At 01:17 PM 09/20/98 +0200, you wrote:

>-  Interrupt occurs
>-> (DI)
>-> Interrupt Routine (-> new interrupt occurs)
>-> EI
>-> ret
>
>What will happen if a NEW interrupt occurs when the MSX is
>processing obove mentioned "routine-part"?

It will be remembered. As an explanation, I'll give a few facts about how
interrupts are handled.

A device generating an interrupt will continue to do so until it is
explicitly asked to "shut up". For example, the VDP will ask for an
vertical blanking interrupt until you read status register 0. If your
interrupt routine doesn't read that register, the VDP will keep generating
interrupts and your MSX will crash.

If a device is asking for an interrupt and the interrupts are enabled, the
Z80 will grant the interrupt. As soon as the interrupt is granted,
interrupts are disabled to make sure the interrupt routine cannot be
interrupted itself. So it's not necessary to begin your interrupt routine
with DI. In interrupt mode 1 (IM1, default on MSX), the Z80 will jump to
0038h where an interrupt routine is supposed to be.

The interrupt routine should end with an instruction that re-enables the
interrupts. I think RETI does that. Anyway, the MSX BIOS uses EI followed
by RET instead.

If a device starts asking for an interrupt when the interrupts are
disabled, it will simply keep asking. At some time the interrupts will be
re-enabled. At that time the interrupt routine is called, which should tell
the device it can stop asking for a interrupt.

So, interrupt requests occuring while an interrupt routine is being handled
are not different from interrupt requests occuring at any other time.

>btw: Thanx 2 all of u 4 the v9938 infos, but I realized that screen 4
>highspeed-copies maybe possible, but (theoretically) the area to
>be copied is 2 difficult 2 select...    :(

I think Mark Zellenrath (previously known as Zelly ;) tried that once, but
came to the conclusion it doesn't work. But on GFX9000 you can copy in
pattern mode.

At 02:27 PM 09/20/98 +0200, Rainier Maas wrote:

>I think the interrupt will be lost forever since all interrupts are 
>disbled by DI. I know for sure it wont be remembered. 

In DI state, the Z80 won't grant any interrupts. But devices are not
influenced by this, so for example the VDP will continue to generate
interrupts. As soon as the Z80 is in EI state again, it will grant those
interrupts.

>I don't know what kind of interrupt routine you are using but it is 
>possible that an EI is in there (e.g. when you use a bios call an EI 
>is almost always in there).

Using those routines in an interrupt handler is not a good thing to do. It
could cause really nasty surprises. For example, you have one interrupt
routine that prints "AB" to the screen. Another interrupt routine prints
"CD" to the screen. Now suppose you print characters by calling a BIOS
routine for every seperate character and that BIOS routine enables the
interrupts. What could happen is this:
1. interrupt routine 1 is called
2. interrupt routine 1 prints "A" to the screen
3. interrupt routine 2 is called
4. interrupt routine 2 prints "C" to the screen
5. interrupt routine 2 prints "D" to the screen
6. interrupt routine 2 ends
7. interrupt routine 1 prints "B" to the screen
8. interrupt routine 1 ends
So your screen would read "ACDB", which is probably something you didn't
intend at all!

>In that case the new interrupt will occur, 
>and your interrupt routine will be called when it is still in the 
>process of handling the previous interrupt. As you can imagine your 
>msx will crash in this scenario due to the exponential growth of the 
>heap etc. etc.

I think by "heap" you mean the stack. Why would the stack grow
exponentially? Should an interrupt occur inside an interrupt, stack usage
would increase, but only by a constant and fairly small amount, which is
not likely to cause a stack overflow.

At 10:19 PM 09/20/98 +0200, Erik wrote:

>but when you enter an interupt routine the interupt flag will be set
>this flag will hold other interupts untill its resets

This flag is called IFF1. It is the flag that contains the DI/EI state.

Bye,
                Maarten



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