aboutsummaryrefslogtreecommitdiffstats
path: root/src/hram.asm
diff options
context:
space:
mode:
Diffstat (limited to 'src/hram.asm')
-rw-r--r--src/hram.asm5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/hram.asm b/src/hram.asm
index 7c1910c..9e65982 100644
--- a/src/hram.asm
+++ b/src/hram.asm
@@ -31,6 +31,9 @@ LOAD "hram_code", HRAM
; Runs from HRAM. Saves/restores full context. Clobbers everything.
; ---------------------------------------------------------------------------
hSwitchTo::
+ di ; no tick ISR while SP and the banks under it
+ ; are out of sync (pushes would hit the wrong
+ ; bank); ei below once the incoming stack is up
; stash target while DE is still valid
ld a, e
ld [hSwitchTgt], a
@@ -114,6 +117,8 @@ hSwitchTo::
ld sp, hl
; --- pop incoming context and resume it ---
+ ei ; SP + banks consistent again (takes effect
+ ; after the next instruction)
pop hl
pop de
pop bc