Give your Commodore 64 new life with an SD card reader
This August marks the 30th anniversary of the most successful computer model in history. One company put personal computers into the people's homes, and launched an entire industry overnight. For an entire decade, despite attempts at marketing improvements, the original platform stood the test of time, virtually unchanged. Even today, the Commodore 64 is celebrated by a community of hobbyists.
In honour of the anniversary month, here are some up to date instructions on how to read old data from the disks. Floppy disks only have a usable lifespan of 10 years, and most of them in my collection are over 25 already. At this point, the chemical binder between the magnetic particles and the plastic substrate is degrading, and the data can literally fall out of the disks. Fortunately, up to date software from the opencbm project tries very hard to read the data and can often succeed when a disk appears to be unusable when connected to a C64.
Here's what you need to read your floppy disk into your PC:
- A commodore 1541 disk drive, in good condition, and power supply.
- The drive cable.
- This ZoomFloppy adapter
- a USB cable.
In addition, if you want to read disk images from an SD card hooked into the real Commodore 64, you will need the uIEC adapter, which can be substituted for a real floppy drive.
Transferring floppy disks to the PC
I want to scan in my copy of Jumpman so its digital bits are preserved.
This copy is totally genuine EPYX product. At least that's what they guy at the swap meet told me, behind the K-mart.
Then, plug the ZoomFloppy into the Commodore drive using the commodore cable (make sure the drive is off!), and into your PC using a USB cable.
Confusingly there's some empty ports. If you want, you can hook other things into it for decoration, I guess.
d64copy -r 16 8 "jumpman.d64"
This means:
- Retry bad blocks up to 16 times before giving up.
- Copy from device #8. Remember, on Commodore, the first floppy drive was always device 8.
- Copy the contents of the disk to the file called jumpman.d64
A minute later, and it is done. Unfortunately, we have a bad sector. Hopefully it is in an unused part of the disk, or in some graphics that won't cause a crash.
At this point, we can run the game in the Vice emulator (On windows this distribution seems to work).
Running games from SD cards
No serious commodore enthusiast is without his or her SD card reader. I happen to have the uIEC which Jim Brain soldered together right in front of me at the World of Commodore 2011 in Toronto.It has to plug into the back of the Commodore, presumably for power, and then the drive cable goes into it as well. Then, it is ready to act exactly like a floppy drive.
But how do folders work?
You can just about fit all the Commodore software in existence onto one card, so how do you access it? You can switch disk images by sending special drive commands to it in BASIC. I've placed the jumpman.d64 file on the SD card. Here is the command to switch to it:
OPEN1,8,15:PRINT#1,"CD:JUMPMAN.D64":CLOSE1There are many other commands for the uIEC. It has some buttons on the circuit board that let you swap disks on the fly without typing commands, but these have to be set up by listing them in a special file. All the other commands are described here.
A major drawback of the uIEC is that while it emulates the standard Commodore drive operation, the commodore 1541 drive was actually another computer that you could load programs on and run. Some programs did this for copy protection or to implement custom fast-loaders. More recently the retro demo-scene uses it for extra storage and computing power. I was disappointed when the Second Reality demo didn't work.
Well, I have Jumpman loaded anyway, so off to an evening of retro fun.
The cheater method
Of course, if you don't want to go to all this trouble, you could obtain just about any software you can think of using pokefinder. Just Bing it.The simple and obvious way to walk through a graph
At some point in your programming career you may have to go through a graph of items and process them all exactly once. If you keep following neighbours, the path might loop back on itself, so you need to keep track of which ones have been processed already.O(n) Delta Compression With a Suffix Array
The difference between two sequences A and B can be compactly stored using COPY/INSERT operations. The greedy algorithm for finding these operations relies on an efficient way of finding the longest matching part of A of any given position in B. This article describes how to use a suffix array to find the optimal sequence of operations in time proportional to the length of the input sequences. As a preprocessing step, we find and store the longest match in A for every position in B in two passes over the suffix array.Finding Bieber: On removing duplicates from a set of documents
Using a locality sensitive hash, you can mark duplicates in millions of items in no time.My favourite Google Cardboard Apps
I have never been a gamer. The most I've played was Super Mario Bros (the original). I then took a break for a decade or two and spent a few weeks with Simcity 4. All that changed when I got Google Cardboard.Finding the top K items in a list efficiently
Do you use sort() to find the top results? Here's a simple trick that will make your software run much faster.Finding awesome developers in programming interviews
In a job interview, I once asked a very experienced embedded software developer to write a program that reverses a string and prints it on the screen. He struggled with this basic task. This man was awesome. Give him a bucket of spare parts, and he could build a robot and program it to navigate around the room. He had worked on satellites that are now in actual orbit. He could have coded circles around me. But the one thing that he had never, ever needed to do was: display something on the screen.My thoughts on various programming languages
Some ill-informed remarks on various programming languages.VP trees: A data structure for finding stuff fast
Let's say you have millions of pictures of faces tagged with names. Given a new photo, how do you find the name of person that the photo most resembles?In the cases I mentioned, each record has hundreds or thousands of elements: the pixels in a photo, or patterns in a sound snippet, or web usage data. These records can be regarded as points in high dimensional space. When you look at a points in space, they tend to form clusters, and you can infer a lot by looking at ones nearby.