From 7898133f92aebd3d44e3982931e69d90976d0b3c Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 19 Feb 2016 16:52:10 -0500 Subject: use a clrtoeol() wrapper instead of conio clrscr(), now 6035 bytes free --- console.s | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'console.s') diff --git a/console.s b/console.s index 04524ab..b02403d 100644 --- a/console.s +++ b/console.s @@ -1,7 +1,7 @@ .include "atari.inc" - .export _clrtobot, _clrtoeol, _clrtoline, _cspaces, _cblank, _backspace + .export _clrtobot, _clrtoeol, _clr_screen, _clrtoline, _cspaces, _cblank, _backspace .export _rvs_on, _rvs_off .import mul40 ; from cc65's runtime @@ -18,6 +18,7 @@ .endif +; void clr_screen(void); ; void clrtobot(void); ; void clrtoeol(void); ; void clrtoline(unsigned char line); @@ -26,11 +27,14 @@ ; current cursor position. It's *way* faster than writing them in ; C in terms of cclear() (which uses one cputc() call per blank). +_clr_screen: ; same as gotoxy(0,0); clrtobot(); + lda #0 + sta ROWCRS + sta COLCRS + _clrtobot: ; same as clrtoline(24); lda #24 - ;bne _clrtoline - .byte $2c ; BIT absolute opcode - ; fall through to _clrtoeol + bne _clrtoline _clrtoeol: lda ROWCRS @@ -38,15 +42,17 @@ _clrtoeol: _clrtoline: sta tmp3 ; stash our arg - lda #0 - sta OLDCHR ; stop conio from redrawing stuff after we clear it + + ;lda #0 + ;sta OLDCHR ; stop conio from redrawing stuff after we clear it, + ; no longer needed with our custom conio. ; setup destptr to start of current line, NOT ; current cursor position. lda ROWCRS jsr mul40 ; AX = A*40 (addr of start-of-row) clc - adc SAVMSC ; add to screen pointer + adc SAVMSC ; add AX to screen pointer sta destptr txa adc SAVMSC+1 -- cgit v1.2.3