SlideShare a Scribd company logo
1 of 16
Download to read offline
SYLHET INTERNATIONAL UNIVERSITY
Shamimabad, Baghbari, Sylhet-3100
Assignment Title: Microprocessors and Interfacing & Assembly
Language
Course Title: Microprocessors and Assembly Language
Course Code: 333
Credit: 3
&
Course Title: Microprocessors and Assembly Language Lab
Course Code: 334
Credit: 1.5
Created by : TeamBlackHole
TeamBlackHole
V
I R
Part-I: Microprocessor and Interfacing
1. Describe the sequence of signals that occurs on the address bus, the
control bus, and the data bus when a simple microcomputer fetches an
instruction?
Ans:
i. A microcomputer fetches each program instruction in sequence,
decodes the instruction, and executes it.
ii. The CPU in a microcomputer fetches instructions or reads data from
memory by sending out an address on the address bus and a Memory
Read signal on the control bus. The memory outputs the addressed
instruction or data word to the CPU on the data bus.
iii. The CPU writes a data word to memory by sending out an address on
the address bus, sending out the data word on the data bus, and
sending a Memory write signal to memory on the control bus.
iv. To read data from a port, the CPU sends out the port address on the
address bus and sends an I/O Read signal to the port device on the
control bus. Data from the port comes into the CPU on the data bus.
v. To write data to a port, the CPU sends out the port address on the
address bus, sends out the data to be written to the port on the data
bus, and sends an I/O Write signal to the port device on the control
bus.
2. What determines whether a microprocessor is considered an 8-bit, a 16-
bit or a 32-bit device?
Ans:
The word size (8 bits, 16 bits, or 32 bits) of a microprocessor is the size of the
data path in the execution unit. Typically, this is the size of the accumulator.
Note: This is the execution unit size, not the bus interface unit size. An example
where this matters is the 8088, which is a 16 bit computer running on an 8 bit
bus.
The 8085 is 8 bits. The 8086/8088 is 16 bits. The 80386 is 32 bits. Modern Intel
processors are 64 bits.
3.
a. How many address line does an 8086 have?
Ans:
There are 20 address lines on the 8086, A19 - A0, of which the low order 16,
A15 - A0, With 20 address lines, and the 8086 can address 1,048,576 bytes.
b. How many memory address does this number of address line allow the
8086 to access directly?
Ans: The 8086/8088 has 20 address lines. It can access 220
, or 1MB, or
1,048,576 bytes of memory.
c. At any given time an 8086 works with four segments in this address
space, how many bytes are contained in each segment?
Ans: 64 kilobyte are contained in each segment.
4. What is the main difference between 8086 and 8088?
DIFFERENCE BETWEEN 8086 AND 8088 MICROPROCESSOR
8086 Microprocessor 8088 Microprocessor
8086 has 16-bit data lines. 8088 has 8-bit data lines.
8086 is available in three clock
speed 5 MHz, 8 MHz and 10 MHz
Whereas 8088 is available in two
clock speed 5 MHz and 8 MHz
The memory space of 8086 is
organized as two 512KB banks.
The memory space of 8088 is
implemented as single 1M*8
Memory bank.
8086 has 6-byte instruction queue. 8088 has 4-byte instruction queue.
The 8086 has BHE (Bank high
enable)
The 8088 has SSO status signal.
The 8086 can read or write 8-bit or
16-bit data at a time.
The 8088 can read/write 8-bit data
at a time.
The I/O voltages level for 8086 is
measured at 2.5 mA.
The I/O voltages level for 8086 is
measured at 2 mA.
The 8086 draws maximum supply
current of 360mA.
The 8086 draws maximum supply
current of 340mA.
DIFFERENCE BETWEEN 8085 AND 8086 MICROPROCESSOR
The difference between 8085 and 8086 are given below.
8085 Microprocessor 8086 Microprocessor
It is 8-bit Microprocessor It is 16-bit Microprocessor
It has 16-bit address line. It has 20-bit address line.
It has 8-bit data bus. It has 16-bit data bus.
The clock speed of 8085
microprocessor is 3 MHz
The clock speed of 8086 can vary
between 5, 8 and 10 MHz for three
different microprocessor.
It has 5 flags. It has 9 flags.
It does not support pipe-lining. It supports pipe-lining.
It’s operate on clock cycle with 50%
duty cycle.
It’s operate on clock cycle with 33%
duty cycle.
It does not support memory
segmentation
It support memory segmentation
The 8085 microprocessor has 6500
transistor.
The 8086 microprocessor has 29000
transistors.
The 8085 microprocessor is
Accumulator based processor.
The 8086 microprocessor is general
purpose register based processor.
The 8085 has no minimum or
maximum mode.
The 8086 has minimum and
maximum mode.
In 8085 microprocessor only one
processor is being used.
In 8086 more than one processor is
being used (additional external
processor can be used).
In 8085 microprocessor only 64 KB
memory is used together.
In 8086 microprocessor 1 MB is
used.
5.
a. Describe the function of the 8086 queue?
Ans: The 8086/8088 instruction queue is a buffer that holds opcode bytes that
have been prefetched by the bus interface unit. This speeds up operations of the
processor by helping to reduce fetch latency, i.e. to improve the probability that
an opcode byte fetched by the processor is already available.
b. What are the functions of execution unit in 8086 Intel?
Ans: Basically the function of execution unit in 8086 is to perform all arithmetic
and logic operations. It tells the Bus Interface unit (BIU) where to fetch
instructions and data from. It has 4 components: Control circuitry, ALU, Flag
registers and general purpose registers.
1. Control circuits-it directs all the internal operations.
2. ALU-performs all logic operations.
3. General purpose registers-used to store data during execution.
4. Flag registers-it has a 16bit flag register containing 9 flags that are set for
certain conditions during any operation. Ex: carry flag (whenever there is a
carry).
It also has a decoder to decode the fetched instructions.
c. How does the queue speed up processing?
Ans: The instruction prefetch queue speeds up the processing of
microprocessors by attempting to have the next opcode bytes available to the
execution unit before it actually needs them. This works because, statistically,
there is time spent by the execution unit in executing a particular instruction;
time that the bus interface unit can use to go ahead and pre-fetch the next
opcode bytes. Sometimes, this results in a loss of time, because the execution
unit may branch to some other location. Modern processors attempt to sidestep
that by using branch prediction algorithms.
6. If the code segment for an 8086 program starts at address 70400h, what
number will be CS register?
Ans: 7040H
7. What physical address represented by
a. 4370:561EH
b. 7A32:0028H
TeamBlackHole
V
I R
Ans: a.
43700
561𝐸
48𝐷1𝐸
Ans: b.
7A320
0028
7𝐴348
8. Why does 8086 use only 6 byte queue?
Ans: Because the longest instruction in instruction set is 6 bytes long. Hence
with a 6 byte long queue it is possible to pre-fetch even longest instruction in
the instruction set.
9. Describe the dived-by-zero interrupt?
Divide-by-zero interrupt: If u attempt to divide an operand by zero, the 8086
will automatically interrupt the currently executing program
More specifically, 8086 will automatically do a type zero interrupt if
– The result of a DIV operation or an IDIV operation is too large to
fit in the destination register.
At the end of each instruction cycle, 8086 checks to see if any interrupts have
been requested. If an interrupt has been requested – the 8086 responds to the
interrupt by stepping through the following series of major actions:
• It decrements the stack pointer by 2 and pushes the flag register on the
stack.
• It disables the INTR interrupt input – by clearing the interrupt flag (IF) in
the flag register.
• It resets the trap flag (TF) in the flag register.
• It decrements the stack pointer by 2 and pushes the current code segment
register contents on the stack.
• It decrements the stack pointer again by 2 and pushes the current
instruction pointer contents on the stack.
• It does an indirect fat jump to the start of the procedure you wrote to
respond to the interrupt.
10.List out the major steps in developing an assembly language program.
• Program Development Steps
• Defining the Problem
• Representing program operations
• Finding the right instructions
• Writing a program
Defining the problems
• Find out the problem. For example: Sensing temperature, detecting
fire, detecting smock, decoder-encoder, intelligent machine
controller etc.
Representing program operations
• Formula or sequence of operations used to solve a programming problem
is called as the algorithm.
• There are two ways of representing algorithms:
• Flowchart
• Structured programming and pseudo code
Finding the right instructions
• Instructions in 8086 are mainly divided into following categories
• Data Transfer Instructions
• Arithmetic Instruction
• Bit manipulation Instruction
• String Instruction
• Program execution transfer Instruction
• Processor control Instruction
Writing a program
• We need to do the following steps to write the program effectively:
• INITIALIZATION INSTRUCTIONS: used to initialize various
parts of the program like segment registers, flags and
programmable port devices.
• STANDARD PROGRAM FORMAT: it’s a tabular format
containing ADDRESS, DATA OR CODE, LABELS, MNEM,
OPERAND(S) and COMMENTS as the columns.
• DOCUMENTATION: you should document the program. E.g.
each page of the document contains page number and name of the
program, heading block containing the abstract about the program,
comments should be added wherever necessary.
11.Question no 8 in the chapter 3 in Microprocessors and interfacing 3rd
edition’s book.
Ans.
MOV AX, BX ; This copies the contents of the BX (075A) register into the
;AX register.
MOV CL, 37H ; This does the same as the above except that the number is
;given in hexadecimal. Hexadecimal numbers MUST begin
;with a digit and end with a "h". This copies 37H into CL
;register.
INC BX ; add one to contents of BX register.
MOV CX, [246BH] ; Copies the contents of memory location [246BH] into
;CX register.
MOV CX, 246BH ; This copies 246BH into CL register.
ADD AL, DH ; This add AL and DH into AL register.
MUL BX ; DX:AX = BX *AX
; Here BX= 07 5A and AX=42 35
; So DX:AX = 1E6B9A2h (1111001101011100110100010b)
; CF=0, OF=0.
DEC BP ; Decrement the value of base pointer by 1
; BP=2467h
DIV BL ; Divide AX by value in BL. result in AL, remainder in AH
; AL=AX/BL, AH=Reminder
; Here AX= 42 35 and BL=5A
; So AL=BCh and AH=0h
SUB AX, DX ; Subtract DX value from the AX value
; Here AX= 4235 and DX= 3302
; AX = F33h
OR CL, BL ; Preforms a Boolean OR operation. The result is stored in the
; destination register.
; Here CL = 04h and BL = 5Ah
; Sets CL = 0000 0000 0000 0100b
; and BL = 0000 0000 0101 1010b
; Sets CL = 0000 0000 0101 1110b
NOT AH ; Performs a Boolean NOT operation on the specified register.
; Here AH = 42h
; Sets AH =0000 0000 0100 0010
; Sets AH = 1111 1111 1011 1101b
ROL BX, 1 ; Rotates the register left by 1 bit. The MSB wraps over to the
;LSB. If more than 1 bit needs to be rotated, set the number of
;bits to rotate in the CL register first.
; Here AX = 0100 0010 0011 0101b
; So AX = 1000 0100 0110 1010b
AND AL, CH ; Performs a Boolean AND operation. The result is stored in
;the destination register.
; Here AL = 35h and CH= 00
; Sets AL= 0000 0000 0011 0101b
; Sets CH= 0000 0000 0000 0000b
; So AL = 0000 0000 0000 0000b
MOV DS, AX ; The Data Segment points to the starting address.
; Here AX = 42 35h
; So DS = 42 35h
ROR BX, CL ; Rotates the register right by 1 bit. The LSB wraps over to the
; MSB. If more than 1 bit needs to be rotated, set the number
;of bits to rotate in the CL register first
; Here BX= 07 5Ah and CL= 04h
; This BX= 0000 0111 0101 1010b
; So BX = 1010 0000 0111 0101b
12. Question no 11 in the chapter 3 in Microprocessors and interfacing 3rd
edition’s book.
Ans.
a. Copy AL to BL (MOV BL, AL)
b. Load 43h into CL (MOV CL, 43h)
c. Increment the contents of CX by 1 (INC CX, 1)
d. Copy SP to BP ( MOV BP, SP)
e. Add 07h to DL (ADD DL, 07h)
f. Multiply AL times BL ( MUL BL)
g. Copy AX to a memory location at offset 245Ah in data segment
(MOV [245Ah], AX)
h. Decrement SP by 1 (DEC SP, 1)
i. Rotate the most significant bit of AL into the least significant bit
position. ( ROL AL,1)
j. Copy DL into a memory location offset is in BX (MOV [BX],
DL)
k. Mask the lower 4 bits of BL (AND BL , 11110000b)
l. Set the most significant bit of AX to a 1 but don’t affect other bits.
( OR AX, 1000 0000 0000 0000b)
m. Invert the lower 4 bits of BL but don’t affect others. (XOR BL,
0000 1111b)
Part-II: Assembly Language
13.Which of the following names are legal in PC assembly language?
Ans.
a. TWO_WORDS (Legal)
b. ?1 (Legal)
a. Two words (Illegal because embedded blank is not allowed)
c. .@? (Legal)
d. $145 (Legal)
e. LET’S_GO (Illegal because (’) is not allowed)
f. T = . (Illegal because the period (.)must be first character
and embedded blank is not allowed)
14.Which of the following are legal numbers? If they are legal, tell whether
they are binary, decimal, or hex numbers.
Ans.
a. 246 (Legal , decimal)
b. 246h (Legal ,hexadecimal)
c. 1001 (Legal , decimal)
d. 1,101 (Illegal ',' is not allowed between digits)
e. 2A3h (Legal ,hexadecimal)
f. FFFEh (Illegal ,hexadecimal number must begin with digit)
g. 0Ah (Legal ,hexadecimal)
h. Bh (Illegal ,hexadecimal number must begin with digit)
a. 1110b (Legal ,binary)
i.
15.If it is legal, give data definition pseudo-ops to define each of the
following.
Ans.
a. A word variable A initialized to 52 (A DW 52)
b. A word variable WORD1, uninitialized (WORD1 DW ?)
c. A byte variable B, initialized to 25h (B DB 25h)
d. A byte variable C1, uninitialized (C1 DB ?)
e. A word variable WORD2, initialized to 65536 (WORD2 DW
65536)
f. A word array ARRAY1, initialized to the first five positive integers (i.e.
1-5) (ARRAY1 DW 1,2,3,4,5)
g. A constant BELL equal to 07h ( BELL EQU 07h)
h. A constant MSG equal to ‘THIS IS A MESSAGE$’ (MSG EQU
‘THIS IS A MESSAGE$’)
16.Suppose that the following data are loaded starting at offset 0000h
A DB 7
B DW 1ABCh
C DB 'HELLO'
a. Give the offset address assigned to variables A, B and C.
b. Give the hex contents of the byte at offset 0002h in hex.
c. Give the hex contents of the byte at offset 0004h in hex
d. Give the offset address of the character 'O' in “HELLO.”
Ans.
Offset Content Notes
0000 07 Content of A
0001 BC Part content of B
0002 1A Part content of B
0003 48 ASCII value of 'H' in hex
0004 65 ASCII value of 'e' in hex
0005 6C ASCII value of 'l' in hex
0006 6C ASCII value of 'l' in hex
0007 6F ASCII value of 'o' in hex
17.Tell whether each of the following instructions is legal or illegal.W1 and
W2 are word variables, and B1 and B2 are byte variables.
Ans.
a. MOV DS, AX (Legal)
b. MOV DS, 1000h (Illegal, can't move constant to segment register )
c. MOV CS, ES (Illegal, can't move between two segment registers)
d. MOV W1, DS (Legal)
e. XCHG W1, W2 (Illegal , can't exchange directly between two memory
location)
f. SUB 5,B1 (Illegal ,The destination can't be constant)
g. ADD B1, B2 (Illegal , can't add directly between two memory
location)
h. MOV W1, B1 (Illegal , can't add directly between two memory
location)
18.Using only MOV, ADD, SUB, INC, DEC, and NEG, translate the
following high-level language assignment statements into assembly
language. A, B, and C are word variables.
Ans.
a. A=B-A
MOV AX, A
NEG AX
ADD AX, B
MOV A, AX
b. A=-(A+1)
ADD A, 1
NEG A
c. C=A+B
MOV AX, A
ADD AX, B
MOV C, AX
d. B=3*B+7
MOV AX, B
ADD AX, B
ADD AX, B
ADD AX, B
ADD AX, 7
MOV B, AX
e. A=B-A-1
MOV AX, B
SUB AX, A
DEC AX
MOV A, AX
19.Write instructions (not a complete program) to do the following.
a. Read a character, and display it at the next position on the same line
b. Read an uppercase letter (omit error checking), and display it at the
next position on the same line in lower case.
Ans. a:
MOV AH, 1 ; keyboard input initialization for interrupt 21H
INT 21H
MOV BL, AL
MOV AH, 2 ; printing output initialization for interrupt 21h
MOV DL, 20H ; (20h) for blank space
INT 21H
MOV DL, BL
INT 21H
Ans. b:
MOV AH, 1 ; keyboard input initialization for interrupt 21h
INT 21H
MOV BL, AL
ADD BL, 20H ; convert to lowercase latter
MOV AH, 2 ; printing output initialization for interrupt 21h
MOV DL, 20H ; (20h) for blank space
INT 21H
MOV DL, BL
INT 21H
TeamBlackHole
V
I R
TeamBlackHole
V
I R

More Related Content

What's hot

8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directivesSARITHA REDDY
 
Static and Dynamic Read/Write memories
Static and Dynamic Read/Write memoriesStatic and Dynamic Read/Write memories
Static and Dynamic Read/Write memoriesAbhilash Nair
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction FormatDhrumil Panchal
 
Design and Fabrication of 4-bit processor
Design and Fabrication of  4-bit processorDesign and Fabrication of  4-bit processor
Design and Fabrication of 4-bit processorPriyatham Bollimpalli
 
Using Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersUsing Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersCorrado Santoro
 
Assembly Language Programming Of 8085
Assembly Language Programming Of 8085Assembly Language Programming Of 8085
Assembly Language Programming Of 8085techbed
 
flag register of 8086
flag register of 8086flag register of 8086
flag register of 8086asrithak
 
Instruction set of 8085
Instruction set  of 8085Instruction set  of 8085
Instruction set of 8085shiji v r
 
Computer registers
Computer registersComputer registers
Computer registersDeepikaT13
 
Counters & time delay
Counters & time delayCounters & time delay
Counters & time delayHemant Chetwani
 
8051 timer and counter 1
8051 timer and counter 18051 timer and counter 1
8051 timer and counter 1DominicHendry
 
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSORTRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSORSubash Sambath Kumar
 
Basic Computer Organization and Design
Basic Computer Organization and DesignBasic Computer Organization and Design
Basic Computer Organization and DesignKamal Acharya
 
8085 microproceesor ppt
8085 microproceesor ppt8085 microproceesor ppt
8085 microproceesor pptRJ Aniket
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Jay Patel
 
Chapter 3
Chapter 3Chapter 3
Chapter 3PRADEEP
 

What's hot (20)

8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
 
Static and Dynamic Read/Write memories
Static and Dynamic Read/Write memoriesStatic and Dynamic Read/Write memories
Static and Dynamic Read/Write memories
 
ARM- Programmer's Model
ARM- Programmer's ModelARM- Programmer's Model
ARM- Programmer's Model
 
Types of Instruction Format
Types of Instruction FormatTypes of Instruction Format
Types of Instruction Format
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
Design and Fabrication of 4-bit processor
Design and Fabrication of  4-bit processorDesign and Fabrication of  4-bit processor
Design and Fabrication of 4-bit processor
 
Using Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersUsing Timers in PIC18F Microcontrollers
Using Timers in PIC18F Microcontrollers
 
Pic16f84
Pic16f84Pic16f84
Pic16f84
 
Assembly Language Programming Of 8085
Assembly Language Programming Of 8085Assembly Language Programming Of 8085
Assembly Language Programming Of 8085
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
 
flag register of 8086
flag register of 8086flag register of 8086
flag register of 8086
 
Instruction set of 8085
Instruction set  of 8085Instruction set  of 8085
Instruction set of 8085
 
Computer registers
Computer registersComputer registers
Computer registers
 
Counters & time delay
Counters & time delayCounters & time delay
Counters & time delay
 
8051 timer and counter 1
8051 timer and counter 18051 timer and counter 1
8051 timer and counter 1
 
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSORTRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
 
Basic Computer Organization and Design
Basic Computer Organization and DesignBasic Computer Organization and Design
Basic Computer Organization and Design
 
8085 microproceesor ppt
8085 microproceesor ppt8085 microproceesor ppt
8085 microproceesor ppt
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 

Viewers also liked

Introduction to-microprocessors
Introduction to-microprocessorsIntroduction to-microprocessors
Introduction to-microprocessorsVolodymyr Ushenko
 
Microprocessor Architecture
Microprocessor ArchitectureMicroprocessor Architecture
Microprocessor ArchitectureAvijeet Negel
 
Microprocessor & Interfacing (Part-1) By Er. Swapnil V. Kaware
Microprocessor & Interfacing (Part-1) By Er. Swapnil V. KawareMicroprocessor & Interfacing (Part-1) By Er. Swapnil V. Kaware
Microprocessor & Interfacing (Part-1) By Er. Swapnil V. KawareProf. Swapnil V. Kaware
 
Microprocessor and-interfacing-techbymak
Microprocessor and-interfacing-techbymakMicroprocessor and-interfacing-techbymak
Microprocessor and-interfacing-techbymakAkshay Makadiya
 
Microprocessor & Interfacing (Part-2) By Er. Swapnil V. Kaware
Microprocessor & Interfacing (Part-2) By Er. Swapnil V. KawareMicroprocessor & Interfacing (Part-2) By Er. Swapnil V. Kaware
Microprocessor & Interfacing (Part-2) By Er. Swapnil V. KawareProf. Swapnil V. Kaware
 
Microprocessor and Interfacing Notes
Microprocessor and Interfacing NotesMicroprocessor and Interfacing Notes
Microprocessor and Interfacing NotesAkshansh Chaudhary
 
1.microprocessor
1.microprocessor1.microprocessor
1.microprocessorraja p
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programmingWondeson Emeye
 
Transmission Media
Transmission MediaTransmission Media
Transmission MediaSourav Roy
 

Viewers also liked (12)

Introduction to-microprocessors
Introduction to-microprocessorsIntroduction to-microprocessors
Introduction to-microprocessors
 
Microprocessor Architecture
Microprocessor ArchitectureMicroprocessor Architecture
Microprocessor Architecture
 
Microprocessor & Interfacing (Part-1) By Er. Swapnil V. Kaware
Microprocessor & Interfacing (Part-1) By Er. Swapnil V. KawareMicroprocessor & Interfacing (Part-1) By Er. Swapnil V. Kaware
Microprocessor & Interfacing (Part-1) By Er. Swapnil V. Kaware
 
Microprocessor and-interfacing-techbymak
Microprocessor and-interfacing-techbymakMicroprocessor and-interfacing-techbymak
Microprocessor and-interfacing-techbymak
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Microprocessor & Interfacing (Part-2) By Er. Swapnil V. Kaware
Microprocessor & Interfacing (Part-2) By Er. Swapnil V. KawareMicroprocessor & Interfacing (Part-2) By Er. Swapnil V. Kaware
Microprocessor & Interfacing (Part-2) By Er. Swapnil V. Kaware
 
Microprocessor and Interfacing Notes
Microprocessor and Interfacing NotesMicroprocessor and Interfacing Notes
Microprocessor and Interfacing Notes
 
1.microprocessor
1.microprocessor1.microprocessor
1.microprocessor
 
Chapter5
Chapter5Chapter5
Chapter5
 
Mpmc lab
Mpmc labMpmc lab
Mpmc lab
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
 
Transmission Media
Transmission MediaTransmission Media
Transmission Media
 

Similar to Microprocessor & Assembly language by team blackhole

Assembly_Language _Programming_UNIT.pptx
Assembly_Language _Programming_UNIT.pptxAssembly_Language _Programming_UNIT.pptx
Assembly_Language _Programming_UNIT.pptxVickyThakur61
 
8086_architecture MMC PPT.ppt
8086_architecture MMC PPT.ppt8086_architecture MMC PPT.ppt
8086_architecture MMC PPT.pptJamesAlpha3
 
Presentation on 8086 microprocessor
Presentation on 8086 microprocessorPresentation on 8086 microprocessor
Presentation on 8086 microprocessorDiponkor Bala
 
EC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptxEC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptxGobinathAECEJRF1101
 
architecture memory interfacing
architecture memory interfacingarchitecture memory interfacing
architecture memory interfacingShamsul Huda
 
Microprocessors and microcontrollers short answer questions and answers
Microprocessors and microcontrollers short answer questions and answersMicroprocessors and microcontrollers short answer questions and answers
Microprocessors and microcontrollers short answer questions and answersAbhijith Augustine
 
Ec 1303 microprocessor_its_applications
Ec 1303 microprocessor_its_applicationsEc 1303 microprocessor_its_applications
Ec 1303 microprocessor_its_applicationsMerin Jesuraj
 
Microprocessor VIVA.pptx
Microprocessor VIVA.pptxMicroprocessor VIVA.pptx
Microprocessor VIVA.pptxShaurya Tyagi
 
Architecture OF 8085
Architecture OF 8085Architecture OF 8085
Architecture OF 8085muneer.k
 
8085 microprocessor
8085 microprocessor8085 microprocessor
8085 microprocessorgohanraw
 
8086 Architecture.pptx
8086 Architecture.pptx8086 Architecture.pptx
8086 Architecture.pptxvishal299181
 
Microprocessor 8086 nitin_p
Microprocessor 8086 nitin_pMicroprocessor 8086 nitin_p
Microprocessor 8086 nitin_pnitinahire15
 
Microprocessor 8086 8087_nitin ahire
Microprocessor 8086 8087_nitin ahireMicroprocessor 8086 8087_nitin ahire
Microprocessor 8086 8087_nitin ahireNitin Ahire
 
Microprocessor 8085
Microprocessor 8085Microprocessor 8085
Microprocessor 8085Dhaval Barot
 

Similar to Microprocessor & Assembly language by team blackhole (20)

Assembly_Language _Programming_UNIT.pptx
Assembly_Language _Programming_UNIT.pptxAssembly_Language _Programming_UNIT.pptx
Assembly_Language _Programming_UNIT.pptx
 
Mpi chapter 2
Mpi chapter 2Mpi chapter 2
Mpi chapter 2
 
8086_architecture MMC PPT.ppt
8086_architecture MMC PPT.ppt8086_architecture MMC PPT.ppt
8086_architecture MMC PPT.ppt
 
Presentation on 8086 microprocessor
Presentation on 8086 microprocessorPresentation on 8086 microprocessor
Presentation on 8086 microprocessor
 
EC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptxEC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptx
 
8086 ppt
8086 ppt8086 ppt
8086 ppt
 
architecture memory interfacing
architecture memory interfacingarchitecture memory interfacing
architecture memory interfacing
 
Microprocessors and microcontrollers short answer questions and answers
Microprocessors and microcontrollers short answer questions and answersMicroprocessors and microcontrollers short answer questions and answers
Microprocessors and microcontrollers short answer questions and answers
 
Ec 1303 microprocessor_its_applications
Ec 1303 microprocessor_its_applicationsEc 1303 microprocessor_its_applications
Ec 1303 microprocessor_its_applications
 
8086
80868086
8086
 
Microprocessor VIVA.pptx
Microprocessor VIVA.pptxMicroprocessor VIVA.pptx
Microprocessor VIVA.pptx
 
Architecture OF 8085
Architecture OF 8085Architecture OF 8085
Architecture OF 8085
 
8085 microprocessor
8085 microprocessor8085 microprocessor
8085 microprocessor
 
8085
80858085
8085
 
8085
80858085
8085
 
8086 Architecture.pptx
8086 Architecture.pptx8086 Architecture.pptx
8086 Architecture.pptx
 
Microprocessor 8086 nitin_p
Microprocessor 8086 nitin_pMicroprocessor 8086 nitin_p
Microprocessor 8086 nitin_p
 
Microprocessor 8086 8087_nitin ahire
Microprocessor 8086 8087_nitin ahireMicroprocessor 8086 8087_nitin ahire
Microprocessor 8086 8087_nitin ahire
 
Microprocessor 8085
Microprocessor 8085Microprocessor 8085
Microprocessor 8085
 
80386 & 80486
80386 & 8048680386 & 80486
80386 & 80486
 

Recently uploaded

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Recently uploaded (20)

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

Microprocessor & Assembly language by team blackhole

  • 1. SYLHET INTERNATIONAL UNIVERSITY Shamimabad, Baghbari, Sylhet-3100 Assignment Title: Microprocessors and Interfacing & Assembly Language Course Title: Microprocessors and Assembly Language Course Code: 333 Credit: 3 & Course Title: Microprocessors and Assembly Language Lab Course Code: 334 Credit: 1.5 Created by : TeamBlackHole TeamBlackHole V I R
  • 2. Part-I: Microprocessor and Interfacing 1. Describe the sequence of signals that occurs on the address bus, the control bus, and the data bus when a simple microcomputer fetches an instruction? Ans: i. A microcomputer fetches each program instruction in sequence, decodes the instruction, and executes it. ii. The CPU in a microcomputer fetches instructions or reads data from memory by sending out an address on the address bus and a Memory Read signal on the control bus. The memory outputs the addressed instruction or data word to the CPU on the data bus. iii. The CPU writes a data word to memory by sending out an address on the address bus, sending out the data word on the data bus, and sending a Memory write signal to memory on the control bus. iv. To read data from a port, the CPU sends out the port address on the address bus and sends an I/O Read signal to the port device on the control bus. Data from the port comes into the CPU on the data bus. v. To write data to a port, the CPU sends out the port address on the address bus, sends out the data to be written to the port on the data bus, and sends an I/O Write signal to the port device on the control bus. 2. What determines whether a microprocessor is considered an 8-bit, a 16- bit or a 32-bit device? Ans: The word size (8 bits, 16 bits, or 32 bits) of a microprocessor is the size of the data path in the execution unit. Typically, this is the size of the accumulator. Note: This is the execution unit size, not the bus interface unit size. An example where this matters is the 8088, which is a 16 bit computer running on an 8 bit bus. The 8085 is 8 bits. The 8086/8088 is 16 bits. The 80386 is 32 bits. Modern Intel processors are 64 bits.
  • 3. 3. a. How many address line does an 8086 have? Ans: There are 20 address lines on the 8086, A19 - A0, of which the low order 16, A15 - A0, With 20 address lines, and the 8086 can address 1,048,576 bytes. b. How many memory address does this number of address line allow the 8086 to access directly? Ans: The 8086/8088 has 20 address lines. It can access 220 , or 1MB, or 1,048,576 bytes of memory. c. At any given time an 8086 works with four segments in this address space, how many bytes are contained in each segment? Ans: 64 kilobyte are contained in each segment. 4. What is the main difference between 8086 and 8088? DIFFERENCE BETWEEN 8086 AND 8088 MICROPROCESSOR 8086 Microprocessor 8088 Microprocessor 8086 has 16-bit data lines. 8088 has 8-bit data lines. 8086 is available in three clock speed 5 MHz, 8 MHz and 10 MHz Whereas 8088 is available in two clock speed 5 MHz and 8 MHz The memory space of 8086 is organized as two 512KB banks. The memory space of 8088 is implemented as single 1M*8 Memory bank. 8086 has 6-byte instruction queue. 8088 has 4-byte instruction queue. The 8086 has BHE (Bank high enable) The 8088 has SSO status signal. The 8086 can read or write 8-bit or 16-bit data at a time. The 8088 can read/write 8-bit data at a time. The I/O voltages level for 8086 is measured at 2.5 mA. The I/O voltages level for 8086 is measured at 2 mA. The 8086 draws maximum supply current of 360mA. The 8086 draws maximum supply current of 340mA.
  • 4. DIFFERENCE BETWEEN 8085 AND 8086 MICROPROCESSOR The difference between 8085 and 8086 are given below. 8085 Microprocessor 8086 Microprocessor It is 8-bit Microprocessor It is 16-bit Microprocessor It has 16-bit address line. It has 20-bit address line. It has 8-bit data bus. It has 16-bit data bus. The clock speed of 8085 microprocessor is 3 MHz The clock speed of 8086 can vary between 5, 8 and 10 MHz for three different microprocessor. It has 5 flags. It has 9 flags. It does not support pipe-lining. It supports pipe-lining. It’s operate on clock cycle with 50% duty cycle. It’s operate on clock cycle with 33% duty cycle. It does not support memory segmentation It support memory segmentation The 8085 microprocessor has 6500 transistor. The 8086 microprocessor has 29000 transistors. The 8085 microprocessor is Accumulator based processor. The 8086 microprocessor is general purpose register based processor. The 8085 has no minimum or maximum mode. The 8086 has minimum and maximum mode. In 8085 microprocessor only one processor is being used. In 8086 more than one processor is being used (additional external processor can be used). In 8085 microprocessor only 64 KB memory is used together. In 8086 microprocessor 1 MB is used. 5. a. Describe the function of the 8086 queue? Ans: The 8086/8088 instruction queue is a buffer that holds opcode bytes that have been prefetched by the bus interface unit. This speeds up operations of the processor by helping to reduce fetch latency, i.e. to improve the probability that an opcode byte fetched by the processor is already available. b. What are the functions of execution unit in 8086 Intel? Ans: Basically the function of execution unit in 8086 is to perform all arithmetic and logic operations. It tells the Bus Interface unit (BIU) where to fetch instructions and data from. It has 4 components: Control circuitry, ALU, Flag registers and general purpose registers.
  • 5. 1. Control circuits-it directs all the internal operations. 2. ALU-performs all logic operations. 3. General purpose registers-used to store data during execution. 4. Flag registers-it has a 16bit flag register containing 9 flags that are set for certain conditions during any operation. Ex: carry flag (whenever there is a carry). It also has a decoder to decode the fetched instructions. c. How does the queue speed up processing? Ans: The instruction prefetch queue speeds up the processing of microprocessors by attempting to have the next opcode bytes available to the execution unit before it actually needs them. This works because, statistically, there is time spent by the execution unit in executing a particular instruction; time that the bus interface unit can use to go ahead and pre-fetch the next opcode bytes. Sometimes, this results in a loss of time, because the execution unit may branch to some other location. Modern processors attempt to sidestep that by using branch prediction algorithms. 6. If the code segment for an 8086 program starts at address 70400h, what number will be CS register? Ans: 7040H 7. What physical address represented by a. 4370:561EH b. 7A32:0028H TeamBlackHole V I R
  • 6. Ans: a. 43700 561𝐸 48𝐷1𝐸 Ans: b. 7A320 0028 7𝐴348 8. Why does 8086 use only 6 byte queue? Ans: Because the longest instruction in instruction set is 6 bytes long. Hence with a 6 byte long queue it is possible to pre-fetch even longest instruction in the instruction set. 9. Describe the dived-by-zero interrupt? Divide-by-zero interrupt: If u attempt to divide an operand by zero, the 8086 will automatically interrupt the currently executing program More specifically, 8086 will automatically do a type zero interrupt if – The result of a DIV operation or an IDIV operation is too large to fit in the destination register. At the end of each instruction cycle, 8086 checks to see if any interrupts have been requested. If an interrupt has been requested – the 8086 responds to the interrupt by stepping through the following series of major actions: • It decrements the stack pointer by 2 and pushes the flag register on the stack. • It disables the INTR interrupt input – by clearing the interrupt flag (IF) in the flag register. • It resets the trap flag (TF) in the flag register. • It decrements the stack pointer by 2 and pushes the current code segment register contents on the stack.
  • 7. • It decrements the stack pointer again by 2 and pushes the current instruction pointer contents on the stack. • It does an indirect fat jump to the start of the procedure you wrote to respond to the interrupt. 10.List out the major steps in developing an assembly language program. • Program Development Steps • Defining the Problem • Representing program operations • Finding the right instructions • Writing a program Defining the problems • Find out the problem. For example: Sensing temperature, detecting fire, detecting smock, decoder-encoder, intelligent machine controller etc. Representing program operations • Formula or sequence of operations used to solve a programming problem is called as the algorithm. • There are two ways of representing algorithms: • Flowchart • Structured programming and pseudo code Finding the right instructions • Instructions in 8086 are mainly divided into following categories • Data Transfer Instructions • Arithmetic Instruction • Bit manipulation Instruction
  • 8. • String Instruction • Program execution transfer Instruction • Processor control Instruction Writing a program • We need to do the following steps to write the program effectively: • INITIALIZATION INSTRUCTIONS: used to initialize various parts of the program like segment registers, flags and programmable port devices. • STANDARD PROGRAM FORMAT: it’s a tabular format containing ADDRESS, DATA OR CODE, LABELS, MNEM, OPERAND(S) and COMMENTS as the columns. • DOCUMENTATION: you should document the program. E.g. each page of the document contains page number and name of the program, heading block containing the abstract about the program, comments should be added wherever necessary. 11.Question no 8 in the chapter 3 in Microprocessors and interfacing 3rd edition’s book. Ans. MOV AX, BX ; This copies the contents of the BX (075A) register into the ;AX register. MOV CL, 37H ; This does the same as the above except that the number is ;given in hexadecimal. Hexadecimal numbers MUST begin ;with a digit and end with a "h". This copies 37H into CL ;register. INC BX ; add one to contents of BX register. MOV CX, [246BH] ; Copies the contents of memory location [246BH] into ;CX register. MOV CX, 246BH ; This copies 246BH into CL register. ADD AL, DH ; This add AL and DH into AL register.
  • 9. MUL BX ; DX:AX = BX *AX ; Here BX= 07 5A and AX=42 35 ; So DX:AX = 1E6B9A2h (1111001101011100110100010b) ; CF=0, OF=0. DEC BP ; Decrement the value of base pointer by 1 ; BP=2467h DIV BL ; Divide AX by value in BL. result in AL, remainder in AH ; AL=AX/BL, AH=Reminder ; Here AX= 42 35 and BL=5A ; So AL=BCh and AH=0h SUB AX, DX ; Subtract DX value from the AX value ; Here AX= 4235 and DX= 3302 ; AX = F33h OR CL, BL ; Preforms a Boolean OR operation. The result is stored in the ; destination register. ; Here CL = 04h and BL = 5Ah ; Sets CL = 0000 0000 0000 0100b ; and BL = 0000 0000 0101 1010b ; Sets CL = 0000 0000 0101 1110b NOT AH ; Performs a Boolean NOT operation on the specified register. ; Here AH = 42h ; Sets AH =0000 0000 0100 0010 ; Sets AH = 1111 1111 1011 1101b ROL BX, 1 ; Rotates the register left by 1 bit. The MSB wraps over to the ;LSB. If more than 1 bit needs to be rotated, set the number of ;bits to rotate in the CL register first. ; Here AX = 0100 0010 0011 0101b ; So AX = 1000 0100 0110 1010b AND AL, CH ; Performs a Boolean AND operation. The result is stored in ;the destination register. ; Here AL = 35h and CH= 00
  • 10. ; Sets AL= 0000 0000 0011 0101b ; Sets CH= 0000 0000 0000 0000b ; So AL = 0000 0000 0000 0000b MOV DS, AX ; The Data Segment points to the starting address. ; Here AX = 42 35h ; So DS = 42 35h ROR BX, CL ; Rotates the register right by 1 bit. The LSB wraps over to the ; MSB. If more than 1 bit needs to be rotated, set the number ;of bits to rotate in the CL register first ; Here BX= 07 5Ah and CL= 04h ; This BX= 0000 0111 0101 1010b ; So BX = 1010 0000 0111 0101b
  • 11. 12. Question no 11 in the chapter 3 in Microprocessors and interfacing 3rd edition’s book. Ans. a. Copy AL to BL (MOV BL, AL) b. Load 43h into CL (MOV CL, 43h) c. Increment the contents of CX by 1 (INC CX, 1) d. Copy SP to BP ( MOV BP, SP) e. Add 07h to DL (ADD DL, 07h) f. Multiply AL times BL ( MUL BL) g. Copy AX to a memory location at offset 245Ah in data segment (MOV [245Ah], AX) h. Decrement SP by 1 (DEC SP, 1) i. Rotate the most significant bit of AL into the least significant bit position. ( ROL AL,1) j. Copy DL into a memory location offset is in BX (MOV [BX], DL) k. Mask the lower 4 bits of BL (AND BL , 11110000b) l. Set the most significant bit of AX to a 1 but don’t affect other bits. ( OR AX, 1000 0000 0000 0000b) m. Invert the lower 4 bits of BL but don’t affect others. (XOR BL, 0000 1111b)
  • 12. Part-II: Assembly Language 13.Which of the following names are legal in PC assembly language? Ans. a. TWO_WORDS (Legal) b. ?1 (Legal) a. Two words (Illegal because embedded blank is not allowed) c. .@? (Legal) d. $145 (Legal) e. LET’S_GO (Illegal because (’) is not allowed) f. T = . (Illegal because the period (.)must be first character and embedded blank is not allowed) 14.Which of the following are legal numbers? If they are legal, tell whether they are binary, decimal, or hex numbers. Ans. a. 246 (Legal , decimal) b. 246h (Legal ,hexadecimal) c. 1001 (Legal , decimal) d. 1,101 (Illegal ',' is not allowed between digits) e. 2A3h (Legal ,hexadecimal) f. FFFEh (Illegal ,hexadecimal number must begin with digit) g. 0Ah (Legal ,hexadecimal) h. Bh (Illegal ,hexadecimal number must begin with digit) a. 1110b (Legal ,binary) i. 15.If it is legal, give data definition pseudo-ops to define each of the following. Ans. a. A word variable A initialized to 52 (A DW 52)
  • 13. b. A word variable WORD1, uninitialized (WORD1 DW ?) c. A byte variable B, initialized to 25h (B DB 25h) d. A byte variable C1, uninitialized (C1 DB ?) e. A word variable WORD2, initialized to 65536 (WORD2 DW 65536) f. A word array ARRAY1, initialized to the first five positive integers (i.e. 1-5) (ARRAY1 DW 1,2,3,4,5) g. A constant BELL equal to 07h ( BELL EQU 07h) h. A constant MSG equal to ‘THIS IS A MESSAGE$’ (MSG EQU ‘THIS IS A MESSAGE$’) 16.Suppose that the following data are loaded starting at offset 0000h A DB 7 B DW 1ABCh C DB 'HELLO' a. Give the offset address assigned to variables A, B and C. b. Give the hex contents of the byte at offset 0002h in hex. c. Give the hex contents of the byte at offset 0004h in hex d. Give the offset address of the character 'O' in “HELLO.” Ans. Offset Content Notes 0000 07 Content of A 0001 BC Part content of B 0002 1A Part content of B 0003 48 ASCII value of 'H' in hex 0004 65 ASCII value of 'e' in hex 0005 6C ASCII value of 'l' in hex 0006 6C ASCII value of 'l' in hex 0007 6F ASCII value of 'o' in hex 17.Tell whether each of the following instructions is legal or illegal.W1 and W2 are word variables, and B1 and B2 are byte variables. Ans. a. MOV DS, AX (Legal) b. MOV DS, 1000h (Illegal, can't move constant to segment register ) c. MOV CS, ES (Illegal, can't move between two segment registers) d. MOV W1, DS (Legal)
  • 14. e. XCHG W1, W2 (Illegal , can't exchange directly between two memory location) f. SUB 5,B1 (Illegal ,The destination can't be constant) g. ADD B1, B2 (Illegal , can't add directly between two memory location) h. MOV W1, B1 (Illegal , can't add directly between two memory location) 18.Using only MOV, ADD, SUB, INC, DEC, and NEG, translate the following high-level language assignment statements into assembly language. A, B, and C are word variables. Ans. a. A=B-A MOV AX, A NEG AX ADD AX, B MOV A, AX b. A=-(A+1) ADD A, 1 NEG A c. C=A+B MOV AX, A ADD AX, B MOV C, AX d. B=3*B+7
  • 15. MOV AX, B ADD AX, B ADD AX, B ADD AX, B ADD AX, 7 MOV B, AX e. A=B-A-1 MOV AX, B SUB AX, A DEC AX MOV A, AX 19.Write instructions (not a complete program) to do the following. a. Read a character, and display it at the next position on the same line b. Read an uppercase letter (omit error checking), and display it at the next position on the same line in lower case. Ans. a: MOV AH, 1 ; keyboard input initialization for interrupt 21H INT 21H MOV BL, AL MOV AH, 2 ; printing output initialization for interrupt 21h MOV DL, 20H ; (20h) for blank space INT 21H MOV DL, BL INT 21H Ans. b:
  • 16. MOV AH, 1 ; keyboard input initialization for interrupt 21h INT 21H MOV BL, AL ADD BL, 20H ; convert to lowercase latter MOV AH, 2 ; printing output initialization for interrupt 21h MOV DL, 20H ; (20h) for blank space INT 21H MOV DL, BL INT 21H TeamBlackHole V I R TeamBlackHole V I R