Relative Addressing Mode - Hyundai GMS800 Instruction Manual

Gms800 series 8-bit single-chip microcomputers
Table of Contents

Advertisement

1.7. Relative Addressing Mode

In this addressing mode, the effective address is calculated current address(the contents of PC) and the
contents of address part of instruction. The address part of the instruction is considered as a signed number
which can be either positive or negative. When this number is added to the contents of PC, the result
produces effective address whose position in memory is relative to the address of the next instruction in the
program.
Relative addressing mode is used in branch instructions when the branch address is in the area surrounding
the instruction word itself. It results in a shorter address field in the instruction format since the relatives
address can be specified with a smaller number of bits than the number of bits required to designate the
entire memory address. The relative address from the current address is in the range of -128 ~+127 byte.


PSW Relative
The branch operation is determined by the bit of PSW specified by instruction. The branch address is
obtained by adding the contents of operand to the contents of program counter.
OP CODE
Operand
PSW
Unconditioned

Notes : BRA 0FEH
Example)
50 30


A.bit Relative
The branch operation is determined by the bit of accumulator specified by bit7,6,5 of op code. The branch
address is obtained by adding the contents of operand to the contents of program counter.
OP CODE
Operand
A
rel
rel
BCC
BCS
BRA

endless Loop ( Recursive Branch )
BCC [30H]
A.bit,rel
rel
BBC
BBS
Instructions
BEQ
BMI
BNE
( IF C=0,)
PC+30
Instructions
Addressing Mode
BPL
BVC
BVS
MEMORY

Op code ( 50 )

Operand ( 30 )
+1

+2
( IF C=1,)
h

NEXT
+2+30
11

Advertisement

Table of Contents
loading

Table of Contents