MDFS::Info.Comp.Spectrum.ProgTips.tapeio/htm | Search |
SA_BYTES
and LD_BYTES
. These two routines load
and save data from and to tape, with the entry parameters specifying
However, these entry parameters can be thought of slightly differently as opening a file for input or output, and reading or writing data from or to that opened file. Defining the entry parameters in this way allows the tape routines to be replaced with code that accesses different media, but still have the same functionality.
Original Specification ====================== 0556 - LD_BYTES - Load Bytes From Tape -------------------------------------- On entry: A: 00=header, FF=data Cy: 1=load, 0=verify IX= start address to load/verify to DE= number of bytes to load/verify On exit: C : bytes loaded or verified NC: nothing done, or load or verify error New specification ================= 0556 - RD_FILE - Scan For Next ------------------------------ On entry: A=00, Cy=1 : Scan for next file DE =filename length+7 (minimum 10+7) IX+0..IX+DE-1: Space to return file information On exit: Cy=1 : A file found, data in IX+0 onwards. Cy=0 : File not found 0556 - RD_FILE - Open For Input ------------------------------- On entry: A=00, Cy=1 : Open file for input, closing any previously open file DE =filename length+7 (minimum 10+7) IX-DE =>file type IX-DE+1 =>filename to search for (padded with spaces) IX-4 =>address to load to or zero to use file's load address IX+0..IX+DE-1: Space to return file information On exit: Cy=1 : A file found, data in IX+0 onwards. Calling program must check if names match Cy=0 : File not found Note: This call looks identical to 'Scan For Next'. The called routine can't tell if the calling program is cataloguing the media or is wanting to open a file. Consequently, the called code should not expect anything in memory at negative offsets from IX, and the calling code caller should check for the filenames matching. 0556 - RD_FILE - Read from input file ------------------------------------- On entry: A=FF, Cy=1 : Read data from current input file DE =length to read IX =address to read to On exit: Cy=1 : Data read ok Cy=0 : Not all data read IX =>byte after last byte read DE =amount of data not read 0556 - RD_FILE - Verify from input file --------------------------------------- On entry: A=FF, Cy=0 : Verify data in current input file DE =length to verify IX =address of data to verify On exit: Cy=1 : Data verified ok Cy=0 : Verification error IX =>byte where verification error DE =(amount of data not verified)+1 0556 - RD_FILE - Verify file header ----------------------------------- On entry: A=00, Cy=0 : Verify file information DE =filename length+7 IX-DE =>file type IX-DE+1 =>filename IX-6 => IX-4 => IX-2 => IX+0..IX+DE-1: Space to return file information On exit: Cy=1 : Data verified ok Cy=0 : Verification error IX =>byte where verification error DE =(amount of data not verified)+1 Original specification ====================== 04C2 - SA_BYTES - Save bytes to tape ------------------------------------ On entry: A: 00=header, FF=data IX= start address to save from DE= number of bytes to save New specification ================= 04C2 - WR_FILE - Open For Output -------------------------------- On entry: A=00 : Open file for output, closing any previously open file DE = filename length+7 IX+0 => file type IX+1 => filename IX+DE-6 => file length IX+DE-4 => file load address IX+DE-2 => file exec address On exit: Cy=1 : File opened Cy=0 : File not opened 04C2 - WR_FILE - Write data to output file ------------------------------------------ On entry: A=FF : Write data to current output file DE = data length IX => data start On exit: Cy=1 : Data written ok Cy=0 : Data not written