delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/04/10:00:04

Path: news.mv.net!news.shore.net!newsfeed.mathworks.com!news.maxwell.syr.edu!newsfeed.stanford.edu!sn-xit-03!supernews.com!sn-inject-01!corp.supernews.com!not-for-mail
From: "Ricardo Cropalato de Melo" <cropalat AT svn DOT com DOT br>
Newsgroups: comp.os.msdos.djgpp
Subject: problem with __dpmi_int()
Date: Mon, 4 Sep 2000 10:39:49 -0300
Organization: Posted via Supernews, http://www.supernews.com
Lines: 72
Message-ID: <sr79j8h7a6e143@corp.supernews.com>
X-Complaints-To: newsabuse AT supernews DOT com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Xref: news.mv.net comp.os.msdos.djgpp:103156

I 'm trying to read a floppy sector / sector, and i was doing it like this
code:

// 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
}

This work fine but if i put this code in a function, i get a GPF. Some one
tell me that int86x() don't work fine with offset and saw to use
__dmpi_int(). It don't work in  main() or in function().

#include <iostream.h>
#include <dpmi.h>
#include <sys/segments.h>

int main()
{
 __dpmi_regs regs;
 char setor[512] = "Teste";

    cout << endl << setor;

 for (int i=0; i< 1; i++) // trilhas
  for (int j=0; j< 2; j++) // cabecas
   for (int k=0; k< 18; k++) file://setores
   {
    regs.h.ah = 2;
    regs.h.al = 1;
    regs.h.ch = i;
    regs.h.cl = j;
    regs.h.dh = k;
    regs.h.dl = 0;
    regs.x.es = _my_cs();
    regs.x.bx = (unsigned) setor;
    __dpmi_int (0x13, &regs);
    cout << endl << setor;
   }
   cout << endl;
}


PLEASE, Any one can help me.

TIA

Cropalato
cropalat AT svn DOT com DOT br





- Raw text -


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