ascii.asm 505 B

12345678910111213141516171819202122232425262728
  1. section .text
  2. global _start ;must be declared for using gcc
  3. _start: ;tell linker entry point
  4. call display
  5. mov eax,1 ;system call number (sys_exit)
  6. int 0x80 ;call kernel
  7. display:
  8. mov ecx, 256
  9. next:
  10. push ecx
  11. mov eax, 4
  12. mov ebx, 1
  13. mov ecx, achar
  14. mov edx, 1
  15. int 80h
  16. pop ecx
  17. mov dx, [achar]
  18. cmp byte [achar], 0dh
  19. inc byte [achar]
  20. loop next
  21. ret
  22. section .data
  23. achar db '0'