0

To Print decimal 5

section .text
  global _start

_start:
  mov edx, 1
  mov ecx, 5
  add ecx, 48
  mov ebx, 1
  mov eax, 4
  int 80h
ret

Commands I'm using for compiling on linux
nasm -f elf32 main.asm
ld -m elf_i386 -s -o main main.o

Error [1] 565 segmentation fault (core dumped) ./main

no_code
  • 1
  • 1
  • `write` takes a pointer to bytes in memory, and you can't `ret` from `_start`. Use `strace` and/or GDB to single-step your code. – Peter Cordes Feb 11 '22 at 17:38

0 Answers0