From dc4edbb81cc7a8f4c7edb30a46443a90708ee971 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 2 Jan 2021 18:53:59 +0100 Subject: [PATCH] more work on monitor integration --- src/mon_m65/,aliases_mon.s | 4 +- src/mon_m65/bsmon.s | 14 ++--- src/mon_m65/mon_command_memory.s | 2 + src/mon_m65/mon_helper_get_addr_to_lac.s | 1 + src/mon_m65/mon_helper_memory.s | 78 ++++++++++++++++++++++++ 5 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 src/mon_m65/mon_helper_memory.s diff --git a/src/mon_m65/,aliases_mon.s b/src/mon_m65/,aliases_mon.s index 7d444c08..c13403e3 100644 --- a/src/mon_m65/,aliases_mon.s +++ b/src/mon_m65/,aliases_mon.s @@ -61,7 +61,9 @@ !addr Disk_Sector = $32 ; logical sector 0 -> 255 !addr Disk_Status = $33 ; BCD value of status - ; $34-$3F - free space, unused for now + ; $34-$3B - free space, unused for now + +!addr Long_TMP = $3C ; temporary pointer, for fetching/storing memory content !addr Disk_Msg = $40 ; 40 bytes, disk status as text message ; XXX rework code to make it not needed !addr Mon_Data = $68 ; 40 bytes, buffer for hunt and filename diff --git a/src/mon_m65/bsmon.s b/src/mon_m65/bsmon.s index c79fb808..83085a87 100644 --- a/src/mon_m65/bsmon.s +++ b/src/mon_m65/bsmon.s @@ -529,9 +529,8 @@ Dump_4_Bytes: ; XXX to be adapted ; *********** JSR CHROUT ; colour -@loop BBS7 Long_PC+3,@banked ; trigger banked access - +NOP ; use LDA [Long_PC],Z -@banked LDA (Long_PC),Z +@loop + JSR Get_From_Memory JSR Print_Hex_Blank INZ TZA @@ -546,9 +545,8 @@ Dump_4_Chars: ; XXX to be adapted LDY #0 STY QTSW ; disable quote mode JSR CHROUT ; colour -@loop BBS7 Long_PC+3,@banked ; trigger banked access - +NOP ; use LDA [Long_PC],Z -@banked LDA (Long_PC),Z +@loop + JSR Get_From_Memory TAY AND #%01100000 BNE @laba @@ -589,9 +587,9 @@ Dump_Row: LDX #2 ; 4 blocks in 80 columns BBR7 MODE_80,@lchr DEX ; 2 blocks in 40 columns -@lchr LDA #KEY_LT_RED +@lchr LDA #KEY_LT_RED ; XXX replace color with bold attribute JSR Dump_4_Chars - LDA #KEY_WHITE + LDA #KEY_WHITE ; XXX replace color with bold attribute JSR Dump_4_Chars DEX BNE @lchr diff --git a/src/mon_m65/mon_command_memory.s b/src/mon_m65/mon_command_memory.s index 2e460cbe..11b688ec 100644 --- a/src/mon_m65/mon_command_memory.s +++ b/src/mon_m65/mon_command_memory.s @@ -1,4 +1,6 @@ +; Based on BSM (Bit Shifter's Monitor) + Mon_Memory: jsr Set_MODE_80 diff --git a/src/mon_m65/mon_helper_get_addr_to_lac.s b/src/mon_m65/mon_helper_get_addr_to_lac.s index 899758b4..a165f8db 100644 --- a/src/mon_m65/mon_helper_get_addr_to_lac.s +++ b/src/mon_m65/mon_helper_get_addr_to_lac.s @@ -1,4 +1,5 @@ +; Based on BSM (Bit Shifter's Monitor) Get_Addr_To_LAC: diff --git a/src/mon_m65/mon_helper_memory.s b/src/mon_m65/mon_helper_memory.s new file mode 100644 index 00000000..fa5e2d52 --- /dev/null +++ b/src/mon_m65/mon_helper_memory.s @@ -0,0 +1,78 @@ + +; Monitor helper code - read and write + +; XXX there is a bug somewhere with wrapping arounf $FFFF + +Get_From_Memory: + + phx + phy + phz + + ; Copy PC + .Z to TMP, set .Z to 0 + + clc + tza + adc Long_PC+0 + sta Long_TMP+0 + + ldx #$02 +@1: + lda Long_PC+1,x + adc #$00 + sta Long_TMP+1,x + dex + bpl @1 + + ldz #$00 + + ; Check addressing mode + + bbs7 Adr_Mode, @mode_flat + +@mode_64k: + + lda Long_TMP+1 + bne @read ; branch if no need to handle shadow memory (not zero page) + lda Long_TMP+0 + dec + dec + cmp #$8E + bcs @read ; branch if no need to handle shadow memory (0, 1, or above $8F) +@2: + sta Long_TMP+0 + bra @read_shadow + +@mode_flat: + + lda Long_TMP+3 + ora Long_TMP+2 + ora Long_TMP+1 + bne @read_flat + + lda Long_TMP+0 + dec + dec + cmp #$8E + bcs @read_flat + bra @2 + +@read_shadow: + + lda #MEMCONF_SHADOW_BZP_1 + sta Long_TMP+1 + lda #MEMCONF_SHADOW_BZP_2 + sta Long_TMP+2 + lda #MEMCONF_SHADOW_BZP_3 + sta Long_TMP+3 + +@read_flat: + +nop +@read: + lda (Long_TMP),Z + + plz + ply + plx + + rts