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
|
;; 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 -
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ chkin:
|
|||||||
lda FAT,Y
|
lda FAT,Y
|
||||||
jsr iec_check_devnum
|
jsr iec_check_devnum
|
||||||
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
@@ -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:
|
||||||
|
|
||||||
|
|||||||
+29
-14
@@ -11,40 +11,41 @@
|
|||||||
|
|
||||||
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:
|
||||||
|
|
||||||
lda last_printed_character_ascii
|
lda last_printed_character_ascii
|
||||||
jsr JCIOUT
|
jsr JCIOUT
|
||||||
bcc chrout_done
|
bcc chrout_done
|
||||||
|
|
||||||
;; FALLTROUGH
|
;; FALLTROUGH
|
||||||
|
|
||||||
chrout_done_fail:
|
chrout_done_fail:
|
||||||
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
|
||||||
@@ -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
|
||||||
@@ -70,12 +85,12 @@ chrout_screen:
|
|||||||
|
|
||||||
;; Crude implementation of character output
|
;; Crude implementation of character output
|
||||||
sei ;; XXX why do we need to disable interrupts?
|
sei ;; XXX why do we need to disable interrupts?
|
||||||
|
|
||||||
jsr hide_cursor_if_visible
|
jsr hide_cursor_if_visible
|
||||||
|
|
||||||
lda last_printed_character_ascii
|
lda last_printed_character_ascii
|
||||||
tax
|
tax
|
||||||
|
|
||||||
;; Check for special characters
|
;; Check for special characters
|
||||||
|
|
||||||
cmp #$00
|
cmp #$00
|
||||||
@@ -89,7 +104,7 @@ not_00:
|
|||||||
bne not_0a
|
bne not_0a
|
||||||
jmp chrout_done
|
jmp chrout_done
|
||||||
not_0a:
|
not_0a:
|
||||||
|
|
||||||
;; Carriage return
|
;; Carriage return
|
||||||
cmp #$0d
|
cmp #$0d
|
||||||
bne not_0d
|
bne not_0d
|
||||||
|
|||||||
+5
-1
@@ -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
|
||||||
|
|
||||||
Reference in new issue
Block a user