[sci.electronics] Z-80 NMI

grege@gold.GVG.TEK.COM (Gregory Ebert) (03/14/90)

In article <5539@bgsuvax.UUCP> nandan@bgsuvax.UUCP (rajesh Nandan) writes:
>Just a baffling situation-help me solve the problem
>
>If the Z-80 is executing "executable" codes the NMI works & forces a jump to
>0066H but when I make it "HANG" by jumping to a "nonexecutable" part of code 
>the NMI DOESN'T work even though the RTC(58167) chip connected pulls the pin 
>low. ie:- the NMI doesn't work if it has hung. 

	The Z-80 might be executing a block instruction with a huge block
	count (ie LDIR w/ BC=0000). NMI will not break into an instruction.
	Maybe your SP got trashed - NMI routine executed OK, but it can't
	return to the right place; this might 'look' like NMI isn't working.
	The last thing to check is the NMI pulse width. NMI is falling-edge
	triggered, but I'm sure that the Z-80 needs to sample NMI low at the
	end of the current instruction; 'glitching' NMI won't work. If NMI
	is stuck-low, the routine at 0066h will get executed. Even if you
	do a RETN, the next NMI won't occur until NMI has gone high. I know
	from experience that NMI works perfectly when all of the laws
	are obeyed.

	For what it's worth, I've been using the Z-80 for 10+ years and I
	always have/always will love this critter.

davidc@vlsisj.VLSI.COM (David Chapman) (03/14/90)

In article <5539@bgsuvax.UUCP> nandan@bgsuvax.UUCP (rajesh Nandan) writes:
>If the Z-80 is executing "executable" codes the NMI works & forces a jump to
>0066H but when I make it "HANG" by jumping to a "nonexecutable" part of code 
>the NMI DOESN'T work even though the RTC(58167) chip connected pulls the pin 
>low. ie:- the NMI doesn't work if it has hung. 

Executing random code could possibly scramble the internal state of the
processor by executing illegal instructions.  There often isn't any guard
against executing undefined instructions on these 8-bit processors.

It's *never* a good idea to execute random instructions.  Put the processor
into a tight loop instead.  You may even be able to halt it; I don't remember
whether a Z80 can be awakened from a halt or not.
-- 
		David Chapman

{known world}!decwrl!vlsisj!fndry!davidc
vlsisj!fndry!davidc@decwrl.dec.com