Thread with 30 posts

jump to expanded post

these last few weeks, @lynn and me have been working on a c compiler for uxn, based on rui ueyama's โ€œchibiccโ€. it's been a lot of fun! it's such a cute little vmโ€ฆ assembly for this tiny stack machine involved so many little puzzles.

i made a demo https://github.com/lynn/chibicc/blob/uxn/examples/star.c :3

Open thread at this post

writing c code with this compiler also involves a lot of problem solving. there's no floats, no 32-bit integers, almost no C runtime, and only 64KiB of ROM space. the compiler can't do much optimisation of your code. you'll have to be creative!

related: https://social.noyu.me/@hikari/statuses/01H2G44V6QJ7BB9Y3J25QCEPB8

Open thread at this post

i am pleased to announce oneko-uxn: a port of oneko-sakura to #uxn. this is a version of the classic software โ€Nekoโ€! ๐Ÿˆ๐Ÿ–ฑ

https://github.com/hikari-no-yume/oneko-uxn

ๆ—ฅๆœฌ่ชž็‰ˆใ‚‚ๆœ‰ใ‚Šใพใ™ใ€‚

this all was made possible with chibicc-uxn, the c compiler for uxn that @lynn and i have worked on together.

have fun!

Open thread at this post

i found a bug in oneko-uxn: the 16-bit Euclidean distance calculation can overflow even for 8-bit inputs :(

but @lynn found a great alternative: the average of the L1 norm and Lโˆž norms is within ~6% of the Euclidean distance, and way easier to compute!

https://github.com/hikari-no-yume/oneko-uxn/commit/060bc664e647e3ea6d1362fa5d882c1d1b95a87c

Open thread at this post

@cr1901 @lynn

0 โ‰ค x โ‰ค 2ฯ€

cx = cos(x)
sx = sin(x)

i plot a point at (cx, sx)

interpreting (cx, sx) as a vector from (0, 0), the euclidean distance is always going to be 1, right

i then calculate the same distance with our approximation, and plot a point at (cx * distance, sx * distance)

so the red line shows how far it strays from euclidean distance at various angles

Open thread at this post

@cr1901 @lynn you can see that at 0ยฐ, 90ยฐ, 180ยฐ and 270ยฐ, there's no difference, which should be intuitive considering that these are exactly the directions for which euclidean distance, L1/manhattan distance and Lโˆž/chebyshev distance are identical, so an average of these last two should be the same as the first of these

Open thread at this post

@neauoire @lynn wow, that's some coincidence! but to be honest i was slightly surprised when i couldn't find an existing port to uxn. it felt obvious, hehe. I'm glad you like it!

my first exposure to Neko was playing a PalmOS port of it as a kid, around two decades ago, so i've had a lifelong fondness for it at this point.

Open thread at this post