diff --git a/src/draw_tile_ammx.c b/src/draw_tile_ammx.c index 1f9e667..54ac7a1 100644 --- a/src/draw_tile_ammx.c +++ b/src/draw_tile_ammx.c @@ -33,7 +33,6 @@ typedef union { extern const uint16_t ddaxskip_i[17]; -extern uint8_t line_limit[256], *limit; static uint32_t scalex; static uint32_t* last_palbase = 0; @@ -77,187 +76,147 @@ static inline void handle_palette(uint32_t* palbase) { ); } -static inline void draw_tile_m68k_norm (uint16_t*tilepos, uint32_t*gfxdata, uint16_t scaley) { - int16_t y; - - for(y = 16; y >= 0; y--) { +static __attribute((regparm(4))) inline void draw_tile_m68k_norm (uint16_t*tilepos, uint32_t*gfxdata, uint16_t scaley) { + while(scaley) { if(scaley & 0x8000) { - #ifdef HONOUR_SPRITE_LIMIT - if(*limit < 96) { - *limit += 1; - #endif - __asm__ volatile ( "\n" - "\tmove.w (%0),d0 \n" - "\tmove.w 2(%0),d1 \n" - "\tmove.w 4(%0),d2 \n" - "\tmove.w 6(%0),d3 \n" - - // TRANSi takes 8, 4-bit values from source and uses - // words stored in E8 thru E23 to write the dest - // since this needs 128-bit, this uses a register pair - "\tdc.w 0xfe00,0x1803 \n" // TRANSi-LO D0, E0:E1 - "\tdc.w 0xfe01,0x1A03 \n" // TRANSi-LO D1, E2:E3 - "\tdc.w 0xfe02,0x1C03 \n" // TRANSi-LO D2, E4:E5 - "\tdc.w 0xfe03,0x1E03 \n" // TRANSi-LO D3, E6:E7 - - // STOREM3 will conditionally store each word - "\tdc.w 0xFE12,0x9926 \n" // STOREM3.W E1,E1,(A2) - "\tdc.w 0xFE2A,0xBB26,0x0008 \n" // STOREM3.W E3,E3,(8,A2) - "\tdc.w 0xFE2A,0xDD26,0x0010 \n" // STOREM3.W E5,E5,(16,A2) - "\tdc.w 0xFE2A,0xFF26,0x0018 \n" // STOREM3.W E7,E7,(24,A2) - - : "+a"(gfxdata),"+a"(tilepos) - :: "d0","d1","d2","d3" - ); - #ifdef HONOUR_SPRITE_LIMIT - } - limit++; - #endif + __asm__ volatile ( "\n" + "\tmove.w 0(%0),d0 \n" + "\tmove.w 2(%0),d1 \n" + "\tmove.w 4(%0),d2 \n" + "\tmove.w 6(%0),d3 \n" + + // TRANSi takes 8, 4-bit values from source and uses + // words stored in E8 thru E23 to write the dest + // since this needs 128-bit, this uses a register pair + "\tdc.w 0xfe00,0x1803 \n" // TRANSi-LO D0, E0:E1 + "\tdc.w 0xfe01,0x1a03 \n" // TRANSi-LO D1, E2:E3 + "\tdc.w 0xfe02,0x1c03 \n" // TRANSi-LO D2, E4:E5 + "\tdc.w 0xfe03,0x1e03 \n" // TRANSi-LO D3, E6:E7 + + // STOREM3 will conditionally store each word + "\tdc.w 0xfe11,0x9926 \n" // STOREM3.W E1,E1,(A1) + "\tdc.w 0xfe29,0xbb26,0x0008 \n" // STOREM3.W E3,E3,(8,A1) + "\tdc.w 0xfe29,0xdd26,0x0010 \n" // STOREM3.W E5,E5,(16,A1) + "\tdc.w 0xfe29,0xff26,0x0018 \n" // STOREM3.W E7,E7,(24,A1) + + : "+a"(gfxdata),"+a"(tilepos) + :: "d0","d1","d2","d3" + ); tilepos += PITCH / 2; - } - scaley <<= 1; + } gfxdata += 2; + scaley <<= 1; } } -static inline void draw_tile_m68k_xflip_norm (uint16_t*tilepos, uint32_t*gfxdata, uint16_t scaley) { - int16_t y; - - for(y = 16; y >= 0; y--) { +static __attribute((regparm(4))) inline void draw_tile_m68k_xflip_norm (uint16_t*tilepos, uint32_t*gfxdata, uint16_t scaley) { + while(scaley) { if(scaley & 0x8000) { - #ifdef HONOUR_SPRITE_LIMIT - if(*limit < 96) { - *limit += 1; - #endif - __asm__ volatile ( "\n" - "\tmove.w (%0),d3 \n" - "\tmove.w 2(%0),d2 \n" - "\tmove.w 4(%0),d1 \n" - "\tmove.w 6(%0),d0 \n" - - // TRANSi takes 8, 4-bit values from source and uses - // words stored in E8 thru E23 to write the dest - // since this needs 128-bit, this uses a register pair - "\tdc.w 0xfe00,0x1803 \n" // TRANSi-LO D0, E0:E1 - "\tdc.w 0xfe01,0x1A03 \n" // TRANSi-LO D1, E2:E3 - "\tdc.w 0xfe02,0x1C03 \n" // TRANSi-LO D2, E4:E5 - "\tdc.w 0xfe03,0x1E03 \n" // TRANSi-LO D3, E6:E7 - - // VPERM to shuffle the colours to match the fix layer format - "dc.w 0xfe3F,0x9909,0x6745,0x2301 \n" // VPERM #IMMD,E1,E1,E1 - "dc.w 0xfe3F,0xBB0B,0x6745,0x2301 \n" // VPERM #IMMD,E3,E3,E3 - "dc.w 0xfe3F,0xDD0D,0x6745,0x2301 \n" // VPERM #IMMD,E5,E5,E5 - "dc.w 0xfe3F,0xFF0F,0x6745,0x2301 \n" // VPERM #IMMD,E7,E7,E7 - - // STOREM3 will conditionally store each word - "\tdc.w 0xFE12,0x9926 \n" // STOREM3.W E1,E1,(A2) - "\tdc.w 0xFE2A,0xBB26,0x0008 \n" // STOREM3.W E3,E3,(8,A2) - "\tdc.w 0xFE2A,0xDD26,0x0010 \n" // STOREM3.W E5,E5,(16,A2) - "\tdc.w 0xFE2A,0xFF26,0x0018 \n" // STOREM3.W E7,E7,(24,A2) - - : "+a"(gfxdata),"+a"(tilepos) - :: "d0","d1","d2","d3" - ); - #ifdef HONOUR_SPRITE_LIMIT - } - limit++; - #endif + __asm__ volatile ( "\n" + "\tmove.w 0(%0),d3 \n" + "\tmove.w 2(%0),d2 \n" + "\tmove.w 4(%0),d1 \n" + "\tmove.w 6(%0),d0 \n" + + // TRANSi takes 8, 4-bit values from source and uses + // words stored in E8 thru E23 to write the dest + // since this needs 128-bit, this uses a register pair + "\tdc.w 0xfe00,0x1803 \n" // TRANSi-LO D0, E0:E1 + "\tdc.w 0xfe01,0x1A03 \n" // TRANSi-LO D1, E2:E3 + "\tdc.w 0xfe02,0x1C03 \n" // TRANSi-LO D2, E4:E5 + "\tdc.w 0xfe03,0x1E03 \n" // TRANSi-LO D3, E6:E7 + + // VPERM to shuffle the colours to match the fix layer format + "dc.w 0xfe3F,0x9909,0x6745,0x2301 \n" // VPERM #IMMD,E1,E1,E1 + "dc.w 0xfe3F,0xBB0B,0x6745,0x2301 \n" // VPERM #IMMD,E3,E3,E3 + "dc.w 0xfe3F,0xDD0D,0x6745,0x2301 \n" // VPERM #IMMD,E5,E5,E5 + "dc.w 0xfe3F,0xFF0F,0x6745,0x2301 \n" // VPERM #IMMD,E7,E7,E7 + + // STOREM3 will conditionally store each word + "\tdc.w 0xFE11,0x9926 \n" // STOREM3.W E1,E1,(A2) + "\tdc.w 0xFE29,0xBB26,0x0008 \n" // STOREM3.W E3,E3,(8,A2) + "\tdc.w 0xFE29,0xDD26,0x0010 \n" // STOREM3.W E5,E5,(16,A2) + "\tdc.w 0xFE29,0xFF26,0x0018 \n" // STOREM3.W E7,E7,(24,A2) + + : "+a"(gfxdata),"+a"(tilepos) + :: "d0","d1","d2","d3" + ); tilepos += PITCH / 2; - } + } + gfxdata += 2; scaley <<= 1; - gfxdata += 2; } } -static inline void draw_tile_m68k_yflip_norm (uint16_t*tilepos, uint32_t*gfxdata, uint16_t scaley) { - int16_t y; - +static __attribute((regparm(4))) inline void draw_tile_m68k_yflip_norm (uint16_t*tilepos, uint32_t*gfxdata, uint16_t scaley) { gfxdata += 30; - for(y = 16; y >= 0; y--) { + while(scaley) { if(scaley & 0x8000) { - #ifdef HONOUR_SPRITE_LIMIT - if(*limit < 96) { - *limit += 1; - #endif - __asm__ volatile ( "\n" - "\tmove.w (%0),d0 \n" - "\tmove.w 2(%0),d1 \n" - "\tmove.w 4(%0),d2 \n" - "\tmove.w 6(%0),d3 \n" - - // TRANSi takes 8, 4-bit values from source and uses - // words stored in E8 thru E23 to write the dest - // since this needs 128-bit, this uses a register pair - "\tdc.w 0xfe00,0x1803 \n" // TRANSi-LO D0, E0:E1 - "\tdc.w 0xfe01,0x1A03 \n" // TRANSi-LO D1, E2:E3 - "\tdc.w 0xfe02,0x1C03 \n" // TRANSi-LO D2, E4:E5 - "\tdc.w 0xfe03,0x1E03 \n" // TRANSi-LO D3, E6:E7 - - // STOREM3 will conditionally store each word - "\tdc.w 0xFE12,0x9926 \n" // STOREM3.W E1,E1,(A2) - "\tdc.w 0xFE2A,0xBB26,0x0008 \n" // STOREM3.W E3,E3,(8,A2) - "\tdc.w 0xFE2A,0xDD26,0x0010 \n" // STOREM3.W E5,E5,(16,A2) - "\tdc.w 0xFE2A,0xFF26,0x0018 \n" // STOREM3.W E7,E7,(24,A2) - - : "+a"(gfxdata),"+a"(tilepos) - :: "d0","d1","d2","d3" - ); - #ifdef HONOUR_SPRITE_LIMIT - } - limit++; - #endif + __asm__ volatile ( "\n" + "\tmove.w 0(%0),d0 \n" + "\tmove.w 2(%0),d1 \n" + "\tmove.w 4(%0),d2 \n" + "\tmove.w 6(%0),d3 \n" + + // TRANSi takes 8, 4-bit values from source and uses + // words stored in E8 thru E23 to write the dest + // since this needs 128-bit, this uses a register pair + "\tdc.w 0xfe00,0x1803 \n" // TRANSi-LO D0, E0:E1 + "\tdc.w 0xfe01,0x1a03 \n" // TRANSi-LO D1, E2:E3 + "\tdc.w 0xfe02,0x1c03 \n" // TRANSi-LO D2, E4:E5 + "\tdc.w 0xfe03,0x1e03 \n" // TRANSi-LO D3, E6:E7 + + // STOREM3 will conditionally store each word + "\tdc.w 0xfe11,0x9926 \n" // STOREM3.W E1,E1,(A1) + "\tdc.w 0xfe29,0xbb26,0x0008 \n" // STOREM3.W E3,E3,(8,A1) + "\tdc.w 0xfe29,0xdd26,0x0010 \n" // STOREM3.W E5,E5,(16,A1) + "\tdc.w 0xfe29,0xff26,0x0018 \n" // STOREM3.W E7,E7,(24,A1) + + : "+a"(gfxdata),"+a"(tilepos) + :: "d0","d1","d2","d3" + ); tilepos += PITCH / 2; - } - scaley <<= 1; + } gfxdata -= 2; - } + scaley <<= 1; + } } -static inline void draw_tile_m68k_xyflip_norm (uint16_t*tilepos, uint32_t*gfxdata, uint16_t scaley) { - int16_t y; - +static __attribute((regparm(4))) inline void draw_tile_m68k_xyflip_norm (uint16_t*tilepos, uint32_t*gfxdata, uint16_t scaley) { gfxdata += 30; - for(y = 16; y >= 0; y--) { + while(scaley) { if(scaley & 0x8000) { - #ifdef HONOUR_SPRITE_LIMIT - if(*limit < 96) { - *limit += 1; - #endif - __asm__ volatile ( "\n" - "\tmove.w (%0),d3 \n" - "\tmove.w 2(%0),d2 \n" - "\tmove.w 4(%0),d1 \n" - "\tmove.w 6(%0),d0 \n" - - // TRANSi takes 8, 4-bit values from source and uses - // words stored in E8 thru E23 to write the dest - // since this needs 128-bit, this uses a register pair - "\tdc.w 0xfe00,0x1803 \n" // TRANSi-LO D0, E0:E1 - "\tdc.w 0xfe01,0x1A03 \n" // TRANSi-LO D1, E2:E3 - "\tdc.w 0xfe02,0x1C03 \n" // TRANSi-LO D2, E4:E5 - "\tdc.w 0xfe03,0x1E03 \n" // TRANSi-LO D3, E6:E7 - - // VPERM to shuffle the colours to match the fix layer format - "dc.w 0xfe3F,0x9909,0x6745,0x2301 \n" // VPERM #IMMD,E1,E1,E1 - "dc.w 0xfe3F,0xBB0B,0x6745,0x2301 \n" // VPERM #IMMD,E3,E3,E3 - "dc.w 0xfe3F,0xDD0D,0x6745,0x2301 \n" // VPERM #IMMD,E5,E5,E5 - "dc.w 0xfe3F,0xFF0F,0x6745,0x2301 \n" // VPERM #IMMD,E7,E7,E7 - - // STOREM3 will conditionally store each word - "\tdc.w 0xFE12,0x9926 \n" // STOREM3.W E1,E1,(A2) - "\tdc.w 0xFE2A,0xBB26,0x0008 \n" // STOREM3.W E3,E3,(8,A2) - "\tdc.w 0xFE2A,0xDD26,0x0010 \n" // STOREM3.W E5,E5,(16,A2) - "\tdc.w 0xFE2A,0xFF26,0x0018 \n" // STOREM3.W E7,E7,(24,A2) - - : "+a"(gfxdata),"+a"(tilepos) - :: "d0","d1","d2","d3" - ); - #ifdef HONOUR_SPRITE_LIMIT - } - limit++; - #endif + __asm__ volatile ( "\n" + "\tmove.w 0(%0),d3 \n" + "\tmove.w 2(%0),d2 \n" + "\tmove.w 4(%0),d1 \n" + "\tmove.w 6(%0),d0 \n" + + // TRANSi takes 8, 4-bit values from source and uses + // words stored in E8 thru E23 to write the dest + // since this needs 128-bit, this uses a register pair + "\tdc.w 0xfe00,0x1803 \n" // TRANSi-LO D0, E0:E1 + "\tdc.w 0xfe01,0x1A03 \n" // TRANSi-LO D1, E2:E3 + "\tdc.w 0xfe02,0x1C03 \n" // TRANSi-LO D2, E4:E5 + "\tdc.w 0xfe03,0x1E03 \n" // TRANSi-LO D3, E6:E7 + + // VPERM to shuffle the colours to match the fix layer format + "dc.w 0xfe3F,0x9909,0x6745,0x2301 \n" // VPERM #IMMD,E1,E1,E1 + "dc.w 0xfe3F,0xBB0B,0x6745,0x2301 \n" // VPERM #IMMD,E3,E3,E3 + "dc.w 0xfe3F,0xDD0D,0x6745,0x2301 \n" // VPERM #IMMD,E5,E5,E5 + "dc.w 0xfe3F,0xFF0F,0x6745,0x2301 \n" // VPERM #IMMD,E7,E7,E7 + + // STOREM3 will conditionally store each word + "\tdc.w 0xFE11,0x9926 \n" // STOREM3.W E1,E1,(A2) + "\tdc.w 0xFE29,0xBB26,0x0008 \n" // STOREM3.W E3,E3,(8,A2) + "\tdc.w 0xFE29,0xDD26,0x0010 \n" // STOREM3.W E5,E5,(16,A2) + "\tdc.w 0xFE29,0xFF26,0x0018 \n" // STOREM3.W E7,E7,(24,A2) + + : "+a"(gfxdata),"+a"(tilepos) + :: "d0","d1","d2","d3" + ); tilepos += PITCH / 2; - } + } + gfxdata -= 2; scaley <<= 1; - gfxdata -= 2; - } + } } static inline void draw_tile_m68k_xzoom (uint32_t*palbase,uint16_t*tilepos,uint32_t*gfxdata,int scaley) { @@ -267,32 +226,27 @@ static inline void draw_tile_m68k_xzoom (uint32_t*palbase,uint16_t*tilepos,uint3 for(;;) { tilepos = org_tilepos; if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - pixeldata.pixel = gfxdata[0]; - if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - - pixeldata.pixel = gfxdata[1]; - if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - - } + pixeldata.pixel = gfxdata[0]; + if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + + pixeldata.pixel = gfxdata[1]; + if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + org_tilepos += PITCH / 2; - limit++; } if(!y) break; scaley <<= 1; @@ -307,32 +261,27 @@ static inline void draw_tile_m68k_xzoomX (uint32_t*palbase,uint16_t*tilepos,uin for(;;) { tilepos = org_tilepos; if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - pixeldata.pixel = gfxdata[1]; - if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - - pixeldata.pixel = gfxdata[0]; - if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - } + pixeldata.pixel = gfxdata[1]; + if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + + pixeldata.pixel = gfxdata[0]; + if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } org_tilepos += PITCH / 2; - limit++; } if(!y) break; scaley <<= 1; @@ -348,33 +297,28 @@ static inline void draw_tile_m68k_xzoomY (uint32_t*palbase,uint16_t*tilepos,uin gfxdata += 30; for(;;) { tilepos = org_tilepos; - if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - pixeldata.pixel = gfxdata[0]; - if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - - pixeldata.pixel = gfxdata[1]; - if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - } + if(scaley & 0x8000) { + pixeldata.pixel = gfxdata[0]; + if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + + pixeldata.pixel = gfxdata[1]; + if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } org_tilepos += PITCH / 2; - limit++; } if(!y) break; scaley <<= 1; @@ -391,31 +335,27 @@ static inline void draw_tile_m68k_xzoomXY (uint32_t*palbase,uint16_t*tilepos,ui for(;;) { tilepos = org_tilepos; if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - pixeldata.pixel = gfxdata[1]; - if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - - pixeldata.pixel = gfxdata[0]; - if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - } + pixeldata.pixel = gfxdata[1]; + if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + + pixeldata.pixel = gfxdata[0]; + if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + org_tilepos += PITCH / 2; - limit++; } if(!y) break; scaley <<= 1; @@ -559,9 +499,7 @@ void draw_tiles_ammx(void) { uint32_t *gfxdata = (uint32_t*)&memory.rom.tiles.p[(tileno % memory.nb_of_tiles)<<7]; uint16_t scaley = ddaxskip_i[yskip]; const int pitch = PITCH / 2; - - limit = &line_limit[sy]; - + if (rzx==16) { handle_palette(palbase); if (tileatr & 0x01) { @@ -600,4 +538,4 @@ void draw_tiles_ammx(void) { sy += yskip; } /* for y */ } /* for count */ -} +} \ No newline at end of file diff --git a/src/draw_tile_m68k.c b/src/draw_tile_m68k.c index 3402f04..19b786e 100644 --- a/src/draw_tile_m68k.c +++ b/src/draw_tile_m68k.c @@ -30,8 +30,6 @@ typedef union { } packpix_t; extern const uint16_t ddaxskip_i[17]; - -extern uint8_t line_limit[256], *limit; static uint32_t scalex; #define DO_NOT_REORDER() asm volatile("": : :"memory") @@ -48,35 +46,32 @@ INLINE void __attribute__((regparm(4))) draw_tile_m68k_norm (uint32_t*palbase,ui while(y--) { if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - if((pixels0.pixel = gfxdata[0])) { pixel1 = pixels0.p.p0; DO_NOT_REORDER(); - pixel2 = pixels0.p.p1; DO_NOT_REORDER(); - if(pixel1) screen[0x0] = palbase[pixel1]; pixel1 = pixels0.p.p2; - if(pixel2) screen[0x1] = palbase[pixel2]; pixel2 = pixels0.p.p3; - if(pixel1) screen[0x2] = palbase[pixel1]; pixel1 = pixels0.p.p4; - if(pixel2) screen[0x3] = palbase[pixel2]; pixel2 = pixels0.p.p5; - if(pixel1) screen[0x4] = palbase[pixel1]; pixel1 = pixels0.p.p6; - if(pixel2) screen[0x5] = palbase[pixel2]; pixel2 = pixels0.p.p7; - if(pixel1) screen[0x6] = palbase[pixel1]; - if(pixel2) screen[0x7] = palbase[pixel2]; - } - - if((pixels0.pixel = gfxdata[1])) { pixel1 = pixels0.p.p0; DO_NOT_REORDER(); - pixel2 = pixels0.p.p1; DO_NOT_REORDER(); - if(pixel1) screen[0x8] = palbase[pixel1]; pixel1 = pixels0.p.p2; - if(pixel2) screen[0x9] = palbase[pixel2]; pixel2 = pixels0.p.p3; - if(pixel1) screen[0xA] = palbase[pixel1]; pixel1 = pixels0.p.p4; - if(pixel2) screen[0xB] = palbase[pixel2]; pixel2 = pixels0.p.p5; - if(pixel1) screen[0xC] = palbase[pixel1]; pixel1 = pixels0.p.p6; - if(pixel2) screen[0xD] = palbase[pixel2]; pixel2 = pixels0.p.p7; - if(pixel1) screen[0xE] = palbase[pixel1]; - if(pixel2) screen[0xF] = palbase[pixel2]; - } + + if((pixels0.pixel = gfxdata[0])) { pixel1 = pixels0.p.p0; DO_NOT_REORDER(); + pixel2 = pixels0.p.p1; DO_NOT_REORDER(); + if(pixel1) screen[0x0] = palbase[pixel1]; pixel1 = pixels0.p.p2; + if(pixel2) screen[0x1] = palbase[pixel2]; pixel2 = pixels0.p.p3; + if(pixel1) screen[0x2] = palbase[pixel1]; pixel1 = pixels0.p.p4; + if(pixel2) screen[0x3] = palbase[pixel2]; pixel2 = pixels0.p.p5; + if(pixel1) screen[0x4] = palbase[pixel1]; pixel1 = pixels0.p.p6; + if(pixel2) screen[0x5] = palbase[pixel2]; pixel2 = pixels0.p.p7; + if(pixel1) screen[0x6] = palbase[pixel1]; + if(pixel2) screen[0x7] = palbase[pixel2]; + } + + if((pixels0.pixel = gfxdata[1])) { pixel1 = pixels0.p.p0; DO_NOT_REORDER(); + pixel2 = pixels0.p.p1; DO_NOT_REORDER(); + if(pixel1) screen[0x8] = palbase[pixel1]; pixel1 = pixels0.p.p2; + if(pixel2) screen[0x9] = palbase[pixel2]; pixel2 = pixels0.p.p3; + if(pixel1) screen[0xA] = palbase[pixel1]; pixel1 = pixels0.p.p4; + if(pixel2) screen[0xB] = palbase[pixel2]; pixel2 = pixels0.p.p5; + if(pixel1) screen[0xC] = palbase[pixel1]; pixel1 = pixels0.p.p6; + if(pixel2) screen[0xD] = palbase[pixel2]; pixel2 = pixels0.p.p7; + if(pixel1) screen[0xE] = palbase[pixel1]; + if(pixel2) screen[0xF] = palbase[pixel2]; } + screen += PITCH / 2; - limit++; } scaley <<= 1; gfxdata += 2; @@ -89,35 +84,31 @@ INLINE void __attribute__((regparm(4))) draw_tile_m68k_xflip_norm (uint32_t*palb while(y--) { if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - if((pixels0.pixel = gfxdata[1])) { pixel1 = pixels0.p.p7; DO_NOT_REORDER(); - pixel2 = pixels0.p.p6; DO_NOT_REORDER(); - if(pixel1) screen[0x0] = palbase[pixel1]; pixel1 = pixels0.p.p5; - if(pixel2) screen[0x1] = palbase[pixel2]; pixel2 = pixels0.p.p4; - if(pixel1) screen[0x2] = palbase[pixel1]; pixel1 = pixels0.p.p3; - if(pixel2) screen[0x3] = palbase[pixel2]; pixel2 = pixels0.p.p2; - if(pixel1) screen[0x4] = palbase[pixel1]; pixel1 = pixels0.p.p1; - if(pixel2) screen[0x5] = palbase[pixel2]; pixel2 = pixels0.p.p0; - if(pixel1) screen[0x6] = palbase[pixel1]; - if(pixel2) screen[0x7] = palbase[pixel2]; - } - - if((pixels0.pixel = gfxdata[0])) { pixel1 = pixels0.p.p7; DO_NOT_REORDER(); - pixel2 = pixels0.p.p6; DO_NOT_REORDER(); - if(pixel1) screen[0x8] = palbase[pixel1]; pixel1 = pixels0.p.p5; - if(pixel2) screen[0x9] = palbase[pixel2]; pixel2 = pixels0.p.p4; - if(pixel1) screen[0xA] = palbase[pixel1]; pixel1 = pixels0.p.p3; - if(pixel2) screen[0xB] = palbase[pixel2]; pixel2 = pixels0.p.p2; - if(pixel1) screen[0xC] = palbase[pixel1]; pixel1 = pixels0.p.p1; - if(pixel2) screen[0xD] = palbase[pixel2]; pixel2 = pixels0.p.p0; - if(pixel1) screen[0xE] = palbase[pixel1]; - if(pixel2) screen[0xF] = palbase[pixel2]; - } + if((pixels0.pixel = gfxdata[1])) { pixel1 = pixels0.p.p7; DO_NOT_REORDER(); + pixel2 = pixels0.p.p6; DO_NOT_REORDER(); + if(pixel1) screen[0x0] = palbase[pixel1]; pixel1 = pixels0.p.p5; + if(pixel2) screen[0x1] = palbase[pixel2]; pixel2 = pixels0.p.p4; + if(pixel1) screen[0x2] = palbase[pixel1]; pixel1 = pixels0.p.p3; + if(pixel2) screen[0x3] = palbase[pixel2]; pixel2 = pixels0.p.p2; + if(pixel1) screen[0x4] = palbase[pixel1]; pixel1 = pixels0.p.p1; + if(pixel2) screen[0x5] = palbase[pixel2]; pixel2 = pixels0.p.p0; + if(pixel1) screen[0x6] = palbase[pixel1]; + if(pixel2) screen[0x7] = palbase[pixel2]; + } + + if((pixels0.pixel = gfxdata[0])) { pixel1 = pixels0.p.p7; DO_NOT_REORDER(); + pixel2 = pixels0.p.p6; DO_NOT_REORDER(); + if(pixel1) screen[0x8] = palbase[pixel1]; pixel1 = pixels0.p.p5; + if(pixel2) screen[0x9] = palbase[pixel2]; pixel2 = pixels0.p.p4; + if(pixel1) screen[0xA] = palbase[pixel1]; pixel1 = pixels0.p.p3; + if(pixel2) screen[0xB] = palbase[pixel2]; pixel2 = pixels0.p.p2; + if(pixel1) screen[0xC] = palbase[pixel1]; pixel1 = pixels0.p.p1; + if(pixel2) screen[0xD] = palbase[pixel2]; pixel2 = pixels0.p.p0; + if(pixel1) screen[0xE] = palbase[pixel1]; + if(pixel2) screen[0xF] = palbase[pixel2]; } + screen += PITCH / 2; - limit++; } scaley <<= 1; gfxdata += 2; @@ -131,36 +122,30 @@ INLINE void __attribute__((regparm(4))) draw_tile_m68k_yflip_norm (uint32_t*pal gfxdata += 30; while(y--) { if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - if((pixels0.pixel = gfxdata[0])) { pixel1 = pixels0.p.p0; DO_NOT_REORDER(); - pixel2 = pixels0.p.p1; DO_NOT_REORDER(); - if(pixel1) screen[0x0] = palbase[pixel1]; pixel1 = pixels0.p.p2; - if(pixel2) screen[0x1] = palbase[pixel2]; pixel2 = pixels0.p.p3; - if(pixel1) screen[0x2] = palbase[pixel1]; pixel1 = pixels0.p.p4; - if(pixel2) screen[0x3] = palbase[pixel2]; pixel2 = pixels0.p.p5; - if(pixel1) screen[0x4] = palbase[pixel1]; pixel1 = pixels0.p.p6; - if(pixel2) screen[0x5] = palbase[pixel2]; pixel2 = pixels0.p.p7; - if(pixel1) screen[0x6] = palbase[pixel1]; - if(pixel2) screen[0x7] = palbase[pixel2]; - } - - if((pixels0.pixel = gfxdata[1])) { pixel1 = pixels0.p.p0; DO_NOT_REORDER(); - pixel2 = pixels0.p.p1; DO_NOT_REORDER(); - if(pixel1) screen[0x8] = palbase[pixel1]; pixel1 = pixels0.p.p2; - if(pixel2) screen[0x9] = palbase[pixel2]; pixel2 = pixels0.p.p3; - if(pixel1) screen[0xA] = palbase[pixel1]; pixel1 = pixels0.p.p4; - if(pixel2) screen[0xB] = palbase[pixel2]; pixel2 = pixels0.p.p5; - if(pixel1) screen[0xC] = palbase[pixel1]; pixel1 = pixels0.p.p6; - if(pixel2) screen[0xD] = palbase[pixel2]; pixel2 = pixels0.p.p7; - if(pixel1) screen[0xE] = palbase[pixel1]; - if(pixel2) screen[0xF] = palbase[pixel2]; - } - + if((pixels0.pixel = gfxdata[0])) { pixel1 = pixels0.p.p0; DO_NOT_REORDER(); + pixel2 = pixels0.p.p1; DO_NOT_REORDER(); + if(pixel1) screen[0x0] = palbase[pixel1]; pixel1 = pixels0.p.p2; + if(pixel2) screen[0x1] = palbase[pixel2]; pixel2 = pixels0.p.p3; + if(pixel1) screen[0x2] = palbase[pixel1]; pixel1 = pixels0.p.p4; + if(pixel2) screen[0x3] = palbase[pixel2]; pixel2 = pixels0.p.p5; + if(pixel1) screen[0x4] = palbase[pixel1]; pixel1 = pixels0.p.p6; + if(pixel2) screen[0x5] = palbase[pixel2]; pixel2 = pixels0.p.p7; + if(pixel1) screen[0x6] = palbase[pixel1]; + if(pixel2) screen[0x7] = palbase[pixel2]; } + + if((pixels0.pixel = gfxdata[1])) { pixel1 = pixels0.p.p0; DO_NOT_REORDER(); + pixel2 = pixels0.p.p1; DO_NOT_REORDER(); + if(pixel1) screen[0x8] = palbase[pixel1]; pixel1 = pixels0.p.p2; + if(pixel2) screen[0x9] = palbase[pixel2]; pixel2 = pixels0.p.p3; + if(pixel1) screen[0xA] = palbase[pixel1]; pixel1 = pixels0.p.p4; + if(pixel2) screen[0xB] = palbase[pixel2]; pixel2 = pixels0.p.p5; + if(pixel1) screen[0xC] = palbase[pixel1]; pixel1 = pixels0.p.p6; + if(pixel2) screen[0xD] = palbase[pixel2]; pixel2 = pixels0.p.p7; + if(pixel1) screen[0xE] = palbase[pixel1]; + if(pixel2) screen[0xF] = palbase[pixel2]; + } screen += PITCH / 2; - limit++; } scaley <<= 1; gfxdata -= 2; @@ -174,35 +159,31 @@ INLINE void __attribute__((regparm(4))) draw_tile_m68k_xyflip_norm (uint32_t*pal gfxdata += 30; while(y--) { if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - if((pixels0.pixel = gfxdata[1])) { pixel1 = pixels0.p.p7; DO_NOT_REORDER(); - pixel2 = pixels0.p.p6; DO_NOT_REORDER(); - if(pixel1) screen[0x0] = palbase[pixel1]; pixel1 = pixels0.p.p5; - if(pixel2) screen[0x1] = palbase[pixel2]; pixel2 = pixels0.p.p4; - if(pixel1) screen[0x2] = palbase[pixel1]; pixel1 = pixels0.p.p3; - if(pixel2) screen[0x3] = palbase[pixel2]; pixel2 = pixels0.p.p2; - if(pixel1) screen[0x4] = palbase[pixel1]; pixel1 = pixels0.p.p1; - if(pixel2) screen[0x5] = palbase[pixel2]; pixel2 = pixels0.p.p0; - if(pixel1) screen[0x6] = palbase[pixel1]; - if(pixel2) screen[0x7] = palbase[pixel2]; - } - - if((pixels0.pixel = gfxdata[0])) { pixel1 = pixels0.p.p7; DO_NOT_REORDER(); - pixel2 = pixels0.p.p6; DO_NOT_REORDER(); - if(pixel1) screen[0x8] = palbase[pixel1]; pixel1 = pixels0.p.p5; - if(pixel2) screen[0x9] = palbase[pixel2]; pixel2 = pixels0.p.p4; - if(pixel1) screen[0xA] = palbase[pixel1]; pixel1 = pixels0.p.p3; - if(pixel2) screen[0xB] = palbase[pixel2]; pixel2 = pixels0.p.p2; - if(pixel1) screen[0xC] = palbase[pixel1]; pixel1 = pixels0.p.p1; - if(pixel2) screen[0xD] = palbase[pixel2]; pixel2 = pixels0.p.p0; - if(pixel1) screen[0xE] = palbase[pixel1]; - if(pixel2) screen[0xF] = palbase[pixel2]; - } + if((pixels0.pixel = gfxdata[1])) { pixel1 = pixels0.p.p7; DO_NOT_REORDER(); + pixel2 = pixels0.p.p6; DO_NOT_REORDER(); + if(pixel1) screen[0x0] = palbase[pixel1]; pixel1 = pixels0.p.p5; + if(pixel2) screen[0x1] = palbase[pixel2]; pixel2 = pixels0.p.p4; + if(pixel1) screen[0x2] = palbase[pixel1]; pixel1 = pixels0.p.p3; + if(pixel2) screen[0x3] = palbase[pixel2]; pixel2 = pixels0.p.p2; + if(pixel1) screen[0x4] = palbase[pixel1]; pixel1 = pixels0.p.p1; + if(pixel2) screen[0x5] = palbase[pixel2]; pixel2 = pixels0.p.p0; + if(pixel1) screen[0x6] = palbase[pixel1]; + if(pixel2) screen[0x7] = palbase[pixel2]; + } + + if((pixels0.pixel = gfxdata[0])) { pixel1 = pixels0.p.p7; DO_NOT_REORDER(); + pixel2 = pixels0.p.p6; DO_NOT_REORDER(); + if(pixel1) screen[0x8] = palbase[pixel1]; pixel1 = pixels0.p.p5; + if(pixel2) screen[0x9] = palbase[pixel2]; pixel2 = pixels0.p.p4; + if(pixel1) screen[0xA] = palbase[pixel1]; pixel1 = pixels0.p.p3; + if(pixel2) screen[0xB] = palbase[pixel2]; pixel2 = pixels0.p.p2; + if(pixel1) screen[0xC] = palbase[pixel1]; pixel1 = pixels0.p.p1; + if(pixel2) screen[0xD] = palbase[pixel2]; pixel2 = pixels0.p.p0; + if(pixel1) screen[0xE] = palbase[pixel1]; + if(pixel2) screen[0xF] = palbase[pixel2]; } + screen += PITCH / 2; - limit++; } scaley <<= 1; gfxdata -= 2; @@ -215,33 +196,28 @@ INLINE void __attribute__((regparm(4))) draw_tile_m68k_xzoom (uint32_t*palbase,u uint16_t* org_tilepos = tilepos; for(;;) { tilepos = org_tilepos; - if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - pixeldata.pixel = gfxdata[0]; - if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - - pixeldata.pixel = gfxdata[1]; - if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - - } + if(scaley & 0x8000) { + pixeldata.pixel = gfxdata[0]; + if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + + pixeldata.pixel = gfxdata[1]; + if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + org_tilepos += PITCH / 2; - limit++; } if(!y) break; scaley <<= 1; @@ -256,32 +232,27 @@ INLINE void __attribute__((regparm(4))) draw_tile_m68k_xzoomX (uint32_t*palbase for(;;) { tilepos = org_tilepos; if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - pixeldata.pixel = gfxdata[1]; - if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - - pixeldata.pixel = gfxdata[0]; - if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - } - + pixeldata.pixel = gfxdata[1]; + if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + + pixeldata.pixel = gfxdata[0]; + if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + org_tilepos += PITCH / 2; - limit++; } if(!y) break; scaley <<= 1; @@ -298,32 +269,26 @@ INLINE void __attribute__((regparm(4))) draw_tile_m68k_xzoomY (uint32_t*palbase for(;;) { tilepos = org_tilepos; if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - pixeldata.pixel = gfxdata[0]; - if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - - pixeldata.pixel = gfxdata[1]; - if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - } - + pixeldata.pixel = gfxdata[0]; + if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + + pixeldata.pixel = gfxdata[1]; + if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } org_tilepos += PITCH / 2; - limit++; } if(!y) break; scaley <<= 1; @@ -339,32 +304,28 @@ INLINE void __attribute__((regparm(4))) draw_tile_m68k_xzoomXY (uint32_t*palbase gfxdata += 30; for(;;) { tilepos = org_tilepos; - if(scaley & 0x8000) { - if(*limit < 96) { - *limit += 1; - - pixeldata.pixel = gfxdata[1]; - if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - - pixeldata.pixel = gfxdata[0]; - if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } - if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } - if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } - if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } - if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } - if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } - if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } - if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } - } + if(scaley & 0x8000) { + pixeldata.pixel = gfxdata[1]; + if(scalex & 0x0001) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + if(scalex & 0x0002) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0004) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0008) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x0010) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x0020) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x0040) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x0080) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + + pixeldata.pixel = gfxdata[0]; + if(scalex & 0x0100) { if(pixeldata.p.p7) *tilepos = (uint16_t)palbase[pixeldata.p.p7]; tilepos++; } + if(scalex & 0x0200) { if(pixeldata.p.p6) *tilepos = (uint16_t)palbase[pixeldata.p.p6]; tilepos++; } + if(scalex & 0x0400) { if(pixeldata.p.p5) *tilepos = (uint16_t)palbase[pixeldata.p.p5]; tilepos++; } + if(scalex & 0x0800) { if(pixeldata.p.p4) *tilepos = (uint16_t)palbase[pixeldata.p.p4]; tilepos++; } + if(scalex & 0x1000) { if(pixeldata.p.p3) *tilepos = (uint16_t)palbase[pixeldata.p.p3]; tilepos++; } + if(scalex & 0x2000) { if(pixeldata.p.p2) *tilepos = (uint16_t)palbase[pixeldata.p.p2]; tilepos++; } + if(scalex & 0x4000) { if(pixeldata.p.p1) *tilepos = (uint16_t)palbase[pixeldata.p.p1]; tilepos++; } + if(scalex & 0x8000) { if(pixeldata.p.p0) *tilepos = (uint16_t)palbase[pixeldata.p.p0]; tilepos++; } + org_tilepos += PITCH / 2; - limit++; } if(!y) break; scaley <<= 1; @@ -507,9 +468,7 @@ void draw_tiles_m68k(void) { uint32_t *gfxdata = (uint32_t*)&memory.rom.tiles.p[(tileno % memory.nb_of_tiles)<<7]; uint16_t scaley = ddaxskip_i[yskip]; const int pitch = PITCH / 2; - - limit = &line_limit[sy]; - + if (rzx==16) { if (tileatr & 0x01) { if (tileatr & 0x02) diff --git a/src/emu.c b/src/emu.c index 5c65789..b8cbb3d 100644 --- a/src/emu.c +++ b/src/emu.c @@ -315,7 +315,7 @@ void main_loop(void) { for(i=0; i #include #include -//#include #include "video.h" #include "memory.h" #include "emu.h" #include "messages.h" #include "conf.h" #include "screen.h" -// #include "frame_skip.h" -// #include "transpack.h" -//#include -//#include -extern int neogeo_fix_bank_type; - - -// #ifdef PROCESSOR_ARM -// /* global declaration for video_arm.S */ -// uint8_t *mem_gfx = NULL; /*=memory.rom.tiles.p;*/ -// uint8_t *mem_video = NULL; //memory.vid.ram; -// //#define TOTAL_GFX_BANK 4096 -// uint32_t *mem_bank_usage; -// -// //GFX_CACHE gcache; -// -// void draw_one_char_arm(int byte1, int byte2, uint16_t *br); -// int draw_tile_arm_norm(uint32_t tileno, int color, uint8_t *bmp, int zy); -// #endif - -// #ifdef I386_ASM -// /* global declaration for video_i386.asm */ -// uint8_t **mem_gfx; //=&memory.rom.tiles.p; -// uint8_t *mem_video; //=memory.vid.ram; -// -// /* prototype */ -// void draw_tile_i386_norm(uint32_t tileno, int sx, int sy, int zx, int zy, -// int color, int xflip, int yflip, uint8_t *bmp); -// void draw_tile_i386_50(uint32_t tileno, int sx, int sy, int zx, int zy, -// int color, int xflip, int yflip, uint8_t *bmp); -// void draw_one_char_i386(int byte1, int byte2, uint16_t *br); -// -// void draw_scanline_tile_i386_norm(uint32_t tileno, int yoffs, int sx, int line, int zx, -// int color, int xflip, uint8_t *bmp); -// -// void draw_scanline_tile_i386_50(uint32_t tileno, int yoffs, int sx, int line, int zx, -// int color, int xflip, uint8_t *bmp); -// #endif -//uint8_t strip_usage[0x300]; #define PEN_USAGE(tileno) ((((uint32_t*) memory.rom.spr_usage.p)[tileno>>4]>>((tileno&0xF)*2))&0x3) - -static uint8_t dr, dg, db, sr, sg, sb; -// static __inline__ uint16_t alpha_blend(uint16_t dest, uint16_t src, uint8_t a) { -// -// -// dr = ((dest & 0xF800) >> 11) << 3; -// dg = ((dest & 0x7E0) >> 5) << 2; -// db = ((dest & 0x1F)) << 3; -// -// sr = ((src & 0xF800) >> 11) << 3; -// sg = ((src & 0x7E0) >> 5) << 2; -// sb = ((src & 0x1F)) << 3; -// -// dr = (((sr - dr)*(a)) >> 8) + dr; -// dg = (((sg - dg)*(a)) >> 8) + dg; -// db = (((sb - db)*(a)) >> 8) + db; -// -// return ((dr >> 3) << 11) | ((dg >> 2) << 5) | (db >> 3); -// } -// #define BLEND16_50(a,b) ((((a)&0xf7de)>>1)+(((b)&0xf7de)>>1)) -// #define BLEND16_25(a,b) alpha_blend(a,b,63) - - -char dda_y_skip[17]; -uint32_t dda_y_skip_i; -uint32_t full_y_skip_i = 0xFFFE; -char full_y_skip[16] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; -uint32_t neogeo_frame_counter_speed = 8; - -// static uint16_t fix_addr[40][32]; -// static uint8_t fix_shift[40]; - -static uint16_t dda_x_skip_i; +extern int neogeo_fix_bank_type; const uint16_t ddaxskip_i[17] = { 0x0000, 0x0080, 0x0880, 0x0888, 0x2888, 0x288a, 0x2a8a, 0x2aaa, 0xaaaa, 0xaaea, 0xbaea, 0xbaeb, 0xbbeb, 0xbbef, 0xfbef, 0xfbff, 0xffff }; -#define dda_x_skip(N) (dda_x_skip_i & (1 << N)) -static void fix_value_init(void) { - // int x, y; - // for (x = 0; x < 40; x++) { - // for (y = 0; y < 32; y++) { - // fix_addr[x][y] = 0xea00 + (y << 1) + 64 * (x / 6); - // } - // fix_shift[x] = (5 - (x % 6)); - // } -} - - -/* Drawing function generation */ -// #define RENAME(name) name##_tile -// #define PUTPIXEL(dst,src) dst=src -// #include "video_template.h" - -// #define RENAME(name) name##_tile_50 -// #define PUTPIXEL(dst,src) dst=BLEND16_50(src,dst) -// #include "video_template.h" -// -// #define RENAME(name) name##_tile_25 -// #define PUTPIXEL(dst,src) dst=BLEND16_25(src,dst) -// #include "video_template.h" -// -// #ifdef PROCESSOR_ARM -// -// -// #endif const int overscan = 1; - extern struct RastPort *theRastPort; uint8_t line_limit[256] = {0xFF}, *limit; +uint32_t neogeo_frame_counter_speed = 8; uint32_t even_odd = 0; -//(palbase, tilepos, gfxdata, rzx, yskip) - -//OPTION_INTERLEAVED +static uint8_t dr, dg, db, sr, sg, sb; void draw_screen(void) { if(screen_prerender()) { - if(arg[OPTION_INTERLEAVED]) { - uint8_t c = even_odd - 1; - uint32_t i, x; - uint16_t *clear = (uint16_t*)bufferpixels; - - for(i=0;i<224;i++) { - line_limit[i] = c; - if(!c) { - uint16_t pixel = current_pc_pal[4095]; - for(x=0;x<320;x++) clear[x] = pixel; - c = 255; - } else { - c = 0; - } - clear += 384; - } - even_odd = !even_odd; - - } else { - bzero( line_limit, 224 ); - clr_screen_m68k(bufferpixels, current_pc_pal[4095] ); - } + clr_screen_m68k(bufferpixels, current_pc_pal[4095] ); /* Draw sprites */ - if(AC68080) draw_tiles_ammx(); - else draw_tiles_m68k(); + if(AC68080) + draw_tiles_ammx(); + else + draw_tiles_m68k(); /* Draw fix layer */ draw_fix_char(bufferpixels, 0, 0); clr_border_m68k(bufferpixels, 0 ); - screen_update(); - + screen_update(); } else { debug("Unable to lock screen (%p)\n", bufferpixels); exit(-1); } } - void init_video(void) { -#ifdef PROCESSOR_ARM - if (!mem_gfx) { - mem_gfx = memory.rom.tiles.p; - } - if (!mem_video) { - mem_video = memory.vid.ram; - } -#elif I386_ASM - mem_gfx = &memory.rom.tiles.p; - mem_video = memory.vid.ram; -#endif - fix_value_init(); memory.vid.modulo = 1; } diff --git a/src/ym2610.c b/src/ym2610.c index a022a61..f91ecde 100644 --- a/src/ym2610.c +++ b/src/ym2610.c @@ -1325,10 +1325,10 @@ static void init_timetables(const u8 *dttable) { int i, d; double rate; -//#if 0 +#if 0 printf("FM.C: samplerate=%8i chip clock=%8i freqbase=%f \n", YM2610.OPN.ST.rate, YM2610.OPN.ST.clock, YM2610.OPN.ST.freqbase ); -//#endif +#endif /* DeTune table */ for (d = 0; d <= 3; d++) {