aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bank3.s2
-rw-r--r--console.s20
-rw-r--r--taipan.c15
3 files changed, 23 insertions, 14 deletions
diff --git a/bank3.s b/bank3.s
index bf09408..f719409 100644
--- a/bank3.s
+++ b/bank3.s
@@ -8,7 +8,7 @@ font = $9c00
.incbin "rodata.8000"
.if * > font
- .fatal "bank7 code too large"
+ .fatal "bank3 code too large"
.else
.out .sprintf("=> %d bytes free in bank 3", font - *)
.endif
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
diff --git a/taipan.c b/taipan.c
index 31fcf3e..e28efd0 100644
--- a/taipan.c
+++ b/taipan.c
@@ -117,6 +117,9 @@ extern void clrtoeol(void);
/* print 'count' spaces: */
extern void __fastcall__ cspaces(unsigned char count);
+/* our own clr_screen(), don't use conio's clrscr() */
+extern void clr_screen(void);
+
/* avoid calling/linking conio's revers() function. This saves us
49 bytes (2 per call to revers(), plus these functions are smaller
than conio's revers() because they return void) */
@@ -885,7 +888,7 @@ int sea_battle(int id, int num_ships) {
ships_on_screen[i] = 0;
}
- clrscr();
+ clr_screen();
// cursor(0);
/* the static part of "we have N guns" display, gets printed
@@ -1354,7 +1357,7 @@ int sea_battle(int id, int num_ships) {
}
if(orders == 1) {
- // clrscr();
+ // clr_screen();
fight_stats(num_ships, orders);
gotoxy(0, 3);
clrtoeol();
@@ -1411,7 +1414,7 @@ unsigned long get_num(void) {
void cash_or_guns(void) {
char choice;
- clrscr();
+ clr_screen();
cprint_Do_you_want();
cputs("to start . . .\r\n\n");
cputs(" 1) With cash (and a debt)\r\n\n");
@@ -1820,7 +1823,7 @@ void final_stats(void)
port_stat_dirty = 1;
- clrscr();
+ clr_screen();
cputs("Your final status:\r\n\n"
"Net cash: ");
#ifdef BIGNUM
@@ -2812,7 +2815,7 @@ void name_firm(void) {
unsigned char input, firmlen = 0;
unsigned int randseed;
- clrscr();
+ clr_screen();
/* old version, readable, but compiles to 78 byte more
than the new version below.
@@ -3146,7 +3149,7 @@ int main(void) {
#ifdef MCHENRY_TEST
{
while(1) {
- clrscr();
+ clr_screen();
cputs("year? ");
year = get_num();
crlf();