Complete the code to load a value from memory into register R0.
LDR R0, [1]The LDR instruction loads the value from the memory address pointed to by R1 into R0. The correct syntax uses square brackets around the register holding the address.
Complete the code to store the value from register R2 into the memory address pointed to by R3.
STR [1], [R3]The STR instruction stores the value from register R2 into the memory address pointed to by R3. The first operand is the source register holding the value to store.
Fix the error in the load instruction to correctly load from the address in R4 with an offset of 12 bytes.
LDR R5, [R4[1]]The correct syntax for loading with an offset is to include a comma and then the immediate offset value inside the brackets. So it should be [R4, #12].
Fill both blanks to store the value from R7 into the memory address at R8 plus an offset of 20 bytes.
STR [1], [[2], #20]
The STR instruction stores the value from R7 into the memory address computed by adding 20 bytes to the address in R8. The syntax requires the source register first, then the base register with offset.
Fill all three blanks to create a dictionary comprehension that maps register names to their load/store instruction types based on whether they use LDR or STR.
{ [1]: '[2]' for [3] in ['R0', 'R1', 'R2'] }This comprehension creates a dictionary where each register name is a key, and the value is the string 'LDR' indicating the load instruction type. The variable 'reg' iterates over the list of registers.
