0

My code is about dividing a number but it results a float example 1.206. The resut I want is only 1. Im just new in assembly so please help me guys thanks.

%define num1    dword[ebp+8]
%define result  dword[ebp+12]

segment .bss
segment .data
temp dq 365.0

segment .text
    global _Area
_Area:

    push ebp
    mov ebp, esp
    push ebx

    fild num1       
    fld1    
    fmulp st1

    fdiv qword[temp]            
    mov ebx, result
    fstp qword[ebx]

    mov eax, 0
    pop ebx
    mov esp, ebp
    pop ebp
    ret
Jack-Jack
  • 119
  • 9

1 Answers1

0

FIST/FISTP is the FPU command to convert a float to an int https://courses.engr.illinois.edu/ece390/archive/spr2002/books/labmanual/inst-ref-fild.html

See also this thread What is the fastest way to convert float to int on x86

Community
  • 1
  • 1
ralf htp
  • 9,149
  • 4
  • 22
  • 34