Tips for using sd2iec

It’s been already a while since I got the uIEC – one of the available hardware running the sd2iec firmware. I did some experimenting with it on how to make the best use of it if the nicely accompanying JiffyDOS is not present. I posted my experiences at Lemon64 forums, but I thought it would be nice to share them here as well. Still, you might want to read that instead for shorter, less detailed description.

Note that I’m describing sd2iec-firmware being used with uIEC/SD-hardware using Commodore 64. Many different hardware combinations are possible.

The principle

With sd2iec loading files from the SD card’s root folder is like loading files from a floppy disk. The very basic loading procedure is exactly the same – except that the default device number is not 8 but 10. So LOAD”$”,10 or LOAD”GAME”,10,1 works just like one would expect.

Things get more complicated if you want anything more. Something like to enter a directory on the SD card or to mount a .d64 disk image. A real Commodore disk drive wasn’t designed for such things so you don’t even have the commands for something like that. Since uIEC is connected only to the serial port of C64 it can be interfaced only using the IEC bus. Enter the command channel! Everything like directory navigation, disk image mounting and device configuration is done by sending drive commands over the command channel.

The Drive Commands and Command Channel

The standard drive command syntax is:

OPEN 1,[device id],15,”[command]”:CLOSE 1

where [device id] is the device number of uIEC and [command] is the command for sd2iec. The sd2iec user manual and a list of commands can be found here, on the sd2iec project page.

Using the standard syntax is very awkward – you don’t want that. Instead, you’ll be happy with DOS Wedge. With DOS Wedge you are able to use the much nicer syntax that is simply:

@[command]

DOS Wedge

DOS Wedge is a program that originally came with 1541 demo disk. I copied the DOS Wedge files “C-64 WEDGE” and “DOS 5.1″ to the root of the SD card from the demo disk. If you use PC for copying the files from e.g. a disk image you might want to remove the .prg file extension from the files. Otherwise sd2iec will include the file extension as part of the file name on the C64.

When DOS Wedge is on the SD card you are able to load it from there. Note that the DOS Wedge is set to work with device number 8 by default. Without modification it will fail operating with any other device number. To resolve this, the C-64 WEDGE can be modified to match the device number of uIEC. The file “C-64 WEDGE” is just a simple BASIC program that loads the actual program that is the file called ”DOS 5.1″. It’s easy to do the needed modification if you have even the slightest understanding of BASIC. On the C-64 WEDGE program listing at the end of line 10 it reads LOAD”DOS 5.1″,8,1. Edit this loading command to match your uIEC device number. Then save your modified program.

Editing C-64 WEDGE BASIC program

If you like things made ready for you, look at the end of this post for bonus download with already modified files.

Many utility and fastload cartridges also has the DOS Wedge command set or similar built-in. For example Action Replay is very useful even though its fastloader is not supported by sd2iec. Loading does work with Action Replay fastloader activated, but the loading reverts to kernal routine speeds. You still have all the Action Replay’s single-stroke directory listing and program loading and execution shortcuts and you can send drive commands using the @[command] method.

Speeding up loading times

DOS Wedge makes the using of sd2iec device much more convenient, but it won’t help the problem of slow loading. A sd2iec device is practically as slow as a real disk drive because of the very, very slow standard data transfer protocol. If JiffyDOS were installed on the C64, the loading would be much faster. But when it’s not, a software implementation of the JiffyDOS transfer protocol comes into aid: SJLOAD.

Loading with SJLOAD from sd2iec device is very fast! Check the SJLOAD C64 DTV Hacking Wiki page for usage instructions. Especially note the command:

LOAD”!*PROGRAM”,[device id],1

As it says on the Wiki page, this loading command autostarts SJLOAD and then fast-loads the given program! A very nice shortcut. The SJLOAD program file “!” has to be in same folder as the program to load this way though. You can also first load the SJLOAD alone and then start browsing the SD card. When SJLOAD is activated the command channel syntax is a little different. It’s VERIFY”[command]“. So changing into a directory would be VERIFY”CD:GAMES”. Also SJLOAD assumes the device number to be 8. This can be worked around in most cases by adding the right device number at the end of the command. Examples using the device number 10:

LOAD”!”,10,1 //load and autostart SJLOAD
VERIFY”CD:GAMES”,10 //change into directory GAMES
VERIFY”$”,10 //display directory
LOAD”PROGRAM”,10 //load file called PROGRAM

According to sd2iec documentation there are various other supported software fastloaders. All non-supported fastloaders will fail.

File browsers

The easiest way to browse the SD card and run programs is to use CBM FileBrowser or some similar program. CBM FileBrowser or other available file browsers make it really convenient to browse the SD card contents and launch the programs. But the problem of slow loading remains.

Use SJLOAD with DOS Wedge or CBM FileBrowser

Things get really swift if you combine the usability of DOS wedge or CBM FileBrowser with the loading speed of SJLOAD. Here’s how you do it for DOS Wedge:

  1. Load and run DOS Wedge
  2. Load SJLOAD (can be simply done by entering “%!”)

Now you can use DOS Wedge as usual, but the only drawback is that you have to use the traditional loading command LOAD”PROGRAM”,[device id],1. The nearly instant loading speed should make it up though.

And for CBM FileBrowser & SJLOAD combination, enter the following (with appropriate device id):

  1. LOAD”!*FB64″,10,1
  2. RUN

Now you can browse the SD card with CBM FileBrowser as usual, but loading happens nearly instantly. If you only want to launch games etc. from your memory card, this method will surely not fall much behind from JiffyDOS equipped C64.

Other utilities

For copying between sd card and a real commodore disk drive or transferring disk images I’d suggest trying CBM-Command or DraCopy.

Bonus download

Here is a pack of files that you can directly put into your sd2iec device’s SD card and you’re off with the above mentioned things. These files are SJLOAD (!), CBM FileBrowser C64 (fb64) and DOS Wedge loader for different device numbers and renamed (WEDGEn). The same files are also included in .d64 disk image. For DOS Wedge you will need the file DOS 5.1 from 1541 Demo Disk. I did not include it because it is copyrighted piece of software.

Bonus pack (zip, 6 kb)

I’m glad if you will find these tips useful for your C64 retro computing pleasure!

Advertisement

5 Responses to Tips for using sd2iec

  1. Chris says:

    Great article, thanks! How easy is it to switch between disk images once a game is up and running though? I assume you can’t get into the Filebrowser at that point.

  2. ilesj says:

    File browser can not be accessed, but two possibilities comes to my mind:

    At least with uIEC and its daughter card it’s very easy with some preparations. One of the buttons in the daughter card can be used for disk change. This requires a swap list file on the folder that is currently in use. Search for chapter “Changing Disk Images” in sd2iec readme file (link in article).

    The other way I can think of is with the help of a freezer cartridge. Freeze the game, and if there is a way to enter drive commands in the freezer menu, you should be able to change disk images or what ever :)

  3. xdr says:

    I found a couple of problems with using these on sd2iec, namely the sjload wont start, it just resets c64. Maybe this one is for uIEC only or device #10?
    With recent updates there is two buttons you can use to switch disks, next and previous.

  4. ilesj says:

    It’s hard to tell what causes the SJLOAD to reset your C64, but it should work with both SD2IEC and uIEC as they run the same firmware. It’s definetely not uIEC only, as SJLOAD can be used also with JiffyDOS equipped floppy drive.

    SJLOAD itself can be of course loaded from any device number and it works with any device number in most cases.

    Everything else works OK and you can load other files with your SD2IEC?

  5. [...] anything like me, you’ll probably insert it upside down. Like I did. But bloggers like Ilesj are helpful, and I wanted to do something similar. Please comment if you find any mistakes or have [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.