💾 Archived View for diesenbacher.net › blog › entries › rabbit-hole-uxntal.gmi captured on 2024-05-10 at 10:37:36. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
The uxn-virtual machine can be programed in [uxntal], a forth-oriented assembler. If you ever did some assembler in the 8-bit era, f.e. 6502 on the C64, you'll be into it in some hours. You'll find also a nice [tutorial] at compudanzas site.
Ahhh, so much fun to write in assembler again, haven't done this for about 30 years. In the distant past I got some experience in 6502 on the Commodore 64 ($a9 LDA, $8d STA, will never forget these opcodes) and also the 68000, which I programmed at the Amiga. Never will forget [AMIGA Maschinensprache] (German), my first intro into Assembler with Amiga.
Uxnasm, the assembler offers a lot of functionality: macros and an extensive way to handle labels. There exists [uxnasm] in C for your host system, but also a bare-metal versions [asma.tal] and [drifblim], these run on uxn itself. And - of course - there are various emacs-modes with syntax highlight for uxntal and other functionalities. I chose [uxntal-mode], as I like simply hitting C-x C-e to compile and start a rom.
What I would love to have, is also org-babel support for uxncli.
See below, my first uxntal progam, printing hexvalues from the stack.
( print-bytes.tal ) ( devices ) |10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ] ( macros ) %EMIT { .Console/write DEO } ( char -- ) %NL { #0a EMIT } ( -- ) %BLANK { #20 EMIT } ( -- ) %QUIT { #010f DEO } ( -- ) |0100 #9f ;print-byte JSR2 BLANK #aa ;print-byte JSR2 NL #1234 ;print-short JSR2 NL QUIT BRK ( prints a short on stack ) @print-short ( short -- ) SWP ,print-byte JSR ,print-byte JSR JMP2r ( prints a byte on stack ) @print-byte ( byte -- ) DUP #04 SFT ,&print-nibble JSR #0f AND ,&print-nibble JSR JMP2r &print-nibble #30 ADD DUP #3a LTH ,&output JCN #07 ADD &output EMIT JMP2r
Just some ideas, what I would like to do with that stuff, if there weren't that many time constrains …
Not only uxn is interesting, the creators behind uxn, who started the project AFAIU, are very intersting people. Since 2016 they live on a sail boat. Have a look at their [site] and [wiki]. Everything they publish is real artists work. I enjoy just having a look at their websites and projectsdescriptions.