We are using a simulator to understand how MIPS assembly language works. This has both good and bad aspects.
GOOD.
putc,
puts, and
getc.
BAD.
Branch instructions in MAL must take operands (the ones for comparison) from registers. Only registers. Therefore, the instruction
beq $10, 12, somewhere
is not a legal MIPS assembly language instruction.
The simulator quietly puts the value 12 into a
register
(Which one? Try it and see!)
and then does a proper beq instruction.
Karen does not even remember what the simulator does if code appears as
.data
X: .word 12
.text
beq $10, X, somewhere
This code does not generate an error as far
as assembly is concerned.
What Karen does not remember is whether the simulator
assumes that the comparison is with the
address assigned for variable X or
with the contents of variable X (12).
| Copyright © Karen Miller, 2007 |