Re: Suppress Critical Error Message

new topic     » goto parent     » topic index » view thread      » older message » newer message

Here's the QBasic routine to check if the floppy is ready converted to
Euphoria. Please note that it *only* works on floppy drives, not hard drives
 - it reports hard drives as "not ready".

 -- David Cuny


 -- BEGINNING OF READY.EX

include machine.e

global function floppy_drive_ready( integer driveChar )

    -- returns True (1) if the floppy drive specified in driveChar (eg: 'A')
    -- by Douglas H. Lusher, April, 1993
    -- Converted to Euphoria by David Cuny, April 1997

    integer driveNum
    sequence  inReg, outReg, flags

    -- convert char to drive number
    -- zero based drive numbering
    driveNum = 'A' - driveChar

     -- initialize register list
    inReg = repeat( 0, 10 )

    -- reset floppy drive
    inReg[REG_AX] = #0
    inReg[REG_DX] = driveNum
    outReg = dos_interrupt( #13, inReg )

    -- check if drive is ready
    inReg[REG_AX] = #401
    inReg[REG_CX] = #101
    inReg[REG_DX] = driveNum
    outReg = dos_interrupt( #13, inReg )

    -- call the interrupt twice since if a disk has just been inserted,
    -- the first time gives a wrong answer
    inReg[REG_AX] = #401
    inReg[REG_CX] = #101
    inReg[REG_DX] = driveNum
    outReg = dos_interrupt( #13, inReg )

    -- result is good if carry flag not set
    flags = int_to_bits( outReg[REG_FLAGS], 1 )

    return not( flags[1] )

end function


 -- END OF FILE READY.EX

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu