#Programming x86 on Visual Studio
1 messages · Page 1 of 1 (latest)
example
.386
.model flat, stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD
.data
first_num DWORD 56
second_num DWORD 24
.code
main PROC
mov eax, first_num ; Loading first_num into eax
mov ebx, second_num ; Loading second_num into ebx
GCD_loop: ; Loop till ebx is '0', then we got the GCD
cmp ebx, 0
jz GCD_res_got ; If EBX is zero then it will jump to GCD_res_got, the result is in eax
; Using the Euclidean Algorithm for finding GCD
xor edx, edx ; Clearing edx
div ebx ; Perform division, remainder in edx
mov eax, ebx ; Move the divisor to eax for the next round
mov ebx, edx ; Move the remainder to ebx for the next iteration
jmp GCD_loop ; Repeat the process till found
GCD_res_got:
INVOKE xitProcess, eax ; Exit the program, return GCD (value in EAX)
main ENDP
END main
u got more details and context?
omg ive been banging my head on this little turd and just realised
the letter in e in exit process IS MISSING
fricking hell
thank you
You can use: /help-thread close if that resolved it. Otherwise some more context would be appreciated.
thanks