C.1 system/user mode opcodes – Jameco Electronics Rabbit 3000 User Manual
Page 327

318
Rabbit 3000 Microprocessor
C.1 System/User Mode Opcodes
Seven new opcodes have been added to support the System/User mode, and are listed in
Table C-2. All but IDET are placed in previously empty opcode table assignments. IDET
shares the value of
LD E,E
in the opcode table, and will perform that operation when the
System/User mode is disabled, or when it is enabled and in the System mode. In addition,
if the
ALTD
prefix appears before the opcode,
LD E’,E
is always executed instead.
The processor keeps a one-byte stack (called the SU register) that is analogous to the IP
register that keeps track of the interrupt priority. Every time
SETUSR
is executed (to enter
the User mode), or an interrupt occurs, or
SYSCALL
or
RST
is executed (to enter the Sys-
tem mode), the current mode is pushed onto the SU register. When a
SURES
is executed,
the previous mode is popped off the SU register.
The effects of each opcode are:
•
The
SETUSR
opcode puts the processor into the User mode by pushing the correct value
into the SU register.
•
PUSH SU
and
POP SU
push and pop the single-byte SU register on/off the SP stack.
•
SURES
pops the current processor mode off the SU register, returning it to the previous
mode.
•
IDET
causes an interrupt if executed in the User mode, and does nothing in the System
mode.
•
RDMODE
returns the current mode in the carry flag (0 for System mode, 1 for User mode).
•
SYSCALL
is essentially a new
RST
opcode, and was added to allow User mode access to
the System mode without using one of the existing
RST
opcodes. It will put the processor
into the System mode and execute code in the corresponding interrupt-vector table entry.
Table C-2. New System/User Mode Opcodes
Instruction
Bytes
clk
A
I
S Z V C
Operation
Priv
?
SETUSR
2
4
-
-
-
-
- SU = {SU[5:0], 0x01}
Yes
PUSH SU
2
9
-
-
-
-
- (SP-1) = SU; SP = SP - 1
Yes
POP SU
2
7
-
-
-
-
- SU = (SP); SP = SP + 1
Yes
SURES
2
4
-
-
-
-
- SU = {SU[1:0], SU[7:2]}
Yes
IDET
1
2
-
-
-
-
-
Performs
LD E,E
, but if
(EDMF && SU[0]) then the System
Violation interrupt flag is set; if ALTD
appears before it always does
LD E’,E
No
RDMODE
2
4
-
-
-
-
* CF = SU[0]
Yes
SYSCALL
2
10
-
-
-
-
-
SP = SP - 2; PC = {R,v} where
v = SYSCALL offset
No