--- Title: Uxn - Day 7 Date: 2023-01-08 Sequence: 4 Tags:  ---
The last day!
This was a light day that quickly went over the remainder of the devices. This was the file devices, the datetime device and the audio devices. I played around with the file device and that seems straightforward to use but I'll need to practice with it as the first thing I want to do is build an editor in uxn because I think that would be fun.
I tried the datetime device but when writing to the console I think I'm write the raw byte when really I want the ascii representation so I'll need to look at how to do that. So far I've only used the `LIT` opcode to print things.
The audio devices look cool but I haven't played around with them yet.
Overall this tutorial was really good and I'm happy that I stuck with it through the first few days that were slower. I'll need to build something with uxn before I can really think about if this was useful or not. It was an interesting and fun diversion though.
The final code that I wrote the tutorial:
( day 7 ) ( devices ) |10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ] |a0 @File0 [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ] |b0 @File1 [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ] |c0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ] ( main ) |0100 ;file/name .File0/name DEO2 #0006 .File0/length DEO2 ;file/read-data .File0/read DEO2 .File0/success DEI2 #0000 EQU2 ,&failed JCN &pass LIT "Y .Console/write DEO ,&end JMP &failed LIT "N .Console/write DEO ,&end JMP &end BRK @file &name "test.txt 00 &read-data ff