Voja4 Memory Map
The Voja4 has two separate address spaces: a 256-nibble data space and a 4096-word code space. Neither is byte-addressed from the CPU’s point of view. Sources: the upstream User Manual (programmer’s model, pp. 18-20), SFR manual, and Instruction Set.
Data memory (0x00-0xFF)
Data memory is 256 x 4 bits, organized as 16 pages of 16 nibbles. It cannot be expanded.
Range |
Size |
Use |
|---|---|---|
|
16 |
Page 0: R0-R9 and the fixed registers/SFRs |
|
15 |
Hardware subroutine stack, 5 return addresses x 3 nibbles |
|
1 |
Free; always available as RAM (not part of the stack) |
|
208 |
General-purpose data RAM ( |
|
16 |
Page 15: control/status SFRs |
0x20-0xEF is the general RAM area: 208 nibbles.
0xE0-0xEF is the alternate register set used by EXR N; those 16 nibbles
remain addressable, but EXR overwrites them.
Page 0: registers and fixed SFRs
Addr |
Name |
Meaning |
|---|---|---|
|
|
Accumulator; the only register usable for data-memory loads/stores |
|
|
General purpose |
|
|
General purpose |
|
|
General purpose |
|
|
General purpose |
|
|
General purpose |
|
|
General purpose |
|
|
General purpose |
|
|
General purpose |
|
|
General purpose |
|
|
Output latch when |
|
|
Input port when |
|
|
Low nibble of a subroutine target; a write triggers the call |
|
|
Low nibble of a jump target; a write triggers the jump |
|
|
Middle PC nibble/bits 7..4 |
|
|
High PC nibble/bits 11..8 |
IOPos is WrFlags bit 1. Setting it moves the output/input latches to
0xFA/0xFB and frees R10/R11 as general registers; the OUT/IN names at
0x0A/0x0B then refer to R10/R11, not the connector.
Only MOV RX,RY, MOV RX,#N, INC RY and DEC RY with JSR/PCL as the
destination trigger a call/jump. An absolute store such as MOV [0x0D],R0 writes
the PCL latch without branching.
Board-level names for the output and input bits are in Board constants.
Hardware stack (0x10-0x1E)
Item |
Value |
|---|---|
Stack pointer |
3-bit, not readable by the program |
Depth |
5 levels, at SP 0-4; SP reads 5 when the stack is full |
Frame size |
3 nibbles |
Address |
|
Push order |
PC bits 3..0 at base, bits 7..4 at base+1, bits 11..8 at base+2 |
Overflow |
6th nested call: fatal, SP indicator blinks |
Underflow |
|
The stack is cleared to SP=0 on RUN/BREAK. There are no PUSH/POP
instructions; the only way to push is a write to JSR, and the only way to pop
is RET R0,#N. 0x1F is not part of the five frames and is free for data.
One manual sentence says each return address takes “4 nibbles” (User Manual p. 20),
but every diagram and the RET/JSR descriptions use 3 nibbles, and 5 x 3 = 15,
matching 0x10-0x1E. The 3-nibble model is correct.
Page 15: special function registers
All are data-memory locations and are accessed with MOV [NN],R0 /
MOV R0,[NN]. Reset values are the documented defaults; RUN clears most state.
Addr |
Name |
Bits (3..0) |
Reset |
Function |
|---|---|---|---|---|
|
|
|
|
Selects the data-memory page shown on the right half of the LED matrix |
|
|
|
|
CPU clock divider index; 0 = fastest (~250 kHz), 15 = 0.5 Hz |
|
|
|
|
User-sync divider index; sets the |
|
|
|
|
Display and I/O routing control |
|
|
reserved, reserved, |
|
Status flags; reading clears |
|
|
|
|
UART error flag and baud rate; reset 9600 |
|
|
|
|
UART low nibble; read/write have different meanings |
|
|
|
|
UART high nibble; read/write have different meanings |
|
|
|
|
Number of unread bytes, 0-14, 15 = “15 or more” |
|
|
|
|
10-minute down-counter; 0 enters SLEEP |
|
|
|
|
Output latch when |
|
|
|
|
Input port when |
|
|
|
|
Debounced key status; reading clears |
|
|
|
|
Number of the last pressed key (0-13) |
|
|
|
|
LED PWM duty; |
|
|
|
random |
4-bit PRNG output; each read advances the LCG; writing reseeds ( |
SFR access from Niblick
Every page-15 SFR has a typed helper in lib/, and peek/poke can reach
any data address directly when a raw access is needed.
SFR |
Address |
Public Niblick API |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Page 0’s fixed registers are different: OUT/IN at 0x0A/0x0B are
reached through out(), in(), gpio_read, and gpio_write; JSR, PCL,
PCM, and PCH are driven by calls, jumps, and returns rather than by a
typed API. Inline assembly can access them when needed.
WrFlags (0xF3)
Bit |
Name |
0 |
1 |
|---|---|---|---|
3 |
|
ALU panel LEDs enabled |
ALU panel LEDs off (CLK/nCLK stay on) |
2 |
|
LED matrix enabled |
LED matrix off |
1 |
|
|
|
0 |
|
UART on SAO connector |
UART on main I/O connector; SAO Rx inactive |
WrFlags is reset to 0 on every RUN and BREAK.
RdFlags (0xF4)
Bit |
Name |
Meaning |
|---|---|---|
3-2 |
reserved |
Read as 0 |
1 |
|
Copy of the signed-overflow flag from the adder |
0 |
|
Set by the |
KeyStatus (0xFC)
Bit |
Name |
Meaning |
|---|---|---|
3 |
|
ALT is pressed (debounced, 5 ms) |
2 |
|
Any key except ALT/ON-OFF is pressed |
1 |
|
The key named in |
0 |
|
A key was pressed since the last read; read clears it |
The matrix is 16 rows x 8 columns, arranged as two 16x4 pages side by side, so two pages (32 nibbles) are visible at once:
Page+1 (left half) Page (right half)
bit 3 2 1 0 (one nibble per row) bit 3 2 1 0
addr (Page+1)*16 + 0 -> top row addr Page*16 + 0 -> top row
addr (Page+1)*16 + 15 -> bottom row addr Page*16 + 15 -> bottom row
The selected page is on the right, Page+1 on the left. If Page=15, the left
half wraps to page 0, showing page 0 and the SFR page together. Bit 3 is the
left column of a nibble, bit 0 the right column. Page resets to 0 on RUN.
In SS mode, ALT forces pages 0 and 1 to be displayed.
Reset/default state at RUN
RUN/BREAK clears the whole data memory and resets most control state:
Item |
Value at RUN |
|---|---|
Data memory |
all zeros |
Stack pointer |
0 |
|
0 |
|
0 (fastest) |
|
0 |
|
0 |
|
|
|
|
|
|
PC |
|
This means .bss is zero-initialized for free on the first RUN, and Clock,
Page, etc. do not retain values from a previous run.
Code memory (0x000-0xFFF)
Item |
Value |
|---|---|
Size |
4096 words x 12 bits |
Address range |
|
PC width |
12 bits |
Reset/run entry |
|
Interrupt vectors |
none |
Writable at run time |
no |
Addressing |
absolute 12-bit via |
The program loader loads a .hex image sequentially starting at word 0; the file
format has no per-record address. ORG only inserts padding so a later word lands
at a chosen address. The ORG fill value is 0x000 (CP R0,0), not a NOP.
Because code and data are separate, a 12-bit value is not a data pointer and an 8-bit data address is not a code address. See Runtime ABI for the compiler’s pointer conventions.