[rec.arts.sf-lovers] 6502 interrupts

albaugh@dms.UUCP (Mike Albaugh) (11/08/90)

From article <kbC92Uq00VoiE3mm4y@andrew.cmu.edu>, by ap1i+@andrew.cmu.edu (Andrew C. Plotkin):
>> I believe this command exists in at least the 6502 microprocessor's
>> vocabulary
> 
> Nope.

	I'll agree with that. No such "command" exists, by that or
any other name in any 6502 system with which I am familiar, and that
includes a _lot_ of such systems, as I have been mucking with 6502s
since I bought a 6501 at Wescon (1975 ?) :-)


> I dearly love my old Apple 2; but I have to admit that the 6502 handles
> interrupts the way a drunk gorilla handles fine china.

	The designers of the Apple-2 did a very poor job of handling
interrupts, perhaps because the competition at the time (S-100 CPM boxes)
typically ignored them totally. But to condemn a CPU architecture for
the sins of one "OS" is misguided at best. The 6502 saves _exactly_
what is needed to restore the state of the processor on return, thus
providing the minimum interrupt latency. This is one of the main reasons
the 6502 was/is so popular in small embedded systems with high interrupt
rates (e.g. video games). You may have no taste for such minimalism, but
others find it a _feature_ :-)

	We now return you to your regularly scheduled programming...

					Mike

| Mike Albaugh (albaugh@dms.UUCP || {...decwrl!pyramid!}weitek!dms!albaugh)
| Atari Games Corp (Arcade Games, no relation to the makers of the ST)
| 675 Sycamore Dr. Milpitas, CA 95035		voice: (408)434-1709
| The opinions expressed are my own (Boy, are they ever)

esmith@goofy.apple.com (Eric Smith) (11/09/90)

In article <kbC92Uq00VoiE3mm4y@andrew.cmu.edu> ap1i+@andrew.cmu.edu (Andrew C. Plotkin) writes:

>   I dearly love my old Apple 2; but I have to admit that the 6502 handles
>   interrupts the way a drunk gorilla handles fine china.

The 6502 handles interrupts just fine; it is the Apple II that handles
them badly.  The design philosopy was apparently the same as that of
Doc Suding (sp?) of The Digital Group fame (anybody remember them?):
interrupts are hard to understand so you shouldn't use them.

In the case of the Apple II and Apple II+, the monitor ROM made it almost
impossible to do useful things with interrupts.  Newer machines were
slightly improved in that respect.

--
Eric L. Smith      Opinions expressed herein do not necessarily reflect those
esmith@apple.com   of my employer, friends, family, computer, or even me!  :-)

david@cs.uow.edu.au (David E A Wilson) (11/09/90)

esmith@goofy.apple.com (Eric Smith) writes:
>The 6502 handles interrupts just fine; it is the Apple II that handles
>them badly.

I think thats overstating the case a little (and I have 2 6502 machines
at home and like the 6502).

The major problem with interrupts on the 6502 is that the BRK instruction
and IRQ signal both vector through the same location. The only way for the
irq handler to tell which it was is to check the B bit in the stacked status
register (not the real one). Thus the following code (paraphrased):

	IRQ:	STA	$45
		PLA
		AND	#BREAK_BIT
		BEQ	IT_WAS_AN_IRQ
	BREAK:

Choosing $45, a location used by the monitor for other things was not, in
hindsight, a good idea.  At least Apple improved things with the enhanced
//e, //c and later machines.
-- 
David Wilson	Dept Comp Sci, Uni of Wollongong	david@cs.uow.edu.au

md3b+@andrew.cmu.edu (Matthew Donald Drown) (11/11/90)

I wrote stuff of a 6510, aka a Commodore 64, and had no problems with
interrupts.  From the number of graphical displays, scrolls, and others things
I was able to do with interrupts was fine.  You did have to play with it a
little bit, but setting them up on a C64 was quite easy.  Disable IRQs, tell
the machin were to go when an IRQ occcurs, Enable IRQs.  As long as the code
you were pointing to, then the IRQs worked fine.
-Matt

"Hear the crashing steel, feel the stearing wheel."

frogger@felix.UUCP (frogger) (11/15/90)

In article <kbC92Uq00VoiE3mm4y@andrew.cmu.edu> ap1i+@andrew.cmu.edu (Andrew C.
Plotkin) writes:
>   I dearly love my old Apple 2; but I have to admit that the 6502 handles
>   interrupts the way a drunk gorilla handles fine china.

In article <ESMITH.90Nov8174851@goofy.apple.com> esmith@goofy.apple.com (Eric
Smith) writes:
>The 6502 handles interrupts just fine; it is the Apple II that handles
>them badly.  The design philosopy was apparently the same as that of
>Doc Suding (sp?) of The Digital Group fame (anybody remember them?):
>interrupts are hard to understand so you shouldn't use them.

Yes, I remember Dr. Suding and the Digital Group.  In fact, I have quite
a bit of Digital Group equipment collecting dust in the garage.  Not too
shabby for the day.

And there _was_ an obvious bias against interrupts, but everything always
seemed to hold together without them.  The wait-state logic was pretty
buggered up, too.  Caused me a bit of grief when I wanted to run a DSDD
floppy and the TV-80 board at the same time.

(But we digress, for a note that is crossposted to such an eclectic set
of groups.)