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.

>Another option: 100 bytes is not enough and you get a stack overflow. But
>you probably thought of that.

I tried also 200... what is the corect amount?

>Advanced interrupt programming....     ;-))

Sounds scary! 8-)

>Isn't it possible, that sometimes a next interrupt occurs, while a 
>previous interrupt routine is still being processed?

See above.

>If that happens everytime, it will crash, but if occasionally, then 
>no problem with proper written interrupt routine.

eh? What is the difference between "occasionally" and "every time" in this
case?

>Try the above:
...
>interrupt -> SP corrupted -> crash/hang

In fact I patch not only timer hook, but also keyboard read and character
print hooks, and stack is changed in all cases (using only one fixed
SAVESP). It is possible that keyboard and character print hooks be called
even in a DI condition? (?.?) If so, surely we found the problem!

>Solution:
>Disable interrupts (DI), then save SP etc., don't call 
>anything that could re-enable interrupts in between, restore SP, and 
>only AFTER that restore, further interrupts could be allowed.

I already do this!

>OR: if possible, don't switch stacks at all.

But these routines do page 2 slot and segment switching, and some programs
which switch stack on page 2 causes a crash...

>> Perhaps a stupid remark, but do you call this routine or do you jump to
>> it? If you call it, the JP at the end causes your problem. If you jump
>> to this routine, I don't see anything wrong with it (somebody else?).
>hmm.. it is just the other way around; if he CALLs it, it is ok because
>the old_interrupt_hook RETurns.

Yep. My routine is JPed by new hook, but this JP is CALLed by system. The
old interrupt is a RET or a routine which returns.

>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.

>Also stupid: don't forget to push/pop IX/IY and shadowregisters.

>You had some hints of what the problem most probably could be. I give you
>one more, but I don't think you made this mistake: push all and pop all
>must be in reversed order, this is correctly done?

Of course! In fact, my program works perfectly when no stack switching is
done, except with programs swtching stack in page 2.

>Most probably you get an interrupt while your routine is working. If that
>happens only once, the system will hang. You can switch them off with
>vdp(1), so you're sure there'll be really no interrupts, even if some
>routine might switch them on.

Wow! This is really advanced programming! 8-) In fact I have no big
knowledge about VDP, and I did not know this.

>If you disable the bios, don't forget to read vdp status register 0 to
>reset the interrupt.

OK. But I don't touch page 0 at all.

Hasta incluso!


************ 15th MSX users meeting in Barcelona: May 1th, 1999 ************
----------------------------------------------------------------------------
          Konami Man - AKA Nestor Soriano (^ ^)v - Itsumo MSX user

               New address!!    http://konamiman.msx.tni.nl
               [EMAIL PROTECTED]       ICQ#: 18281450

     Metal Gear for MSX - (C) Konami 1987  (Nothing new under the sun...)
----------------------------------------------------------------------------

****
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/)
****

Reply via email to