Hi,
My interrupt management routine checks for the F1 key in order to put the game in pause. During that pause, I can press several keys in order to do "developer's" actions : view VRAM pages, enable/disable sprites, ... (within DI/EI opcodes).
I'd like to add a action key that would change levels within the game.
But this is a major branching process ... And it implies to get out of the interrupt routine quite cleanly.
My main game loop is as such :
L1: call LEVEL1 L2: call LEVEL2 ...
What I have in mind is something like this (for example here a change from level 1 to level 2) :
change_level: ; called from PAUSE routine (which is called from my main interrupt routine) ... pop hl ; erases the last call (change_level) from SP pop hl ; erases the last call (PAUSE) from SP pop hl ; erases the last call (H.TIMI) from SP (since I put a "jp INTERRUPT" in that hook) pop hl ; erases the last call (RST $38) from SP (but is this necessary ?) pop hl ; erases the last call (LEVEL1) from SP ld hl,L2 ; let's go for a change to level 2 ex (sp),hl ei jp LEVEL2
What do you think 
I guess I'll also have to add the "pop all registers" which will be missing from the last lines of the $38 routine ... 
EDIT : Yeah ... But what about all the calls made within the LEVEL1 routine ? Impossible to know about all of 'em ...

