Example SAL and MAL Programs
I've written a bunch of short programs to demonstrate how various things
are done in MIPS assembly language.
Here are links to
them, in approximately the order in which I'll discuss them:
- 2.1.SAL.s, figure 2.1 from the book.
- 2.1.MAL.s, a MAL translation of the above.
- 2.1.TAL.s, a TAL translation of the above.
- 2.1.s, the same as 2.1.SAL.s but with some
additional global labels so it's easier to understand while single-stepping
- 2.7.SAL.s, which solves problem 2.7 in SAL.
- 2.9.SAL.s, problem 2.9 in SAL.
- 2.9.MAL.s, the same in MAL.
- 2.9.TAL.s, the same in TAL.
- 2.9.s, the same as 2.9.SAL.s plus globals for
- 2.11.SAL.s, problem 2.11 in SAL.
- 4.11.s, problem 4.11 in SAL.
- 7.15.s, problem 7.15 in SAL.
- 8.8.s, problem 8.8 in MAL.
- proc1.s, a simple procedure-calling example
- proc2.s, a naive (and BUGGY!) attempt at
nested procedure calling.
- proc3.s, a better attempt at nested procedure
calling, using a stack.
- power.s, a recursive function that computes
- power2.s, another version of the same
function, using MIPS parameter-passing conventions.
- params.s, an example showing both parameter
passing and local variable storage.
Thu Sep 3 14:56:16 EDT 1998
Stephen Bloch / firstname.lastname@example.org