sound: try for tiny sound

This commit is contained in:
Vince Weaver 2022-03-26 00:53:35 -04:00
parent ed5ec29895
commit 85e67e61dd
4 changed files with 111 additions and 12 deletions

View File

@ -6,13 +6,17 @@ PNG_TO_40x48D = ../../utils/gr-utils/png_to_40x48d
PNG2RLE = ../../utils/gr-utils/png2rle
B2D = ../../utils/bmp2dhr/b2d
TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft
EMPTY_DISK = ../../empty_disk/empty.dsk
all: sound.dsk
sound.dsk: HELLO SOUND
cp empty.dsk sound.dsk
sound.dsk: HELLO SOUND TINY
cp $(EMPTY_DISK) sound.dsk
$(DOS33) -y sound.dsk SAVE A HELLO
$(DOS33) -y sound.dsk BSAVE -a 0x1000 SOUND
$(DOS33) -y sound.dsk BSAVE -a 0x1000 TINY
###
SOUND: sound.o
ld65 -o SOUND sound.o -C ../../linker_scripts/apple2_1000.inc
@ -22,12 +26,20 @@ sound.o: sound.s
###
TINY: tiny.o
ld65 -o TINY tiny.o -C ../../linker_scripts/apple2_1000.inc
tiny.o: tiny.s
ca65 -o tiny.o tiny.s -l tiny.lst
###
HELLO: hello.bas
$(TOKENIZE) < hello.bas > HELLO
####
clean:
rm -f *~ *.o *.lst HELLO SOUND
rm -f *~ *.o *.lst HELLO SOUND TINY

Binary file not shown.

View File

@ -10,22 +10,37 @@ sound_effects:
jsr water
; jsr whistle
jsr wait_until_keypress
; jsr boop
jsr whistle
; jsr beep
jsr wait_until_keypress
; jsr boop
jsr boop
; jsr static
jsr wait_until_keypress
jsr beep
jsr wait_until_keypress
jsr boop
jsr wait_until_keypress
jsr static
jsr wait_until_keypress
end:
lda KEYPRESS
bpl end
bit KEYRESET
jsr sound_effects
jmp sound_effects
wait_until_keypress:
lda KEYPRESS
bpl wait_until_keypress
bit KEYRESET
rts

View File

@ -0,0 +1,72 @@
; Soft Switches
KEYPRESS= $C000
KEYRESET= $C010
SPEAKER= $C030
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
; zero page use
HALF_PERIOD = $FF
test_sound:
jsr tiny_sound_effect
wait_until_keypress:
lda KEYPRESS
bpl wait_until_keypress
bit KEYRESET
jmp test_sound
tiny_sound_effect:
ldy #0
freq_smc:
lda #$40
sta HALF_PERIOD
play_note:
loop_half_period:
lda $C030 ; 4 cycles
ldx HALF_PERIOD ; 3 cycles
loop_nops:
pha ; 4 cycles
plp ; 4 cycles
dex ; 2 cycles
bne loop_nops ; 3 cycles
; Testing duration loop
dey ; 2 cycles
bne loop_half_period ; 3 cycles
lsr freq_smc+1
lsr pattern
beq end
bcc skip_wait
wait_smc:
lda #80
jsr WAIT
skip_wait:
beq tiny_sound_effect ; bra
end:
rts
pattern:
.byte $13