Sunday 26 June 2022

Custom ROM sets for the Mini PET and PET ROM RAM

This question has come up a few times recently, so I thought I would go into more detail.

The Mini PET and PET ROM/RAM both uses a single large EPROM to replace many individual ROM chips in the original Commodore PET. But more than that, they contain several different sets of these replacement ROMs, to give a choice of BASIC to match the machine they are going into.


PET Memory Map

To start with, lets have a look at how the various PET models split up the 64K memory map of the 6502.

Address range
2001 (8K)
3016
4032
8032
0000-0FFF
8K RAM
16K RAM
32K RAM
32K RAM
1000-1FFF
2000-2FFF
-
3000-3FFF
-
4000-4FFF
-
-
5000-5FFF
-
-
6000-6FFF
-
-
7000-7FFF
-
-
8000-8FFF
1K Video RAM
1K Video RAM
1K Video RAM
2K Video RAM
9000-9FFF
-
4K Option ROM
4K Option ROM
4K Option ROM
A000-AFFF
-
4K Option ROM
4K Option ROM
4K Option ROM
B000-BFFF
-
4K Option ROM
4K BASIC ROM
4K BASIC ROM
C000-CFFF
2 x 2K ROM
4K ROM
4K BASIC ROM
4K BASIC ROM
D000-DFFF
2 x 2K ROM
4K ROM
4K BASIC ROM
4K BASIC ROM
E000-EFFF
2K ROM
2K ROM
2K EDIT ROM
2K EDIT ROM
F000-FFFF
2 x 2K ROM
4K ROM
4K KERNAL ROM
4K KERNAL ROM


The bits that aren't ROMs

Character ROM

OK, so it is a ROM, but it does not contain executable code, is not accessible to the processor, and does not appear in the memory map. It is wired directly into the video circuitry. This means it cannot be replaced from the 6502 socket with a PET ROM/RAM, and is a separate ROM chip on the Mini PET.

Video RAM

Video RAM is also a special case. It does appear in the memory map, but is still separate from the main RAM, and cannot be replaced by a PET ROM/RAM

IO Cutout

The 2K region from E800 to EFFF was not allocated to ROM and was used for memory mapped IO. Later machines reduced the cutout to E800-E8FF, allowing the remaining space to be used for extensions to the edit ROM.


BASIC Versions

There were several versions of BASIC, each of which will run on most of the machines in the PET range. There can be a bit of inconsistency with the numbering. This is my take on it.

BASIC 1  *** COMMODORE BASIC ***

This is the original version from the 2001 which has a few bugs. I don't generally include this in any ROM sets.

BASIC 1r *** COMMODORE BASIC ***

This is a patched version of BASIC 1 which fixes some of the bugs (but notably not the one that stops IEEE-488 disk drives being used). This is the version of BASIC 1 I use.

BASIC 2 ### COMMODORE BASIC ###

This is the second major version of BASIC, available as an upgrade to the 2001, and used on the 2001N and 30xx series. Sometimes referred to in older books as "new ROMs". It is also sometimes called BASIC 3, since it was used on the 30xx series of machines, and was followed by BASIC 4, but I stick to calling this BASIC 2.

BASIC 4 *** COMMODORE BASIC 4.0 ***

No confusion with numbering this one, it says 4.0 on the screen. There are however many different versions of it. The original release had a few bugs that were fixed by replacing one of the five chips. I don't include the buggy version in any ROM sets, and just stick to the fixed version. Frustratingly, even after ruling out that buggy version, there are several different flavours of BASIC 4 for different hardware, which confuses things a bit.

There is a more pronounced split between the regions of ROM in BASIC 4. B000-DFFF is BASIC, E000-E7FF (and in some cases also E900-EFFF) is the screen editor and F000-FFFF is the kernal (that is how it is spelled in all the Commodore documentation of the day). The changes were all within the editor ROM, and that would often be the only one of the system ROMs that was socketed. I will not go into too much detail here, maybe one day I will do a detailed breakdown of how BASIC 4 fits together - I did a lot of reverse engineering when producing the Mini PET ROMs)

  • BASIC 4 for non CRTC machines
  • BASIC 4 for 4032 (normal keyboard, link linking etc.)
  • BASIC 4 for 8032 (business keyboard, windowing etc.)
  • BASIC 4 regional differences (DIN etc.)

Machines

Now we have seen all the versions of BASIC, let's look at the machines they ran on.

PET 2001

The 2001 had a total of 7 2K ROM chips, from C000 to FFFF, with a gap at E800-EFFF for the IO chips. BASIC 1 and BASIC 2 were available in 2K ROMs, either as 6540 ROMs on earlier machines or 2716 style on later boards. There was no space on the board for more than 8K of RAM or ROMs in the 9000-BFFF range. Options ROMs and even BASIC 4 could be added using expansion boards on the side edge connector, or plug in boards such as the PET ROM/RAM.

PET 2001N / 3008/3016/3032 etc.

The 2001N boards also had 7 ROM chips, but these were 4K each, and covered the complete range from 9000-FFFF (with the cut out at E800-EFFF). They initially came with BASIC 2, which left three sockets free for expansion ROMs from 9000-BFFF. They could be upgraded to BASIC 4 which used one of those for it's larger version of BASIC. These were the 9" 4008/4016/4032 machines. Not to be confused with the 12" monitor versions of the 4016/4032 I am just about to talk about.

PET 4016/4032 / CBM 8032/8096/8296

The various versions of the 40xx and 80xx boards had 7 ROM slots again. Often only the two options ROMs at 9000-9FFF and A000-AFFF and the editor ROM E000-EFFF (minus IO cutout) would be socketed. The others being tried and tested and unlikely to change. These machines had 6545 CRTC chips used to drive the display. This had to be initialised before it would display anything, so the correct editor ROM has to be used. It means that these machines cannot run earlier versions of BASIC as they do not initialise the CRTC at boot up.


ROM images

The PET ROM/RAM boards replace all of the ROM from 9000 to FFFF, leaving the full IO region E800-EFFF alone. This is almost 32K, so it makes sense to deal with this in 32K blocks.

Considering the simplest case of a single ROM set, the 32K ROM image is mapped into the upper 32K of the memory map, with the cutouts for video RAM and IO.

ROM Image Address range
PET Address range
Use
-
0000-0FFF
RAM
-
1000-1FFF
-
2000-2FFF
-
3000-3FFF
-
4000-4FFF
-
5000-5FFF
-
6000-6FFF
-
7000-7FFF
0000-0FFF
8000-8FFF
Video RAM
1000-1FFF
9000-9FFF
Option ROM
2000-2FFF
A000-AFFF
Option ROM
3000-3FFF
B000-BFFF
BASIC ROM
4000-4FFF
C000-CFFF
BASIC ROM
5000-5FFF
D000-DFFF
BASIC ROM
6000-6FFF
E000-EFFF
EDITOR ROM*
7000-7FFF
F000-FFFF
KERNAL ROM

* including IO cut out E800-E8FF or E800-EFFF

In this simple case, the 32K ROM image is built up so that it maps to the upper 32K of ROM. The regions in the ROM that would map to the video RAM and IO region are ignored, and I sometimes use those to note what is in the ROM image.


Next consider a two ROM set version. a 27C512 ROM will contain 64K, two 32K ROM images. The first set is as before 0000-7FFF, which is mapped into the PET memory map at 8000-FFFF (minus cut outs). The second set is in the EPROM from 8000-FFFF, and is mapped into the PET at 8000-FFFF.

And so on, a 27C010 can contain 4 images, 27C020 8 images, a 27C040 16 images and a 27C080 can contain 32 ROM images, which should be enough for anyone. 

In all cases, these are 32K blocks just stuck together.

ROM Address
Contents
00000-07FFF
ROM set 1
08000-0FFFF
ROM set 2
10000-17FFF
ROM set 3
etc.
etc.


Building ROM images

To build a ROM image, I suggest working on 32K chunks at a time, and then combining those later to create the final ROM image. This allows you to go back and make different "mix tape" ROM sets of all your favourite versions of BASIC. No? Just me then.

The individual ROM images can be found online, the best source being the wonderful zimmers site.

http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/pet/index.html

Any space not used should be padded with 0xFF characters.

I'll only give a couple of examples here, as this post is already far too long and has no where near enough pictures in.

BASIC 2

ROM Image Address range
Contents
File
0000-0FFF
-
-
1000-1FFF
Option ROM
Various / Optional
2000-2FFF
Option ROM
Various / Optional
3000-3FFF
Option ROM
Various / Optional
4000-4FFF
BASIC 2 C000
901465-01
5000-5FFF
BASIC 2 D000
901465-02
6000-6FFF
BASIC 2 E000 (Normal)
901447-24
BASIC 2 E000 (Business)
901474-01
7000-7FFF
BASIC 2 F000
901465-03

There are a choice of the E000 ROMs for normal or business keyboards.

BASIC 4

ROM Image Address range
Contents
File
0000-0FFF
-
-
1000-1FFF
Option ROM
Various / Optional
2000-2FFF
Option ROM
Various / Optional
3000-3FFF
BASIC 4 B000
901465-23
4000-4FFF
BASIC 4 C000
901465-20
5000-5FFF
BASIC 4 D000
901465-21
6000-6FFF
Editor E000 (Non CRTC)
901447-29
Editor E000 (40 column normal 50Hz)
901498-01
Editor E000 (80 column business 60Hz)
901474-03
etc.
so many to choose from
7000-7FFF
KERNAL F000
901465-22

There are many editor ROMs to chose from, for different hardware, different refresh rates, different languages, different keyboards etc. There are also differences to the way the screen editor works, with the normal keyboard, 40 columns builds using line linking to allow mulitple screen lines per lines of code. The 80 column business keyboards were single line only, but supported windowing modes where areas of the screen could be fixed (c.f. the status line in Zork).

There are many versions of the editor ROMs on Zimmers, including a couple I patched for alternate keyboard types. Those are the ones with .ts.bin extensions (my attribution appears to have been lost in the mail).

Other images types

I think that is just about it. There are a few exceptions, you can put any code you want in there, you can run from 9000 through to FFFF with only the IO cutout. Put the usual NMI, IRQ and Reset vectors in the last six bytes and the rest is up to you. For example, see a previous post about running Cheese and Chive from ROM

http://blog.tynemouthsoftware.co.uk/2022/04/running-cheese-and-chive-from-rom-on-a-mini-pet.html



Advertisements

The Mini PET 40/80 kits are all sold out, but there are some Mini PET 40/80D boards still available from TFW8b NOW WITH £50 OFF (whilst stocks last) 

https://www.thefuturewas8bit.com/shop/tynemouth-products/minipet4080d.html


PET ROM RAM 

The PET ROM RAM is available from my SellMyRetro store (UK only, sorry)

The smaller version on the left allows up to 8 ROM images to be select, and replaces either all or none of the ROMs and all or none of the RAM. Ideal for a fit and forget repair or upgrade.

https://www.sellmyretro.com/offer/details/62175

The larger version has up to 16 ROM images and has finer control of which regions of ROM and RAM are replaced.

https://www.sellmyretro.com/offer/details/62176

Patreon

You can support me via Patreon, and get access to advance previews of projects and behind the scenes updates. This now also includes access to my new Patreon only Discord server for even more regular updates.

https://www.patreon.com/tynemouthsoftware