randrew / uxn32

Uxn emulator for Windows and Wine
169 stars 7 forks source link

UF Forth: unknown machine error #18

Closed farvardin closed 12 months ago

farvardin commented 12 months ago

I've tried to load ufx.rom into uxn32, and I get this error: "unknown machine error" (it's an error message from the rom itself).

You can get uf.rom from http://www.call-with-current-continuation.org/uf/uf.html (and compile ufx.rom yourself or get a version there: https://gitlab.com/garvalf/forth-is-fun/-/blob/main/uf_forth/uf9/ufx.rom?ref_type=heads )

This rom worked on all other uxn implementations I've tried (on linux, nintendoDS or haikuOS), also including this web version: https://metasyn.srht.site/

I don't know why it's stuck on uxn32...

randrew commented 12 months ago

Maybe @neauoire knows if there has been some change to how Uxn is supposed to work recently?

farvardin commented 12 months ago

@randrew well, now you're saying it, I've seen uxn32 was from last july and I thought it was recent enough, but there has been some changes in how uxn handles the stack and the latest uf forth reflect that. I've tried an older uf forth (uf6) and it works on uxn32. Maybe you should launch a new release then :)

randrew commented 12 months ago

I'll make a new release either when @neauoire either lets us put a version tag in the ROM file format or promises to never change Uxn again :)

farvardin commented 12 months ago

I can't tell for the rom file format, but now uxn has some version informations:

Uxnasm - Uxntal Assembler, 8 Aug 2023.
Uxncli - Console Varvara Emulator, 5 Sep 2023.
Device Version Dei  Deo
     0       2 0030 ff38
     1       1 0000 0300
     a       1 0000 a260
     b       1 0000 a260
     c       1 07ff 0000
Uxnemu - Graphical Varvara Emulator, 2 Sep 2023.
Device Version Dei  Deo
     0       2 0030 ff38
     1       1 0000 0300
     2       1 003c c028
     3       1 0014 8000
     4       1 0014 8000
     5       1 0014 8000
     6       1 0014 8000
     8       1 0000 0000
     9       1 0000 0000
     a       1 0000 a260
     b       1 0000 a260
     c       1 07ff 0000
randrew commented 12 months ago

Is that something the emulator reports to the executing ROM? If so, I'm guessing that only helps if the ROM was programmed to recognize it, and if the changes made to Uxn don't break the ROM code in a way that makes it not work.

farvardin commented 12 months ago

@randrew I don't know. Maybe it's possible but @neauoire would know better :)

neauoire commented 12 months ago

System device version 2 requires wst and dst ports for UF to works properly. As far as I know, this is the only rom that I am aware of that makes use of these ports.

v2: wst/rst ports to read and write to the stack pointer.

Reading, and writing, to the System/wst and System/rst ports will get, or set, a byte value as the working and return stack pointers. Note that reading the value in the wst and rst ports will include the resulting stack pointer byte, so an empty stack will return 01.

randrew commented 12 months ago

Not too hard to implement.