home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
SIMTEL
/
CPMUG
/
CPMUG023.ARK
/
FILES.DOC
< prev
next >
Wrap
Text File
|
1984-04-29
|
9KB
|
272 lines
***************************************************************************
** COPYRIGHT (C) MASSACHUSETTS INSTITUTE OF TECHNOLOGY AND HARVARD **
** UNIVERSITY, BIOMEDICAL ENGINEERING CENTER 1977. ALL RIGHTS RESERVED. **
***************************************************************************
STOIC FILE SYSTEM
J. SACHS 2/9/77
THE STOIC FILE SYSTEM SUPPORTS CONTIGUOUS FILES WHICH
ARE REFERENCED BY SIX-LETTER NAMES. THESE NAMES AND THE LOCATIONS
OF THE FILES ON THE STORAGE MEDIUM ARE STORED IN A DIRECTORY
WHICH OCCUPIES BLOCK ZERO. NEW FILES ARE ALWAYS ADDED AT THE
END OF THE MEDIUM. THE BLOCKS TAKEN UP BY A FILE WHICH HAS BEEN
DELETED ARE NOT AVAILABLE UNTIL THE WORD "SQUASH" HAS BEEN EXECUTED.
"SQUASH" SLIDES ALL THE FILES DOWN AND RESTRUCTURES THE DIRECTORY
TO ELIMINATE ALL GAPS. THE FOLLOWING WORDS CONTROL DIRECTORY
MAINTENANCE AND FILE ACCESS:
ZERO-DIRECTORY INITIALIZES THE DIRECTORY. THE PREVIOUS CONTENTS
OF THE DIRECTORY ARE LOST.
LIST-DIRECTORY TYPES A DIRECTORY LISTING IN TWO COLUMNS.
LEFT RETURNS ON THE STACK THE NUMBER OF UNUSED BLOCKS
ON THE STORAGE MEDIUM.
CCONT CREATES A CONTIGUOUS FILE WHOSE LENGTH (IN BLOCKS)
IS AT THE TOP OF THE STACK, THE NAME IS AT TOP - 1.
DELETE DELETES THE FILE WHOSE NAME IS AT TOP OF STACK.
RENAME RENAMES FILE WHOSE NAME IS AT TOP - 1 TO NAME AT TOP.
FILE CREATES A 3-WORD FILE CONTROL TABLE WHOSE NAME IS AT
TOP. WHEN REFERENCED, THE ADDRESS OF THE FILE CONTROL
TABLE IS STORED IN THE VARIABLE "FCT". THIS CAUSES
THE FILE CONTROL TABLE TO BECOME THE CURRENT FILE
CONTROL TABLE.
IFILE A 3-WORD FCT AVAILABLE TO THE USER (NORMALLY USED FOR
INPUT FILE)
OFILE A 3-WORD FCT AVAILABLE TO THE USER (NORMALLY USED FOR
OUTPUT FILE)
OPEN OPENS THE FILE WHOSE NAME IS AT TOP USING THE CURRENT
FILE CONTROL TABLE. THE NUMBER OF THE FIRST BLOCK OF
THE FILE IS STORED IN THE FIRST WORD OF THE FILE CONTROL
TABLE AND THE OTHER TWO WORDS ARE ZEROED.
WOPEN OPENS A FILE FOR WRITING; FILE NAME AT TOP OF STACK.
ANY PREVIOUS VERSION OF THE FILE IS DELETED, A NEW
VERSION IS CREATED WHOSE LENGTH IS EQUAL TO THE ENTIRE
REMAINING FREE SPACE, AND THE FILE IS OPENED USING
THE CURRENT FILE CONTROL TABLE. IF MORE THAN ONE
OUTPUT FILE IS ACTIVE AT A TIME, ALL BUT ONE OF THEM
MUST BE CREATED WITH "CCONT" AND OPENED WITH "OPEN",
GIVING THE FILE LENGTH IN ADVANCE. THE LAST ONE MAY
BE VARIABLE LENGTH AND OPENED WITH "WOPEN".
SHRINK USING THE CURRENT FILE CONTROL TABLE, THE END OF
THE DIRECTORY IS MOVED DOWN TO THE FIRST FREE BLOCK
FOLLOWING THE CURRENT FILE. THIS WORD IS USED ONLY
WITH FILES WHICH HAVE BEEN OPENED USING "WOPEN" TO
RELEASE WHATEVER STORAGE IS NOT USED BY THE OUTPUT
FILE.
CLOSE ZEROES THE FIRST WORD OF THE CURRENT FILE CONTROL
TABLE, SIGNALLING IT AS INACTIVE.
GETBYTE USING THE CURRENT FILE CONTROL TABLE,
RETURNS THE NEXT BYTE FROM THE FILE.
GETBYTES USING THE CURRENT FILE CONTROL TABLE, AND TAKING
A BYTE COUNT AT TOP AND A BUFFER ADDRESS AT TOP - 1,
THE SPECIFIED NUMBER OF BYTES ARE READ FROM THE FILE
INTO THE BUFFER.
PUTBYTE USING THE CURRENT FILE CONTROL TABLE,
STORES BYTE AT TOP IN NEXT BYTE OF FILE.
PUTBYTES USING THE CURRENT FILE CONTROL TABLE, AND TAKING
A BYTE COUNT AT TOP AND A BUFFER ADDRESS AT TOP - 1,
THE SPECIFIED NUMBER OF BYTES ARE WRITTEN INTO THE FILE
FROM THE BUFFER.
GPOS USING THE CURRENT FILE CONTROL TABLE,
RETURNS A DOUBLE PRECISION INTEGER FILE POSITION
AT TOP AND TOP - 1. (MOST SIGNIFICANT WORD AT TOP).
SPOS USING THE CURRENT FILE CONTROL TABLE
SETS THE FILE POSITION TO THE DOUBLE PRECISION
INTEGER VALUE AND TOP AND TOP - 1.
EXIST SEARCHES THE DIRECTORY FOR THE NAME AT TOP. IF
FOUND, THE ADDRESS OF THE DIRECTORY ENTRY IS LEFT AT
TOP. IF NOT FOUND, THE ERROR "FILE DOES NOT EXIST"
IS GIVEN.
NOT-EXIST SEARCHES THE DIRECTORY FOR THE NAME AT TOP. IF
FOUND, THE ERROR "FILE ALREADY EXISTS" IS GIVEN.
OPEN? GIVES THE MESSAGE "FILE NOT OPEN" IF THE
CURRENT FILE CONTROL TABLE IS NOT OPEN.
FSQUASH REMOVES DELETED ENTRIES FROM THE END OF THE
DIRECTORY. DELETED ENTRIES BEFORE THE LAST
ACTIVE FILE ARE NOT AFFECTED. FSQUASH IS
CALLED AUTOMATICALLY AFTER A "DELETE".
MVBLOCKS TAKES A SOURCE BLOCK NUMBER AT TOP-2, A DESTINATION
BLOCK NUMBER AT TOP-1, AND A BLOCK COUNT AT TOP.
A SEQUENTIAL SET OF BLOCKS ARE COPIED FROM THE SOURCE
BLOCK TO THE DESTINATION BLOCK.
SQUASH REMOVES ALL DELETED ENTRIES FROM THE DIRECTORY.
THE REMAINING FILES ARE MOVED DOWN TO FILL UP
THE EMPTY SPACE.
SEARCH SEARCHES THE DIRECTORY FOR THE NAME AT TOP. IF
FOUND, A -1 IS RETURNED AT TOP AND A POINTER TO
THE DIRECTORY ENTRY AT TOP - 1. IF NOT FOUND,
A ZERO IS LEFT AT TOP.
DIRECTORY RETURNS ON THE TOP OF THE STACK THE ADDRESS OF
THE FIRST BYTE OF A BUFFER CONTAINING THE
DIRECTORY.
SLOT RETURNS THE ADDRESS OF THE END-OF DIRECTORY ENTRY
IN THE DIRECTORY BUFFER.
SBLK GIVEN THE ADDRESS OF A DIRECTORY ENTRY AT TOP, RETURNS
THE STARTING BLOCK NUMBER FOR THE FILE.
PRINT TYPES OUT ON THE SYSTEM CONSOLE THE CONTENTS OF THE
FILE WHOSE NAME IS AT TOP.
XFER COPIES THE FILE WHOSE NAME IS AT TOP - 1 TO A FILE
WHOSE NAME IS AT TOP. THE DESTINATION FILE IS CREATED
AT THE END OF THE DIRECTORY; ANY PREVIOUS VERSION IS
DELETED.
EXAMPLES:
'PRINT : IFILE OPEN BEGIN GETBYTE DUP EOF NE IF TYO REPEAT
DROP CLOSE ;
THIS EXAMPLE GIVES THE DEFINITIONS OF THE WORD "PRINT" DESCRIBED
ABOVE. IT IS CALLED WITH THE ADDRESS OF A STRING ON THE STACK
WHICH SUPPLIES AN ARGUMENT TO THE WORD "OPEN". "IFILE" MAKES
THE FILE CONTROL TABLE "IFILE" THE CURRENT FILE CONTROL TABLE.
A LOOP IS THEN ENTERED WHICH GETS THE NEXT BYTE FROM THE FILE
("GETBYTE") AND TYPES IT ("TYO") UNTIL AN EOF IS ENCOUNTERED.
AT THIS POINT, THE FILE IS CLOSED.
DIRECTORY ENTRY FORMAT:
WORD CONTENTS
0 1ST WORD OF NAME
(= -1 IF DELETED)
(= 0 IF END OF DIRECTORY)
1 2ND WORD OF NAME
2 3RD WORD OF NAME
3 NUMBER OF FIRST BLOCK OF FILE (IN LEAST SIGNIFICANT 9 BITS)
(NUMBER OF FIRST FREE BLOCK IF 1ST WORD = 0)
THE MOST SIGNIFICANT 7 BITS OF THIS WORD
ARE RESERVED FOR FUTURE USE AS ATTRIBUTE
BITS.
FILE CONTROL TABLE FORMAT:
WORD CONTENTS
0 NUMBER OF FIRST BLOCK OF FILE
(= 0 IF NOT OPEN)
1 CURRENT RELATIVE BLOCK NUMBER
2 CURRENT RELATIVE BYTE NUMBER WITHIN CURRENT BLOCK
SAVING AND RESTORING CORE IMAGES
TWO WORDS ARE PROVIDED WITHIN THE KERNEL WHICH
ENABLE THE USER TO SAVE A "SNAPSHOT" OF THE DICTIONARY AND
ALL STOIC VARIABLES IN A FILE AND, AT A LATER TIME, TO
RESTORE THE SAVED STATE OF THE MACHINE AND RESUME EXECUTION.
THEIR USE IS OUTLINED BELOW:
'FILE WRCI WRITE A CORE IMAGE INTO THE NAMED FILE
'FILE RDCI READ A CORE IMAGE FROM THE NAMED FILE
THE CONTENTS OF THE I/O BUFFERS ARE NOT SAVED AS PART
OF THE CORE IMAGE FILE, BUT ALL OTHER VARIABLES USED BY THE KERNEL,
THE CONTENTS OF ALL STACKS, THE INTERRUPT DISPATCH TABLE, AND ALL
USER DEFINITIONS ARE TRANSFERRED.
CORE IMAGE FILES MUST BE REGENERATED WHENEVER A NEW VERSION
OF THE KERNEL IS USED SINCE THE NEW USER DEFINITIONS REFERENCE
ABSOLUTE LOCATIONS WITHIN THE KERNEL.
"RDCI" SIZES MEMORY AFTER READING IN ITS CORE IMAGE AND THEN
RESETS THE WORD "MEMORY" TO THE TOP OF MEMORY. THIS PERMITS CORE
IMAGES WRITTEN ON ONE MACHINE TO BE USED ON A MACHINE WITH A DIFFERENT
AMOUNT OF MEMORY.
CORE IMAGE FILES SAVE THE STATE OF THE COMPILE BUFFER AND
PSEUDO-INSTRUCTION POINTER. THUS, ANY CODE WHICH FOLLOWS THE CALL TO
"WRCI" WILL BE EXECUTED UPON LOADING THE CORE IMAGE BY "RDCI". FOR
EXAMPLE:
'INITIAL WRCI LIST-DIRECTORY
THIS COMMAND LINE WILL WRITE OUT A CORE IMAGE WITH THE NAME "INITIAL",
AND THEN TYPE OUT A DIRECTORY LISTING. WHEN THE CORE IMAGE IS READ IN:
'INITIAL RDCI
THE STATE OF MEMORY WILL BE RESTORED TO THAT AT THE TIME OF THE "WRCI"
AND EXECUTION WILL RESUME AT THE WORD FOLLOWING "WRCI", CAUSING A DIRECTORY
LISTING TO BE GENERATED.
TO GENERATE A BOOTSTRAPPABLE FILE CONTAINING THE STOIC KERNEL
PLUS ALL CURRENT USER DEFINITIONS, THE FOLLOWING COMMAND IS USED:
'FILE WRITE-BOOT WRITES A BOOTSTRAP FILE.
THE BOOTSTRAP FILE CAN THEN BE LOADED DIRECTLY BY THE BOOTSTRAP BY
RESPONDING WITH THE FILENAME TO THE INITIAL PROMPT. "WRITE-BOOT", LIKE
"WRCI" SAVES THE COMPILE BUFFER AND THUS CODE ENTERED FOLLOWING
"WRITE-BOOT" WILL BE EXECUTED BY THE PROGRAM UPON BEING RELOADED.
THUS, TO SET UP A PROGRAM TO EXECUTE IMMEDIATELY UPON BEING LOADED:
'PROG WRITE-BOOT GO
THIS GENERATES A BOOTSTRAP FILE "PROG" WHICH, WHEN LOADED, WILL
EXECUTE THDFILE, "GET" MUST RETURN AN EOF (^D).
'NAME LOAD-FILE<CR>
WILL THEN COPY FROM THE INPUT DEVICE TO THE NAMED DISK FILE.
8) LOAD THE EDITOR AND ANY OTHER PROGRAMS YOU NEED ONTO THE DISK.
9) THE BASIC DEFINITIONS AND FILE SYSTEM PROGRAMS NEED NOT BE SAVED
ON THE DISK.
THE LINE DRAWER AND INTERRUPT HANDLER ARE HIGHLY SYSTEM DEPENDENT
AND ARE INCLUDED MAINLY AS GUIDELINES FOR WRITING YOUR OWN ROUTINES.
***EOF***