diff options
| author | Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> | 2025-11-18 21:17:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-18 15:17:31 -0500 |
| commit | f3326786259f4e53c06b7565369add7605bea8ba (patch) | |
| tree | 1e09025ed19a6403fa74c408aa195662178cc0ca /home/vcopy.asm | |
| parent | Add `_vc` patch targets to `.PHONY` (diff) | |
| download | pokeyellow-f3326786259f4e53c06b7565369add7605bea8ba.tar.gz pokeyellow-f3326786259f4e53c06b7565369add7605bea8ba.tar.xz pokeyellow-f3326786259f4e53c06b7565369add7605bea8ba.zip | |
Use more hardware and graphics constants (#532)
- Use `OBJ_SIZE` and `TILE_SIZE` from hardware.inc.
- `SPRITESTATEDATA1_LENGTH`, `NUM_SPRITESTATEDATA_STRUCTS`
and `TILE_1BPP_SIZE` are used in some places.
- Highlight an oversight in `OakSpeech` where several
direct MBC bank switches are requested.
- Remove redundant comments in home/overworld.asm.
- Add unreferenced `FillBgMap` function to avoid a byte
of dead code.
- Some constants added in wram.asm.
- Correctly separate the commented code in `SaveMainData`.
Diffstat (limited to 'home/vcopy.asm')
| -rw-r--r-- | home/vcopy.asm | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/home/vcopy.asm b/home/vcopy.asm index 8ae9484a..cf4c3e6c 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -20,9 +20,14 @@ GetRowColAddressBgMap:: ; INPUT: h - high byte of background tile map address in VRAM ClearBgMap:: ld a, ' ' - jr .next + jr FillBgMapCommon + +; fills a VRAM background map with tile index in register l +; INPUT: h - high byte of background tile map address in VRAM +FillBgMap:: ; unreferenced ld a, l -.next + +FillBgMapCommon: ld de, TILEMAP_AREA ld l, e .loop @@ -69,8 +74,8 @@ RedrawRowOrColumn:: .noCarry ; the following 4 lines wrap us from bottom to top if necessary ld a, d - and $3 - or $98 + and HIGH(TILEMAP_AREA - 1) + or HIGH(vBGMap0) ld d, a dec c jr nz, .loop1 @@ -86,7 +91,7 @@ RedrawRowOrColumn:: push de call .DrawHalf ; draw upper half pop de - ld a, TILEMAP_WIDTH ; width of VRAM background map + ld a, TILEMAP_WIDTH add e ld e, a ; fall through and draw lower half @@ -102,10 +107,10 @@ RedrawRowOrColumn:: ld a, e inc a ; the following 6 lines wrap us from the right edge to the left edge if necessary - and $1f + and %11111 ld b, a ld a, e - and $e0 + and %11100000 or b ld e, a dec c @@ -134,7 +139,7 @@ AutoBgMapTransfer:: dec a jr z, .transferMiddleThird .transferBottomThird - hlcoord 0, 12 + hlcoord 0, 2 * SCREEN_HEIGHT / 3 ld sp, hl ldh a, [hAutoBGTransferDest + 1] ld h, a @@ -154,7 +159,7 @@ AutoBgMapTransfer:: ld a, TRANSFERMIDDLE jr .doTransfer .transferMiddleThird - hlcoord 0, 6 + hlcoord 0, SCREEN_HEIGHT / 3 ld sp, hl ldh a, [hAutoBGTransferDest + 1] ld h, a @@ -165,7 +170,7 @@ AutoBgMapTransfer:: ld a, TRANSFERBOTTOM .doTransfer ldh [hAutoBGTransferPortion], a ; store next portion - ld b, 6 + ld b, SCREEN_HEIGHT / 3 TransferBgRows:: ; unrolled loop and using pop for speed @@ -390,7 +395,7 @@ UpdateMovingBgTiles:: ; water ld hl, vTileset tile $14 - ld c, $10 + ld c, TILE_SIZE ld a, [wMovingBGTilesCounter2] inc a @@ -435,7 +440,7 @@ UpdateMovingBgTiles:: ld hl, FlowerTile3 .copy ld de, vTileset tile $03 - ld c, $10 + ld c, TILE_SIZE .loop ld a, [hli] ld [de], a |
