EEE 326 Lecture-2 & 3. Micro LAB-2 & 3
EEE 326 Lecture-2 & 3. Micro LAB-2 & 3
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.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
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
3. Follow the procedure given below to prepare machine code for your program:
Page 1|4
Source listing [NUL.LST]: filename Press ENTER
4. Open the file “filename.lst” using notepad. Here you will find respective machine code for
each instruction.
7. Write the machine codes in the appropriate memory address according the following table:
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.
Quiz:
Question 1.
Which flag bits may change after addition or subtraction according to result.
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 ------------
Page 3|4
Question 7.
Suppose 805EH is an unsigned number. The decimal equivalent of this number is ------------.
Question 8.
ORG 1000H indicates ------------.
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.
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.
The connector of computer RS-232C is 25 pin and RS-232C of MDA-8086 is 9 pin, must be
connect like figure1.
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.
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.
3. Follow the procedure given below to prepare machine code for your program:
Source filename [.ASM]: filename Press ENTER
5. Follow the procedure given below to prepare HEX (ABS) file for your program:
[.OBJ]:
Object/Command File 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:
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.
P a g e 7 | 10
DIV BL
MOV AX, −205
MOV BL, 4
IDIV BL
HLT
Questions:
(a) True
(b) False
Question 2.
Which flag bits may change after addition or subtraction according to result.
Question 3.
Match the items on the left with the items on the right for the following instruction
CMP 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.
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