gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

ASM > Can't get Direct Sound to play..

#6812 - GbaGuy - Tue Jun 03, 2003 2:30 am

The code:
Code:

@include sound.h
@include dirsound.h
@include dma.h

ldr r1,=REG_SOUNDCNT_H
ldr r2,=(DSA_OUTPUT_TO_BOTH | DSA_FIFO_RESET)
mov r2,r2,lsl #16
str r2,[r1]

SoundOn

ldr r1,=REG_DMA1SAD
ldr r2,=StartOfSample
str r2,[r1]

ldr r1,=REG_DMA1DAD
ldr r2,=0x40000A0
str r2,[r1]

ldr r1,=REG_DMA1CNT
ldr r2,=(DMA_DEST_FIXED|DMA_REPEAT|DMA_32|DMA_ENABLE|DMA_TIMEING_SYNC_TO_DISPLAY)
str r2,[r1]

ldr r1,=REG_TM0D
ldr r2,=65536 - (16777216/11000)
mov r2,r2,lsl #16
str r2,[r1]

ldr r1,=REG_TM0CNT
ldr r2,=TIMER_ENABLE
mov r2,r2,lsl #16
str r2,[r1]

infin:
b infin

StartOfSample:
;I'm appending the RAW converted wav file at the end after assembly.


I know it tries to play, because I can hear static and some beeps.
The code is identical to some C code I found that works with
the same sample I'm trying to play.

Why is this not working?

Thanks,
- Mike