if any customer wants to use her internet
banking facility, he must have to enter two different 8-bit pin codes one by one. Computer gets these two 8 bits
numbers, converts them into binary and performs addition on both of these numbers. If the result matches with the
code that is stored for this account, internet banking facility will be provided otherwise, the system will not allow the
use of internet banking.
;MS Visual Studio 2017
INCLUDE irvine32.inc
.data
number1 dword ?
code8 dword 10101010b
msgValue1 BYTE "Enter the first pin-code: ",0
msgValue2 BYTE "Enter the second pin-code: ",0
promptBad BYTE "Invalid input, please enter again",0
Correct BYTE "Correct",10,10,13,0
unCorrect BYTE "UnCorrect",10,10,13,0
.code
main PROC
mov edx, OFFSET msgValue1 ; address of msgValue ("Enter the first pin-code: ")
call writeString ; writes a string
read1:
call Readint ; Reads integer
jno goodInput1
mov edx,OFFSET promptBad
call WriteString ; writes a string about Invalid input
call crlf ; New line
jmp read1 ;go input again
goodInput1:
and eax,0FFh
mov number1,eax ;store good value
mov edx, OFFSET msgValue2 ; address of msgValue ("Enter the second pin-code: ")
call writeString ; writes a string
read2:
call Readint ; Reads a decimal integer g
jno goodInput2
mov edx,OFFSET promptBad
call WriteString ; writes a string about Invalid input
call crlf ; New line
jmp read2 ;go input again
goodInput2:
and eax,0FFh
; generate the code8
add eax, number1
cmp eax,code8
jnz err
mov edx, OFFSET Correct
call writeString ; writes a string
jmp finish
err:
mov edx, OFFSET unCorrect
call writeString ; writes a string
finish:
exit
main ENDP
END main
Comments
Leave a comment