Nestor Soriano wrote:
>
> Hey, thanxs everybody for your replies! I reply all in one message for
> saving space... ;-)
>
> >Is it possible that another interrupt is granted while the '...' section is
> >executed?
>
> I execute a DI at first. In this section there is slot and segment
> switching (page 2), via ENASLT and PUT_P2 respectively.
>
> >If that happens, SAVESP will be overwritten.
>
> Why? My routines and data areas are placed in a reserved zone in page 3,
> above MSXDOS.SYS.
SAVESP will be overwritten by your own hook routine when it is called a
second time.
> >Do you perform BDOS routines during your interrupt Nestor? And do you use
> >it in DOS1 or DOS2 environment?
>
> Only slot and segment switching. My program is for DOS 2 only.
so no BDOS: that is ok.
What is selected in page 0? Main BIOS or RAM (with MSX-DOS2 interrupt
handler) ?
In case of BIOS: ok
In case of MSX-DOS2 interrupt handler: it is absolutely required that
there occurs no interrupt during your interrupt routine because each
interrupt the MSX-DOS2 interrupt handler switches over to its own stack
and then you got the same problem: the second interrupt overwrites the
interrupt stack.
(note: when an interrupt occurs, the MSX-DOS2 interrupt handler checks
to see if the SP points to somewhere in the interrupt stack area. If
this is the case, it doesn't alter the SP, so no data is overwritten. So
the MSX-DOS2 interrupt handler is capable of accepting interrupts during
an interrupt (as long as the interrupt stack is not full)
However in your case, you alter the stack to your own stackspace. If a
second interrupt occurs, the MSX-DOS2 interrupt handler *will*
initialize its own SP and so the first interruptdata is overwritten.
If you don't switch to your own stackspace and a second interrupt occurs
during your interrupt routine, there will be no problem because the
MSX-DOS2 interrupt handler will not initialize its SP.
The SAVESP problem will not cause a crash because the SP value when
entering your routine will always be the same. (when using MSX-DOS2
handler) So SAVESP is overwritten, but always with the same value.
> Of course! In fact, my program works perfectly when no stack switching is
> done, except with programs swtching stack in page 2.
coincidence?
BTW when using MSX-DOS2 interrupt handler, programs with stack in page 2
are no problem. In that case your FD9F routine is executed by the
MSX-DOS2 handler with the stack somewhere in page 3. So you can do as
much slotswitching in page 2 as you like.
>
> >Also stupid: don't forget to push/pop IX/IY and shadowregisters.
>
oh, I see, you are not making your own interrupt routine, but
redirecting hook FD9F.
In that case you don't need to push any registers except the A register.
This contains valuable information when FD9F is called. (contents of VDP
statusregister 0 I believe)
I would advice you to replace your interrupt routine by a simple
program; for example:
ld hl,#c000
inc (hl)
and see if that works right.
jon
****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****