Results 1 to 1 of 1
Hello there,
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 ...
- 07-21-2007 #1
problem with STDOUT (assembly)
Hello there,
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 -
The numbers are read in by kernel read sys_call, and the output is intended for the terminal. Thanks in advance!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 0x80Gentoo 2.6.24 amd64
AMD Anthlon 64 X2, 2 GB RAM, Asus M2N-MX, nVidia GeForce 9600GT 512Mb, 250Gb + 160Gb HDDs


Reply With Quote