From 4907a146da81ec4856db934f0050fb483ec6b6a2 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 22 Sep 2020 18:08:49 +0200 Subject: [PATCH] small DOS Wedge improvement --- STATUS.md | 2 +- doc/Extended-BASIC.md | 16 ++++++++++------ src/basic/wedge/wedge_dos.s | 34 +++++++++++++++++++++++++--------- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/STATUS.md b/STATUS.md index c0b3c7aa..3e219ccf 100644 --- a/STATUS.md +++ b/STATUS.md @@ -9,7 +9,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8 * pre-defined function keys * JiffyDOS and DolphinDOS protocols support -* DOS wedge (direct mode only) - `@`, `@`, `@$`, `@$`, `@` +* DOS wedge (direct mode only) - `@`, `@`, `@$[mask]`, `@$`, `@$[mask]` `@` * BASIC extensions, see the [documentation](doc/Extended-BASIC.md) * extended / tweaked `LOAD` / `VERIFY` commands * start/end addresses are displayed, in the Final cartridge style diff --git a/doc/Extended-BASIC.md b/doc/Extended-BASIC.md index 3de5a66d..eeccfae3 100644 --- a/doc/Extended-BASIC.md +++ b/doc/Extended-BASIC.md @@ -9,19 +9,23 @@ The DOS Wedge commands are only available in direct mode, and they have to start ### `@` (all) -Displays the error/status read from the current drive. Current drive is either the last device used by any I/O command, the one set by DOS Wedge command, or 8 as a fallback. +Displays the error/status read from the current unit. Current unit is either the last device used by any I/O command, the one set by DOS Wedge command, or a default one for the given build. -### `@$` (all) +### `@$[mask]` (all) -Displays the directory of the current drive. Does not destroy BASIC program in memory. +Displays the directory of the current unit. Can be followed by mask, like in `LOAD "$mask"`. Does not destroy BASIC program in memory. -### `@device_number` (all) +### `@` (all) -Changes the current drive number. +Changes the current unit number. + +### `@$[mask]` (all) + +Combines the two above - displays the directory of the selected driove, in one command. ### `@command` (all) -Sends the DOS command to the current drive. +Sends the DOS command to the current unit. ## Tape Wedge diff --git a/src/basic/wedge/wedge_dos.s b/src/basic/wedge/wedge_dos.s index eaa80fa4..f451d4a6 100644 --- a/src/basic/wedge/wedge_dos.s +++ b/src/basic/wedge/wedge_dos.s @@ -136,22 +136,27 @@ wedge_dos_command_confirmed: wedge_dos_change_drive: - ; Fetch new drive number, make sure this is the last part of the command + ; Fetch new drive number, make sure it is sane jsr fetch_uint8 - pha - jsr fetch_character_skip_spaces - cmp #$00 - +bne do_SYNTAX_error - pla - - ; Check if device number is valid for IEC drive - cmp #$08 +bcc do_ILLEGAL_DEVICE_NUMBER_error + ; Check if this is end of command, or directory request + + pha + jsr fetch_character_skip_spaces + cmp #$24 + beq wedge_dos_change_drive_directory + + ; Make sure this is end of command + + cmp #$00 + +bne do_SYNTAX_error + ; Store new device number and return to shell + pla sta FA jmp shell_main_loop @@ -245,6 +250,17 @@ wedge_dos_status_print_no_new_line: +bra wedge_dos_clean_exit +wedge_dos_change_drive_directory: + + ; Store new device number, display directory + + pla + sta FA + + dec TXTPTR+0 ; in direct mode we do not have to care about TXTPTR+1 + + ; FALLTROUGH + wedge_dos_directory: ; First change the secondary address to the one suitable for directory loading