improved initialization and Kernal vector handling

This commit is contained in:
FeralChild64 committed 2019-07-22 19:16:41 +02:00
1 parent 273eb3ee6a
commit 4a12719986
5 files changed
+81 -30

No files matched your search

+1 -1
View File
@@ -98,7 +98,7 @@ got_secondaryaddress:
got_loadaddress: got_loadaddress:
lda #$00 ; LOAD not verify lda #$00 ; LOAD not verify
jsr JLOAD jsr via_ILOAD
bcc + bcc +
;; A = KERNAL error code, which also almost match ;; A = KERNAL error code, which also almost match
+40
View File
@@ -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)
+31 -23
View File
@@ -4,7 +4,7 @@
wedge_dos: wedge_dos:
;; Close all the channels, so that wedge has full control ;; 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 ;; Set file parameters, channel 15 is a typical one for commands
jsr select_device ; sets X register jsr select_device ; sets X register
@@ -39,12 +39,31 @@ wedge_dos:
;; XXX consider SYNTAX ERROR if anything besides spaces is there ;; XXX consider SYNTAX ERROR if anything besides spaces is there
jmp - jmp -
wedge_dos_command: ; default wedge_dos_command:
;; XXX - implement this ;; Set remaining file parameters, open the channel
jsr printf lda #$00 ; empty file name
.byte "DBG: CMD", 0 jsr JSETNAM
jmp do_NOT_IMPLEMENTED_error 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: wedge_dos_change_drive:
@@ -71,15 +90,16 @@ wedge_dos_status:
;; Set remaining file parameters, open the channel ;; Set remaining file parameters, open the channel
lda #$00 ; empty file name lda #$00 ; empty file name
jsr JSETNAM jsr JSETNAM
jsr wedge_dos_OPEN jsr via_IOPEN
bcc + bcc +
jmp do_DEVICE_NOT_PRESENT_error jmp do_DEVICE_NOT_PRESENT_error
* *
;; Set channel for input ;; Set channel for input
ldx #$0F 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 ;; Print out everything retrieved from the drive
bne + bne +
@@ -97,21 +117,9 @@ wedge_dos_directory:
.byte "DBG: DIR", 0 .byte "DBG: DIR", 0
jmp do_NOT_IMPLEMENTED_error 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: wedge_dos_clean_exit:
jsr wedge_dos_CLALL jsr via_ICLALL
jsr wedge_dos_CLRCHR jsr via_ICLRCH
jmp basic_end_of_line jmp basic_end_of_line
;; END wedge support ;; END wedge support
+3
View File
@@ -43,6 +43,9 @@ cint:
;; Put non-zero value in enable_case_switch ;; Put non-zero value in enable_case_switch
stx 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) ;; Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215)
jmp clear_screen jmp clear_screen
+6 -6
View File
@@ -10,24 +10,24 @@
clrchn: clrchn:
;; Restore input device to default ;; Handle IEC input device
lda DFLTN lda DFLTN
jsr iec_devnum_check jsr iec_devnum_check
bcs + bcs +
;; Previous device was IEC one - send UNTALK first ;; Previous device was IEC one - send UNTALK first
jsr untlk jsr untlk
* *
;; Set input device number to keyboard
lda #$00
sta DFLTN
;; Restore output device to default ;; Restore output device to default
lda DFLTO lda DFLTO
jsr iec_devnum_check jsr iec_devnum_check
bcs + bcs +
;; Previous device was IEC one - send UNLISTEN first ;; Handle IEC output device
jsr unlsn jsr unlsn
* *
clrchn_reset:
;; Set input device number to keyboard
lda #$00
sta DFLTN
;; Set output device number to screen ;; Set output device number to screen
lda #$03 lda #$03
sta DFLTO sta DFLTO