diff --git a/src/sys/graphics/objgfx30.cpp b/src/sys/graphics/objgfx30.cpp index f3d10c8..776a662 100755 --- a/src/sys/graphics/objgfx30.cpp +++ b/src/sys/graphics/objgfx30.cpp @@ -117,23 +117,47 @@ switch (BPP) { case 8: asm( - "movl $256,%%ecx \n" - "movl $256*3+1, %%ebx \n" - "xorl %%eax, %%eax \n" - "lop: \n" - "pushl %%eax \n" - "movb (%%esi), %%al \n" - "incl %%esi \n" - "subb %1, %%al \n" - "popl %%eax \n" - "decl %%ecx \n" - "jcxz lop \n" - : - :"S"(pal), "g"(red) - :"eax","ecx" - ); // asm + "movl $256,%%ecx \n" + "movl $256*3+1,%%ebx \n" + "xor %%eax,%%eax \n" + "lop: \n" + " pushl %%eax \n" + " mov (%%esi),%%al \n" + " inc %%esi \n" + " sub %1,%%al \n" + " jns abs1 \n" + " neg %%al \n" + "abs1: \n" + " movl %%eax,%%edi \n" + " mov (%%esi),%%al \n" + " inc %%esi \n" + " sub %2,%%al \n" + " jns abs2 \n" + " neg %%al \n" + "abs2: \n" + " add %%eax,%%edi \n" + " mov (%%esi),%%al \n" + " inc %%esi \n" + " sub %3,%%al \n" + " jns abs3 \n" + " neg %%al \n" + "abs3: \n" + " add %%eax,%%edi \n" + " pop %%eax \n" + " cmp %%ebx,%%edi \n" + " jae no_good_match \n" + " movl %%edi,%%ebx \n" + "no_good_match: \n" + " inc %%eax \n" + " dec %%ecx \n" + " jnz lop \n" + : + : "S" (pal), "g" (red), "g" (green), "g" (blue) + ); + asm("": "=a" (lastclr)); break; } // switch + //asm("": "=a" (lastclr)); return lastclr; } // TGfx0::RGB