Department of Computer Engineering Microprocessor Laboratory (2019 course)
Experiments No:03
Name of Student……………………………………………….. Roll No.:…… Batch:…….
Subject:MPL Department :Computer Engg. Class: SE COMP (Div-A/B)
Viva Dated Sign of
Correctness Timely
Write-up Documentation Total Subject
Program Submission
Teacher
4 4 4 4 4 20
Date of Performance:..................................... Date of Completion:....................................
----------------------------------------------------------------------------------------------------------------------
Title: To find the largest of given Byte/Word/Dword/64-bit numbers.
Problem Statement: Write an X86/64 ALP to find the largest of given Byte/Word/Dword/64-bit
numbers.
Objective:
● To understand assembly language programming instruction set
To understand different assembler directives with example
● To apply instruction set for implementing X86/64 bit assembly language programs
Outcomes: On completion of this practical ,students will be able to
C218.1: Understand and apply various addressing modes and instruction set to implement
assembly language programs
Hardware Requirement: NA
Software Requirement: OS:Ubuntu Assembler: NASM version 2.10.07 Linker: ld
Theory Contents :Datatype in 80386:
The 80386 supports the following data types they are
SNJB’s LS KBJ COE Chandwad
Department of Computer Engineering Microprocessor Laboratory (2019 course)
● Bit
● Bit Field: A group of at the most 32 bits (4bytes)
● Bit String: A string of contiguous bits of maximum 4Gbytes in length.
● Signed Byte: Signed byte data
● Unsigned Byte: Unsigned byte data.
● Integer word: Signed 16-bit data.
● Long Integer: 32-bit signed data represented in 2's complement form.
● Unsigned Integer Word: Unsigned 16-bit data
● Unsigned Long Integer: Unsigned 32-bit data
● Signed Quad Word: A signed 64-bit data or four word data.
● Unsigned Quad Word: An unsigned 64-bit data.
● Offset: 16/32-bit displacement that points a memory location using any of the addressing
modes.
● Pointer: This consists of a pair of 16-bit selector and 16/32-bit offset.
● Character: An ASCII equivalent to any of the alphanumeric or control characters.
● Strings: These are the sequences of bytes, words or double words. A string may contain
minimum one byte and maximum 4 Gigabytes.
● BCD: Decimal digits from 0-9 represented by unpacked bytes.
● Packed BCD: This represents two packed BCD digits using a byte, i.e. from 00 to 99.
Registers in 80386:
SNJB’s LS KBJ COE Chandwad
Department of Computer Engineering Microprocessor Laboratory (2019 course)
● General Purpose Register: EAX, EBX, ECX, EDX
● Pointer register: ESP, EBP
● Index register: ESI, EDI
● Segment Register: CS, FS, DS, GS, ES, SS
● Eflags register: EFLAGS
● System Address/Memory management Registers : GDTR, LDTR, IDTR
● Control Register: Cr0, Cr1, Cr2, Cr3
● Debug Register : DR0, DR,1 DR2, DR3, DR4, DR5, DR6, DR7
● Test Register: TR0, TR,1 TR2, TR3, TR4, TR5, TR6, TR7
EAX AX AH,AL
EBX BX BH,BL
ECX CX CH,CL
EDX DX DH,DL
EBP BP
EDI DI
ESI SI
ESP
Size of operands in an Intel assembler instruction
● Specifying the size of an operand in Intel
● The size of the operand (byte, word, double word) is conveyed by the operand itself
▪ EAX means: a 32 bit operand
▪ AX means: a 16 bit operand
▪ AL means: a8 bit operand The size of the source operand and the destination
operand must be equal
Addressing modes in 80386: The purpose of using addressing modes is as follows:
1. To give the programming versatility to the user.
2. To reduce the number of bits in addressing field of instruction.
1. Register addressing mode: MOV EAX, EDX
2. Immediate Addressing modes: MOV ECX, 20305060H
SNJB’s LS KBJ COE Chandwad
Department of Computer Engineering Microprocessor Laboratory (2019 course)
3. Direct Addressing mode: MOV AX, [1897 H]
4. Register Indirect Addressing mode MOV EBX, [ECX]
5. Based Mode MOV ESI, [EAX+23H]
6. Index Mode SUB COUNT [EDI], EAX
7. Scaled Index Mode MOV [ESI*8], ECX
8. Based Indexed Mode MOV ESI, [ECX][EBX]
9. Based Index Mode with displacement EA=EBX+EBP+1245678H
10. Based Scaled Index Mode with displacement MOV [EBX*8] [ECX+5678H], ECX
11. String Addressing modes:
12. Implied Addressing modes:
Assignment Questions:
1. Explain Types of Addressing mode instruction?
2. Write five basic instructions which are used in ALP?
3. How to find the largest number from a given number?
Conclusion:
Hence we find largest number from given number
MPL Practical Oral Question Bank
Sr B Questions Oral 1 Oral 2 Remark
No L (improve
ment)
1 1 What are the type of instruction?
2 2
What is difference between byte,word and
double word?
3 1 What is format of instruction?
4 2 What is use of label in instruction?
Sign of Student
SNJB’s LS KBJ COE Chandwad