x86 assembly Intel Syntax - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

x86 assembly Intel Syntax

ag2888ag2888 Posts: 2Member
This is my code so far for a multiply function that cannot use any multipaction and division operators.

.intel_syntax noprefix
.data

.globl _x
_x: .long 0

.global _y
_y:

.text





.globl _fac
_fac:
push ebp
mov ebp,esp

mov eax,0
mov edx,1
mov ebx,_x



mov ecx,_y

cmp edx,ecx
jl LOOP
xchg ecx,ebx



LOOP:

cmp edx,ecx
jg DONE
add eax,ebx
SUB ecx,1

jmp LOOP


DONE:



pop ebp #you need this too
ret #return

It works with a main.c file that calls multiply and calls the global variables x and y

Sign In or Register to comment.