From 6f1a80637e4523976d57b2d248ad2182211f845b Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 30 Jan 2021 23:29:41 +0100 Subject: [PATCH] more work on Z80 bringup --- src/mon_m65/bsmon.s | 1 + src/zvm_m65/debug.s | 19 +++++++++++++++++-- src/zvm_m65/z80_instr_jump.s | 2 ++ src/zvm_m65/zvm.s | 9 +++++---- src/zvm_m65/zvm_cputest.s | 4 +++- src/zvm_m65/zvm_imports.s | 2 ++ 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/mon_m65/bsmon.s b/src/mon_m65/bsmon.s index 354efd70..96ebbdbf 100644 --- a/src/mon_m65/bsmon.s +++ b/src/mon_m65/bsmon.s @@ -38,6 +38,7 @@ Mon_Start: ; ******** CLD + CLI TSY STY SPH TSX diff --git a/src/zvm_m65/debug.s b/src/zvm_m65/debug.s index 73d9618a..64b81deb 100644 --- a/src/zvm_m65/debug.s +++ b/src/zvm_m65/debug.s @@ -24,8 +24,7 @@ DBG_print_PC_opcode: !pet " opcode: ", 0 pla -@1: - beq @1 + +beq MONITOR jsr DBGINT_print_hex_byte ; FALLTROUGH @@ -57,6 +56,22 @@ DBG_print_hex: bra DBGINT_end +DBG_print_LOADCOUNT: + + php + pha + phx + phy + phz + + lda BIOS_LOADCOUNT+1 + jsr DBGINT_print_hex_byte + lda BIOS_LOADCOUNT+0 + jsr DBGINT_print_hex_byte + lda #$0D + jsr CHROUT + + bra DBGINT_end DBGINT_print_hex_byte: diff --git a/src/zvm_m65/z80_instr_jump.s b/src/zvm_m65/z80_instr_jump.s index 47729310..bd2ef756 100644 --- a/src/zvm_m65/z80_instr_jump.s +++ b/src/zvm_m65/z80_instr_jump.s @@ -7,8 +7,10 @@ Z80_instr_C3: ; JP nn +Z80_FETCH_VIA_PC_INC + jsr DBG_print_hex sta REG_PC+0 +Z80_FETCH_VIA_PC_INC + jsr DBG_print_hex sta REG_PC+1 jmp ZVM_next diff --git a/src/zvm_m65/zvm.s b/src/zvm_m65/zvm.s index 8cdbf8c2..75f48c4b 100644 --- a/src/zvm_m65/zvm.s +++ b/src/zvm_m65/zvm.s @@ -14,10 +14,11 @@ ZVM: ; entry point ; Skip the IRQ processing, even if Kernal reenables it sei - lda #return_from_interrupt - sta CINV+1 + ; XXX uncomment this when debugging is finished + ; lda #return_from_interrupt + ; sta CINV+1 ; Make sure $C000-$CFFF ROM is mapped-in, we keep our proxies there ; Also make sure the palette is taken from RAM diff --git a/src/zvm_m65/zvm_cputest.s b/src/zvm_m65/zvm_cputest.s index 416aba27..f69056f3 100644 --- a/src/zvm_m65/zvm_cputest.s +++ b/src/zvm_m65/zvm_cputest.s @@ -111,10 +111,12 @@ ZVM_cputest: ; Copy up to 512 bytes from buffer to target memory + inw BIOS_LOADCOUNT + @loop3: dew BIOS_LOADCOUNT - bmi @loop2 + beq @loop2 ; XXX why no BMI, without INW? lda [BIOS_IOBUFERPTR],z sta [BIOS_LOADPTR],z diff --git a/src/zvm_m65/zvm_imports.s b/src/zvm_m65/zvm_imports.s index 92d77b53..bce4cff3 100644 --- a/src/zvm_m65/zvm_imports.s +++ b/src/zvm_m65/zvm_imports.s @@ -8,9 +8,11 @@ ;; #ALIAS# CHROUT = KERNAL_C.proxy_Z1_CHROUT +;; #ALIAS# MONITOR = KERNAL_0.MONITOR ;; #ALIAS# return_from_interrupt = KERNAL_0.return_from_interrupt + ; 'Print immediate', original implementation by Mike Barry, adapted to 65CE02, modified to preserve .Y ; see http://www.6502.org/source/io/primm.htm