Topics:
There are two major methods of input, the real keyboard on your computer and the virtual keyboard of the emulator.
The support of real keyboards is set up so that you may type as natural as possible. Special characters are generally what they are on your keyboard. E.g., the double quote is still how you type it normally, probably a shifted key, while it is no a shifted key on the PET 2001. Hitting a normal letter key will produce this letter as normal, even if it appears in upper case on the PET. Shifted variants of PET characters are available for all of the alphabetic characters, allowing you to enter the common Commodore BASIC abbreviations naturally as on a real PET. However, shifted variants are probably not available in combination with special characters or punctuations. In this case, please resort to the virtual keyboard (see below). The shift key on your keyboard will still work, so you may shift-click a key on the virtual keyboard to access a graphics character.
The emulator works best with a full-size keyboard featuring a numeric keypad, which generally mirrors the layout of the PET 2001’s chicklet keyboard. This is especially true for games, which freequently make use of the numeric keypad for directional input. Cursor keys and editing keys, like HOME, DEL, etc, are supported as well and mapped to their PET equivalent, including support of shift keys. In order to mirror the PET 2001 keyboard layout even closer, the ENTER key on the numeric keypad is mapped to “=
” and the decimal key is always mapped to a dot (“.
”), even if it is a comma on your particular keyboard.
However, not all PETSCII characters have a direct equivalenant on modern keyboards. Therefore, a few special mappings are used:
^
”) and to TAB, as well,π
)._
”) and to ALT+TAB,◥
”®
”, which should be ALT+R on most keyboards.The virtual keyboard, depicted below the screen, is ideal for touch screens and also complements the real keyboard for the input of graphics characters. Simply tap or click a key on the keyboard image (visual feedbak is provided). To input a shifted character, first click/tap one of the two SHIFT keys and then click/tap the actual key. If you have a real keyboard, shift-clicking a key will work as well.
The “touch cursor” allows you to freely position the cursor anywhere on the screen, by simply clicking or tapping onto the emulated screen. Repositioning the cursor will also force the editor out of quote/insert mode and reset any active RVS ON mode.
To use this feature, please activate the checkbox “Touch Cursor” below the emulated screen. Be aware that accidential clicks/taps may interfere with input statements. So, while this is helpful for editing and sketching up things on the screen, it may be best to leave this option off while running programs.
The PET 2001 doesn’t feature key repeat. To the opposite, its operating system actively inhibits it. In order to facilitate natural keyboard input and fluent cursor movements, the emulator adds a key repeat of its own, both for the real keyboard and for the virtual keyboard. However, this usually isn’t best for games, which often implement a keyboard repeat of their own. Games will also benefit from the more immediate reaction of the unmodified keyboard input. Therefore, the emulator features a a special menu to switch between “Editing” (virtual key repeat on) and “Games” (virtual key repeat off) modes. This menu is found, like all other emulator controls, directly below the virtual screen.
The PET 2001 features, like all the Commodore 8-bit computers that followed, two character sets, one for upper case letters and graphics characters (default), and one for upper-case / lower case text and just a limited range of graphics characters. Mind that the original PET 2001, unlike later models, displayed unshifted characters in upper-case in both modes and displayed lower-case letters for shifted characters!
This is how you change the character set on the PET 2001 (by a POKE to a hardware address, the PCR of the VIA):
POKE 59468,12
… switch to upper case / graphics.POKE 59468,14
… switch to upper case / lower case.There’s also an item “Switch Character Set” in the “Utils/Export” menu (see below) and a respective item in the context menu for the virtual screen that will do the same for you.
The emulator features a set of basic controls, which are found below the virtual screen in two rows.
First row:
Second row:
The emulator has a virtual IEEE-488 device attached at address 8, which can be used to load and save files. To save a program, type “SAVE
"NAME",8
” (replace “NAME” by your actual choice) and the emulator will generate a binary file in .prg
format. What happens next, may depend on your browser and your operating system: you may be prompted with a file dialog and a suggested filename, or the file may be simply downloaded to your normal download folder, or, if there’s no native support for this, the emulator will display a ribbon with a link, which you can right-click (or Cmd-click on Macs) in order to save the file.
There’s also an option “Save BASIC as PRG-File” in the “Utils/Export” menu, which does essentially the same, without requiring an explicit command to be typed into the virtual machine.
(Note that IEEE-488 doesn’t work very well with ROM version 1.)
There are several ways of loading a file into the emulator:
Mounting a file and typing “LOAD
"NAME",8
” into the emulated PET. This will load any previously mounted file into the emulator.
Note on ROM 1.0 (old Rom):
IEEE-support isn’t great with ROM version 1 and requires pessing the STOP key. However, the emulator will press the STOP key automatically and will, in case the file starts at the usual BASIC start at $0401
, attempt to adjust the BASIC system pointers accordingly to the program. If all works well, there shouldn’t be any notable difference in operations.
LOAD
"8:NAME",8
”.You may mount a file either via the “Mount File” button, which will give you access to your normal system file dialog or per drag and drop. Archive formats, like disk images, will bring up a directory dialog. The emulator supports full access via “LOAD
”. There’s also full support for disk directories in drive 8 (including wildcards and type selectors). Tape archives (“.t64
”) are handled like disks mounted in drive 8.
There are a number of file formats supported by the emulator, commonly known by their file extension:
.prg
, .pet
):SHIFT
while dropping such a file onto the emulator to just load a program without running it automatically..d64
):LOAD "NAME",8,1
” on later Commodore machines). However, you may want to run a BASIC program which was meant for a different Commodore 8-bit machine, which uses a different start address for BASIC programs. Check this option in order to do so and the PET will adjust the program to the usual start address.RUN
” and press ENTER manually. However, you may want to inspect the program by typing “LIST
” or using any of the Utilities (see below), in which case this option should be off..t64
):.p00
….p99
):.txt
, .text
, .bas
, .ba
):{…}
”), see below for details.The emulator will accept only files with any of the file extensions listed above and will handle the files based on that extension.
A places to look for program files may be www.zimmers.net/anonftp/pub/cbm/pet/ALLFILES.html (have a look at the sections demos/Cursor/ and games/). Download files to your computer and then drop them onto the emulator.
Editing BASIC source file using your own, favorite text editor and simply dropping them onto the emulator is probably the most comfortable way of programming a PET 2001. (No chiclet keyboard, and, while the BASIC editor was certainly nice for its time, your text editor is probably better at it.) Just be sure to save the file as a plain text-file (Unicode is supported, of course).
BASIC source files maybe in either character case, the emulator will try to figure out the correct case for each of the lines. If a line starts in lower case, it will assume lower-case text. Otherwise, it will assume upper-case text (default). Meaning, you may even mix case between lines, as it may happen with copy & paste. Empty lines will be simple ignored.
The usual rules for BASIC text apply: You may use “?
” for PRINT
and even the usal Commodore BASIC abbreviation, like “pO
” or “poK
” for “POKE
”. Mind that BASIC only accepts lines of up to 80 bytes length (that is, after tokenizing any BASIC keywords to single bytes). The emulator will abort with an error message, if a line exceeds the maximum length. Also mind that the maximum line number in Commodore BASIC is 63999
!
BASIC source files must be in plain US-ASCII text only, with the notable exception of the PI symbol (π). Hence, any special PETSCII characters must be escaped in a special markup. (Mind that graphics characters may appear in BASIC only inside strings.) The emulator uses curly brackets for this (“{…}
”), which may embrace either a PETSCII character code in decimal or hex notation or a label.
{ddd}
{147}
” (clear screen) or {18}
(rvs on).{$hh}
{$93}
” (clear screen).{label}
{HOME}
”, and their abbreviations are supported. This should work naturally. Any spaces or dashes are ignored. See below for an extensive list.{n label}
{4 SPACES}
or {12 DOWN}
, as may be found in some listings (but will never export them for compatibility reasons.) This works also with decimal or hexadecimal character codes.(In case the emulator fails to parse an escaped character code or dosen’t recognize a label, it will simply ignore it.)
The PET 2001 uses fewer control characters than later machines, just 12 in total, of which onl 7 may appear in strings. Here they are are, together with a few extra characters and the labels that may be used for them (spaces, etc in names are ignored, as well as case):
As you may see, there’s an abbreviation for everyone and most of the common abbreviations will be recognized. Just use what ever you are used to or what’s in the type-in listing. (The emulator will use the very first label in each of the lists, when exporting a program using labels, see below. Spaces or π will never be replaced by markup in any of those exports, as these are printable characters.)
The emulator will load any of the programs from the Program Library using special hot-links. For security reasons, this option is restricted to files in this specific server directory and will not work with external resources.
Parameters are (either as a query string or as hash/fragment, separated by “&
”:
prg=<filename>
, also program=
, load=
, run=
run
” spefically to auto-run a text file. If there’s no file extension supplied, “.prg
” will be assumed./
) as a path separator. If no file name is found, a directory list dialog will be displayed.disk=<filename>
, also floppy=
, d64=
, dsk=
t64=<filename>
Generally, default options may be specified in URL parameters, as well.
As above, parameters are (either as a query string or as hash/fragment, separated by “&
”.
keyboard=<option>
, also kbd=
, kbdmode=
repeat
”, “edit
”, “editing
” (key repeat on) and “norepeat
”, “games
”, “gaming
” (key repeat off).repeat=<option>
yes
”, “no
”, “off
”, “true
”, “false
”, “1
” or “0
” to set the option.color=<option>
, also clr=
, screen=
white
” and “green
”.ram=<size-in-K>
8
” (default), “16
” and “32
”.rom=<version>
1
”, “2
” (default) and “4
”.autorun=<option>
repeat
).asbasic=<option>
, also isbasic=
, basic=
$0401)
.Mind that this allows you to bookmark a preferred configuration, like using the link ?screen=white&ram=32
for a white screen and 32K of RAM.
Finally, you may load an entire BASIC source text using URL parameters. The source may be either encoded using X-WWW-Form-URL-encoding (AKA form data) or as a base64 string. Again, this me be supplied either as a query string or in hash/fragement. All the above configuration parameters also apply and may be used in conjunction.
data=<data-string>
base64:
” or “data:<mime-type>;base64
” is found the following stream will be interpreted as base64 encoded data. (Suitable MIME-types are, text/plain, text/basic, application/text, application/basic, or application/octet-stream.)filename=<string>
” or “name=<string>
”.
execute=<data-string>
, also exec=
E.g., for a simple hello-world example,
?data=10%20print%22hello%20world%22&autorun=true
,
or, using the hash/fragment,
#data=10%20print%22hello%20world%22&autorun=true
.
(The difference is here, that a normal query string, strating with “?
”, will be sent over the network, while a hash/fragment will be handled inside the browser only.)
And here’s an example for executing a statement in direct mode,
?exec=print(100+20)*5
.
All the usual PETSCII escape may be used (see above), also “\pi
” may be used to escape Pi (π), e.g.,?exec=printsin(\pi/6)
The “Utils/Export” menu (see below) includes an option to automatically generate a data URL for the BASIC program currently in memory.
You may also use the Link Console to assemble a data-URL for the emulator.
The menu “Utils/Export” below the emulated screen provides a number of ways to export your work from the virtual machine or to interact with it in oder ways. As there are:
CHR$()
statements, which will work everywhere, or any of the special escapes used by the emulator, compare the section on PETSCII escapes above.{HOME}
”, where applicable.)CHR$()
sequences. This is the most compatible option and should work everywhere. However, mind that there’s a small chance that a line may exceed the maximum length and the source may require some manual editing, because of this.0xC000
.SAVE "FILENAME",8
” in BASIC.THEN
, GOTO
, GOSUB
, ON … GOTO
, and ON … GOSUB
.Some of the screen related options are also available in a context menu of the virtual screen.
The implementation of copy & paste may vary with browsers and their specific implementation of security related features.
The first two items of the context menu of the virtual screen expose copy and paste functionality:
If the browser supports the feature and there isn’t a pop-updialog active, pasting is also supported via the system “Paste” menu item and its associated shortcut. (Currently, this is supported by all major browsers, as Google Chrome, Mozilla Firefox, Apple Safariat, at least in the respective desktop versions.)
Mind that you may only paste to a PET that is interactive and ready to accept keyboard input, meaning, it must not be paused and there has to be an active cursor.
Pasted text will be evaluated for case before it is transferred to the emulated PET and may contain the usual PETSCII-markup ({ddd}
, {$hh}
, {label}
). To the PET it will appear the same as if the text had been typed in by the keyboard. Pasted text may stretch over multiple lines and may even encompass an entire program. If not present, a closing RETURN will be added to the text in order execute it.
Tip: Paste may be used to supply multiple values to input statements of a program, one line per input statement, which may come handy for testing.
E.g., pasting the following will enter a tiny program, run it, and will pass the values 4
and 5
to the executing program:
10 PRINT "RECTANGLE" 20 INPUT "SIDE A"; A 30 INPUT "SIDE B"; B 40 PRINT "AREA: "; A*B RUN 4 5
However, mind that transferring a file per drag & drop is still the preferred and also quicker method of loading BASIC source texts.
For more information on PET 2001 operations, you may download some essential references directly from this site:
Further manuals and references can be found at www.zimmers.net/anonftp/pub/cbm/manuals/pet/ and www.commodore.ca/commodore-manuals/.
Did you know that the PET 2001 has a built-in monitor in ROM? (ROM version 2, AKA “new ROM”, and ROM 4.0.) The interrupt vector points to the machine monitor. Therefor, jumping to any memory location containing zero (the 6502 instruction BRK
) will give you immediate access to the monitor. Such a location is conveniently found at 0x0400
, thus you may enter the monitor from BASIC by executing the command, “SYS 1024
”.
OPEN
and CLOSE
for programs that require additional data files.Let’s see…
N. Landsteiner, V.1.5, December 2022
This is the old version 1.x of the emulator. Mind that there is a newer version with more and updated features.
Credits:
Commodore PET 2001 by Commodore International / Commodore Business Machines (CBM), 1977-1979.
Commodore PET 2001 emulation © 2014 Thomas Skibo (all rights reserved, redistribution permitted).
PET keyboard image (SVG, rerendered to PNG) by Lovelac7, 2008, Wikimedia / Creative Commons.
Image of PET 2001 computer (edited) by Tomislav Medak, 2009, Creative Commons.
Revised interface, screen emulation, input and output handling, as well as import and export features and utilities by Norbert Landsteiner, 2017–2022, www.masswerk.at.
Running Files:
You may run programs by simply dragging and dropping files onto the virtual screen of the emulator.
Supported file formats are:
Binary files will be run automatically (hold SHIFT to override), while BASIC source files are just loaded in order to allow for an inspection of the generated BASIC program.
(BASIC source files may be both in lower and upper case, case is evaluated on a per-word basis. No attempt is made to translate non-alphabetic PETSCII characters, please use "chr$()" or the special PETSCII escapes instead.)
You may also provide a BASIC source text as URL-Data. See the link console to craft such a URL.
For best gaming experiences set the keyboard to "Games"-mode (no simulated key repeat and immediate touch interaction) from the pop-up menu at the bottom of the virtual screen.
Directories are fully emulated for disk images and tape archives (emulated as disks in drive 8), including LOAD commands and directory listings from BASIC, wildcards and type selectors. Please mind that the emulated IEEE interface currently doesn’t support advanced BASIC 4.0 disk commands. (E.g., please use the traditional “LOAD "$",8
” instead of “DIRECTORY
”.)
New: Basic support for BASIC 4.0
See here for some games (with hotlinks to load them into the emulator) and PET 2001 manuals.
Note for iPad users (9.5in): Consider adding this page to your home screen. If started from there, the navigation bar will be hidden and the interface should just fit the screen.
Escape as:
Export Data-URL
Renumber BASIC Lines and Jump Targets
Drag or right-click to save
→ Shift-click “run” links to create a new entry in the browser history.
Mount File
Press the button and choose a file.
Type ‘LOAD "*",8’ and ‘RUN’ to run a mounted file.
Archives, like disk images, will automatically bring up a directory dialog to choose from. You may also access a mounted archive like a normal floppy disk in drive 8.
Clicking the media icon to the left of the name of the mounted will also trigger the most appropriate action (load and run a single file or display a directory dialog).
Mind that you may always drag and drop a file onto the virtual screen (outside of this dialog).