Mercurial > repos > blastem
comparison zruntime.S @ 284:ed7098f717d7
Implement IN and OUT (untested)
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 04 May 2013 15:58:15 -0700 |
parents | 44f0bbf57b4f |
children | 021aeb6df19b |
comparison
equal
deleted
inserted
replaced
283:61f5d88ea01a | 284:ed7098f717d7 |
---|---|
1 z_inccycles_io: | |
2 cmp %edi, %ebp | |
3 jnb do_limit | |
4 no_sync_io: | |
5 add $4, %ebp | |
6 ret | |
7 do_limit_io: | |
8 cmp 112(%rsi), %ebp | |
9 jb no_sync_io | |
10 jmp sync_io | |
11 | |
1 z_inccycles: | 12 z_inccycles: |
2 cmp %edi, %ebp | 13 cmp %edi, %ebp |
3 jnb do_limit | 14 jnb do_limit |
4 no_sync: | 15 no_sync: |
5 add $3, %ebp | 16 add $3, %ebp |
6 ret | 17 ret |
7 do_limit: | 18 do_limit: |
8 cmp 112(%rsi), %ebp | 19 cmp 112(%rsi), %ebp |
9 jb no_sync | 20 jb no_sync |
21 sync_io: | |
10 call z80_save_context_scratch | 22 call z80_save_context_scratch |
11 pop %rax /*return address in read/write func*/ | 23 pop %rax /*return address in read/write func*/ |
12 pop 104(%rsi) /*return address in native code*/ | 24 pop 104(%rsi) /*return address in native code*/ |
13 sub $5, %rax /* adjust return addres to point to the call instruction that got us here */ | 25 sub $5, %rax /* adjust return addres to point to the call instruction that got us here */ |
14 mov %rax, (%rsi) | 26 mov %rax, (%rsi) |
177 pop %r14 | 189 pop %r14 |
178 add $1, %r14w | 190 add $1, %r14w |
179 shr $8, %r13w | 191 shr $8, %r13w |
180 call z_inccycles | 192 call z_inccycles |
181 call z80_write_byte_noinc | 193 call z80_write_byte_noinc |
194 ret | |
195 | |
196 .global z80_io_read | |
197 z80_io_read: | |
198 call z_inccycles_io | |
199 /* genesis Z80 has no IO port hardware and always returns FF */ | |
200 mov $0xFF, %r13 | |
201 ret | |
202 | |
203 .global z80_io_write | |
204 z80_io_write: | |
205 call z_inccycles_io | |
206 /* genesis Z80 has no IO port hardware and writes have no effect */ | |
182 ret | 207 ret |
183 | 208 |
184 .global z80_retrans_stub | 209 .global z80_retrans_stub |
185 z80_retrans_stub: | 210 z80_retrans_stub: |
186 call z80_save_context | 211 call z80_save_context |