Professional Documents
Culture Documents
Lab Final
Lab Final
191196
Question 2
Include irvine32.inc
.data
Str1 byte “ Muhammad Aliyan Siddiqui – 191196 “,0
Bal dword 0
Error1 byte “ Sorry, the amount exceeds your current balance, Enter
uppercase R for re-entering amount or M for Main menu”,0dh,0ah,0
Error2 byte “ Invalid entry! “,0dh,0ah,0
.code
_username PROC
Mov edx, offset msg2
Call writestring
Mov edx, offset username
Mov ecx, 10
Call readstring
Ret
_username endp
_password PROC
Mov edx, offset msg3
Call writestring
Mov edx,0
Mov edx, offset pass
Mov ecx, 10
Call readstring
Ret
_password endp
_deposit PROC
Mov edx,offset out1
Call writestring
Call readint
Add bal,eax
Ret
_deposit endp
_account proc
Mov edx,offset acc1
Call writestring
Mov edx,offset username
Call writestring
Call crlf
MAIN proc
Reg:
Mov edx,offset str1
Call writestring
Call crlf
Mov edx,offset msg1
Call writestring
Call _username
Call _password
L1:
Mov edx, offset prompt1
Call writestring
Mov edx, offset prompt2
Call writestring
Mov edx, offset prompt3
Call writestring
Mov edx, offset prompt4
Call writestring
Mov edx, offset prompt5
Call writestring
Mov edx, offset prompt6
Call writestring
Cmp eax,2
Je withdraw
Cmp eax,3
Je account
Cmp eax,4
Je changepass
Cmp eax,5
Je logout
Cmp eax,6
Je _exit
Deposit:
Call _deposit
Jmp L1
Withdraw:
Mov eax,0
Mov edx,offset out2
Call writestring
Call readint
Cmp eax,bal
Jae disp1
Cmp eax,0
Jb invalid
Sub bal,eax
Jmp L1
Account:
Call _account
Jmp L1
Changepass:
Call _password
Jmp L1
Logout:
Jmp Reg
Invalid:
Mov edx, offset error2
Call writestring
Jmp L1
Disp1:
Mov edx,offset error1
Call writestring
Call readchar
Cmp al,82
Je withdraw
Cmp al,77
Je L1
Jmp invalid
_exit:
Call waitmsg
Exit
Main endp
End MAIN