Sunday, 6 July 2025

VIC20 Turbo Wedge

Shipping this week from TFW8b there is an updated version of the VIC20 Penultimate Cartridge, the Penultimate Plus 3 DCR.

Like the original Plus 3, this has a built in SD2IEC. This time it uses a full size SD card, and has the drive LEDs visible through the top of the case. There is also a detachable cable IEC cable. If you don't want to use the SD2IEC, just unplug the cable.

The menu is essentially the same, but you might notice the RAM now goes up to 280K.

That is 8 banks of 35K. Just waiting on someone to write a game that will make use of it.....

Turbo Wedge

A big change is this now boasts a turbo loader and DOS wedge that are automatically activated at boot.

This is going to be another one of those posts that scroll a lot, so here is a brief summary for those in a hurry.

  • COMMODORE + RUN/STOP - load and run first program on disk (LOAD"0:*",d,1)
  • SHIFT + RUN/STOP - load and run from tape (as normal)
  • # - display selected drive number
  • #d - change selected drive number (#8 #9 #10 #11)
  • /name - load a BASIC program (LOAD "name",d)
  • %name - load a machine code program (LOAD "name",d,1)
  • name - load and run a program (LOAD "name",d,1 RUN)
  • name - save a program (SAVE "name",d) and display status
  • $ - display directory
  • $C* - display files that start with C etc.
  • @ - get drive status
  • @command - send drive command and wait for response (@X? etc.)
  • >command - send drive command and return immediately
  • @C:newfile=existingfile - copy a file on the same diskette
  • @R:newname=oldname - rename a file
  • @S:name scratch (delete) a file (wildcards supported)
  • @UI - get drive ID string
  • @UI- - reduce send delay (VIC20 only)
  • @UI+ - increase send delay (for C64 compatibility)

Real drive commands

  • @I - re read disk (after disk change)
  • @N:diskname,id - format a disk with name and id
  • @N:diskname - quick format a previously formatted disk
  • @V - validate a disk - tidy up free blocks, unclosed files etc.

SD2IEC commands

  • @CD:name - change directory
  • @CD:name.d64 - mount a disk image
  • @MD:name - create a directory
  • @RD:name - delete a directory
  • @CD← - change back / unmount disk image
  • @XE+ - enable extension hiding
  • @XE- - disable extension hiding
  • @XW - remember changes to XE and UI after reset
  • @X? - display extended drive ID

In the last release of the Penultimate Cartridge, I added a fastloader, which was present in ROM, but needed to be activated with a SYS 40000 command.

That was using 1K of ROM in a space designed for IO devices on the cartridge port.

There are actually two 1K IO blocks available on the cartridge port, but only one was wired for ROM use on the old version of the hardware.

New PCBs were being produced to integrate an SD2IEC with a full size SD socket, making the Penultimate +3 DCR boards (a nod to the C128DCR).

Since the boards were being respun, I took the opportunity to give access to the second block.

With the additional 1K of space (luxury!), I have added a DOS wedge, similar to that used on the Mini PET.

I initially looked to the one in the C64 Epyx Fastload, but I didn't like the way that operated, so I have gone more towards the PET version (which was based on Nil's Eilder's version).

I have also saved you having to type SYS 40000, so now it is enabled when you exit to BASIC (unless you disable it from the Penultimate menu)

Status

With the wedge, you can issue disk commands directly from the READY prompt. With just the @, you can get drive status.

When a disk drive has been reset, the first call to status will return a drive ID. You can ask for that at any time using the @UI command.

Commands operate on the last used disk drive, normally ID 8. On the Penultimate +3, this will be the internal SD2IEC.

Drive IDs

You can display the currently selected drive using the # command.

You can also use that to change the currently selected drive.(#8 though #11)

That will persist until you reset, or change to another drive (or load from tape when it will change back to 8 afterwards).

Yes, you can still LOAD from tape, and since the SD2IEC is internal to the cartridge port, it does not need additional power, so you have access to both the datasette port and the userport.

Directories

One of the most useful things about a DOS wedge like this is you can get a disk directory without overwriting your current program.

This uses the $ command (or you can use @$ if you prefer), and you can use wildcards to limit the list.

LOADing

There are four new ways to LOAD a program, (yes, four), all shorter than typing in LOAD "game",8.

/game

This is the normal LOAD, and is equivalent to typing LOAD "game",8 (or whatever the current drive number is).

There is also %game if you want to do LOAD "game",8,1.

What's the difference?

Well, when you do /game or LOAD "game",8 this will load the program to the default LOAD address for the system with the current RAM options. This is normal for plain BASIC programs as it allows you to LOAD a game SAVEd on a system with a lower amount of memory on one with a larger amount (it is unlikely to work the other way around unless the program is small enough)

When you do %game or LOAD "game",8,1 if will load the program to the LOAD address specified in the file. This is generally the preferred option as it will ensure anything out of the ordinary is loaded where it is intended to go, specially for machine code programs, and buts of multi-part games or graphics data etc.

To demonstrate, I have switched to the VIC having no expansion RAM (yes, the turbo wedge still runs with no expansion RAM).

The  command is used to save the file.

The VIC20 memory map moves around when the memory size is changed. In unexpanded mode, the load address of that program is $1001.

Switching back to full RAM allocation, the normal load address is $1201.

If I load that program using /UNEXPANDED or LOAD "UNEXPANDED",8, then it get loaded to $1201. BASIC copes with this relocation fine.

(yes, you can use wildcards in the load commands as well).

If I was to use %UNEXPANDED or LOAD "UNEXPANDED",8,1 that would try to load it to address $1001, which in full RAM mode is actually the location of the screen, so you can see it overwrites the first line of the display.

BASIC programs are therefore best loaded with the built in relocation so that you can use them in a system with more memory that originally present (i.e. a 0K game with a 32K expansion, but not a 32K game on an unexpanded VIC).

Machine code programs and game and graphic data however do not like to be relocated, unless they have been designed to do so. They usually include jumps to specific addresses and if the code is loaded to a different location, the code will not be there when they jump (game over).

Most of the time % is the one you would want.

You said four?

Oh yes, so far there is / and %. The third is .

game is equivalent to %game (or LOAD "game",8,1) and then RUN.

That is using LOAD "game",8,1 as most of the time that is the right option (if you specifically need the BASIC relocation, then just type /game and then RUN)

The fourth option is COMMODORE + RUN/STOP. This will load the first program from the current disk and then run it.

It types in the %0:* automatically. I know I said fourth, but it's not Forth (or PERL or any kind of regular expression.)

% is LOAD as before, so that is a shortcut for LOAD "0:*",8,1

* means the first program on the disk.

Well, most of the time.

It actually means "the first program on the disk OR if you have previously loaded anything, the program you last loaded".

If I was to load HELLO next, that will be the last program loaded.

Now if you do LOAD "*",8 again, it will load HELLO instead.

Adding the 0: in front forces the "first program on the disk", specifically, "first program on the disk in the first drive of this unit". It is a throwback to the the PET disk drives like the 4040 and the 8250. These were dual drive units, device ID 8, or unit 8 with two drives per device. Drive 0 and drive 1 were selected with LOAD "0:game",8,1 or LOAD "1:game",8,1

And we are back to the first program on the disk again.

N.B. this is the first program displayed when you do a full directory listing. If you are using an SD2IEC type device and you have let Windows near the SD card, it can sometimes mess up the file table and place a different file first to the one you expect.

SAVEing

The  is used for save, so game is the same as SAVE "game",8.

Unlike the normal BASIC SAVE function, when the file has finished saving, the drive status is shown, so you can see how it got on.

With the normal SAVE function, you do not get any feedback, other than the error light flashing on the drive.

If you tried to save again with the same filename using the  command, you would see the error of your ways.

Tape

SHIFT + RUN/STOP will LOAD from tape and RUN, as normal.

Disk commands

There are various useful commands you can now easily access with the wedge using @ (or > if you prefer).

@ - Status

@ on it's own shows status, that can be useful to find out what is wrong if you ever see the drive light flashing.

In the example above, if you tried to save a file with a name that already exists, you could use the @ command to check what was going on.

@ will tell you what category of disaster has befallen you.

N.B. there is a way to force SAVE to overwrite the file, but that is buggy on most of the Commodore disk drives, so I would not suggest using it

@S - Scratch

The @S command can be used to scratch the file (in modern parlance, to delete it).

@S:name

Careful, there is no Y/N confirmation, it will just go ahead and delete the specified file or files, and tell you how many were deleted.

All gone now.

You can now save your file again.

The file has saved correctly this time.

@R - Rename

An alternative would have been to rename the old file.

@R:newname=oldname

That will, as it says on the tin, rename the oldname file to newname. Note the order, new=old.

You can then save your file as planned as there is now no file named HELLO.

And now both files are there.

@C - Copy

The file copy command has a similar syntax.

@C:newname=existingname.

Again, note the order of the names, new=old or alternatively think of it like assignment, destination=source.

And now there are two copies of that file

@UI-

The original IEC disk drive, the 1540, was designed to work with a VIC20. When the Commodore 64 came along, they found there were sometimes problems missing files due to the screen redraw, and so added an extra delay to slow the drive down, and produced the 1541.

(ironically, the 1540 had already been slowed down due to a bug in the 6522. The C64 used the new 6526 so this was no longer a problem, but they couldn't speed it up for that as it wouldn't be backwardly compatible with the VIC20, so the 1541 has doubly slowed down, no wonder SD2IEC is not the fastest in the world. Good thing we have a Turbo loader in the Penultimate Cartridge)

If you are using a VIC20 and want to get back to the faster version of the disk protocol, you can use the @UI- command to reduce the delay. This lasts until the drive is reset or a power cycle. You can also use @UI+ to increase the delay back to C64 safe levels.

That also works on an SD2IEC, when you send the @UI- command, it reduces a delay in the send byte function. You can use the @XW command to make this change permanent. (use @UI+ then @XW to revert this change).

I believe all the SD2IEC drives integrated into the Penultimate +3 DCR cartridges will have this mode already enabled since it is unlikely to be used with anything other than a VIC20. (although I am sure some user will find some way of stacking a C64 on top of their VIC20 and running two power supplies and standing on one leg, drinking a glass of water whilst playing a Beatles LP backwards.....)

Real Disk Drive Commands

If you are using a real 1541 or other IEC disk drive, there are a some extra commands you can use.

@I - Initialise

This re-reads the disk, handy if it gets confused after a disk change (looking at you, 1581).

@V - Validate

The @V command can be used to tidy up a disk, reclaim allocated blocks from unclosed files etc.

@N - Format

This command can be used to format a disk. There is no Y/N confirmation, so be careful.

@N:name,ID will format a disk with the name and ID supplied. (the ID is two characters, usually a number, used to help the drive differentiate between two disks both called "Dave")

You can also omit the ID and just use @N:name for a quick(er) format if the disk has already been formatted.

There is no status display during these operations, just the ticking of the head stepper motor, so you just need to wait for them to return.

>command

I have seen some of the other wedges use > instead of @. I originally had both performing the same task, sending a command to the drive, wait for it to do the job and then display the status when it's finished.

A few of those command may take a while to complete, things like disk format for example, so I have changed the operation of > to send the command and then return immediately. You can then get on with other things, and if you can later check the result using the @ command.

Whilst the disk is formatting, you can get on with writing your next program.

You can then save all the work you did in the minute or so of extra time you didn't have to spend waiting for the disk to format.

SD2IEC Commands

There are some commands that are useful on SD2IEC type devices

@CD - Change Directory

@CD:directory

This changes to a subdirectory.

@CD:image.d64

This mounts a disk image.

@CD←

This unmounts the disk image or moves back one folder

@MD - Make Directory

@MD:directory can be used to create a directory

@RD - Remove Directory

@RD:directory can be used to delete a directory - use with care

@EX - Extension Hiding

Normally an SD2IEC will show file extensions as part of the filename, e.g. HELLO.PRG.

That means if you try to load it as HELLO, it will fail - you need to specify the full name, HELLO.PRG

You can use @XE+ to enable extension hiding. This will now show that as just HELLO

You can use @XW to remember changes to XE and UI after reset, and @XE- to disable extension hiding again

More Stuff

I think that covers most of the things you can do with the wedge.

I will go into more details next time, there are various new games and utilities added, and of course the extra paged RAM.


Adverts

The Penultimate +3 DCR is available to order now, shipping this week.


Tindie

Your reward for reading all of that is notice that there is 15% of everything in my Tindie store throughout July.


Patreon

You can support me via Patreon, and get access to advance previews of development logs on new projects and behind the scenes updates. New releases like this will be notified to Patreon first, if you want to be sure to get the latest things. This also includes access to my Patreon only Discord server for even more regular updates.