[net.micro.cbm] Switching C64 cartridges

joels@tektronix.UUCP (Joel Swank) (03/30/84)

   Switching cartridges on the C64 is much more difficult than on the
VIC.  This is because of the complicated BUS structure on the C64. The
key to the C64 BUS is the 82S100 PLA (Programmable Logic Array). This
device is the traffic cop that allows the 6510 microprocessor, the
VIC-II video chip and the external Z80 microprocessor, to access 64 and
1/2 K of RAM, up to 36 K of ROM and 4K of I/O. The PLA has 4 main input
lines. These are EXROM, GAME, LORAM and HIRAM. EXROM and GAME are
inputs from the cartridge port.  They are used by the cartridge to
notify the PLA that an external cartridge is present. The LORAM and
HIRAM lines come from the 6510 microprocessor's zero page I/O port.
They are used to control the PLA under software control.  The 16
possible combinations of these 4 lines generate the memory maps shown
in the "Programmers Guide" pages 262-267 (there are many duplicates).
In addition the CHAREN line selects between the 4K character pattern
ROM and I/O block in all memory maps that show the 4K of I/O (one
exception noted in the manual).
   Cartridges use GAME and EXROM to tell the PLA what parts of the
address space they need. The PLA uses the ROML and ROMH lines to select
the cartridge at the appropriate time. ROML selects the 8K bank at
$8000. ROMH can select either the 8K bank at $A000 or the 8K bank at
$E000. Cartridges may also use the auxilary I/O selects (I/O1 and I/O2)
The CPM cartridge also uses DMA to take control of the BUS. Therefore,
to allow all possible cartridges to work a motherboard would have to
switch all of these lines (GAME, EXROM, ROML, ROMH, I/O1, I/O2, and
DMA) to one cartridge at a time.
   Even if the motherboard switches all of these lines, there are other
problems. Switching these lines does not cause any of the devices
inside a cartridge to go to a high impedence state. In fact, probably
none of the devices used in cartridges have this capability. That means
that all cartridges plugged in will load the BUS. Some of the address
lines already drive 10 devices internally. The actual number of
cartridges that can be plugged in at once without overloading the BUS,
depends on the devices used in the cartridges. The only alternative
(other than switching all lines) is to add buffering to the
motherboard. To support the external CPU these buffers would have to be
dual direction.
   A full function motherboard for the C64 is not a trivial project. I
do not know if any of the comercial motherboards now available cover
all the bases.  A minimal function motherboard that works with ROM
cartridges only would require switching EXROM, GAME, ROMH and ROML.
Since ROMs generally do not present a large load to the BUS, as many as
4 or 5 cartridges may work together.
    References: "C64 programmers reference" pages 260-267, 366, 396

      Joel Swank
      Tektronix