Assemble, test, and run your program using the IJVM assembler and simulator from Lab #12.
You can model your code after my C++ version (Java programmers: don't worry -- the only strange things you will see are statements like cout << "foo" << endl; in place of System.out.println("foo");). You can compile and run that code with the commands
g++ -o nim357.x nim357.cc ./nim357.x
Remember that each method takes a dummy OBJREF as its first parameter. Push a zero onto the stack before pushing any other parameters before invoking a method, and remember to include the dummy value in your count of parameters. If you do not do these things, the simulator will not run your methods properly.
Every method must return an integer. To write the assembly code for a high-level language method with a void return type, push an arbitrary value onto the stack before the method returns and have the invoking method immediately perform a POP after invoking the method.
Write and test your program one method at a time, just like you would a program in a high-level language (right?). For example, the following code could test your printRow method.
BIPUSH 0 SPRINT "How many sticks would you like to print?\n" IREAD INVOKEVIRTUAL printRow POP HALT #your printRow code would go here