C64 Archives

Everything about the Commodore 64, or C64 or CBM 64. Some even called him the VIC-64. I got mine in the mid eighties, used from a neighbour – complete with monitor and 1541 disk drive (vintage 1982/1983), and even a needle printer. I later got hold of a C16 Datasette (the dark grey one) which connected to my C64 via an adaptor. I used it until 1992/1993.

String Operations on Commodore Computers

Commodore BASIC has some interesting and simple string functions built in. Three of them are self explanatory: LEN, LEFT$ and RIGHT$. But others, like the mysterious MID$ and INSTR functions, are a little tricker, and I can never remember how they works. So here’s a quick recap on how they all work. LEN (A$) Returns … Read more

How to use direct block access commands in Commodore DOS

Commodore-Logo-PaddedWe can access each sector’s raw data on Commodore disk drives with direct block access commands. Supported drives include the 1541, 1571, the VICE emulator as well as the SD2IEC card reader (for the most part).

Each single sided floppy contains 35 sectors, while a double sided 1571 formatted disk contains 70 sectors. Each track contains between 17 and 21 sectors depending on how far inside or outside they are. Each sector contains 255 bytes we can read or write.

Sectors are the same as blocks: only the directory refers to them as “blocks” and shows us how many we have available.

We’ll need to open two channels to our disk drives: a command channel and a data channel. Here’s how to do it:

Read more

How to split a long string into separate words in Commodore BASIC

Here’s a quick word splitter routine for CBM BASIC. It takes phrase and “explodes” all words into an array, removing spaces. Feel free to adopt it for your own needs. 10 rem word splitter 20 rem splits a long phrase into words at a space 30 input “tell me something”;a$ 40 rem clear current array … Read more

How to use SD2IEC: a quick command reference

I’ve ordered an SD2IEC a few weeks ago from Nic over at http://sd2iec.co.uk. It’s an SD card reader for Commodre computers and emulates many features of the 1541 Floppy Disk Drive. I went for the Limited Edition made from authentic recycled C64 plastic – so this little critter used to be a real C64! This … Read more

How to merge BASIC programmes on your Commodore C64, C128 and Plus/4

You can merge / combine / concatenate BASIC programmes on a Commodore computer. It’s often useful to develop shorter chunks of code and put them together for a larger app. Sadly there’s no built-in command that lets you do this, even though the C128 user guide hints that the CONCAT command can do this (if … Read more

How to load a .PRG file in VICE

Usually you’d attach a disk image to the VICE emulator and load one of several files from your virtual disk. Occasionally though you’ll come across single files ending in .PRG – those are the files that are contained on a disk image. Remember those weird three letter abbreviations on the right hand side when you … Read more