The IDE64 Project
IDE64
INTERFACE CARTRIDGE
user's guide
2004.Aug.14 preview
IDE64
The ATA/ATAPI controller card for Commodore 64 / 128 computers
supporting HardDisk / CDROM / ZiP drive / LS-120 (A-Drive) / CompactFlash and more

Foreword

This will be the manual for the IDE64 interface cartridge V2.1, V3.1 and V3.4 with the upcoming IDEDOS 0.9x. Incomplete but planned parts are marked this way, inserted texts since last version are marked this way, while deleted texts are marked this way.

Contents



1 About the IDE64 interface cartridge

The IDE64 cartridge was created to provide the fastest I/O and biggest storage capacity available for the C64/C128 computers, at cheap price. It's possible to connect and use ATA(PI) devices to a C64/C128 like harddisks, CDROMs, CompactFlash cards, ZiP drives and LS-120 (A-Drive) just like ordinary disk drives. The IDE64 cartridge contains a 64KiB PEROM (flash EPROM containing IDEDOS, Machine Code Monitor, File Manager and Setup), a 28KiB RAM (used for internal buffers), a realtime clock chip (powered by a battery), two LEDs (to indicate the presence of cartridge and device activity), a Short-BUS for peripherals (like DUART Card, ETH64) and an ispLSI chip.

The IDE64 cartridge is compatible with a wide variety of hardware including (but not limited to):

There are of course incompatible/unsupported hardwares (most notably cracking/fastload cartridges, RamLink, etc.), for more information read the Compatibility FAQ at the end of the guide.

The uniq architecture of the cartridge allows updating of firmware, so it's possible to be up to date with the latest versions of IDEDOS.

IDEDOS can handle disks/partitions up to 137GB (128GiB). A disk can be divided into a maximal of 16 partitions. Files can be organized into a tree organized directory structure where each directory can contain 1023 files. Maximal file size is 4GiB for regular files and 16MiB for relative files. Filenames can be 16 characters long plus a 3 character filetype. Automatic file timestamping is supported.

IDEDOS 0.9x is free software, the source and the tools required to build the firmware are public and available for Linux and Win32. The code is licensed under the GPL-2:


IDEDOS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

IDEDOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

You are wellcome to review the code and send suggestions/improvements/bugfixes if you want.



IDE64 cartridge

2 Set up and begin using the IDE64 cartridge

Make sure that the computer is powered off. The cartridge must be plugged into the expansion so that the chips are on top as seen on the picture. The ATA(PI) devices are connected with a 40 wire IDE-cable to the port on the end of the cartridge. Make sure that the red line on the cable is at pin 1 on both ends. (pin 1 is usually near the reset button on the cartridge, and on power cord side on the devices) 2 devices can be connected on the cable, one is called master, the other slave. It's important that there's only one master and one slave on a cable, so check the jumper setting of your devices.

The external devices need external power too, so connect them to a pc power supply or something similar. AT-style power supplys will work without problems (some require a minimal load to start, so it may not work alone without any devices). ATX-style supplys require that the green wire is connected to a black one, but do this at your own risk without connecting any devices to the supply to minimalize possible damage. (if everything goes well, the cooler must spin up) First test your devices with the supply without connecting to the cartridge to see if everything is ok.

Compact Flash card plugged into the V3.4 version of the cartridge does not require any external power supply. If you want to use an ATA(PI) device and CompactFlash card at the same time, then configure the device as slave, because the CF card is always master. If using SCPU at 20MHz with a slow CF card you may experience 'drive not ready' errors while reading/writing large amount of data (>1000 blocks) in a short time. Either switch to 1MHz or reduce the linear max settings in the CMOS Setup utility.

IDE64 cartridge v3.4

When using a ZiP drive it's important that it's jumpered as Master A or Slave A, otherwise it won't work. (old drives without A marking emulate a harddisk and do not need any special treatment) Standalone ZiP drive must be configured as Slave A. Note that not every ZiP-drive, cable and cartridge combinations work. It may be necessery to put the drive at the middle of the cable so that the remaining unconnected part of the cable is at least ca. 15cm long.

LS-120 (A-Drive) works fine with regular 720KB/1.2MB/1.44MB floppy disks or with the 120MiB superdisk. Disks of CBM1581/FD2000/FD4000 are not supported. If disk format is not readable by IDEDOS then use CFSfdisk to create a new filesystem. If using 1.2MB/1.44MB disk you may experience silent data corruption if multisector write is 12 or more! (see settings in CMOS Setup utility)

Peripherals (duart cartridge, ETH64, etc.) are connected to the other port (called Short Bus) of the cartridge with a 34 wire cable similar to the floppy cable in pcs, but without wire swaping. Peripherals do not require any external power.

There's a battery holder on the back of the cartridge. It's strongly recommended to put a battery into it (3 Volt) otherwise the setup settings can't be permanently stored and the file timestamping won't work. If using accu or super cap instead of battery, then enable recharging in the CMOS Setup utility.

When everything is ready, you may turn on your equipment. It's recommended to first turn on the power supply, then the computer, however if you have devices that do not spin-up until the computer is turned on and your AT-supply does not start without load (giving an annoying noise) you must do this the other way around. If your devices are not detected on poweron, try giving HDINIT on the basic prompt. If still nothing, turn off your computer and powersupply, then check the cables and jumper settings. If you suspect that there's some software bug preventing the detection of the device (eg. it works in some other equipment) than contact us on the mailinglist.

If everything is ok the boot screen should come up first (black screen with light-blue characters) with the information on the version of IDEDOS and the connected devices. Then the standard C64 reset screen should appear in less the 30 seconds, depending on the connected devices. Holding down CONTROL will hold the bootup screen, so it can be read. The boot screen only appears on poweron, so if you want to autodetect your devices later to see everything is ok use HDINIT. If there's no boot screen just a standard C64 reset screen without the usual "IDE-DOS xxxxx EXPANDED" you may use the wrong version of IDEDOS. (eg. SuperCPU version on C64, C64 version on SuperCPU, config register version on old cartridge) If "30719 BASIC BYTES FREE" appears that means there's no valid IDEDOS burned into the perom of the cartridge. If "CORRUPT PEROM!" message appears instead of regular boot, than consider rewriting your perom using the perom programmer utility.

To use the builtin selftest of IDEDOS hold down LEFTSHIFT while turning on the computer (or simply use SHIFTLOCK).



3 The CMOS Setup utility

Setup

The IDE64 cartridge has a battery backed up clock with some memory (DS1302) used to store the configuration settings and current time. Of course it works without a battery too using the default settings and no clock. If you do not like the defaults, you can change them here.

The CMOS Setup utility is started by pressing <- + RESTORE while in interactive mode. (like STOP + RESTORE) Moving is done with cursor keys, RETURN selects/changes item, + and - also changes item. C= and STOP exits submenu, while C= saves setting and STOP discards them in main menu.

Setup does not touch memory range $0800-$FFFF so your work won't lost when need to change some settings.


3.1 Standard setup

Standard setup

General settings.

3.1.1 Date, Time

Here's possible to set the built in clock. This has affect on the DATE command, the file timestamping and on TI$ (see below). The calendar is built in and works in range 1980-2079. (Y2K compatible) The clock ticks while the computer is turned off. (but requires battery)

3.1.2 Start boot file

The file called "1//:BOOT,PRG" can be autostarted from the boot drive at powerup or always after reset. The file must be executeable with RUN. Hold C= if you want to skip autoboot, or hold STOP to skip starting of program.

3.1.3 Boot device

The default drivenumber (at $BA) after reset can be selected here. (usefull for the dos wedge, monitor and autobooting)

3.1.4 Disk fastloader

Use fastloader for the 1541, 1570, 1571 and 1581 floppy drives. (and also fast read/write in manager) If you are using unsupported serial drives then disable this, or ?LOAD ERROR will happen. If drive is capable of JiffyDOS fast protocol then the fastloader is automatically not used.

3.1.5 Set basic clock

Sets TI$ to the time in the built in clock.

3.1.6 Keyboard repeat

Sets keyboard repeat after reset. (at $028A)

3.1.7 Lowercase chars

Upper/lowercase chars after reset or STOP + RESTORE.

3.1.8 Use dos wedge

You may disable it, if you have JiffyDos installed. For more see below!

3.1.9 C128 keyboard

If cartridge has cartconfig register, support is compiled in, and computer is a C128, it makes use of extra keys on keyboard.

Table 1 – C128 extra keys
KeyFunction
ESCCHR$(27)
TABCHR$(9)
ALT-nothing-
HELPEnter monitor
LINE FEEDCHR$(10)
NO SCROLL-nothing-
CURSOR KEYS and NUM PADTheir usual meaning
3.1.10 Direct write

Enables/disables the use of "B=W". Cleared on reset. You may have to enable it when creating filesystem.

3.1.11 Accu charging

Selects accu charging current. Leave it on "Battery" if not using accu or super cap. Charging a battery is useless, and some low quality products may even leak if charged.

3.1.12 CMD emulation

If enabled the returned rom string for memory-read is different, and "/" is allowed in filenames which makes a difference in path handling. Also the partition listing is changed too.


3.2 Color setup

The default colors of boot screen, manager and monitor can be changed here.

3.3 Device numbers

Drive number setup

Device number mapping to drives. -- means device is disabled.

3.3.1 LCD display

Device number for LCD display connected to short bus.

3.3.2 Serial device x

Device number mapping for serial devices. Selecting 9 for serial device 8, and 8 for serial device 9 will effectively swap them.

3.3.3 IDE x

Usefull when programs think device number 8 is the only one.

3.3.4 PC-LINK

Virtual drive. Needs serial/parallel cable and a server program on the PC.


3.4 Advanced setup

Advanced setup

Master/Slave ATA(PI) device configuration.

3.4.1 Power management

Drive spindown time from disabled to 2 hours in 15 steps. Default means do not touch drive's power management settings. (almost all devices support power management) KILL will also spin down the drive if it's enabled.

3.4.2 Retry on error

Tells the device to retry on error.

3.4.3 Write cache

Will speed up writes if supported by device.

3.4.4 Read look-ahead

Will speed up short sequential reads if supported by device. If you set "Linear read max" to it's maximum, this does not affect performance significantly, and it even slows down directory reads. (the look-ahead reads for random positioned directory sectors will flood the drive's cache with unneeded data, and take more time then the single sector reads)

3.4.5 Slow down CDROM

Selects 255 KB/s data transfer rate on CDROMs supporting this. (deactivates the built in jet simulator on 32x or faster CDROMs if enabled) Has no effect on transfer rate, because the cartridge transfers data much slower.

3.4.6 Linear read max

Maximal sequential read allowed by the device. (setting it lower than 128 will degrade the performance of CFS filesystem greatly!) You should decrease it from 128 if you get ?LOAD ERROR when loading a big program. (this is very unlikely)

3.4.7 Linear write max

Same as above but for write operations.

If using LS-120 with 1.2MB/1.44MB disk then set this less then 12 (eg. 11) or data corruption may happen! (at least it happens on a rev.05 drive with 1.44MB disks, but fortunately 720KB and 120MiB disks are not affected. 1.2MB disk may work with a setting of 12)

3.5 Restore defaults

Does restore the default settings.

3.6 Save & exit

Save changes and exit cmos setup. (same as pressing C=)

3.7 Discard & exit

Forget changes and exit setup. (same as pressing STOP)



4 Preparing a blank disk

To use a new disk with IDE64 you must first create the filesystem on it. IDEDOS has it's own filesystem called CFS. It allows to use disks up to 128 GiB, files up to 4GiB with holes and fast seeking, relative files up to 16MiB, 16 partitions, unlimited directorys and files (only limited by the capacity of disk), customizable filetypes, and new file permissions.

To create the filesystem on a harddrive or ZiP drive use the provided format utility. It allow's to create partitions, change partition flags and create filesystems on them. First set the "Direct write" option in the setup utility to enabled, then start the format utility. Follow the instructions. Don't forget that formatting a partition will erase all data on it permanently!

CDROM device do not need any special treatment, just use ISO9660/Joilet format CDs to be able to read them.

Floppy disks may require physical format before the creation of the filesystem. Use the format ("N") command described in the Command channel chapter.

4.1 The format utility

The partitioner tool and the CFS filesystem creator is integrated into one executable called CFSfdisk. First it was a prototype utility running on GNU/Linux systems, then it was ported to C64 with the CC65 compiler.

Before partitioning/formatting go into setup and change 'Direct write' to enabled. Then load and start cfsfdisk.
CFSfdisk version 7
Copyright (C) 2001-2004 Kajtar Zsolt
(Soci/Singular)

CFSfdisk comes with ABSOLUTELY NO
WARRANTY; for details see LICENSE.
This is free software, and you are
welcome to redistribute it
under certain conditions; se LICENSE
for details.

Drive number (4-30): 
CFSfdisk is released under the GPL2, the C source can be downloaded with the IDEDOS source. OK, first it want's to know what's the drive's number you want to format. It's usually 12 or 13, see your setup settings on device number assignment for master/slave device. Remember that there will be no changes made on disk unless you exit with command 'w'.
For LBA disks only the LBA sectors
matters, for CHS ignore LBA sectors.

Cylinders (1-65536, default 1244):
Heads (1-16, default 16):
Sectors (1-255, default 63):
LBA available (Y/N, default Y):
LBA (256-268435456, default 1253952): 
Usually the autodetected defaults are ok, so you can just press enter for these questions. If not, enter the correct values.
Did not found any CFS partition entry in
PC BIOS partition table.
I assume you want to use the whole disk.
If you want to share the disk with other
operating systems, use the fdisk
utility, and make a partition entry
with type 0xCF.

Creating new disklabel.
It's possible to share disk with other (pc) operating systems, and because there was no partition marked for IDEDOS usage, the disk will be repartitioned so that the whole disk will be used by IDEDOS. It you only want to use a part of the disk for IDEDOS first create a partition with type 0xCF. (those familiar with the util-linux fdisk utility will know what I'm talking about for sure...) Anyway if you won't ever use this disk with anything else but a C64 then ignore the crap above ;-)
Creating new partition table.
A new empty C64 partition table was created. (inside the PC BIOS partition entry with type 0xCF)
Command (m for help): m
Command action
   a   select boot partition
   d   delete a partition
   g   set global disklabel
   h   toggle hidden flag
   l   toggle lbamode
   m   print this menu
   n   add new partition
   o   create an empty partition table
   p   print the partition table
   r   toggle writeable flag
   t   change partition's type
   q   quit without saving changes
   w   write table to disk and exit
Typing 'm' list possibilities. There are no partitions yet, so let's create one.
Command (m for help): n
Partition number (1-16): 1
Start (4-1253952, default 4):
End or +x or +xG or +xM or +xK or +x%
(10-1253952, default 1253952): +50%
Partition's name: stuff
This creates partition 1 called 'stuff' beginning on the start of the disk, and it will fill the half of the disk. (~300MiB) It's possible to give the exact start and end position or the size of the partition in sectors (eg. +2342) for power users. For everyday use +1048576K or +1024M or +1G creates an example partition with a size of 1 GiB. (metrics are powers of 1024, not 1000!) +25% means ¼ of the maximal partition size possible in this extent.
After adding some more partitions, the partition table will look like this:
Command (m for help): p

Drive 12: 1253952 sectors
Disklabel: "                "

Nr Boot Flags     Start       End
   Blocks   Id  System  Name
 1   *   --           4    626977
   313487    1  CFS     stuff
 2       --      626978    831777
   102400    1  CFS     work
 3       --      831778    864545
    16384    1  CFS     geos
 4       --      864546   1253952
   194703+   1  CFS     backup
Now let's change the global disklabel, and the default boot partition (I like to start at the work partition after boot). As you can see the listing above is not very readable as this program was designed for 80 column screen... The start and end of partition is displayed in sectors, while the partition size is displayed in KiB.
Command (m for help): g
New disklabel: soci's disk

Command (m for help): a
Partition number (1-16): 2

Command (m for help): p

Drive 12: 1253952 sectors
Disklabel: "soci's disk     "

Nr Boot Flags     Start       End   Blocks   Id  System  Name
 1       --           4    626977   313487    1  CFS     stuff
 2   *   --      626978    831777   102400    1  CFS     work
 3       --      831778    864545    16384    1  CFS     geos
 4       --      864546   1253952   194703+   1  CFS     backup
Partition 3 will be used by GEOS (I hope the correct driver for GEOS will be available someday), so I'll change the partition type for it, and add the hidden flag, because it's not readable by IDEDOS anyway.
Command (m for help): t
Hex code (type L to list codes): l

 0  Empty
 1  CFS
 2  GEOS
Hex code (type L to list codes): 2

Command (m for help): h
Partition number (1-16): 3

Command (m for help): p

Drive 12: 1253952 sectors
Disklabel: "soci's disk     "

Nr Boot Flags     Start       End   Blocks   Id  System  Name
 1       --           4    626977   313487    1  CFS     stuff
 2   *   --      626978    831777   102400    1  CFS     work
 3       H-      831778    864545    16384    2  GEOS    geos
 4       --      864546   1253952   194703+   1  CFS     backup
Now it's ready, let's format (or you can use 'q' to abort):
Command (m for help): w

Formatting partition 1...done.
Formatting partition 2...done.
Formatting partition 4...done.
Done.
After filling partition 4 with lot of important stuff, let's mark it readonly. Load the CFSfdisk utility and start it.
Command (m for help): r
Partition number (1-16): 4

Command (m for help): p

Drive 12: 1253952 sectors
Disklabel: "soci's disk     "

Nr Boot Flags     Start       End   Blocks   Id  System  Name
 1       --           4    626977   313487    1  CFS     stuff
 2   *   --      626978    831777   102400    1  CFS     work
 3       H-      831778    864545    16384    2  GEOS    geos
 4       -R      864546   1253952   194703+   1  CFS     backup

Command (m for help): w

Done.

CFSfdisk autodetects CHS/LBA disks, so you don't have to worry about this (at least on C64). But if want to change it, use 'l'. The current setting is visible in the ' Drive xx:' line, if there are numbers about cylinders, etc. then the disk is in CHS format.

If you only want to reformat a partition without deleting/readding it just change it's type to CFS even if was already in CFS format.



5 Using partitions

When using a new disk at least 1 partition must be created. Partitions provide the highest level of organizing data. Each partition has it's own filesystem, so possible disk/software errors can't destroy the whole data at once. It's also possible to select the default partition on boot, set the global disklabel, partition names and partition attributes (hidden/readonly) with the format utility. The readonly attribute is usefull to prevent accidental changes to a filesystem.

Examples:
Listing available partitions. '*' indicates default partition, '<' indicates readonly partition. Hidden partitions are not listed.
@$=P

255 "SOCI'S DISK     " IDE64
1    "STUFF"            CFS
2    "WORK"            *CFS
4    "BACKUP"           CFS<
3 PARTITIONS.
READY.
 
Selecting partition 4 as working partition:
@CP4
02, PARTITION SELECTED,004,000,000,000
READY.
 
Selecting partition 1 as working partition the other way:
OPEN 15,12,15,"C"+CHR$(208)+CHR$(1):CLOSE15
READY.
 
Load a file from partition 2 from the directory '/GT'. More about paths later in chapter Paths.
LOAD"2//GT/:FILE"

SEARCHING FOR 2//GT/:FILE
LOADIND $0801-$0932
READY.
 


6 Using directorys

A directory is a list of files. To view the directory use LOAD"$" then LIST, DIR, or @$. Of course LOAD will overwrite the current program in memory, while the last 2 methods will preserve your work.

The number before the first line is the partition number, it's followed by the directory's name, finally the ID string like IDE64. The following lines provide informations about the size of each file in 256 byte blocks (so 4 blocks are 1KiB), the name of the file enclosed in quotation marks, and it's filetype at the right side. The last line shows the total block count of all files in the list.

Example:
A directory list:
LIST

2 "TEST            " IDE64
0    "PLUGINS"          DIR
40   "BOOT"             PRG
2    "CONFIG EXT"
5    "TOD"              ASM
23   "VIEWER"           PRG
70 BLOCKS USED.
READY.
 

Putting a few thousand files in one long directory is not an optimal way of organizing data, so IDEDOS provides 'subdirectorys'. Subdirectorys look like normal files with filetype DIR in directory listings. Directorys are organized into a tree like structure starting from the root directory. The root directory is the top level directory, it's parent directory is itself. After boot this directory is selected as the working directory. The working directory is the directory which is used when no path is given in the filename just like in LOAD"$". Managing directorys is done via channel #15 commands, but these examples will use the DOS Wedge to simplify things. (more about the channel #15 commands and the DOS Wedge later)

Examples:
Creating a subdirectory
@MD:DIRNAME
Changing the working directory
@CD:DIRNAME

@/DIRNAME
Changing the working directory to the parent directory
@CD<-

@CD:..

@/..
Removing empty subdirectory
@RD:DIRNAME

6.1 Paths

Each file in the tree structure can be reached with a 'path'. The path is composed from the name of the directorys separated by a slash character.

Here's an example directory structure:
    ROOT-DIR
    /  |  \
   /   |   \
  A    B    C
  |        / \
  |       /   \
  F      E     D

Let's say the working directory is 'C' now. To load a file from directory 'E' use the following: LOAD"/E/:FILE". This is a relative path. It's also possible to specify the location of a file from the root directory, it's called absolute path: LOAD"//C/E/:FILE". As it seems the path is enclosed between 2 slashes before a semicolon, after it is the name of file. In the last example the real path was '/C/E' where the slash before C indicates the it's an absolute path.

Now let's compose a relative path, but now our working directory is 'F': LOAD"/../../C/E/:FILE". There's no directory named '..' in the graph, as this is a special directory, and it means the parent directory. That's why 'CD:..' means change to parent directory in some previous example. There's another special directory called '.' which means the directory itself. These 2 special directorys always exists.

To embed the partition number into the filename place it before the path, eg. '13/C/:E'.

Examples:
The directory structure above can be created by the following program:
10 OPEN 15,12,15
20 PRINT#15,"CD//"             :REM GOTO ROOT-DIR
30 PRINT#15,"MD:A"             :REM CREATE A
40 PRINT#15,"MD/A/:F"          :REM CREATE F
50 PRINT#15,"MD:B"             :REM CREATE B
60 PRINT#15,"CD:B"             :REM ENTER B JUST FOR FUN
70 PRINT#15,"MD//:C"           :REM CREATE C
80 PRINT#15,"MD//C/:E"         :REM CREATE E
90 PRINT#15,"MD/../C/./E/../:D":REM CREATE D ;-)
100 CLOSE 15
This small program lists all files in the working directory and in it's subdirectorys (recursive directory listing). The level of a directory in the tree is illustrated by the amount of tabulation before the file listing.
10 OPEN 15,12,15
20 A=A+1:OPEN A,12,0,"$":GET#A,A$,A$
30 GET#A,A$,A$,A$,B$:A$=A$+CHR$(0):B$=B$+CHR$(0):IF ST THEN 130
40 PRINT TAB(A*2-2);ASC(A$)+ASC(B$)*256;:B=1:D$="":N$=""
50 GET#A,A$:IF A$="" THEN 110
60 PRINT A$;:IF A$=CHR$(34) THEN B=B+1:GOTO 50
70 ON B GOTO 50,80,90
80 N$=N$+A$:GOTO 50
90 IF A$<>CHR$(32) THEN D$=D$+A$
100 GOTO 50
110 PRINT:IF D$="DIR" THEN PRINT:PRINT#15,"CD:"+N$:GOTO 20
120 GOTO 30
130 CLOSE A:A=A-1:IF A THEN PRINT#15,"CD"CHR$(95):PRINT:GOTO 30
140 CLOSE 15

6.2 Wildcards

It's possible to filter directory listings to show only a subset of files in a directory by using wildcards. There are 2 different wildcards: '?' matches exactly one character, while '*' matches any number of characters. These wildcards can be used in path elements or filename too, in this case the first filename will be matched. To filter directory listing by filetype append '=TYP' to the filename.

Examples:
List files starting with 'A'.
LOAD"$A*"

SEARCHING FOR $A*
LOADING $0801-$08DF
READY.
LIST

1 "PICTURES        " IDE64
132  "ALIEN BAR BY WEC" FUN
29   "ALIEN-LIFE BY MB" SHI
132  "ALLEY BY MIKE"    FUN
132  "ANGEL BY FZ"      FUN
72   "ARNIE BY AMN"     DRL
497 BLOCKS USED.
READY.
 
List files ending with 'DEPACKER'.
@$*DEPACKER

1 "UTILITIES       " IDE64
9    "DMC 5.0 DEPACKER" PRG
10   "DMC 5.1 DEPACKER" PRG
19 BLOCKS USED.
READY.
 
List files containing 'PLAYER'.
@$*PLAYER*

1 "UTILITIES       " IDE64
0    "MUSIC PLAYER"     DIR
9    "CD PLAYER 1"      PRG
12   "CD PLAYER 3"      PRG
12   "CD PLAYER 4"      PRG
77   "CUBIC PLAYER"     PRG
110 BLOCKS USED.
READY.
 
List 4 character long filenames.
@$????

1 "UTILITIES       " IDE64
0    "DEMO"             DIR
0 BLOCKS USED.
READY.
 
List files starting with 'K' and filetype 'D64'
@$K*=D64

1 "DEMOS           " IDE64
683  "KJU"              D64
683  "KRESTAGE 2"       D64
768  "KRESTOLOGY 1"     D64
768  "KRESTOLOGY 2"     D64
683  "KRESTOOLS"        D64
3585 BLOCKS USED.
READY.
 


7 Using files

Files store programs and data on disk. Traditionally files could only be accessed sequentially like on tape, but later relative files appeared with fixed record lengths on disk drives. Using IDEDOS with the CFS filesystem it's now possible to use randomly accessible files up to 4 GiB without the fixed record length limitation. Relative files are also available for compatibility reasons, these are limited to 16 MiB. There's also a special purpose file called link, which can be used to reference other files.

At maximum there can be 32 files open. (this includes all files, even on non-IDE64 drives) IDEDOS has 10 buffers for it's own files, these are shared between the IDE64 devices. IDEDOS supports opening of multiple files for write too, but keep in mind that each file locks a 2MiB part of the partition, which means that on partitions smaller than 2MiB (like on 1.44MB disk) there can be only 1 file opened for write at the same time, and the next opening/creation attempt will fail with a disk full error. This should be no problem on big partitions except the partition is near full.

Opened files are locked, they cannot be removed until they are not closed. This applies to directorys too, the current working directory cannot be removed even if it's empty.

In the format description everything between "[" and "]" is optional, and <name> means a parameter.

7.1 Normal files

Normal files are the most common on disk, they can be created by SAVE or OPEN and read back later by LOAD and OPEN, GET#, INPUT#.

7.1.1 SAVE

The basic command SAVE (and also the similar kernal call) has the following format:

SAVE"[[@][<partition>][<path>]:]<filename>[,<type>]"[,<device>]

Wildcards ("?", "*") and the characters ":", "," and "=" are not allowed in filename. The filetype has the same limitations plus it can't contain space or "<". The resulting file will be deleteable, readable, writeable, loadable, and not hidden. The directory, the partition and the disk must be writeable where the file is created, and the file must be deleteable if replaced.

Examples:
Simple save into current drive, current partition and into working directory, the result is "A" with filetype PRG.
SAVE"A"
This will save file B with filetype DAT on drive 12 to partition 3 to directory "/A". If it's exists it will be first removed.
SAVE"@3//A/:B,DAT",12
Will overwrite the first file in working directory beginning with A. Filetype is not changed. Wildcards are only alowed if replace is used! ("@:")
SAVE"@:A*"
7.1.2 LOAD

The basic command LOAD has the following format:

LOAD"[[<part>][<path>]:]<fname>[,<type>]"[,<device>[,<mode>]]

The file must be loadable. (the executeable flag must be set) For directory load the directory must be readable.

Examples:
Simple load from current drive, current partition and from working directory. As filetype is not specified the first will be loaded. The starting address will be ignored. (no mode specified means mode 0)
LOAD"A"
This will load file B with filetype PIC from drive 13 from partition 4 from directory "/A". It will be loaded to the load address included in file (first 2 bytes), because mode is not 0.
LOAD"4//A/:B,PIC",13,1
This will load the directory listing containing only PRG files as a basic program.
LOAD"$*=P",12
7.1.3 OPEN

Unfinished...



8 Direct access

By using direct access commands you can read/write any sector of disk. Common use of direct access commands is to access unknown filesystems, manage the partition table and to create the filesystem. It's also important in diskeditor applications.

To use direct access, you need to open 2 channels, one for commands, and one for data. The command channel can be opened with the usual OPEN <lfn>,<device>,15. The data channel is opened similar to opening normal files, except that the file name must be a hash sign. (OPEN <lfn>,<device>,<channel>,"#") The channel number must be greater than 1. This 'file' will be a circular data buffer holding 512/2048 bytes depending on the device used. The end of buffer can be found by checking the variable ST.

8.1 BLOCK-READ

The block-read command reads the specified sector into the buffer and sets the buffer pointer to the start of buffer. It can also be used to get the ATA(PI) device identity information to find out the geometry, diskname, etc. as described in ATA(PI) standards.

8.1.1 Reading from a CHS-ATA device
PRINT#<command lfn>,"B=R"; CHR$(<data channel>); CHR$(HEAD); CHR$(CYLINDERBITS8TO15); CHR$(CYLINDERBITS0TO7); CHR$(SECTOR)
8.1.2 Reading from a LBA-ATA or ATAPI device
PRINT#<command lfn>,"B=R"; CHR$(<data channel>); CHR$(64 OR (LBABITS24TO27)); CHR$(LBABITS16TO23); CHR$(LBABITS8TO15); CHR$(LBABITS0TO7)
8.1.3 Getting device identity
PRINT#<command lfn>,"B=R"; CHR$(<data channel>); CHR$(0); CHR$(0); CHR$(0); CHR$(0)

8.2 BLOCK-WRITE

The block-write command writes the buffer content to the specified sector and sets the buffer pointer to the start of buffer.

8.2.1 Writing to a CHS-ATA device
PRINT#<command lfn>,"B=W"; CHR$(<data channel>); CHR$(HEAD); CHR$(CYLINDERBITS8TO15); CHR$(CYLINDERBITS0TO7); CHR$(SECTOR)
8.2.2 Writing to a LBA-ATA or ATAPI device
PRINT#<command lfn>,"B=W"; CHR$(<data channel>); CHR$(64 OR (LBABITS24TO27)); CHR$(LBABITS16TO23); CHR$(LBABITS8TO15); CHR$(LBABITS0TO7)

8.3 BUFFER-POINTER

The buffer pointer selects individual bytes in the buffer. Reading and writing will start on the buffer position and the buffer pointer will be incremented by the number of bytes read/written.

8.3.1 Selecting a byte
PRINT#<command lfn>,"B=P"; CHR$(<data channel>); CHR$(POSITIONBITS0TO7); CHR$(POSITIONBITS8TO15) Examples:
This example reads in the boot sector and prints out the CFS identification string. (CHS disk, CFS filesystem). For LBA or ATAPI devices modify line 20:
20 PRINT#15,"B=R"CHR$(4)CHR$(64)CHR$(0)CHR$(0)CHR$(0)
10 OPEN15,12,15:OPEN4,12,4,"#" 
20 PRINT#15,"B=R"CHR$(4)CHR$(0)CHR$(0)CHR$(0)CHR$(1)
30 PRINT#15,"B=P"CHR$(4)CHR$(8)CHR$(0)
40 FORA=0TO15:GET#4,A$:PRINTA$;:NEXT 
50 CLOSE4:CLOSE15
This example prints some information from the device using the device identity.
10 OPEN15,12,15:OPEN4,12,4,"#"
20 PRINT#15,"B=R"CHR$(4)CHR$(0)CHR$(0)CHR$(0)CHR$(0)
30 PRINT#15,"B=P"CHR$(4)CHR$(46)CHR$(0)
40 PRINT"FIRMWARE REVISION:":B=4:GOSUB90
50 PRINT"MODEL NUMBER:":B=20:GOSUB90
60 PRINT#15,"B=P"CHR$(4)CHR$(20)CHR$(0)
70 PRINT"SERIAL NUMBER:":B=10:GOSUB90
80 CLOSE4:CLOSE15:END
90 FORA=1TOB:GET#4,A$,B$:PRINTB$A$;:NEXT:PRINT:RETURN


9 The File Manager

Manager

IDE File Manager is a software for copying, deleting, renaming, making directories, and starting programs. Working with this program is very easy. Start it from BASIC typing command MAN.

The screen is divided into 2 parts called "panel"s, each containing a directory listing, with the maximal number of displayable files of 510/panel. The black line is the file selector, which can be moved by the CRSR and F<x> keys. Selecting the active panel is done by the CONTROL keys. The right side of each panel shows the summ of selected files block count, the number of selected files, the used/free blocks in directory/disk and the drivenumber with the current partition. The current directory path is displayed on the top of screen, while the drive type and disklabel is on top of each panel. Tagging files for operation on multiple files (eg. copying) in done with the DEL key.

9.1 Plugins

Plugins are external programs called by the file manager to extend it's functionality. Plugins show text/various graphic formats, play sid files and animations, extract archives and disk images or just fire up an assembler with the file. Plugins are started by pressing RETURN or 3 on a file. When pressing 3 the file called "1//:VIEWER" is started from the boot drive. The action taken when RETURN is pressed is determined by the file called "1//ETC/:MANPLUGINS".

9.1.1 Plugin format

Plugins are machine code files compiled to $1000. When started at $1000 they should display some kind of prompt for getting the filename. The manager starts the plugins at $1003 with the accumulator loaded with the length of filename, the X register with the lower, the Y with the higher byte of the address to the filename. $BA contains the current device number the file is on. The filename always includes the filetype separated by a comma on the end.

Example:
A sample plugin framework
	*= $1000

	jmp printc
	jmp start

txt	.text 13,"FILENAME:",0

printc	lda #<txt
	ldy #>txt
	jsr $ab1e       ; print prompt
	ldy #255
oqu	iny
	jsr $ffcf       ; get input
	sta $200,y
	cmp #13
	bne oqu
	tya             ; setup fake manager start
	ldx #<$200
	ldy #>$200

start	jsr $ffbd       ; setup filename ("SD,MOV")
	lda #filenumber ; file number (1-255)
	ldx $ba         ; actual device number
	ldy #secaddy    ; secondary address
	jsr $ffba
	jsr $ffc0       ; open file
        
        ...             ; play movie

        lda #filenumber ; file number (1-255)
        jsr $ffc3	; close file
        rts             ; done

The plugin must not destroy $0002-$0333 badly and must not modify $0800-$0FFF! Please leave the VIC/SID/CIA, etc. after exit of the plugin in a usable state...

9.2 Manager config file

Not done yet.

9.3 Manager keys

Here's the list of keys and their functions in manager:


Table 2 – Manager keys
KeyFunction
<-Exit
CONTROLChange panel
UP/DOWNMove cursor
F1 or LEFTPage Up
F7 or RIGHTPage Down
1Refresh dir
3Execute viewer plugin
5Copy file(s)
6Rename file or directory
7Create directory
8Delete file(s)
9Send disk command
.Go into parent dir
/Go into root dir
DEL(Un)select file
F2/HOMEGo on top of listing
F8/CLRGo to end of listing
RETURNEnter directory or LOAD"file",x RUN or start viewer plugin
SHIFT + RETURNLOAD"file",x,1
^Eject media
*Invert file selection
+Select all files
-Deselect all files
C=Select drive
C= + SHIFTSelect charset
A...ZQuick jump to filename


10 Using the monitor

Monitor

The monitor is designed to be fast and simple, but still usefull for debugging and fixing. It's possible to edit every single byte in memory and I/O space without conflicting with internal variables of the monitor itself. Illegal opcodes, 65816 opcodes (emulation mode only) and wildcard searching is included.
The monitor is started by hitting C= + RESTORE at the same time, or by executing a BRK instruction, or pressing LEFTSHIFT + RESET.

If C128 keyboard is enabled it's possible to use HELP to start the monitor.

To recover from died monitor (not very likely) press LEFTSHIFT + RESET. Memory won't get distorted.

To rip from games/etc, press LEFTSHIFT+RESET while the program is running. (not a real freezer, but at least it's possible to rip ifli pictures...)

C64 version
A few bytes from stack ($1F3-$1FF), the contents of both CIAs, the memory configuration at $00/$01 and the processor registers (A, X, Y, SR, SP) will be lost, otherwise the memory is not touched. (PC will not have a valid restart address, instead it contains $FCE2)
SCPU version
A few bytes from stack ($1F3-$1FF), the contents of VIC registers $D020-$D02E, and zero page addresses $99, $9A will be lost, otherwise the memory is not touched. Due to end of stack corruption you may have problems with the restarted program. (PC will have a valid restart address!) Use SCPU reset button, stopping the program for a short time before freeze may be necessery.

To use the monitor like a real freezer monitor you must make sure that the NMI and BRK vectors won't get overwritten in ram. If so, press C= + RESTORE to freeze the program. The chip states, processor registers and memory is preserved. In the C64 version it's possible to call the monitor even from configurations like 5. (I/O area must be available)


Table 3 – Monitor commands
CommandFunction
@commandDisk command and status
@$Directory
A xxxx NOPAssemble
B xxMemory configuration
BTBacktrace
C start end start2 Compare memory
D {start {end}}Disassemble
,start xx xx xxWrite hex data to memory and disassemble
EC {start {end}}Edit char (binary)
[start xxxxxxxxWrite binary data to memory
ES {start {end}}Edit sprite (binary)
]start xxxxxxxxWrite binary sprite data to memory
F start end xxFill memory with byte
G xxxxExecute at address
H start end xx ? "txt"Search hex/any/ascii
I {start {end}}Dump memory in ascii
'start xxxxxxxWrite ascii data to memory
J {start {end}}Dump memory in screencode
.start xxxxxxxWrite screencode data to memory
K "name"Defreeze memory
L "name" {start}Load memory
M {start {end}}Dump memory in hex and ascii
O xxActual drive
:start xx xx xx xxWrite hex/ascii data to memory
RShow registers
;xxxx xx xxChange registers
S "name"Freeze memory
S "name" start endSave memory
T start end start2Copy memory
V "name" {start}Verify memory
XContinue program
QExit to BASIC warm start
<-(left arrow) Push address(es) to astack.
^(up arrow) Pop address from astack.
*Select RAM/ROM

Everything between "{" and "}" is an optional hexadecimal parameter.

Examples:
Print error channel:
@
00, OK,000,000,000,000
 
Send disk command:
@CD:SOURCE
00, OK,000,000,000,000
 
Display directory:
@$T*
2 "TEST            " IDE64
13105"TRANCEANDACID"
5    "TOD"              ASM
13110 BLOCKS USED.
 
Select drive 12. Drive numbers are in hexadecimal. This drive number is used in all disk access commands, the default is the same as the boot drive selected in setup.
O C
 
Print registers. Modify the registers and flags by overwriting the line beginning with ";". ADDR is the address where the program continues (see X!), AC XR YR SP are the accumulator, x register, y register and stack pointer, BK is the currently edited bank selector (see B!), DR is the drive number used in disk access commands (see O!), NV-BDIZC are the processor flags.
R
 ADDR AC XR YR SP BK DR NV-BDIZC
;E5D1 00 00 0A F3 07 0C 00100010
 
Select bank 4. Banks 0-7 have the same meaning like the first 3 bits of $01, banks 8-1E selects the drive's memory with that device number, bank 1F selects VDC memory (C128 only).
B 4
 
Continue program execution at PC.
IDE64 MONITOR

 ADDR AC XR YR SP BK DR NV-BDIZC
;E5D1 00 00 01 F2 07 08 00100010
X 
Try to exit to basic prompt. Usefull after hitting a BRK.
BRK EXCEPTION

 ADDR AC XR YR SP BK DR NV-BDIZC
;1230 10 00 0A C6 07 0D 00110000
Q 
Start program at $080D. When program terminates it trys to return to monitor with a BRK.
G 80D 
Enter assembly instructions. Illegal instuctions are supported, 65816 instructions are not.
A 1000 EE 20 D0 INC $D020
A1003 4C 00 10 JMP $1000
A1006 B3 30    LAX ($30),Y
A1008 NOP 
Disassembly from last address: D. Disassembly a few lines: D1234. Disassembly till end of memory: D1234-. Disassembly between addresses: D1234-5678. Pressing RETURN on modified hex bytes or on modified disassembly changes memory. (the cursor position selects what happens) To slow down listing hold CONTROL, to stop press STOP, to pause listing press anything else.
D 1000
,1000 EE 20 D0 INC $D020
,1003 4C 00 10 JMP $1000
,1006 B3 30    LAX ($30),Y
Dump memory in hex and ascii. Press RETURN to enter the modified hex values/ascii text into memory. To enter ascii text, use I! Possible parameters are the same as for D.
M E478
:E478 20 2A 2A 2A 2A 20 43 4F  **** CO
:E480 4D 4D 4F 44 4F 52 45 20 MMODORE
:E488 36 34 20 42 41 53 49 43 64 BASIC
:E490 20 56 32 20 2A 2A 2A 2A  V2 ****
Dump memory in ascii. Press RETURN to enter the modified text into memory. Some ascii values have the same screencode, so be carefull when editing text mixed with code. Possible parameters are the same as for D.
i a0a0
'a0a0 DfoRnexTdatAinput~inpuTdiMreaDle
'a0c0 TgotOruNiFrestorEgosuBreturNreMs
'a0e0 toPoNwaiTloaDsavEverifYdeFpokEpr
'a100 inT~prinTconTlisTclRcmDsySopeNcl
Dump memory in screencode. Press RETURN to enter the modified text into memory. (I* is available for MK7 addicts) Possible parameters are the same as for D.
J 400
.0400     **** COMMODORE 64 BASIC V2 *
.0428 ***
.0450                  64K RAM SYSTEM
.0478  IDE-DOS BETA! EXPANDED
Dump memory in binary. Press RETURN to enter the modified bytes into memory. "." means 0, anything else (no space) 1. Possible parameters are the same as for D.
B 3
EC D008
[D008 ...##...
[D009 ..####..
[D00A .##..##.
[D00B .######.
[D00C .##..##.
[D00D .##..##.
[D00E .##..##.
[D00F ........
Dump memory as sprite. Press RETURN to enter the modified bytes into memory. "." means 0, anything else (no space) 1. Possible parameters are the same as for D.
ES A00
]0A00 ........................
]0A03 ........................
]0A06 ........................
]0A09 ........................
]0A0C ........................
]0A0F ........................
]0A12 ........................
]0A15 ........................
]0A18 ...........#######......
]0A1B .........##########.....
]0A1E .......############.....
]0A21 ......#######.....#.....
]0A24 .....########.....#.....
]0A27 ....########......#.....
]0A2A ....########..#...#.....
]0A2D ....#######...#..##.....
]0A30 .....##.......#..##.....
]0A33 ......#...........#.....
]0A36 ......#...........##....
]0A39 .......#....#......#....
]0A3C ........##...#....#.....
Copy memory from $400-$7FF to $C00-$FFF. Overlapping areas are supported.
T 400 7FF C00
 
Compare memory from $2000-$3FFF with $E000-$FFFF.
C 2000 3FFF E000
 3FC0 3FC1 3FC2
 
Fill memory $2-$FFFF with $00.
B 4
F 2 FFFF 0
 
Do backtrace. $1237, $1233 and $1230 are the caller JSR addresses, $30 is some pushed data.
A1230 20 33 12 JSR $1233
A1233 20 36 12 JSR $1236
A1236 08       PHP
A1237 20 3A 12 JSR $123A
A123A 00       BRK
A123B

G 1230

BRK EXCEPTION

 ADDR AC XR YR SP BK DR NV-BDIZC
;1230 10 00 0A C6 07 0D 00110000
BT
1237 30 1233 1230 7A E3 1009 050E 10
 
Search memory for instructions accessing $277. (? is a 1 character wildcard matching everything)
H E000 FFFF ? 77 2
 E5B4 E5BC EB3C
D E5B4
,E5B4 AC 77 02 LDY $0277
,E5B7 A2 00    LDX #$00
,E5B9 BD 78 02 LDA $0278,X
Search memory for text.
H E000 FFFF "COMM"
 E47E
 
Save memory to disk.
S"SPRITES" 2000 21FF
OK
 
Load memory to disk.
L"SPRITES"
2000-21FF OK

L"SPRITES" 2200
2200-23FF OK
 
Verify memory from disk.
V"SPRITES"
2000-21FF OK

V"SPRITES" 2200
 2312 2313
2200-23FF OK
 
Freeze (saves 64K RAM + I/O) memory to disk. VDC memory is not saved on C128.
S"MYFREEZE"
OK
 
Defreeze memory from disk. (loads 64K RAM + I/O)
K"MYFREEZE"
0000-FFFF OK
 
Look at screen. Usefull for finding the videobank after LEFTSHIFT + RESET.
W 
Using astack. Search for something, then put a leftarrow before the address list, press RETURN (push), then list with D uparrow, or with something else (pop). The address stack is 8 deep only.
H E000 FFFF 20 BA FF
<-E1DD E1F0 E22B E23F E24E
D^
,E24E 20 BA FF JSR $FFBA
,E251 20 06 E2 JSR $E206
,E254 20 0E E2 JSR $E20E
D^
,E23F 20 BA FF JSR $FFBA
,E242 20 06 E2 JSR $E206
,E245 20 00 E2 JSR $E200
D^
,E22B 20 BA FF JSR $FFBA
,E22E 20 06 E2 JSR $E206
,E231 20 00 E2 JSR $E200
D^
,E1F0 20 BA FF JSR $FFBA
,E1F3 20 06 E2 JSR $E206
,E1F6 20 00 E2 JSR $E200
D^
,E1DD 20 BA FF JSR $FFBA
,E1E0 20 06 E2 JSR $E206
,E1E3 20 57 E2 JSR $E257
Using print upwards/downwards. (F1, F3, F5, F7). Type D FCE2 then hold F3 till the code before $FCE2 appears. (other keys work similar)
,FCDD D0 02    BNE $FCE1
,FCDF E6 AD    INC $AD
,FCE1 60       RTS
,FCE2 A2 FF    LDX #$FF
,FCE4 78       SEI
,FCE5 9A       TXS
,FCE6 D8       CLD
,FCE7 20 02 FD JSR $FD02
Quick switch between RAM/ROM (bank 4/7)
 ADDR AC XR YR SP BK DR NV-BDIZC
;EAB4 03 03 15 EA 07 08 00100101
*
RAM
R
 ADDR AC XR YR SP BK DR NV-BDIZC
;EAB4 03 03 15 EA 04 08 00100101
 


11 DOS Wedge

These are one/two character long commands to speed up some frequently typed command at the basic prompt. Enable/disable this feature in the setup utility.

11.1 @

It sends the parameter (if any) to the last used device and then prints the command channel.

Examples:
Print error channel:
@
00, OK,000,000,000,000

READY.
 
Delete a file:
@S:MYFILE
01, FILES SCRATCHED,001,000,000,000

READY.
 

11.2 @#

Selects the specified device as last used device.

Example:
Select drive 8:
@#8

READY.
 

11.3 @$

Display directory without affecting memory

Example:
List PRG files beginning with "S" ending with ".DRL".
@$S*.DRL=P

1 "TEST            " IDE64
33   "SHUDDER.DRL"      PRG
33 BLOCKS USED.
READY.
 

11.4 / (slash)

Loads a basic file, like LOAD"FILE",<current device>.

Example:
To load a program from directory listing:
@$

1 "TEST            " IDE64
0    "PLUGINS"          DIR
132  "2 PLANETS BY"     FUN
45   "DRAZPAINT 2.0"    PRG
/1   "DRAZLACE V1.0"    PRG
64   "TASM"             PRG
SEARCHING FOR DRAZLACE V1.0
LOADING $0801-$3023
READY.
 

11.5 % (percent)

Loads an assembly file, like LOAD"FILE",<current device>,1.

Example:
To load a program from directory listing:
LIST

1 "TEST            " IDE64
0    "PLUGINS"          DIR
132  "2 PLANETS BY"     FUN
45   "DRAZPAINT 2.0"    PRG
41   "DRAZLACE V1.0"    PRG
%4   "TASM",8           PRG
33   "SHUDDER.DRL"      PRG
SEARCHING FOR TASM
LOADING $9000-$CF00
READY.
 

11.6 ´ (shift 7)

Verifys an assembly file, like VERIFY"FILE",<current device>,1.

Example:
Verify Drazlace:
´DRAZLACE*

SEARCHING FOR DRAZLACE*
VERIFYING $0801-$3023
OK

READY.
 

11.7 ^ (up arrow)

Loads a basic file, like /, and than starts it with RUN.

Example:
Load Drazlace and start it:
^DRAZLACE*

SEARCHING FOR DRAZLACE*
LOADING $0801-$3023
READY.
Ru:

11.8 <- (left arrow)

Saves a basic file, like SAVE"FILE",<current device>.

Example:
To save a program:
<-MYFILE

SAVING MYFILE $0801-$0932
READY.
 

11.9 £ (pound sign)

Loads an assembly file, like %, and than starts it with JMP at it's load address.

Example:
Load and start TASM:
£TASM

SEARCHING FOR TASM
LOADING $9000-$CF00


12 BASIC extensions

Most basic extensions slow down program execution, but this one has some optimizations to avoid the performance hit. In this chapter the new/changed BASIC commands are described.

12.1 CD

Sends change dir to the last used/specified device. (Same as "@CD:PARAMETER")

Example:
CD"GAMES"

READY.
 

12.2 CDCLOSE

Sends close tray command to the last used/specified device. (Same as "@U0>E0")

12.3 CDOPEN

Sends eject media command to the last used/specified device. (Same as "@U0>E1")

12.4 CHANGE

Sends change device number to the last used/specified device. (Same as "@S-8" or "@S-D")

Example:
Change device 12 to be device 8:
CHANGE12

READY.
 
Change device 8 back:
CHANGE8

READY.
 

12.5 DATE

Prints the date and time of the last used/specified device. For date format see Reading time from RTC! (Same as "@T-RA")

Example:
DATE
THUR 08/12/04 08:51:18 PM

READY.
 

12.6 DIR

Lists directory of the last used/specified device. (Same as "@$PARAMETER")

Example:
DIR"*=B

3 "ACE             " IDE64
0    "BIN"              DIR
0    "ETC"		DIR
0    "HOME"		DIR
0 BLOCKS USED.
READY.
 

12.7 HDINIT

Trys to autodetect devices connected to the cartridge.

Example:
HDINIT
MASTER:
ST9385AG

READY.
 

12.8 INIT

Fills memory with nulls, then reset. Usefull before linking.

12.9 KILL

Switches cartridge off. Usefull if you suspect compatibility problems with a program.

Example:
KILL
BYE!

READY.
 

12.10 LL

Pretty verbose directory list for power users. First line is the directory label, same parameters as for command DIR.

Table 4 – LL format
PartMeaning
-. = DEL entry, - = file, R = relative file, D = directory, L = link
CC = Closed
DD = Deleteable
RR = Readable
WW = Writeable
XX = Loadable
-H = Hidden
363Size of file
2004-08-12Date
16:12:13Time
"LIST"Filename
TXTFiletype
568/12/4Disk address (CHS or LBA)
Examples:
Simple listing:
LL

D--RWX-            1980-01-01 00:00:00  "WORK            " DIR 560/5/36
DC-R-XH          0 1980-01-01 00:00:00  "%DELETED  FILES%" DIR 560/5/35
-CDRWX-        363 2004-08-12 16:12:13  "LIST"             TXT 568/12/4
-CDRWX-     820528 2004-08-11 16:32:26  "UTILITIES"        ZIP 560/5/37
-CDRWX-    2234108 2004-08-11 18:46:01  "TXT"              ZIP 562/9/21
-CDRWX-      25513 2004-08-11 19:29:43  "CHANNEL15"        ASM 568/11/9
READY.
 
Redirect listing into file to be able to print or view it later.
OPEN 1,12,1,"LIST,TXT":CMD 1:LL:CLOSE 1

READY.
 
Listing works on 1541/1571/1581 too:
LL"",8

"GEOS 128 V2.0AM " CP 2A
P--              2 1988-08-22 13:00     "GEOS"             PRG 19/15
P--              6 1988-08-22 13:00     "GEOS BOOT"        PRG 19/17
U--            156 1988-08-22 13:00     "GEOS KERNAL"      USR 19/18
U-W            137 1988-10-10 13:06     "128 DESKTOP"      USR 8/20
U-W             79 1988-09-08 16:50     "128 CONFIGURE"    USR 15/6
BREAK
READY.
 

12.11 LOAD

Loads a program file into memory. Using no device number selects last used device. No filename means "*".

Example:
LOAD

SEARCHING FOR *
LOADING $0801-$099E
READY.
 

12.12 MAN

Starts the built in file manager.

12.13 MKDIR

Sends make dir to the last used/specified device. (Same as "@MD:NEWDIR")

Example:
MKDIR"PICS",12

READY.
 

12.14 RM

Sends scratch file to the last used/specified device. (Same as "@S:FILENAME")

Example:
RM"OLDSTUFF",8

READY.
 

12.15 RMDIR

Sends remove directory to the last used/specified device. (Same as "@RD:FILENAME")

Example:
RMDIR"OLDDIR"

READY.
 

12.16 SAVE

Saves program to disk. Using no device number selects last used device.

Example:
SAVE"TEST"

SAVING TEST $0801-$1A43
READY.
 

12.17 VERIFY

Verifys that the program in memory matches the on-disk version. Using no device number selects last used device. No filename means "*".

Example:
VERIFY"TEST"

SEARCHING FOR TEST
VERIFYING $0801-$1A43
OK

READY.
 


13 Programming in assembly

This part is not finished...

13.1 $FFB7 - READST

Description:Read status word
Implementation:Standard
Communication registers:None
Preparatory routines:None
Error returns:None
Status:None
Registers affected:A
Example:
Check end of file while reading
	jsr chrin	; read data from file
	sta data,y
	jsr readst	; test status
	and #$40	; end of file flag
	bne endoffile
Table 5 – Device status ($90)
BitMeaning
7Device not present
6End of File
5(Tape CRC error)
4Verify/read error (Tape read error)
3(Tape long block)
2(Tape short block)
1Timeout on receive
0Timeout on send

13.2 $FF90 - SETMSG

Description:Control kernal message printing
Implementation:Standard
Communication registers:A
Preparatory routines:None
Error returns:None
Status:None
Registers affected:A
Example:
Turn off messages to prevent screen distorsion
	lda #$00
	jsr setmsg	;turn off messages	
Table 6 – Messages ($9D)
BitMeaning
7Full error messages (LOADING, etc.)
6Kernal error messages (I/O ERROR#x)
5..0Undefined

13.3 $FFE1 - STOP

Description:Check if stop was pressed
Implementation:Standard
Communication registers:A
Preparatory routines:None
Error returns:None
Status:None
Registers affected:A, X
Example:
Check stop key while reading a file (STOP calls CLRCHN if stop was pressed)
	jsr chrin
	sta ($fb),y
	jsr stop
	beq stoped	;stop was pressed

	...

stopped	lda #filenum
	jmp close	;close file and exit

13.4 $FFBA - SETLFS

Description:Sets Logical File Number, Device Number, and Secondary Address
Implementation:Standard
Communication registers:A, X, Y
Preparatory routines:None
Error returns:None
Status:None
Registers affected:None
Example:
Set the first three parameters of BASIC OPEN command. Filenumber is ignored for LOAD/SAVE.
	lda #filenumber	; file number (1-255)
	ldx $ba		; actual device number
	ldy #secaddy	; secondary address
	jsr setlfs
        
        ...

        jsr open
Table 7 – Device numbers ($BA)
Device numberDevice
0Keyboard
1Datassette(TM)
2RS-232C device
3CRT display
4..5Serial bus printer
6..7Serial bus plotter
8..11CBM serial bus disk drive
12Primary IDE controller, Master (default)
13Primary IDE controller, Slave (default)
14PC-link serial/parallel (default)
15..30Other
31..255Illegal
Table 8 – Secondary addresses ($B9)
Secondary addressOpen mode
0Read access (load)
1Write access (save)
2..14Data channel
15Status/command channel
16..127Illegal
128..255Illegal (serial bus specific)

13.5 $FFBD - SETNAM

Description:Sets filename for OPEN/LOAD/SAVE routine
Implementation:Standard
Communication registers:A, X, Y
Preparatory routines:None
Error returns:None
Status:None
Registers affected:None
Example:
Set filename for OPEN/LOAD/SAVE
	lda #8		; filename length
	ldx #<name	; pointer to filename, low byte
	ldy #>name	; pointer to filename, high byte
	jsr setnam

	...

        jsr open

name	.text "filename"

13.6 $FFC0 - OPEN

Description:Open a logical file
Implementation:IDE Extended
Communication registers:None
Preparatory routines:SETLFS, SETNAM
Error returns:1, 2, 4, 5, 6, 7, 240 (see errorcodes)
Status:$00, $80 (see READST)
Registers affected:A, X, Y
Example:
Open a file
	lda #filenumber	; file number (1-255)
	ldx $ba		; actual device number
	ldy #secaddy	; secondary address
	jsr setlfs
	lda #8		; filename length
	ldx #<name	; pointer to filename, low byte
	ldy #>name	; pointer to filename, high byte
	jsr setnam
        jsr open

name	.text "filename"

13.7 $FFC3 - CLOSE

Description:Close a logical file
Implementation:IDE Extended
Communication registers:A
Preparatory routines:None
Error returns:0, 240 (see errorcodes)
Status:$00, $03, $80 (see READST)
Registers affected:A, X, Y
Example:
Close a file
	lda #filenumber	; opened file number
	jsr close

13.8 $FFC6 - CHKIN

Description:Set standard input
Implementation:IDE Extended
Communication registers:X
Preparatory routines:valid OPEN
Error returns:0, 3, 5, 6 (see errorcodes)
Status:$00, $03, $80 (see READST)
Registers affected:A, X
Example:
Starts to read from a file
	...
        jsr open	; open file

	ldx #filenumber	; opened file number
	jsr chkin	; set input

	ldx #0
        jsr chrin	; get bytes
        sta $400,x
        ...

13.9 $FFC9 - CHKOUT

Description:Set standard output
Implementation:IDE Extended
Communication registers:X
Preparatory routines:valid OPEN
Error returns:0, 3, 5, 7 (see errorcodes)
Status:$00, $03, $80 (see READST)
Registers affected:A, X
Example:
Starts to write to a file
	...
        jsr open	; open file

	ldx #filenumber	; opened file number
	jsr chkout	; set output

	ldx #0
	lda $400,x
        jsr chrout	; write out data
        ...

13.10 $FFCF - CHRIN

Description:Get a character from standard input
Implementation:IDE Extended
Communication registers:None
Preparatory routines:valid OPEN, CHKIN
Error returns:6 (see errorcodes)
Status:$00, $40, $42, $52, $80 (see READST)
Registers affected:A (Y but not for file I/O)
Example:
Get in a byte from standard input
	...
        jsr chkin

	ldy #0
	jsr chrin
	sta data,y
	iny
        ...

13.11 $FFE4 - GETIN

Description:Get a character from standard input
Implementation:IDE Extended
Communication registers:None
Preparatory routines:valid OPEN, CHKIN
Error returns:6 (see errorcodes)
Status:$00, $40, $42, $52, $80 (see READST)
Registers affected:A (X, Y but not for file I/O)
Example:
Get in a byte from standard input
	...
        jsr chkin

	ldy #0
	jsr getin
	sta data,y
	iny
        ...
Wait until a space is pressed
	...
	jsr clrchn	;keyboard/screen
        ...

wait	jsr getin	;get key
	beq wait	;nothing pressed?
        
        cmp #32		;space pressed?

13.12 $FFD2 - CHROUT

Description:Output a character to standard output
Implementation:IDE Extended
Communication registers:A
Preparatory routines:valid OPEN, CHKOUT
Error returns:7 (see errorcodes)
Status:$00, $03, $80 (see READST)
Registers affected:None
Example:
Put in a byte to output
	...
        jsr chkout

	lda #$00
	jsr chrout	;write 0
        ...

13.13 $FFE7 - CLALL

Description:Close all files and set standard input/output to keyboard/CRT
Implementation:IDE Extended
Communication registers:None
Preparatory routines:None
Error returns:5 (see errorcodes)
Status:$00, $03, $80 (see READST)
Registers affected:A, X
Example:
Make sure all files are closed before starting.
	jsr clall	; close all files, set default i/o
	jmp run		; run program

13.14 $FFCC - CLRCHN

Description:Set standard input/output to keyboard/CRT
Implementation:IDE Extended
Communication registers:None
Preparatory routines:None
Error returns:5 (see errorcodes)
Status:$00, $03, $80 (see READST)
Registers affected:A, X
Example:
Set standart keyboard/screen in/output.
	...
        jsr chkin
        ...
        
	lda #1
	jsr close
	jsr clrchn	; set default i/o

13.15 $FFD5 - LOAD

Description:Load memory from file
Implementation:IDE Extended
Communication registers:A, X, Y
Preparatory routines:SETLFS, SETNAM
Error returns:0, 4, 5, 8, 9, 16 (see errorcodes)
Status:$00, $10, $40, $42, $50, $52, $80 (see READST)
Registers affected:A, X, Y
Example:
Load a file. It's possible to load from $0400 to $FFFF (IDE64 switches $01 memory configuration register automatically if needed).
	lda #1		; filename length
	ldx #<dirnam
	ldy #>dirnam	; filename pointer
	jsr setnam

	lda #1		; file number
	ldx $ba		; actual device number
	ldy #0		; sec.address 0=new location, 1=original location
	jsr setlfs

	lda #$00	; load flag (1=verify)
	ldx #<dirbuff
	ldy #>dirbuff	; new start address
	jsr load
	bcc loadok
	...
	rts

loadok	stx $ae		; new end after load/verify
	sty $af
	...
	rts

dirnam	.text "$"

13.16 $FFD8 - SAVE

Description:Save memory to file
Implementation:IDE Extended
Communication registers:A, X, Y
Preparatory routines:SETLFS, SETNAM
Error returns:0, 5, 8, 9, 24 (see errorcodes)
Status:$00, $03, $80 (see READST)
Registers affected:A, X, Y
Example:
Save a file. It's possible to save RAM from $0200 to $CFFF. For save ram under the BASIC rom don't forget to set $01!
databegin = $fb

	lda #1		; file number
	ldx $ba		; actual device number
	ldy #0		; sec.address
	jsr setlfs

	lda #8		; filename length
	ldx #<name
	ldy #>name	; filename pointer
	jsr setnam

	lda #<$1000
	sta databegin	; begin
	lda #>$1000
	sta databegin+1
	lda #databegin
	ldx #<$8000
	ldy #>$8000	; end
	jsr save

name	.text "filename"

13.17 $DEF1 - WRITE

Description:Save data block to IDE device
Implementation:IDE only
Communication registers:A, X, Y
Preparatory routines:valid OPEN, CHKOUT
Error returns:5, 7, 9 (see errorcodes)
Status:$00, $80 (see READST)
Registers affected:A, X, Y

Note: Not possible to save under I/O. (eg. saving from $D800 will save color ram) To access RAM under the BASIC and KERNAL ROM, set $01 correctly. Saving RAM under the KERNAL ROM is not supported on SuperCPU.

If you want your application using READ/WRITE make runnable on a not IDE64 equiped machine, check for IDE64 presence before calling these two calls, and use standard routines instead of, as described above. (Imagine what happens at JSR $DEF1 if there's open I/O space at $DE00-$DEFF...)

Example:
Detect IDE64 before write and workaround if not present.
	lda $de60	;check ide64
	cmp #$49
	bne old
	lda $de61
	cmp #$44
	bne old
	lda $de62
	cmp #$45
	bne old
	lda #zp
	jsr $def1
	bcc ok
	cmp #9		;illegal device
	beq old2	;tried to use call on non-ide64 device
ok
	...
	rts

old2	ldx #channel
	jsr chkout
old	...		;old byte by byte routine
	rts

13.18 $DEF4 - READ

Description:Load data block from IDE device
Implementation:IDE only
Communication registers:A, X, Y
Preparatory routines:valid OPEN, CHKIN
Error returns:5, 6, 9 (see errorcodes)
Status:$00, $40, $42, $52, $80 (see READST)
Registers affected:A, X, Y

Note: This routine does not load under I/O. (e.g. reading to $D800 will overwrite color ram)

Example:
Copy a file with read and write
	lda #1		; source filenumber
	ldx $ba		; actual device number
	ldy #0		; secondary address for read
	jsr setlfs
	lda #outputname-inputname
	ldx #<inputname
	ldy #>inputname
	jsr setnam
	jsr open	; open input file

	lda #2		; destination filenumber
	ldx $ba		; actual device number
	ldy #1		; secondary address for write
	jsr setlfs
	lda #status-outputname
	ldx #<outputname
	ldy #>outputname
	jsr setnam
	jsr open	; open output file

	lda #<startadd
	sta $fb
	lda #>startadd	; buffer start address
	sta $fc

	ldx #1		; set input to source file
	jsr chkin

	ldx #2
	jsr chkout	; set output to destination file

loop	lda #$fb	; pointer to zeropage with start address
	ldx #<blocksize
	ldy #>blocksize	; block size
	jsr read	; read
	bit $90		; readst
	php		; status to stack

	lda #$fb
	jsr write	; write
	plp		; status
	bvc loop	; test end of file

	lda #2
	jsr close	; close output file
	lda #1
	jsr close	; close input file
	jsr clall	; set default i/o device
	rts

inputname .text "/bin/input-file"
outputname .text "/tmp/output-file"
status	.byte 0
Table 9 – Errors codes returned by kernal
AccuMeaning
0Routine terminated by the STOP key
1Too many open files
2File already open
3File not open
4File not found
5Device not present
6File is not an input file
7File is not an output file
8File name is missing
9Illegal device number
16Out of memory (load)
24File data error (save)
240Top-of-memory change RS-232 buffer allocation/deallocation


14 PCLink

IDEDOS also supports a virtual drive called as "PCLink". This drive is a network drive, which make file copying possible across computers. Programs can also directly run of a PCLink drive. There are several variations for the connection:

14.1 PCLink on XPClink cable

The slowest method but the easiest if you already have a X1541, XE1541, XM1541 or XA1541 cable. Maximal transfer speed is around 5000 bytes/sec.

Table 10 – X1541 PCLink cable
PinC64
serial port
PinPC
printer port
2GND18...25GND
3ATN1STROBE
4CLK14AUTOFEED
5DATA17SELECT IN

This cable will not work with all printer ports.

14.2 PCLink on parallel cable

This connection is made between the parallel port of a PC and the user port of a C64 using a cable similar to Laplink, however the layout was based on PC64 cable.

Table 11 – Parallel PCLink cable
PinC64
user port
PinPC
printer port
A,1GND18...25GND
CPB0 out15ERROR in
DPB1 out13SELECT in
EPB2 out12PAPER in
FPB3 out10ACK IN in
HPB4 in2D0 out
JPB5 in3D1 out
KPB6 in4D2 out
LPB7 in5D3 out
MPA2 out11BUSY in
N,12GND18...25GND
BFLAG in (not mandatory)9D7 (not mandatory)

Incorrectly built cable can damage the printer or/and userport! Same for plugging the cable while the computers are turned on...

14.3 PCLink on null modem cable

It's using a null modem cable with handshake between your PC's serial port and a port of a duart card. Communication is done at 115200 bit/s resulting in an effective transfer speed of ? bytes/sec.

Table 12 – Serial PCLink cable
9
pin
C64
duart port
9
pin
25
pin
PC
serial port
2RxD32TxD
3TxD23RxD
7RTS85CTS
8CTS74RTS
5GND57GND


15 Command channel

Will write this a bit more verbose later. Some examples use the dos wedge like "@I", of course the @ at the beginning of line is not part of the command.

15.1 File management commands

For more see chapter Using files.

15.1.1 Position

Seek to file position.

Format: PRINT#<command lfn>,"P"; CHR$(<file channel>); CHR$(POSITIONBITS0TO7); CHR$(POSITIONBITS8TO15); CHR$(POSITIONBITS16TO23); CHR$(POSITIONBITS24TO31)

Example:
Seek in file to the 100000th byte and read it. (counting begins at 0)
10 OPEN 15,12,15:OPEN 4,12,4,"FILE"
20 PRINT#15,"P"; CHR$(4); CHR$(159); CHR$(134); CHR$(1); CHR$(0)
30 GET#4,A$:CLOSE 4:CLOSE 15

15.2 Filesystem management commands

15.2.1 Initialize

Redetect filesystem and go into root directory of default partition.

Example:
@I
00, OK,000,000,000,000
15.2.2 Scratch

Delete a file. For empty directorys use RD. File must have the DELETEABLE flag set, and must be on a writeable partition.

Example:
Delete the file called 'FILE'
@S:FILE
01, FILES SCRATCHED,001,000,000,000
15.2.3 Rename

Rename a file or directory. The new and old file must be in the same directory, on a writeable partition.

Example:
Rename the file called 'OLD,PRG' to 'NEW,SEQ'
@R:NEW,SEQ=OLD,PRG
00, OK,000,000,000,000

15.3 Partition management commands

15.3.1 Change partition

Partition changing.

Example:
Select partition 2
@CP2
02, PARTITION SELECTED,002,000,000,000
 
Select partition 3 the other way
OPEN 15,12,15,"C"+CHR$(208)+CHR$(3):CLOSE 15
READY.
 
15.3.2 Get partition info

Get information about a partition. The returned data format is:

Table 13 – G-P data format
ByteMeaning
0Partition type: 0=not available, 1=CFS
1Unused
2Partition number
3-18Partition name
19-26Unused
27-28Size (65535)
Examples:
What's the current partition?
10 OPEN 15,12,15,"G-P"
20 GET#15,A$,B$,C$:CLOSE 15
30 PRINT"CURRENT PARTITION IS:"ASC($C$+CHR$(0))
Is partition 2 there?
10 OPEN 15,12,15,"G-P"+CHR$(2)
20 GET#15,A$,B$,C$:CLOSE 15
30 IF A$="" THEN PRINT"NO SUCH PARTITION!"

15.4 Device management commands

15.4.1 Drive number change

To tempolary change the device number (till next reset) send "U0>"+CHR$(new) to the device. If 'new' is 0 then the device is disabled.

Example:
Use device 12 as 8 from now on
OPEN 15,12,15,"U0>"+CHR$(8):CLOSE15

An easier typed variant is the "S-8", "S-9" and "S-D". D means default device number.

Example:
Use device 12 as 8 from now on
@S-8
00, OK,000,000,000,000
READY.
Revert to default device number
@S-D
00, OK,000,000,000,000
READY.
15.4.2 Identify device

Sending 'UI' or 'U9' on command channel returns the dos version of the device.

Example:
@UI
73, IDE DOS BETA! IDE64,000,000,000,000
15.4.3 Reset device

Sending 'UJ' or 'U:' on command channel resets (re-detects) the device.

Example:
@UJ
73, IDE DOS BETA! IDE64,000,000,000,000
15.4.4 Power management

It's possible to enter/exit powersaving mode if the device support it.

Examples:
Spin down drive
@U0>P0
00, OK,000,000,000,000
Spin up drive
@U0>P1
00, OK,000,000,000,000
15.4.5 Eject/Load media

More usefull on CDROM, ZiP drive and LS-120 than on harddisk.

Examples:
Load media (CDROM only)
@U0>E0
00, OK,000,000,000,000
Eject media
@U0>E1
00, OK,000,000,000,000
15.4.6 Lock/Unlock media

It's possible to prevent media removal on CDROM, ZiP and LS-120 drives.

Examples:
Unlock media
@U0>L0
00, OK,000,000,000,000
Lock media
@U0>L1
00, OK,000,000,000,000
15.4.7 Reading time from RTC

Sending 'T-RA' will read the current time in ascii, 'T-RB' in BCD, while 'T-RD' in decimal.

Table 14 – T-RB and T-RD data format
ByteMeaning
0Day of week: 0=Sunday, 1=Monday...
1Year 00-99, 00=2000, 79=2079, 80=1980, etc.
2Month 1-12, 1=January
3Date 1-31
4Hour 1-12
5Minute 0-59
6Second 0-59
7AM/PM 0=AM, else PM
Example:
Get the current time in human readable form (day of week, month, date, year, hour, min, sec, am/pm)
@T-RA
SAT. 08/07/04 07:42:48 PM
15.4.8 Format disk

Formatting of floppy disks is sometimes necessery to eliminate bad sectors, or just bring the media into a usable format. Formatting changes the physical format, it does not create a filesystem on disk. Use CFSfdisk to create a filesystem!

Note that while formatting the drive is not accessible (this can take more than 30mins), fortunately it's possible to use other devices. And of course HDINIT will break formatting, so try to avoid it.

Table 15 – Disk formats
CodeMeaning
720KDouble density disk with 720KB capacity (LS-120)
1.2MHigh density disk with 1200KB capacity (LS-120)
1.44MHigh density disk with 1440KB capacity (LS-120)
120MSuperDisk with 120MiB capacity (LS-120)
Example:
Format a 1.44MB disk
@N=1.44M
00, OK,000,000,000,000

15.5 Direct access commands

For more see chapter Direct access.

15.5.1 Buffer read
Format: PRINT#<command lfn>,"B=R"; CHR$(<data channel>); CHR$(HEAD); CHR$(CYLINDERBITS8TO15); CHR$(CYLINDERBITS0TO7); CHR$(SECTOR)
15.5.2 Buffer position
Format: PRINT#<command lfn>,"B=P"; CHR$(<data channel>); CHR$(POSITIONBITS0TO7); CHR$(POSITIONBITS8TO15)
15.5.3 Buffer write
Format: PRINT#<command lfn>,"B=W"; CHR$(<data channel>); CHR$(HEAD); CHR$(CYLINDERBITS8TO15); CHR$(CYLINDERBITS0TO7); CHR$(SECTOR)

15.6 Directory handling commands

For more see chapter Using directorys.

15.6.1 Change working dir
Example:
@CD:NEWDIR
00, OK,000,000,000,000
15.6.2 Make dir
Example:
Create the directory called 'NEWDIR'
@MD:NEWDIR
00, OK,000,000,000,000
15.6.3 Remove dir
Example:
Remove the directory called 'OLDDIR'
@RD:OLDDIR
01, FILES SCRATCHED,001,000,000,000


16 Command channel error messages

These are the possible returned error messages on channel #15 with their short descriptions.

00, OK,000,000,000,000
No error since last action.
01, FILES SCRATCHED,xxx,yyy,000,000
xxx+yyy*256 files where deleted.
02, PARTITION SELECTED,xxx,000,000,000
Partition number #xxx was selected.
20, READ ERROR,dp1,dp2,dp3,dp4
Unrecoverable read error. Maybe a defective disk.
dp1,dp2,dp3,dp4 is drive specific address of sector.
21, READ ERROR,dp1,dp2,dp3,dp4
Timeout during read.
22, READ ERROR,dp1,dp2,dp3,dp4
Data block not found, or unformatted media.
23, READ ERROR,dp1,dp2,dp3,dp4
Problem with data checksumm.
25, WRITE ERROR,dp1,dp2,dp3,dp4
Verify error.
26, WRITE PROTECT ON,000,000,000,000
Write protected file/dir/partition/media.
27, ACCESS DENIED,000,000,000,000
Cannot perform operation.
28, WRITE ERROR,dp1,dp2,dp3,dp4
Timeout during write.
29, DISK CHANGED,000,000,000,000
Disk change detected.
30, SYNTAX ERROR,000,000,000,000
Syntax error in command. (something is missing...)
31, UNKNOWN COMMAND,000,000,000,000
Unknown/unimplemented command.
32, SYNTAX ERROR,000,000,000,000
Command buffer overflow.
33, SYNTAX ERROR,000,000,000,000
Illegal character in filename.
34, SYNTAX ERROR,000,000,000,000
Missing filename.
39, PATH NOT FOUND,000,000,000,000
Path not found.
50, SEEK BEYOND END,000,000,000,000
Attempt to seek beyond end of file.
62, FILE NOT FOUND,000,000,000,000
File not found in directory.
63, FILE EXISTS,000,000,000,000
File already exists in dir.
64, FILE TYPE MISMATCH,000,000,000,000
Problems with file's type.
67, ILLEGAL REQUEST,dp1,dp2,dp3,dp4
Sector's address out of range.
70, NO CHANNEL,000,000,000,000
Channel number incorrect for block commands.
71, DIR ERROR,dp1,dp2,dp3,dp4
No directory header found.
72, PARTITION FULL,000,000,000,000
There's no more space left on partition
73, IDE DOS Vx.xx IDE64,000,000,000,000
73, IDE DOS Vx.xx CDROM,000,000,000,000
73, IDE DOS Vx.xx ZIP64,000,000,000,000
73, IDESERV x.xx PCLINK,000,000,000,000
Dos version, and drive type.
74, DRIVE NOT READY,000,000,000,000
No disk in drive.
75, FORMAT ERROR,000,000,000,000
Disk not in known format. Use format command/utility.
77, SELECTED PARTITION ILLEGAL,xxx,000,000,000
Partition number #xxx not found/illegal.


17 Compatibility FAQ

17.1 Commodore serial devices, datassette

Of course they work. Will include 1541 fastloader later.There's also fastload support for 1541, 1570, 1571 and 1581. Datassette supported if kernal supports it.

17.2 SuperCPU

The SCPU IDEDOS expects emulation mode with directpage starting at the 0th byte of bank 0, like normal. The high byte of register A is not preserved during operation. Tested on SCPU64V2 with SuperCPU DOS 2.04.

17.3 RetroReplay, Action Replay, Final cartridge

These hardwares use the same I/O space as the IDE64 cartridge, so they won't work.

17.4 RamLink

Probably does not work on C64, but needs more testing. RL-DOS won't work with IDEDOS if using SCPU.

17.5 CMD HD/FD/etc. (serial)

As these are serial devices they should work. They are supported by the manager too.

17.6 C128

Works in C64 mode. Inits VDC, clears $D02F-$D030. The cartridge is not designed for 2MHz operation, so do not call IDE64 routines in 2MHz mode! C128 keyboard is available if cartridge has cartconfig register and support is compiled in. (Num pad, cursor keys, esc, tab, linefeed are available, help calls monitor, alt and noscroll unused)

17.7 JiffyDOS

It's detected. (tested with v6.01) The built-in DOS Wedge has higher priority, if you want to use the JiffyDOS one then disable it in the CMOS Setup utility!@#<device> does not work with IDE64 drives without DOS Wedge enabled. (but always uses last accessed drive) With DOS Wedge features are missing ;-) JiffyDos fastload is disabled in the SCPU version (meaning 1/3 loading performance on 1541, but still 2x faster than normal)

Loading and saving is accelerated if the drive has JiffyDos, even if there's no JiffyDOS rom installed in the computer (selectable at compile time). If you get sometimes random "?LOAD ERROR"s when loading directory from a JiffyDOS drive, then that's not a bug in IDEDOS. The original JiffyDOS load routine trys to workaround this by retrying IECIN, and this causes an endless loop until STOP is pressed. I prefer getting an error over waiting forever...

17.8 NTSC/PAL

Both works.

17.9 REU

Works, not touched. RamDOS does not work, but if someone is interrested it's possible to support it.

17.10 Second SID

Supported if installed at $D420. (volume 0 is set) This is changeable at compiletime.

17.11 +60K

Works, not touched.

17.12 IEEE-488

Does not work, because the IDE64 cartridge cannot manipulate the EXROM line.

17.13 Turbo 232, Swiftlink

Works.

17.14 Software

Forget about autostarting programs...

17.15 CHS/LBA harddisk

Use LBA formatted harddisks if possible, it's much faster to scratch, check filesystem, etc. because there's no chs→lba→chs translation, which is slow.



18 Updating IDEDOS

[Perom programmer screenshot]

The IDE64 interface cartridge is equiped with 64KiB flash memory (AT29C512) for the firmware. The content of the flash memory is non-volatile and can be changed anytime, so you can always run the latest firmware with the new features and bugfixes.

Updating IDEDOS is very easy and does not require any special electronic knowledge. The cartridge was designed so that it's always possible to update the firmware even if it was messed up, so you can't render your cartridge unusable by interrupted update or wrong firmware.

If you own a SuperCPU you probably change between the 2 versions of IDEDOS depending on the presence of SCPU. Updating firmware everytime when you want to use IDE64 with or without SCPU can be frustrating. By using a 128KiB flash memory (AT29C010) it's possible to change the firmware fast and avoid time vasting updates.

Here's a short guide to updating IDEDOS:

  1. Get the latest Perom programmer and the new firmware and copy both to a serial device. (eg. floppy drive, CMD HD, etc.) If having a XPClink cable it's also possible to use it for update. (and it's much faster)
  2. Plug your cartridge into the expansion port when the computer is turned off (if not already done so). SCPU does not disturb the process, it even speeds up the update (JiffyDOS and 20Mhz), however if you are having trouble you may remove it. [PGM pins picture]
  3. There are 2 squares near the big Lattice chip and the 8 pin DS1302 called PGM. By connecting these 2 squares on board together you can enable flash update. (use screwdriver) Newer version of the IDE64 cartridge have pins instead of squares, and you have to use a jumper to connect them. (see picture)
  4. Now you can turn on your computer or press reset if it's already on. The green led should blink now, except if you have you SCPU enabled, then it's off. If the led is steady on it means the flash write protect is still enabled, this case retry from the beginning. (it's not easy to connect the 2 squares on older cartridges for the first try...)
  5. The normal C64 screen should appear, the only difference is that there are now only "30719 BYTES FREE". Now you can remove the screwdriver or jumper.
  6. If using a greater then 64KiB flash memory, then select the bank you want to program!
  7. Load the Perom programmer and start it. It should start with the screen shown in the picture. (if using v1.1) Now you may backup your current IDEDOS if you want, and update to the lastest from XPClink or disk. Just select the action with the CRSR keys and hit RETURN. Erasing of perom is not required before programming, so do not select it unless you have reasons to do so!
  8. After selecting one of the update menu items the program will ask for device number and filename. Leaving the filename blank cancels the update. If the program says it cannot find the perom then make sure you removed the jumper! (also it's not recommended using pencil for connecting the squares because the remaining graffit may permanently connect them unless cleand)
  9. If the filename was corect and the PCLink server was running then the programming should start. A box filled with characters will appear on screen each character representing a 128 byte sector of flash memory. During update the writing should progress from the upper left corner towards the bottom right. If finished you get an "Update successfull" message. If hexadecimal numbers appear in the right corner of the screen and you get "Update failed" then it's meaning that you exceeded the typical 10000 rewrites for some sectors, which is very unlikely. (or the flash memory is just failing for some other unknown reason) Also disk errors may interrupt the update, this case get a new disk and retry the update.
  10. Now if ready ("Update successfull") you may leave the program and press reset to start the new firmware. If using older versions of the firmware (before 0.9x) then power cycle the computer!


19 More information

The IDE64 project homepage: http://ide64.org/
The IDE64 Information Portal: http://news.ide64.org/
The IDE64 warez site: http://singularcrew.hu/ide64warez/
The IDEDOS 0.9x page: http://singularcrew.hu/idedos/

Document maintained by:

Kajtár Zsolt
Szigliget
Hóvirág u.15.
8264
Hungary
mail: soci at c64.rulez.org