diff options
Diffstat (limited to 'home/decompress.asm')
-rw-r--r-- | home/decompress.asm | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/home/decompress.asm b/home/decompress.asm index 216b861f6..d4bab7a6a 100644 --- a/home/decompress.asm +++ b/home/decompress.asm @@ -1,4 +1,4 @@ -FarDecompress:: ; b40 +FarDecompress:: ; Decompress graphics data from a:hl to de. ld [wLZBank], a @@ -12,19 +12,15 @@ FarDecompress:: ; b40 pop af rst Bankswitch ret -; b50 - -Decompress:: ; b50 +Decompress:: ; Pokemon Crystal uses an lz variant for compression. ; This is mainly (but not necessarily) used for graphics. ; This function decompresses lz-compressed data from hl to de. - LZ_END EQU $ff ; Compressed data is terminated with $ff. - ; A typical control command consists of: LZ_CMD EQU %11100000 ; command id (bits 5-7) @@ -32,7 +28,6 @@ LZ_LEN EQU %00011111 ; length n (bits 0-4) ; Additional parameters are read during command execution. - ; Commands: LZ_LITERAL EQU 0 << 5 ; Read literal data for n bytes. @@ -40,7 +35,6 @@ LZ_ITERATE EQU 1 << 5 ; Write the same byte for n bytes. LZ_ALTERNATE EQU 2 << 5 ; Alternate two bytes for n bytes. LZ_ZERO EQU 3 << 5 ; Write 0 for n bytes. - ; Another class of commands reuses data from the decompressed output. LZ_RW EQU 2 + 5 ; bit @@ -53,7 +47,6 @@ LZ_REPEAT EQU 4 << 5 ; Repeat n bytes from the offset. LZ_FLIP EQU 5 << 5 ; Repeat n bitflipped bytes. LZ_REVERSE EQU 6 << 5 ; Repeat n bytes in reverse. - ; If the value in the count needs to be larger than 5 bits, ; LZ_LONG can be used to expand the count to 10 bits. LZ_LONG EQU 7 << 5 @@ -68,10 +61,8 @@ LZ_LONG_HI EQU %00000011 ; x: the new control command ; y: the length - ; For more information, refer to the code below and in extras/gfx.py. - ; Save the output address ; for rewrite commands. ld a, e @@ -113,7 +104,6 @@ LZ_LONG_HI EQU %00000011 inc bc jr .command - .short push af @@ -125,7 +115,6 @@ LZ_LONG_HI EQU %00000011 ; read at least 1 byte inc c - .command ; Increment loop counts. ; We bail the moment they hit 0. @@ -144,7 +133,6 @@ LZ_LONG_HI EQU %00000011 cp LZ_ZERO jr z, .Zero - .Literal: ; Read literal data for bc bytes. .lloop @@ -159,7 +147,6 @@ LZ_LONG_HI EQU %00000011 inc de jr .lloop - .Iter: ; Write the same byte for bc bytes. ld a, [hli] @@ -175,7 +162,6 @@ LZ_LONG_HI EQU %00000011 inc de jr .iloop - .Alt: ; Alternate two bytes for bc bytes. dec c @@ -205,7 +191,6 @@ LZ_LONG_HI EQU %00000011 inc hl jr .Main - .Zero: ; Write 0 for bc bytes. xor a @@ -221,7 +206,6 @@ LZ_LONG_HI EQU %00000011 inc de jr .zloop - .rewrite ; Repeat decompressed data from output. push hl @@ -275,7 +259,6 @@ LZ_LONG_HI EQU %00000011 ; More practically, LZ_LONG is not recursive. ; For now, it defaults to LZ_REPEAT. - .Repeat: ; Copy decompressed data for bc bytes. dec c @@ -289,7 +272,6 @@ LZ_LONG_HI EQU %00000011 inc de jr .Repeat - .Flip: ; Copy bitflipped decompressed data for bc bytes. dec c @@ -315,7 +297,6 @@ LZ_LONG_HI EQU %00000011 inc de jr .Flip - .Reverse: ; Copy reversed decompressed data for bc bytes. dec c @@ -330,7 +311,6 @@ LZ_LONG_HI EQU %00000011 inc de jr .Reverse - .donerw pop hl @@ -340,4 +320,3 @@ LZ_LONG_HI EQU %00000011 .next inc hl jp .Main -; c2f |