June 26, 2022

Some reasons why the Commodore 64 has felt out of fashion

 

In the 1980s the Commodore 64 was the most sold home computer. It wasn't sold 1 million times or 5 million times but more than 15 million machines were produced by the Commodore company. The C64 was an affordable computer, and many games were created first for this machine. It has revolutionized a decade and even today, the C64 stands for the personal computer in general.
To get a better understanding why the machine has felt out of fashion we have to describe the context in which the C64 was published. The development was driven by technically possibilities. At the beginning of the 1980, the microchip was available namely Intel based CPUs and of course the 6510 CPU from MOS technology. Also it was the first time, that low cost DRAM chips were produced in mass amount, so it was from an engineering perspective logical consequence to combine these ingredients into a single product. The C64 was a basically a combination of 64 kb RAM, a cheap 8bit CPU and external devices like printerss and floppy drives.
After the hardware was available it was from a programming perspective also a logical idea to create for this machine lots of applications and of course games. It was a self reinforcing circle. The huge amount of sold C64 made the computer interesting for games publishing houses and the huge of games, made the product interesting for more consumers to buy the hardware.
Even if the situation was amazing there were some cons available. First problem with the 6510 CPU is, that it has only a low amount of registers. This makes it hard to program the CPU with high level programming languages especially C. The only programming language which runs fast on the 8bit CPU is Assembly language and Forth. The problem with Assembly language is, that it is hard to write longer programs which exceed 50 kb and more. Larger applications which are written in the C language have a size of 500 kb and more. The C64 CPU and the small amount of RAM prevents such software can be executed.
Another problem with the device was, that it was controlled by a single company. Commodore has invented build the CPU, the specification, the ROM chips and it was impossible for third person companies to built their own C64 clone.
And perhaps this explain why the IBM PC has become a success. First thing was, that third party companies were allowed to create the hardware and secondly, the CPU wasn't fixed but different sort of CPU with many registers were used in these machines. This combination allows C programmers to create more complex applications which has resulted intodays bloatware software which can be created easily from scratch.
Hardware oriented programming
For today's programmers it is some sort of mystery how exactly software was created for the Commodore 64. First problem was that the amount of RAM was low, and secondly the programmers in the 1980s were thinking differently from today's software engineers. The perspective of the 1980s can be summarized with a CPU oriented approach. The idea was, that it is hard to built and maintain the hardware of a computer. The most important part is the CPU, the RAM chip and the cycles which are scheduled on the main board. That means in each second the C64 was running with 1 million cycles and during each cycle the next assembly instruction is executed.
The only possible cause of errors – at least in the understanding of the 1980s engineers – was that something with the hardware is wrong. For example, that one of the transistors in the CPU has a malfunction or that something with the electric current on the mainboard is wrong. The consequence is that the engineer has to open the machine, and search for the error with a measurement instrument. In contrast, software was seen as not important or in the worst case, the software was seen as an error. For example bad written program will slow down the cpu or will waste the RAM of the computer.
The main purpose of the 1980s programmers on the Commodore 64 was to write efficient software in a sense that it will occupy only little amount of RAM and use a small amount of assembly instructions. The interesting situation is, that this hardware oriented habit isn't the only one which is available but from today's perspective it is something which has slowed down the development.
Perhaps it makes sense to describe the opposite perspective towards the same problem. In a software oriented perspective, the computer hardware is perceived as something which is there and which has unlimited amount of resources. For example a computer has 3 million pixels on the screen, and 2 GB of RAM and now the question is how to program the computer so that it will do something useful. A typical challenge is to program an object oriented programming language, a graphical user interface or to create a large database applications. What the post-C64 programmers doesn't like to do is to understand the hardware. They simply doesn't care about the CPU nor the transistors in the CPU.
The interesting situation is, that both perspective are working the opposite. It is possible to focus either on the hardware or on the software but never fulfill both requirements together. In the 1980s the focus was only on the hardware because at this time computer hardware was the bottleneck. Software defined requirements for example a graphical user interface with lots of colors were ignored in this area. It was described as not needed and in the worst case, a GUI was seen as something which will slowdown the computer.

June 12, 2022

Programming the Atari 8bit home computer

 

The most dominant computer in the 1980s was the commodore 64. Until the year 1985 the sales for the IBM PC and the C64 were the same. But there was a smaller alternative available which was the Atari 600XL. The Atari 8bit computer was equipped with only 16kb of RAM and was sold for a lower price than the C64.
The question left open is how to program such a device. A look into magazines and books from the 1980s will show that two dominant programming languages were used: BASIC And the assembly language. For today's programmer it looks a bit unusual but in the 1980s most software was created in Assembly.
So what is Assembly language? It is a machine oriented programming style. The programmer has to know the details of a certain CPU, a certain memory layout and all the onboard chips. Assembly language is written from a hardware perspective. The underlying idea is, that the dominant problem of a computer is to built the machine with RAM, keyboard and CPU and then a short program demo is coded in the assembly language. For this reason assembly works great.
The reason why today's programmers have lost their interest in the assembly language is because they are not writing short demo programs in 1 kb anymore. What today's programmers are trying to archive is to create larger projects which have 100 kb and more in sourcecode. Such programs can't be written on 8bit homecomputers and especially they can't be created in assembly language. It would take years until a team of programmers has created such a program.
A seldom noticed side development for the Atari 8bit computer was the existing of so called C compilers like Deep blue c and tiny c. A program written in Deep blue c has much in common with a modern program written for Windows or linux. The idea of C is that the programmer is using a library of graphic routines and that a single command is very powerful. For example, the c language allows to open a file and write some characters into that file in under 10 lines of code. Such a feature would need much more lines of code in the assembly language.
The C language and the Pascal language have much in common. They are both academic programming language because they are using a high abstraction level. The underlying hardware gets ignored and the programming language itself stands in the focus. Instead of focusing on a certain CPU type, the programmer is asked to use for loops and existing programming libraries. Also he can use sub functions and variables.

June 02, 2022

Why Forth is better than Python

 

There is some sort of ongoing debate available which of the programming languages is more compact and which runs more efficient. Of course, the winner is Forth because this stack based language is the preferred choice of elite programmers. It needs only a small amount of RAM and can be executed an any computer including the Commodore 64.
To get a better understanding why exactly ANSI Forth is more than ready for creating large projects including video games, we have to compare the sourcecode for the game of Tetris. Both projects were created by different programmers in the past and perhaps they doesn't aware of each other.
The first one was written in a Forth dialect and compiles out of the box under Linux and Windows as well. It needs only 384 lines of code and the bricks patterns were encoded in a very elegant way. In addition, the source code was factored well in subroutines so that the overall program is easy to understand.
In contrast, the same game of Tetris which was implemented in the Python language needs around 134 lines of code. The code is hard to understand and most operating systems aren't able to run the code because it was written for a certain python version which includes unknown libraries likes tkinter. The programmer has created a mess of methods which are distributed over classes and stand alone routines and it is hard to maintain the code.
Everybody is encouraged to compare the Python and the Forth language by itself. So there is no need to follow my judgment.