Files
open-roms/c64/kernal/ciout.s
T

40 lines
687 B
ArmAsm

;;
;; Official Kernal routine, described in:
;;
;; - [RG64] C64 Programmer's Reference Guide - page 279/280
;; - [CM64] Compute's Mapping the Commodore 64 - page 224
;;
;; CPU registers that has to be preserved (see [RG64]): .X, .Y
;;
;; XXX currently does not preserve registers, to be fixed!
ciout:
pha
lda C3PO
bne ciout_send_byte
;; Nothing to send - set buffer as valid, store byte there
inc C3PO
;; Clear carry flag to indicate success
clc
ciout_store_in_buffer:
;; Store in the buffer data to be sent next, return
pla
sta BSOUR
rts
ciout_send_byte:
;; Send previous data
lda BSOUR
clc ; don't send with EOI
jsr iec_tx_byte
jmp ciout_store_in_buffer