Play recorded sounds: Difference between revisions

m
Line 25:
LEA $A04000,A3
MOVEQ #$2B,D0
MOVEQ #$80,D1 ;assembler might not allow this notation, but MOVEQ #-128,D0 is equivalent.
MOVEQ #$80,D1
jsr FMRegWrite ;this part is not time-critical so we can use the function call here.
jsr FMRegWrite
subq.b #1,d0 ;move.b #dac_data,D0
.dac_loop:
MOVE.B (a1)+,d1
beq .dac_done ;exit on a zero value.
sub.b #$30,d1
 
;the core functionality of FMRegWrite had to be reproduced inline
Line 37 ⟶ 36:
 
.wait1:
BTST #7,(A3) ;check if sound chip is busy
BNE .wait1 ;loop until it's not busy
MOVE.B D0,(A3) ;write to DAC_DATA register
.wait2:
BTST #7,(A3)
BNE .wait2
MOVE.B D1,(1,A3) ;data to write
BRA .dac_loop
.dac_done:
RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1,489

edits