Affected Flags |
|||
C | V | N | Z |
* | * |
* | * |
rsr | : read special registers |
wsr | : write special register |
These instructions are used to read and write some special internal registers of the processor. You can read and write into the status flags, program counter, interrupt pending register. * The status flags are not affected by these instruction unless you the wsr instruction to write to the status flag register.
regnum = special internal register number
rx = destination register number
Form | Effect |
rsr.l #regnum,rx |
Special register #regnum -> rx |
wsr.l #regnum,rx |
Special register #regnum <- rx |
Special register |
Effect |
0 |
Processor version and subversion (read only) 16 bits higher : Version 16 bits lower : Subversion |
1 |
Status flag (r/w). Read the page about the status flag register for informations about this register. |
2 | Program counter (r/w) Writing make a jump. Value can be read to make relative adress operations. |
3 | Interrupt pending register (r/w). Each bit is for one of the 16 interrupt levels. A bit set two one mean the interrupt is triggerd. |
4 | Last used index register (r/w). The last used index register contains the 4 bits of the last used index register (with the move instruction). This register is used by the inclr register. The 4 bits of this register are part of the status register. But this command provide more direct access. |
I = Special register number
D = Source register 2
Instruction | Op Code |
Cycles | Encoding |
rsr.l rx | 40 | 6 | 01000000 IIIIDDDD |
wsr.l rx | 80 | 6 | 10000000 IIIIDDDD |
// Example : todo...