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