]> wirehaze git hosting - MS-DOS.git/blob - v2.0/source/DOSSYM.ASM

wirehaze git hosting

rewrote Readme in proper German.
[MS-DOS.git] / v2.0 / source / DOSSYM.ASM
1 include DOSMAC.ASM
2 IF2
3 %OUT DOSSYM in Pass 2
4 ENDIF
5
6 IFNDEF ALTVECT
7 ALTVECT EQU 0 ;FALSE
8 ENDIF
9
10 BREAK <Control character definitions>
11
12 c_DEL EQU 7Fh ; ASCII rubout or delete previous char
13 c_BS EQU 08h ; ^H ASCII backspace
14 c_CR EQU 0Dh ; ^M ASCII carriage return
15 c_LF EQU 0Ah ; ^J ASCII linefeed
16 c_ETB EQU 17h ; ^W ASCII end of transmission
17 c_NAK EQU 15h ; ^U ASCII negative acknowledge
18 c_ETX EQU 03h ; ^C ASCII end of text
19 c_HT EQU 09h ; ^I ASCII tab
20
21 BREAK <BPB Definition>
22
23
24 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
25 ; ;
26 ; C A V E A T P R O G R A M M E R ;
27 ; ;
28 ; Certain structures, constants and system calls below are private to ;
29 ; the DOS and are extremely version-dependent. They may change at any ;
30 ; time at the implementors' whim. As a result, they must not be ;
31 ; documented to the general public. If an extreme case arises, they ;
32 ; must be documented with this warning. ;
33 ; ;
34 ; Those structures and constants that are subject to the above will be ;
35 ; marked and bracketed with the flag: ;
36 ; ;
37 ; C A V E A T P R O G R A M M E R ;
38 ; ;
39 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
40
41 BREAK <Bios Parameter Block>
42 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
43 ; C A V E A T P R O G R A M M E R ;
44 ; ;
45
46 ; Bios Parameter Block definition
47 ; This structure is used to build a full DPB
48
49 BPBLOCK STRUC
50 BPSECSZ DW ? ; Size in bytes of physical sector
51 BPCLUS DB ? ; Sectors/Alloc unit
52 BPRES DW ? ; Number of reserved sectors
53 BPFTCNT DB ? ; Number of FATs
54 BPDRCNT DW ? ; Number of directory entries
55 BPSCCNT DW ? ; Total number of sectors
56 BPMEDIA DB ? ; Media descriptor byte
57 BPFTSEC DW ? ; Number of sectors taken up by one FAT
58 BPBLOCK ENDS
59 ; ;
60 ; C A V E A T P R O G R A M M E R ;
61 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
62
63 BREAK <Disk I/O Buffer Header>
64 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
65 ; C A V E A T P R O G R A M M E R ;
66 ; ;
67
68 ; Field definition for I/O buffer information
69
70 BUFFINFO STRUC
71 NEXTBUF DD ? ; Pointer to next buffer in list
72 ; The next two items are often refed as a word
73 BUFDRV DB ? ; Logical drive # assoc with buffer FF = free
74 BUFDIRTY DB ? ; Dirty flag
75 BUFPRI DB ? ; Buffer selection priority (see EQUs below)
76 VISIT DB ? ; Visit flag for buffer pool scans
77 BUFSECNO DW ? ; Sector number of buffer
78 ; The next two items are often refed as a word
79 BUFWRTCNT DB ? ; For FAT sectors, # times sector written out
80 BUFWRTINC DB ? ; " " " , # sectors between each write
81 BUFDRVDP DD ? ; Pointer to drive parameters
82 BUFFINFO ENDS
83
84 BUFINSIZ EQU SIZE BUFFINFO
85 ; Size of structure in bytes
86
87 FREEPRI EQU 0
88 LBRPRI EQU 2 ; Last byte of buffer read
89 LBWPRI EQU 4 ; Last byte written
90 RPRI EQU 6 ; Read but not last byte
91 WPRI EQU 8 ; Written but not last byte
92 DIRPRI EQU 15 ; Directory Sector
93 FATPRI EQU 30 ; FAT sector
94 ; ;
95 ; C A V E A T P R O G R A M M E R ;
96 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
97
98 BREAK <User stack inside of system call>
99 ; Location of user registers relative user stack pointer
100
101 user_environ STRUC
102 user_AX DW ?
103 user_BX DW ?
104 user_CX DW ?
105 user_DX DW ?
106 user_SI DW ?
107 user_DI DW ?
108 user_BP DW ?
109 user_DS DW ?
110 user_ES DW ?
111 user_IP DW ?
112 user_CS DW ?
113 user_F DW ?
114 user_environ ENDS
115
116 BREAK <interrupt definitions>
117
118 INTTAB EQU 20H
119 INTBASE EQU 4 * inttab
120 ENTRYPOINT EQU INTBASE+40H
121
122 IF ALTVECT
123 ALTTAB EQU 0F0H
124 ALTBASE EQU 4 * ALTTAB
125 ENDIF
126
127 ;
128 ; interrupt assignments
129 ;
130 IF NOT ALTVECT
131 int_abort EQU INTTAB ; abort process
132 int_command EQU int_abort+1 ; call MSDOS
133 int_terminate EQU int_abort+2 ; int to terminate address
134 int_ctrl_c EQU int_abort+3 ; ^c trapper
135 int_fatal_abort EQU int_abort+4 ; hard disk error
136 int_disk_read EQU int_abort+5 ; logical sector disk read
137 int_disk_write EQU int_abort+6 ; logical sector disk write
138 int_keep_process EQU int_abort+7 ; terminate program and stay resident
139 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
140 ; C A V E A T P R O G R A M M E R ;
141 ; ;
142 int_spooler EQU int_abort+8 ; spooler call
143 int_fastcon EQU int_abort+9 ; fast CON interrupt
144 ; ;
145 ; C A V E A T P R O G R A M M E R ;
146 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
147 ELSE
148 int_abort EQU INTTAB ; abort process
149 int_command EQU int_abort+1 ; call MSDOS
150 int_terminate EQU ALTTAB ; int to terminate address
151 int_ctrl_c EQU int_terminate+1 ; ^c trapper
152 int_fatal_abort EQU int_terminate+2 ; hard disk error
153 int_disk_read EQU int_abort+5 ; logical sector disk read
154 int_disk_write EQU int_abort+6 ; logical sector disk write
155 int_keep_process EQU int_abort+7 ; terminate program and stay resident
156 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
157 ; C A V E A T P R O G R A M M E R ;
158 ; ;
159 int_spooler EQU int_terminate+3 ; spooler call
160 int_fastcon EQU int_abort+9 ; fast CON interrupt
161 ; ;
162 ; C A V E A T P R O G R A M M E R ;
163 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
164 ENDIF
165
166 addr_int_abort EQU 4 * int_abort
167 addr_int_command EQU 4 * int_command
168 addr_int_terminate EQU 4 * int_terminate
169 addr_int_ctrl_c EQU 4 * int_ctrl_c
170 addr_int_fatal_abort EQU 4 * int_fatal_abort
171 addr_int_disk_read EQU 4 * int_disk_read
172 addr_int_disk_write EQU 4 * int_disk_write
173 addr_int_keep_process EQU 4 * int_keep_process
174 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
175 ; C A V E A T P R O G R A M M E R ;
176 ; ;
177 addr_int_spooler EQU 4 * int_spooler
178 addr_int_fastcon EQU 4 * int_fastcon
179 ; ;
180 ; C A V E A T P R O G R A M M E R ;
181 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
182
183 BREAK <Disk map>
184 ; MSDOS partitions the disk into 4 sections:
185 ;
186 ; phys sector 0: +-------------------+
187 ; | | boot/reserved |
188 ; | +-------------------+
189 ; | | File allocation |
190 ; v | table(s) |
191 ; | (multiple copies |
192 ; | are kept) |
193 ; +-------------------+
194 ; | Directory |
195 ; +-------------------+
196 ; | File space |
197 ; +-------------------+
198 ; | Unaddressable |
199 ; | (to end of disk) |
200 ; +-------------------+
201 ;
202 ; All partition boundaries are sector boundaries. The size of the FAT is
203 ; adjusted to maximize the file space addressable.
204
205 BREAK <Directory entry>
206
207 ;
208 ; +---------------------------+
209 ; | (12 BYTE) filename/ext | 0 0
210 ; +---------------------------+
211 ; | (BYTE) attributes | 11 B
212 ; +---------------------------+
213 ; | (10 BYTE) reserved | 12 C
214 ; +---------------------------+
215 ; | (WORD) time of last write | 22 16
216 ; +---------------------------+
217 ; | (WORD) date of last write | 24 18
218 ; +---------------------------+
219 ; | (WORD) First cluster | 26 1A
220 ; +---------------------------+
221 ; | (DWORD) file size | 28 1C
222 ; +---------------------------+
223 ;
224 ; First byte of filename = E5 -> free directory entry
225 ; = 00 -> end of allocated directory
226 ; Time: Bits 0-4=seconds/2, bits 5-10=minute, 11-15=hour
227 ; Date: Bits 0-4=day, bits 5-8=month, bits 9-15=year-1980
228 ;
229 dir_entry STRUC
230 dir_name DB 11 DUP (?) ; file name
231 dir_attr DB ? ; attribute bits
232 dir_pad DB 10 DUP (?) ; reserved for expansion
233 dir_time DW ? ; time of last write
234 dir_date DW ? ; date of last write
235 dir_first DW ? ; first allocation unit of file
236 dir_size_l DW ? ; low 16 bits of file size
237 dir_size_h DW ? ; high 16 bits of file size
238 dir_entry ENDS
239
240 attr_read_only EQU 1h
241 attr_hidden EQU 2h
242 attr_system EQU 4h
243 attr_volume_id EQU 8h
244 attr_directory EQU 10h
245 attr_archive EQU 20h
246
247 attr_all EQU attr_hidden+attr_system+attr_directory
248 ; OR of hard attributes for FINDENTRY
249
250 attr_ignore EQU attr_read_only+attr_archive
251 ; ignore this(ese) attribute(s)
252 ; during search first/next
253
254 attr_changeable EQU attr_read_only+attr_hidden+attr_system+attr_archive
255 ; changeable via CHMOD
256
257 BREAK <File allocation Table information>
258 ;
259 ; The File Allocation Table uses a 12-bit entry for each allocation unit on the
260 ; disk. These entries are packed, two for every three bytes. The contents of
261 ; entry number N is found by 1) multiplying N by 1.5; 2) adding the result to
262 ; the base address of the Allocation Table; 3) fetching the 16-bit word at this
263 ; address; 4) If N was odd (so that N*1.5 was not an integer), shift the word
264 ; right four bits; 5) mask to 12 bits (AND with 0FFF hex). Entry number zero
265 ; is used as an end-of-file trap in the OS and is passed to the BIOS to help
266 ; determine disk format. Entry 1 is reserved for future use. The first
267 ; available allocation unit is assigned entry number two, and even though it is
268 ; the first, is called cluster 2. Entries greater than 0FF8H are end of file
269 ; marks; entries of zero are unallocated. Otherwise, the contents of a FAT
270 ; entry is the number of the next cluster in the file.
271 ;
272 ; Clusters with bad sectors are tagged with FF7H. Any non-zero number would do
273 ; because these clusters show as allocated, but are not part of any allocation
274 ; chain and thus will never be allocated to a file. A particular number is
275 ; selected so that disk checking programs know what to do (ie. a cluster with
276 ; entry FF7H which is not in a chain is not an error).
277
278 BREAK <DPB structure>
279 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
280 ; C A V E A T P R O G R A M M E R ;
281 ; ;
282
283 DIRSTRLEN EQU 64 ; Max length in bytes of directory strings
284
285 dpb STRUC
286 dpb_drive DB ? ; Logical drive # assoc with DPB (A=0,B=1,...)
287 dpb_UNIT DB ? ; Driver unit number of DPB
288 dpb_sector_size DW ? ; Size of physical sector in bytes
289 dpb_cluster_mask DB ? ; Sectors/cluster - 1
290 dpb_cluster_shift DB ? ; Log2 of sectors/cluster
291 dpb_first_FAT DW ? ; Starting record of FATs
292 dpb_FAT_count DB ? ; Number of FATs for this drive
293 dpb_root_entries DW ? ; Number of directory entries
294 dpb_first_sector DW ? ; First sector of first cluster
295 dpb_max_cluster DW ? ; Number of clusters on drive + 1
296 dpb_FAT_size DB ? ; Number of records occupied by FAT
297 dpb_dir_sector DW ? ; Starting record of directory
298 dpb_driver_addr DD ? ; Pointer to driver
299 dpb_media DB ? ; Media byte
300 dpb_first_access DB ? ; This is initialized to -1 to force a media
301 ; check the first time this DPB is used
302 dpb_next_dpb DD ? ; Pointer to next Drive parameter block
303 dpb_current_dir DW ? ; Cluster number of start of current directory
304 ; 0 indicates root, -1 indicates invalid
305 ; (disk ? changed)
306 dpb_dir_text DB DIRSTRLEN DUP(?)
307 ; ASCIZ string of current directory
308 dpb ENDS
309
310 DPBSIZ EQU SIZE dpb ; Size of the structure in bytes
311
312 DSKSIZ = dpb_max_cluster ; Size of disk (temp used during init only)
313 ; ;
314 ; C A V E A T P R O G R A M M E R ;
315 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
316
317 BREAK <File Control Block definition>
318 ;
319 ; Field definition for FCBs
320 ; The FCB has the following structure:
321 ;
322 ; +---------------------------+
323 ; | Drive indicator(byte) |
324 ; +---------------------------+
325 ; | Filename (8 chars) |
326 ; +---------------------------+
327 ; | Extension (3 chars) |
328 ; +---------------------------+
329 ; | Current Extent(word) |
330 ; +---------------------------+
331 ; | Record size (word) |
332 ; +---------------------------+
333 ; | File Size (2 words) |
334 ; +---------------------------+
335 ; | Date of write |
336 ; +---------------------------+
337 ; | Time of write |
338 ; +---------------------------+
339 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
340 ; C A V E A T P R O G R A M M E R ;
341 ; ;
342 ; | Flags: |
343 ; | bit 7=0 file/1 device |
344 ; | bit 6=0 if dirty |
345 ; | bits 0-5 deviceid |
346 ; +---------------------------+
347 ; | first cluster in file |
348 ; +---------------------------+
349 ; | position of last cluster |
350 ; +---------------------------+
351 ; | last cluster accessed | 12 bit-+--- packed in 3 bytes
352 ; +---------------------------+ |
353 ; | parent directory | <------+
354 ; +---------------------------+
355 ; ;
356 ; C A V E A T P R O G R A M M E R ;
357 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
358 ; | next record number |
359 ; +---------------------------+
360 ; | random record number |
361 ; +---------------------------+
362 ;
363
364 sys_fcb STRUC
365 fcb_drive DB ?
366 fcb_name DB 8 DUP (?)
367 fcb_ext DB 3 DUP (?)
368 fcb_EXTENT DW ?
369 fcb_RECSIZ DW ? ; Size of record (user settable)
370 fcb_FILSIZ DW ? ; Size of file in bytes; used with the following
371 ; word
372 fcb_DRVBP DW ? ; BP for SEARCH FIRST and SEARCH NEXT
373 fcb_FDATE DW ? ; Date of last writing
374 fcb_FTIME DW ? ; Time of last writing
375 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
376 ; C A V E A T P R O G R A M M E R ;
377 ; ;
378 fcb_DEVID DB ? ; Device ID number, bits 0-5 if file.
379 ; bit 7=0 for file, bit 7=1 for I/O device
380 ; If file, bit 6=0 if dirty
381 ; If I/O device, bit 6=0 if EOF (input)
382 ; Bit 5=1 if Raw mode
383 ; Bit 0=1 if console input device
384 ; Bit 1=1 if console output device
385 ; Bit 2=1 if null device
386 ; Bit 3=1 if clock device
387 fcb_FIRCLUS DW ? ; First cluster of file
388 fcb_CLUSPOS DW ? ; Position of last cluster accessed
389 fcb_LSTCLUS DW ? ; Last cluster accessed and directory
390 DB ? ; pack 2 12 bit numbers into 24 bits...
391 ; ;
392 ; C A V E A T P R O G R A M M E R ;
393 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
394 fcb_NR DB ? ; Next record
395 fcb_RR DB 4 DUP (?) ; Random record
396 sys_fcb ENDS
397
398 FILDIRENT = fcb_FILSIZ ; Used only by SEARCH FIRST and
399 ; SEARCH NEXT
400
401 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
402 ; C A V E A T P R O G R A M M E R ;
403 ; ;
404 devid_file_clean EQU 40h ; true if file and not written
405 devid_file_mask_drive EQU 3Fh ; mask for drive number
406
407 devid_device EQU 80h ; true if a device
408 devid_device_EOF EQU 40h ; true if end of file reached
409 devid_device_raw EQU 20h ; true if in raw mode
410 devid_device_special EQU 10h ; true if special device
411 devid_device_clock EQU 08h ; true if clock device
412 devid_device_null EQU 04h ; true if null device
413 devid_device_con_out EQU 02h ; true if console output
414 devid_device_con_in EQU 01h ; true if consle input
415
416 ;
417 ; structure of devid field as returned by IOCTL is:
418 ;
419 ; BIT 7 6 5 4 3 2 1 0
420 ; |---|---|---|---|---|---|---|---|
421 ; | I | E | R | S | I | I | I | I |
422 ; | S | O | A | P | S | S | S | S |
423 ; | D | F | W | E | C | N | C | C |
424 ; | E | | | C | L | U | O | I |
425 ; | V | | | L | K | L | T | N |
426 ; |---|---|---|---|---|---|---|---|
427 ; ISDEV = 1 if this channel is a device
428 ; = 0 if this channel is a disk file
429 ;
430 ; If ISDEV = 1
431 ;
432 ; EOF = 0 if End Of File on input
433 ; RAW = 1 if this device is in Raw mode
434 ; = 0 if this device is cooked
435 ; ISCLK = 1 if this device is the clock device
436 ; ISNUL = 1 if this device is the null device
437 ; ISCOT = 1 if this device is the console output
438 ; ISCIN = 1 if this device is the console input
439 ;
440 ; If ISDEV = 0
441 ; EOF = 0 if channel has been written
442 ; Bits 0-5 are the block device number for
443 ; the channel (0 = A, 1 = B, ...)
444 ;
445 devid_ISDEV EQU 80h
446 devid_EOF EQU 40h
447 devid_RAW EQU 20h
448 devid_SPECIAL EQU 10H
449 devid_ISCLK EQU 08h
450 devid_ISNUL EQU 04h
451 devid_ISCOT EQU 02h
452 devid_ISCIN EQU 01h
453
454 devid_block_dev EQU 1Fh ; mask for block device number
455
456 ;
457 ; find first/next buffer
458 ;
459 find_buf STRUC
460 find_buf_sattr DB ? ; attribute of search
461 find_buf_drive DB ? ; drive of search
462 find_buf_name DB 11 DUP (?) ; formatted name
463 find_buf_LastEnt DW ? ; LastEnt
464 find_buf_ThisDPB DD ? ; This DPB
465 find_buf_DirStart DW ? ; DirStart
466 ; ;
467 ; C A V E A T P R O G R A M M E R ;
468 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
469
470 find_buf_attr DB ? ; attribute found
471 find_buf_time DW ? ; time
472 find_buf_date DW ? ; date
473 find_buf_size_l DW ? ; low(size)
474 find_buf_size_h DW ? ; high(size)
475 find_buf_pname DB 13 DUP (?) ; packed name
476 find_buf ENDS
477
478 BREAK <Process data block>
479 ;
480 ; Process data block (otherwise known as program header)
481 ;
482
483 FilPerProc EQU 20
484
485 Process_data_block STRUC
486 PDB_Exit_Call DW ? ; INT int_abort system terminate
487 PDB_block_len DW ? ; size of execution block
488 DB ?
489 PDB_CPM_Call DB 5 DUP (?) ; ancient call to system
490 PDB_Exit DD ? ; pointer to exit routine
491 PDB_Ctrl_C DD ? ; pointer to ^C routine
492 PDB_Fatal_abort DD ? ; pointer to fatal error
493 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
494 ; C A V E A T P R O G R A M M E R ;
495 ; ;
496 PDB_Parent_PID DW ? ; PID of parent (terminate PID)
497 PDB_JFN_Table DB FilPerProc DUP (?)
498 ; indices into system table
499 ; ;
500 ; C A V E A T P R O G R A M M E R ;
501 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
502 PDB_environ DW ? ; seg addr of environment
503 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
504 ; C A V E A T P R O G R A M M E R ;
505 ; ;
506 PDB_User_stack DD ? ; stack of self during system calls
507 PDB_PAD1 DB 1Eh DUP (?)
508 ; ;
509 ; C A V E A T P R O G R A M M E R ;
510 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
511 PDB_Call_system DB 5 DUP (?) ; portable method of system call
512 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
513 ; C A V E A T P R O G R A M M E R ;
514 ; ;
515 PDB_PAD2 DB 6h DUP (?) ;
516 ; ;
517 ; C A V E A T P R O G R A M M E R ;
518 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
519 Process_data_block ENDS
520
521 BREAK <EXEC and EXE file structures>
522 ;
523 ; EXEC arg block - load/go program
524 ;
525
526 ;
527 ; The following get used as arguments to the EXEC system call. They indicate
528 ; whether or not the program is executed or whether or not a program header
529 ; gets created.
530 ;
531 exec_func_no_execute EQU 1 ; no execute bit
532 exec_func_overlay EQU 2 ; overlay bit
533
534 Exec0 STRUC
535 Exec0_environ DW ? ; seg addr of environment
536 Exec0_com_line DD ? ; pointer to asciz command line
537 Exec0_5C_FCB DD ? ; default fcb at 5C
538 Exec0_6C_FCB DD ? ; default fcb at 6C
539 Exec0 ENDS
540
541 Exec1 STRUC
542 Exec1_environ DW ? ; seg addr of environment
543 Exec1_com_line DD ? ; pointer to asciz command line
544 Exec1_5C_FCB DD ? ; default fcb at 5C
545 Exec1_6C_FCB DD ? ; default fcb at 6C
546 Exec1_SP DW ? ; stack pointer of program
547 Exec1_SS DW ? ; stack seg register of program
548 Exec1_IP DW ? ; entry point IP
549 Exec1_CS DW ? ; entry point CS
550 Exec1 ENDS
551
552 Exec3 STRUC
553 Exec3_load_addr DW ? ; seg address of load point
554 Exec3_reloc_fac DW ? ; relocation factor
555 Exec3 ENDS
556
557 ;
558 ; Exit codes in upper byte
559 ;
560 Exit_terminate EQU 0
561 Exit_abort EQU 0
562 Exit_Ctrl_C EQU 1
563 Exit_Hard_Error EQU 2
564 Exit_Keep_process EQU 3
565
566 ;
567 ; EXE file header
568 ;
569
570 EXE_file STRUC
571 exe_signature DW ? ; must contain 4D5A (yay zibo!)
572 exe_len_mod_512 DW ? ; low 9 bits of length
573 exe_pages DW ? ; number of 512b pages in file
574 exe_rle_count DW ? ; count of reloc entries
575 exe_par_dir DW ? ; number of paragraphs before image
576 exe_min_BSS DW ? ; minimum number of para of BSS
577 exe_max_BSS DW ? ; max number of para of BSS
578 exe_SS DW ? ; stack of image
579 exe_SP DW ? ; SP of image
580 exe_chksum DW ? ; checksum of file (ignored)
581 exe_IP DW ? ; IP of entry
582 exe_CS DW ? ; CS of entry
583 exe_rle_table DW ? ; byte offset of reloc table
584 exe_iov DW ? ; overlay number (0 for root)
585 exe_sym_tab DD ? ; offset of symbol table in file
586 EXE_file ENDS
587
588 exe_valid_signature EQU 5A4Dh
589 exe_valid_old_signature EQU 4D5Ah
590
591 symbol_entry STRUC
592 sym_value DD ?
593 sym_type DW ?
594 sym_len DB ?
595 sym_name DB 255 dup (?)
596 symbol_entry ENDS
597
598 BREAK <Internal system file table format>
599 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
600 ; C A V E A T P R O G R A M M E R ;
601 ; ;
602 ;
603 ; system file table
604 ;
605
606 sft STRUC
607 sft_link DD ?
608 sft_count DW ? ; number of entries
609 sft_table DW ? ; beginning of array of the following
610 sft ENDS
611
612 ;
613 ; system file table entry
614 ;
615
616 sf_entry STRUC
617 sf_ref_count DB ? ; number of processes sharing fcb
618 sf_mode DB ? ; mode of access
619 sf_attr DB ? ; attribute of file
620 sf_fcb DB (SIZE sys_fcb) DUP (?)
621 ; actual FCB
622 sf_entry ENDS
623
624 sf_default_number EQU 5h
625 ; ;
626 ; C A V E A T P R O G R A M M E R ;
627 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
628
629 BREAK <Memory arena structure>
630 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
631 ; C A V E A T P R O G R A M M E R ;
632 ; ;
633 ;
634 ; arena item
635 ;
636 arena STRUC
637 arena_signature DB ? ; 4D for valid item, 5A for last item
638 arena_owner DW ? ; owner of arena item
639 arena_size DW ? ; size in paragraphs of item
640 arena ENDS
641
642 arena_owner_system EQU 0 ; free block indication
643
644 arena_signature_normal EQU 4Dh ; valid signature, not end of arena
645 arena_signature_end EQU 5Ah ; valid signature, last block in arena
646 ; ;
647 ; C A V E A T P R O G R A M M E R ;
648 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
649
650 BREAK <Machine instruction definitions>
651
652 mi_INT EQU 0CDh
653 mi_Long_JMP EQU 0EAh
654 mi_Long_CALL EQU 09Ah
655 mi_Long_RET EQU 0CBh
656
657 BREAK <Standard I/O assignments>
658
659 stdin EQU 0
660 stdout EQU 1
661 stderr EQU 2
662 stdaux EQU 3
663 stdprn EQU 4
664
665 BREAK <Xenix subfunction assignments>
666
667 open_for_read EQU 0
668 open_for_write EQU 1
669 open_for_both EQU 2
670
671 BREAK <Xenix error codes>
672
673 ;
674 ; XENIX calls all return error codes through AX. If an error occurred then the
675 ; carry bit will be set and the error code is in AX. If no error occurred then
676 ; the carry bit is reset and AX contains returned info.
677 ;
678
679 no_error_occurred EQU 0 ?
680
681 error_invalid_function EQU 1
682 error_file_not_found EQU 2
683 error_path_not_found EQU 3
684 error_too_many_open_files EQU 4
685 error_access_denied EQU 5
686 error_invalid_handle EQU 6
687 error_arena_trashed EQU 7
688 error_not_enough_memory EQU 8
689 error_invalid_block EQU 9
690 error_bad_environment EQU 10
691 error_bad_format EQU 11
692 error_invalid_access EQU 12
693 error_invalid_data EQU 13
694 ;**** unused EQU 14
695 error_invalid_drive EQU 15
696 error_current_directory EQU 16
697 error_not_same_device EQU 17
698 error_no_more_files EQU 18
699
700 alloc_not_enough_memory EQU error_not_enough_memory
701 alloc_arena_trashed EQU error_arena_trashed
702
703 close_invalid_handle EQU error_invalid_handle
704 close_invalid_function EQU error_invalid_function
705
706 chdir_path_not_found EQU error_path_not_found
707
708 chmod_path_not_found EQU error_path_not_found
709 chmod_access_denied EQU error_access_denied
710 chmod_invalid_function EQU error_invalid_function
711
712 creat_access_denied EQU error_access_denied
713 creat_path_not_found EQU error_path_not_found
714 creat_too_many_open_files EQU error_too_many_open_files
715
716 curdir_invalid_drive EQU error_invalid_drive
717
718 dealloc_invalid_block EQU error_invalid_block
719 dealloc_arena_trashed EQU error_arena_trashed
720
721 dup_invalid_handle EQU error_invalid_handle
722 dup_too_many_open_files EQU error_too_many_open_files
723
724 dup2_invalid_handle EQU error_invalid_handle
725
726 exec_invalid_function EQU error_invalid_function
727 exec_bad_environment EQU error_bad_environment
728 exec_bad_format EQU error_bad_format
729 exec_not_enough_memory EQU error_not_enough_memory
730 exec_file_not_found EQU error_file_not_found
731
732 filetimes_invalid_function EQU error_invalid_function
733 filetimes_invalid_handle EQU error_invalid_handle
734
735 findfirst_file_not_found EQU error_file_not_found
736 findfirst_no_more_files EQU error_no_more_files
737 findnext_no_more_files EQU error_no_more_files
738
739 international_invalid_function EQU error_invalid_function
740
741 ioctl_invalid_handle EQU error_invalid_handle
742 ioctl_invalid_function EQU error_invalid_function
743 ioctl_invalid_data EQU error_invalid_data
744
745 lseek_invalid_handle EQU error_invalid_handle
746 lseek_invalid_function EQU error_invalid_function
747
748 mkdir_path_not_found EQU error_path_not_found
749 mkdir_access_denied EQU error_access_denied
750
751 open_invalid_access EQU error_invalid_access
752 open_file_not_found EQU error_file_not_found
753 open_access_denied EQU error_access_denied
754 open_too_many_open_files EQU error_too_many_open_files
755
756 read_invalid_handle EQU error_invalid_handle
757 read_access_denied EQU error_access_denied
758
759 rename_file_not_found EQU error_file_not_found
760 rename_not_same_device EQU error_not_same_device
761 rename_access_denied EQU error_access_denied
762
763 rmdir_path_not_found EQU error_path_not_found
764 rmdir_access_denied EQU error_access_denied
765 rmdir_current_directory EQU error_current_directory
766
767 setblock_invalid_block EQU error_invalid_block
768 setblock_arena_trashed EQU error_arena_trashed
769 setblock_not_enough_memory EQU error_not_enough_memory
770 setblock_invalid_function EQU error_invalid_function
771
772 unlink_file_not_found EQU error_file_not_found
773 unlink_access_denied EQU error_access_denied
774
775 write_invalid_handle EQU error_invalid_handle
776 write_access_denied EQU error_access_denied
777
778 BREAK <system call definitions>
779
780 ABORT EQU 0 ; 0 0
781 STD_CON_INPUT EQU 1 ; 1 1
782 STD_CON_OUTPUT EQU 2 ; 2 2
783 STD_AUX_INPUT EQU 3 ; 3 3
784 STD_AUX_OUTPUT EQU 4 ; 4 4
785 STD_PRINTER_OUTPUT EQU 5 ; 5 5
786 RAW_CON_IO EQU 6 ; 6 6
787 RAW_CON_INPUT EQU 7 ; 7 7
788 STD_CON_INPUT_NO_ECHO EQU 8 ; 8 8
789 STD_CON_STRING_OUTPUT EQU 9 ; 9 9
790 STD_CON_STRING_INPUT EQU 10 ; 10 A
791 STD_CON_INPUT_STATUS EQU 11 ; 11 B
792 STD_CON_INPUT_FLUSH EQU 12 ; 12 C
793 DISK_RESET EQU 13 ; 13 D
794 SET_DEFAULT_DRIVE EQU 14 ; 14 E
795 FCB_OPEN EQU 15 ; 15 F
796 FCB_CLOSE EQU 16 ; 16 10
797 DIR_SEARCH_FIRST EQU 17 ; 17 11
798 DIR_SEARCH_NEXT EQU 18 ; 18 12
799 FCB_DELETE EQU 19 ; 19 13
800 FCB_SEQ_READ EQU 20 ; 20 14
801 FCB_SEQ_WRITE EQU 21 ; 21 15
802 FCB_CREATE EQU 22 ; 22 16
803 FCB_RENAME EQU 23 ; 23 17
804 GET_DEFAULT_DRIVE EQU 25 ; 25 19
805 SET_DMA EQU 26 ; 26 1A
806 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
807 ; C A V E A T P R O G R A M M E R ;
808 ; ;
809 GET_DEFAULT_DPB EQU 31 ; 31 1F
810 ; ;
811 ; C A V E A T P R O G R A M M E R ;
812 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
813 FCB_RANDOM_READ EQU 33 ; 33 21
814 FCB_RANDOM_WRITE EQU 34 ; 34 22
815 GET_FCB_FILE_LENGTH EQU 35 ; 35 23
816 GET_FCB_POSITION EQU 36 ; 36 24
817 SET_INTERRUPT_VECTOR EQU 37 ; 37 25
818 CREATE_PROCESS_DATA_BLOCK EQU 38 ; 38 26
819 FCB_RANDOM_READ_BLOCK EQU 39 ; 39 27
820 FCB_RANDOM_WRITE_BLOCK EQU 40 ; 40 28
821 PARSE_FILE_DESCRIPTOR EQU 41 ; 41 29
822 GET_DATE EQU 42 ; 42 2A
823 SET_DATE EQU 43 ; 43 2B
824 GET_TIME EQU 44 ; 44 2C
825 SET_TIME EQU 45 ; 45 2D
826 SET_VERIFY_ON_WRITE EQU 46 ; 46 2E
827 ; Extended functionality group
828 GET_DMA EQU 47 ; 47 2F
829 GET_VERSION EQU 48 ; 48 30
830 KEEP_PROCESS EQU 49 ; 49 31
831 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
832 ; C A V E A T P R O G R A M M E R ;
833 ; ;
834 GET_DPB EQU 50 ; 50 32
835 ; ;
836 ; C A V E A T P R O G R A M M E R ;
837 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
838 SET_CTRL_C_TRAPPING EQU 51 ; 51 33
839 GET_INDOS_FLAG EQU 52 ; 52 34
840 GET_INTERRUPT_VECTOR EQU 53 ; 53 35
841 GET_DRIVE_FREESPACE EQU 54 ; 54 36
842 CHAR_OPER EQU 55 ; 55 37
843 INTERNATIONAL EQU 56 ; 56 38
844 ; XENIX CALLS
845 ; Directory Group
846 MKDIR EQU 57 ; 57 39
847 RMDIR EQU 58 ; 58 3A
848 CHDIR EQU 59 ; 59 3B
849 ; File Group
850 CREAT EQU 60 ; 60 3C
851 OPEN EQU 61 ; 61 3D
852 CLOSE EQU 62 ; 62 3E
853 READ EQU 63 ; 63 3F
854 WRITE EQU 64 ; 64 40
855 UNLINK EQU 65 ; 65 41
856 LSEEK EQU 66 ; 66 42
857 CHMOD EQU 67 ; 67 43
858 IOCTL EQU 68 ; 68 44
859 XDUP EQU 69 ; 69 45
860 XDUP2 EQU 70 ; 70 46
861 CURRENT_DIR EQU 71 ; 71 47
862 ; Memory Group
863 ALLOC EQU 72 ; 72 48
864 DEALLOC EQU 73 ; 73 49
865 SETBLOCK EQU 74 ; 74 4A
866 ; Process Group
867 EXEC EQU 75 ; 75 4B
868 EXIT EQU 76 ; 76 4C
869 WAIT EQU 77 ; 77 4D
870 FIND_FIRST EQU 78 ; 78 4E
871 ; Special Group
872 FIND_NEXT EQU 79 ; 79 4F
873 ; SPECIAL SYSTEM GROUP
874 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
875 ; C A V E A T P R O G R A M M E R ;
876 ; ;
877 SET_CURRENT_PDB EQU 80 ; 80 50
878 GET_CURRENT_PDB EQU 81 ; 81 51
879 GET_IN_VARS EQU 82 ; 82 52
880 SETDPB EQU 83 ; 83 53
881 ; ;
882 ; C A V E A T P R O G R A M M E R ;
883 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
884 GET_VERIFY_ON_WRITE EQU 84 ; 84 54
885 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
886 ; C A V E A T P R O G R A M M E R ;
887 ; ;
888 DUP_PDB EQU 85 ; 85 55
889 ; ;
890 ; C A V E A T P R O G R A M M E R ;
891 ;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
892 RENAME EQU 86 ; 86 56
893 FILE_TIMES EQU 87 ; 87 57
894
895 SET_OEM_HANDLER EQU 248 ; 248 F8
896 OEM_C1 EQU 249 ; 249 F9
897 OEM_C2 EQU 250 ; 250 FA
898 OEM_C3 EQU 251 ; 251 FB
899 OEM_C4 EQU 252 ; 252 FC
900 OEM_C5 EQU 253 ; 253 FD
901 OEM_C6 EQU 254 ; 254 FE
902 OEM_C7 EQU 255 ; 255 FF
903 SUBTTL
904