uxn laboratory
As I look to assembly nights 2 and think of trying my own take on it, I wanna have a cozy space ready to play with uxn.
The setup I’ve landed on is sort of inspired by plan9port.
Prepare the way
- in home directory, create a
u
directory - in
u
cloneuxn
and build it - add
~/u/uxn/
to your path as$UXN
- add
$UXN/bin
to your path - moving forward we’ll put any and all
*.rom
files into$UXN/bin
Utility scripts
- create script called
u
that contains the following
#!/bin/sh
UXN=${UXN:-$HOME/u/uxn}
export UXN
case "$PATH" in
$UXN/bin:*)
;;
*)
PATH=$UXN/bin:$PATH
export PATH
;;
esac
case $# in
[1-9]*)
exec "$@"
;;
esac
-
make
u
executable withchmod +x
andmv
it to/usr/local/bin
or some similar space in
$UXN/bin
add the following scripts, make each executable withchmod +x
lin
, used to lint*.tal
files before assembly.
# script name: lin
#!/bin/sh
u uxncli uxnlin.rom $1
asm
, used to assemble*.tal
files into executable*.rom
s.
# script name: asm
#!/bin/sh
u uxnasm $1 $2
run
, used to run*.rom
s in the sdl2 uxn emulator.
# script name: run
#!/bin/sh
u uxnemu $1
cli
, used to run command line*.rom
s into stdin/stdout at the shell prompt.
# script name: cli
#!/bin/sh
u uxncli $1
drif
, an alternate assembler — this one is selfhosted and doesn’t support macros.
# script name: drif
#!/bin/sh
u uxncli drifblim.rom $1 $2
rom library
wget
the followingrom
s into$UXN/bin
wget https://rabbits.srht.site/left/left.rom
wget https://rabbits.srht.site/drifblim/drifblim.rom
rock and roll
At this point everything is set and cozy to start exploring!
Do that like so:
- to lint a
*.tal
file,
u lin rad.tal
- to assemble a
*.tal
file using an assembler that supports macros,
u asm rad.tal rad.rom
- to assemble a
*.tal
file using the selfhosted assembler,
u drif rad.tal rad.rom
- to run a
rom
in the emulator
u run rad.rom
- to run a
rom
at the prompt
u cli rad.rom
- to edit something using left,
u uxnemu left.rom -s 2 rad.tal
NOTE: the -s 2
bit makes the program run zoomed…I’ve got bad eyesight and have a high DPI screen, you may not need that flag.
Onward!
Now, I’ll be honest — I don’t know if I’ll actually do my own flavor of assembly nights with uxn, but I’m really pleased with this little setup…so, that is a step in the right direction. The other step in the right direction I’ve taken is that I started to read Programming from the Ground Up by Jonathan Bartlett…so far, 2 chapters in, I am enjoying it a lot.
Published