Dire Dawa Institute of Technology: Department of Electrical and Computer Engineering
Dire Dawa Institute of Technology: Department of Electrical and Computer Engineering
Dire Dawa Institute of Technology: Department of Electrical and Computer Engineering
MOV AL, 5
MOV BL, 10
ADD BL, AL
MOV CX, 8
JZ zero
SHL BL, 1
LOOP PRINT
INT 21H
RET
2. A program that adds a profit factor to each element in a cost array and puts the result in
an prices array
ARRAYS SEGMENT
1
COST DB 20H, 28H, 15H, 26H, 19H, 27H, 16H, 29H
ARRAYS ENDS
CODE SEGMENT
MOV DS, AX
MOV CX, 8H
MOV BX, 0
DAA
MOV PRICES[BX], AL
INC BX
DEC CX
JNZ DO_ET
CODE ENDS
END
Answer
pass1 DB ?,?,?,?
pass2 DB ‘1’,’2’,’3’,’4’
2
LEA BX, pass1 ;Points the address of the input password
MOV SI, BX ; keep the address of input password
MOV CX, 4
MOV AH, 1
INP:
INT 21H ;Gets the input from the keyboard
MOV [BX], AL
INC BX
LOOP INP
CLD
LEA SI, pass1 ;keep the address of input password
LEA DI, pass2 ;keep the address of saved password
MOV CX, 4
REPE CMPSB ;Compare the strings
JNZ Not_equal
MOV DX, OFFSET GRANTED
MOV AH, 9 ;Output of a string at DS: DX
INT 21H
JMP Exit_here
Not_equal:
INT 21H
Exit_here: ;Final
RET