diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | README.txt | 15 | ||||
| -rw-r--r-- | newtitle.s | 19 | ||||
| -rw-r--r-- | taipan.c | 49 | ||||
| -rw-r--r-- | vcount.s | 22 | ||||
| -rw-r--r-- | ver.dat | bin | 40 -> 0 bytes | 
6 files changed, 82 insertions, 25 deletions
| @@ -171,7 +171,7 @@ convfont: convfont.c  # Obligatory clean and distclean rules.  clean: -	rm -f *.o *.lst convfont *.xex AUTORUN.SYS taipan.atr +	rm -f *.o *.lst convfont *.xex AUTORUN.SYS taipan.atr ver.dat  distclean: clean  	rm -f *~ core .*.swp 1.* 2.* 1 2 3 map map.* *.map a b c foo bar baz @@ -40,12 +40,13 @@ Build Requirements:    version of BSD make (which works).  - cc65. Originally I used version 2.13.3, and part way through I -  upgraded to a git snapshot dated December 29, 2015. cc65-2.3.13 -  is probably broken right now, but it will be supported again. +  upgraded to a git snapshot dated December 29, 2015. Building with +  cc65-2.3.13 is probably broken right now, but it will be supported +  again.  - gcc. I use version 4.8.2. Probably any version will do. It's only    needed for convfont.c (and there's nothing gcc-specific about it, -  so really you just need any C compiler). +  so really you just need any C compiler, see HOSTCC in the Makefile).  - perl. I use version 5.18.1, probably any 5.x version will work. @@ -53,9 +54,9 @@ Build Requirements:    a shell that does I/O redirection. Linux, BSD, and Mac OS X should    be fine. If you're on Windows, try Cygwin. -If you plan to edit the port status scrren or ship graphics, you'll need -the Atari800 emulator. It's also handy for actually playing the game, -whether you build it or use the provided binary. +If you plan to edit the port status scrren, you'll need the Atari800 +emulator. It's also handy for actually playing the game, whether you +build it or use the provided binary.  If you plan to edit the title screen, you'll need the ImageMagick library  and its perl module (Image::Magick). Also you'll need something that @@ -124,6 +125,8 @@ arcade game).  Bugs! At least these: +- Throw Cargo screen layout is a mess. +  - The "negative interest" bug is currently missing, due to using    unsigned values for debt. Plus, it's cheating. It'll get added back when    I either start using big numbers (floats or 64-bit ints or whatever), @@ -19,6 +19,11 @@ screendata = $9000  version:   .incbin "ver.dat" +colorchoices: + .byte $c0,$10,$00 + +colorcount = (*-colorchoices)-1 +   ; executable code here  start:   ; setup color registers @@ -52,12 +57,26 @@ start:   lda #$ff   sta CH + ldx #0 ; X = index into color choices +   ; wait for user to press a key  wait4key: + lda colorchoices,x + sta COLOR2   lda CH   cmp #$ff   beq wait4key + cmp #39 ; atari logo key + bne keyok + dex + bpl x_ok + ldx #colorcount +x_ok: + lda #$ff + sta CH + bne wait4key +keyok:   ; eat the keypress   lda #$ff   sta CH @@ -99,12 +99,15 @@ void atari_text_setup() {  	jsleep(1);  	POKE(559, 34);        // turn on the screen (normal playfield)  	jsleep(1); -	POKE(710, 0xc0); // green background -	POKE(709, 0x0c); // bright text +	// POKE(710, 0xc0); // green background +	// POKE(709, 0x0c); // bright text  	POKE(756, 0xb8); // use our custom font  	POKE(731, 1);    // disable keyclick on XL/XE (does nothing on 400/800)  } +/* this didn't work out, bummer. */ +// extern void __fastcall__ waitvcount(unsigned char c); +  /**** End of atari-specific stuff */  /* old version of this used to just 'return randl()%clamp'. @@ -892,9 +895,10 @@ int sea_battle(int id, int num_ships) {           flushinp();  			for(i = 0; i < 3; i++) { -				POKE(710, 0xcc); +				unsigned char color = PEEK(710) & 0xf0; +				POKE(710, color | 0x0c);  				jsleep(10); -				POKE(710, 0xc0); +				POKE(710, color & 0xf0);  				jsleep(10);  			} @@ -1180,6 +1184,7 @@ void set_prices(void)  void port_stats(void)  { +	static int firmpos = 0;     int  i, in_use,  		  status = 100 - ((damage * 100) / capacity); @@ -1231,14 +1236,19 @@ void port_stats(void)  	if(port_stat_dirty) {  		void *p = (void *)(PEEK(88) + 256 * PEEK(89)); +		/* don't update the top of the screen while ANTIC is +			reading from it (prevents tearing) */ +		// waitvcount(84);  		memcpy(p, &port_stat_screen, 640);  		port_stat_dirty = 0;  	}  #endif  	/* dynamic stuff: */ +	// waitvcount(84);  	cursor(0); -	gotoxy(12 - strlen(firm) / 2, 0); /* TODO: store in global */ +	if(!firmpos) firmpos = 12 - strlen(firm) / 2; +	gotoxy(firmpos, 0);  	cputs("Firm: ");  	cputs(firm);  	cputs(", Hong Kong"); @@ -1313,7 +1323,7 @@ void port_stats(void)  	gotoy(9);  	fancy_numbers(debt, fancy_num); -	gotox(33 - strlen(fancy_num) / 2); +	gotox(34 - strlen(fancy_num) / 2);  	clrtoeol();  	revers(1);   	cputs(fancy_num); @@ -1426,6 +1436,9 @@ void retire(void)  void final_stats(void)  { +	/* TODO: write cprintlong() to print signed value */ +	long finalcash; +     int years = year - 1860,         time = ((year - 1860) * 12) + month,         choice = 0; @@ -1434,8 +1447,8 @@ void final_stats(void)     clrscr();     cputs("Your final status:\r\n\r\n"); -   cash = cash + bank - debt; -   fancy_numbers(cash, fancy_num); +   finalcash = cash + bank - debt; +   fancy_numbers(finalcash, fancy_num);  	cputs("Net cash:  ");  	cputs(fancy_num);  	cputs("\r\nShip size: "); @@ -1458,16 +1471,16 @@ void final_stats(void)        cputc('s');     }     cputs("\r\n\r\n"); -   cash = cash / 100 / time; +   finalcash = finalcash / 100 / time;  	revers(1);  	cputs("Your score is "); -	cprintulong(cash); +	cprintulong(finalcash);  	cputs(".\r\n");  	revers(0); -   if ((cash < 100) && (cash >= 0)) +   if ((finalcash < 100) && (finalcash >= 0))     {        cputs("Have you considered a land based job?\r\n\r\n\r\n"); -   } else if (cash < 0) { +   } else if (finalcash < 0) {        cputs("The crew has requested that you stay on\r\n");        cputs("shore for their safety!!\r\n\r\n");     } else { @@ -1480,7 +1493,7 @@ void final_stats(void)  	cputs("\r\n");     // cputs(" _______________________________\r\n");     cputc('|'); -   if (cash > 49999L) +   if (finalcash > 49999L)     {  		revers(1);     } @@ -1488,7 +1501,7 @@ void final_stats(void)  	revers(0);     cputs("         50,000 and over |\r\n");     cputc('|'); -   if ((cash < 50000L) && (cash > 7999L)) +   if ((finalcash < 50000L) && (finalcash > 7999L))     {  		revers(1);     } @@ -1496,7 +1509,7 @@ void final_stats(void)  	revers(0);     cputs("   8,000 to 49,999|\r\n");     cputc('|'); -   if ((cash < 8000L) && (cash > 999L)) +   if ((finalcash < 8000L) && (finalcash > 999L))     {  		revers(1);     } @@ -1504,7 +1517,7 @@ void final_stats(void)  	revers(0);     cputs("          1,000 to  7,999|\r\n");     cputc('|'); -   if ((cash < 1000) && (cash > 499)) +   if ((finalcash < 1000) && (finalcash > 499))     {  		revers(1);     } @@ -1512,7 +1525,7 @@ void final_stats(void)  	revers(0);     cputs("        500 to    999|\r\n");     cputc('|'); -   if (cash < 500) +   if (finalcash < 500)     {  		revers(1);     } @@ -1620,7 +1633,7 @@ void transfer(void)                    gotoxy(0, 21);                    cputs("Your warehouse will only hold an\r\nadditional ");  						cprintulong(10000 - in_use); -                  cputs("%d, Taipan!"); +                  cputs(", Taipan!");                    timed_getch(TMOUT_5S);                 } diff --git a/vcount.s b/vcount.s new file mode 100644 index 0000000..067ce26 --- /dev/null +++ b/vcount.s @@ -0,0 +1,22 @@ + .export _waitvcount + + .include "atari.inc" + +; wait for VCOUNT to reach a particular value. Use this +; to avoid updating parts of the screen while ANTIC is +; reading from it. + +; c should be ((4 + Yposition) * 4), where Yposition is +; the text line below the bottom one you're about to modify. + +; void __fastcall__ waitvcount(unsigned char *c) +_waitvcount: + sta FR1 + +w: + lda VCOUNT + cmp FR1 + bne w + + STA WSYNC ; finish current scanline + rts diff --git a/ver.dat b/ver.datBinary files differ deleted file mode 100644 index d03fad4..0000000 --- a/ver.dat +++ /dev/null | 
