Understand that assembly language is not a universal, standardized thing. It is officially defined by the program that reads it, which is an assembler. So no matter what this code defines as the language for this assembler, it is a language. Machine code is what is important to the processor, so you can have as many different assemblers and assembly languages as you have users, as long as they all produce the correct machine code. Therefore, if you expect this to be universal, one rule applies to all types of things that do not apply.
You have provided enough information, although for experienced people, to see the habits of other assembler languages, reflected here.
mov 202, 100[r1+]
Thus, it seems that you are moving what is indicated in the addressing address 202, as you stated. to the place at r1 + 100, registered by the index, and incremental increment.
To replace this with a lot of instructions, since one line is the simplest as the lines of code go (how complicated and the number of hours is not necessary).
- So you need to read the contents of address 202,
- you need to temporarily add 100 to r1,
- you need to write the contents of address 202 to address r1 + 100,
- and then you need to take r1 and increase it (not r1 + 100, but r1 without an index).
The resulting solution does pretty much what:
add #100, r1 mov #202, r2 mov[r2],[r1] sub #99, r1
It adds 100 to r1, which we need to do temporarily (and will have to cancel later, because r1 is now not so in the long run). Then, since they restrict addressing modes, you need the register to hold address 202, so the value 202 is loaded into r2 just as the value 100 was added to r1. #number means just using this number.
Now you are allowed to use [rn] so that this step reads what is on address r2 (address 202), and writes it to address r1 (source r1 plus 100). Finally, because we want r1 to ultimately be the original plus 1, but we made it original plus 100, we need to subtract 99 r1 + 100-99 = r1 + 1
In C, it would be something like this:
unsigned *r1; unsigned *r2; //r1 is set somewhere in here to something that is not defined in your question or problem. r1 += 100; //add
with the assignment on the right and the operand on the left is not intuitive, since we basically write and code the result on the left and the operands on the right.
We do not code 202 = r2; , and instead write r2 = 202; , therefore mov r2,#202 more intuitive, but again the assembler language is determined by the people who wrote the assembler, and some people like it left to the right, and others to the left.