exec.inc 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053
  1. TYPE
  2. STRPTR = PChar;
  3. ULONG = Longint;
  4. LONG = longint;
  5. APTR = Pointer;
  6. BPTR = Longint;
  7. BSTR = Longint;
  8. pWord = ^Word;
  9. pLongint = ^Longint;
  10. pInteger = ^Integer;
  11. TYPE
  12. { * List Node Structure. Each member in a list starts with a Node * }
  13. pNode = ^tNode;
  14. tNode = Packed Record
  15. ln_Succ, { * Pointer to next (successor) * }
  16. ln_Pred : pNode; { * Pointer to previous (predecessor) * }
  17. ln_Type : Byte;
  18. ln_Pri : Shortint; { * Priority, for sorting * }
  19. ln_Name : STRPTR; { * ID string, null terminated * }
  20. End; { * Note: Integer aligned * }
  21. { * minimal node -- no type checking possible * }
  22. pMinNode = ^tMinNode;
  23. tMinNode = Packed Record
  24. mln_Succ,
  25. mln_Pred : pMinNode;
  26. End;
  27. { *
  28. ** Note: Newly initialized IORequests, and software interrupt structures
  29. ** used with Cause(), should have type NT_UNKNOWN. The OS will assign a type
  30. ** when they are first used.
  31. * }
  32. { *----- Node Types for LN_TYPE -----* }
  33. Const
  34. NT_UNKNOWN = 0;
  35. NT_TASK = 1; { * Exec task * }
  36. NT_INTERRUPT = 2;
  37. NT_DEVICE = 3;
  38. NT_MSGPORT = 4;
  39. NT_MESSAGE = 5; { * Indicates message currently pending * }
  40. NT_FREEMSG = 6;
  41. NT_REPLYMSG = 7; { * Message has been replied * }
  42. NT_RESOURCE = 8;
  43. NT_LIBRARY = 9;
  44. NT_MEMORY = 10;
  45. NT_SOFTINT = 11; { * Internal flag used by SoftInits * }
  46. NT_FONT = 12;
  47. NT_PROCESS = 13; { * AmigaDOS Process * }
  48. NT_SEMAPHORE = 14;
  49. NT_SIGNALSEM = 15; { * signal semaphores * }
  50. NT_BOOTNODE = 16;
  51. NT_KICKMEM = 17;
  52. NT_GRAPHICS = 18;
  53. NT_DEATHMESSAGE = 19;
  54. NT_USER = 254; { * User node types work down from here * }
  55. NT_EXTENDED = 255;
  56. {
  57. This file defines Exec system lists, which are used to link
  58. various things. Exec provides several routines to handle list
  59. processing (defined at the bottom of this file), so you can
  60. use these routines to save yourself the trouble of writing a list
  61. package.
  62. }
  63. Type
  64. { normal, full featured list }
  65. pList = ^tList;
  66. tList = Packed record
  67. lh_Head : pNode;
  68. lh_Tail : pNode;
  69. lh_TailPred : pNode;
  70. lh_Type : Byte;
  71. l_pad : Byte;
  72. end;
  73. { minimum list -- no type checking possible }
  74. pMinList = ^tMinList;
  75. tMinList = Packed record
  76. mlh_Head : pMinNode;
  77. mlh_Tail : pMinNode;
  78. mlh_TailPred : pMinNode;
  79. end;
  80. { ********************************************************************
  81. *
  82. * Format of the alert error number:
  83. *
  84. * +-+-------------+----------------+--------------------------------+
  85. * |D| SubSysId | General Error | SubSystem Specific Error |
  86. * +-+-------------+----------------+--------------------------------+
  87. * 1 7 bits 8 bits 16 bits
  88. *
  89. * D: DeadEnd alert
  90. * SubSysId: indicates ROM subsystem number.
  91. * General Error: roughly indicates what the error was
  92. * Specific Error: indicates more detail
  93. *********************************************************************}
  94. const
  95. {*********************************************************************
  96. *
  97. * Hardware/CPU specific alerts: They may show without the 8 at the
  98. * front of the number. These are CPU/68000 specific. See 68$0
  99. * programmer's manuals for more details.
  100. *
  101. *********************************************************************}
  102. ACPU_BusErr = $80000002; { Hardware bus fault/access error }
  103. ACPU_AddressErr = $80000003; { Illegal address access (ie: odd) }
  104. ACPU_InstErr = $80000004; { Illegal instruction }
  105. ACPU_DivZero = $80000005; { Divide by zero }
  106. ACPU_CHK = $80000006; { Check instruction error }
  107. ACPU_TRAPV = $80000007; { TrapV instruction error }
  108. ACPU_PrivErr = $80000008; { Privilege violation error }
  109. ACPU_Trace = $80000009; { Trace error }
  110. ACPU_LineA = $8000000A; { Line 1010 Emulator error }
  111. ACPU_LineF = $8000000B; { Line 1111 Emulator error }
  112. ACPU_Format = $8000000E; { Stack frame format error }
  113. ACPU_Spurious = $80000018; { Spurious interrupt error }
  114. ACPU_AutoVec1 = $80000019; { AutoVector Level 1 interrupt error }
  115. ACPU_AutoVec2 = $8000001A; { AutoVector Level 2 interrupt error }
  116. ACPU_AutoVec3 = $8000001B; { AutoVector Level 3 interrupt error }
  117. ACPU_AutoVec4 = $8000001C; { AutoVector Level 4 interrupt error }
  118. ACPU_AutoVec5 = $8000001D; { AutoVector Level 5 interrupt error }
  119. ACPU_AutoVec6 = $8000001E; { AutoVector Level 6 interrupt error }
  120. ACPU_AutoVec7 = $8000001F; { AutoVector Level 7 interrupt error }
  121. { ********************************************************************
  122. *
  123. * General Alerts
  124. *
  125. * For example: timer.device cannot open math.library would be $05038015
  126. *
  127. * Alert(AN_TimerDev|AG_OpenLib|AO_MathLib);
  128. *
  129. ********************************************************************}
  130. CONST
  131. { ------ alert types }
  132. AT_DeadEnd = $80000000;
  133. AT_Recovery = $00000000;
  134. { ------ general purpose alert codes }
  135. AG_NoMemory = $00010000;
  136. AG_MakeLib = $00020000;
  137. AG_OpenLib = $00030000;
  138. AG_OpenDev = $00040000;
  139. AG_OpenRes = $00050000;
  140. AG_IOError = $00060000;
  141. AG_NoSignal = $00070000;
  142. AG_BadParm = $00080000;
  143. AG_CloseLib = $00090000; { usually too many closes }
  144. AG_CloseDev = $000A0000; { or a mismatched close }
  145. AG_ProcCreate = $000B0000; { Process creation failed }
  146. { ------ alert objects: }
  147. AO_ExecLib = $00008001;
  148. AO_GraphicsLib = $00008002;
  149. AO_LayersLib = $00008003;
  150. AO_Intuition = $00008004;
  151. AO_MathLib = $00008005;
  152. AO_DOSLib = $00008007;
  153. AO_RAMLib = $00008008;
  154. AO_IconLib = $00008009;
  155. AO_ExpansionLib = $0000800A;
  156. AO_DiskfontLib = $0000800B;
  157. AO_UtilityLib = $0000800C;
  158. AO_KeyMapLib = $0000800D;
  159. AO_AudioDev = $00008010;
  160. AO_ConsoleDev = $00008011;
  161. AO_GamePortDev = $00008012;
  162. AO_KeyboardDev = $00008013;
  163. AO_TrackDiskDev = $00008014;
  164. AO_TimerDev = $00008015;
  165. AO_CIARsrc = $00008020;
  166. AO_DiskRsrc = $00008021;
  167. AO_MiscRsrc = $00008022;
  168. AO_BootStrap = $00008030;
  169. AO_Workbench = $00008031;
  170. AO_DiskCopy = $00008032;
  171. AO_GadTools = $00008033;
  172. AO_Unknown = $00008035;
  173. { ********************************************************************
  174. *
  175. * Specific Alerts:
  176. *
  177. ********************************************************************}
  178. { ------ exec.library }
  179. AN_ExecLib = $01000000;
  180. AN_ExcptVect = $01000001; { 68000 exception vector checksum (obs.) }
  181. AN_BaseChkSum = $01000002; { Execbase checksum (obs.) }
  182. AN_LibChkSum = $01000003; { Library checksum failure }
  183. AN_MemCorrupt = $81000005; { Corrupt memory list detected in FreeMem }
  184. AN_IntrMem = $81000006; { No memory for interrupt servers }
  185. AN_InitAPtr = $01000007; { InitStruct() of an APTR source (obs.) }
  186. AN_SemCorrupt = $01000008; { A semaphore is in an illegal state
  187. at ReleaseSempahore() }
  188. AN_FreeTwice = $01000009; { Freeing memory already freed }
  189. AN_BogusExcpt = $8100000A; { illegal 68k exception taken (obs.) }
  190. AN_IOUsedTwice = $0100000B; { Attempt to reuse active IORequest }
  191. AN_MemoryInsane = $0100000C; { Sanity check on memory list failed
  192. during AvailMem(MEMF_LARGEST) }
  193. AN_IOAfterClose = $0100000D; { IO attempted on closed IORequest }
  194. AN_StackProbe = $0100000E; { Stack appears to extend out of range }
  195. AN_BadFreeAddr = $0100000F; { Memory header not located. [ Usually an
  196. invalid address passed to FreeMem() ] }
  197. AN_BadSemaphore = $01000010; { An attempt was made to use the old
  198. message semaphores. }
  199. { ------ graphics.library }
  200. AN_GraphicsLib = $02000000;
  201. AN_GfxNoMem = $82010000; { graphics out of memory }
  202. AN_GfxNoMemMspc = $82010001; { MonitorSpec alloc, no memory }
  203. AN_LongFrame = $82010006; { long frame, no memory }
  204. AN_ShortFrame = $82010007; { short frame, no memory }
  205. AN_TextTmpRas = $02010009; { text, no memory for TmpRas }
  206. AN_BltBitMap = $8201000A; { BltBitMap, no memory }
  207. AN_RegionMemory = $8201000B; { regions, memory not available }
  208. AN_MakeVPort = $82010030; { MakeVPort, no memory }
  209. AN_GfxNewError = $0200000C;
  210. AN_GfxFreeError = $0200000D;
  211. AN_GfxNoLCM = $82011234; { emergency memory not available }
  212. AN_ObsoleteFont = $02000401; { unsupported font description used }
  213. { ------ layers.library }
  214. AN_LayersLib = $03000000;
  215. AN_LayersNoMem = $83010000; { layers out of memory }
  216. { ------ intuition.library }
  217. AN_Intuition = $04000000;
  218. AN_GadgetType = $84000001; { unknown gadget type }
  219. AN_BadGadget = $04000001; { Recovery form of AN_GadgetType }
  220. AN_CreatePort = $84010002; { create port, no memory }
  221. AN_ItemAlloc = $04010003; { item plane alloc, no memory }
  222. AN_SubAlloc = $04010004; { sub alloc, no memory }
  223. AN_PlaneAlloc = $84010005; { plane alloc, no memory }
  224. AN_ItemBoxTop = $84000006; { item box top < RelZero }
  225. AN_OpenScreen = $84010007; { open screen, no memory }
  226. AN_OpenScrnRast = $84010008; { open screen, raster alloc, no memory }
  227. AN_SysScrnType = $84000009; { open sys screen, unknown type }
  228. AN_AddSWGadget = $8401000A; { add SW gadgets, no memory }
  229. AN_OpenWindow = $8401000B; { open window, no memory }
  230. AN_BadState = $8400000C; { Bad State Return entering Intuition }
  231. AN_BadMessage = $8400000D; { Bad Message received by IDCMP }
  232. AN_WeirdEcho = $8400000E; { Weird echo causing incomprehension }
  233. AN_NoConsole = $8400000F; { couldn't open the Console Device }
  234. AN_NoISem = $04000010; { Intuition skipped obtaining a sem }
  235. AN_ISemOrder = $04000011; { Intuition obtained a sem in bad order }
  236. { ------ math.library }
  237. AN_MathLib = $05000000;
  238. { ------ dos.library }
  239. AN_DOSLib = $07000000;
  240. AN_StartMem = $07010001; { no memory at startup }
  241. AN_EndTask = $07000002; { EndTask didn't }
  242. AN_QPktFail = $07000003; { Qpkt failure }
  243. AN_AsyncPkt = $07000004; { Unexpected packet received }
  244. AN_FreeVec = $07000005; { Freevec failed }
  245. AN_DiskBlkSeq = $07000006; { Disk block sequence error }
  246. AN_BitMap = $07000007; { Bitmap corrupt }
  247. AN_KeyFree = $07000008; { Key already free }
  248. AN_BadChkSum = $07000009; { Invalid checksum }
  249. AN_DiskError = $0700000A; { Disk Error }
  250. AN_KeyRange = $0700000B; { Key out of range }
  251. AN_BadOverlay = $0700000C; { Bad overlay }
  252. AN_BadInitFunc = $0700000D; { Invalid init packet for cli/shell }
  253. AN_FileReclosed = $0700000E; { A filehandle was closed more than once }
  254. { ------ ramlib.library }
  255. AN_RAMLib = $08000000;
  256. AN_BadSegList = $08000001; { no overlays in library seglists }
  257. { ------ icon.library }
  258. AN_IconLib = $09000000;
  259. { ------ expansion.library }
  260. AN_ExpansionLib = $0A000000;
  261. AN_BadExpansionFree = $0A000001; { freeed free region }
  262. { ------ diskfont.library }
  263. AN_DiskfontLib = $0B000000;
  264. { ------ audio.device }
  265. AN_AudioDev = $10000000;
  266. { ------ console.device }
  267. AN_ConsoleDev = $11000000;
  268. AN_NoWindow = $11000001; { Console can't open initial window }
  269. { ------ gameport.device }
  270. AN_GamePortDev = $12000000;
  271. { ------ keyboard.device }
  272. AN_KeyboardDev = $13000000;
  273. { ------ trackdisk.device }
  274. AN_TrackDiskDev = $14000000;
  275. AN_TDCalibSeek = $14000001; { calibrate: seek error }
  276. AN_TDDelay = $14000002; { delay: error on timer wait }
  277. { ------ timer.device }
  278. AN_TimerDev = $15000000;
  279. AN_TMBadReq = $15000001; { bad request }
  280. AN_TMBadSupply = $15000002; { power supply -- no 50/60Hz ticks }
  281. { ------ cia.resource }
  282. AN_CIARsrc = $20000000;
  283. { ------ disk.resource }
  284. AN_DiskRsrc = $21000000;
  285. AN_DRHasDisk = $21000001; { get unit: already has disk }
  286. AN_DRIntNoAct = $21000002; { interrupt: no active unit }
  287. { ------ misc.resource }
  288. AN_MiscRsrc = $22000000;
  289. { ------ bootstrap }
  290. AN_BootStrap = $30000000;
  291. AN_BootError = $30000001; { boot code returned an error }
  292. { ------ Workbench }
  293. AN_Workbench = $31000000;
  294. AN_NoFonts = $B1000001;
  295. AN_WBBadStartupMsg1 = $31000001;
  296. AN_WBBadStartupMsg2 = $31000002;
  297. AN_WBBadIOMsg = $31000003;
  298. AN_WBReLayoutToolMenu = $B1010009;
  299. { ------ DiskCopy }
  300. AN_DiskCopy = $32000000;
  301. { ------ toolkit for Intuition }
  302. AN_GadTools = $33000000;
  303. { ------ System utility library }
  304. AN_UtilityLib = $34000000;
  305. { ------ For use by any application that needs it }
  306. AN_Unknown = $35000000;
  307. CONST
  308. IOERR_OPENFAIL = -1; { device/unit failed to open }
  309. IOERR_ABORTED = -2; { request terminated early [after AbortIO()] }
  310. IOERR_NOCMD = -3; { command not supported by device }
  311. IOERR_BADLENGTH = -4; { not a valid length (usually IO_LENGTH) }
  312. IOERR_BADADDRESS = -5; { invalid address (misaligned or bad range) }
  313. IOERR_UNITBUSY = -6; { device opens ok, but requested unit is busy }
  314. IOERR_SELFTEST = -7; { hardware failed self-test }
  315. type
  316. pResident = ^tResident;
  317. tResident = packed record
  318. rt_MatchWord : Word; { Integer to match on (ILLEGAL) }
  319. rt_MatchTag : pResident; { pointer to the above }
  320. rt_EndSkip : Pointer; { address to continue scan }
  321. rt_Flags : Byte; { various tag flags }
  322. rt_Version : Byte; { release version number }
  323. rt_Type : Byte; { type of module (NT_mumble) }
  324. rt_Pri : Shortint; { initialization priority }
  325. rt_Name : STRPTR; { pointer to node name }
  326. rt_IdString : STRPTR; { pointer to ident string }
  327. rt_Init : Pointer; { pointer to init code }
  328. end;
  329. const
  330. RTC_MATCHWORD = $4AFC;
  331. RTF_AUTOINIT = $80;
  332. RTF_AFTERDOS = $04;
  333. RTF_SINGLETASK = $02;
  334. RTF_COLDSTART = $01;
  335. { Compatibility: }
  336. RTM_WHEN = $03;
  337. RTW_COLDSTART = $01;
  338. RTW_NEVER = $00;
  339. TYPE
  340. { ****** MemChunk **************************************************** }
  341. pMemChunk = ^tMemChunk;
  342. tMemChunk = Packed Record
  343. mc_Next : pMemChunk; { * pointer to next chunk * }
  344. mc_Bytes : ULONG; { * chunk byte size * }
  345. End;
  346. { ****** MemHeader *************************************************** }
  347. pMemHeader = ^tMemHeader;
  348. tMemHeader = Packed Record
  349. mh_Node : tNode;
  350. mh_Attributes : Word; { * characteristics of this region * }
  351. mh_First : pMemChunk; { * first free region * }
  352. mh_Lower, { * lower memory bound * }
  353. mh_Upper : Pointer; { * upper memory bound+1 * }
  354. mh_Free : Ulong; { * total number of free bytes * }
  355. End;
  356. { ****** MemEntry **************************************************** }
  357. pMemUnit = ^tMemUnit;
  358. tMemUnit = Packed Record
  359. meu_Reqs : ULONG; { * the AllocMem requirements * }
  360. meu_Addr : Pointer; { * the address of this memory region * }
  361. End;
  362. pMemEntry = ^tMemEntry;
  363. tMemEntry = Packed Record
  364. me_Un : tMemUnit;
  365. me_Length : ULONG; { * the length of this memory region * }
  366. End;
  367. { ****** MemList ***************************************************** }
  368. { * Note: sizeof(struct MemList) includes the size of the first MemEntry! * }
  369. pMemList = ^tMemList;
  370. tMemList = Packed Record
  371. ml_Node : tNode;
  372. ml_NumEntries : Word; { * number of entries in this struct * }
  373. ml_ME : Array [0..0] of tMemEntry; { * the first entry * }
  374. End;
  375. { *----- Memory Requirement Types ---------------------------* }
  376. { *----- See the AllocMem() documentation for details--------* }
  377. Const
  378. MEMF_ANY = %000000000000000000000000; { * Any type of memory will do * }
  379. MEMF_PUBLIC = %000000000000000000000001;
  380. MEMF_CHIP = %000000000000000000000010;
  381. MEMF_FAST = %000000000000000000000100;
  382. MEMF_LOCAL = %000000000000000100000000;
  383. MEMF_24BITDMA = %000000000000001000000000; { * DMAable memory within 24 bits of address * }
  384. MEMF_KICK = %000000000000010000000000; { Memory that can be used for KickTags }
  385. MEMF_CLEAR = %000000010000000000000000;
  386. MEMF_LARGEST = %000000100000000000000000;
  387. MEMF_REVERSE = %000001000000000000000000;
  388. MEMF_TOTAL = %000010000000000000000000; { * AvailMem: return total size of memory * }
  389. MEMF_NO_EXPUNGE = $80000000; {AllocMem: Do not cause expunge on failure }
  390. MEM_BLOCKSIZE = 8;
  391. MEM_BLOCKMASK = MEM_BLOCKSIZE-1;
  392. Type
  393. {***** MemHandlerData *********************************************}
  394. { Note: This structure is *READ ONLY* and only EXEC can create it!}
  395. pMemHandlerData = ^tMemHandlerData;
  396. tMemHandlerData = Packed Record
  397. memh_RequestSize, { Requested allocation size }
  398. memh_RequestFlags, { Requested allocation flags }
  399. memh_Flags : ULONG; { Flags (see below) }
  400. end;
  401. const
  402. MEMHF_RECYCLE = 1; { 0==First time, 1==recycle }
  403. {***** Low Memory handler return values **************************}
  404. MEM_DID_NOTHING = 0; { Nothing we could do... }
  405. MEM_ALL_DONE = -1; { We did all we could do }
  406. MEM_TRY_AGAIN = 1; { We did some, try the allocation again }
  407. type
  408. pInterrupt = ^tInterrupt;
  409. tInterrupt = Packed record
  410. is_Node : tNode;
  411. is_Data : Pointer; { Server data segment }
  412. is_Code : Pointer; { Server code entry }
  413. end;
  414. pIntVector = ^tIntVector;
  415. tIntVector = Packed record { For EXEC use ONLY! }
  416. iv_Data : Pointer;
  417. iv_Code : Pointer;
  418. iv_Node : pNode;
  419. end;
  420. pSoftIntList = ^tSoftIntList;
  421. tSoftIntList = Packed record { For EXEC use ONLY! }
  422. sh_List : tList;
  423. sh_Pad : Word;
  424. end;
  425. const
  426. SIH_PRIMASK = $F0;
  427. { this is a fake INT definition, used only for AddIntServer and the like }
  428. INTB_NMI = 15;
  429. INTF_NMI = $0080;
  430. {
  431. Every Amiga Task has one of these Task structures associated with it.
  432. To find yours, use FindTask(Nil). AmigaDOS processes tack a few more
  433. values on to the end of this structure, which is the difference between
  434. Tasks and Processes.
  435. }
  436. type
  437. pTask = ^tTask;
  438. tTask = Packed record
  439. tc_Node : tNode;
  440. tc_Flags : Byte;
  441. tc_State : Byte;
  442. tc_IDNestCnt : Shortint; { intr disabled nesting }
  443. tc_TDNestCnt : Shortint; { task disabled nesting }
  444. tc_SigAlloc : ULONG; { sigs allocated }
  445. tc_SigWait : ULONG; { sigs we are waiting for }
  446. tc_SigRecvd : ULONG; { sigs we have received }
  447. tc_SigExcept : ULONG; { sigs we will take excepts for }
  448. tc_TrapAlloc : Word; { traps allocated }
  449. tc_TrapAble : Word; { traps enabled }
  450. tc_ExceptData : Pointer; { points to except data }
  451. tc_ExceptCode : Pointer; { points to except code }
  452. tc_TrapData : Pointer; { points to trap data }
  453. tc_TrapCode : Pointer; { points to trap code }
  454. tc_SPReg : Pointer; { stack pointer }
  455. tc_SPLower : Pointer; { stack lower bound }
  456. tc_SPUpper : Pointer; { stack upper bound + 2 }
  457. tc_Switch : Pointer; { task losing CPU }
  458. tc_Launch : Pointer; { task getting CPU }
  459. tc_MemEntry : tList; { allocated memory }
  460. tc_UserData : Pointer; { per task data }
  461. end;
  462. {
  463. * Stack swap structure as passed to StackSwap()
  464. }
  465. pStackSwapStruct = ^tStackSwapStruct;
  466. tStackSwapStruct = Packed Record
  467. stk_Lower : Pointer; { Lowest byte of stack }
  468. stk_Upper : ULONG; { Upper end of stack (size + Lowest) }
  469. stk_Pointer : Pointer; { Stack pointer at switch point }
  470. end;
  471. {----- Flag Bits ------------------------------------------}
  472. const
  473. TB_PROCTIME = 0;
  474. TB_ETASK = 3;
  475. TB_STACKCHK = 4;
  476. TB_EXCEPT = 5;
  477. TB_SWITCH = 6;
  478. TB_LAUNCH = 7;
  479. TF_PROCTIME = 1;
  480. TF_ETASK = 8;
  481. TF_STACKCHK = 16;
  482. TF_EXCEPT = 32;
  483. TF_SWITCH = 64;
  484. TF_LAUNCH = 128;
  485. {----- Task States ----------------------------------------}
  486. TS_INVALID = 0;
  487. TS_ADDED = 1;
  488. TS_RUN = 2;
  489. TS_READY = 3;
  490. TS_WAIT = 4;
  491. TS_EXCEPT = 5;
  492. TS_REMOVED = 6;
  493. {----- Predefined Signals -------------------------------------}
  494. SIGB_ABORT = 0;
  495. SIGB_CHILD = 1;
  496. SIGB_BLIT = 4;
  497. SIGB_SINGLE = 4;
  498. SIGB_INTUITION = 5;
  499. SIGB_DOS = 8;
  500. SIGF_ABORT = 1;
  501. SIGF_CHILD = 2;
  502. SIGF_BLIT = 16;
  503. SIGF_SINGLE = 16;
  504. SIGF_INTUITION = 32;
  505. SIGF_DOS = 256;
  506. {
  507. This file defines ports and messages, which are used for inter-
  508. task communications using the routines defined toward the
  509. bottom of this file.
  510. }
  511. type
  512. {****** MsgPort *****************************************************}
  513. pMsgPort = ^tMsgPort;
  514. tMsgPort = Packed record
  515. mp_Node : tNode;
  516. mp_Flags : Byte;
  517. mp_SigBit : Byte; { signal bit number }
  518. mp_SigTask : Pointer; { task to be signalled (TaskPtr) }
  519. mp_MsgList : tList; { message linked list }
  520. end;
  521. {****** Message *****************************************************}
  522. pMessage = ^tMessage;
  523. tMessage = Packed record
  524. mn_Node : tNode;
  525. mn_ReplyPort : pMsgPort; { message reply port }
  526. mn_Length : Word; { message len in bytes }
  527. end;
  528. { mp_Flags: Port arrival actions (PutMsg) }
  529. CONST
  530. PF_ACTION = 3; { * Mask * }
  531. PA_SIGNAL = 0; { * Signal task in mp_SigTask * }
  532. PA_SOFTINT = 1; { * Signal SoftInt in mp_SoftInt/mp_SigTask * }
  533. PA_IGNORE = 2; { * Ignore arrival * }
  534. { Semaphore }
  535. type
  536. pSemaphore = ^tSemaphore;
  537. tSemaphore = Packed record
  538. sm_MsgPort : tMsgPort;
  539. sm_Bids : Integer;
  540. end;
  541. { This is the structure used to request a signal semaphore }
  542. pSemaphoreRequest = ^tSemaphoreRequest;
  543. tSemaphoreRequest = Packed record
  544. sr_Link : tMinNode;
  545. sr_Waiter : pTask;
  546. end;
  547. { The actual semaphore itself }
  548. pSignalSemaphore = ^tSignalSemaphore;
  549. tSignalSemaphore = Packed record
  550. ss_Link : tNode;
  551. ss_NestCount : Integer;
  552. ss_WaitQueue : tMinList;
  553. ss_MultipleLink : tSemaphoreRequest;
  554. ss_Owner : pTask;
  555. ss_QueueCount : Integer;
  556. end;
  557. { ***** Semaphore procure message (for use in V39 Procure/Vacate *** }
  558. pSemaphoreMessage = ^tSemaphoreMessage;
  559. tSemaphoreMessage = Packed Record
  560. ssm_Message : tMessage;
  561. ssm_Semaphore : pSignalSemaphore;
  562. end;
  563. const
  564. SM_SHARED = 1;
  565. SM_EXCLUSIVE = 0;
  566. CONST
  567. { ------ Special Constants --------------------------------------- }
  568. LIB_VECTSIZE = 6; { Each library entry takes 6 bytes }
  569. LIB_RESERVED = 4; { Exec reserves the first 4 vectors }
  570. LIB_BASE = (-LIB_VECTSIZE);
  571. LIB_USERDEF = (LIB_BASE-(LIB_RESERVED*LIB_VECTSIZE));
  572. LIB_NONSTD = (LIB_USERDEF);
  573. { ------ Standard Functions -------------------------------------- }
  574. LIB_OPEN = -6;
  575. LIB_CLOSE = -12;
  576. LIB_EXPUNGE = -18;
  577. LIB_EXTFUNC = -24; { for future expansion }
  578. TYPE
  579. { ------ Library Base Structure ---------------------------------- }
  580. { Also used for Devices and some Resources }
  581. pLibrary = ^tLibrary;
  582. tLibrary = packed record
  583. lib_Node : tNode;
  584. lib_Flags,
  585. lib_pad : Byte;
  586. lib_NegSize, { number of bytes before library }
  587. lib_PosSize, { number of bytes after library }
  588. lib_Version, { major }
  589. lib_Revision : Word; { minor }
  590. lib_IdString : STRPTR; { ASCII identification }
  591. lib_Sum : ULONG; { the checksum itself }
  592. lib_OpenCnt : Word; { number of current opens }
  593. end; { * Warning: size is not a longword multiple ! * }
  594. CONST
  595. { lib_Flags bit definitions (all others are system reserved) }
  596. LIBF_SUMMING = %00000001; { we are currently checksumming }
  597. LIBF_CHANGED = %00000010; { we have just changed the lib }
  598. LIBF_SUMUSED = %00000100; { set if we should bother to sum }
  599. LIBF_DELEXP = %00001000; { delayed expunge }
  600. {
  601. This file defines the constants and types required to use
  602. Amiga device IO routines, which are also defined here.
  603. }
  604. TYPE
  605. {***** Device *****************************************************}
  606. pDevice = ^tDevice;
  607. tDevice = packed record
  608. dd_Library : tLibrary;
  609. end;
  610. {***** Unit *******************************************************}
  611. pUnit = ^tUnit;
  612. tUnit = record
  613. unit_MsgPort : tMsgPort; { queue for unprocessed messages }
  614. { instance of msgport is recommended }
  615. unit_flags,
  616. unit_pad : Byte;
  617. unit_OpenCnt : Word; { number of active opens }
  618. end;
  619. Const
  620. UNITF_ACTIVE = %00000001;
  621. UNITF_INTASK = %00000010;
  622. type
  623. pIORequest = ^tIORequest;
  624. tIORequest = packed record
  625. io_Message : tMessage;
  626. io_Device : pDevice; { device node pointer }
  627. io_Unit : pUnit; { unit (driver private)}
  628. io_Command : Word; { device command }
  629. io_Flags : Byte;
  630. io_Error : Shortint; { error or warning num }
  631. end;
  632. pIOStdReq = ^tIOStdReq;
  633. tIOStdReq = packed record
  634. io_Message : tMessage;
  635. io_Device : pDevice; { device node pointer }
  636. io_Unit : pUnit; { unit (driver private)}
  637. io_Command : Word; { device command }
  638. io_Flags : Byte;
  639. io_Error : Shortint; { error or warning num }
  640. io_Actual : ULONG; { actual number of bytes transferred }
  641. io_Length : ULONG; { requested number bytes transferred}
  642. io_Data : Pointer; { points to data area }
  643. io_Offset : ULONG; { offset for block structured devices }
  644. end;
  645. { library vector offsets for device reserved vectors }
  646. const
  647. DEV_BEGINIO = -30;
  648. DEV_ABORTIO = -36;
  649. { io_Flags defined bits }
  650. IOB_QUICK = 0;
  651. IOF_QUICK = 1;
  652. CMD_INVALID = 0;
  653. CMD_RESET = 1;
  654. CMD_READ = 2;
  655. CMD_WRITE = 3;
  656. CMD_UPDATE = 4;
  657. CMD_CLEAR = 5;
  658. CMD_STOP = 6;
  659. CMD_START = 7;
  660. CMD_FLUSH = 8;
  661. CMD_NONSTD = 9;
  662. { Definition of the Exec library base structure (pointed to by location 4).
  663. ** Most fields are not to be viewed or modified by user programs. Use
  664. ** extreme caution.
  665. }
  666. type
  667. pExecBase = ^tExecBase;
  668. tExecBase = packed Record
  669. LibNode : tLibrary; { Standard library node }
  670. { ******* Static System Variables ******* }
  671. SoftVer : Word; { kickstart release number (obs.) }
  672. LowMemChkSum : Integer; { checksum of 68000 trap vectors }
  673. ChkBase : ULONG; { system base pointer complement }
  674. ColdCapture, { coldstart soft capture vector }
  675. CoolCapture, { coolstart soft capture vector }
  676. WarmCapture, { warmstart soft capture vector }
  677. SysStkUpper, { system stack base (upper bound) }
  678. SysStkLower : Pointer; { top of system stack (lower bound) }
  679. MaxLocMem : ULONG; { top of chip memory }
  680. DebugEntry, { global debugger entry point }
  681. DebugData, { global debugger data segment }
  682. AlertData, { alert data segment }
  683. MaxExtMem : Pointer; { top of extended mem, or null if none }
  684. ChkSum : Word; { for all of the above (minus 2) }
  685. { ***** Interrupt Related ************************************** }
  686. IntVects : Array[0..15] of tIntVector;
  687. { ***** Dynamic System Variables ************************************ }
  688. ThisTask : pTask; { pointer to current task (readable) }
  689. IdleCount, { idle counter }
  690. DispCount : ULONG; { dispatch counter }
  691. Quantum, { time slice quantum }
  692. Elapsed, { current quantum ticks }
  693. SysFlags : Word; { misc internal system flags }
  694. IDNestCnt, { interrupt disable nesting count }
  695. TDNestCnt : Shortint; { task disable nesting count }
  696. AttnFlags, { special attention flags (readable) }
  697. AttnResched : Word; { rescheduling attention }
  698. ResModules, { resident module array pointer }
  699. TaskTrapCode,
  700. TaskExceptCode,
  701. TaskExitCode : Pointer;
  702. TaskSigAlloc : ULONG;
  703. TaskTrapAlloc: Word;
  704. { ***** System Lists (private!) ******************************* }
  705. MemList,
  706. ResourceList,
  707. DeviceList,
  708. IntrList,
  709. LibList,
  710. PortList,
  711. TaskReady,
  712. TaskWait : tList;
  713. SoftInts : Array[0..4] of tSoftIntList;
  714. { ***** Other Globals ****************************************** }
  715. LastAlert : Array[0..3] of LONG;
  716. { these next two variables are provided to allow
  717. ** system developers to have a rough idea of the
  718. ** period of two externally controlled signals --
  719. ** the time between vertical blank interrupts and the
  720. ** external line rate (which is counted by CIA A's
  721. ** "time of day" clock). In general these values
  722. ** will be 50 or 60, and may or may not track each
  723. ** other. These values replace the obsolete AFB_PAL
  724. ** and AFB_50HZ flags.
  725. }
  726. VBlankFrequency, { (readable) }
  727. PowerSupplyFrequency : Byte; { (readable) }
  728. SemaphoreList : tList;
  729. { these next two are to be able to kickstart into user ram.
  730. ** KickMemPtr holds a singly linked list of MemLists which
  731. ** will be removed from the memory list via AllocAbs. If
  732. ** all the AllocAbs's succeeded, then the KickTagPtr will
  733. ** be added to the rom tag list.
  734. }
  735. KickMemPtr, { ptr to queue of mem lists }
  736. KickTagPtr, { ptr to rom tag queue }
  737. KickCheckSum : Pointer; { checksum for mem and tags }
  738. { ***** V36 Exec additions start here ************************************* }
  739. ex_Pad0 : Word;
  740. ex_Reserved0 : ULONG;
  741. ex_RamLibPrivate : Pointer;
  742. { The next ULONG contains the system "E" clock frequency,
  743. ** expressed in Hertz. The E clock is used as a timebase for
  744. ** the Amiga's 8520 I/O chips. (E is connected to "02").
  745. ** Typical values are 715909 for NTSC, or 709379 for PAL.
  746. }
  747. ex_EClockFrequency, { (readable) }
  748. ex_CacheControl, { Private to CacheControl calls }
  749. ex_TaskID : ULONG; { Next available task ID }
  750. ex_Reserved1 : Array[0..4] of ULONG;
  751. ex_MMULock : Pointer; { private }
  752. ex_Reserved2 : Array[0..2] of ULONG;
  753. {***** V39 Exec additions start here *************************************}
  754. { The following list and data element are used
  755. * for V39 exec's low memory handler...
  756. }
  757. ex_MemHandlers : tMinList; { The handler list }
  758. ex_MemHandler : Pointer; { Private! handler pointer }
  759. ex_Reserved : Array[0..1] of Shortint;
  760. end;
  761. { ***** Bit defines for AttnFlags (see above) ***************************** }
  762. { Processors and Co-processors: }
  763. CONST
  764. AFB_68010 = 0; { also set for 68020 }
  765. AFB_68020 = 1; { also set for 68030 }
  766. AFB_68030 = 2; { also set for 68040 }
  767. AFB_68040 = 3;
  768. AFB_68881 = 4; { also set for 68882 }
  769. AFB_68882 = 5;
  770. AFB_FPU40 = 6; { Set if 68040 FPU }
  771. AFF_68010 = %00000001;
  772. AFF_68020 = %00000010;
  773. AFF_68030 = %00000100;
  774. AFF_68040 = %00001000;
  775. AFF_68881 = %00010000;
  776. AFF_68882 = %00100000;
  777. AFF_FPU40 = %01000000;
  778. { AFB_RESERVED8 = %000100000000; }
  779. { AFB_RESERVED9 = %001000000000; }
  780. { ***** Selected flag definitions for Cache manipulation calls ********* }
  781. CACRF_EnableI = %0000000000000001; { Enable instruction cache }
  782. CACRF_FreezeI = %0000000000000010; { Freeze instruction cache }
  783. CACRF_ClearI = %0000000000001000; { Clear instruction cache }
  784. CACRF_IBE = %0000000000010000; { Instruction burst enable }
  785. CACRF_EnableD = %0000000100000000; { 68030 Enable data cache }
  786. CACRF_FreezeD = %0000001000000000; { 68030 Freeze data cache }
  787. CACRF_ClearD = %0000100000000000; { 68030 Clear data cache }
  788. CACRF_DBE = %0001000000000000; { 68030 Data burst enable }
  789. CACRF_WriteAllocate = %0010000000000000; { 68030 Write-Allocate mode
  790. (must always be set!) }
  791. CACRF_EnableE = 1073741824; { Master enable for external caches }
  792. { External caches should track the }
  793. { state of the internal caches }
  794. { such that they do not cache anything }
  795. { that the internal cache turned off }
  796. { for. }
  797. CACRF_CopyBack = $80000000; { Master enable for copyback caches }
  798. DMA_Continue = 2; { Continuation flag for CachePreDMA }
  799. DMA_NoModify = 4; { Set if DMA does not update memory }
  800. DMA_ReadFromRAM = 8; { Set if DMA goes *FROM* RAM to device }