diff options
author | B. Watson <yalhcru@gmail.com> | 2016-02-04 17:33:17 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2016-02-04 17:33:17 -0500 |
commit | 3ccfe725cfd1672e04dcf5caa555ceaaf3f27159 (patch) | |
tree | bbe8c3e4651d0994f57d0cb48e30cfc196e0fc54 | |
parent | 00d78b9f401ec6f1ba0a1c900e382ec323058337 (diff) | |
download | taipan-3ccfe725cfd1672e04dcf5caa555ceaaf3f27159.tar.gz |
rewrite cspace() in asm, save a few more bytes
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | console.s (renamed from clrtobot.s) | 11 | ||||
-rw-r--r-- | taipan.c | 18 |
3 files changed, 22 insertions, 11 deletions
@@ -89,7 +89,7 @@ XEX=taipan.xex # All the C and asm sources for taimain.xex: TAIMAIN_HDRS=sounds.h TAIMAIN_C_SRC=taipan.c -TAIMAIN_ASM_SRC=rand.s draw_lorcha.s timed_getch.s portstat.s clrtobot.s ultostr.s soundasm.s explosion.s +TAIMAIN_ASM_SRC=rand.s draw_lorcha.s timed_getch.s portstat.s console.s ultostr.s soundasm.s explosion.s # Comment these lines out to build without big number support. # This will stop being possible at some point. @@ -179,7 +179,7 @@ help.dat: help.txt text2screen.pl taimain.xex: $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(TAIMAIN_HDRS) $(BIGNUM_SRC) $(BIGNUM_HDRS) cl65 -m taipan.map $(CFLAGS) $(BIGNUM_CFLAGS) -o taimain.xex $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(BIGNUM_SRC) -#cl65 --mapfile taipan.map $(CFLAGS) -o taimain.xex taipan.c sounds.c rand.s draw_lorcha.s timed_getch.s jsleep.s portstat.s clrtobot.s +#cl65 --mapfile taipan.map $(CFLAGS) -o taimain.xex taipan.c sounds.c rand.s draw_lorcha.s timed_getch.s jsleep.s portstat.s console.s # With newer cc65s, I have to do this to get an assembly listing of just # taipan.c. This rule not used as part of the main build, it's only for @@ -1,12 +1,13 @@ .include "atari.inc" - .export _clrtobot, _clrtoeol, _clrtoline + .export _clrtobot, _clrtoeol, _clrtoline, _cspaces .import mul40 ; from cc65's runtime .importzp tmp3 ; ditto .import bump_destptr ; these two are .importzp destptr ; from draw_lorcha.s + .import _cspace ; void clrtobot(void); ; void clrtoeol(void); @@ -64,3 +65,11 @@ clrloop: done: rts + +_cspaces: + sta tmp3 +@lp: + jsr _cspace + dec tmp3 + bne @lp + rts @@ -104,10 +104,12 @@ extern const char *port_stat_screen; port_stat_screen into screen RAM) */ char port_stat_dirty = 1; -/* asm curses/conio funcs from clrtobot.s. Old C versions moved to +/* asm curses/conio funcs from console.s. Old C versions moved to oldcurses.c for reference. */ extern void clrtobot(void); extern void clrtoeol(void); +/* print 'count' spaces: */ +extern void __fastcall__ cspaces(unsigned char count); /* asm funcs from draw_lorcha.s for drawing/animating enemy ships. used by sea_battle() */ @@ -155,9 +157,9 @@ void cspace(void) { cputc(' '); } -/* print 'count' spaces */ -void cspaces(unsigned char count) { - while(count--) cspace(); +/* print the letter s (for pluralization) */ +void cputc_s(void) { + cputc('s'); } /* print 'count' spaces, but leave the cursor where it was. @@ -699,7 +701,7 @@ void fight_stats(int ships, int orders) { justify_int(ships); cputs(" ship"); - if(ships != 1) cputc('s'); + if(ships != 1) cputc_s(); // cputs(" attacking, Taipan! \r\n"); cputs(" attacking"); cprint_taipan_bang(); @@ -1726,14 +1728,14 @@ void final_stats(void) cputs(" year"); if (years != 1) { - cputc('s'); + cputc_s(); } cputs(" and "); cprintulong(month); cputs(" month"); if (month > 1) { - cputc('s'); + cputc_s(); } cputs("\r\n\n"); revers(1); @@ -2054,7 +2056,7 @@ void quit(void) } cprintulong(num_ships); cputs(" hostile ship"); - if(num_ships != 1) cputc('s'); + if(num_ships != 1) cputc_s(); // cputs(" approaching, Taipan!\r\n"); cputs(" approaching"); cprint_taipan_bang(); |