diff options
author | B. Watson <yalhcru@gmail.com> | 2021-04-15 13:02:39 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2021-04-15 13:02:39 -0400 |
commit | ca3c75a316e152dca0dcbac1f0adbd7789d09489 (patch) | |
tree | 1ea0c872d3f153c3496e2b3475405456f685eccc | |
parent | c94725152b4bb2e46f94a32d0dbee68f47de343b (diff) | |
download | taipan-ca3c75a316e152dca0dcbac1f0adbd7789d09489.tar.gz |
Save 20 bytes
-rw-r--r-- | console.s | 27 | ||||
-rw-r--r-- | taipan.c | 21 |
2 files changed, 19 insertions, 29 deletions
@@ -2,7 +2,7 @@ .include "atari.inc" .include "conio/mul40.s" - .export _clrtobot, _clrtoeol, _clr_screen, _clrtoline, _cspaces, _cblank, _cblankto, _backspace, _cprint_pipe, _cprint_bang, _cspace, _cputc_s, _comma_space, _cprint_colon_space, _cprint_question_space, _cprint_period, _cprint_taipan_prompt, _plus_or_space, _gotox0y22, _gotox0y3, _gotox0y, _gotox0y3_clrtoeol,_cputc0, _set_orders + .export _clrtobot, _clrtoeol, _clr_screen, _clrtoline, _cspaces, _cblank, _cblankto, _backspace, _cprint_pipe, _cprint_bang, _cspace, _cputc_s, _comma_space, _cprint_colon_space, _cprint_question_space, _cprint_period, _cprint_taipan_prompt, _plus_or_space, _gotox0y22, _gotox0y3, _gotox0y, _gotox0y3_clrtoeol,_cputc0, _set_orders, _pluralize .export _rvs_on, _rvs_off .importzp tmp3 ; ditto @@ -254,24 +254,13 @@ _gotox0y3_clrtoeol: jsr _gotox0y3 jmp _clrtoeol -; extern void set_orders(void); -;_set_orders: -; jsr _timed_getch -; ldx _orders -; cmp #'f' -; bne @notf -; ldx #1 -;@notf: -; cmp #'r' -; bne @notr -; ldx #2 -;@notr: -; cmp #'t' -; bne @nott -; ldx #3 -;@nott: -; stx _orders -; rts +; extern void __fastcall__ pluralize(int num); +_pluralize: + cmp #1 + bne _cputc_s + txa + bne _cputc_s + rts ; extern void set_orders(void); _set_orders: @@ -209,6 +209,9 @@ unsigned char one_chance_in(unsigned char odds) { return ( (randi() % odds) == 0); } +/* print 's' if num==1, otherwise do nothing. */ +extern void __fastcall__ pluralize(int num); + /* print 1 space */ /* void cspace(void) { @@ -972,7 +975,8 @@ void fight_stats(int ships, int orders) { justify_int(ships); // cputs(" ship"); print_msg(M_space_ship); - if(ships != 1) cputc_s(); + // if(ships != 1) cputc_s(); + pluralize(ships); // cputs(" attacking"); print_msg(M_space_attacking); cprint_taipan_bang(); @@ -1984,19 +1988,15 @@ void final_stats(void) cprintuint(years); // cputs(" year"); print_msg(M_spc_year); - if (years != 1) - { - cputc_s(); - } + pluralize(years); + // if (years != 1) cputc_s(); // cputs(" and "); print_msg(M_spc_and_spc); cprintuchar(month); // cputs(" month"); print_msg(M_spc_month); - if (month > 1) - { - cputc_s(); - } + pluralize(month); + // if (month > 1) cputc_s(); crlf(); crlf(); rvs_on(); @@ -2339,7 +2339,8 @@ void quit(void) { cprintuint(num_ships); // cputs(" hostile ship"); print_msg(M_hostile_ship); - if(num_ships != 1) cputc_s(); + pluralize(num_ships); + // if(num_ships != 1) cputc_s(); // cputs(" approaching"); print_msg(M_approaching); cprint_taipan_bang(); |