<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>


FILE Search:

In File I/O Words in TurboForth Kernal

Word Name: FILE
Type: Immediate word
Data Stack Signature:
Return Stack Signature: --
Availability: V1.0  V1.1  V1.2
Description:

Builds a PAB (Peripheral Access Block) in a buffer previously declared with FBUF: according to the descriptor string supplied via the stack.

Example:

S" PIO.CR DV80O" PRINTER FILE

The above defines a file variable (previously declared with FBUF:) called PRINTER which references the PIO device. Subsequent file IO words that wish to send data to the PIO shall use the file variable name to reference it, e.g.:

PRINTER #OPEN DROP (open PIO and drop success/fail flag)
S" HELLO WORLD" PRINTER #PUT DROP (write HELLO WORLD to the PIO and drop success/fail flag)

Comment:

The string, which specifies the file name and file characteristics is defined as below. The file-name must come first followed by at least one space character. After that, the file characteristics can come in any order.

File Access Options
File Options File Type
F Fixed record type
V Variable record type
D Display data type
L Internal data type*
U Update file mode
O Output file mode
I Input file mode
A Append file mode
S Sequential file type
R Relative file type

*Note that Internal type files require L - this is because I is used to specify INPUT mode.

Internally, FILE variables build a PAB (peripheral address block) in CPU memory which will be used by #OPEN and all File IO words. Word 0 of the reserved memory is used to point to the actual PAB in VDP memory. The VDP location of the PAB is not determined until #OPEN is executed.

See Also: #CLOSE  #OPEN  FBUF: 

<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>