CASE#1 A TEXT NAME BASED OPERATION ================================== The first case is based on calls where the user supplies a filename in some manner. User ---- Issues a command such as *-FSNAME-COMMAND filename Operating system ---------------- Attempts to match FSNAME with one of the ones in its table. This table is built on hard resets in response to service call number &25. If a match is found and the match is not the currently selected filing system then it takes the supplied filing system id and initialises it with a service call number &12. The filing system then claims the call by returning with A=0. If no match is found then the error "Bad filing system name" is given. Filing system ------------- Does a 'warm' initialisation, restoring any previously held open files from when it was last active. This includes shutting down the current FS with a call to OSFilingSystemControl with A=6, repointing the filing system vectors into the appropriate addresses in ROM, and issuing a vectors changed service call &F. The filing system then gets called by the OS, and should simply do whatever was asked of it just as though your filing system had always been selected. Note that the OS automatically switches back to the old filing system on the next call to any of the filing system addresses so your handler must NOT make any filing system calls itself - you MUST directly call your internal routines. CASE#2 A HANDLE BASED OPERATION =============================== The second case is where a program is making use of a handle specially allocated when the file was first opened. User ---- Wants to read/write a byte to a file, eg.in BASIC a use of BPUT#handle,byte Operating system ---------------- Takes and compares it with the range specified in the table of filing system details built on hard resets in response to service call number &25. If the handle is outside the current filing system's range, an attempt to find which FS it came from is made. If a match is found the OS makes that filing system current by sending a service call number &12. If no match is found, it is passed to the current FS anyway, where it will result in a "Channel" error. Filing system ------------- Does a 'warm' initialisation, restoring any previously held open files from when it was last active. This includes shutting down the current FS with a call to OSFilingSystemControl with A=6, repointing the filing system vectors into the appropriate addresses in ROM, and issuing a vectors changed service call &F. The filing system then gets called by the OS, and your FS should check that the handle is in range and that the file has been opened in the right combination of read/write, and process the request just as though your filing system had always been selected. Note that the OS automatically switches back to the old filing system on the next call to any of the filing system addresses so your handler must NOT make any filing system calls itself - you MUST directly call your internal routines. CASE#3 AT POWERUP ================= This is what is required of you at a hard reset, such as when the machine is first turned on or CTRL-BREAK is pressed. User ---- Turns on the machine, or presses CTRL-BREAK Operating system ---------------- Issues service call &25 to get filing system details Filing system ------------- Should use Y as an offset to the pointer at &F2 to where the OS wants the details. ie.in assembler this is a STA(&F2),Y instruction. The format of the response is "FSNAME "+lowest handle used+highest handle used+filing system id Note that the filing system name is in upper case and should be padded with spaces to 8 characters. The other 3 are single bytes making 11 in total. Your filing system may submit more than one filing system details block (eg. the cassette filing system registers -TAPE- and -CFS- as an alternative) if required. Do not claim the call, and exit with Y increased by however many 11 byte blocks you have added to the table, ready for any other ROMs in the machine to add to.