Commodore 128 Tips & Tricks

Go to content


Standard COMMODORE devices

Commodore 1570

- drive 1541 compatible for Commodore 128
- CBM DOS V3.0
- 170kB 5,25" SSDD diskette
- uses burst mode
- booting supported

Commodore 1571

- faster excellent drive for Commodore 128
- CBM DOS V3.0
- 340kB 5,25" DSDD diskette
- uses burst mode
- booting supported

Commodore 1581

- fastest excellent drive for Commodore 128
- CBM DOS V10.0
- 800kB 3,5" DSDD diskette
- uses burst mode
- booting supported



speedup data storage to 3,5" diskette DSHD - Double Sided High Density 1,6MB.
faster than more Commodore serial devices. Has own DOS, supports partitions and sub-directories.


speedup data storage to 3,5" diskette DSED - Double Sided Extended Density 3,2MB.
It's also
faster than more Commodore serial devices. Has own DOS, supports partitions and sub-directories. This model is very rare.

CMD HD-Series
SCSI hardisks for Commodores
in range of
20MB to 4GB!!!!

Fastest storage (only RAMLink is faster from CMD devices) by using SCSI HDD with non-standard parallel connector (look below). Very good solution to storage data from your diskettes to HDD, supporting partitions and sub-directories etc.

First some steps to get storage faster and better...

Here's a very useful technique that makes your
C64 programs run automatically when loaded.
To use it, you must add this line to your BASIC program:

0 poke 770,131:poke771,164

Now, save the program like this:


After the program has been saved, the computer locks up, continually flashing READY at the top of the screen. To return things to normal, simply turn your computer off and on.
Now the command LOAD"filename",8,1 automatically loads and runs your program.
You must use the ,1 extension.

Yes, it's solution for C64, but it can be done easier:

- write small routine at
$02C0 - $02FE (it's free for 64 bytes) which runs main program
- rewrite vector at
$0302 to $02C0
- saving
$02C0 to $0303, then main program.
All is pretty good, but: everytime you must to use
secondary address, so not standard LOAD"NAME",8 but everytime LOAD"NAME",8,1 and it's on these two solutions wrong. Better is booting on C128 :-)

Small program to get free blocks on disk:

10 z$=chr$(0):open1,8,0,"$0:"
20 for i = 1 to 18: get#1,a$, b$: next: close1
30 f=asc(a$+z$)+256*(asc(b$+z$))
40 print f;"blocks free"

Required blocks for saving program (for both computer modes C128 and C64)

graphic clr:x=58109-fre(0):printint(x/254)+"disk blocks required"
x=peek(45)+256*peek(46)-2049:print int(x/254)+1"disk blocks required"

Everybody don't want to have in program ?DEVICE NOT PRESENT ERROR, here's protection:

10 open2,deivce,2:close2:ifst<>0thenprint"Turn on device!":goto10
20 rem **** continue ****

Shortest SEQ file reader ever:

open 0,8,0,"filename,s,r":sys41149

There are a few quirks here, but it is indeed very quick. Being a one line program, it can be assigned to one of the 128's function keys as well.

RESET of diskdrive:


Single-Sided 1571 or Double-Sided:

In C64 mode, or on a regular C64, the 1571 defaults to single side mode. You can switch to double sided mode by issuing the following command:

OPEN 15,8,15,"U0>M1":CLOSE 15

To switch back to single sided mode:

OPEN 15,8,15,"U0>M0":CLOSE 15

While in single sided mode, you can switch to the other side of the disk, without turning it over, by switching to the other side's read/write head:

OPEN15,8,15,"U0>H1":CLOSE 15

Faster 1541?

The 1540 disk drive (which was designed foe the VIC computer) was a faster drive than its offspring, the 1541. The difference in speed is, believe it or not, related to the screen sizes of the VIC and the 64. The VIC's smaller screen puts less of a demand on the system. (The VIC has a screen size of 22 characters across by 23 characters vertically, while the 64's screen is 40 by 25). On the VIC, 4048 bytes of memory had to be read and displayed, but 8000 need to be read and displayed on the 64. The 64 can't keep up with the 1540 unless you turn off the screen.

If you are willing to turn off the screen, you can put the 1541 into 1540 mode with one simple disk drive command. This is especially useful from within a program that needs to read or write to disk. The following line blanks the screen and speeds up the serial bus:

POKE 53265, PEEK(53265) AND 239: OPEN15,8,15,"UI-":CLOSE15

And this line returns the screen and drive to normal:

POKE 53265, PEEK(53265) OR 16: OPEN15,8,15,"UI+":CLOSE15

This technique is most useful for reading and writing files from within a program. Be sure to warn the user that the screen will blank so the he or she doesn't think the computer has locked up.

View SCRATCHED files:

You have to read blocks directly from disc (directory blocks). For a 1571 you have to read sector at track 18 sector 1 and further on (next sector from first two bytes)

To read blocks directly you open a buffer "#" and send "U1" command. (Alternatively burst read commands ... - not nessecary here).

Each directory entry has 32 bytes if I correctly remember it. But this is very good documented, look for D64 description (in
Download section are described all known Commodore disks formats and emulator formats).

CMD solutions for larger and faster storage...

You can look also on Commodore Disk Drives webpage where are described more drives than were known.

One more:

Start program in C128 mode with software switch to C64 mode and continue in program...

Mike Tranchemontagne

Most Commodore 128 owners know that their computer can automatically load and run any 128 program from disk. This easy-to-use program adds the same convenience for Commodore 64 programs as well, allowing the 128 to load and run any C64 program automatically when you boot the system. A disk drive is required.

The Commodore 128 has many outstanding features, not the least of which is its ability to run thousands of excellent Commodore 64 programs and games. The 128 can automatically load and run any program written for 128 mode or CP/M mode. Although there are programs for the 64 that automatically run after loading from disk, it's still necessary to type in a command like LOAD "PROGRAM", 8, 1 to activate the disk drive in 64 mode. "Boot 64 For 128" automates this process so that you can load and run any Commodore 64 program simply by putting the disk in the drive and turning on the computer. This feature is ideal for younger members of the family or infrequent computer users. Even experienced programmers will appreciate the extra convenience it affords.

Creating An Autoboot Disk

Type in Programs 1, 2, and 3, and save copies of all three programs. For the boot sector created by Program 2 to work properly, you must use the filename 128BOOT64 when saving Program 1. To create an autobooting disk for 64 mode, follow these three steps:

1. Select the disk which will contain the 64 program you want to load and run automatically. Load Program 2, insert the disk in the drive, and run the program. When Program 2 is finished, the disk contains a 128 boot sector that will cause the computer to load and run a program named 128BOOT64. (You do not need to save Program 2 on the target disk.)

2. Load Program 1 and save it on the disk. Remember, you must save this program with the file-name 128BOOT64.

3. Load the 64 program which you want to load and run automatically; then save it on the disk using the filename BOOT64. You must save the program with this filename.

Once you've performed all three steps, place the disk in the drive and reboot by turning the power off and on or by pressing the reset switch. If the computer does not load and run the desired program, check Programs 1 and 2 for typing errors and repeat the process. Keep in mind that the process won't work unless you use the filenames noted above.

Autobooting ML Programs

With this technique, you can load and run any Commodore 64 BASIC program. The same is true of any machine language program that runs like BASIC. For instance, SpeedScript, COMPUTE!'s word processor, ordinarily starts with LOAD"SPEEDSCRIPT", 8 and RUN. To autoboot and run SpeedScript, simply save SpeedScript to disk with the filename BOOT64 as described in Step 3.

You can also autoboot and start a machine language program that normally loads with ,8,1 and starts with SYS instead of RUN. Program 3 is a very short BASIC loader which loads an ML program into memory, then activates it with SYS. As listed, the program loads and starts DOS 5.1, the DOS Wedge program supplied on the 1541/1571 Test/Demo disk. To load a different ML program, replace the name DOS 5.1 in line 20 with the filename of your program, and replace the address 52224 in line 30 with the correct SYS address for the program. When that's done, perform steps 1 and 2 as described earlier; then save Program 3 on the disk with the filename BOOT64. Of course, you must also copy the ML program to the same disk, using the filename you specified in line 20 of Program 3.

How Autobooting Works

When you turn on the 128 (or reboot by pressing the reset button), the computer automatically performs several checks to determine which mode it will operate in. If an autostart cartridge is plugged into the cartridge port, the cartridge takes control. If the Commodore key is pressed, the computer enters 64 mode. If the STOP key is pressed, the 128 enters the built-in machine language monitor.

If none of these conditions applies, the 128 looks on sector 0 of track 1 of the current disk (known as the boot sector) to see whether it contains a boot header. If no boot header is found, the computer simply starts BASIC, which produces the familiar READY prompt. However, if the boot header information is present, the 128 automatically loads and runs the program indicated in the boot sector. This process works equally well with a 1571 or 1541 disk drive.

In 128 mode, the 128 can switch to 64 mode by performing the command GO64. However, there is no provision for loading and running a program after you enter 64 mode. To achieve the same effect, this program creates a boot sector that tells the computer to load and run the program 128BOOT64. That program, in turn, stores a short machine language program and cartridge-identifier bytes in the special memory area where Commodore 64 autostarting cartridges normally reside. The ML program causes the computer (now in 64 mode) to perform a normal reset. When the reset occurs, the computer detects the cartridge-identifier bytes, concludes that a cartridge is present, and runs the ML routine found at the cartridge start address. This program, in turn, uses the dynamic keyboard technique to load and run a program named BOOT64 from disk. The process may seem complicated, but it all happens very quickly, and you need not understand the details in order to take advantage of it.

For instructions on entering these listings, please refer to "COMPUTE!'s Guide to Typing In Programs" in this issue of COMPUTE!.

Program 1: 128BOOT64
XK 20 READ D$: IF D$ = "-1" THEN GO64
HR 30 POKE A, DEC (D$):A = A + 1: GO TO 20
PH 40 DATA 09, 80, 5E, FE, C3, C2, C, D, 38, 30
HM 50 DATA 8E, 16, D0, 20, A3, FD, 20, 50, FD
QX 60 DATA 20, 15, FD, 20, 5B, FF, 58
QH 70 DATA 20, 53, E4, 20, BF, E3, 20, 22, E4
CQ 80 DATA A2, FB, 9A
PH 90 DATA A2, 00, BD, 41, 80, F0, 06
AK 100 DATA 20, D2, FF, E8, D0, F5
HA 110 DATA A9, 0D, 8D, 77, 02, 8D, 78, 02
FG 120 DATA A9, 02, 85, C6
JA 130 DATA 4C, 74, A4
BR 140 DATA 0D, 4C, 4F, 41, 44, 22, 42, 4F, 4F, 54, 36, 34, 22, 2C, 38
BQ 150 DATA 0D, 0D, 0D, 0D, 0D, 52, 55, 4E, 91, 91, 91, 91, 91, 91, 91, 0, -1

Program 2: Boot sector Maker
JF 20 DCLEAR: OPEN 15, 8, 15: OPEN 2, 8, 2, "#": PRINT# 15, "B-P:2, 0"
RR 30 READ D$: D = DEC(D$): IF D>255 THEN 50
EE 40 PRINT# 2, CHR$(D); : GOTO \ 0
RJ 50 PRINT# 15, "U2;2, 0, 1, 0"
XG 70 DATA 43, 42, 4D, 00, 00, 00, 00, 31, 32, 38, 42, 4F, 4F, 54, 36, 34, 00, 00, A2, 18
RM 80 DATA A0, 0B, 4C, A5, AF, 52, 55, 4E, 22, 31, 32, 38, 42, 4F, 4F, 54, 36, 34, 00, 100

Program 3: ML Loader
KM 20 IF A = 0 THEN A = 1: LOAD "DOS 5.1", 8, 1

Description of Serial Port of Commodore Computers:

(Used for Disk Drives or printers)

1. Serial SRQIN (NOT)
2. GND
3. Serial ATN IN/OUT
4. Serial CLK IN/OUT
5. Seral DATA IN/OUT

Description of Parallel Port of CMD devices:

Back to content | Back to main menu