Hard disk interfacing

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Hard disk interfacing

Postby CopperCAT » Wed May 28, 2008 6:02 pm

Actually i'm searching for some information on how hard disk drivers for the atari work. At this point I don't even have a clue how a "driver" "registers" itself so a storage device can be accessed from z.b. the desktop.
I can't find anything on the web, partly because I don't know which keywords I should be looking for. Also, source code for Atari hardware projects seems to be very sparse. Could someone provide me with some links or clues, or even some example code?
CopperCAT
Atari freak
Atari freak
 
Posts: 71
Joined: Wed May 31, 2006 9:54 pm
Location: Belgium

Re: Hard disk interfacing

Postby sqward » Wed May 28, 2008 7:30 pm

I'm not sure how it works at the lowest levels of TOS, but if you're using a modern driver like HDDRIVER or HUSI (not sure about that one thou), you can use XHDI to interface a harddrive to the system, take a look here: http://toshyp.atari.org/010008.htm
User avatar
sqward
Retro freak
Retro freak
 
Posts: 11
Joined: Wed Mar 12, 2008 4:47 pm
Location: London

Re: Hard disk interfacing

Postby CopperCAT » Wed May 28, 2008 8:10 pm

sqward wrote:I'm not sure how it works at the lowest levels of TOS, but if you're using a modern driver like HDDRIVER or HUSI (not sure about that one thou), you can use XHDI to interface a harddrive to the system, take a look here: http://toshyp.atari.org/010008.htm


I believe you mean HUSHI.
Yeah, I also stumbled on that page, but it seems more like a reference when you already understand how it works :)
What I want to know is goes like this:
Imagine I'm making some custom IDE/SD/whatever interface for the ST, how do I make the system "see" the device and interact with it like it would do with a standard ASCI or SCSI drive.
CopperCAT
Atari freak
Atari freak
 
Posts: 71
Joined: Wed May 31, 2006 9:54 pm
Location: Belgium

Re: Hard disk interfacing

Postby sqward » Wed May 28, 2008 8:21 pm

If it's not compatible with atari IDE mapping then you need to change TOS rom to include your custom XHDI driver, and then boot a with your device bootsector reading a HDDRIVER or HUSHI so it can make use of your driver. At least I would do that ;)
User avatar
sqward
Retro freak
Retro freak
 
Posts: 11
Joined: Wed Mar 12, 2008 4:47 pm
Location: London

Re: Hard disk interfacing

Postby Jookie » Thu May 29, 2008 7:01 am

CopperCAT, I'm not shure what exactly are you doing or what you try to find out - if you would supply more info of what are you trying to achieve, we could supply more info on how to achieve that ;)

If you want to make some sort of hard disk driver and you want that you can access the drive from desktop, you should:
- save the current addresses of mediach, rwabs and getbpb vectors
- replace those vectors with pointers to your device driver
- in that driver you should jump to the original vector when the request for some action arrives and it's not for your device
- modify (add bits) the flags which tell the system which drives are present (A, C, D, ...)

And that's mainly it. If you would like to make your device driver XHDI compatible, you should check the XHDI documentation.

If you are making a device which acts like a ACSI or SCSI drive, then you should just answer to standart SCSI-2 commands over the ACSI interface.

Jookie
User avatar
Jookie
Hardware Guru
Hardware Guru
 
Posts: 556
Joined: Wed Feb 04, 2004 6:54 pm
Location: Kosice, Slovakia

Re: Hard disk interfacing

Postby CopperCAT » Thu May 29, 2008 7:41 am

Jookie wrote:CopperCAT, I'm not shure what exactly are you doing or what you try to find out - if you would supply more info of what are you trying to achieve, we could supply more info on how to achieve that ;)

If you want to make some sort of hard disk driver and you want that you can access the drive from desktop, you should:
- save the current addresses of mediach, rwabs and getbpb vectors
- replace those vectors with pointers to your device driver
- in that driver you should jump to the original vector when the request for some action arrives and it's not for your device
- modify (add bits) the flags which tell the system which drives are present (A, C, D, ...)

And that's mainly it. If you would like to make your device driver XHDI compatible, you should check the XHDI documentation.

If you are making a device which acts like a ACSI or SCSI drive, then you should just answer to standart SCSI-2 commands over the ACSI interface.

Jookie


That makes sense :) Is that also the way the AHDI prg works?

I had the idea of trying to build a harddrive addon for my Mega. On the hardware side, I have some knowledge of FPGA's and the like. But I don't know what I should do for the software side. It's a complete unknown for me :)
Is this kind of information in the Profi-buch?
CopperCAT
Atari freak
Atari freak
 
Posts: 71
Joined: Wed May 31, 2006 9:54 pm
Location: Belgium

Re: Hard disk interfacing

Postby Jookie » Thu May 29, 2008 7:54 am

CopperCAT wrote:That makes sense :) Is that also the way the AHDI prg works?


I don't know exactly, but it should be something like that ;) I did a RAM disk on ST that way and it worked OK.

CopperCAT wrote:I had the idea of trying to build a harddrive addon for my Mega.


If you would build that harddrive addon and if it would answer as normal ACSI drive (or SCSI drive via ACSI-to-SCSI host adapter) to commands, you don't need to solve the ST driver as it would work with almost all current hard disk drivers.

I can supply you with more information about this and/or you can read my C and Verilog HDL sources to see how to answer as standart ACSI drive.

CopperCAT wrote:On the hardware side, I have some knowledge of FPGA's and the like.


Good! Atari community needs people like you! ;)

CopperCAT wrote:Is this kind of information in the Profi-buch?


As far as I remember the Profi Buch does not cover topics like creating a hard disk driver, but it covers the ACSI communication on the HW level and also some SCSI commands which are used over the ACSI interface. It's one of the sources I used...

Jookie
User avatar
Jookie
Hardware Guru
Hardware Guru
 
Posts: 556
Joined: Wed Feb 04, 2004 6:54 pm
Location: Kosice, Slovakia

Re: Hard disk interfacing

Postby ppera » Thu May 29, 2008 8:40 am

Writing hard disk driver is not so simple. However, there is some documentation on WEB. For instance sources for all versions of official Atari driver - AHDI. It is not fastest, and is obsolete. Hushi is obsolete too. Only one from popular ones, updated still is Hddriver.

XHDI is made with some big ambitions, but is I see, it is barely used - practically only Mint uses it. I added XHDI support for my hard disk drivers, what was big work (in assembler), however, don't see that it was a worth of effort. Do it only when everything works fine, and you have too much free time :D

What knowledge is necessary? Knowing BIOS, XBIOS, GEMDOS functions, system variables, way how HW ports work - ACSI, IDE ports. Plus must know disk Master Boot Record structure, partition tables, partition types as FAT16, BIGDOS, AHDI etc.
There is lot of documentation about mentined on WEB.

One note: ACSI uses only SCSI group 1 commands (6-byte R/W commands). Therefore is limit of 1GB capacity. More is possible, but many ACSI-SCSI adapters are unable to work with 10-byte SCSI commands. As adapter in Mega STE, early ICD adapters...
ppera
 

Re: Hard disk interfacing

Postby Jookie » Thu May 29, 2008 10:12 am

ppera wrote:What knowledge is necessary? Knowing BIOS, XBIOS, GEMDOS functions, system variables, way how HW ports work - ACSI, IDE ports. Plus must know disk Master Boot Record structure, partition tables, partition types as FAT16, BIGDOS, AHDI etc.
There is lot of documentation about mentined on WEB.


My opinion is that if you don't want do extend some TOS features (no additional support for DOS partitions, ...) and you want to just make support for one specific device in your hard disk driver (for one exact device which you develop), you might save a lot of work and don't need to know so much about XBIOS, GEMDOS, etc.. But if you would like to make a universal hard disk driver (supporting all Atari hard disk interfaces and supporting most of the devices), I agree that it might require a lot of work.

Jookie
User avatar
Jookie
Hardware Guru
Hardware Guru
 
Posts: 556
Joined: Wed Feb 04, 2004 6:54 pm
Location: Kosice, Slovakia

Re: Hard disk interfacing

Postby ppera » Thu May 29, 2008 10:25 am

Maybe I should be more specific: need to know some basic things about BIOS, XBIOS, GEMDOS calls - since they are used in almost every program, so in hard disk driver too.
Supporting most of devices is not lot of work - it is loooot of work and looot of money, time required. You can't do working driver by just reading specs. You need to test it on real hardware.
Additional support for DOS partitions is already made in several forms. It stays mostly from recognising partitions from part. table and transferring parameters into BPB tables. Actually, it is nothing harder than doing support for AHDI partitioned disks.
ppera
 

Re: Hard disk interfacing

Postby CopperCAT » Thu May 29, 2008 11:14 am

ppera wrote:Maybe I should be more specific: need to know some basic things about BIOS, XBIOS, GEMDOS calls - since they are used in almost every program, so in hard disk driver too.
Supporting most of devices is not lot of work - it is loooot of work and looot of money, time required. You can't do working driver by just reading specs. You need to test it on real hardware.
Additional support for DOS partitions is already made in several forms. It stays mostly from recognising partitions from part. table and transferring parameters into BPB tables. Actually, it is nothing harder than doing support for AHDI partitioned disks.


So if i were only to modify AHDI, other software could take care of the partitioning and formatting side of things?

I'm not so good at deciphering asm so that AHDI code will be a challenge :) Is this stuff also possible from C?
CopperCAT
Atari freak
Atari freak
 
Posts: 71
Joined: Wed May 31, 2006 9:54 pm
Location: Belgium

Re: Hard disk interfacing

Postby Jookie » Thu May 29, 2008 11:35 am

CopperCAT wrote:I'm not so good at deciphering asm so that AHDI code will be a challenge :) Is this stuff also possible from C?


There is a simple driver called NOAHDI and it's written in C and the sources are available. It can be found (also) here:
http://www.umich.edu/~archive/atari/Diskutils/

Jookie
User avatar
Jookie
Hardware Guru
Hardware Guru
 
Posts: 556
Joined: Wed Feb 04, 2004 6:54 pm
Location: Kosice, Slovakia

Re: Hard disk interfacing

Postby ppera » Thu May 29, 2008 5:00 pm

CopperCAT wrote:...
So if i were only to modify AHDI, other software could take care of the partitioning and formatting side of things?

I'm not so good at deciphering asm so that AHDI code will be a challenge :) Is this stuff also possible from C?


Driver is simpler than partitioner. At least it is so usually... Btw. I don't think that doing it in C is good idea, It will be slow, maybe not with ACSI, but with IDE certainly.
ppera
 

Re: Hard disk interfacing

Postby DrCoolZic » Sat Sep 13, 2008 2:36 pm

CopperCAT wrote:Actually i'm searching for some information on how hard disk drivers for the atari work. At this point I don't even have a clue how a "driver" "registers" itself so a storage device can be accessed from z.b. the desktop.
I can't find anything on the web, partly because I don't know which keywords I should be looking for. Also, source code for Atari hardware projects seems to be very sparse. Could someone provide me with some links or clues, or even some example code?

Last time I looked at this topic I read the following doc (non limitative):
• Engineering Hardware Specification of the Atari ST Computer System The Atari Corporation - Sunnyvale, California - 7 January 1986
• How To Use The Atari St Hard Disk Port Doug Collinge - School of Music, University of Victoria
• Atari ASCI/DMA Integration Guide – June 28, 1991
• Atari ST/STe/MSTe/TT/F030 Hardware Register Listing Dan Hollis - 1/22/94
• Atari ST Internals - Abacus Software 1985
• Le livre du Developpeur sur Atari ST - Micro Application -1989
• Hitchhiker’s guide to the BIOS – Atari corporation 1985
• Atari ST/Mega – Edition Weka 1991

Most of this information plus much more can be found at: Atari documentation archive http://dev-docs.atariforge.org/
User avatar
DrCoolZic
Atari Super Hero
Atari Super Hero
 
Posts: 653
Joined: Mon Oct 03, 2005 7:03 pm
Location: France

Re: Hard disk interfacing

Postby ppera » Sat Sep 20, 2008 12:48 pm

People forgets that all mentioned documentation is pretty obsolete.
If someone wants to make hard disk driver, partitioner in 2008 he needs to read many up to date docs. And even forget about some obsolete things proposed by Atari in 1985-1991. For instance bad sector list on hard drive or especially CF, SD card is total nonsense and waste. Whole partitioning and formatting should be done different, as old docs are made in era of MFM and RLL drives.
Even Uwe Seimet dropped out some features from new versions of Hddriver.

What I recommend to read is ATA documentation, SCSI, CF - all it has official WEBsites.

There is no up-to date literature how to making it on Atari machines, what is normal.
You need to be good in many things if want to make some decent and modern driver.
ppera
 

Re: Hard disk interfacing

Postby giachi11 » Fri Jan 30, 2009 1:38 pm

So, if i want to build some kind of stuff that acts as an ACSI hdd I should only make my hardware SCSI-1 compliant?
User avatar
giachi11
Atari freak
Atari freak
 
Posts: 61
Joined: Sun Jun 11, 2006 1:50 pm

Re: Hard disk interfacing

Postby ppera » Fri Jan 30, 2009 3:35 pm

giachi11 wrote:So, if i want to build some kind of stuff that acts as an ACSI hdd I should only make my hardware SCSI-1 compliant?


It is the simpler way. But then you will be limited on 1GB space. Better make little more complicated adapter, and will be able to access complete modern hard disks. Example: Ultra Satan - uses ICD protocol to override 1GB limit.
ppera
 

Re: Hard disk interfacing

Postby giachi11 » Fri Jan 30, 2009 4:33 pm

thanks for the explanation ppera :). I've another question: my goal is to build a simple device that acts as an hdd, quite like a "ACSI thumbdrive", with a very simple design (maybe a little flash nand with a PIC uC as controller), not targeted to be a very fast very large storage device, it will be only an experiment. I'm reading the Atari ACSI/DMA integration guide from atariforge. Is that a good reference (AHDI compatibility is ok for me)?
User avatar
giachi11
Atari freak
Atari freak
 
Posts: 61
Joined: Sun Jun 11, 2006 1:50 pm

Re: Hard disk interfacing

Postby ppera » Fri Jan 30, 2009 4:51 pm

giachi11 wrote:thanks for the explanation ppera :). I've another question: my goal is to build a simple device that acts as an hdd, quite like a "ACSI thumbdrive", with a very simple design (maybe a little flash nand with a PIC uC as controller), not targeted to be a very fast very large storage device, it will be only an experiment. I'm reading the Atari ACSI/DMA integration guide from atariforge. Is that a good reference (AHDI compatibility is ok for me)?


Interesting... I thought too about using some flash nand (from Pen drive for instance) connected to Atari without USB. So for only thought :D
Atari ACSI/DMA DOC is good. What is relevant is HW part. But maybe whole thing can be done simpler and better without using DMA in Atari, but connecting to CPUs bus directly (as IDE adapters do). What is data bit count on your Nand Flash ? (How wide is data bus in other words ?) .
ppera
 

Re: Hard disk interfacing

Postby giachi11 » Fri Jan 30, 2009 5:23 pm

I' ve still to decide which Nand i'll use (maybe i'll use a small backed up sram for early tests), anyway i'm going to adpot a 8bit wide databus IC. Solder directly some spaghetti of wire all around the ST mainboard can make me achieve a faster transfer rate, but i want to use the acsi to avoid this (the spaghetti's). I want a simple and easy to use thing, also if slower :)
User avatar
giachi11
Atari freak
Atari freak
 
Posts: 61
Joined: Sun Jun 11, 2006 1:50 pm

Re: Hard disk interfacing

Postby ppera » Fri Jan 30, 2009 5:37 pm

Programming ACSI is not simpler, just to mention. Yes, it is the problem that in Ataris you have no expansion connector, so must to 'spaghettize' little for doing some HW add-ons :D
I'm waiting on your results .... :D
ppera
 

Re: Hard disk interfacing

Postby giachi11 » Fri Jan 30, 2009 5:47 pm

just another question (if there will be more questions, i'll PM you). Is any version of AHDI good for testing or there is a best one?
thanks
User avatar
giachi11
Atari freak
Atari freak
 
Posts: 61
Joined: Sun Jun 11, 2006 1:50 pm

Re: Hard disk interfacing

Postby ppera » Sat Jan 31, 2009 10:46 am

I guess that latest is the best... But really not used AHDI much. I saw in sources that they done some limitations because of higher compatibility (therefore lower speed). Probably just good for testing purposes.
However, I must say that if you want to do some disk initialization (partitioning, formatting) better forget it. It will very likely not work, as it is made in era of MFM hard disks. Today things go pretty different.
What you should do at beginning is checking of disk recognition and some simple sector transfers at BIOS level.
ppera
 


Return to Coding

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests