From 076849d61bba0ad62ac899271700e66f9bf5eea2 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 19 Apr 2021 15:56:04 -0400 Subject: Save 92 bytes --- console.s | 10 +++++++++- taipan.c | 22 ++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/console.s b/console.s index d080fe8..2bb9902 100644 --- a/console.s +++ b/console.s @@ -11,7 +11,7 @@ .export _gotox0y22, _gotox0y3, _gotox0y, _gotox0y3_clrtoeol .export _cputc0, _set_orders, _pluralize, _print_combat_msg .export _rvs_on, _rvs_off - .export _prepare_report, _clear_msg_window + .export _prepare_report, _clear_msg_window, _print_item .importzp tmp3 ; ditto .import _revflag ; conio/revers.s @@ -21,6 +21,7 @@ .import _cprintulong, _cputc, _cprint_taipan, _timed_getch, _orders .import _turbo .import _print_msg, _cspaces + .import _item .ifdef CART_TARGET .segment "HIGHCODE" @@ -263,6 +264,13 @@ _print_combat_msg: jsr _print_msg jmp _clrtoeol +; extern void __fastcall__ print_item(char item) +_print_item: + asl + tay + lda _item,y + ldx _item+1,y + jmp _print_msg ; extern void clear_msg_window(void) ; extern void prepare_report(void) diff --git a/taipan.c b/taipan.c index 36993bc..ac76bc6 100644 --- a/taipan.c +++ b/taipan.c @@ -372,6 +372,8 @@ char *num_buf = (char *) 0x600; // char *item[] = { "Opium", "Silk", "Arms", "General Cargo" }; const char * const item[] = { M_opium, M_silk, M_arms, M_gen_cargo }; +extern void __fastcall__ print_item(char item); + /* const char *location[] = { "At sea", "Hong Kong", "Shanghai", "Nagasaki", "Saigon", "Manila", "Singapore", "Batavia" }; @@ -1287,13 +1289,13 @@ char sea_battle(char id, int num_ships) { cprint_colon_space(); gotoxy(4, 4); // cputs(item[0]); - print_msg(M_opium); + print_item(0); // cputs(": "); cprint_colon_space(); cprintulong(hold_[0]); gotoxy(24, 4); // cputs(item[1]); - print_msg(M_silk); + print_item(1); // cputs(": "); cprint_colon_space(); cprintulong(hold_[1]); @@ -1301,13 +1303,13 @@ char sea_battle(char id, int num_ships) { clrtoeol(); gotox(5); // cputs(item[2]); - print_msg(M_arms); + print_item(2); // cputs(": "); cprint_colon_space(); cprintulong(hold_[2]); gotoxy(21, 5); // cputs(item[3]); - print_msg(M_gen_cargo); + print_item(3); // cputs(": "); cprint_colon_space(); cprintulong(hold_[3]); @@ -2174,7 +2176,7 @@ void transfer(void) { compradores_report(); how_much(); // cputs(item[i]); - print_msg(item[i]); + print_item(i); // cputs(" shall I move\nto the warehouse"); print_msg(M_move_to_whouse); cprint_taipan_prompt(); @@ -2224,7 +2226,7 @@ void transfer(void) { compradores_report(); how_much(); // cputs(item[i]); - print_msg(item[i]); + print_item(i); // cputs(" shall I move\naboard ship"); print_msg(M_move_aboard); cprint_taipan_prompt(); @@ -2837,7 +2839,7 @@ void good_prices(void) { // cputs("!! The price of "); print_msg(M_the_price_of); // cputs(item[i]); - print_msg(item[i]); + print_item(i); // cputs("\n has "); print_msg(M_nl_has_spc); @@ -2880,7 +2882,7 @@ int port_choices(void) { print_msg(M_general_shortname); else // cputs(item[choice]); - print_msg(item[choice]); + print_item(choice); // cputc(':'); cprint_colon_space(); gotox(11 + ((choice & 1) * 18)); @@ -3106,7 +3108,7 @@ void buy(void) { gotox0y22(); how_much(); // cputs(item[choice]); - print_msg(item[choice]); + print_item(choice); // cputs(" shall"); print_msg(M_spc_shall); gotoxy(31, 22); @@ -3160,7 +3162,7 @@ void sell(void) { how_much(); // cputs(item[choice]); - print_msg(item[choice]); + print_item(choice); // cputs(" shall\nI sell, "); print_msg(M_shall_i_sell); cprint_taipan_colon(); -- cgit v1.2.3