Anders Hesselbom

Skeptiker, debattör och religionskritiker


Blandade texter om Commodore genom åren.

Commodore 128 Hello world!

Några exempel på hur man kan skriva "Hello world" på den mångsidiga Commodore 128 (1985)... Läs hela texten.

Commodore 128 sprites


Funktioner på VIC-20


Om Commodore 64


AND, OR och EOR på MOS 6502


Kom igång med C128 Assembler

Idag finns en hel del produkter för att utveckla program till Commodore 64 eller 128 på en modern PC, vilket är betydligt enklare än att göra det direkt på målmaskinen. Följ dessa steg för att komma igång med Assembler i Commodore 128... Läs hela texten.

Två Commodore 128-algoritmer


Commodore 128 vector graphics

The Commodore 128 have a rich API for making colorful vector graphics. The low resolution (160×200) color mode allows you to make the classic “Forrest Gump” smiley using these five lines of code... Läs hela texten.

Commodore 128 bitmap graphics

When Commodore 128 vector graphics can't provide the desired details, there is an option to do bitmap graphics. The 128 have a built in command for creating pixel perfect graphics called SPRSAV. You can create a pattern using the built-in editor (SPRDEF)... Läs del 1 och del 2.


Vissa är säkert bekanta labyrintalgoritmen för Commodore 64, känd för de mer eller mindre slumpmässiga förutsättningarna som gör att en labyrint kan genereras med minimal kod. Koden jag tänker på är givetvis denna (Commodore Basic 2.0)... Läs hela texten.

Min gamla Commodore 128




Making music in Basic 7.0

In Commodore Basic 7, music is made using the PLAY command. PLAY takes one string, and that string contains the notations that you want the Commodore 128 to play. The string “CDE” will play the note C, and then the note D and finally then note E... Läs del 1, del 2, del 3, del 4 och del 5.

CP/M on a Commodore machine – online resources

To get started with CP/M, you will need a Commodore 128 with a disk drive or a computer that runs Vice (X128). The disks you need can be downloaded from here. The CP/M boot disk, the additional utilities, "more CP/M additional utilities", the Assembler utilities and Microsoft Basic 80 (two disks). If you run this on a physical machine, make sure to insert the boot disk, and to push in the "40/80 display" key on... Läs hela texten.

Sprites on the Commodore 64

Things gets a bit tougher on the Commodore 64, because this excellent piece of hardware did not come with Basic equipped with sprite commands. Nor has it a sprite editor or a machine code monitor. However, if we have access to a Commodore 128, sprites can be edited when in C128 mode, and then used in C64 mode. If we want, we can also use the machine code monitor in C128 mode and then execute the program in C64 mode. I am going to display a sprite without using the C128 mode... Läs hela texten.

Positioning sprites on the Commodore 64

The task of positioning sprites on the C64 holds one particular oddity that I want to show. To be able to position a sprite on screen, you must master binary logic on the C64, and binary logic works in the same way as on the Commodore PET, shown here. Also, you need a visible sprite. The following code does the trick. If you don't own a Commodore 64 and don't have an emulator, the code also works in JaC64, an on-line C64 emulator implemented as an Java Applet. However, I can't get the cursor keys to work in JaC64, so don't mistype... Läs hela texten.

Collision detection

A nice and quick way to create two filled sprites (sprite 1 and 2) is to enter the monitor and type... Läs hela texten.

Accessing individual bits on a Commodore PET

On a Commodore PET, each byte that can be read using the PEEK function, and set using the POKE statement. A byte consist of 8 bits, and represent a number between 0 and 255. This code writes the value 5 to the memory address 1020, and then reads it back. The output is of course 5... Läs hela texten.

Editing code on the Commodore 65

The Commodore 64 and the Commodore 128 uses the same method for editing code. You press enter over a line, and that line is stored the with the index of the entered line number, overwriting any existing code on that with that index. The Commodore 65 has the same machine code monitor as the Commodore 128 (it runs more smoothly because the C65 is much faster than the C128). Also, adding and overwriting Basic code is done in the same way. Editing is probably not, but I am not sure... Läs hela texten.

Manipulate a byte

When you get a tweet like this thrown at you, the only thing to do is to take another visit to the wonderful world of the C128 monitor. Let’s say that we were to make a program using assembler. We will store it at address 4096. Enter the machine code monitor by typing MONITOR, and view the current disassembled instructions at 4096 by typing... Läs hela texten.

The built-in machine code monitor

The Commodore 128 features a few built in applications and one Easter egg. The egg is a list of the engineers that built the machine, with the word “hardware” intentionally misspelled as “herdware” after 8-bit computer designer Bil Herd. To reveal the egg, type... Läs hela texten.

Hidden stuff in the C128

Here is some of the hidden stuff in my favorite computer, the Commodore 128. There is a bug in the Basic interpretation that shows up when you tries to do an arithmetic calculation using a string. This is what’s supposed to happen: When you add an integer to a string, the interpretator should say that you have mismatching types... Läs hela texten.

Visa det här inlägget på Instagram

Om du istället är intresserad av material om C#, klicka här!