2009-04-18 18:10:51 +00:00
|
|
|
; This is the trojan program we send to the DSP from DSPSpy to figure it out.
|
2009-04-24 14:36:31 +00:00
|
|
|
REGS_BASE: equ 0x0f80
|
|
|
|
MEM_HI: equ 0x0f7E
|
|
|
|
MEM_LO: equ 0x0f7F
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
;
|
2009-04-18 18:10:51 +00:00
|
|
|
; CODE STARTS HERE.
|
2009-04-18 14:02:34 +00:00
|
|
|
|
|
|
|
; Interrupt vectors 8 vectors, 2 opcodes each
|
|
|
|
|
|
|
|
jmp irq0
|
|
|
|
jmp irq1
|
|
|
|
jmp irq2
|
|
|
|
jmp irq3
|
|
|
|
jmp irq4
|
|
|
|
jmp irq5
|
|
|
|
jmp irq6
|
|
|
|
jmp irq7
|
|
|
|
|
|
|
|
; Main code at 0x10
|
2009-04-18 18:10:51 +00:00
|
|
|
sbset #0x02
|
|
|
|
sbset #0x03
|
|
|
|
sbclr #0x04
|
|
|
|
sbset #0x05
|
|
|
|
sbset #0x06
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-23 08:52:21 +00:00
|
|
|
set16
|
2009-04-18 18:10:51 +00:00
|
|
|
lri $CR, #0x00ff
|
|
|
|
|
|
|
|
; Why do we have a main label here?
|
2009-04-18 14:02:34 +00:00
|
|
|
main:
|
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
clr $ACC1
|
|
|
|
clr $ACC0
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; get address of memory dump and copy it to DRAM
|
2009-04-18 14:02:34 +00:00
|
|
|
|
|
|
|
call wait_for_dsp_mbox
|
|
|
|
si @DMBH, #0x8888
|
|
|
|
si @DMBL, #0xdead
|
|
|
|
si @DIRQ, #0x0001
|
|
|
|
|
|
|
|
call wait_for_cpu_mbox
|
2009-04-24 14:36:31 +00:00
|
|
|
lrs $AC0.M, @CMBL
|
|
|
|
andi $ac1.m, #0x7fff
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
sr @MEM_HI, $AC1.M
|
|
|
|
sr @MEM_LO, $AC0.M
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ax0.l, #0
|
|
|
|
lri $ax1.l, #0 ;(DSP_CR_IMEM | DSP_CR_TO_CPU)
|
|
|
|
lri $ax0.h, #0x2000
|
|
|
|
lr $ac0.l, @MEM_HI
|
|
|
|
lr $ac0.m, @MEM_LO
|
2009-04-18 14:02:34 +00:00
|
|
|
call do_dma
|
|
|
|
|
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; get address of registers and DMA them to ram
|
2009-04-18 14:02:34 +00:00
|
|
|
|
|
|
|
call wait_for_dsp_mbox
|
|
|
|
si @DMBH, #0x8888
|
|
|
|
si @DMBL, #0xbeef
|
|
|
|
si @DIRQ, #0x0001
|
|
|
|
|
|
|
|
call wait_for_cpu_mbox
|
2009-04-24 14:36:31 +00:00
|
|
|
lrs $AC0.M, @CMBL
|
|
|
|
andi $ac1.m, #0x7fff
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
sr @MEM_HI, $AC1.M
|
|
|
|
sr @MEM_LO, $AC0.M
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ax0.l, #REGS_BASE
|
|
|
|
lri $ax1.l, #0 ;(DSP_CR_IMEM | DSP_CR_TO_CPU)
|
|
|
|
lri $ax0.h, #0x80
|
|
|
|
lr $ac0.l, @MEM_HI
|
|
|
|
lr $ac0.m, @MEM_LO
|
2009-04-18 14:02:34 +00:00
|
|
|
call do_dma
|
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; Read in all the registers from RAM
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ar0, #REGS_BASE+1
|
|
|
|
lrri $ar1, @$ar0
|
|
|
|
lrri $ar2, @$ar0
|
|
|
|
lrri $ar3, @$ar0
|
|
|
|
lrri $ix0, @$ar0
|
|
|
|
lrri $ix1, @$ar0
|
|
|
|
lrri $ix2, @$ar0
|
|
|
|
lrri $ix3, @$ar0
|
|
|
|
lrri $r08, @$ar0
|
|
|
|
lrri $r09, @$ar0
|
|
|
|
lrri $r10, @$ar0
|
|
|
|
lrri $r11, @$ar0
|
|
|
|
lrri $st0, @$ar0
|
|
|
|
lrri $st1, @$ar0
|
|
|
|
lrri $st2, @$ar0
|
|
|
|
lrri $st3, @$ar0
|
|
|
|
lrri $ac0.h, @$ar0
|
|
|
|
lrri $ac1.h, @$ar0
|
|
|
|
lrri $cr, @$ar0
|
|
|
|
lrri $sr, @$ar0
|
|
|
|
lrri $prod.l, @$ar0
|
|
|
|
lrri $prod.m1, @$ar0
|
|
|
|
lrri $prod.h, @$ar0
|
|
|
|
lrri $prod.m2, @$ar0
|
|
|
|
lrri $ax0.l, @$ar0
|
|
|
|
lrri $ax1.l, @$ar0
|
|
|
|
lrri $ax0.h, @$ar0
|
|
|
|
lrri $ax1.h, @$ar0
|
|
|
|
lrri $ac0.l, @$ar0
|
|
|
|
lrri $ac1.l, @$ar0
|
|
|
|
lrri $ac0.m, @$ar0
|
|
|
|
lrri $ac1.m, @$ar0
|
|
|
|
lr $ar0, @REGS_BASE
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; Right here we are at a specific predetermined state.
|
|
|
|
; Ideal environment to try instructions.
|
|
|
|
|
|
|
|
; We can call send_back at any time to send data back to the PowerPC.
|
|
|
|
|
2009-04-22 19:08:13 +00:00
|
|
|
; Calling set40 here seemed to crash the dsp tester in strange ways
|
|
|
|
; until I added set16 in send_back. Seems clear that it affects something important.
|
2009-04-18 19:26:06 +00:00
|
|
|
|
2009-04-18 14:02:34 +00:00
|
|
|
nop
|
|
|
|
nop
|
2009-04-18 21:35:21 +00:00
|
|
|
lris $AC0.M, #0xcc
|
|
|
|
lris $AC1.M, #0xcc
|
2009-04-18 14:02:34 +00:00
|
|
|
nop
|
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
mrr $ar0, $sr
|
2009-04-18 19:26:06 +00:00
|
|
|
call send_back
|
|
|
|
|
2009-04-23 08:52:21 +00:00
|
|
|
set40
|
2009-04-18 21:35:21 +00:00
|
|
|
nop
|
|
|
|
lris $AC0.M, #0xcc
|
|
|
|
lris $AC1.M, #0xcc
|
|
|
|
nop
|
|
|
|
nop
|
2009-04-24 14:36:31 +00:00
|
|
|
mrr $ar0, $sr
|
2009-04-18 19:26:06 +00:00
|
|
|
call send_back
|
|
|
|
|
2009-04-18 21:35:21 +00:00
|
|
|
cw 0xa100
|
|
|
|
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0xa900
|
|
|
|
|
|
|
|
call send_back
|
2009-04-23 08:52:21 +00:00
|
|
|
set40
|
2009-04-18 21:35:21 +00:00
|
|
|
cw 0xa100
|
|
|
|
|
|
|
|
call send_back
|
2009-04-23 08:52:21 +00:00
|
|
|
set40
|
2009-04-18 21:35:21 +00:00
|
|
|
cw 0xa900
|
|
|
|
|
|
|
|
call send_back
|
2009-04-18 18:10:51 +00:00
|
|
|
; We're done - currently we only test one opcode, in this case 0x8600.
|
|
|
|
; It's possible to test many more in one go - just call send_back after each one.
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
jmp ende
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; Below here is tons of random leftover test code from whoever last experimented with this.
|
2009-04-18 14:02:34 +00:00
|
|
|
|
|
|
|
; call dump_memory
|
2009-04-18 18:10:51 +00:00
|
|
|
; call send_back
|
2009-04-18 14:02:34 +00:00
|
|
|
|
|
|
|
cw 0x00de
|
|
|
|
cw 0x03f1
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x0200
|
|
|
|
cw 0x0a60
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x1c7e
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x8100
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x8900
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x009f
|
|
|
|
cw 0x00a0
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x00de
|
|
|
|
cw 0x03f1
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x5d00
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x0e50
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x0750
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x0270
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x5d00
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x00da
|
|
|
|
cw 0x03f2
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x8600
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
JNS g_0c4d
|
|
|
|
; cw 0x0290
|
|
|
|
; cw 0x0c4d
|
|
|
|
; call send_back JX0
|
|
|
|
|
|
|
|
cw 0x00de
|
|
|
|
cw 0x03f3
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x5c00
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
JLE g_0c38
|
|
|
|
; cw 0x0293
|
|
|
|
; cw 0x0c38 JX3
|
|
|
|
; call send_back
|
|
|
|
|
|
|
|
JMP g_0c52
|
|
|
|
|
|
|
|
; cw 0x029f
|
|
|
|
; cw 0x0c52
|
|
|
|
; call send_back
|
|
|
|
|
|
|
|
g_0c38:
|
|
|
|
cw 0x00db
|
|
|
|
cw 0x03f7
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x009e
|
|
|
|
cw 0x8000
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x4600
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
JMP g_0c44
|
|
|
|
; cw 0x029f
|
|
|
|
; cw 0x0c44
|
|
|
|
; call send_back
|
|
|
|
|
|
|
|
g_0c3f:
|
|
|
|
cw 0x00db
|
|
|
|
cw 0x03f7
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x009e
|
|
|
|
cw 0x8000
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x5600
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
g_0c44:
|
|
|
|
cw 0x00fe
|
|
|
|
cw 0x03f5
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x1fda
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x7c00
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x1f5e
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x00fe
|
|
|
|
cw 0x03f2
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
JMP g_0c52
|
|
|
|
; cw 0x029f
|
|
|
|
; cw 0x0c52
|
|
|
|
; call send_back
|
|
|
|
|
|
|
|
g_0c4d:
|
|
|
|
|
|
|
|
cw 0x00de
|
|
|
|
cw 0x03f4
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x5d00
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
JLE g_0c3f
|
|
|
|
; cw 0x0293
|
|
|
|
; cw 0x0c3f
|
|
|
|
; call send_back
|
|
|
|
|
|
|
|
g_0c52:
|
|
|
|
cw 0x8900
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x00dd
|
|
|
|
cw 0x03f5
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x1501
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x8100
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x00dc
|
|
|
|
cw 0x03f6
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x008b
|
|
|
|
cw 0x009f
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x0080
|
|
|
|
cw 0x0a00
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x0900
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
BLOOPI #0x50, g_0c65
|
|
|
|
; cw 0x1150
|
|
|
|
; cw 0x0c65
|
|
|
|
; call send_back
|
|
|
|
|
|
|
|
|
|
|
|
cw 0x1878
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x4c00
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x1cfe
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x001f
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x1fd9
|
|
|
|
call send_back
|
|
|
|
g_0c65:
|
|
|
|
cw 0x1b18
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x009f
|
|
|
|
cw 0x0a60
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x1fc3
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x5c00
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x00fe
|
|
|
|
cw 0x03f1
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x00fc
|
|
|
|
cw 0x03f6
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
cw 0x008b
|
|
|
|
cw 0xffff
|
|
|
|
call send_back
|
|
|
|
|
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; This is where we jump when we're done testing, see above.
|
2009-04-18 14:02:34 +00:00
|
|
|
ende:
|
|
|
|
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; We just fall into a loop, playing dead until someone resets the DSP.
|
2009-04-18 14:02:34 +00:00
|
|
|
dead_loop:
|
|
|
|
jmp dead_loop
|
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; Utility function to do DMA.
|
2009-04-24 14:36:31 +00:00
|
|
|
; ac0.l:ac0.m - external address.
|
|
|
|
; ax0.l - address in DSP
|
2009-04-18 14:02:34 +00:00
|
|
|
do_dma:
|
2009-04-24 14:36:31 +00:00
|
|
|
sr @DSMAH, $ac0.l
|
|
|
|
sr @DSMAL, $ac0.m
|
|
|
|
sr @DSPA, $ax0.l
|
|
|
|
sr @DSCR, $ax1.l
|
|
|
|
sr @DSBL, $ax0.h ; This kicks off the DMA.
|
2009-04-18 18:10:51 +00:00
|
|
|
|
|
|
|
; Waits for said DMA to complete by watching a bit in DSCR.
|
2009-04-18 14:02:34 +00:00
|
|
|
wait_dma:
|
2009-04-24 14:36:31 +00:00
|
|
|
LRS $AC1.M, @DSCR
|
|
|
|
andcf $ac1.m, #0x0004
|
2009-04-18 14:02:34 +00:00
|
|
|
JLZ wait_dma
|
|
|
|
RET
|
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; This waits for a mail to arrive in the DSP in-mailbox.
|
2009-04-18 14:02:34 +00:00
|
|
|
wait_for_dsp_mbox:
|
2009-04-24 14:36:31 +00:00
|
|
|
lrs $AC1.M, @DMBH
|
|
|
|
andcf $ac1.m, #0x8000
|
2009-04-18 14:02:34 +00:00
|
|
|
jlz wait_for_dsp_mbox
|
|
|
|
ret
|
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; This waits for the CPU to grab a mail that we just sent from the DSP.
|
2009-04-18 14:02:34 +00:00
|
|
|
wait_for_cpu_mbox:
|
2009-04-24 14:36:31 +00:00
|
|
|
lrs $AC1.M, @cmbh
|
|
|
|
andcf $ac1.m, #0x8000
|
2009-04-18 14:02:34 +00:00
|
|
|
jlnz wait_for_cpu_mbox
|
|
|
|
ret
|
2009-04-18 18:10:51 +00:00
|
|
|
|
|
|
|
; IRQ handlers. Not entirely sure what good they do currently.
|
2009-04-18 14:02:34 +00:00
|
|
|
irq0:
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ac0.m, #0x0000
|
2009-04-18 14:02:34 +00:00
|
|
|
jmp irq
|
|
|
|
irq1:
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ac0.m, #0x0001
|
2009-04-18 14:02:34 +00:00
|
|
|
jmp irq
|
|
|
|
irq2:
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ac0.m, #0x0002
|
2009-04-18 14:02:34 +00:00
|
|
|
jmp irq
|
|
|
|
irq3:
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ac0.m, #0x0003
|
2009-04-18 14:02:34 +00:00
|
|
|
jmp irq
|
|
|
|
irq4:
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ac0.m, #0x0004
|
2009-04-18 14:02:34 +00:00
|
|
|
jmp irq
|
|
|
|
irq5:
|
2009-04-18 18:10:51 +00:00
|
|
|
; No idea what this code is doing.
|
2009-04-23 08:52:21 +00:00
|
|
|
set16
|
2009-04-24 14:36:31 +00:00
|
|
|
mrr $st1, $ac0.l
|
|
|
|
mrr $st1, $ac0.m
|
2009-04-18 14:02:34 +00:00
|
|
|
clr $acc0
|
2009-04-24 14:36:31 +00:00
|
|
|
mrr $ac0.m, $st1
|
|
|
|
mrr $ac0.l, $st1
|
2009-04-18 18:10:51 +00:00
|
|
|
nop ; Or why there's a nop sled here.
|
2009-04-18 14:02:34 +00:00
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
rti
|
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ac0.m, #0x0005
|
2009-04-18 14:02:34 +00:00
|
|
|
jmp irq
|
|
|
|
irq6:
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ac0.m, #0x0006
|
2009-04-18 14:02:34 +00:00
|
|
|
jmp irq
|
|
|
|
irq7:
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ac0.m, #0x0007
|
2009-04-18 14:02:34 +00:00
|
|
|
jmp irq
|
2009-04-18 18:10:51 +00:00
|
|
|
|
2009-04-18 14:02:34 +00:00
|
|
|
irq:
|
2009-04-24 14:36:31 +00:00
|
|
|
lrs $AC1.M, @DMBH
|
|
|
|
andcf $ac1.m, #0x8000
|
2009-04-18 14:02:34 +00:00
|
|
|
jlz irq
|
|
|
|
si @DMBH, #0x8BAD
|
2009-04-24 14:36:31 +00:00
|
|
|
sr @DMBL, $r11
|
|
|
|
;sr @DMBL, $ac0.m
|
2009-04-18 14:02:34 +00:00
|
|
|
si @DIRQ, #0x0001
|
|
|
|
halt
|
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; DMA:s the current state of the registers back to the PowerPC. To do this,
|
|
|
|
; it must write the contents of all regs to DRAM.
|
2009-04-18 14:02:34 +00:00
|
|
|
send_back:
|
2009-04-18 19:26:06 +00:00
|
|
|
; make state safe.
|
2009-04-22 19:08:13 +00:00
|
|
|
set16
|
2009-04-18 14:02:34 +00:00
|
|
|
; store registers to reg table
|
2009-04-24 14:36:31 +00:00
|
|
|
sr @REGS_BASE, $ar0
|
|
|
|
lri $ar0, #(REGS_BASE + 1)
|
|
|
|
srri @$ar0, $ar1
|
|
|
|
srri @$ar0, $ar2
|
|
|
|
srri @$ar0, $ar3
|
|
|
|
srri @$ar0, $ix0
|
|
|
|
srri @$ar0, $ix1
|
|
|
|
srri @$ar0, $ix2
|
|
|
|
srri @$ar0, $ix3
|
|
|
|
srri @$ar0, $r08
|
|
|
|
srri @$ar0, $r09
|
|
|
|
srri @$ar0, $r10
|
|
|
|
srri @$ar0, $r11
|
|
|
|
srri @$ar0, $st0
|
|
|
|
srri @$ar0, $st1
|
|
|
|
srri @$ar0, $st2
|
|
|
|
srri @$ar0, $st3
|
|
|
|
srri @$ar0, $ac0.h
|
|
|
|
srri @$ar0, $ac1.h
|
|
|
|
srri @$ar0, $cr
|
|
|
|
srri @$ar0, $sr
|
|
|
|
srri @$ar0, $prod.l
|
|
|
|
srri @$ar0, $prod.m1
|
|
|
|
srri @$ar0, $prod.h
|
|
|
|
srri @$ar0, $prod.m2
|
|
|
|
srri @$ar0, $ax0.l
|
|
|
|
srri @$ar0, $ax1.l
|
|
|
|
srri @$ar0, $ax0.h
|
|
|
|
srri @$ar0, $ax1.h
|
|
|
|
srri @$ar0, $ac0.l
|
|
|
|
srri @$ar0, $ac1.l
|
|
|
|
srri @$ar0, $ac0.m
|
|
|
|
srri @$ar0, $ac1.m
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; Regs are stored. Prepare DMA.
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ax0.l, #0x0000
|
|
|
|
lri $ax1.l, #1 ;(DSP_CR_IMEM | DSP_CR_TO_CPU)
|
|
|
|
lri $ax0.h, #0x200
|
|
|
|
lr $ac0.l, @MEM_HI
|
|
|
|
lr $ac0.m, @MEM_LO
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ar1, #8+8
|
2009-04-18 18:10:51 +00:00
|
|
|
|
|
|
|
; Now, why are we looping here?
|
2009-04-24 14:36:31 +00:00
|
|
|
bloop $ar1, dma_copy
|
2009-04-18 14:02:34 +00:00
|
|
|
call do_dma
|
2009-04-24 14:36:31 +00:00
|
|
|
addi $ac0.m, #0x200
|
|
|
|
mrr $ac1.m, $ax0.l
|
|
|
|
addi $ac1.m, #0x100
|
|
|
|
mrr $ax0.l, $ac1.m
|
2009-04-18 14:02:34 +00:00
|
|
|
nop
|
2009-04-18 18:10:51 +00:00
|
|
|
|
2009-04-18 14:02:34 +00:00
|
|
|
dma_copy:
|
|
|
|
nop
|
2009-04-18 18:10:51 +00:00
|
|
|
|
|
|
|
; Wait for the CPU to send us a mail.
|
2009-04-18 14:02:34 +00:00
|
|
|
call wait_for_dsp_mbox
|
|
|
|
si @DMBH, #0x8888
|
|
|
|
si @DMBL, #0xfeeb
|
|
|
|
si @DIRQ, #0x0001
|
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; wait for the CPU to recieve our response before we execute the next op
|
2009-04-18 14:02:34 +00:00
|
|
|
call wait_for_cpu_mbox
|
2009-04-24 14:36:31 +00:00
|
|
|
lrs $AC0.M, @CMBL
|
|
|
|
andi $ac1.m, #0x7fff
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
; Restore all regs again so we're ready to execute another op.
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ar0, #REGS_BASE+1
|
|
|
|
lrri $ar1, @$ar0
|
|
|
|
lrri $ar2, @$ar0
|
|
|
|
lrri $ar3, @$ar0
|
|
|
|
lrri $ix0, @$ar0
|
|
|
|
lrri $ix1, @$ar0
|
|
|
|
lrri $ix2, @$ar0
|
|
|
|
lrri $ix3, @$ar0
|
|
|
|
lrri $r08, @$ar0
|
|
|
|
lrri $r09, @$ar0
|
|
|
|
lrri $r10, @$ar0
|
|
|
|
lrri $r11, @$ar0
|
|
|
|
lrri $st0, @$ar0
|
|
|
|
lrri $st1, @$ar0
|
|
|
|
lrri $st2, @$ar0
|
|
|
|
lrri $st3, @$ar0
|
|
|
|
lrri $ac0.h, @$ar0
|
|
|
|
lrri $ac1.h, @$ar0
|
|
|
|
lrri $cr, @$ar0
|
|
|
|
lrri $sr, @$ar0
|
|
|
|
lrri $prod.l, @$ar0
|
|
|
|
lrri $prod.m1, @$ar0
|
|
|
|
lrri $prod.h, @$ar0
|
|
|
|
lrri $prod.m2, @$ar0
|
|
|
|
lrri $ax0.l, @$ar0
|
|
|
|
lrri $ax1.l, @$ar0
|
|
|
|
lrri $ax0.h, @$ar0
|
|
|
|
lrri $ax1.h, @$ar0
|
|
|
|
lrri $ac0.l, @$ar0
|
|
|
|
lrri $ac1.l, @$ar0
|
|
|
|
lrri $ac0.m, @$ar0
|
|
|
|
lrri $ac1.m, @$ar0
|
|
|
|
lr $ar0, @REGS_BASE
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
ret ; from send_back
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-23 08:52:21 +00:00
|
|
|
; If you are in set40 mode, use this instead of send_back if you want to stay
|
|
|
|
; in set40 mode.
|
2009-04-22 19:08:13 +00:00
|
|
|
send_back_40:
|
2009-04-18 18:10:51 +00:00
|
|
|
set16
|
2009-04-22 19:08:13 +00:00
|
|
|
call send_back
|
|
|
|
set40
|
2009-04-18 14:02:34 +00:00
|
|
|
ret
|
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
; This one's odd. Doesn't look like it should work since it uses ac0.m but
|
2009-04-18 18:10:51 +00:00
|
|
|
; increments acm0... (acc0)
|
|
|
|
dump_memory:
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ar2, #0x0000
|
|
|
|
lri $ac0.m, #0x1000
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
lri $ar1, #0x1000
|
|
|
|
bloop $ar1, _fill_loop2
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
mrr $ar3, $ac0.m
|
2009-04-18 18:10:51 +00:00
|
|
|
nx'ld : $AX0.H, $AX1.H, @$AR0
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-24 14:36:31 +00:00
|
|
|
mrr $ac1.m, $ar0
|
|
|
|
mrr $ar0, $ar2
|
|
|
|
srri @$ar0, $ax1.h
|
|
|
|
mrr $ar2, $ar0
|
|
|
|
mrr $ar0, $ac1.m
|
2009-04-18 14:02:34 +00:00
|
|
|
|
2009-04-18 18:10:51 +00:00
|
|
|
addis $acc0, #0x1
|
|
|
|
|
2009-04-18 14:02:34 +00:00
|
|
|
_fill_loop2:
|
|
|
|
nop
|
2009-04-18 18:10:51 +00:00
|
|
|
ret ; from dump_memory
|