From 85d6c10832d5fecbfd4d03755f5d33b6d25d8309 Mon Sep 17 00:00:00 2001 From: Paul Gardner-Stephen Date: Fri, 19 Apr 2019 20:55:36 +0930 Subject: [PATCH] begin implementing chrout --- c64/kernal/chrout.s | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/c64/kernal/chrout.s b/c64/kernal/chrout.s index ab222291..371cc232 100644 --- a/c64/kernal/chrout.s +++ b/c64/kernal/chrout.s @@ -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