clear SBSS section
[libogc.git] / libogc / texconv.c
blobf955b351aa46abda8df490f03bcf1c9eb0585abe
1 /*-------------------------------------------------------------
3 texconv.c - Helper functions for GX texture conversion
5 Copyright (C) 2008
6 softdev
7 Michael Wiedenbauer (shagkur)
8 Dave Murphy (WinterMute)
10 This software is provided 'as-is', without any express or implied
11 warranty. In no event will the authors be held liable for any
12 damages arising from the use of this software.
14 Permission is granted to anyone to use this software for any
15 purpose, including commercial applications, and to alter it and
16 redistribute it freely, subject to the following restrictions:
18 1. The origin of this software must not be misrepresented; you
19 must not claim that you wrote the original software. If you use
20 this software in a product, an acknowledgment in the product
21 documentation would be appreciated but is not required.
23 2. Altered source versions must be plainly marked as such, and
24 must not be misrepresented as being the original software.
26 3. This notice may not be removed or altered from any source
27 distribution.
29 -------------------------------------------------------------*/
30 #include <gctypes.h>
32 void MakeTexture565(const void *src,void *dst,s32 width,s32 height)
34 register u32 tmp0=0,tmp1=0,tmp2=0,tmp3=0;
36 __asm__ __volatile__ (
37 " srwi %6,%6,2\n"
38 " srwi %7,%7,2\n"
39 " subi %3,%4,4\n"
40 " subi %4,%4,8\n"
42 "2: mtctr %6\n"
43 " mr %0,%5\n"
45 "1: lwz %1,0(%5)\n"
46 " stwu %1,8(%4)\n"
47 " lwz %2,4(%5)\n"
48 " stwu %2,8(%3)\n"
50 " lwz %1,1024(%5)\n"
51 " stwu %1,8(%4)\n"
52 " lwz %2,1028(%5)\n"
53 " stwu %2,8(%3)\n"
55 " lwz %1,2048(%5)\n"
56 " stwu %1,8(%4)\n"
57 " lwz %2,2052(%5)\n"
58 " stwu %2,8(%3)\n"
60 " lwz %1,3072(%5)\n"
61 " stwu %1,8(%4)\n"
62 " lwz %2,3076(%5)\n"
63 " stwu %2,8(%3)\n"
65 " addi %5,%5,8\n"
66 " bdnz 1b\n"
68 " addi %5,%0,4096\n"
69 " subic. %7,%7,1\n"
70 " bne 2b"
71 // 0 1 2 3
72 : "=&b"(tmp0), "=&r"(tmp1), "=&r"(tmp2), "=&b"(tmp3)
73 // 4 5 6 7
74 : "b"(dst), "b"(src), "r"(width), "r"(height)
75 : "memory"