Category Archives: Retro Computing

Dedicated to my adventures with my real Commodore VIC20 and programming using a Commodore 64 emulator.

The Many Ways to Run QBasic in 2020

It has been a few months now since I started playing with Microsoft QBasic again. A surprising amount of that time was spent determining the best way to actually use it in these modern times. There are so many ways it can be used!

Over the past few years I have become more aware of the energy use (and cost) of my computers. This introspection has lead me to a happy place where I can get a whole desktop computing experience while only using 27 Watts of electricity (at the outlet, not including my desk lamp). That’s extremely impressive when you consider what I am getting for those 27W:

– 24″ 1080p desktop monitor.
– Full sized back-lit mechanical keyboard, a wireless mouse, and a USB SNES style gamepad.
– Desktop speakers.
– Quad core Intel CPU that performs about the same as a 95W desktop CPU from 2008.
– A full, no compromises, Linux or Windows environment.
– An uninterruptible power supply.

In practice it’s identical to using my desktop, yet it consumes 115 to 300 Watts less power! Heck, it’s even 55W more efficient than using my Pentium 233MMX based Deskpro with an SVGA LCD. That’s a whole lot of energy efficient computing and I love it!

Oh yeah… the computer is a laptop, so I can unplug it and go use it on the porch for 8 hours or more. I tell ya, it’s an impressive setup!

So that’s my personal bias when it comes to running QBasic in 2020. I am sure the ideal setup for feeling all nostalgic and junk would be to use a real 386 or 486 computer, but to each his own.

Anyway, the following is a fairly comprehensive rundown of the various ways one can use QBasic in 2020. If you’re interested, I have some benchmark data in my QBasic repo on GitHub.


DOSBox

Honestly, this is the best way to do it. There is only one downside, which I have read about yet not personally experienced: the floating point math of the emulator can sometimes cause integer math to fail in QBasic. 1 + 1 will always equal 2, but complex algorithms might produce incorrect results. That negative possibility aside, I feel DOSBox is the best option, because the setup of DOSBox is dead simple, as is its daily use, and the performance is also excellent.

Pros:
– Easy to setup and use in both Linux and Windows.
– Performs great on low-end/low-power x86 and ARM based computers.
– Can use real floppy drives.
– Can emulate 386SX 25MHz to Pentium 200MHz without getting weird.
– Able to feel very retro, depending on one’s hardware setup.
– Integrates well with Git and other host OS file management tools.
– You have the benefit of being able to quickly fire up a normal web browser, play background music, watch a video in another window, etc.

Cons:
– Gets a little weird when the cycles are set too high (screen flickering, input doesn’t always register, and other strangeness).
– Integer math might, maybe, sometimes, possibly produce incorrect results.
– Not particularly retro feeling, depending on one’s hardware setup.
– The DOSBox developers only support its use for games, so they really couldn’t give a shit if QBasic works properly. But it does! 🙂


DOSBox-X

This is basically a more complicated version of DOSBox that is focused on more accurately emulating certain CPU types. I saw absolutely no advantage to using this for QBasic over plain DOSBox. Also, I had to compile it from source, which is obviously more involved than installing normal DOSBox.


FreeDOS / MSDOS

There are three main ways to run a full version of DOS: on an old PC, on a modern PC, and in a virtual machine like VirtualBox (or DOSBox). For the purpose of using QBasic, FreeDOS provides an identical experience to using Microsoft DOS, except that FreeDOS is easier to find and install.

Modern Hardware Installation:
It’s fast as hell, but good luck getting sound and a whole lot of other things to work on your hardware. I really wanted to love this setup, but it was just a pain the ass to use (on my laptop, which would only boot from a USB connected SATA SSD). My laptop would beep using the PC speaker, which is all the sound the QBasic 1.1 IDE natively supports, but USB sticks wouldn’t work, wifi wouldn’t work, and there’s no Git for FreeDOS. Really, I’d have to use Linux to share/manage my QBasic files anyway, so why not save myself the multi-boot jamboree and just use DOSBox.

Retro Hardware Installation:
Also fast using FreeDOS, Windows 98 DOS, or DOS 6.22 on my Compaq Deskpro. Again, USB didn’t work in any of them, forcing me to boot to Windows 98 to transfer files between machines, because none of my other machines have floppy or zip drives. It’s perfectly fine to use FreeDOS on old hardware, so go ahead and use it if you don’t own a copy of Microsoft DOS. If you’re content to keep all of your QBasic stuff confined to a single machine, a real 486SX25 based desktop with a VGA monitor would be ideal for the QBasic 1.1 IDE. Kick it up to a Pentium OverDrive 83MHz or a Pentium 75MHz if you’re looking to compile graphically intense games made for Screen Mode 13 using QuickBasic 4.5 or QBX7.

VirtualBox Installation:
Yeah, don’t. It’s slower than running FreeDOS natively on the same hardware, sound and USB still won’t work, and the VirtualBox guest additions won’t work. Unless you’re using a VHD file as your fake hard drive (which the Windows volume manager can mount), managing your files is a pain in the ass. In fact, it’s still a PIA even when using a VHD, at least compared to using DOSBox on the same hardware/OS. Having tried this with both FreeDOS and MSDOS 6.22, I see absolutely no reason whatsoever to do this. None.

DOSBox Installation:

A full version of DOS is completely unnecessary for running QBasic in DOSBox. You can add a directory to your DOS path (I use C:\EXE) and copy your favorite DOS tools to it if you’d like, but really DOSBox and your host OS already have everything you’ll need to manage your files.

Pros:
– Works great on real retro hardware. It’s DOS and… it’s free!
– On real hardware, retro and modern, it’s faster than anything else.

Cons:
– Installation is more involved than DOSBox.
– Too fast on any real hardware newer than a Pentium 75.
– Too slow in VirtualBox.
– It’s an obtuse way do use QBasic on modern hardware if you plan on sharing your programs in the modern world, unless you’re well versed in and enjoy using networked programs in FreeDOS.


PCem

As the name implies, PCem is a personal computer hardware emulator. It strives to put a real old computer inside a handy window on your modern computer. Not in a fancy way with skeuomorphic graphical representations of devices, just a normal Windows or Linux window with drop down menus. On one hand it’s retro-cool when booting a real old BIOS, while on the other hand it’s as bland as using VirtualBox.

Pros:
– Objectively, for the purpose of running QBasic, there aren’t any.
– Can match the speed of real retro hardware.
– QBasic works fine with a simple MSDOS 6.22 boot disk image, assuming you can figure out how to get QBasic onto said disk image.

Cons:
– Setup requires advanced knowledge of both old PC hardware and current ways to find, install, and use unlicensed BIOS ROMs, disk images, etc.
– Requires a beefy computer to emulate anything faster than a 486DX66.
– Uses way more host CPU cycles than anything else; it’s seriously wasteful for the end result. To match my real Pentium 233MMX system at 85W, my desktop had to use 187W. That don’t make sense!
– File management is a huge pain in the ass, having to manipulate floppy or CD disk images with obscure software in Windows and complex commands in Linux. I humbly refer to this file management system as, “convoluted as fuck”.


That covers the over-all ways one can use QBasic in 2020, the most flexible and sensible being DOSBox. Now I’ll list some pros and cons of using DOSBox in the three main hardware setup you’re likely to consider.

Desktop PC Pros:
– Greatest variety of hardware, including essentially any dual core CPU based system.
– Compatible with old PCI sound and video cards. Some Intel Pentium Dual-Core (Core2) socket 775 and AMD Athlon 64 X2 socket 939 motherboards even had ISA slots.
– Most likely to create the nostalgia of using a late 1980s, early 1990s PC. You can, for instance, easily cram an ATX motherboard into a modified AT case and use it with 5.25″ floppy disks if you’d like.
– Endless ways one can configure various versions Windows or Linux to their liking.
– Paired with a 4:3 ratio, 15″ – 17″ CRT monitor and a decent keyboard, the full screen experience looks and feels identical to the old days.
– Used 4:3 SVGA LCDs are often next to free. While they clearly do not have the same presence on the desk as a CRT, some LCDs are fairly retro looking themselves.
– With x86 desktops your limits are really just time, money, and imagination.

Desktop PC Cons:
– You’ll likely need a system from 2005-2010 if you’d like to use a floppy drive.
– A poor use of electricity.
– Battery backup / uninterruptible power supplies are large, somewhat expensive, and the batteries wear out after only a couple of years.
– Obviously not portable.

Laptop PC Pros:
– Obviously portable!
– Even a first generation Chromebook, ARM or x86 based, that has been converted to a full Linux machine can run DOSBox well enough for QBasic. My fully personalized Devuan 3 setup on my Lenovo 100e “Winbook” only uses 11GB of hard drive space. A basic Linux desktop can use as little as 4GB of space and require only 1GB RAM.
– There’s plenty of variety; You can pick a laptop specifically to use for QBasic, in which case a 4:3 screen would be ideal, or you can pick a laptop that’s suits all your other needs and just happens to also run QBasic in DOSBox.

Laptop PC Cons:
– Lower resolution 4:3 screens and SVGA outputs aren’t very common anymore, yet they are ideal for using QBasic in full screen.
– Wires, wires everywhere! Desktop and tower PCs neatly tuck their wires out of one’s way, where as laptops tend to have ports and wires sticking out all over the place when using them as a desktop replacement. I suppose a Thunderbolt dock would help here…
– Not very retro feeling, outside of using an older Lenovo/IBM Thinkpad if your version of retro swings that way.

Single Board Computer Pros:

– Energy efficient and available in ARM and x86 versions.
– GPIO pins are cool!
– Small enough to fit into any case or form factor one desires. Want to pretend you’re using QBasic on a Commodore 64? Buy a C64 with a working keyboard and a Keyrah device to convert that keyboard to USB and have at’r champ! Same goes for almost any other retro computer chassis.
– Easily repurposed for other projects.

Single Board Computer Cons:
– People say they’re cheap, but they’re not. At least here in Canada anyway. $48 for a 2GB Pi 4B, $15 for the power supply, another $25 for the SD card and cables, and then you have to factor in the cost of a keyboard, mouse, and monitor. When one adds it all up, it costs almost as much as Chromebook or “Winbook” class laptop, devices which of course come with a whole host of their own benefits. As a desktop computer, none of the SBCs make any financial sense.
– More complicated than, “Open laptop, install DOSBox, run DOSBox, win!”.


Well that about wraps it up. I hope this information has been helpful to anyone who’s feeling the itch to putter with QBasic again. I should mention that while I have been referring to using the Microsoft QBasic 1.1 IDE in this article, you will be happy to know that QuickBasic 4.5, QBX7, and GWBasic also work well in DOSBox. Personally I am emulating the 386SX era of computers, so I run DOSBox at only 5000 cyles, but it’s more than happy to kick it up to Pentium 200MHz performance levels if you need the extra umph.

As far as downloading and installing QBasic, the best resource I have found is qbasic.net. They host images of all the software. DOSBox is available from the DOSBox website or the package manager of your Linux distribution.

Here’s a Retro Desktop Chassis I’d Like to Make

Having recently modified my desk to accommodate my old Compaq Deskpro 4000, I uncovered some unfortunate consequences of the steady march of time. Always something, isn’t it!

1. My nice 15″ Acer CRT no longer works properly, with its screen dramatically pinched on the left and right sides. That’s a bummer, because it looks so nice with the size and shape of the desktop case below. Conversely, neither my 17″ Dell CRT nor my 15″ Dell LCD look appropriate on top of the Deskpro case. I like the LCD better for its size, display quality, and power usage, so that’s what I am using.

2. Both of my Compact Flash cards (1GB, 256MB) have ceased to function with the IDE to CF adapter, so I must use the very loud 10GB IBM hard drive. The issue may be with the adapter itself, I dunno.

3. The Deskpro is my only computer that can use floppy and zip disks and that’s a pain. It does have two USB ports on the rear, which I use in Windows 98 to transfer files to/from the machine, but it’s not so convenient and it’s a bit boring. I like using real disks! FYI: Windows 10 likes to crash if I use either of my PCI ATA controller cards in my main desktop, one being a Promise ATA133 and the other being a VIA based card. Of course they work fine in Linux… Always something!

4. Honestly, there’s little I wish to actually use the Deskpro for…

This got me to thinking about my old desktop PC from 2008, which has been in service as the livingroom/TV/kids desktop since 2013. Its Asus P5K-VM motherboard has a floppy controller and an IDE controller (for the internal Iomega zip drive), while also having handy modern stuff like SATA ports, Ethernet, and a Core 2 Quad CPU. It’s actually an ideal system to setup an emulation themed Linux box, both in terms of hardware I already have kicking around and in being able to easily enjoy the tactile and audible sensations of old disks… I’d probably use Mint 17.3, as it’s still my favorite Linux distro and it’s just so simple to install, configure, and manage…

Anyway, I could simply stick the floppy, zip, and DVD drives in its current boring black Micro ATX tower and use it, and that’s probably what I will end up do doing eventually, but I thought it would be fun to see if I could make a chassis in Blender 2.79b and GIMP 2.8 that’s more retro, while also matching my 15″ Dell LCD. This is what I came up with!

I like shorter desktop cases, ones like the IBM PS/2 and the Lenovo Thinkcenter M52. I also like the big red power switch and the LED panel on my old AT server tower. Finally, for black computers of yore, I like the industrial flair of the Commodore Plus/4. So those were my inspiration when I was putting this (shabby) render together.

Will I make it? Maybe someday, if I can figure out what to make it out of for as close to free as possible. Alas, it’s fun to dream! In the mean time I will continue to use my Lenovo 100e laptop (in Devuan Linux and Windows 10) and my aging AMD FX-8320 desktop, as they suit my needs and the kids are still using the livingroom PC anyway. 🙂

Microsoft QBasic 1.1 Online Reference Material

I enjoy Microsoft QBasic Version 1.1 for its inherent limitations and its delightful end user experience. It’s a system that achieves its goals in a comprehensive, compact, and efficient manner. It also runs well using DOSBox on my laptop, which is much more convenient for me than keeping my Pentium 233MMX based, DOS 6.22 system setup in my limited desk area. It’s too bad that I don’t have room for the old Compaq Deskpro 4000, because I do get a kick out of using the old beast… Nostalgia can be beautiful thing!

That said, nostalgia can also be a right pain the arse and such is the case when attempting to locate excellent documentation about using Microsoft QBasic 1.1. Not the various other iterations of Microsoft BASIC that were similar, not the countless modern remakes of QBasic that feel absolutely nothing like the original, certainly not the poorly written and painful to read shenanigans of nerds the world over, just… Microsoft QBasic 1.1 damn it!

There are many guides and books for beginners that all scratch the surface of what one can do with QBasic, but they are all essentially more verbose versions of the help references that are built into the QBasic IDE itself. That’s helpful for beginners who will benefit from a greater understanding of the fundamentals, but it certainly does little for people who want to use the advanced features and functionality of QBasic. If only there were a “Programmers Reference Guide for QBasic”, like the one I have for the Commodore 64, that covers absolutely everything there is to know.

The following links are the best resources about using real, actual, Microsoft QBasic Version 1.1 that I could find on the Internet…

Gary Beene’s Information Center
– Explains the differences between QBasic and the original QuickBasic.
– Has tutorials about lesser discussed, yet important topics.

QBASIC Programming for Kids
– Written by Ted Felix.
– Excellent guide to various topics, especially his sprite tutorial.

Load Sprite From File
– Written by Balau.
– Shows how to load sprite data from a file, as well as the general info one needs to reach that point.

Pete’s QBasic Site
– Lots of information about many topics, but you have to sift through things that aren’t applicable to QBasic 1.1.

QBasic.net
– Useful downloads and information about running QBasic on modern hardware.
– Provides full copies of QBasic 1.1, Quick Basic 4.5 and Quick Basic 7.

QBasic
– Wikibooks.org
– OK general purpose manual, but the latter, more detailed, portions are specific to QB64 rather than QBasic…

Progamming in QBasic
– Technoloy University
– Complex math and other useful examples.

Compaq Deskpro 4000
My DOS 6.22 / Windows 98SE computer.

Building My Replacement Commodore 64 Power Supply

With how frequently it is discussed in the retro Commodore community, I’m confidient that you have already heard about how the original “power bricks” for the C64 can fail and take the computer along with them. Here, let’s have a look at why this is the case…

Yup, that’s a giant soup of 30+ year old glop that many refer to as epoxy, but I am starting wonder if it’s actually toxic waste that the company decided to get rid of on the sly… Seriously, the stuff inside this old brick still sticky depsite the container having a few cracks around the wire holes for air flow. It stinks, it’s gross, but most importantly it traps heat and heat significantly reduces the functional life of capacitors and voltage regulators. Unfortunately, in this type of circuit, when the voltage regulator goes bad it tends to send waaaay too much voltage through it – components rated for 5 volts will usually burn out when given more than 6 volts, but in this case they can receive up to 9 volts. On the Commodore 64, it’s usually the fuse, RAM, and other logic chips that die due to power supply failure.

Now I am sure you may be wondering, “Rob, why not just buy a new power supply from Ebay or the like?”, because there seem to be quite a few to choose from at present. Well, dear reader, they’re expensive from the get go and are made even more so by the low value of the Canadian dollar, shipping charges, duty charges, and taxes. An item listed for $50 USD can easily cost me more than $100 CAD by the time its in my hands. Don’t get me started when it comes to buying anything in British Pounds! Unfortunately, no one in Canada is making power supplies for the Commodore 64 to my knowledge, so I’ll just make my own that is good enough and inexpensive (I only spent $1 on it!).

Moving on… let’s have a look the original “full wave rectifier” style power supply that was included with all Commodore 64s.

A respectable design, even by today’s standards, but it has some shortcomings. The biggest (and heaviest!) issue with this design is that it relies on a large transformer to step house electricity down to a level that can be used by electronics. Considering that we routinely charge our mobile phones using small, light bricks, you might be wondering why Commodore would ever use this massive transformer. The long story short is that it’s a very good transformer, with components that can handle much larger current than what was really needed to do the job, and that was a common practice in the 70s and 80s. Seriously, the copper windings inside this thing look like they were made of 16 guage wire! That’s excellent for allowing lots of electrons to flow and to induce a strong current on the equally hefty secondary windings (how a transformer works), but it’s not really needed in this case. And where there is a lot of current flow, there is a lot heat generated! Sadly in this case, that heat got trapped in an big o’l box of chemically putrid goop…

The second issue is the “full wave rectifier” circuit design itself – it’s simple and inexpensive, but it’s not very fault tolerant – if that voltage regulator breaks down, as I wrote earlier, up to the entire input voltage will be applied to the device, which can be disastrous. Also to be noted here, Commodore decided to save 1/10th of a cent by using a “full wave rectifier” design, rather than a “bridge rectifier”, using only two diodes instead of four – truly odd, because it requires a beefier transformer, which you’d think would be more expensive than two extra diodes. Anyway, it’s not the most energy efficient and fault tolerant design.

It’s for these two reasons that nowadays you will usually find power adaptors that use the “switching” method of stepping house electricity down to levels that are safe for electronics. Switching is a simple concept – it literally switches the power on and off really fast, such that it reduces the overall voltage that leaves the output. This switching happens many times per second and the components that take care of it are reliable and do not consume much power to get the job done. While there are some potentially dangerous side effects of this method (holding the output of a USB charger and touching your stove could produce a current so strong it would stop your heart, due to the “potential difference” if the stove isn’t properly grounded), none of them are likely to occur. For the life our electronics, an important feature of switching power supplies is that when they fail they just “stop working” without breaking the device they are attached to. Yay!

Hopefully with this background knowledge in hand, you’ll understand why I chose to use pre-made “wall wart” power supplies to build the new power supply for my Commodore 64!

From left to right those are…
Linksys 9V AC / 1A – For the C64
2Wire 5.2V DC / 2.2A – Also for the C64
Radio Shack 9V DC – For my Arduino!

Yup, because I decided to use the very nice aluminum case from my old PC power supply, I had enough room to include a power supply for my Arduino as well. This will be handy for larger projects that will draw more current than what the USB port on the computer provides (500mA), as I can plug it into a secondary power adaptor to power the components on the breadboard separately from the Arduino. Also, I can run the Arduino without using a battery or the power from my desktop PC. I digress!

As we frequently do in life, I unfortunately learned the hard way that what I was about to do wouldn’t work. That’s life man, that’s life!

As it happened, the the 5v adaptor I picked up from a thift store for $1 was insufficient for powering the Commodore 64. While it was rated at 2.2 amps and my (cheap and limited) multi-meter indicated that it delivered 5.19 volts (which I initially brought down to 5.02v using a 10K & 330 ohm voltage divider), my C64 failed to turn on when it was in use. Here are some pictures of my progress to this point. Note that I removed the Radio Shack wall wart from its case so I could use the 9v AC off its transformer for the C64.

Incidentally, the 9v DC Radio Shack supply powered the 12v DC power supply fan just fine, even with its 4 awesome LEDs! Heh, that was pretty ahead of it’s time when I bought the power supply in 2007 or so. 🙂

This ATX power supply served me well for more than 10 years before giving up the ghost!

Thinking about how to put them in there…


The guts of the 5.2v wall wart, which I took apart to see what was loose inside. Turned out to be an inconsequential chip of the plastic shell. Also, a nice chunk of steel plate from some other thing I took apart at some point.


The guts of the 9v DC Radio Shack wall wart. The cheap buggers used a 9.6v transformer and a very simple bridge rectifier circuit to make the 9v DC. If I had an ocilicsope I’d show you how noisy that DC current wave form must be, but I don’t have a scope. It should look like ____ but I bet it has lots of ripple, like so ~~~~~. That said, it’s good enough for a fan and my Arduino projects!


Note the plastic shim under the board that prevents it from shorting out on the mounting plate! It’s a piece of the lid of an old laundry bin.

The Arduino works!


The resistors that make up the voltage divider for 5.02v DC, before I applied the heat shrink wrap, and the 9.6v AC (orange wires) all wired up to the C64 connector.


So at this point the computer didn’t turn on, not even the power light. Initially I thought that the problem might have been the 9v power supply, as the Radio Shack one was 9.6v at 500mA unloaded, where as the Linksys one was 11.89v at 1A unloaded. Just to make sure I hadn’t blown up the C64 completely, I pulled out the wall warts I used to power my VIC20 (of which the Linksys wall wart was one)…

And my C64 was indeed still functional! Pardon the picture of the VIC20, what you’re supposed to be looking at is the “wall wart” power supply. 🙂

So I disconnected the orange wires from the Radio Shack transformer and installed the Linksys wall wart. I left the Linksys one inside its case, because I didn’t have a need to open it.

Nope, this didn’t work either!

Well, that left the 2Wire 5v wall wart as the problem. Too bad really, because it was rated for 2.2 amps, which should be enough to drive the Commodore 64 and the Ultimate 1541 II+ Cartridge (which itself is a little computer), where as the little 1.8 amp wall wart that I used with the VIC20 probably will not have enough juice for the job. I guess I will find out next month when my Ultimate II+ arrives!

I wanted to be able to use the Commodore 64, so I decided to put the 1.8A / 5v wall wart from my right-busted Blackberry Playbook tablet inside there for the time being. Yes, that means after all that effort I am… using exactly the same wall warts that I used for the VIC20 last year! lol… Such is life folks! 🙂 Check it out in all its majesty!

Originally this ATX power supply had two fans, one pushing air in and the other blowing air out. It’s plenty efficient in this case with the one fan blowing into the case and air escaping out the vents.

If the the Playbook wall wart isn’t able to power the system properly, I’ll order a Mean Well RS-15-5 5V/3A power supply (from Digikey, as they appear to have the lowest price, for both the item and shipping costs, that I can find). The Mean Well is designed for industrial use and will be quick to swap into the power supply case. In the mean time, the girls and I will continue to enjoy puttering with BASIC!

Go Baylea, programmer extraordinaire!

So proud!


Disclaimer:
I am a person who learned about electronics in high school and college in the 1990s. I am not an expert in the field and this post is for your entertainment and general information only; it is not a definitive guide on how-to build something. Importantly, I was taught how to properly handle high voltage electrical systems and how to use a soldering iron, while you may not have been!

Please be careful and do your research before working with electricity, chemicals, and high temperatures. Even better, find real life people who can bestow their knowledge and experiences upon you in an environment where you’re able to ask questions and listen to answers until you fully understand! Ask around at school or work or check your local social media / forums / papers for hobby groups such as makerspaces or computer/electronics clubs.

Note: I’m not affiliated with any links provided in this article, they just exist for your reference.

BASICly Moving a Character with WASD

Today let’s have a look a program that moves a character around the screen using the W,A,S,D keyboard keys. The character moves around the screen and stays within the borders, as you would expect in a top-down style game.

Fortunately the program was short enough to fit into a single screen, because I still don’t have a storage device for my Commodore 64.

Keep in mind that this little program is something that I put together myself as part of my relearning of BASIC programming – it’s just an example of how something is done, not BASIC gospel!

The Program

1 P=1024+480:PRINT CHR$(147):POKE P,0
10 GET N$
20 IF N$="W" THEN GOSUB 100
30 IF N$="S" THEN GOSUB 200
40 IF N$="A" THEN GOSUB 300
50 IF N$="D" THEN GOSUB 400
60 GOTO 10
100 IF P<1064 THEN RETURN
110 PRINT CHR$(147)
120 P=P-40: POKE P,0: RETURN
200 IF P>1983 THEN RETURN
210 PRINT CHR$(147)
220 P=P+40: POKE P,0: RETURN
300 M=P-1024: IF M-INT(M/40)*40=0 THEN RETURN
310 PRINT CHR$(147)
320 P=P-1: POKE P,0: RETURN
400 M=P-1024: IF M-INT(M/40)*40=39 THEN RETURN
410 PRINT CHR$(147)
420 P=P+1: POKE P,0: RETURN

Line By Line Description

1 Initial screen position of @ character: clear screen: Draw @
10 Get keyboard input
20 IF Input = "W" THEN jump to line 100
30 IF Input = "S" THEN jump to line 200
40 IF Input = "A" THEN jump to line 300
50 IF Input = "D" THEN jump to line 400
60 GOTO 10 to loop through getting input approx 60 times/second
100 IF @ is already on top row, do nothing
110 clear screen
120 move @ up 1 line:Draw @: RETURN
200 IF @ is already on bottom row, do nothing
210 clear screen
220 move @ down 1 line: Draw @: RETURN
300 IF already on left edge, do nothing
310 clear screen
320 move @ up 1 line: Draw @: RETURN
400 IF already on right edge, do nothing
410 clear screen
420 move @ down 1 line: Draw @: RETURN

Notes

Due to the use of a subroutine (“function” in modern lingo) that jumps away from the GET statement using GOSUB, holding a movement key down does not repeat the movement of the character.

Lines 10 to 60 are the “game loop” that repeats roughly 60 times per second. Each time the player moves the @ character, the whole screen is erased and redrawn. This is similar to what happens in more modern game engines, just things are so fast and abstract in new game engines that redrawing the screen is taken for granted. Here with character graphics, one must manually redraw the screen, otherwise the old characters would still be there.

Lines 100, 200, 300, and 400 are used to keep the character from going off the top or bottom of the screen or from wrapping around to the next line on the screen. Lines 300 and 400 use the modulus principle (remainder after dividing) to determine the column that the character is in. In other languages it would be as simple as typing 5 % 2, which would equal 1, but BASIC 2.0 on the Commodore 64 does not have a modulus operator. I had to take the screen position and calculate it the modulus the long way, like so,

M = P-1024
M = Current Screen Memory Address – Screen Memory Start Address
M = Location in grid, a number between 0 and 999

The screen is laid out basically as a grid of 1000 sections, with 25 horizontal rows of 40 vertical columns, numbered 0 to 999. Knowing this, we can find what column the character is in using modulus like so,

Location in Grid – INT(Locaction in Grid / Length of Row)*Length of Row

Row = M – INT(M/40)*40

Where the INT() function drops any decimal places, such as 34.32 becomes just plain old 34. We know that the left most column is 0 and the right most is 39, so if the @ character is already there, then we don’t need to move it more in that direction.

Conclusion
This simple program can be extended by adding more functions to the game loop in a similar manner as those you see above: GOSUB to some line, do some stuff, return to line below where you GOSUB’d from. Is it perfect? No, but it’s essentially the starting point of games such as Pong and Snake.

Creating My C64 Development Setup

After “saving my work” based on page 20 of the Commodore Programmer’s Guide in this smartphone image,

Told my wife I “saved” this and she didn’t get the joke lol…

I am definitely looking forward to having a real storage device for my Commodore systems! It’s kinda handy to be able to save stuff, but I will get there eventually I am sure.

Beyond that, for writing software using the Commodore 64, I don’t really need anything else. However, there are a few minor things that I want to get to dramatically improve and expand the experience. For the sake of clarity, I will list and describe each part of my setup!

Commodore 64C
I chose the Commodore 64 model C over the other Commodore machines for a number of reasons, such as:

  1. PETs are way too expensive for me!
  2. 22 column display… sorry VIC20, but I gotta have more!
  3. The C16 is usually cheaper than C64s and it comes with an improved version of BASIC, but it has other shortcomings that make the 64 a better choice.
  4. The 128 has too many options and rabbit holes for me to fall into and get distracted by, while also having more hardware to go wrong.
  5. Finally, the model C is more ergonomic than the “breadbin” style 64, which is important for long term use.

Sure I would love to sit at a PET and program character graphics games in BASIC 7 on a green screen in true “I was still in the womb when this thing was new” fashion, but I just can’t afford to get and upgrade my desired 80 column PET. So, I will happily live with making games and other software on the 64 instead!

I like the 64 over the 128 for it’s focus – it’s only one machine, with one set of abilities and that lets me focus on learning and using all of those abilities. Absolutely, I would prefer to program in 80 columns, but at the end of the day programming on a 40 column display isn’t so bad. I mean, it could be the 22 columns of the VIC20, right? 🙂

The graphics and sound capabilities, especially the hardware sprites, are also a nifty aspect of the Commodore 64 that I look forward to using. As far as what is out there, in my opinion it’s really an ideal development platform for the average person who enjoys this sort of thing.

Monitor: Old Samsung 19″ 4:3 LCD TV
First of all, the answer to the question, “Why this particular model of television?” is, “because it was only $20 and it works!”. My desk space is limited and I want as little crap and wires cluttering it up as possible, so this TV is perfect in that regard. It allows me to use the composite or s-video input for the Commodore 64 and the svga input for my Compaq Deskpro DOS/Win98 desktop. Is it ideal? Nope. Will it suffice? Absolutely! Also a bonus is that it’s a TV, so it has built in speakers. It’s also large, which is fantastic for my old-man eyes!

Disk Drive: SD2IEC
An SD2IEC device is an SD Card to Commodore serial port device, which is essentially a standard SD card reader that works on most Commodore computers. These are ideal for content creators, as even a super old 16MB SD could hold hundreds of BASIC files! More than that though, an SD2IEC is able to host whole disk images and it is compatible with some fast loader cartridges that are used to speed up the loading time of programs. What this means for me is that it will be easy to back up all of my programs to Google drive and to share my BASIC code on GitHub by simply sticking the SD card into my Chromebook or my desktop PC. Heck, I could even keep an “off site backup” on an SD card in my back shed or attached to a kite or something… 🙂

Epyx FastLoad Cartridge
Perhaps the most popular of the disk read speed enhancing cartridges of yesteryear, this puppy will load programs about 5 times faster even using the SD2IEC! Conveniently it also has a machine language monitor built in, though it does lack some features that may prove useful in the future.

Commodore BASIC 2.0
For the time being, I am going to be working within BASIC. Once I have a firm grasp of the architecture, I will move into including machine language within my BASIC programs.

Simons’ BASIC
This extension to Commodore BASIC, created by 16 year old David Simon in 1983, adds a wide variety of functionality that will be helpful when creating more advanced BASIC programs. The down side of using these extension is that they require the user to have the Simons’ BASIC cartridge as well. However, in today’s age of SD card readers, custom cartridges, and apathy towards ancient copyrights, this isn’t really much of a concern for me – If I make something cool that requires Simons’ BASIC, people will find a way to use what I made. Personally, I would like to obtain a real cartridge (and manual!) though.

Macro Assembler Development System
Created by Commodore in 1982 and available on www.lyonlabs.com, this Assembly language suit of software will likely be what I use to create professional-style games on the C64. I don’t have any experience with the software, nor have I programmed in Assembly or Machine language, so there is the possibility that I will use a different program for this when I get there.

Lumafix
Lumafix is a basic hardware mod that helps clean up the video out of the VICII chip. It’s primarily used to remove the vertical lines present on many 64s, especially model C’s like mine. It also clears up s-video signal issues that effect LCD displays. Breadbox64.com has a detailed review. If you have a look at the before and after images, it will be clear to you why I want this mod: Text is WAAAAAY easier to read and as a programmer, I will be reading a lot of text!

EasyFlash Cartridge
Eventually I will complete a game that is worthy of being sold on a cartridge, so I think it would be great fun to have one of these EasyFlash carts that, amongst other things, make it very easy to create your own bootable cartridge.

Linux Desktop / Chromebook
All of my documentation and sharing with the outside world is accomplished using GNU/Linux or ChromeOS, because it’s really the best tool for the job. Sure, I could hook the C64 up to the Internet, but that’s really more trouble than it’s worth and my intention is not to use the C64 as my main computer, but as a tool for creating content, kind of like a sewing machine really. So, I will be writing about my creations and posting said creations using my Chromebook for the most part, as I don’t really need to fire up the big o’l desktop for that. I’ll also be using VICE to test any important software in the emulator before publishing it.

Windows Desktop
Technically the same physical piece of hardware as my Linux desktop, my Windows desktop may occasionally be used for access to CBM.prg Studio, a modern Commodore 64 programming IDE created by Arthur Jordison. While this awesome software can be used to greatly simplify the production of games for the Commodore 64, it makes the process feel pretty much the same as making any other software on a modern PC. Indeed, that’s the whole point. I don’t plan on using this software much, if at all, because it bypasses the part of making software on the C64 that I like – actually using the C64 to make the software, like we did in the past! That said, it might be handy for creating sprites – we’ll see! At one time I did consider forging real Commodore hardware just using CBM.prg Studio with VICE, but I figured if I was going to use my PC to program, then I may as well just program for the PC… So real hardware, real software for that hardware, and everything that entails it is for me!

Conclusion
At this time all I have is the C64, the monitor, and the Epix Fastloader cartridge, but in time I will acquire the other pieces – first of which will be an SDC2IEC drive when we can afford one (the low value of the Canadian dollar, combined with shipping and duty charges, more than doubles their price for me). The LumaFix will help my old eyes significantly and it should be duty-free due costing less than $20, so that is nice. The EasyFlash and Simons’ BASIC cartridges will remain optional parts of my development arsinal for at least the remainder of 2018 on the other hand.

I look forward to seeing how all of these plans and preparations play out as I gain more experience programming on the Commodore 64; I’ve done a lot of research, but I can’t tell the future!

Take care and thanks for reading!

My eldest daughter, Neillia, programming in the Semi-Nerdly Command Center just like me!

Note: I am NOT affiliated with any product or service linked from this page. The links are provided for your convenience.

Retro Desktop: PCI to SATA Card vs. IDE to SATA Adapter

Ever have one of those times when you’re telling a friend about something you’re doing which you are super pleased with and they suck the wind out of your sails by saying something like, “Really? You should have done this!”? Well, that happened to me recently and I thought I would share so you could learn from my… experience! 🙂

Setting
I have a 233MHz Pentium MMX based Compaq Deskpro 4000 that I use for DOS and Windows 98, primarily to relive my music tracking days using Impulse Tracker.

Problem
I don’t want to listen to the sound of the hard drive all the time. I always wanted a silent computer, but it’s especially important to me for music production.

Solution 1: Compact Flash Card to IDE Adapter
I have one of these and they do work well, however they do not hold up well when there is a significant amount of disk writing activity, as they do not have any wear leveling software and other related issues. As such, I have experienced file corruption, read errors, and system freezes in DOS, Windows 98, and Linux when using an CF card as a native IDE hard drive. It works very well for DOS, almost flawlessly, so will likely be fine for people who aren’t writing many large files.

Solution 2: Solid State Drive
A modern serial ATA (SATA) solid state drive, especially the small and cheap ones, are ideal for use with retro desktop computers apart from one minor detail: Old desktops pre-date the SATA standard, so you won’t find any SATA ports on computers older than the Pentium 4. But, I happened have an extra 30GB OCZ Onyz SSD kicking around, which served as my Linux boot drive until I ungraded to a 120GB drive a few years ago, so I was keen on putting it to use in my Deskpro!

With this in mind, I needed to look for a solution to make a SATA SSD compatible with my system. In the past I have used a PCI card to add IDE ports to a computer that didn’t have an IDE ports, so my first thought was to see if I could find an inexpensive PCI SATA card. Sure enough, I found just such a PCI card on ebay from a seller nearby in Ontario and I ordered one!

The biggest problem one can have with using storage devices attached to PCI cards is that the BIOS on some motherboards simply will not boot from them. Not thinking to use my dusty old Promise Ultra 133 TX2 IDE controller card to test the Deskpro’s ability to boot from PCI card attached storage, I waited for the PCI SATA controller card to arrive in the mail before I found out if it would work as I had hoped.

VIA VT6421A based controller card added to the system!

The Deskpro 4000 was not able to boot from a SATA hard drive or SSD attached to the controller card. However, when testing with Windows 98 installed on the IDE hard drive attached to the motherboard, the PCI controller card drivers allowed the attached storage to be utilized by the system. Unfortunately I was not able to find any DOS drivers for the card so it can’t be used by Impulse Tracker, as I need to use that in real DOS.

Conclusion
To make the most out of the situation, I decided to compromise and use a larger 1GB CF card to boot Windows 98 (as apposed to the 256MB CF card I was using for DOS – both cards we previously used in our camera), so that I could use the system in silence and still make use of the 30GB SATA SSD. It just meant that I would have to run Impulse Tracker from the CF card and copy over any files I want to use at that time from the SSD to the CF card…. blah THIS SUCKS!

And that’s where my friend Chris came in and said (via Messenger from other side of the continent), why don’t you use one of these?

Why didn’t I think of that!!!??? 🙂

Not only are those IDE to SATA adapters 1/4 the price I paid for the PCI SATA controller card, they are also invisible to the motherboard and thus will allow a SATA SSD to boot like any other drive. Sigh…

I have yet to purchase and test an IDE to SATA adapter in my machine, but I would imagine it would work just fine. It would be nice to order one from someone in North America, as shipping from China/Hong Kong takes like five-ever (still waiting for 5 head phone plugs I ordered in April for $2), but shipping and lack of personal testing aside, I absolutely recommend going the route of using a cheap 4/8/16/32 GB SATA SSD with your IDE era retro desktop via one of these adapters. SSDs are quiet, fast, reliable, and they hardly use any electricity at all, making them superior to old IDE hard drives in every way.

If you’re into the retro sound of a traditional hard drive, that’s great, you can carry on using one. If not, get yourself a SATA SSD and an IDE to SATA adapter – I know I will at some point!

Here are some pictures of my progress and setup.


Ps. If you’re feeling particularly creative you could fashion a 3.5″ drive bay for your 2.5″ SATA drive that looks similar to a floppy drive, saving you the need to open the case should you wish to remove the drive. You can probably buy hot swapable bays like this, but I am not sure they would work with the IDE adapter and I would not risk using the hot swap feature itself.

Unboxing My Commodore 64! (And Why I Bought It)

Hey, who doesn’t like unboxing videos, right?! I was pretty excited to make this one, because using this new machine marks the beginning of a new journey that will occupy me from here on out. Indeed, rather than upgrade my 2013 desktop PC this year as I had planned, I decided to keep it and put that money toward taking a new direction completely. Honestly, for everthing that I do on my computer (which is a hell of a lot!), my AMD FX-8320 based system is still great – the worst part about it is how much electricity it uses compared to newer machines.

I have spent countless hours window shopping online for upgrades to this PC, considering everything within my budget probably a thousand times, and it wasn’t until recently that I had an epiphany: If I turn off the desktop, it doesn’t use any power at all!

While that may seem super obvious, when you consider that I have been relying on my desktop computer for all my computing needs, including emulating the Commodore 64 and just browsing the web, it legitimately did blow my mind when I thought about this. I mean, a real C64 with an SD card reader as a “floppy drive” is actually a very low power device. As is my Chromebook. When I added on my earlier realization that I prefer making games than to playing them (I really only play Guild Wars 2 anymore and even then, rarely) and the ones I play work just fine, it made sense to me that I didn’t need to upgrade my PC at all. An upgrade would be nice, but realistically all it would accomplish is to allow me to do what I am already doing, just faster and with a lower electricity cost. So I will follow my Dad’s advice and “use the right tool for the job”.

If I am just reading PDF files or farting around on the web, there’s no sense firing up the desktop – I should use the Chromebook for that, because it can run 10 hours on battery while only drawing 45W for a 2 hour charge (where as my desktop uses around 200W any time it is running, more when compiling software, and WAY MORE when playing 3D games). If I want to program games, I could use my beefy and awesome Linux desktop and make something that will most likely never be used and will definitely be forgotten or, I could use a power efficient Commodore 64 and create games (and other software) that may well prove fun for decades to come. And for all those PC games I occasionally play and the music and graphics and all that other stuff I like to do on the PC, I can carry on using this nice old desktop that I already own! This seems to me like it’s the best use of our resources and an excellent use of my time.

Anyway, now that you know why I own a Commodore 64, enjoy watching this video of me opening it!

Upgrading like it’s 1982!

Like technically, the Commodore 64 version C wasn’t released until 1986, but let’s not be pedantic nerds. 🙂

There has been a lot on my mind this year and indeed, the last few years. Allow me to tell you with certainty, being forty is a whole lot easier than turning forty! Mortality and self awareness are completely bizarre experiences – I KNOW that I am not going to live forever, I have experienced the death of a loved one first hand and I’ve lost many other friends and family members over the years, yet I have still somehow managed to ignore the passage of time as though I will both never run out of it and I will somehow magically achieve everything I at one point intended to achieve, even though it would be entirely impossible to do so without living infinite lives simultaneously. Farley Mowat touched on this concept in an interview with George Stroumboulopoulos not too long before he died. He answered that he had been focusing on pealing back the layers of reality to peer into and better understand the truth beneath, and I was like, “You go Farley! Our human existence sure is one messed up and arbitrary construct that we’ve created for ourselves!”. I hope he found his answers before he stepped into the great beyond. I have found some of mine.

My heart breaks when I hear of people who end their lives or hurt themselves as the result of being so wrapped up in this fucked up and completely arbitrary social existence that we all seemingly must endure, because the truth is clear and limitlessly beautiful…

None of this matters.

Not you, not me, not the air we breath nor the Earth we walk upon. Beyond the star dust coalesced, all out beyond endlessly and right here within each of us is energy. Touch something, feel it. The crazy reality is that on the fundamental level you are so full of empty space that you’re not really touching that object at all, yet you can FEEL it. You can feel it, because we are energy.

Energy given the gift of this shared existence, with which we may each, to the best of our will, experience, achieve, and leave behind shadows of our deeds and desires. Fleeting and overwhelming as it will be, your life is your gift. Yours.

So with whatever I have left of my own blip of existence, I will be dedicating my “nerd hobby time” to making things for the Commodore 64, using a Commodore 64C!

Late last year I purchased a Commodore VIC20, largely because it was an inexpensive reminder of the Commodore 64 that I learned to program on as a kid in the early 1990s. Indeed, it was the first computer I ever touched in the early 1980s! While I do enjoy the nostalgia of the machine, typing on it tends to be uncomfortable due to the height of the “breadbin” style chassis. And even though the VIC20 is an important and still widely popular computer, one can not deny that the C64 is the real hero of computers yore.

Indeed, if one wishes to attach one’s self to something that will stand the test of time, one can chisel one’s self a stone tablet or one can create something enjoyable for the Commodore 64. I have decided to do the latter!

Soon, thanks to my good friend Chris “Kinshi” Edgin from Uncharted Gaming (and the brains behind the former Tarkin Star Wars Galaxies Emulator server), I will be the proud owner of a Commodore 64C! That’s the more ergonomic version of the chassis, which feels very much the same as any other desktop keyboard to type on.

I have used (and tremdously appreciate!) the VICE emulator on my desktop PC and my Chromebook, but at the end of the day when I am using these modern machines, my feeling is thus, “if I’m going to be using a Linux PC, I may as well program for a Linux PC!“. Using a real C64 to develop programs for the C64 as folks did “back in the day”, enjoying the full and true experience/process, is what I find appealing.

I enjoy making things. I especially enjoy making humorous and whimsical experiences on the computer. I also enjoy learning and understanding. Focusing my efforts on a machine such as the (extremely well docuemented and supported!!) Commodore 64 will press all the right buttons when it comes to how I like to spend my “hobby time” – creating, thinking, learning, failing and trying again, because it’s the creative process that drives me.

With C= I will create and enjoy, star dust to electric ether and beyond…

My Commodore 64C on Chris’ test bench

Cleaning My Old Pentium 233MMX Computer

Ages ago, sometime in perhaps 2002, I had a need for a floppy drive. I lived in the lower mainland of British Columbia at the time, where I had access to loads of excellent, inexpensive computer stores. So, I looked up the price of a drive, said to myself something along the lines of, “Why spend $18 on a new drive when I could spend $30 on a drive that is attached to a whole computer?”, and proceed to purchase a used computer instead of just the drive. Believe it or not, I still have that computer and recently I decided to pull it out of storage and clean it up!

The poor thing, I have used it many times over the years, but never as my main computer. I like it though, as it has the same specs as the first computer I ever purchased for myself and because the case is really well designed. I’ve upgraded it with the various extra stuff I had kicking around, such that it has the following specs…

CPU: Intel Pentium 233MMX
RAM: 384MB (2×256 DIMMs)
Video: S3 Virge GX 4MB
HD: 10GB IBM branded Quantum Fireball
Monitor: Acer 58c 15″ CRT
Other: DVD-RW, Iomega 100MB ZipDrive, Compaq keyboard, Microsoft 2 button mouse
Operating Systems: Windows 98, Slackware Linux 9.1

As for taking you through the cleaning, I’ll do most of that using the captions on the following images. For the most part the tower, monitor, and mouse only needed some scrubbing with glass cleaner and baking soda, so I didn’t take many pictures of them. The vast majority of the effort went into making the keyboard great again!

And now that it’s clean? Well, I dunno… It works… Cool. 🙂 Seriously though, I think at some point I will set it up similar to how I had my computer back 1998/1999, when I was using Impulse Tracker in DOS to create music, while learning Linux, and using Windows 98 for pretty much everything else.