Skip to content

Interrupts on the MOS 6502

May 20, 2011

How far in the past can one look at CPU architectures while still finding reliable documentations on interrupt management ? Well, it seems that even chips from the 70s still have some reliable doc on the internet. So here’s how interrupts work on the MOS Technology 6502 processor, used in early products from Commodore (PET, VIC-20), Apple (I, II), Atari (2600) and Nintendo (NES/Famicon). I use the doc from this website, which proved to be pretty clear and understandable.

So…

  • The 6502 has only one interrupt pin with one single vector associated to it (if you ignore NMI, that is), so one has to use external interrupt controllers to deal with multiple external interrupt sources and talk to them to know which interrupt has occured, just like on the ARM chips discussed earlier.
  • An interrupt vector is here the address of some code to run, with no added information like on x86 or code like on ARM and SPARC.
  • In the event of an interrupt, the 6502 pushes address of previously running code and previous status register on the stack, and disables interrupt.
  • The 6502 then loads the vector from a pair of fixed, known memory addresses ($FFFE-$FFFF) and jumps to it.
About these ads

From → OS development

2 Comments
  1. ugly2 permalink

    The next step as I remember it back in the day, was to poll a number of fixed hardware address, typically belonging to one or more IO chips to see who actually caused the interrupt. Since, the 6502 made no distinction between hardware addresses and memory addresses, and it had a unique indirect memory addressing scheme, there were some interesting things you could do, like dynamically changing the interrupt vectors with external stimuli. Don’t remember the details, but I made a cool $1000 selling one of those tricks. That was when $1000 was worth something. :-)

Trackbacks & Pingbacks

  1. Happy birthday, OS|periment ! « The OS|periment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.