Introduction
These change one flag, or several at once (REP, SEP), switch between the two modes (XCE), or do nothing in particular. REP, SEP and XCE are the instructions that change the width of the registers, and therefore the length of the instructions after them.
The instructions
Each form is written mode opcode, bytes, cycles.
| Instruction | Forms | What it does | Flags |
|---|---|---|---|
clc | imp 18, 1, 2 | Clear carry. Before XCE it selects native mode. | C |
cld | imp D8, 1, 2 | Clear decimal mode. | D |
cli | imp 58, 1, 2 | Enable interrupts. | I |
clv | imp B8, 1, 2 | Clear overflow. | V |
sec | imp 38, 1, 2 | Set carry. Before XCE it selects emulation mode. | C |
sed | imp F8, 1, 2 | Set decimal mode. | D |
sei | imp 78, 1, 2 | Disable interrupts. | I |
rep | imm8 C2, 2, 3 | Reset (clear) every status bit that is 1 in the operand: bit 7 N, 6 V, 5 M, 4 X, 3 D, 2 I, 1 Z, 0 C. rep #$30 makes the accumulator and the index registers 16 bits. In emulation mode M and X do not change. | by the operand |
sep | imm8 E2, 2, 3 | Set every status bit that is 1 in the operand. sep #$30 makes both 8 bits (and clears the high bytes of X and Y). | by the operand |
xce | imp FB, 1, 2 | Exchange the carry flag with the emulation flag. clc xce enters native mode, sec xce emulation mode. Entering emulation mode sets M and X, clears the high bytes of X and Y and forces the stack to page one. | C E M X |
nop | imp EA, 1, 2 | Does nothing. | – |
wdm | imm8 42, 2, 2 | Reserved by WDC for future expansion. It is two bytes, skips its signature byte and does nothing, like a two-byte NOP; the explorer marks it reserved. | – |
wai | imp CB, 1, 3 | Wait for an interrupt: stops the processor until an interrupt arrives. With the interrupt flag set it continues at the next instruction when one is requested, without taking it. | – |
stp | imp DB, 1, 3 | Stop the processor until a reset. | – |
Not described
Known, not yet covered
- Reference: how WAI and STP interact with the RDY pin and with the interrupt inputs in detail, which the Super Nintendo does not use.
Links
Reference
- 65816 reference – the Super Famicom Development Wiki’s instruction table
- W65C816S data sheet – Western Design Center