From: "Ricardo Cropalato de Melo" Newsgroups: comp.os.msdos.djgpp Subject: Read a boot sector Date: Fri, 25 Aug 2000 09:12:51 -0300 Organization: Posted via Supernews, http://www.supernews.com Lines: 35 Message-ID: X-Complaints-To: newsabuse AT supernews DOT com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I write this single program to read a floppy boot sector. // Code #include #include #include 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