commit 6b0515895f42ba7053770a0121e4ad159efcba4b
Author: thing1 <thing1@seacrossedlovers.xyz>
Date: Tue, 12 May 2026 17:40:32 +0100
init commit
Diffstat:
9 files changed, 309 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,2 @@
+*.sym
+*.rom
diff --git a/day2.tal b/day2.tal
@@ -0,0 +1,39 @@
+|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
+
+%HALF { #01 SFT } ( number -- number/2 )
+%HALF2 { #01 SFT2 } ( number -- number/2 )
+%WIDTH { .Screen/width DEI2 }
+%HEIGHT { .Screen/height DEI2 }
+
+%COLOR { #42 }
+
+|0100
+ #2ce9 .System/r DEO2
+ #01c0 .System/g DEO2
+ #2ce5 .System/b DEO2
+
+ #00a4 .Screen/x DEO2
+ #00a4 .Screen/y DEO2
+
+
+ COLOR [ WIDTH HALF2 #0004 SUB2 ] #0000 ;arrow stamp
+ COLOR [ WIDTH HALF2 #0004 SUB2 ][ HEIGHT #0008 SUB2 ] ;arrow stamp
+ COLOR [ #0000 ] HEIGHT HALF2 ;arrow stamp
+ COLOR [ WIDTH #0008 SUB2 ] HEIGHT HALF2 ;arrow stamp
+
+ COLOR [ WIDTH #0004 SUB2 ] HALF2 HEIGHT HALF2 ;rock stamp
+BRK
+
+@stamp ( color x y sprite* -- )
+ .Screen/addr DEO2
+
+ .Screen/y DEO2
+ .Screen/x DEO2
+
+ .Screen/sprite DEO
+JMP2r
+
+
+@arrow [ 0102 0488 d0e0 f0f8 ]
+@rock [ 3c4e 9ffd f962 3c00 ]
diff --git a/draw-with-keyboard.tal b/draw-with-keyboard.tal
@@ -0,0 +1,67 @@
+( draw-with-keyboard.tal )
+( devices )
+|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
+|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite ]
+|80 @Controller [ &vector $2 &button $1 &key $1 ]
+
+( main program )
+|0100
+ ( set system colors )
+ #2ce9 .System/r DEO2
+ #01c0 .System/g DEO2
+ #2ce5 .System/b DEO2
+
+ ( assign controller vector )
+ ;on-controller .Controller/vector DEO2
+
+ ( set initial x,y coordinates )
+ #0008 .Screen/x DEO2
+ #0008 .Screen/y DEO2
+ ( set sprite address )
+ ;square .Screen/addr DEO2
+BRK
+
+@on-controller ( -> )
+ .Controller/button DEI DUP ( read and duplicate button byte )
+ #01 AND ( isolate bit 0, corresponding to Ctrl )
+ ,&fill JCN ( if the bit is not 0, jump to fill, otherwise continue )
+
+ &outline
+ #01 .Screen/sprite DEO ( draw outline )
+ ,&check-arrows JMP ( continue to check-arrows )
+
+ &fill
+ #04 .Screen/sprite DEO ( draw filled )
+
+ &check-arrows
+ ( use button byte from the stack )
+ DUP #10 AND ( isolate bit 4, corresponding to Up )
+ ,&up JCN ( jump if not 0 )
+ DUP #20 AND ( isolate bit 5, corresponding to Down )
+ ,&down JCN ( jump if not 0 )
+ DUP #40 AND ( isolate bit 6, corresponding to Left )
+ ,&left JCN ( jump if not 0 )
+ DUP #80 AND ( isolate bit 7, corresponding to Right )
+ ,&right JCN ( jump if not 0 )
+
+ POP BRK
+
+ &up
+ .Screen/y DEI2 #0008 SUB2 .Screen/y DEO2 ( decrement y )
+ POP
+ BRK
+ &down
+ .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 ( increment y )
+ POP
+ BRK
+ &left
+ .Screen/x DEI2 #0008 SUB2 .Screen/x DEO2 ( decrement x )
+ POP
+ BRK
+ &right
+ .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( increment x )
+ POP
+ BRK
+BRK
+( sprite )
+@square ff81 8181 8181 81ff
diff --git a/hello-keyboard.tal b/hello-keyboard.tal
@@ -0,0 +1,34 @@
+( hello-keyboard.tal )
+
+( devices )
+|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
+|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
+|80 @Controller [ &vector $2 &button $1 &key $1 ]
+
+( main program )
+|0100
+ ( set system colors )
+ #2ce9 .System/r DEO2
+ #01c0 .System/g DEO2
+ #2ce5 .System/b DEO2
+
+ ( assign controller vector )
+ ;on-controller .Controller/vector DEO2
+BRK
+
+( run this code whenever a key is pressed or released )
+@on-controller ( -> )
+ ( set x,y coordinates )
+ #0008 .Screen/x DEO2
+ #0008 .Screen/y DEO2
+
+ ( set sprite address )
+ ;square .Screen/addr DEO2
+
+ ( draw sprite in the background )
+ ( using color 1 for the outline )
+ #01 .Screen/sprite DEO
+BRK
+
+( sprite )
+@square ff81 8181 8181 81ff
diff --git a/hello-screen.tal b/hello-screen.tal
@@ -0,0 +1,90 @@
+|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
+
+%PIXEL {
+ .Screen/y DEO2
+ .Screen/x DEO2
+ .Screen/pixel DEO
+ } ( p x y -- )
+%DRAW-PIXEL { #41 .Screen/pixel DEO } ( -- )
+
+%INC-X { .Screen/x DEI2 INC2 .Screen/x DEO2 } ( -- )
+
+%ADD-X { .Screen/x DEI2 ADD2 .Screen/x DEO2 } ( INC -- )
+
+%DRAW-LINE { DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X DRAW-PIXEL INC-X }
+
+
+
+|0100
+
+ #2ce9 .System/r DEO2
+ #01c0 .System/g DEO2
+ #2ce5 .System/b DEO2
+
+ #00a4 .Screen/x DEO2
+ #00a4 .Screen/y DEO2
+
+ #f7 .Screen/auto DEO
+ #0100 .Screen/addr DEO2
+
+ #42 .Screen/sprite DEO
+BRK
+
+@arrow [ 0102 0488 d0e0 f0f8 ]
+@rock [ 3c4e 9ffd f962 3c00 ]
+@character [ 3c7e 5a7f 1b3c 5a18 ]
+
+@lil-guy
+[
+00 00 00 00 01 03 06 04
+00 00 00 00 00 00 00 00
+00 00 00 00 80 80 e0 30
+00 00 00 00 00 00 00 00
+00 00 00 00 00 07 04 0c
+00 00 00 00 00 00 00 00
+00 00 00 00 00 c0 40 60
+00 00 00 00 00 00 00 00
+0c 18 10 10 30 20 60 47
+00 00 00 00 00 00 00 00
+10 1f 00 00 00 00 03 02
+00 00 00 00 00 00 00 01
+18 f0 30 00 00 00 00 40
+00 00 00 00 00 00 00 80
+20 30 10 10 18 08 08 08
+00 00 00 00 00 00 00 00
+00 00 01 03 06 04 04 0c
+00 00 00 00 00 00 00 00
+00 00 00 80 80 c0 60 30
+00 00 00 00 00 00 00 00
+c5 85 87 80 80 c0 40 40
+02 02 00 00 00 00 00 00
+02 02 01 00 00 7e 03 00
+01 01 00 00 00 00 00 00
+60 60 80 00 08 38 e0 00
+80 80 00 00 00 00 00 00
+08 08 08 08 09 0f 04 04
+00 00 00 00 00 00 00 00
+08 18 30 e1 83 02 06 04
+00 00 00 00 00 00 00 00
+30 60 c0 80 00 00 00 00
+00 00 00 00 00 00 00 00
+40 40 60 20 20 20 20 30
+00 00 00 00 00 00 00 00
+00 00 00 00 00 7c 47 40
+1d 15 04 00 00 00 00 00
+00 00 00 00 00 78 c8 08
+80 c0 40 20 00 00 00 00
+04 04 04 0f 04 0c 08 08
+00 00 00 00 00 00 00 00
+0c 18 70 c0 00 00 00 00
+00 00 00 00 00 00 00 00
+18 0f 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+c0 80 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+08 0f 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+08 f8 60 00 00 00 00 00
+00 00 00 00 00 00 00 00
+]
diff --git a/hello.tal b/hello.tal
@@ -0,0 +1,8 @@
+|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
+
+%EMIT { .Console/write DEO } ( char -- )
+%NL { #0a EMIT } ( -- )
+
+|0100
+ LIT "o LIT "l LIT "l LIT "e LIT "h
+ EMIT EMIT EMIT EMIT EMIT
diff --git a/printdigit.tal b/printdigit.tal
@@ -0,0 +1,3 @@
+%PRINT-DIGIT { LIT 30 ADD LIT 18 DEO }
+
+|0100 LIT 07 PRINT-DIGIT
diff --git a/run.sh b/run.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+uxn11 ~/roms/uxnasm.rom $1.tal $1.rom && uxn11 $1.rom
diff --git a/screen.tal b/screen.tal
@@ -0,0 +1,62 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ <title>git.sr.ht</title>
+
+
+ <link rel="icon" type="image/svg+xml" href="/static/logo.svg" />
+ <link rel="icon" type="image/png" href="/static/logo.png" sizes="any" />
+
+ <link rel="stylesheet" href="/static/git.sr.ht/main.min.8d3964dc.css">
+
+
+
+
+ </head>
+ <body>
+
+
+
+
+ <nav class="container navbar navbar-light navbar-expand-sm">
+
+<span class="navbar-brand">
+ <span class="icon icon-circle " aria-hidden="true"><svg width="22" height="22" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z"/></svg>
+</span>
+ <a href="https://sr.ht">
+ sourcehut
+ </a>
+</span>
+
+<ul class="navbar-nav">
+
+</ul>
+<div class="login">
+
+ <span class="navbar-text">
+
+ <a href="https://meta.sr.ht/login?return_to=https%3A%2F%2Fgit.sr.ht%2F~rabbits%2Fuxn%2Ftree%2Fmain%2Fitem%2Fprojects%2Fexamples%2Fdevices%2Fscreen.tal%3F" rel="nofollow">Log in</a>
+ —
+ <a href="https://meta.sr.ht">Register</a>
+
+ </span>
+
+</div>
+ </nav>
+
+
+<div class="container">
+ <h2>404 Not Found</h2>
+ <p>
+ Whatever you're looking for, it isn't here.
+ <a href="/">Index <i class="fa fa-caret-right"></i></a>
+ </p>
+</div>
+
+
+
+ </body>
+</html>
+\ No newline at end of file