You should be able to translate the supplied OS VM files along with your Main.vm and run the result.
First thing to try is to ensure that you have an correct stack frame on entry to Sys.init(). The easiest way to do this is use your VM call code writer to write the bootstrap call:
writeAsm("@256, D=A, @SP, M=D");
writeCall("Sys.init", 0);
writeAsm("@$HALT, ($HALT), 0;JMP"); // Sys.init() shouldn't return, but...
If you haven't done so, have your VM Translator write the VM source code in the ASM Output as comments.
// function Array.new 0
(Array.new)
// push argument 0
@ARG
AD=M
D=M
@SP
...
// push constant 0
@SP
...
// gt
@RIP$2
D=A
Also very helpful is to have your Assembler generate a listing file that includes the ROM addresses for the instructions and the symbol tables. If you print the ROM and RAM symbols in separate tables it is quite obvious when a (LABEL) is missing because LABEL shows up in the RAM symbols.
// function Array.new 0
74 (Array.new)
// push argument 0
74 2 @ARG
75 FC30 AD=M
76 FC10 D=M
77 0 @SP
...
// push constant 0
81 0 @SP
...
// gt
85 126 @RIP$2
86 EC10 D=A
Note: my assembler writes C-instructions codes in hex, all other numbers in decimal.
Debugging a problem like this can be rather intense. You might want to move on through projects 9-12 adn come back to this later.
If you want direct help debugging this, email me.
--Mark