Showing posts with label Commodore PET. Show all posts
Showing posts with label Commodore PET. Show all posts

Sunday, July 16, 2023

Tut-Tut: Tomb Raiding on the Vic-20

1 comment

Tut-Tut Concept Art

A New Version of a Modern Retro Classic

Given the resounding success of my little game of Tut-Tut on platforms such as ZX Spectrum, ZX81, Jupiter ACE, and the commendable port by Tynemouth Software's Dave Curran to the Commodore PET, it was an inevitable progression to broaden the game's horizons and introduce it to the illustrious Vic-20, the "Wonder Computer of the 1980s."


New to Tut-Tut? What's this Game About?

As the digging season of 1921 draws to a close in Egypt's Valley of the Kings, it becomes evident that your excavations have yielded disappointing results. Despite your ardent efforts, no traces of the fabled and elusive Pharaohs' tombs have been uncovered. However, as the final weeks approach, intriguing rumours begin to circulate, recounting chilling accounts of vengeful mummies exacting retribution upon local would-be tomb raiders.


These wild stories, though tinged with the supernatural and curses, cannot be ignored. As an Egyptologist and daring adventurer, you find yourself presented with concrete leads and irresistible opportunities. The allure of uncovering long-lost secrets and ancient treasures proves too tempting to resist, even in the face of ominous tales of wrathful spirits.


Tut-Tut Vic20 Screen Shots
Screen Shots from the Vic-20 version of TuT-TuT

Now, on the cusp of a new expedition, you stand poised to delve into the unknown depths of the Valley of the Kings, ready to face the mysteries and potential dangers that lie ahead. Will you emerge unscathed from the clutches of ancient curses, or will the vengeful spirits lurking in the shadows prove to be more than mere legends? The answers await, as you embark on a daring quest that will test your courage, knowledge, and perhaps even your beliefs.

Prepare to embark on a journey like no other as Tut-Tut takes you on an adventure through the treacherous Egyptian tombs, with its visually stunning colour scheme and a myriad of intricately woven graphic tile sets that bring the ancient world to life before your very eyes.


The Making of the Vic-20 Version  

Tut-Tut initially originated as a BASIC type-in game, designed specifically for the ZX Spectrum and published in Paleotronic Magazine. Further versions of the game for the ZX81, Enhanced 2020 Spectrum Edition and Jupiter Ace, the latest version was one ported to the Commodore PET by Dave Curran. All varieties have all kept the core structure and mechanics as outlined there.

After witnessing the success of Dave's PET version, I couldn't help but ponder the possibility of bringing Tut-Tut to the Vic-20. While considering the similarities between the two machines, I became aware of the numerous disparities that needed to be addressed, particularly in terms of screen real-estate and the Vic-20's unconventional memory management scheme. Luckily i raised the conversion idea with Dave, and he was up to a joint challenge, as I'm in no way sure I'd have got there without our joint efforts.

Screen Real-Estate and Luck by Design

Due to Tut-Tut's origin as a ZX BASIC game, one that need to run quickly, lead to the adoption of a 26x17 character grid for the game board layout (excluding score bars etc). The ZX Spectrum's character resolution is 32x24, constraining the board size to a smaller grid made for more time efficient code in the very orriginal ZX BASIC version. These dimensions sunsiquently stuck for all future conversions.

However, while the grid size was suitable for the ZX line, it posed a challenge when porting Tut-Tut to the Vic-20. Those familiar with the Vic-20 immediately noticed the issue: the Vic-20's screen width is only 22 characters wide (and 23 high). This presented a hurdle that needed to be addressed in order to adapt the game for the Vic-20.

A possible solution could have been to reconfigure the game's levels to fit within the Vic-20's 22x23 screen limitations. This would have been easily achievable code wise, but level design wise it would come at a cost to the overall feel and immersion. A particular issue, as the existing levels are heavily constructed around the games mechanics and already small(ish) screen size.

Tut-Tut Vic20 Screen Shots / PAL vs NTSC Geometry
PAL vs NTSC Geometry Comparison

As luck would have it, the Vic-20's screen sizes can be redefined to an extent. Values in memory location 36864 to 36867 can be POKED to set screen geometry and centring. The results of doing so yielded just the right amount screen width to fit the existing level structure.

Yet another obstacle presented itself: the disparities in screen geometry between PAL and NTSC standards. NTSC, in particular, occupies a wider physical width on a display (not pixels) compared to PAL. However, by a stroke of luck, the constraints imposed by the level width inadvertently resulted in an image that delicately brushes the very edge of an NTSC display. This serendipitous alignment allowed Tut-Tut to make the most of the available screen space on both PAL and NTSC systems.

Graphics Updates

The Vic-20 is perhaps renowned for its vibrant and colourful display, you'd think this would be directly comparable to the ZX Spectrum in terms of its rich palette. However, an intriguing aspect arises when considering the variation in colour appearance based on factors such as the age, make, and region (PAL/NTSC) of the Vic Chip utilised on any given machine. Then there is the screen fuzziness / blurriness, which again varies. 

The diversity in colour appearance on different Vic-20 machines prompted us to reevaluate tile design and colour choices for Tut-Tut. In the Spectrum version, the game employed various palettes that cycled based on the level number, creating a dynamic and ever-changing visual experience. However, for the Vic-20 version, we've opted for a different approach. Instead of cycling palettes, we focused on expanding the selection of available thematic tiles while exercising tighter control over the colour schemes. (A good approach, and If I hadn't mentioned it, would probably gone unnoticed.)

We're pretty confident we reached the required level of ancient Egyptian cinematic charm / ham.

Memory for Mummies?

Another challenge we faced was determining how much memory we could allocate to the game on the Vic-20. By default, the Vic-20 only had a modest 3k of onboard memory, which was insufficient to accommodate even the most streamlined versions of Tut. The issue was further compounded by the lack of a standardised expansion memory layout and location of that memory on a Vic-20. This variability made it difficult to rely on expanded memory for larger games, often leading to the reliance on cartridges for larger game titles.

Ultimately, we proceeded with the assumption that modern enthusiasts would likely possess a contemporary memory solution, such as the Penultimate+, offering a generous 32k of memory. This assumption gave us the confidence that the game could be released on cassette. Little did we know at the time of developing the game that Tut-Tut would eventually become a pack-in title on the Penultimate+2 Cart from TFW8b.com.

Pharaohs' (Pen)Ultimate Enhancements

The Vic-20 version of Tut-Tut comes packed with all 36 levels from the ZX Spectrum 2020 Edition. In addition, we have incorporated 6 exciting new levels (bringing the total to 40) that are carefully integrated throughout the game, providing fresh challenges and surprises.

We have also included the convenient pause option from the PET version, allowing intrepid Archaeologists to take much needed meal and rest breaks. Furthermore, one of the most highly requested features we have implemented is the inclusion of level codes: Enter specific codes to access the harder levels previously reached.

All very good reasons to call this Vic-20 version, the Ultimate Tut-Tut.
 

Playing Vic20 Tut-Tut with the Peultimate+2 Cartridge
Playing Tut-Tut Vic-20 as included on the Penultimate+2 Cart

Special Thanks

I Can't end this post without thanking Dave Curran for sharing in the creation of the Vic-20 conversion, he'd paved much of the ground work during his PET efforts.

Additionally, thanks very much to Rob Hull for including the game in the Penultimate+2 games lineup. Very happy indeed to have it listed alongside the other TFW8b titles.


Fancey Delving Deeper into the Vic-20 Conversion?

Further Readings  unraveling the mysteries of Tut-Tut Tomb's and the Vic-20 conversion are now available on the Illustrious Tynemouth Software Blog.


Raid the Pyramids for a Copy of TuT-TuT


Commodore Vic-20

Commodore PET

ZX81 Versions

ZX Spectrum Versions

Jupiter Ace

TRS80 MC-10


Read More

Sunday, August 15, 2021

Tut-Tut on the Commodore PET

Leave a Comment

For a game that started out as type-in program for Paleotronic Magazine, Tut-Tut has received a load of love. I'm constantly surprised at Tuts success throughout all the versions I and others have released. 


The various Spectrum versions feature in YouTube videos, the ZX81 version made the review pages of Retro Gamer, George Becketts' Jupiter Ace port has become quite the hit in Forth Circles and the original type in version even made it to the TRS-80 MC-10 courtesy of Jim Gerrie. Yes for a game that I wrote initially to prove Sinclair BASIC games didn't have to be a slow boring mess, Tut-Tut found it's mummified legs and ran with them.


All of which brings us around to the latest port, Dave Currans' 2021 Commodore PET release of Tut-Tut.  


Pharaohs' 6502 Tomb of PETs

Ostensibly the PET port is based on the source code from the ZX81 version of the game. Considering the graphical limitations of Commodores first line of computers, the ZX81 version provides the perfect starting point.  Of course the source code is only the beginning, there are many challenges in transposing  games from system to system. 


Dave has done a brilliant job of porting and preserving the overall feeling of the game. Game play is smooth and crisp, and you certainly don't ever feel cheated when caught out by Pharaohs' treasure guardians.


Tut-Tut on the Commodore Pet


In the PETs favour, the limited music and sound effects from the Spectrum and Ace versions have been incorporated, along with the ability to pause the game. All features that lend to your immersion into the game world. (Why I forgot to include 'pause' in the ZX81 release I've been meaning to ask myself for ages.)


I'm not going to dive any deeper into reviewing the game, I feel that's best left to others, after all I've got quite a stake in this title in general. What I will say however is that PET Tut-Tut is every bit Tut-Tut, and if you've enjoyed the other varieties then you're sure to love this one as well.


The game is now available from The Future was 8bit on Cassette as part of their £4.99 range or digitally at Itch.io. I strongly recommend loading up ASAP, Pharaohs' treasures await.


One again, great Job Dave!





Raid the Pyramids for a Copy of TuT-TuT


ZX81 Versions

ZX Spectrum Versions

Jupiter Ace

Commodore PET

TRS80 MC-10

Love the Game?









Read More

Friday, August 13, 2021

Mini PET 40/80 Build & Review

4 comments

 


The New Tynemouth & TFW8b.com Mini PET

Back in 2020 Tynemouth Software released the Mini PET onto a largely unsuspecting retro computer kit appreciating public. 2021 sees the release of a significant update to the standalone kit in the form of the Mini PET 40/80. What's it like? How easy is it to build? How usable is it? Lets find out.


A new PET in a Kit

At first the Commodore Personal Electronic Transactor (PET) seems an unlikely choice for a computer kit, being possibly the least widely used of the classic Commodore computer lines. Then again PETs are the raison d'être for all subsequent Commodores and for that reason alone places the PET line in a very special place.


Now there were quite a variety PETs produced, the the first being the 2001 series, going all the way up to SuperPET 9000s. But what type of PET is a Tynemouth Mini PET 40/80? Well, it's most of them and none of them all at the same time (well kind of). Internally the Mini PET 40/80, as the name suggests is a 32k PET 4000 series / CBM 8000 series clone, yet it takes the stylised keyboard from the original 2001.

Unlike Commodore PETs, Tynemouth / TFW8b PETs come unassembled, and in that state it's pretty damn impressive. Mr Tynemouth aka Dave Currans' kits are normally impressive enough, but with the powers of TFW8b & Tynemouth combined something special awaits the keen kit builder this time around. 

The kit comes in quite the box; A light blue Commodore Pin Stripping cover sleeve cloaks the contents, imparting that essential Commodore-ish-ness of what lays within. Once opened our container reveals an equally special spiral bound assembly booklet, a PCB, the required ICs and other components neatly arranged out on build trays, plus a host of laser cut perspex sheeting that will go on to form the computers case.


The Opened PET kit ready to roll.

Thanks to all the hard work that's gone into first impressions, there's no sense of dread to be had before embarking on the build, quite the opposite, you can't wait to get the PET together.


Build a PET

As alluded to earlier, the build manual is a kit highlight, not only striking in it's design references, it is perhaps more importantly for the purposes of kit building a very clear and well laid out reference. Being spiral bound the manual is easy to lay flat during the step by step kit building processes and each stage of the build is presented at the appropriate time. (with the possible exception of step 3, the Crystal and Transistor mounting, which I'd recommend swapping with step 4.)


Building the PET is a breeze, well more of a long gust, there's a lot to solder after all. The PCB is cleanly laid out with part placement quickly referenced in the manual. Conveniently all the IC's / Sockets are laid parallel and facing the same direction, a trait shared with other matched components such as diodes, a nice touch that makes it quite difficult to solder polarised parts incorrectly rotated.


One thing to note while building up the PCB; the solder pads around the IC's are on the smaller side, I found the use of a flux pen greatly improved my soldering experience. 


Key Craft - Cut & Place


Perhaps the weakest point of the original Mini PET was its 'tack switch' based keyboard. Not having an example of the previous model I can't reliably comment fully, still I think we can all intuitively 'feel' the issue. The Mini PET 40/80 has addressed all concerns while managing to keep a satisfying retro feel. Omron B3f Series switches underpin the keyboard this time around, Cherry MX (or 9mm Guy Preferred) they are not, though they are rather pleasant to use and should serve extremely well. In situ surrounded by a bezel the keyboard looks the part, really completing out that retro PET styling. This keyboard gets an A+ from me for effort and details (and even feel).


Once at the keyboard legend decal stage you'll have quite the arts and craft session ahead of you. 87 legend cutouts required for placement under clear keycap tops. Thankfully the kit comes equipt with several copies of the keyboard decal sheets should you make a mistake.


That leaves us with the final case assembly, and what a fine bit of work that is. Held firm on a dark base plate, the white circuit board and bezel plates all topped off with a clear laser cut etched panel, completed and all together the Mini Pet 40/80 is gorgeous.


PET Handling

Of course the most exciting part of any kit is powering it on for the first time. I was instantly greeted with the "*** MINI PET BASIC 4.1 ***" header; for what must be a first for me it all worked straight out of the gate. Good omens!.


One Mini Pet 40/80 All Together on the Workbench


Next, to test some software, I'd grabbed some PET software off the Net and loaded all manner of things up, and no issues at all. The Mini PET seems perfectly compatible with all the software I'd tried in 40 and 80 column modes. 


I'd definitely recommend purchasing the "SD2PET Future" interface alongside the PET kit if you don't already have one, particularly if you don't a Commodore Datasette (or Disk Drive), else you'll need to load manually via person on keyboard entry, all old school like.


PET Video

We have a number of video modes to choose from, some of which are quite exciting if you happen to have the correct monitor. There are the usual composite PAL and NTSC, real PET Monitor Specific modes, of more interest to some are the options for RGBI/CGA and MDA/Hercules.


Composite video quality is crystal clear when viewed on a CRT in either NTSC or PAL, and no less stunning through the my cheep and cheerful HD Video Converter. With the clarity available from composite there's not a lot of need fort RGBI or MDA except that it gives you the choice of switching on a retro green screen mode.


Close up of Composite Video on an LCD screen


I found CGA/RGBI mode is a mixed bag, although I believe that with a genuine CGA capable monitor (including the infamous Commodore 1024s series) RGBI would be quite stunning, however I have don't have an RGBI monitor to test with. What I do have are a number of CGA to VGA converters, and the picture from these was a touch disappointing, with colour ghosting and artefacting as if the phase was out. I couldn't find a way to rectify this easily. Your millage with video converters may vary significantly. On the other Hand MDA/Hercules I was able to convert perfectly. 


Similar image through RGBI with colour bleeding (note this most likely an issue with the conversion process not the actual video output)


Regardless of RGBI issues, as stated above the Composite is so crystal clear that it's no major loss if you can't get a particular RGBI converter to work as expected, or if you don't have a CGA/RGBI monitor to hand.





An Update on CGA / RGBI Video Output


Not being satisfied with the CGA to VGA converter result, I dug out an RGBI to RGBS converter I had in a draw and married that up to a SCART to HDMI converter.  The results are much clearer than I'd achieved with the CGA box. I think we can say definitively that the Mini PET puts out a pretty decent RGBI image (which would look brilliant on a CGA monitor).

 

RGBI converted to RGBS and run through a SCART to HDMI Converter. A much better Image.


For sharpest results with minimal fuss I'd still recommend simply upping the Composite video to VGA or HDMI, or maybe going straight to a TV depending.




Should You Adopt a PET?

In short YES! 

If you're interested in Commodore computers and kits, then this kit is for you. All in all this was a fun build and I'm certainly looking forward to experiencing the PET for what it is and was. The Mini Pet 40/80 is quite simply a brilliant kit computer, by far one of the most enjoyable kits I've ever built.

Adopt your own PET today from Tynemouth Software & TFW8b.com





Read More

Sunday, September 06, 2020

Commodore Educator 64 Mini: Part 3

11 comments
Here we are at the final article in the Commodore Educator 64 Mini series and there are a surprising number of loose ends to tie off; very probably the reason why it's taken a while to actually get around to documenting them.

This article more or less sums things up and provides some instruction on how get the project up and running. If you haven't read Part 1 or Part 2, I'd suggest starting from the beginning so that it all makes sense.

All files required to build the Educator Mini are made available at the end of the post.

The Final Producst
The Final Product: The Commodore Educator 64 Mini

Fitting the Keyboard and Daughter Board

The keyboard is designed to sit quite firmly in the Educator case, it shouldn't require any glue but you may need to file and / or sand the 3D printed case lightly to gain that perfect fit.

The Raspberry PI Daughter Board and monitor cables should be fitted before placing the Raspberry Pi in it's Educator case, as there is not a lot of height to play with right up the back. Cabling running to the keyboard can be inserted at any time.


Raspberry Pi Daughter Board
Educator Min Keyboard to Raspberry Pi Daughter Board / Interface

When fitting the keyboard you need to pay attention to the labels at the header pins. The numbers and letters correspond with a similar arrangement found on the PI Daughter Board. As a plus, the naming scheme also matches that used on a real 64 keyboard.


Keyboard Fitted / back view
Commodore 64 Mini Keyboard fitted Snuggly: Pay attention to the jumper setting.

In addition there is a jumper setting to be made, for use in the Mini. A Jumper should be set across pins 1 & 2. The Jumper determines the behaviour of the Shift Lock key, unfortunately there are not enough free GIPO pins on the PI to take advantage of this feature for now.


The Educator Internals
Inside the Educator MIni

Finalising Model Styling

You'd have noticed by now that the Educator Mini 64 has a somewhat different set of stickers to Lorenzo's PET (much like the real thing really). I've made up a couple of additional mini replica decals to suit the 64, the most obvious of these being the BASIC reference panel.

The BASIC keyword panel is a fairly good approximation the original full sized version and depending on how good your eyes are and the resolution of the printers used to produce the decal sheet could well come in useful.

I've also included Lorenzo's decals for the back of the monitor and the Serial Number Name Plate for the sake of completeness.

Educator 64 Mini Decal Sheet, Including everything an old computer needs.

Getting the Educator Mini up and Running

RetroPie is normally your friend for an easy Linux retro solution. Disclaimer time, I decided not to use RetroPie for this build and went with a standard versions of Raspberry Pi OS (previously called Raspbian).

There are a number of reasons I'm using Raspbian, the main ones for me being,
  1. It's just simpler to get the keyboard working with the Vice emulator.
  2. I'm only intending to use Vice and Commodore Emulation on the Mini.
Of course your needs may vary, and what ever I've done is really only a suggestion.

Installing the Vice Emulator

Raspberry Pi OS does not include the Vice Emulator as a standard package, or even an optional downloadable package, so you'll need to install it manually. I simply followed the Installation guide on krystof.io 

Once Vice is installed you'll be wanting to add a configuration file to get the emulator looking and feeling right.

Run the following commands to create a sdl-vicerc config file:
mkdir -p ~/.config/vice
nano ~/.config/vice/sdl-vicerc
[C64SC]
MenuKey=293
MenuKeyUp=273
MenuKeyDown=274
MenuKeyLeft=276
MenuKeyRight=275
MenuKeyPageUp=280
MenuKeyPageDown=281
MenuKeyHome=278
MenuKeyEnd=279
WarpMode=0
Sound=1
SoundDeviceName="sdl"
SoundSampleRate=8000
SoundBufferSize=100
SoundFragmentSize=0
SoundVolume=100
SoundOutput=1
AspectRatio="1.000000"
SDLCustomWidth=480
SDLCustomHeight=320
SDLWindowWidth=480
SDLWindowHeight=320
SDLGLAspectMode=0
VirtualDevices=1
IECReset=1
CIA1Model=0
CIA2Model=0
VICIIVideoCache=1
VICIIDoubleScan=0
VICIIDoubleSize=0
VICIIFilter=0
VICIIModel=0
SidEngine=0
SidModel=0
JoyPort4Device=0
JoyDevice1=4
JoyDevice2=4
AutostartBasicLoad=1
AutostartPrgMode=0
DriveSoundEmulation=0
Drive8Type=1571
GlueLogic=0
ETHERNETCARTBase=56832
Acia1Base=56832
AutostartWarp=1
KeyboardMapping=1

Setting Up the keyboard

There are multiple was to of configuring a keyboard for use with the vice Emulator, I've chosen the path of least resistance. Feel free to delve deeper into the heavy customisation that Vice affords. That said intense configuring is a little above what's really required for what is essentially a very cute desk toy.

For the initial steps, we'll basically be following those documented in PJ Evens's MagPi issue 67 article on page 26, make some changes specifically for the Commodore Educator 64 keyboard.

1) install Libsuinput: From your home directory:
cd
sudo apt install get libudev-dev python-dev python-pip
sudo pip install wiringpi
cd git clone github.com/tuomasjjrasanen/libsuinput
cd libsuinput
./autogen
./configure
make
sudo make install
Add the following line to /etc/modules-load.d/modules.conf
uinput

2) Install Python-uinput: From your home directory:
cd
git clone github.com/
tuomasjjrasanen/pythonuinput
cd python-uinput
sudo python setup.py build
sudo python setup.py install

3) Install cbmscanner python scripts:  Download these scripts and uncompress the file. We'll mimic the original Magi Article and install them in a subdirectory off the home dir.
cd
wget  -P ~ "http://dasteph.com/cgi/pet/files/cbmscanner.tar"
tar -xvf cbmscanner.tar

4) Create a new Service: We need to setup a new service to run keyboard scanner on boot by creating a new config file.
sudo nano /usr/lib/systemd/cbmscanner.service
[Unit]
Description=Commodore 64 Keyboard Scanner
After=multi-user.target
 
[Service]
Type=simple
ExecStart=/usr/bin/python /home/pi/cbmscanner/cbmscanner.py
Restart=on-abort
 
[Install]
WantedBy=multi-user.target
sudo systemctl enable /usr/lib/systemd/cbmscanner.service

5) Configure Keyboard Layout: Edit the keyboard file and ensure we're setup for a US keyboard layout.
sudo nano /etc/default/keyboard
# KEYBOARD CONFIGURATION FILE
# Consult the keyboard(5) manual page.
 
XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""
 
BACKSPACE="guess"
We can the reboot the Raspberry Pi, the keyboard should then work as intended.


All the Educator 64 Files to Download

Please be sure to refer back to the official  Commodore PET Mini site for the full build details and project history not covered in this series of blog articles.


See all entries for this project:  Part 1Part 2 and Part 3


Read More

Tuesday, June 09, 2020

Commodore Educator 64 Mini: Part 2

Leave a Comment
When I embarked on the Educator 64 journey I had no idea this would end up being my particular quarantine pass time. Who would have thought being stuck at home would be so useful.

So where are we up to? By the end of Part 1 I'd covered the printing of the Educator 64 Mini Case and very briefly mentioned sending a keyboard PCB of for manufacturing. This time around I'll get into the design of the keyboard and detail some additional modifications I've made to Lorenzo Herreras' Commodore PET Mini.


Mini Keyboards for Tiny LCDs

On the whole I've not diverted much from the general design of the Commodore PET MINI. The main inclusion is that of the working keyboard, I did however choose to make things slightly easier where possible in other respects.

As I was going to be ordering a PCB for the keyboard I decided I might as well design an extra PCB that would plug into the back of the LCD panel. Lorenzo's PET screen design has you dissecting a ribbon cable, then hand wiring the various bits to the back of the the Waveshare LCD screen. To much effort I thought, a nice little PCB would save all that hand rerouting trouble. I also thought mounting a reassuring yellow glowing LED at the back night add some CRT realism (or not, turned out you can't really see it once installed, oh well).

LCD Mounting PCB

I addition to the LCD mounting PCB I took the opportunity to deign and order a Pi Zero sized prototyping board which extended the pin header out and added had just enough space to the end of the board for some diodes and the like. The board was a bit of an after thought, although as it turned out I needed it.

Keyboard Design

There's no shortage of people out there hacking old Commodore 64s and making them work with modern equipment. One of the largest set of modifications to dead 64s is in the re-purposing of their keyboards for use with emulators.

To this end the schematics for the 64s keyboard are well know and have been pretty convincingly documented by Simon Inns on his page Waiting for Friday. Simon interestingly points out that the official Commodore Keyboard Schematic is wrong; that certainly spared me some confusion as not having a 64 myself I had nothing else to go by other than the published designs.

Commodore Educator 64 Mini Keyboard Circuit 

I made one minor change to the keyboard schematic; the inclusion of a jumper allowing the SHIFT LOCK key to be placed on the same Column as the Restore Key,  or in its normal state as an extra LEFT SHIFT key. On a Commodore 64 keyboard the SHIFT LOCK actually locks in place if pressed, this functionality isn't possible with the TAC switches I planned on using, so I opened the option to simulate that behaviour in software latter (This option wasn't to be, read on). 

With a known working layout for a Commodore keyboard to hand, all that need to be done was getting all to fit onto a 105x38mm PCB. As mentioned in Part 1 I'd found the perfectly sized switch in the KMR431G which has a footprint of 4.2mm x 2.8mm. The resulting layout mimics the design of a full sized Commodore keyboard. As there are to be no keycaps, Legends are printed on the PCB, some additional PCB styling gives the impression of a full space bar and a silk screened separator between the main keyboard and function keys implies the existence of the metal or plastic case shroud.

The Commodore Educator 64 Mini Keyboard PCB

Reading the Keyboard

My initial plan was to use an Arduino Proc Micro acting in HID mode for decoding the keyboard inputs and passing key presses onto the Pi. The other option I'd considered was procuring a Commodore USB Keyboard Kit from Tynemouth Software. Both of these methods required a spare USB port on the Raspberry PI, being that by this time I'd decided to us a Pi 3A+ for the project (which only has one port) I really didn't have a USB port to spare, particularly if I need to connect another device such as a joystick.

A long time ago for the AZ15 build I'd considered connecting a ZX81 matrix keyboard directly to a Pi, but thought the method a little to cumbersome and unreliable. What I couldn't find at the time was a good way of sending key presses back to the LINUX kernel, sure you could detect a keypad, but only in the active program doing the decoding, not much use for emulators. Fortunately time passes and things get developed and now there are off the shelf solutions.

Enter an article in The MagPi Page 25 by PJ Evans, where he describes, and provides many of the necessities required for reading a ZX Spectrum Keyboard directly, then injecting those key presses back into the LINUX kernel. This Sounded just the ticket for the Commodore Educator keyboard, All that's needed are some software libraries, libsuinput for handling the kernel injection, and wiringpi to run some keyboard scanning code. The only possible road block being the availability of enough free GPIO ports to handle the Commodore Keyboard.

Mapping Raspberry Pi GPIO pins to the Waveshare LCD and C64 Keyboard

At a minimum we need 17 free GPIO ports to read the c64 keyboard (without worrying about multiplexing), 8 Data lines, 8 Address lines and 1 for detecting the RESTORE key. In reality I has hoping for 18 spare GPIO pins so we could enable SHIFT LOCKing. After consulting the Waveshare LCD manual it appeared all requirements could be met, but appearances can be deceptive.

Out of 28 GPIO pins the LCD panel uses 8, leaving 20 pins. Not so fast, GPIO23 is taken when using analogue audio (which we need) and on testing I also found GPIO27 and GPIO22 also seemed to be in use by the LCD panel. That left 17 ports. However GPIO14 & 15 are used as serial lines, that's now down to 15 ports. Fortunately serial can be disabled in the /boot/config.txt file. Phew, we have just enough ports free without having to stuff around with multiplexing.

The rather messy prototyping Board full of Diodes

To get things moving along I wired up my prototyping PCB much as documented in The MagPi article, I adjusting the data and address lines (see earlier image above). I then downloaded the required zxscanner code by PJ Evens, modifying sufficiently to accommodate the C64 keyboard, the result a working keyboard.

Testing the tiny Commodore 64 Keyboard

That is of course just the start, I still need to go back though the zxscanner code and turn it into c64scanner code. As it stands zxscanner is just that, it's geared towards ZX Spectrum emulators, Commodore emulators such as Vice take a somewhat different path when mapping keys from PC-like keyboards and that is something we can tackle in Part 3.

Commodore Pet Mini
C64 Keyboard Installed and some final Decals Added to the Case

Until the next article here's a quick preview of the keyboard in action:




See all entries for this project:  Part 1Part 2 and Part 3




Read More

Saturday, May 30, 2020

Commodore Educator 64 Mini: Part 1

1 comment
What do you do with a new 3D printer, a governmental advised quarantine stay at home order and the freely available plans for a Commodore PET Mini build? Why build a Commodore Educator 64 with a functional keyboard of course.

Commodore Educator 64 - drawing by David A Stephenson 2020

Printing your own PETs.

A  little over a year ago Lorenzo Herrera launched the Commodore Pet Mini on the world, a very cute miniature PET model 8032 housing a Raspberry Pi. Nicely he also included all the 3D models and a full material list so you could build your own (and a lot of people have). 

This all looked like a really fun project, the only problem being I didn't have 3D printer.  Then quite unexpectedly and just before the world locked down the family presented me a with a Flash Forge Finder 3D printer for my birthday. Thanks Family!

And so the initial stage of building a PET (soon to become an Educator 64) Mini began in earnest.

The Making of a Model

While the PET mini is quite the functional beauty as is, what with its Pi core, tiny LCD screen and USB ports, it does almost criminally lack the most important part of an early home / office / school computer, a functional keyboard.

Before going to far along the process of 3D printing I first need to know if I could get a keyboard to fit into the PET Mini. I managed to find some very diminutive KMR431G surface mount TAC switches on Element 14, tiny but not tiny enough to build a full PET keyboard.

The KMR431G switches would just squeeze in nicely when arranged in a 64 style. As luck would have it the Case design of the PET 8032 (and Lorenzo's 3D model) is near identical to that of a Educator 64. For those that don't know, an Educator 64 is basically a Commodore 64 in a PET case sold primarily to schools; possibly making it the best 80s game playing school computer ever.

Educator 64 Mini Keyboard PCB
Educator 64 Mini Keyboard PCB

I'll cover the full details of the keyboard and how it's intended to work in Part 2: For now though I laid out a PCB that followed the C64 key mappings and sent it off for Fabrication. The important part being that I now had the measurements required to adjust the top half of the PET case to fit the keyboard. 

Case Adjustments to be Made

To fit the keyboard into the Mini I simply cutout the keyboard space from the original model and designed a shelf for the new keyboard PCB to sit on. Additionally I removed the magnet clips which would normally be located under a printed keyboard and replaced these with clips located on either side of the modified case design.

Lorenzo provides bottom case templates for Raspberry Pi 2/3's and for the 4. I had a Pi 3A on hand and further modified the lower case to fit that in place. The shorter Pi 3A board would came in handy later when cramming many additional keyboard wires into the case. 

Exploded View of the Commodore Educator 64 Mini Case.

Unfortunately the cases main top and bottom sections proved slightly too large for my printer. So I broke these down into separate components with some additional tabs put in place to make gluing them together convenient  and providing some structural strength. I also decided to divide the monitor stand into a bottom an top piece facilitating slightly easier 3D printing and finishing.


The other large-ish change I made to the original model was in redesigning the monitor frame, that part holding the LCD panel. This I made this slightly wider and a little less ovaloid in keeping with the source material. The clasp holding the monitor in place I also reduced in size considerably, minimising the likelihood of snapping an LCD panel accidentally. 

Printing and Finishing the Model

With all the adjustments made the model printed out quite easily. Finishing the the plastics took a little extra effort.

From other modelling activities I had a set of small files and sandpaper which went to good use. Quite a lot of time went into smoothing of the rougher areas and obvious layering from the 3D printing process. I wasn't intent on removing all traces of the printing technique, the model should reflect the process at least to some extent. 

Once sanded down and finished, the little Educator 64  parts were spray painted with a couple of colour combinations. The white panels being a mix of Tamiya TS-26 Pure White for the under layers and TS-7 Racing White for the finishing coats, lending a nice retro feel as the Racing White is slightly creamy in colour.

The black areas of the model were first painted in Citadel Lead Belcher, although any steel or silvery colour would be just as fine (It just happened to be the colour I had available).  The top coat is a Tamiya TS-6 Matt Black, applied relatively lightly, just enough to appear black while allowing the metallic undercoat to maintain some presence. All the components were then sealed with a Satin Spray varnish. The end result being really quite pleasing.

Commodore Educator 64 Mini based on the Commodore Pet Mini

Next Time: The Electronics

The Educator 64 fits together much as the PET mini. The major electronic components are pretty much listed at commodorepetmini.com. In Part 2 I'll attempt to go over how the keyboard is configured and how it works in conjunction with the original PET design.


See all entries for this project:  Part 1, Part 2 and Part 3

 
Read More