File squeezer Jim Lopushinsky Edmonton, Alberta, Canada February 16, 1984 SQ has now been rewritten in assembly language. As you will see, it operates much faster than the old SQ program. SQ is now 8080 compatable. The program writer can utilize the squeezer by searching SQLIB in the link step. Only 2 external refrences are needed: SQINIT: This is the analysis phase. SQ reads the input file, and analyzes the file for squeezing. Input: Register HL contains the address of a scratch pad for SQ. This area of ram must be at least 3072 (0C00h) bytes. Output: Register A has the return code: 0 No errors 1 Input file is already squeezed 2 Input file is empty 3 Squeezed file will be larger then the input file. 4 Squeeze table or bit length overflow. Register HL contains the size (in sectors) of the squeezed file. Register DE contains the size (in sectors) of the input file. SQ: This is the squeeze subroutine. It reads the input file again, and writes the squeezed file. Input: Register HL contains the address of the FCB for the original file (so that it can write the filename in the squeezed file). Output: Register A has the return code: 0 No errors 1 Abnormal EOF when reading the input file a second time. SQINIT itself has 5 external refrences, 3 of which are resolved in SQLIB. The 3 refrences in SQLIB are: MPBMUL Multi-byte binary multiplication MPBDIV Multi-byte binary division MPLSR Multi-byte logical shift right SQINIT requires 2 external refrences from the calling program for byte read and byte write. These 2 subroutines are called from SQINIT and SQ to input unsqueezed characters, and to output squeezed bytes. The 2 subroutines do not have to preserve any registers, and must return control with a RET instruction. RDBYTE: This the byte input subroutine. One byte of data is passed back with each call to RDBYTE. Input: none. Output: Register A contains a byte of data for squeezing. Z flag clear (NZ true): byte of data passed. Z flag set (Z true): end of file reached. WRBYTE: This is the byte output subroutine. One byte of data is passed to WRBYTE with each call. Input: Register A contains a squeezed byte of data. Output: none. The WRBYTE subroutine must perform its own error recovery or termination. The main program should do the following: 1. Open the input file 2. Call SQINIT 3. Check for error return from SQINIT 4. Re-open the input file 5. Open the output file 6. Call SQ 7. Check for error return from SQ 8. Close the output file If there are any questions or comments, I can be reached at: (403) 484-5981 6:00 pm - 10:00 am @ 300/1200 baud