VLIR file support ------------------------------------------------------------------ 1-501 Function Name: OpenRecordFile Purpose: Opens a VLIR file. Call address: $C274 Input requirements: $02-$03 R0 Pointer to file name. Output: $04 R1L Track of VLIR sector. $05 R1H Sector of VLIR sector. $0C-$0D R5 Pointer to file's directory entry. $8100-$81FF fileHeader: File's VLIR sector. $8496 curRecord: Initial chain # (Should be 0). $8497 usedRecords: Number of chains. $8498 fileWritten: Set to $00. (VLIR file modified). $8499-$849A fileSize: File size. $886F Track of file's directory entry. $8870 Sector of file's directory entry. $8871-$8872 Pointer to directory entry. $8873 Track for VLIR sector. $8874 Sector for VLIR sector. Errors: See Appendix I. Description: This routine opens a VLIR file, and sets up all the variables associated with it. Only one VLIR file can be open at a time due to the fact that these variables are global. 1-502 Function Name: PointRecord Purpose: Get a specific VLIR chain. Call address: $C280 Input requirements: A VLIR chain number. Output: Y Track of VLIR chain. $04 R1L Track of VLIR chain. $05 R1H Sector of VLIR chain. $8496 curRecord: Set to A. Preparatory routines: OpenRecordFile Errors: See Appendix I. Description: This routine gets the track and sector of a specific chain in the open VLIR file. It does not check to see if the chain exists (i.e. track is zero). It does check if this chain is greater than zero and less than the number of VLIR chains at $8497 (usedRecords). VLIR chains are numbered from 0 to N-1, where N is the number of chains. 1-503 Function Name: PreviousRecord Purpose: Move to previous VLIR chain. Call address: $C27D Output: Y Track of VLIR chain. $04 R1L Track of VLIR chain. $05 R1H Sector of VLIR chain. $8496 curRecord: Decremented by 1. Preparatory routines: OpenRecordFile Errors: See Appendix I. Description: This routine gets the track and sector of the previous chain in the open VLIR file. It does not check to see if the chain exists (i.e. track is zero). It does check if this chain is greater than zero. 1-504 Function Name: NextRecord Purpose: Move to next VLIR chain. Call address: $C27A Output: Y Track of VLIR chain. $04 R1L Track of VLIR chain. $05 R1H Sector of VLIR chain. $8496 curRecord: Incremented by 1. Preparatory routines: OpenRecordFile Errors: See Appendix I. Description: This routine gets the track and sector of the next chain in the open VLIR file. It does not check to see if the chain exists (i.e. track is zero). It does check if this chain is in range against $8497 (usedRecords). 1-505 Function Name: InsertRecord Purpose: Insert a new chain in a VLIR file. Call address: $C286 Input requirements: $8496 curRecord: Current chain number. Output: $8497 usedRecords: Incremented by 1. Preparatory routines: OpenRecordFile Errors: See Appendix I. Description: A hole is opened up in the VLIR sector starting with the current chain. The hole is filled with $00,$FF. This represents a null chain. 1-506 Function Name: AppendRecord Purpose: Append a new chain in a VLIR file. Call address: $C289 Input requirements: $8496 curRecord: Current chain number. Output: $8496 curRecord: Incremented by 1. $8497 usedRecords: Incremented by 1. Preparatory routines: OpenRecordFile Errors: See appendix I. Description: A hole is opened up in the VLIR sector immediately following the current chain. The hole is filled with $00,$FF. This represents a null chain. This hole becomes the current chain. 1-507 Function Name: DeleteRecord Purpose: Remove a VLIR chain. Call address: $C283 Input requirements: $8496 curRecord: VLIR chain number. Output: $8496 curRecord: Decremented if greater than or equal to $8497. $8497 usedRecords: Decremented by 1. Preparatory routines: OpenRecordFile Errors: See Appendix I. Description: The current VLIR chain is removed from the VLIR sector, and all the following chains are moved down one. The sectors associated with that chain are freed up. 1-508 Function Name: ReadRecord Purpose: Load a VLIR chain. Call address: $C28C Input requirements: $06-$07 R2 Maximum byte count of load. $10-$11 R7 Load address. $8496 curRecord: Current chain number. Output: $8302-$83FF fileTrScTab: Table of tracks and sectors loaded. Preparatory routines: OpenRecordFile Errors: See Appendix I. Description: This routine loads the current chain by calling ReadFile. 1-509 Function Name: WriteRecord Purpose: Save memory to a VLIR chain. Call address: $C28F Input requirements: $06-$07 R2 Length of save. $10-$11 R7 Address of memory to be saved. $8496 curRecord: VLIR chain number. Output: $8300-$83FF fileTrScTab: Table of tracks and sectors saved to. Preparatory routines: OpenRecordFile Errors: See Appendix I. Description: This routine saves a block of memory to a VLIR chain. If the chain already existed, then it is deleted first. If the length of the save is 0, then no save is performed. This would allow this routine to be used as a delete chain function. 1-510 Function Name: UpdateRecordFile Purpose: Update a VLIR file. Call address: $C295 Output: $8498 fileWritten: Cleared to $00. Preparatory routines: OpenRecordFile Errors: See Appendix I. Description: This routine writes the open VLIR file's VLIR sector to disk and updates the file's directory entry on disk (Time, date and file size). This operation is not performed if location $8498 is zero to start with. That location is a flag that tells whether the file has been altered or not. This routine is called by CloseRecordFile. 1-511 Function Name: CloseRecordFile Purpose: Close a VLIR file. Call address: $C277 Output: $8873 Cleared to $00. Preparatory routines: OpenRecordFile Errors: See Appendix I. Description: The VLIR sector is rewritten to the disk and the directory is updated with a new time, date and file size by calling UpdateRecordFile. Location $8873 is the track number of the VLIR sector. By clearing it, GEOS says that the file is no longer in memory.