I want to get a basic feel for assembly and wrote a program that ought to
- displays the string Enter a number:
- reads in user input
- counts the number read down to 0and prints the number in each iteration in a loop.
Here is my code.
section .data
   msg  db 'Enter a number:' 
   len equ $ - msg
section .bss
   num resb 1
section  .text
   global _start        ;must be declared for using gcc
_start:                  ;tell linker entry point
   mov   eax,4          ;sys_write
   mov   ebx,1
   mov   ecx,msg        ;the message "Enter a number:"
   mov   edx,len        ;write "enter a number" on the screen
   int 80h
   mov   eax,3          ;reading in user input into num
   mov   ebx,2
   mov   ecx,num
   mov   edx,1
   int 80h
   mov   ecx,num
   jmp loop1
   
   mov   eax,1          ;system call number (sys_exit)
   int   80h           ;call kernel
   
loop1:
   mov   edx,1
   mov   ebx,1          ;file descriptor (stdout)
   mov   eax,4          ;system call number (sys_write)
   int   80h
   loop  loop1
   mov eax,1
   int 80h
When entering loop1 nothing is written to the terminal instead of the countdown I want. Can someone tell me what I fail to see?
