I understand the CPU had fewer address lines than a 6502, limiting it to 8kb but that the Atari hardware didn't connect one line thus limiting cartridge access to 4kb.
I further understand that the hardware maps the cartridge ROM into the top of the address space to $FFFF
since the start vector is at $FFFC
, and that RAM is mapped from $0000
since the zero page is essential for 6502 family programming.
I believe that, for emulators, both .a26
and .bin
ROM files are the same format and the extensions can be freely switched. They actually have no format and are just dumps of the ROMs with no headers.
So that's fine for old/small games that only use 2k or 4k, but newer games used memory paging. Since these files are just longer binary files with no header, how are the ROM pages/banks arranged in them? They can't have different addresses and all the paging is controlled by the software and whatever extra chips might be in the cartridge, meaning there is no standard.
If there were a standard I assume bigger ROMs would just just at addresses at lower powers of 2, $E000
for 8k games, $C000
for 16k games, $8000
for 8k games, etc. But as they all can only get mapped into the $F000
to $FFFF
range 4kb at a time, they don't have an inherent order.
One thing I can think of is that internally inside the cartridge the ROM is contiguous and the chips inside map from these internal ranges to the bank actually switched into the address range the console can see.
But this brings me to the next wrinkle. Most ROMs I find online are 2k, 4k, 8k, or 16k, as I expected. But there are also plenty of 25k, 34k, and 64k. How do those work? Common sizes, in hex: $2100
, $6300
, $3000
, $8400
, and, strangely, $28ff
and $2003
!
I never programmed on machines with banked memory back in the day, I went straight from a 48K Speccy to an Amiga 1000, so I might be missing some obvious things.
(Please feel free to ask for clarification or edit for clarity. It's hard to explain, I think.)
.a26
and.bin
etc. the emulator has to "guess" (AUTO mode). As for how each bankswitching type works, look further into the code..a26
and.bin
are the same. I think that for now I shouldn't have to care about how the bank switching itself works. Knowing which part of the file gets mapped to0xF800
initially would be a good way to start I think.