home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 2: Collection B / 17Bit_Collection_B.iso / files / 2010.dms / in.adf / P-Compress / Object / Object.doc < prev   
Encoding:
Text File  |  1999-12-26  |  3.0 KB  |  70 lines

  1.  
  2.  
  3.                              OBJECT.Doc 
  4.  
  5.    This drawer contains two 'object' files, comp.o and decomp.o which
  6.   can be linked to your programmes to make available to them the functions
  7.   compress() and decompress() respectively.
  8.  
  9.    error = compress(*FileHandle,*FileHandle)
  10.  
  11.     The function compresses the data in the first file into the second file.
  12.   
  13.     error:          value 0 - satisfactory completion
  14.                     value 1 - compression failed
  15.                     value 2 - insufficient memory
  16.  
  17.     The short C programme Crunch.c illustrates how to use the function. The
  18.    caller must declare the two file handles and the variable 'error' (int) and
  19.    Open (using the DOS Open function) the files before calling compress.  On 
  20.    completion the files must be closed.
  21.   
  22.     When calling from Assembler the two FileHandles should be passed on the
  23.    stack.  Error is returned in D0.
  24.  
  25.  
  26.    error = decompress(*FileHandle,*FileHandle)
  27.     
  28.     The function decompresses the first file into the second file. 
  29.  
  30.     error:          value 0 = satisfactory completion
  31.                     value 1 = decompression failed
  32.                     value 2 = insufficient memory
  33.  
  34.     The short C programme Decrunch.c illustrates how to use the function. The
  35.    caller must declare the two file handles and the variable 'error' (int) and
  36.    Open (using the DOS Open function) the files before calling decompress.  On 
  37.    completion the files must be closed.
  38.   
  39.     When calling from Assembler the two FileHandles should be passed on the
  40.    stack.  Error is returned in D0.
  41.  
  42.  
  43.    General Notes 
  44.  
  45.     The two C files are very basic (but fully viable) applications producing 
  46.    usable compression and decompression modules.  To re-create the executables
  47.    compile the .c files and then call Execute Comp_linker or Execute
  48.    Decomp_linker.
  49.  
  50.     A compressed file will have the format:
  51.      'LH',int(decompressed length),int(compressed length),int(CHECKSUM),data. .
  52.  
  53.     Special illustrated files which are used optionally by P-Reader precede
  54.    this sequence with 'PREx' where x is 0 for a PAL file and 1 for an NTSC file
  55.    The two C examples remove this precursor, if present; this extra code may be
  56.    omitted if your programme is not going to meet such files.
  57.  
  58.     I have chosen to work from file to file rather than from memory to memory
  59.    because this saves the caller from measuring file lengths, allocating
  60.    memory, copying to final destination, and because a file provides a more
  61.    stable base for any further processing.  Where the output forms an inter-
  62.    mediate stage in your programme the output file will normally be a 
  63.    temporary file in RAM, however in low-memory situations it can be placed
  64.    anywhere.  All inputs and outputs are fully buffered.
  65.  
  66.     That's all - no special libraries, pragmas, glue or bother - the simplest
  67.    possible approach.
  68.  
  69.   Chas A. Wyndham
  70.