Skip to content

Commit

Permalink
Document sLevelBlockObjectMap
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroDeoxys committed May 20, 2024
1 parent faa6f91 commit 0b2cccd
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 27 deletions.
30 changes: 15 additions & 15 deletions src/engine/bank2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ REPT 11
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, :+
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1043,7 +1043,7 @@ ENDR
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, .asm_a562
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1077,7 +1077,7 @@ REPT 10
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, :+
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1151,7 +1151,7 @@ REPT 11
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, :+
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1209,7 +1209,7 @@ Func_aa2d:
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, .asm_aa67
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1243,7 +1243,7 @@ Func_aa2d:
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, :+
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1314,7 +1314,7 @@ REPT 11
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, :+
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1364,7 +1364,7 @@ Func_af1f:
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, .asm_af51
ld h, HIGH(STARTOF(SRAM))
ld h, HIGHsLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1397,7 +1397,7 @@ REPT 10
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, :+
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1469,7 +1469,7 @@ REPT 11
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, :+
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1525,7 +1525,7 @@ Func_b405:
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, .asm_b43e
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -1558,7 +1558,7 @@ REPT 10
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, :+
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wSRAMBank]
inc a
sramswitch
Expand Down Expand Up @@ -2395,7 +2395,7 @@ Func_bb85:
ld [wBlockPtrBank], a
sramswitch
push hl
call GetBlockPtrPtrBGMapAddress
call GetBlockPtrBGMapAddress
ld a, [wBGMapAddressQueueSize]
ld b, a
ld de, wBGMapAddressQueue
Expand Down Expand Up @@ -2550,7 +2550,7 @@ UpdateSwitchableBlocks:
push af
ld a, BANK("SRAM1")
sramswitch
ld hl, s1a000
ld hl, sLevelBlockObjectMap
.loop_1
ld a, [hli]
and $7f
Expand Down Expand Up @@ -2609,7 +2609,7 @@ UpdateSwitchableBlocks:
push af
ld a, BANK("SRAM1")
sramswitch
ld hl, s1a000
ld hl, sLevelBlockObjectMap
.loop_3
ld a, [hli]
and $7f
Expand Down
2 changes: 1 addition & 1 deletion src/engine/bank7c.asm
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ CalculateBackupSRAMChecksum1:
push af
ld a, BANK("SRAM1")
sramswitch
ld hl, s1a000
ld hl, sLevelBlockObjectMap
ld de, 0
ld bc, SIZEOF(SRAM)
.loop_sram_1
Expand Down
2 changes: 1 addition & 1 deletion src/engine/level/spawn_edge.asm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ SpawnRowEdgeObjects:
ld a, h
cp $c0
jr nz, .skip_incr_srambank
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wBlockPtrBank]
inc a
ld [wBlockPtrBank], a
Expand Down
6 changes: 3 additions & 3 deletions src/engine/level/start_room.asm
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ ProcessMultiBlock:
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
ld a, [wcedb]
jr nz, .no_wrap_1
ld a, HIGH(STARTOF(SRAM))
ld a, HIGH(sLevelBlockObjectMap)
ld h, a
ld [wBlockPtr + 0], a
ld a, [wcedb]
Expand Down Expand Up @@ -585,7 +585,7 @@ Func_896f:
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, .asm_89de
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wccec]
inc a
ld [wccec], a
Expand Down Expand Up @@ -716,7 +716,7 @@ SetWarioPositionToSpawn:
ld a, h
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr nz, .asm_8a77
ld h, HIGH(STARTOF(SRAM))
ld h, HIGH(sLevelBlockObjectMap)
ld a, [wccec]
inc a
ld [wccec], a
Expand Down
8 changes: 4 additions & 4 deletions src/home/home1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GetBlockPtr::
add b

ld b, BANK("SRAM1")
add HIGH(STARTOF(SRAM))
add HIGH(sLevelBlockObjectMap)
cp HIGH(STARTOF(SRAM) + SIZEOF(SRAM))
jr c, .got_sram_bank
inc b
Expand Down Expand Up @@ -49,7 +49,7 @@ GetBlockPtr::
ret

; hl = block ptr
GetBlockPtrPtrBGMapAddress::
GetBlockPtrBGMapAddress::
ld a, h
sub HIGH(STARTOF(SRAM))
ld e, a
Expand Down Expand Up @@ -586,8 +586,8 @@ Func_f13::
ret

.Decompress
ld c, $a0
ld hl, s1a000
ld c, LEVEL_WIDTH
ld hl, sLevelBlockObjectMap
.loop_data
ld a, [de]
and a
Expand Down
4 changes: 2 additions & 2 deletions src/home/load_level.asm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DecompressLevelBlockMap::
; each row is 160 blocks wide
.Decompress:
ld c, LEVEL_WIDTH
ld de, s1a000
ld de, sLevelBlockObjectMap
.loop_data
ld a, [hli]
and a
Expand Down Expand Up @@ -120,7 +120,7 @@ DecompressLevelObjectMap::
add $b0
dec a
ld c, a ; (LEVEL_WIDTH / 2) + $b0 - 1
ld de, s1a000 + $b0
ld de, sLevelBlockObjectMap + $b0
.loop_data
ld a, [hli]
and a
Expand Down
5 changes: 4 additions & 1 deletion src/sram.asm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ s0aff8:: ; aff8

SECTION "SRAM1", SRAM

s1a000:: ; a000
; map is seperated into LEVEL_WIDTH wide rows of blocks
; followed by (LEVEL_WIDTH / 2) wide rows of objects
; these are interleaved with each other for each row
sLevelBlockObjectMap:: ; a000
ds $2000

SECTION "SRAM2", SRAM
Expand Down

0 comments on commit 0b2cccd

Please sign in to comment.