]> pd.if.org Git - mmurtl/blob - ossource/mosedf.inc
autocommit for file dated 2003-12-29 17:36:54
[mmurtl] / ossource / mosedf.inc
1 ;   MMURTL Operating System Source Code\r
2 ;   Copyright 1991,1992,1993,1994 Richard A. Burgess\r
3 ;   ALL RIGHTS RESERVED   Version 1,0\r
4 ;=============================================================================\r
5 ; General EQUates for the OS. Included in many modules.\r
6 ;=============================================================================\r
7 \r
8 TRUE                    EQU 1\r
9 FALSE                   EQU 0\r
10 \r
11 ; Error and Status Codes.  All MMURTL functions (with the exception\r
12 ; of a very few) return a Status or Error code. It is a 32 bit\r
13 ; value. Unlike some systems which may indicate any number\r
14 ; of errors or function status by returning a single value\r
15 ; such as -1, MMURTL tells you what happened exactly upon\r
16 ; return from each call.\r
17 ; You can assume (unless specified in the API for that call),\r
18 ; that ZERO (0) means everything went as expected.\r
19 ; The values assigned are broken into groups based on\r
20 ; functionality.  The numbers were selected arbitrarily as the\r
21 ; OS code was developed, so there is no real reasoning behind\r
22 ; the numbers themselves.\r
23 ; If you add services, or device drivers, please use numbers beyond\r
24 ; the range of these to indicate errors that would not\r
25 ; otherwise be standardized.  If a standardized error code\r
26 ; fits the description of an error you would return, then use it.\r
27 ;---------------------------\r
28 ;\r
29 ;1-199  OS Kernel and Resource Management (general, used by all)\r
30 \r
31 ErcOk                   EQU 0   ;Normal Status, No errors\r
32 ErcEOF          EQU 1   ;End of file\r
33 ErcOpCancel             EQU 4   ;Operator cancel\r
34 ErcNullPtr              EQU 6   ;Null ptr passed into call or service\r
35 \r
36 ;10 - 19 Exchange Errors for Allocation and Use\r
37 \r
38 ErcOutOfRange   EQU 10  ;Exchange number beyond allocated count\r
39 ErcNotAlloc             EQU 11  ;Bad exchange (not allocated)\r
40 ErcNotOwner             EQU 12  ;Attempt to deallocate an Exch that's not yours\r
41 \r
42 ;20 - 29 Message Management\r
43 \r
44 ErcNoMsg                EQU 20  ;Returned by Check primitive when no msg waiting\r
45 \r
46 ;30 - 39 System Service Management\r
47 \r
48 ErcNoSuchSvc    EQU 30  ;No service by that name\r
49 ErcBadSvcCode   EQU 32  ;Service doesn't handle that code\r
50 ErcNotRqBlk             EQU 34  ;Service received a NON RqBlock at it's exchange\r
51 ErcOutOfSvcDesc EQU 36  ;No more empty Service Descriptors\r
52 ErcOwnerAbort   EQU 37  ;Service received SvcCode 0 on owner of this RqBlk\r
53 \r
54 ;OS Resource Management Errors\r
55 \r
56 ErcNoMoreExch   EQU 40  ;\r
57 ErcNoMoreLBs    EQU 41  ;Out of Link Blocks\r
58 ;ErcMsgMissing  EQU 42\r
59 ErcNoSvcBlks    EQU 43  ;No more servcice can install\r
60 ErcNoMoreTBs    EQU 44  ;Out of timer blocks\r
61 ErcNoMoreTSSs   EQU 45  ;Out of TSSs\r
62 ErcNoMoreRqBlks EQU 46  ;Out of Request Blocks\r
63 ErcNoMoreJCBs   EQU 47  ;Out of Job Control Blocks\r
64 \r
65 ;OS Call Gate Management\r
66 ErcBadGateNum   EQU 48  ;tried to add an invalid GDT call gate\r
67 ErcBadCallGate  EQU 49  ;Called an UNinitialized Call Gate!!\r
68 \r
69 ;OS Task Management\r
70 \r
71 ErcBadPriority  EQU 50\r
72 \r
73 ;OS Job Management\r
74 \r
75 ErcBadJobNum    EQU 70  ;A Bad job number was specified in an OS call\r
76 ErcInvalidJCB   EQU 71  ;The Job number specifies an unassigned JCB\r
77 ErcBadRunFile   EQU 74  ;The run file you specified is NOT a run file!\r
78 ErcNoExitJob    EQU 76  ;No exit job was specified on ExitJob(n)\r
79 ErcBadParams    EQU 80  ;Invalid or bad params were passed to a command\r
80 \r
81 ;Memory Management\r
82 \r
83 ErcNoGdtSlots   EQU 100 ;No more free rgMemDesc GDT slots!\r
84 ErcNoMem                EQU 101 ;Not enough memory (no more pages!!!)\r
85 ErcBadMemPage   EQU 102 ;Bad physical page specified in Mem call\r
86 ErcBadMemReq    EQU 104 ;Invalid size for memory request\r
87 ErcInternalMem  EQU 106 ;An error has occurred that shouldn't, this indicates\r
88                                                 ;an internal inconsistancy. AddPage can't!\r
89 ErcNoRuns               EQU 107 ;No free runs large enough in PTs (temporary)\r
90 ErcBadLinAdd    EQU 108 ;Bad linear address was passed to DeallocMem\r
91 ErcShortMem     EQU 109 ;Passed in too many pages to Dealloc, but\r
92                         ;as many as possible were deallocated\r
93 ErcBadAlias     EQU 111 ;Address passed in WASN't an alias (it should be)\r
94 \r
95 ;File System    200 - 299  See FSYS.C for complete description\r
96 \r
97 ;Character Video Management 300 -399\r
98 \r
99 ErcVidNum               EQU 300 ;Bad video number passed as param to vid call\r
100 ErcVidparam             EQU 301 ;A param was out of range to a Vid call\r
101 ErcEditParam    EQU 300 ;Bad param to EditLine\r
102 ErcBadString    EQU 302 ;Invalid sting passed to Math Cnvrt Func\r
103 \r
104 ;OS hardware Resource Management\r
105 \r
106 ErcDMAChannel   EQU 400  ;Invalid DMA channel specified as param\r
107 ErcDMAMode              EQU 401  ;Bad mode specified\r
108 \r
109 ;500-599 Device Management (General)\r
110 \r
111 ErcBadDevNum    EQU 500         ;DCB number too large ( > max DCBs)\r
112 ErcDevInUse             EQU 501         ;DCB already in use\r
113 ErcBadDevName   EQU 502         ;Size of device name incorrect\r
114 ErcBadOpNum             EQU 503         ;OpNum to DD that it doesn't handle!\r
115 ErcNoDevice             EQU 504         ;Driver's installed but NO device is\r
116 ErcNoDriver             EQU 505         ;No driver installed for that Device Num\r
117 ErcDCBInUse             EQU 506         ;Attempt to install driver over valid FDC\r
118 \r
119 ;600-649 Floppy Device Driver (See FDD.c)\r
120 \r
121 ;650-699 Hard Disk Device Driver (See HDD.c)\r
122 \r
123 ;700-749 Keyboard Service\r
124 \r
125 ErcNoKeyAvail   EQU 700\r
126 \r
127 ;800-899 Async Comms Device Driver (COMx)\r
128 \r
129 ;900-949 Parallel Comms Device Driver (LPTx)\r
130 \r
131 \r
132 ;----------------------------------------------------------------\r
133 ;OS Constants\r
134 \r
135 OSCodeSel               EQU 0008h       ;OS code is 0 based on this selector\r
136 DataSel                 EQU 0010h       ;All data is 0 based on this selector\r
137 JobCodeSel              EQU 0018h       ;All User Code is 0 based on this selector\r
138 \r
139 NIL                             EQU 0           ;Duh...\r
140 nTSS                    EQU 66          ;2 static and 64 dynamic\r
141 nLB                             EQU 512         ;Number of link blocks\r
142 nDynEXCH                EQU 256         ;number of dynamic exchanges (fills one page)\r
143 nPRI                    EQU 32          ;Task priorities (0 to 31)\r
144 nSVC                    EQU 64          ;max services that can be installed\r
145 nTmrBlks                EQU 32          ;max outstanding timer blocks\r
146 nCallGates              EQU 694         ;Number of call gates (Max!)\r
147 \r
148 ;6144 (6Kb) of GDT slots - 768 total\r
149 \r
150 nGDTSlots               EQU (8 + nCallGates + nTSS)\r
151 \r
152 ;=============================================================================\r
153 ;\r
154 ; The Link Blocks are small structures used to attach\r
155 ; messages to exchanges.  They each form a piece\r
156 ; of a linked list. This is required because more\r
157 ; than one message may be waiting at an exchange.\r
158 ; Each link block is 16 bytes long\r
159 ;\r
160 DATALB          EQU 00h                         ;Used in LBType to indicate LB usage\r
161 REQLB           EQU 01h\r
162 RESPLB          EQU 02h\r
163 REQLBA          EQU 03h                         ;RqBlk with pointers already aliased\r
164 \r
165 sLINKBLOCK      EQU 16\r
166 DataLo          EQU 0   ;DD 00000000h           ; Data Low DWord   or  pRqBlk\r
167 DataHi          EQU 4   ;DD 00000000h           ; Data High DWord\r
168 NextLB          EQU 8   ;DD 00000000h           ; Pointer to next LB (Free, or in Link)\r
169 LBType          EQU 12  ;DB 00h                         ; SEND                 REQUEST\r
170 ;LBResvd                ;DB 0,0,0                       ; Pad to 16 bytes\r
171 ;\r
172 ;------------------------------------\r
173 ; The queue type is used to form an array of Queues\r
174 ; where tasks will be lined up to run.  They\r
175 ; form the ReadyQ.\r
176 ; Each Queue Type is 8 bytes long\r
177 ;\r
178 ; NOTE: If this size sQUEUE changes you must change the enQueueRdy\r
179 ;               code because it uses a shift instruction\r
180 ;               (SHL 3) for speed instead of multiplying by the size.\r
181 ;               It is unlikely that this size will change, but you never know.\r
182 ;\r
183 sQUEUE          EQU 8\r
184 Head            EQU 0   ;DD 00000000h           ; head Queue Pointer\r
185 Tail            EQU 4   ;DD 00000000h           ; tail Queue Pointer\r
186 ;\r
187 ;\r
188 ;------------------------------------\r
189 ; Each Exchange is 16 bytes long\r
190 ; NOTE: We use shift instructions for multiplying to calculate\r
191 ; a pointer to an exchange. The size of the Exch structure\r
192 ; should always be a power of 2. It's a speed issue...\r
193 ;\r
194 sEXCH           EQU 16\r
195 EHead           EQU 0   ;DD 00000000h           ; Struct for the msg/Task queue\r
196 ETail           EQU 4   ;DD 00000000h           ;\r
197 fEMsg           EQU 8   ;DD 00000000h           ; True if this holds messages (vice task)\r
198 Owner           EQU 12  ;DD 00000000h           ; pointer to JCB\r
199 \r
200 ;\r
201 ;\r
202 ;-------------------------------------------------\r
203 ; The System Service Descriptor type is a structure\r
204 ; that keeps the names and exchanges of all active\r
205 ; system services (it forms an array of names).\r
206 ; This is used to locate the exchange where a service\r
207 ; is waiting for requests.\r
208 ; Each System Service Descriptor is 12 bytes long\r
209 ;\r
210 sSVC            EQU 12\r
211 SvcName         EQU 0   ;DD 00000000h           ; System Service Name (8 bytes)\r
212                                         ;DD 00000000h\r
213 SvcExch         EQU 8   ;DD 00000000h           ; System Service Exchange\r
214 ;\r
215 ;\r
216 ;Video stuff used in more than one module\r
217 \r
218 VGATextBase EQU 0B8000h ;Offset from OS DS to VGA Text screen 0\r
219 \r
220 ;================= END of Module ==================\r