#Programming x86 on Visual Studio

1 messages · Page 1 of 1 (latest)

light cedarBOT
#

@bronze nest has a question:

kittymeow329

anyone here know how to code in x86 on VS?

#

<@&987246527741304832> please have a look, thanks.

stoic nymph
#

which language?

#

java? c++? sth else?

bronze nest
#

x86...?

#

x86 processor thing

stoic nymph
#

x86 just means the architecture u choose

#

i. e. 64bit

bronze nest
#

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

stoic nymph
#

u got more details and context?

bronze nest
#

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

turbid badger
#

You can use: /help-thread close if that resolved it. Otherwise some more context would be appreciated.

bronze nest
#

thanks