aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-01-07 07:21:35 -0500
committerB. Watson <yalhcru@gmail.com>2016-01-07 07:21:35 -0500
commitebbc4a225ba2ecf3b7d54510884976c4e7a961cc (patch)
tree0bf55b2c33a5204f2db5628db472e651799bc4a0
parent2ae2b1397ec74e6535f5a5b5b0be8f0d0d4f4965 (diff)
downloadtaipan-ebbc4a225ba2ecf3b7d54510884976c4e7a961cc.tar.gz
silly explosion noises, enable/disable sound from title screen
-rw-r--r--help.txt1
-rw-r--r--newtitle.s36
-rw-r--r--sounds.c65
-rw-r--r--sounds.h12
4 files changed, 104 insertions, 10 deletions
diff --git a/help.txt b/help.txt
index 0b6f204..f89e6e6 100644
--- a/help.txt
+++ b/help.txt
@@ -1,3 +1,4 @@
\B:Change BG Color \E\s\c:more
\T:Change Text Color \E\s\c:more
+\S:Sound [now \O\N ] \E\s\c:more
\A\n\y other key: Start \E\s\c:more
diff --git a/newtitle.s b/newtitle.s
index 32f72a3..d9a96cb 100644
--- a/newtitle.s
+++ b/newtitle.s
@@ -4,6 +4,11 @@
.include "atari.inc"
+ ; location sound code will look at to see whether sound
+ ; is disabled (0 = enabled, !0 = disabled). If you
+ ; change this here, change it in sounds.h also!
+sound_disabled = $06ff
+
; where our screen was loaded (see newtitle.pl)
screendata = $9000
@@ -27,6 +32,7 @@ helphitbl:
.byte >help
.byte >(help+32)
.byte >(help+64)
+ .byte >(help+96)
.byte 0
helplotbl:
@@ -34,10 +40,14 @@ helplotbl:
.byte <help
.byte <(help+32)
.byte <(help+64)
+ .byte <(help+96)
.byte 0
helpshowing = FR1
+; N<space> or FF (inverse)
+sounddisp = help + 78
+
colorchoices:
.byte $c0,$10,$00
@@ -101,6 +111,7 @@ wait4key:
bne not_esc
; show next line of help
+showhelp:
stx FR1+1
ldx helpshowing
inx
@@ -119,6 +130,13 @@ helpok:
bcc x_ok
not_esc:
+ cmp #62 ; S key
+ bne not_s
+ jsr enable_disable_sound
+ clc
+ bcc showhelp
+
+not_s:
cmp #21 ; B key
bne not_b
dex
@@ -151,6 +169,24 @@ wait:
beq wait
rts
+enable_disable_sound:
+ lda #2
+ sta helpshowing
+ lda sound_disabled
+ eor #$01
+ sta sound_disabled
+ beq now_on
+ lda #166 ; inverse F screen code
+ sta sounddisp
+ sta sounddisp+1
+ rts
+now_on:
+ lda #174 ; inverse N screen code
+ sta sounddisp
+ lda #128 ; inverse space screen code
+ sta sounddisp+1
+ rts
+
; display list here
dlist:
.byte $70 ; 24 scanlines of blanks
diff --git a/sounds.c b/sounds.c
index aee7319..de6ea83 100644
--- a/sounds.c
+++ b/sounds.c
@@ -11,6 +11,9 @@
#include <atari.h>
#include <peekpoke.h>
+#include "sounds.h"
+
+int sound_disabled = 0x06ff;
/* to build standalone xex that just plays the 3 sounds:
cl65 -DTESTXEX -t atari -o sounds.xex sounds.c
@@ -27,21 +30,23 @@ void jsleep(unsigned int j) {
extern void __fastcall__ jsleep(unsigned int j);
#endif
-void init_sound(void) {
+void init_sound(unsigned char audc1) {
+ if(PEEK(sound_disabled)) return;
+
/* init POKEY audio */
POKEY_WRITE.audctl = 0;
POKEY_WRITE.skctl = 3;
- POKEY_WRITE.audc1 = 0xaa; /* SOUND 0,x,10,10 */
+ POKEY_WRITE.audc1 = audc1; /* SOUND 0,x,audc1>>4,audc1&0x0f */
}
void stop_sound(void) {
POKEY_WRITE.audc1 = 0x00; /* SOUND 0,x,0,0 */
}
-void bad_joss_sound() {
+void bad_joss_sound(void) {
unsigned char i;
- init_sound();
+ init_sound(0xaa);
for(i=0; i<10; i++) {
POKEY_WRITE.audf1 = 80-i*8;
jsleep(1);
@@ -49,10 +54,10 @@ void bad_joss_sound() {
stop_sound();
}
-void good_joss_sound() {
+void good_joss_sound(void) {
unsigned char i, j;
- init_sound();
+ init_sound(0xaa);
for(j=0; j<3; j++) {
for(i=0; i<4; i++) {
POKEY_WRITE.audf1 = 20-i*5;
@@ -62,10 +67,10 @@ void good_joss_sound() {
stop_sound();
}
-void under_attack_sound() {
+void under_attack_sound(void) {
unsigned char i, j;
- init_sound();
+ init_sound(0xaa);
for(j=0; j<3; j++) {
for(i=0; i<3; i++) {
POKEY_WRITE.audf1 = 20-i*3;
@@ -75,9 +80,44 @@ void under_attack_sound() {
stop_sound();
}
+void cannon_sound(void) {
+ unsigned char i;
+
+ init_sound(0xaa);
+ for(i = 20; i < 40; i += 1) {
+ POKEY_WRITE.audf1 = i;
+ jsleep(1);
+ }
+
+ init_sound(0x8a);
+ POKEY_WRITE.audf1 = 120;
+ for(i = 15; i > 3; i--) {
+ POKEY_WRITE.audc1 = 0x80 | i;
+ jsleep(3);
+ }
+
+ stop_sound();
+}
+
+/* this isn't a very good explosion yet */
+void weve_been_hit_sound(void) {
+ unsigned char i;
+
+ init_sound(0x8a);
+ POKEY_WRITE.audf1 = 200;
+ for(i = 15; i > 3; i--) {
+ POKEY_WRITE.audc1 = 0x80 | i;
+ POKEY_WRITE.audf1 = 200-i*2;
+ jsleep(4);
+ }
+
+ stop_sound();
+}
+
#ifdef TESTXEX
int main(void) {
for(;;) {
+ /*
puts("Bad joss, Taipan!");
bad_joss_sound();
jsleep(30);
@@ -89,6 +129,15 @@ int main(void) {
puts("1.0E+97 hostile ships approaching, Taipan!");
under_attack_sound();
jsleep(30);
+ */
+
+ puts("We're firing on them!");
+ cannon_sound();
+ jsleep(30);
+
+ puts("We've been hit!");
+ weve_been_hit_sound();
+ jsleep(30);
}
hang: goto hang;
diff --git a/sounds.h b/sounds.h
index 8df6aec..6dd3492 100644
--- a/sounds.h
+++ b/sounds.h
@@ -1,5 +1,10 @@
+/* location we will look at, to see if sound is disabled.
+ 0 = enabled, 1 = disabled. If you change this here,
+ change it in newtitle.s also! */
+extern int sound_disabled;
+
/* set volume 10, distortion 10 on audio channel 0 */
-void init_sound(void);
+void init_sound(unsigned char audc1);
/* silence audio channel 0 */
void stop_sound(void);
@@ -10,9 +15,12 @@ void bad_joss_sound(void);
/* played when something good happens */
void good_joss_sound(void);
-/* played before & during combat */
+/* UNUSED: will be played before & during combat */
void under_attack_sound(void);
+/* UNUSED: will be played while screen flashes in combat */
+void weve_been_hit_sound(void);
+
/* rest of this file is a list of all the instances of each sound,
gathered by playing the Apple II version in an emulator, and by
reading the Applesoft source (the goggles, they do nothing!). It