What should I see when running translated os.asm?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

What should I see when running translated os.asm?

JavaJack
My vm translator works well enough to successfully run all the small examples, up to and including StaticsTest.

But when I run os.asm, as created by my translator, I see a small block fill in the bottom right of the virtual screen area, then it eventually halts "At line 384: Expression involves M but A=-1 is an illegal memory address." Is this revealing a flaw in my translator, or is os.asm just scaffolding that will never run standalone even with a perfect translator?
Reply | Threaded
Open this post in threaded view
|

Re: What should I see when running translated os.asm?

JavaJack
My guess is the latter, since Sys.vm calls a non-existing Main.main.

I stubbed this in by creating a fake Main.vm:
function Main.main 0
push constant 65
call Output.printChar 1
return

Which doesn't bomb out with the A=-1 error.
Reply | Threaded
Open this post in threaded view
|

Re: What should I see when running translated os.asm?

cadet1620
Administrator
JavaJack wrote
My guess is the latter, since Sys.vm calls a non-existing Main.main.

I stubbed this in by creating a fake Main.vm:
function Main.main 0
push constant 65
call Output.printChar 1
return

Which doesn't bomb out with the A=-1 error.
This is correct.  The vm files in the tools\os directory are, in effect, the system library that need to be linked to all programs.

What's happening when you translate the os directory is that the call to Main.main results in
    @Main.main
    0;JMP
but since there is no corresponding code label (Main.main) the assembler assigns the next unused RAM address to Main.main and uses that as the ROM address and the generated code jumps to some random place in ROM and blows up.

--Mark