Exemplo n.º 1
0
Arquivo: hdisk.c Projeto: FDOS/format
/* forces re-creation of DPB when drive is next accessed */
void Force_Drive_Recheck()
{
    regs.h.ah = 0x0d; /* reset disk system of DOS, flush buffers */
    intdos(&regs, &regs);

    regs.h.ah = 0x32; /* force re-reading of boot sector (not useful for FAT1x?) */
    regs.h.dl = param.drive_number + 1;
    intdosx(&regs, &regs, &sregs);	/* DS:BX is DPB pointer on return - ignored! */
    segread(&sregs);			/* restore defaults */

    if (param.fat_type == FAT32)
    {
        /* structure is DW size 0x18, DW 0, DD function (2 "force media change"),
         * plus 0x10 unused bytes */
        union REGS r;
        struct SREGS s;
        char some_struc[0x20];
        memset(some_struc,0, 0x20);
        some_struc[0] = 0x18;
        some_struc[4] = 2;
        r.x.ax = 0x7304;		/* get/set FAT32 flag stuff */
        s.es   = FP_SEG(&some_struc[0]);
        r.x.di = FP_OFF(&some_struc[0]);
        r.h.dl = param.drive_number+1; /* A: is 1 etc. */
        r.x.cx = 0x18; /* structure size */
        intdosx(&r, &r, &s);
        segread(&sregs);		/* restore defaults */
    } /* FAT32 */
}
Exemplo n.º 2
0
int isWprot(int drive)
{
      union REGS regs;
      struct SREGS sregs;
      char buf[512], FAR *bufptr = (char FAR *)buf;   /* Needed by MSC  */

      /* First read sector 0  */

      segread(&sregs);
      regs.x.ax = 0x201;
      regs.x.cx = 1;
      regs.x.dx = drive & 0x7f;
      sregs.es  = FP_SEG(bufptr);
      regs.x.bx = FP_OFF(bufptr);
      int86x(0x13, &regs, &regs, &sregs);
      if (regs.x.cflag && regs.h.ah != 6)
      {
            regs.h.ah = 0x00;         /* reset diskette subsystem */
            regs.h.dl = drive & 0x7f;
            int86x(0x13, &regs, &regs, &sregs);
            return -1;
      }

      /* Try to write it back */

      segread(&sregs);
      regs.x.ax = 0x301;
      regs.x.cx = 1;
      regs.x.dx = drive & 0x7f;
      sregs.es  = FP_SEG(bufptr);
      regs.x.bx = FP_OFF(bufptr);
      int86x(0x13, &regs, &regs, &sregs);
      return (3 == regs.h.ah);
}
Exemplo n.º 3
0
/* --------- display the mouse cursor -------- */
void show_mousecursor(void)
{
    if (mouse_installed())	{
		segread(&sregs);
        mouse(1,0,0,0);
	}
}
Exemplo n.º 4
0
struct osMemMap *
osMemMap(int mask)
{
	static struct osMemMap	mmv[4];
	struct SREGS		segs;
	int			ix;

	segread(&segs);
	ix = 0;

	if (mask & OSMEM_IDATA) {
		mmv[ix].use = OSMEM_IDATA;
		mmv[ix].lo  = ptrCanon(MK_FP(segs.ds, int0));
		mmv[ix].hi  = ptrCanon(MK_FP(segs.ss, int0));
		ix++;
	}
	if (mask & OSMEM_DDATA) {
		mmv[ix].use = OSMEM_DDATA;
		/* Contains overlay info. */
		mmv[ix].lo  = ptrCanon(MK_FP(segs.ss, _stklen));
		mmv[ix].hi  = ptrCanon(sbrk(int0));
		ix++;
	}
	if (mask & OSMEM_STACK) {
		mmv[ix].use = OSMEM_STACK;
		mmv[ix].lo  = ptrCanon(&ix);
		mmv[ix].hi  = ptrCanon(MK_FP(segs.ss, _stklen));
		ix++;
	}
	mmv[ix].use = OSMEM_END;

	return mmv;
}
Exemplo n.º 5
0
void far *allocDOS (unsigned nbytes, short *pseg, short *psel)
{
   unsigned npara = (nbytes + 15) / 16;
   void far *pprot;
   pprot = NULL;
   *pseg = 0;        // assume will fail
   *psel = 0;

   // DPMI call 100h allocates DOS memory
   segread (&sregs);
   AX (regs) = 0x0100;        // DPMI: Allocate DOS Memory
   BX (regs) = npara;         // number of paragraphs to alloc
   int386( DPMI_INT, &regs, &regs);

   if (regs.w.cflag == 0)
   {
      *pseg = AX (regs);      // the real-mode segment
      *psel = DX (regs);      // equivalent protected-mode selector
      // pprot is the protected mode address of the same allocated block.
      // The Rational extender maps the 1 MB physical DOS memory into
      // the bottom of our virtual address space.
      pprot = (void far *) ((unsigned)*pseg << 4);
   }
   return pprot;
}
Exemplo n.º 6
0
main()
{
    struct SREGS seg_stacks;
    segread(&seg_stacks);
    printf("\nCS:%X\tDS:%X\tSS:%X\tES:%X",seg_stacks.cs,
         seg_stacks.ds,seg_stacks.ss,seg_stacks.es);
}
Exemplo n.º 7
0
/* --------- hide the mouse cursor ------- */
void hide_mousecursor(void)
{
    if (mouse_installed())	{
		segread(&sregs);
        mouse(2,0,0,0);
	}
}
Exemplo n.º 8
0
T_void IMouseInstallCallback(T_void)
{
    struct SREGS sregs ;
    union REGS inregs ;
    union REGS outregs ;

/* Can't get to work correctly -- take it out. */
//return ;

    DebugRoutine("IMouseInstallCallback") ;

    if (G_callbackInstalled == FALSE)  {
puts("Installing mouse callback") ;
        segread(&sregs) ;
        inregs.w.ax = 0xC ;
        inregs.w.cx = 0x000F ;
        inregs.x.edx = FP_OFF(IMouseCallback) ;
        sregs.es = FP_SEG(IMouseCallback) ;
        int386x(0x33, &inregs, &outregs, &sregs) ;

        G_callbackInstalled = TRUE ;

        /* Make sure the callback is removed at some time. */
        if (G_atexitInstalled == FALSE)  {
            G_atexitInstalled = TRUE ;
            atexit(IMouseUninstallCallback) ;
        }
    }

    DebugEnd() ;
}
Exemplo n.º 9
0
void main()
  {
    struct SREGS sregs;

    segread( &sregs );
    printf( "Current value of CS is %04X\n", sregs.cs );
  }
Exemplo n.º 10
0
/* Verify that a file or directory exists.  Mode is ignored.
 * Returns 0 if file or directory exists, -1 if it doesn't.
 */
int access(char *Name, int mode)
   {
   segread(&s);
   s.ds = FP_SEG(Name);
   r.x.dx = FP_OFF(Name);
   r.h.al = 0;
   return dosx(0x43);
   }
Exemplo n.º 11
0
int valid_drive(char *s)
{
    char buf1[128],buf2[128];
    struct SREGS sregs;
    union REGS regs;

    if (s[1] != ':')
        return(0);

    *TempDrive = *s;

    /* Make sure this is a valid drive. */
    con_fcb[fcbDRIVE] = *TempDrive-'A'+1;
    regs.x.ax = 0x0f00;
    regs.x.dx = (unsigned)con_fcb; /* needs NEAR POINTER */
    intdos(&regs, &regs);
    if (regs.h.al)
        {
        myprintf("Not a valid drive\r\n",0);
        /* printf("Not a valid drive\n") */
        exit(1);
        } /* end if. */

    regs.x.ax = 0x1000;
    regs.x.dx = (unsigned)con_fcb; /* needs NEAR POINTER */
    intdos(&regs, &regs);                 /* Now close the file. */

    /* Make sure user is not trying to label a network drive. */
    regs.h.ah = IOCTL;
    regs.h.al = REMOTE;
    regs.h.bl = (char)(*TempDrive-'A'+1);
    intdos(&regs, &regs);
    if (regs.x.dx & 0x1000)
        {
        myprintf("You cannot label a network drive\r\n",0);
        /* printf("You cannot label a network drive\n"); */
        exit(5);
        } /* end if. */

    /* Make sure the user is not trying to label a drive which has */
    /* been ASSIGNed, JOINed, or SUBSTed. */
    strcpy(buf1, TempDrive);
    strcat(buf1, "\\");
    segread(&sregs);
    regs.x.si = (unsigned)buf1; /* needs NEAR POINTER */
    regs.x.di = (unsigned)buf2; /* needs NEAR POINTER */
    regs.x.ax = 0x6000;
    intdosx(&regs, &regs, &sregs);
    if (*buf1 != *buf2)
        {
        myprintf("You cannot label a drive which has\r\n",0);
        myprintf("been ASSIGNed, JOINed, or SUBSTed.\r\n",0);
        exit(5);
        } /* end if. */

    return(1);

} /* end valid_drive. */
Exemplo n.º 12
0
void main() {
	struct SREGS D;

	segread (&D);
	printf ("Las dos lineas siguientes deben ser iguales...\n");
	printf ("%#X %#X %#X %#X\n",D.es, D.cs, D.ss, D.ds);
	printf ("%#X %#X %#X %#X\n",_ES, _CS, _SS, _DS);
	getch();
}
Exemplo n.º 13
0
void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
{
    int j;

    PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno));

    if (pdc_direct_video)
    {
#if SMALL || MEDIUM
# ifndef __PACIFIC__
        struct SREGS segregs;
# endif
        int ds;
#endif
        /* this should be enough for the maximum width of a screen */

        struct {unsigned char text, attr;} temp_line[256];

        /* replace the attribute part of the chtype with the actual
           color value for each chtype in the line */

        for (j = 0; j < len; j++)
        {
            chtype ch = srcp[j];

            temp_line[j].attr = pdc_atrtab[ch >> PDC_ATTR_SHIFT];
#ifdef CHTYPE_LONG
            if (ch & A_ALTCHARSET && !(ch & 0xff80))
                ch = acs_map[ch & 0x7f];
#endif
            temp_line[j].text = ch & 0xff;
        }

#ifdef __DJGPP__
        dosmemput(temp_line, len * 2,
                  (unsigned long)_FAR_POINTER(pdc_video_seg,
                  pdc_video_ofs + (lineno * curscr->_maxx + x) * 2));
#else
# if SMALL || MEDIUM
#  ifdef __PACIFIC__
        ds = FP_SEG((void far *) temp_line);
#  else
        segread(&segregs);
        ds = segregs.ds;
#  endif
        movedata(ds, (int)temp_line, pdc_video_seg,
                 pdc_video_ofs + (lineno * curscr->_maxx + x) * 2, len * 2);
# else
        memcpy((void *)_FAR_POINTER(pdc_video_seg,
               pdc_video_ofs + (lineno * curscr->_maxx + x) * 2),
               temp_line, len * 2);
# endif
#endif

    }
    else
        for (j = 0; j < len;)
Exemplo n.º 14
0
/* --- return true if a mouse button has been released --- */
int button_releases(void)
{
    if (mouse_installed())	{
		segread(&sregs);
        mouse(6,0,0,0);
	    return regs.x.bx;
	}
	return 0;
}
Exemplo n.º 15
0
/* -------- position the mouse cursor -------- */
void set_mouseposition(int x, int y)
{
    if (mouse_installed())	{
		segread(&sregs);
		if (SCREENWIDTH == 40)
			x *= 2;
        mouse(4,0,x*8,y*8);
	}
}
Exemplo n.º 16
0
/* ------ return true if mouse buttons are pressed ------- */
int mousebuttons(void)
{
    if (mouse_installed())	{
		segread(&sregs);
        mouse(3,0,0,0);
	    return regs.x.bx & 3;
	}
	return 0;
}
Exemplo n.º 17
0
change(int *shape)
{
i.x.ax=9;
i.x.bx=0;
i.x.cx=0;
i.x.dx=(unsigned)shape;
segread(&s);
s.es=s.ds;
int86x(0x33,&i,&i,&s);
}
Exemplo n.º 18
0
void mouseCursor(int *cur)
{
	i.x.ax = 9;
	i.x.bx = 0;
	i.x.cx = 0;
	i.x.dx = (unsigned)cur;
	segread(&s);
	s.es = s.ds;
	int86x(0x33,&i,&i,&s);
}
Exemplo n.º 19
0
int putsects(char *buf,int nsects,unsigned cyl,unsigned head,unsigned sect,unsigned drive)
 {
 union REGS in, out;
 struct SREGS segs;
 segread(&segs);
 segs.es=FP_SEG(buf);
 in.x.ax=0x0300+nsects;
 in.x.bx=FP_OFF(buf);
 in.x.cx=((cyl&0xFF)<<8)+((cyl>>8)<<6)+sect+1;
 in.x.dx=drive+(head<<8);
 return int86x(0x13,&in,&out,&segs);
 }
Exemplo n.º 20
0
/* ----- set mouse travel limits ------- */
void set_mousetravel(int minx, int maxx, int miny, int maxy)
{
    if (mouse_installed())	{
		if (SCREENWIDTH == 40)	{
			minx *= 2;
			maxx *= 2;
		}
		segread(&sregs);
        mouse(7, 0, minx*8, maxx*8);
		mouse(8, 0, miny*8, maxy*8);
	}
}
Exemplo n.º 21
0
/* ---------- return mouse coordinates ---------- */
void get_mouseposition(int *x, int *y)
{
	*x = *y = -1;
    if (mouse_installed())    {
		segread(&sregs);
        mouse(3,0,0,0);
        *x = regs.x.cx/8;
        *y = regs.x.dx/8;
		if (SCREENWIDTH == 40)
			*x /= 2;
    }
}
Exemplo n.º 22
0
void main(int argc, char *argv[])
{
    unsigned long i,m,snum;
    unsigned long bh, addr;
    unsigned short sel, csel, codesize;
    struct SREGS seg;
    void (__far *sieveFunc)();
    int  (__far *isprimeFunc)();
    void sieve(unsigned short tblsel, unsigned long num);
    int isprime(unsigned short tblsel, unsigned long num);

    if (argc>1)
        m = atol(argv[1]);
    else
        m = NUM;

    segread(&seg);
    codesize=(seg.ds-seg.cs)*16;

    DPMIRealToProto();

    csel = DPMIAllocLDT();
    DPMISetRights(csel, TypeCode+0x60, Code386);
    DPMISetBaseAddr(csel, SegToLinier(seg.cs, 0));
    DPMISetLimit(csel, codesize);
    sieveFunc = (void (__far *)() )
        (((unsigned long)csel<<16) + (unsigned short) sieve);
    isprimeFunc = (int (__far *)() )
        (((unsigned long)csel<<16) + (unsigned short) isprime);

    sel = DPMIAllocLDT();
    bh = DPMIAllocBlock(m+1, &addr);
    DPMISetRights(sel, TypeData+0x60, BigSeg);
    DPMISetBaseAddr(sel, addr);
    DPMISetLimit(sel, m+1);

    sieveFunc(sel, m);
    snum=0;
    for (i=2;i<=m;i++) {
        if (isprimeFunc(sel, i)) {
            snum++;
            printf("%lu ", i);
        }
    }

    putchar('\n');
    printf("%lu prime numbers in 2..%lu\n",snum,m);

    DPMIFreeBlock(bh);
    DPMIFreeLDT(sel);
    DPMIFreeLDT(csel);
    ExitToDos();
}
Exemplo n.º 23
0
/* Set a 256 entry pallette with the values given in "palbuf". */
static void
setmany(unsigned char palbuf[256][3], int start, int count)
{
    unsigned char _far *fp;
    union REGS regs;
    struct SREGS sregs;
    unsigned i;

#if defined( __GNUC__ )
    /* This should work for most compilers - only tested with GNU C++, so
       it isn't turned on for anything else */
    for (i=start;i<start+count;i++) {
	regs.x.ax = 0x1010;
	regs.x.bx = i;
	regs.h.ch = palbuf[i][1];
	regs.h.cl = palbuf[i][2];
	regs.h.dh = palbuf[i][0];
	int86x(0x10, &regs, &regs, &sregs);
	return;
    }
#elif defined( DOS386 )
    /* Put the contents of the new palette into real memory, the only
       place I know that won't impact things is the video RAM. */
    fp = MK_FP(_x386_zero_base_selector, 0xA0000);
#else
    /* If you aren't using GNU C++ or Zortech C++ for 386 protected mode,
       then you need to use a compiler that supports access to all of the
       registers, including ES, to be able to set the pallette all at once. */
    fp = MK_FP(0xA000, 0);
#endif

    /* If you got here then you are using Zortech C++ */
    for (i=start;i<start+count;i++) {
	fp[3*(i-start)  ] = palbuf[i][0];
	fp[3*(i-start)+1] = palbuf[i][1];
	fp[3*(i-start)+2] = palbuf[i][2];
    }

    regs.x.ax = 0x1012;
    regs.x.bx = start;
    regs.x.cx = count;
    regs.x.dx = 0;
    segread(&sregs);
    sregs.es  = 0xA000;
#if defined( DOS386 )
    int86x_real(0x10, &regs, &regs, &sregs);
#else
    int86x(0x10, &regs, &regs, &sregs);
#endif
    /* Now clear off the values that got dumped into the video RAM */
    for (i=0;i<3*count; i++)
	*fp++ = 0;
}
Exemplo n.º 24
0
/* execute real mode interrupt from protected mode */
static int RM_Interrupt(int num, RM_Info *rm)
{
    union REGS regs{};
    struct SREGS sregs{};
    segread(&sregs);
    regs.w.ax = 0x0300;
    regs.w.bx = (short)num;
    regs.w.cx = 0;
    sregs.es = FP_SEG(rm);
    regs.x.edi = FP_OFF(rm);
    return int386x(0x31, &regs, &regs, &sregs);
}
Exemplo n.º 25
0
extern void main( void )
{
    unsigned            dpmisize;
    void                *dpmimem;
    unsigned            dpmiseg;
    void                __far *switchaddr;

    segread( &RMRegs );
    Envseg = *(unsigned __far *)MK_FP( _psp, 0x2c );
    switchaddr = GetPModeAddr( &dpmisize );
    dpmimem = malloc( dpmisize + 15 );
    dpmiseg = FP_SEG( dpmimem ) + ( FP_OFF( dpmimem ) + 15 ) / 16;
    if( ( switchaddr == NULLFAR ) || ( dpmimem == NULL ) ) {
        _debug( "error, DPMI host is not present" );
    } else if( !EnterPMode( switchaddr, dpmiseg ) ) {
        _debug( "could not enter protected mode" );
    } else {
        _debug( "entered protected mode" );
        if( !getaddrs() ) {
            _debug( "could not get raw switch and state save addresses" );
        } else {

            segread( &PMRegs );
            hook_vects( MK_FP( PMRegs.cs, FP_OFF( &PM66Handler ) ),
                        &rm_66_handler, &OldPMHandler, &OldRMHandler );
            _debug( "doing an int 0x66" );
            DoInt66( PMRegs.cs, PMRegs.ds );
            _debug( "completed int 0x66" );
            _debug( "raw switching to real mode" );
            save_vects( RMVTable, PMVTable );
            DoRawSwitch( RawPMtoRMAddr, RawRMtoPMAddr,
                         FP_OFF( &start_shell ), &RMRegs );
            _debug( "made it back to the debugger's protected mode" );
            restore_vects( RMVTable, PMVTable );
            hook_vects( OldPMHandler, OldRMHandler, NULLFAR, NULLFAR );
        }
        _debug( "press any key to terminate debugger" );
        DPMIFini();
    }
}
Exemplo n.º 26
0
static int
setvesamode(int mode, int clear)
{
   union REGS regs;
   struct SREGS sregs;
   struct ModeInfoBlock *VgaPtr = &VESAModeInfo;
   unsigned i;

   /* Call VESA function 1 to get mode info */
   regs.h.ah = 0x4f;
   regs.h.al = 0x01;
   regs.x.cx = mode;
#if defined( DOS386 )
   regs.x.di = real_buf[0];
   segread(&sregs);
   sregs.es  = real_buf[1];
   int86x_real(0x10, &regs, &regs, &sregs);
   if (regs.h.al != 0x4f || regs.h.ah != 0)
      return 0;
   for (i=0; i<sizeof(struct ModeInfoBlock); i++)
      ((unsigned char *)VgaPtr)[i] = real_ptr[i];
#elif defined( __GNUC__ )
   regs.x.di = real_buf[0];
   int86x(0x10, &regs, &regs, &sregs);
   if (regs.h.al != 0x4f || regs.h.ah != 0)
      return 0;
   for (i=0; i<sizeof(struct ModeInfoBlock); i++)
      ((unsigned char *)VgaPtr)[i] = real_ptr[i];
#else
   regs.x.di = FP_OFF(VgaPtr);
   sregs.es  = FP_SEG(VgaPtr);
   int86x(0x10, &regs, &regs, &sregs);
   if (regs.h.al != 0x4f || regs.h.ah != 0)
      return 0;
#endif

   /* The mode is supported - save useful information and initialize
      the graphics display */
   line_length = VgaPtr->BytesPerScanLine;
   granularity = ((unsigned long)VgaPtr->WinGranularity) << 10;
   screen_maxx = VgaPtr->XResolution;
   screen_maxy = VgaPtr->YResolution;

   if (Reset_Display_Flag) {
      /* Now go set the video adapter into the requested mode */
      regs.h.ah = 0x4f;
      regs.h.al = 0x02;
      regs.x.bx = mode;
      int86(0x10, &regs, &regs);
      return (regs.h.al == 0x4f && regs.h.ah == 0x00 ? 1 : 0);
      }
}
Exemplo n.º 27
0
/* Ask the dos extender where to communicate with real mode BIOS calls */
static void
find_real_buf()
{
   struct SREGS sregs;
   union REGS regs;

   regs.x.ax = 0x250d;
   segread(&sregs);
   int86x(0x21, &regs, &regs, &sregs);

   *((unsigned *)&real_buf) = regs.e.ebx;
   real_ptr = MK_FP(sregs.es, regs.e.edx);
}
Exemplo n.º 28
0
void disp_label()
{
    unsigned char serialbuf[26];
    union REGS regs;
    struct SREGS sregs;

    /* First set the dta to be fcb so information returned is put there. */
    regs.x.ax = 0x1a00;
    regs.x.dx = (unsigned)fcb; /* needs NEAR POINTER */
    intdos(&regs, &regs);

    /* Now try to find the volume label. */
    fcb[fcbDRIVE] = *Drive-'A'+1;
    regs.x.ax = 0x1100;
    regs.x.dx = (unsigned)fcb; /* needs NEAR POINTER */
    intdos(&regs, &regs);
    if (regs.h.al)
        {
        myprintf("Volume in drive ",0);
        myprintf(Drive,1);
        myprintf(" has no label\r\n",0);
        } /* end if. */
    else
        {
        NoLabel = 0;
        fcb[ENDNAME] = '\0';
        myprintf("Volume in drive ",0);
        myprintf(Drive,1);
        myprintf(" is ",0);
        myprintf(&fcb[NAME],0);
        myprintf("\r\n",0);
        } /* end else. */

    /* Now print out the volume serial number, if it exists. */
    segread(&sregs);
    regs.x.ax = 0x6900;
    regs.h.bl = *Drive-'A'+1;
    regs.x.dx = (unsigned)serialbuf; /* needs NEAR POINTER */
    intdosx(&regs, &regs, &sregs);
    if (!regs.x.cflag)
        {
        myprintf("Volume serial number is ",0);
        hexprint(serialbuf[5]);
        hexprint(serialbuf[4]);
        myprintf("-",0);
        hexprint(serialbuf[3]);
        hexprint(serialbuf[2]);
        myprintf("\r\n",0);
        } /* end if. */

} /* end disp_label. */
Exemplo n.º 29
0
/*
 * newIntVect - set a new 32-bit interrupt vector
 */
static void newIntVect( int vect, void far *rtn )
{
    union REGS          inregs, outregs;
    struct SREGS        segregs;

    segread( &segregs );

    inregs.w.ax = 0x2506;  /* always gain control in prot. mode */
    inregs.h.cl = vect;
    segregs.ds = FP_SEG( rtn );
    inregs.x.edx = FP_OFF( rtn );
    intdosx( &inregs, &outregs, &segregs );

} /* newIntVect */
Exemplo n.º 30
0
main()
{
      int i;
      int unsigned result;
      int drivestatus[26];
      unsigned char FAR *DPB;
      union REGS regs;
      struct SREGS sregs;


      /* routine checks for all valid drive possibilities from A to Z  */

      /*
      **    if removable media drive ie. floppy drive A: has a latch door
      **    open you will get "Abort Retry" panic message
      */

      for (i = 0; i < 26; i++)
      {
            /* drive number (0=default, 1=A, 2=B,etc.)*/

            regs.h.dl = (unsigned char)(i + 1);
            segread(&sregs);

            regs.h.ah=0x32;         /* DOS interrupt 32H */
                                    /* was undocumented for DOS release 3.2 */

            intdosx(&regs,&regs, &sregs);

            result=regs.h.al;
            DPB = MK_FP(sregs.ds, regs.x.bx);

            /*
            **  result =0  then valid drive
            **         =255 or ff hex then invalid or non-existent drive
            */

            if (0 == result && *DPB != (unsigned char)i)
                  drivestatus[i] = 1;
            else  drivestatus[i]=result;
      }

      for (i = 0; i < 26; i = i + 2)
      {
            printf("drive %c: status code =%3d drive %c: status code =%3d\n",
                  'A' + i,drivestatus[i],'B' + i,drivestatus[i+1]);
      }
      return 0;
}