[A83] Re: _getkey and turning the calc off


[Prev][Next][Index][Thread]

[A83] Re: _getkey and turning the calc off




> Van: Perpendicular Universe <vadmium@hotmail.com>

Someone is thinking here that he's the universe who's talking?

> Is there any way of preventing someone turning the calculator off in the 
> _getkey routine, or even better, making the calculator free my program's 
> memory before it turns off?

You could install an interrupt... But I have to say that it could be a bit
difficult if you are a starting programmer. Basicaly what you have to do
is:

Make the TIOS believe that [ON] hasn't been pressed, I guess you can do
that with "res oninterrupt,(iy+onflags)". And then you'll have to do a "JP
$0038". As far as I know it has been done before, especialy in SOS (and
older) programs. You might want to take a look in the 'routines' directory
on Ticalc if there are/is already (some) interrupt routine(s) available
that does the job.

What SOS (the shell itself) does:

interrupt_start:
	ex	af,af'
	in	a,(3)
	rra
	jr	nc,on_not_pressed
	res	3,(iy+18)
on_not_pressed:
	jp	$0039	; skip ex af,af' in TIOS interrupt.

About the "res 3,(iy+18)": sysflags.txt (from flagscan v1.0) says
"Unknown"...

> I have made a fairly large program which uses the ROM call _getkey
> (address 4CFEh). When you press [2nd] [OFF] in the middle of the
> program to turn the calc off, and then turn it back on, the screen comes
> up the same but it isn't in my program: it's in the "home screen" mode.
> I can live with that, but what I don't like is each time someone turns
> it off like this the memory available goes down and I dunno how to free
> it back up without resetting the calc.

Another solution to your problem is to program for Venus, when you there
"crash back to the prompt" you only lose the memory occupied by prgm0
(theta) that's about 3 bytes. Plus your program can be executed
'transparently', so just like it was a BASIC programs.

Download Venus.zip (I've seen the newest version 1.5 at calc.org yesterday)
there's a file called "devinfo.txt", it will explain to you what to the
format of the Venus header is.

	Henk Poley <><