fixes to Kernal character handling routines
This commit is contained in:
1 parent
bfda74a9bc
commit
a80d490590
5 files changed
+46
-24
No files matched your search
@@ -103,6 +103,7 @@ wedge_dos_status:
|
||||
;; Print out everything retrieved from the drive
|
||||
bne +
|
||||
jsr via_IBASIN
|
||||
bcs wedge_dos_basic_error
|
||||
jsr via_IBSOUT
|
||||
jmp -
|
||||
*
|
||||
|
||||
@@ -44,13 +44,13 @@ chkin:
|
||||
lda FAT,Y
|
||||
jsr iec_check_devnum
|
||||
bcs chkin_set_device
|
||||
|
||||
|
||||
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
|
||||
jsr tksa
|
||||
bcs chkinout_end
|
||||
bcs chkinout_device_not_present
|
||||
|
||||
chkin_set_device:
|
||||
lda FAT,Y
|
||||
@@ -126,16 +126,16 @@ ckout:
|
||||
;; For IEC devices, send LISTEN + SECOND first
|
||||
lda FAT,Y
|
||||
jsr iec_check_devnum
|
||||
bcs chkin_set_device
|
||||
bcs chkout_set_device
|
||||
|
||||
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
|
||||
jsr second
|
||||
bcs chkinout_end
|
||||
bcs chkinout_device_not_present
|
||||
|
||||
hkout_set_device:
|
||||
chkout_set_device:
|
||||
lda FAT,Y
|
||||
sta DFLTO
|
||||
clc ; for success
|
||||
|
||||
+4
-2
@@ -15,14 +15,16 @@
|
||||
;; Repeated calls after that read out the successive bytes of the line of input.
|
||||
|
||||
chrin:
|
||||
;; First determine the device number
|
||||
|
||||
;; Determine the device number
|
||||
lda DFLTN
|
||||
|
||||
beq chrin_keyboard ; #$00 - keyboard
|
||||
;; XXX add screen support
|
||||
|
||||
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:
|
||||
|
||||
|
||||
+29
-14
@@ -11,40 +11,41 @@
|
||||
|
||||
chrout:
|
||||
|
||||
sta last_printed_character_ascii
|
||||
|
||||
;; Save X and Y values
|
||||
;; (Confirmed by writing a test program that X and Y
|
||||
;; don't get modified, in agreement with C64 PRG's
|
||||
;; description of CHROUT)
|
||||
sta last_printed_character_ascii
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
php
|
||||
|
||||
;; First determine the device number
|
||||
;; Determine the device number
|
||||
lda DFLTO
|
||||
|
||||
cmp #$03 ; screen
|
||||
beq chrout_screen
|
||||
|
||||
jsr iec_check_devnum
|
||||
bcs chrout_done_fail ; not a supported device
|
||||
bcs chrout_done_unknown_device ; not a supported device
|
||||
|
||||
chrout_iec:
|
||||
|
||||
lda last_printed_character_ascii
|
||||
jsr JCIOUT
|
||||
bcc chrout_done
|
||||
|
||||
|
||||
;; FALLTROUGH
|
||||
|
||||
chrout_done_fail:
|
||||
jsr show_cursor_if_enabled
|
||||
|
||||
|
||||
plp
|
||||
|
||||
;; Restore X and Y, set carry to mark success on exit
|
||||
|
||||
;; Restore X and Y
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
@@ -52,12 +53,26 @@ chrout_done_fail:
|
||||
sec ; indicate failure
|
||||
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:
|
||||
jsr show_cursor_if_enabled
|
||||
|
||||
|
||||
plp
|
||||
|
||||
;; Restore X and Y, set carry to mark success on exit
|
||||
|
||||
;; Restore X and Y
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
@@ -70,12 +85,12 @@ chrout_screen:
|
||||
|
||||
;; Crude implementation of character output
|
||||
sei ;; XXX why do we need to disable interrupts?
|
||||
|
||||
|
||||
jsr hide_cursor_if_visible
|
||||
|
||||
|
||||
lda last_printed_character_ascii
|
||||
tax
|
||||
|
||||
|
||||
;; Check for special characters
|
||||
|
||||
cmp #$00
|
||||
@@ -89,7 +104,7 @@ not_00:
|
||||
bne not_0a
|
||||
jmp chrout_done
|
||||
not_0a:
|
||||
|
||||
|
||||
;; Carriage return
|
||||
cmp #$0d
|
||||
bne not_0d
|
||||
|
||||
+5
-1
@@ -31,4 +31,8 @@ clall:
|
||||
tay
|
||||
|
||||
;; '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
|
||||
|
||||
Reference in new issue
Block a user