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

wirehaze git hosting

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