From 7885e53d747a3ec2ef6ee463a432c3d5455383c5 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 19 Jan 2021 22:44:38 +0100 Subject: [PATCH] started work on monitor disc commands --- src/aliases/,aliases_ram_lowmem.s | 2 +- src/mon_m65/bsmon.s | 86 ---------------- src/mon_m65/imports.s | 1 + src/mon_m65/mon_command_load_save.s | 152 ++++++++++++++++++++++++++++ 4 files changed, 154 insertions(+), 87 deletions(-) create mode 100644 src/mon_m65/mon_command_load_save.s diff --git a/src/aliases/,aliases_ram_lowmem.s b/src/aliases/,aliases_ram_lowmem.s index 89e9aa5b..cdce7464 100644 --- a/src/aliases/,aliases_ram_lowmem.s +++ b/src/aliases/,aliases_ram_lowmem.s @@ -122,7 +122,7 @@ !addr FNLEN = $B7 ; current file name length !addr LA = $B8 ; current logical_file number !addr SA = $B9 ; current secondary address - !addr FA = $BA ; current device number + !addr FA = $BA ; current unit number !addr FNADDR = $BB ; $BB-$BC current file name pointer !addr ROPRTY = $BD ; -- NOT IMPLEMENTED -- tape / RS-232 temporary storage !addr FSBLK = $BE ; -- NOT IMPLEMENTED -- tape / RS-232 temporary storage diff --git a/src/mon_m65/bsmon.s b/src/mon_m65/bsmon.s index 294f058d..5c66750d 100644 --- a/src/mon_m65/bsmon.s +++ b/src/mon_m65/bsmon.s @@ -469,92 +469,6 @@ Dump_Row: PLZ RTS -; ******** -Load_Save: -; ******** - - ; XXX to be rewritten for Open ROMs! - jmp Main - - ; LDY Disk_Unit - ; STY FA - ; LDY #8 - ; STY SA - ; LDY #0 - ; STY BA - ; STY FNLEN - ; STY FNBANK - ; STY IOSTATUS - ; LDA #>Mon_Data - ; STA FNADR+1 - ; LDA # load/verify - ; JSR Print_CR - ; LDX Long_AC ; X/Y = end address - ; LDY Long_AC+1 - ; LDA VERCKK ; A = load/verify/save - ; CMP #'S' - ; LBNE Mon_Error ; must be Save - ; LDA #0 - ; STA SA ; set SA for PRG - ; LDA #Long_PC ; Long_PC = start address - ; JSR SAVE -; @exit JMP Main - -; @do LDA VERCKK - ; CMP #'V' ; Verify - ; BEQ @exec - ; CMP #'L' ; Load - ; LBNE Mon_Error - ; LDA #0 ; 0 = LOAD -; @exec JSR LOAD ; A == 0 : LOAD else VERIFY - ; BBR4 IOSTATUS,@exit - ; LDA VERCKK - ; LBEQ Mon_Error - ; LBCS Main - ; JSR PRIMM - ; !pet " error",0 - ; JMP Main - -; @load LDX Long_PC - ; LDY Long_PC+1 - ; LDA #0 ; 0 = use X/Y as load address - ; STA SA ; and ignore load address from file - ; BRA @do - ; *********** Mon_Assemble: ; *********** diff --git a/src/mon_m65/imports.s b/src/mon_m65/imports.s index a981faf6..94510187 100644 --- a/src/mon_m65/imports.s +++ b/src/mon_m65/imports.s @@ -8,6 +8,7 @@ ;; #ALIAS# SETMSG = KERNAL_0.SETMSG ;; #ALIAS# STOP = KERNAL_0.STOP ;; #ALIAS# SCREEN = KERNAL_0.SCREEN +;; #ALIAS# SELDEV = KERNAL_0.SELDEV ;; #ALIAS# monitor_exit = KERNAL_0.m65_shadow_BZP ;; #ALIAS# monitor_memread_helper = KERNAL_0.proxy_M1_memread diff --git a/src/mon_m65/mon_command_load_save.s b/src/mon_m65/mon_command_load_save.s new file mode 100644 index 00000000..3e2f41a0 --- /dev/null +++ b/src/mon_m65/mon_command_load_save.s @@ -0,0 +1,152 @@ + +; Based on BSM (Bit Shifter's Monitor) + + +Load_Save: + + ; Retrieve file name + +@skip1: + + jsr Get_Char + +beq Mon_Error + cmp #' ' + beq @skip1 + cmp #KEY_QUOTE + +bne Mon_Error + + lda #$FF + sta FNLEN + lda Buf_Index + sta FNADDR+0 + lda #>BUF + sta FNADDR+1 + +@skip2: + inc FNLEN + jsr Get_Char + +beq Mon_Error + cmp #KEY_QUOTE + bne @skip2 + + ; Separate flow for SAVE + + lda VERCKK + cmp #$02 + beq Mon_Save + + ; FALLTROUGH + +Mon_Load_Verify: + + ; Determine unit + + jsr SELDEV ; set default unit + stx FA + + jsr Get_Val_To_LAC + beq @got_unit + jsr Syntax_Byte_AC + lda Long_AC+0 + sta FA + +@got_unit: + + ; XXX to be finished + + jmp Main + + +Mon_Save: + + ; Determine unit + + jsr Get_Val_To_LAC + +beq Mon_Error + jsr Syntax_Byte_AC + + + + ; XXX to be finished + + jmp Main + + + + + ; LDY #8 + ; STY SA + ; LDY #0 + ; STY BA + ; STY FNLEN + ; STY FNBANK + ; STY IOSTATUS + ; LDA #>Mon_Data + ; STA FNADR+1 + ; LDA # load/verify + ; JSR Print_CR + ; LDX Long_AC ; X/Y = end address + ; LDY Long_AC+1 + ; LDA VERCKK ; A = load/verify/save + ; CMP #'S' + ; LBNE Mon_Error ; must be Save + ; LDA #0 + ; STA SA ; set SA for PRG + ; LDA #Long_PC ; Long_PC = start address + ; JSR SAVE +; @exit JMP Main + +; @do LDA VERCKK + ; CMP #'V' ; Verify + ; BEQ @exec + ; CMP #'L' ; Load + ; LBNE Mon_Error + ; LDA #0 ; 0 = LOAD +; @exec JSR LOAD ; A == 0 : LOAD else VERIFY + ; BBR4 IOSTATUS,@exit + ; LDA VERCKK + ; LBEQ Mon_Error + ; LBCS Main + ; JSR PRIMM + ; !pet " error",0 + ; JMP Main + +; @load LDX Long_PC + ; LDY Long_PC+1 + ; LDA #0 ; 0 = use X/Y as load address + ; STA SA ; and ignore load address from file + ; BRA @do