IDE HARDDRIVE/CDROM CONTROLLER (IDE64)

for
Commodore 64/128

Attention: Names, technologies and standards used in this document may be protected by author's rights or patents.

Contents
INTRODUCTION TO IDE64 CARTRIDGE ......
INSTALLATION ......
SETUP ......
IDE64 BASIC EXTENSIONS ......
IDE KERNAL EXTENSIONS ......
FILE MANAGER ......
HARDDRIVE MONITOR ......
MACHINE CODE MONITOR ......
APPENDIX A ......
APPENDIX B ......

IDE64 CARTRIDGE:

The IDE64 cartridge is a device for connecting IDE harddisks and ATAPI CDROM drives to a C64. It's plugged into the Expansion Port and connected to ATA(PI) devices by a 40 wire cable. The IDE64 cartridge contains a 64kB PEROM (flash EPROM, with IDEDOS, Machine Code Monitor, File Manager and Setup), a 28kB RAM (used for internal buffers), a realtime clock chip (powered by a battery), two LEDs (to indicate the presence of the cartrige and HDD activity), a Short-BUS for peripherals (like DUART Card) and an ispLSI chip.

INSTALLATION:

If you receive the unassembled controller, use the diagram when constructing IDE64. Work carefully when soldering CMOS components. If you think you're talented enough, you can fit the cartridge inside a C64C under the keyboard, connecting it with ribbon cables to expansion port. The IDE cable has the same size as the tape port, so let's pass though it that cable. Take care about not to damage the ribbon cables placed under the mainboard by it's pins! Drill some nice holes for the HDD activity leds and reset button where you think they look best. Short bus has also the same size as the tape port, and if you don't own/won't use such device then it's the right place for it, with a nice long cable. (it's not mandatory to build the short bus) Don't solder the short bus slot on the cartridge board, if you want to fit it under the keyboard! (the mainboard expansion slot is free, because we soldered the ribbon cables directly under the mainboard to it's pins, and the short bus is at the tape port...) Forget to say that there's also no space for the battery holder on the solderside of the cartridge, place this somewhere else, you can also replace it with two AAA size 1.5V longlife batterys for military usage ;-)
If you're a lucky owner of a low power 2.5" laptop HDD then it's worth to mention that it's so small that it also fits under the keyboard with the IDE64 cartridge, and no additional power supply is needed. (Next project is a laptop CDROM inside the case, if I can get my hands on one) For more informations about integrating the IDE64 cartridge mail Soci/Singular. And don't forget to create a 'Powered by IDE64' sticker ;-)

Install for avarage users:
Before pluging the IDE cartridge into the expansion port turn off your C64. Connect your ATA(PI) devices (harddisk/cdrom) with the cartridge using a 40 wire cable aligning pin 1 of the cartridge with pin 1 of the drive(s) (pin 1 on cartridge is on the upper right hand side near RESET button. The red line indicates pin 1 on the cable, and on most devices pin1 is near to their powersupply connector or is labelled). Make sure that the drive(s) are correctly configured. If you are using only one device, jumper it to single/master mode. If you are using two devices, jumper the first one to master and second one to slave. Connect the drive(s) to the power supply and then turn on C64 and external device(s). (Hopefully you got an AT power supply with a power switch.) Wait until READY appears on the screen. (can take some time with a CDROM...) Before using hard disk drives the first time you must format them. Load the program IDEformat and type RUN. Follow the instructions given in the program. After the hard disk drive is formatted RESET the C64 and type HDINIT (one device) or HDINIT1 (two devices). CDROMs are ready to use if inserted CDs are in ISO9660/Joliet format. (all CDs are in these formats ;-) )

"IDE64 rescue disks" can be requested when buying the cartridge or needed programs can be downloaded from this page or from The IDE64 Warez site.

SETUP:

The setup utility is contained in the ROM of the IDE controller. Start it by typing '<-' together with the RESTORE key. The setup consists of 2 sections: the Standard Setup and the Advanced Setup. Use CRSR and return. Use Run/Stop to come back to the main menu.

Standard Setup:

In Standard Setup you can change logical device numbers, screen colors, floppyspeeder and set the real time clock.

Advanced Setup:

The Advanced Setup lets change drive specific features, like power management, error retry, write cache, look-ahead, and CDROM speed control on per drive basis. Don't forget that these settings won't take affect until a HDINIT(1) or powerup!

Restore defaults:

Save & exit:

Discard & exit:

IDE64 BASIC EXTENSIONS:

IDE64 also has some usefull Basic extensions to make basic programmers life easier. Most of this functions are accessible to ML programmers useing channel 15 commands. See programming manual!

HDINIT

Initialize the internal variables and buffers of the harddrive (command is executed automaticaly, after turning-on the computer).
If the harddrive was turned-on later than the computer, it is necessary to use this command before using it!
This command disables slave device, even if that exists!

Syntax:

HDINIT

Example:

HDINIT

1 HDD DETECTED
READY.

HDINIT1

Same as HDINIT, but for two devices.

Syntax:

HDINIT1

Example:

HDINIT1

1 HDD, 1 CDROM DETECTED
READY.

CD

Change current path.
If the device number is missing, current device number is used. (This rule is valid for other commands too.)

Syntax:

CD "/"
or
CD "/BIN"
or
CD "/BIN/DATA",12

Example:

CD"A

HD FOUND A
READY.

LL

List of current/selected directory in UNIX format.

Syntax:

LL or
LL "/"
or
LL "/GAMES",12

Meaning of output:

D = Directory
- = file
X = eXecuteable
U = User
- = other
T = proTected
- = normal
* = splat
Size in bytes/Kbytes Closed at Filename

Example:

LL"/

HD FOUND /
DXT     0 JUL 13 19:39 .
DX-     0 JUL 13 19:52 PLUGINS
-X-  9941 DEC  3  1999 BOOT
-X-  170K JUL 14 11:50 TEST.D64

READY.

DIR

List of current/selected directory in C64 format.

Syntax:

DIR
or
DIR "",12

Example:

DIR"/

HD FOUND /
0 ".                " IDE64
0    "PLUGINS"           DIR
39   "BOOT"              PRG
684  "TEST.D64"          PRG
723 BLOCKS FULL.

READY.

MKDIR

Creates directory in current path or in selected existing path.

Syntax:

MKDIR "DIRECTORY"
or
MKDIR "/BIN/UTIL/DIR1",12 - means create directory "DIR1" in the existing "/BIN/UTIL" path.

Example:

MKDIR"A

DIRECTORY CREATED
READY.
Note: file or directory name can't handle "/"-character, because "/" means pathname.

RM

Deletes (removes) file or empty directory in current or selected path.

Syntax:

RM "DIRECTORY"
or
RM "DIRECTORY/FILE",12

Example:

RM"A

FILE/DIR DELETED
READY.

CHANGE

Changes device number between harddrive and floppy drive (HDD will be device number 8, floppy drive no. 12).
Use HDINIT(1) command or reset for change back.
Command CHANGE1 works similarily for second harddrive, if any. 13 <-> 8.

Syntax:

CHANGE
or
CHANGE1

Example:

CHANGE

READY.

DATE

Prints current date and time from external time chip to screen.

Syntax:

DATE

Example:

DATE
MON JUL 17 14:32:43 2000

READY.

MAN

Starts the File Manager (program is placed in external ROM).

Syntax:

MAN


CDOPEN

Opens cdrom's tray.

Syntax:

CDOPEN <device number>

Example:

CDOPEN 13

READY.

CDCLOSE

Closes cdrom's tray.

Syntax:

CDCLOSE <device number>

Example:

CDCLOSE 13

READY.

KILL

Deactivates the cartridge, and shuts down HDDs if power management enabled. Use "RESET" button for unkill.

Syntax:

KILL

Example:

KILL

READY.

INIT

Clears memory, and performs a reset.

Syntax:

INIT

Example:

    **** COMMODORE 64 BASIC V2 ****
    
 64K RAM SYSTEM  IDE-DOS VX.XX EXPANDED
 
READY.

LOAD

Loads the program START into memory at original address from path /GAMES/ELVIRA. (LOAD can load programs up to $FFFF from HDD and FDD if floppy speeder enabled)

Syntax:

LOAD "/GAMES/ELVIRA/START",12,1

Example:

LOAD"/UTILITIES/IDE TASM",12,1

HD FOUND /
HD FOUND UTILITIES
HD FOUND IDE TASM
LOADING FROM $9000 - $CF00
READY.

SAVE

Saves file BASIC-PROGRAM to harddrive on current path

Syntax:

SAVE "BASIC-PROGRAM",12

Example:

SAVE"/WORK/PART2",12

HD FOUND /
HD FOUND WORK
READY.

IDE KERNAL EXTENSIONS:

Kernel of C-64 was extended with these fast calls:
$DEF4 - READ (read part of file and store to memory); preceed with OPEN and CHKIN
$DEF1 - WRITE (write part of memory to harddrive); preceed with OPEN and CHKOUT

READ

Input: register X,Y - LOW/HI maximum number of bytes to read; register A - pointer (to zeropage) to startadress of the buffer.

Output: register X,Y - LOW/HI number of bytes read in; $90 - status.

This call is faster than byte by byte (CHRIN/GETIN) reading when more than 10 bytes need to be read. At $D000-$DFFF it writes to I/O area.

WRITE

Input: register X,Y - LOW/HI length of data to be written in bytes; register A - pointer (to zeropage) to startadress of buffer.

Example

Warning: This functions can't access ram in memory area $D000-$DFFF, only the I/O area! To be able to access the ram at $A000-$BFFF and $E000-$FFFF set the processor ports $00/$01 correctly.


FILE MANAGER:

The 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 typeing command MAN.

To move between windows press CTRL, to select device number press C=.

F1/CRSR LEFT- page up
F2/HOME- home
F7/CRSR RIGHT- page down
F8/CLR- end
CRSR UP/DOWN- move cursor
+- select all (only files)
-- unselect all (only files)
INS/DEL- select some files
1- reread directory
3- view file using "/VIEWER"
5- copy (single file names may be changed)
6- rename file/directorys
7- create directory
8- delete (only files or empty directory)
RETURN- change directory or load+start program or view file with plugin
SHIFT + RETURN- change directory or load program
/- go to root directory (extremly usefull with an 1581 ;-) )
^- open/close CDROM tray. (operates on the current panel's drive)
<-- quit manager

File Manager can associate different applications (manager 'plugins') with different file name patterns. This feature allows you to view the Art Studio or FLI pictures just by pressing RETURN, for example.
Don't forget that this patterns are case sensitive. (Not a bad idea to have the patterns in uppercase too, so you won't be suprised if you'll try to view something from an old, non-joliet CD, where everything is in uppercase ;-) ) Download Manager plugins.

Install the "CONFIG EXT" file (containing file name pattern associations) into the 'root' directory of the primary harddrive.

;Example CONFIG EXT file

".shi:/Plugins/shi viewer"           ; SuperHiresInterlace viewer
"mpic:/Plugins/mpic viewer"          ; Art Studio v1.2b viewer
".mpi:/Plugins/mpic viewer"          ; Art Studio v1.2b viewer
" pic:/Plugins/hpic viewer"          ; Art Studio v1.1 viewer
".hpi:/Plugins/hpic viewer"          ; Art Studio v1.2b viewer
".drl:/Plugins/drl viewer"           ; Drazlace viewer
".drp:/Plugins/drp viewer"           ; DrazPaint viewer
".fun:/Plugins/fun viewer"           ; Funpaint II viewer
".ifl:/Plugins/ifl viewer"           ; Gunpaint viewer
".afl:/Plugins/afl viewer"           ; Afli-editor viewer
".fli:/Plugins/fli viewer"           ; Flidesigner viewer
".sid:/Plugins/sid player"           ; HVSID player
".d64:/Plugins/d64 writer"           ; ID64 writer
"flii:/Plugins/flii viewer"          ; FLI interlace viewer
Creating of such file, the easy way:
10 OPEN 4,12,4,"/CONFIG EXT,P,W"
20 PRINT#4,CHR$(34)+".SID:/PLUGINS/SID PLAYER"+CHR$(34)
....
100 CLOSE 4

HARDDRIVE MONITOR:

IDE harddrive monitor is utility for reading/editing/writting the sectors on HDD. May be used for simply repair of directory structure or files.

Controls with simple commands:

I - identify drive
R - read sector (cylinder,head and sector number)
W - write sector (cylinder, head and sector number)
N - follow file linking and load next sector
+ - load next sector
- - load previous sector
E - edit sector (back with RUN/STOP)
C - change drive (primary or secondary, if exist)
F - format harddrive (obsolete type) -use IDEformat instead.


Machine Code Monitor:

Program for reading and editing memory and registers, and for writing and debugging simple programs in ML. Works in external ROM, C64 RAM used only if necessary and very carefully. This program starts by pressing 'C=' key and 'RESTORE' or by instruction BRK.

Standard monitor header:

   PC  IRQ  DR BK AC XR YR SP NV#BDIZC
.;AAFA EA31 0D 07 7A 00 EB E8 ..**.*.*
C- Carry flag
Z- Zero flag
I- Interrupt flag
D- Decimal flag
B- Break flag
#- don't care
V- oVerflow flag
N- Negative flag
SP- Stack Pointer
YR- Y Register
XR- X Register
AC- ACcumulator
BK- BanK switch
DR- DRive number
IRQ- IRQ vector
PC- Program Counter

xxxx- means start address in hex
yyyy- means end address in hex
zzzz- means new start address in hex
hh- means byte value
dn- means device number in hex
"filename"- means filename in text
"disccommand"- means string of disk command
()- means optional parameters


A - Assemble

Description: Assemble instruction to memory

Syntax: A xxxx instruction


C - Compare

Description: Compare two memory area and print diferences

Syntax: C xxxx,yyyy,zzzz


M - Memory list

Description: Memory list in hex and ascii format

Syntax: M xxxx(,yyyy)


D - Disassemble

Description: Disassemble memory

Syntax: D xxxx(,yyyy)


T - Transfer

Description: Transfer memory area to new place

Syntax: T xxxx,yyyy,zzzz


G - Go to

Description: Start program at address xxxx

Syntax: G (xxxx)

Note: When starting address is not entered, program will start at address, contained in PC.


I - Ascii

Description: Memory list in ASCII format.

Syntax: I xxxx(,yyyy)


O, B - memory switch

Description: Switch memory at $01

Syntax: O4 - only RAM

OD - switch to DD


L - LOAD

Description: Loads file to RAM. When starting address is not present, monitor loads file at address in first two bytes of file.

Syntax: L "filename",dn(,xxxx)


S - SAVE

Description: Save memory between $xxxx and $yyyy to file "filename". First bytes of file contain starting address.

Syntax: S "filename",dn,xxxx,yyyy
Example: S "DUMP",0C,1000,2000
Saves file "DUMP" (from $1000 to $1FFF) to device number 12 (harddrive)


X - Exit

Description: Exits monitor

Syntax: X


H - Search

Description: Search in memory for bytes

Syntax: H xxxx,yyyy,hh(,hh(,hh)...)


R - Registers

Description: Prints header

Syntax: R


@ - disk command

Description: Sends command to current device

Syntax: @ "command"

Note: @ without command displays drive status


E - edit

Description: View memory in special format

Syntax: EC xxxx(,yyyy) - edit memory in character format (binary)

ES xxxx(,yyyy) - edit memory in sprite format


F - fill

Description: Fill memory with character

Syntax: F xxxx,yyyy,hh


P - print

Description: Prints screen on printer

Syntax: PM xxxx,yyyy - prints memory area from xxxx to yyyy in M format

PD xxxx,yyyy - prints memory area from xxxx to yyyy in disassembled format


# - convert

Description: Convert from dec to hex. Range of conversion is one byte.

Syntax: #[0-255]


$ - convert

Description: Convert from hex to dec. Range of conversion is one byte.

Syntax: $[0000-ffff]


*r track sector memory - read track from floppy drive

*w track sector memory - write track to floppy drive
Function keys:

F1 - disk command
F3 - move up
F5 - move down
F7 - directory


APPENDIX A

Description of the harddrive Basic error messages

?HD  ERROR
READY.
There is a problem with the IDE harddrive (hardware or configuration problem).

?DISK FULL  ERROR
READY.
The Harddisk drive filesystem is full.

?LAST DIR SECTOR  ERROR
READY.
The controller detected a sector problem.

?FILE IS NOT DIR  ERROR
READY.
The requested directory name exists on the drive as a standard file name.

?CAN'T LOAD DIR  ERROR
READY.
The requested file name exists on the drive as a directory name.

?WRITE PROTECT  ERROR
READY.
This message is generated when the controller attempts to delete a protected file.

?FILE TYPE  ERROR
READY.
Similar to FILE TYPE MISMATCH

?BAM  ERROR
READY.
The is a problem with BAM (Block Availability Map). To correct this problem, initialize the harddrive or use IDE ScanDisk utility.

?DIR IS NOT EMPTY  ERROR
READY.
Controller cannot delete a directory which is not empty.

?FILE DIR EXIST  ERROR
READY.
The file name or directory already exists on the current path.

APPENDIX B

Meaning of IDEDOS error messages

00, OK,00,00
Everything seems to be ok.

23, READ ERROR,00,00
Media error/device timeout. More common when using buggy CDs.

26, WRITE PROTECT ON,00,00
File/device is write protected.

29, DISK ID MISMATCH,00,00
CD changed in drive.

31, SYNTAX ERROR,00,00
Unknown/not implemented command.

62, FILE NOT FOUND,00,00
File couldn't be found.

63, FILE EXISTS,00,00
File/directory already exists.

64, FILE TYPE MISMATCH,00,00
Tryd to use unknown filetypes/changedir into file.

73, IDE DOS Vx.xx IDE64,00,00
Identify string for harddrive.

73, IDE DOS Vx.xx CDROM,00,00
Identify string for cdrom.

74, DRIVE NOT READY,00,00
No disk in cdrom.

80, HDD ERROR,00,00
Other errors, which don't have a number yet, like dir not empty.

Internet contact

WWW:

http://come.to/ide64
http://singularcrew.hu/ide64warez/

E-mail:

josef.soucek@ct.cz (IDEDOS)
dundera@volny.cz (hardware, manager)
soci@c64.rulez.org (software, cd, warez, IDEDOS etc.)

This document is subject of change, so always get newest version of it to get informed about the latest features.

This manual was created on 2001.Feb.12. with IDEDOS v0.89 in mind.