Created
April 5, 2023 23:18
-
-
Save Eriarer/3fc943fae2590278bb647a65ccbb7356 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GLOBAL main | |
section .data | |
powr DD 1.0 ;resulatdo de la potencia | |
pown DB 3 ;potencia | |
base DD 0.32;base | |
section .text | |
finit | |
main: | |
mov ecx, 0 ;limpiamos variables | |
mov eax, 0 | |
mov ebx, 0 | |
mov cl, [pown] ;movemos el valor de pown a cl | |
call power ;llamamos a la funcion power | |
ext: | |
mov eax, 1 ;paso de parametros | |
mov ebx, 0 ;paso de paramteros | |
int 0x80 ;manejador de interrupciones | |
power: | |
call mult ;llamamos a la funcion mult | |
loop power ;si cl es distinto de 0, vuelve a llamar a power | |
ret | |
mult: | |
fld dword [base] ;cargamos el valor de powr en la pila | |
fld dword [powr] ;cargamos el valor de powr en la pila | |
fmulp ;multiplicamos los valores de la pila | |
fstp dword [powr] ;guardamos el resultado en powr | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment