Friday, February 10, 2017

My Commodore 64 Saga Part II - Disk Drives and Disk Images

In Part I of this series, I covered some of the basic functionality of the Commodore 64 and my trials and tribulations in getting mine to work properly.  In Part 2 I will talk disk drives and disk images.

Before I can talk about the Ultimate-1541, I need to discuss the Commodore 1541 Disk Drive and how the C64 deals with floppy disks, the other major storage medium for NTSC C64 users.  The Commodore 1541 Disk Drive is an external 5.25" floppy disk drive which connects to the C64 via the 6-pin serial port.  The 1541 had its own power supply and its own 6502 CPU, 16KB of ROM and 2KB of RAM, it was essentially a computer of its own.  The disks used were standard double density disks, but the drive was a single sided drive like the drives for the contemporary Apple and Atari home computers.  The IBM PC used single sided drives for the first year of its existence.  Like the Atari drives, you turn on your drive first, then the computer.

The disks were encoded with Commodore's custom GCR encoding, similar to Apple's GCR but quite incompatible MFM encoding used by the IBM PC.  In the 1541 each side of the disk had to be formatted independently.  C64 disks had 35 tracks, just like Apple II disks, and used a 256-byte sector size, but there the similarities end.  Apple and IBM formatted their disks so that each track held an equal amount of data, even though the there is a lot more surface area on the outer tracks of a disk than there is on the inner tracks.  Commodore decided to write more sectors ("blocks') to the outer tracks compared to the inner tracks.  So for tracks 1-17, each track held 20 blocks, tracks 18-24 had 19, 25-30 had 17 and 31-35 had 16.  As you can guess, track 1 is the track by the outer edge of the disk and track 35 is by the inner hole of the disk.  By contrast, Apple used 16 sectors for all 35 tracks. This is a form of variable density encoding which would become standard with hard drives by the end of the decade, which was very forward thinking of Commodore.,

In a final touch of efficiency, the directory and disk structure is stored on track 18, right in the center of tie disk.  This meant that in order to access any particular file, the disk drive head need only transverse half the radius of the disk.  MS-DOS stored the Master Boot Record, FAT copies and root directory entries starting with track 1. In the 1541, Commodore called Track 18 the directory, which can be a little confusing for MS-DOS users.

In total, a Commodore-formatted disk could hold 683 blocks or 174,848 bytes.  However, the file structure takes up some space, so you have 664 blocks or from 168,656-167,132 bytes available for user storage.  Each disk can store up to 144 separate files.

Like the Apple, the 1541's DOS gives different designations to different files.  The most common type is the Program file, or PRG.  There are also User (USR), Deleted (DEL), Sequential (SEQ) and Relative (REL) files.  PRG files are the only kind of file that can be LOADed, so they are the most important.

The 1541 can share the serial bus with other devices.  Physically, these devices are daisy chained together similar to the Atari 8-bit computers.  Typically the serial bus was shared with printers.  The C64's internal ROM addressed devices logically by number.  Device numbers 0-3 were reserved for specific devices, the keyboard, the datasette, an RS-232 interface and the text screen.  Device numbers 4-7 were reserved for printers and plotters.  Device numbers 8-30 were intended for disk drives.  Printers and disk drives used a customized serial version of the IEEE-488 interface.  This allowed the cables to be thin 6-pin cables.

The 1541 uses a version of CBM-DOS, namely 2.6, contained on its internal ROM chip.   In order to load a non-cartridge program on the C64, you have to LOAD the program and sometimes RUN the program.  If you type LOAD at the BASIC prompt, BASIC will prompt you to "PRESS PLAY ON TAPE."  In other words, the default device for the LOAD program is the datasette.  In order to LOAD a program off a floppy disk, you must tell the LOAD command what file you are trying to load and which device you are trying to load it from.  Unlike virtually every other home computer, the C64 did not autoboot its disks.  Here we get to the famous command :


This command consists of four parts.  The first is self-explanatory, LOAD is the command.  The second part indicates the filename of the program to be loaded. "*" is shorthand for "the first program on the disk"  The third part of the command, ,8, gives the BASIC device number for the first disk drive.  The final part of the command, ,1, tells BASIC that the program will load itself in the memory location contained within the program.

The command was about as easy as it gets for CBM-DOS, and eventually almost everyone used it as a convention.  Unlike MS-DOS or Apple DOS 3.3, Commodore DOS used some rather cryptic commands to perform basic file operations.  Apple DOS 3.x, added commands like CATALOG, DELETE, RENAME to the BASIC prompt.  CBM-DOS is not nearly so refined. For example, to list the contents of a disk, at the MS-DOS command prompt, you would simply type DIR.  At a BASIC prompt having loaded Apple DOS 3.3, you typed CATALOG.  In Commodore DOS, you typed LOAD"$",8.  Not nearly as easy to remember as IBM and Apple's mnemonics, but other commands made this one look simple.  Then you had to type LIST to see the directory contents.  When you get the LIST, it will start with the Disk Name (Label) then list every file with how many blocks it takes to store it, the file name and the file type, similar to an Apple II directory listing.

Some games do not load themselves with the de-facto LOADing command.   If a program will not load with the standard command, you may have to start hunting down for the C64-specific version of the program's manual or reference guide.  Here are some good links :

As an example of a non-standard loader, if you want to load Ultima 2, (Sierra Online version), you must type LOAD"ULT",8,1.  Ultima 3 and 4 are LOAD"*",8 then type in RUN.  Note the lack of the ,1 for Ultima 3 and 4.  Other games, like those from EA, tell you to use EA in the quotation marks, but as the EA file seems to be the only file that appears on the disk, then the * works just as well.  But sometimes you may need to use the LOAD/LIST command to figure out how to load a game.

Most C64 games were copy protected.  Copy protection on the C64 is a subject which could lend itself to a series of articles, but it is virtually ever-present.  There were a few games toward the end of the C64's lifespan which used document based copy protection, but most games used disk based protection.  C64 disk copy protection schemes had a whole computer of their own in the 1541 to play with the disk and obfuscate its code.  Fortunately for us today, the C64 was extremely popular, so the hacking and pirating community could crack just about any game.  Disk images of games would be distributed by BBS services.  Later those images found their way onto the Internet.

The standard dumping format for C64 disks uses the .D64 extension.  There is nothing special about this type of dump, it is just a standard sector dump like a DOS .IMA/.IMG file or an Apple II .DSK file.  The file size should be 174,848 bytes.  You will find that most games with .D64 images are cracks.  Many of the games come with Cracker Intros, short audio/visual displays that appear before the game begins proper.  These Intros serve to identify the hacker/hacking group involved and to give a shout out, or greets, to other groups.  These Intros may have animation and their own music.  Many games also come with a trainer, which is a cheat menu.

Despite their widespread availability, cracks can be annoying.  Sometimes the images are bad, but other times the crack is broken or does not completely crack the game.  Some games run their protection scheme at more than one point during the game.  So if a cracker missed something, then you could get halfway into the game before it fails or ratchets up the difficulty level to near impossible.  Finally, cracks pull away from the pure experience of running a game out of the box.

.D64 cannot capture enough information for the more sophisticated methods of copy protection to work.  The ideal dumping format for the C64 is the .G64 format.  The .G64 format is not a straight disk dump, it stores the low level formatting information like sync and gap bytes, that allow copy protection schemes to work properly.  Today most of these dumps come from a Kyroflux device, which was made by Commodore enthusiasts.  The C64 Preservation Project,, has essentially preserved virtually every major US game in its pristine state.

Finding proper .G64 images can be more of a challenge.  In the past few years there have been nib images made available for C64 software.  Unlike Apple II nib images, C64 nib images cannot be run directly by emulators or written back to disks via a Kyroflux.  They must be converted to .G64 format, and the conversion tools do not always make a working image.  The WinVICE emulator has superb disk emulation, so a good rule of thumb is that if the image doesn't work with WinVICE, don't expect it to work with real hardware.

Commodore released other disk drives which were compatible with the C64.  The 1541-C and 1541-II were bugfixed and more reliable versions of the 1541.  The 1570 was a faster replacement intended for the C128 which supported faster transfer modes and MFM-formatted floppies.  The 1571 was a double-sided verison of the 1570 with improved 1541 compatibility.  Even the VIC-20's 1540 disk drive could be made compatible with a C64 with a firmware replacement.  The 3.5" 1581 drive is also C64 compatible but few if any games were released on the 3.5" format.

In this overview of C64 disks, one cannot avoid discussing fastloaders.  CBM-DOS, as found on the 1541, could transfer about 300 bytes per second over the C64's serial bus.  This gave the C64 the unwelcome reputation as possessing the slowest disk drive transfer speeds of any major home computer.  Ultima 3's Quick Reference Card informed the user that the game would take four minutes to load, and that was not atypical for the early years.

Within a few years of the C64's release, fast loaders were present.  A game could use its own loading routines as a replacement for the slow DOS routines to speed up transfers.  Cartridges like the Epyx Fast Loader, the Action Replay or the Final Cartridge III were released that could increase loading speeds by a factor of five to six and a half.  Finally, the user could install a CBM-DOS replacement like JiffyDOS in their 1541 and their C64 for speed transfers up to fifteen times faster than the stock ROMs.  JiffyDOS does require removing two ROM chips and replacing them with EPROMs, so it is not a solution for everyone.

The basic Fast Loader was the Epyx cartridge.  This simple cartridge does not have any fancy switches on it, but it sold amazingly well.  They are easy to find these days.  The Epyx is not as fast as some of the later cartridges, but it tends to work very well with real disks.  It is very unobtrusive, all you will see differently when you run the cartridge is the word FASTLOAD underneath the BASIC READY line.  Moreover, the cartridge can make life much easier when it comes to DOS commands.  By pressing C= and Run/Stop, you will have a shorthand way of executing LOAD"*",8,1.  You can list the contents of a disk by just pressing $.  You can use the £ key to bring up a menu of disk commands.  You can use this menu to copy files, delete files, format disks or duplicate non-copy protected disks.   You can also disable the cartridge if a program is not working with it.  It also includes an assembly monitor very similar to that in the Apple II.  Other Fast Loader cartridges have similar functionality, so when it comes to working with disks, these cartridges are really essential.

In Part 3 I will finally get to the Ultimate 1541-II Flash Cart!

Unusual Film Formats on Blu-ray

Blu-ray disc may not have been as successful as DVDs, but its capabilities have allowed it to embrace and do some justice to unusual film formats.  Let's discuss some of them.  For screenshots, I will refer the reader to the article with the appropriate links (when available), which has excellent, multiple full-HD screenshots for most of the films I will be discussing here.  All Blu-ray covers are taken from or with one exception noted below.

My Commodore 64 Saga Part I : Initial Observations, Restoration and Repair Attempts

A couple of years ago, I had traded my Atari 800 for a Commodore 64.  The C64 was a breadbin model and while it had a power supply, it did not come with a disk drive or any software other than a single cartridge.  When I took it home, I noticed that the keyboard was extremely stiff with some of the keys on the left side barely registering to keypresses.

Friday, February 3, 2017

EverDrive GBA X5 - The Ultimate GBA Flashcart

In July of 2016, Krikzz finally released his long anticipated EverDrive flash cart for the Game Boy Advance.  He called it the EverDrive GBA X5 and sells it for $99.99 on his site and through his authorized vendors.  I bought mine on his annual Black Friday sale for 20% off, so it ended up costing me $87.00, shipping to the USA (from Ukraine) included.

The "X5" in the name represents a new branding of his product lines.  His new products will be released with an X3, X5 and X7 designation.  Each designation indicates the feature support of the flash cart relative to a desired feature set for flash carts.  The designation is not tied to the products released for any particular console.  For example, the Mega EverDrive X7 has save state support whereas the X5 and X3 do not.  Furthermore, the MegaEverDrive X7 and X5 support saving games without resetting the console whereas the X3 requires pressing reset to save or you lose your save games.  Krikzz has not officially used the X designation for his products except those released for the GBA and Sega Genesis.  There is no such thing as a GBA X7 or X3 and Krikzz has no current plans to make any other GBA flash carts.

Sunday, January 29, 2017

Metroid Classic NES Series vs. Metroid in Metroid: Zero Mission - Not the Same

When Metroid: Zero Mission for the Game Boy Advance was released on February 9, 2004, it was no secret that the original Metroid was included as an unlockable extra.  Several months later on October 26, 2004 Metroid was released along with seven other NES games for the GBA in the Classic NES Series.  People complained that buying the standalone version of Metroid was of little, if any value given that Zero Mission also contained the game and was not significantly more expensive.  However, that turns out not to be the case.

Wednesday, January 25, 2017

A Challenger for the Sound Card Crown : The Pro Audio Spectrum 16

In 1991, Creative Labs was prospering quite well with its Sound Blaster card.  Its enhanced features and reasonable price had knocked the Adlib off the hill.  But a company called Mediavision released the Pro Audio Spectrum card in May of that year.  The Pro Audio Spectrum was not only Adlib compatible but had a second Adlib FM sound chip for stereo music.  It also had a joystick port and MIDI interface, but it supported higher digital playback and recording rates (8-bit 44.1KHz in stereo) compared to the Sound Blaster.  It also required fewer jumpers to select hardware resources.  It was shielded to block electrical noise and hard drive motors that can interfere with the audio output.  It listened to the bus to emulate a PC Speaker.  Creative caught up with the Sound Blaster Pro in November of 1991, essentially duplicating most of the new features of the PAS but retaining the increasingly-important compatibility with the original Sound Blaster.  The Sound Blaster Pro was not shielded and was totally via jumpers.

The PAS did not have any Sound Blaster compatibility, it was only compatible with an Adlib card.  While it sold decently, it was not enough to be a Sound Blaster-killer.  In fact, Mediavision also released a card called the Thunder Board which was Sound Blaster 1.5/DSP v2.00 compatible and could be installed alongside a PAS to support digital Sound Blaster audio.

Today it is not easy to find and usually very expensive when one shows up on the secondary market.  The Sound Blaster Pro (1.0) can essentially do almost everything a PAS can.  While the SB Pro 1.0 is not cheap, it is more common and commands a lower price than the original PAS.  But it was Mediavision's next big card that proved to be Creative Labs' most significant challenge in the sound card market space.

Sunday, January 15, 2017

Classic Systems - The True Framerate

Classic color NTSC uses a frame rate of 59.94  However, classic video game consoles and home computers never adhered strictly to the NTSC standard.  Here are the exact frame rates as I have been able to find :

NES & SNES : 60.0988
GB, GBC & GBA : 59.7275
SGB : 61.1679
SGB2 : 60.0988

Apple II, Atari 2600, Colecovision, IBM CGA, PCjr., Tandy 1000, EGA @ 200, MSX, SMS & Genesis : 59.9275
Commodore 64 = 59.862

Hercules Graphics : 50.050048
IBM VGA : 70.086303
IBM VGA 640x480 : 59.940475

Gamecube & Wii : 60.00222p/59.88814i

Sunday, January 8, 2017

YouTube Playthrough and Demonstration Series

This Christmas, I got a capture device.  The device in question is an I-O Data GV-USB2.  It can accept composite or s-video input and has stereo sound inputs.  The manual is in Japanese but the drivers are in English.

One of the reasons why I acquired this device is because I found a disturbing lack of video game footage captured from real hardware on YouTube.  While there are plenty of playthroughs or longplays of various games, many of these are from emulators.  Footage directly captured from consoles tends to be older and is reduced to 30 frames per second.  The heyday of 480i/30 frames per second was the Playstation 2 era.  Before the Playstation 2 and the Dreamcast, it was not often used and almost never used by the SNES or Genesis.  They used 240p and ran at 60fps.  So did many vintage computers from Apple, TI, Commodore and Atari.  Even 320x200 256 color VGA graphics is just double-scanned 240p.

As many people know, 240p is a hack of 480i.  TV tubes were designed to display 480 interlaced lines 60 times per second (in NTSC countries).  The odd lines of an image would be displayed, followed by the even lines of an image and your eyes would see fluid motion.  30 times per second the TV would be drawing odd lines and 30 times per second the TV would be drawing even lines. 240p works by telling the TV to odd lines always, 60 times per second. Because the even lines are never being drawn, there is a space between the lines which can be noticed at times as scanlines.  The console or computer is sending a complete frame for the TV to draw on the odd lines.