fixes to Kernal character handling routines

This commit is contained in:
FeralChild64 committed 2019-07-26 18:30:07 +02:00
1 parent bfda74a9bc
commit a80d490590
5 files changed
+36 -14

No files matched your search

+1
View File
@@ -103,6 +103,7 @@ wedge_dos_status:
;; Print out everything retrieved from the drive ;; Print out everything retrieved from the drive
bne + bne +
jsr via_IBASIN jsr via_IBASIN
bcs wedge_dos_basic_error
jsr via_IBSOUT jsr via_IBSOUT
jmp - jmp -
* *
+6 -6
View File
@@ -46,11 +46,11 @@ chkin:
bcs chkin_set_device bcs chkin_set_device
jsr talk jsr talk
bcs chkinout_end ; don't set DFLTN in case of failure bcs chkinout_device_not_present ; don't set DFLTN in case of failure
lda LAT, Y lda LAT, Y
jsr tksa jsr tksa
bcs chkinout_end bcs chkinout_device_not_present
chkin_set_device: chkin_set_device:
lda FAT,Y lda FAT,Y
@@ -126,16 +126,16 @@ ckout:
;; For IEC devices, send LISTEN + SECOND first ;; For IEC devices, send LISTEN + SECOND first
lda FAT,Y lda FAT,Y
jsr iec_check_devnum jsr iec_check_devnum
bcs chkin_set_device bcs chkout_set_device
jsr listen jsr listen
bcs chkinout_end ; don't set DFLTO in case of failure bcs chkinout_device_not_present ; don't set DFLTO in case of failure
lda LAT, Y lda LAT, Y
jsr second jsr second
bcs chkinout_end bcs chkinout_device_not_present
hkout_set_device: chkout_set_device:
lda FAT,Y lda FAT,Y
sta DFLTO sta DFLTO
clc ; for success clc ; for success
+4 -2
View File
@@ -15,14 +15,16 @@
;; Repeated calls after that read out the successive bytes of the line of input. ;; Repeated calls after that read out the successive bytes of the line of input.
chrin: chrin:
;; First determine the device number
;; Determine the device number
lda DFLTN lda DFLTN
beq chrin_keyboard ; #$00 - keyboard beq chrin_keyboard ; #$00 - keyboard
;; XXX add screen support ;; XXX add screen support
jsr iec_check_devnum jsr iec_check_devnum
bcs chrin_done_fail ; not a supported device bcc chrin_iec
jmp lvs_device_not_found_error ; not a supported device
chrin_iec: chrin_iec:
+20 -5
View File
@@ -11,25 +11,26 @@
chrout: chrout:
sta last_printed_character_ascii
;; Save X and Y values ;; Save X and Y values
;; (Confirmed by writing a test program that X and Y ;; (Confirmed by writing a test program that X and Y
;; don't get modified, in agreement with C64 PRG's ;; don't get modified, in agreement with C64 PRG's
;; description of CHROUT) ;; description of CHROUT)
sta last_printed_character_ascii
txa txa
pha pha
tya tya
pha pha
php php
;; First determine the device number ;; Determine the device number
lda DFLTO lda DFLTO
cmp #$03 ; screen cmp #$03 ; screen
beq chrout_screen beq chrout_screen
jsr iec_check_devnum jsr iec_check_devnum
bcs chrout_done_fail ; not a supported device bcs chrout_done_unknown_device ; not a supported device
chrout_iec: chrout_iec:
@@ -44,7 +45,7 @@ chrout_done_fail:
plp plp
;; Restore X and Y, set carry to mark success on exit ;; Restore X and Y
pla pla
tay tay
pla pla
@@ -52,12 +53,26 @@ chrout_done_fail:
sec ; indicate failure sec ; indicate failure
rts rts
chrout_done_unknown_device:
jsr show_cursor_if_enabled
plp
;; Restore X and Y
pla
tay
pla
tax
;; End wioth error
jmp lvs_device_not_found_error
chrout_done: chrout_done:
jsr show_cursor_if_enabled jsr show_cursor_if_enabled
plp plp
;; Restore X and Y, set carry to mark success on exit ;; Restore X and Y
pla pla
tay tay
pla pla
+5 -1
View File
@@ -31,4 +31,8 @@ clall:
tay tay
;; 'C64 Programmers Reference Guide', page 281, claims it calls CLRCHN too ;; 'C64 Programmers Reference Guide', page 281, claims it calls CLRCHN too
jmp clrchn jsr clrchn
;; Not sure whether original Kernal does so, but it seems sane to also clear possible errors
jmp kernalstatus_reset