Not so long ago I decided to learn assembly language. I have grasped the basics of it more or less, but there is one problem that I cannot solve (and find any help about). I wrote a program to output the sum of two integers that are entered by the user. I'm using the kernel sys_call write. It seems to add them up correctly, but it prints out the ASCII symbol of that number (or similar)! I've tried YASM, FASM and NASM, but the result is the same. Can anyone give me some advice as to how to output the actual number, not the ASCII code? Here's the source code -
.... section .bss input1 resd 1 input2 resd 1 sum resd 1 section .text global _start _start: .... mov rax,[input1] add rax,[input2] mov [sum], rax ; print sum mov rdx,2 lea rcx,[sum] mov rbx, 1 mov rax,4 int 0x80
Please help or give some advice as to how I can get rid of this! Without solving this problem I cannot continue any further.