INT 21,6C - Extended Open/Create (DOS 4.x+)
AH = 6C
AL = 00
BX = open mode (see below)
CX = file attribute (see FILE ATTRIBUTES, bits 15-8 are zero)
DX = function control indicator (see below)
DS:SI = ASCIIZ filespec
returns:
AX = handle if CF clear
= error code if CF set (see DOS ERROR CODES)
CX = 01 file opened
= 02 file created and opened
= 03 file truncated and opened (replaced)
CF = 0 if successful
= 1 if error
Open Mode in BX:
|F|E|D|C|B|A|9|8|7|6|5|4|3|2|1|0| BX (Open Mode)
| | | | | | | | | | | | | `-------- read/write access mode
| | | | | | | | | | | | `-------- reserve (must be 0)
| | | | | | | | | `------------ sharing mode
| | | | | | | | `------------ 1 = private, 0 = inheritable
| | | `-------------------- reserved
| | `-------------------- 0 = call INT 24, 1 = ignore INT 24
| `-------------------- 0 = normal write, 1 = flush each write
`-------------------- reserved
Read/Write Access bits: Sharing Mode bits:
210 654
000 read access 000 compatibility mode
001 write access 001 read/write access
010 read/write access 010 write access denied
011 read access denied
100 full access
Function Control Indicator in DX:
|F|E|D|C|B|A|9|8|7|6|5|4|3|2|1|0| DX (Function Control)
| | | | | | | | | | | | `---------- file existence behavior
| | | | | | | | `----------------- creation behavior
`-------------------------------- reserved
File Existence Behavior bits:
3210
0000 if file exist, generate error, take no action
0001 if file exists, open file
0010 if file exists, truncate and open
Creation Behavior bits:
7654
0000 if file does not exist, generate error, take no action
0001 if file does not exist, create