We're looking for your comments on how to best organize the wiki's content.
arg1 is ignored and has no effect on what
RFI does at all.
Although it is technically possible to return from an interrupt manually with other opcodes, this is not stable and is therefore discouraged.
The instability stems from the fact that to return from an interrupt back to the main program, several things must happen:
Aregister should be retrieved from the stack.
- Interrupt queueing should be turned off.
PCmust be popped from the stack.
Once interrupt queueing is turned off, another interrupt could come and delay return to the main program. Although
PC is still retained in the stack from the first interrupt, a long series of interrupts can prevent returning to the main program indefinitely.
Although the above problem is not completely stopped by
RFI, the main program at least is able to execute one instruction between interrupts. Eventually (if such a situation was prepared for), this will give the operator an opportunity to disable interrupts again without requiring a forced shutdown.
SET IA, myISR ; interrupts will be handled by myISR (Interrupt Service Routine), below SET a, 1 INT a ADD a, 2 :end SET pc, end :myISR SET b, 1 ADD b, a RFI a ; continues execution at ADD a, 2
In binary machine code, this Special opcode's five-bit representation is:
0b0 1011 (
The instruction takes three cycles to execute, plus any additional cycles necessary to evaluate the argument.
- DCPU-16 specification v1.7 (Copyright 2012 Mojang)