diff --git a/c64/basic/cmd_load.s b/c64/basic/cmd_load.s index 2931b607..dc900c54 100644 --- a/c64/basic/cmd_load.s +++ b/c64/basic/cmd_load.s @@ -98,7 +98,7 @@ got_secondaryaddress: got_loadaddress: lda #$00 ; LOAD not verify - jsr JLOAD + jsr via_ILOAD bcc + ;; A = KERNAL error code, which also almost match diff --git a/c64/basic/via_vector.s b/c64/basic/via_vector.s new file mode 100644 index 00000000..d17e36a5 --- /dev/null +++ b/c64/basic/via_vector.s @@ -0,0 +1,40 @@ + +;; +;; Helper routines for jumping via vectors, to be used with JSR +;; + +via_IOPEN: + jmp (IOPEN) + +via_ICLOSE: + jmp (ICLOSE) + +via_ICHKIN: + jmp (ICHKIN) + +via_ICKOUT: + jmp (ICKOUT) + +via_ICLRCH: + jmp (ICLRCH) + +via_IBASIN: + jmp (IBASIN) + +via_IBASOUT: + jmp (IBASOUT) + +via_ISTOP: + jmp (ISTOP) + +via_IGETIN: + jmp (IGETIN) + +via_ICLALL: + jmp (ICLALL) + +via_ILOAD: + jmp (ILOAD) + +via_ISAVE: + jmp (ISAVE) diff --git a/c64/basic/wedge_dos.s b/c64/basic/wedge_dos.s index da0d3788..1c7726ec 100644 --- a/c64/basic/wedge_dos.s +++ b/c64/basic/wedge_dos.s @@ -4,7 +4,7 @@ wedge_dos: ;; Close all the channels, so that wedge has full control - jsr wedge_dos_CLALL + jsr via_ICLALL ;; Set file parameters, channel 15 is a typical one for commands jsr select_device ; sets X register @@ -39,12 +39,31 @@ wedge_dos: ;; XXX consider SYNTAX ERROR if anything besides spaces is there jmp - -wedge_dos_command: ; default +wedge_dos_command: - ;; XXX - implement this - jsr printf - .byte "DBG: CMD", 0 - jmp do_NOT_IMPLEMENTED_error + ;; Set remaining file parameters, open the channel + lda #$00 ; empty file name + jsr JSETNAM + jsr via_IOPEN + bcc + + jmp do_DEVICE_NOT_PRESENT_error +* + ;; Set channel for output + ldx #$0F + jsr via_ICKOUT +* + jsr JREADST ; retrieve errors + ;; XXX error in case of status != 0 +* + jsr basic_fetch_and_consume_character + beq + + jsr JCHROUT + ;; XXX check errors here + jmp - +* + ;; XXX check status - print it if not OK + ;; Clean-up and exit + jmp wedge_dos_clean_exit wedge_dos_change_drive: @@ -71,15 +90,16 @@ wedge_dos_status: ;; Set remaining file parameters, open the channel lda #$00 ; empty file name jsr JSETNAM - jsr wedge_dos_OPEN + jsr via_IOPEN bcc + jmp do_DEVICE_NOT_PRESENT_error * ;; Set channel for input ldx #$0F - jsr wedge_dos_CHKIN + jsr via_ICHKIN * - jsr $FFB7 ; READST - to retrieve errors + jsr JREADST ; retrieve errors + ;; XXX error in case of status != 0 * ;; Print out everything retrieved from the drive bne + @@ -97,21 +117,9 @@ wedge_dos_directory: .byte "DBG: DIR", 0 jmp do_NOT_IMPLEMENTED_error -wedge_dos_CLALL: - jmp (ICLALL) - -wedge_dos_CHKIN: - jmp (ICHKIN) - -wedge_dos_CLRCHR: - jmp (ICLRCH) - -wedge_dos_OPEN: - jmp (IOPEN) - wedge_dos_clean_exit: - jsr wedge_dos_CLALL - jsr wedge_dos_CLRCHR + jsr via_ICLALL + jsr via_ICLRCH jmp basic_end_of_line ;; END wedge support diff --git a/c64/kernal/cint.s b/c64/kernal/cint.s index 7dd92f46..973def0d 100644 --- a/c64/kernal/cint.s +++ b/c64/kernal/cint.s @@ -43,6 +43,9 @@ cint: ;; Put non-zero value in enable_case_switch stx enable_case_switch + ;; Set default I/O devices (see SCINIT description at http://sta.c64.org/cbm64krnfunc.html) + jsr clrchn_reset + ;; Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215) jmp clear_screen diff --git a/c64/kernal/clrchn.s b/c64/kernal/clrchn.s index ce1452d0..d0cd0243 100644 --- a/c64/kernal/clrchn.s +++ b/c64/kernal/clrchn.s @@ -10,24 +10,24 @@ clrchn: - ;; Restore input device to default + ;; Handle IEC input device lda DFLTN jsr iec_devnum_check bcs + ;; Previous device was IEC one - send UNTALK first jsr untlk * - ;; Set input device number to keyboard - lda #$00 - sta DFLTN - ;; Restore output device to default lda DFLTO jsr iec_devnum_check bcs + - ;; Previous device was IEC one - send UNLISTEN first + ;; Handle IEC output device jsr unlsn * +clrchn_reset: + ;; Set input device number to keyboard + lda #$00 + sta DFLTN ;; Set output device number to screen lda #$03 sta DFLTO