I recently read this article about using printf and scanf in an assembly:
Intfmt value: db "% d", 10, 0 in assembly
In particular, it says "In printf, a new line prints a new line, and then (if the output is in buffered mode in the line, which probably is), it clears the internal output buffer, so you can see the result. Therefore, when you delete 10 and you donโt see the conclusion. "
However, I do not know what to do if I do not need a new line after my output in my assembly file. Here is a simple test file that I wrote for printing without a new line:
extern printf LINUX equ 80H ; interupt number for entering Linux kernel EXIT equ 60 ; Linux system call 1 ie exit () section .data int_output_format: db "%ld", 0 segment .text global main main: mov r8, 10 push rdi push rsi push r10 push r9 mov rsi, r8 mov rdi, int_output_format xor rax, rax call printf pop r9 pop r10 pop rsi pop rdi call os_return ; return to operating system os_return: mov rax, EXIT ; Linux system call 1 ie exit () mov rdi, 0 ; Error code 0 ie no errors syscall ; Interrupt Linux kernel 64-bit
but as a read article assumes stdout is not cleared. I was thinking, maybe I need to somehow wash off after the number is displayed? But I'm really not sure.
I am using NASM assembly language.
Thanks in advance!
source share