It is often very useful to convert between file and block source formats. Although blocks are the most efficient format, files are usually more convenient to edit (although the block line editor is now available and is very usable on the Z88 itself) and also take up less space in the Z88's memory.
These utilities allow easy conversion between the two formats. Blocks are converted to files by outputting each 64-character block line as a line of the file (with trailing blanks removed); files are converted to blocks in the reverse manner, with lines over 64 characters in length causing an error.
Usually, the word BLKS>FILE is most convenient; this saves a range of blocks to a new file. For example:
S" newfile.fth" 5 10 BLKS>FILE
saves blocks 5 thru 10 to a file named newfile.fth.
If you have an already-open file, you can supply its file ID and append one or more blocks to it (this leaves the file open). For example, if the word myfile returns the fileid of a file open for writing, use:
myfile 17 BLK>> myfile 25 28 BLKS>>
to append blocks 17, 25, 26, 27 and 28 to the file.
Use the word FILE>BLKS to convert a text file into a range of blocks. For example:
S" sourcey.fth" 30 FILE>BLKS
converts the text file sourcey.fth to blocks, starting with block number 30.
More about CamelForth
Back to the Z88 home page