I decided to learn Assembly. And I think I'm in big trouble. ( I am using NASM )
section .data
character_x DB 'x'
section .text
global _start
_start:
mov eax,4
mov ebx,1
mov ecx, character_x
mov edx,1
int 0x80
mov eax,1
int 0x80
The code above prints the character x. And he system call required to print something on the screen is 4 for eax. For example, how do I put the integer value of 4 in the eax register?
for example:
mov eax, 4h
; OR
mov eax, '4'
And How do I define an integer value as a bit? Or hexadimal. Example
integer_value1 DB 00100010 ; Decimal = 34
integer_value2 DD AF3 ; Decimal = 2803
I want to ask another question like the other stupid questions above,
cx register is Count Register. dx register is Data Register.
mov ecx, character_x
mov edx, 1
Why ecx register got the character itself? And Why did the edx register take the length of the character?
I think the code should have been like the one below
mov ecx, 1
mov edx, character_x
Thanks.
mov eax, 4. "Why ecx register got the character itself?" It doesn't. It contains the address where the character is stored.00100010bor0AF3h. 3. The meanings as "counter" or such are only for old instructions or some special cases (egloop,rep movsw, shift count). Linux'sint 80hinterface does not useecxfor "counter", just as one of several parameters (in a certain order).