Monday, March 28, 2011

First computer

Not so long ago, I bought a new PC. In my previous PC, the video card died and I didn't find it useful to invest any money in a system which is almost 4 years old. In this blog post, I don't want to talk about my new computer, but about my first one which still gives me good memories.


My first computer experience started on a Commodore 64 owned by my parents. Actually, it was a more advanced Commodore 128 (shown in a picture from Wikipedia above), which was automatically booted in C64 mode due to a helper cartridge. The newer Commodore 128 model was still compatible with the older Commodore 64.

The amount of Commodore 64 system resources were very slim compared to systems these days. It included a MOS Technology 6510 processor running at ~1 MHz and 64 KiB of RAM (half of the amount could only be used by BASIC programs). In Commodore 128 mode, you had double the amount of RAM (128 KiB) available and the more advanced 8502 processor running on ~2 MHz.

Usage


The operating system and shell of both the Commodore 64 and 128 were also very simple. It was just a simple BASIC interpreter, which you could use for various tasks such as retrieving the contents of a disk and to load a program. Retrieving the contents of a disk was done by loading a special program named: '$' into the BASIC program space in memory:

LOAD "$",8

And by listing the BASIC program, you could see the disk contents:

LIST


Then you basically had to move your cursor to the line containing the program that you wanted to run then you had to type: LOAD and RUN to load and run the program. Maybe this process sounds scary, since we have fancy GUIs nowadays, but it wasn't so hard back then. I was able to do this when I was 6 years old.

Programming


My first experience with programming also started on this computer. For some reason, knowing that it was possible to create your own stuff (next to running somebody else's stuff) fascinated me. A cousin of mine (who already had some programming experience on the Commodore) showed me the basics. Moreover, I also owned several C64 programming books (given to me by some relatives) which I used as a reference, although I was not always able to understand all these concepts as a kid.

The first Commodore 64 BASIC program I ever wrote looked basically like this:

10 INPUT "WHAT IS YOUR NAME";A$
20 PRINT "HELLO ";A$;"!"

It was just a very simple program which asked the user to type his name and responded by sending a friendly greeting to the user. Of course, these two lines were a little boring, so usually I added two lines in the beginning which cleared the screen, changed the color of the text and I used some POKE'ing to change to colors of the main screen and screen border to make the program look a little prettier. Since the Commodore 64 uses special characters for clearing the screen and changing the color of the text (which I can't list here), I have included a screenshot showing the output of the program and a listing of the source code.


I wrote many more Commodore 64 BASIC programs, such as a variant of the first program to insult persons that I disliked, some simple games (guessing words and numbers or games using a dice) and a lot of useless stuff in which I tried to do things with graphics and to create games from it (but I lacked the skills/knowledge back then to do something really useful).

The challenging part of programming games, was that you had to understand the hardware architecture of the Commodore 64 quite well. Although an internal BASIC interpreter was available, there were no high level instructions for things such as creating sprites and sounds. Most of these things were achieved by using POKEs and PEEKs in BASIC to read and write values into the appropriate memory positions (the Commodore 128 BASIC interpreter was more advanced and did have some high level instructions, but I never used them). Moreover, BASIC was also much too slow for most games and therefore you had to write most things in assembly. But since writing stuff in assembly is not much more difficult then using POKEs and PEEKs this was not the biggest challenge.

Games





Although the Commodore 64 had only 16 predefined colors (which can't be changed), some games had good graphics and were exceptionally creative. Basically, the tiles of side scroller games consisted of programmable characters in multi-color mode. Each multi-color character could use 4 colors out of the predefined 16. Each character pixel could be 1 custom color (for the whole character), the background color or 2 predefined colors (shared with all other characters). Assigning a color value to each individual pixel was too expensive. In order to make something look nice, you really had to think ahead and use some creative tricks. I still have to admit that I'm impressed to see how those games have been developed.




One of the most advanced games I owned was Turrican, a side-scroller shooter game combining several elements of various games such as Metroid. I have uploaded some screenshots shown on the left. Moreover, I also remember this game very well because I had a hard time beating one of the bosses, which gave me nightmares when I was still a kid. The boss that I feared so much is shown in the last screenshot :-) . This game is often praised for it's high technical achievements, showing things people did not believe to be possible on a Commodore 64. The sequel: Turrican 2 contained even more advanced features, although I did not own a copy of it.


Experience


Except for playing games, writing many useless Commodore 64 and 128 BASIC programs, and some "experiments" in Commodore 64 assembly, I also wrote several programs that actually were a bit interesting (in some degree). The "coolest program" I wrote was a demo in which I rapidly abused POKEs and some delays to change the colors of the main screen and screen border, which created cool screen effects.

The most useful program I have created is probably the homework assistant, to help me learning my English/French vocabularies. It could be used to fill in Dutch words and their translations and to test your skills. It also had the ability to save your vocabularies on disk. Although creating the homework assistant was fun, I rarely used it during my studies :-) (probably because learning words wasn't that difficult for me).

Nowadays, computers are many times more powerful than my good old Commodore and have much more abilities. Moreover, throughout the years many more (high-level) programming languages, frameworks, libraries, paradigms and other techniques have been developed to make things more convenient. We have a lot of cool stuff, such as high resolution 3D graphics, but for some reason I don't get the impression that everything has become so many more times "better". Funny...

However, I'm happy to say that the Commodore 128 of my parents is still in my possession and it still seems to work, although I rarely turn it on nowadays.

References


For the screenshots included in this blog post, I used VICE, a collection of Free/Open-Source emulators for various CBM models, including the C64 and C128.

2 comments:

  1. "The good old days" :)

    The thing is a luxury problem. In 'the old days' one had to pour much creativity into the c64 in order to create something nice. The disadvantage was that this creativity needed much attention to hack the machine in order to (over) use it's possibility to get decent results. Nowadays, in comparison, the possibilities are virtually endless and if you start pouring, you should be careful not to spill. The trick is to keep attention to narrow your design. The good part is that there is less creativity needed to hack the machine in order to get nice results, which means more can be used to create nice software e.g. games. It still remains a challenge to do it compact and decent.

    ReplyDelete
  2. Yes you're right about luxury. So things such as writing stuff in assembly is something I'd rather avoid (because it is hard to understand, labour intensive and not portable), but other things nowadays are a bit over abstracted too. For example, I'm curious to see how this homework assistant program would look like implemented with "modern technology" compared to the original Commodore 64 BASIC program. Is everything that I use today so much "better"?

    Apart from technical issues, there are more things I'm thinking about. In the old days, we were allowed to understand and study the complete hardware architecture of the Commodore and implement our own tweaks. Furthermore, we were also allowed to talk about it freely and share information with others. Even magazines explained all the low-level stuff.

    If I compare all these things with modern technology, we also have much more restrictions. For instance, if we hack/tweak a game console (I'm not going to give an example here) we are considered criminals (or even terrorists). We are no longer allowed to know how these devices work and to do things we want. Moreover, companies also sue people who share details on their web pages/blogs and also ask search engines to filter the web.

    Furthermore, there is also a lot of secrecy with hardware specifications. Some hardware vendors refuse to give away specs, they obfuscate things (or use encryption). Anyone who attempts to write his own custom driver is going to get sued.

    Although on the Commodore things weren't truly free (as in freedom) either, we didn't have all those annoying restrictions and we were happy with the things we could do.

    ReplyDelete