Thursday | 21 NOV 2024
[ previous ]
[ next ]

Uxn - Day 2

Title:
Date: 2023-01-06
Tags:  

Another day!

https://compudanzas.net/uxn_tutorial_day_2.html

The final code as of day 2:

( day2 )

( 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 ]

( macros )
%DRAW-PIXEL { #41 .Screen/pixel DEO }
%INC-X { .Screen/x DEI2 INC2 .Screen/x DEO2 }
%DRAW-LINE {
    .Screen/y DEO2
    .Screen/x DEO2
    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 {
    .Screen/y DEO2
    .Screen/x DEO2
    .Screen/addr DEO2
    #01 .Screen/sprite DEO
}

( main )

|0100
#2ce9 .System/r DEO2
#01c0 .System/g DEO2
#2ce5 .System/b DEO2

#0008 #0030 DRAW-LINE

;square #0005 #0005 DRAW

;character #0010 #0010 DRAW

;new-square #0036 #0036 DRAW

;flower #0045 #0045 DRAW

BRK

@square ff81 8181 8181 81ff
@character 3c7e 5a7f 1b3c 5a18
@new-square  017f 7b73 6343 7fff 007c 7c7c 7c7c 0000
@flower 9942 2499 9924 4299

I need to really wrap my head around all this byte and low level hackery. It all feels magical. The tutorial is definitely good and I can see what the aim is. I like how the author is building from tiny steps to a larger thing but it's just not meshing.

Usually at this point I would change the tutorial and find something else that might help but with uxn there isn't enough content for that. I'll need to continue struggling through and hopefully something will click.

I am getting the stack machine concept and chaining things. I can also see the abstractions being created.

Nasu is cool but I still don't get it. I made a tiny little image and got that into my rom so I'm happy :)