ADDRESSING MODES

S3C9228/P9228

 

 

RELATIVE ADDRESS MODE (RA)

In Relative Address (RA) mode, a two's-complement signed displacement between – 128 and + 127 is specified in the instruction. The displacement value is then added to the current PC value. The result is the address of the next instruction to be executed. Before this addition occurs, the PC contains the address of the instruction immediately following the current instruction.

The instructions that support RA addressing is JR.

Current Instruction

Program Memory

Next OPCODE

Displacement

OPCODE

Program Memory

Address Used

Current

PC Value +

Signed Displacement Value

Sample Instructions:

JR

ULT,$ + OFFSET

; Where OFFSET is a value in the range + 127 to - 128

Figure 3-12. Relative Addressing

IMMEDIATE MODE (IM)

In Immediate (IM) addressing mode, the operand value used in the instruction is the value supplied in the operand field itself. Immediate addressing mode is useful for loading constant values into registers.

Program Memory

OPERAND

OPCODE

(The Operand value is in the instruction)

Sample Instruction:

LD R0,#0AAH

Figure 3-13. Immediate Addressing

3-12

Page 52
Image 52
Samsung S3C9228/P9228, 8-Bit CMOS Microcontroller user manual Relative Address Mode RA, Immediate Mode IM