begin implementing chrout

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-19 20:55:36 +09:30
1 parent 6bd5778db2
commit 85d6c10832
1 file changed
+37 -1
+37 -1
View File
@@ -1,4 +1,40 @@
; Function defined on pp272-273 of C64 Programmers Reference Guide
chrout:
inc $d020
;; Crude implementation of character output
sta $0400
inc $0401
jmp chrout
;; Write character on the screen
ldy current_screen_x
sta (current_screen_line_ptr),y
;; Advance the column, and scroll screen down if we need
;; to insert a 2nd line in this logical line.
;; (eg Compute's Mapping the 64 p41)
ldx current_screen_y
iny current_screen_x
sty current_screen_x
cpy #40
beq screen_grow_logical_line
cpy #79
bcs screen_advance_to_next_line
rts
screen_grow_logical_line:
;; XXX - Scroll screen down to make space
rts
screen_advance_to_next_line:
;; Go to start of line
lda #0
sta current_screen_x
;; Advance line number
inc current_screen_y
;; Work out if we have gone off the bottom of the screen?
;; XXX -- implement this check and scrolling of the screen
;; and updating the screen line links.
rts