Code: Select all
sys_sleep:
lea sys_state(pc),a0
ori.w #$0700,sr
move.l $70.w,(a0)+
move.l $114.w,(a0)+
lea new_vbi(pc),a1
move.l a1,$70.w
lea new_tc(pc),a1
move.l a1,timerc.w
andi.w #$f3ff,sr
rts
Moderator: troed
Code: Select all
sys_sleep:
lea sys_state(pc),a0
ori.w #$0700,sr
move.l $70.w,(a0)+
move.l $114.w,(a0)+
lea new_vbi(pc),a1
move.l a1,$70.w
lea new_tc(pc),a1
move.l a1,timerc.w
andi.w #$f3ff,sr
rts
Cool thanks.thorsten.otto wrote: ↑Thu Apr 09, 2020 6:01 pm Its cleaner to save the old value of SR, and restore it at the end, rather than just doing andi $f3ff,sr. Depending on where you call your code, interrupts might have already been disabled before, or the mask being set to a different value than 3, and then you would unintentionally enabling them.
Other than that, it looks ok to me.
Can you explain how to enable and disable the interrupts like that code does ? When I poke in STOS I get back $E03662.. I have no idea what that number is for or what bits to change ?thorsten.otto wrote: ↑Thu Apr 09, 2020 6:01 pm Its cleaner to save the old value of SR, and restore it at the end, rather than just doing andi $f3ff,sr. Depending on where you call your code, interrupts might have already been disabled before, or the mask being set to a different value than 3, and then you would unintentionally enabling them.
Code: Select all
sys_sleep:
lea sys_state(pc),a0
move.w sr,d0 <-- save old value
ori.w #$0700,sr
move.l $70.w,(a0)+
move.l $114.w,(a0)+
lea new_vbi(pc),a1
move.l a1,$70.w
lea new_tc(pc),a1
move.l a1,timerc.w
move.w d0,sr <-- restore old interrupt mask
rts
Yeah, though I didn't program that ASM code, so no idea what its really doing. I need to be able to do this in HISOFT BASIC.