Re: A86: APD


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

Re: A86: APD




assets@eden.rutgers.edu wrote on Sat, 21 Feb 1998 01:42:54 -0500:
> 
> I think this would be the right code for an interupt:
> 
>         push de
>         push bc
>         push hl
> 
>         in a,(3)
>         bit 3,a
>         jr nz,exit
>         res 3,(iy+8)
>         set 4,(iy+8)
>         call $4101
> exit:
>         pop hl
>         pop bc
>         pop de
>         ret

For some reason this did not work for me at all, although the call to
$4101 was definately being executed.  Perhaps Rom page $0d is not
loaded before the ROM routine is run?

Anyhow, as this counter is the same for both ROM versions the
following interrupt routine should work for everybody (works very well
for me!)

offtime equ 4

 ld hl,$c00a
 ld a,(hl)
 cp offtime+1
 ret c
 ld (hl),offtime
 ret

As opposed to the quoted routine which switches off when pressing
"on", this one just makes the calculator switch off sooner (about 6
seconds - increase the variable "offtime" as you like).

I like it because it is fast and lets the calculator do all the hard
work and is very short & quick to execute.  Its downfall may be
incompatibility with future ROMs, but that's not too bad?

BTW. I have found that writing out to the keyboard port during the
interrupt routine makes the "on" key behave strangely snd that WAIT
commands (or calling routines that WAIT) is not a good idea :)

Thanks all!
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AJD AJD AJD AJD AJD AJD AJD AJD        |
-------------------------------------- |
Anthony J. Doggett                     |
Mailto:Doggett@zetnet.co.uk            |
http://www.users.zetnet.co.uk/doggett/ |
-------------------------------------- |
Life is what you make of it.


References: