diff options
Diffstat (limited to 'home/vcopy.asm')
-rw-r--r-- | home/vcopy.asm | 68 |
1 files changed, 21 insertions, 47 deletions
diff --git a/home/vcopy.asm b/home/vcopy.asm index b7fb099e..2974dfec 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -33,13 +33,13 @@ ClearBgMap:: jr nz,.loop ret -RedrawRowOrColumn:: ; This function redraws a BG row of height 2 or a BG column of width 2. ; One of its main uses is redrawing the row or column that will be exposed upon ; scrolling the BG when the player takes a step. Redrawing only the exposed ; row or column is more efficient than redrawing the entire screen. ; However, this function is also called repeatedly to redraw the whole screen ; when necessary. It is also used in trade animation and elevator code. +RedrawRowOrColumn:: ld a,[hRedrawRowOrColumnMode] and a ret z @@ -123,11 +123,7 @@ AutoBgMapTransfer:: ld a,[H_AUTOBGTRANSFERENABLED] and a ret z - ld hl,[sp + 0] - ld a,h - ld [H_SPTEMP],a - ld a,l - ld [H_SPTEMP + 1],a ; save stack pinter + ld [H_SPTEMP],sp ; save stack pinter ld a,[H_AUTOBGTRANSFERPORTION] and a jr z,.transferTopThird @@ -193,9 +189,9 @@ TransferBgRows:: jr nz, TransferBgRows ld a, [H_SPTEMP] - ld h, a - ld a, [H_SPTEMP + 1] ld l, a + ld a, [H_SPTEMP + 1] + ld h, a ld sp, hl ret @@ -205,11 +201,7 @@ VBlankCopyBgMap:: ld a,[H_VBCOPYBGSRC] ; doubles as enabling byte and a ret z - ld hl,[sp + 0] - ld a,h - ld [H_SPTEMP],a - ld a,l - ld [H_SPTEMP + 1],a ; save stack pointer + ld [H_SPTEMP],sp ; save stack pointer ld a,[H_VBCOPYBGSRC] ld l,a ld a,[H_VBCOPYBGSRC + 1] @@ -238,11 +230,7 @@ VBlankCopyDouble:: and a ret z - ld hl, [sp + 0] - ld a, h - ld [H_SPTEMP], a - ld a, l - ld [H_SPTEMP + 1], a + ld [H_SPTEMP],sp ; save stack pointer ld a, [H_VBCOPYDOUBLESRC] ld l, a @@ -285,21 +273,14 @@ VBlankCopyDouble:: dec b jr nz, .loop - ld a, l - ld [H_VBCOPYDOUBLEDEST], a - ld a, h - ld [H_VBCOPYDOUBLEDEST + 1], a - - ld hl, [sp + 0] - ld a, l - ld [H_VBCOPYDOUBLESRC], a - ld a, h - ld [H_VBCOPYDOUBLESRC + 1], a + ld [H_VBCOPYDOUBLESRC],sp + ld sp,hl ; load destination into sp to save time with ld [$xxxx],sp + ld [H_VBCOPYDOUBLEDEST], sp ld a, [H_SPTEMP] - ld h, a - ld a, [H_SPTEMP + 1] ld l, a + ld a, [H_SPTEMP + 1] + ld h, a ld sp, hl ret @@ -316,11 +297,7 @@ VBlankCopy:: and a ret z - ld hl, [sp + 0] - ld a, h - ld [H_SPTEMP], a - ld a, l - ld [H_SPTEMP + 1], a + ld [H_SPTEMP],sp ld a, [H_VBCOPYSRC] ld l, a @@ -355,21 +332,14 @@ VBlankCopy:: dec b jr nz, .loop - ld a, l - ld [H_VBCOPYDEST], a - ld a, h - ld [H_VBCOPYDEST + 1], a - - ld hl, [sp + 0] - ld a, l - ld [H_VBCOPYSRC], a - ld a, h - ld [H_VBCOPYSRC + 1], a + ld [H_VBCOPYSRC],sp + ld sp,hl + ld [H_VBCOPYDEST],sp ld a, [H_SPTEMP] - ld h, a - ld a, [H_SPTEMP + 1] ld l, a + ld a, [H_SPTEMP + 1] + ld h, a ld sp, hl ret @@ -383,6 +353,10 @@ UpdateMovingBgTiles:: and a ret z ; no animations if indoors (or if a menu set this to 0) + ld a,[rLY] + cp $90 ; check if not in vblank period??? (maybe if vblank is too long) + ret c + ld a, [hMovingBGTilesCounter1] inc a ld [hMovingBGTilesCounter1], a |