The collision.a48
demo program shows another new feature: sound. Every time the
fire button is pressed an explosion sound is played. There is a very
sophisticated routine in the bios which should be called at every VSYNC. I
have named this routine soundirq. It is possible to replace this
routine completely, but for normal operation you have to put a
jmp soundirq at 040Ah. This routine interprets a kind of
macro code. There are commands for setting sound registers, waiting and jumping
unconditionally. This routine reads the sound data from page 3 of the internal
ROM, so to play tunes different from the built-in ones you have to replace the
routine completely. To start the playing of one of the tunes put the number of
the tune into A and call playsound. For a description of the
tunes look at the summary chapter.
call getjoystick ; get offsets
cpl F0
jf0 nofire ; skip next part
; if not fire
; start playing the built-in tune for "explode"
; the rest is done by the irq routines in ROM
mov a,#tune_explode
call playsound
nofire