aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--console.s27
-rw-r--r--taipan.c21
2 files changed, 19 insertions, 29 deletions
diff --git a/console.s b/console.s
index 875dcf3..3cee1b5 100644
--- a/console.s
+++ b/console.s
@@ -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:
diff --git a/taipan.c b/taipan.c
index 174ca39..28628be 100644
--- a/taipan.c
+++ b/taipan.c
@@ -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();