gemdos.inc 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2016 by Free Pascal development team
  4. GEMDOS related defines for Atari TOS
  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. { The API description of this file is based on the information available
  12. online at: http://toshyp.atari.org }
  13. const
  14. E_OK = 0; // OK. No error has arisen
  15. EINVFN = -32; // Unknown function number
  16. EFILNF = -33; // File not found
  17. EPTHNF = -34; // Directory (folder) not found
  18. ENHNDL = -35; // No more handles available
  19. EACCDN = -36; // Access denied
  20. EIHNDL = -37; // Invalid file handle
  21. ENSMEM = -39; // Insufficient memory
  22. EIMBA = -40; // Invalid memory block address
  23. EDRIVE = -46; // Invalid drive specification
  24. ECWD = -47; // Current directory cannot be deleted
  25. ENSAME = -48; // Files on different logical drives
  26. ENMFIL = -49; // No more files can be opened
  27. ELOCKED = -58; // Segment of a file is protected (network)
  28. ENSLOCK = -59; // Invalid lock removal request
  29. ERANGE = -64; // File pointer in invalid segment (see also FreeMiNT message -88)
  30. EINTRN = -65; // Internal error of GEMDOS
  31. EPLFMT = -66; // Invalid program load format
  32. EGSBF = -67; // Allocated memory block could not be enlarged
  33. EBREAK = -68; // Program termination by Control-C
  34. EXCPT = -69; // 68000 exception (bombs)
  35. EPTHOV = -70; // Path overflow
  36. ELOOP = -80; // Endless loop with symbolic links
  37. EPIPE = -81; // Write to broken pipe.
  38. // as used by fseek
  39. const
  40. SEEK_FROM_START = 0;
  41. SEEK_FROM_CURRENT = 1;
  42. SEEK_FROM_END = 2;
  43. // as used by fcreate and fattrib
  44. const
  45. ATTRIB_WRITE_PROT = ( 1 shl 0 );
  46. ATTRIB_HIDDEN = ( 1 shl 1 );
  47. ATTRIB_SYSTEM = ( 1 shl 2 );
  48. ATTRIB_VOLUME_LABEL = ( 1 shl 3 );
  49. ATTRIB_DIRECTORY = ( 1 shl 4 );
  50. ATTRIB_ARCHIVE = ( 1 shl 5 );
  51. // as used by fopen
  52. const
  53. OPEN_READ_ONLY = ( 1 shl 0 );
  54. OPEN_WRITE_ONLY = ( 1 shl 1 );
  55. OPEN_READ_WRITE = ( 1 shl 2 );
  56. // as used by fattrib
  57. const
  58. FLAG_GET = 0;
  59. FLAG_SET = 1;
  60. type
  61. PDTA = ^TDTA;
  62. TDTA = packed record
  63. d_reserved: array[0..20] of shortint; {* Reserved for GEMDOS *}
  64. d_attrib: byte; {* File attributes *}
  65. d_time: word; {* Time *}
  66. d_date: word; {* Date *}
  67. d_length: dword; {* File length *}
  68. d_fname: array[0..13] of char; {* Filename *}
  69. end;
  70. type
  71. PDISKINFO = ^TDISKINFO;
  72. TDISKINFO = record
  73. b_free: dword; {* Number of free clusters *}
  74. b_total: dword; {* Total number of clusters *}
  75. b_secsiz: dword; {* Bytes per sector *}
  76. b_clsiz: dword; {* Sector per cluster *}
  77. end;
  78. type
  79. PDOSTIME = ^TDOSTIME;
  80. TDOSTIME = record
  81. time: word; {* Time like Tgettime *}
  82. date: word; {* Date like Tgetdate *}
  83. end;
  84. type
  85. PPD = ^TPD;
  86. TPD = record
  87. p_lowtpa: pointer; {* Start address of the TPA *}
  88. p_hitpa: pointer; {* First byte after the end of the TPA *}
  89. p_tbase: pointer; {* Start address of the program code *}
  90. p_tlen: longint; {* Length of the program code *}
  91. p_dbase: pointer; {* Start address of the DATA segment *}
  92. p_dlen: longint; {* Length of the DATA section *}
  93. p_bbase: pointer; {* Start address of the BSS segment *}
  94. p_blen: longint; {* Length of the BSS section *}
  95. p_dta: PDTA; {* Pointer to the default DTA *}
  96. {* Warning: Points first to the *}
  97. {* command line ! *}
  98. p_parent: PPD; {* Pointer to the basepage of the *}
  99. {* calling processes *}
  100. p_resrvd0: longint; {* Reserved *}
  101. p_env: pchar; {* Address of the environment string *}
  102. p_resrvd1: array[0..79] of char; {* Reserved *}
  103. p_cmdlin: array[0..127] of char; {* Command line *}
  104. end;
  105. TBASEPAGE = TPD; {* alias types... *}
  106. PBASEPAGE = ^TBASEPAGE;
  107. procedure gemdos_cconws(p: pchar); syscall 1 9;
  108. function gemdos_dsetdrv(drv: smallint): longint; syscall 1 14;
  109. function gemdos_dgetdrv: smallint; syscall 1 25;
  110. procedure gemdos_setdta(buf: PDTA); syscall 1 26;
  111. function gemdos_tgetdate: longint; syscall 1 42;
  112. function gemdos_tsetdate(date: word): smallint; syscall 1 43;
  113. function gemdos_tgettime: longint; syscall 1 44;
  114. function gemdos_tsettime(time: word): smallint; syscall 1 45;
  115. function gemdos_getdta: PDTA; syscall 1 47;
  116. function gemdos_sversion: smallint; syscall 1 48;
  117. function gemdos_dfree(buf: PDISKINFO; driveno: smallint): smallint; syscall 1 54;
  118. function gemdos_dcreate(const path: pchar): longint; syscall 1 57;
  119. function gemdos_ddelete(const path: pchar): longint; syscall 1 58;
  120. function gemdos_dsetpath(path: pchar): smallint; syscall 1 59;
  121. function gemdos_fcreate(fname: pchar; attr: smallint): smallint; syscall 1 60;
  122. function gemdos_fopen(fname: pchar; mode: smallint): longint; syscall 1 61;
  123. function gemdos_fclose(handle: smallint): smallint; syscall 1 62;
  124. function gemdos_fread(handle: smallint; count: longint; buf: pointer): longint; syscall 1 63;
  125. function gemdos_fwrite(handle: smallint; count: longint; buf: pointer): longint; syscall 1 64;
  126. function gemdos_fdelete(fname: pchar): smallint; syscall 1 65;
  127. function gemdos_fseek(offset: longint; handle: smallint; seekmode: smallint): longint; syscall 1 66;
  128. function gemdos_fattrib(filename: pchar; wflag: smallint; attrib: smallint): smallint; syscall 1 67;
  129. function gemdos_dgetpath(path: pchar; driveno: smallint): smallint; syscall 1 71;
  130. function gemdos_malloc(number: dword): pointer; syscall 1 72;
  131. function gemdos_free(block: pointer): dword; syscall 1 73;
  132. function gemdos_mshrink(zero: word; block: pointer; newsiz: longint): longint; syscall 1 74;
  133. function gemdos_pexec(mode: word; name: pchar; cmdline: pchar; env: pchar): longint; syscall 1 75;
  134. procedure gemdos_pterm(returncode: smallint); syscall 1 76;
  135. function gemdos_fsfirst(filename: pchar; attr: smallint): longint; syscall 1 78;
  136. function gemdos_fsnext: smallint; syscall 1 79;
  137. function gemdos_frename(zero: word; oldname: pchar; newname: pchar): longint; syscall 1 86;
  138. procedure gemdos_fdatime(timeptr: PDOSTIME; handle: smallint; wflag: smallint); syscall 1 87;