www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/25/10:23:54

Date: Fri, 25 Aug 2000 19:58:49 +0530
Message-Id: <200008251428.TAA03931@midpec.com>
X-Authentication-Warning: midpec.com: tr set sender to tr AT eth DOT net using -f
From: Prashant TR <tr AT eth DOT net>
To: cropalat AT svn DOT com DOT br
CC: djgpp AT delorie DOT com
In-reply-to: <sqcp34mit91130@corp.supernews.com> (cropalat@svn.com.br)
Subject: Re: Read a boot sector
References: <sqcp34mit91130 AT corp DOT supernews DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Use __dpmi_int rather than int86x. You can't load real-mode segment
values into segment registers in protected mode.

-- 
Prashant TR <tr AT midpec DOT com>
Web: http://www.midpec.com/

| From: "Ricardo Cropalato de Melo" <cropalat AT svn DOT com DOT br>
| Date: Fri, 25 Aug 2000 09:12:51 -0300
| DJ-Gateway: from newsgroup comp.os.msdos.djgpp
| 
| 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