crsandu icon

5-A

crsandu | PRO | 09/06/18 09:49:07 AM UTC | 0 ⭐ | 12940 👁️ | Never ⏰ | []
ASM (NASM) |

0 B

|

None

|

0 👍

/

0 👎

.586
.model flat, C
 
includelib msvcrt.lib
extern exit:    proc
extern printf:  proc
extern scanf:   proc
 
public start
 
.data
    numar_obtinut   dq  ?
    numar_introdus  dd  ?
    mesaj_out   db  "Introduceti o valoare: ", 0
    mesaj_in    db  "%d", 0
    float_f     db  "Valoarea obtinuta este: %.3f", 0
 
.code
    square  proc
        mov EBP, ESP
        
        FLD1
        
        FILD    DWORD PTR [EBP + 4]
        FIMUL   DWORD PTR [EBP + 4] ; <=> val^2
        
        FDIV ; impartim valorile
        ret
    square endp
 
    start:
        push offset mesaj_out
        call printf
        add ESP, 04h
        
        push offset numar_introdus
        push offset mesaj_in
        call scanf
        add ESP, 08h
        
        
        push numar_introdus
        call square
        add ESP, 04h
        
        
        MOV EBP, ESP ; - ca sa pot afisa double
        FSTP QWORD PTR [EBP]
        
        push offset float_f
        call printf
        
        push 0
        call exit
end start

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎