This commit is contained in:
tildearrow 2023-03-15 02:13:10 -05:00
parent ed3b0610d3
commit 557f77c3c6
1 changed files with 58 additions and 21 deletions

View File

@ -5,43 +5,47 @@
VPOSR = $dff004 VPOSR = $dff004
COLOR00 = $dff180 COLOR00 = $dff180
DMACONR = $dff002
DMACON = $dff096 chipBase=$dff000
AUD0LCH = $dff0a0
AUD0LCL = $dff0a2 DMACONR = $02
AUD0LEN = $dff0a4 DMACON = $96
AUD0PER = $dff0a6 AUD0LCH = $a0
AUD0VOL = $dff0a8 AUD0LCL = $a2
AUD0DAT = $dff0aa AUD0LEN = $a4
AUD0PER = $a6
AUD0VOL = $a8
AUD0DAT = $aa
code_c code_c
move.w #15,d0 start:
move.w d0,DMACON lea chipBase,a0
move.w #15,DMACON(a0)
testDMACon: testDMACon:
move.w DMACON,d0 move.w DMACONR(a0),d0
btst #0,d0 btst #0,d0
bne testDMACon bne testDMACon
lea sampleData(pc),a0 lea sampleData(pc),a1
move.l a0,AUD0LCH move.l a1,AUD0LCH(a0)
move.w #$2000,d0 move.w #$2000,d0
move.w d0,AUD0LEN move.w d0,AUD0LEN(a0)
move.w #$a0,d0 move.w #$a0,AUD0PER(a0)
move.w d0,AUD0PER move.w #$40,AUD0VOL(a0)
move.w #$40,d0 move.w #$8201,DMACON(a0)
move.w d0,AUD0VOL
move.l #$8201,d0
move.w d0,DMACON
main: main:
jsr waitVBlank jsr waitVBlank
move.w curColor,d0 move.w curColor,d0
move.w d0,COLOR00 move.w d0,COLOR00
addi.w #1,d0 addi.w #1,d0
move.w d0,curColor move.w d0,curColor
jsr nextTick
jmp main jmp main
waitVBlank: waitVBlank:
@ -51,11 +55,44 @@ waitVBlank:
bne waitVBlank bne waitVBlank
rts rts
nextTick:
lea state(pc),a4
move.w (a4),d0
subi.w #1,d0
bmi nextTick1
move.w d0,(a4)
rts
nextTick1:
move.l seqAddr(pc),a2
; get next command
move.b (a2)+,d0
testSpecial:
cmp.b #$f0,d0
blt testChannel
cmp.b #$
testChannel:
cmp.b #$40,d0
bge nextTickPost
nextTickPost:
lea seqAddr(pc),a3
move.l a2,(a3)
bra nextTick1
data_c data_c
curColor: curColor:
dc.w 0 dc.w 0
state:
dc.w 0 ; ticks
seqAddr:
dc.l sequence
sampleData: sampleData:
incbin "sample.bin" incbin "sample.bin"