Question: There will be a function called getdouble . This function will simply double any number which is currently in eax and store the result in
There will be a function called getdouble. This function will simply double any number which is currently in eax and store the result in eax.
There will be a function called gettriple. This function will simply triple any number which is currently in eax and store the result in eax.
There will be a function called getoddeven. This function will check if the value in eax is even. IF it is even, it will call the getdouble function. IF it is odd, it will get the gettriple function. (Note: edx stores remainder after you divide)
Your main program should ask the first user for a name as well as for a number. You should then call the getoddeven function. That function will either double or triple the initial value entered by the user. Display the name and the final result for this first user.
Your program will then do the same for a second user for a name as well as for a number. You will again call the getoddeven function which will either double or triple the value. Display the name and final result for this second user.
Finally, you will compare the two final results of each user and display the name of the one with the bigger final number as well as the number they have.
here's what I have so far
can't get it to go to getDouble getTriple based on remainder in edx then double or triple user input please help!
TITLE MASM template
INCLUDE Irvine32.inc
.data msg1 byte "Please Enter your name",0dh,0ah, 0 msg2 byte "Please Enter a number",0dh,0ah, 0 name1 byte "Pghlkjlkhgfuig",0dh,0ah, 0
msg3 byte "Your Number is" ,0dh,0ah, 0
num1 DWORD 0 num2 DWORD 0 remainder DWORD 0 .code
getDouble proc mov ebx, 2 mul ebx call WriteInt ret
getDouble endp
getTriple proc mov ebx, 3 mul ebx ret
getTriple endp
getoddeven proc
mov edx, 0 mov ebx, 2 div ebx mov num1,eax mov eax, edx mov ebx, 0 cmp eax, ebx je Double cmp eax, ebx je Triple Double: mov eax, num1 call getDouble jmp endProc
Triple: mov eax, num1 call getTriple jmp endProc
endProc: ret
getoddeven endp
main proc
;Get ueser's name
;Get user's grade
mov edx, offset msg2 ;moves msg2 memory address to edx call Writestring call ReadInt
; Call getoddeven function with first number call getoddeven call writeint
ending1: call crlf
exit main endp end main
can't get it to go to getDouble getTriple based on remainder in edx then double or triple user input please help
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
