So I want to print out the ascii value of what is stored in an address with a system call.
Lets say i want to print the letter Z
in hex this is 0x5a
, so lets say in my preamble there I have a pointer ptr
point to a element of an array, I transfer the value at the address into cl
by:
mov edx, ptr
mov cl, [edx]
Now lets say the value 0x5a
is in cl
, how do I print this to STDOUT? I have tried (amoung other things):
mov eax, 4 ; SYS_WRITE
mov ebx, 1 ; STDOUT
;value to be prininted is in cl so it is in ecx
mov edx, 4 ; size of the item (tried 4 and 1)
int 80h ;interrupt
This prints absolutely nothing, what am I doing wrong? Do I need to declare something in .data / .bss?
I want it to print Z
Thanks
EDIT:
So I can print Z
by declaring in .data
:
num db 90
Then using mov ecx, num
in the system call. but how can I take the hex value in the register and do the same?