summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2019-02-04 22:51:56 -0800
committerMichael Pavone <pavone@retrodev.com>2019-02-04 22:51:56 -0800
commit9f3816b25a22648eb1cde164dcfc1541f48ace31 (patch)
treed16e2bdcc9fb910d872cb6c3ca7136b8bf7e3776
parentd0d4e82bb1bf7c8f61093566dbb2588580fa2860 (diff)
Implemented RLD/RRD in new Z80 core
-rw-r--r--z80.cpu35
1 files changed, 35 insertions, 0 deletions
diff --git a/z80.cpu b/z80.cpu
index 3fc3166..8a69723 100644
--- a/z80.cpu
+++ b/z80.cpu
@@ -2226,4 +2226,39 @@ dd OOOOOOOO dd_normal
fd OOOOOOOO fd_normal
dispatch O
+
+ed 01101111 rld
+ local tmp 8
+ local tmp2 8
+ z80_fetch_hl
+ cycles 4
+
+ lsr scratch1 4 tmp
+
+ lsl scratch1 4 scratch1
+
+ and 0xF a tmp2
+ or tmp2 scratch1 scratch1
+
+ and 0xF0 a a
+ or tmp a a
+ update_flags SZYH0XPN0
+ z80_store_hl
+
+ed 01100111 rrd
+ local tmp 8
+ local tmp2 8
+ z80_fetch_hl
+ cycles 4
+
+ and 0xF scratch1 tmp
+ lsr scratch1 4 scratch1
+
+ lsl a 4 tmp2
+ or tmp2 scratch1 scratch1
+
+ and 0xF0 a a
+ or tmp a a
+ update_flags SZYH0XPN0
+ z80_store_hl
\ No newline at end of file