From cf92df4acd5badc5822d08a93c6f4c0cccf865c7 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 8 Jan 2021 22:40:03 +0100 Subject: [PATCH] another monitor integration bugfix, added some debug code --- src/mon_m65/mon_debug.s | 105 ++++++++++++++++++++++++++++++++ src/mon_m65/mon_helper_memory.s | 11 ++-- 2 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 src/mon_m65/mon_debug.s diff --git a/src/mon_m65/mon_debug.s b/src/mon_m65/mon_debug.s new file mode 100644 index 00000000..aa66c1e8 --- /dev/null +++ b/src/mon_m65/mon_debug.s @@ -0,0 +1,105 @@ + +; +; Helper code for debugging the monitor +; + +; XXX disable this code once the monitor integration is complete + + +DBG_print_long_pc: + + php + pha + phx + phy + phz + + jsr PRIMM + !pet $0D, "long pc : ", 0 + + lda Long_PC+3 + jsr Print_Hex + lda Long_PC+2 + jsr Print_Hex + lda Long_PC+1 + jsr Print_Hex + lda Long_PC+0 + jsr Print_Hex + + jsr PRIMM + !pet " addr mode : ", 0 + + lda Adr_Mode + jsr Print_Hex + + jsr PRIMM + !pet " :: ", 0 + + plz + ply + plx + pla + plp + + rts + +DBG_print_hex: + + php + pha + phx + phy + phz + + pha + jsr PRIMM + !pet $0D, "hex : ", 0 + pla + + jsr Print_Hex + + plz + ply + plx + pla + plp + + rts + +DBG_print_CP1: + + php + pha + phx + phy + phz + + jsr PRIMM + !pet $0D, "checkpoint 1", 0 + + jmp DBG_END + +DBG_print_CP2: + + php + pha + phx + phy + phz + + jsr PRIMM + !pet $0D, "checkpoint 2", 0 + + ; FALLTROUGH + +DBG_END: + + plz + ply + plx + pla + plp + + rts + + diff --git a/src/mon_m65/mon_helper_memory.s b/src/mon_m65/mon_helper_memory.s index fa5e2d52..e0a5a884 100644 --- a/src/mon_m65/mon_helper_memory.s +++ b/src/mon_m65/mon_helper_memory.s @@ -16,13 +16,14 @@ Get_From_Memory: adc Long_PC+0 sta Long_TMP+0 - ldx #$02 + ldx #$01 @1: - lda Long_PC+1,x + lda Long_PC+0,x adc #$00 - sta Long_TMP+1,x - dex - bpl @1 + sta Long_TMP+0,x + inx + cpx #$04 + bne @1 ldz #$00