0% found this document useful (0 votes)
103 views14 pages

EEE 326 Lecture-2 & 3. Micro LAB-2 & 3

Familiarization with “Serial Monitor” mode operation of MDA-8086 and verification of arithmetic operations.

Uploaded by

enalmiah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views14 pages

EEE 326 Lecture-2 & 3. Micro LAB-2 & 3

Familiarization with “Serial Monitor” mode operation of MDA-8086 and verification of arithmetic operations.

Uploaded by

enalmiah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Manarat International University

Department of Electrical and Electronic Engineering


Microprocessor and Interfacing LAB

Experiment No. 02: To load the machine codes of a sample program to MDA-8086, execution
of instructions in single step mode and verification of results.

2.1 Objectives: The objectives of this experiment are-

a) To learn the procedure of loading program in RAM of MDA-8086 in “Machine


Code” mode.
b) To load the program to MDA-8086, execute the program in single step mode and
verify the result.

2.2 Instructions/Program:

CODE SEGMENT
ASSUME CS: CODE, DS: CODE
ORG 1000H
MOV AX, 805EH
MOV DX, 0540H
MOV CL, 02H
MOV CH, 91H
ADD AX, DX
MOV BX, 0050H
SUB AX, BX
INC DL
DEC BX
XCHG CX, BX
HLT
CODE ENDS
END

2.3 Experiment Procedures:

1. Write the above program in notepad and save the file as “filename.asm”. Place this file in the
folder where “masm.exe” exists.

2. Go to command prompt and execute “masm.exe”. You will see the following message

Microsoft (R) Macro Assembler Version 5.10


Copyright (C) Misrosoft Corp 1981, 1988. All right reserved. Source filename [.ASM]:

3. Follow the procedure given below to prepare machine code for your program:

Source filename [.ASM]: filename Press ENTER

Object filename [C:filename.OBJ]: Press ENTER

Page 1|4
Source listing [NUL.LST]: filename Press ENTER

Cross reference [NUL.CRF]: Press ENTER

4. Open the file “filename.lst” using notepad. Here you will find respective machine code for
each instruction.

5. Turn on the 8086 microprocessor kit

6. Set the address 0000H: 1000H in MDA-8086 kit.

7. Write the machine codes in the appropriate memory address according the following table:

Seg. Address Offset Address Machine Code Instruction / Mnemonics


0000H 1000 B8 805E MOV AX, 805EH
0000H 1003 BA 0540 MOV DX, 0540H
0000H 1006 B1 02 MOV CL, 02H
0000H 1008 B5 91 MOV CH, 91H
0000H 100A 03 C2 ADD AX, DX
0000H 100C BB 0050 MOV BX, 0050H
0000H 100F 2B C3 SUB AX, BX
0000H 1011 FE C2 INC DL
0000H 1013 4B DEC BX
0000H 1014 87 CB XCHG CX, BX
0000H 1016 F4 HLT

8. Execute this program in single step using “STP”. Observe the register contents after execution
of each instruction and note down in the data table. Perform theoretical calculations and verify
results.

2.4 Data Table:

Instruction AX BX CX DX Set Flag


MOV AX, 805EH Bit(s)
MOV DX, 0540H
MOV CL, 02H
MOV CH, 91H
ADD AX, DX
MOV BX, 0050H
SUB AX, BX
INC DL
DEC BX
XCHG CX, BX
HLT
Page 2|4
Question
Write down the flags of 8086 microprocessors. Describe the flags of 8086 microprocessors.

Quiz:

Question 1.
Which flag bits may change after addition or subtraction according to result.

(a) Carry Flag (b) Parity Flag


(c) Auxiliary Carry (d) Trap Flag
(e) All of them

Question 2.
How many conditional flags are here in 8086 microprocessors?

(a) 4 (b) 6
(c) 3 (d) 9

Question 3.
The size of flag resister is ------------------ bit among which ------------------- bits are active.

Question 4.
Find the content of AX after following instructions ------------

MOV BX, F230H


MOV DX, F009H
MOV AL, 1284H
MOV AH, DH
Question 5.
Find the status of different conditional flag bits after executing following instructions.

MOV CX, 101FH


MOV DX, F009H
XCHG CH, DL
MOV DX, CX
Question 6.
Suppose 805EH is a sign numbers. The decimal equivalent of this number is ------------.

Page 3|4
Question 7.
Suppose 805EH is an unsigned number. The decimal equivalent of this number is ------------.

Question 8.
ORG 1000H indicates ------------.

(a) writing of machine code starts from


(b) initial IP is 1000H
(c) segment address is set to 1000H
(d) turn on 8086 microprocessors bit

Question 9.
Suppose set address to write machine code is 0000H: 1000H. Find the content of CS and IP
register after writing the following machine codes.

B8 805E
BA 0540

Page 4|4
Manarat International University
Department of Electrical and Electronic Engineering
Microprocessor and Interfacing LAB

Experiment No. 03: Familiarization with “Serial Monitor” mode operation of MDA-8086
and verification of arithmetic operations.

3.1 Objective: The objectives of this experiment are-


a) To familiarize with the operation of MDA-8086 in “Serial Monitor” mode.
b) To learn the procedure of loading program in RAM of MDA-8086 in “Serial
Monitor”
mode.
c) To load a program containing arithmetic operations to MDA-8086, execute the
program in single step mode and verify the results.

3.2 Serial Monitor:

Serial monitor is the basic monitor program to perform data communication between MDA-
8086 and a computer. So as to use serial monitor, we have to move jumper P1 which located
on the PCB like this.

3.3 Connection between computer and MDA-8086

The connector of computer RS-232C is 25 pin and RS-232C of MDA-8086 is 9 pin, must be
connect like figure1.

Figure1: PC 25 PIN - MDA-8086 9 PIN connection

When the connector of computer RS-232C is 9 pin and RS-232C of MDA-8086 is 9 pin,
must be connected like figure 2
Figure 2: PC 9 PIN - MDA-8086 9 PIN connection

Data communication between MDA-8086 and a computer need fixing initial of WinComm
software. When we press F5 key, following is displayed and the step of fixing initial is like as
follows.

3.4 Operation of serial monitor command

User can only use command which stored at serial monitor. Serial monitor can execute to
command when user type command and then CR (carriage return) key. If there is no any
command at serial monitor, error message will be displayed with bell sound and serial monitor
prompt will be displayed again.

P a g e 2 | 10
P a g e 3 | 10
P a g e 4 | 10
3.5 Program:
CODE SEGMENT
ASSUME CS: CODE, DS: CODE
AX,
MOV 0001H
AX,
ADD 6789H
STC
AX,
ADC 0488H
;
AX,
SUB 156FH
STC
AX,
SBB 080FH
;
MOV AX, 00FEH
INC AL
DEC AL
CBW
NEG AL
;
MOV
AL,
F0H
MOV
BL,
11H
MUL BL
;
MOV AX,
F000H
MOV BX,
1234H
IMUL BX
;
MOV AX,
00F0H
MOV BL,
10H
DIV BL

P a g e 5 | 10
;
MOV AX, −205
MOV BL, 4
IDIV BL
;
HLT
CODE ENDS
END
3.6 Experiment Requirements:
1. 8086 microprocessor kit.
2. Assembler “MASM” and loader “LOD186”.
3. WinComm.
3.7 Experiment Procedures:
1. Write the above program in notepad and save the file as “filename.asm”. Place this file
in the folder where “masm.exe” exists.

2. Go to command prompt and execute “masm.exe”. You will see the following
message Microsoft (R) Macro Assembler Version 5.10
Copyright (C) Microsoft Corp 1981, 1988. All right reserved.

Source filename [.ASM]:

3. Follow the procedure given below to prepare machine code for your program:
Source filename [.ASM]: filename Press ENTER

Object filename [C: file name.OBJ]: Press ENTER

Source listing [NUL.LST]: filename Press ENTER

Cross reference [NUL.CRF]: Press ENTER

4. Execute “LOD186.exe”. You will see the following


message Paragon LOD186 Loader-Version 4.0h
Copyright (C) 1983 - 1986 Microtec Research Inc.
ALL RIGHT RESERVED.

Object/Command File [.OBJ]:

5. Follow the procedure given below to prepare HEX (ABS) file for your program:
[.OBJ]:
Object/Command File filename Press ENTER

Output Object File [C:filename.ABS]: Press ENTER


[C:NUL.MAP]
Map Filename : Press ENTER

**LOAD COMPLETE

P a g e 6 | 10
6. Turn on the 8086 microprocessor kit

7. Open the “Wincomm” window. Press “L” then “Enter”. You will see the following message:

** Serial Monitor 1.0 **


** Midas 335-0964/5 **

8086 >L Press ENTER

Down load start!!

8. Strike PgUp or F3 key of your keyboard. A new window will appear. Locate the
“filename.ABS” file and open it.

9. You will observe that file download has started. A message like the following one will be
shown:
:14100000B800008ED88EC0BB00208B078A6F028A4F038BEBB6
:101014003E8B5604268B76068B7E088B1E0A20CCCC
:0E20000012345678ABCDF0146853B1C41020E2
:00000001FF
OK completed!!

10. After loading the program, execute it in single step mode. Fill up the data table and
verify the results.

3.8 Data Table:


Offset Instruction/ AX BX DX Set Flag IP
Address Mnemonics Bits Address
INITIAL
STATUS
MOV AX, 0001H
ADD AX, 6789H
STC
ADC AX, 0488H
SUB Ax, 156FH
STC
SBB AX, 080FH
MOV AX, 00FEH
INC AL
DEC AL
CBW
NEG AL
MOV AL, F0H
MOV BL, 11H
MUL BL
MOV AX, F000H
MOV BX, 1234H
IMUL BX
MOV AX, 00F0H
MOV BL, 10H

P a g e 7 | 10
DIV BL
MOV AX, −205
MOV BL, 4
IDIV BL
HLT

Questions:

a) What is the function of INC BYTYE PTR [BX] instruction?


b) What will occur after CMP CL, BL instruction?
c) Write instructions to multiply 3 with 4.
Quiz
Question 1.
INC BYTE PTR[BX] instruction adds 1 to the byte content of stack segment memory location
addressed by BX.

(a) True
(b) False

Question 2.
Which flag bits may change after addition or subtraction according to result.

(a) Carry Flag


(b) Trap Flag
(c) Auxiliary Carry
(d) Parity Flag
(e) All of them

Question 3.
Match the items on the left with the items on the right for the following instruction
CMP CL, BL

CF=0 ZF=1 SF=0 CL>BL


CF=0 ZF=0 SF=0 CL=BL
CF=1 ZF=0 SF=1 CL<BL

P a g e 8 | 10
Question 4.
In 8-bit multiplication, multiplicand is always stays in .............................. register.

Question 5.
Which will be the content of AH after executing following instructions?
MOV AL, F0H
CBW

(a) 0b11111111
(b) 0b10101010
(c) 0b11110000
(d) 0b00000000
(e) 0b00001111

Question 6.
CWD copies the sign of a word in to all the bits of the ……….......... register.
Question 7.
Which one of the followings is a subtraction instruction?

(a) TEST
(b) CBW
(c) NEG
(d) CMP
(e) DAA

Question 8.
For a 16-bit division, match the items on the left with the items on the right.

Remainder appears in DX register


Dividend stored in AX register
Divider stored in any 16-bit register or memory.
Quotient appears in DX-AX register
Question 9.
Which of the flag bits are changes in CMP instructions?

(a) Overflow Flag


(b) Carry Flag
(c) Sign Flag
(d) Zero Flag
(e) Interrupt Flag

P a g e 9 | 10
Question 10.
Suppose, 1001 is a 4-bit sign number. Which one of the following will be the decimal equivalent
of this number?

(a) -1
(b) -3
(c) -6
(d) -7

Question 11.
Which instruction set is correct to multiply 3 with 4?

(a)

(b)

(c)

(d)

Question 12.
Which one is not an arithmetic Instructions?

(a) CMP
(b) DEC
(c) CBW
(d) SBB
(e) TEST

P a g e 10 | 10

You might also like