Mail Archives: djgpp/2000/08/25/10:23:54
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,®s,®s,&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 -