Important Program For 8086
Important Program For 8086
. Store the
maximum in location result.
Title maximum in given series
Dosseg
.model small
.stack 100h
.data
List db 80, 81, 78, 65, 23, 45, 89, 90, 10, 99
Result db ?
.code
Main proc
MOV AX, @data
MOV DS, AX
MOV SI, offset List
MOV AL, 00H
MOV CX, 0AH
Back: CMP AL, [SI]
JNC Ahead
MOV AL, [SI]
Ahead: INC SI
LOOP Back
MOV Result, AL
MOV AH, 4CH
INT 21H
Main endp
End Main
8. Find number of times letter e exist in the string exercise, Store the count at me
mory
ans.
Title string operation
Dosseg
.model small
.stack 100h
.data
String db exercise, $
Ans db ?
Length db $-String
.code
Main proc
MOV AX, @data
MOV DS, AX
MOV AL,00H
MOV SI, offset String
MOV CX, Length
Back: MOV BH, [SI]
CMP BH, e
JNZ Label
INC AL
Label: INC SI
LOOP Back
MOV Ans, AL
MOV AH, 4CH
INT 21H
Main endp
End Main
9. Write an ALP to generate square wave with period of 200s and address of output
device is 55H for 8086 microprocessor.
START: MOV AX, 01H
OUT 30H, AX
String db The quick brown fox jumped over lazy sleeping dog, $
Len dw $-string
Vowel db ?
End Main
11. Write an 8086 ALP which will input the user name from the keyboard. If the u
ser is
Pokhara it will output The username is valid else it will output Invalid user name.
Note: This program is not verified in MASM so, please verify this program. This
program can be
done in the same approach as question 10, which is done above by comparing each
character
input.
title input name and comparision
dosseg
.model small
.stack 100h
.data
input db 7 dup(?)
comparestring db 'Pokhara','$'
outputstring1 db 'The username is valid','$'
outputstring2 db 'The username is invalid','$'
.code
main proc
mov ax, @data
mov ds, ax
; read string
mov dx, offset input
mov ah,0ah
int 21h
;string comparision
mov si, offset input
mov di, offset comparestring
mov cx,07h ;length of string in cx
CLD ; DF-> direction flag clear i.e. autoincrement mode
repe cmpsw ;compare words of two string if equal then ZF will be set
JZ label1
mov dx, offset outputstring2
jmp label2
label1: mov dx, offset outputstring1
label2: mov ah, 0ah
int 21h
mov ah,4ch
int 21h
main endp
end main