mirror of
https://github.com/libretro/mame2003-plus-libretro.git
synced 2026-11-07 04:16:07 -10:00
Z80: the delay-loop shortcut counts the DEC cycles of each skipped iteration
The TIME_LOOP_HACKS shortcut skips the iterations of a DEC rr / LD A,r / OR r / JR NZ (or JP NZ) delay loop by burning their cycles in one go. Each skipped iteration runs four opcodes (R is advanced by 4), but only LD, OR and the jump were counted: the DEC was left out, so every iteration took 6 cycles too few (20 instead of 26 with JR) and such delays ran about 23% short. Count the DEC as well, for the BC, DE and HL loops with JR and JP. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01N3fzdsnzkQVtgYtYzqepjX
This commit is contained in:
1 file changed
+6
@@ -3487,6 +3487,7 @@ if( _BC > 1 && _PCD < 0xfffc ) { \
|
||||
if( op3==0x20 && op4==0xfb ) \
|
||||
{ \
|
||||
int cnt = \
|
||||
cc[Z80_TABLE_op][0x0b] + \
|
||||
cc[Z80_TABLE_op][0x78] + \
|
||||
cc[Z80_TABLE_op][0xb1] + \
|
||||
cc[Z80_TABLE_op][0x20] + \
|
||||
@@ -3505,6 +3506,7 @@ if( _BC > 1 && _PCD < 0xfffc ) { \
|
||||
if( (ad1 + 256 * ad2) == (_PCD - 1) ) \
|
||||
{ \
|
||||
int cnt = \
|
||||
cc[Z80_TABLE_op][0x0b] + \
|
||||
cc[Z80_TABLE_op][0x78] + \
|
||||
cc[Z80_TABLE_op][0xb1] + \
|
||||
cc[Z80_TABLE_op][0xc2] + \
|
||||
@@ -3530,6 +3532,7 @@ if( _DE > 1 && _PCD < 0xfffc ) { \
|
||||
if( op3==0x20 && op4==0xfb ) \
|
||||
{ \
|
||||
int cnt = \
|
||||
cc[Z80_TABLE_op][0x1b] + \
|
||||
cc[Z80_TABLE_op][0x7a] + \
|
||||
cc[Z80_TABLE_op][0xb3] + \
|
||||
cc[Z80_TABLE_op][0x20] + \
|
||||
@@ -3548,6 +3551,7 @@ if( _DE > 1 && _PCD < 0xfffc ) { \
|
||||
if( (ad1 + 256 * ad2) == (_PCD - 1) ) \
|
||||
{ \
|
||||
int cnt = \
|
||||
cc[Z80_TABLE_op][0x1b] + \
|
||||
cc[Z80_TABLE_op][0x7a] + \
|
||||
cc[Z80_TABLE_op][0xb3] + \
|
||||
cc[Z80_TABLE_op][0xc2] + \
|
||||
@@ -3573,6 +3577,7 @@ if( _HL > 1 && _PCD < 0xfffc ) { \
|
||||
if( op3==0x20 && op4==0xfb ) \
|
||||
{ \
|
||||
int cnt = \
|
||||
cc[Z80_TABLE_op][0x2b] + \
|
||||
cc[Z80_TABLE_op][0x7c] + \
|
||||
cc[Z80_TABLE_op][0xb5] + \
|
||||
cc[Z80_TABLE_op][0x20] + \
|
||||
@@ -3591,6 +3596,7 @@ if( _HL > 1 && _PCD < 0xfffc ) { \
|
||||
if( (ad1 + 256 * ad2) == (_PCD - 1) ) \
|
||||
{ \
|
||||
int cnt = \
|
||||
cc[Z80_TABLE_op][0x2b] + \
|
||||
cc[Z80_TABLE_op][0x7c] + \
|
||||
cc[Z80_TABLE_op][0xb5] + \
|
||||
cc[Z80_TABLE_op][0xc2] + \
|
||||
|
||||
Reference in new issue
Block a user