On Tue, 17 Jan 1995 15:05:16 +0000 (GMT), Steve Taylor said:
> I dunno if anyone's thought of this before,

Yes.  See my sample player which I posted on this list some time ago... ;-)

[snip]

> So, I decided to alter the code to pause for a bit before returning to 
> basic, and junking any return addresses generated by subsequent nmis, 
> avoiding any stack overflow:

>       ORG 62h
> back  OUT (251),A
>       OUT (250),A
> nmi   POP HL          ; junk return address
>       LD  BC,1000h
> loop  DJNZ loop
>       DEC C
>       JR  NZ,loop
>       LD  A,31
>       JR  back

The alternative which the MGT snapshotter uses is to do the delay first
and then clean up the stack (it has to do it this way round in order to
guarantee a safe return to the program that was interrupted).  You have
to press the break button very carefully in order to avoid overflowing
the stack.  ;-)

Unfortunately, it doesn't quite know when to stop with the result that if
you do something like "PRINT USR 102" from a spectrum emulator and then try
to return to it, the thing crashes.  I wrote a slightly better version of it
once (I think it might be on the Syncytium disk).

All of this would have been unnecessary if they had just spent an extra 60p
and installed a proper break button...

imc

Reply via email to