                           FLUSHING SMARTDRV

                           Matthew  Probert
                           Servile Software



Disk caching is all well and good, but what if your program needs to commit 
data to the disk? That is, make sure that the disk cache has written out all 
its stored data.

Since SMARTDRV is commonly used on PCs, it is a reasonable bet that the host 
computer may be using it. This function detects whether or not SMARTDRV is 
loaded into memory by using the SMARTDRV installation check interrupt call:



int SMARTDRV()
{
    /*
        Return 1 if SMARTDRV active
    */
    union REGS inreg,outreg;

    inreg.x.ax = 0x4a10;
    inreg.x.bx = 0;
    inreg.x.cx = 0xEBAB;
    int86(0x2f,&inreg,&outreg);

    if (outreg.x.ax == 0xBABE)
        return 1;
    return 0;
}



In the event that SMARTDRV is loaded, you can then flush SMARTDRV, so that at 
all cached data is written out use the following code: 

    /*
        Flush smartdrv buffers
    */
    union REGS inreg,outreg;

    inreg.x.ax = 0x4a10;
    inreg.x.bx = 0x0001;
    int86(0x2f,&inreg,&outreg);

