« Oatmeal

uxn exit

This evening I sat down on the couch sleepy. We’d just gotten the kids into bed. I hadn’t planned on writing any code but figured I’d round the evening out with some reading.

First I read through the docs and glossary of uf, a forth system for uxn. Then I read through an example program provided by uf.

…with my palette whetted I re-visited some other forth documentation.

Then I put things down and did the dishes. After doing the dishes I found myself back at a keyboard ready to write some code.

My first thought was to re-implement the unix command cat in uxntal. After a bit of noodling I decided to go with echo instead of cat. I banged away at echo for a bit but then remembered the very first program demonstrated in a book I’m currently reading, Programming from the Ground Up, by Jonathan Bartlett. The first sample program there is one that exits. That is about it.

Exiting felt achievable.

Here is a teeny tiny program that prints the string Hello Uxn! and then exits.

( exit )

|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1

|0100 ( -> )

    ( print hello )
    ;hello-txt

    &while
        LDAk .Console/write DEO
        INC2 LDAk ,&while JCN
    POP2

    ( exit )
    #010f DEO

BRK


@hello-txt "Hello 20 "Uxn! $1

It isn’t much, but it is a start.

Some handy resources I poured over over this evenings explorations include:

Also, big thanks to Devine Lu Linvenga, a primary force behind uxn, for pointing me in the right direction and suggesting some optimizations.

I’m not sure if I’ll have it in me to write code every night moving forward, but this was a lot of fun and I still have big dreams for a homespun cat.tal