Varvara beginnings
Sunday 2nd August 2026
We have a complete Uxn CPU, now we need some peripherals to model a computer, this is done with Varvara.
Similar to how I defined all the Uxn opcodes in Opcode.kt I've created a Device.kt to hold all the different devices and their ports that live in the device page - the object which has io with the Uxn CPU. So far I've just done the boilerplate:
enum class Device(val address: Int, val deviceName: String, val ports: List<Port>) {
SYSTEM(
address = 0x00,
deviceName = "System",
ports = listOf(
Port(name = "expansion", offset = 0x02),
Port(name = "wst", offset = 0x04),
Port(name = "rst", offset = 0x05),
Port(name = "red", offset = 0x08),
Port(name = "green", offset = 0x0a),
Port(name = "blue", offset = 0x0c),
Port(name = "debug", offset = 0x0e),
Port(name = "state", offset = 0x0f)
)
),
CONSOLE(
address = 0x10,
deviceName = "Console",
ports = listOf(
Port("vector", 0x00),
Port("read", 0x02),
Port("write", 0x08),
Port("error", 0x09)
)
),
SCREEN(
address = 0x20,
deviceName = "Screen",
ports = listOf(
Port(name = "vector", offset = 0x00),
Port(name = "width", offset = 0x02),
Port(name = "height", offset = 0x04),
Port(name = "auto", offset = 0x06),
Port(name = "x", offset = 0x08),
Port(name = "y", offset = 0x0a),
Port(name = "addr", offset = 0x0c),
Port(name = "pixel", offset = 0x0e),
Port(name = "sprite", offset = 0x0f)
)
),
// Audio is four independent channels, one 16-byte block each.
AUDIO0(
address = 0x30,
deviceName = "Audio0",
ports = listOf()
),
AUDIO1(
address = 0x40,
deviceName = "Audio1",
ports = listOf()
),
AUDIO2(
address = 0x50,
deviceName = "Audio2",
ports = listOf()
),
AUDIO3(
address = 0x60,
deviceName = "Audio3",
ports = listOf()
),
CONTROLLER(
address = 0x80,
deviceName = "Controller",
ports = listOf(
Port("vector", 0x00),
Port("button", 0x02),
Port("key", 0x03)
)
),
MOUSE(
address = 0x90,
deviceName = "Mouse",
ports = listOf(
Port("vector", 0x00),
Port("x", 0x02),
Port("y", 0x04),
Port("state", 0x06),
Port("scrollx", 0x0a),
Port("scrolly", 0x0c)
)
),
FILE_A(
address = 0xa0,
deviceName = "FileA",
ports = listOf()
),
FILE_B(
address = 0xb0,
deviceName = "FileB",
ports = listOf()
),
DATETIME(
address = 0xc0,
deviceName = "Datetime",
ports = listOf()
);
...
}