Re: A83: Re: interrupts


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

Re: A83: Re: interrupts




On 19-Jun-98, Florent Dhordain wrote:

>    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

How do you install interrupt handlers?  I've been having some ideas about
switching to interrupt mode 2, then having a 256-bytes big table at
9400h-94ffh with 93h all over it, then having the interrupt handler at 9393h,
but is there an easier way?

Linus


References: