Skip to content

Instantly share code, notes, and snippets.

@Ismael-VC
Ismael-VC / hello_world.tal
Created March 25, 2023 00:26
Hello World in Uxntal.
%RTN { JMP2r }
%EMIT { #18 DEO }
%HALT { #010f DEO }
%\0 { 00 }
%\s { 20 }
%\n { 0a }
|0100 ( init )
;hello-word print-str
HALT
@Ismael-VC
Ismael-VC / Material-Theme.sublime-color-scheme
Last active September 15, 2022 06:59
Uxntal Sublime Text 4 Syntax Definition and Color Scheme for Material Theme Dark.
{
"name": "Uxntal Material Color Scheme",
"variables": {
"pink": "#f07178",
"green": "#c3e88d",
"dark_green": "#009688",
"blue": "#82aaff",
"pale_blue": "#B2CCD6",
"aqua": "#7af8ca",
"red": "rgb(255,83,112)",
@Ismael-VC
Ismael-VC / blank.tal
Created September 13, 2022 23:39
Uxntal empty file template.
( a blank file )
|00 @System [ &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 &func $1 ]
@Ismael-VC
Ismael-VC / fib-seq.tal
Created June 28, 2022 15:06
8-bit fibonacci sequence
%CALL { JSR2 }
%RTN { JMP2r }
%NOT { #01 EOR }
%DEBUG { #01 #0e DEO }
|0100 @main
#00
&while
DUPk
#0d GTH NOT ,&body JCN
@Ismael-VC
Ismael-VC / fib.tal
Created June 27, 2022 13:23
8-bit fibonacci in Uxntal.
%CALL { JSR2 }
%RTN { JMP2r }
%NOT { #01 EOR }
%DEBUG { #01 #0e DEO }
|0100
( DEBUG )
#0d ;fib CALL
#e9 EQU
BRK
@Ismael-VC
Ismael-VC / pong.tal
Created June 26, 2022 01:24
Pong in Uxntal
( pong.tal )
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &auto $1 &pad $1
&x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|80 @Controller [ &vector $2 &button $1 &key $1 ]
( macros )
%RTN { JMP2r }
@Ismael-VC
Ismael-VC / spr.tal
Last active June 21, 2022 18:20
SPR Uxntal Macro
(
SPR - Display a sprite to the screen.
Arguments:
@sprite (label)
x* (short) x coordinate
y* (short) y coordinate
mode (byte) display mode
(
uxnasm projects/examples/demos/snake.tal bin/snake.rom && uxnemu bin/snake.rom
)
%CALL { JMP2 }
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
(
uxnasm projects/examples/demos/snake.tal bin/snake.rom && uxnemu bin/snake.rom
)
%CALL { JMP2 }
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
@Ismael-VC
Ismael-VC / uxn64.c
Created December 18, 2021 17:23
Uxn 64x64 Icon
/* GIMP RGBA C-Source image dump (uxn64.c) */
static const struct {
unsigned int width;
unsigned int height;
unsigned int bytes_per_pixel; /* 2:RGB16, 3:RGB, 4:RGBA */
unsigned char pixel_data[64 * 64 * 4 + 1];
} uxn64 = {
64, 64, 4,
"\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"