flash information

First off, the version 1 DTV (NTSC version sold in USA in 2004-2005) does not have flash memory at all, hence this document is useless to you if that is what you have. The DTV2 and Hummer contain flash memory.

The version 2 DTV has 2 MB of Flash RAM and 2 MB of SDRAM. Normally on a regular C64 the system only recognized 64K of RAM. So any memory address was expressed as a 4-digit hexidecimal number such as $C000. However, the 6502 reads adresses backwards so in actual programming code it would be expressed as $00C0. Also you will see references in decimal. The adress of $C000 in decimal would be 49152. You will find that on the DTV we tend to only use hexidecimal for the fact that now we have 6 digits. Since the unit can address more RAM, we have to use an expression like $00C000. Now keep in mind that this is still an 8-bit system. So the CPU still can't see more than 64K at a time. It has a memory controller that allows one to map in and out certain pieces of RAM or ROM. So it can see all of the memory, just not at once.

When you are flashing the memory, keep in mind that anything from $000000 to $00FFFF is memory you don't want to be messing with at all unless you are intentionally trying to reflash the kernal. If you were to erase this area or corrupt it somehow, your system would no longer boot up, so you would not be able to correct what you did. Hence, it would make your DTV into a paperweight. Anything From $010000 and higher is safe to mess with. When I say safe, I mean that it won't destroy your DTV. However, it will change or destroy files and programs stored in your flash memory.

Now lets talk about the filesystem. The DTV's filesystem was designed as a read-only system, so it is very simple. But that makes it very complicated to add things to it. Also there are two different directories. One is the "real" directory and the other is the "fake" directory. Normally on a real C64 and disk drive if you type LOAD "$",8 then this tells the disk drive that you want to see the directory. The disk drive is quite a sophisticated computer itself so it does a lot of this in its own memory. What it does is create a BASIC program with the directory listing as the line numbers and returns that to the C64 for listing. The DTV doesn't do this. Actually, this does happen if you are reading the directory from a real attached disk drive. It does not happen on the internal flash. This is where the fake directory comes in. There is a file on the DTV which is actually called "$" and it was pre-made by the programmers to reflect the files on the DTV. So when you load it, you are just seeing what was placed there. It is not a real indication of what files are really on your flash memory. You can download DIR.DTV, it is a program which will read and display the real directory.

This is the layout of the directory structure. The directory starts at flash memory location $010000. Every directory entry is 32-bytes long. The first 24 bytes is the filename itslelf. If the filename is less than 24 bytes, any remaining bytes should be zeros. The next 3 bytes is the flash location. That tells the load routine where in the flash memory to find this file. The next three bytes are the load address. That tells the load routine where in the DTV's RAM this file should be copied to. The last 2 bytes are not used and can be left blank. One thing to keep in mind is that the C64 (and the DTV) are Big-Endian systems. That means the most significant byte (the big one) comes at the end. Hence Big-Endian. So bytes are ordered in memory opposite than you might think. So if you wanted to load from flash address $02BE4C then in the directory structure this would be backwards: 4CBE02. The same is true with the load address. Also, when the directory routine runs across a filename that starts with zero, it assumes that is the end of the directory.

Now the files themselves need to be encoded! It is a type of compression, and it is beyond the scope of this document. Fortunatly, there is a Windows application you can use to encode the files. You can download it here: dtvencoder.exe

DIREDIT is a program I wrote which will help you design a custom flash directory. It will read the current directory from flash or from a file on disk. It will also save the edited directory as a file. Then you can flash that file into the FlashROM using the DTV-Flash utility. More information on this program in the software section If you want to have a look at the Hummer's real directory, look here.

Back to main DTV Hacking Page