UXN is a minimalistic CPU/virtual machine designed by Hundred Rabbits.
Interesting features, coding-paradigm-wise:
UXN
virtual_machineSite
Design
Technical documentation
Sample applications
Sample implementation
Relevant
In category
UXN is a minimalistic CPU/virtual machine designed by Hundred Rabbits.
Interesting features, coding-paradigm-wise:
Vectors
Callbacks that can be configured to execute when an event occurs on a device.
[ 3/7 ] Compudanzas' UXN tutorial
web_pagetutorialA UXN tutorial divided in days. Each day covers a number of concepts and instructions from the VM.
Day 1
Url
Explains the basic concepts of the UXN CPU
CPU
Can handle words of 1 or two bytes
Each instruction is encoded in 1 byte
32 possible instructions + 3 mode flags
Memory
Four separate spaces
main memory
64 Kibibytes
First 256 bytes are "zero page", which can be accessed with 1 byte
Stores the program to be executed, starting at
0x0100
i/o memory
256 bytes divided in 16 sections/devices of 16bytes each
working stack
256 bytes
cannot be accessed randomly
return stack
256 bytes
cannot be accessed randomly
Writes, runs and goes step-by-step describing a "hello-world" program.
Explains [ UXNtal ] concepts
Runes
runes are special characters that indicate to uxnasm some pre-processing to do when assembling our programs.
Absolute pad
|
Pads up elements until a memory position is reached
Literal hex
#
Rewrites #AA
to LIT AA
Raw character
'
Rewrites 'h
to 68
(note that in this case LIT
may be necessary)
Labels
@
and &
to define, .
and /
to use
Can be used to define something like struct-offset macros (difficult to explain in few words).
Macros
%<NAME>
to define, just "<name>" to invoke
Day 2
Shows screen usage
Pixel drawing
Sprite drawing
Runes
Literal absolute
;
Push the address of a @
label to the stack
Day 3
Presents
the @Controller
device
Used to receive keyboard (and game controller) events
Arrow keys and Ctrl are handled by using the .Controller/button
register
control flow mechanisms
bitwise logic
stack manipulation
runes for addresses
.label
literal address in zero page
;label
literal address in main memory
,label
literal relative address in main memory
:label
main addres in main memory
@label
Label definition
&sublabel
Definition of a sublabel
Refer to it as label/sublabel
Or just &sublabel
for local sublabels
Day 4
Presents
How to use the .Screen/vector
to interrupt the program at 60Hz
Stopped at
Day 5
Day 6
Day 7