comparison z80.cpu @ 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 a1663a83dcab
children 48a43dff4dc0
comparison
equal deleted inserted replaced
1744:91aa789e57bd 1745:a8f04b0ab744
1437 neg a a 1437 neg a a
1438 update_flags SZYHVXN1C 1438 update_flags SZYHVXN1C
1439 1439
1440 00111111 ccf 1440 00111111 ccf
1441 local tmp 8 1441 local tmp 8
1442 and 0x80 last_flag_result last_flag_result
1443 and 0x7F a tmp
1444 or tmp last_flag_result last_flag_result
1442 and 0x80 chflags chflags 1445 and 0x80 chflags chflags
1443 lsr chflags 4 tmp 1446 lsr chflags 4 tmp
1444 or tmp chflags chflags 1447 or tmp chflags chflags
1445 xor 0x80 chflags chflags 1448 xor 0x80 chflags chflags
1446 update_flags N0 1449 update_flags N0
1447 1450
1448 00110111 scf 1451 00110111 scf
1452 local tmp 8
1453 and 0x80 last_flag_result last_flag_result
1454 and 0x7F a tmp
1455 or tmp last_flag_result last_flag_result
1449 update_flags H0N0C1 1456 update_flags H0N0C1
1450 1457
1451 00000000 nop 1458 00000000 nop
1452 1459
1453 01110110 halt 1460 01110110 halt
2215 2222
2216 and 0x80 chflags tmp 2223 and 0x80 chflags tmp
2217 if tmp 2224 if tmp
2218 2225
2219 or 0x60 diff diff 2226 or 0x60 diff diff
2227 update_flags C1
2220 2228
2221 else 2229 else
2222 2230
2223 cmp 0xA0 a 2231 cmp 0x9A a
2224 if >=U 2232 if >=U
2225 or 0x60 diff diff 2233 or 0x60 diff diff
2234 update_flags C1
2235 else
2236 update_flags C0
2226 end 2237 end
2227 end 2238 end
2228 2239
2229 if nflag 2240 if nflag
2230 2241
2231 sub diff a a 2242 sub diff a a
2232 update_flags SZYHPXC 2243 update_flags SZYHPX
2233 2244
2234 else 2245 else
2235 2246
2236 add diff a a 2247 add diff a a
2237 update_flags SZYHPXC 2248 update_flags SZYHPX
2238 2249
2239 end 2250 end
2240 2251
2241 dd OOOOOOOO dd_normal 2252 dd OOOOOOOO dd_normal
2242 dispatch O 2253 dispatch O