The Commodore 64 computer was a great 8 bit system in the 80’s. It featured excellent graphics and sound. Still, it does have its flaws. Let’s have a look at its features.
The Commodore 64 was born in 1982. It may be regarded as a vastly improved VIC 20. It shares many things with this little computer, not only appereance, but still, it offers many additional features.
The “brain” of the Commodore 64 is a CPU called 6510, produced by Commodore itself. It is very close to a standard 6502 CPU and it is fully compatible with it. It runs at 0,98 MHz on PAL systems and at 1,02 MHz on NTSC systems.
The system comes with 64K of RAM memory, plus 16K ROM containing the BASIC interpreter and KERNAL routines. Another 4K ROM is used for characters shapes (the standard font used by the system).
The BASIC interpreter in ROM is BASIC 2.0. It’s a fast interpreter, still it was already old even when the Commodore 64 was introduced. It is the same interpreter that can be found on old PET/CBM machines. It is well suited for text applications, but it requires the use of POKE instructions to make use of Commodore 64 graphics and sound. There are no specialized graphics and sound commands, there is no easy access to disk drives commands. A channel must be opened manually to send CBM DOS commands to the disk drive. BASIC commands like LOAD and SAVE do support disk drives however.
The VIC-II chip offers a hardware text mode of 40 x 25 characters (allowing fast text editing) and a bitmap mode with a maximum video resolution of 320 x 200 pixels. 8 hardware sprites are also included, and these can be moved around the screen with no restrictions, and they can be combined with any graphics mode. Sprites can be also expanded on hardware, both in X and Y directions.
16 colors are offered. On high resolution mode, only 2 colors per cell are allowed (a cell is made up of 8 x 8 pixels). On multicolor mode, 4 colours per cell are allowed, but at the expense of halving the horizontal resolution (so, in multicolor video resolution is 160 x 200).
Multicolor mode can be used indipendently on bitmap screen, characters and sprites.
Characters are programmable, so the system font can be replaced with any font in RAM memory.
The VIC-II chip also offers raster interrupts. Those can be used to have smooth motion of objects on the screen and to mix different graphics modes on the same screen (screen splits).
Hardware fine scrolling and screen blanking features are also available. Finally, characters also have an extended background color mode.
The VIC-II chip can use all main system RAM, so no video RAM is necessary. The VIC-II can access a 16K RAM bank at a time, indipendently from the CPU.
Sound is handled by the SID chip. It offers three programmable channels, each covering 8 octaves. The SID chip can be regarded as a simple yet advanced for its time sound synthesizer. There are 4 waveforms available for each channel (triangular, saw-tooth, pulse and white noise). An ADSR generator is used to create the envelope of instruments. Filters and advanced features like ring modulation and synchronization are also available.
This sound synthesizer was regarded as one of the best on 8 bits machines.
A couple of specialized I/O chips allow for I/O handling. Those are called CIAs and make it possible to connect the Commodore 64 to the keyboard, tape, floppy disk drives, printers and so on. The system offers many ports for interfacing.
Specialized chips (VIC-II, SID and CIAs) are mapped on memory. That means, those chips can be controlled by putting values on some special memory location called registers. Those registers are mapped on the same 4K area used for characters ROM. This is possible because the VIC-II chip has indipendent access from the CPU to RAM memory. So, the VIC-II chip can look on this 4K area for characters shapes, and at the same time the CPU can put values on these locations so that specialized chips registers are updated.
For instance, if we want to copy the ROM font in a RAM area, we must make it possible for the CPU to read this ROM. This is accomplished by using a special register on the 6510 CPU, mapped on location 1 (the I/O register).
As you may have noticed earlier, the Commodore 64 has a total amount of 84 K memory (64K RAM + 20 K ROM). That’s actually 88K memory if you also include the 4K I/O area. Since the 6510 CPU has a 16 bit address bus (like any other 6502 family processor), how is it possible to gain access to the whole RAM/ROM memory?
The I/O port in the 6510 CPU is used just for this.
When the Commodore 64 is turned on, the total amount of RAM is not available to BASIC. This is because KERNAL and BASIC are addressed by the CPU in order to be used. Still, a 4 K RAM area is used for specialized chips registers (those chips are called IA, interface adapters). Another 4K RAM area is not available for BASIC, but still it is available for machine language routines and data. So, there are roughly 64-4-4-8-8-2 = 38 K RAM available for BASIC (38911 bytes to be exact). The above count is as follows:
- – 4 K RAM, used for I/O registers for IA chips (VIC-II, SID and CIAS) and color RAM;
- – 4 K RAM, not available to BASIC but available for Machine Language routines or data;
- – 8 K RAM replaced by the KERNAL ROM;
- – 8 K RAM replaced by the BASIC ROM;
- – 2 K RAM used by the KERNAL for OS variables and parameters and by the VIC-II for the screen memory and sprite pointers.
Those areas can be switched in and out so that the memory map of the Commodore 64 can be adapted to custom use.
Please note that when the BASIC and KERNAL ROMs are switched in, the matching RAM addresses cannot be read by the CPU, but they can be still written to. So, it is possible to load a 50K machine language program even if there is only 38K RAM available for BASIC.
When using Machine Language, the BASIC can be swapped out. That means, the 8K ROM can be deactivated and an 8K RAM area will be available on its place, on the same addresses. The same can be done to the KERNAL ROM. This way, a machine language program can access 58 – 59 K RAM (still, roughly 1 K is used for the video matrix and sprite pointers, and 4 K are used for I/O registers).
Theoretically, the whole RAM could be used, but at this stage, no means of communicating with the IA chips is possible.
This mechanism may be called static bank switching. That means, there are some areas you can choose to be RAM or ROM by using the I/O port on the CPU. On a certain point of view, TED machines and the Commodore 128 on C128 mode are an improvement over the Commodore 64, as they provide dynamic bank switching. Banks are continuosly switched in and out by the system, so that roughly 60K and 122 K of BASIC bytes can be used on Plus/4 and Commodore 128 machines. On the Commodore 64 instead, out of 64K RAM only 38911 bytes can be used for BASIC. Still, that amount of BASIC RAM is more than enough on nearly all cases.
As for compatibility, the Commodore 64 has a different chipset from earlier Commodore machines. As a result, only very simple BASIC programs written for the VIC 20 or PET machines with no registers use will run on the Commodore 64. Some modifications may still be required. TED machines use a different chipset as well, so C64 compatibility is very limited. On the Commodore 128, compatibility was taken into account, so it can run C64 software perfectly when in C64 mode (there are little incompatibilities, but nothing worth noticing).
By the way, there are some similarities in the Commodore KERNAL between the different Commodore 8 bit systems.
Tape and disk access are not fast on the Commodore 64, provided standard KERNAL routines are used. The 1541 disk drive using stock routines is very slow. The problem can be solved in software, so I/O speed can be vastly improved. But still, a faster built-in disk access would have put the machine on another level.
Anyhow, the Commodore 1541 disk drive is an excellent device with its own memory and CPU. It can run many tasks on its own (like formatting a floppy disk) and it doesn’t require a DOS to be loaded on the Commodore 64 RAM. The 1541 has the CBM DOS already in ROM.
Sadly, like we mentioned above, no specialized DOS commands are available on Commodore 64 BASIC, so to use commands like FORMAT, SCRATCH, VALIDATE a channel must be opened with the BASIC instruction OPEN. Still, to read a disk directory, the infamous LOAD”$”,8 command must be used. I don’t like this command, it’s a hang over from the seventies, and it erases the BASIC program currently on memory. So, still being obvious, it is definitely not a good idea to check the directory before saving a program with LOAD”$”,8. BASIC 4.0 with CATALOG command was already available on CBM machines, but it was not made built-in on the Commodore 64.
However, those problems may be easily fixed by using a simple DOS wedge.
When programming on machine language, all Commodore 64 features can be used with freedom. With ROM BASIC, things are a bit different. Features like programmable characters, sprites and music can be reached by using POKE instructions with not much effort. The problems become clear when you want to gain access to bitmap graphics with the standard BASIC 2.0. The flexible Commodore 64 architecture do offer solutions by the way. It is possible to plug in a cartridge with an expanded BASIC (like Simons’ BASIC for instance). It is possible to LOAD an expanded BASIC from disk or tape as well. Last but not least, simple utilities and/or other expanders may be used to make experiments with bitmap graphics. Still, on most 8 bit systems, easy access to bitmap graphics is already provided by the BASIC in ROM. But, as the CBM BASIC 2.0 is fast, compared to other advanced interpreters, those limitations can be more than tolerated. Talking about strings, on this BASIC interpreter garbage collection may be an issue on some situations, but it can be handled.
Its sound and graphics capabilities make the Commodore 64 a great gaming machine for the time. Its flexibility and the wide availability of utilities, expansions and speeders make it an excellent home computer for BASIC and Machine Language programming as well.
The low clock of the CPU (only 0,98 MHz on PAL systems) is compensated by the features of VIC-II and SID chips, that require little effort of the CPU for most operations. Furthermore, on many algorithms this CPU does very well (compared to other 8 bit CPU, of course, even with a greater clock speed), because of its simple architecture. Still, on pure computations, especially on math algorithm requiring multiplications (for example 3D graphics), those limitations of the CPU do show, but not as much as one would expect. Also, the way algorithms are coded do make a difference, and it is actually possible to have fast 3D routines on the Commodore 64, like today’s scene productions show.