Primordial Ooze Posted September 23, 2011 Share Posted September 23, 2011 (edited) 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 September 23, 2011 by Primordial Ooze Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted September 23, 2011 Share Posted September 23, 2011 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. Quote Link to comment Share on other sites More sharing options...
SmileyDude Posted September 29, 2011 Share Posted September 29, 2011 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. Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted September 30, 2011 Share Posted September 30, 2011 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. Quote Link to comment Share on other sites More sharing options...
RevEng Posted September 30, 2011 Share Posted September 30, 2011 Omegamatrix used the interrupt flag as an extra bit for his Starmaster 2-button hack. I confirmed that it ran without issue on my 7800, so it appears that a 7800 running in 2600 mode ignores the state of the interrupt flag. Quote Link to comment Share on other sites More sharing options...
SmileyDude Posted September 30, 2011 Share Posted September 30, 2011 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. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted October 7, 2011 Share Posted October 7, 2011 . 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.