Re: Question about 65816

From: Ethan Dicks (erd_at_infinet.com)
Date: 1998-07-08 21:05:59

> Actually, the 6510 one is also two bytes long.  If you look at the
> BRK spec in e.g. the Programmer's Reference Guide, it pushes
> PC+2 onto the stack; similarly, if you look at e.g. the source code
> for Supermon it subtracts 2 from the PC counter on the stack to
> get the correct PC.

This creates a potential software feature on 6502-family processors akin
to the BIOS interrupt on DOS or the toolbox traps on a Mac - use the BRK as
a true SOFTWARE interrupt, and follow it by a routine vector number.

Check the B bit in the status byte on the stack to see if the IRQ was
triggered by a BRK instruction or a real hardware interrupt.  If it
was a BRK, then you use the next byte as an index into a vector table to
dispatch, say, I/O requests.  If you need to patch out a two byte instruction,
define a double-BRK as a noop or a call to the monitor.  With this scheme,
you don't have to worry about kernel jump tables in ROM or any of that ugly
stuff.  Porting to a different 6502 design is a matter of hardware specific
routines and a vector table that is known to the interrupt handler.

Thoughts?

-ethan
-
This message was sent through the cbm-hackers mailing list.
To unsubscribe: echo unsubscribe | mail cbm-hackers-request@dot.tcm.hut.fi.

Archive generated by hypermail 2.1.1.