Files
open-roms/src/kernal/iostack/f1ca.chrout.s
T
chris f809b9b7ea feat(arnitech): the Terminal Card is a Blade's screen and keyboard
With ARNITECH_BLADE the screen editor, the keyboard matrix scan, and the VIC-II
set-up are left out, and devices 3 and 0 are the Terminal Card the Arnitech
controller finds by its type, $04. CHROUT writes each byte to its Output, or
to its Literal while quote or insert mode is on, keeping QTSW and INSRT as the
screen editor does. CHRIN marks where input starts, echoes the keys typed, and
on RETURN has the Card take the logical line under the cursor and reads it
back. SCNKEY moves the Card's keys into the keyboard buffer up to XMAX, UDTIM
sets STKEY from its RUN/STOP, SCREEN answers 80x25, PLOT moves and reads its
cursor, and CINT resets it and puts the native-mode vectors in place. With no
Terminal Card, bytes printed go nowhere and no key comes.
2026-10-18 08:57:01 +02:00

85 lines
1.3 KiB
ArmAsm

;; #LAYOUT# STD * #TAKE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
;
; Official Kernal routine, described in:
;
; - [RG64] C64 Programmers Reference Guide - page 278/279
; - [CM64] Computes Mapping the Commodore 64 - page 228
;
; CPU registers that has to be preserved (see [RG64]): .Y
; Additionally we have to preserve .X for out CHRIN and implementation
;
CHROUT:
sta SCHAR
; Save X and Y values
; (Confirmed by writing a test program that X and Y
; do not get modified, in agreement with C64 PRG
; description of CHROUT)
+phx_trash_a
+phy_trash_a
php
; Determine the device number
lda DFLTO
cmp #$03 ; screen
!ifndef CONFIG_ARNITECH_BLADE {
+beq chrout_screen
} else {
+beq chrout_terminal
}
!ifdef HAS_RS232 {
cmp #$02
+beq chrout_rs232
}
!ifdef CONFIG_IEC {
jsr iec_check_devnum_oc
+bcc chrout_iec
}
; FALLTROUGH
chrout_done_fail:
plp
; Restore X and Y
+ply_trash_a
+plx_trash_a
sec ; indicate failure
rts
chrout_done_unknown_device:
plp
; Restore X and Y
+ply_trash_a
+plx_trash_a
; End wioth error
jmp lvs_device_not_found_error
chrout_done_success:
plp
cli ; needed for screen (checked calling the routine on original ROMs), XXX what about other devices?
; Restore X and Y
+ply_trash_a
+plx_trash_a
lda SCHAR
clc ; indicate success
rts