Jump to content
IGNORED

Which interrupt isn't required?


Primordial Ooze

Recommended Posts

I remember that one of the three interrupts, weren't required when creating Atari 2600 games. In addition you could save a byte by not including that interrupt and changing the starting the interrupt address at $FFFC instead of $FFFA. Could someone please tell me which interrupt i don't need and can remove safely? Any assistance in this matter would be greatly appreciated.

 

Sincerely,

 

Primordial Ooze

Edited by Primordial Ooze
Link to comment
Share on other sites

The three 6502 vector addresses are the NMI vector at $FFFA and $FFFB, the reset vector at $FFFC and $FFFD, and the IRQ vector at $FFFE and $FFFF. The 6507 doesn't have pins for the NMI and IRQ signals, so technically the only vector you truly need to use in your 2600 programs is the reset vector at $FFFC and $FFFD, and you don't need to include the SEI command in your startup routine. But the IRQ vector is used by the BRK command, so you can either point the IRQ vector at $FFFE and $FFFF to the same address as the reset vector (so your program will essentially reboot itself if it encounters a BRK instruction), or you can point the IRQ address to a routine that will handle the BRK interrupt and then return back to where it was called from. I don't remember which game(s) did this, but at least one game did use BRK interrupts to play different sounds.

Link to comment
Share on other sites

I came to the same conclusion about the SEI instruction, but then I came across this comment in macro.h:

 

;-------------------------------------------------------------------------------
; CLEAN_START
; Original author: Andrew Davie
; Standardised start-up code, clears stack, all TIA registers and RAM to 0
; Sets stack pointer to $FF, and all registers to 0
; Sets decimal mode off, sets interrupt flag (kind of un-necessary)
; Use as very first section of code on boot (ie: at reset)
; Code written to minimise total ROM usage - uses weird 6502 knowledge 

 

Does anyone know what Andrew meant by "kind of un-necessary"? I just assumed that it was always un-necessary on the 6507 since both interrupts lines are tied to ground and therefore, it's impossible for an interrupt to go off. Unless there is some weird edge condition that I wasn't aware of that could cause an interrupt.

Link to comment
Share on other sites

Does anyone know what Andrew meant by "kind of un-necessary"? I just assumed that it was always un-necessary on the 6507 since both interrupts lines are tied to ground and therefore, it's impossible for an interrupt to go off. Unless there is some weird edge condition that I wasn't aware of that could cause an interrupt.

Andrew would need to confirm, but I think he just meant it's unnecessary on the 2600/6507. I'm not sure about on the 7800/6502. It's only a 1-byte instruction, so it's common to just include it, whether or not it actually matters.

Link to comment
Share on other sites

I took at look at a disassembly of the 7800 BIOS, and it looks like the interrupt mode is disabled at the start and is never re-enabled by the BIOS ever.

 

http://atarihq.com/danb/files/7800bios.asm

 

The only source of interrupts on the 7800 is the IRQ on the cartridge port, so for a pure 2600 game, skipping SEI shouldn't cause a problem on any system that Atari shipped. But as said above, it's a cheap form of insurance and who knows if someone will make a new version of the 2600/7800 that does use interrupts in some interesting way.

Link to comment
Share on other sites

. I don't remember which game(s) did this, but at least one game did use BRK interrupts to play different sounds.

I found that Parker is using this trick in several games (to save some ROM space). One of them is Lord Of The Rings.

 

http://www.biglist.com/lists/stella/archives/200112/msg00093.html

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...