Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write zeros to Hard Drive.....

Status
Not open for further replies.

emc2kh

MIS
Nov 7, 2004
2
0
0
US
I am a newcomer to assembly language. I just wanted to know how difficult it would be to write a small utility that writes zeros to my slave hard drive. Would it be too complicated for a "newbee?" Thank you for your time, and any help that can point me in the right direction will be greatly appreciated.

Kory
 
Hi Kory,

It is not difficult at all. My advice is that you start with a basic program in old fashioned Dos and then move forward to the most complicated modern os if you want to do hardware access routines like accessing hard drives.

in dos for example, you have to use int 21h function 15h, wich is the one for sequential write to a file...
a brief example is,

mov ah, 15h
mov dx, offset arch (if you are in 16 bit mode)
mov wordptr ds::dx+oeh, 512 ; this is the size
int 21h
or al, al ; verify statsus
jnz lblerror
...
...
lblerror


my_fcb db 1
db 'myfile' ; name of file
db 'dat' ; extension
db 25 dup (0) ; this is the rest of the file


regards,

Rick
 
If you want direct access, you should read the ATA and/or ATAPI specs. Try reading sectors first, because writing to the wrong drive would cause disaster.

This requires polling or using interrupts. Not exactly noobie stuff. Especially if you've never done interrupts or I/O ports before.

If you do PIO, it's not too bad, but if you do DMA, I'd start with playing waves or raw sound with DMA on your sound card first. Then you can move on to UDMA.


A programmer is a device for converting Coke into software.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top