1. Suppress Critical Error Message
- Posted by Lee woo seob <wslee at HHI.CO.KR> Apr 08, 1997
- 1022 views
Hi everyone! Before I begin my message on the subject above, I would like to express my sincere thanks to Mr. Jiri and Mr. Robert for their nice answers to the problem in my fast_puts() routine. The routine now works well perfectly!!!!. On the subject above: How can I suppress the critical error message printed on the screen when the drive is not ready? How can I know whether the drive A: or B: is ready or not before the program read the diskette? The message I want to suppress is : "Critical Error : Abort,Retry,Ignore,Fail?" I studied Interrupt Lists and have known that the Interrupt 24 can handle this critical error, however, I did not have any idea on how to use. The List says: "This interrupt should not be invoked directly... blah blah..." If there is anyone who knows how, please kindly share his knowledge with me. Wish to have good day to all Euphorian guys. Bye Regards from Wooseob --- my first name
2. Re: Suppress Critical Error Message
- Posted by Colin Taylor <71630.1776 at COMPUSERVE.COM> Apr 09, 1997
- 975 views
Lee woo seob wrote: >How can I suppress the critical error message printed on the screen when the >drive is not ready? How can I know whether the drive A: or B: is ready or >not before the program read the diskette? I have to say that this is near the top of my wish list, too. My (limited) understanding of this subject is that when a critical error occurs, DOS suspends all program activity until the the error is resolved. This means that you can't write an error handler in Euphoria because Euphoria will be inactive during this period. I have seen examples of error handling programs (written in assembler) that give detailed error messages in pop-up windows, etc. Is there anything like this that is readily available, customizable and will work well with Euphoria??? Colin Taylor 71630.1776 at compuserve.com
3. Re: Suppress Critical Error Message
- Posted by "Cuny, David" <ATB.DCUNY at HW1.CAHWNET.GOV> Apr 09, 1997
- 1020 views
re: drive not ready. I had a request to do the same error check with my editor before floppy disk writes. It's been on the back burner, but I've got some files from the All Basic Code packets that deal with the problem. The first file looks like an easy port to Euphoria; the second is in assembly, but looks like it's just a couple of BIOS calls as well, so it should be easy to port as well. You may want to check for space on the disk as well, since that will also generate an error. If you want, I can try digging that up as well. Hope this helps. -- David Cuny -- TESTDISK.BAS BEGINS HERE ' Function FLOPPYDRIVEREADY checks if disk is in drive ' Function FLOPPYWRITEOK checks if disk is write protected '$INCLUDE: 'QB.BI' DECLARE FUNCTION FloppyDriveReady% (Drive$, ErrCode%) DECLARE FUNCTION FloppyWriteOK% (Drive$) DIM SHARED Register AS RegType, XRegister AS RegTypeX A = FloppyDriveReady%("A", ErrCode%) IF ErrCode% = -1 THEN PRINT "Disk in drive." ELSE PRINT "Drive not ready." FUNCTION FloppyDriveReady% (Drive$, ErrCode%) 'returns True (-1) if the floppy drive specified in Drive$ 'has a disk in it. If the function returns False (0), ErrCode% 'contains the DOS error code. 'by Douglas H. Lusher, April, 1993 Drive% = (ASC(Drive$) OR 32) - 97 'reset floppy drive Register.ax = 0 Register.dx = Drive% CALL INTERRUPT(&H13, Register, Register) Register.ax = &H401 Register.cx = &H101 Register.dx = Drive% CALL INTERRUPT(&H13, Register, Register) 'call the interrupt twice since if a disk has just been inserted, 'the first time gives a wrong answer Register.ax = &H401 Register.cx = &H101 Register.dx = Drive% CALL INTERRUPT(&H13, Register, Register) FloppyDriveReady% = ((Register.flags AND 1) = 0) ErrCode% = ((Register.ax AND &HFF00) \ &H100) AND &HFF END FUNCTION FUNCTION FloppyWriteOK% (Drive$) 'returns True (-1) if the disk in the specified floppy drive 'is not write protected 'by Douglas H. Lusher, April 1993 Drive% = (ASC(Drive$) OR 32) - 97 'reset floppy drive XRegister.ax = 0 XRegister.dx = Drive% CALL INTERRUPTX(&H13, XRegister, XRegister) 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) ErrCode% = ((XRegister.ax AND &HFF00) \ &H100) AND &HFF END FUNCTION -- TESTDISK.BAS ENDS HERE -- READY.BAS BEGINS HERE ' Drive Ready source for PowerBASIC 3.x ' by BRIAN MCLAUGHLIN $LIB ALL OFF DEFINT A-Z DECLARE FUNCTION DriveReady( BYVAL Drive$ ) FOR X = ASC( "A" ) TO ASC( "F" ) PRINT "Checking..."; Ready = DriveReady( CHR$( X )) PRINT "drive "; CHR$( X ); IF Ready THEN PRINT " ready." ELSE PRINT " NOT ready." END IF NEXT '=============================== FUNCTION DriveReady( BYVAL Drive$ ) PUBLIC AS INTEGER '=============================== ' This FUNCTION returns -1 (true) if the drive is ready, or 0 (false), ' if the drive is not ready, or the drive letter is an invalid drive. ' It will NOT recognize a CD-ROM drive as being ready. DIM DriveNum AS LOCAL INTEGER DIM DriveIsReady AS LOCAL INTEGER DriveNum = ( ASC( Drive$ ) OR 32 ) - 97 DriveIsReady = -1 'assume drive will be ready ! push DS ! xor AX, AX ! mov DX, DriveNum ; zero - based drive numbering used ! int &H13 ; CALL BIOS TO RESET the drive controller ! mov AX, &H401 ! mov CX, &H101 ! mov DX, DriveNum ! int &H13 ! mov AX, &H401 ! mov CX, &H101 ! mov DX, DriveNum ! int &H13 ! jnc DriveOK ; carry set could be a fixed disk ! mov AH, &H1C ; so LET us look, USING DOS ! mov DX, DriveNum ! inc DX ; one - based drive numbering used ! int &H21 ! cmp DX, &HFF ! je DriveOK ! mov AX, [BX] ! cmp AX, &HF8 ! je DriveOK ! mov DriveIsReady, 0 DriveOK: ! pop DS DriveReady = DriveIsReady END FUNCTION -- READY.BAS FILE ENDS HERE
4. Re: Suppress Critical Error Message
- Posted by Architek <architek at GEOCITIES.COM> Apr 09, 1997
- 1000 views
Colin Taylor wrote: > I have to say that this is near the top of my wish list, too. My (limited) > understanding of this subject is that when a critical error occurs, DOS suspen ds > all program activity until the the error is resolved. This means that you can 't > write an error handler in Euphoria because Euphoria will be inactive during th is > period. I have seen examples of error handling programs (written in assembler ) > that give detailed error messages in pop-up windows, etc. Is there anything > like this that is readily available, customizable and will work well with > Euphoria??? I think you *can* do it in Euphoria. What you have to do is create, in assembler, a routine that will take care of the error. You should poke this routine into the 1st Mb of memory (allocate_low()). Then you must set the correct interruput to the appropiate memory address. This is theory, into practice unffortunally and don't know how to do it. I'm sure you can find some asm code in the net that deals with error handling, try to convert them into hex values. The trouble is to know wich interrupt vector to modify... maybe in Ralph Brown Int list or HelpPC are tips. But I think the best solution is to ask an expert... ask Jacques Deschjen. -- ************************************ This message sent by Daniel Berstein ************************************ email: architek at geocities.com homepages: http://www.geocities.com/SiliconValley/Heights/9316 http://www.cybercity.hko.net/silicon_valley/architek
5. Re: Suppress Critical Error Message
- Posted by "Cuny, David" <ATB.DCUNY at HW1.CAHWNET.GOV> Apr 09, 1997
- 992 views
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
6. Re: Suppress Critical Error Message
- Posted by Ad Rienks <Ad_Rienks at COMPUSERVE.COM> Apr 10, 1997
- 992 views
- Last edited Apr 11, 1997
A function to read the number of available bytes on a disk: -- CODE BEGINS HERE -- dskspace.e include machine.e global function dskspace(integer drive_num) -- return number of available bytes on disk -- return 0 if disk not recognized -- drive_num 0 is the default, a is 1, etc ... sequence reg_list -- initialize the registers reg_list = repeat(0, 10) reg_list[REG_DX] = drive_num -- call DOS function 36H reg_list[REG_AX] = #3600 -- do the interrupt 21H call reg_list = dos_interrupt(#21, reg_list) -- returns available clusters in BX, -- bytes per cluster in CX, -- and sectors per cluster in AX -- Note: total number of bytes on the disk = -- DX * CX * AX return reg_list[REG_BX] * reg_list[REG_CX] * reg_list[REG_AX] end function -- dskspace ---------------------------------------------------------------- -- usage: printf(1, "your a disk has %d bytes available.\n", dskspace(1)) -- CODE ENDS HERE cheers, Ad Rienks.