A symbol representing the blue rose.

Uxn

The Uxn ecosystem is a personal computing playground, created to host small tools and games, programmable in its own unique assembly language.

It was designed with an implementation-first mindset with a focus on creating portable graphical applications, the distribution of Uxn projects is akin to sharing game roms for any classic console emulator.

Links

XXIIVV: Uxn
Compudanzas Uxn Tutorial
Learn Uxn in Y minutes
Rostiger's Uxn Illustrations
Eli's Opinionated Uxn Setup
Awesome Uxn

Rostiger's notes, textified!

Below are some WIP text adaptations of Rostiger's Uxn notes.

Binary Encoding

bit:
either 0 or 1

nibble (4 bits):
0010

byte (2 nibbles):
0: 0110
1: 0001

short (2 bytes):
0: 1111
1: 1001
a: 1001
4: 1111

binary to hex conversion:
0000 > 0    1000 > 8
0001 > 1    1001 > 9
0010 > 2    1010 > a
0011 > 3    1011 > b
0100 > 4    1100 > c
0101 > 5    1101 > d
0110 > 6    1110 > e
0111 > 7    1111 > f

The CPU

At the heart of Uxn is the CPU.
It is said to be a *beet*.
The beet performs operations
with instructions written in TAL.

The 32 Opcodes are instructions
that Uxn can perform.
Each instruction is encoded
in a single 8-bit word.

+-------+
|0 0 1 0| <- Instruction
| +-----+
|0|0 0 0| <- Flags
+-------+

Memory

Main Memory (64kb):
Each byte in the main memory
has an address of 16 bits.

The zero page is for data
storage during runtime and
can be addressed by 8 bits.

I/O Memory (256b):
Varavara takes care of all
devices, such as:
- screen
- mouse
- keyboard
- audio
- filesytem
and more!

Each byte stores the address
of a device, and each device 
has 16 ports.

The Stack

The 256b stack is used to perform
code operations.

Runes, Labels, and Macros

Runes are special characters
that indicate element types of TAL:

% Macro              # Literal Hex
| Absolute Pad       $ Relative Pad
@ Label              & Sublabel
. Zero Page Address  , Relative Address
; Absolute Address   : Raw Address
' Raw Char           " Raw Word

Labels provide a readable link
to devices and their ports.

Macros are custom definitions
that allow grouping and reusing
instructions.

The Instruction Cycle

The Uxn CPU reads one byte at
a time from the main memory.

|0100 LIT 68 LIT 18 DEO

|       Absolute pad
0100    Main memory address
LIT     "Literal" instruction
68      Byte (hex code for the letter "h")
LIT
1       Device 1: standard I/O
8       Port 8: write
DEO     "Device Out" instruction

Arithmetics

[#01 #a4 ADD]{a5
[#a9 #24 SUB]{85
[#02 #36 MUL]{6c
[#fd #1a DIV]{09

To calculate shorts,
use the short flag.

Short mode addition:
[#0241 #1320 ADD2]{1561

Bitwise Shifting

Bitwise shifting moves a bit
to the left or to the right.

It can be used for
multiplications 
or divisions!

28: 00101000
      > >
14: 00010100