Category: General

Dagens ord om Skeptikerpodden

John Houdi säger det så bra, så jag låter han tala:

Tänk vad fort det går. Vi har nu gjort 16 avsnitt av Skeptikerpodden!

Med tanke på den respons vi fått så har denna poddradio varit eftertraktad länge, vilket vi som gör Skeptikerpodden tycker är oerhört kul.

Läs inlägget här.

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.

On the C128, you just had to make sure you saw the line of code on screen, move the text cursor to it, write something else on top of what is there, and save it by pressing Enter. The C65 does not allow you to fly around with the text cursor over the screen. I loved the fact that you could move the cursor to any position, but it was tricky to collect user input if the user suddenly felt the urge to move away and type something unexpected at an arbitrary location. Perhaps they were to implement some command to do this, or perhaps they planned to allow the cursor to move freely. I don’t know.

I have found some great improvements. Here, I have added 4 lines of code. It displays three lines of text and makes a sound. I use the LIST command to display the whole Commodore Basic 10 program.

Already on the C128 you could use arguments to list parts of the program, and change the line numbers throughout the program using the RENUMBER command. But on the C65, you can find out the line number of certain line of code using the FIND command.

The above image shows the C65 telling me where the word HEJ can be found in my program. Also, I can use the CHANGE command to search and replace text. Let’s say I want to change the notes I want the C65 to play, I can use CHANGE to do this. The C65 asks for each search hit before changing.

Hope to get back to the lovely world of Commodore in the future.

The Commodore 65

This is truly one of those machines you really want to own. The Commodore 65 (or C64DX) never made it to the market, probably because of the huge success of the Commodore Amiga. But what a machine it is.

Better graphics than the Amiga, 128 Kb of RAM (could be expanded 8 Mb) and a Basic interpretator for Commodore Basic 10. Commodore Basic 10 is sort of the same that the Commodore 128 has (Commodore Basic 7) but well improved with added support for mouse programming and genlocking (that is adding graphics to video).

The most amazing feature of the C65 must be that it had two SID chips for sound. This gave the machine 6 channels of fat analogue stereo sound. Like the C64, but more.

There are (illegal) ROM dumps circulating the Internet, and I sometimes get it to run without crashing my PC. I hope to get back to this soon enough.

Logging in Notepad

All that you have to do is to add .LOG as the first line in a text document, and then save it. Now, each time you open the text file in Notepad, the current date and time will be added to the file, and the file will be marked as unsaved. I started out like this, and saved my file:

.LOG

This is a log.

Next time the file was opened, this is what Notepad showed:

.LOG

This is a log.

00:32 2010-06-19

The date is not in the file, it was added when the file was opened. I added a line of text (“A new line is added to my log”), saved and reopened again. Notepad added a new line like this:

.LOG

This is a log.

00:32 2010-06-19

A new line is added to my log.

00:39 2010-06-19

Those little things can be so nice to have!

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 is not “smashing” either, but it solved some problems that text based systems had at that time. It presented the features of the applications and the system itself, so that the user could point and click on the feature that user wants to use. These screenshots show GEOS in all its glory on an enormous 320 by 200 pixel screen.

At startup, GEOS shows the content of the system disk. To access some of the useful applications, you would insert that disk, and click Disk and Open to refresh the screen. GEOS was delivered with word processor, a painting program, among other things. Not very sophisticated compared to what you could get for your Macintosh or Windows, but a life saver for any C128 user.

GEOS did not multitask very well. Here, when I use the calculator, I can’t move the mouse outside the calculator window. I need to close it, before I can access the applications window behind, and that window cannot be moved around. It can be closed, and reopened from the Disk menu.

GEOS was relesed in 1986 and from what I know, the GEOS disks are not available for download.

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 this?

If you want to boot CP/M, download the image from here. In the ctools/x128 folder, attach the “cpm128.d64″ image to device 8 and type BOOT (or reset the machine).

Attach the first file to drive 8 and type BOOT (or reset the machine). If you’re doing this from a physical C128, make sure to have the 80 col key pressed down. If you’re doing this from the Vice emulator, send the -80 argument to x128.exe at startup.

X128.exe -80

It takes a while to boot, and watching the prompt is sort of just as fun as watching it boot. What can it do? Most of the operations will require that other disks are inserted to the drive. They were delivered with your machine when you bought it, but you probably reformatted those disks to make room for some pirated games. However, you can show the contents of a disk by typing dir and you can get help by typing help. Hang on, it is working on providing you help. No it didn’t crash, it is working on providing you help! Yes, it is. Ah there you go. Like I said, it can provide help!

In purple and everything!

Some commands worth mentioning are PIP to copy or combine files (PIP can be used without any extra disks), ED to edit a file, DUMP to display a file and FORMAT to format a CP/M disk.

Have fun. Or perhaps: Have “fun“.

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 disk image, and Drive 8 to display the Attach disk image dialog. There, type in a filename, click Create image, and finally click Attach.

You can make sure that your disk is correctly attached by typing DIRECTORY. This is what you should see:

To create a blank area of memory, enter the machine code monitor and fill a memory area with the value zero. Type:

MONITOR

F 1000 1100 0

To ensure that memory now is blank, type M 1000. Type X to leave the machine code monitor. Note that the monitor is using the hexadecimal, so the area that we have blanked out is from address 4096 to address 4352.

From the Basic parser (that is, outside the machine code monitor) the POKE command is used to set a byte and the PEEK function is used to get a byte. Commodore Basic uses the decimal number system but is equipped with functions to convert between the systems.

So, to set a byte at position 4096 (in this case, the value 5) type:

POKE 4096, 5

To read the same byte, type:

PRINT PEEK(4096)

Also, you can enter the monitor and type M 1000. This is what you should see:

The C128 has built in commands for saving memory to disk and loading memory to disk. Let’s say that we want to save our byte and some following bytes, use the BSAVE command (Binary Save). This will save 4 bytes to a file called TEST.DAT, where the first byte is our value 5. The second argument is the device (B0 is device 8), the third argument is the address range (the character P must occur before the number).

BSAVE "TEST.DAT", B0, P4096 TO P4100

Type DIRECTORY to make sure the file is located there.

To load this file, use BLOAD (Binary Load). This is a test you can do.

Type PRINT PEEK(4110) to ensure address 4110 is empty. Load the file into the address 4110 by typing:

BLOAD "TEST.DAT", B0, P4110

Type PRINT PEEK(4110) again to see that it now holds the value 5, as loaded from the file.

Skeptikerpodden och tillhörande forum

In short: The last week has been dedicated to the podcast and the Swedish skeptic movement.

Det var ett tag sedan jag uppdaterade något på WinSoft.se, vilket grämer mig. Tiden har gått till vår podcast, Skeptikerpodden. Dessutom lanserar vi strax ett nytt forum, som redan är uppsatt. Om du är intresserad av skepticism (eller om du är vidskeplig för den delen) och vill diskutera frågan, kan du redan nu registrera ett konto och hoppa in. Trots att det är lite tomt så här i början. Forumet heter Skeptikerforum.

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 that GO 60+4 does the job, you would perhaps expect GO 65 to generate a ?ILLEGAL QUANTITY ERROR, but it generates a ?SYNTAX ERROR. The fact that typing GO 8*8 sets the machine in C64 mode is strange enough.

Sound
The PLAY command plays notes and the SOUND command audio in any frequency. PLAY can deal with notes and volume envelopes but not pitch bending. SOUND can pitch bend but not deal with volume envelopes. This plays three notes, C, D and E, with a volume envelope that emulates a piano:

PLAY "CDE"

This plays a C-maj chord:

PLAY "V1 C V2 E V3 G"

This plays a pitch bending sound without a volume envelope:

SOUND 1, 8000, 40, 2, 7000, 100

The arguments are channel, frequency, duration, direction (2 means oscillate) and stepvalue.

If I make a program with a PLAY command that is directly followed by a SOUND command that plays a sound in the same voice channel, they are combined! This gives a pitch bending sound with a volume envelope! T5 means that I use the predefined guitar volume envelope, and HC means half note of C (two quarters long C).

10 SOUND 1, 8000, 50, 7000, 100
20 PLAY "V1 T5 HC"

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 multicolor mode, you can also use 3 and 4. To save and close the editor, press SHIFT+ENTER followed by ENTER.

The sprite engine in Commodore Basic 7 lets you enable and disable sprites, and control sprite movement. The SPRITE command is used to turn sprites on or off and to set the sprite attributes. The arguments I have used is one-based sprite index (1), on (1), cyan color (4) in front of other graphics (0).

10 SPRITE 1, 1, 4, 0

My next line of code, will tell the sprite to move to the left using the MOVSPR command. The arguments I have used are one-based sprite index (1), 90 degrees at a speed of 4.

20 MOVSPR 1, 90 # 4

Type RUN to start the show.