Basic PC Addressing Scheme
a. Possible address run from 0000h to FFFFH
b. Instructions work with addresses that are 16 bit long
c. By straightforward scheme, the processor would be able to address up to 64k bytes of memory which is not enough.
86 Intel Processor consider the 16bit address to be relative to a base address.
Address is consist of two parts
a. Segment address – 20 bit address that corresponds to the base address.
b. Offset address – 16 bit address that is used to access locations relative to base address
Actual/Effective Address = Segment Address + Offset Address
By this scheme, the processor can access up to 100000H bytes of memory (1024kbytes or 1Mbytes). To implement this addressing scheme, the processor requires that all programs be divided into segments.
Segments – an area of memory that is up to 64kb. Large programs must be partitioned in segments.
Note:
a. All program must have at least code segment and a stack segment
b. Most program use at least data segment
Stack is organized as a list of 16 bit (2ytes) entities
Stack segment register (SS) – always contains the segment address of the stack
Stack pointer register – contains an offset that points to the top of the stack
SS points to the lowest address in the list (at the bottom) and SP points to the last data that was pushed (at the top most).
When an item is pushed – the SP is decremented by 2.
When an item is pop – the SP is incremented by 2.
Addressing Mode
a. Direct Addressing – addressing in which offset is specified directly
b. Indirect Addressing – addressing in which the offset is specified as being the value of a register. Can use offset registers.
Note:
a. It is necessary to specify a segment register because the processor will assume one.
b. If SP or BP is used, the processor will use SS register. If BX, SI, DI is used, the processor will use data segment (DS)
c. To override default, specify the segment register. Ex: ES:[BX]
Implied Segment Register Usage for
Indirect Addressing
|
|
Register
|
Implied Segment Register
|
[SP]
|
SS
|
[BP]
|
SS
|
[BX]
|
DS
|
[SI]
|
DS
|
[DI]
|
DS (ES if with string instructions)
|
Displacement – the number that we add to a base address.
Formats in Addressing
a. Direct Addressing name [base] [index] + constant
b. Indirect Addressing [base] [index] + constant
No comments:
Post a Comment
Thanks for Suggestion / Comment!
God Bless!