belgo.org

Stuff about Christopher Shepherd, with a seemingly incongruous domain name.

PLAY.S (load and play a sound, with ProDOS 8)

lst off
org $1000
cas in
use /merlin/macro.library/util.macs
use /merlin/macro.library/sound.macs
use /merlin/macro.library/dos.8.macs
loadf open oparms ; Do our file reading junk
lda parm1
sta parm2
sta parm3
sta parm4
get_eof eparms
lda eof
sta rdbytes
lda eof+1
sta rdbytes+1
sta sndbytes ; Interesting note here.. put PAGES in sndbytes
read rparms
close cparms
play clc  ;Get into 16bit mode,
xce  ;
rep #$30 ; Start up sound tools and play the sound.
pushword #$9000 ;
_soundstartup  ;
pushword #$1201 ;
pushlong #Sparms ;
_FFstartsound  ;
sec  ;Then back to 8 bits so we can
xce  ;
ldx #$10
loopii phx
lda #$ff
jsr $fca8
plx
dex
cpx #00
bne loopii
clc  ;16 Bits to shut down sound tools.
xce  ;
rep #$30 ;
_soundshutdown  ;
sec  ;
xce  ;
rts  ;8 Bits so we can RTS to BASIC.
Sparms hex 00,20,00,00      ; Sound at $00/2000
sndbytes hex 00,00       ; Number of pages long
hex c8,00       ; 0200 = Playback rate
hex 00,20       ; Position at $2000 in DOC RAM
hex 00,80       ; $8000 = WaveSize = Dont worry 'bout it.
hex 00,00,00,00      ; No More Parms
hex ff,00       ; Full Volume
oparms hex 03 ;Prodos parms crap
da path
hex 0096
parm1 hex 00
eparms hex 02
parm2 hex 00
eof hex 000000
rparms hex 04
parm3 hex 00
hex 0020
rdbytes hex 0000
hex 0000
cparms hex 01
parm4 hex 00
path str "/CHRIS.SOURCE/FRANKLY"