write disk sector Problem

13/03/2010 - 14:37 von Jens Kallup | Report spam
Hallo,

so hab ein wenig code: http://codepad.org/fPl9Syjo

wie kann man nun einen sector auf 386 PC disk schreiben?
Danke für Hilfe

Jens
 

Lesen sie die antworten

#1 Dirk Wolfgang Glomp
13/03/2010 - 18:04 | Warnen spam
Am Sat, 13 Mar 2010 14:37:00 +0100 schrieb Jens Kallup:

Hallo,

so hab ein wenig code: http://codepad.org/fPl9Syjo



(Ich habe es mir noch nicht angeschaut)

wie kann man nun einen sector auf 386 PC disk schreiben?
Danke für Hilfe

Jens



Ggf. hilft dir dieses Teil(nicht von mir).

Dirk

On 2005-01-05 said:

Hi,
can you please help me I want to read directly from ide hard drive
for example I want to read cylinder = 5 head = 6 sector 56
Thanks for your help.



;
; Read a hard disk sector into our allocated buffer, by
; directly accessing the hard disk at the hardware port level.
;
my_buff db 512 dup 0 ;allocate a storage buffer
;
mov dx,1F6h ;drive and head port
mov al,0A6h ;drive 0, head 6
out dx,al ;send it

mov dx,1F2h ;sector count port
mov al,1 ;read one sector
out dx,al ;send it

mov dx,1F3h ;sector number port
mov al,56 ;read sector 56
out dx,al ;send it

mov dx,1F4h ;cylinder low port
mov al,5 ;cylinder 5
out dx,al ;send it

mov dx,1F5h ;cylinder high port
mov al,0 ;the rest of the cylinder (here, 0)
out dx,al ;send it

mov dx,1F7h ;command port
mov al,20h ;read with retry
out dx,al ;send it

still_going:
in al,dx ;read a byte
test al,8 ;are we ready to proceed yet?
jz still_going ;no, so go again
mov cx,512/2 ;one sector (512 bytes/2 = 256 words)
mov di,offset my_buff ;point DI to our local storage buffer
mov dx,1F0h ;data port - data comes in and out here

more:
in ax,dx ;read a word from the port
mov [di],al ;store first byte in our local buffer
inc di ;bump the buffer pointer
mov [di],ah ;store second byte in our local buffer
inc di ;bump the buffer pointer
loop more ;go again if CX > 0
...
...
[ your code here ]
...
... _____
((( `\
This code is, of course, _ _`\ )
for DOS. (^ ) )
~-( )
If you're programming for _'((,,,)))
WinDoze, I can't help you. ,-' \_/ `\
( , |
You'll probably have to call `-.-'`-.-'/|_|
some wacky WinDoze API function, \ / | |
like ReadRawHardDiskSector4Me. =()=: / ,' aa
Hehehe!

Ähnliche fragen