home *** CD-ROM | disk | FTP | other *** search
- \ TDISK.SEQ Text to disk write routines. by Tom Zimmer
-
- ?dark
- .comment:
-
- Routines to allow printing to a disk file.
-
- Just enter PRTON to create a print file on disk called TEXT.PRN. After
- using PRTON, any printed output performed with PRINT, or PRINTING ON/OFF
- will go to this file. Finish up text file output by entering PRTOFF.
- This closes the print file.
-
- The filename used for printing, can be specified with the PRTSET command.
- Enter:
- PRTSET <filename> <enter>
-
- To specify a print file other than TEXT.PRN. The extension ".PRN" will
- always be applied to your print filename.
-
-
- comment;
-
- create aline 128 allot \ 128 character line buffer
- variable len len off \ current line buffer character position.
- handle prtfile \ Print file handle
-
- : c>file ( c1 --- ) \ Character to file
- dup aline len @ + c! len incr 10 = \ write on linefeed
- len @ 127 > or \ or on long line.
- if aline len @ prtfile hwrite drop
- len off
- then #out incr ;
-
- : prtset ( name --- )
- bl word \ specify a filename
- prtfile $>handle \ move it to the handle
- " PRN" ">$ prtfile $>ext ; \ make file extension always .TXT
-
- prtset TEXT \ default to "TEXT.PRN"
-
- : prtoff ( --- ) \ Terminate printing, and close file.
- prtfile >hndle @ 0< \ Leave if already closed.
- if exit
- then
- 13 c>file 10 c>file
- ['] (print) is pemit
- prtfile hclose drop
- fast staton ;
-
- : prton ( --- ) \ Enable printing and create file.
- prtfile >hndle @ -1 > \ Leave if file is already open.
- if exit
- then
- prtfile >hndle @ 0<
- if prtfile hcreate \ make the file
- abort" Couldn't create file" \ abort if error
- len off \ newline
- then slow statoff
- ['] c>file is pemit ;
-
- 60 tillkey