summaryrefslogtreecommitdiff
path: root/home/decompress.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/decompress.asm')
-rw-r--r--home/decompress.asm14
1 files changed, 4 insertions, 10 deletions
diff --git a/home/decompress.asm b/home/decompress.asm
index 1d555529..b1e2ba5e 100644
--- a/home/decompress.asm
+++ b/home/decompress.asm
@@ -19,10 +19,8 @@ Decompress::
; 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)
@@ -30,8 +28,8 @@ 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.
LZ_ITERATE EQU 1 << 5 ; Write the same byte for n bytes.
LZ_ALTERNATE EQU 2 << 5 ; Alternate two bytes for n bytes.
@@ -49,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
@@ -64,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
@@ -75,7 +70,7 @@ LZ_LONG_HI EQU %00000011
ld a, d
ld [wLZAddress + 1], a
-.Main
+.Main:
ld a, [hl]
cp LZ_END
ret z
@@ -95,7 +90,7 @@ LZ_LONG_HI EQU %00000011
add a ; << 3
add a
- ; This is our new control code.
+ ; This is our new control code.
and LZ_CMD
push af
@@ -109,7 +104,6 @@ LZ_LONG_HI EQU %00000011
inc bc
jr .command
-
.short
push af
@@ -139,7 +133,7 @@ LZ_LONG_HI EQU %00000011
cp LZ_ZERO
jr z, .Zero
-.Literal
+.Literal:
; Read literal data for bc bytes.
.lloop
dec c