[A83] Re: interrupt with shutdown


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

[A83] Re: interrupt with shutdown




> > > > So I guess it's safe to remove the DI from the start of a
> > > > custom interrupt routine.

> > > But with my interrupt routine I posted earlier, If I don't
> > > disable interrupts before I jump to 38h, the calc freezes.
> > > That's also the correction I posted afterwards.

> > The Z80 disables interrupts at the moment it accepts one. If you enable
> > interrupts again during the execution of your interrupt routine then it
> > might happen an interrupt occures, which causes a whole lot of trouble.

> So then it's not that save to do an ei before my halt?

You *must* put an EI before the HALT. If you don't enable interrupts, the
HALT instruction will wait forever. But in your code, after the HALT you
still execute some code that is part of the interrupt routine. So after the
HALT you must disable them again. However as David pointed out, that's
normally not necessary, because the code after the HALT is really short and
doesn't leave enough time for an interrupt to happen.





References: