[A83] Re: Interrupt troubles [83, Ion]
[Prev][Next][Index][Thread]
[A83] Re: Interrupt troubles [83, Ion]
Tricking the interrupt routine is hard, for some reason. You'd think it
wouldn't even matter, since an interrupt doesn't even take nearly the whole
time to execute. But for some reason it does. The only things I can
recommend are to eliminate use of shadow registers, or to paste a bit of
TI's interrupt routine in, and call the key scanning routine from your
interrupt routine. The problem with this is you'd have to find out the
address of that routine -- bcalls in interrupts aren't good.
On just a question, why is all of this being done to Z88DK? SDCC produces
much much better code, as it has a real optimizer in it. All that would have
to be done is add some peephole optimizer code to it, and its output would
be quite streamlined for a C compiler. It even uses IX as the stack pointer.
-----Original Message-----
From: assembly-83-bounce@lists.ticalc.org
[mailto:assembly-83-bounce@lists.ticalc.org]On Behalf Of Henk Poley
Sent: Monday, July 09, 2001 3:24 AM
To: assembly-83@lists.ticalc.org
Subject: [A83] Re: Interrupt troubles [83, Ion]
Okay, I guess that somebody came with this idea already, but haven't
checked my mail since the last one I sended in here...
What I now do is checking if an error-flag is set by my routine, and fixes
the stack if needed, but it doesn't work :-(
What am I doing wrong? (btw I thought about the stuff, and came to the
conclusoin that the return value is only once on the stack, not twice, as I
said before..)
(I can also try to put in a DI right before the JP IntProcStart in the
statvars, maybe that might help a little too)
-------
[using the same loader]
defc intcount = $878A ; 1 byte needed
.IntProcStart
push af ;
ld a,(intcount) ; Check if own interrupt has quited
bit 7,a ; correctly, then bit 7 is zero
jr nz,int_fix ; If not zero, fix stack...
push hl ;
push de ;
push bc ;
ld hl,intcount ; If a 'direct interrupt' occures
set 7,(hl) ; right after the TIOS-int, then
; we want bit 7 to be set...
.exit_interrupt ;
exx ; Swap to shadow registers.
ex af,af ; So the TIOS swaps back to the
; normal ones... (the ones we saved
; with push/pops)
rst $38 ;
di ; 'BIG' HOLE HERE...
ex af,af ;
exx ;
;
ld hl,intcount ; Interrupt returned correctly, so
res 7,(hl) ; we reset our error-condition...
;
pop bc ;
pop de ;
pop hl ;
pop af ;
ei ;
ret ;
.int_fix ;
pop af ; Pop AF back
ex af,af ; Fix shadowregs back
exx ;
pop bc ; Pop the returnpoint of RST $38
; from the stack
jr exit_interrupt ;
.jump_over
References: