Answer the question
In order to leave comments, you need to log in
Why is it not displaying a number on the screen?
Printing a string is not a problem, there are a lot of tutorials, but something strange happens with a number. Instead of a number, it displays krakozyabry
SECTION .DATA
x: dq 0x12345678
SECTION .TEXT
GLOBAL _start
_start:
mov eax,4 ; 'write' system call = 4
mov ebx,1 ; file descriptor 1 = STDOUT
mov ecx,x ;write car
mov edx,32 ; length of string to write
int 80h ; call the kernel
; Terminate program
mov eax,1 ; 'exit' system call
mov ebx,0 ; exit with error code 0
int 80h ; call the kernel
Answer the question
In order to leave comments, you need to log in
By itself. The number is in binary form, but to print the numbers, you need ASCII codes:
db 0x31, 0x32, 0x33 ... 0x38
Write your itoa () in assembler - the code that will translate the number into a string. The algorithm is elementary
And what do you expect to get from a function that outputs a string if you pass it an address that is not a string.
Naturally, the function interprets the data at the passed address as a string, that is, a sequence of character codes.
If you want to output a number, first convert it to a string.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question