Assembler char Output

I am currently working with assembly language a bit. I want to print char to the console and my program runs without error but it doesn't output. Here is my current code:

movl  $4, %eax         #Defines Output
movl  $1, %ebx         #STDOUT as first parameter
movl  $48, %ecx        #Copy char (0) to ECX
movl  $1, %edx         #String length 1
int   $0x80            #Trigger Interrupt

movl  %eax, %ebx       #Exitcode 0
movl  $1, %eax         #System Code SYS_EXIT
int   $0x80            #Trigger Interrupt


Do you have any idea why it doesn't come to a conclusion? As you can see, I am using GAS syntax. What is the problem with my code?


source to share

1 answer

The call sys_write

has three parameters:

Register | Type         | Description
ebx      | unsigned int | file descriptor
ecx      | const char * | pointer to data to write
edx      | size_t       | length of data


So your problem is that you are putting the actual character in ecx

, where you should put the pointer to the string.



All Articles