<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 14 Mar 2010 20:26:39 -0000
From   : dl.harper@... (David Harper)
Subject: Master 128: Hiding a routine from memory clear

samwise wrote:

> I may be way out of my depth (my assembler skills are pretty ropey),
> but I've been trying to catch a Break or Ctrl+Break (once only) and
> basically CHAIN a BASIC program.  Once it has been captured once, the
> routine should be deactivated so that a double break / ctrl-break will
> reset the machine.
>
> The problem is the program (Chuckie Egg) I'm then running sets flag
> &258 which results in a memory clear on Break, clearing out my custom
> routine.

You cannot stop Break wiping main memory on the Master if the flag at &258 
has been set. (This happens early in the Break process, before any calls to 
RAM-based routines are encountered.)

Sideways RAM is not cleared, so you could stick something in one of the 
SW-RAM banks of the Master and trap one of the reset service calls (call &27 
would be the logical one). This would be fiddly to implement, but possible.

At least this is so for MOS version 3.20. I seem to recall having read 
somewhere that in version 3.5 then the memory-clear wipes the SW banks as 
well, but I may be wrong.

Another alternative (other than patching the program so that it doesn't set 
the flag) would be to hide away a little timer-triggered interrupt routine 
that cleared the flag. This could regularly set the flag back to 0 even if a 
program had changed it. This won't work, of course, if the program actually 
checks the flag value and refuses to run if it is wrong.

David Harper 
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>