[A83] Re: Interrupt troubles [83, Ion]


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

[A83] Re: Interrupt troubles [83, Ion]




> Van: Kirk Meyer <kirk.meyer@colorado.edu>
> 
> Ah. You've hit on the problem exactly. The interrupt that you are calling
> enables interrupts before returning. rst $38 is hardly used on
calculators
> because of this reason. You can only jump to $0038 if necessary. If you
want
> to use TI's interrupts, you probably can't avoid the shadow registers. I
> compiled a program with Z88DK, and it used the shadow registers a total
of 3
> times -- and just HL', at that. That's not a very efficient use of shadow
> registers. You could probably do better using something else...

Okay, I do have to say, from the compiler side it's easy, we could just
change this "ex hl,hl [..] ex hl,hl" code to "push hl [..] pop hl", the
bigger problem is the FP routines, they use the shadow regs all the time...

Makeing the z88dk using the TIOS FP routines is possible (I think), but I'm
not really trying it at the moment...

> If you absolutely have to use shadow registers, then you'll probably want
to
> paste the entire interrupt code into your program (pretty large). As soon
as
> interrupts execute the EI \ RET(I) (as TI's does), another interrupt can
> occur, so if the RET(I) doesn't actually return from the interrupt, you
can
> end up in an endless interrupt loop. This is why EI executes the next
> instruction before the interrupts are reenabled -- this way there is no
> possibility for interrupt overlap.

Okay, when I read this I was first on for some very mad idea, replacing the
JP IntProcStart with another JP that fixes things up afterwards (and vice
versa)...
But damn that wouldn't work... Since you don't know if an interrupt uccures
directly after the IE \ RETI...

So probably we'll have to stick with the TIEI \ TIDI...
On the Ti83- we don't have these interrupt-hooks, hûh? Could also be
something to help... Or knowing if there's a way to reset the
interrupting-device, so it would take another 1/160 of a sec untill the
next interrupt...

Oh, hey (just thinking), I could also check at the beginning of the
interrupt if the previous(-previous-previ..) value on the stack is the
return adress to my interrupt routine. Would that work?

Some example to proof:

Stack (because of direct interrupt after EI \ RETI):
  6. Somewhere-in-program-or-ROM
  5. saved af
  4. saved hl
  3. saved de
  2. saved bc
  1. right-after-my-rst-$38
  0. right-after-my-rst-$38 (when returning from TIOS-int an interrupt
occures, so the value of the PC is stored at the stack)

Now inside my interrupt:
My interrupt checks if "right-after-my-rst-$38" is stored at the stack
(twice); removes it; goes on with normal operation. Difficult, but could be
done, I hope... (this doesn't safe you if e-v-e-r-y-time a direct-int
occures, but okay it shouldn't be, because then your program wouldn't
execute after all, even if you didn't use your IM2 interrupt)

Oh, and yes I know, I use that '...' too much... ;-)

	Henk Poley


BTW: And still nobody who knows to fix my (strange) Ion problem.