I'm trying to print out a single character in assembly language. The program compiles and runs without error, but it won't print anything to stdout.
Code
.section .text
 .global _start
_start:
  # push char
  push $0x41 # letter "A"
  # print char
  mov $1, %rdx # arg 3: length
  mov %rsp, %rcx # arg 2: src
  mov $1, %rbx # arg 1: file handle (stdout)
  mov $4, %rax # sys_write
  int $0x80 # call kernal
  # sys exit
  mov $1, %rax
  mov $0, %rbx
  int $0x80
If I replace %rsp with $letter and include the following:
.section .data
  letter: .byte 0x41
then the code works as expected. But I want to use the stack, since I plan to expand this program to print variable-length (null-terminated) strings from the stack, rather than a set string from .data.
I eventually want to be able to simply echo the user's input to stdout, and pushing to the stack seems like the best way, but I can't yet get this bit to work, so I want to know what it is I'm doing wrong.
 
    