diff options
Diffstat (limited to 'taipan.c')
-rw-r--r-- | taipan.c | 95 |
1 files changed, 84 insertions, 11 deletions
@@ -79,6 +79,7 @@ extern void __fastcall__ jsleep(unsigned int j); extern void explosion(void); extern void __fastcall__ cblank(unsigned char count); +extern void __fastcall__ backspace(void); /* Atari-specific random number functions from rand.s. Non-Atari platforms can probably just: @@ -128,6 +129,12 @@ extern void __fastcall__ clear_lorcha(int which); if nothing has set port_stat_dirty */ extern void redraw_port_stat(void); +/* this pragma places compiled C code in bank 3 of the cartridge, + so it doesn't need to be copied to RAM (speeds startup). */ +#ifdef CART_TARGET +# pragma code-name (push, "HIGHCODE") +#endif + /* used to set the background/text colors here, but now the title screen does it (newtitle.s) */ void atari_text_setup() { @@ -172,7 +179,7 @@ void cputc_s(void) { } /* print 'count' spaces, but leave the cursor where it was. - TODO: rewrite in asm. */ + been rewritten in asm, see console.s */ /* void cblank(unsigned char count) { char oldx = wherex(); @@ -184,12 +191,14 @@ void cblank(unsigned char count) { /* conio doesn't back up the cursor if you cputc(BKSP), it prints the graphics character instead. Could use putchar(), - but using stdio links a bunch of extra support code. So: */ -/* TODO: rewrite in asm */ + but using stdio links a bunch of extra support code. + Been rewritten in asm, see console.s */ +/* void backspace() { gotox(wherex()-1); cblank(1); } +*/ /* get an inventory item, return its index into items[]. if allow_all is true, allows '*', which is used for @@ -207,6 +216,10 @@ unsigned char get_item(unsigned char allow_all) { } } +#ifdef CART_TARGET +# pragma code-name (pop) +#endif + /* modified ultoa() with hardcoded radix */ extern char *ultostr(unsigned long value, char* s); @@ -753,12 +766,18 @@ void cprintfancy(unsigned long num) { } #endif +#ifdef CART_TARGET +# pragma code-name (push, "HIGHCODE") +#endif void justify_int(unsigned int num) { if(num < 1000) cspace(); if(num < 100) cspace(); if(num < 10) cspace(); cprintulong(num); } +#ifdef CART_TARGET +# pragma code-name (pop) +#endif /* void hide_cursor() { @@ -1380,6 +1399,9 @@ unsigned long get_num(void) { } /* TODO: rewrite in asm */ +#ifdef CART_TARGET +# pragma code-name (push, "HIGHCODE") +#endif void cash_or_guns(void) { char choice; @@ -1451,6 +1473,10 @@ void set_prices(void) { unsigned int warehouse_in_use() { return hkw_[0] + hkw_[1] + hkw_[2] + hkw_[3]; } +#ifdef CART_TARGET +# pragma code-name (pop) +#endif + void port_stats(void) { @@ -2769,6 +2795,12 @@ int port_choices(void) { return choice; } +void print_bar_line(void) { + cprint_pipe(); + cspaces(38); + cprint_pipe(); +} + /* TODO: rewrite in asm, or at least better C */ void name_firm(void) { unsigned char input, firmlen = 0; @@ -2776,6 +2808,8 @@ void name_firm(void) { clrscr(); + /* old version, readable, but compiles to 78 byte more + than the new version below. chlinexy(1, 7, 38); chlinexy(1, 16, 38); cvlinexy(0, 8, 8); @@ -2784,32 +2818,65 @@ void name_firm(void) { cputcxy(0, 16, 26); // lower left corner cputcxy(39, 7, 5); // upper right corner cputcxy(39, 16, 3); // lower right corner - gotoxy(6, 9); cprint_taipan_comma(); gotoxy(2, 11); cputs("What will you name your"); gotoxy(6, 13); - // cputs("Firm:"); cprint_firm_colon(); chlinexy(12, 14, 22); + */ + + gotoy(7); + cputc(17); + chline(38); + cputc(5); + print_bar_line(); + cprint_pipe(); + cspaces(5); + cprint_taipan_comma(); + cspaces(25); + cprint_pipe(); + print_bar_line(); + cprint_pipe(); + cputs(" What will you name your"); + cspaces(14); + cprint_pipe(); + print_bar_line(); + cprint_pipe(); + cspaces(5); + cprint_firm_colon(); + cspaces(28); + cprint_pipe(); + cprint_pipe(); + cspaces(11); + chline(22); + cspaces(5); + cprint_pipe(); + print_bar_line(); + cputc(26); + chline(38); + cputc(3); gotoxy(12, 13); - while((input = agetc()) && (firmlen < 22)) { - if(input == ENTER) { + while(1) { + if((input = agetc()) == ENTER) { if(firmlen) break; else bad_joss_sound(); + } else if(input == DEL) { + gotox(12); + cblank(22); + firmlen = 0; } else if(input == BKSP) { if(firmlen) { backspace(); - firm[firmlen--] = '\0'; + --firmlen; } - } else { - cputc(input); - firm[firmlen++] = input; + } else if(firmlen < 22) { + cputc(firm[firmlen++] = input); randseed <<= 1; randseed += (input - 32); } @@ -2826,6 +2893,9 @@ void name_firm(void) { return; } +#ifdef CART_TARGET +# pragma code-name (push, "HIGHCODE") +#endif char what_do_you_wish_me_to(char buy_or_sell) { gotoxy(0, 22); clrtobot(); @@ -2836,6 +2906,9 @@ char what_do_you_wish_me_to(char buy_or_sell) { cprint_taipan_prompt(); return get_item(0); } +#ifdef CART_TARGET +# pragma code-name (pop) +#endif void buy(void) { int choice; |