FizzyChicken Posted June 15, 2016 Share Posted June 15, 2016 Hi, as I understand it when the 2600 is powered on the PC is set by the reset vector, which is held in ROM memory locations $fffc & $fffd. But when a 2K ROM is inserted the ROM only reaches up to $f7ff. When I look at the hex dump of Combat I can see the reset vector ($f000) in locations $f7fc & $f7fd. So does the reset vector location depend on the ROM size or am I missing something ? Thanks Quote Link to comment Share on other sites More sharing options...
alex_79 Posted June 15, 2016 Share Posted June 15, 2016 Address line A11 is not connected to a 2k rom, so the rom is mirrored twice in the 4k address space. Addresses '$F7FC' and '$FFFC' both point to location '$7FC' in the 2k rom. These aren't the only mirrors you can use. In 4k rom, address lines A15,A14,A13 are ignored (those pins aren't present at all on the 6507), A12 must be '1' to select the rom and A0 to A11 are used to address the rom. This results in the rom being mirrored 8 times in the entire 16bit address space:$1000-$1FFF$3000-$3FFF$5000-$5FFF$7000-$7FFF$9000-$9FFF$B000-$BFFF$D000-$DFFF$F000-$FFFFIn a 2k rom, in addition to that, A11 is also not connected and only A0 to A10 are used to address the rom, so in this case there are 16 mirrors:$1000-$17FF$1800-$1FFF$3000-$37FF$3800-$3FFF$5000-$57FF$5800-$5FFF$7000-$77FF$7800-$7FFF$9000-$97FF$9800-$9FFF$B000-$B7FF$B800-$BFFF$D000-$D7FF$D800-$DFFF$F000-$F7FF$F800-$FFFFYou can use any of these mirrors in your program, as they all point to the same phisical memory. 1 Quote Link to comment Share on other sites More sharing options...
FizzyChicken Posted June 15, 2016 Author Share Posted June 15, 2016 Ah, that explains it. Thank you Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted June 15, 2016 Share Posted June 15, 2016 TIA, RAM, IO and Timers are also mirrored multiple times in the 2600. More info about that in this topic. 2 Quote Link to comment Share on other sites More sharing options...
tschak909 Posted June 15, 2016 Share Posted June 15, 2016 Gotta love partial address decoding... -Thom 1 Quote Link to comment Share on other sites More sharing options...
Omegamatrix Posted June 16, 2016 Share Posted June 16, 2016 The three highest bits of a pointer are also useful for temporary storage during the kernel since they will just access a mirrored address. They are especially great for branching with BIT tests (BMI, BPL, BVC, BVS). 5 Quote Link to comment Share on other sites More sharing options...
alex_79 Posted June 16, 2016 Share Posted June 16, 2016 They're also a way to pass parameters to a subroutine. Jump to a mirror address according to the parameters that you need to pass before calling the subroutine and it can test the return address in the stack. (the 6507 is a full 6502 internally, so the program counter is 16 bit wide and all bits are stored in the stack when executing a jsr) 2 Quote Link to comment Share on other sites More sharing options...
FizzyChicken Posted June 16, 2016 Author Share Posted June 16, 2016 (edited) Wow. Some good tips there. I learnt to program the 6502 on the C64/128 when I was a kid. Used to do demo's and rip games apart etc. The only other asm I've done is a couple of years coding 68K on the MegaDrive. The 2600 is quite a challenge after 20-odd years of making games with higher level languages and tools. Absolutely loving getting back down to the metal again. Makes me feel like a big kid . Edited June 16, 2016 by FizzyChicken Quote Link to comment Share on other sites More sharing options...
Omegamatrix Posted June 17, 2016 Share Posted June 17, 2016 They're also a way to pass parameters to a subroutine. Jump to a mirror address according to the parameters that you need to pass before calling the subroutine and it can test the return address in the stack. (the 6507 is a full 6502 internally, so the program counter is 16 bit wide and all bits are stored in the stack when executing a jsr) Another cool use is aligning the stack pointer to some color registers, and then JSR to a certain address. The return address gets written to the color registers. You can also use BRK to do three color writes in 7 cycles. Here is another example of stack abuse different to the one I posted above. We were making a two color AtariAge logo. Quote Link to comment Share on other sites More sharing options...
gauauu Posted June 18, 2016 Share Posted June 18, 2016 You guys have made me realize just how little skill I have with 6502 magic when it comes to the Atari. Keep the tricks coming, this is amazing. Quote Link to comment Share on other sites More sharing options...
tschak909 Posted June 18, 2016 Share Posted June 18, 2016 I still love using the stack pointer over the missile and ball registers and PHPing them to enable the missiles and ball in O(1) time. -Thom 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.