IM2 corrupting stack-based redraw

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
Lethargeek
Manic Miner
Posts: 743
Joined: Wed Dec 11, 2019 6:47 am

Re: IM2 corrupting stack-based redraw

Post by Lethargeek »

djnzx48 wrote: Mon Aug 19, 2019 12:37 amThere was a method described in that thread of using checksums to restore the corrupted data, which could potentially be a solution for copying the screen.
i know this method was used in Commando (except not adding but xoring like the tape routine does)
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: IM2 corrupting stack-based redraw

Post by Alone Coder »

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.
Post Reply