Professional Documents
Culture Documents
Microprocessor Based
Systems
Chapter 2
What is memory?
How a memory is addressed?
4 BYTE memory?
8 Byte memory?
Address bits concern
MEMORY ADDRESS SPACE
& DATA ORGANIZATION
8088 microcomputer supports 1Mbyte
of external memory.
Address Range over 00000H to
FFFFFH.
20 bit address. Why?
Physical Address
v/s not as
Data organized as 8-bit bytes,
Logical
16-bit words but can Address?
be fetched as
16-bit word or 8-bit byte.
MEMORY ADDRESS SPACE
& DATA ORGANIZATION
MEMORY ADDRESS SPACE
& DATA ORGANIZATION
MEMORY ADDRESS SPACE &
DATA ORGANIZATION
lower-addressed byte is the least
significant byte of the word, and the
higher-addressed byte is its most
significant byte
MEMORY ADDRESS SPACE &
DATA ORGANIZATION
Which word is stored in memory
beginning at address 00724H?
Remember, Lower address lower
byte, Higher address higher byte.
Code
Data Segment:
Stack
Extra Segment:
Segment:
Segment:
Stores
Stores
Also forInstructions
Program
Temporary
Data Data.
i.e. Codes
Storage.
Information
like Push, Pop, Jump, Call etc. Actually, data
code
stores in the
memory.
Data
Code Segment
Segment
Register contains
the Base
Address i.e.
Starting Address
on which the
instructions
data started to
started to enter.
enter.
Registers: Segment Registers &
Memory Segmentation
Generating a Physical memory
Address
Generating a Physical
Memory Address
16 Bit Address in
Segment
Registers
20 Bit
Address Bus
Code Segment : Instruction
Pointer
Code Segment
Offset : Instruction Pointer
Address
Physical
Address
0001
0000
0003
0000
FFFF
0000
Signed Integer
Byte-wide integer represent decimal
numbers in the range -128 to +127 .
Byte-wide integer represent decimal
numbers in the range +32,767 to -32,768
Data Types
}
• used for storage of pointers to
interrupt service routines
• Pointers require 4 bytes of
memory as pointer is two-word
address
• How many pointers can be
saved?
INSTRUCTION POINTER
• Instruction cycle
• Read instruction from queue
• Decode it
• (Read operands from internal
registers or memory (data
segment) if required)
• Perform operation
• Result written back to memory or
internal register
INSTRUCTION POINTER
Example:
BX could hold a 16-bit base address
e.g. in XLAT command.
POINTER AND INDEX
REGISTERS
• an operand that is to be
processed may be located in
memory instead of the internal
register
• In this case, an index address is
used to identify the location of
the operand in memory
• The index registers can also be
source or destination registers
• MOV SI, 0005H;
STATUS REGISTER(Flag
Register)
STATUS REGISTER(Flag
Register)
• Also 16 bit long; however only 9
bit are used.
• 6 bits for status flags
• carry flag (CF)
• parity flag (PF)
• auxiliary carry flag (AF)
• zero flag (ZF)
• sign flag (SF)
• overflow flag (OF)
STATUS REGISTER(Flag
Register)
• Also 16 bit long; however only 9
bit are used.
• 3 bits for control flags
• direction flag (DF)
• interrupt enable flag (IF)
• trap flag (TF)
STATUS REGISTER(Flag
Register)
STATUS REGISTER(Flag
Register)
STATUS REGISTER(Flag
Register)
• The carry flag (CF): CF is set if there is a carry-
out or a borrow-in for the most significant bit of
the result during the execution of an instruction.
Otherwise, CF is reset.
At the microcomputer’s
startup, the value in SP
is initialized to FFFEH
THE STACK
THE STACK
• Data transferred to and from the
stack are word-wide, not byte-wide
PUSH operation:
Each time a word is to be pushed
• SP is first automatically
decremented by two
• Then contents are written on stack
THE STACK
• Therefore, the stack grows down in
memory from the bottom of the stack,
which corresponds to the physical
address SS:FFFEH, toward the end of
the stack, which corresponds to the
physical address obtained from SS
and offset 0000H (SS:0000H).
THE STACK
• POP Operation
When a value is popped, the reverse
of this sequence occurs
•SS and SP points to the location of the
last value pushed
• contents are first popped off
• SP is automatically incremented by
two
• top of the stack then corresponds to
the address of the previous value
pushed onto the stack
THE STACK(PUSH Operation)
4. POP BX instruction,
loads value BBAAH into
the BX register
5. SP is incremented once
more & equals to s
000AH
THE STACK(POP Operation)
ANSWER:
Values read out of
addresses 1056H and
1058H remain at these
locations, but now reside
at locations that are above
the top of the stack;
therefore, they no longer
represent valid stack data.
If new information is
pushed to the stack, these
values are written over
THE STACK(POP Operation)
Any number of stacks
may exist in an 8088
microcomputer. Simply
changing the value in
the SS register brings
in a new stack. For
instance, executing the
instruction MOV SS, DX
loads a new value from
DX into SS. Although
many stacks can exist,
only one can be active
at a time.
INPUT/OUTPUT ADDRESS
SPACE
• 8088 has separate memory and input/output (I/O)
address spaces
• I/O address space is the place where I/O interfaces, such as
printer and monitor ports, are implemented+
• range is from 0000H to FFFFH (64Kbyte)
• therefore, unlike memory, I/O addresses are only 16 bits long
• Each of these addresses corresponds to one byte-wide I/O port
• Page 0: Certain of the 8088’s I/O instructions can perform
only input or output data-transfer operations to I/O devices
located in this part of the I/O address space
• Other I/O instructions can input or output data for devices
located anywhere in the I/O address space.
• I/O data transfers can be byte-wide or word-wide
• eight locations reserved by Intel Corporation and should not be
used (00F8H through 00FFH)