I$Create

From NitrOS-9
Jump to: navigation, search
Create File Creates and opens a disk file
OS9 I$Create 103F 83

Entry Conditions

A access mode (write or update)

B file attributes

X address of the pathlist

Exit Conditions

A path number

X address of the last byte of the pathlist + 1; skips any trailing blanks

Error Output

CC carry set on error

B error code, if any

Additional Information

  • NitrOS-9 parses the pathlist and enters the new filename in the specified directory. If you do not specify a directory, NitrOS-9 enters the new filename in the working directory.
  • NitrOS-9 gives the file the attributes passed in Register B, which has bits defined as follows:
Bit Definition
0 Read
1 Write
2 Execute
3 Public read
4 Public write
5 Public execute
6 Shareable file
  • These access mode parameters passed in Register A must have the write bit set if any data is to be written. These access codes are defined as follows: 2 = write, 3 = update. The mode affects the file only until the file is closed.
  • You can reopen the file in any access mode allowed by the file attributes. (See the Open system call.)
  • Files opened for write can allow faster data transfer than those opened for update because update sometimes needs to pre-read sectors.
  • If the execute bit (Bit 2) is set, the file is created in the working execution directory instead of the working data directory.
  • Create File causes an implicit I$Attach call. If the device has not previously been attached, the device’s initialization routine is called.
  • Later I/O calls use the path number to identify the file, until the file is closed.
  • NitrOS-9 does not allocate data storage for a file at creation. Instead, it allocates the storage either automatically when you first issue a write or explicitly by the SetStat subroutine.
  • If the filename already exists in the directory, an error occurs. If the call specifies a non-multiple file device (such as a printer or terminal), Create behaves the same as Open.
  • You cannot use Create to make directories. (See the Make Directory system call for instructions on how to make directories.)
  • Before the Create File call:
/ D 0 / W O R K $0D
 ?X                
  • After the Create File call:
/ D 0 / W O R K $0D
               ?X