Path: ns-mx!uunet!munnari.oz.au!metro!cs.uow.edu.au!david
From: david@cs.uow.edu.au (David E A Wilson)
Newsgroups: comp.sys.apple2
Subject: Re: Interrupt generator for an Apple 2e
Message-ID: <1992Feb9.045115.26120@cs.uow.edu.au>
Date: 9 Feb 92 04:51:15 GMT
References: <1992Feb8.222110.3745@csc.canterbury.ac.nz>
Organization: Dept of Computer Science, Wollongong University, Australia
Lines: 41

misc006@csc.canterbury.ac.nz writes:
>How would you go about building a simple interrupt generator for and apple 2e??
>Basically so far I have come up with some sort of capacitor array attached to a
>555 timer chip on the irq line. Can anyone help or suggest any ideas...

You would need some way of reseting the IRQ source from your IRQ handler as
IRQ is a level sensitive input and would reinterrupt if you just fed a square-
wave into it. I have the following circuit in a clone (which had a few unused
softswitches and VBL accessable):

EnableVidIRQ	>-----------+
		      _	 ___O___	74LS05 (or any o/c inverting gate)
		      |	| Reset |	  *		___
		      +-|Data  Q|-------|>o------->	IRQ
			|      _|			______
VBL		>-------|>Clk  Q|----------------->	VidIRQ
			|_______|
			74LS74

EnableVidIRQ is set high to turn on Video interrupts and is set low to turn them
off AND to clear the previous IRQ. VidIRQ is read to see if this interrupt was
caused by this circuit. Thus the code required to handle the interrupt would be:

		BIT	VidIRQ		; was it my IRQ? Bit 7 = 0 if yes
		BMI	no
		STA	ClrEnableVidIRQ	; clear interrupt
		STA	SetEnableVidIRQ	; re-enable VidIRQ
		do what is required here

>Also what how many clock cycles does an interrupt take on an apple 2e. Any
>chance of getting a 32000 hz interrupt going. (I have an 8mhz zip chip)
>I know this may be a little hopeful but a 50hz would do nicely for a start.

According to the Enhanced //e docs, it takes at LEAST 150-200 us to get to
JMP ($3fe) and another 40-140 us after the RTI - thus on a 1Mhz machine the IRQ
process would absorb all available cycles at between 3 and 5 kilohertz or
(assuming everything is sped up equally @8MHz) 24-40kHz on your Zipped machine.
This would leave virtually no time for non interrupt processing however.
-- 
David Wilson				(042) 21 3802 voice, (042) 21 3262 fax
Dept Comp Sci, Uni of Wollongong	david@cs.uow.edu.au
