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
Solved

How to call DOS Interrupts in delphi?

Posted on 1998-12-30
4
556 Views
Last Modified: 2010-04-04
Hi,
  I want to read and write data from a
  specific cluster in a floppy. Is there
  any way other that calling interrupts.
  I would like to know how to call DOS
  Interrupts from Delphi.


  Is there any way other than calling
  Interrupts for reading data from a specific
  cluster in a Floppy.
     
 
  I would be much greatful if u can help
  me out in solving this problem or any
  related web sites.  

regards
   jagan
0
Comment
Question by:rjagan
4 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1353900
You'll have to call DeviceIOControl. It's quite difficult. If you've Delphi 2 or 3, please open the win32.hlp file and look in the index for something like "Calling DeviceIOControl on Win95". In the win32.hlp shipped with Delphi4 these pages are gone, don't know why...

Regards, Madshi.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1353901
It's quite difficult if possible to do the task u want... Similar question has already been asked and the guy had to do it in TP and call his DOS app in order for this to work...
0
 
LVL 2

Expert Comment

by:ivi
ID: 1353902
jagan, what is your Delphi version (16 bit or 32 bit)?
What is operating system? 3.1? 95/98? NT?
0
 

Accepted Solution

by:
tothpaul earned 20 total points
ID: 1353903
windows 95 allow DeviceIoControl for floppy disk; but not for hard drive. To access hard drive sectors you need to write a .vxd driver (impossible with Delphi) or to use a 16bits DLL (Delphi 1)  using INT 31h (DPMI DOS Call).

Type
 TRegs=record
  edi,esi,bp,Reserved,ebx,edx,ecx,eax:longint;
  Flags,es,ds,fs,gs,ip,cs,sp,ss:word;
 end;

Function ReadSector(Drive,Head,Track,Sector,Count:word; Var Data):boolean;
 Var
  Regs:TRegs;
  Dpmi:boolean;
  Buff:longint;
  ARegs:pointer;
 begin
 {The return value contains a paragraph-segment value in its high-order word and
  a selector in its low-order word.}
  Buff:=GlobalDosAlloc(512);

  with Regs do begin
   eax:=$0200+Count; { BIOS read, "Count" sector  }
   edx:=Head shl 8 + Drive;
   ecx:=(Lo(Track) shl 8)+Hi(Track) shl 6+Sector;
   es :=HiWord(Buff); { Segment of sector buffer }
   ebx:=$0000;        { Offset of sector buffer }
  end;
  ARegs:=@Regs;

  asm  { Realmode Interrupt }
   mov ax,$0300      { DPMI Simulate Real Mode int }
   mov bl,$13        { Interrupt to simulate       }
   mov bh,$01
   xor cx,cx
   les di,ARegs
   int 31h
   mov al,False
   jc  @Done
    mov al,True
   @Done:
   mov Dpmi,al
  end;

  if Dpmi then begin
   if odd(Regs.Flags) then begin
    showMessage('Unable to read sector');
    ReadSector:=false;
   end else begin
    Move(Ptr(LoWord(Buff),0)^,Data,512);
    ReadSector:=true;
   end;
  end else begin
   showmessage('Dpmi error');
   ReadSector:=false;
  end;

  GlobalDosFree(LoWord(Buff));
 end;


0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Communication Between RC4 Delphi <-> PHP 3 123
Delphi application Soap connection 5 121
Delphi IDE crash without error message ... 7 99
Performance of SQL statement 37 127
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

829 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