Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Muhammad Aliyan Siddiqui

191196

Question 2

Include irvine32.inc

.data
Str1 byte “ Muhammad Aliyan Siddiqui – 191196 “,0

Bal dword 0

Msg1 byte “ Welcome new user!”,0dh,0ah,0


Msg2 byte “ Enter your username (max 10 char): “,0dh,0ah,0
Msg3 byte “ Enter your password (max 10 char): “,0dh,0ah,0
Msg4 byte “ Enter your option: “,0

Prompt1 byte “ 1. Deposit money”,0dh,0ah,0


Prompt2 byte “ 2. Withdraw money”,0dh,0ah,0
Prompt3 byte “ 3. Account details”,0dh,0ah,0
Prompt4 byte “ 4. Change password”,0dh,0ah,0
Prompt5 byte “ 5. Logout”,0dh,0ah,0
Prompt6 byte “ 6. Exit”,0dh,0ah,0
Acc1 byte “ Username: “,0
Acc2 byte “ Password: “,0
Acc3 byte “ Current balance: “,0

Out1 byte “ Enter cash amount to deposit: “,0


Out2 byte “ Enter cash amount to withdraw: “,0
Out3 byte “ Enter new password (max 10 char): “,0dh,0ah,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

Username byte 11 DUP(?)


Pass byte 11 DUP(?)

.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

Mov edx,offset acc2


Call writestring
Mov edx,offset pass
Call writestring
Call crlf

Mov edx,offset acc3


Call writestring
Mov eax,bal
Call writeint
Call crlf
Call crlf
Ret
_account endp

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

Mov edx, offset msg4


Call writestring
Call readint
Cmp eax,1
Je deposit

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

You might also like