General registers
There are 32 registers of 32 bits, r0 to r31. r0 always reads as zero and a write to it is lost (the decoder leaves it out of the registers an instruction reads or writes).
The program counter is separate (its bit 0 is fixed to 0, and it is FFFFFFF0H after a reset). The names are those of the NEC manual (U10082EJ1V0UM00, section 2.1.1); the viewer can show them (the option “Register names”). Compiler names for other registers (some tools call r1 fp or r30 ep) are not in the manual and are not used.
| Register | Name | Use |
|---|---|---|
r0 | zero | Always 0 (hardware) |
r1 | Assembler-reserved: the working register for building a 32-bit immediate and for effective addresses (manual: “reserved for address generation”) | |
r2 | hp | Handler stack pointer: reserved as the stack pointer of the handler |
r3 | sp | Stack pointer: stack frames for function calls |
r4 | gp | Global pointer: access to global variables in the data area |
r5 | tp | Text pointer: points to the beginning of the text area |
r6 to r25 | General use (arguments, results, temporaries and saved registers by the compilers’ rules) | |
r26 to r29 | String destination bit offset, string source bit offset, string length, string destination: the bit-string instructions use them (with r30) as their operands, so a program that uses those instructions cannot keep other values in them | |
r30 | String source (the source word address of a bit-string instruction); MUL, MULU put the high word of the product here and DIV, DIVU the remainder; CAXI reads the value to store from it | |
r31 | lp | Link pointer: JAL puts the return address here (hardware) |
System registers
LDSR and STSR name a system register by a 5-bit number. Only the numbers below are defined (manual section 2.2.9); 8 to 23 and 26 to 31 are reserved (“operation is not guaranteed if this is accessed”) and are shown as SRn with the status reserved. ECR, PIR and TKCW cannot be written with LDSR.
| No. | Name | Meaning |
|---|---|---|
| 0 | EIPC | Exception/interrupt PC: the PC saved when an exception or interrupt is taken |
| 1 | EIPSW | Exception/interrupt PSW: the PSW saved with it |
| 2 | FEPC | Fatal-error PC: saved by a duplexed exception (an exception during an exception) and by the NMI |
| 3 | FEPSW | Fatal-error PSW |
| 4 | ECR | Exception cause register: the code of the last exception or interrupt (low half) and of the last fatal one (high half) |
| 5 | PSW | Program status word (below) |
| 6 | PIR | Processor ID, read only |
| 7 | TKCW | Task control word: floating-point control, read only |
| 24 | CHCW | Cache control word: instruction cache enable, clear and dump |
| 25 | ADTRE | Address trap register for execution |
The PSW
| Bit | Name | Meaning |
|---|---|---|
| 0 | Z | Zero |
| 1 | S | Sign |
| 2 | OV | Overflow |
| 3 | CY | Carry (or borrow) |
| 4 | FPR | Floating-point precision degradation |
| 5 | FUD | Floating-point underflow |
| 6 | FOV | Floating-point overflow |
| 7 | FZD | Floating-point divide by zero |
| 8 | FIV | Floating-point invalid operation |
| 9 | FRO | Floating-point reserved operand |
| 12 | ID | Interrupt disable: set by SEI, cleared by CLI |
| 13 | AE | Address trap enable |
| 14 | EP | Exception pending |
| 15 | NP | NMI pending: selects FEPC/FEPSW for RETI |
| 16–19 | I3–I0 | Interrupt enable level: a maskable interrupt of level n is not accepted when n is lower than this field (n < I3–I0), so level 15 cannot be masked this way; taking an interrupt sets the field to n + 1 (15 for level 15) |
Bits 10 and 11 and 20 to 31 are reserved and fixed to 0. The bit positions are from the NEC manual (section 2.2.4) and agree with the Mednafen/Beetle core’s constants (FRO 0x200, FIV 0x100, FZD 0x80, FOV 0x40, FUD 0x20, FPR 0x10). The flag bits 4 to 9 were listed in the opposite order on this page before 2026-11-19; the manual’s order is the one above.
NP = 1 means NMI processing is in progress (NMI is masked and multiple interrupts are disabled); EP = 1 means exception, trap or interrupt processing is in progress (it masks interrupts); AE = 1 enables the address trap; ID = 1 disables maskable interrupts. EIPSW and FEPSW have bits 31 to 20, 11 and 10 fixed to 0, and bit 0 of EIPC and FEPC is fixed to 0.
The other system registers
| Register | Fields (NEC manual 2.2.3 to 2.2.8) |
|---|---|
ECR | bits 31 to 16 FECC: exception code of an NMI or a duplexed exception; bits 15 to 0 EICC: exception code of an interrupt or exception (the codes are in Table 6-1 below). Read only. |
PIR | bits 31 to 16 reserved (0); bits 15 to 4 PT processor type (the register reads 0000810xH on the V810 family); bits 3 to 0 NECRV reserved by NEC. Read only. |
TKCW | Read only and fixed on the V810 family: bit 8 OTM operand trap mask = 0 (trap on a reserved operand); bit 7 FIT = 1 (trap on an invalid operation); bit 6 FZT = 1 (trap on zero division); bit 5 FVT = 1 (trap on overflow); bit 4 FUT = 0 (no trap on underflow); bit 3 FPT = 0 (no trap on precision degradation); bit 2 RDI = 0 (integer conversion rounds as RD says); bits 1 to 0 RD = 00 (round toward nearest). Bits 31 to 9 reserved (0). |
CHCW | The 1 KB instruction cache (128 entries of 8 bytes, direct mapped, 4-byte subblocks). Bits 31 to 8 SA spill-out base address (the high 24 bits of the dump or restore area; reads as 0), which shares its upper bits with bits 31 to 20 CEN clear entry number (the first entry to clear; nothing happens if CEN is 128 or more) and bits 19 to 8 CEC clear entry count (set to 128 if larger); bit 5 ICR instruction cache restore; bit 4 ICD dump; bit 1 ICE enable; bit 0 ICC clear. ICR, ICD, ICE and ICC must not be set together; ICR, ICD and ICC read as 0; bits 7, 6, 3 and 2 are reserved (0). An interrupt during a restore, dump or clear is held until it finishes. |
ADTRE | Bits 31 to 1 TA trap address, bit 0 fixed to 0. An instruction fetch from this address raises the address trap when PSW.AE is 1. |
Exceptions and interrupts
NEC manual chapter 6, Table 6-1. The “restore PC” is the value saved in EIPC (or FEPC): the address of the instruction that raised the exception (“current PC”) or of the next one (“next PC”). Handler addresses are CPU addresses; the ROM end of the Virtual Boy maps to 0xFFFFFFFF.
| Event | Exception code (ECR) | Handler address | Restore PC |
|---|---|---|---|
| Reset | FFF0 | FFFFFFF0 | (EIPC and FEPC undefined) |
| NMI | FFD0 | FFFFFFD0 | next PC (current PC while an aborted-by-interrupt instruction runs) |
| Duplexed exception | the cause of the second exception, in the high half of ECR | FFFFFFD0 (the NMI handler) | current PC |
| Address trap | FFC0 | FFFFFFC0 | current PC |
TRAP, operand 0x1n | FFBn | FFFFFFB0 | next PC |
TRAP, operand 0x0n | FFAn | FFFFFFA0 | next PC |
| Invalid instruction code | FF90 | FFFFFF90 | current PC |
| Zero division | FF80 | FFFFFF80 | current PC |
| FIV floating-point invalid operation | FF70 | FFFFFF60 | current PC |
| FZD floating-point zero division | FF68 | FFFFFF60 | current PC |
| FOV floating-point overflow | FF64 | FFFFFF60 | current PC |
| FUD floating-point underflow | FF62 | FFFFFF60 | current PC (does not occur on the V810 family) |
| FPR floating-point precision degradation | FF61 | FFFFFF60 | current PC (does not occur on the V810 family) |
| FRO floating-point reserved operand | FF60 | FFFFFF60 | current PC |
| Maskable interrupt, level n (0 to 15) | FEn0 | FFFFFEn0 | next PC (current PC for an instruction aborted by the interrupt) |
The instructions an interrupt can abort (Table 6-2) are DIV, DIVU, the floating-point instructions and the bit-string instructions; they restart.
- Exception. If PSW.NP is already set the exception is fatal: the processor halts until reset after writing the cause (FFFF0000H OR the code) to address 0, the PSW to address 4 and the PC to address 8. If PSW.EP is set it is duplexed: FEPC, FEPSW and the high half of ECR are loaded, NP and ID are set, AE is cleared and the NMI handler runs. Otherwise the restore PC goes to EIPC, the PSW to EIPSW, the code to the low half of ECR (EICC), EP and ID are set, AE is cleared, and the handler runs.
- Maskable interrupt. It is masked by NP, EP or ID being set, and refused when its level n is lower than I3–I0. When accepted it is taken as above (EIPC, EIPSW, EICC), and the interrupt level field becomes n + 1 (15 if n = 15).
- NMI. FEPC, FEPSW and FECC are loaded, NP and ID are set, AE is cleared, and the processor jumps to
FFFFFFD0. A second NMI while NP is set is held and started when NP is cleared byRETIorLDSR. - Return.
RETIrestores PC and PSW from FEPC and FEPSW when NP = 1, otherwise from EIPC and EIPSW. - Priority (Table 6-3), highest first: reset, NMI, maskable interrupt, address trap, then TRAP, invalid opcode, zero division and the floating-point exceptions (which do not occur together). Floating-point exceptions rank FRO, FIV, FZD, FOV (Table 6-4). An interrupt is accepted in the last clock of an instruction that takes two or more.
Condition codes
Bits 12 to 9 of a branch, and the low four bits of the SETF operand, choose one of sixteen conditions. The manual names the carry and zero tests two ways (BL/BC, BE/BZ,
BNL/BNC, BNE/BNZ); the viewer’s option “Condition names” picks the spelling. SETF writes T and F for codes 5 and 13, where the branch is BR and NOP.
| Code | Branch | SETF | True when |
|---|---|---|---|
| 0 | BV | V | OV = 1 |
| 1 | BL / BC | L / C | CY = 1 |
| 2 | BE / BZ | E / Z | Z = 1 |
| 3 | BNH | NH | CY = 1 or Z = 1 |
| 4 | BN | N / S | S = 1 |
| 5 | BR | T | always |
| 6 | BLT | LT | S xor OV = 1 |
| 7 | BLE | LE | (S xor OV) or Z |
| 8 | BNV | NV | OV = 0 |
| 9 | BNL / BNC | NL / NC | CY = 0 |
| 10 | BNE / BNZ | NE / NZ | Z = 0 |
| 11 | BH | H | CY = 0 and Z = 0 |
| 12 | BP | P / NS | S = 0 |
| 13 | NOP | F | never |
| 14 | BGE | GE | S xor OV = 0 |
| 15 | BGT | GT | (S xor OV) or Z = 0 |
Not described
See the status page: system registers 8 to 23 and 26 to 31, the exact PSW interrupt-mask field and the reset values of the registers are not covered.