diff options
author | B. Watson <yalhcru@gmail.com> | 2021-04-13 16:18:36 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2021-04-14 00:31:13 -0400 |
commit | 65e6bb6bae08be492d76b00b661108afc4ad93be (patch) | |
tree | 9d3fdc4c26856967dc35bbb5e0ae28e84439027a | |
parent | 044dbba1f59389d0ff73ab77d546cfbb53fdebd2 (diff) | |
download | taipan-65e6bb6bae08be492d76b00b661108afc4ad93be.tar.gz |
Save 43 bytes (8326 free)
-rw-r--r-- | console.s | 13 | ||||
-rw-r--r-- | taipan.c | 53 |
2 files changed, 40 insertions, 26 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, _gotox0y, _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, _cputc0, _set_orders .export _rvs_on, _rvs_off .importzp tmp3 ; ditto @@ -233,8 +233,17 @@ _plus_or_space: stx ROWCRS jmp _cputc +; extern void gotox0y22(void); +_gotox0y22: + lda #22 + .byte $2c + +; extern void gotox0y3(void); +_gotox0y3: + lda #3 + ; extern void gotox0y(char y); - _gotox0y: +_gotox0y: sta ROWCRS lda #0 sta COLCRS @@ -134,6 +134,11 @@ extern void __fastcall__ cspaces(unsigned char count); this saves 208 bytes! */ extern void __fastcall__ gotox0y(char y); +/* replacing all gotox0y(3) and gotox0y(22) calls with these + save us 43 bytes. */ +extern void __fastcall__ gotox0y3(void); /* same as gotoxy(0,3) */ +extern void __fastcall__ gotox0y22(void); /* same as gotoxy(0,22) */ + /* each prints one specific character */ extern void crlf(void); extern void cspace(void); @@ -1120,7 +1125,7 @@ char sea_battle(char id, int num_ships) { set_orders(); if(!orders) { turbo = 0; - gotox0y(3); + gotox0y3(); clrtoeol(); cprint_taipan_comma(); // cputs("what shall we do??\n(Fight, Run, Throw cargo)"); @@ -1129,7 +1134,7 @@ char sea_battle(char id, int num_ships) { while(!orders) set_orders(); - gotox0y(3); + gotox0y3(); clrtoeol(); gotox0y(4); clrtoeol(); @@ -1143,14 +1148,14 @@ char sea_battle(char id, int num_ships) { ok = 3; ik = 1; - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("Aye, we'll fight 'em"); print_msg(M_aye_fight); cprint_taipan_period(); set_orders(); - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("We're firing on 'em"); print_msg(M_were_firing); @@ -1215,7 +1220,7 @@ char sea_battle(char id, int num_ships) { tjsleep(10); } } - gotox0y(3); + gotox0y3(); clrtoeol(); if(sk > 0) { // cputs("Sunk "); @@ -1240,7 +1245,7 @@ char sea_battle(char id, int num_ships) { num_ships -= ran; fight_stats(num_ships, orders); - gotox0y(3); + gotox0y3(); clrtoeol(); cprintuint(ran); // cputs(" ran away"); @@ -1268,7 +1273,7 @@ char sea_battle(char id, int num_ships) { set_orders(); } } else if ((orders == 1) && (guns == 0)) { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("We have no guns"); print_msg(M_we_have_no_guns); @@ -1281,7 +1286,7 @@ char sea_battle(char id, int num_ships) { total = 0; turbo = 0; - gotox0y(3); + gotox0y3(); // cputs("You have the following on board"); print_msg(M_you_have_on_board); cprint_colon_space(); @@ -1345,7 +1350,7 @@ char sea_battle(char id, int num_ships) { clrtoeol(); if(total > 0) { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("Let's hope we lose 'em"); print_msg(M_hope_we_lose_em); @@ -1366,7 +1371,7 @@ char sea_battle(char id, int num_ships) { set_orders(); } else { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("There's nothing there"); print_msg(M_nothing_there); @@ -1379,7 +1384,7 @@ char sea_battle(char id, int num_ships) { if((orders == 2) || (orders == 3)) { if(orders == 2) { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("Aye, we'll run"); print_msg(M_aye_run); @@ -1389,7 +1394,7 @@ char sea_battle(char id, int num_ships) { ok += ik++; if(randi()%ok > randi()%num_ships) { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("We got away from 'em"); print_msg(M_we_got_away); @@ -1401,7 +1406,7 @@ char sea_battle(char id, int num_ships) { timed_getch(); num_ships = 0; } else { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("Couldn't lose 'em."); print_msg(M_couldnt_lose_em); @@ -1413,7 +1418,7 @@ char sea_battle(char id, int num_ships) { num_ships -= lost; fight_stats(num_ships, orders); - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("But we escaped from "); print_msg(M_but_we_escaped); @@ -1442,7 +1447,7 @@ char sea_battle(char id, int num_ships) { } if(num_ships > 0) { - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("They're firing on us"); print_msg(M_theyre_firing); @@ -1454,7 +1459,7 @@ char sea_battle(char id, int num_ships) { fight_stats(num_ships, orders); plus_or_space(num_ships > num_on_screen); - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("We've been hit"); print_msg(M_weve_been_hit); @@ -1476,7 +1481,7 @@ char sea_battle(char id, int num_ships) { guns--; hold += 10; fight_stats(num_ships, orders); - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("The buggers hit a gun"); print_msg(M_buggers_hit_gun); @@ -1541,7 +1546,7 @@ char sea_battle(char id, int num_ships) { if(orders == 1) { fight_stats(num_ships, orders); - gotox0y(3); + gotox0y3(); clrtoeol(); // cputs("We got 'em all"); print_msg(M_we_got_em_all); @@ -2102,7 +2107,7 @@ void final_stats(void) chline(31); cputc(3); // lower right corner - gotox0y(22); + gotox0y22(); // cputs("Play again? "); print_msg(M_play_again); choice = yngetc(0); @@ -2185,7 +2190,7 @@ void transfer(void) { unsigned long amount = 0; if(have_no_cargo()) { - gotox0y(22); + gotox0y22(); clrtobot(); // cputs("You have no cargo"); print_msg(M_you_have_no_cargo); @@ -2925,7 +2930,7 @@ int port_choices(void) { cprintulong(price[3]); */ - gotox0y(22); + gotox0y22(); clrtobot(); #ifdef BIGNUM @@ -3094,7 +3099,7 @@ void name_firm(void) { # pragma code-name (push, "HIGHCODE") #endif char what_do_you_wish_me_to(char buy_or_sell) { - gotox0y(22); + gotox0y22(); clrtobot(); // cputs("What "); print_msg(M_what); @@ -3124,7 +3129,7 @@ void buy(void) { // cputs(" You can "); print_msg(M_spc_you_can_spc); rvs_off(); - gotox0y(22); + gotox0y22(); how_much(); // cputs(item[choice]); print_msg(item[choice]); @@ -3175,7 +3180,7 @@ void sell(void) { choice = what_do_you_wish_me_to(0); for (;;) { - gotox0y(22); + gotox0y22(); clrtobot(); how_much(); |