Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

T.

Areej Hijaz

Microprocessor and Assembly Language

Practical – part

Lab(1)

Types of Registers:

Registers

Data Addrees Status

Data Register:

AX, BX, CX, DX -----------> (General Purpose Registers)GPR

bits 8 High AH
AX -16 bits
bits 8 Low AL

AX (Accumulator) :

 The most common type


 used in computational and arithmetical operations
 used to transfer data ,
 deal with memory addresses.

BX ( Base Register):

Used as Address Pointer to memory locations.

CX ( Count Register):

Used as counter to control how many times to repeat instructions .


DX ( Data Registers):

 Used in multiplications and division operations.


 Used as a pointer to input/output data addresses.

Segments Registers:

Used to determine a specific addresses in memory.

CS(Code Segment)

DS(Data Segment)
Segments
Registers
SS(Stack Segment)

ES(Extra Segment)

In Microprocessor( 20 bits) :

Address bus 220 = 1048576 = 1 Mbyte

In Register (16 bits):

Can contain maximum address reach to

216 = 64 Kbyte

216 ( Register) ≠ 220 ( memory address)

So, to solve this problem divide the memory to Segments .

Each Segment contain (16 bits /216 = 64 Kbyte)


Memory Segments:

 Each Segment has " number" , and has (start, end)


address
 Each segment starts with 0000h address, ends with FFFF h
address Offset

Start End
0000h FFFF h

Segment(216= 64Kbyte)

To determine any address in memory, we must know :

1-segment number 2- offset address

Logical Address : ( Segment number : offset address)

EX:

Logical address -------> ( AABB : 5566 )

To obtain a physical address :-

Physical address=( segment-no ) * 16 bit + offset

EX: Find the physical address for the following logical


address(AABB:5566)

Physical address= AABB*10 + 5566= AABB0 + 5566 = B0116 h

Location of Segments:
0000:0000 FFFF:00000001:0000 FFFF:0001 0002:0000 FFFF:0002

Seg-no= 0000 Seg-no= 0001 Seg-no= 0002


Segment No Physical Address
Segment no(2) starts with 00020
Segment no(1) starts with 00010
Segment no(0) starts with 00000

Segment No Physical Address


Segment no(2) ends with 1001F
Segment no(1) ends with 1000F
Segment no(0) ends with 0FFFF

Question(1) :

determine the offset address to identify the following physical address


(1256A) in:

a) 1256 segment b) 1240 segment

Answer:

a) 1256 * 10 + offset = 1256A


12560 + offset = 1256A
Offset= 1256A – 12560
Offset = 000A
Logical address is ( 1256 : 000A)

b) 1240 *10 + offset = 1256A


12400 + offset = 1256A
Offset = 1256A – 12400
Offset = 016A
Logical address is ( 1240 : 016A)
Question2:

Give the segment number to determine the following physical address


( 80FD2 h) if you know that the offset address is ( BFD2 h)?

Answer:

( Seg-no) * 10 + BFD2 = 80FD2

80FD2 – BFD2 = (seg-no) * 10

75000 = (seg-no) * 10

Seg-no= 7500 h

Types of Segments Registers:

Segment Register Usage


Code Segment Register (CS) Code & instructions
Data Segment Register (DS) Data
Stack Segment Register (SS) Last In First Out(LIFO) memory
Extra Segment Register (ES) To determine and use extra
part in memory

You might also like