Remember: You are encouraged to turn in individual problems as soon as possible, rather than turning in the whole assignment on the due date. Please mark each problem with the exercise number from the book.
tmp at our disposal, we can start by
eliminating sne, since
sne s, a, bb can be replaced by the sequence of instructions:
seq s, a, b li tmp, 1 sub s, tmp, sor with the sequence of instructions:
sub, s, a, b li tmp, done-label jeqz s, tmp li s, 1 done-label:
Remember, that the instruction you are replacing
could appear anywhere in a larger program, so (for example) your
proposed replacement should not halt. (See how few auxiliary
registers like tmp you can get away with.)
To make DrScheme display vectors in the standard Scheme way, you can evaluate
the following expression in DrScheme: (print-vector-length #f)
This will, for example, make a vector of length four containing four
zeros print out as
#(0 0 0 0)
instead of
#4(0).