i know this method was used in Commando (except not adding but xoring like the tape routine does)
IM2 corrupting stack-based redraw
- Lethargeek
- Manic Miner
- Posts: 743
- Joined: Wed Dec 11, 2019 6:47 am
-
- Manic Miner
- Posts: 401
- Joined: Fri Jan 03, 2020 10:00 am
Re: IM2 corrupting stack-based redraw
If you use just ld:push technique all you need is to restore two bytes on the screen (or restore sp before drawing them).
If you use pop hl:ld (),hl technique, your interrupt routine just needs to push hl back to the stack.
pop:push technique is not that good, you must thoroughly compare t-states even with ldi (because of complex loop code).
If you unroll the loop, ld:push is faster. The fastest method with memory contention might be ld bc:ld de:ld hl:push bc:push de:push hl.
If you use pop hl:ld (),hl technique, your interrupt routine just needs to push hl back to the stack.
pop:push technique is not that good, you must thoroughly compare t-states even with ldi (because of complex loop code).
If you unroll the loop, ld:push is faster. The fastest method with memory contention might be ld bc:ld de:ld hl:push bc:push de:push hl.