summaryrefslogtreecommitdiff
path: root/home/decompress.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-06-24 23:22:50 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2018-06-24 23:22:50 -0400
commit67d1364c7acfd5e8e2256080e16a14cfa59a5abc (patch)
treefcf1bcbc2990b8fdeb5d63159d15382a8bdf719a /home/decompress.asm
parent91f914718a263839daef24d44eda857bfc7cca95 (diff)
Fix triple newlines left over from removing address comments
Diffstat (limited to 'home/decompress.asm')
-rw-r--r--home/decompress.asm19
1 files changed, 0 insertions, 19 deletions
diff --git a/home/decompress.asm b/home/decompress.asm
index 104fa0e30..d4bab7a6a 100644
--- a/home/decompress.asm
+++ b/home/decompress.asm
@@ -13,17 +13,14 @@ FarDecompress::
rst Bankswitch
ret
-
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)
@@ -31,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.
@@ -39,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
@@ -52,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
@@ -67,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
@@ -112,7 +104,6 @@ LZ_LONG_HI EQU %00000011
inc bc
jr .command
-
.short
push af
@@ -124,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.
@@ -143,7 +133,6 @@ LZ_LONG_HI EQU %00000011
cp LZ_ZERO
jr z, .Zero
-
.Literal:
; Read literal data for bc bytes.
.lloop
@@ -158,7 +147,6 @@ LZ_LONG_HI EQU %00000011
inc de
jr .lloop
-
.Iter:
; Write the same byte for bc bytes.
ld a, [hli]
@@ -174,7 +162,6 @@ LZ_LONG_HI EQU %00000011
inc de
jr .iloop
-
.Alt:
; Alternate two bytes for bc bytes.
dec c
@@ -204,7 +191,6 @@ LZ_LONG_HI EQU %00000011
inc hl
jr .Main
-
.Zero:
; Write 0 for bc bytes.
xor a
@@ -220,7 +206,6 @@ LZ_LONG_HI EQU %00000011
inc de
jr .zloop
-
.rewrite
; Repeat decompressed data from output.
push hl
@@ -274,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
@@ -288,7 +272,6 @@ LZ_LONG_HI EQU %00000011
inc de
jr .Repeat
-
.Flip:
; Copy bitflipped decompressed data for bc bytes.
dec c
@@ -314,7 +297,6 @@ LZ_LONG_HI EQU %00000011
inc de
jr .Flip
-
.Reverse:
; Copy reversed decompressed data for bc bytes.
dec c
@@ -329,7 +311,6 @@ LZ_LONG_HI EQU %00000011
inc de
jr .Reverse
-
.donerw
pop hl