diff --git a/src/aliases/,aliases_ram_lowmem.s b/src/aliases/,aliases_ram_lowmem.s index d6660835..89e9aa5b 100644 --- a/src/aliases/,aliases_ram_lowmem.s +++ b/src/aliases/,aliases_ram_lowmem.s @@ -16,8 +16,8 @@ !addr ADRAY2 = $05 ; $05-$06 !addr CHARAC = $07 ; [!] our implementation might be different XXX give more details !addr ENDCHR = $08 ; [!] our implementation might be different XXX give more details - !addr TRMPOS = $09 ; -- NOT IMPLEMENTED -- - !addr VERCKB = $0A ; flag used by BASIC, 0 - LOAD, 1 - VERIFY + !addr TRMPOS = $09 ; -- NOT IMPLEMENTED -- [!] on MEGA65 also used by DOS Wedge under MONITOR + !addr VERCKB = $0A ; flag used by BASIC, 0 - LOAD, 1 - VERIFY, [!] on MEGA65 also used by DOS Wedge !addr COUNT = $0B ; [!] our implementation might be different XXX give more details !addr DIMFLG = $0C ; [!] our implementation might be different XXX give more details !addr VALTYP = $0D ; expression eveluation result; $00 - float, $FF - string diff --git a/src/basic/,basic_aliases.s b/src/basic/,basic_aliases.s index b1242b1c..e98ffc1e 100644 --- a/src/basic/,basic_aliases.s +++ b/src/basic/,basic_aliases.s @@ -22,6 +22,12 @@ !addr __tokenise_work4 = $0F ; GARBFL !addr __tokenise_work5 = $0C ; DIMFLG +; +; Helper aliases for DOS Wedge under MONITOR +; + +!addr __wedge_mon = $0A ; VERCKB +!addr __wedge_spstore = $09 ; TRMPOS ; diff --git a/src/basic/wedge/wedge_dos.s b/src/basic/wedge/wedge_dos.s index df55ae78..675f58f8 100644 --- a/src/basic/wedge/wedge_dos.s +++ b/src/basic/wedge/wedge_dos.s @@ -22,7 +22,11 @@ wedge_dos_monitor: ; entry point for the MONITOR wedge_dos_monitor: - rts + tsx + stx __wedge_spstore ; preserve stack pointer + + lda #$FF ; mark MONITOR-called wedge + bra wedge_dos_monitor_cont } ; .X has to contain size of the buffer @@ -44,10 +48,16 @@ wedge_dos: } else { ; Prepare buffer - finish it with '0' - lda #$00 sta BUF,x +!ifdef CONFIG_MB_M65 { + +wedge_dos_monitor_cont: + + sta __wedge_mon ; mark BASIC/MONITOR-called wedge +} + ; Close all the channels, so that wedge has full control jsr JCLALL @@ -164,7 +174,11 @@ wedge_dos_change_drive: jsr fetch_uint8 cmp #$08 +!ifdef CONFIG_MB_M65 { + +bcc wedge_dos_wrapper_ILLEGAL_DEVICE_NUMBER_error +} else { +bcc do_ILLEGAL_DEVICE_NUMBER_error +} ; Check if this is end of command, or directory request @@ -176,8 +190,11 @@ wedge_dos_change_drive: ; Make sure this is end of command cmp #$00 +!ifdef CONFIG_MB_M65 { + +bne wedge_dos_wrapper_SYNTAX_error +} else { +bne do_SYNTAX_error - +} ; Store new device number and return to shell pla @@ -221,8 +238,11 @@ wedge_dos_status_get_loop: ; Check for buffer overflow cpy #$50 +!ifdef CONFIG_MB_M65 { + +beq wedge_dos_wrapper_OVERFLOW_error +} else { +beq do_OVERFLOW_error - +} ; Check for EOF jsr JREADST @@ -326,8 +346,12 @@ wedge_dos_directory_line: jsr JCHRIN bcs wedge_dos_basic_error sta BUF, y - cpy #$50 - +beq do_OVERFLOW_error ; branch if line too long + cpy #$50 ; make sure line is not too long +!ifdef CONFIG_MB_M65 { + +beq wedge_dos_wrapper_OVERFLOW_error +} else { + +beq do_OVERFLOW_error +} jsr JREADST bne @6 ; end of file cpy #$04 ; 2 bytes (pointer to next line) + 2 bytes (line number) @@ -371,14 +395,22 @@ wedge_dos_directory_display: wedge_dos_clean_exit: jsr JCLALL +!ifdef CONFIG_MB_M65 { + jmp wedge_dos_wrapper_exit +} else { jmp shell_main_loop +} wedge_dos_basic_error: pha jsr JCLALL pla +!ifdef CONFIG_MB_M65 { + bra wedge_dos_wrapper_kernal_error +} else { jmp do_kernal_error +} wedge_dos_setnam: @@ -398,6 +430,68 @@ wedge_dos_setnam: jmp JSETNAM +!ifdef CONFIG_MB_M65 { + +wedge_dos_wrapper_exit: + + bbr7 __wedge_mon, wedge_dos_clean_exit_basic + + ; FALLTROUGH + +wedge_dos_wrapper_exit_nocheck: + + ldx __wedge_spstore + txs + rts + +wedge_dos_wrapper_SYNTAX_error: + + bbr7 __wedge_mon, wedge_dos_SYNTAX_error + + ; XXX + +wedge_dos_wrapper_ILLEGAL_DEVICE_NUMBER_error: + + bbr7 __wedge_mon, wedge_dos_ILLEGAL_DEVICE_NUMBER_error + + ; XXX + +wedge_dos_wrapper_OVERFLOW_error: + + bbr7 __wedge_mon, wedge_dos_OVERFLOW_error + + ; XXX + +wedge_dos_wrapper_kernal_error: + + bbr7 __wedge_mon, wedge_dos_kernal_error + + ; XXX + + bra wedge_dos_wrapper_exit_nocheck + +wedge_dos_SYNTAX_error: + + jmp do_SYNTAX_error + +wedge_dos_ILLEGAL_DEVICE_NUMBER_error: + + jmp do_ILLEGAL_DEVICE_NUMBER_error + +wedge_dos_OVERFLOW_error: + + jmp do_OVERFLOW_error + +wedge_dos_kernal_error: + + jmp do_kernal_error + +wedge_dos_clean_exit_basic: + + jmp shell_main_loop + + +} ; MEGA65 specific code } ; ROM layout