qdos.inc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2020 by Karoly Balogh
  4. Interface QDOS OS functions used by the Sinclair QL RTL
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$i qdosh.inc}
  12. const
  13. _MT_ALCHP = $18;
  14. _MT_RECHP = $19;
  15. function mt_alchp(size: dword; sizegot: pdword; jobid: Tjobid): pointer; assembler; nostackframe; public name '_mt_alchp';
  16. asm
  17. movem.l d2-d3/a2-a3,-(sp)
  18. move.l sizegot,-(sp)
  19. move.l jobid,d2
  20. move.l size,d1
  21. moveq.l #_MT_ALCHP,d0
  22. trap #1
  23. move.l (sp)+,d2 // sizegot ptr
  24. tst d0
  25. bne @quit
  26. move.l d2,a1
  27. beq @nosizegot
  28. move.l d1,(a1)
  29. @nosizegot:
  30. move.l a0,d0
  31. @quit:
  32. movem.l (sp)+,d2-d3/a2-a3
  33. end;
  34. procedure mt_rechp(area: pointer); assembler; nostackframe; public name '_mt_rechp';
  35. asm
  36. movem.l d2-d3/a2-a3,-(sp)
  37. move.l area,a0
  38. moveq.l #_MT_RECHP,d0
  39. trap #1
  40. movem.l (sp)+,d2-d3/a2-a3
  41. end;
  42. const
  43. _IO_SBYTE = $05;
  44. _IO_SSTRG = $07;
  45. function io_sbyte(chan: Tchanid; timeout: Ttimeout; c: char): longint; assembler; public name '_io_sbyte';
  46. asm
  47. move.l d3,-(sp)
  48. move.w timeout,d3
  49. clr.l d1
  50. move.b c,d1
  51. move.l chan,a0
  52. moveq.l #_IO_SBYTE,d0
  53. trap #3
  54. move.l (sp)+,d3
  55. end;
  56. function io_sstrg(chan: Tchanid; timeout: Ttimeout; buf: pointer; len: smallint): smallint; assembler; public name '_io_sstrg';
  57. asm
  58. movem.l d2-d3,-(sp)
  59. move.w len,d2
  60. move.l buf,a1
  61. move.w timeout,d3
  62. move.l chan,a0
  63. moveq.l #_IO_SSTRG,d0
  64. trap #3
  65. tst.l d0
  66. beq @ok
  67. cmp.w #ERR_EF,d0
  68. beq @eof
  69. cmp.w #ERR_NC,d0
  70. bne @quit
  71. @eof:
  72. tst.w d1
  73. beq @quit
  74. @ok:
  75. clr.l d0
  76. move.w d1,d0
  77. @quit:
  78. movem.l (sp)+,d2-d3
  79. end;