Professional Documents
Culture Documents
04A27
04A26
--------
00001
00000
Memory
(Stack)
Addressing Data in Memory
Segment
Segment start address (array)
04C00
04A00
Segments and Addressing
Program
Instructions Subroutines
Data
(Functions)
04F03 offset
Segment start address
Stack 04F02
04F01
04F00 04F00
Segment registers
Data
04C00
Code
04A00
Segments and Addressing
04F03 offset
SS Stack 04F02
04F01
04F00 04F00
Data
04C00
DS
CS Code
04A00
Segments and Addressing
Offset
Actual Address
Segments and Addressing
AX BX
DX CX
• the only general-purpose register
•I/O •I/O •Value that controls the
which may be used for indirect
•Arithmetic •MUL, DIV of large number of times a loop is
addressing MOV [BX], AX
numbers repeated
•Computation
AX:DX •Value to shift bits left or right.
•String addressing and indexing
Registers
AX
16-bit
AH AL
8-bit 8-bit
EAX
32-bit
Flag Register
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OF DF IF TF SF ZF AF PF CF
Flag Register
OF DF IF TF SF ZF AF PF CF
Features of Operating System
Processor CS = FFFF[0] H
reset state IP =0000
Turning on
the power FFFF0H, entry point
to BIOS in ROM
the boot strap loader loads BOIS checks disk for the
system files from the disk system files and accesses
into memory and transfer the boot strap loader.
control to them.
BIOS Boot Process
Processor CS = FFFF[0] H
IP =0000
reset state
Turning on the
power
FFFF0H, entry point to
BIOS in ROM
Clear memory locations
to zero.
Perform parity check of
memory. •Interrupt Vector Table
•BIOS data area
the boot strap loader loads system BOIS checks disk for the system files
files from the disk into memory and and accesses the boot strap loader.
transfer control to them.
BIOS Boot Process
Turning on the
power
FFFF0H, entry point
First instruction to be to BIOS in ROM
executed FFFF0H.
BIOS contains set of routines
to provide device support
(checks various ports to •Interrupt Vector Table
•BIOS data area
identify and initialize devices,
services for I/O)
the boot strap loader loads system BOIS checks disk for the system files
files from the disk into memory and and accesses the boot strap loader.
transfer control to them.
BIOS Boot Process
Turning on the
power
FFFF0H, entry point to
IVT, begins at location 0 and BIOS in ROM
contains 256 4-byte addresses in
the form (segment: offset) for
handling interrupts.
BIOS data area begins at location •Interrupt Vector Table
40[0], status of attached devices. •BIOS data area
the boot strap loader loads system BOIS checks disk for the system files
files from the disk into memory and and accesses the boot strap loader.
transfer control to them.
I/O Interface
User Programs
Operating System
BIOS
Hardware/Devices
Types of executable programs
CS :IP
Memory
34 0000
32 0000
30 0000
2E 0000
PUSH AX
AX=026B
Decrements SP by 2 BX=04E3
Stores contents of AX
34 0000
32 0000
30 0000
2E 0000
PUSH AX
AX=026B
Decrements SP by 2 BX=04E3
Stores contents of AX
34 6B02 SP=34
32 0000
30 0000
2E 0000
PUSH BX
AX=026B
Decrements SP by 2 BX=04E3
Stores contents of BX
34 6B02 SP=34
32 E304 SP=32
30 0000
2E 0000
POP BX
restores contents of BX
Increments SP by 2
34 6B02 SP=34
32 E304 SP=32
30 0000
2E 0000
POP BX
restores contents of BX
Increments SP by 2
34 6B02 SP=34
32 E304 BX=04E3
30 0000
2E 0000
POP AX
restores contents of AX
Increments SP by 2
34 6B02 AX=026B
32 E304 BX=04E3
30 0000
2E 0000
05BE0
Notes
Assume that the next instruction to be
executed is: mov AL, [0016]
Stack
mov AL, [0016]
A01600
05D26 4A Data
How the program accesses
data?
05D10
1. Initialize DS= 05D1H, offset
=0016
Code 00
2. The address will be 05D26H 16
4A
05C03 A0
AX
Notes
Assume that the next instruction to be
executed is: mov AL, [0016]
AX 4A
Stack
AX 02 48
Stack
Data
05D10
00
16 Code
05C03 A0
Instruction Operands
WORDX DW 0
……….
MOV CX, WORDX Operand could be a normal
name
MOV CX, 25
MOV CX, BX Operand could be a number
MOV CX, [BX]
DS:BX