ECE 252 Week 8
To find the first memory address for PC-offset addressing assigned by the compiler, take:
0x0200 + Number of instructions, including BR START
Nibble
4 bits
LOAD instruction LC-3
A load instruction copies a value from a memory location to a register. EX: LD R0, NUM -Load whatever is in memory location named NUM into R0
Indirect addressing concept
A location in memory holds a value which is the final memory address.
LDR and STR use what type of addressing
Base-offset addressing
Effective Address for PC-relative Addressing mode
Effective Address= PC+ + PCoffset
PC-relative addressing mode
Instead of encoding the actual address, encode how far away it is from where the already-incremented PC is pointing. It is used for accessing memory locations "near" the current PC value, since the 9-bit offset is limited in range.
LC-3 LDI instruction
LDI R4, ADDR_R **Read from the location labeled ADDR_R to get the effective address for a load that copies from memory to register R4.
LC-3 base offset Load
LDR DR, BaseR, offset6
LC-3 load effective address
LEA, R1, ARRAYLABEL -Copy the address of the ARRAY label into register R1 so that we can use it as a base register for LDR/STR
Assembler directive to create a label
NAMEOFLABEL .FILL x1234
LD and ST use what type of addressing
PC relative
LC-3 STI instruction
STI R4, ADDR_W **Read from the location labeled ADDR_W to get the effective address for a store that copies from register R4 to memory.
LC-3 base offset store
STR DR, BaseR, offset6
Labels in Assembly language
Somewhat like a variable in a HLL. The assembler converts the labels to addresses.
Base-offset Addressing
The value of the base register is added to the signed offset to get the effective address
STORE instruction LC-3
a store instruction copies a value from a register to a memory location EX: ST R6, NUM -Copy whatever is in register R6 to the memory location named NUM