summaryrefslogtreecommitdiff
path: root/zruntime.S
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-05-04 15:58:15 -0700
committerMike Pavone <pavone@retrodev.com>2013-05-04 15:58:15 -0700
commit703129f573b4e3b84df96612bb26db672617a8bc (patch)
treecf1042cf399ac182bd3df92867fd61513b32955e /zruntime.S
parentd511cd2c0b128f0e5e3b55ba2d6cda1e75e49f8f (diff)
Implement IN and OUT (untested)
Diffstat (limited to 'zruntime.S')
-rw-r--r--zruntime.S25
1 files changed, 25 insertions, 0 deletions
diff --git a/zruntime.S b/zruntime.S
index a5808a8..8b74b1b 100644
--- a/zruntime.S
+++ b/zruntime.S
@@ -1,3 +1,14 @@
+z_inccycles_io:
+ cmp %edi, %ebp
+ jnb do_limit
+no_sync_io:
+ add $4, %ebp
+ ret
+do_limit_io:
+ cmp 112(%rsi), %ebp
+ jb no_sync_io
+ jmp sync_io
+
z_inccycles:
cmp %edi, %ebp
jnb do_limit
@@ -7,6 +18,7 @@ no_sync:
do_limit:
cmp 112(%rsi), %ebp
jb no_sync
+sync_io:
call z80_save_context_scratch
pop %rax /*return address in read/write func*/
pop 104(%rsi) /*return address in native code*/
@@ -180,6 +192,19 @@ z80_write_word_lowfirst:
call z_inccycles
call z80_write_byte_noinc
ret
+
+ .global z80_io_read
+z80_io_read:
+ call z_inccycles_io
+ /* genesis Z80 has no IO port hardware and always returns FF */
+ mov $0xFF, %r13
+ ret
+
+ .global z80_io_write
+z80_io_write:
+ call z_inccycles_io
+ /* genesis Z80 has no IO port hardware and writes have no effect */
+ ret
.global z80_retrans_stub
z80_retrans_stub: