This commit is contained in:
tildearrow 2023-03-15 04:23:47 -05:00
parent 557f77c3c6
commit 32298f6ab3
2 changed files with 107 additions and 23 deletions

View file

@ -43,6 +43,5 @@ run a.out on Amiga. it should play the exported song.
- f2 xx: wait
- f3 xxxx: wait
- f6 xxxx: write to DMACON
- fa xxxx: write to INTENA
- fe xxxx: write to ADKCON
- ff: end of song

View file

@ -10,6 +10,8 @@ chipBase=$dff000
DMACONR = $02
DMACON = $96
ADKCON = $9e
AUDBASE = $a0
AUD0LCH = $a0
AUD0LCL = $a2
AUD0LEN = $a4
@ -18,24 +20,6 @@ AUD0VOL = $a8
AUD0DAT = $aa
code_c
start:
lea chipBase,a0
move.w #15,DMACON(a0)
testDMACon:
move.w DMACONR(a0),d0
btst #0,d0
bne testDMACon
lea sampleData(pc),a1
move.l a1,AUD0LCH(a0)
move.w #$2000,d0
move.w d0,AUD0LEN(a0)
move.w #$a0,AUD0PER(a0)
move.w #$40,AUD0VOL(a0)
move.w #$8201,DMACON(a0)
main:
jsr waitVBlank
@ -71,16 +55,117 @@ testSpecial:
cmp.b #$f0,d0
blt testChannel
cmp.b #$
testF1:
; f1 - next tick
cmp.b #$f1,d0
bne testF2
; end of tick
move.w #0,(a4)
bra endTick
testF2:
; f2 - wait (char)
cmp.b #$f2,d0
bne testF3
move.b (a2)+,d0
andi.w #$ff,d0
move.w d0,(a4)
bra endTick
testF3:
; f3 - wait (short)
cmp.b #$f3,d0
bne testF6
clr.w d2
move.b (a2)+,d2
rol.w #8,d2
or.b (a2)+,d2
move.w d2,(a4)
bra endTick
testF6:
; f6 - write DMACON
cmp.b #$f6,d0
bne testFE
clr.w d2
move.b (a2)+,d2
rol.w #8,d2
or.b (a2)+,d2
move.w d2,chipBase+DMACON
bra nextTick1
testFE:
; fe - write ADKCON
cmp.b #$fe,d0
bne testFF
clr.w d2
move.b (a2)+,d2
rol.w #8,d2
or.b (a2)+,d2
move.w d2,chipBase+ADKCON
bra nextTick1
testFF:
; ff - end of song
cmp.b #$ff,d0
bne testOther
bra nextTick1
testOther:
; something else
bra nextTick1
testChannel:
cmp.b #$40,d0
bge nextTickPost
bge invalidCmd
; process channel
move.b d0,d1
andi.b #15,d0
; check for 0
bne chanNotZero
; write loc/len
clr.l d2
move.b (a2)+,d2
rol.w #8,d2
or.b (a2)+,d2
rol.w #8,d2
or.b (a2)+,d2
add.l sampleData(pc),d2
lea chipBase,a0
or.b d1,d0
addi.b #AUDBASE,d0
andi.w #$ff,d0
adda.w d0,a0
move.l d2,(a0) ; location
clr.w d2
move.b (a2)+,d2
rol.w #8,d2
or.b (a2)+,d2
adda.w #4,a0
move.l d2,(a0) ; length
bra nextTick1
chanNotZero:
; check for 8 (VOL)
cmp.b #8,d0
bne chanOther
; write volume
clr.w d2
move.b (a2)+,d2
bra chanWrite
chanOther:
; get value and write
clr.w d2
move.b (a2)+,d2
rol.w #8,d2
or.b (a2)+,d2
chanWrite:
lea chipBase,a0
or.b d1,d0
addi.b #AUDBASE,d0
andi.w #$ff,d0
adda.w d0,a0
move.w d2,(a0)
invalidCmd:
bra nextTick1
nextTickPost:
endTick:
lea seqAddr(pc),a3
move.l a2,(a3)
bra nextTick1
rts
data_c