We had a task, given was an assembler instruction of a 2-addressing machine:
mov 202, 100[r1+]Note down a minimal ass
In mov 202, 100[r1+]:
mov202. In some assembly languages, you could also write [202] for clarity. There's no # on the number, so it's an absolute addressing mode, not an immediate.r1 + 100.r1++Like many flavours of assembly language, this one apparently uses # prefixes to indicate immediate constants. This is like GNU/AT&T x86 syntax, where add $4, %eax adds 4, but add 4, %eax loads a value from the absolute address 4.
Your professor's given equivalent sequence adds 100 to r1, then subtracts 99, since it wants to avoid displacements and post-increments in addressing modes. It also clobbers r2, which the single-instruction version doesn't, so it's not a drop-in replacement.