[A89] Re: change the SR
[Prev][Next][Index][Thread]
[A89] Re: change the SR
> Hi,
>
> I want to change the SR with a move ..,SR instruction but i got a privileged
> violation error, because the processor is in user-mode. How do I get into
> supervisor mode? I know, when an interrupt is called, the S/U bit is
> switched, but when it returns from interrupt, it's switched again. Do I have
> to write my own interrupt code that doesn't restore the SR when it returns
> back to normal code? Isn't there an easier way(ROM call?) to get the
> processor in Supervisor mode, so I can change the Interrupt Mask in the
> SR???
Trap 1 swaps the contents of the D0 register into the SR register, and bit 2
of 0x600001 controls the low memory protection. This code should work:
move.w #0x0700,d0
trap #1
move.l (0x00000064),old_int1
...
move.l (0x000000bc),old_trap15
bclr.b #2,(0x00600001)
move.l #MyInt1,(0x00000064)
...
move.l #MyTrap15,(0x000000bc)
bset.b #2,(0x00600001)
trap #1
Not all the replacement interrupts and traps are needed, of course. Also, it
is generally a good idea to restore the SR like it was (i.e. store or don't
change D0 before Trap 1 is called again).
--
/ Niklas Brunlid
Check out Prosit for the TI-89 / TI-92+ at http://prosit.ticalc.org
Random PQF v5.1 Quote follows:
The Archchancellor's most important job, as the Bursar saw it, was to sign
things, preferably, from the Bursar's point of view, without reading them
first.
-- Middle management explained
(Terry Pratchett, Moving Pictures)
Follow-Ups:
References: