| HDD GURU FORUMS http://forum.hddguru.com/ |
|
| how to write a base program to send ATA command in dos http://forum.hddguru.com/viewtopic.php?f=7&t=6498 |
Page 1 of 1 |
| Author: | danrevella [ December 4th, 2006, 9:00 ] |
| Post subject: | how to write a base program to send ATA command in dos |
Hi! some of you who have just read my precedent post may think I'm a little crazy with my mania about writing bad sector unc on hd.... I understand btw, after have saved 4 hd with this "makebad" technique, I wanna go over............ I would like to write a program that send directelly ata command to the hd, in a dos environment.... with purpose of intentionally writing UNC sector. Looking on http://www.t13.org/ I only found the command I have to send to the I/O port, instead I would like a scheletal program in C or in Assembly who may teach me how to implement it. Any help please? Any "strong" help please: it's about 25 years I no longer programming..... and I have fear that my death will arrive before I'll be able in writing this (in)utility...... BYE |
|
| Author: | quasimodo [ December 4th, 2006, 13:27 ] |
| Post subject: | |
I also want to write some utility to send ATA commands directly to the controller. I found this: http://ata-atapi.com/products.htm also at the end of this article there is a link to some Assembler code which you can take a look at. http://polya.computing.dcu.ie/wiki/inde ... rnal_Links Happy coding |
|
| Author: | Sfor [ December 17th, 2006, 18:16 ] |
| Post subject: | |
Hard drive controller is available through CPU I/O ports. All available commands and the reigisters used to program HDD controller are described in ATA specification. The biggest problem will be converting the address of the particular sector to proper register values, I think. The addressing rules are different for CHS and LBA addressing. I've been doing some direct controller programming. Yet, I never found to be necesary writing those sectors from own program. I've been using disk editor utilities to write to particular UNC sectors, instead. |
|
| Author: | danrevella [ December 18th, 2006, 4:26 ] |
| Post subject: | |
Sfor wrote: I've been doing some direct controller programming. Yet, I never found to be necesary writing those sectors from own program. I've been using disk editor utilities to write to particular UNC sectors, instead.
Uhm..... what disk sector utilities is able to write UNC? Thanks |
|
| Author: | Sfor [ December 18th, 2006, 8:16 ] |
| Post subject: | |
Norton Disk Editor is just one of them. It can access physical sectors of a disk drive. But, since it is a very old software designed to work with CHS it does not work perfectly with the high capacity disk drives. Yet, I managed to get rid of a few UNC sectors, that way. To speak the truth, the disk done the hard job itself relocating the sector, I just had to persuade it the particular sector is realy damaged. In some cases the standard procedure does not work perfectly, and the drive does not want to relocate a particular sector. I think the procedure does not believe the sector is damaged enough for the sector to be moved. So, pesuading it the sector does not work well can take a few read write cycles. The DOS format procedure is quite effective in those cases, as it is trying to recover damaged clusters by multiple read write cycles. |
|
| Author: | danrevella [ December 18th, 2006, 9:28 ] |
| Post subject: | |
Hi!! I have understand the concept: you let that the hd itself does execute relocation, and we have to try to convince it that a particular sector is bad performing on it multiple read/write operations. Ok!! This works great generally, but not always( at least for me... I had an hd maxtor 80gb where the smart relocate raw parameter is 1172 (normally must not be over 50!!!), well no bad sector on it, but only weak /red and brown ) sectors: no relocation is now possible, in this case my utilty works great manually marking as UNC al these weak sectors, then a full format under window will give me bad sector running chkdsk, btw now the disk is really stable and I no longer experiment slowdown and freeze.... Of course with Pc300 I may solve the situation, but makebad is for people who do not own Pc300...... CYA!! |
|
| Author: | Sfor [ December 18th, 2006, 12:48 ] |
| Post subject: | |
Oh. You want to set the sector as bad, so the OS will stop from using it. This means, I misunerstood you completely. In such a case using direct disk access is a complicated task. Because OS is using a completely different addressing system. It would be much simpler to do it from DOS level. In other case it would be necesary to analyze the partition table and calculate between logical cluster number - logical sector number - physical sector number - physical sector address. I never had a heart for those calculations. |
|
| Author: | danrevella [ December 19th, 2006, 6:16 ] |
| Post subject: | |
No, no........ Was me that was no clear: my english is terrible..... but what can I do? I'm too old now to study english.... I mean the follows: I HAVE NOT GOT PC3000!!! I have an hd whose g/list is full so is unable in relocate anymore, so: 1) backup my data 2) low level format it 3) run a scansion (F4) with mhdd or victoria 4) take note of ALL lba warnings (access >500ms) 5) use "inside" mhdd the command "makebad" to manually mark as UNC all these defective sectors 6) come back to window 7) perform a re-partition and a FULL (no fast) format My utility is able in automatizing pass from 1) to 5) maybe you wanna give a try: http://files.hddguru.com/index.php?&dir ... ft/Makebad CYA |
|
| Author: | Sfor [ December 19th, 2006, 6:41 ] |
| Post subject: | |
I got the picture, now. I'm not sure if marking bad clusters by the same utility is a good idea. The all in one system would require to repartition and then to reformat partitions from the utility. Unless a script solution would satisfy your needs. It will be difficult to repartition the drive with what DOS provides. But, automatical format from a batch is possible, I think. |
|
| Author: | Sfor [ December 19th, 2006, 6:58 ] |
| Post subject: | |
Wait a minute.... Repartitioning is not necesary. The program can store the partition table sector while doing the drive cleaning. Then it can write it back to the drive. Only system format remains in such a case. |
|
| Author: | danrevella [ December 19th, 2006, 7:10 ] |
| Post subject: | |
yeah, of course a re-partioning is NOT necessary, only a FULL format, or even worse: chkdsk /f /r may be enough.... BTW, please go and read if you've time my last post here: http://forum.hddguru.com/are-you-hddgur ... t6544.html See you later... |
|
| Author: | aimtrading [ January 15th, 2007, 11:28 ] |
| Post subject: | |
Hi, This was the tutorial that actually helped me to send ATA commands: http://www.geocities.com/SiliconValley/2072/atapi.htm It's pretty straight forward and after reading it, you'll have no difficulties sending ATA commands. However, I now want to send ATA commands to a SATA device and don't know how to do that. If anybody has info on that, that would be much appreciated ! |
|
| Author: | aimtrading [ January 19th, 2007, 19:19 ] |
| Post subject: | |
If you're going to write more than 1 sector to a device with the 0x30 ATA cmd, then make SURE that you poll the status register for NBSY after each sector. I found out the hard way that it's needed |
|
| Author: | sreevidya [ March 18th, 2013, 8:11 ] |
| Post subject: | Re: how to write a base program to send ATA command in dos |
Can any one send me the C/C++ code for writing sector to the device with 0x30 ATA cmd! Thanks in advance. |
|
| Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|