TL;DR: With what values are the I/O port registers (locations
$01) on the 6510 initialised when it is powered on?
I'm writing a Commodore 64 emulation. The Commodore 64 uses a 6510 microprocessor which has an I/O port built in. The I/O port is accessed at locations
$00 (data direction) and
$01 (data). I found lots of documents explaining how the thing works, but nothing so far on how it is initialised.
The I/O port is the main means of controlling the RAM bank switching, so how it is initialised is critical. For example, if bit 1 of the data direction register is 1 (for output), the ROM between
$FFFF is controlled by bit 1 of the port (1 = ROM, 0 = RAM).
So on the Commodore 64, unless the data direction register is set for output and the I/O port bit 1 is set to 1, there is RAM at the top of the address map and crucially the reset and interrupt vectors are not accessible. However, the designers of the 6510 probably would not do this because they wouldn't have known what I/O devices are connected to the port.
The I/O port doesn't drive the RAM bank switching directly, but via a PLA so I'm guessing that the DDR and the port are initialised to 0 when the processor switches on and the PLA keeps the ROM selected until the C64 has set the direction and port data correctly. (Maybe there's some sort of tri-state thing going on with a pull up resistor or something.)
Is my assumption correct?