From 5accf927b3123518de862fef27f07efd80b19bb1 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 13 Jun 2019 18:09:09 +0200 Subject: [PATCH] first work towards DOS wedge --- c64/basic/basic_execute_line.s | 24 ++++++++++--- c64/basic/wedge_dos.s | 65 ++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 c64/basic/wedge_dos.s diff --git a/c64/basic/basic_execute_line.s b/c64/basic/basic_execute_line.s index a7689e51..1571575f 100644 --- a/c64/basic/basic_execute_line.s +++ b/c64/basic/basic_execute_line.s @@ -80,9 +80,9 @@ basic_execute_statement: ;; Now consume the character jsr basic_consume_character - rts + rts -not_a_token: +not_a_token: ;; Space, which we can also just ignore cmp #$20 beq basic_skip_char @@ -93,11 +93,27 @@ not_a_token: cmp #$3a beq basic_skip_char +;; START wedge support + + ;; Are we in direct mode? + ;; DOS Wedge is a hacky solution (inelegant, but convenient), + ;; BASIC programmers should implement communication with drives + ;; the standard way, handling channels properly + ldx basic_current_line_number+1 + cpx #$ff + bne + + ;; We are in direct mode, allow wedge to handle '@' sign + ;; XXX Maybe it should be allowed only as the first command? + cmp #$40 + bne + + jsr basic_consume_character + jmp wedge_dos +* +;; END wedge support + ;; If all else fails, it's a syntax error jmp do_SYNTAX_error - jmp basic_main_loop - basic_skip_char: jsr basic_consume_character jmp basic_execute_statement diff --git a/c64/basic/wedge_dos.s b/c64/basic/wedge_dos.s new file mode 100644 index 00000000..2f7a5506 --- /dev/null +++ b/c64/basic/wedge_dos.s @@ -0,0 +1,65 @@ + +;; START wedge support + +wedge_dos: + + ;; Close all the channels, so that wedge has full control + jsr $FFE7 ; CLALL + + ;; Take last device number, make sure it's a drive + ;; If not, set to 8 (first drive number) + lda current_device_number + cmp #$07 + bpl + + lda #$08 +* + ;; Set remaining file parameters + ldx #$0F + ldy #$0F + jsr $FFBA ; SETLFS + + ;; Now we have to check what the user wants us to do + + ;; Check if user asked for a status + ldy #$00 + lda (basic_current_statement_ptr), y + beq wedge_dos_status + cmp #$20 + beq wedge_dos_status + + ;; Check if asked for a directory + cmp #$24 + beq wedge_dos_directory +* + ;; XXX Check if asked to change drive number + +wedge_dos_command: ; default + + ;; XXX - implement this + jsr printf + .byte "DBG: CMD", 0 + jmp do_NOT_IMPLEMENTED_error + +wedge_dos_change_drive: + + ;; XXX - implement this + jsr printf + .byte "DBG: CHANGE DRIVE", 0 + jmp do_NOT_IMPLEMENTED_error + +wedge_dos_status: + + ;; XXX - implement this + jsr printf + .byte "DBG: STATUS", 0 + jmp do_NOT_IMPLEMENTED_error + +wedge_dos_directory: + + ;; XXX - implement this + jsr printf + .byte "DBG: DIR", 0 + jmp do_NOT_IMPLEMENTED_error + +;; END wedge support +