section .data  

char db 0, 0, 0ah  

section .text  

global _start 

_start:  

; 1° cálculo: 3 + 2 = 05  

xor rax, rax  

mov rax, 3  

add rax, 2  

call saida_calc  

; 2° cálculo: 9 - 1 = 08 
xor rax, rax 
mov rax, 9 
sub rax, 1 
call saida_calc 
 
; 3° cálculo: 10 - 8 = 02 
xor rax, rax 
mov rax, 10 
mov rbx, 8 
sub rax, rbx 
call saida_calc 
 
; 4° cálculo: 3 * 2 = 06 
xor rax, rax 
mov al, 3 
mov bl, 2 
mul bl 
call saida_calc 
 
; 5° cálculo: (6 * 9) - 52 = 02 
xor rax, rax 
mov al, 6 
mov bl, 9 
mul bl 
sub al, 52 
call saida_calc 
 
; 6° cálculo: 10 / 2 = 05 
xor rax, rax 
mov ax, 10 
mov bl, 2 
div bl 
mov ah, 0           
call saida_calc 
 
; 7° cálculo: (30 / 3) - 3 = 07 
xor rax, rax 
mov ax, 30 
mov bl, 3 
div bl 
sub al, 3 
mov ah, 0            
call saida_calc 
 
; 8° cálculo: (5 * 4) - (20 - 7) = 07 
xor rax, rax 
mov al, 20 
sub al, 7 
mov bl, al          
 
mov al, 5 
mov cl, 4            
mul cl               
 
sub al, bl       
mov ah, 0        
call saida_calc 
 
; 9° cálculo: (4 * 7) + (5 * 6) = 58 
mov al, 4 
mov cl, 7 
mul cl 
mov r8b, al 
 
mov al, 5 
mov cl, 6 
mul cl 
mov r9b, al 
 
mov al, r8b 
add al, r9b 
call saida_calc 
 
; 10° cálculo: (81 / 9) + 15 = 24 
mov ax, 81 
mov bl, 9 
div bl 
add al, 15 
call saida_calc 
 
; 11° cálculo: (12 * 4) - 20 = 28 
mov al, 12 
mov bl, 4 
mul bl 
sub al, 20 
call saida_calc 
 
; 12° cálculo: (100 / 4) + (3 * 5) = 40 
mov ax, 100 
mov bl, 4 
div bl 
mov r8b, al 
 
mov al, 3 
mov bl, 5 
mul bl 
 
add al, r8b 
call saida_calc 
 
; 13° cálculo: (50 - 18) / 2 = 16 
mov al, 50 
sub al, 18 
mov ah, 0 
mov bl, 2 
div bl 
call saida_calc 
 
; 14° cálculo: (7 * 8) - 40 = 16 
mov al, 7 
mov bl, 8 
mul bl 
sub al, 40 
call saida_calc 
 
; 15° cálculo: (90 / 3) - 12 = 18 
mov ax, 90 
mov bl, 3 
div bl 
sub al, 12 
call saida_calc 
 
; 16° cálculo: (15 + 25) / 5 = 08 
mov al, 15 
add al, 25 
mov ah, 0 
mov bl, 5 
div bl 
call saida_calc 
 
; 17° cálculo: (6 * 6) + (4 * 4) = 52 
mov al, 6 
mov bl, 6 
mul bl 
mov r8b, al 
 
mov al, 4 
mov bl, 4 
mul bl 
 
add al, r8b 
call saida_calc 
 
; 18° cálculo: (72 / 8) * 3 = 27 
mov ax, 72 
mov bl, 8 
div bl 
mov bl, 3 
mul bl 
call saida_calc 
 
; 19° cálculo: (99 - 19) / 4 = 20 
mov al, 99 
sub al, 19 
mov ah, 0 
mov bl, 4 
div bl 
call saida_calc 
 
; 20° cálculo: (11 * 3) + (14 / 2) = 40 
mov al, 11 
mov bl, 3 
mul bl 
mov r8b, al 
 
mov ax, 14 
mov bl, 2 
div bl 
 
add al, r8b 
call saida_calc 
 
; Sair do programa 
mov rax, 60 
mov rdi, 0 
syscall 
  

saida_calc: 
 push rax 
 push rbx 
 push rdx 

movzx ax, al           
mov bl, 10              
div bl                 
                       
add al, 48             
add ah, 48             
 
mov [char], al         
mov [char + 1], ah      
 
mov rax, 1              
mov rdi, 1              
mov rsi, char          
mov rdx, 3             
syscall 
 
pop rdx                
pop rbx 
pop rax 
ret 
 

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: