home *** CD-ROM | disk | FTP | other *** search
-
-
- OBJECT.Doc
-
- This drawer contains two 'object' files, comp.o and decomp.o which
- can be linked to your programmes to make available to them the functions
- compress() and decompress() respectively.
-
- error = compress(*FileHandle,*FileHandle)
-
- The function compresses the data in the first file into the second file.
-
- error: value 0 - satisfactory completion
- value 1 - compression failed
- value 2 - insufficient memory
-
- The short C programme Crunch.c illustrates how to use the function. The
- caller must declare the two file handles and the variable 'error' (int) and
- Open (using the DOS Open function) the files before calling compress. On
- completion the files must be closed.
-
- When calling from Assembler the two FileHandles should be passed on the
- stack. Error is returned in D0.
-
-
- error = decompress(*FileHandle,*FileHandle)
-
- The function decompresses the first file into the second file.
-
- error: value 0 = satisfactory completion
- value 1 = decompression failed
- value 2 = insufficient memory
-
- The short C programme Decrunch.c illustrates how to use the function. The
- caller must declare the two file handles and the variable 'error' (int) and
- Open (using the DOS Open function) the files before calling decompress. On
- completion the files must be closed.
-
- When calling from Assembler the two FileHandles should be passed on the
- stack. Error is returned in D0.
-
-
- General Notes
-
- The two C files are very basic (but fully viable) applications producing
- usable compression and decompression modules. To re-create the executables
- compile the .c files and then call Execute Comp_linker or Execute
- Decomp_linker.
-
- A compressed file will have the format:
- 'LH',int(decompressed length),int(compressed length),int(CHECKSUM),data. .
-
- Special illustrated files which are used optionally by P-Reader precede
- this sequence with 'PREx' where x is 0 for a PAL file and 1 for an NTSC file
- The two C examples remove this precursor, if present; this extra code may be
- omitted if your programme is not going to meet such files.
-
- I have chosen to work from file to file rather than from memory to memory
- because this saves the caller from measuring file lengths, allocating
- memory, copying to final destination, and because a file provides a more
- stable base for any further processing. Where the output forms an inter-
- mediate stage in your programme the output file will normally be a
- temporary file in RAM, however in low-memory situations it can be placed
- anywhere. All inputs and outputs are fully buffered.
-
- That's all - no special libraries, pragmas, glue or bother - the simplest
- possible approach.
-
- Chas A. Wyndham
-