CBMSTEVE.CA - Steve J. Gray's Homepage
CBMSTEVE.CA - Personal pages of Steve J. Gray
Changes Info Prototypes Remakes PET Projects CBM Projects Modding 3D Models KiCad Github Ohio Scientific Other My Software My Collections Facebooks

The PET/CBM Editor ROM Project

Introduction

Welcome! This is a project to build various Editor ROMs for the Commodore PET/CBM computer models with BASIC 4 ROMS and CRTC (cathode ray tube controller) chip. Other older machines are not supported!

The Editor ROM is responsible for all video initialization, screen output, keyboard input, full-screen editor, and IRQ handling. By putting all this in one ROM Commodore were able to customize the machines for various markets, with different options. Commodore provided for most combinations, but not all models got all options. Later CBM machines had additional editing features and even a simple power-on menu for "Executives".

I have a couple other projects that are related and could benefit from a "one-source for all" editor ROM. My ColourPET project adds colour capabilities to the PET/CBM and these new hardware features must be implemented in the Editor ROM. My Replacement PET Keyboard project also uses the Editor ROM by modifying the keyboard scanning matrix table. It was also clear that Commodore's simple keyboard scanning routine in earlier ROMs was inadequate to support the various keyboards that we would like to use.

This project will allow us to build Editor ROMs with any combination of features that we would like, and allow us to extend the ROM to support additional features in the future.

Implementation

In late 2012 I started disassembling the various Editor ROMs to try to understand how they worked. I used the symbolic disassembler feature of my CBMXfer program and created source code for most ROMs. I started adding comments to the code. At this point I knew enough to be able to patch the ROMs manually to change the keyboard layout, or adjust the screen parameters so that it would would be compatible to NTSC monitors, and even created a "Soft-40" ROM that allowed 80 column machines to boot in 40 column mode.

In 2013, after seeing my ColourPET project, Edilbert Kirk sent me his fully disassembled and commented 8296D source code. This source was for his own Mac assembler. Since I dont have a MAC, I set about adapting the code to the ACME assembler, which is multi-platform. I added a lot of comments that I had done from my previous disassemblies and I pulled out all keyboard and screen tables and made them as includes. I added assembler directives so that you can easily select which options you want.

I also disassembled several other 3rd-party PET Editor ROM's, and found source code for the C64, C128, and CBM-II firmware, which I also hope to incorporate into this project.

Goals

Standard PET/CBM Machines support the following features:

In addition I have added, or want to add the following:

Source Code

I have decided to make this an open project, so hopefully people can contribute. The latest source code can be found on GitHub here:

github.com/sjgray/cbm-edit-rom.

If you are interested in contributing fixes/new features etc please let me know.

The source code for this project is formatted for the multi-platform ACME assembler. The file "EDIT.ASM" is the main file. Different ROM images can be generated by setting specific variables listed at the top of the file. You can re-create a couple of existing Commodore Edit roms by setting those variables to specific settings. For custom ROMs you can modify those variables, usually by setting them to a non-zero value. For example, to create a ColourPET rom, set COLOURPET=1.

To make your own EDITOR ROM on a Windows PC:

If you are not on a Windows PC you will need to download the appropriate ACME for your system. Refer to your OS guide for how to edit text files and run command-line utilities.

You may edit the "!TO" line to set the name of the output file.

Binaries

If you don't feel you are able to assemble your own EditROM binary from the source, then look on Github in the binaries folder for some pre-assembled versions. Look at the filename to see which features and options are included. The filename will follow this convention:

sjg-edit-codebase-columns-keyboard-screen-options (date).bin"

So, for example sjg-edit-c1-80-b-60-esc-wedge-ss40-reboot (2015-12-03).bin is an "Edit-rom-project" binary with Codebase 1, 80-column screen, business keyboard, 60Hz power (20Khz refresh implied), with escape codes, wedge, ss40 and reboot option, created on 2015-12-03 (YYYY-MM-DD).

I won't be able to generate every possible combination of features, but if you need something specific let me know and I can add it to the binaries directory.

ROM Codebase

The CODEBASE is the foundation or base code to build on. The CODEBASE determines which features are available, and which options and enhanced features are available for it, which will determine which PET hardware it is appropriate for. There are three different CODEBASE's as supplied with standard "Commodore PET" ROMS. They have the following features:

CODEBASE ROM SIZE KEYBOARD COLUMNS LINELINK WINDOWING OTHER
C02KGraphic40YESNO Simple screen editor.
C12KBusiness80NOYES Enhanced Editor. Shifted symbols on number keys.
C24KBusiness/DIN80NOYES Advanced Editor. Character set switching, Diacritics, Graphic symbol via multi-key entry, CTRL key. Two keyboard matrices.

The CODEBASE will determine the size of the EDIT ROM. Both C0 and C1 are 2K. Adding EXTENDED features to a 2K ROM will expand it to 4K. CODEBASE 2 is 4K already which means there is no room available for adding EXTENDED features. Not all EXTENDED features can be combined at once.

IMPORTANT NOTE!: Currently this project only supports BASIC 4 machines with a CRTC controller. BASIC 1 or 2 machines, or machines with NON-CRTC motherboards such as 2001 or 3xxx series are not supported! Commodore's model#'s can be confusing and it's possible that motherboards may have been upgraded/swapped, so if in doubt check your motherboard for a 6545 CRTC or equivilent chip.

Status

The initial code was uploaded on Dec 2/2013 and was made to assemble to a byte-exact copy of the 324243-02 ROM. Most of the source is commented but there are still some areas that are not; particularly, the extended keyboard scanner and character handling code. I have included files for various keyboard layouts and screen parameters. I have also included the raw disassemblies for Execudesk from Commodore, and one third-party autoboot rom. I have extracted a few routines from the C64 kernal relating to colour codes, and have written additional code to support ColourPET.

Commodore Editor ROM Reference

These are the Commodore supplied Editor ROMs that were released for use with BASIC 4 CRTC models. Check the part number to see what features it has:

PART# CODEBASE SCREEN KEYBOARD HERTZ SIZE NOTES
324243-01 C280x25DIN504K
324243-02bC280x25DIN504K4V2E
324243-03 C280x25DIN504K4V2E
324243-04 C280x25DIN504K4V4E
324728-02 C280x25DIN504K
901474-02 C180x25B ? 2K
901474-03 C180x25B 602K
901474-04 C180x25B 502K
901498-01 C040x25N 502K
901499-01 C040x25N 602K

Features

In the table below you will find a listing of the major features and their current status. Some features (Marked 2K) are implemented as patches or replacement code for existing features and can fit in a 2K ROM, while others (Marked as EXT) are implemented as brand new code, and will require a 4K ROM if OPTROM=0. If OPTROM>0 then EXT code will be relocated.

Please check carefully which features are available for the CODEBASE (C0, C1, C2) you wish to use! For example, since C1 does not support line linking, I do NOT recommend EDITING BASIC programs when using SOFT40 mode - Lines may be truncated!!!!!!

FEATURE C0 C1 C2 SIZE NOTES
CODEBASE Available YES YES YES - CODEBASE 0 was recently added, so has limited features
OPTROM YES YES -- - Moves EXT code to OPTION ROM space ($9000 or $A000)
40 Column Support YES YES -- 2K Supports 40 column wide screen (Soft40)
80 Column Support YES YES YES 2K Supports 80 column wide screen
Soft-40 YES YES YES 2K 80-COL. Turn your 80 column machine into a 40 column
Switchable Soft-40 -- YES -- EXT 80-COL. 40/80 switching on the fly. REQUIRES ESC CODES!
Hardware Switchable 40/80 -- YES -- EXT 80-COL. 40/80 switching on the fly. REQUIRES ESC CODES and HARDWARE Add-On Board!
Line Linking YES -- -- 2K Ability to link multiple lines for editing. NO means limited to line width!
Enhanced Screen Editor -- YES YES 2K Screen editor supports additional codes plus Windowing
C0 Keyboard Scanner YES YES -- 2K GRAPHIC keyboard scanner (simple shift)
C1 Keyboard Scanner YES YES -- 2K BUSINESS keyboard scanner (more standard)
C2 Keyboard Scanner -- -- YES 2K ADVANCED keyboard scanner (diacritics and key combinations)
Large-matrix Keyboards -- PART-- 2K In Progress. Requires hardware mod. Inital/untested support for 16x8 matrix CBM-II keyboards.
Keyboards YES YES YES 2K Supports 6 different keyboard layouts
Keyboard Reboot -- YES -- 2K Soft Reboot using a combination of keys
Keyboard ASCII/DIN -- YES -- EXT Swaps Y/Z keys. REQUIRES ESC CODES!
Screen Rate YES YES YES 2K Supports internal and external NTSC/PAL monitors
IRQ/Clock Accuracy YES -- -- 2K Codebase>0 needs investigation.
Screen Font Mode YES YES YES 2K Ability to boot in TEXT or GRAPHIC mode on startup.
ESC Codes PARTYES -- EXT Mostly working - Need to implement some more codes.
Wedge YES YES YES EXT Integrated DOS Wedge.
Custom Banner YES YES YES EXT Customized Power-on Banner text.
Execudesk YES YES -- EXT Working. Both 80 and 40 column options. REQUIRES BOOT to TEXT mode!
Autoboot YES YES YES EXT Working.
ColourPET -- YES -- EXT Most codes working. Need fixes for cursor/colour. REQUIRES ESC CODES!
Video Mode Select -- YES -- EXT Select Video Mode. REQUIRES ESC CODES!
Info -- YES -- EXT Display Project Info with ESC-BACKARROW. REQUIRES ESC CODES!
Enhanced Screens -- YES -- 2K 80x35 character text screens on 8296.
SuperPET compatibility -- PART-- ^ See SuperPET section below.

Status as of 2022-04-24. Check GitHub for latest info. PART-Means partial support - see notes.

IMPORTANT!: The PET/CBM's have limited Zero Page (ZP) memory available. Additional features require additional ZP storage. Memory locations that have been re-assigned should not be regarded as permanently set. As features are added and/or modified it might be necessary to change these assignments! Re-assigned locations may also cause problems with certain 3rd-party software apps, or they my cause new features to break or work in an unexpected way! 100% compatibility is not guaranteed!

PET/CBM Memory Map

The memory map of the PET/CBM machines looks like this:

The PET/CBM Editor ROM normally resides from $E000-E7FF. There is one page of I/O at $E800-E8FF, and additional space at $E900-EFFF. This additional area was used for some advanced Editor ROMs in some PET/CBM models. There were two normally empty "Option ROM" sockets which could be used to add various utility software, BASIC extensions, ML monitors, or as program protection. You can choose to place EXTended Editor ROM functions in either Option ROM space if you wish.

Screen RAM is from $8000-83FF for 40-column machines, or from $8000-87FF for 80-column machines. My ColourPET board will use the RAM from $8800-8FFF as colour and/or font attibute RAM.

OPTROM option

The OPTROM option allows you to re-locate the EXTended code to one of the PET OPTION ROM sockets at $9000-9FFF or $A000-AFFF address space. This would then allow the EDITOR ROM to remain 2K, placing extra code in a separate EPROM chip. This would allow 8K of additional editor rom code. This option may also be needed if you are building an editor ROM for a SuperPET machine. See the SuperPET info section farther below for more info.

OPTROMDESCRIPTION
0Additional code at $E900-EFFF (after normal code)
1Additional code at $9000-9FFF (option ROM #1)
2Additional code at $A000-AFFF (option ROM #2)

IMPORTANT!: When you assemble the code you will get ONE BIN file containing the entire space from $9000 or $A000 (depending on OPTROM) to $E7FF. You will need to manually split this file into separate BIN files for burning to EPROM!

I use a program called HxD on the PC to edit binary files. Here are the steps to split the binary:

Keyboard Scanner

The keyboard scanner interfaces directly to the PET hardware, checking which keys are being pressed, decoding the special keys (SHIFT, CTRL etc) and converting them to actual keystrokes. The scanner doesn't care which keyboard is selected, it just interprets whatever is in the keyboard matrix.

Set KEYSCAN to select which keyboard scanning code is used. At this time I recommend using KEYSCAN=1 to use the Business Keyboard scanning code. I am working on integrating additional scanning routines such as the VIC/64 scanner, which will support multiple modifier (SHIFT, CTRL, C=) keys. I am also planning to support "large matrix" keyboards up to 16x8 but that will require a hardware modification.

NUM SCANNER STATUS DESCRIPTION
0KEYSCAN-GDONEGraphic. Single Table. SHIFTed keys are calculated. Does not handle symbols above numbers.
1KEYSCAN-BDONEBusiness. Single Table. SHIFTed keys are calculated, with special handling for numeric keys on the top line. Recommended.
2KEYSCAN-DINDONEDIN/Extended. Two Tables - Normal and Shifted, plus support for diacritics and graphic symbols.
-KEYSCAN-C64-C64/VIC scanner. Four Tables. Not complete at this time.
-KEYSCAN-CBM2-CBM-II scanner. Four Tables. Not complete at this time.

Supported Keyboards and Options

The keyboard matrix(s) determines the layout of the keyboard. Standard PET/CBM keyboards are supported, as well as some modified layout keyboards, and also VIC/C64 keyboards (with some limitations). Set KEYBOARD=num to select from the table below. There are separate keyboard definition files for each scanner routine (KBD=normal, KBDX=extended).

NOTE: Not all keyboards are available for all keyboard scanning routines!

Set REBOOT=1 to enable Soft Re-boot. This lets you re-boot the PET/CBM by holding down a combination of keys (like CTRL-ALT-DEL on modern PC hardware). The keys are determined by the KEYBOARD setting.

Show all keyboards here

NUM STATUS NAME NOTES REBOOT
0 DONENNormal/Graphic Keyboard - 2001 Chicklet. @ , LSHIFT , RSHIFT , DEL
0 DONENNormal/Graphic Keyboard - Standard. @ , LSHIFT , RSHIFT , DEL
1 DONEBBusiness Keyboard - Standard QWERTY layout. ESC , LSHIFT , RSHIFT , DEL
2 DONEDIN1German DIN Keyboard - Layout 1. ESC , LSHIFT , RSHIFT , DEL
3 DONEC64Commodore 64 Keyboard. CTRL , LSHIFT , RSHIFT , DEL
4 DONEB-SJGBusiness Keyboard - Modified Layout. ESC , LSHIFT , RSHIFT , DEL
5 DONEN-SJGNormal/Graphic Keyboard - Modified - @=ESC, BACKARROW=@. ESC , LSHIFT , RSHIFT , DEL
6 DONEBZBusiness Keyboard - QWERTZ layout. ESC , LSHIFT , RSHIFT , DEL
7 DONEBABusiness Keyboard - AZERTY layout (french). ESC , LSHIFT , RSHIFT , DEL
8 IN DEVCBM2Commodore CBM-II Keyboard (requires hardware mod). ?
9 DONEN-SJG2Normal/Graphic Keyboard - Modified - BACKARROW=ESC. ESC , LSHIFT , RSHIFT , DEL
10 IN DEVNAGraphic Keyboard - AZERTY layout (french). ?
11 IN DEVNATED (C116,C16,Plus/4) QWERTY layout. ?

Click on NUM link for a picture.

NOTE: Some software, notably GAMES bypass the normal keyboard scanning routine with their own routine. These games will not be aware that the keyboard is different. In this case you will have to play the game based on the KEY's original POSITION in the matrix. This is also important for 80-column machines using SOFT-40 or SS-40. Refer to the n-vs-b-keyboards chart.

Screen Refresh

Early PET machines had no CRTC controller chip and generated a FIXED screen refresh of 15kHz (approx) on its internal 9" monitor. The signal could be sent to an external NTSC video monitor. Later PET/CBM's added the CRTC controller which allowed the video signal to be configured on the fly. The refresh was set to 20kHz for the new 12" screens. Unfortunately this meant the signal was incompatible with external monitors. Luckily the CRTC controller settings can be adjusted.

Setting the REFRESH option allows you to select the proper CRTC register values for your intended monitor. The following are available:

NUM LAYOUT
COLSxROWS
V-FREQ
(kHz)
H-FREQ
(Hz)
SCREEN INVERT NOTES
040/80x255020.000 Internal 12" YESEuropean 4000/8000/8296/9000
140/80x256020.000 Internal 12" YESNorth America 4000/8000/8296/9000
240/80x255015.625 External PAL YESPAL monitor
340/80x256015.748 External NTSCYESNTSC monitor
440/80x256015.748 Internal 9" NO Old PET 9"
8240/80x255016.949 Internal 12" YES8296D only!
8340/80x255016.949 Internal 12" YES8296D only!
9040/80x3260? Internal 12" YES8296/8296D machines only!
9140/80x3560? Internal 12" YES8296/8296D machines only!
9245/90x3560? Internal 12" YES8296/8296D machines only!
99CUSTOM ---- CUSTOM ---Custom settings - user edit

* Optimal value. Frequencies can be off slightly depending on specific ROM settings

The standard for the internal 12" monitor is to invert the video output by setting bit 12 of the start address of the video screen (register 12 = 16). For 9" monitors the video should NOT be inverted (register 12=0).

Screen Font

PET/CBM's have two screen fonts; "Text" and "Graphics". Text mode gives lowercase and uppercase letters and a limited set of graphics characters. Most 80 column machines boot up in Text mode. Graphics mode changes lowercase to uppercase and gives the complete set of graphics characters. Most 40 column machines boot up in Graphics mode. It's important to note that switching between text and graphics modes does NOT change the codes associated with the key, but only its appearance. To set the default screen set FONTSET=0 for Text or FONTSET=1 for Graphics.

International Character Support

The PET/CBMs had support for international character sets, in the form of replacement Character ROMs. These 2KB ROMs replaced standard PETSCII characters/symbols with special symbols and/or characters using accents/umlats/diacritics etc. Later PET/CBM's supported an extended FONT set, with two additional fonts, totalling 4 fonts in a 4KB ROM. This was first used on the SuperPET to support a standard ASCII font, and also for a special APL symbol set. Later Commodore supported the GERMAN 'DIN' character set with an expanded EDITOR ROM (CODEBASE 2) and DIN Character ROM. To access these special characters you would press two characters and they would be combined into one with the proper accent/umlat/diacritic.

When not using the CODEBASE 2 editor, the normal way to access the extended sets is to POKE the hardware directly, but if you include ESC CODES then you can use ESC-Z. ESC-Y returns to the standard font set.

To view/download international character set ROMs click here.

Soft-40

PET/CBM machines come in both 40 and 80 column versions. Early 40 column machines had most of the game software, whereas 80 column machines have most of the "business" software. You want games and serious apps?... what to do? Soft-40! Soft-40 allows your 80 column machine to behave much like a 40-column machine. Games that poke to the screen will display correctly. It does this by re-programming the 80-column PET's CRTC controller to only show 40 columns per line. The left and right margins are increased leaving 40 (squished) columns in the middle of the screen. That solves one major problem, but be aware that some 40-column software expects to have a "graphics" keyboard and so some game controls might be messed up. Refer to the n-vs-b-keyboards chart for new control key mapping.

Set SOFT40=1 to enable Soft-40 mode. Your 80-column machine now becomes 40 column.

Switchable Soft-40

This is an EXTENDED feature, requires ESC CODES, and 80-column hardware. Switchable Soft-40 lets you toggle between 40 or 80 columns using ESC-X! Set SS40=1 to enable Switchable Soft-40. Set SS40MODE to 40 or 80 to set the initial screen mode on bootup.

NOTE: Do not enable SOFT40 and SS40 at the same time!

Hardware Switchable 40/80

Back in the day there were hardware 40/80 column switchers, like the Comspec 40/80. I have cloned this board as my CBM 40/80 Switcher Project. and combined it with a Edit-ROM Switcher in my Multi-EditROM+40/80 Switcher Project. These projects are currently being completed. To enable Hardware Switchable 40/80 set SS40=1 and HARWARE4080=1. Also set SS40MODE to 40 or 80 to set the boot-up column size.

These boards are controlled using an unused address pin on the 6845 CRT Controller chip. Stay tuned for updates!

Enhanced Screens

Normal PET screens are 80 or 40 columns by 25 lines. Some CBM machines (8296, 8296D) have extra usable screen RAM. Since the CRTC controller in the pet is configurable, one can tweak it to produce "non-standard" screen layouts. I have been able to extend the PET screen to be 80 or 90 characters by up to 36 lines. Theoretically this could also be used to simulate screens from other computers, such as the VIC-20 (22x23), OSI (32x32, 64x32, 48x16), or even the Pacman screen (36x28).

To play with the screen parameters I have written a program I call CRTCX, or CRTC Explorer. With this program you can modify any of the CRTC's registers and define your own custom screens (within specific parameters). You can find it on GitHub in the software folder. However, you are cautioned that this program can let you change registers which can go out of range and cause your PET's monitor to go crazy or even disappear! It may even be possible to damage the monitor, although so far I haven't managed to break anything yet. If your screen goes funny, quickly change the parameter back, or if the computer is unresponsive turn the PET off just to be sure.

Changing the screen is only one step to make it work. You'll also need to adjust some other routines to get the PET to work on your custom screen, such as the ROWS/COLUMNS variables, and the SLA (screen line addresses) table.

Escape Codes

This is an EXTENDED feature. ESC Codes were first seen in the CBM-II series, then the TED series and finally the C128. These add additional screen editing capabilities. In some cases these mimic some of the standard CHR$() codes. An escape sequence is the ESC key followed by one additional key. Pressing ESC twice will cancel the sequence and also "escapes" from insert and quote mode. Escape codes can be used in programs by doing PRINT CHR$(27);"X" (where "X" is the function code)

Setting ESCCODES=1 adds ESC codes. Since the PET/CBM video hardware is not as advanced as on those machines, some ESC sequences have been changed. Also, if you set COLOURPET=1 you will get additional codes to set the screen colour.

NOTE: To use Escape Sequences you need a keyboard with an ESC key! The 'B' and 'DIN' keyboards have one as standard. The 'N' keyboard does not. I have created a keyboard map called N-SJG that redefines the "@" key as an ESC key as a temporary measure. Make sure you select the correct keyboard number!

Current/planned ESC codes:

BASIC ESC CODES

SEQ DESCRIPTION STATUS
ESC-@Clear Remainder of ScreenPENDING
ESC-aAuto Insert PENDING
ESC-bSet Window Bottom OK
ESC-cCancel Auto Insert PENDING
ESC-dDelete Line OK
ESC-eCursor Non Flash CHANGE **
ESC-fFlash Screen OK **
ESC-gBell Enable OK
ESC-hBell Disable OK
ESC-iInsert Line OK
ESC-jStart-of-Line OK
ESC-kEnd-of-Line PENDING
ESC-lScroll On PENDING
ESC-mScroll Off PENDING
ESC-nScreen Normal OK *
ESC-oESCape. Also: ESC+ESC OK

BASIC ESC CODES

SEQ DESCRIPTION STATUS
ESC-pErase Begin OK
ESC-qErase End OK
ESC-rScreen Reverse OK
ESC-sText/Lowercase Mode OK *
ESC-tSet Window Top OK
ESC-uGraphics/Uppercase Mode OK *
ESC-vScroll Up OK
ESC-wScroll Down OK
ESC-xSwitch 40/80 Col OK
ESC-yNormal Chr Set OK *
ESC-zAlternate Chr Set OK *
ESC-[Mark Start OK *
ESC-\Swap Y/Z keys OK *
ESC-]Mark End (Copy) OK *
ESC-^Paste (^=UP Arrow) PENDING
ESC-BAShow Info (BA=BackArrow)OK

COLOURPET ESC CODES

SEQ DESCRIPTION STATUS
ESC-0Set Colour to Black OK
ESC-1Set Colour to Medium GreyOK
ESC-2Set Colour to Blue OK
ESC-3Set Colour to Light Blue OK
ESC-4Set Colour to Green OK
ESC-5Set Colour to Light GreenOK
ESC-6Set Colour to Dark Cyan OK
ESC-7Set Colour to Light Cyan OK
ESC-8Set Colour to Red OK
ESC-9Set Colour to Light Red OK
ESC-:Set Colour to Dark PurpleOK
ESC-;Set Colour to Purple OK
ESC-<Set Colour to Dark YellowOK
ESC-=Set Colour to Yellow OK
ESC->Set Colour to Light Grey OK
ESC-?Set Colour to White OK
ESC-eFill Colour BG OK **
ESC-fFill Colour FG + BG OK **

VIDEO MODE SELECT

SEQ DESCRIPTION STATUS
ESC-0Set 40/80 Text, 60Hz OK
ESC-1Set 40/80 Graphics, 60Hz OK
ESC-2Set 40/80 Text, 50Hz OK
ESC-3Set 40/80 Graphics, 50Hz OK
ESC-4Set 8296D Text, 50Hz OK
ESC-5Set 8296D Graphics, 50Hz OK
ESC-6Set NTSC, Non-Inverted OK
ESC-7Set NTSC, Inverted OK
ESC-8Set PAL, Non-Inverted OK
ESC-9Set PAL, Inverted OK

Codes marked with '*' are different than C128/CBM-II functions. Those marked '**' differ between PET and ColourPET!

Auto Run

This is a mechanism to allow optional features to be run once the machine is finished initializing. A "SYS" command is placed into the keyboard buffer, which then is run. The AUTORUN manager will then run whatever tasks that are needed. The "SYS" command string will be erased so that no messages will appear unless part of an AUTORUN task. Setting BYPASS=1 will add a check to disable the AUTORUN by holding any ROW9 (bottom row of matrix) key down at boot.

Banner

This is an EXTENDED and AUTORUN feature. This allows customized Banners (power-on messages) to be displayed. Normally the PET displays "*** COMMODORE BASIC 4.0 ***" and a bytes free message. You can overwrite any of this text or completely erase it and display anything you like. Set BANNER=#, where '#' is from the following:

# MODEL MODE TYPE DESCRIPTION
1 CPET GRAPHOVER"COMMODORE COLOURPET" in colour on top of banner
2 CPET TEXT OVER"ColourPET BASIC4 + Wedge"
3 80-COLTEXT OVER"Commodore EDITROM Project - Wedge/ESC/SS40"
4 ANY GRAPHOVER"CBM BASIC 4 WITH WEDGE"
5 CPET GRAPHFULLC65-like screen with colour bars
6 80-COLANY OVER"commodore basic 4.0 with wedge/esc/ss40"
7 80-COLANY OVER"commodore basic 4.0 with wedge,esc,reboot,40/80 switcher"
8 8296 ANY OVER"commodore 8296 basic 4.0 with wedge,esc,reboot,80x35 screen"
9 8296 ANY OVER"commodore 8296 basic 4.0 with wedge,esc,reboot,extended screen"
1080-COLANY OVER"commodore basic 4.0 with wedge,esc,reboot,ss40, execudesk"
1180-COLANY OVER"commodore basic 4.0 with enhanced editor and wedge"
1240-COLANY OVER"cbm basic 4 plus editor+wedge"
138296D ANY OVER"commodore 8296 basic 4.0 with wedge,reboot, backarrow"
148296D ANY OVER"commodore 8296 basic 4.0 with custom editor rom"
158296D ANY OVER"commodore 8296d basic 4.0 with custom editor rom"
1680COL ANY OVER"commodore basic 4.0 with custom editor rom"
99ANY ANY ADD Displays DATE and COMMENT for debug purposes

TYPES: FULL - Replaces all, OVER - Overwrites some text, ADD - Adds to existing banner.

Wedge

This is an EXTENDED and AUTORUN feature. Commodore released the "Universal Wedge" program that allowed you to perform disk-related tasks without resorting to the complicated BASIC4 syntax. Nils Eilers disassembled the wedge and provided the source code which was incorporated here. Thanks Nils! NOTE: Wedge commands only work in immediate mode. Set WEDGE=1 to include wedge code. If WEDGEMSG=0 the wedge will be installed invisibly. If WEDGEMSG=1 it will display "WEDGE ACTIVE".

The following wedge commands will be available:

COMMANDDESCRIPTION
#DEVICE Set the default DEVICE number. IE: #8 or #9. Without unit number shows the current default drive.
@$[[DRIVE]:FILENAME]Displays the disk's directory. Wildcards are supported. SPACE=Pause, any other key to continue. STOP=Abort.
/FILENAME Loads a program from default drive.
^FILENAME Loads and runs a file ("^" is up arrow, NOT "carat")
@ Read and display disk status
@STRING Sends 'STRING' to the device's command channel. See DOS manual for valid commands.

Disk Auto Boot

This is an EXTENDED and AUTORUN feature. Automatically loads and runs the first file from disk. Works the same as SHIFT RUN/STOP. Can be used to load a BBS or menuing system at startup. To enable set AUTOBOOT=1. Auto Boot is always performed last.

Video Mode Select

This is an EXTENDED feature that requires ESC Codes. This allows you to switch to a specific video mode. To enable set ESCCODES=1 and VIDSWITCH=1. See ESC CODES Table for details. This features would, for example, allow you to switch from normal internal monitor frequencies, to either NTSC or PAL for use with a composite video adapter, for toggling video invert (9" monitor), or shifting the screen on an 8296D. The Video Mode is temporary and can be cancelled if you or a program uses the TEXT/GRAPHIC CHR codes, ESC Y/Z font change, or if the Hard 40/80 column mode is changed.

IMPORTANT: Switching to NTSC or PAL when you are using an internal PET monitor will cause the monitor to be distorted. Similarly, when switching back to normal 20kHz mode will cause the composite video output to be non-standard and likely non-viewable.

ColourPET

This is an EXTENDED feature. This is to support my own colour hardware board, currently in development. The board adds colour capability to any PET/CBM with "universal dynamic pet" motherboard. Please see the ColourPET page for additional info.

Two versions of the ColourPET hardware are planned. Version 1 is the "Digital" version, designed to output to a RGBI digital monitor. Each character on the screen can have 16 foreground and 16 background colours. This board has been prototyped and is working, but needs some additional fixes. Version 2 is the "Analog" version, designed to output to an RGB Analog monitor. Each character on the screen can have 256 colours using the "RRRGGGBB" colour assignment. The background colour is fixed for all characters. This board is still in the early planning stages. Additional enhancements are planned for both versions, such as border colour or transparent colour capabilities.

When COLOURPET=1 AND ESCCODES=1 Colour features will be enabled. For early prototype boards set COLOURVER=0. If you are running ColourPET using VICE set COLOURVER=1. This option sets the memory location for colour ram. Set COLOURMODE=0 for digital (16 colour) hardware, or to "1" for Analog (256 colour) boards. You can also select the DEFAULTFG (foreground) or DEFAULTBG (background) colours.

The DIGITAL version has 16 colours that match the Commodore C128's 80-column VDC mode. These are:

NUM PETSCII COLOUR
0144 Black
1152 Medium Grey
2 31 Blue
3154 Light Blue
4 30 Green
5 99*Light Green
6151 Cyan
7159 Light Cyan
NUM PETSCII COLOUR
8 28 Red
9150*Light Red
10129 Dark Purple
11156 Purple
12149*Dark Yellow
13158 Yellow
14155*Light Grey
15 5 White

Colours codes marked with a '*' replace existing PET codes. For the analog board these colours will be converted to the closest analog equivilent automatically.

Execudesk

This is an EXTENDED feature AND an AUTORUN feature depending on setting. Some 8296/8296D machines came with "Execudesk". This is a power-on menuing system designed to make the machine easier to use. You could select a wordprocessor, database, and spreadsheet for example simply by selecting a number from the menu. Set EXECUDESK=1 to include Execudesk code compatible with Commodore's Execudesk ROM. With this option there is limited space for other EXT features, and some EXT features may not work correctly (ie Autorun).

Set EXECUDESK=2 to include Execudesk as an AUTORUN feature. This setting is more compatible with EXT features. When OPTROM=0 there will be limited space. If you set OPTROM to 1 or 2 the EXT code will be relocated to the PET's OPTION ROM sockets. This would allow enough space to include all EXT features. See the OPTROM section above for more info.

Execudesk was only availible on 80-column machines from Commodore, but has been adapted to work also on 40 column machines.

Project Info Display

With this project you can create an Editor ROM with almost any combination of features/settings. To make identifying binaries easier, the project settings are automatically listed and placed in the hidden IO area of 4K ROMs. This area is not visible to the PET, but can be looked at with a HEX VIEWER on your PC. You may also enter a date and comment that will be included.

If you want, this info can also be included in the code area of a 4K ROM. Set INFO=1 to include it. Also, if you enable ESCAPE CODES you can press ESC-BACKARROW to display this info on the PET's screen.

Colour6847

This is a project by Tony Ellis to connect a Motorola MC6847 Video Display Generator chip to the PET. The MC6847 is a low-resolution colour capable chip that supports text and graphics modes. It has a built-in character generator and can access up to 6K of dedicated video RAM. I saw Tony's project on Facebook and we started chatting. He asked about getting my Editor ROM project to work with this chip. Tony's circuit is designed to plug into one of the PET/CBM Option ROM sockets ($A000-AFFF). To add support I added a new ROWS variable which normally will be 25 for the PET. The 6847 screen is 32 x 16, so if you set COLUMNS=32 and ROWS=16 it will be enabled.

Ultra-PET

The MicroPET and UltraPET are projects by Andre Fachat to build an enhanced PET with Colour using real hardware. Please refer to Andre's project here: https://github.com/fachat/csa_ultracpu

Misc Options

The following are some additional options:

SuperPET Info

The SuperPET's have an additional 6809 CPU, ACIA (RS-232) chip, "protection" chip, and additional registers to control memory. The ACIA and protection chips reside at $EFE0-EFFF in the upper extended editor ROM area. In normal "6502" mode, if a 4K Editor ROM is used, accessing that area will cause bus contention, meaning neither the ROM nor the ACIA will work. If you don't need to access the ACIA then you CAN use a 4K Edit ROM provided the code does not use the last 32 bytes of the ROM. Also, when in 6809 CPU mode all PET ROMs must be disabled. This is done using the NOROM signal on the motherboard. The MASKED Edit ROM works fine for this, but replacing the ROM with an EPROM has an issue. To disable an EPROM the NOROM line must be inverted.

I have designed a Multi-EditROM adapter which handles the NOROM signal. Unfortunately it does not fix the bus conflict. If you need an Edit ROM that fills the entire 4K or more you can relocate the EXT code to one or both of the Option ROM ($9000-$9FFF and $A000-$AFFF) areas. To relocate, set OPTROM=1 or OPTROM=2 options, which will put the extra editor ROM code to option ROM space.

Some Practical Uses

Ok, so that's a lot to take in at once. Here are some practical uses for a custom Editor ROM:

Related Hardware

I have designed some hardware add-ons for the PET that can add additional features! They are:

Related Software

While developing new features I sometimes write utilities to make things easier. You might find some of these useful. You can find these utilities in the /SOFTWARE folder.

Milestone Log

Contact

Project created: Dec 3/2013. Last updated: Jan 26/2025, 1:00pm EST

Send comments or feedback to Steve Gray(sjgray@rogers.com)