Jag har slängt ihop två nya SID-låtar som kan avnjutas på din Commodore 64. Den ena (the_roger_boogie.sid) är ett resultat från ett demo-jam på jobbet tillsammans med Klas Dahlén, Roger Johansson och Erik Sandberg. Den är egenkomponerad och använder en samtida playerrutin (SID 8580). Förhandsgranskning finns på YouTube. Den andra, som är en cover på låten I Touch Myself av Divinyls, slände jag ihop igår kväll. Den körs på en rutin som är anpassad till den gamla brödburken (SID 6582). Ladda gärna hem filerna här!

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 mode and 1 is the high resolution monochrome graphics mode. This program sets a few random pixels on the screen using the DRAW command: 10 GRAPHIC 1, 1 20 FOR A = 1 TO 100 30 DRAW 1, RND(1) * 320, RND(1) * 200 40 NEXT A When the program is run, the text is hidden, so to retain the text cursor, just type GRAPHIC 0 and hit Enter. If you like,[…]

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 times. This program cannot be written in Basic, because the Basic interpreter is too slow. Remember that the machine code monitor expects code in one format, and displays it in another, so what I show here, is what I actually type in. I will write my program at location 1000 (4096) in the memory. Type MONITOR to enter the machine code monitor, and type F 1000 1100 0 to create some free space. To begin writing[…]

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 anything! 😉 10 FOR I=0 TO 62 20 POKE 704+I, 255 30 NEXT I 40 POKE 2040, 11[…]

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. The bit pattern at D015 gets and sets what sprites are enabled, just as it does on the Commodore 128, but on the Commodore 128 we also have[…]