Path: blob/master/libmupen64plus/mupen64plus-video-glide64/src/TexLoad4b.h
2 views
/*1* Glide64 - Glide video plugin for Nintendo 64 emulators.2* Copyright (c) 2002 Dave20013* Copyright (c) 2008 Günther <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public16* License along with this program; if not, write to the Free17* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,18* Boston, MA 02110-1301, USA19*/2021//****************************************************************22//23// Glide64 - Glide Plugin for Nintendo 64 emulators (tested mostly with Project64)24// Project started on December 29th, 200125//26// To modify Glide64:27// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.28// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.29//30// Official Glide64 development channel: #Glide64 on EFnet31//32// Original author: Dave2001 ([email protected])33// Other authors: Gonetz, Gugaman34//35//****************************************************************3637//****************************************************************38// Size: 0, Format: 23940DWORD Load4bCI (unsigned char * dst, unsigned char * src, int wid_64, int height, int line, int real_width, int tile)41{42if (wid_64 < 1) wid_64 = 1;43if (height < 1) height = 1;44int ext = (real_width - (wid_64 << 4)) << 1;45unsigned short * pal = (rdp.pal_8 + (rdp.tiles[tile].palette << 4));46if (rdp.tlut_mode == 2)47{48#if !defined(__GNUC__) && !defined(NO_ASM)49__asm {50mov ebx,dword ptr [pal]5152mov esi,dword ptr [src]53mov edi,dword ptr [dst]5455mov ecx,dword ptr [height]56y_loop:57push ecx5859mov ecx,dword ptr [wid_64]60x_loop:61push ecx6263mov eax,dword ptr [esi] // read all 8 pixels64bswap eax65add esi,466mov edx,eax6768// 1st dword output {69shr eax,2370and eax,0x1E71mov cx,word ptr [ebx+eax]72ror cx,173shl ecx,167475mov eax,edx76shr eax,2777and eax,0x1E78mov cx,word ptr [ebx+eax]79ror cx,18081mov dword ptr [edi],ecx82add edi,483// }8485// 2nd dword output {86mov eax,edx87shr eax,1588and eax,0x1E89mov cx,word ptr [ebx+eax]90ror cx,191shl ecx,169293mov eax,edx94shr eax,1995and eax,0x1E96mov cx,word ptr [ebx+eax]97ror cx,19899mov dword ptr [edi],ecx100add edi,4101// }102103// 3rd dword output {104mov eax,edx105shr eax,7106and eax,0x1E107mov cx,word ptr [ebx+eax]108ror cx,1109shl ecx,16110111mov eax,edx112shr eax,11113and eax,0x1E114mov cx,word ptr [ebx+eax]115ror cx,1116117mov dword ptr [edi],ecx118add edi,4119// }120121// 4th dword output {122mov eax,edx123shl eax,1124and eax,0x1E125mov cx,word ptr [ebx+eax]126ror cx,1127shl ecx,16128129shr edx,3130and edx,0x1E131mov cx,word ptr [ebx+edx]132ror cx,1133134mov dword ptr [edi],ecx135add edi,4136// }137138// * copy139mov eax,dword ptr [esi] // read all 8 pixels140bswap eax141add esi,4142mov edx,eax143144// 1st dword output {145shr eax,23146and eax,0x1E147mov cx,word ptr [ebx+eax]148ror cx,1149shl ecx,16150151mov eax,edx152shr eax,27153and eax,0x1E154mov cx,word ptr [ebx+eax]155ror cx,1156157mov dword ptr [edi],ecx158add edi,4159// }160161// 2nd dword output {162mov eax,edx163shr eax,15164and eax,0x1E165mov cx,word ptr [ebx+eax]166ror cx,1167shl ecx,16168169mov eax,edx170shr eax,19171and eax,0x1E172mov cx,word ptr [ebx+eax]173ror cx,1174175mov dword ptr [edi],ecx176add edi,4177// }178179// 3rd dword output {180mov eax,edx181shr eax,7182and eax,0x1E183mov cx,word ptr [ebx+eax]184ror cx,1185shl ecx,16186187mov eax,edx188shr eax,11189and eax,0x1E190mov cx,word ptr [ebx+eax]191ror cx,1192193mov dword ptr [edi],ecx194add edi,4195// }196197// 4th dword output {198mov eax,edx199shl eax,1200and eax,0x1E201mov cx,word ptr [ebx+eax]202ror cx,1203shl ecx,16204205shr edx,3206and edx,0x1E207mov cx,word ptr [ebx+edx]208ror cx,1209210mov dword ptr [edi],ecx211add edi,4212// }213// *214215pop ecx216217dec ecx218jnz x_loop219220pop ecx221dec ecx222jz end_y_loop223push ecx224225add esi,dword ptr [line]226add edi,dword ptr [ext]227228mov ecx,dword ptr [wid_64]229x_loop_2:230push ecx231232mov eax,dword ptr [esi+4] // read all 8 pixels233bswap eax234mov edx,eax235236// 1st dword output {237shr eax,23238and eax,0x1E239mov cx,word ptr [ebx+eax]240ror cx,1241shl ecx,16242243mov eax,edx244shr eax,27245and eax,0x1E246mov cx,word ptr [ebx+eax]247ror cx,1248249mov dword ptr [edi],ecx250add edi,4251// }252253// 2nd dword output {254mov eax,edx255shr eax,15256and eax,0x1E257mov cx,word ptr [ebx+eax]258ror cx,1259shl ecx,16260261mov eax,edx262shr eax,19263and eax,0x1E264mov cx,word ptr [ebx+eax]265ror cx,1266267mov dword ptr [edi],ecx268add edi,4269// }270271// 3rd dword output {272mov eax,edx273shr eax,7274and eax,0x1E275mov cx,word ptr [ebx+eax]276ror cx,1277shl ecx,16278279mov eax,edx280shr eax,11281and eax,0x1E282mov cx,word ptr [ebx+eax]283ror cx,1284285mov dword ptr [edi],ecx286add edi,4287// }288289// 4th dword output {290mov eax,edx291shl eax,1292and eax,0x1E293mov cx,word ptr [ebx+eax]294ror cx,1295shl ecx,16296297shr edx,3298and edx,0x1E299mov cx,word ptr [ebx+edx]300ror cx,1301302mov dword ptr [edi],ecx303add edi,4304// }305306// * copy307mov eax,dword ptr [esi] // read all 8 pixels308bswap eax309add esi,8310mov edx,eax311312// 1st dword output {313shr eax,23314and eax,0x1E315mov cx,word ptr [ebx+eax]316ror cx,1317shl ecx,16318319mov eax,edx320shr eax,27321and eax,0x1E322mov cx,word ptr [ebx+eax]323ror cx,1324325mov dword ptr [edi],ecx326add edi,4327// }328329// 2nd dword output {330mov eax,edx331shr eax,15332and eax,0x1E333mov cx,word ptr [ebx+eax]334ror cx,1335shl ecx,16336337mov eax,edx338shr eax,19339and eax,0x1E340mov cx,word ptr [ebx+eax]341ror cx,1342343mov dword ptr [edi],ecx344add edi,4345// }346347// 3rd dword output {348mov eax,edx349shr eax,7350and eax,0x1E351mov cx,word ptr [ebx+eax]352ror cx,1353shl ecx,16354355mov eax,edx356shr eax,11357and eax,0x1E358mov cx,word ptr [ebx+eax]359ror cx,1360361mov dword ptr [edi],ecx362add edi,4363// }364365// 4th dword output {366mov eax,edx367shl eax,1368and eax,0x1E369mov cx,word ptr [ebx+eax]370ror cx,1371shl ecx,16372373shr edx,3374and edx,0x1E375mov cx,word ptr [ebx+edx]376ror cx,1377378mov dword ptr [edi],ecx379add edi,4380// }381// *382383pop ecx384385dec ecx386jnz x_loop_2387388add esi,dword ptr [line]389add edi,dword ptr [ext]390391pop ecx392dec ecx393jnz y_loop394395end_y_loop:396}397#elif !defined(NO_ASM)398//printf("Load4bCI1\n");399// This way, gcc generates either a 32 bit or a 64 bit register400long lTempX, lTempY, lHeight = (long) height;401intptr_t fake_eax, fake_edx;402asm volatile (403"1: \n" // y_loop404"mov %[c], %[tempy] \n"405406"mov %[wid_64], %%ecx \n"407"2: \n" // x_loop408"mov %[c], %[tempx] \n"409410"mov (%[src]), %%eax \n" // read all 8 pixels411"bswap %%eax \n"412"add $4, %[src] \n"413"mov %%eax, %%edx \n"414415// 1st dword output {416"shr $23, %%eax \n"417"and $0x1E, %%eax \n"418"mov (%[pal],%[a]), %%cx \n"419"ror $1, %%cx \n"420"shl $16, %%ecx \n"421422"mov %%edx, %%eax \n"423"shr $27, %%eax \n"424"and $0x1E, %%eax \n"425"mov (%[pal],%[a]), %%cx \n"426"ror $1, %%cx \n"427428"mov %%ecx, (%[dst]) \n"429"add $4, %[dst] \n"430// }431432// 2nd dword output {433"mov %%edx, %%eax \n"434"shr $15, %%eax \n"435"and $0x1E, %%eax \n"436"mov (%[pal],%[a]), %%cx \n"437"ror $1, %%cx \n"438"shl $16, %%ecx \n"439440"mov %%edx, %%eax \n"441"shr $19, %%eax \n"442"and $0x1E, %%eax \n"443"mov (%[pal],%[a]), %%cx \n"444"ror $1, %%cx \n"445446"mov %%ecx, (%[dst]) \n"447"add $4, %[dst] \n"448// }449450// 3rd dword output {451"mov %%edx, %%eax \n"452"shr $7,%%eax \n"453"and $0x1E, %%eax \n"454"mov (%[pal],%[a]),%%cx \n"455"ror $1,%%cx \n"456"shl $16,%%ecx \n"457458"mov %%edx, %%eax \n"459"shr $11, %%eax \n"460"and $0x1E, %%eax \n"461"mov (%[pal],%[a]), %%cx \n"462"ror $1, %%cx \n"463464"mov %%ecx, (%[dst]) \n"465"add $4, %[dst] \n"466// }467468// 4th dword output {469"mov %%edx, %%eax \n"470"shl $1, %%eax \n"471"and $0x1E, %%eax \n"472"mov (%[pal],%[a]), %%cx \n"473"ror $1, %%cx \n"474"shl $16, %%ecx \n"475476"shr $3, %%edx \n"477"and $0x1E, %%edx \n"478"mov (%[pal],%[d]), %%cx \n"479"ror $1, %%cx \n"480481"mov %%ecx, (%[dst]) \n"482"add $4, %[dst] \n"483// }484485// * copy486"mov (%[src]), %%eax \n" // read all 8 pixels487"bswap %%eax \n"488"add $4, %[src] \n"489"mov %%eax, %%edx \n"490491// 1st dword output {492"shr $23, %%eax \n"493"and $0x1E, %%eax \n"494"mov (%[pal],%[a]), %%cx \n"495"ror $1, %%cx \n"496"shl $16, %%ecx \n"497498"mov %%edx, %%eax \n"499"shr $27, %%eax \n"500"and $0x1E, %%eax \n"501"mov (%[pal],%[a]), %%cx \n"502"ror $1, %%cx \n"503504"mov %%ecx, (%[dst]) \n"505"add $4, %[dst] \n"506// }507508// 2nd dword output {509"mov %%edx, %%eax \n"510"shr $15, %%eax \n"511"and $0x1E, %%eax \n"512"mov (%[pal],%[a]), %%cx \n"513"ror $1, %%cx \n"514"shl $16, %%ecx \n"515516"mov %%edx, %%eax \n"517"shr $19, %%eax \n"518"and $0x1E, %%eax \n"519"mov (%[pal],%[a]), %%cx \n"520"ror $1, %%cx \n"521522"mov %%ecx, (%[dst]) \n"523"add $4, %[dst] \n"524// }525526// 3rd dword output {527"mov %%edx, %%eax \n"528"shr $7, %%eax \n"529"and $0x1E, %%eax \n"530"mov (%[pal],%[a]), %%cx \n"531"ror $1, %%cx \n"532"shl $16, %%ecx \n"533534"mov %%edx, %%eax \n"535"shr $11, %%eax \n"536"and $0x1E, %%eax \n"537"mov (%[pal],%[a]), %%cx \n"538"ror $1, %%cx \n"539540"mov %%ecx, (%[dst]) \n"541"add $4, %[dst] \n"542// }543544// 4th dword output {545"mov %%edx, %%eax \n"546"shl $1, %%eax \n"547"and $0x1E, %%eax \n"548"mov (%[pal],%[a]), %%cx \n"549"ror $1, %%cx \n"550"shl $16, %%ecx \n"551552"shr $3, %%edx \n"553"and $0x1E, %%edx \n"554"mov (%[pal],%[d]), %%cx \n"555"ror $1, %%cx \n"556557"mov %%ecx, (%[dst]) \n"558"add $4, %[dst] \n"559// }560// *561562"mov %[tempx], %[c] \n"563564"dec %%ecx \n"565"jnz 2b \n" // x_loop566567"mov %[tempy], %[c] \n"568"dec %%ecx \n"569"jz 4f \n" // end_y_loop570"mov %[c], %[tempy] \n"571572"add %[line], %[src] \n"573"add %[ext], %[dst] \n"574575"mov %[wid_64], %%ecx \n"576"3: \n" // x_loop_2577"mov %[c], %[tempx] \n"578579"mov 4(%[src]), %%eax \n" // read all 8 pixels580"bswap %%eax \n"581"mov %%eax, %%edx \n"582583// 1st dword output {584"shr $23, %%eax \n"585"and $0x1E, %%eax \n"586"mov (%[pal],%[a]), %%cx \n"587"ror $1, %%cx \n"588"shl $16, %%ecx \n"589590"mov %%edx, %%eax \n"591"shr $27, %%eax \n"592"and $0x1E, %%eax \n"593"mov (%[pal],%[a]), %%cx \n"594"ror $1, %%cx \n"595596"mov %%ecx, (%[dst]) \n"597"add $4, %[dst] \n"598// }599600// 2nd dword output {601"mov %%edx, %%eax \n"602"shr $15, %%eax \n"603"and $0x1E, %%eax \n"604"mov (%[pal],%[a]), %%cx \n"605"ror $1, %%cx \n"606"shl $16, %%ecx \n"607608"mov %%edx, %%eax \n"609"shr $19, %%eax \n"610"and $0x1E, %%eax \n"611"mov (%[pal],%[a]), %%cx \n"612"ror $1, %%cx \n"613614"mov %%ecx, (%[dst]) \n"615"add $4, %[dst] \n"616// }617618// 3rd dword output {619"mov %%edx, %%eax \n"620"shr $7, %%eax \n"621"and $0x1E, %%eax \n"622"mov (%[pal],%[a]), %%cx \n"623"ror $1, %%cx \n"624"shl $16, %%ecx \n"625626"mov %%edx, %%eax \n"627"shr $11, %%eax \n"628"and $0x1E, %%eax \n"629"mov (%[pal],%[a]), %%cx \n"630"ror $1, %%cx \n"631632"mov %%ecx, (%[dst]) \n"633"add $4, %[dst] \n"634// }635636// 4th dword output {637"mov %%edx, %%eax \n"638"shl $1, %%eax \n"639"and $0x1E, %%eax \n"640"mov (%[pal],%[a]), %%cx \n"641"ror $1, %%cx \n"642"shl $16, %%ecx \n"643644"shr $3, %%edx \n"645"and $0x1E, %%edx \n"646"mov (%[pal],%[d]), %%cx \n"647"ror $1, %%cx \n"648649"mov %%ecx, (%[dst]) \n"650"add $4, %[dst] \n"651// }652653// * copy654"mov (%[src]), %%eax \n" // read all 8 pixels655"bswap %%eax \n"656"add $8, %[src] \n"657"mov %%eax, %%edx \n"658659// 1st dword output {660"shr $23, %%eax \n"661"and $0x1E, %%eax \n"662"mov (%[pal],%[a]), %%cx \n"663"ror $1, %%cx \n"664"shl $16, %%ecx \n"665666"mov %%edx, %%eax \n"667"shr $27, %%eax \n"668"and $0x1E, %%eax \n"669"mov (%[pal],%[a]), %%cx \n"670"ror $1, %%cx \n"671672"mov %%ecx, (%[dst]) \n"673"add $4, %[dst] \n"674// }675676// 2nd dword output {677"mov %%edx, %%eax \n"678"shr $15, %%eax \n"679"and $0x1E, %%eax \n"680"mov (%[pal],%[a]), %%cx \n"681"ror $1, %%cx \n"682"shl $16, %%ecx \n"683684"mov %%edx, %%eax \n"685"shr $19, %%eax \n"686"and $0x1E, %%eax \n"687"mov (%[pal],%[a]), %%cx \n"688"ror $1, %%cx \n"689690"mov %%ecx, (%[dst]) \n"691"add $4, %[dst] \n"692// }693694// 3rd dword output {695"mov %%edx, %%eax \n"696"shr $7, %%eax \n"697"and $0x1E, %%eax \n"698"mov (%[pal],%[a]), %%cx \n"699"ror $1, %%cx \n"700"shl $16, %%ecx \n"701702"mov %%edx, %%eax \n"703"shr $11, %%eax \n"704"and $0x1E, %%eax \n"705"mov (%[pal],%[a]), %%cx \n"706"ror $1, %%cx \n"707708"mov %%ecx, (%[dst]) \n"709"add $4, %[dst] \n"710// }711712// 4th dword output {713"mov %%edx, %%eax \n"714"shl $1, %%eax \n"715"and $0x1E, %%eax \n"716"mov (%[pal],%[a]), %%cx \n"717"ror $1, %%cx \n"718"shl $16, %%ecx \n"719720"shr $3, %%edx \n"721"and $0x1E, %%edx \n"722"mov (%[pal],%[d]), %%cx \n"723"ror $1, %%cx \n"724725"mov %%ecx, (%[dst]) \n"726"add $4, %[dst] \n"727// }728// *729730"mov %[tempx], %[c] \n"731732"dec %%ecx \n"733"jnz 3b \n" // x_loop_2734735"add %[line], %[src] \n"736"add %[ext], %[dst] \n"737738"mov %[tempy], %[c] \n"739"dec %%ecx \n"740"jnz 1b \n" // y_loop741742"4: \n" // end_y_loop743: [tempx]"=m"(lTempX), [tempy]"=m"(lTempY), [a] "=&a"(fake_eax), [d] "=&d"(fake_edx), [src] "+S"(src), [dst] "+D"(dst), [c] "+c"(lHeight)744// pal needs to be in a register because its used in mov (%[pal],...), ...745: [pal] "r" (pal), [wid_64] "g" (wid_64), [line] "g" ((uintptr_t)line), [ext] "g" ((uintptr_t)ext)746: "memory", "cc"747);748#endif749}750else751{752#if !defined(__GNUC__) && !defined(NO_ASM)753__asm {754mov ebx,dword ptr [pal]755756mov esi,dword ptr [src]757mov edi,dword ptr [dst]758759mov ecx,dword ptr [height]760ia_y_loop:761push ecx762763mov ecx,dword ptr [wid_64]764ia_x_loop:765push ecx766767mov eax,dword ptr [esi] // read all 8 pixels768bswap eax769add esi,4770mov edx,eax771772// 1st dword output {773shr eax,23774and eax,0x1E775mov cx,word ptr [ebx+eax]776ror cx,8777shl ecx,16778779mov eax,edx780shr eax,27781and eax,0x1E782mov cx,word ptr [ebx+eax]783ror cx,8784785mov dword ptr [edi],ecx786add edi,4787// }788789// 2nd dword output {790mov eax,edx791shr eax,15792and eax,0x1E793mov cx,word ptr [ebx+eax]794ror cx,8795shl ecx,16796797mov eax,edx798shr eax,19799and eax,0x1E800mov cx,word ptr [ebx+eax]801ror cx,8802803mov dword ptr [edi],ecx804add edi,4805// }806807// 3rd dword output {808mov eax,edx809shr eax,7810and eax,0x1E811mov cx,word ptr [ebx+eax]812ror cx,8813shl ecx,16814815mov eax,edx816shr eax,11817and eax,0x1E818mov cx,word ptr [ebx+eax]819ror cx,8820821mov dword ptr [edi],ecx822add edi,4823// }824825// 4th dword output {826mov eax,edx827shl eax,1828and eax,0x1E829mov cx,word ptr [ebx+eax]830ror cx,8831shl ecx,16832833shr edx,3834and edx,0x1E835mov cx,word ptr [ebx+edx]836ror cx,8837838mov dword ptr [edi],ecx839add edi,4840// }841842// * copy843mov eax,dword ptr [esi] // read all 8 pixels844bswap eax845add esi,4846mov edx,eax847848// 1st dword output {849shr eax,23850and eax,0x1E851mov cx,word ptr [ebx+eax]852ror cx,8853shl ecx,16854855mov eax,edx856shr eax,27857and eax,0x1E858mov cx,word ptr [ebx+eax]859ror cx,8860861mov dword ptr [edi],ecx862add edi,4863// }864865// 2nd dword output {866mov eax,edx867shr eax,15868and eax,0x1E869mov cx,word ptr [ebx+eax]870ror cx,8871shl ecx,16872873mov eax,edx874shr eax,19875and eax,0x1E876mov cx,word ptr [ebx+eax]877ror cx,8878879mov dword ptr [edi],ecx880add edi,4881// }882883// 3rd dword output {884mov eax,edx885shr eax,7886and eax,0x1E887mov cx,word ptr [ebx+eax]888ror cx,8889shl ecx,16890891mov eax,edx892shr eax,11893and eax,0x1E894mov cx,word ptr [ebx+eax]895ror cx,8896897mov dword ptr [edi],ecx898add edi,4899// }900901// 4th dword output {902mov eax,edx903shl eax,1904and eax,0x1E905mov cx,word ptr [ebx+eax]906ror cx,8907shl ecx,16908909shr edx,3910and edx,0x1E911mov cx,word ptr [ebx+edx]912ror cx,8913914mov dword ptr [edi],ecx915add edi,4916// }917// *918919pop ecx920921dec ecx922jnz ia_x_loop923924pop ecx925dec ecx926jz ia_end_y_loop927push ecx928929add esi,dword ptr [line]930add edi,dword ptr [ext]931932mov ecx,dword ptr [wid_64]933ia_x_loop_2:934push ecx935936mov eax,dword ptr [esi+4] // read all 8 pixels937bswap eax938mov edx,eax939940// 1st dword output {941shr eax,23942and eax,0x1E943mov cx,word ptr [ebx+eax]944ror cx,8945shl ecx,16946947mov eax,edx948shr eax,27949and eax,0x1E950mov cx,word ptr [ebx+eax]951ror cx,8952953mov dword ptr [edi],ecx954add edi,4955// }956957// 2nd dword output {958mov eax,edx959shr eax,15960and eax,0x1E961mov cx,word ptr [ebx+eax]962ror cx,8963shl ecx,16964965mov eax,edx966shr eax,19967and eax,0x1E968mov cx,word ptr [ebx+eax]969ror cx,8970971mov dword ptr [edi],ecx972add edi,4973// }974975// 3rd dword output {976mov eax,edx977shr eax,7978and eax,0x1E979mov cx,word ptr [ebx+eax]980ror cx,8981shl ecx,16982983mov eax,edx984shr eax,11985and eax,0x1E986mov cx,word ptr [ebx+eax]987ror cx,8988989mov dword ptr [edi],ecx990add edi,4991// }992993// 4th dword output {994mov eax,edx995shl eax,1996and eax,0x1E997mov cx,word ptr [ebx+eax]998ror cx,8999shl ecx,1610001001shr edx,31002and edx,0x1E1003mov cx,word ptr [ebx+edx]1004ror cx,810051006mov dword ptr [edi],ecx1007add edi,41008// }10091010// * copy1011mov eax,dword ptr [esi] // read all 8 pixels1012bswap eax1013add esi,81014mov edx,eax10151016// 1st dword output {1017shr eax,231018and eax,0x1E1019mov cx,word ptr [ebx+eax]1020ror cx,81021shl ecx,1610221023mov eax,edx1024shr eax,271025and eax,0x1E1026mov cx,word ptr [ebx+eax]1027ror cx,810281029mov dword ptr [edi],ecx1030add edi,41031// }10321033// 2nd dword output {1034mov eax,edx1035shr eax,151036and eax,0x1E1037mov cx,word ptr [ebx+eax]1038ror cx,81039shl ecx,1610401041mov eax,edx1042shr eax,191043and eax,0x1E1044mov cx,word ptr [ebx+eax]1045ror cx,810461047mov dword ptr [edi],ecx1048add edi,41049// }10501051// 3rd dword output {1052mov eax,edx1053shr eax,71054and eax,0x1E1055mov cx,word ptr [ebx+eax]1056ror cx,81057shl ecx,1610581059mov eax,edx1060shr eax,111061and eax,0x1E1062mov cx,word ptr [ebx+eax]1063ror cx,810641065mov dword ptr [edi],ecx1066add edi,41067// }10681069// 4th dword output {1070mov eax,edx1071shl eax,11072and eax,0x1E1073mov cx,word ptr [ebx+eax]1074ror cx,81075shl ecx,1610761077shr edx,31078and edx,0x1E1079mov cx,word ptr [ebx+edx]1080ror cx,810811082mov dword ptr [edi],ecx1083add edi,41084// }1085// *10861087pop ecx10881089dec ecx1090jnz ia_x_loop_210911092add esi,dword ptr [line]1093add edi,dword ptr [ext]10941095pop ecx1096dec ecx1097jnz ia_y_loop10981099ia_end_y_loop:1100}1101#elif !defined(NO_ASM)1102//printf("Load4bCI2\n");1103long lTempX, lTempY, lHeight = (long) height;1104intptr_t fake_eax, fake_edx;1105asm volatile (1106"1: \n" // ia_y_loop1107"mov %[c], %[tempy] \n"11081109"mov %[wid_64], %%ecx \n"1110"2: \n" // ia_x_loop1111"mov %[c], %[tempx] \n"11121113"mov (%[src]), %%eax \n" // read all 8 pixels1114"bswap %%eax \n"1115"add $4, %[src] \n"1116"mov %%eax, %%edx \n"11171118// 1st dword output {1119"shr $23, %%eax \n"1120"and $0x1E, %%eax \n"1121"mov (%[pal],%[a]), %%cx \n"1122"ror $8, %%cx \n"1123"shl $16, %%ecx \n"11241125"mov %%edx, %%eax \n"1126"shr $27, %%eax \n"1127"and $0x1E, %%eax \n"1128"mov (%[pal],%[a]), %%cx \n"1129"ror $8, %%cx \n"11301131"mov %%ecx, (%[dst]) \n"1132"add $4, %[dst] \n"1133// }11341135// 2nd dword output {1136"mov %%edx, %%eax \n"1137"shr $15, %%eax \n"1138"and $0x1E, %%eax \n"1139"mov (%[pal],%[a]), %%cx \n"1140"ror $8, %%cx \n"1141"shl $16, %%ecx \n"11421143"mov %%edx, %%eax \n"1144"shr $19, %%eax \n"1145"and $0x1E, %%eax \n"1146"mov (%[pal],%[a]), %%cx \n"1147"ror $8, %%cx \n"11481149"mov %%ecx, (%[dst]) \n"1150"add $4, %[dst] \n"1151// }11521153// 3rd dword output {1154"mov %%edx, %%eax \n"1155"shr $7, %%eax \n"1156"and $0x1E, %%eax \n"1157"mov (%[pal],%[a]), %%cx \n"1158"ror $8, %%cx \n"1159"shl $16, %%ecx \n"11601161"mov %%edx, %%eax \n"1162"shr $11, %%eax \n"1163"and $0x1E, %%eax \n"1164"mov (%[pal],%[a]), %%cx \n"1165"ror $8, %%cx \n"11661167"mov %%ecx, (%[dst]) \n"1168"add $4, %[dst] \n"1169// }11701171// 4th dword output {1172"mov %%edx, %%eax \n"1173"shl $1, %%eax \n"1174"and $0x1E, %%eax \n"1175"mov (%[pal],%[a]), %%cx \n"1176"ror $8, %%cx \n"1177"shl $16, %%ecx \n"11781179"shr $3, %%edx \n"1180"and $0x1E, %%edx \n"1181"mov (%[pal],%[d]), %%cx \n"1182"ror $8, %%cx \n"11831184"mov %%ecx, (%[dst]) \n"1185"add $4, %[dst] \n"1186// }11871188// * copy1189"mov (%[src]), %%eax \n" // read all 8 pixels1190"bswap %%eax \n"1191"add $4, %[src] \n"1192"mov %%eax, %%edx \n"11931194// 1st dword output {1195"shr $23, %%eax \n"1196"and $0x1E, %%eax \n"1197"mov (%[pal],%[a]), %%cx \n"1198"ror $8, %%cx \n"1199"shl $16, %%ecx \n"12001201"mov %%edx, %%eax \n"1202"shr $27, %%eax \n"1203"and $0x1E, %%eax \n"1204"mov (%[pal],%[a]), %%cx \n"1205"ror $8, %%cx \n"12061207"mov %%ecx, (%[dst]) \n"1208"add $4, %[dst] \n"1209// }12101211// 2nd dword output {1212"mov %%edx, %%eax \n"1213"shr $15, %%eax \n"1214"and $0x1E, %%eax \n"1215"mov (%[pal],%[a]), %%cx \n"1216"ror $8, %%cx \n"1217"shl $16, %%ecx \n"12181219"mov %%edx, %%eax \n"1220"shr $19, %%eax \n"1221"and $0x1E, %%eax \n"1222"mov (%[pal],%[a]), %%cx \n"1223"ror $8, %%cx \n"12241225"mov %%ecx, (%[dst]) \n"1226"add $4, %[dst] \n"1227// }12281229// 3rd dword output {1230"mov %%edx, %%eax \n"1231"shr $7, %%eax \n"1232"and $0x1E, %%eax \n"1233"mov (%[pal],%[a]), %%cx \n"1234"ror $8,%%cx \n"1235"shl $16, %%ecx \n"12361237"mov %%edx, %%eax \n"1238"shr $11, %%eax \n"1239"and $0x1E, %%eax \n"1240"mov (%[pal],%[a]), %%cx \n"1241"ror $8, %%cx \n"12421243"mov %%ecx, (%[dst]) \n"1244"add $4, %[dst] \n"1245// }12461247// 4th dword output {1248"mov %%edx, %%eax \n"1249"shl $1, %%eax \n"1250"and $0x1E, %%eax \n"1251"mov (%[pal],%[a]), %%cx \n"1252"ror $8, %%cx \n"1253"shl $16, %%ecx \n"12541255"shr $3, %%edx \n"1256"and $0x1E, %%edx \n"1257"mov (%[pal],%[d]), %%cx \n"1258"ror $8, %%cx \n"12591260"mov %%ecx, (%[dst]) \n"1261"add $4, %[dst] \n"1262// }1263// *12641265"mov %[tempx], %[c] \n"12661267"dec %%ecx \n"1268"jnz 2b \n" // ia_x_loop12691270"mov %[tempy], %[c] \n"1271"dec %%ecx \n"1272"jz 4f \n" // ia_end_y_loop1273"mov %[c], %[tempy] \n"12741275"add %[line], %[src] \n"1276"add %[ext], %[dst] \n"12771278"mov %[wid_64], %%ecx \n"1279"3: \n" // ia_x_loop_21280"mov %[c], %[tempx] \n"12811282"mov 4(%[src]), %%eax \n" // read all 8 pixels1283"bswap %%eax \n"1284"mov %%eax, %%edx \n"12851286// 1st dword output {1287"shr $23, %%eax \n"1288"and $0x1E, %%eax \n"1289"mov (%[pal],%[a]), %%cx \n"1290"ror $8, %%cx \n"1291"shl $16, %%ecx \n"12921293"mov %%edx, %%eax \n"1294"shr $27, %%eax \n"1295"and $0x1E, %%eax \n"1296"mov (%[pal],%[a]), %%cx \n"1297"ror $8, %%cx \n"12981299"mov %%ecx, (%[dst]) \n"1300"add $4, %[dst] \n"1301// }13021303// 2nd dword output {1304"mov %%edx, %%eax \n"1305"shr $15, %%eax \n"1306"and $0x1E, %%eax \n"1307"mov (%[pal],%[a]), %%cx \n"1308"ror $8, %%cx \n"1309"shl $16, %%ecx \n"13101311"mov %%edx, %%eax \n"1312"shr $19, %%eax \n"1313"and $0x1E, %%eax \n"1314"mov (%[pal],%[a]), %%cx \n"1315"ror $8, %%cx \n"13161317"mov %%ecx, (%[dst]) \n"1318"add $4, %[dst] \n"1319// }13201321// 3rd dword output {1322"mov %%edx, %%eax \n"1323"shr $7, %%eax \n"1324"and $0x1E, %%eax \n"1325"mov (%[pal],%[a]), %%cx \n"1326"ror $8, %%cx \n"1327"shl $16, %%ecx \n"13281329"mov %%edx, %%eax \n"1330"shr $11, %%eax \n"1331"and $0x1E, %%eax \n"1332"mov (%[pal],%[a]), %%cx \n"1333"ror $8, %%cx \n"13341335"mov %%ecx, (%[dst]) \n"1336"add $4, %[dst] \n"1337// }13381339// 4th dword output {1340"mov %%edx, %%eax \n"1341"shl $1, %%eax \n"1342"and $0x1E, %%eax \n"1343"mov (%[pal],%[a]), %%cx \n"1344"ror $8, %%cx \n"1345"shl $16, %%ecx \n"13461347"shr $3, %%edx \n"1348"and $0x1E, %%edx \n"1349"mov (%[pal],%[d]), %%cx \n"1350"ror $8, %%cx \n"13511352"mov %%ecx, (%[dst]) \n"1353"add $4, %[dst] \n"1354// }13551356// * copy1357"mov (%[src]), %%eax \n" // read all 8 pixels1358"bswap %%eax \n"1359"add $8, %[src] \n"1360"mov %%eax, %%edx \n"13611362// 1st dword output {1363"shr $23, %%eax \n"1364"and $0x1E, %%eax \n"1365"mov (%[pal],%[a]), %%cx \n"1366"ror $8, %%cx \n"1367"shl $16, %%ecx \n"13681369"mov %%edx, %%eax \n"1370"shr $27, %%eax \n"1371"and $0x1E, %%eax \n"1372"mov (%[pal],%[a]), %%cx \n"1373"ror $8, %%cx \n"13741375"mov %%ecx, (%[dst]) \n"1376"add $4, %[dst] \n"1377// }13781379// 2nd dword output {1380"mov %%edx, %%eax \n"1381"shr $15, %%eax \n"1382"and $0x1E, %%eax \n"1383"mov (%[pal],%[a]), %%cx \n"1384"ror $8, %%cx \n"1385"shl $16, %%ecx \n"13861387"mov %%edx, %%eax \n"1388"shr $19, %%eax \n"1389"and $0x1E, %%eax \n"1390"mov (%[pal],%[a]), %%cx \n"1391"ror $8, %%cx \n"13921393"mov %%ecx, (%[dst]) \n"1394"add $4, %[dst] \n"1395// }13961397// 3rd dword output {1398"mov %%edx, %%eax \n"1399"shr $7, %%eax \n"1400"and $0x1E, %%eax \n"1401"mov (%[pal],%[a]), %%cx \n"1402"ror $8, %%cx \n"1403"shl $16, %%ecx \n"14041405"mov %%edx, %%eax \n"1406"shr $11, %%eax \n"1407"and $0x1E, %%eax \n"1408"mov (%[pal],%[a]), %%cx \n"1409"ror $8, %%cx \n"14101411"mov %%ecx, (%[dst]) \n"1412"add $4, %[dst] \n"1413// }14141415// 4th dword output {1416"mov %%edx, %%eax \n"1417"shl $1, %%eax \n"1418"and $0x1E, %%eax \n"1419"mov (%[pal],%[a]), %%cx \n"1420"ror $8, %%cx \n"1421"shl $16, %%ecx \n"14221423"shr $3, %%edx \n"1424"and $0x1E, %%edx \n"1425"mov (%[pal],%[d]), %%cx \n"1426"ror $8, %%cx \n"14271428"mov %%ecx, (%[dst]) \n"1429"add $4, %[dst] \n"1430// }1431// *14321433"mov %[tempx], %[c] \n"14341435"dec %%ecx \n"1436"jnz 3b \n" // ia_x_loop_214371438"add %[line], %[src] \n"1439"add %[ext], %[dst] \n"14401441"mov %[tempy], %[c] \n"1442"dec %%ecx \n"1443"jnz 1b \n" // ia_y_loop14441445"4: \n" // ia_end_y_loop1446: [tempx]"=m"(lTempX), [tempy]"=m"(lTempY), [a] "=&a"(fake_eax), [d] "=&d"(fake_edx), [src] "+S"(src), [dst] "+D"(dst), [c] "+c"(lHeight)1447// pal needs to be in a register because its used in mov (%[pal],...), ...1448: [pal] "r" (pal), [wid_64] "g" (wid_64), [line] "g" ((uintptr_t)line), [ext] "g" ((uintptr_t)ext)1449: "memory", "cc"1450);1451#endif1452return (1 << 16) | GR_TEXFMT_ALPHA_INTENSITY_88;1453}14541455return (1 << 16) | GR_TEXFMT_ARGB_1555;1456}14571458//****************************************************************1459// Size: 0, Format: 31460//1461// ** BY GUGAMAN **14621463DWORD Load4bIA (unsigned char * dst, unsigned char * src, int wid_64, int height, int line, int real_width, int tile)1464{1465if (rdp.tlut_mode != 0)1466return Load4bCI (dst, src, wid_64, height, line, real_width, tile);14671468if (wid_64 < 1) wid_64 = 1;1469if (height < 1) height = 1;1470int ext = (real_width - (wid_64 << 4));1471#if !defined(__GNUC__) && !defined(NO_ASM)1472__asm {1473mov esi,dword ptr [src]1474mov edi,dword ptr [dst]14751476mov ecx,dword ptr [height]1477y_loop:1478push ecx14791480mov ecx,dword ptr [wid_64]1481x_loop:1482push ecx14831484mov eax,dword ptr [esi] // read all 8 pixels1485bswap eax1486add esi,41487mov edx,eax14881489// 1st dword {1490xor ecx,ecx14911492// pixel #11493// IIIAxxxxxxxxxxxxxxxxxxxxxxxxxxxx1494// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII1495mov eax,edx1496shr eax,24 //Alpha1497and eax,0x000000101498or ecx,eax1499shl eax,11500or ecx,eax1501shl eax,11502or ecx,eax1503shl eax,11504or ecx,eax1505mov eax,edx1506shr eax,28 // Intensity1507and eax,0x0000000E1508or ecx,eax1509shr eax,31510or ecx,eax15111512// pixel #21513// xxxxIIIAxxxxxxxxxxxxxxxxxxxxxxxx1514// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx1515mov eax,edx1516shr eax,12 //Alpha1517and eax,0x000010001518or ecx,eax1519shl eax,11520or ecx,eax1521shl eax,11522or ecx,eax1523shl eax,11524or ecx,eax1525mov eax,edx1526shr eax,16 // Intensity1527and eax,0x00000E001528or ecx,eax1529shr eax,31530and eax,0x000001001531or ecx,eax15321533// pixel #31534// xxxxxxxxIIIAxxxxxxxxxxxxxxxxxxxx1535// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx1536//Alpha1537mov eax,edx1538and eax,0x001000001539or ecx,eax1540shl eax,11541or ecx,eax1542shl eax,11543or ecx,eax1544shl eax,11545or ecx,eax1546mov eax,edx1547shr eax,4 // Intensity1548and eax,0x000E00001549or ecx,eax1550shr eax,31551and eax,0x000100001552or ecx,eax15531554// pixel #41555// xxxxxxxxxxxxIIIAxxxxxxxxxxxxxxxx1556// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx1557mov eax,edx1558shl eax,12 //Alpha1559and eax,0x100000001560or ecx,eax1561shl eax,11562or ecx,eax1563shl eax,11564or ecx,eax1565shl eax,11566or ecx,eax1567mov eax,edx1568shl eax,8 // Intensity1569and eax,0x0E0000001570or ecx,eax1571shr eax,31572and eax,0x010000001573or ecx,eax157415751576mov dword ptr [edi],ecx1577add edi,41578// }15791580// 2nd dword {1581xor ecx,ecx15821583// pixel #51584// xxxxxxxxxxxxxxxxIIIAxxxxxxxxxxxx1585// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII1586mov eax,edx1587shr eax,8 //Alpha1588and eax,0x000000101589or ecx,eax1590shl eax,11591or ecx,eax1592shl eax,11593or ecx,eax1594shl eax,11595or ecx,eax1596mov eax,edx1597shr eax,12 // Intensity1598and eax,0x0000000E1599or ecx,eax1600shr eax,31601or ecx,eax16021603// pixel #61604// xxxxxxxxxxxxxxxxxxxxIIIAxxxxxxxx1605// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx1606//Alpha1607mov eax,edx1608shl eax,41609and eax,0x000010001610or ecx,eax1611shl eax,11612or ecx,eax1613shl eax,11614or ecx,eax1615shl eax,11616or ecx,eax1617mov eax,edx // Intensity1618and eax,0x00000E001619or ecx,eax1620shr eax,31621and eax,0x000001001622or ecx,eax16231624// pixel #71625// xxxxxxxxxxxxxxxxxxxxxxxxIIIAxxxx1626// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx1627//Alpha1628mov eax,edx1629shl eax,161630and eax,0x001000001631or ecx,eax1632shl eax,11633or ecx,eax1634shl eax,11635or ecx,eax1636shl eax,11637or ecx,eax1638mov eax,edx1639shl eax,12 // Intensity1640and eax,0x000E00001641or ecx,eax1642shr eax,31643and eax,0x000100001644or ecx,eax16451646// pixel #81647// xxxxxxxxxxxxxxxxxxxxxxxxxxxxIIIA1648// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx1649mov eax,edx1650shl eax,28 //Alpha1651and eax,0x100000001652or ecx,eax1653shl eax,11654or ecx,eax1655shl eax,11656or ecx,eax1657shl eax,11658or ecx,eax1659mov eax,edx1660shl eax,24 // Intensity1661and eax,0x0E0000001662or ecx,eax1663shr eax,31664and eax,0x010000001665or ecx,eax16661667mov dword ptr [edi],ecx1668add edi,41669// }16701671// * copy1672mov eax,dword ptr [esi] // read all 8 pixels1673bswap eax1674add esi,41675mov edx,eax16761677// 1st dword {1678xor ecx,ecx16791680// pixel #11681// IIIAxxxxxxxxxxxxxxxxxxxxxxxxxxxx1682// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII1683mov eax,edx1684shr eax,24 //Alpha1685and eax,0x000000101686or ecx,eax1687shl eax,11688or ecx,eax1689shl eax,11690or ecx,eax1691shl eax,11692or ecx,eax1693mov eax,edx1694shr eax,28 // Intensity1695and eax,0x0000000E1696or ecx,eax1697shr eax,31698or ecx,eax16991700// pixel #21701// xxxxIIIAxxxxxxxxxxxxxxxxxxxxxxxx1702// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx1703mov eax,edx1704shr eax,12 //Alpha1705and eax,0x000010001706or ecx,eax1707shl eax,11708or ecx,eax1709shl eax,11710or ecx,eax1711shl eax,11712or ecx,eax1713mov eax,edx1714shr eax,16 // Intensity1715and eax,0x00000E001716or ecx,eax1717shr eax,31718and eax,0x000001001719or ecx,eax17201721// pixel #31722// xxxxxxxxIIIAxxxxxxxxxxxxxxxxxxxx1723// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx1724//Alpha1725mov eax,edx1726and eax,0x001000001727or ecx,eax1728shl eax,11729or ecx,eax1730shl eax,11731or ecx,eax1732shl eax,11733or ecx,eax1734mov eax,edx1735shr eax,4 // Intensity1736and eax,0x000E00001737or ecx,eax1738shr eax,31739and eax,0x000100001740or ecx,eax17411742// pixel #41743// xxxxxxxxxxxxIIIAxxxxxxxxxxxxxxxx1744// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx1745mov eax,edx1746shl eax,12 //Alpha1747and eax,0x100000001748or ecx,eax1749shl eax,11750or ecx,eax1751shl eax,11752or ecx,eax1753shl eax,11754or ecx,eax1755mov eax,edx1756shl eax,8 // Intensity1757and eax,0x0E0000001758or ecx,eax1759shr eax,31760and eax,0x010000001761or ecx,eax176217631764mov dword ptr [edi],ecx1765add edi,41766// }17671768// 2nd dword {1769xor ecx,ecx17701771// pixel #51772// xxxxxxxxxxxxxxxxIIIAxxxxxxxxxxxx1773// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII1774mov eax,edx1775shr eax,8 //Alpha1776and eax,0x000000101777or ecx,eax1778shl eax,11779or ecx,eax1780shl eax,11781or ecx,eax1782shl eax,11783or ecx,eax1784mov eax,edx1785shr eax,12 // Intensity1786and eax,0x0000000E1787or ecx,eax1788shr eax,31789or ecx,eax17901791// pixel #61792// xxxxxxxxxxxxxxxxxxxxIIIAxxxxxxxx1793// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx1794//Alpha1795mov eax,edx1796shl eax,41797and eax,0x000010001798or ecx,eax1799shl eax,11800or ecx,eax1801shl eax,11802or ecx,eax1803shl eax,11804or ecx,eax1805mov eax,edx // Intensity1806and eax,0x00000E001807or ecx,eax1808shr eax,31809and eax,0x000001001810or ecx,eax18111812// pixel #71813// xxxxxxxxxxxxxxxxxxxxxxxxIIIAxxxx1814// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx1815//Alpha1816mov eax,edx1817shl eax,161818and eax,0x001000001819or ecx,eax1820shl eax,11821or ecx,eax1822shl eax,11823or ecx,eax1824shl eax,11825or ecx,eax1826mov eax,edx1827shl eax,12 // Intensity1828and eax,0x000E00001829or ecx,eax1830shr eax,31831and eax,0x000100001832or ecx,eax18331834// pixel #81835// xxxxxxxxxxxxxxxxxxxxxxxxxxxxIIIA1836// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx1837mov eax,edx1838shl eax,28 //Alpha1839and eax,0x100000001840or ecx,eax1841shl eax,11842or ecx,eax1843shl eax,11844or ecx,eax1845shl eax,11846or ecx,eax1847mov eax,edx1848shl eax,24 // Intensity1849and eax,0x0E0000001850or ecx,eax1851shr eax,31852and eax,0x010000001853or ecx,eax18541855mov dword ptr [edi],ecx1856add edi,41857// }18581859// *18601861pop ecx1862dec ecx1863jnz x_loop18641865pop ecx1866dec ecx1867jz end_y_loop1868push ecx18691870add esi,dword ptr [line]1871add edi,dword ptr [ext]18721873mov ecx,dword ptr [wid_64]1874x_loop_2:1875push ecx18761877mov eax,dword ptr [esi+4] // read all 8 pixels1878bswap eax1879mov edx,eax18801881// 1st dword {1882xor ecx,ecx18831884// pixel #11885// IIIAxxxxxxxxxxxxxxxxxxxxxxxxxxxx1886// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII1887mov eax,edx1888shr eax,24 //Alpha1889and eax,0x000000101890or ecx,eax1891shl eax,11892or ecx,eax1893shl eax,11894or ecx,eax1895shl eax,11896or ecx,eax1897mov eax,edx1898shr eax,28 // Intensity1899and eax,0x0000000E1900or ecx,eax1901shr eax,31902or ecx,eax19031904// pixel #21905// xxxxIIIAxxxxxxxxxxxxxxxxxxxxxxxx1906// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx1907mov eax,edx1908shr eax,12 //Alpha1909and eax,0x000010001910or ecx,eax1911shl eax,11912or ecx,eax1913shl eax,11914or ecx,eax1915shl eax,11916or ecx,eax1917mov eax,edx1918shr eax,16 // Intensity1919and eax,0x00000E001920or ecx,eax1921shr eax,31922and eax,0x000001001923or ecx,eax19241925// pixel #31926// xxxxxxxxIIIAxxxxxxxxxxxxxxxxxxxx1927// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx1928//Alpha1929mov eax,edx1930and eax,0x001000001931or ecx,eax1932shl eax,11933or ecx,eax1934shl eax,11935or ecx,eax1936shl eax,11937or ecx,eax1938mov eax,edx1939shr eax,4 // Intensity1940and eax,0x000E00001941or ecx,eax1942shr eax,31943and eax,0x000100001944or ecx,eax19451946// pixel #41947// xxxxxxxxxxxxIIIAxxxxxxxxxxxxxxxx1948// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx1949mov eax,edx1950shl eax,12 //Alpha1951and eax,0x100000001952or ecx,eax1953shl eax,11954or ecx,eax1955shl eax,11956or ecx,eax1957shl eax,11958or ecx,eax1959mov eax,edx1960shl eax,8 // Intensity1961and eax,0x0E0000001962or ecx,eax1963shr eax,31964and eax,0x010000001965or ecx,eax196619671968mov dword ptr [edi],ecx1969add edi,41970// }19711972// 2nd dword {1973xor ecx,ecx19741975// pixel #51976// xxxxxxxxxxxxxxxxIIIAxxxxxxxxxxxx1977// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII1978mov eax,edx1979shr eax,8 //Alpha1980and eax,0x000000101981or ecx,eax1982shl eax,11983or ecx,eax1984shl eax,11985or ecx,eax1986shl eax,11987or ecx,eax1988mov eax,edx1989shr eax,12 // Intensity1990and eax,0x0000000E1991or ecx,eax1992shr eax,31993or ecx,eax19941995// pixel #61996// xxxxxxxxxxxxxxxxxxxxIIIAxxxxxxxx1997// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx1998//Alpha1999mov eax,edx2000shl eax,42001and eax,0x000010002002or ecx,eax2003shl eax,12004or ecx,eax2005shl eax,12006or ecx,eax2007shl eax,12008or ecx,eax2009mov eax,edx // Intensity2010and eax,0x00000E002011or ecx,eax2012shr eax,32013and eax,0x000001002014or ecx,eax20152016// pixel #72017// xxxxxxxxxxxxxxxxxxxxxxxxIIIAxxxx2018// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2019//Alpha2020mov eax,edx2021shl eax,162022and eax,0x001000002023or ecx,eax2024shl eax,12025or ecx,eax2026shl eax,12027or ecx,eax2028shl eax,12029or ecx,eax2030mov eax,edx2031shl eax,12 // Intensity2032and eax,0x000E00002033or ecx,eax2034shr eax,32035and eax,0x000100002036or ecx,eax20372038// pixel #82039// xxxxxxxxxxxxxxxxxxxxxxxxxxxxIIIA2040// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx2041mov eax,edx2042shl eax,28 //Alpha2043and eax,0x100000002044or ecx,eax2045shl eax,12046or ecx,eax2047shl eax,12048or ecx,eax2049shl eax,12050or ecx,eax2051mov eax,edx2052shl eax,24 // Intensity2053and eax,0x0E0000002054or ecx,eax2055shr eax,32056and eax,0x010000002057or ecx,eax20582059mov dword ptr [edi],ecx2060add edi,42061// }20622063// * copy2064mov eax,dword ptr [esi] // read all 8 pixels2065bswap eax2066add esi,82067mov edx,eax20682069// 1st dword {2070xor ecx,ecx20712072// pixel #12073// IIIAxxxxxxxxxxxxxxxxxxxxxxxxxxxx2074// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII2075mov eax,edx2076shr eax,24 //Alpha2077and eax,0x000000102078or ecx,eax2079shl eax,12080or ecx,eax2081shl eax,12082or ecx,eax2083shl eax,12084or ecx,eax2085mov eax,edx2086shr eax,28 // Intensity2087and eax,0x0000000E2088or ecx,eax2089shr eax,32090or ecx,eax20912092// pixel #22093// xxxxIIIAxxxxxxxxxxxxxxxxxxxxxxxx2094// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx2095mov eax,edx2096shr eax,12 //Alpha2097and eax,0x000010002098or ecx,eax2099shl eax,12100or ecx,eax2101shl eax,12102or ecx,eax2103shl eax,12104or ecx,eax2105mov eax,edx2106shr eax,16 // Intensity2107and eax,0x00000E002108or ecx,eax2109shr eax,32110and eax,0x000001002111or ecx,eax21122113// pixel #32114// xxxxxxxxIIIAxxxxxxxxxxxxxxxxxxxx2115// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2116//Alpha2117mov eax,edx2118and eax,0x001000002119or ecx,eax2120shl eax,12121or ecx,eax2122shl eax,12123or ecx,eax2124shl eax,12125or ecx,eax2126mov eax,edx2127shr eax,4 // Intensity2128and eax,0x000E00002129or ecx,eax2130shr eax,32131and eax,0x000100002132or ecx,eax21332134// pixel #42135// xxxxxxxxxxxxIIIAxxxxxxxxxxxxxxxx2136// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx2137mov eax,edx2138shl eax,12 //Alpha2139and eax,0x100000002140or ecx,eax2141shl eax,12142or ecx,eax2143shl eax,12144or ecx,eax2145shl eax,12146or ecx,eax2147mov eax,edx2148shl eax,8 // Intensity2149and eax,0x0E0000002150or ecx,eax2151shr eax,32152and eax,0x010000002153or ecx,eax215421552156mov dword ptr [edi],ecx2157add edi,42158// }21592160// 2nd dword {2161xor ecx,ecx21622163// pixel #52164// xxxxxxxxxxxxxxxxIIIAxxxxxxxxxxxx2165// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII2166mov eax,edx2167shr eax,8 //Alpha2168and eax,0x000000102169or ecx,eax2170shl eax,12171or ecx,eax2172shl eax,12173or ecx,eax2174shl eax,12175or ecx,eax2176mov eax,edx2177shr eax,12 // Intensity2178and eax,0x0000000E2179or ecx,eax2180shr eax,32181or ecx,eax21822183// pixel #62184// xxxxxxxxxxxxxxxxxxxxIIIAxxxxxxxx2185// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx2186//Alpha2187mov eax,edx2188shl eax,42189and eax,0x000010002190or ecx,eax2191shl eax,12192or ecx,eax2193shl eax,12194or ecx,eax2195shl eax,12196or ecx,eax2197mov eax,edx // Intensity2198and eax,0x00000E002199or ecx,eax2200shr eax,32201and eax,0x000001002202or ecx,eax22032204// pixel #72205// xxxxxxxxxxxxxxxxxxxxxxxxIIIAxxxx2206// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2207//Alpha2208mov eax,edx2209shl eax,162210and eax,0x001000002211or ecx,eax2212shl eax,12213or ecx,eax2214shl eax,12215or ecx,eax2216shl eax,12217or ecx,eax2218mov eax,edx2219shl eax,12 // Intensity2220and eax,0x000E00002221or ecx,eax2222shr eax,32223and eax,0x000100002224or ecx,eax22252226// pixel #82227// xxxxxxxxxxxxxxxxxxxxxxxxxxxxIIIA2228// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx2229mov eax,edx2230shl eax,28 //Alpha2231and eax,0x100000002232or ecx,eax2233shl eax,12234or ecx,eax2235shl eax,12236or ecx,eax2237shl eax,12238or ecx,eax2239mov eax,edx2240shl eax,24 // Intensity2241and eax,0x0E0000002242or ecx,eax2243shr eax,32244and eax,0x010000002245or ecx,eax22462247mov dword ptr [edi],ecx2248add edi,42249// }2250// *22512252pop ecx2253dec ecx2254jnz x_loop_222552256add esi,dword ptr [line]2257add edi,dword ptr [ext]22582259pop ecx2260dec ecx2261jnz y_loop22622263end_y_loop:2264}2265#elif !defined(NO_ASM)2266//printf("Load4bIA\n");2267long lTempX, lTempY, lHeight = (long) height;2268asm volatile (2269"1: \n" // y_loop22270"mov %[c], %[tempy] \n"22712272"mov %[wid_64], %%ecx \n"2273"2: \n" // x_loop22274"mov %[c], %[tempx] \n"22752276"mov (%[src]), %%eax \n" // read all 8 pixels2277"bswap %%eax \n"2278"add $4, %[src] \n"2279"mov %%eax, %%edx \n"22802281// 1st dword {2282"xor %%ecx, %%ecx \n"22832284// pixel #12285// IIIAxxxxxxxxxxxxxxxxxxxxxxxxxxxx2286// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII2287"mov %%edx, %%eax \n"2288"shr $24, %%eax \n" //Alpha2289"and $0x00000010, %%eax \n"2290"or %%eax, %%ecx \n"2291"shl $1, %%eax \n"2292"or %%eax, %%ecx \n"2293"shl $1, %%eax \n"2294"or %%eax, %%ecx \n"2295"shl $1, %%eax \n"2296"or %%eax, %%ecx \n"2297"mov %%edx, %%eax \n"2298"shr $28, %%eax \n" // Intensity2299"and $0x0000000E, %%eax \n"2300"or %%eax, %%ecx \n"2301"shr $3, %%eax \n"2302"or %%eax, %%ecx \n"23032304// pixel #22305// xxxxIIIAxxxxxxxxxxxxxxxxxxxxxxxx2306// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx2307"mov %%edx, %%eax \n"2308"shr $12, %%eax \n" //Alpha2309"and $0x00001000, %%eax \n"2310"or %%eax, %%ecx \n"2311"shl $1, %%eax \n"2312"or %%eax, %%ecx \n"2313"shl $1, %%eax \n"2314"or %%eax, %%ecx \n"2315"shl $1, %%eax \n"2316"or %%eax, %%ecx \n"2317"mov %%edx, %%eax \n"2318"shr $16, %%eax \n" // Intensity2319"and $0x00000E00, %%eax \n"2320"or %%eax, %%ecx \n"2321"shr $3, %%eax \n"2322"and $0x00000100, %%eax \n"2323"or %%eax, %%ecx \n"23242325// pixel #32326// xxxxxxxxIIIAxxxxxxxxxxxxxxxxxxxx2327// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2328//Alpha2329"mov %%edx, %%eax \n"2330"and $0x00100000, %%eax \n"2331"or %%eax, %%ecx \n"2332"shl $1, %%eax \n"2333"or %%eax, %%ecx \n"2334"shl $1, %%eax \n"2335"or %%eax, %%ecx \n"2336"shl $1, %%eax \n"2337"or %%eax, %%ecx \n"2338"mov %%edx, %%eax \n"2339"shr $4, %%eax \n" // Intensity2340"and $0x000E0000, %%eax \n"2341"or %%eax, %%ecx \n"2342"shr $3, %%eax \n"2343"and $0x00010000, %%eax \n"2344"or %%eax, %%ecx \n"23452346// pixel #42347// xxxxxxxxxxxxIIIAxxxxxxxxxxxxxxxx2348// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx2349"mov %%edx, %%eax \n"2350"shl $12, %%eax \n" //Alpha2351"and $0x10000000, %%eax \n"2352"or %%eax, %%ecx \n"2353"shl $1, %%eax \n"2354"or %%eax, %%ecx \n"2355"shl $1, %%eax \n"2356"or %%eax, %%ecx \n"2357"shl $1, %%eax \n"2358"or %%eax, %%ecx \n"2359"mov %%edx, %%eax \n"2360"shl $8, %%eax \n" // Intensity2361"and $0x0E000000, %%eax \n"2362"or %%eax, %%ecx \n"2363"shr $3, %%eax \n"2364"and $0x01000000, %%eax \n"2365"or %%eax, %%ecx \n"236623672368"mov %%ecx, (%[dst]) \n"2369"add $4, %[dst] \n"2370// }23712372// 2nd dword {2373"xor %%ecx, %%ecx \n"23742375// pixel #52376// xxxxxxxxxxxxxxxxIIIAxxxxxxxxxxxx2377// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII2378"mov %%edx, %%eax \n"2379"shr $8, %%eax \n" //Alpha2380"and $0x00000010, %%eax \n"2381"or %%eax, %%ecx \n"2382"shl $1, %%eax \n"2383"or %%eax, %%ecx \n"2384"shl $1, %%eax \n"2385"or %%eax, %%ecx \n"2386"shl $1, %%eax \n"2387"or %%eax, %%ecx \n"2388"mov %%edx, %%eax \n"2389"shr $12, %%eax \n" // Intensity2390"and $0x0000000E, %%eax \n"2391"or %%eax, %%ecx \n"2392"shr $3, %%eax \n"2393"or %%eax, %%ecx \n"23942395// pixel #62396// xxxxxxxxxxxxxxxxxxxxIIIAxxxxxxxx2397// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx2398//Alpha2399"mov %%edx, %%eax \n"2400"shl $4, %%eax \n"2401"and $0x00001000, %%eax \n"2402"or %%eax, %%ecx \n"2403"shl $1, %%eax \n"2404"or %%eax, %%ecx \n"2405"shl $1, %%eax \n"2406"or %%eax, %%ecx \n"2407"shl $1, %%eax \n"2408"or %%eax, %%ecx \n"2409"mov %%edx, %%eax \n" // Intensity2410"and $0x00000E00, %%eax \n"2411"or %%eax, %%ecx \n"2412"shr $3, %%eax \n"2413"and $0x00000100, %%eax \n"2414"or %%eax, %%ecx \n"24152416// pixel #72417// xxxxxxxxxxxxxxxxxxxxxxxxIIIAxxxx2418// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2419//Alpha2420"mov %%edx, %%eax \n"2421"shl $16, %%eax \n"2422"and $0x00100000, %%eax \n"2423"or %%eax, %%ecx \n"2424"shl $1, %%eax \n"2425"or %%eax, %%ecx \n"2426"shl $1, %%eax \n"2427"or %%eax, %%ecx \n"2428"shl $1, %%eax \n"2429"or %%eax, %%ecx \n"2430"mov %%edx, %%eax \n"2431"shl $12, %%eax \n" // Intensity2432"and $0x000E0000, %%eax \n"2433"or %%eax, %%ecx \n"2434"shr $3, %%eax \n"2435"and $0x00010000, %%eax \n"2436"or %%eax, %%ecx \n"24372438// pixel #82439// xxxxxxxxxxxxxxxxxxxxxxxxxxxxIIIA2440// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx2441"mov %%edx, %%eax \n"2442"shl $28, %%eax \n" //Alpha2443"and $0x10000000, %%eax \n"2444"or %%eax, %%ecx \n"2445"shl $1, %%eax \n"2446"or %%eax, %%ecx \n"2447"shl $1, %%eax \n"2448"or %%eax, %%ecx \n"2449"shl $1, %%eax \n"2450"or %%eax, %%ecx \n"2451"mov %%edx, %%eax \n"2452"shl $24, %%eax \n" // Intensity2453"and $0x0E000000, %%eax \n"2454"or %%eax, %%ecx \n"2455"shr $3, %%eax \n"2456"and $0x01000000, %%eax \n"2457"or %%eax, %%ecx \n"24582459"mov %%ecx, (%[dst]) \n"2460"add $4, %[dst] \n"2461// }24622463// * copy2464"mov (%[src]), %%eax \n" // read all 8 pixels2465"bswap %%eax \n"2466"add $4, %[src] \n"2467"mov %%eax, %%edx \n"24682469// 1st dword {2470"xor %%ecx, %%ecx \n"24712472// pixel #12473// IIIAxxxxxxxxxxxxxxxxxxxxxxxxxxxx2474// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII2475"mov %%edx, %%eax \n"2476"shr $24, %%eax \n" //Alpha2477"and $0x00000010, %%eax \n"2478"or %%eax, %%ecx \n"2479"shl $1, %%eax \n"2480"or %%eax, %%ecx \n"2481"shl $1, %%eax \n"2482"or %%eax, %%ecx \n"2483"shl $1, %%eax \n"2484"or %%eax, %%ecx \n"2485"mov %%edx, %%eax \n"2486"shr $28, %%eax \n" // Intensity2487"and $0x0000000E, %%eax \n"2488"or %%eax, %%ecx \n"2489"shr $3, %%eax \n"2490"or %%eax, %%ecx \n"24912492// pixel #22493// xxxxIIIAxxxxxxxxxxxxxxxxxxxxxxxx2494// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx2495"mov %%edx, %%eax \n"2496"shr $12, %%eax \n" //Alpha2497"and $0x00001000, %%eax \n"2498"or %%eax, %%ecx \n"2499"shl $1, %%eax \n"2500"or %%eax, %%ecx \n"2501"shl $1, %%eax \n"2502"or %%eax, %%ecx \n"2503"shl $1, %%eax \n"2504"or %%eax, %%ecx \n"2505"mov %%edx, %%eax \n"2506"shr $16, %%eax \n" // Intensity2507"and $0x00000E00, %%eax \n"2508"or %%eax, %%ecx \n"2509"shr $3, %%eax \n"2510"and $0x00000100, %%eax \n"2511"or %%eax, %%ecx \n"25122513// pixel #32514// xxxxxxxxIIIAxxxxxxxxxxxxxxxxxxxx2515// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2516//Alpha2517"mov %%edx, %%eax \n"2518"and $0x00100000, %%eax \n"2519"or %%eax, %%ecx \n"2520"shl $1, %%eax \n"2521"or %%eax, %%ecx \n"2522"shl $1, %%eax \n"2523"or %%eax, %%ecx \n"2524"shl $1, %%eax \n"2525"or %%eax, %%ecx \n"2526"mov %%edx, %%eax \n"2527"shr $4, %%eax \n" // Intensity2528"and $0x000E0000, %%eax \n"2529"or %%eax, %%ecx \n"2530"shr $3, %%eax \n"2531"and $0x00010000, %%eax \n"2532"or %%eax, %%ecx \n"25332534// pixel #42535// xxxxxxxxxxxxIIIAxxxxxxxxxxxxxxxx2536// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx2537"mov %%edx, %%eax \n"2538"shl $12, %%eax \n" //Alpha2539"and $0x10000000, %%eax \n"2540"or %%eax, %%ecx \n"2541"shl $1, %%eax \n"2542"or %%eax, %%ecx \n"2543"shl $1, %%eax \n"2544"or %%eax, %%ecx \n"2545"shl $1, %%eax \n"2546"or %%eax, %%ecx \n"2547"mov %%edx, %%eax \n"2548"shl $8, %%eax \n" // Intensity2549"and $0x0E000000, %%eax \n"2550"or %%eax, %%ecx \n"2551"shr $3, %%eax \n"2552"and $0x01000000, %%eax \n"2553"or %%eax, %%ecx \n"255425552556"mov %%ecx, (%[dst]) \n"2557"add $4, %[dst] \n"2558// }25592560// 2nd dword {2561"xor %%ecx, %%ecx \n"25622563// pixel #52564// xxxxxxxxxxxxxxxxIIIAxxxxxxxxxxxx2565// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII2566"mov %%edx, %%eax \n"2567"shr $8, %%eax \n" //Alpha2568"and $0x00000010, %%eax \n"2569"or %%eax, %%ecx \n"2570"shl $1, %%eax \n"2571"or %%eax, %%ecx \n"2572"shl $1, %%eax \n"2573"or %%eax, %%ecx \n"2574"shl $1, %%eax \n"2575"or %%eax, %%ecx \n"2576"mov %%edx, %%eax \n"2577"shr $12, %%eax \n" // Intensity2578"and $0x0000000E, %%eax \n"2579"or %%eax, %%ecx \n"2580"shr $3, %%eax \n"2581"or %%eax, %%ecx \n"25822583// pixel #62584// xxxxxxxxxxxxxxxxxxxxIIIAxxxxxxxx2585// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx2586//Alpha2587"mov %%edx, %%eax \n"2588"shl $4, %%eax \n"2589"and $0x00001000, %%eax \n"2590"or %%eax, %%ecx \n"2591"shl $1, %%eax \n"2592"or %%eax, %%ecx \n"2593"shl $1, %%eax \n"2594"or %%eax, %%ecx \n"2595"shl $1, %%eax \n"2596"or %%eax, %%ecx \n"2597"mov %%edx, %%eax \n" // Intensity2598"and $0x00000E00, %%eax \n"2599"or %%eax, %%ecx \n"2600"shr $3, %%eax \n"2601"and $0x00000100, %%eax \n"2602"or %%eax, %%ecx \n"26032604// pixel #72605// xxxxxxxxxxxxxxxxxxxxxxxxIIIAxxxx2606// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2607//Alpha2608"mov %%edx, %%eax \n"2609"shl $16, %%eax \n"2610"and $0x00100000, %%eax \n"2611"or %%eax, %%ecx \n"2612"shl $1, %%eax \n"2613"or %%eax, %%ecx \n"2614"shl $1, %%eax \n"2615"or %%eax, %%ecx \n"2616"shl $1, %%eax \n"2617"or %%eax, %%ecx \n"2618"mov %%edx, %%eax \n"2619"shl $12, %%eax \n" // Intensity2620"and $0x000E0000, %%eax \n"2621"or %%eax, %%ecx \n"2622"shr $3, %%eax \n"2623"and $0x00010000, %%eax \n"2624"or %%eax, %%ecx \n"26252626// pixel #82627// xxxxxxxxxxxxxxxxxxxxxxxxxxxxIIIA2628// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx2629"mov %%edx, %%eax \n"2630"shl $28, %%eax \n" //Alpha2631"and $0x10000000, %%eax \n"2632"or %%eax, %%ecx \n"2633"shl $1, %%eax \n"2634"or %%eax, %%ecx \n"2635"shl $1, %%eax \n"2636"or %%eax, %%ecx \n"2637"shl $1, %%eax \n"2638"or %%eax, %%ecx \n"2639"mov %%edx, %%eax \n"2640"shl $24, %%eax \n" // Intensity2641"and $0x0E000000, %%eax \n"2642"or %%eax, %%ecx \n"2643"shr $3, %%eax \n"2644"and $0x01000000, %%eax \n"2645"or %%eax, %%ecx \n"26462647"mov %%ecx, (%[dst]) \n"2648"add $4, %[dst] \n"2649// }26502651// *26522653"mov %[tempx], %[c] \n"2654"dec %%ecx \n"2655"jnz 2b \n" // x_loop226562657"mov %[tempy], %[c] \n"2658"dec %%ecx \n"2659"jz 4f \n" // end_y_loop22660"mov %[c], %[tempy] \n"26612662"add %[line], %[src] \n"2663"add %[ext], %[dst] \n"26642665"mov %[wid_64], %%ecx \n"2666"3: \n" // x_loop_222667"mov %[c], %[tempx] \n"26682669"mov 4(%[src]), %%eax \n" // read all 8 pixels2670"bswap %%eax \n"2671"mov %%eax, %%edx \n"26722673// 1st dword {2674"xor %%ecx, %%ecx \n"26752676// pixel #12677// IIIAxxxxxxxxxxxxxxxxxxxxxxxxxxxx2678// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII2679"mov %%edx, %%eax \n"2680"shr $24, %%eax \n" //Alpha2681"and $0x00000010, %%eax \n"2682"or %%eax, %%ecx \n"2683"shl $1, %%eax \n"2684"or %%eax, %%ecx \n"2685"shl $1, %%eax \n"2686"or %%eax, %%ecx \n"2687"shl $1, %%eax \n"2688"or %%eax, %%ecx \n"2689"mov %%edx, %%eax \n"2690"shr $28, %%eax \n" // Intensity2691"and $0x0000000E, %%eax \n"2692"or %%eax, %%ecx \n"2693"shr $3, %%eax \n"2694"or %%eax, %%ecx \n"26952696// pixel #22697// xxxxIIIAxxxxxxxxxxxxxxxxxxxxxxxx2698// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx2699"mov %%edx, %%eax \n"2700"shr $12, %%eax \n" //Alpha2701"and $0x00001000, %%eax \n"2702"or %%eax, %%ecx \n"2703"shl $1, %%eax \n"2704"or %%eax, %%ecx \n"2705"shl $1, %%eax \n"2706"or %%eax, %%ecx \n"2707"shl $1, %%eax \n"2708"or %%eax, %%ecx \n"2709"mov %%edx, %%eax \n"2710"shr $16, %%eax \n" // Intensity2711"and $0x00000E00, %%eax \n"2712"or %%eax, %%ecx \n"2713"shr $3, %%eax \n"2714"and $0x00000100, %%eax \n"2715"or %%eax, %%ecx \n"27162717// pixel #32718// xxxxxxxxIIIAxxxxxxxxxxxxxxxxxxxx2719// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2720//Alpha2721"mov %%edx, %%eax \n"2722"and $0x00100000, %%eax \n"2723"or %%eax, %%ecx \n"2724"shl $1, %%eax \n"2725"or %%eax, %%ecx \n"2726"shl $1, %%eax \n"2727"or %%eax, %%ecx \n"2728"shl $1, %%eax \n"2729"or %%eax, %%ecx \n"2730"mov %%edx, %%eax \n"2731"shr $4, %%eax \n" // Intensity2732"and $0x000E0000, %%eax \n"2733"or %%eax, %%ecx \n"2734"shr $3, %%eax \n"2735"and $0x00010000, %%eax \n"2736"or %%eax, %%ecx \n"27372738// pixel #42739// xxxxxxxxxxxxIIIAxxxxxxxxxxxxxxxx2740// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx2741"mov %%edx, %%eax \n"2742"shl $12, %%eax \n" //Alpha2743"and $0x10000000, %%eax \n"2744"or %%eax, %%ecx \n"2745"shl $1, %%eax \n"2746"or %%eax, %%ecx \n"2747"shl $1, %%eax \n"2748"or %%eax, %%ecx \n"2749"shl $1, %%eax \n"2750"or %%eax, %%ecx \n"2751"mov %%edx, %%eax \n"2752"shl $8, %%eax \n" // Intensity2753"and $0x0E000000, %%eax \n"2754"or %%eax, %%ecx \n"2755"shr $3, %%eax \n"2756"and $0x01000000, %%eax \n"2757"or %%eax, %%ecx \n"275827592760"mov %%ecx, (%[dst]) \n"2761"add $4, %[dst] \n"2762// }27632764// 2nd dword {2765"xor %%ecx, %%ecx \n"27662767// pixel #52768// xxxxxxxxxxxxxxxxIIIAxxxxxxxxxxxx2769// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII2770"mov %%edx, %%eax \n"2771"shr $8, %%eax \n" //Alpha2772"and $0x00000010, %%eax \n"2773"or %%eax, %%ecx \n"2774"shl $1, %%eax \n"2775"or %%eax, %%ecx \n"2776"shl $1, %%eax \n"2777"or %%eax, %%ecx \n"2778"shl $1, %%eax \n"2779"or %%eax, %%ecx \n"2780"mov %%edx, %%eax \n"2781"shr $12, %%eax \n" // Intensity2782"and $0x0000000E, %%eax \n"2783"or %%eax, %%ecx \n"2784"shr $3, %%eax \n"2785"or %%eax, %%ecx \n"27862787// pixel #62788// xxxxxxxxxxxxxxxxxxxxIIIAxxxxxxxx2789// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx2790//Alpha2791"mov %%edx, %%eax \n"2792"shl $4, %%eax \n"2793"and $0x00001000, %%eax \n"2794"or %%eax, %%ecx \n"2795"shl $1, %%eax \n"2796"or %%eax, %%ecx \n"2797"shl $1, %%eax \n"2798"or %%eax, %%ecx \n"2799"shl $1, %%eax \n"2800"or %%eax, %%ecx \n"2801"mov %%edx, %%eax \n" // Intensity2802"and $0x00000E00, %%eax \n"2803"or %%eax, %%ecx \n"2804"shr $3, %%eax \n"2805"and $0x00000100, %%eax \n"2806"or %%eax, %%ecx \n"28072808// pixel #72809// xxxxxxxxxxxxxxxxxxxxxxxxIIIAxxxx2810// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2811//Alpha2812"mov %%edx, %%eax \n"2813"shl $16, %%eax \n"2814"and $0x00100000, %%eax \n"2815"or %%eax, %%ecx \n"2816"shl $1, %%eax \n"2817"or %%eax, %%ecx \n"2818"shl $1, %%eax \n"2819"or %%eax, %%ecx \n"2820"shl $1, %%eax \n"2821"or %%eax, %%ecx \n"2822"mov %%edx, %%eax \n"2823"shl $12, %%eax \n" // Intensity2824"and $0x000E0000, %%eax \n"2825"or %%eax, %%ecx \n"2826"shr $3, %%eax \n"2827"and $0x00010000, %%eax \n"2828"or %%eax, %%ecx \n"28292830// pixel #82831// xxxxxxxxxxxxxxxxxxxxxxxxxxxxIIIA2832// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx2833"mov %%edx, %%eax \n"2834"shl $28, %%eax \n" //Alpha2835"and $0x10000000, %%eax \n"2836"or %%eax, %%ecx \n"2837"shl $1, %%eax \n"2838"or %%eax, %%ecx \n"2839"shl $1, %%eax \n"2840"or %%eax, %%ecx \n"2841"shl $1, %%eax \n"2842"or %%eax, %%ecx \n"2843"mov %%edx, %%eax \n"2844"shl $24, %%eax \n" // Intensity2845"and $0x0E000000, %%eax \n"2846"or %%eax, %%ecx \n"2847"shr $3, %%eax \n"2848"and $0x01000000, %%eax \n"2849"or %%eax, %%ecx \n"28502851"mov %%ecx, (%[dst]) \n"2852"add $4, %[dst] \n"2853// }28542855// * copy2856"mov (%[src]), %%eax \n" // read all 8 pixels2857"bswap %%eax \n"2858"add $8, %[src] \n"2859"mov %%eax, %%edx \n"28602861// 1st dword {2862"xor %%ecx, %%ecx \n"28632864// pixel #12865// IIIAxxxxxxxxxxxxxxxxxxxxxxxxxxxx2866// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII2867"mov %%edx, %%eax \n"2868"shr $24, %%eax \n" //Alpha2869"and $0x00000010, %%eax \n"2870"or %%eax, %%ecx \n"2871"shl $1, %%eax \n"2872"or %%eax, %%ecx \n"2873"shl $1, %%eax \n"2874"or %%eax, %%ecx \n"2875"shl $1, %%eax \n"2876"or %%eax, %%ecx \n"2877"mov %%edx, %%eax \n"2878"shr $28, %%eax \n" // Intensity2879"and $0x0000000E, %%eax \n"2880"or %%eax, %%ecx \n"2881"shr $3, %%eax \n"2882"or %%eax, %%ecx \n"28832884// pixel #22885// xxxxIIIAxxxxxxxxxxxxxxxxxxxxxxxx2886// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx2887"mov %%edx, %%eax \n"2888"shr $12, %%eax \n" //Alpha2889"and $0x00001000, %%eax \n"2890"or %%eax, %%ecx \n"2891"shl $1, %%eax \n"2892"or %%eax, %%ecx \n"2893"shl $1, %%eax \n"2894"or %%eax, %%ecx \n"2895"shl $1, %%eax \n"2896"or %%eax, %%ecx \n"2897"mov %%edx, %%eax \n"2898"shr $16, %%eax \n" // Intensity2899"and $0x00000E00, %%eax \n"2900"or %%eax, %%ecx \n"2901"shr $3, %%eax \n"2902"and $0x00000100, %%eax \n"2903"or %%eax, %%ecx \n"29042905// pixel #32906// xxxxxxxxIIIAxxxxxxxxxxxxxxxxxxxx2907// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2908//Alpha2909"mov %%edx, %%eax \n"2910"and $0x00100000, %%eax \n"2911"or %%eax, %%ecx \n"2912"shl $1, %%eax \n"2913"or %%eax, %%ecx \n"2914"shl $1, %%eax \n"2915"or %%eax, %%ecx \n"2916"shl $1, %%eax \n"2917"or %%eax, %%ecx \n"2918"mov %%edx, %%eax \n"2919"shr $4, %%eax \n" // Intensity2920"and $0x000E0000, %%eax \n"2921"or %%eax, %%ecx \n"2922"shr $3, %%eax \n"2923"and $0x00010000, %%eax \n"2924"or %%eax, %%ecx \n"29252926// pixel #42927// xxxxxxxxxxxxIIIAxxxxxxxxxxxxxxxx2928// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx2929"mov %%edx, %%eax \n"2930"shl $12, %%eax \n" //Alpha2931"and $0x10000000, %%eax \n"2932"or %%eax, %%ecx \n"2933"shl $1, %%eax \n"2934"or %%eax, %%ecx \n"2935"shl $1, %%eax \n"2936"or %%eax, %%ecx \n"2937"shl $1, %%eax \n"2938"or %%eax, %%ecx \n"2939"mov %%edx, %%eax \n"2940"shl $8, %%eax \n" // Intensity2941"and $0x0E000000, %%eax \n"2942"or %%eax, %%ecx \n"2943"shr $3, %%eax \n"2944"and $0x01000000, %%eax \n"2945"or %%eax, %%ecx \n"294629472948"mov %%ecx, (%[dst]) \n"2949"add $4, %[dst] \n"2950// }29512952// 2nd dword {2953"xor %%ecx, %%ecx \n"29542955// pixel #52956// xxxxxxxxxxxxxxxxIIIAxxxxxxxxxxxx2957// xxxxxxxxxxxxxxxxxxxxxxxxAAAAIIII2958"mov %%edx, %%eax \n"2959"shr $8, %%eax \n" //Alpha2960"and $0x00000010, %%eax \n"2961"or %%eax, %%ecx \n"2962"shl $1, %%eax \n"2963"or %%eax, %%ecx \n"2964"shl $1, %%eax \n"2965"or %%eax, %%ecx \n"2966"shl $1, %%eax \n"2967"or %%eax, %%ecx \n"2968"mov %%edx, %%eax \n"2969"shr $12, %%eax \n" // Intensity2970"and $0x0000000E, %%eax \n"2971"or %%eax, %%ecx \n"2972"shr $3, %%eax \n"2973"or %%eax, %%ecx \n"29742975// pixel #62976// xxxxxxxxxxxxxxxxxxxxIIIAxxxxxxxx2977// xxxxxxxxxxxxxxxxAAAAIIIIxxxxxxxx2978//Alpha2979"mov %%edx, %%eax \n"2980"shl $4, %%eax \n"2981"and $0x00001000, %%eax \n"2982"or %%eax, %%ecx \n"2983"shl $1, %%eax \n"2984"or %%eax, %%ecx \n"2985"shl $1, %%eax \n"2986"or %%eax, %%ecx \n"2987"shl $1, %%eax \n"2988"or %%eax, %%ecx \n"2989"mov %%edx, %%eax \n" // Intensity2990"and $0x00000E00, %%eax \n"2991"or %%eax, %%ecx \n"2992"shr $3, %%eax \n"2993"and $0x00000100, %%eax \n"2994"or %%eax, %%ecx \n"29952996// pixel #72997// xxxxxxxxxxxxxxxxxxxxxxxxIIIAxxxx2998// xxxxxxxxAAAAIIIIxxxxxxxxxxxxxxxx2999//Alpha3000"mov %%edx, %%eax \n"3001"shl $16, %%eax \n"3002"and $0x00100000, %%eax \n"3003"or %%eax, %%ecx \n"3004"shl $1, %%eax \n"3005"or %%eax, %%ecx \n"3006"shl $1, %%eax \n"3007"or %%eax, %%ecx \n"3008"shl $1, %%eax \n"3009"or %%eax, %%ecx \n"3010"mov %%edx, %%eax \n"3011"shl $12, %%eax \n" // Intensity3012"and $0x000E0000, %%eax \n"3013"or %%eax, %%ecx \n"3014"shr $3, %%eax \n"3015"and $0x00010000, %%eax \n"3016"or %%eax, %%ecx \n"30173018// pixel #83019// xxxxxxxxxxxxxxxxxxxxxxxxxxxxIIIA3020// AAAAIIIIxxxxxxxxxxxxxxxxxxxxxxxx3021"mov %%edx, %%eax \n"3022"shl $28, %%eax \n" //Alpha3023"and $0x10000000, %%eax \n"3024"or %%eax, %%ecx \n"3025"shl $1, %%eax \n"3026"or %%eax, %%ecx \n"3027"shl $1, %%eax \n"3028"or %%eax, %%ecx \n"3029"shl $1, %%eax \n"3030"or %%eax, %%ecx \n"3031"mov %%edx, %%eax \n"3032"shl $24, %%eax \n" // Intensity3033"and $0x0E000000, %%eax \n"3034"or %%eax, %%ecx \n"3035"shr $3, %%eax \n"3036"and $0x01000000, %%eax \n"3037"or %%eax, %%ecx \n"30383039"mov %%ecx, (%[dst]) \n"3040"add $4, %[dst] \n"3041// }3042// *30433044"mov %[tempx], %[c] \n"3045"dec %%ecx \n"3046"jnz 3b \n" // x_loop_2230473048"add %[line], %[src] \n"3049"add %[ext], %[dst] \n"30503051"mov %[tempy], %[c] \n"3052"dec %%ecx \n"3053"jnz 1b \n" // y_loop230543055"4: \n" // end_y_loop23056: [tempx]"=m"(lTempX), [tempy]"=m"(lTempY), [src]"+S"(src), [dst]"+D"(dst), [c]"+c"(lHeight)3057: [wid_64] "g" (wid_64), [line] "g" ((uintptr_t)line), [ext] "g" ((uintptr_t)ext)3058: "memory", "cc", "eax", "edx"3059);3060#endif30613062return /*(0 << 16) | */GR_TEXFMT_ALPHA_INTENSITY_44;3063}30643065//****************************************************************3066// Size: 0, Format: 430673068DWORD Load4bI (unsigned char * dst, unsigned char * src, int wid_64, int height, int line, int real_width, int tile)3069{3070if (rdp.tlut_mode != 0)3071return Load4bCI (dst, src, wid_64, height, line, real_width, tile);30723073if (wid_64 < 1) wid_64 = 1;3074if (height < 1) height = 1;3075int ext = (real_width - (wid_64 << 4));3076#if !defined(__GNUC__) && !defined(NO_ASM)3077__asm {3078mov esi,dword ptr [src]3079mov edi,dword ptr [dst]30803081mov ecx,dword ptr [height]3082y_loop:3083push ecx30843085mov ecx,dword ptr [wid_64]3086x_loop:3087push ecx30883089mov eax,dword ptr [esi] // read all 8 pixels3090bswap eax3091add esi,43092mov edx,eax30933094// 1st dword {3095xor ecx,ecx3096shr eax,28 // 0xF0000000 -> 0x0000000F3097or ecx,eax3098shl eax,43099or ecx,eax31003101mov eax,edx // 0x0F000000 -> 0x00000F003102shr eax,163103and eax,0x00000F003104or ecx,eax3105shl eax,43106or ecx,eax31073108mov eax,edx3109shr eax,4 // 0x00F00000 -> 0x000F00003110and eax,0x000F00003111or ecx,eax3112shl eax,43113or ecx,eax31143115mov eax,edx3116shl eax,8 // 0x000F0000 -> 0x0F0000003117and eax,0x0F0000003118or ecx,eax3119shl eax,43120or ecx,eax31213122mov dword ptr [edi],ecx3123add edi,43124// }31253126// 2nd dword {3127xor ecx,ecx3128mov eax,edx3129shr eax,12 // 0x0000F000 -> 0x0000000F3130and eax,0x0000000F3131or ecx,eax3132shl eax,43133or ecx,eax31343135mov eax,edx // 0x00000F00 -> 0x00000F003136and eax,0x00000F003137or ecx,eax3138shl eax,43139or ecx,eax31403141mov eax,edx3142shl eax,12 // 0x000000F0 -> 0x000F00003143and eax,0x000F00003144or ecx,eax3145shl eax,43146or ecx,eax31473148shl edx,24 // 0x0000000F -> 0x0F0000003149and edx,0x0F0000003150or ecx,edx3151shl edx,43152or ecx,edx31533154mov dword ptr [edi],ecx3155add edi,43156// }31573158// * copy3159mov eax,dword ptr [esi] // read all 8 pixels3160bswap eax3161add esi,43162mov edx,eax31633164// 1st dword {3165xor ecx,ecx3166shr eax,28 // 0xF0000000 -> 0x0000000F3167or ecx,eax3168shl eax,43169or ecx,eax31703171mov eax,edx // 0x0F000000 -> 0x00000F003172shr eax,163173and eax,0x00000F003174or ecx,eax3175shl eax,43176or ecx,eax31773178mov eax,edx3179shr eax,4 // 0x00F00000 -> 0x000F00003180and eax,0x000F00003181or ecx,eax3182shl eax,43183or ecx,eax31843185mov eax,edx3186shl eax,8 // 0x000F0000 -> 0x0F0000003187and eax,0x0F0000003188or ecx,eax3189shl eax,43190or ecx,eax31913192mov dword ptr [edi],ecx3193add edi,43194// }31953196// 2nd dword {3197xor ecx,ecx3198mov eax,edx3199shr eax,12 // 0x0000F000 -> 0x0000000F3200and eax,0x0000000F3201or ecx,eax3202shl eax,43203or ecx,eax32043205mov eax,edx // 0x00000F00 -> 0x00000F003206and eax,0x00000F003207or ecx,eax3208shl eax,43209or ecx,eax32103211mov eax,edx3212shl eax,12 // 0x000000F0 -> 0x000F00003213and eax,0x000F00003214or ecx,eax3215shl eax,43216or ecx,eax32173218shl edx,24 // 0x0000000F -> 0x0F0000003219and edx,0x0F0000003220or ecx,edx3221shl edx,43222or ecx,edx32233224mov dword ptr [edi],ecx3225add edi,43226// }3227// *32283229pop ecx3230dec ecx3231jnz x_loop32323233pop ecx3234dec ecx3235jz end_y_loop3236push ecx32373238add esi,dword ptr [line]3239add edi,dword ptr [ext]32403241mov ecx,dword ptr [wid_64]3242x_loop_2:3243push ecx32443245mov eax,dword ptr [esi+4] // read all 8 pixels3246bswap eax3247mov edx,eax32483249// 1st dword {3250xor ecx,ecx3251shr eax,28 // 0xF0000000 -> 0x0000000F3252or ecx,eax3253shl eax,43254or ecx,eax32553256mov eax,edx // 0x0F000000 -> 0x00000F003257shr eax,163258and eax,0x00000F003259or ecx,eax3260shl eax,43261or ecx,eax32623263mov eax,edx3264shr eax,4 // 0x00F00000 -> 0x000F00003265and eax,0x000F00003266or ecx,eax3267shl eax,43268or ecx,eax32693270mov eax,edx3271shl eax,8 // 0x000F0000 -> 0x0F0000003272and eax,0x0F0000003273or ecx,eax3274shl eax,43275or ecx,eax32763277mov dword ptr [edi],ecx3278add edi,43279// }32803281// 2nd dword {3282xor ecx,ecx3283mov eax,edx3284shr eax,12 // 0x0000F000 -> 0x0000000F3285and eax,0x0000000F3286or ecx,eax3287shl eax,43288or ecx,eax32893290mov eax,edx // 0x00000F00 -> 0x00000F003291and eax,0x00000F003292or ecx,eax3293shl eax,43294or ecx,eax32953296mov eax,edx3297shl eax,12 // 0x000000F0 -> 0x000F00003298and eax,0x000F00003299or ecx,eax3300shl eax,43301or ecx,eax33023303shl edx,24 // 0x0000000F -> 0x0F0000003304and edx,0x0F0000003305or ecx,edx3306shl edx,43307or ecx,edx33083309mov dword ptr [edi],ecx3310add edi,43311// }33123313// * copy3314mov eax,dword ptr [esi] // read all 8 pixels3315bswap eax3316add esi,83317mov edx,eax33183319// 1st dword {3320xor ecx,ecx3321shr eax,28 // 0xF0000000 -> 0x0000000F3322or ecx,eax3323shl eax,43324or ecx,eax33253326mov eax,edx // 0x0F000000 -> 0x00000F003327shr eax,163328and eax,0x00000F003329or ecx,eax3330shl eax,43331or ecx,eax33323333mov eax,edx3334shr eax,4 // 0x00F00000 -> 0x000F00003335and eax,0x000F00003336or ecx,eax3337shl eax,43338or ecx,eax33393340mov eax,edx3341shl eax,8 // 0x000F0000 -> 0x0F0000003342and eax,0x0F0000003343or ecx,eax3344shl eax,43345or ecx,eax33463347mov dword ptr [edi],ecx3348add edi,43349// }33503351// 2nd dword {3352xor ecx,ecx3353mov eax,edx3354shr eax,12 // 0x0000F000 -> 0x0000000F3355and eax,0x0000000F3356or ecx,eax3357shl eax,43358or ecx,eax33593360mov eax,edx // 0x00000F00 -> 0x00000F003361and eax,0x00000F003362or ecx,eax3363shl eax,43364or ecx,eax33653366mov eax,edx3367shl eax,12 // 0x000000F0 -> 0x000F00003368and eax,0x000F00003369or ecx,eax3370shl eax,43371or ecx,eax33723373shl edx,24 // 0x0000000F -> 0x0F0000003374and edx,0x0F0000003375or ecx,edx3376shl edx,43377or ecx,edx33783379mov dword ptr [edi],ecx3380add edi,43381// }3382// *33833384pop ecx3385dec ecx3386jnz x_loop_233873388add esi,dword ptr [line]3389add edi,dword ptr [ext]33903391pop ecx3392dec ecx3393jnz y_loop33943395end_y_loop:3396}3397#elif !defined(NO_ASM)3398//printf("Load4bI\n");3399int lTempX, lTempY, lHeight = (int) height;3400asm volatile (3401"1: \n" // y_loop33402"mov %[c], %[tempy] \n"34033404"mov %[wid_64], %%ecx \n"3405"2: \n" // x_loop33406"mov %[c], %[tempx] \n"34073408"mov (%[src]), %%eax \n" // read all 8 pixels3409"bswap %%eax \n"3410"add $4, %[src] \n"3411"mov %%eax, %%edx \n"34123413// 1st dword {3414"xor %%ecx, %%ecx \n"3415"shr $28, %%eax \n" // 0xF0000000 -> 0x0000000F3416"or %%eax, %%ecx \n"3417"shl $4, %%eax \n"3418"or %%eax, %%ecx \n"34193420"mov %%edx, %%eax \n" // 0x0F000000 -> 0x00000F003421"shr $16, %%eax \n"3422"and $0x00000F00, %%eax \n"3423"or %%eax, %%ecx \n"3424"shl $4, %%eax \n"3425"or %%eax, %%ecx \n"34263427"mov %%edx, %%eax \n"3428"shr $4, %%eax \n" // 0x00F00000 -> 0x000F00003429"and $0x000F0000, %%eax \n"3430"or %%eax, %%ecx \n"3431"shl $4, %%eax \n"3432"or %%eax, %%ecx \n"34333434"mov %%edx, %%eax \n"3435"shl $8, %%eax \n" // 0x000F0000 -> 0x0F0000003436"and $0x0F000000, %%eax \n"3437"or %%eax, %%ecx \n"3438"shl $4, %%eax \n"3439"or %%eax, %%ecx \n"34403441"mov %%ecx, (%[dst]) \n"3442"add $4, %[dst] \n"3443// }34443445// 2nd dword {3446"xor %%ecx, %%ecx \n"3447"mov %%edx, %%eax \n"3448"shr $12, %%eax \n" // 0x0000F000 -> 0x0000000F3449"and $0x0000000F, %%eax \n"3450"or %%eax, %%ecx \n"3451"shl $4, %%eax \n"3452"or %%eax, %%ecx \n"34533454"mov %%edx, %%eax \n" // 0x00000F00 -> 0x00000F003455"and $0x00000F00, %%eax \n"3456"or %%eax, %%ecx \n"3457"shl $4, %%eax \n"3458"or %%eax, %%ecx \n"34593460"mov %%edx, %%eax \n"3461"shl $12, %%eax \n" // 0x000000F0 -> 0x000F00003462"and $0x000F0000, %%eax \n"3463"or %%eax, %%ecx \n"3464"shl $4, %%eax \n"3465"or %%eax, %%ecx \n"34663467"shl $24, %%edx \n" // 0x0000000F -> 0x0F0000003468"and $0x0F000000, %%edx \n"3469"or %%edx, %%ecx \n"3470"shl $4, %%edx \n"3471"or %%edx, %%ecx \n"34723473"mov %%ecx, (%[dst]) \n"3474"add $4, %[dst] \n"3475// }34763477// * copy3478"mov (%[src]), %%eax \n" // read all 8 pixels3479"bswap %%eax \n"3480"add $4, %[src] \n"3481"mov %%eax, %%edx \n"34823483// 1st dword {3484"xor %%ecx, %%ecx \n"3485"shr $28, %%eax \n" // 0xF0000000 -> 0x0000000F3486"or %%eax, %%ecx \n"3487"shl $4, %%eax \n"3488"or %%eax, %%ecx \n"34893490"mov %%edx, %%eax \n" // 0x0F000000 -> 0x00000F003491"shr $16, %%eax \n"3492"and $0x00000F00, %%eax \n"3493"or %%eax, %%ecx \n"3494"shl $4, %%eax \n"3495"or %%eax, %%ecx \n"34963497"mov %%edx, %%eax \n"3498"shr $4, %%eax \n" // 0x00F00000 -> 0x000F00003499"and $0x000F0000, %%eax \n"3500"or %%eax, %%ecx \n"3501"shl $4, %%eax \n"3502"or %%eax, %%ecx \n"35033504"mov %%edx, %%eax \n"3505"shl $8, %%eax \n" // 0x000F0000 -> 0x0F0000003506"and $0x0F000000, %%eax \n"3507"or %%eax, %%ecx \n"3508"shl $4, %%eax \n"3509"or %%eax, %%ecx \n"35103511"mov %%ecx, (%[dst]) \n"3512"add $4, %[dst] \n"3513// }35143515// 2nd dword {3516"xor %%ecx, %%ecx \n"3517"mov %%edx, %%eax \n"3518"shr $12, %%eax \n" // 0x0000F000 -> 0x0000000F3519"and $0x0000000F, %%eax \n"3520"or %%eax, %%ecx \n"3521"shl $4, %%eax \n"3522"or %%eax, %%ecx \n"35233524"mov %%edx, %%eax \n" // 0x00000F00 -> 0x00000F003525"and $0x00000F00, %%eax \n"3526"or %%eax, %%ecx \n"3527"shl $4, %%eax \n"3528"or %%eax, %%ecx \n"35293530"mov %%edx, %%eax \n"3531"shl $12, %%eax \n" // 0x000000F0 -> 0x000F00003532"and $0x000F0000, %%eax \n"3533"or %%eax, %%ecx \n"3534"shl $4, %%eax \n"3535"or %%eax, %%ecx \n"35363537"shl $24, %%edx \n" // 0x0000000F -> 0x0F0000003538"and $0x0F000000, %%edx \n"3539"or %%edx, %%ecx \n"3540"shl $4, %%edx \n"3541"or %%edx, %%ecx \n"35423543"mov %%ecx, (%[dst]) \n"3544"add $4, %[dst] \n"3545// }3546// *35473548"mov %[tempx], %[c] \n"3549"dec %%ecx \n"3550"jnz 2b \n" // x_loop335513552"mov %[tempy], %[c] \n"3553"dec %%ecx \n"3554"jz 4f \n" // end_y_loop33555"mov %[c], %[tempy] \n"35563557"add %[line], %[src] \n"3558"add %[ext], %[dst] \n"35593560"mov %[wid_64], %%ecx \n"3561"3: \n" // x_loop_233562"mov %[c], %[tempx] \n"35633564"mov 4(%[src]), %%eax \n" // read all 8 pixels3565"bswap %%eax \n"3566"mov %%eax, %%edx \n"35673568// 1st dword {3569"xor %%ecx, %%ecx \n"3570"shr $28, %%eax \n" // 0xF0000000 -> 0x0000000F3571"or %%eax, %%ecx \n"3572"shl $4, %%eax \n"3573"or %%eax, %%ecx \n"35743575"mov %%edx, %%eax \n" // 0x0F000000 -> 0x00000F003576"shr $16, %%eax \n"3577"and $0x00000F00, %%eax \n"3578"or %%eax, %%ecx \n"3579"shl $4, %%eax \n"3580"or %%eax, %%ecx \n"35813582"mov %%edx, %%eax \n"3583"shr $4, %%eax \n" // 0x00F00000 -> 0x000F00003584"and $0x000F0000, %%eax \n"3585"or %%eax, %%ecx \n"3586"shl $4, %%eax \n"3587"or %%eax, %%ecx \n"35883589"mov %%edx, %%eax \n"3590"shl $8, %%eax \n" // 0x000F0000 -> 0x0F0000003591"and $0x0F000000, %%eax \n"3592"or %%eax, %%ecx \n"3593"shl $4, %%eax \n"3594"or %%eax, %%ecx \n"35953596"mov %%ecx, (%[dst]) \n"3597"add $4, %[dst] \n"3598// }35993600// 2nd dword {3601"xor %%ecx, %%ecx \n"3602"mov %%edx, %%eax \n"3603"shr $12, %%eax \n" // 0x0000F000 -> 0x0000000F3604"and $0x0000000F, %%eax \n"3605"or %%eax, %%ecx \n"3606"shl $4, %%eax \n"3607"or %%eax, %%ecx \n"36083609"mov %%edx, %%eax \n" // 0x00000F00 -> 0x00000F003610"and $0x00000F00, %%eax \n"3611"or %%eax, %%ecx \n"3612"shl $4, %%eax \n"3613"or %%eax, %%ecx \n"36143615"mov %%edx, %%eax \n"3616"shl $12, %%eax \n" // 0x000000F0 -> 0x000F00003617"and $0x000F0000, %%eax \n"3618"or %%eax, %%ecx \n"3619"shl $4, %%eax \n"3620"or %%eax, %%ecx \n"36213622"shl $24, %%edx \n" // 0x0000000F -> 0x0F0000003623"and $0x0F000000, %%edx \n"3624"or %%edx, %%ecx \n"3625"shl $4, %%edx \n"3626"or %%edx, %%ecx \n"36273628"mov %%ecx, (%[dst]) \n"3629"add $4, %[dst] \n"3630// }36313632// * copy3633"mov (%[src]), %%eax \n" // read all 8 pixels3634"bswap %%eax \n"3635"add $8, %[src] \n"3636"mov %%eax, %%edx \n"36373638// 1st dword {3639"xor %%ecx, %%ecx \n"3640"shr $28, %%eax \n" // 0xF0000000 -> 0x0000000F3641"or %%eax, %%ecx \n"3642"shl $4, %%eax \n"3643"or %%eax, %%ecx \n"36443645"mov %%edx, %%eax \n" // 0x0F000000 -> 0x00000F003646"shr $16, %%eax \n"3647"and $0x00000F00, %%eax \n"3648"or %%eax, %%ecx \n"3649"shl $4, %%eax \n"3650"or %%eax, %%ecx \n"36513652"mov %%edx, %%eax \n"3653"shr $4, %%eax \n" // 0x00F00000 -> 0x000F00003654"and $0x000F0000, %%eax \n"3655"or %%eax, %%ecx \n"3656"shl $4, %%eax \n"3657"or %%eax, %%ecx \n"36583659"mov %%edx, %%eax \n"3660"shl $8, %%eax \n" // 0x000F0000 -> 0x0F0000003661"and $0x0F000000, %%eax \n"3662"or %%eax, %%ecx \n"3663"shl $4, %%eax \n"3664"or %%eax, %%ecx \n"36653666"mov %%ecx, (%[dst]) \n"3667"add $4, %[dst] \n"3668// }36693670// 2nd dword {3671"xor %%ecx, %%ecx \n"3672"mov %%edx, %%eax \n"3673"shr $12, %%eax \n" // 0x0000F000 -> 0x0000000F3674"and $0x0000000F, %%eax \n"3675"or %%eax, %%ecx \n"3676"shl $4, %%eax \n"3677"or %%eax, %%ecx \n"36783679"mov %%edx, %%eax \n" // 0x00000F00 -> 0x00000F003680"and $0x00000F00, %%eax \n"3681"or %%eax, %%ecx \n"3682"shl $4, %%eax \n"3683"or %%eax, %%ecx \n"36843685"mov %%edx, %%eax \n"3686"shl $12, %%eax \n" // 0x000000F0 -> 0x000F00003687"and $0x000F0000, %%eax \n"3688"or %%eax, %%ecx \n"3689"shl $4, %%eax \n"3690"or %%eax, %%ecx \n"36913692"shl $24, %%edx \n" // 0x0000000F -> 0x0F0000003693"and $0x0F000000, %%edx \n"3694"or %%edx, %%ecx \n"3695"shl $4, %%edx \n"3696"or %%edx, %%ecx \n"36973698"mov %%ecx, (%[dst]) \n"3699"add $4, %[dst] \n"3700// }3701// *37023703"mov %[tempx], %[c] \n"3704"dec %%ecx \n"3705"jnz 3b \n" // x_loop_2337063707"add %[line], %[src] \n"3708"add %[ext], %[dst] \n"37093710"mov %[tempy], %[c] \n"3711"dec %%ecx \n"3712"jnz 1b \n" // y_loop337133714"4: \n" // end_y_loop33715: [tempx]"=m"(lTempX), [tempy]"=m"(lTempY), [src] "+S"(src), [dst] "+D"(dst), [c]"+c"(lHeight)3716: [wid_64] "g" (wid_64), [line] "g" ((uintptr_t)line), [ext] "g" ((uintptr_t)ext)3717: "memory", "cc", "eax", "edx"3718);3719#endif37203721return /*(0 << 16) | */GR_TEXFMT_ALPHA_INTENSITY_44;3722}37233724//****************************************************************3725// Size: 0, Format: 037263727DWORD Load4bSelect (unsigned char * dst, unsigned char * src, int wid_64, int height, int line, int real_width, int tile)3728{3729if (rdp.tlut_mode == 0)3730return Load4bI (dst, src, wid_64, height, line, real_width, tile);37313732return Load4bCI (dst, src, wid_64, height, line, real_width, tile);3733}3734373537363737