Professional Documents
Culture Documents
Segment:Offset Addressing
is a technique intel introduced to address more memory space
aka logical address
Segment:Offset Addressing
In 8086/8088
was able to address 1MB of
memory, where each memory
location address is 20bits wide
Problem
Solution
Segment:offset Addressing
Segment:Offset Addressing …
How it works?
combines the starting address of a
segment with an offset value
A segment can only start on a
paragraph boundary address, where
the rightmost four bits of its address
are zero
An offset is a 16bits wide address
that specifies an address relative to
the segment starting address
A segment could have a size up to
64k, which means that an offset
address can range from 0000h up to
ffffh
Example:
1000:0008
2000:000A
From Logical Address to Physical Address
The program that calls the subroutine may also pass data by placing it in the stack
where the subroutine access it
The program has to perform calculations that use the registers; it can save the
present contents of the registers on the stack, make the calculations, and then restore
the data from the stack to the registers
The program loader automatically defines the stack for .com program, whereas
you must explicitly define a stack for .exe program
The stack …
In 8086, each data in the stack is one word = 2 bytes
SS holds the beginning of the stack
Initially SP contains the size of the stack, a value that points
to the byte past the end of the stack
Data storage begins at the highest location in the segment
and stores data downward through memory
PUSH & POP are the instructions used to push data to the
stack and retrieve data from the stack respectively
The Stack
Push executes by decrementing SP by 2 to
the next lower storage word in the stack
and storing or pushing a value there
POP executes by returning a value from
the stack and incrementing SP by 2 to the
next higher storage word
Exercise
MOV AX, 0026
MOV BX, 0115
PUSH AX
PUSH BX
POP AX
POP BX
Note that when SP=0 the stack is full