Download ZXMatrix manual
Transcript
The channels package provides a number of new channels for use under ResiDOS. Most of these are compatible
with the extended channels of the ZX Spectrum +3e, although there are also several important additions.
After installing the package, in order to make use of the new channels, you will need to read the information on
extended channels.
The channels provided are:
•
•
•
•
•
File access ("I>", "O>" and "U>")
String variables ("V>")
Memory regions ("M>")
Text windows ("W>")
Null ("Z>")
File channels
Streams may be opened to any file in one of three different access modes: input (using the "I>" channel), output
(using the "O>" channel) and update (using the "U>" channel).
In input and update modes, the file must already exist, or an error will occur. In output mode, the file is deleted if
it already exists, and then a new file is created. Once the file is open, it can be input from (if opened in input or
update modes) or output to (if opened in output or update modes). Because of file buffering, it is essential to
CLOSE # any file channel before finishing, otherwise data may be lost.
The channel specifier for all file channel types requires the filename of the file to follow the ">" character.
File channels support all the pointer operations (FN ptr#(), FN ext#() and POINT #).
It should be noted that files on IDEDOS disks are always stored as a number of 128-byte "records" and so you
may read rubbish at the end of a file if it is not an exact multiple of 128 bytes in length. To avoid this problem,
you should write some code or "signature" at the end of your file which you can detect when reading it back.
Alternatively, you could write the number of bytes or entries in your file at the start. This problem does not exist
for files on FAT disks, but it would be good practice to do this anyway, since it will then allow your program to
be used with files on both FAT and IDEDOS disks.
Examples
OPEN #4, "o>test.txt"
Creates a file named "test.txt" on the default drive for output through stream 4.
OPEN #5, "i>a:test2.txt"
Opens a file named "test2.txt" on drive A: for input through stream 5.
OPEN #6, "u>c:/data/list.txt"
Opens a file named "list.txt" in the "data" directory of drive C: for update through stream 6.
Variable channels
The "V>" channel can be used to direct output to or input from a string variable, which can be easily
manipulated within a BASIC program. This would allow you to (for example) examine disk catalogs in your
BASIC program, or make an auto-running game demo (by inputting from a string containing set keystrokes).
The channel specifier for the variable channel type requires the name of the string variable to follow the ">"
character.
Variable channels support all the pointer operations (FN ptr#(), FN ext#() and POINT #).
24