0

This simple program NASM outputs character 'A' instead of number 65:

section .data
    var DB 65

section .text
    global _start   
_start:              

    mov edx, 1       ;message length
    mov ecx, var     ;message to write
    mov ebx, 1       ;file descriptor (stdout)
    mov eax, 4       ;system call number (sys_write)
    int 0x80         ;call kernel
    
    ;exit
    mov eax, 1       ;system call number (sys_exit)
    int 0x80         ;call kernel

I want it to print the number.

All I found related to the topic were programs invloving printf which is not what I want.

CrazyMan
  • 63
  • 5
  • 3
    Using a write system call to output that one byte is of course just going to produce a byte, one ASCII character. Since the value is in the printable range, writing it to a terminal shows a letter. See the linked duplicate about making digit-strings that represent the value of a number, so you can write that. – Peter Cordes Mar 20 '22 at 04:55

0 Answers0