A83: Re: interrupts -> for pat


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

A83: Re: interrupts -> for pat




    See inside

-----Message d'origine-----
De : Ian Graf <ian_graf@geocities.com>
Objet : A83: interrupts -> for pat


>
>pat,
>
>sorry to keep bugging you, but i have a few questions...
>
>4) is there a standard address for the calc's off routine (when [2nd] +
>[ON] is pressed) on all versions of the 83's rom? if so, what is the
>address?

dunno

>
>5) what is the address of the apd counter, and is it a byte or a word?
>6) is the calc shut off when the apd counter reaches 0?

It is a word, located at $8009 ( lsb at $8009, msb at $800a). It is initialised
to $74xx ( the xx are left untouched ) every time you press a byte.

And, yeah, the calc shuts off when it reaches 0

>
>i want to know because i want to catch the calc before it apd's and just
>shut it off normally, so the apd buffer won't be altered (i know it can
>be done because i saw it on the 82).
>
>btw, out of curiosity, did you work on any other calc's?
>
>thanks!
>

    During normal asm programs, except when you're using _getkey, the APD is
disabled.

    To catch the apd, you'll have to add an interrupt handler :

inthand:
    exx
    ex af, af'        ; use alternate registers, to prevent any change to normal
ones
    ld hl, $800A
    ld a, (hl)            ; check MSB
    or a                    ; is it 0 ?
    jr nz, normalint    ; no ==> no APD
    dec hl
    ld a, (hl)            ; check LSB
    dec a                ; is it 1 ( you can't check if it is 0, because the
calc would have
                            ; already APD
    jr nz, normalint    ; no ==> no APD

; here, shut off the calc, and some other stuff :
    inc hl
    ld a, $74            ; restore apd counter, so it doesn't run this code
twice
    ld (hl), a
    ld a, $8            ; clear interrupt flip-flops
    out (3), a
    ld a, $1            ; enable only [on] int, turn off lcd
    out (3), a
    pop hl            ; so we'll return to when the int occured
    exx
    ex af, af'           ; restore normal registers, as the [on] press will
cause another int
    ei
    halt

normalint:
    jp $3A        ; jump over the exx & ex af, af'

I haven't tested it, but it should work.

- Florent


Follow-Ups: