www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/03/05/12:28:41

Date: Fri, 5 Mar 93 11:42:28 EST
From: bst%tt AT CAM DOT ORG (Brent Townshend)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: SCSI Driver Under DJGPP
Cc: bst%tt AT CAM DOT ORG, chris AT alderan DOT sdata DOT de

I am trying to port some code which accesses a SCSI tape device
to an MSDOS environment and I'm having some problems with accessing
the ASPI driver from a program compiled with djgpp, whereas the same
code works fine under Microsoft C.

I believe the problem has something to do with running the software
under protected vs. real-mode, but my limitted exposure to DOS 
programming leaves me somewhat bewildered.  Perhaps, some more
knowledgable person on the net could give me some guidance..

The way the ASPI driver works is that there is a int 21 call to
DOS which is supposed to fill in a memory location with an entry
address to the ASPI driver, here is the code:


  ...
  if ( (h=open("SCSIMGR$",0)) == -1 )  {
    perror("Opening ASPI Manager");
    exit(1);
  }
  printf("SCSIMGR$ opened at fd %d\n", h);
  /*
   * This is an ioctl(READ) to the "SCSIMGR$".
   * It returns the entrypoint of the aspi-module (far pointer)
   * in the 4 bytes, pointed to by the dx register.
   */
  inregs.x.ax = 0x4402;
  inregs.x.dx = ( int ) &aspi_tmp;
  inregs.x.cx = 4;
  inregs.x.bx = h;
  intdos(&inregs, &outregs);
  ...

When the intdos() call is executed, I get:
d:/djgpp/bin/go32.exe version 1.09 Copyright (C) 1991 DJ Delorie
Exception 33 (0x21) at eip=4002d2

I suppose the address of aspi_tmp is in the 32-bit arena, while the
interrupt routine expects something else.  But now I'm stuck as to
how to handle this.


-Brent

--------------------------------------------------------------------
Brent Townshend			Internet: bst%tt AT cam DOT org
Townshend Computer Tools	    UUCP: ...!mcgill!altitude!tt!bst
230 Sherbrooke St E. #502	   Phone: +514-289-9123
Montreal, Quebec, H2X 1E1	     FAX: +514-289-1831

- Raw text -


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