h68kdos.inc 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2023 by Free Pascal development team
  4. DOS related defines for Human 68k (Sharp X68000)
  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. const
  12. DOSE_ILGFNC = -1; { Invalid function code executed }
  13. DOSE_NOENT = -2; { File not found }
  14. DOSE_NODIR = -3; { Directory not found }
  15. DOSE_MFILE = -4; { Too many open files }
  16. DOSE_ISDIR = -5; { Directory and volume label inaccessible }
  17. DOSE_BADF = -6; { The specified handle is not open }
  18. DOSE_BROKNMEM = -7; { The memory management area was destroyed }
  19. DOSE_NOMEM = -8; { Not enough memory for execution }
  20. DOSE_ILGMPTR = -9; { Invalid memory management pointer specified }
  21. DOSE_ILGENV = -10; { Illegal environment specified }
  22. DOSE_ILGFMT = -11; { Abnormal executable file format }
  23. DOSE_ILGARG = -12; { Abnormal open access mode }
  24. DOSE_ILGFNAME = -13; { Invalid file name }
  25. DOSE_ILGPARM = -14; { Called with invalid parameter }
  26. DOSE_ILGDRV = -15; { Invalid drive specified }
  27. DOSE_ISCURDIR = -16; { Current directory can't be deleted }
  28. DOSE_CANTIOC = -17; { ioctrl can not be used }
  29. DOSE_NOMORE = -18; { No more files found }
  30. DOSE_RDONLY = -19; { The file can't be written }
  31. DOSE_EXISTDIR = -20; { The directory already exists }
  32. DOSE_NOTEMPTY = -21; { File can't be deleted }
  33. DOSE_CANTREN = -22; { File can't be renamed }
  34. DOSE_DISKFULL = -23; { File can't be created because disk is full }
  35. DOSE_DIRFULL = -24; { File can't be created because folder is full }
  36. DOSE_CANTSEEK = -25; { Can't seek to the specified position }
  37. DOSE_SUPER = -26; { Supervisor mode require while in supervisor mode }
  38. DOSE_DUPTHNAM = -27; { Thread name exists }
  39. DOSE_CANTSEND = -28; { IPC buffer is write protected }
  40. DOSE_THFULL = -29; { Can't start any more background processes }
  41. DOSE_LCKFULL = -32; { Insufficient lock space }
  42. DOSE_LCKERR = -33; { File is locked and can't be accessed }
  43. DOSE_BUSYDRV = -34; { The drive has a handler open }
  44. DOSE_SYMLOOP = -35; { Symbolic link nest exceeded 16 links(lndrv) }
  45. DOSE_EXISTFILE = -80; { File exists }
  46. type
  47. Th68kdos_comline = record
  48. case boolean of
  49. true: ( len: byte; buffer: array[0..255] of char; );
  50. false: ( pstr: shortstring; )
  51. end;
  52. Ph68kdos_comline = ^Th68kdos_comline;
  53. type
  54. Th68kdos_psp = record
  55. env: pchar;
  56. _exit: pointer;
  57. ctrlc: pointer;
  58. errexit: pointer;
  59. comline: Ph68kdos_comline;
  60. handle: array[0..11] of byte;
  61. bss: pointer;
  62. heap: pointer;
  63. stack: pointer;
  64. usp: pointer;
  65. ssp: pointer;
  66. sr: word;
  67. abort_sr: word;
  68. abort_ssp: pointer;
  69. trap10: pointer;
  70. trap11: pointer;
  71. trap12: pointer;
  72. trap13: pointer;
  73. trap14: pointer;
  74. osflg: dword;
  75. reserve_1: array[0..27] of byte;
  76. exe_path: array[0..67] of char;
  77. exe_name: array[0..23] of char;
  78. reserve_2: array[0..35] of byte;
  79. end;
  80. Ph68kdos_psp = ^Th68kdos_psp;
  81. // register contents on startup, a0-a5 respectively
  82. type
  83. Th68kdos_startup = record
  84. mcb: pbyte;
  85. bss_end: pbyte;
  86. comm: ph68kdos_comline;
  87. environ: pbyte;
  88. entry: pbyte;
  89. intr: pbyte;
  90. end;
  91. Ph68kdos_startup = ^Th68kdos_startup;
  92. type
  93. Th68kdos_freeinfo = record
  94. free: word;
  95. max: word;
  96. sectors: word;
  97. bytes: word;
  98. end;
  99. Ph68kdos_freeinfo = ^Th68kdos_freeinfo;
  100. type
  101. Th68kdos_filbuf = record
  102. searchatr: byte;
  103. driveno: byte;
  104. dirsec: dword;
  105. dirlft: word;
  106. dirpos: word;
  107. filename: array[0..7] of char;
  108. ext: array[0..2] of char;
  109. atr: byte;
  110. time: word;
  111. date: word;
  112. filelen: dword;
  113. name: array[0..22] of char;
  114. end;
  115. Ph68kdos_filbuf = ^Th68kdos_filbuf;
  116. // as used by seek
  117. const
  118. SEEK_FROM_START = 0;
  119. SEEK_FROM_CURRENT = 1;
  120. SEEK_FROM_END = 2;
  121. procedure h68kdos_exit; noreturn; syscall $ff00;
  122. function h68kdos_chgdrv(newdrv: word): longint; syscall $ff0e;
  123. function h68kdos_curdrv: longint; syscall $ff17;
  124. function h68kdos_gettim2: longint; syscall $ff27;
  125. function h68kdos_settim2(time: longint): longint; syscall $ff28;
  126. function h68kdos_getdate: longint; syscall $ff2a;
  127. function h68kdos_setdate(date: word): longint; syscall $ff2b;
  128. function h68kdos_gettime: longint; syscall $ff2c;
  129. function h68kdos_settime(time: word): longint; syscall $ff2d;
  130. function h68kdos_vernum: longint; syscall $ff30;
  131. function h68kdos_dskfre(drive: word; buffer: Ph68kdos_freeinfo): longint; syscall $ff36;
  132. function h68kdos_mkdir(name: pchar): longint; syscall $ff39;
  133. function h68kdos_rmdir(name: pchar): longint; syscall $ff3a;
  134. function h68kdos_chdir(name: pchar): longint; syscall $ff3b;
  135. function h68kdos_create(name: pchar; attr: word): longint; syscall $ff3c;
  136. function h68kdos_open(name: pchar; mode: word): longint; syscall $ff3d;
  137. function h68kdos_close(fileno: word): longint; syscall $ff3e;
  138. function h68kdos_read(fileno: word; buffer: pointer; len: longint): longint; syscall $ff3f;
  139. function h68kdos_write(fileno: word; buffer: pointer; len: longint): longint; syscall $ff40;
  140. function h68kdos_delete(name: pchar): longint; syscall $ff41;
  141. function h68kdos_seek(fileno: word; offset: longint; mode: word): longint; syscall $ff42;
  142. function h68kdos_chmod(name: pchar; atr: word):longint; syscall $ff43;
  143. function h68kdos_curdir(driveno: word; buffer: pointer): longint; syscall $ff47;
  144. function h68kdos_malloc(size: longint): pointer; syscall $ff48;
  145. function h68kdos_mfree(ptr: pointer): longint; syscall $ff49;
  146. function h68kdos_setblock(ptr: pointer; size: longint): longint; syscall $ff4a;
  147. function h68kdos_exec(mode: word; fil: pchar; p1: pointer; p2: pointer): longint; syscall $ff4b;
  148. procedure h68kdos_exit2(code: smallint); noreturn; syscall $ff4c;
  149. function h68kdos_files(filbuf: Ph68kdos_filbuf; name: pchar; atr: word): longint; syscall $ff4e;
  150. function h68kdos_nfiles(filbuf: Ph68kdos_filbuf): longint; syscall $ff4f;
  151. { * human68k v2 only calls * }
  152. function h68kdos_rename_v2(oldname: PChar; newname: PChar): longint; syscall $ff56;
  153. function h68kdos_filedate_v2(fileno: word; datetime: longint): longint; syscall $ff57;
  154. { * human68k v3 only calls * }
  155. function h68kdos_rename_v3(oldname: PChar; newname: PChar): longint; syscall $ff86;
  156. function h68kdos_filedate_v3(fileno: word; datetime: longint): longint; syscall $ff87;