|
|
Atari coding BBS
Re: DSP context switch |
Posted by: Laurent / Thadoss
|
Mar,14.2014-13:32
|
Hi Doug,
For saving/restoring the DSP context in an interrupted program area, I use the following code (maybe you've got a better solution) :
; Save registers
move r1,y:x_save_r1
move r0,y:x_save_r0
move #x_save_regs2,r1
move #x_save_regs1,r0
move r2,y:(r1)+
move r3,y:(r0)+
move r4,y:(r1)+
move r5,y:(r0)+
move r6,y:(r1)+
move x0,y:(r0)+
move x1,y:(r1)+
move y0,y:(r0)+
move y1,y:(r1)+
move a0,y:(r0)+
move a1,y:(r1)+
move a2,y:(r0)+
move b0,y:(r1)+
move b1,y:(r0)
move b2,y:(r1)
; Restore registers
move #x_save_regs2,r1
move #x_save_regs1,r0
move y:(r1)+,r2
move y:(r0)+,r3
move y:(r1)+,r4
move y:(r0)+,r5
move y:(r1)+,r6
move y:(r0)+,x0
move y:(r1)+,x1
move y:(r0)+,y0
move y:(r1)+,y1
move y:(r0)+,a0
move y:(r1)+,a1
move y:(r0)+,a2
move y:(r1)+,b0
move y:(r0),b1
move y:(r1),b2
move y:x_save_r0,r0
move y:x_save_r1,r1
rti
;---------- Y:Memory ----------------------
org y:0
x_save_r0 dc 0
x_save_r1 dc 0
x_save_regs1 ds 8
x_save_regs2 ds 8
|
[All messages in this thread] [Start new thread]
What's the anti-troll code? That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
|
|
|