0

What is wrong with my code? I successfully get the input number stored in ecx, but can't seem to print the same 1-digit number to console. I'm very frustrated as I believe to have everything right.

Code:

section .bss
n resb 4

section .text

global _start
_start:

call ReadInt
call PrintInt

mov eax,1
mov ebx,0
int 80h

ReadInt:
mov eax,3
mov ebx,0
mov ecx,n
mov edx,1
int 80h
mov ecx,[n]
sub ecx,'0'
mov [n],ecx
ret

PrintInt:
mov eax,4
mov ebx,1
int 80h
ret
Michael Petch
  • 46,082
  • 8
  • 107
  • 198

0 Answers0