Anders Hesselbom

Programmerare, skeptiker, sekulärhumanist, antirasist. Författare till bok om C64 och senbliven lantis. Röstar pirat.

Startsidan > Texter > Teknikblogg

Tag: C128

Rita en cirkel på Commodore 64

Det finns ett meme som visar hur omständligt det är att programmera BASIC på Commodore 64 (C64). Bilden visar den kod som krävs för att rita en cirkel på skärmen på en C64, jämfört med den kod som krävs för att rita en cirkel på skärmen på Sinclair [...]

Förberäknade spritebanor på Commodore 128

Med anledning av hur långsam Commodore 128 var på att beräkna multiplikation och division, detta klipp visar hur man kan förberäkna banor för sprites.

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. 1. Ladda he [...]

Linjär interpolering

Jag använder min Commodore 128 för detta exempel, eftersom jag vill komma åt den höga upplösningen i 80-kolumnsläget, men koden är körbar även på C64, Vic 20 och Pet, med reservation för radbryten och annat. Jag använder alltså en skärm som rymmer 80 [...]

Två Commodore 128-algoritmer

Commodore 128 bitmap graphics 2/2

Part 1. Part 2. On the Commodore 128, the screen is divided into characters. Each character consists of eight eight-pixel lines (bytes), which make a total of 64 pixels per character. Each pixel pair represent one of four available c [...]

Commodore 128 bitmap graphics 1/2

Part 1. Part 2. 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 bui [...]

Commodore 128 vector graphics

The Commodore 128 have a rich API for making colorful vector graphics. The low resolution (160x200) color mode allows you to make the classic "Forrest Gump" smiley using these five lines of code: 10 COLOR 0, 13 : REM GREY BACKGROUND 20 COLOR 4, 13 [...]

Skalning av vektorgrafik på Commodore 128

Genom kommandot SCALE kan man skala vektorgrafiken, alltså den grafik som skapas med kommandon som DRAW, CIRCLE och BOX - inte sprite-grafik eller text. När man arbetar med högupplöst grafik utan skalning är skärmen 320 pixlar bred och 200 pixlar hög [...]

Making music in Basic 7.0 part 5

You can add pitch bending using the SOUND command. By itself, you cannot use envelopes, just flat sounds in any given pitch. The arguments are voice (1, 2 or 3), frequency (0 to 65535), duration (16 = one second), pitch bend direction (0 = up, 1 = do [...]

Making music in Basic 7.0 part 4

Apart from PLAY, the commands that are available for making sounds and music are TEMPO, ENVELOPE, SOUND and FILTER. TEMPO lets you control playback speed. The slowest is 1 and the fastest is 255. ENVELOPE lets you modify the ten predefined inst [...]

Making music in Basic 7.0 part 3

When you use the other synthesizer control characters (O, T, U and X), they apply no matter of what voice (V) you have chosen. So when you for example use O to set the octave (0 to 6), all the following notes, regardless of voice, will be played in t [...]

Making music in Basic 7.0 part 2

The synthesizer control characters (V, O, T, U and X) always take one integer argument and always affect all the rest of the notes that are played. V stands for Voice and is the key to polyphonic music. Since polyphonic music is achieved by playing n [...]

Making music in Basic 7.0 part 1

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. PL [...]

Sequential data on 5.25 inch floppies

If you have an actual 1571 disk drive for your Commodore 128, insert a blank disk, format it using the HEADER command. Something like this: HEADER "MY DISK", I44, D0 (Formatting a disk takes a while.) If you are running a virtual Commodore 128 i [...]

Plotting graphics

The Commodore 128 has a nice API for setting graphics mode and plotting graphics, that can be used in 40 column mode. The GRAPHIC command takes a mode (0 to 5) and a "clear screen flag", and changes the current graphics mode. 0 is the 40 column text [...]

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 Assembl [...]

Let’s make the screen flash!

This program will make the screen flash on the Commodore 128, and it will also run on the Commodore 64. The background color of the screen is stored at D021 (53281), so this effect is accomplished by manipulating the value at that address, multiple t [...]

Collision detection

A nice and quick way to create two filled sprites (sprite 1 and 2) is to enter the monitor and type: F 0E00 0E3E FF F 0E3F 0E7E FF Of course you can fill both at once, but this the above code nicely declares the two memory areas I am using in [...]

Poking graphics on the C128

The skills of using PEEK, POKE and logical operators that I write about for the Commodore PET here, can be used to create graphics on the Commodore 128, in 40-column mode. Before you begin, you might want to clear the screen using the SCNCLR command. [...]

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 b [...]

Some cool software for the C128: GEOS

So CP/M is the text based disk operating system for the Commodore 128. You could buy a window based operating on disk called GEOS (Graphic Environment Operating System). GEOS was available for some of the Commodore machines and the Apple II. GEOS i [...]

Some cool software for the C128: CP/M

CP/M, the disk operating system for the Commodore 128 This is one of the strange things about this machine. Microsoft DOS was around, and Commodore was already making computers running DOS. But the Commodore 128 was supposed to run CP/M. Who used [...]

Basic data management

If you want to do this on a real Commodore 128, you will need a blank floppy disk, and if you are doing this from an emulator, you will need a blank floppy image. I have created a blank d64 image from the Vice emulator. To do that, click File, Attach [...]

The oddities: GO64 and sound

GO64 In some ways, GO64 behaves as a command (GO) with one argument (64). For example, you can type GO64, GO 64 or even GO 70-6 and all will set the C128 in C64 mode. But in some ways, GO64 behaves as a command on its own. For example, from the fact [...]

The sprite engine

One of the built in applications in the C128 is the sprite editor. Enter it by typing SPRDEF. Choose a sprite number, use the cursor keys to move the cursor and numeric keys to draw. 1 will delete a pixel, 2 will draw with the first color. In multico [...]

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 [...]

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 th [...]

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 [...]

En kopp kaffe!

Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!

Bjud på en kopp kaffe!


Kontaktuppgifter, med mera, finns här.

Följ mig

Twitter Instagram
GitHub RSS

Public Service

Folkbildning om public service.