QB traps disk access errors

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
TmEE
Veteran
Posts: 97
Joined: Mon Mar 17, 2008 11:14 am
Location: Estonia, Rapla
Contact:

QB traps disk access errors

Post by TmEE »

Its been quite a long time since I was last here... anyway :

I've been writing another music making program, much more powerful than my last one and one nice thing with it is the file selector... but here is the problem, QB captures disk access errors... I don't even use QB's internal file management routines but mess with DOS ints directly to get file listings etc. and when I access a drive with no media in it (CD drive, memory card with nothing inserted) then my program gets halted with an error message. The routines that query files will give me the error codes and would allow me to do what I want.
I have tried ON ERROR GOTO xxx but using RESUME will only result in an infinite loop. In theory I could jump over the offending line but since it happens in a SUB I think I will lose 2 or 4 bytes of stack and that results in a nasty crash eventually. EDIT: This does not work. ON ERR which QB gives as an example for use in SUBs does not seem to work :/
I'm not aware of any ways to disable (some of the) QB's error checking...

Does anyone have any ideas ? I'd much rather not start messing with disk drives directly and parsing FATs........ D:

EDIT2: Seems I got to hijack DOS int 24h. Only problem with that is when my program crashes, QB will be in an intermediate state... QB takes over DOS int, I take over QB, then I got to give QB back the int and QB has to give it back to DOS...

Here's a screenshot of the nice file selector :
Image
(excuse the file path, its way too late to change it now, lot of stuff will get broken when it gets changed....)
TmEE
Veteran
Posts: 97
Joined: Mon Mar 17, 2008 11:14 am
Location: Estonia, Rapla
Contact:

Post by TmEE »

Sorry for double post, but I have got around my problem.

Solution was to have my own DOS Critical Error interrupt, which is the DOS int 24h. Little bit more of ASM magic and problem solved 8)
Mida sa loed ? Nagunii aru ei saa :P
Post Reply