Board index » delphi » int 13h extensions (direct HDD access) in TP - needed!

int 13h extensions (direct HDD access) in TP - needed!

Hello

I am looking for the source of an unit / program / procedures able to deal
with the topic. I have found a lot of information how to do it in ASM, but I
think somebody has written it already in pascal...

I am interested in functions 42h and 43h of int 13h.

Thanks in advance
Peter

 

Re:int 13h extensions (direct HDD access) in TP - needed!


Quote
Piotr Kaminski <pio...@ectorun.pl> wrote:
> Hello
> I am looking for the source of an unit / program / procedures able to deal
> with the topic. I have found a lot of information how to do it in ASM, but I
> think somebody has written it already in pascal...
> I am interested in functions 42h and 43h of int 13h.
> Thanks in advance
> Peter

Hi,

if you have the information in ASM then you have two possibilities.
First you use the inline assembler of pascal to write your methods. So you
get the functions you need by using the pascal modules.
Second you use the information to write pure pascal routines using the
register structure and int procedure.
So everything works alright.

cu,
Toralf

Re:int 13h extensions (direct HDD access) in TP - needed!


On Tue, 10 Jul 2001 09:58:26 +0200, "Piotr Kaminski" <pio...@ectorun.pl>
wrote:

Quote
>Hello

>I am looking for the source of an unit / program / procedures able to deal
>with the topic. I have found a lot of information how to do it in ASM, but I
>think somebody has written it already in pascal...

>I am interested in functions 42h and 43h of int 13h.

>Thanks in advance
>Peter

Inline assembly is the easiest way to do it.

Be sure to read the specs so you know what to expect.

Try this for Info.

http://www.t13.org/project/d1386r5a.pdf

You can also make the packet a record or if you don't
mond some work into an onject class. I am doing something
simular with part of my projects adn its not to hard.

--
Doors - Dont look at the future in a window.
        just walk to the door http://walk.to/doors
      - Open it and go there.

http://www.tidepool.com/~doors/doors.htm
OR SEARCH AT
http://www.tidepool.com/~doors/search.htm

do...@tidepool.com
mailto:do...@tidepool.com

Re:int 13h extensions (direct HDD access) in TP - needed!


Quote
> Inline assembly is the easiest way to do it.

well, yes, I think so. That's why I am wondering why the code below does not
work. Being precise - it works, but it screw's up the system... some strange
errors pop up after my procedure.
What did I wrong? I tried to follow up instructions from
http://www.teleport.com/~brainy/diskaccess.htm

anyway, thanks for the reply
Piotr

==== my test prog =====

program sect_test;

const
 start0=63;        {starting sector (LBA) }
 cnt0=1;   {number of sectors to be read }
type
 t=array[1..35000]of byte;

var
 bp:^t;
 f:fcnt;
 err:byte;

FUNCTION ReadSector(drive:Byte; start,cnt:word; buff: Pointer): Byte;
{ drive = 0 for drive A:, 1 = B:,   }
{ 80h = first hard drive.           }
var
 packet:array[0..$0f]of byte;
 s,o:word;
 res:byte;
begin
fillchar(packet[0],$0f,0);       {'packet' gets zeros}
s:=seg(packet); o:=ofs(packet);
packet[$0]:=$10;
packet[$1]:=0;
packet[$2]:=lo(cnt);
packet[$3]:=hi(cnt);

packet[$4]:=lo(ofs(buff));
packet[$5]:=hi(ofs(buff));
packet[$6]:=lo(seg(buff));
packet[$7]:=hi(seg(buff));

packet[$8]:=lo(start);
packet[$9]:=hi(start);

ASM
    mov  ax,s
    push ax
    mov  ax,o
    push ax
    pop  si
    pop  ds

    mov  ax, 4200h      { extended read }
    mov  dl, drive
    int  13h            { read ! }

    mov  al, ah         { status result in al }
    mov  res,al
END;
readsector:=res;
end;

begin
new(bp);
fillchar(bp^[1],512,44);

err:=255;
err:=ReadSector($80,start0,cnt0,bp);
writeln('error: ',err);

assign(f,'c:\image.txt');
rewrite(f,1);}
blockwrite(f,bp^,cnt0*512);
close(f);

dispose(bp);
end.

Re:int 13h extensions (direct HDD access) in TP - needed!


correct variables declaration (search-and-replace bug during translation to
English, sorry):

var
 bp:^t;
 f:file;
 err:byte

Other Threads