XXIIVV

Uxntal Memory

There are 64kb of addressable memory. Roms are loaded at 0x0100, which is the address of the reset vector. During boot, the stacks, device and addressable memories are zeroed, if it is a soft-reboot, the content of the zero-page is preserved.

|18 @width
|100 @on-reset ( -> )
	;buffer/end BRK 02 18
|200 @buffer $width &end

Once in memory, a Uxn program can write over itself, it is not uncommon for a uxntal program to self-modify for storing variables. Memory is big-endian, when writing or reading a short from memory, the position is that of the high-byte. The low-byte of a short written at 0xffff wraps to 0x0000.

#12 #0200 STA 0x0200=12
#3456 #0400 STA2 0x0400=34, 0x0401=56
#0400 LDA 34

The zero-page is the memory located below 0x0100, its purpose is to store variables that will be accessed often, or needs to be preserved across a soft-reboot. It is sligthly faster to read and write from the zero-page using the LDZ and STZ opcodes as they use only a single byte instead of a short. This memory space cannot be pre-filled in the rom prior to initialization. The low-byte of a short written at 0xff wraps to 0x00.

#1234 #80 STZ2 0x0080=12, 0x0081=34
#81 LDZ 34

incoming uxn uxntal syntax uxntal syntax uxntal syntax