Académique Documents
Professionnel Documents
Culture Documents
Instruction Sets
Part II: Data Types & Addressing Modes
Data Types
Addressing Modes
Nonnumeric
Characters (ASCII, UNICODE), Boolean (logical) data
Integer
Byte unsigned(signed) integer (8 bits)
Word unsigned(signed) integer (16 bits)
Double word unsigned(signed) integer (32 bits)
Quad word unsigned(signed) integer (64 bits)
Signed integer uses 2s complement representation
Others
Bit field, Bit string, BCD
Zelalem Birhanu, AAiT 4
Addressing Modes
Addressing Modes
How is the address of an operand specified?
Drawback
Only a constant can be supplied
The number of values is limited by the size of the operand
field (e.g. 0 to 255 if the field is 8 bits)
CPU Memory
e.g. MOV R1,[100] R1 96 99 78
Memory 100 96
Address 101 0
Advantage
Requires only one memory reference
Drawback
Can address a limited number of memory locations (relatively
smaller address space) (e.g. If the field is 8 bits the instruction can
only access 256 memory locations)
Zelalem Birhanu, AAiT 8
Register Addressing
CPU Memory
e.g. MOV R1,[R2] R1 0 99 78
R2 101 100 96
Memory
Address 101 0
Advantage
Can address larger number of memory locations compared
with direct addressing
e.g. Assume we have an array of four elements. Let the memory address
of the first element is 100. A program that adds 1 to every element of the
array is given below:
MOV R1,4
Memory Memory
MOV R2,0
(100+0) 100 52 100 53
loop:
(100+1) 101 55 101 56
INC [R2+100]
(100+2) 102 0 102 1
INC R2 103 94
(100+3) 103 93
DEC R1 104 23 104 23
JNZ loop
displacement value 13
Stack Addressing
CPU Stack
e.g. PUSH R1 R1 0 201 0
200 23
SP 201
199 15
Stack
pointer
Register
Register, Immediate
e.g. MOV AX, 0546
Direct
e.g. ADD AX, [0546]
Register Indirect
e.g. MOV [BX],AX
Displacement
Indexed
e.g. MOV AX, [R+0645] where R is an Index register (SI or DI)
Based
e.g. MOV AX, [R+0645] where R is a base register (BX or BP)