OneCompiler

sub

129

%macro disp 2
mov rax, 1
mov rdi, 1
mov rsi, %1
mov rdx, %2
syscall
%endmacro

section .data
msg db " The subtraction of two number is:", 0ah
len equ $-msg

section .bss
result resb 2

section .text
global _start
_start:

mov ax,'0C'        ;input first number
sub  ax,'07'       ;convert number to actual value if <9 sub 00 or >9 sub 07

mov bx,'03'        ;input first number
sub bx,'00'        ;convert number to actual value if <9 sub 00 or >9 sub 07


sub ax,bx          ;perform subtraction
add ax,'00'        ;convert result to ASCII

mov [result], ax      ;mov ASCII value of result to varible 

disp msg, len         ;display msg
disp result, 2        ;display subtraction

mov rax, 60        ;sys_exit
mov rdi, 0
syscall