Qbasicnews.com

Full Version: Newbie: FB-DOS: CHDRIVE and "CALL INTERRUPT/X"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Very new to FB (only a few hours!!) - seems like an excellent product.

I've tried compiling a few QB/PDS programs, and hit issues only with CHDRIVE, and CALL INTERRUPT. I've looked through much of the various DOCs available, and note that:
- CHDRIVE is rarely noted in the DOCs anyway,
- CALL INTERRUPT is not supported for some obvious reasons (cross-platform, etc)

Is anything like CHDRIVE available in FB, or should I write an equivalent CALL INTERRUPT function? (I'm very familiar with ASM/DOS)?

Anyone written any FB "wrappers" to replace CALL INTERRUPT/X? It looks like a SUB to just load the Regs/Flags from the supplied vars, INT 21h, save the Flags/Regs for the caller, and Return. From what I've read so far on FB, I don't know if the Seg-Regs should be loaded or not (especially for INTERRUPTX), nor what should be placed in them. With some guidance, I'll gladly play with these, or, indeed, I'll be glad to help on any other similar 16-bit ASM items.

Thank you,
- Mike
If you're using the Win32 version of FreeBASIC, then you don't need ASM. Oh, sure, you could use inline asm, but that wouldn't work, as the majority of ASM that worked with QB was 16-bit, FreeBASIC is 32-bit, so it wouldn't work too well.

Bottom line: you should never have to use ASM in FreeBASIC (except maybe for optimization) and absolutely NEVER try to use interrupts with it. I tried using interrupts with inline ASM and VC++, and it just crashed my system. So don't try it, you'll get bad results.
You can use inline ASM in FB

No need to use call interrupt anymore, nor call absolute for that matter.


Dont know about CHDRIVE, but using relative paths is a given, and you chould be able to code around drive changes..


But I dont know what the program is for, if it's a prog to browse HD's you need CHDRIVE, kind of obvious Tongue
Good Grief!! - 2 responses within SECONDS!!. Thank You!!

All my queries applied to older DOS utilities...

The CHDRIVE is used many times on an old utility which matches folders & files - copying/moving/deleting files to Sync the folders - but the utility is also a bit "specific". Internally, it's just a simple Int-21 function, so if I could get a good approach for the CALL INTERRUPT issues, then this could easily be resolved.

Re Interrupts: I should have clearly stated I was referring to the "CALL INTERRUPT/X" syntax to issue Int-21h functions - Not "Interrupts" in the more general hardware sense. These CALLs are used many times for Int-21h functions that were not available in QB/PDS - setting DTA, Reading File-names (FindFirst/Last), etc.

Thank you,
- Mike
No need for a CHDRIVE function. Just do
Code:
CHDIR "A:\"
to change current dir/drive to A:\
As for your need for old DOS int 21h, FB has a built-in DIR$ function that works like the PDS one:
Code:
DIM file AS STRING
file = DIR$("*.bas")   '' This acts as a findfirst
WHILE file <> ""
  PRINT file
  file = DIR$    '' No arguments; acts like a findnext
WEND
It's possible to add a second optional parameter to DIR$ to specify attributes? This way hidden files or dirs could be searched...
I second that sugestion
Thanks to everybody again. These are super solutions!

I reckoned that CHDIR would not change the drive - the DOCs say "If in windows or dos, this changes the current directory on the given drive but does not change the default drive." However, I'll give it a whirl.

I'll need to review all my INTERRUPT Calls, to check what functions I'm calling, and to then check on equivalents in FB. The DIR$ command (with the ATTRIB option) will meet the FindFirst/Next options very nicely.

Super support. Thank you very much.
- Mike
DIR$ has an optional argument, called attrib, don't ask me for the values, Angelo coded it ;)
Aaaah, that's the unofficial API of FB!!! I knew someone would talk too much someday..... I will start a 1337 site to hunt for those hidden things. Down with the FB monopoly!!! :rotfl:
Pages: 1 2