It's always exciting to get something working, and so I was really chuffed to day: Funktal is finally so far that I could implement the Uxn DVD Bounce demo, and it works! Here is a short video.
#Funktal #Uxn
@wim_v12e What's up with the underflow errors? 🤔
@csepp I have no idea. It's caused by the handler for the clock event (Screen/vector in Uxntal) but even if it is totally empty, it still gives this underflow.

@csepp OK, I've got it. It's because the vector doesn't have anywhere to return to. Currently there is no difference between an event handler and an ordinary function, so all functions end with a JMP2r. For a vector it should be BRK. Not sure how to address this.

@neauoire

@wim_v12e @csepp main should brk, and everything else should return.

@neauoire The dvd.tal demo has a BRK for on-frame, and I think that is what it should be. With a JMP2r, it would try to get a value from the RST but there is nothing there because for vectors there is no JSR. That's what was wrong with my code.

So what I've done is added a new function, `done`, which simply emits as BRK.

@csepp

@wim_v12e you implemented devices! Well done :D

For anyone looking for the ftal sources: https://codeberg.org/wimvanderbauwhede/funktal/src/branch/main/examples/dvd.ftal

funktal

A small compiler implemented in Fortran for a statically typed functional language running on Uxn.

Codeberg.org

@neauoire Yes, it's generic so it will work for all devices. I'm very happy I got it to work!

I am puzzled that I get "Return stack underflow" , even if the vector is a totally empty routine.
Have you encountered that before?