MIC Project Report2
MIC Project Report2
MIC Project Report2
➢ Introduction:
8086 Microprocessor was the first 16-bit microprocessor developed by Intel Corporation. This
8086 Microprocessor have 40 pins and is operate at 5 volts DC supply.
For this subject we have done this project using the MACRO directive. In this whole micro-
project, we worked on three sub projects which includes operations on strings and numbers as
well. In this project we have developed three sub-projects such as:
1|Page
1. Write assembly language program to check whether number is
Armstrong or not.
➢ Algorithm:
Step 1: Start
Step 2: Initialize data segment.
Step 3: Read number from user.
Step 4: Calculate cube of each digit of number.
Step 5: Make addition of cube of digits.
Step 6: Addition = number go to step
Step 7: Print number is Armstrong.
Step 8: Print number is not Armstrong.
Step 9: Stop.
➢ Flowchart:
2|Page
➢ Program:
.model small
mov ch,00h
mov bx,0ah
mov ax,sum
rpt:
mov dx,00
div bx
push dx
inc ch
cmp ax,0ah
jge rpt
inc ch
mov cl,12
rpt3:
and ax,0fh
shl ax,cl
add dec_num,ax
sub cl,4
pop ax
3|Page
dec ch
jnz rpt3
mov ax,dec_num
mov cl,04h
ror ax,cl
mov dec_num,ax
mov ax,num1
cmp ax,dec_num
jz dn
mov ah,09h
lea dx,msg2
int 21h
jmp exit
dn:
mov ah,09h
lea dx,msg1
int 21h
exit:
mov ah,4ch
int 21h
endm
.data
num1 dw 153h
num2 dw 0
divis dw 10h
quo dw 0
rem dw 0
sum dw 0
dec_num dw 0
msg1 db 'number is armstrong$'
msg2 db 'number is not armstrong$'
.code
mov ax,@data
mov ds,ax
armstrong num1,num2,divis,quo,rem,sum,dec_num,msg1,msg2
ends
end
4|Page
➢ Output:
5|Page
➢ Flowchart
➢ Program:
palindrome MACRO STRING, STRING1, STRING2
MOV SI, OFFSET STRING
LOOP1:
MOV AL, [SI]
CMP AL, '$'
JE LABEL1
INC SI
JMP LOOP1
LABEL1:
MOV DI, OFFSET STRING
DEC SI
LOOP2:
CMP SI, DI
JL OUTPUT1
MOV AL, [SI]
MOV BL, [DI]
CMP AL, BL
JNE OUTPUT2
DEC SI
6|Page
INC DI
JMP LOOP2
OUTPUT1:
LEA DX, STRING1
MOV AH,09H
INT 21H
RET
OUTPUT2:
LEA DX, STRING2
MOV AH,09H
INT 21H
RET
ENDM
.data
STRING DB 'ABBA$'
STRING1 DB 'STRING IS PALINDROM$'
STRING2 DB 'STRING IS NOT PALINDROME$'
.code
MOV AX, @data
MOV DS, AX
mov es, ax
palindrome STRING, STRING1, STRING2
MOV AH,4CH
INT 21H
ENDS
END
➢ Output:
7|Page
3. Write assembly language program to count vowels and consonants in
a string.
➢ Algorithm
Step 1: Start.
Step 2: Initialize data segment
Step 3: Initialize vowel and consonant counter.
Step 4: Initialize memory pointer to read string.
Step 5: Call MACRO from main program.
Step 6: Read character.
Step 7: If character equals to vowel, then go to step 9.
Step 8: Increment consonant counter.
Step 9: Increment vowel counter.
Step 10: Increment memory pointer.
Step 11: Go to step 6 until last character.
Step 12: Stop.
➢ Flowchart
8|Page
➢ Program:
.MODEL SMALL
COUNT:
INC COUNT_V ;INCREMENT VOWEL COUNTER
MOVE:
INC SI ;INCREMENT MEMORY POINTER TO READ NEXT
NUMBER
JMP START ;GOTO START LABLE AGAIN.
9|Page
EXIT:
MOV BL, COUNT_V ;STORE VOWEL COUNT IN BL
MOV DL, COUNT_C ;STORE CONSONANT COUNT IN BL
ENDM
.DATA
STR1 DB 'ADITYABUC$' ;INPUT STRING
COUNT_V DB 0
COUNT_C DB 0
.CODE
MOV AX, @DATA ;INITIALIZE DATA SEGMENT
MOV DS, AX
MOV SI, OFFSET STR1 ;INITIALIZE MEMORY POINTER
MOV AH,09H
INT 21H
ENDS
END
➢ Output:
10 | P a g e
➢ Resources Used:
Name of
Sr.no. required Specification Quantity Remarks
resources
Operating
2. Windows 7+ 1 Each
System
Software:
Editor EDIT/Notepad
3. Assembler TASM/MASM 1 Each
Linker TLINK/LINK
Debugger TD/DEBUG
Microprocessor and
4. Reference Book 1
Interfacing
Laboratory Diploma Semester IV
5. 1 Each
Manual Microprocessors
https://www.tutorialspoint.
Online com/assembly_programmin
6. -
Reference g/index.htm
➢ Skills Developed:
11 | P a g e