mass:werk / Blog

(Posts tagged “pet2001“.  All posts. RSS feed: Subscribe.)

Funny Games on a PET 2001N (or B)

A curious case of jumper settings for PETs with the dynamic system board.

A semi-abstract title illustration

The curious tale of a PET, two jumpers, and some funny games…

Continue reading…

The PET 2001 Emulator Debugger

A visual tour.

Illustration for the PET 2001 emulation debugger article

So a few words on the debugger for the PET 2001 emulator: this is meant to help you around with 6502 machine code on the virtual PET, both for exploring existing software and testing your own code.

Be my guest on a visual tour…

Continue reading…

The Commodore PET INPUT Bug-Feature

Adventures in MS BASIC (Commodore PET edition).

Well, another illustration

As it happens, I recently added a debugger to the PET 2001 emulator, with the expressed purpose of facilitating code reverse engineering. To celebrate this, we’ll risk a glimpse into a peculiar bug — or is it a feature? — of the BASIC flavor found on Commodore’s PET computers. Particularly, it’s about BASIC bailing out into a warm start, whenever an empty string is entered by just pressing RETURN on the INPUT prompt.

Continue reading…

PET 2001 Dark Mode & Themed Range Sliders

Also, how to style range inputs using CSS, including accent colors.

Title illustration: dark mode control and slider elements of the PET 2001 emulator

So the PET 2001 emulator received a dark mode. This wasn’t exactly great news, nor worthy a blog post, if there wasn’t also something to be learned from every project. In this case, it’s about how to implement accent colors for custom styled HTML range-input elements, something, I haven’t found any hint on in the entirety of the Internet.

Continue reading…

PET Business

PET 2001 emulator up to business.

Yet another illustration, including a PET 2001

The PET 2001 emulator does now support the business keyboard!
While we prepared for this and hinted here at this in the past, we now proudly present a full implementation. — Select “ROM 4b” for BASIC 4.0 with a ”b” as in “business”…

CBM 2001/B computer

Update: Our humble PET, which has thus become a “CBM Series 2001/B Business Computer”, as well, isn’t limited to BASIC 4.0 with the business keyboard any longer, as you may now also select “ROM 2b” for BASIC 2.0 with a ”b” as in “business”.

PET 2001 Emulator: Option ROMs

Just to let you know, in case you were interested…

Yet another illustration, a drawing of a PET 2001 and puzzle pieces

A very brief update notice: Inching forward on the quest for feature creep, the PET 2001 emulator now supports ROM installation per drag&drop! See the description for details.

To add a bit of meat to this post, here are the ROM socket designators of the PET 2001:

There are no sockets for option ROMs on the boards of the original PET 2001s.
Moreover, as there is no socket for B000–BFFF, we’re out of luck regarding BASIC 4 and restricted to the old and new ROM versions of Commodore BASIC. (Of course, we can always directly access the address bus on the CPU and thus provide for extra ROMs, but on an unmodified machine we are restricted in our firmware options.) Notably, the sockets, there are, are for 2K ROMs, while later models featured sockets for 4K ROMs.

On the PET 2001N, the one with the “real” keyboard, and CBMs, there are sockets for the full complement, including D3 and D4 for option ROMs:

Finally, later PETs featured the following ROM socket designators:

*) reserved I/O space at E800–EFFF.

Fun fact:
In the handwritten schematics, ”D800” for H6 looks much like “0800” and “B000” for D5 much like “8000”.

PET 2001 Emulator + 6502 Updates

Yet another software update notification.

Yet another illustration

After the big spring rewrite for version 2.0 of the PET 2001 emulator, which brought things like sound, cycle accurate video rendering (we run all the newest demos without modifications!), a new CPU emulation, and even more features, like a built-in 6502 assembler, various context aware dissassembly and dump modes to allow a close inpsection of the internals, support for joystick input with emulatinon of various adapter schemes (including SNES gamepads), and other things more, I’m happy to announce a few further upgrades.

Recently, I rewrote the entire keyboard handling from scratch, which now provides faithful emulation of the PET’s original keyboard in ”Games Mode”. Which — as suggested by the name — should provide better support for games that bring their own keyboard scan routines. (Compare our last installment.) Now I added support for a virtual numeric keypad, which is both complementary and somewhat alternative to the keyboard joystick emulation (which reroutes cursor input to any selected joystick scheme, using the CPAS-LOCK as a modal toggle.) Moreover, I rewrote the ROM implementation, which now (a) transparently relates to ROM sets and Commodore product IDs of the individual ROMs, and (b) allows modular upgrades without redundantly including duplicate code.

Somehow things are dropping in place and are coming together for a feature still missing, namely, support for the business keyboard. As the PET’s business keyboard features both typewriter-style numerals on the top row of the keyboard as well as a separate numeric keypad, which comes with its own key codes, any kind of emulated keypad is strictly a requirement for this to be of any use in the era of laptops and reduced keyboards. (Some laptops come with a NUM-LOCK feature, but others, like MacBooks, don’t have any of this. Hence, it’s up to the emulator to provide for this.) As the business keyboard also comes with its own keyboard matrix, we’ll have to replace the editor ROM in order for this to work. Which is already provided for by the new ROM architecture.

Other, I’m happy to announce that the CPU emulation passes Klaus Dormann’s functional test suite for the 6502 and the extensive decimal mode (BCD) test, which is also true for the closely related virtual 6502 emulation. The virtual 6502 suite also saw the addition of a new member, a tiny hex-editor for quick hacks of 8-bit binaries and hex-dumps (with special support for Commodore 8-bit PRG-files). Moreover, these apps now enforce their unique window identifier, which should provide improved interoperability, when switching between them, regardless of where you came from or how you navigated there.

Well, that’s it, for this time, but there may be coming more….

PET Keys — Series 2001 Edition

A closer inspection of the keyboard(s) of the PET 2001.

Another illustration

Where we investigate the PET keyboard, have a closer look at the keyboard matrix of the various layouts found on the PET 2001 and later PETs, as well, and even have a bit of 6502 fun.

Update: Now with code examples!

Continue reading…

The Case of the Missing 4th Commodore BASIC Variable (and the 5th Byte)

Yet another detective story.

Illustration: The case of the Missing 4th Commodore Variable…

We investigate the hair-raising case of the missing 4th variable type in Commodore BASIC — and a possible damsel, possibly in distress. A true detective story…

Continue reading…

December Updates

Assorted site news.

Title illustration

It’s been a while since my last post — sorry (a more substantial post is a bit long in the tooth, but may appear soon) —, so it may time to quickly announce a few updates to the site.

Since it’s end of the year, which is also the traditional time to look for a calendar, there is now one at www.masswerk.at/time/calendar. Pick a year and print it out in order to show off that you really understand how days work! :-). We had this already at our time display, but now you can have an entire year of this! E.g., here’s a link to 2023, which happens to be next year. (Make sure to disable headers & footers and to enable backgrounds in your print dialog.) If you really don’t like the idea of the layout (how dare you?), you may also export a no-frills plain-text version.

Another update is also related to time, namely it’s an international time zone conversion utility. Which can be found at www.masswerk.at/time/convert.
Now, JavaScript (and by this, your browser) features localized dates with time zones, nowadays, but this only supports foward conversions from UTC timestamps to localized dates. This, however, also involves finding a corresponding UTC date to a given local date so that you can pick a date and time in one timezone and see what this may be in annother time zone. Which is, what this utility does. (Please mind the disclaimer. Especially mind that things become a bit tricky with DST/standard time crossovers and there may be more than a single UTC reference for a given localized time-date combination. E.g., when a local clock rewinds to 2:00 am at 3:00 am, once a year.)

Screenshot of the international time zone conversion utility.

This is what it looks like. Technically, we use our trusty TZIntl.js library for this. And thanks to this, this utility runs entirely on your local computer, in the browser, without connecting to an external service or leaking any data.

Links to both utilities can be found at the bottom of our fancy time display, which is always behind the tiny clock icon at the very end of the site navigation.

The final news is about the PET 2001 emulator:
First, the emulator now supports quantifiers in PETSCII escapes in any BASIC source file or pasted code, like "{4 SPACES}" or "{12 RIGHT}", which adds another layer of compatibility to some listings as may be found in traditional type-in code. (It may even come handy for designing screen output more comfortably.) The other one is a rather major one, but without much of an external effect: The emulator now supports varying ROM sizes, which means, it now also comes with ROM 4.0. However, the IEEE interface emulation still only supports LOAD and SAVE commands, so there isn’t much utility to the advanced disk commands of Commodore BASIC 4.0. Still, there is otherwise full support for ROM 4.0, including text-to-BASIC, BASIC-to-text imports and exports and even click-anywhere-on-the-screen-to-place-the-cursor functionality (AKA, “Touch Cursor”). I guess, still sufficient added capability to elevate the emulator to version 1.5.

Copy & Paste for PET 2001

A quick update on the PET 2001 online emulator.

Title: copy & paste for PET 2001 emulator
The PET 2001 emulator just became even better.

The PET 2001 online emulator just received its first sponsored update, by this advancing to version 1.4. And this update is all about Copy & Paste integration. — TLDR version; have a look at the respective section in the online help, accessible via the “Help” button on top of the emulator’s page.

Continue reading…

PET 2001 Emulator — V. 1.1

Proudly announcing version 1.1 of the PET 2001 online emulator.

Commodore PET 2001 Emulator V.1.1 Announcement
Yet another PET 2001 related title illustration.

Version 1.1 of the PET 2001 online emulator features a totally revamped mounting and loading mechanism for files. For users this means full access to disk directories and LOADing programs from inside BASIC. For all the nerdy details and some hilarious insights into Commodore IEEE file loading (like, “Where on Earth — uhm, in memory — is the BASIC scondary device address?”) follow the link:

Continue reading…

Stay at Home Edition: Personal Computer Space Transactor 2001 (2017)

RetroChallenge 2017/04: Computer Space for the Commodore PET 2001

Personal Computer Space Transactor 2001 (PET 2001, RetroChallenge 2017/04)
Accepting the PETSCII challenge…

In 2017 I had a new toy and it was the 40th anniversary of the Commodore PET 2001, as well. So what may be more appropriate for RetroChallenge 2017 than to port Computer Space this time to the venerable PET? I always deemed it an interesting challenge to port an arcade game to a text only display, using nothing but the available characters. Could we do a free floating space shooter in PETSCII characters only and preserve some of the specific feel and attitude of the original game?

In the end, I (somewhat) succedded with a downloadable game for the PET 2001 (ROM 1 and ROM 2) and a special version for the C64. However, I actually deem the DEC PDP-1 to be the better gaming platform!

Have at least a look at episode 2, where we have a closer look at Computer Space and how early, CPU-less video games worked in general!

Start reading: “Personal Computer Space Transactor 2001”…

PET 2001 Emulator — V. 1.0

Proudly announcing version 1.0 of the PET 2001 online emulator.

Commodore PET 2001 Emulator V.1.0 Announcement
Yet another PET 2001 related title illustration.

Recently, I’ve been posting on Commodore BASIC and more specifically about the PET 2001 quite a bit. While not the sole reason, this was partly because I was adding a few features to the PET 2001 online emulator behind the scenes. I even endeavored into a major reorganization of some of the source code in order to facilitate this and future work. And, last but not least, there’s now even a suitable help file / documentation. — Reason enough to promote the emulator from its previous beta state to version 1.0!

Continue reading…

PETSCII Revealed

A closer look at the logic behind Commodore ASCII, AKA “PETSCII”, and the PET 2001.

PETSCII and the Commodore PET 2001
Investigations into a somewhat mysterious character code.

The flavor of ASCII used by the Commodore 8 bit computers, commonly known as PETSCII, is asking for a bit of an explanation. PETSCII is a peculiar beast, close to ASCII, but not quite, somewhat compatible, but not really, there are duplicate ranges of characters all over the place, and the special characters are lacking any recognizable order… — But look at all these these funny graphics characters!

In order to make sense of this and how the character set is organized, it may be helpful to have a closer look at it with a particular focus on the PET 2001. At least, this is the very machine, this character set originated on and for which it was designed for, with no idea yet that this may become the ancestor of a succesful line of home computers. Here, we may discover logic, in what must remain a puzzling enigma on the more popular and better known machines that followed, like the C64.

Continue reading…

Writing a PET 2001 Ten-Line Canyon Run Video Game

String exploits and a reasonably paced video game in just 10 lines of Commodore BASIC.

Writing a 10-line canõn run game on the PET 2001
Yee-haw! — A canyon to ride by just 10 lines of BASIC!

In continuation of and as a finale to our mini series on the internal representations of Commodore BASIC, we’ll now put some of our findings to use, especially some possible exploits of string variables.

What we’re going to do, is a classic canyon run game, where a single player rides/flies/drives/navigates a procedurally generated canyon down from the top, trying to progress as far and deeply into the winding depths as possible while avoiding the walls of the canyon. And we’re going to implement it in just 10 lines of BASIC, which puts some serious constraints on our solution. As do some of the intricacies of the PET 2001. Especially, we’ll have to avoid any direct access to the video memory (as in PEEKs and POKEs), meaning, we’ll do it all by print statements. So we’ll have to consult our bag of tricks — and come up with some exploits of the string mechanism.

Spoiler alert: It will be about fast partial strings and fast FIFO queues, while avoiding garbage collection.

Continue reading…

BASIC Variables & Strings — with Commodore

Investigations into the memory utilization of Commodore BASIC (PET 2001, VIC-20, C64)

Variables and Strings in Commodore BASIC
The astounding intricacies of Commodore BASIC variables.

In continuation of our last episode, we return to our investigations into Commodore BASIC memory representations. This time, it’s about variables, arrays, and, especially, strings.

Continue reading…

BASIC (Re)Numbering — with Commodore

How to thoroughly renumber Commodore BASIC programs (PET 2001, VIC-20, C64)

Renumbering Commodore BASIC
The curious wonders of Commodore BASIC renumbering.

Renumbering a is popular beginner’s sport for those who dare to venture into the mythical realms of intricacy, which the BASIC interpreter and its storage formats provide. Since it is also a useful utility, there are numerous programs for this, especially it’s a favorite example in the intructory sections of machine language guides. However, as always, there’s an easy way and a thorough one. And we’ll see soon, why this may be.

Continue reading…

Instant PET: Commodore BASIC as Data-URL

mass:werk proudly presents: Running BASIC on a virtual PET 2001 from URL-data.

Network URLs for a virtual PET

So you want to show your friends a little BASIC program or want to solve some problem with (retro) style? Despair no more, since help is near…

More specifically, just a click away, at www.masswerk.at/pet, where you find my enhanced version of Thomas Skibo’s in-browser PET 2001 emulation. What’s new is an additional mode, where the emulator loads (and runs) a program from data encoded in URL-parameters — as provided either in the query-string or in the URL-fragment (hash). And you may use this for immediate execution in direct mode, as well!

Continue reading…

A Curious Bug in the Commodore BASIC Tokenizer Routine

Investigations into a lesser known bug in Commodore BASIC abbreviations.

There is a well known, special feature of the BASIC implementation of Commodore 8-bit machines, namely abbreviated BASIC commands. While this is probably more a bug than a feature, this bug has a curious bug of its own. Reason enough to start an investigation.

VT100 Series CRT Typography
A slightly embarrassed Commodore PET.

Why are there these abbreviations, how do they work, and, what could possibly go wrong?

Continue reading…