Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Read sector(s) from floppy

Posted on 1998-11-12
6
Medium Priority
?
1,534 Views
Last Modified: 2012-05-04
Hi, I want to read a floppy sector-by-sector.

E.G.
...
  asm
    mov ah, 02h   //function 2 : read sector
    mov dl, 00h    //first drive A:
    mov dh, 00h  //head 0
    mov ch, 00h  //track 0
    mov cl, 01h   //sector 1
    mov al, 01h   //read 1 sector
    mov es, SEG buff  //segment address of buffer
    mov bx, OFFSET buff  //offset address of buffer
    int 13h      //read sector with interrupt 13
  end;
...

But, "SEG" is not available in Delphi2,
so what do I do then???
0
Comment
Question by:8BEE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1346643
This won't work with 32bit windows. You'll have to use CreateFile and DeviceIOControl instead. Please look in the win32 help file for a topic called "Calling DeviceIOControl on Windows 95" or "Using DeviceIOControl...".

Sorry, have no sources available at this moment...   :-(

Regards, Madshi.
0
 
LVL 17

Expert Comment

by:inthe
ID: 1346644
Hello
Here is a demo from dejanews  
It shows how to change the serial numberof a floppy disk using deviceiocontrol. it may be of assistance if only to help you understand how to use deviceiocontrol

InThe

USE IT AT YOUR OWN RISK!!!

unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics,
  Controls, Forms, Dialogs, StdCtrls, ComCtrls;type  TForm1 = class(TForm)
    Button1: TButton;    procedure Button1Click(Sender: TObject);  private
    { Private-Deklarationen }  public    { Public-Deklarationen }  end;var
  Form1: TForm1;const  VWin32_DIOC_DOS_Int25 = 2; // direkter Lesezugriff
                                              // direct read access
  VWin32_DIOC_DOS_Int26 = 3; // direkter Schreibzugriff
                                              // direct write accesstype
  TDevIoCtl_Reg = packed Record  Reg_EBX   : DWord;  Reg_EDX   : DWord;
  Reg_ECX   : DWord;  Reg_EAX   : DWord;  Reg_EDI   : DWord;  Reg_ESI   : DWord;
  Reg_Flags : DWord;end;type  TDiskIO = packed record  StartSektor    : DWord;
  AnzahlSektoren : Word;  PBuffer        : DWord;end;implementation{$R *.DFM}
// Bootsektor lesen, Seriennummer ändern und// Bootsektor zurückschreiben
// read boot sector, change serial number, and// write boot sector back
procedure TForm1.Button1Click(Sender: TObject);var  DevIoHandle   : THandle;
  BytesReturned : DWord;  Reg           : TDevIoCtl_Reg;
  DiskIO        : TDiskIO;
  DatenBuffer   : Array [0..511] of Byte;   //  = 512 Bytes
  // Die Sektorgröße kann man mit GetDiskFreeSpace ermitteln
  // (normalerweise = 512 Bytes, bei CD-ROMs = 2048 Bytes).
  // The size of one sector can be found out with GetDiskFreeSpace
  // (normaly = 512 bytes, CD-ROMs = 2048 bytes).begin
  // DiskIO und Reg initialisieren  // initialize DiskIO and Reg  with DiskIO do
    begin      StartSektor := 0;          // ab Sektor 0 / from sector 0
      AnzahlSektoren := 1;       // 1 Sektor lesen / read 1 sector
      PBuffer := DWord(@DatenBuffer);    end;  with Reg do    begin
      reg_EAX := 0;              // Laufwerk: / drive: 0 = A, 1 = B usw.
      reg_EBX := DWord(@DiskIO);
      reg_ECX := $FFFF;          // benutze / use DiskIO    end;
  // Handle für DeviceIoControl holen.  // retrieve handle for DeviceIoControl
  DevIoHandle := CreateFile(                 '\\.\vwin32',
                 Generic_Read,
                 File_Share_Read or File_Share_Write,                 nil,
                 Open_Existing,                 File_Attribute_Normal,
                 0);  // Nur weiter, wenn Handle gültig ist.
  // only proceed, if handle is valid
  if DevIoHandle <> Invalid_Handle_Value then    begin
      // direkter Lesezugriff      // direct read access
      DeviceIoControl(DevIoHandle,                      VWin32_DIOC_DOS_Int25,
                      @Reg,                      SizeOf(Reg),
                      @Reg,                      SizeOf(Reg),
                      BytesReturned,                      nil);
      // neue Seriennummer = $12345678      // new serial number = $12345678
      DatenBuffer[39] := $78;      DatenBuffer[40] := $56;
      DatenBuffer[41] := $34;      DatenBuffer[42] := $12;
      // direkter Schreibzugriff      // direct write access
      DeviceIoControl(DevIoHandle,                      VWin32_DIOC_DOS_Int26,
                      @Reg,                      SizeOf(Reg),
                      @Reg,                      SizeOf(Reg),
                      BytesReturned,                      nil);
      // Handle freigeben      // release handle      CloseHandle(DevIoHandle);
    end;end;end.

0
 
LVL 17

Expert Comment

by:inthe
ID: 1346645
ps..sorry that's such a bloody mess:-)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Expert Comment

by:skatan_187
ID: 1346646
I am looking for a function that reads a disk until there is an error and then give the sector
as result .. So actually I am looking for the same stuff you are looking for. If I find something
i'll inform you about it ;-)

SkAtAn
0
 
LVL 4

Accepted Solution

by:
dwwang earned 600 total points
ID: 1346647
This is a new component that can read sectors from any disk:

http://vcl.vclxx.com/DELPHI/D32FREE/DIO.ZIP

download and have a try.
0
 
LVL 4

Expert Comment

by:dwwang
ID: 1346648
Hi, any progress?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question