diff options
author | ElectroDeoxys <ElectroDeoxys@gmail.com> | 2021-09-29 09:02:02 +0100 |
---|---|---|
committer | ElectroDeoxys <ElectroDeoxys@gmail.com> | 2021-09-29 09:02:02 +0100 |
commit | bae47106f18266d2c3b97b6d954b91d9b16c0ccf (patch) | |
tree | 4d1a24de37ddb1b22ff22991a275fca351a3651d /src/engine/gfx | |
parent | b0487fa979d0b5f3241e9e0659dd4b29a7e38f18 (diff) |
Reorganise some folders in engine/
Diffstat (limited to 'src/engine/gfx')
-rw-r--r-- | src/engine/gfx/sprite_vblank.asm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/engine/gfx/sprite_vblank.asm b/src/engine/gfx/sprite_vblank.asm new file mode 100644 index 0000000..5f099a1 --- /dev/null +++ b/src/engine/gfx/sprite_vblank.asm @@ -0,0 +1,39 @@ +; empties screen and replaces +; wVBlankFunctionTrampoline with HandleAllSpriteAnimations +SetSpriteAnimationsAsVBlankFunction: + call EmptyScreen + call Set_OBJ_8x8 + call Func_3ca4 + lb de, $38, $7f + call SetupText + ld hl, wVBlankFunctionTrampoline + 1 + ld de, wVBlankFunctionTrampolineBackup + call BackupVBlankFunctionTrampoline + di + ld [hl], LOW(HandleAllSpriteAnimations) + inc hl + ld [hl], HIGH(HandleAllSpriteAnimations) + ei + ret + +; sets backup VBlank function as wVBlankFunctionTrampoline +RestoreVBlankFunction: + ld hl, wVBlankFunctionTrampolineBackup + ld de, wVBlankFunctionTrampoline + 1 + call BackupVBlankFunctionTrampoline + call Func_3ca4 + bank1call ZeroObjectPositionsAndToggleOAMCopy + ret + +; copies 2 bytes from hl to de while interrupts are disabled +; used to load or store wVBlankFunctionTrampoline +; to wVBlankFunctionTrampolineBackup +BackupVBlankFunctionTrampoline: + di + ld a, [hli] + ld [de], a + inc de + ld a, [hld] + ld [de], a + ei + ret |