www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/05/12/03:04:30

From: morphine AT server DOT cs DOT jhu DOT edu (Michael Phelps)
Sender: morphine AT server DOT cs DOT jhu DOT edu
Date: Thu, 11 May 1995 11:29:57 -0400
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Checking for floppy: answers

>  All 3 of my interrupt books say that the buffer address should be input in
>ES:BX, but phelps seems to have input it in DS:BX.  Perhaps that is why he got
>AH=2 error exits and why always he always had zero sectors read.
DJ helped me out with this.  My current function is:

int     get_drive_A_status()
{
        _go32_dpmi_registers    regs;

        regs.h.ah = 0x02; /* BIOS disk read */
        regs.h.al = 0x01; /* read one sector */
        regs.h.ch = 0x00; /* track zero */
        regs.h.cl = 0x01; /* SECTOR ONE--_NOT_ ZERO */
        regs.h.dh = 0x00; /* drive A: */
        regs.x.bx = (_go32_info_block.linear_address_of_transfer_buffer & 0x0f);
        regs.x.es = (_go32_info_block.linear_address_of_transfer_buffer >> 4);
        /* just read it into the transfer buffer; I don't care about contents */
        regs.x.ss = regs.x.sp = 0;

        _go32_dpmi_simulate_int(0x13, &regs); /* execute BIOS call */

        return (regs.h.ah);
}

I call my function with the following:
        while((floppy_status = get_drive_A_status()) == 6)  {  }
                /* retry for error 6 (disk switched) */
        if (!floppy_status)  /* if there _IS_ a disk in the drive */
        {
                (floppy-code here)
        }

This presently works.  Thanks to all who assisted!

                                                ---Michael Phelps, MD

- Raw text -


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