mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-12-26 18:27:50 +00:00
DSPSpy: save and restore $sr properly
This commit is contained in:
parent
3118a68246
commit
fb041f75e5
@ -33,7 +33,7 @@ m0
|
||||
clr15
|
||||
|
||||
;step 1: context setup
|
||||
call send_back_40
|
||||
call send_back
|
||||
|
||||
call 0x807e ; loop until DSP->CPU mailbox is empty
|
||||
si @DMBH, #0xdcd1
|
||||
@ -342,44 +342,44 @@ call send_back
|
||||
|
||||
call send_back
|
||||
set40
|
||||
call send_back_40
|
||||
call send_back
|
||||
lri $AR2, #0x0015
|
||||
call send_back_40
|
||||
call send_back
|
||||
lr $AC0.M, @0x0006
|
||||
call send_back_40
|
||||
call send_back
|
||||
lr $AX0.H, @0x165b
|
||||
call send_back_40
|
||||
call send_back
|
||||
call 0x88e5
|
||||
call send_back_40
|
||||
call send_back
|
||||
asr $ACC0, #-3
|
||||
call send_back_40
|
||||
call send_back
|
||||
lsl $ACC0, #3
|
||||
call send_back_40
|
||||
call send_back
|
||||
srri @$AR2, $AC0.M
|
||||
call send_back_40
|
||||
call send_back
|
||||
srri @$AR2, $AC0.L
|
||||
call send_back_40
|
||||
call send_back
|
||||
lri $AR2, #0x0016
|
||||
call send_back_40
|
||||
call send_back
|
||||
lr $AC0.M, @0x1723
|
||||
call send_back_40
|
||||
call send_back
|
||||
asr $ACC0, #-12
|
||||
call send_back_40
|
||||
call send_back
|
||||
lr $AX0.H, @0x166b
|
||||
call send_back_40
|
||||
call send_back
|
||||
call 0x88e5
|
||||
call send_back_40
|
||||
call send_back
|
||||
tst $ACC0
|
||||
call send_back_40
|
||||
call send_back
|
||||
jge Unk_012e
|
||||
call send_back_40
|
||||
call send_back
|
||||
|
||||
clr $ACC0
|
||||
call send_back_40
|
||||
call send_back
|
||||
|
||||
Unk_012e:
|
||||
asr $ACC0, #-3
|
||||
call send_back_40
|
||||
call send_back
|
||||
set16
|
||||
;step 4
|
||||
call send_back
|
||||
|
@ -169,10 +169,9 @@ irq:
|
||||
|
||||
; 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.
|
||||
; Unfortunately, this loop uses ar0 so it's best to use AR1 and friends for testing
|
||||
; when messing with indexing.
|
||||
send_back:
|
||||
; make state safe.
|
||||
; first, store $sr so we can modify it
|
||||
sr @(REGS_BASE + 19), $sr
|
||||
set16
|
||||
; store registers to reg table
|
||||
sr @REGS_BASE, $ar0
|
||||
@ -195,7 +194,8 @@ send_back:
|
||||
srri @$ar0, $ac0.h
|
||||
srri @$ar0, $ac1.h
|
||||
srri @$ar0, $cr
|
||||
srri @$ar0, $sr
|
||||
; skip $sr since we already stored and modified it
|
||||
iar $ar0
|
||||
srri @$ar0, $prod.l
|
||||
srri @$ar0, $prod.m1
|
||||
srri @$ar0, $prod.h
|
||||
@ -257,7 +257,8 @@ dma_copy:
|
||||
lrri $ac0.h, @$ar0
|
||||
lrri $ac1.h, @$ar0
|
||||
lrri $cr, @$ar0
|
||||
lrri $sr, @$ar0
|
||||
; leave $sr for later
|
||||
iar $ar0
|
||||
lrri $prod.l, @$ar0
|
||||
lrri $prod.m1, @$ar0
|
||||
lrri $prod.h, @$ar0
|
||||
@ -270,17 +271,10 @@ dma_copy:
|
||||
lrri $ac1.l, @$ar0
|
||||
lrri $ac0.m, @$ar0
|
||||
lrri $ac1.m, @$ar0
|
||||
lr $ar0, @REGS_BASE
|
||||
lr $ar0, @REGS_BASE
|
||||
lr $sr, @(REGS_BASE+19)
|
||||
|
||||
ret ; from send_back
|
||||
|
||||
; If you are in set40 mode, use this instead of send_back if you want to stay
|
||||
; in set40 mode.
|
||||
send_back_40:
|
||||
set16
|
||||
call send_back
|
||||
set40
|
||||
ret
|
||||
|
||||
; Obviously this must be included directly before your test code
|
||||
start_of_test:
|
||||
|
@ -6,9 +6,6 @@ include "dsp_base.inc"
|
||||
|
||||
; We can call send_back at any time to send data back to the PowerPC.
|
||||
|
||||
; 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.
|
||||
|
||||
lri $AC0.M, #0x1000
|
||||
call send_back
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user