From f898176dd3871dcb15ecfbb3eca46f539d284b8b Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 23 Feb 2016 17:22:47 -0500 Subject: modify conio so it no longer needs carriage returns, now 7454 bytes free --- conio/README | 13 ++++++++++++- conio/cputc.s | 36 +++++++++++++++++++++++------------- 2 files changed, 35 insertions(+), 14 deletions(-) (limited to 'conio') diff --git a/conio/README b/conio/README index bfe8187..d63ed27 100644 --- a/conio/README +++ b/conio/README @@ -4,12 +4,23 @@ More particularly, the standard cc65 conio always draws a cursor, whether the cursor is enabled or not. When it's disabled, the cursor is drawn as a space character. +Also, the cputc() here no longer requires \r\n to move the cursor +to the start of the next line. \n alone does it, and \r isn't +treated specially (it's just a ctrl-R, prints a graphics character). + +The cputcxy() routine has been deleted, since taipan doesn't use it. + Benefits of doing this: - Faster and smoother screen updates -- Slightly smaller code (20-30 bytes) +- Slightly smaller code (100-odd bytes) - No more "cursor ghosts" at timed prompts - No need for a hide_cursor() function +- print_msg() from textdecomp.s is simplified, it no longer has + to print a carriage return every time it sees a newline in a + compressed message. +- In taipan.c, cputs("foo\r\n") no longer requires the \r, saves + one byte per string. Disadvantage: Have to draw the cursor myself when needed. It turns out that only agetc() needs to do this, so not a big deal. Also had to diff --git a/conio/cputc.s b/conio/cputc.s index 5955b42..fb60ffc 100644 --- a/conio/cputc.s +++ b/conio/cputc.s @@ -1,3 +1,10 @@ +; this file modified for use with taipan: +; - \n treated like \r\n used to: moves cursor to +; start of next line. +; - \r no longer special (prints a graphics character) +; - $0a no longer treated as as \n (prints graphics char) +; - _cputcxy removed as taipan never uses it + ; ; Mark Keates, Christian Groessler ; @@ -5,7 +12,8 @@ ; void cputc (char c); ; - .export _cputcxy, _cputc + ;.export _cputcxy, _cputc + .export _cputc .export plot, cputdirect, putchar .import popa, _gotoxy, mul40 .importzp tmp4,ptr4 @@ -13,21 +21,21 @@ .include "atari.inc" -_cputcxy: - pha ; Save C - jsr popa ; Get Y - jsr _gotoxy ; Set cursor, drop x - pla ; Restore C +;_cputcxy: + ;pha ; Save C + ;jsr popa ; Get Y + ;jsr _gotoxy ; Set cursor, drop x + ;pla ; Restore C _cputc: - cmp #$0D ; CR - bne L4 - lda #0 - sta COLCRS - beq plot ; return +; cmp #$0D ; CR +; bne L4 +; lda #0 +; sta COLCRS +; beq plot ; return -L4: cmp #$0A ; LF - beq newline +L4: ;cmp #$0A ; LF + ;beq newline cmp #ATEOL ; Atari-EOL? beq newline @@ -55,6 +63,8 @@ cputdirect: ; accepts screen code .export newline newline: + lda #0 + sta COLCRS inc ROWCRS lda ROWCRS cmp #24 -- cgit v1.2.3