But many people do not have access to a RISC-based workstation. The SPIM simulator allows MIPS assembly-language to be assembled and run on a Pentium PC running Microsoft Windows (or on a Unix workstation of almost any type).
The documentation for SPIM also includes a detailed summary of the MIPS instruction set and assembly language.
SPIM has no link-loader, and its system calls are incompatible with those assumed by runtime.c. A new version of the runtime is necessary: the file runtime.s. Warning: This file is not fully tested! Only main, initArray, and print are tested.
Instead of link-loading, it is necessary to concatenate the Tiger-compiler output file myprog.s with runtime.s (either one can go first) and load the combined file into the SPIM simulator.
L12_framesize=60 addiu $sp,$sp,-L12_framesizeand then within the function L12 it generates offsets such as
sw $25,-24+L12_framesize($sp)The SPIM assembler seems unable to handle negated labels in expressions, so I had to modify the prologue to read as,
L12_framesize=60 addiu $sp,$sp,-60However, the offset expressions such as -24+L12_framesize($sp) work just fine.
Andrew Appel