diff --git a/src/mon_m65/,aliases_mon.s b/src/mon_m65/,aliases_mon.s index baf6877a..814abeea 100644 --- a/src/mon_m65/,aliases_mon.s +++ b/src/mon_m65/,aliases_mon.s @@ -26,8 +26,8 @@ ; * Other variables * ; ******************* -!addr Src_Addr_Mode = 13 ; Addr_Mode for 1st address -!addr Dst_Addr_Mode = 14 ; Addr_Mode for 2nd address +!addr Src_Addr_Mode = 13 ; Addr_Mode for 1st address XXX can this be replaced with Addr_Mode? +!addr Dst_Addr_Mode = 14 ; Addr_Mode for 2nd address XXX is it needed? !addr MODE_80 = 15 ; 80 column / 40 volumn flag diff --git a/src/mon_m65/bsmon.s b/src/mon_m65/bsmon.s index 449f029b..5e26a4ce 100644 --- a/src/mon_m65/bsmon.s +++ b/src/mon_m65/bsmon.s @@ -199,7 +199,7 @@ Jump_Table: !word Mon_JSR ; J XXX to be debugged/adapted !word Mon_Memory ; M !word Mon_Register ; R - !word Mon_Transfer ; T XXX to be debugged/adapted + !word Mon_Transfer ; T XXX to be bugfixed !word Mon_Exit ; X !word Mon_DOS ; @ !word Mon_Assemble ; . XXX to be debugged/adapted @@ -399,7 +399,7 @@ Fetch: PHZ TYA TAZ - JSR Get_From_Memory + JSR Get_From_Memory_LPC PLZ AND #$ff RTS @@ -482,10 +482,10 @@ Mon_JSR: jmp Main ; *********** -Dump_4_Bytes: ; XXX to be adapted +Dump_4_Bytes: ; *********** -@loop JSR Get_From_Memory +@loop JSR Get_From_Memory_LPC JSR Print_Hex_Blank INZ TZA @@ -494,10 +494,10 @@ Dump_4_Bytes: ; XXX to be adapted RTS ; *********** -Dump_4_Chars: ; XXX to be adapted +Dump_4_Chars: ; *********** -@loop JSR Get_From_Memory +@loop JSR Get_From_Memory_LPC TAY AND #%01100000 BNE @laba @@ -550,39 +550,6 @@ Dump_Row: PLZ RTS -; *********** -Mon_Transfer: -; *********** - - JSR Get_Param_Range ; Long_PC = source - LBCS Mon_Error ; Long_CT = count - JSR Get_LAC ; Long_AC = target - LBCS Mon_Error - - LDZ #0 - JSR LAC_Compare_LPC ; target - source - BCC @forward - -; source < target: backward transfer - - JSR LAC_Plus_LCT ; Long_AC = end of target - -@lpback LDA [Long_DA],Z ; backward copy - STA [Long_AC],Z - JSR Dec_LDA - JSR Dec_LAC - JSR Dec_LCT - BPL @lpback - JMP Main - -@forward LDA [Long_PC],Z ; forward copy - STA [Long_AC],Z - JSR Inc_LPC - JSR Inc_LAC - JSR Dec_LCT - BPL @forward - JMP Main - ; ********** Mon_Compare: ; ********** @@ -2325,7 +2292,7 @@ Mon_Help: !pet KEY_ESC,'s',"g",KEY_ESC,'u',"o - g [address]",KEY_RETURN !pet KEY_ESC,'s',"h",KEY_ESC,'u',"unt - h from to (string or bytes)",KEY_RETURN !pet KEY_ESC,'s',"j",KEY_ESC,'u',"sr - j address",KEY_RETURN - !pet KEY_ESC,'s',"l",KEY_ESC,'u',"oad - l filename [uniy [address]]",KEY_RETURN + !pet KEY_ESC,'s',"l",KEY_ESC,'u',"oad - l filename [unit [address]]",KEY_RETURN !pet KEY_ESC,'s',"m",KEY_ESC,'u',"emory - m [from [to]]",KEY_RETURN !pet KEY_ESC,'s',"r",KEY_ESC,'u',"egisters - r",KEY_RETURN !pet KEY_ESC,'s',"s",KEY_ESC,'u',"ave - s filename unit from to",KEY_RETURN diff --git a/src/mon_m65/mon_command_bits.s b/src/mon_m65/mon_command_bits.s index 57fb2d87..7d9248e6 100644 --- a/src/mon_m65/mon_command_bits.s +++ b/src/mon_m65/mon_command_bits.s @@ -46,7 +46,7 @@ Mon_Bits: plx - jsr Get_From_Memory + jsr Get_From_Memory_LPC jsr Print_Bits clc tza diff --git a/src/mon_m65/mon_command_fill.s b/src/mon_m65/mon_command_fill.s index f537c5bb..9a9de779 100644 --- a/src/mon_m65/mon_command_fill.s +++ b/src/mon_m65/mon_command_fill.s @@ -21,7 +21,7 @@ Mon_Fill: @loop: lda Long_AC - jsr Put_To_Memory + jsr Put_To_Memory_LPC jsr Inc_LPC jsr Dec_LCT bpl @loop diff --git a/src/mon_m65/mon_command_transfer.s b/src/mon_m65/mon_command_transfer.s new file mode 100644 index 00000000..95eb5f94 --- /dev/null +++ b/src/mon_m65/mon_command_transfer.s @@ -0,0 +1,42 @@ + +; Based on BSM (Bit Shifter's Monitor) + + +Mon_Transfer: + + jsr Get_Param_Range ; Long_PC = source + ; Long_CT = count + + jsr Get_Addr_To_LAC ; Long_AC = target + +beq Mon_Error + + lda Src_Addr_Mode + sta Addr_Mode + + ldz #0 + jsr LAC_Compare_LPC ; target - source + bcc @forward + + ; source < target: backward transfer + + jsr LAC_Plus_LCT ; Long_AC = end of target + +@lpback: + + jsr Get_From_Memory_LDA ; backward copy + jsr Put_To_Memory_LAC + jsr Dec_LDA + jsr Dec_LAC + jsr Dec_LCT + bpl @lpback + jmp Main + +@forward: + + jsr Get_From_Memory_LPC ; forward copy + jsr Put_To_Memory_LAC + jsr Inc_LPC + jsr Inc_LAC + jsr Dec_LCT + bpl @forward + jmp Main diff --git a/src/mon_m65/mon_helper_memory.s b/src/mon_m65/mon_helper_memory.s index 43d5cb33..5eafd00b 100644 --- a/src/mon_m65/mon_helper_memory.s +++ b/src/mon_m65/mon_helper_memory.s @@ -1,8 +1,13 @@ ; Monitor helper code - memory read and write +Get_From_Memory_LDA: -Get_From_Memory: + jsr Exchange_LDA_LPC + jsr Get_From_Memory_LPC + jmp Exchange_LDA_LPC + +Get_From_Memory_LPC: phx phy @@ -111,7 +116,14 @@ Get_Put_Memory_Prepare_Shadow: -Put_To_Memory: + +Put_To_Memory_LAC: + + jsr Exchange_LAC_LPC + jsr Put_To_Memory_LPC + jmp Exchange_LAC_LPC + +Put_To_Memory_LPC: phx phy @@ -144,3 +156,51 @@ Put_To_Memory: pla jsr monitor_memwrite_helper bra Get_Put_Memory_End + + + +Exchange_LDA_LPC: + + phx + pha + + ldx #$03 + +@loop: + + lda Long_DA,X + pha + lda Long_PC,X + sta Long_DA,X + pla + sta Long_PC,X + + dex + bpl @loop + + pla + plx + rts + +Exchange_LAC_LPC: + + phx + pha + + ldx #$03 + +@loop: + + lda Long_AC,X + pha + lda Long_PC,X + sta Long_AC,X + pla + sta Long_PC,X + + dex + bpl @loop + + pla + plx + rts