ovictoraurelio

EE2 Resolução - 2015 - 1

Dec 1st, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥
  2. ; ♥
  3. ; ♥
  4. ; ♥                   @author ovictoraurelio
  5. ; ♥                   @github http://github.com/ovictoraurelio
  6. ; ♥                   @website http://victoraurelio.com
  7. ; ♥
  8. ; ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥
  9.  
  10. SECTION .data          
  11.     raio: dq 4.0
  12.     altura: dq 3.0    
  13.     teste: db "Calculado: %f", 10, 0,    
  14. SECTION .bss
  15.     vol: resq 1              
  16. SECTION .text                    
  17.     global  main                  
  18.     extern printf    
  19.  
  20. main:
  21.    
  22.     finit
  23.     fldpi               ; empilha PI          
  24.     fld qword[raio]     ; empilha o raio
  25.     fmul st0,st0        ; calcula e empilha: raio^2
  26.     fmulp st1,st0       ; calcula e empilha: PI * raio^2 e desempilha PI
  27.     fld qword[altura]   ; empilha altura
  28.     fmulp st1,st0       ; calcula e empilha: altura * PI * raio^2 e desempilha antigo ST0
  29.     mov eax, 3          ; armazena o inteiro 3 em eax
  30.     push eax            ; push na memória pq fld só funciona com memória
  31.     fild dword[esp]     ; empilha o inteiro 3    
  32.     fdivp st1, st0      ; calcula e empilha: altura * PI * raio^2 / 3
  33.     fstp qword[vol]      ; armazena na memoria      
  34.  
  35.     push dword[vol + 4]  
  36.     push dword[vol]
  37.     push dword teste
  38.     call printf
  39.    
  40.     pop eax
  41.     pop eax
  42.     pop eax
  43.     popa
  44.  
  45.     mov eax, 1
  46.     mov ebx, 0
  47.     int 80h
Advertisement
Add Comment
Please, Sign In to add comment