Board index » delphi » Hard Drive Light Help Needed

Hard Drive Light Help Needed

I am in High School and am taking a Pascal (7.0) programming class.
I have been working on a couple of various things on my own, and
need a little help.  On a couple of projects, I have needed to be able
to directly access hardware to the extent that I could make the hard drive
light come on without actually accessing a file.  I know there are ways
to do this in assembly, so maybe sticking a couple of lines of in-line
assembly code into it or something.  But, the class has only been going
a couple a months, so I am still kinda illiterate as to some of the finer
aspects of Pascal.  Since I don't think it would be too long, could
someone write it out for me.  Or, if all else fails, just the code for
opening a file and closing it to put in a loop to make the hard drive
flicker a few times.  But, thanks now for any help!

                                Varon

P.S.  And don't forget to tell how to turn it off the light once I have
got it on!!  Thanks!
--

 

Re:Hard Drive Light Help Needed


Quote
Varon Q. Blackburn wrote:

> I am in High School and am taking a Pascal (7.0) programming class.
> I have been working on a couple of various things on my own, and
> need a little help.  On a couple of projects, I have needed to be able
> to directly access hardware to the extent that I could make the hard drive
> light come on without actually accessing a file.  I know there are ways
> to do this in assembly, so maybe sticking a couple of lines of in-line
> assembly code into it or something.  But, the class has only been going
> a couple a months, so I am still kinda illiterate as to some of the finer
> aspects of Pascal.  Since I don't think it would be too long, could
> someone write it out for me.  Or, if all else fails, just the code for
> opening a file and closing it to put in a loop to make the hard drive
> flicker a few times.  But, thanks now for any help!

Hmm, I kind of have to wonder why you'd want such a thing.  I can just see
someone freaking out because a program came up with "formatting hard drive!"
and started blinking the light. . . .  Better to leave well enough alone.  
Besides, if you're creative, you'll find a way to do it without needing to
access the hardware ports.

I suppose it's possible, though I've never tried it.  What I *have* done is a
short program that blinks the lights on the floppy drives by activating and
deactivating the stepper motors.

program flippit;

{
 Flips the floppy lights on and off.  Only tested on 2-drive systems, but
 should work on a 1-drive system.

 Written by Scott Earnest (set...@ix.netcom.com)

 DISCLAIMER:  Standard.  Use at your own risk, and if you do something
 socially, morally, or legally unacceptable with this code, that's your
 fault, not mine.

Quote
}

uses
  crt;

var
  d : byte;

procedure motor_on (drive : byte);

begin
  port[$3f2] := $0c+drive+1 shl (4+drive);
end;

procedure motor_off (drive : byte);

begin
  port[$3f2] := $0c+drive;
end;

begin
  d := 0;
  while keypressed do readkey;
  repeat
    motor_on (d);
    delay (150);
    motor_off (d);
    d := 1-d;
  until keypressed;
  while keypressed do readkey;
end.

Quote
>                                 Varon

> P.S.  And don't forget to tell how to turn it off the light once I have
> got it on!!  Thanks!
> --

--
Scott Earnest                      | _,-""-_,-""-_,-""-_,-""-_,-""-_,-" |
set...@ix.netcom.com (primary)     | We now return you to our regularly |
siny...@{*word*104}space.org (alternate) | scheduled chaos and mayhem. . . .  |

Other Threads