Page 1 of 1

Powering the hard drive down programatically using bios

Posted: Mon Sep 23, 2002 5:25 pm
by kbeers
My boss has a program (run in DOS) that will send command sequences to the bios. He has asked me to find out how we can shut the power off to a hard drive using this program. Are there any command sequences or interrupts related to this issue that anyone is aware of?

I am familiar with the "park heads" interrupt, but that is specific to a PS/2 system.

Posted: Mon Sep 23, 2002 7:37 pm
by Rainbow
I don't think that there is something like that. However it's easy to communicate with IDE HDDs so you can send the stand-by command. Here is a short code that I did some years ago:

Code: Select all

; E0h = Stand-By
; E1h = Idle
; E2h = Timed Stand-By
; E3h = Timed Idle
; E6h = Sleep
.model tiny
.code
org 100h
start:
       HddSDH1  EQU 01F6h                       ; SDH register
       HddCmd1  EQU 01F7h                       ; Command register
       HddSDH2  EQU 0176h                       ; SDH register
       HddCmd2  EQU 0177h                       ; Command register
       Drive0   EQU 00h                         ; 00=Master, 10=slave
       Drive1   EQU 10h                         ; 00=Master, 10=slave

       MOV AL,Drive0                            ; Drive 0 - master
       MOV DX,HddSDH1                           ; Address of SDH register
       OUT DX,AL                                ; Set the SDH register

       MOV AL,0E0h                              ; Stand-By command
       MOV DX,HDDCMD1                           ; Address of Command register
       OUT DX,AL                                ; Send command

       MOV AL,Drive1                            ; Drive 1 - slave
       MOV DX,HddSDH1                           ; Address of SDH register
       OUT DX,AL                                ; Set the SDH register

       MOV AL,0E0h                              ; Stand-By command
       MOV DX,HDDCMD1                           ; Address of Command register
       OUT DX,AL                                ; Send command

       MOV AL,Drive0                            ; Drive 0 - master
       MOV DX,HddSDH2                           ; Address of SDH register
       OUT DX,AL                                ; Set the SDH register

       MOV AL,0E0h                              ; Stand-By command
       MOV DX,HDDCMD2                           ; Address of Command register
       OUT DX,AL                                ; Send command

       MOV AL,Drive1                            ; Drive 1 - slave
       MOV DX,HddSDH2                           ; Address of SDH register
       OUT DX,AL                                ; Set the SDH register

       MOV AL,0E0h                              ; Stand-By command
       MOV DX,HDDCMD2                           ; Address of Command register
       OUT DX,AL                                ; Send command

       int 20h                                  ; Exit .COM program
end start