Spagett912 0 Light Poster

Hey everyone and anyone who reads this. I'm trying to make a program that can have a function prompt for 2 integers:
void InputNumbers(int & num1, int & num2)

find the GCD of any 2 integers: int gcd(int num1,int num2)"

and finally display the GCD.
void DisplayGCD(int answer)


This is the coding that I have so far...


INCLUDE \Irvine\Irvine32.inc

INTEGER_COUNT = 2

.data
str1 BYTE "Enter a signed integer: ",0
str2 BYTE "The GCD of the 2 integers is: ",0
array DWORD INTEGER_COUNT DUP(?)
first dword ?
second dword ?

.code
main PROC
call Clrscr

;Emulate how a high level language
; handles parameter passing. Consider
; the following prototype:
;void PromptForInteger(int &first, int &second)
;The next 3 lines are the equivalent

;InputNumbers(first, second)

push OFFSET first
push OFFSET second
call InputNumbers


;eax=GCD(first, second)

push first
push second
call GCD ; GCD returns its answer via "eax"

; DisplayGCD(eax)

push EAX ; <-- The Answer just gotten from GCD

call DisplayGCD


exit
main ENDP

;-----------------------------------------------------
InputNumbers PROC
;
;
; Prompts the user for 2 integers
; and return the 2 parameters with
; Receives: Receives 2 reference parameters of type integer.
; Returns: 2 integers as entered by the user.
;-----------------------------------------------------

ret
InputNumbers ENDP

;-----------------------------------------------------
DisplayGCD PROC
;
; Displays the sum on the screen
; Receives: 1 integer Parameter from the stack
; Returns: nothing
;-----------------------------------------------------


ret
DisplayGCD ENDP
;-----------------------------------------------------
GCD PROC
; Find the greatest common divisor of 2 numbers
; within a 2 element array
; Receives: ESI points to the array, ECX = array size
; Returns: The GCD of the 2 numbers via register EAX
;-----------------------------------------------------

;;;;;The task: Expand this stub to actually find the GCD
;;;;; based on the 2 values given
;;;;; Return the final answer via "EAX"

ret

GCD ENDP

END main