Quantcast
Viewing latest article 20
Browse Latest Browse All 152

x86 assembly Intel Syntax

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


Viewing latest article 20
Browse Latest Browse All 152

Trending Articles