From 26a919a8c0a101f6f1504f72c36a54453a3b22c0 Mon Sep 17 00:00:00 2001 From: pagefault <> Date: Mon, 5 May 2003 16:58:57 +0000 Subject: [PATCH] IO latch behaviour --- zsnes/src/cpu/regs.inc | 13 +++++++++++-- zsnes/src/cpu/regsw.inc | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/zsnes/src/cpu/regs.inc b/zsnes/src/cpu/regs.inc index e0a56341..c59128b5 100644 --- a/zsnes/src/cpu/regs.inc +++ b/zsnes/src/cpu/regs.inc @@ -664,7 +664,7 @@ NEWSYM SDD1BankD, db 3 NEWSYM vramread2, db 0 ; previous character for vram read NEWSYM nosprincr, db 0 NEWSYM poamaddrs, dw 0 -NEWSYM rdioval, db 0 +NEWSYM ioportval, db 0 NEWSYM tempdat, times 479 db 0 ; expandable area @@ -767,6 +767,11 @@ reg2137r: ; mov byte[debstop3],1 cmp byte[debuggeron],1 je .debugger + cmp byte[iocounteren],1 + je .dolatch + test byte[ioportval],80h + jnz .nolatch +.dolatch xor ebx,ebx mov bl,[cycpl] sub bl,dh @@ -786,11 +791,14 @@ reg2137r: inc word[latchy] .novhirq .noincly +.nolatch xor al,al mov byte[extlatch],0 ret .debugger debblah: + test byte[ioportval],80h + jnz .nolatch2 xor ebx,ebx mov bl,[cycpl] sub bl,[pdh] @@ -842,6 +850,7 @@ debblah: inc word[latchy] .novhirq2 .noincly2 +.nolatch2 xor al,al mov byte[extlatch],0 ret @@ -1372,7 +1381,7 @@ debblah2: ; Programmable I/O port reg4213r: - mov al,[rdioval] + mov al,[ioportval] ret ; Quotent of Divide Result (Low) diff --git a/zsnes/src/cpu/regsw.inc b/zsnes/src/cpu/regsw.inc index a66df41d..b17d9a86 100644 --- a/zsnes/src/cpu/regsw.inc +++ b/zsnes/src/cpu/regsw.inc @@ -1504,7 +1504,7 @@ reg4200w: ; Programmable I/O port (out-port) reg4201w: - mov byte[rdioval],al + mov byte[ioportval],al mov bl,al and bl,80h and byte[MultiTapStat],07Fh