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

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.