diff options
Diffstat (limited to 'src/wram.asm')
-rw-r--r-- | src/wram.asm | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/src/wram.asm b/src/wram.asm index 85c839b..e5f8b9c 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -15,6 +15,22 @@ NEXTU wc000:: ; c000 ds $100 +NEXTU + +; aside from wDecompressionBuffer, which stores the +; de facto final decompressed data after decompression, +; this buffer stores a secondary buffer that is used +; for "lookbacks" when repeating byte sequences. +; actually starts in the middle of the buffer, +; at wDecompressionSecondaryBufferStart, then wraps back up +; to wDecompressionSecondaryBuffer. +; this is used so that $00 can be "looked back", since anything +; before $ef is initialized to 0 when starting decompression. +wDecompressionSecondaryBuffer:: ; c000 + ds $ef +wDecompressionSecondaryBufferStart:: ; ; c0ef + ds $11 + ENDU ds $100 @@ -543,30 +559,48 @@ wDoFrameFunction:: ; cad3 wcad5:: ; cad5 ds $1 -wcad6:: ; cad6 +; pointer to keep track of where +; in the source data we are while +; running the decompression algorithm +wDecompSourcePosPtr:: ; cad6 ds $2 -wcad8:: ; cad8 +; number of bits that are still left +; to read from the current command byte +wDecompNumCommandBitsLeft:: ; cad8 ds $1 -wcad9:: ; cad9 +; command byte from which to read the bits +; to decompress source data +wDecompCommandByte:: ; cad9 ds $1 -wcada:: ; cada +; if bit 7 is changed from off to on, then +; decompression routine will read next two bytes +; for repeating previous sequence (num of bytes, offset) +; if changes from off to on, then the routine +; will only read one byte, and reuse previous num of bytes +wDecompRepeatModeToggle:: ; cada ds $1 -wcadb:: ; cadb +; stores in both nybbles the length of the +; sequences to copy in decompression +; the high nybble is used first, then the low nybble +; for a subsequent sequence repition +wDecompRepeatLengths:: ; cadb ds $1 -wcadc:: ; cadc +wDecompNumBytesToRepeat:: ; cadc ds $1 -wcadd:: ; cadd +wDecompSecondaryBufferPtrHigh:: ; cadd ds $1 -wcade:: ; cade +; offset to repeat byte from decompressed data +wDecompRepeatSeqOffset:: ; cade ds $1 +wDecompSecondaryBufferPtrLow:: ; cadf ds $1 wTempSGBPacket:: ; cae0 |