diff options
author | B. Watson <yalhcru@gmail.com> | 2016-01-07 04:55:59 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2016-01-07 04:55:59 -0500 |
commit | 3d7d8a9b549f1b6445858f78012b4c55609e1335 (patch) | |
tree | 11406bc12cae0ee6169754fd442eb28e6acff663 | |
parent | 23fd09c5c464505c7c9ceb801fceb907446cd1ab (diff) | |
download | taipan-3d7d8a9b549f1b6445858f78012b4c55609e1335.tar.gz |
first pass at sounds
-rw-r--r-- | Makefile | 18 | ||||
-rw-r--r-- | README.txt | 2 | ||||
-rw-r--r-- | applesounds.wav | bin | 14449964 -> 0 bytes | |||
-rw-r--r-- | badjoss.wav | bin | 0 -> 323808 bytes | |||
-rw-r--r-- | goodjoss.wav | bin | 0 -> 382672 bytes | |||
-rw-r--r-- | sounds.c | 97 | ||||
-rw-r--r-- | sounds.h | 5 | ||||
-rw-r--r-- | taipan.c | 4 | ||||
-rw-r--r-- | timed_getch.s | 4 | ||||
-rw-r--r-- | underattack.wav | bin | 0 -> 382680 bytes |
10 files changed, 122 insertions, 8 deletions
@@ -60,6 +60,10 @@ HOSTCFLAGS=-Wall # The game binary: XEX=taipan.xex +# All the C and asm sources for taimain.xex: +TAIMAIN_C_SRC=taipan.c sounds.c +TAIMAIN_ASM_SRC=rand.s draw_lorcha.s timed_getch.s jsleep.s portstat.s clrtobot.s + # Default rule for plain 'make' command is to build the binary. all: $(XEX) @@ -111,9 +115,11 @@ comptitle.xex: titledata.xex titlecomp.pl comptitle.s.in newtitle.xex: newtitle.s ver.dat help.dat cl65 -l newtitle.lst -m newtitle.map -o newtitle.xex -t none newtitle.s +# Version number in Atari screen-data form ver.dat: text2screen.pl echo "$(VERSION)" | perl text2screen.pl > ver.dat +# Help text for the title screen help.dat: help.txt text2screen.pl perl text2screen.pl < help.txt > help.dat @@ -122,14 +128,16 @@ help.dat: help.txt text2screen.pl # The main executable. All the C and asm code goes here, except the init # segment in newtitle.s. -taimain.xex: taipan.c rand.s draw_lorcha.s timed_getch.s jsleep.s portstat.s clrtobot.s - cl65 --mapfile taipan.map $(CFLAGS) -o taimain.xex taipan.c rand.s draw_lorcha.s timed_getch.s jsleep.s portstat.s clrtobot.s +taimain.xex: $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) + cl65 -m taipan.map $(CFLAGS) -o taimain.xex $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) + +#cl65 --mapfile taipan.map $(CFLAGS) -o taimain.xex taipan.c sounds.c rand.s draw_lorcha.s timed_getch.s jsleep.s portstat.s clrtobot.s # With newer cc65s, I have to do this to get an assembly listing of just # taipan.c. This rule not used as part of the main build, it's only for # debugging. taipan.lst: taipan.c - cl65 --mapfile taipan.map $(CFLAGS) -c -o /dev/null -l taipan.lst -T taipan.c + cl65 -m taipan.map $(CFLAGS) -c -o /dev/null -l taipan.lst -T taipan.c # The font gets loaded into RAM, in the area reserved by the # -D__RESERVED_MEMORY__ option to cl65. To actually use the font, @@ -187,6 +195,10 @@ lorchatest: lorchatest.c draw_lorcha.s taifont.xex cat taifont.xex lorchatest1.xex > lorchatest.xex atari800 -nobasic lorchatest.xex +soundtest: sounds.c + cl65 -DTESTXEX -t atari -o sounds.xex sounds.c + atari800 -nobasic sounds.xex + # former textmode title screen, was generated by TITLE.LST. Replaced # by graphical title screen. #title.xex: TITLE.DAT @@ -125,8 +125,6 @@ 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), diff --git a/applesounds.wav b/applesounds.wav Binary files differdeleted file mode 100644 index d5642a6..0000000 --- a/applesounds.wav +++ /dev/null diff --git a/badjoss.wav b/badjoss.wav Binary files differnew file mode 100644 index 0000000..e25712c --- /dev/null +++ b/badjoss.wav diff --git a/goodjoss.wav b/goodjoss.wav Binary files differnew file mode 100644 index 0000000..7c6cb86 --- /dev/null +++ b/goodjoss.wav diff --git a/sounds.c b/sounds.c new file mode 100644 index 0000000..aee7319 --- /dev/null +++ b/sounds.c @@ -0,0 +1,97 @@ +/* Sounds for Taipan! Atari 800 port. + + Made by capturing the Apple II audio and taking wild guesses, + then refining them. + + I'm not shooting for Atari sounds that are identical to the + Apple ones: (a) it's impossible anyway, and (b) the Apple + sounds are a bit harsh to the ear. Hopefully these sound + a little smoother while still being pretty close. +*/ + +#include <atari.h> +#include <peekpoke.h> + +/* to build standalone xex that just plays the 3 sounds: + cl65 -DTESTXEX -t atari -o sounds.xex sounds.c +*/ +#ifdef TESTXEX +#include <stdio.h> + +void jsleep(unsigned int j) { + POKE(20,0); + while(PEEK(20) < j) + ; +} +#else +extern void __fastcall__ jsleep(unsigned int j); +#endif + +void init_sound(void) { + /* init POKEY audio */ + POKEY_WRITE.audctl = 0; + POKEY_WRITE.skctl = 3; + POKEY_WRITE.audc1 = 0xaa; /* SOUND 0,x,10,10 */ +} + +void stop_sound(void) { + POKEY_WRITE.audc1 = 0x00; /* SOUND 0,x,0,0 */ +} + +void bad_joss_sound() { + unsigned char i; + + init_sound(); + for(i=0; i<10; i++) { + POKEY_WRITE.audf1 = 80-i*8; + jsleep(1); + } + stop_sound(); +} + +void good_joss_sound() { + unsigned char i, j; + + init_sound(); + for(j=0; j<3; j++) { + for(i=0; i<4; i++) { + POKEY_WRITE.audf1 = 20-i*5; + jsleep(2); + } + } + stop_sound(); +} + +void under_attack_sound() { + unsigned char i, j; + + init_sound(); + for(j=0; j<3; j++) { + for(i=0; i<3; i++) { + POKEY_WRITE.audf1 = 20-i*3; + jsleep(3); + } + } + stop_sound(); +} + +#ifdef TESTXEX +int main(void) { + for(;;) { + puts("Bad joss, Taipan!"); + bad_joss_sound(); + jsleep(30); + + puts("Good joss, Taipan!"); + good_joss_sound(); + jsleep(30); + + puts("1.0E+97 hostile ships approaching, Taipan!"); + under_attack_sound(); + jsleep(30); + } + +hang: goto hang; + return 0; +} +#endif diff --git a/sounds.h b/sounds.h new file mode 100644 index 0000000..06f67ec --- /dev/null +++ b/sounds.h @@ -0,0 +1,5 @@ +void init_sound(void); +void stop_sound(void); +void bad_joss_sound(void); +void good_joss_sound(void); +void under_attack_sound(void); @@ -6,10 +6,12 @@ #include <string.h> #include <peekpoke.h> +#include "sounds.h" + /* define this for testing sea_battle(). it causes a pirate attack every time you leave port. Don't leave defined for a release!! */ -#define COMBAT_TEST +// #define COMBAT_TEST /* define this to show internals of damage calculation */ // #define DAMAGE_TEST diff --git a/timed_getch.s b/timed_getch.s index 3259d7e..25a2320 100644 --- a/timed_getch.s +++ b/timed_getch.s @@ -44,7 +44,7 @@ done: _agetc: lda #1 ; show cursor jsr _cursor - sta FR0+2 ; save old cursor status + sta FR1+2 ; save old cursor status lda #1 jsr _cblank @@ -73,7 +73,7 @@ notcontrol: ok: pha lda #1 - lda FR0+2 + lda FR1+2 jsr _cursor pla ldx #0 diff --git a/underattack.wav b/underattack.wav Binary files differnew file mode 100644 index 0000000..f477cce --- /dev/null +++ b/underattack.wav |