BBS: Inland Empire Archive Date: 03-30-93 (08:58) Number: 340 From: DOUGLAS LUSHER Refer#: NONE To: LEE MADAJCZYK Recvd: NO Subj: DISK NOT READY, AND GENER Conf: (2) Quik_Bas
LM> DL> By the way, if you're doing a lot of work on floppy drives, you LM> > might also want to check if the disk in the drive is LM> > write-protected or not. I have code for that also, if you need LM> Douglas... LM> Could you post that here? If I said Pretty Please? Thanks.. Sure, here it is. I trust you know to load QB with the /L switch and to include the QB.BI file. Of course when you use this in a program, you will want to use the code I posted earlier to make sure that there is a disk in the drive before using this to make sure that the floppy is not write protected. This function returns True (-1) if the disk in the specified drive *can* be written to, i.e. it is not write protected. FUNCTION FloppyWriteOK% (Drive$) DIM XRegister as RegTypeX Drive% = (ASC(Drive$) OR 32) - 97 'reset floppy drive XRegister.AX = 0 XRegister.DX = Drive% CALL InterruptX(&H13, XRegister, XRegister) 'spin it XRegister.AX = &H401 XRegister.CX = &H101 XRegister.DX = Drive% CALL InterruptX(&H13, XRegister, XRegister) Buffer$ = SPACE$(512) 'read from the disk XRegister.AX = &H201 XRegister.ES = VARSEG(Buffer$) XRegister.BX = SADD(Buffer$) XRegister.CX = &H101 XRegister.DX = Drive% CALL InterruptX(&H13, XRegister, XRegister) 'try writing back to the disk XRegister.AX = &H301 XRegister.ES = VARSEG(Buffer$) XRegister.BX = SADD(Buffer$) XRegister.CX = &H101 XRegister.DX = Drive% CALL InterruptX(&H13, XRegister, XRegister) FloppyWriteOK% = ((XRegister.Flags AND 1) = 0) END FUNCTION --- þ SLMR 2.1a þ Being weird isn't enough. --- TMail v1.30.4 * Origin: TC-AMS MLTBBS 2.2 - Minnetonka, MN (612)-938-4799 (1:282/7)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET