All pastes #719037 Raw Edit

Someone

public text v1 · immutable
#719037 ·published 2007-09-28 21:51 UTC
rendered paste body
Sound_E1:                ; XREF: Sound_ExIndex
    move.w    #$100,($A11100).l
@loop:
    btst    #0,($A11100).l
    bne.s    @loop
    lea    (SegaPCM).l,a2            ; Load the "SEGA" PCM sample into a2. It's important that we use a2 since a0 and a1 are going to be used up ahead when reading the joypad ports
    move.l    #$6978,d3            ; Load the size of the "SEGA" PCM sample into d3
    move.b    #$2A,($A04000).l        ; $A04000 = $2A -> Write to DAC channel    
PlayPCM_Loop:     
    move.b    (a2)+,($A04001).l         ; Write the PCM data (contained in a2) to $A04001 (YM2612 register D0)
    move.w    #$2A,d0                ; Write the pitch ($2A in this case) to d0
    dbf    d0,*                ; Decrement d0; jump to itself if not 0. (for pitch control, avoids playing the sample too fast) 
    sub.l    #1,d3                 ; Subtract 1 from the PCM sample size
    bne.s    PlayPCM_Loop            ; Otherwise, continue playing PCM sample
return_PlayPCM:
    addq.w    #4,sp
    rts