aboutsummaryrefslogtreecommitdiffstats
path: root/home
diff options
context:
space:
mode:
authorSylvie <35663410+Rangi42@users.noreply.github.com>2024-09-24 09:33:33 -0400
committerGitHub <noreply@github.com>2024-09-24 09:33:33 -0400
commitb5d2540e7c56d7ae596ba49d105b1a01dd6ffd29 (patch)
treee5cd5ae7b6f06ce33f495ad3ba995761ec93f72f /home
parentFix comment: Road -> Roar (#466) (diff)
downloadpokeyellow-b5d2540e7c56d7ae596ba49d105b1a01dd6ffd29.tar.gz
pokeyellow-b5d2540e7c56d7ae596ba49d105b1a01dd6ffd29.tar.xz
pokeyellow-b5d2540e7c56d7ae596ba49d105b1a01dd6ffd29.zip
Identify more bit flags (#465)
* Identify more bit flags * Space
Diffstat (limited to 'home')
-rw-r--r--home/overworld.asm2
-rw-r--r--home/pokemon.asm2
-rw-r--r--home/serial.asm2
-rw-r--r--home/uncompress.asm19
4 files changed, 15 insertions, 10 deletions
diff --git a/home/overworld.asm b/home/overworld.asm
index e43ebc81..85969e46 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -2002,7 +2002,7 @@ LoadPlayerSpriteGraphicsCommon::
jr nc, .noCarry
inc d
.noCarry
- set 3, h
+ set 3, h ; add $800 ($80 tiles) to hl (1 << 3 == $8)
lb bc, BANK(RedSprite), $0c
jp CopyVideoData
diff --git a/home/pokemon.asm b/home/pokemon.asm
index 54d69bba..7cc5f2d1 100644
--- a/home/pokemon.asm
+++ b/home/pokemon.asm
@@ -252,7 +252,7 @@ HandlePartyMenuInput::
jp nz, .swappingPokemon
pop af
ldh [hTileAnimations], a
- bit 1, b
+ bit BIT_B_BUTTON, b
jr nz, .noPokemonChosen
ld a, [wPartyCount]
and a
diff --git a/home/serial.asm b/home/serial.asm
index f44772df..58111de6 100644
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -30,7 +30,7 @@ Serial::
ldh [rDIV], a
.waitLoop
ldh a, [rDIV]
- bit 7, a
+ bit 7, a ; wait until rDIV has incremented from $3 to $80 or more
jr nz, .waitLoop
ld a, START_TRANSFER_EXTERNAL_CLOCK
ldh [rSC], a
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