Mercurial > repos > blastem
changeset 1745:a8f04b0ab744
Fixes to DAA, SCF and CCF to pass ZEXALL in new Z80 core
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 06 Feb 2019 08:54:09 -0800 |
parents | 91aa789e57bd |
children | cd6f4cea97b6 |
files | cpu_dsl.py z80.cpu |
diffstat | 2 files changed, 19 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/cpu_dsl.py Tue Feb 05 19:29:54 2019 -0800 +++ b/cpu_dsl.py Wed Feb 06 08:54:09 2019 -0800 @@ -468,10 +468,11 @@ if needsCarry: size *= 2 tmpvar = 'cmp_tmp{sz}__'.format(sz=size) - prog.carryFlowDst = tmpvar - prog.lastA = params[1] - prog.lastB = params[0] - prog.lastBFlow = params[0] + if flagUpdates: + prog.carryFlowDst = tmpvar + prog.lastA = params[1] + prog.lastB = params[0] + prog.lastBFlow = params[0] scope = prog.getRootScope() if not scope.resolveLocal(tmpvar): scope.addLocal(tmpvar, size)
--- a/z80.cpu Tue Feb 05 19:29:54 2019 -0800 +++ b/z80.cpu Wed Feb 06 08:54:09 2019 -0800 @@ -1439,6 +1439,9 @@ 00111111 ccf local tmp 8 + and 0x80 last_flag_result last_flag_result + and 0x7F a tmp + or tmp last_flag_result last_flag_result and 0x80 chflags chflags lsr chflags 4 tmp or tmp chflags chflags @@ -1446,6 +1449,10 @@ update_flags N0 00110111 scf + local tmp 8 + and 0x80 last_flag_result last_flag_result + and 0x7F a tmp + or tmp last_flag_result last_flag_result update_flags H0N0C1 00000000 nop @@ -2217,24 +2224,28 @@ if tmp or 0x60 diff diff + update_flags C1 else - cmp 0xA0 a + cmp 0x9A a if >=U or 0x60 diff diff + update_flags C1 + else + update_flags C0 end end if nflag sub diff a a - update_flags SZYHPXC + update_flags SZYHPX else add diff a a - update_flags SZYHPXC + update_flags SZYHPX end