io.inc 710 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. %include "io-defs.inc"
  2. %ifndef __IO_INC__
  3. %define __IO_INC__
  4. extern _open
  5. extern _close
  6. extern _lseek
  7. extern _write
  8. extern _read
  9. extern _fputchar
  10. extern _fgetchar
  11. extern _fputs
  12. extern _fgets
  13. extern _fsetw
  14. ; linked to stdout
  15. %macro _putchar 1
  16. mov ebx, %1
  17. mov eax, STDOUT
  18. call _fputchar
  19. %endmacro
  20. ; linked to stdin
  21. %macro _getchar 0
  22. mov eax, STDIN
  23. call _fgetchar
  24. %endmacro
  25. ; linked to stdout
  26. %macro _puts 1
  27. mov ebx, %1
  28. mov eax, STDOUT
  29. call _fputs
  30. %endmacro
  31. ; linked to stdin
  32. %macro _gets 1
  33. mov ebx, %1
  34. mov eax, STDIN
  35. call _fgets
  36. %endmacro
  37. ; linked to stdout
  38. %macro _setw 1
  39. mov ebx, %1
  40. mov eax, STDOUT
  41. call _fsetw
  42. %endmacro
  43. %endif ; __IO_INC__