From dd49801256757e0239c6e6107863d511ad79da76 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 30 Jan 2019 21:47:35 -0800 Subject: Fix cp instruction in new Z80 core and implement its DD/FD prefixes --- z80.cpu | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'z80.cpu') diff --git a/z80.cpu b/z80.cpu index 0969456..1c7945c 100644 --- a/z80.cpu +++ b/z80.cpu @@ -879,18 +879,53 @@ ed 01110010 sbc_hl_sp update_flags SZYH0PXN0C0 10111RRR cp_reg + mov main.R last_flag_result cmp main.R a - update_flags SZYHVXN1C + update_flags SZHVN1C + +dd 10111100 cp_ixh + lsr ix 8 last_flag_result + cmp last_flag_result a + update_flags SZHVN1C + +dd 10111101 cp_ixl + mov ix last_flag_result + cmp last_flag_result a + update_flags SZHVN1C + +fd 10111100 cp_iyh + lsr iy 8 last_flag_result + cmp last_flag_result a + update_flags SZHVN1C + +fd 10111101 cp_iyl + mov iy last_flag_result + cmp last_flag_result a + update_flags SZHVN1C 10111110 cp_hl z80_fetch_hl + mov scratch1 last_flag_result cmp scratch1 a - update_flags SZYHVXN1C + update_flags SZHVN1C + +dd 10111110 cp_ixd + z80_fetch_index ix + mov scratch1 last_flag_result + cmp scratch1 a + update_flags SZHVN1C + +fd 10111110 cp_iyd + z80_fetch_index iy + mov scratch1 last_flag_result + cmp scratch1 a + update_flags SZHVN1C 11111110 cp_immed z80_fetch_immed + mov scratch1 last_flag_result cmp scratch1 a - update_flags SZYHVXN1C + update_flags SZHVN1C 00RRR100 inc_reg add 1 main.R main.R -- cgit v1.2.3