Re: A83: Re: interrupts


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

Re: A83: Re: interrupts




    Yeah, try that :

        ld hl, $8F01 ; let's put the table there. The 1 stuff is needed !
        ld de, inthand
        ld b, $80    ; put 128 vectors
VECTL:
        ld      (hl),e ; LSB first, as the table starts @ i*256+1
        inc     hl
        ld      (hl),d
        inc     hl
        djnz    VECTL
        ld a, $8f
        ld i, a
        im 2
        ei        ; if you did a di somewhere before, else don't need

( code from movax )

Using this you won't have to let your int handler at a $XYXY address (i.e. $8585
or $9393). You could let it where it was in the code.

Hey, I've made an error in the inthand code :

instead of :
>>    ld a, (hl)            ; check MSB
>>    or a                    ; is it 0 ?

it should have been :
    ld a, (hl)
    dec a

cause when apd counter = $0101, then it does :
    ld hl, $8009
    dec (hl)
    ret nz
    inc hl
    dec (hl)
    ret nz
and then it executes the rest of the apd code.

- Florent

PS :

        Created by:   PKZIP: 2.0 under Amiga
 Needed to extract: PKUNZIP: 2.0

Ah, ok, but I very seldomly run pkunzip -vt ...


-----Message d'origine-----
De : Linus Akesson <lairfight@softhome.net>
À : Florent Dhordain <assembly-83@lists.ticalc.org>
Date : samedi 20 juin 1998 20:04
Objet : 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
>


Follow-Ups: