// Virtual Machine instruction to Hack assembly sequence test frame. // Copy your Hack assembly code down below and single step this program // with the CPUEmulator to test that your Hack assembly is the correct // translation of a given single Virtual Machine instruction. // For a complete test, run a second time with the stack base and any // segment bases used moved to different memory address. @256 // Establish the stack base at address 256 by setting SP to 256 D=A @SP M=D // Uncomment the following three asm code sequences to simulate: // push constant 42 // push constant 220 // This might be useful if you want to, for example, quickly test your // translation of the VM's add instruction. // //@42 // simulate push constant 42 //D=A //@256 //M=D // //@220 // simulate push constant 220 //D=A //@257 //M=D // //@258 // set SP to 258 //D=A //@SP //M=D // Set LCL, ARG, THIS, and THAT to 16 word segments starting at address // 512. This leaves a 256 word stack segment. // // set LCL base to 512 @512 D=A @LCL M=D // set ARG base to 528 @528 D=A @ARG M=D // set THIS base to 544 @544 D=A @THIS M=D // set THAT base to 560 @560 D=A @THAT M=D // Put your Hack assembly code here. // Infinite loop (__END) @__END 0;JMP