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:
// not
@SP
A=M-1
M=!M
// if-goto IF_TRUE0
@SP
AM=M-1
D=M
@Array.new$IF_TRUE0
D;JNE
// goto IF_FALSE0
@Array.new$IF_FALSE0
0;JMP
// label IF_TRUE0
(Array.new$IF_TRUE0)
// push constant 2
@2
D=A
--Mark