Reputation: 1140
I'm learning basic NASM x86 assembly, and I'm having issues printing to stdout
twice in the same binary. My code is:
section .data
pokelst: dw 'Bulbasaur',0xa,'Charmander',0xa,'Squirtle',0
pokelstLen: equ $-pokelst
endl: db '\n'
smiley: db '\u23a',0xa
smileyLen: equ $-smiley
section .text
global _start
_start:
mov ebx,1
mov ecx,smiley
mov eax,4
mov edx,smileyLen
int 80h
int 80h
mov eax,1 ;syscall code 1 is exit
mov ebx,0 ;ebx contains exit code (canonically, 0 means no errors)
int 80h ;int 80h=syscall
The output was:
\u23a
ocket8888@ParanoidLinux ~
Ignoring the fact that it's not resolving uni-code, it seems to me that if I use int 80h
twice, it should print twice. But, it very clearly is not.
What am I doing wrong?
Upvotes: 1
Views: 421
Reputation: 647
Reading the RETURN
section or write(2)
...
On success, the number of bytes written is returned (zero indicates nothing was written). On error, -1 is returned, and errno is set appropriately.
After this call finishes, a value is returned to EAX
. That means, when you try to run the interrupt again, you are going to be running a different interrupt.
Upvotes: 4