aboutsummaryrefslogtreecommitdiffstats
path: root/home/uncompress.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/uncompress.asm')
-rw-r--r--home/uncompress.asm19
1 files changed, 12 insertions, 7 deletions
diff --git a/home/uncompress.asm b/home/uncompress.asm
index 0e609f1c..9e434497 100644
--- a/home/uncompress.asm
+++ b/home/uncompress.asm
@@ -1,3 +1,8 @@
+; wSpriteLoadFlags bits, streamed from compressed sprite data
+ const_def
+ const BIT_USE_SPRITE_BUFFER_2 ; 0
+ const BIT_LAST_SPRITE_CHUNK ; 1
+
; bankswitches and runs _UncompressSpriteData
; bank is given in a, sprite input stream is pointed to in wSpriteInputPtr
UncompressSpriteData::
@@ -47,7 +52,7 @@ _UncompressSpriteData::
add a
ld [wSpriteWidth], a
call ReadNextInputBit
- ld [wSpriteLoadFlags], a ; initialite bit1 to 0 and bit0 to the first input bit
+ ld [wSpriteLoadFlags], a ; initialize bit1 to 0 and bit0 to the first input bit
; this will load two chunks of data to sSpriteBuffer1 and sSpriteBuffer2
; bit 0 decides in which one the first chunk is placed
; fall through
@@ -58,13 +63,13 @@ _UncompressSpriteData::
UncompressSpriteDataLoop::
ld hl, sSpriteBuffer1
ld a, [wSpriteLoadFlags]
- bit 0, a
+ bit BIT_USE_SPRITE_BUFFER_2, a
jr z, .useSpriteBuffer1 ; check which buffer to use
ld hl, sSpriteBuffer2
.useSpriteBuffer1
call StoreSpriteOutputPointer
ld a, [wSpriteLoadFlags]
- bit 1, a
+ bit BIT_LAST_SPRITE_CHUNK, a
jr z, .startDecompression ; check if last iteration
call ReadNextInputBit ; if last chunk, read 1-2 bit unpacking mode
and a
@@ -196,10 +201,10 @@ MoveToNextBufferPosition::
xor a
ld [wSpriteCurPosX], a
ld a, [wSpriteLoadFlags]
- bit 1, a
+ bit BIT_LAST_SPRITE_CHUNK, a
jr nz, .done ; test if there is one more sprite to go
- xor $1
- set 1, a
+ xor 1 << BIT_USE_SPRITE_BUFFER_2
+ set BIT_LAST_SPRITE_CHUNK, a
ld [wSpriteLoadFlags], a
jp UncompressSpriteDataLoop
.done
@@ -540,7 +545,7 @@ ReverseNybble::
; resets sprite buffer pointers to buffer 1 and 2, depending on wSpriteLoadFlags
ResetSpriteBufferPointers::
ld a, [wSpriteLoadFlags]
- bit 0, a
+ bit BIT_USE_SPRITE_BUFFER_2, a
jr nz, .buffer2Selected
ld de, sSpriteBuffer1
ld hl, sSpriteBuffer2