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
+46 -24

No files matched your search

+29 -14
View File
@@ -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