I'm having trouble with FibonacciElement, and I'm not sure what's wrong.
I've passed Simple Function and Nested Element, so I'm not sure which piece of my Translator is causing the problem. I have bootstrap code setting SP to 256 and calling Sys.init.
When running the CPU emulator, I've noticed that my stack frames match up with the VMs stack frames (except for the return address pushed onto the stack which I don't think needs to match up). The problem seems to be on the first return. My .asm file never gets to the return code because it never gets past the JGT (if-goto) after the LT comparison. I'm confused why there's a JGT after the LT because the LT will never return something greater than 0. But my StackTest, BasicLoop, and FibSeries also pass, so I don't think there's a problem with my LT/if-goto code.
Are you generating the JGT instead of JNE in your if-goto? From 8.2.1 "if the value is not zero, execution continues from location marked by the label" (I wouldn't expect that all the earlier tests would pass if that was so....)
One thing that can really help figuring out where generated code comes from is to include the source VM commands in the generated ASM as comments. Here's an example from my VM translator: