changeset 72:7935cd64d5c8

Implement word wide access to IO area
author Mike Pavone <pavone@retrodev.com>
date Fri, 21 Dec 2012 16:04:30 -0800
parents f80fa1776507
children 8da611e69b32
files runtime.S
diffstat 1 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/runtime.S	Fri Dec 21 01:00:52 2012 -0800
+++ b/runtime.S	Fri Dec 21 16:04:30 2012 -0800
@@ -22,7 +22,7 @@
 	call vdp_port_read
 	mov %rax, %rsi
 	call m68k_load_context
-	mov 120(%rsi), %cx
+	mov 128(%rsi), %cx
 	ret
 	
 do_io_write:
@@ -40,7 +40,7 @@
 	call io_read
 	mov %rax, %rsi
 	call m68k_load_context
-	mov 120(%rsi), %cl
+	mov 128(%rsi), %cl
 	ret
 	
 bad_access_msg:
@@ -76,7 +76,7 @@
 	push %rdx
 	push %rbx
 	/* fetch VDP context pointer from 68K context */
-	mov 112(%rsi), %rdx
+	mov 120(%rsi), %rdx
 	/* get fifo_cur and compare it to fifo_end */
 	mov (%rdx), %rbx
 	cmp %rbx, 8(%rdx)
@@ -187,6 +187,17 @@
 	jge workram
 	cmp $0xC00000, %ecx
 	jge vdp_psg
+	cmp $0xA10000, %ecx
+	jl not_io
+	cmp $0xA10100, %ecx
+	jge not_io
+	call do_io_read
+	mov %cl, %dil
+	and $0xFF, %cx
+	shl $8, %di
+	or %di, %cx
+	ret
+not_io:
 	xor %cx, %cx
 	dec %cx
 	ret
@@ -277,7 +288,7 @@
 	mov %r13d, 40(%rsi) /* a0 */
 	mov %r14d, 44(%rsi) /* a1 */
 	mov %r15d, 68(%rsi) /* a7 */
-	mov %eax, 76(%rsi) /* current cycle count */
+	mov %eax, 80(%rsi) /* current cycle count */
 	ret
 
 	.global m68k_load_context
@@ -292,10 +303,10 @@
 	mov 40(%rsi), %r13d /* a0 */
 	mov 44(%rsi), %r14d /* a1 */
 	mov 68(%rsi), %r15d /* a7 */
-	mov 72(%rsi), %ebp /* target cycle count */
-	mov 76(%rsi), %eax /* current cycle count */
-	mov 80(%rsi), %r8d /* cartridge address */
-	mov 88(%rsi), %r9d /* work ram address */
+	mov 76(%rsi), %ebp /* target cycle count */
+	mov 80(%rsi), %eax /* current cycle count */
+	mov 88(%rsi), %r8d /* cartridge address */
+	mov 96(%rsi), %r9d /* work ram address */
 	ret
 
 	.global m68k_start_context