home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 4: Demo 1
/
almathera_demo1.bin
/
sourcecode
/
german
/
soundtest.s
< prev
next >
Wrap
Text File
|
1995-03-17
|
2KB
|
115 lines
org $35000
load $35000
;
; Digitized Sound Test
;
; by THE MAD THINKER on 28-Feb-87
;
; ---- memory usage
MaxSnd=20480
SndBuffer=$45000
; ---- exec.library
AbsExecBase=$4
OpenLibrary=-408
CloseLibrary=-414
; ---- dos.library
Open=-30
Close=-36
Read=-42
OPEN_OLD=1005
; ---- Program Entry Point !
start:
move.l sp,initialSP
move.l AbsExecBase,a6
lea DosName,a1
jsr OpenLibrary(a6)
; ---- Load Digitized Data in ram
move.l d0,a6
move.l #FileName,d1
move.l #OPEN_OLD,d2
jsr Open(a6)
move.l d0,d7
move.l d0,d1
move.l #SndBuffer,d2
move.l #MaxSnd,d3
jsr Read(a6)
lsr.l #1,d0
move.w d0,SndLen ; len in words
move.l d7,d1
jsr Close(a6)
move.l a6,a1
move.l AbsExecBase,a6
jsr CloseLibrary(a6)
; ---- setup system interrupts
move.l $70,OldVector
move.l #SndHandler,$70
move.w #$0080,$dff09c
move.w #$8080,$dff09a
; ---- setup sound registers
move.w #497,$dff0a6
move.w #1,timer
; ---- main sound loop
loop:
btst #6,$bfe001
beq.s fire
btst #7,$bfe001
bne.s loop
bra.s stopsnd
; --- start sound
fire:
move.l #SndBuffer,$dff0a0 ; location register
move.w SndLen,$dff0a4
move.w #64,$dff0a8 ; volume
move.w #$8001,$dff096
move.l #10,d1
ach2:
move.l #$ffffffff,d0
ach:
dbra d0,ach
dbra d1,ach2
bra.s loop
; --- end of sound
stopsnd:
move.w #$0001,$dff096
move.w #$0080,$dff09a
move.l OldVector,$70
move.l initialSP,sp
illegal
; --- Wait one scan line
waitlin:
move.w $dff006,d0
lsr.w #8,d0
wi1:
move.w $dff006,d1
lsr.w #8,d1
cmp.w d0,d1
beq.s wi1
rts
; --- Interrupt Sound Handler
SndHandler:
move SR,-(sp)
move.l d0,-(sp)
btst #7,$dff01f
beq.s weg
move.w #$0080,$dff09c
; -- play sound
subq.w #1,timer
bpl.s weg
move.w #$0001,$dff096
move.w #1,timer
weg:
bchg #1,$bfe001
move.l (sp)+,d0
move (sp)+,SR
rte
; --- Data area
FileName: DC.B 'df1:sound',0
even
DosName: DC.B 'dos.library',0
even
SndLen: blk.w 1,0
OldVector: blk.l 1,0
initialSP: blk.l 1,0
timer: blk.w 1,0