Answer to Question #295102 in Assembler for safi

Question #295102

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.


1
Expert's answer
2022-02-08T09:35:17-0500
;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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS