aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--bank7.s13
-rw-r--r--console.s7
-rw-r--r--taipan.c95
4 files changed, 100 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index 8404da4..47e1aee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ titledata.dat
ver.dat
*.map
*.o
+*.lib
*.lst
*.xex
.*
diff --git a/bank7.s b/bank7.s
index 052a474..32e5a34 100644
--- a/bank7.s
+++ b/bank7.s
@@ -95,26 +95,31 @@ cartstart:
sta destptr
lda #>codedest
sta destptr+1
+
+ ; banks 0 and 1 are full of code (minus the top page), bank 2
+ ; is partially full. At some point, bank 2 might disappear, if
+ ; I can shrink the code down to fit in 0 and 1 only.
lda #0 ; bank 0...
sta CCNTL ; ...select it
jsr copy_31_pages
+
lda #1 ; bank 1...
sta CCNTL ; ...select it
jsr copy_31_pages
+
lda #2 ; bank 2...
sta CCNTL ; ...select it
ldx #(>BANK2SIZE)+1 ; BANK2SIZE defined on the command line
jsr copy_x_pages
- ; bank 3 contains RODATA and some code, that runs from ROM rather than
- ; being copied to RAM.
+ ; bank 3 contains our font, RODATA, and some code that runs from ROM
+ ; rather than being copied to RAM. It stays enabled the entire time
+ ; the game is running.
lda #3 ; bank 3...
sta CCNTL ; ...select it
.out .sprintf("BANK2SIZE $%x (%d pages)", BANK2SIZE, (>BANK2SIZE)+1)
- ; leave bank 3 enabled, as it has our custom font in it
-
lda #1
sta COLDST ; System Reset = reboot
jsr start ; 'start' is from newtitle.s
diff --git a/console.s b/console.s
index 2ad5e58..7c7e18e 100644
--- a/console.s
+++ b/console.s
@@ -1,7 +1,7 @@
.include "atari.inc"
- .export _clrtobot, _clrtoeol, _clrtoline, _cspaces, _cblank
+ .export _clrtobot, _clrtoeol, _clrtoline, _cspaces, _cblank, _backspace
.import mul40 ; from cc65's runtime
.importzp tmp3 ; ditto
@@ -94,3 +94,8 @@ _cblank:
pla
sta COLCRS
rts
+
+_backspace:
+ dec COLCRS
+ lda #1
+ bne _cblank
diff --git a/taipan.c b/taipan.c
index 611f39e..7f1c206 100644
--- a/taipan.c
+++ b/taipan.c
@@ -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;