print.asm 594 B

12345678910111213141516171819202122232425262728293031323334353637
  1. print:
  2. pusha
  3. ; keep this in mind:
  4. ; while (string[i] != 0) { print string[i]; i++ }
  5. ; the comparison for string end (null byte)
  6. start:
  7. mov al, [bx] ; 'bx' is the base address for the string
  8. cmp al, 0
  9. je done
  10. ; the part where we print with the BIOS help
  11. mov ah, 0x0e
  12. int 0x10 ; 'al' already contains the char
  13. ; increment pointer and do next loop
  14. add bx, 1
  15. jmp start
  16. done:
  17. popa
  18. ret
  19. print_nl:
  20. pusha
  21. mov ah, 0x0e
  22. mov al, 0x0a ; newline char
  23. int 0x10
  24. mov al, 0x0d ; carriage return
  25. int 0x10
  26. popa
  27. ret