TRAP
Software Interrupt
7-192
Syntax TRAP
Operands None
Opcode
0123456789101112131415
1000101001111101
Execution (PC) + 1 → stack
22h → PC
Status Bits Not affected by INTM; does not affect INTM.
Description The TRAP instruction is a software interrupt that transfers program control to
program-memory location 22h and pushes the program counter (PC) plus 1
onto the hardware stack. The instruction at location 22h may contain a branch
instruction to transfer control to the TRAP routine. Putting (PC + 1) onto the
stack enables a return instruction to pop the return address (which points to
the instruction after TRAP) from the stack. The TRAP instruction is not mask-
able.
Words 1
Cycles for a Single TRAP Instruction
ROM DARAM SARAM External
4 4 4 4+3p
†
†
The processor performs speculative fetching by reading two additional instruction words. If the
PC discontinuity is taken, these two instruction words are discarded.
Example TRAP ;PC + 1 is pushed onto the stack, and then
;control is passed to program memory location
;22h.
Cycles