delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/25/18:38:17

From: "Edmund Horner" <ejrh AT paradise DOT net DOT nz>
Newsgroups: comp.os.msdos.djgpp
References: <sqcp34mit91130 AT corp DOT supernews DOT com>
Subject: Re: Read a boot sector
Lines: 50
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Organization: Paradise Net
Message-ID: <967211566.252262@shelley.paradise.net.nz>
Cache-Post-Path: shelley.paradise.net.nz!unknown AT 203-96-154-45 DOT tnt7 DOT paradise DOT net DOT nz
X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)
Date: Sat, 26 Aug 2000 01:54:19 +1200
NNTP-Posting-Host: 203.96.152.26
X-Complaints-To: newsadmin AT xtra DOT co DOT nz
X-Trace: news.xtra.co.nz 967211586 203.96.152.26 (Sat, 26 Aug 2000 01:53:06 NZST)
NNTP-Posting-Date: Sat, 26 Aug 2000 01:53:06 NZST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Yes!  You're trying to call a 16-bit interrupt from 32-bit code.  Normally
int86x makes this okay, except you're trying to pass a pointer to a buffer
in your programs space.  This can't be done, you need to use the transfer
buffer.

Look it up in the F.A.Q., it should tell you how to do things.

(Disclaimer, I've never had to do this kind of thing, but I have seen the
question asked lots!)

"Ricardo Cropalato de Melo" <cropalat AT svn DOT com DOT br> wrote in message
news:sqcp34mit91130 AT corp DOT supernews DOT com...
> I write this single program to read a floppy boot sector.
>
> // Code
> #include <stdio.h>
> #include <sys/segments.h>
> #include <dos.h>
>
> int main(void)
> {
>     union REGS regs;
>     struct SREGS sregs;
>     unsigned char sector[512];
>
>     regs.h.ah =0x02; // read a sectors from a disk
>     regs.h.dl = 0x00;   // drive number
>     regs.h.ch = k;      // track   0 to 79 - max 80
>     regs.h.cl = j;      // sector     0 à 17 - max 18
>     regs.h.dh = i;      // head    0 e 1  - max 2
>     regs.x.bx = (unsigned) sector;
>     sregs.es = _my_ds();
>
>     int86x(0x13,&regs,&regs,&sregs);
>
>     return (regs.h.ah); // zero if ok
> }
>
> And it is fine. But if a put it in a function and call this function, a
get
> a GPF. Anybody know why? Any idea?
>
> TIA
>
> Cropalato
> cropalat AT svn DOT com DOT br
>
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019