Writing to Port DFxxh selects the Upper ROM Bank Number (in range of 00h..FFh) to be mapped to memory at C000h..FFFFh. Whether or not the ROM is enabled (or if RAM is mapped to that region) is controlled by the Gate Array.
Technical
The ROM Bank Number is not stored anywhere inside of the CPC. Instead, peripherals must watch the bus for writes to Port DFxxh, check if the Bank Number matches the Number where they want to map their ROM to, and memorize the result by setting/clearing a flipflop accordingly (eg. a 74LS74).
If the flipflop indicates a match, and the CPC outputs A15=HIGH (upper memory half), then the peripheral should set /OE=LOW (on its own ROM chip), and output the opposite level, ROMDIS=HIGH to the CPC (disable the CPC's BASIC ROM).
Additionally the CPC's /ROMEN should be wired to peripheral ROM chip's /CS pin. A14 doesn't need to be decoded since there is no ROM at 8000h..BFFFh, only at C000h..FFFFh.
By default, if there are no peripherals issuing ROMDIS=HIGH, then BASIC is mapped to all ROM banks in range of 00h..FFh.
Common ROM Bank Numbers
00h BASIC (or AMSDOS, depending on LK1 on the DDI-1 board. On CPC, if AMSDOS sees itself mapped to bank 0, then it does automatically load & start the boot sector from drive A after power-up. On Plus, there is a bug in the System cartridge that will cause the machine to crash instead.) 07h AMSDOS (or BASIC, depending on LK1 on the DDI-1 board) 00h..07h Bootable ROMs on CPC 464/664/6128 (KL_ROM_WALK) 08h..0Fh Bootable ROMs on CPC 664/6128 (KL_ROM_WALK) 10h..FFh Non-bootable ROMs (or secondary banks of Bootable ROMs) FCh..FFh Can be used, but aren't accessible by BIOS functions FFh BASIC (or ROM with similar ID; for the crude 128K RAM-size detection in CP/M+) FFh BASIC (or ROM with similar ID; for the BIOS key scan detection in AMSDOS+)
Other Bank Numbers
- Utopia should always be in an upper slot than UniDOS. Utopia in lower slot than UniDOS will disable some UniDOS RSX. Source
- ROM List listing of known ROM-based software
- You may want to add a list of devices with ROM here, please also include their fixed bank number(s), or selectable range of bank number(s))
- Not sure if there are devices with incompletely decoded bank numbers? Eg. a ROM mapped to bank 06h, but also mirrored to 16h, 26h, 36h, etc. If so, these addresses should be listed here, too.
ASIC ROM numbering system
On CPC, this port is really simple. It simply accepts any logical ROM number from 0-255.
On Plus, this port behaves in 2 modes, indicated by bit7:
- if bit7 = 0, it accepts a logical ROM number from 0-127
- If bit7 = 1, bits6..5 are ignored and bits4..0 is a physical ROM number from 0-31
On a barebone CPC, the logical ROMs available are:
- ROM 0: BASIC
- ROM 7: AMSDOS (except on CPC464)
On a Plus with factory cartridge, the physical ROMs available are:
- ROM 0: Firmware
- ROM 1: BASIC
- ROM 2: Unused
- ROM 3: AMSDOS
- ROM 4: Burnin' Rubber ROM 0
- ROM 5: Burnin' Rubber ROM 1
- ROM 6: Burnin' Rubber ROM 2
- ROM 7: Burnin' Rubber ROM 3
By default, just like on Amstrad CPC, if there are no peripherals issuing ROMDIS=HIGH, then BASIC (or more precisely: Physical ROM 1) is mapped to all logical ROM banks (in range of 00h..7Fh).
And on 6128+ only, physical ROM 3 is mapped to logical ROM 7. The ASIC is configured not to map it on 464+ and GX4000, even if a 6128+ cartridge is inserted.
Summary
On Amstrad CPC, there is only 1 lower rom (the firmware), and up to 256 upper roms.
On Amstrad Plus:
- Each cartridge contains up to 32 physical roms.
- The first 8 physical roms can be accessed as lower roms. And all the 32 physical roms can be accessed as upper roms. A physical rom can even be mounted both as lower rom and upper rom at the same time.
- ROM boards are seen as logical roms. They can be accessed only as upper roms and there can be up to 128 logical roms.
Warning for ROM boards
On CPC 6128 and DDI-1, the internal ROM 7 can't be cleanly disabled (it works on some machines, but it means the internal ROM and the flash chip both use the memory bus at the same time, and it happens that the flash chip is stronger in this fight. But it could eventually damage the hardware). Source
On Plus and machines without disk drives, the internal ROM 7 can safely be disabled.
ROM 0 can always be overloaded, but remember that you will not boot to the BASIC in that case (the Hacker ROM is a popular replacement ROM 0, for example).
In-depth hardware details for creating your own ROM expansion can be found there: https://pulkomandy.github.io/shinra.github.io/gordon.html