XipZ
Mini packer ▶►▸ for small programs.
Macros | Functions
qadz.cc File Reference

LZ77-like compression routine. More...

#include <algorithm>
#include <fstream>
#include <iostream>
#include <iterator>
#include <vector>
#include <boost/format.hpp>
#include <stdio.h>
#include <stdint.h>
#include <limits.h>
#include "data.hh"
#include "decrunchqadzstub.inc"
Include dependency graph for qadz.cc:

Go to the source code of this file.

Macros

#define LOOK_BACK   255
 
#define MAX_LEN   128
 
#define MAX_PLAIN_LEN   127
 

Functions

int decrunch_main (int argc, char **argv)
 
std::ostream & write_qadz_stub (std::ostream &out, uint16_t size, uint16_t loadaddr, uint16_t jmp)
 write the decrunch stub More...
 
std::vector< uint8_t > crunch_qadz (const Data &data)
 

Detailed Description

LZ77-like compression routine.

Simpe LZ77 like compression routine. It is optimised to use while bytes as using nybbles is quite expensinve on an architecture like the 6502. This makes LZ4 painful.

Definition in file qadz.cc.

Function Documentation

◆ crunch_qadz()

std::vector<uint8_t> crunch_qadz ( const Data data)

Compress data using the LZ77-alike compression.

Parameters
databinary data to compress
Returns
compressed data

< temporary buffer to collect plain tokens

Definition at line 114 of file qadz.cc.

◆ write_qadz_stub()

std::ostream& write_qadz_stub ( std::ostream &  out,
uint16_t  size,
uint16_t  loadaddr,
uint16_t  jmp 
)

write the decrunch stub

The decrunching stub is written and all parameters like decrunching address and jump address are adjusted. Please take care to adjust all the defines above otherwise the code will probably just crash. It may also fry your cat so be careful!

Parameters
outoutput stream to write to
sizenumber of compressed bytes
loadaddroriginal load address of the data
jmpjump address to jump after decrunching
Returns
output stream

Definition at line 72 of file qadz.cc.