From 96bdf93b76800e9cf33f45e4b339d47e915386d2 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 17 Jan 2021 10:28:19 +0100 Subject: [PATCH] monitor command set memory adapted --- src/mon_m65/bsmon.s | 31 +-------------- src/mon_m65/mon_command_bits.s | 2 +- src/mon_m65/mon_command_compare.s | 2 +- src/mon_m65/mon_command_disassemble.s | 4 +- src/mon_m65/mon_command_fill.s | 2 +- src/mon_m65/mon_command_hunt.s | 4 +- src/mon_m65/mon_command_memory.s | 4 +- src/mon_m65/mon_command_set_memory.s | 38 +++++++++++++++++++ src/mon_m65/mon_command_transfer.s | 2 +- src/mon_m65/mon_helper_get_param_range.s | 2 +- ...r_to_lac.s => mon_helper_get_val_to_lac.s} | 8 ++-- src/mon_m65/mon_helper_syntax.s | 4 ++ 12 files changed, 59 insertions(+), 44 deletions(-) create mode 100644 src/mon_m65/mon_command_set_memory.s rename src/mon_m65/{mon_helper_get_addr_to_lac.s => mon_helper_get_val_to_lac.s} (93%) diff --git a/src/mon_m65/bsmon.s b/src/mon_m65/bsmon.s index 5f5be446..7ee8fa32 100644 --- a/src/mon_m65/bsmon.s +++ b/src/mon_m65/bsmon.s @@ -203,7 +203,7 @@ Jump_Table: !word Mon_Exit ; X !word Mon_DOS ; @ !word Mon_Assemble ; . XXX to be debugged/adapted - !word Mon_Set_Memory ; > XXX to be debugged/adapted + !word Mon_Set_Memory ; > !word Mon_Set_Register ; ; XXX to be debugged/adapted !word Mon_Help ; ? !word Converter ; $ @@ -439,33 +439,6 @@ Mon_Set_Register: ; XXX this needs adaptation BCC @loop @exit JMP Main -; ************* -Mon_Set_Memory: -; ************* - - JSR Set_MODE_80 - - JSR Get_LAC ; get 1st. parameter - BCS @exit - JSR LAC_To_LPC ; Long_PC = row address - LDZ #0 -@loop JSR Get_LAC - BCS @exit - LDA Long_AC - BBS7 Long_PC+3,@banked ; trigger banked access - +NOP ; use STA [Long_PC],Z -@banked STA (Long_PC),Z - INZ - CPZ #16 - BBR7 MODE_80,@next - CPZ #8 -@next BCC @loop - -@exit JSR PRIMM - !pet KEY_ESC, 'o' - !pet $91,$00 - JSR Dump_Row - JMP Main ; ***** Mon_Go: @@ -1727,7 +1700,7 @@ Converter: LDX #0 STX Buf_Index - JSR Get_Addr_To_LAC + JSR Get_Val_To_LAC LBEQ Mon_Error JSR Print_CR LDX #0 diff --git a/src/mon_m65/mon_command_bits.s b/src/mon_m65/mon_command_bits.s index 7d9248e6..6c07bd6b 100644 --- a/src/mon_m65/mon_command_bits.s +++ b/src/mon_m65/mon_command_bits.s @@ -10,7 +10,7 @@ Mon_Bits: lda #$00 sta Addr_Mode ; by default use C64-style addressing - jsr Get_Addr_To_LAC ; get 1st parameter (start address) + jsr Get_Val_To_LAC ; get 1st parameter (start address) beq @nopar pla ; drop previous addressing mode jsr LAC_To_LPC ; Long_PC = start address diff --git a/src/mon_m65/mon_command_compare.s b/src/mon_m65/mon_command_compare.s index f2e6aa86..8e60a3f6 100644 --- a/src/mon_m65/mon_command_compare.s +++ b/src/mon_m65/mon_command_compare.s @@ -8,7 +8,7 @@ Mon_Compare: +bcs Mon_Error ; Long_CT = count lda #$00 sta Addr_Mode - jsr Get_Addr_To_LAC ; Long_AC = target + jsr Get_Val_To_LAC ; Long_AC = target +beq Mon_Error lda Src_Addr_Mode diff --git a/src/mon_m65/mon_command_disassemble.s b/src/mon_m65/mon_command_disassemble.s index 68f33348..582fc71d 100644 --- a/src/mon_m65/mon_command_disassemble.s +++ b/src/mon_m65/mon_command_disassemble.s @@ -9,11 +9,11 @@ Mon_Disassemble: lda #$00 sta Addr_Mode ; by default use C64-style addressing - jsr Get_Addr_To_LAC ; get 1st parameter (start address) + jsr Get_Val_To_LAC ; get 1st parameter (start address) beq @nopar pla ; drop previous addressing mode jsr LAC_To_LPC ; Long_PC = start address - jsr Get_Addr_To_LAC ; get 2nd parameter (end address) + jsr Get_Val_To_LAC ; get 2nd parameter (end address) beq @norange jsr LAC_Minus_LPC ; Long_CT = range +bcc Mon_Error ; -> negative diff --git a/src/mon_m65/mon_command_fill.s b/src/mon_m65/mon_command_fill.s index e79f5ca0..a872097a 100644 --- a/src/mon_m65/mon_command_fill.s +++ b/src/mon_m65/mon_command_fill.s @@ -9,7 +9,7 @@ Mon_Fill: jsr Get_Param_Range ; Long_PC = target +bcs Mon_Error ; Long_CT = count - jsr Get_Addr_To_LAC ; Long_AC = fill byte + jsr Get_Val_To_LAC ; Long_AC = fill byte +beq Mon_Error jsr Syntax_Byte_AC ; only 1 fill byte allowed diff --git a/src/mon_m65/mon_command_hunt.s b/src/mon_m65/mon_command_hunt.s index 048851a5..bd1a74cc 100644 --- a/src/mon_m65/mon_command_hunt.s +++ b/src/mon_m65/mon_command_hunt.s @@ -27,7 +27,7 @@ Mon_Hunt: @bin: - jsr Got_Addr_To_LAC + jsr Got_Val_To_LAC jsr Syntax_Byte_AC @lpbin: @@ -35,7 +35,7 @@ Mon_Hunt: lda Long_AC sta Mon_Data,Y iny - jsr Get_Addr_To_LAC + jsr Get_Val_To_LAC beq @hunt jsr Syntax_Byte_AC diff --git a/src/mon_m65/mon_command_memory.s b/src/mon_m65/mon_command_memory.s index 02103be1..45f00ad5 100644 --- a/src/mon_m65/mon_command_memory.s +++ b/src/mon_m65/mon_command_memory.s @@ -8,11 +8,11 @@ Mon_Memory: lda #$00 sta Addr_Mode ; by default use C64-style addressing - jsr Get_Addr_To_LAC ; get 1st parameter (start address) + jsr Get_Val_To_LAC ; get 1st parameter (start address) +beq Mon_Error jsr LAC_To_LPC ; Long_PC = start address - jsr Get_Addr_To_LAC ; get 2nd parameter (end address) + jsr Get_Val_To_LAC ; get 2nd parameter (end address) bne @calcdiff lda #$10 ; by default display 16 rows diff --git a/src/mon_m65/mon_command_set_memory.s b/src/mon_m65/mon_command_set_memory.s new file mode 100644 index 00000000..263de1c4 --- /dev/null +++ b/src/mon_m65/mon_command_set_memory.s @@ -0,0 +1,38 @@ + +; Based on BSM (Bit Shifter's Monitor) + + +Mon_Set_Memory: + + jsr Get_Val_To_LAC ; get 1st. parameter + beq @exit + jsr LAC_To_LPC ; Long_PC = row address + lda Addr_Mode + sta Dst_Addr_Mode + + ldz #$00 + +@loop: + + jsr Get_Glyph + cmp #KEY_COLON + beq @exit + jsr Got_Val_To_LAC + beq @exit + jsr Syntax_Byte_AC + + lda Dst_Addr_Mode + sta Addr_Mode + + lda Long_AC+0 + jsr Put_To_Memory_LPC + + inz + bra @loop + +@exit: + + jsr PRIMM + !pet KEY_ESC, 'o', $91, $00 + jsr Dump_Row + jmp Main diff --git a/src/mon_m65/mon_command_transfer.s b/src/mon_m65/mon_command_transfer.s index 44b37f11..55c31158 100644 --- a/src/mon_m65/mon_command_transfer.s +++ b/src/mon_m65/mon_command_transfer.s @@ -7,7 +7,7 @@ Mon_Transfer: jsr Get_Param_Range ; Long_PC = source ; Long_CT = count - jsr Get_Addr_To_LAC ; Long_AC = target + jsr Get_Val_To_LAC ; Long_AC = target +beq Mon_Error lda Src_Addr_Mode diff --git a/src/mon_m65/mon_helper_get_param_range.s b/src/mon_m65/mon_helper_get_param_range.s index 2f749269..64a168d8 100644 --- a/src/mon_m65/mon_helper_get_param_range.s +++ b/src/mon_m65/mon_helper_get_param_range.s @@ -36,7 +36,7 @@ Get_Param_Range: lda #$00 sta Addr_Mode - jsr Get_Addr_To_LAC + jsr Get_Val_To_LAC beq @error lda Addr_Mode rts diff --git a/src/mon_m65/mon_helper_get_addr_to_lac.s b/src/mon_m65/mon_helper_get_val_to_lac.s similarity index 93% rename from src/mon_m65/mon_helper_get_addr_to_lac.s rename to src/mon_m65/mon_helper_get_val_to_lac.s index 7bfb8d2b..a1d0d090 100644 --- a/src/mon_m65/mon_helper_get_addr_to_lac.s +++ b/src/mon_m65/mon_helper_get_val_to_lac.s @@ -2,13 +2,13 @@ ; Based on BSM (Bit Shifter's Monitor) -Got_Addr_To_LAC: ; to be used when first byte already fetched +Got_Val_To_LAC: ; to be used when first byte already fetched dec Buf_Index ; FALLTROUGH -Get_Addr_To_LAC: +Get_Val_To_LAC: phx phy @@ -118,13 +118,13 @@ Get_Addr_To_LAC: inw Long_AC+2 bne @valid_prefix - jmp Mon_Error ; number foo large + jmp Mon_Error ; number too large @exit: lda Long_AC+3 and #%11110000 - +bne Mon_Error ; MEGA65 has a 28-bit address bu + +bne Mon_Error ; MEGA65 has a 28-bit address bus lda Dig_Cnt ; check if we should enable long addressing mode cmp Num_Limit,Y diff --git a/src/mon_m65/mon_helper_syntax.s b/src/mon_m65/mon_helper_syntax.s index ff77a4d5..ce30b745 100644 --- a/src/mon_m65/mon_helper_syntax.s +++ b/src/mon_m65/mon_helper_syntax.s @@ -7,6 +7,8 @@ Syntax_Byte_AC: ; ensure AC contains a 1-byte value php pha + ; XXX improve this - check for numeric system and Dig_Cnt, will require Got_Addr_To_LAC rework + lda Long_AC+1 ora Long_AC+2 ora Long_AC+3 @@ -15,3 +17,5 @@ Syntax_Byte_AC: ; ensure AC contains a 1-byte value pla plp rts + +; XXX add routine to check if this was last character