home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / SOURCE / STARTUP / MSDOS.IN_ / MSDOS.IN
Encoding:
Text File  |  1993-02-08  |  7.5 KB  |  274 lines

  1. ;***
  2. ;msdos.inc - MS-DOS definitions for C runtime
  3. ;
  4. ;    Copyright (c) 1987-1992, Microsoft Corporation.  All rights reserved.
  5. ;
  6. ;Purpose:
  7. ;    This file contains the MS-DOS definitions (DOS function request
  8. ;    numbers, flags, etc) used by the C runtime.
  9. ;
  10. ;*******************************************************************************
  11.  
  12.  
  13. ;_NFILE equ    20        ; maximum # files per process
  14.  
  15. ifdef    OS2
  16. STACKSLOP equ    512        ; stack slop for OS/2 system call overhead
  17. else
  18. STACKSLOP equ    256        ; stack slop for DOS interrupt overhead
  19. endif
  20.  
  21. ;    __osfile flag values for DOS file handles
  22.  
  23. FOPEN    equ    01H        ; file handle open
  24. FEOFLAG equ    02H        ; end of file has been encountered
  25. FCRLF    equ    04H        ; CR-LF across read buffer (in text mode)
  26. FPIPE    equ    08H        ; file handle refers to a pipe
  27. FRDONLY equ    10H        ; file handle associated with read only file
  28. FAPPEND equ    20H        ; file handle opened O_APPEND
  29. FDEV    equ    40H        ; file handle refers to device
  30. FTEXT    equ    80H        ; file handle is in text mode
  31.  
  32. ;
  33. ; callos - issue a DOS system call
  34. ;
  35. ; interface:  callos [func]
  36. ;
  37. ; where [func] is an optional DOS function number that,
  38. ; if present, is loaded into AH before the system call.
  39. ;
  40. ifdef _WINDOWS
  41. ; Issue the appropriate call (either a DOS3CALL or an
  42. ; int21h call).  This is to get around a Win 3.0 real
  43. ; mode bug in the DOS3CALL handler.
  44. endif
  45. ;
  46. ifdef _BAT16
  47. ; Call __bat_call_os, which either calls the appropriate 
  48. ; BAT16 bookkeeping function or executes what is in the
  49. ; regular macro.
  50. ;
  51. endif
  52.  
  53.  
  54. ifdef _BAT16
  55.  
  56. callos    MACRO    func
  57.  
  58. extrn    __bat_call_os:near
  59.  
  60. ifnb    <func>
  61.     mov    ah,DOS_&func
  62. endif
  63.  
  64.     call    __bat_call_os
  65.     ENDM
  66.  
  67. else    ; !_BAT16
  68.  
  69. ifdef _WINDOWS
  70.  
  71. callos    MACRO    func
  72. local    _real,_endcall
  73.  
  74. extrn    DOS3CALL:far
  75.  
  76. ifndef _STARTUPBLD
  77. extrn    __wflags:word
  78. endif
  79.  
  80. ifnb    <func>
  81.     mov    ah,DOS_&func
  82. endif
  83.  
  84.     test    [__wflags],WF_PMODE    ; protect mode ??
  85.     jz    _real
  86.     call    DOS3CALL        ; protect mode call
  87.     jmp    short _endcall
  88. _real:    int    DOS            ; real mode call
  89. _endcall:
  90.  
  91.     ENDM
  92.  
  93. else    ;!_WINDOWS
  94.  
  95. callos    MACRO    func
  96.  
  97. ifnb    <func>
  98.     mov    ah,DOS_&func
  99. endif
  100.     int    DOS
  101.  
  102.     ENDM
  103.  
  104. endif    ;_WINDOWS
  105.  
  106. endif    ; _BAT16
  107.  
  108.  
  109. ;
  110. ; DOS System Definitions
  111. ;
  112.  
  113. DOS    equ    21H        ; MS-DOS interrupt
  114.  
  115. DOS_exit equ    00000H        ; exit offset        (PSP:0000)
  116. DOS_maxpara equ 00002H        ; maximum paragraph    (PSP:0002)
  117. DOS_envp equ    0002cH        ; environment address    (PSP:002c)
  118. DOS_cmdline equ 00080H        ; command line offset    (PSP:0080)
  119.  
  120. DOS_kill    equ    00H        ; terminate
  121. DOS_echoread    equ    01H        ; read keyboard and echo
  122. DOS_display    equ    02H        ; display character
  123. DOS_auxinput    equ    03H        ; auxiliary input
  124. DOS_auxoutput    equ    04H        ; auxiliary output
  125. DOS_print    equ    05H        ; print character
  126. DOS_conio    equ    06H        ; direct console i/o
  127. DOS_coninput    equ    07H        ; direct console input
  128. DOS_readkbd    equ    08H        ; read keyboard
  129. DOS_message    equ    09H        ; display string
  130. DOS_bufkbdin    equ    0aH        ; buffered keyboard input
  131. DOS_kbdstatus    equ    0bH        ; check keyboard status
  132. DOS_flshread    equ    0cH        ; flush buffer and read keyboard
  133. DOS_diskreset    equ    0dH        ; disk reset
  134. DOS_selectdisk    equ    0eH        ; select default disk
  135. DOS_fcbopen    equ    0fH        ; open file with fcb
  136. DOS_fcbclose    equ    10H        ; close file with fcb
  137. DOS_fcbfirst    equ    11H        ; search for first entry with fcb
  138. DOS_fcbnext    equ    12H        ; search for next entry with fcb
  139. DOS_fcbdelete    equ    13H        ; delete file with fcb
  140. DOS_fcbsread    equ    14H        ; sequential read with fcb
  141. DOS_fcbswrite    equ    15H        ; sequential write with fcb
  142. DOS_fcbcreate    equ    16H        ; create file with fcb
  143. DOS_fcbrename    equ    17H        ; rename file with fcb
  144. DOS_currentd    equ    19H        ; current default disk
  145. DOS_setDMA    equ    1aH        ; set DMA
  146. DOS_fcbrread    equ    21H        ; random read with fcb
  147. DOS_fcbrwrite    equ    22H        ; random write with fcb
  148. DOS_fcbsize    equ    23H        ; file size with fcb
  149. DOS_fcbsetrec    equ    24H        ; set relative record with fcb
  150. DOS_setvector    equ    25H        ; set interrupt vector
  151. DOS_fcbbread    equ    27H        ; random block read with fcb
  152. DOS_fcbbwrite    equ    28H        ; random block write with fcb
  153. DOS_fcbparse    equ    29H        ; parse file name with fcb
  154. DOS_getdate    equ    2aH        ; get date
  155. DOS_setdate    equ    2bH        ; set date
  156. DOS_gettime    equ    2cH        ; get time
  157. DOS_settime    equ    2dH        ; set time
  158. DOS_verify    equ    2eH        ; set/reset verify flag
  159. DOS_getDMA    equ    2fH        ; get DMA
  160. DOS_version    equ    30H        ; get version number
  161. DOS_keep    equ    31H        ; keep process
  162. DOS_cntlc    equ    33H        ; Cntl-C check
  163. DOS_getvector    equ    35H        ; get interrupt vector
  164. DOS_getdskspc    equ    36H        ; get disk free space
  165. DOS_country    equ    38H        ; get country dependent info
  166. DOS_mkdir    equ    39H        ; make subdirectory
  167. DOS_rmdir    equ    3aH        ; remove subdirectory
  168. DOS_chdir    equ    3bH        ; change subdirectory
  169. DOS_create    equ    3cH        ; create pathname
  170. DOS_open    equ    3dH        ; open pathname
  171. DOS_close    equ    3eH        ; close file handle
  172. DOS_read    equ    3fH        ; read from file handle
  173. DOS_write    equ    40H        ; write from file handle
  174. DOS_delete    equ    41H        ; delete pathname
  175. DOS_lseek    equ    42H        ; move file pointer
  176. DOS_filemode    equ    43H        ; get/set attributes of pathname
  177. DOS_ioctl    equ    44H        ; ioctl for devices
  178. DOS_dup     equ    45H        ; duplicate file handle
  179. DOS_forcedup    equ    46H        ; force duplicate file handle
  180. DOS_curdir    equ    47H        ; get current directory
  181. DOS_allocmem    equ    48H        ; allocate memory block
  182. DOS_freemem    equ    49H        ; free memory block
  183. DOS_setmem    equ    4aH        ; set size of memory block
  184. DOS_exec    equ    4bH        ; load and execute program
  185. DOS_terminate    equ    4cH        ; terminate process with errorcode
  186. DOS_wait    equ    4dH        ; get child process return code
  187. DOS_findfirst    equ    4eH        ; find first file match
  188. DOS_findnext    equ    4fH        ; find next file match
  189. DOS_getverify    equ    54H        ; return current verify flag
  190. DOS_rename    equ    56H        ; rename pathname
  191. DOS_filedate    equ    57H        ; get/set file handle date/time
  192. DOS_createnew    equ    5BH        ; create new file
  193. DOS_locking    equ    5CH        ; file record locking/unlocking
  194. DOS_commit    equ    68H        ; commit file
  195. DOS_sleep    equ    89H        ; delay process execution
  196.  
  197. ;
  198. ;    DOS error codes
  199. ;
  200.  
  201. doserr    MACRO    num,name,text
  202. name    equ    num
  203.     ENDM
  204.  
  205. doserr    1,    E_ifunc,    <invalid function code>
  206. doserr    2,    E_nofile,    <file not found>
  207. doserr    3,    E_nopath,    <path not found>
  208. doserr    4,    E_toomany,    <too many open files>
  209. doserr    5,    E_access,    <access denied>
  210. doserr    6,    E_ihandle,    <invalid handle>
  211. doserr    7,    E_arena,    <arena trashed>
  212. doserr    8,    E_nomem,    <not enough memory>
  213. doserr    9,    E_iblock,    <invalid block>
  214. doserr    10,    E_badenv,    <bad environment>
  215. doserr    11,    E_badfmt,    <bad format>
  216. doserr    12,    E_iaccess,    <invalid access code>
  217. doserr    13,    E_idata,    <invalid data>
  218. doserr    14,    E_unknown,    <??? unknown error ???>
  219. doserr    15,    E_idrive,    <invalid drive>
  220. doserr    16,    E_curdir,    <current directory>
  221. doserr    17,    E_difdev,    <not same device>
  222. doserr    18,    E_nomore,    <no more files>
  223. doserr    19,    E_maxerr2,    <unknown error - Version 2.0>
  224.  
  225. ; the following errors can occur only in DOS 3.0
  226.  
  227. doserr    32,    E_sharerr,    <sharing violation>
  228. doserr    33,    E_lockerr,    <locking violation>
  229. doserr    34,    E_maxerr3,    <unknown error - Version 3.0>
  230.  
  231. doserr    80,    E_exist,    <file already exists>
  232.  
  233.  
  234. ;    DOS file attributes
  235.  
  236. A_ro    equ    01H        ; read-only file
  237. A_h    equ    02H        ; hidden
  238. A_s    equ    04H        ; system
  239. A_v    equ    08H        ; volume ID
  240. A_d    equ    10H        ; directory
  241. A_a    equ    20H        ; archive
  242.  
  243. A_mod    equ    A_ro+A_h+A_s+A_a ; modifiable attributes
  244.  
  245. ;    OS/2 file creation bits
  246.  
  247. F_CREATFLAG equ 10h
  248. F_OPENFLAG  equ 01h
  249. F_TRUNCFLAG equ 02H
  250.  
  251. ;    OS/2 device mask
  252.  
  253. IS_DEV    equ 1
  254. IS_PIPE equ 2
  255.  
  256. ;    Windows flag bits
  257.  
  258. WF_PMODE    equ    0001H
  259. WF_CPU286    equ    0002H
  260. WF_CPU386    equ    0004H
  261. WF_CPU486    equ    0008H
  262. WF_STANDARD    equ    0010H
  263. WF_WIN286    equ    0010H
  264. WF_ENHANCED    equ    0020H
  265. WF_WIN386    equ    0020H
  266. WF_CPU086    equ    0040H
  267. WF_CPU186    equ    0080H
  268. WF_LARGEFRAME    equ    0100H
  269. WF_SMALLFRAME    equ    0200H
  270. WF_80x87    equ    0400H
  271.  
  272. ;    end of msdos.inc
  273. ;-----------------------------------------------------------------------
  274.