[A83] Re: Interrupt troubles [83, Ion]
[Prev][Next][Index][Thread]
[A83] Re: Interrupt troubles [83, Ion]
> Van: Tijl Coosemans <tijlc@hotmail.com>
>
> To clarify: this deals about the 83- (not +)
> (Although I think it's about the same on the 83+. You only have to change
> port 03h by port 04h).
>
> >From: "Henk Poley" <HPoley@DDS.nl>
> >
> >What is the "in/out (3)" stuff needed for, I wanted to write
> >a 'wrapper' for the TIOS interrupt. I have now tried it
> >together with the greyscale interrupt; like this here, but
> >it makes the program drop back to the TIOS:
>
> ...
>
> > in a,(3) ; check on interrupt status
> > rra ;
> > ld a,0 ;
> > adc a,9 ;
> > out (3),a ;
> > ld a,$0B ;
> > out (3),a ;
>
> This part is necessary to *quit* an interrupt properly (at least on ti's
> calcs). But now you continue...
>
> > exx ; Swap to shadow registers.
> > ex af,af ; So the TIOS swaps back to the
> > rst $38 ; normal ones... (the ones we saved
> > ex af,af ; with push/pops)
> > exx ;
previously I used the same code exept for the ex(x)/rst stuff (so I didn't
call the TIOS-int), and then it DID work, but it could off coarse be that
the interrupt-device (the 160Hz..) switches on again after outputting the
mentioned code, maybe it takes some time untill it interrupts again...
> > pop bc ;
> > pop de ;
> > pop hl ;
> > pop af ;
> > ei ;
> > ret ;
>
> Because you call the standard interrupt handler, you don't need the
*quit*
> code (mentioned above), because the standard interrupt handler already
> handles this.
Okay, I've now made a non-grayscale interrupt code that only saves the regs
and then does a RST $38. This time it doesn't drop back to TIOS, it now
displays some garbage on the screen and then crashes (doesn't respond or
anything), it could be that IY is changed in some of the graphics routine
in the program I tested it, although I don't think so...
-----------
im 1 ;
res 6,(iy+9) ; stats not valid
ld a,$86 ; locate vector table at $8600-$8700
ld i,a ;
ld bc,$0100 ; vector table is 256 bytes
ld h,a ;
ld l,c ; HL = $8600
ld d,a ;
ld e,b ; DE = $8601
inc a ; A = $87
ld (hl),a ; interrupt "program" located at 8787h
ldir ;
;
ld l,a ; HL = $8787
ld (hl),$C3 ; Put a JP IntProcStart at $8787
inc hl ;
ld (hl),IntProcStart&$FF ;
inc hl ;
ld (hl),IntProcStart/256 ;
;
im 2 ;
jr jump_over ; Jump over the interrupt code
;-----------------
; Actual interrupt
;-----------------
.IntProcStart
push af ;
push hl ;
push de ;
push bc ;
;
exx ; Swap to shadow registers.
ex af,af ; So the TIOS swaps back to the
rst $38 ; normal ones... (the ones we saved
ex af,af ; with push/pops)
exx ;
;
pop bc ;
pop de ;
pop hl ;
pop af ;
ei ;
ret ;
.jump_over
-----------
I already thought of putting a DI after the RST, but that doesn't help a
thing...
The next thing I could think of is that the outputting to port 3 re-enables
the interrupting-device, although if I execute a DI nothing should
happen...
But maybe nice to know how to disable the interrupting-device again.
> >I suspect the "in/out (3)" to be the problem, what does
> >it do? Does it enable the "hardware-that-interrupts"
> >again? The TIOS is also fiddeling around with this port...
>
> The only interrupts we have on ti's calcs are maskable interrupts. Port 3
is
> the interrupt mask. It tells the interrupt handler what kind of interrupt
we
> have by setting some bits. As far as I could see only the first three
bits
> are used (the fourth tells the status of the [on] key). Wether or not
these
> bits are set affects what code is executed during the interrupt. What I
> don't know is if these bits are set at regular times, randomly, or
affected
> by something else.
So that would need some trial and error... or taking a good look at the
TIOS.
Henk Poley
Follow-Ups: