" ( -- )
Extend the semantics of " to be:
Interpretation: ( "ccc<quote>" -- CDATA -> CHARACTER UNSIGNED )
Parse ccc delimited by " (double-quote).
Store the resulting string at address STR. and return
STR as CDATA -> CHARACTER. Store the length
of the resulting string at #STR and return it as
UNSIGNED. An ambiguous condition exists if the length of
the string exceeds 80 characters.
Note: Subsequent uses of " will overwrite the buffer.
Compilation: ( "ccc<quote>" -- )
Parse ccc delimited by " (double-quote).
Append the runtime semantics given below to the current definition.
Runtime: ( -- CCONST -> CHARACTER UNSIGNED )
Return CCONST -> CHARACTER as the address and
UNSIGNED as the character count of a character string
consisting of the characters ccc that were parsed during
compilation. A program shall not alter the returned string.
#FIB ( -- DATA -> UNSIGNED )
DATA -> UNSIGNED is the address of a cell containing the number of characters in the file input buffer.
#STR ( -- DATA -> UNSIGNED )
DATA -> UNSIGNED is the address of a cell containing the number of characters in the string buffer.
Note: The string buffer is used by " in interpretation state, and by >STR.
(ALLOCATE) ( UNSIGNED -- FAR-ADDRESS 1ST SIGNED )
Allocate UNSIGNED paragraphs of contiguous memory space. The initial content of the allocated space is undefined. If the allocation succeeds, FAR-ADDRESS is the aligned starting address of the allocated space, 1ST is the number of paragraphs allocated, and SIGNED is zero. If the operation fails, FAR-ADDRESS does not represent a valid address, 1ST is the number of paragraphs allocated, and SIGNED is the DOS error code.
(ALLOCATE) corresponds to DOS interrupt 21 (hex), function 48 (hex).
(ALLOCATION-STRATEGY) ( UNSIGNED UNSIGNED -- 1ST SIGNED )
If the second UNSIGNED is equal to 0, 1ST indicates the currently selected memory allocation strategy. If the second UNSIGNED is equal to 1, select the memory allocation strategy indicated by the first UNSIGNED, and return it as 1ST. SIGNED is non-zero if either UNSIGNED has an undefined value.
Second UNSIGNED and 1ST | Memory Allocation Strategy |
---|---|
0 | Reserve the first fitting block, starting from low addresses. |
1 | Reserve the best fitting block. |
2 | Reserve the first fitting block, starting from high addresses. |
(ALLOCATION-STRATEGY) corresponds to DOS interrupt 21 (hex), function 58 (hex).
(ATTRIBUTES) ( CDATA -> CHARACTER LOGICAL UNSIGNED -- 3RD SIGNED )
If UNSIGNED is 0, return the attributes of the file identified by the null-terminated character string CDATA -> CHARACTER. If the operation succeeds, SIGNED is zero and 3RD indicates the file attributes as specified in the below table. Otherwise SIGNED is the DOS error code and 3RD is undefined. LOGICAL is ignored.
If UNSIGNED is 1, set the attributes of the file identified by the null-terminated character string CDATA -> CHARACTER to the value of LOGICAL according to the below table. If the operation succeeds, SIGNED is zero and 3RD indicates the new file attributes. Otherwise SIGNED is the DOS error code and 3RD is undefined.
If UNSIGNED is neither 0 nor 1, SIGNED is non-zero and 3RD is undefined.
Bits 15 to 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | Attribute |
---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | Unlimited access |
0 | x | x | x | x | x | 1 | Read only file |
0 | x | x | x | x | 1 | x | Hidden file |
0 | x | x | x | 1 | x | x | System file |
0 | 0 | 0 | 1 | 0 | 0 | 0 | Volume ID |
0 | x | 1 | x | x | x | x | Subdirectory |
0 | 1 | x | x | x | x | x | File has not been archived |
x means don't care.
(ATTRIBUTES) corresponds to DOS interrupt 21 (hex), function 43 (hex).
(CHANGE-DIR) ( CDATA -> CHARACTER -- SIGNED )
Change the current directory to the absolute or relative path identified by the null-terminated character string CDATA -> CHARACTER. SIGNED is non-zero if and only if the specified path is invalid.
(CHANGE-DIR) corresponds to DOS interrupt 21 (hex), function 3B (hex).
(CLOSE) ( FILE -- SIGNED )
Close the file identified by FILE. SIGNED is the DOS error code.
(CLOSE) corresponds to DOS interrupt 21 (hex), function 3E (hex).
(CONTROL-I/O) ( SINGLE UNSIGNED SINGLE UNSIGNED -- UNSIGNED LOGICAL SIGNED )
Queries or sets DOS channel information depending on the value of the second parameter UNSIGNED. The other input and output parameters have various meanings as specified in the below table. If the operation succeeds, SIGNED is zero. Otherwise, SIGNED is the DOS error code and the other two output parameters are undefined.
Input Parameters | Output Parameters | |||||
---|---|---|---|---|---|---|
SINGLE | UNSIGNED | SINGLE | UNSIGNED | UNSIGNED | LOGICAL | SIGNED |
device handle | (unused) | (unused) | 0 = get device data | (undefined) | channel info | error code |
device handle | (unused) | device data | 1 = set device data | (undefined) | device data | error code |
device handle | buffer size | buffer address | 2 = receive from character device | byte count | (undefined) | error code |
device handle | buffer size | buffer address | 3 = send to character device | byte count | (undefined) | error code |
drive number | buffer size | buffer address | 4 = receive from block device | byte count | (undefined) | error code |
drive number | buffer size | buffer address | 5 = send to block device | byte count | (undefined) | error code |
device handle | (unused) | (unused) | 6 = check input status | 0 iff not ready | (undefined) | error code |
device handle | (unused) | (unused | 7 = check output status | 0 iff not ready | (undefined) | error code |
drive number | (unused) | (unused) | 8 = check if changable | 0 iff changable | (undefined) | error code |
drive number | (unused) | (unused) | 9 = check if device redirected | (undefined) | channel info | error code |
device handle | (unused) | (unused) | 10 = check if handle redirected | (undefined) | channel info | error code |
(unused) | retry delay | number of retries | 11 = set number of retries | (undefined) | (undefined) | error code |
device handle | subfunction | parameter address | 12 = I/O control for character devices | (undefined) | (undefined) | error code |
drive number | subfunction | parameter address | 13 = I/O control for block devices | (undefined) | (undefined) | error code |
drive number | (unused) | (unused) | 14 = get logical drive map | drive number | (undefined) | error code |
drive number | (unused) | (unused) | 15 = set logical drive map | drive number | (undefined) | error code |
(CONTROL-I/O) corresponds to DOS interrupt 21 (hex), function 44 (hex).
(COUNTRY-DEPENDENT-INFORMATION) ( CDATA UNSIGNED -- 2ND SIGNED )
For the country code UNSIGNED, copy the country-dependent information to the 32 bytes long buffer starting at address CDATA. If CDATA is equal to FFFF (hex), make UNSIGNED as the current country code. 2ND is the current country code. SIGNED is non-zero if and only if UNSIGNED is an unknown country code.
Buffer Offset | Contents |
---|---|
0 | Date and time format: 0 = hh:mm:ss mm/dd/yyyy 1 = hh:mm:ss dd/mm/yyyy 2 = hh:mm:ss yyyy/mm/dd. |
2 | Null-terminated currency string |
7 | Null-terminated thousand separator |
9 | Null-terminated decimal separator |
11 | Null-terminated date separator |
13 | Null-terminated time separator |
15 | Bit 0: Currency string succeeds the value Bit 1: Currency string preceded by one space Bit 2: Currency string replaces decimal separator |
16 | Number of decimal places for currency |
17 | Time format (0 = 12 hours, 1 = 24 hours) |
18 | Address of a subroutine that converts country-specific umlauts from lower case to upper case |
22 | Null-terminated list separator |
24 | Reserved |
(COUNTRY-DEPENDENT-INFORMATION) corresponds to DOS interrupt 21 (hex), function 38 (hex).
(CREATE) ( CDATA -> CHARACTER LOGICAL -- FILE SIGNED )
Create the file named in the null-terminated character string CDATA -> CHARACTER, and open it for read/write file access. If a file with the same name already exists, recreate it as an empty file. If the file was successfully created and opened, SIGNED is zero, FILE is its identifier, and the file has been positioned to the start of the file. Otherwise, SIGNED is the DOS error code and FILE is undefined.
The bits of LOGICAL determine the file attributes as specified in the below table. The operation fails if an undefined bit combination is specified as LOGICAL.
Bits 15 to 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | Attribute |
---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | Unlimited access |
0 | x | x | x | x | x | 1 | Read only file |
0 | x | x | x | x | 1 | x | Hidden file |
0 | x | x | x | 1 | x | x | System file |
0 | 0 | 0 | 1 | 0 | 0 | 0 | Volume ID |
0 | x | 1 | x | x | x | x | Subdirectory |
0 | 1 | x | x | x | x | x | File has not been archived |
x means don't care.
(CREATE) corresponds to DOS interrupt 21 (hex), function 3C (hex).
(CREATE-DIR) ( CDATA -> CHARACTER -- SIGNED )
Create a new subdirectory with the absolute or relative path identified by the null-terminated character string CDATA -> CHARACTER. SIGNED is the DOS error code.
(CREATE-DIR) corresponds to DOS interrupt 21 (hex), function 39 (hex).
(CREATE-NEW) ( CDATA -> CHARACTER LOGICAL -- FILE SIGNED )
Create the file named in the null-terminated character string CDATA -> CHARACTER, and open it for read/write file access. If a file with the same name already exists, the operation fails. If the file was successfully created and opened, SIGNED is zero, FILE is its identifier, and the file has been positioned to the start of the file. Otherwise, SIGNED is the DOS error code and FILE is undefined.
The bits of LOGICAL determine the file attributes as specified in the below table. The operation fails if an undefined bit combination is specified as LOGICAL.
Bit 15 to 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | Attribute |
---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | Unlimited access |
0 | x | x | x | x | x | 1 | Read only file |
0 | x | x | x | x | 1 | x | Hidden file |
0 | x | x | x | 1 | x | x | System file |
0 | 0 | 0 | 1 | 0 | 0 | 0 | Volume ID |
0 | x | 1 | x | x | x | x | Subdirectory |
0 | 1 | x | x | x | x | x | File has not been archived |
x means "don't care".
(CREATE-NEW) corresponds to DOS interrupt 21 (hex), function 5B (hex).
(CREATE-TEMPORARY) ( CDATA -> CHARACTER LOGICAL -- FILE SIGNED )
Create a temporary file with a system-generated name in the directory whose path is named in the null-terminated character string CDATA -> CHARACTER, and open it for read/write file access. If the file was successfully created and opened, SIGNED is zero, FILE is its identifier, and the file has been positioned to the start of the file. Otherwise, SIGNED is the DOS error code and FILE is undefined.
The bits of LOGICAL determine the file attributes as specified in the below table. The operation fails if an undefined bit combination is specified as LOGICAL.
Bit 15 to 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | Attribute |
---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | Unlimited access |
0 | x | x | x | x | x | 1 | Read only file |
0 | x | x | x | x | 1 | x | Hidden file |
0 | x | x | x | 1 | x | x | System file |
0 | 0 | 0 | 1 | 0 | 0 | 0 | Volume ID |
0 | x | 1 | x | x | x | x | Subdirectory |
0 | 1 | x | x | x | x | x | File has not been archived |
x means "don't care".
(CREATE-TEMPORARY) corresponds to DOS interrupt 21 (hex), function 5A (hex).
(CTRL-C-CHECK) ( SINGLE UNSIGNED -- FLAG FLAG )
If UNSIGNED is equal to 0, query the system's reaction to the entry of control-C. If UNSIGNED is equal to 1 and SIGNED is zero, turn control-C interrupts off. If UNSIGNED is equal to 1, and SIGNED is non-zero, turn control-C interrupts on. The first FLAG is FALSE if control-C interrupts are turned off, and TRUE if control-C interrupts are turned on. The second FLAG is TRUE if and only if UNSIGNED is either 0 or 1.
(CTRL-C-CHECK) corresponds to DOS interrupt 21 (hex), function 33 (hex).
(CURRENT-DIR) ( CDATA -> CHARACTER UNSIGNED -- SIGNED )
For the drive indicated by UNSIGNED, copy the absolute path of the current directory to the buffer starting at CDATA -> CHARACTER. The buffer shall be at least 64 characters long. SIGNED is non-zero if and only if UNSIGNED does not indicate a valid drive.
UNSIGNED | Drive |
---|---|
0 | Current drive |
1 | A: |
2 | B: |
3 | C: |
... | ... |
(CURRENT-DIR) corresponds to DOS interrupt 21 (hex), function 47 (hex).
(DEALLOCATE) ( FAR-ADDRESS -- SIGNED )
Return the contiguous region of memory space indicated by FAR-ADDRESS to the system for later allocation. FAR-ADDRESS shall indicate a region of memory space that was previously obtained by (ALLOCATE) or (REALLOCATE). If the operation succeeds, SIGNED is zero. If the operation fails, SIGNED is the DOS error code.
(DEALLOCATE) corresponds to DOS interrupt 21 (hex), function 49 (hex).
(DELETE) ( CDATA -> CHARACTER -- SIGNED )
Delete the file named in the null-terminated character string CDATA -> CHARACTER. SIGNED is the DOS error code.
(DELETE) corresponds to DOS interrupt 21 (hex), function 41 (hex).
(DUPLICATE) ( FILE -- 1ST SIGNED )
Create a second access channel to the file FILE. 1ST is the second access channel. The file itself and all its attributes, like the value returned by POSITION, remain unique. SIGNED is the DOS error code.
(DUPLICATE) corresponds to DOS interrupt 21 (hex), function 45 (hex).
(FLUSH) ( FILE -- SIGNED )
Attempt to force any buffered information written to the file referred to by FILE to be written to mass storage, and the size information for the file to be recorded in the storage directory if changed. SIGNED is the DOS error code.
(FLUSH) corresponds to DOS interrupt 21 (hex), function 68 (hex).
(FORCED-DUPLICATE) ( FILE FILE -- SIGNED )
Create a second access channel to the file FILE. The second FILE is the predefined second access channel. The file itself and all its attributes, like the value returned by POSITION, remain unique. If the second access channel already exists, the channel previously associated with it is being closed. SIGNED is the DOS error code.
(FORCED-DUPLICATE) corresponds to DOS interrupt 21 (hex), function 46 (hex).
(GET-DISK-FREE-SPACE) ( UNSIGNED -- UNSIGNED UNSIGNED UNSIGNED UNSIGNED )
Returns information about the drive specified by UNSIGNED:
UNSIGNED | Drive |
---|---|
0 | Current drive |
1 | A: |
2 | B: |
3 | C: |
... | ... |
(GET-DISK-FREE-SPACE) corresponds to DOS interrupt 21 (hex), function 36 (hex).
(GET-DOS-VERSION) ( -- UNSIGNED-DOUBLE UNSIGNED UNSIGNED )
UNSIGNED-DOUBLE is the DOS serial number. The first UNSIGNED is the minor DOS version number. The second UNSIGNED is the major DOS version number.
(GET-DOS-VERSION) corresponds to DOS interrupt 21 (hex), function 30 (hex).
(GET-DRIVE) ( -- UNSIGNED )
UNSIGNED identifies the current drive.
UNSIGNED | Drive |
---|---|
0 | A: |
1 | B: |
2 | C: |
... | ... |
(GET-DRIVE) corresponds to DOS interrupt 21 (hex), function 19 (hex).
(GET-DRIVE-DATA) ( UNSIGNED -- FAR-ADDRESS UNSIGNED UNSIGNED UNSIGNED )
Returns information about the drive specified by UNSIGNED:
UNSIGNED | Drive |
---|---|
0 | Current drive |
1 | A: |
2 | B: |
3 | C: |
... | ... |
(GET-DRIVE-DATA) corresponds to DOS interrupt 21 (hex), function 1C (hex).
(GET-DTA) ( -- FAR-ADDRESS )
FAR-ADDRESS is the disk transfer address (DTA).
(GET-DTA) corresponds to DOS interrupt 21 (hex), function 2F (hex).
(GET-INTERRUPT) ( UNSIGNED -- FAR-ADDRESS )
FAR-ADDRESS is the address of the interrupt service routine assigned to interrupt UNSIGNED.
(GET-INTERRUPT) corresponds to DOS interrupt 21 (hex), function 35 (hex).
(GET-VERIFY-FLAG) ( -- FLAG )
FLAG is TRUE if and only if automatic verification of data written to mass storage is turned on.
(GET-VERIFY-FLAG) corresponds to DOS interrupt 21 (hex), function 54 (hex).
(LAST-WRITE) ( FILE DOUBLE UNSIGNED -- 2ND SIGNED )
If UNSIGNED is equal to 0, query the time and date of the last access to the file FILE. If UNSIGNED is equal to 1, set the time and date of the last access to the file FILE to the value encoded in DOUBLE. SIGNED is non-zero if and only if either UNSIGNED or FILE are invalid. DOUBLE is divided into bit fields containing year, month, date, hours, minutes and seconds as binary numbers:
Year-1980 | Month | Day | Hours | Minutes | Seconds/2 |
Bits | Content |
---|---|
0 to 4 | Seconds divided by 2 (0 to 29) |
5 to 10 | Minutes (0 to 59) |
11 to 15 | Hours (0 to 23) |
16 to 20 | Date (1 to 31) |
21 to 24 | Month (1 to 12) |
25 to 31 | Year minus 1980 |
(LAST-WRITE) corresponds to DOS interrupt 21 (hex), function 57 (hex).
(LOAD/EXECUTE) ( CDATA -> CHARACTER FAR-ADDRESS UNSIGNED -- SIGNED )
If UNSIGNED is equal to 0, load and execute the DOS program whose path and file name is identified by the null-terminated character string CDATA -> CHARACTER. FAR-ADDRESS is the address of the parameter block. SIGNED is the DOS error code.
If UNSIGNED is equal to 3, load the DOS overlay whose path and file name is identified by the null-terminated character string CDATA -> CHARACTER. FAR-ADDRESS is the address of the parameter block. SIGNED is the DOS error code.
An ambiguous condition exists if UNSIGNED has any other value.
(LOAD/EXECUTE) corresponds to DOS interrupt 21 (hex), function 4B (hex).
(LOCK/UNLOCK) ( FILE UNSIGNED-DOUBLE UNSIGNED-DOUBLE UNSIGNED -- SIGNED )
Lock or unlock any access to the whole or a part of the file FILE. The first UNSIGNED-DOUBLE is the position within the file where the locked part starts. The second UNSIGNED-DOUBLE is the length of the locked part. If UNSIGNED is 0, the specified part is locked. If UNSIGNED is 1, the specified part is unlocked. All other values of UNSIGNED will cause the operation to fail. SIGNED is the DOS error code.
(LOCK/UNLOCK) corresponds to DOS interrupt 21 (hex), function 5C (hex).
(OPEN) ( CDATA -> CHARACTER FAM -- FILE SIGNED )
Open the file named in the null-terminated character string CDATA -> CHARACTER, with file access method FAM. If the file is successfully opened, SIGNED is zero, FILE is its identifier, and the file has been positioned to the start of the file. Otherwise, SIGNED is the DOS error code and FILE is undefined.
(OPEN) corresponds to DOS interrupt 21 (hex), function 3D (hex).
(POSITION) ( FILE INTEGER-DOUBLE UNSIGNED -- UNSIGNED-DOUBLE SIGNED )
Reposition the file identified by FILE. If UNSIGNED is 0, the new position is the (unsigned) value of INTEGER-DOUBLE. If UNSIGNED is 1, the new position is the current position plus or minus the (signed) value of INTEGER-DOUBLE. If UNSIGNED is 2, the new position is the end of the file plus or minus the (signed) value of INTEGER-DOUBLE. The operation fails if UNSIGNED has any other value. UNSIGNED-DOUBLE is the new position of the file. SIGNED is the DOS error code.
(POSITION) corresponds to DOS interrupt 21 (hex), function 42 (hex).
(PSP) ( -- FAR-ADDRESS )
FAR-ADDRESS is the address of the program segment prefix (PSP).
(PSP) corresponds to DOS interrupt 21 (hex), function 62 (hex).
(READ) ( CDATA -> CHARACTER UNSIGNED FILE -- 3RD SIGNED )
Read UNSIGNED consecutive characters to address CDATA -> CHARACTER from the current position of the file identified by FILE. If UNSIGNED characters are read without an exception, SIGNED is zero and 3RD is equal to UNSIGNED. If the end of the file is reached before UNSIGNED characters are read, SIGNED is zero and 3RD is the number of characters actually read. If the operation is initiated when the value returned by POSITION is equal to the value returned by SIZE for the file identified by FILE, SIGNED is zero and 3RD is zero. If the operation fails, SIGNED is the DOS error code, and 3RD is zero. An ambiguous condition exists if the operation is initiated when the value returned by POSITION is greater than the value returned by SIZE for the file identified by FILE, or if the requested operation attempts to read portions of the file not written. At the conclusion of the operation, POSITION returns the next file position after the last character read.
(READ) corresponds to DOS interrupt 21 (hex), function 3F (hex).
(REALLOCATE) ( FAR-ADDRESS UNSIGNED -- 2ND SIGNED )
Change the allocation of the contiguous memory space starting at the address FAR-ADDRESS, previously allocated by (ALLOCATE) or (REALLOCATE), to UNSIGNED paragraphs. UNSIGNED may be either larger or smaller than the current size of the region in paragraphs. If the operation succeeds, 2ND is the number of paragraphs allocated and SIGNED is zero. If the operation fails, the region of memory at FAR-ADDRESS is unaffected, 2ND is undefined, and SIGNED is the DOS error code.
(REALLOCATE) corresponds to DOS interrupt 21 (hex), function 4A (hex).
(REMOVE-DIR) ( CDATA -> CHARACTER -- SIGNED )
Remove the subdirectory with the absolute or relative path identified by the null-terminated character string CDATA -> CHARACTER. It is not possible to remove the current directory, or a directory that is not empty. SIGNED is the DOS error code.
(REMOVE-DIR) corresponds to DOS interrupt 21 (hex), function 3A (hex).
(RENAME) ( CDATA -> CHARACTER CDATA -> CHARACTER -- SIGNED )
Rename the file named by the first null-terminated character string CDATA -> CHARACTER to the name in the second null-terminated character string CDATA -> CHARACTER. SIGNED is the DOS error code.
(RENAME) corresponds to DOS interrupt 21 (hex), function 56 (hex).
(RETURN-CODE) ( -- UNSIGNED UNSIGNED )
Returns the status of a terminated program. The first UNSIGNED is the program's return code if it terminated normally. The second UNSIGNED indicates the type of termination according to the below table.
Second UNSIGNED | Type Of Termination |
---|---|
0 | Normal |
1 | Control-C |
2 | Fatal Device Error |
3 | Terminate Stay Resident (TSR) |
(RETURN-CODE) corresponds to DOS interrupt 21 (hex), function 4D (hex).
(SEARCH-DIR) ( CDATA -> CHARACTER LOGICAL -- SIGNED )
Search for a file whose name matches the pattern stored in the null-terminated character string CDATA -> CHARACTER. The pattern consists of an optional path and file name and may contain wildcards. LOGICAL provides attributes that allow finding additional entries in the target directory if the corresponding bits are set:
Bit | Attribute |
---|---|
1 | Hidden file |
2 | System file |
3 | Volume ID |
4 | Subdirectory |
SIGNED is zero if a file has been found whose name matches the pattern. Otherwise, SIGNED is the DOS error code. Information about the file is stored at the disk transfer address:
Address | Contents |
---|---|
DTA | Reserved |
DTA+21 | File attributes |
DTA+22 | Date and time of last file access |
DTA+26 | File size |
DTA+30 | File name as null-terminated character string |
(SEARCH-DIR) corresponds to DOS interrupt 21 (hex), function 4E (hex).
(SEARCH-DIR-NEXT) ( -- SIGNED )
Search for the next file with the same pattern and attributes as were provided in the previous execution of (SEARCH-DIR).
SIGNED is zero if another file has been found whose name matches the pattern. Otherwise, SIGNED is the DOS error code. Information about the file is stored at the disk transfer address:
Address | Contents |
---|---|
DTA | Reserved |
DTA+21 | File attributes |
DTA+22 | Date and time of last file access |
DTA+26 | File size |
DTA+30 | File name as null-terminated character string |
(SEARCH-DIR) corresponds to DOS interrupt 21 (hex), function 4F (hex).
(SET-DATE) ( UNSIGNED UNSIGNED UNSIGNED -- FLAG )
Set the current DOS system date. The first UNSIGNED is the day of the month (1 to 31). The second UNSIGNED is the month (1 to 12). The third UNSIGNED is the year (1980 to 2099).
(SET-DATE) corresponds to DOS interrupt 21 (hex), function 2B (hex).
(SET-DRIVE) ( UNSIGNED -- 1ST )
Make the drive identified by UNSIGNED the current drive. 1ST is the total number of drives specified by LASTDRIVE.
UNSIGNED | Drive |
---|---|
0 | A: |
1 | B: |
2 | C: |
... | ... |
(SET-DRIVE) corresponds to DOS interrupt 21 (hex), function 0E (hex).
(SET-DTA) ( FAR-ADDRESS -- )
Make FAR-ADDRESS the disk transfer address (DTA).
(SET-DTA) corresponds to DOS interrupt 21 (hex), function 1A (hex).
(SET-INTERRUPT) ( FAR-ADDRESS UNSIGNED -- )
Make FAR-ADDRESS the address of the interrupt service routine assigned to interrupt UNSIGNED.
(SET-INTERRUPT) corresponds to DOS interrupt 21 (hex), function 25 (hex).
(SET-TIME) ( UNSIGNED UNSIGNED UNSIGNED UNSIGNED -- FLAG )
Set the current DOS system time. The first UNSIGNED is the number ot centiseconds (0 to 99). The second UNSIGNED is the seconds (0 to 99). The third UNSIGNED is the minutes (0 to 59). The fourth UNSIGNED is the hours (0 to 23).
(SET-TIME) corresponds to DOS interrupt 21 (hex), function 2D (hex).
(SET-VERIFY-FLAG) ( SINGLE -- )
If SINGLE is non-zero, turn on automatic verification of data written to mass storage. If SINGLE is zero, turn off automatic verification of data written to mass storage.
(SET-VERIFY-FLAG) corresponds to DOS interrupt 21 (hex), function 2E (hex).
(TERMINATE) ( UNSIGNED -- )
Terminate StrongForth and return control to DOS with return code UNSIGNED. Neither the block file nor any other open files are closed.
(TERMINATE) corresponds to DOS interrupt 21 (hex), function 4C (hex).
(TSR) ( UNSIGNED UNSIGNED -- )
Terminate StrongForth and stay resident. The first UNSIGNED is the DOS return code. The second UNSIGNED is the number of paragraphs reserved for the resident program. Neither the block file nor any other open files are closed.
(TSR) corresponds to DOS interrupt 21 (hex), function 31 (hex).
(WRITE) ( CCONST -> CHARACTER UNSIGNED FILE -- SIGNED )
Write UNSIGNED characters from address CDATA -> CHARACTER to the file identified by FILE starting at its current position. SIGNED is the DOS error code. At the conclusion of the operation, POSITION returns the next file position after the last character written to the file, and SIZE returns a value greater than or equal to the value returned by POSITION.
(WRITE) corresponds to DOS interrupt 21 (hex), function 40 (hex).
(WRITE) ( CDATA -> CHARACTER UNSIGNED FILE -- SIGNED )
Write UNSIGNED characters from address CCONST -> CHARACTER to the file identified by FILE starting at its current position. SIGNED is the DOS error code. At the conclusion of the operation, POSITION returns the next file position after the last character written to the file, and SIZE returns a value greater than or equal to the value returned by POSITION.
(WRITE) corresponds to DOS interrupt 21 (hex), function 40 (hex).
>IOR ( SIGNED -- 1ST )
1ST is the I/O result code corresponding to the DOS error code SIGNED.
>PARAGRAPHS ( UNSIGNED -- 1ST )
1ST is the minimum number of paragraphs that are required to store a contiguous memory block of UNSIGNED address units.
>STR ( CDATA -> CHARACTER UNSIGNED CDATA -> CHARACTER -- 4 TH )
Copy the character string CDATA -> CHARACTER UNSIGNED to address CDATA -> CHARACTER and append a trailing null character to make it a null-terminated string. 4 TH is equal to the second CDATA -> CHARACTER. An ambiguous condition exists if the buffer at address CDATA -> CHARACTER is less than UNSIGNED+1 characters long.
Note: Null-terminated strings are required as parameters for DOS interrupts.
>STR ( CDATA -> CHARACTER UNSIGNED -- CDATA -> CHARACTER )
Copy the character string CDATA -> CHARACTER UNSIGNED to the string buffer and append a trailing null character to make it a null-terminated string. Return the address of the string buffer as CDATA -> CHARACTER. An ambiguous condition exists if UNSIGNED is greater than 79, which is the size of the string buffer minus 1.
Note: Null-terminated strings are required as parameters for DOS interrupts.
>STR ( CCONST -> CHARACTER UNSIGNED CDATA -> CHARACTER -- 4 TH )
Copy the character string CCONST -> CHARACTER UNSIGNED to address CDATA -> CHARACTER and append a trailing null character to make it a null-terminated string. 4 TH is equal to CDATA -> CHARACTER. An ambiguous condition exists if the buffer at address CDATA -> CHARACTER is less than UNSIGNED+1 characters long.
Note: Null-terminated strings are required as parameters for DOS interrupts.
>STR ( CCONST -> CHARACTER UNSIGNED -- CDATA -> CHARACTER )
Copy the character string CCONST -> CHARACTER UNSIGNED to the string buffer and append a trailing null character to make it a null-terminated string. Return the address of the string buffer as CDATA -> CHARACTER. An ambiguous condition exists if UNSIGNED is greater than 79, which is the size of the string buffer minus 1.
Note: Null-terminated strings are required as parameters for DOS interrupts.
?REFILL ( -- )
When the input source is a text file, re-read the current line from the file to the file input buffer. >IN remains unchanged.
Note: ?REFILL is used by words like INCLUDE, EVALUATE and THROW, which restore the input source specification after the file input buffer might have been overwritten.
BIN ( FAM -- 1ST )
Modify FAM to additionally select a binary, i.e., not line oriented, file access method, giving 1ST.
CFAR-ALLOCATE ( UNSIGNED -- CFAR-ADDRESS SIGNED )
Allocate UNSIGNED address units of contiguous memory space. The initial content of the allocated memory space is undefined. If the allocation succeeds, CFAR-ADDRESS is the aligned starting address of the allocated memory space and SIGNED is zero. If the operation fails, CFAR-ADDRESS does not represent a valid address and SIGNED is the I/O result code.
CLOSE ( FILE -- SIGNED )
Close the file identified by FILE. SIGNED is the I/O result code.
CREATE ( CDATA -> CHARACTER FAM -- FILE SIGNED )
Create the file named in the null-terminated character string CDATA -> CHARACTER, and open it with file access method FAM. If a file with the same name already exists, recreate it as an empty file. If the file was successfully created and opened, SIGNED is zero, FILE is its identifier, and the file has been positioned to the start of the file. Otherwise, SIGNED is the I/O result code and FILE is undefined.
CREATE ( CDATA -> CHARACTER UNSIGNED FAM -- FILE SIGNED )
Create the file named in the character string CDATA -> CHARACTER UNSIGNED, and open it with file access method FAM. If a file with the same name already exists, recreate it as an empty file. If the file was successfully created and opened, SIGNED is zero, FILE is its identifier, and the file has been positioned to the start of the file. Otherwise, SIGNED is the I/O result code and FILE is undefined.
CREATE ( CCONST -> CHARACTER UNSIGNED FAM -- FILE SIGNED )
Create the file named in the character string CCONST -> CHARACTER UNSIGNED, and open it with file access method FAM. If a file with the same name already exists, recreate it as an empty file. If the file was successfully created and opened, SIGNED is zero, FILE is its identifier, and the file has been positioned to the start of the file. Otherwise, SIGNED is the I/O result code and FILE is undefined.
DELETE ( CDATA -> CHARACTER UNSIGNED -- SIGNED )
Delete the file named in the character string CDATA -> CHARACTER UNSIGNED. SIGNED is the I/O result code.
DELETE ( CCONST -> CHARACTER UNSIGNED -- SIGNED )
Delete the file named in the character string CCONST -> CHARACTER UNSIGNED. SIGNED is the I/O result code.
FAM ( STACK-DIAGRAM -- 1ST )
When used in a stack diagram, specifies an input or output parameter with data type FAM.
FAR-ALLOCATE ( UNSIGNED -- FAR-ADDRESS SIGNED )
Allocate UNSIGNED address units of contiguous memory space. The initial content of the allocated memory space is undefined. If the allocation succeeds, FAR-ADDRESS is the aligned starting address of the allocated memory space and SIGNED is zero. If the operation fails, FAR-ADDRESS does not represent a valid address and SIGNED is the I/O result code.
FIB ( -- CDATA -> CHARACTER )
CDATA -> CHARACTER is the address of the file input buffer. The file input buffer is 1024 characters long.
FLUSH ( FILE -- SIGNED )
Attempt to force any buffered information written to the file referred to by FILE to be written to mass storage, and the size information for the file to be recorded in the storage directory if changed. If the operation is successful, SIGNED is zero. Otherwise, it is the I/O result code.
FREE ( FAR-ADDRESS -- SIGNED )
Return the contiguous region of memory space indicated by FAR-ADDRESS to the system for later allocation. FAR-ADDRESS shall indicate a region of memory space that was previously obtained by FAR-ALLOCATE or RESIZE. If the operation succeeds, or FAR-ADDRESS is null, SIGNED is zero. If the operation fails, SIGNED is the I/O result code.
FREE ( CFAR-ADDRESS -- SIGNED )
Return the contiguous region of memory space indicated by CFAR-ADDRESS to the system for later allocation. CFAR-ADDRESS shall indicate a region of memory space that was previously obtained by CFAR-ALLOCATE or RESIZE. If the operation succeeds, or CFAR-ADDRESS is null, SIGNED is zero. If the operation fails, SIGNED is the I/O result code.
INCLUDE ( CDATA -> CHARACTER UNSIGNED -- )
Remove CDATA -> CHARACTER UNSIGNED from the stack. Save the current input source specification, including the value of SOURCE-ID. Open the file specified by CDATA -> CHARACTER UNSIGNED, store the resulting file identifier in SOURCE-ID, and make it the input source. Store zero in BLK. Other stack effects are due to the words included.
Repeat until end of file: read a line from the file, fill the input buffer from the contents of that line, set >IN to zero, and interpret. Text interpretation begins at the file position where the next file read would occur. When the end of the file is reached, close the file and restore the input source specification to its saved value. An exception is thrown if the named file can not be opened, if an I/O exception occurs reading the file, or if an I/O exception occurs while closing the file. When an exception is thrown, the status (open or closed) of any files that were being interpreted is undefined.
INCLUDE ( FILE -- )
Remove FILE from the stack. Save the current input source specification, including the value of SOURCE-ID. Store FILE in SOURCE-ID. Make the file specified by FILE the input source. Store zero in BLK. Other stack effects are due to the words included.
Repeat until end of file: read a line from the file, fill the input buffer from the contents of that line, set >IN to zero, and interpret. Text interpretation begins at the file position where the next file read would occur. When the end of the file is reached, close the file and restore the input source specification to its saved value. An exception is thrown if FILE is invalid, if there is an I/O exception reading FILE, or if an I/O exception occurs while closing FILE. When an exception is thrown, the status (open or closed) of any files that were being interpreted is undefined.
OPEN ( CDATA -> CHARACTER UNSIGNED FAM -- FILE SIGNED )
Open the file named in the character string CDATA -> CHARACTER UNSIGNED, with file access method FAM. If the file is successfully opened, SIGNED is zero, FILE is its identifier, and the file has been positioned to the start of the file. Otherwise, SIGNED is the I/O result code and FILE is undefined.
OPEN ( CCONST -> CHARACTER UNSIGNED FAM -- FILE SIGNED )
Open the file named in the character string CCONST -> CHARACTER UNSIGNED, with file access method FAM. If the file is successfully opened, SIGNED is zero, FILE is its identifier, and the file has been positioned to the start of the file. Otherwise, SIGNED is the I/O result code and FILE is undefined.
POSITION ( FILE -- UNSIGNED-DOUBLE SIGNED )
UNSIGNED-DOUBLE is the current file position for the file identified by FILE. SIGNED is the I/O result code. UNSIGNED-DOUBLE is undefined if SIGNED is non-zero.
R/O ( -- FAM )
FAM is the value for selecting the read only file access method.
R/W ( -- FAM )
FAM is the value for selecting the read/write file access method.
READ ( CDATA -> CHARACTER UNSIGNED FILE -- 3RD SIGNED )
Read UNSIGNED consecutive characters to address CDATA -> CHARACTER from the current position of the file identified by FILE. If UNSIGNED characters are read without an exception, SIGNED is zero and 3RD is equal to UNSIGNED. If the end of the file is reached before UNSIGNED characters are read, SIGNED is zero and 3RD is the number of characters actually read. If the operation is initiated when the value returned by POSITION is equal to the value returned by SIZE for the file identified by FILE, SIGNED is zero and 3RD is zero. If the operation fails, SIGNED is the I/O result code, and 3RD is zero. An ambiguous condition exists if the operation is initiated when the value returned by POSITION is greater than the value returned by SIZE for the file identified by FILE, or if the requested operation attempts to read portions of the file not written. At the conclusion of the operation, POSITION returns the next file position after the last character read.
READ-LINE ( CDATA -> CHARACTER UNSIGNED FILE -- 3RD FLAG SIGNED )
Read the next line from the file specified by FILE into memory at the address CDATA -> CHARACTER. At most UNSIGNED characters are read. Up to two line-terminating characters (<CR> and <LF>) may be read into memory at the end of the line, but are not included in the count 3RD. The line buffer provided by CDATA -> CHARACTER should be at least UNSIGNED+2 characters long. If the operation succeeded, FLAG is true and SIGNED is zero. If a line terminator was received before UNSIGNED characters were read, then 3RD is the number of characters, not including the line terminator, actually read (0 <= 3RD <= UNSIGNED). When UNSIGNED = 3RD, the line terminator has yet to be reached. If the operation is initiated when the value returned by POSITION is equal to the value returned by SIZE for the file identified by FILE, FLAG is false, SIGNED is zero, and 3RD is zero. If SIGNED is non-zero, the operation failed and SIGNED is the I/O result code.
An ambiguous condition exists if the operation is initiated when the value returned by POSITION is greater than the value returned by SIZE for the file identified by FILE, or if the requested operation attempts to read portions of the file not written. At the conclusion of the operation, POSITION returns the next file position after the last character read.
REFILL ( -- FLAG )
Extend the execution semantics of REFILL with the following:
When the input source is a text file, attempt to read the next line from the file to the file input buffer. If successful, set >IN to zero, and return TRUE as FLAG. Otherwise return FALSE as FLAG.
REFILL is a deferred definition.
RENAME ( CDATA -> CHARACTER UNSIGNED CDATA -> CHARACTER UNSIGNED -- SIGNED )
Rename the file named by the first character string CDATA -> CHARACTER UNSIGNED to the name in the second character string CDATA -> CHARACTER UNSIGNED. SIGNED is the I/O result code.
RENAME ( CDATA -> CHARACTER UNSIGNED CCONST -> CHARACTER UNSIGNED -- SIGNED )
Rename the file named by the character string CDATA -> CHARACTER UNSIGNED to the name in the character string CCONST -> CHARACTER UNSIGNED. SIGNED is the I/O result code.
RENAME ( CCONST -> CHARACTER UNSIGNED CDATA -> CHARACTER UNSIGNED -- SIGNED )
Rename the file named by the character string CCONST -> CHARACTER UNSIGNED to the name in the character string CDATA -> CHARACTER UNSIGNED. SIGNED is the I/O result code.
RENAME ( CCONST -> CHARACTER UNSIGNED CCONST -> CHARACTER UNSIGNED -- SIGNED )
Rename the file named by the first character string CCONST -> CHARACTER UNSIGNED to the name in the second character string CCONST -> CHARACTER UNSIGNED. SIGNED is the I/O result code.
REPOSITION ( UNSIGNED-DOUBLE FILE -- SIGNED )
Reposition the file identified by FILE to UNSIGNED-DOUBLE. SIGNED is the I/O result code. At the conclusion of the operation, POSITION returns the value UNSIGNED-DOUBLE.
RESIZE ( UNSIGNED-DOUBLE FILE -- SIGNED )
Set the size of the file identified by FILE to UNSIGNED-DOUBLE. SIGNED is the I/O result code. If the resultant file is larger than the file before the operation, the portion of the file added as a result of the operation is undefined. At the conclusion of the operation, both SIZE and POSITION return the value UNSIGNED-DOUBLE.
RESIZE ( FAR-ADDRESS UNSIGNED -- 1ST SIGNED )
Change the allocation of the contiguous memory space starting at the address FAR-ADDRESS, previously allocated by FAR-ALLOCATE or RESIZE, to UNSIGNED address units. UNSIGNED may be either larger or smaller than the current size of the region. If the operation succeeds, 1ST is the aligned starting address of UNSIGNED address units of allocated memory and SIGNED is zero. If the operation fails, the region of memory at FAR-ADDRESS is unaffected, and SIGNED is the I/O result code. 1ST is always the same as FAR-ADDRESS.
If FAR-ADDRESS is zero, RESIZE just performs the semantics of FAR-ALLOCATE.
RESIZE ( CFAR-ADDRESS UNSIGNED -- 1ST SIGNED )
Change the allocation of the contiguous memory space starting at the address CFAR-ADDRESS, previously allocated by CFAR-ALLOCATE or RESIZE, to UNSIGNED address units. UNSIGNED may be either larger or smaller than the current size of the region. If the operation succeeds, 1ST is the aligned starting address of UNSIGNED address units of allocated memory and SIGNED is zero. If the operation fails, the region of memory at CFAR-ADDRESS is unaffected, and SIGNED is the I/O result code. 1ST is always the same as CFAR-ADDRESS.
If CFAR-ADDRESS is zero, RESIZE just performs the semantics of CFAR-ALLOCATE.
RESTORE-INPUT ( INPUT-SOURCE -- FLAG )
Attempt to restore the input source specification to the state described by the tuple INPUT-SOURCE. The input source specification may be the user input device, a character string, a block or a file. FLAG is true if the input source specification cannot be restored.
An ambiguous condition exists if the input source represented by the arguments is not the same as the current input source.
SAVE-INPUT ( -- INPUT-SOURCE )
INPUT-SOURCE is a tuple that describes the current state of the input source specification for later use by RESTORE-INPUT. The input source specification may be the user input device, a character string, a block or a file.
SIZE ( FILE -- UNSIGNED-DOUBLE SIGNED )
UNSIGNED-DOUBLE is the size, in characters, of the file identified by FILE. SIGNED is the I/O result code. This operation does not affect the value returned by POSITION. UNSIGNED-DOUBLE is undefined if SIGNED is non-zero.
SIZE ( FAR-ADDRESS -- UNSIGNED-DOUBLE )
UNSIGNED-DOUBLE is the size in address units of the contiguous memory space starting at the address FAR-ADDRESS that has previously been obtained by FAR-ALLOCATE or RESIZE. UNSIGNED-DOUBLE is zero if FAR-ADDRESS is not the address of a contiguous memory space that has previously been obtained by FAR-ALLOCATE or RESIZE.
SIZE ( CFAR-ADDRESS -- UNSIGNED-DOUBLE )
UNSIGNED-DOUBLE is the size in address units of the contiguous memory space starting at the address CFAR-ADDRESS that has previously been obtained by CFAR-ALLOCATE or RESIZE. UNSIGNED-DOUBLE is zero if CFAR-ADDRESS is not the address of a contiguous memory space that has previously been obtained by CFAR-ALLOCATE or RESIZE.
SOURCE ( -- CDATA -> CHARACTER UNSIGNED )
Extend the execution semantics of SOURCE with the following:
When the input source is a text file, CDATA -> CHARACTER is the address of the file input buffer, and UNSIGNED is the number of characters in the file input buffer.
SOURCE is a deferred definition.
STATUS ( CDATA -> CHARACTER UNSIGNED -- LOGICAL SIGNED )
Return the status of the file named by the character string CDATA -> CHARACTER UNSIGNED. If the file exists, SIGNED is zero; otherwise SIGNED is the I/O result code. The bits of LOGICAL indicate file attributes as specified in the below table.
Bits 15 to 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | Attribute |
---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | Unlimited access |
0 | x | x | x | x | x | 1 | Read only file |
0 | x | x | x | x | 1 | x | Hidden file |
0 | x | x | x | 1 | x | x | System file |
0 | 0 | 0 | 1 | 0 | 0 | 0 | Volume ID |
0 | x | 1 | x | x | x | x | Subdirectory |
0 | 1 | x | x | x | x | x | File has not been archived |
x means don't care.
STATUS ( CCONST -> CHARACTER UNSIGNED -- LOGICAL SIGNED )
Return the status of the file named by the character string CCONST -> CHARACTER UNSIGNED. If the file exists, SIGNED is zero; otherwise SIGNED is the I/O result code. The bits of LOGICAL indicate file attributes as specified in the below table.
Bits 15 to 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | Attribute |
---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | Unlimited access |
0 | x | x | x | x | x | 1 | Read only file |
0 | x | x | x | x | 1 | x | Hidden file |
0 | x | x | x | 1 | x | x | System file |
0 | 0 | 0 | 1 | 0 | 0 | 0 | Volume ID |
0 | x | 1 | x | x | x | x | Subdirectory |
0 | 1 | x | x | x | x | x | File has not been archived |
x means don't care.
STR ( -- CDATA -> CHARACTER )
CDATA -> CHARACTER is the address of the string buffer. The string buffer is 80 characters long.
Note: The string buffer is used by " in interpretation state and by >STR.
W/O ( -- FAM )
FAM is the value for selecting the write only file access method.
WRITE ( CDATA -> CHARACTER UNSIGNED FILE -- SIGNED )
Write UNSIGNED characters from address CDATA -> CHARACTER to the file identified by FILE starting at its current position. SIGNED is the I/O result code. At the conclusion of the operation, POSITION returns the next file position after the last character written to the file, and SIZE returns a value greater than or equal to the value returned by POSITION.
WRITE ( CCONST -> CHARACTER UNSIGNED FILE -- SIGNED )
Write UNSIGNED characters from address CCONST -> CHARACTER to the file identified by FILE starting at its current position. SIGNED is the I/O result code. At the conclusion of the operation, POSITION returns the next file position after the last character written to the file, and SIZE returns a value greater than or equal to the value returned by POSITION.
WRITE-EOL ( FILE -- SIGNED )
Write a line terminator (<CR> and <LF>) to the file identified by FILE at its current position. SIGNED is the I/O result code. At the conclusion of the operation, POSITION returns the next file position after the second character written to the file, and SIZE returns a value greater than or equal to the value returned by POSITION.
WRITE-LINE ( CDATA -> CHARACTER UNSIGNED FILE -- SIGNED )
Write UNSIGNED characters from address CDATA -> CHARACTER followed by a line terminator (<CR> and <LF>) to the file identified by FILE starting at its current position. SIGNED is the I/O result code. At the conclusion of the operation, POSITION returns the next file position after the last character written to the file, and SIZE returns a value greater than or equal to the value returned by POSITION.
WRITE-LINE ( CCONST -> CHARACTER UNSIGNED FILE -- SIGNED )
Write UNSIGNED characters from address CCONST -> CHARACTER followed by a line terminator (<CR> and <LF>) to the file identified by FILE starting at its current position. SIGNED is the I/O result code. At the conclusion of the operation, POSITION returns the next file position after the last character written to the file, and SIZE returns a value greater than or equal to the value returned by POSITION.
Dr. Stephan Becher - February 6th, 2008