lc3 LDR instruction and the value stored

The second parameter is the offset of the base address that will be loaded.

I started to take some pictures to post here and make a good explanation but I found an interesting lecture video that will explain much better than words and will save a lot of time.

LC3 Instructions – LD, LDR, LDI, LEA

The video is explaining the differences between the load instructions for the LC3, highlighting the differences between them.

In your example:

You have your data:

A .FILL X1234
B .FILL X370B
C .FILL X370C

Running your code:

LEA R0, A      -- R0 has the address of A
LDI R2, C      -- R2 has value of which address C has
LDR R3, R0, 2  -- R3 has the value of C 
               -- because R0 has the address of A + 2 positions = C

Leave a Comment