Thread View: net.lang.forth
3 messages
3 total messages
Started by hsiung
Thu, 23 Feb 1984 03:26
KPNO FORTH - (nf)
Author: hsiung
Date: Thu, 23 Feb 1984 03:26
Date: Thu, 23 Feb 1984 03:26
11 lines
700 bytes
700 bytes
#N:uiucdcs:30900003:000:200
uiucdcs!hsiung Feb 22 18:29:00 1984
I know it was printed earlier in this notesfile but does
anyone have the address and particulars of getting KPNO forth.
thanks,
uiucdcs!hsiung
{ihnp4,parsec,pur-ee}!uiucdcs!hsiung
Re: forth83 query
Author: cmaz504
Date: Sat, 17 Mar 1984 20:04
Date: Sat, 17 Mar 1984 20:04
8 lines
877 bytes
877 bytes
I recently got a copy of the Forth83 standard on my Kaypro and would like to know how to create and save files with it. Unfortunately there were no instructions and I'd like to do some real programming in Forth rather than having to start from scratch each time. Any help would be appreciated. Steve Alexander cmaz504 at ut-ngp
Re: forth83 query ( using files )
Author: Mitch Bradley
Date: Thu, 22 Mar 1984 18:53
Date: Thu, 22 Mar 1984 18:53
78 lines
3578 bytes
3578 bytes
By F83, I mean the public-domain version of Forth83 that was done my Michael Perry and Henry Laxen. F83 uses CP/M files to contain Forth screens. It does not have a general-purpose stream-oriented file interface like Unix has. N.B. I have written a "stdio"-like stream-oriented file interface for F83 and will post it to the net when I am satisfied with it. For more information, see the 2 papers by W.M. Bradley (me) in the Proceedings of the 1983 Asilomar FORML Conference. Now for how to manipulate files in F83. This is not an exhaustive tutorial, but merely something to get you started. F83 has a notion of a "current file", to which nearly all file operations apply. The variable FILE contains a number which refers to that file (actually, it contains the address of a CP/M file control block for that file). Stack notation: Following the usual convention, (S in1 in2 -- out1 out2 out3 ) means that the word expects 2 input arguments on the stack and leaves 3 output results on the stack. If the word also takes a name from the input stream, this notation is used: (S in1 in2 --name out1 out2 out3 ) Note the absence of a blank between the hypens and "name". Glossary: MAKE-FILE (S --name ) Create a file on the disk with the given name. The file is initially empty. The file must be "OPEN"ed before further use may be made of it. Example: MAKE-FILE B:MYFILE.SCR CREATE-FILE (S #blocks --name ) Create a file on the disk with the given name. The file is initially #blocks * 1024 bytes long and contains blanks. The file must be "OPEN"ed before further use may be made of it. Example: 30 CREATE-FILE B:MYFILE.SCR DIR (S -- ) Show a list of the files on the disk. OPEN (S --name ) The named file becomes the current file. The first time a file is "OPEN"ed, a dictionary entry for the file is created, so that the file may be subsequently opened just by using its name. The file has to already exist on disk (see MAKE-FILE and CREATE-FILE). Example: OPEN B:MYFILE.SCR Later, the file may be re-opened by simply typing B:MYFILE.SCR Once you have made a file current by OPENing it, all of the normal Forth I/O words (BLOCK, LOAD, THRU, LIST, etc ) refer to blocks within that file. You can edit the blocks with the editor (see Starting Forth by Leo Brodie for a description of how to use the editor). SAVE-BUFFERS will write out to disk any blocks you have changed. Copying files: The normal CP/M utilities (e.g. PIP) will work for copying files around. From within Forth, you can also copy files. Here's an example: OPEN NEWFILE.SCR FILES FROM OLDFILE.SCR 5 10 TO 20 CONVEY FORTH will copy blocks 5 through 10 of OLDFILE.SCR to NEWFILE.SCR, starting at block 20 in NEWFILE. There is more that can be done, but I don't have time right now to write about it. I learned all this by reading the code and the shadow screens. Mitch Bradley Sun Microsystems, Inc. decvax!decwrl!sun!wmb
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads