Professional Documents
Culture Documents
Laboratory#2 Legaspi
Laboratory#2 Legaspi
Legaspi_________
Objective:
Instruction:
“01” if loaded to the accumulator will trigger an Input event and the user input will then be passed
automatically to the lower accumulator.
This is just to obtain an input from the user. But we need to see what is the input of the user. So, we
followed the code with an output.
The next is “08” which is also an input command without echo, means it will not show what the user
pressed from the keyboard.
.code
main proc
mov ax,seg message
mov ds,ax
mov ah,09h ; load string
lea dx, message ; obtain string using dx(DH,DL) from .data
int 21h ; execute and display
PROBLEM: PERFORM A PIN NUMBER [ 4 INPUTS ONLY] VERIFICATION USING ASSEMBLY LANGUAGE.
3 ERRORS WILL DISPLAY “UNAUTHORIZE”, A CORRECT PIN WILL DISPLAY “ACCESS GRANTED”.
e.g
[ 3 ERROR]
Enter Pin : * * * *
“Error”
Enter Pin : * * *
“Error”
Enter Pin : * * * *
Enter Pin : * * *
“Error”
“UNAUTHORIZE”
[ ACCESS GRANTED ]
Enter Pin : * * * *
ACCESS GRANTED
Code:
;PIN: 1434
.model small
.stack
.data
mes db "Error.$'"
.code
main proc
mov ax,@data
mov ds,ax
mov cl,03h
jmp here
error:
mov ah,02h
mov dl,0Ah
int 21h
mov ah,09h
lea dx,mes
int 21h
mov ah,02h
mov dl,0Ah
int 21h
dec cl
cmp cl,00h
je max
here:
mov ah,09h
int 21h
mov ah,08
int 21h
mov bl,al
mov ah,02h
mov dl,2Ah
int 21h
cmp bl,31h
jne error
mov ah,08
int 21h
mov bl,al
mov ah,02h
mov dl,2Ah
int 21h
cmp bl,34h
jne error
mov ah,08
int 21h
mov bl,al
mov ah,02h
mov dl,2Ah
int 21h
cmp bl,33h
jne error
mov ah,08
int 21h
mov bl,al
mov ah,02h
mov dl,2Ah
int 21h
cmp bl,34h
jne error
je correct
max:
mov ah,09h
int 21h
jmp exit
correct:
mov ah,02h
mov dl,0Ah
int 21h
mov ah,09h
int 21h
exit:
mov ax,4c00h
int 21h
main endp
end main