--- /dev/null
+; MMURTL Operating System Source Code\r
+; Copyright 1991,1992,1993,1994 Richard A. Burgess\r
+; ALL RIGHTS RESERVED Version 1,0\r
+;=============================================================================\r
+; General EQUates for the OS. Included in many modules.\r
+;=============================================================================\r
+\r
+TRUE EQU 1\r
+FALSE EQU 0\r
+\r
+; Error and Status Codes. All MMURTL functions (with the exception\r
+; of a very few) return a Status or Error code. It is a 32 bit\r
+; value. Unlike some systems which may indicate any number\r
+; of errors or function status by returning a single value\r
+; such as -1, MMURTL tells you what happened exactly upon\r
+; return from each call.\r
+; You can assume (unless specified in the API for that call),\r
+; that ZERO (0) means everything went as expected.\r
+; The values assigned are broken into groups based on\r
+; functionality. The numbers were selected arbitrarily as the\r
+; OS code was developed, so there is no real reasoning behind\r
+; the numbers themselves.\r
+; If you add services, or device drivers, please use numbers beyond\r
+; the range of these to indicate errors that would not\r
+; otherwise be standardized. If a standardized error code\r
+; fits the description of an error you would return, then use it.\r
+;---------------------------\r
+;\r
+;1-199 OS Kernel and Resource Management (general, used by all)\r
+\r
+ErcOk EQU 0 ;Normal Status, No errors\r
+ErcEOF EQU 1 ;End of file\r
+ErcOpCancel EQU 4 ;Operator cancel\r
+ErcNullPtr EQU 6 ;Null ptr passed into call or service\r
+\r
+;10 - 19 Exchange Errors for Allocation and Use\r
+\r
+ErcOutOfRange EQU 10 ;Exchange number beyond allocated count\r
+ErcNotAlloc EQU 11 ;Bad exchange (not allocated)\r
+ErcNotOwner EQU 12 ;Attempt to deallocate an Exch that's not yours\r
+\r
+;20 - 29 Message Management\r
+\r
+ErcNoMsg EQU 20 ;Returned by Check primitive when no msg waiting\r
+\r
+;30 - 39 System Service Management\r
+\r
+ErcNoSuchSvc EQU 30 ;No service by that name\r
+ErcBadSvcCode EQU 32 ;Service doesn't handle that code\r
+ErcNotRqBlk EQU 34 ;Service received a NON RqBlock at it's exchange\r
+ErcOutOfSvcDesc EQU 36 ;No more empty Service Descriptors\r
+ErcOwnerAbort EQU 37 ;Service received SvcCode 0 on owner of this RqBlk\r
+\r
+;OS Resource Management Errors\r
+\r
+ErcNoMoreExch EQU 40 ;\r
+ErcNoMoreLBs EQU 41 ;Out of Link Blocks\r
+;ErcMsgMissing EQU 42\r
+ErcNoSvcBlks EQU 43 ;No more servcice can install\r
+ErcNoMoreTBs EQU 44 ;Out of timer blocks\r
+ErcNoMoreTSSs EQU 45 ;Out of TSSs\r
+ErcNoMoreRqBlks EQU 46 ;Out of Request Blocks\r
+ErcNoMoreJCBs EQU 47 ;Out of Job Control Blocks\r
+\r
+;OS Call Gate Management\r
+ErcBadGateNum EQU 48 ;tried to add an invalid GDT call gate\r
+ErcBadCallGate EQU 49 ;Called an UNinitialized Call Gate!!\r
+\r
+;OS Task Management\r
+\r
+ErcBadPriority EQU 50\r
+\r
+;OS Job Management\r
+\r
+ErcBadJobNum EQU 70 ;A Bad job number was specified in an OS call\r
+ErcInvalidJCB EQU 71 ;The Job number specifies an unassigned JCB\r
+ErcBadRunFile EQU 74 ;The run file you specified is NOT a run file!\r
+ErcNoExitJob EQU 76 ;No exit job was specified on ExitJob(n)\r
+ErcBadParams EQU 80 ;Invalid or bad params were passed to a command\r
+\r
+;Memory Management\r
+\r
+ErcNoGdtSlots EQU 100 ;No more free rgMemDesc GDT slots!\r
+ErcNoMem EQU 101 ;Not enough memory (no more pages!!!)\r
+ErcBadMemPage EQU 102 ;Bad physical page specified in Mem call\r
+ErcBadMemReq EQU 104 ;Invalid size for memory request\r
+ErcInternalMem EQU 106 ;An error has occurred that shouldn't, this indicates\r
+ ;an internal inconsistancy. AddPage can't!\r
+ErcNoRuns EQU 107 ;No free runs large enough in PTs (temporary)\r
+ErcBadLinAdd EQU 108 ;Bad linear address was passed to DeallocMem\r
+ErcShortMem EQU 109 ;Passed in too many pages to Dealloc, but\r
+ ;as many as possible were deallocated\r
+ErcBadAlias EQU 111 ;Address passed in WASN't an alias (it should be)\r
+\r
+;File System 200 - 299 See FSYS.C for complete description\r
+\r
+;Character Video Management 300 -399\r
+\r
+ErcVidNum EQU 300 ;Bad video number passed as param to vid call\r
+ErcVidparam EQU 301 ;A param was out of range to a Vid call\r
+ErcEditParam EQU 300 ;Bad param to EditLine\r
+ErcBadString EQU 302 ;Invalid sting passed to Math Cnvrt Func\r
+\r
+;OS hardware Resource Management\r
+\r
+ErcDMAChannel EQU 400 ;Invalid DMA channel specified as param\r
+ErcDMAMode EQU 401 ;Bad mode specified\r
+\r
+;500-599 Device Management (General)\r
+\r
+ErcBadDevNum EQU 500 ;DCB number too large ( > max DCBs)\r
+ErcDevInUse EQU 501 ;DCB already in use\r
+ErcBadDevName EQU 502 ;Size of device name incorrect\r
+ErcBadOpNum EQU 503 ;OpNum to DD that it doesn't handle!\r
+ErcNoDevice EQU 504 ;Driver's installed but NO device is\r
+ErcNoDriver EQU 505 ;No driver installed for that Device Num\r
+ErcDCBInUse EQU 506 ;Attempt to install driver over valid FDC\r
+\r
+;600-649 Floppy Device Driver (See FDD.c)\r
+\r
+;650-699 Hard Disk Device Driver (See HDD.c)\r
+\r
+;700-749 Keyboard Service\r
+\r
+ErcNoKeyAvail EQU 700\r
+\r
+;800-899 Async Comms Device Driver (COMx)\r
+\r
+;900-949 Parallel Comms Device Driver (LPTx)\r
+\r
+\r
+;----------------------------------------------------------------\r
+;OS Constants\r
+\r
+OSCodeSel EQU 0008h ;OS code is 0 based on this selector\r
+DataSel EQU 0010h ;All data is 0 based on this selector\r
+JobCodeSel EQU 0018h ;All User Code is 0 based on this selector\r
+\r
+NIL EQU 0 ;Duh...\r
+nTSS EQU 66 ;2 static and 64 dynamic\r
+nLB EQU 512 ;Number of link blocks\r
+nDynEXCH EQU 256 ;number of dynamic exchanges (fills one page)\r
+nPRI EQU 32 ;Task priorities (0 to 31)\r
+nSVC EQU 64 ;max services that can be installed\r
+nTmrBlks EQU 32 ;max outstanding timer blocks\r
+nCallGates EQU 694 ;Number of call gates (Max!)\r
+\r
+;6144 (6Kb) of GDT slots - 768 total\r
+\r
+nGDTSlots EQU (8 + nCallGates + nTSS)\r
+\r
+;=============================================================================\r
+;\r
+; The Link Blocks are small structures used to attach\r
+; messages to exchanges. They each form a piece\r
+; of a linked list. This is required because more\r
+; than one message may be waiting at an exchange.\r
+; Each link block is 16 bytes long\r
+;\r
+DATALB EQU 00h ;Used in LBType to indicate LB usage\r
+REQLB EQU 01h\r
+RESPLB EQU 02h\r
+REQLBA EQU 03h ;RqBlk with pointers already aliased\r
+\r
+sLINKBLOCK EQU 16\r
+DataLo EQU 0 ;DD 00000000h ; Data Low DWord or pRqBlk\r
+DataHi EQU 4 ;DD 00000000h ; Data High DWord\r
+NextLB EQU 8 ;DD 00000000h ; Pointer to next LB (Free, or in Link)\r
+LBType EQU 12 ;DB 00h ; SEND REQUEST\r
+;LBResvd ;DB 0,0,0 ; Pad to 16 bytes\r
+;\r
+;------------------------------------\r
+; The queue type is used to form an array of Queues\r
+; where tasks will be lined up to run. They\r
+; form the ReadyQ.\r
+; Each Queue Type is 8 bytes long\r
+;\r
+; NOTE: If this size sQUEUE changes you must change the enQueueRdy\r
+; code because it uses a shift instruction\r
+; (SHL 3) for speed instead of multiplying by the size.\r
+; It is unlikely that this size will change, but you never know.\r
+;\r
+sQUEUE EQU 8\r
+Head EQU 0 ;DD 00000000h ; head Queue Pointer\r
+Tail EQU 4 ;DD 00000000h ; tail Queue Pointer\r
+;\r
+;\r
+;------------------------------------\r
+; Each Exchange is 16 bytes long\r
+; NOTE: We use shift instructions for multiplying to calculate\r
+; a pointer to an exchange. The size of the Exch structure\r
+; should always be a power of 2. It's a speed issue...\r
+;\r
+sEXCH EQU 16\r
+EHead EQU 0 ;DD 00000000h ; Struct for the msg/Task queue\r
+ETail EQU 4 ;DD 00000000h ;\r
+fEMsg EQU 8 ;DD 00000000h ; True if this holds messages (vice task)\r
+Owner EQU 12 ;DD 00000000h ; pointer to JCB\r
+\r
+;\r
+;\r
+;-------------------------------------------------\r
+; The System Service Descriptor type is a structure\r
+; that keeps the names and exchanges of all active\r
+; system services (it forms an array of names).\r
+; This is used to locate the exchange where a service\r
+; is waiting for requests.\r
+; Each System Service Descriptor is 12 bytes long\r
+;\r
+sSVC EQU 12\r
+SvcName EQU 0 ;DD 00000000h ; System Service Name (8 bytes)\r
+ ;DD 00000000h\r
+SvcExch EQU 8 ;DD 00000000h ; System Service Exchange\r
+;\r
+;\r
+;Video stuff used in more than one module\r
+\r
+VGATextBase EQU 0B8000h ;Offset from OS DS to VGA Text screen 0\r
+\r
+;================= END of Module ==================\r