Jump to content
IGNORED

Reset vector with 2K ROM


Recommended Posts

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

Link to comment
Share on other sites

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-$FFFF

In 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-$FFFF

You can use any of these mirrors in your program, as they all point to the same phisical memory.

  • Like 1
Link to comment
Share on other sites

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)

  • Like 2
Link to comment
Share on other sites

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 8).

Edited by FizzyChicken
Link to comment
Share on other sites

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.

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...