Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make QBasic apps utilize memory above 640k ??? 3

Status
Not open for further replies.

BobTheMad

Programmer
Jun 11, 1999
81
US
What is the best/easiest way to code a QBasic application to utilize memory above the conventional 640k barrier? I have a program I have written that has to perform SO many functions that it sometimes hits this barrier & crashes. I would love to just re-write the whole darn thing in VB 6.0, but unfortunately it has to run off a DOS 5.0 platform, so this is not an option.

Thanks in advance.
 
Here's a way to automatically use all available EMS, XMS and virtual memory in your BASIC apps. Download PowerBasic from It's fairly inexpensive.

I haven't tried it yet but it is definately on my to-do list. If I read the readme right, you can port all of your QB code directly into PowerBasic and away-ya-go.

It sounds really good. You can write TSRs, use true multi-threading, write in-line assember instructions, use huge arrays and loads of other neat things that are practically impossible to accomplish with QB.

The evaluation version is very limited (you have to re-type your code every time you compile) but I think I'll skip that part and get the whole package.

Definately worth a look by anybody serious about writing some serious BASIC apps.
VCA.gif

Alt255@Vorpalcom.Intranets.com
"To run Visual Basic, you must have certain hardware and software installed on your computer.
• Any IBM-compatible machine with an 80286 processor or higher.
• One megabyte of memory."


Visual Basic Programmer's Guide
 
To MiggyD:

Thanks for the reply. I used 'Shell' rather than 'Run' for sorting.

This latest application of mine used 6 programs all linked with 'Run'. The application hopped from program to program as needed. Each of these progs generated a 'carry.dat' file on exit which was used to provide the next prog with variables it would require, and instructions on which of its various sections to use - the Print prog, for example, dealt with the printout of two databases and various sorted lists of results. So in effect each program, although self-contained, was working under instruction from its previous program. Included in the 'carry.dat' was the name of the program that the new prog was to return to when it had finished.

The application included a database of club membership, and because the club was growing, the list could be as long as a piece of string! So I used a commercial sort program because of memory limitations when sorting large arrays. I used 'shell' because it provided a means to use the sort prog and then get back in to QB where it had left off. The Print and Database progs both needed to sort.

The 'Run' statement would have ended the app when the sort prog had finished because there was no 'forwarding' information in the sort prog. I suppose I could have used a Batch file but I thought that was a bit 'messy'.

So I was pleased to read the enquiry from BobTheMad - it stirred the grey matter and prompted me to find a solution.

Keep up the good work you programmers - every reply you give to a query is a gem, and with every one I read, I learn something!
 
That library sounds like it might be the way to go, but unfortunately the link to it on the page you provided does not seem to work... Thought for the day: Beware of Gods who cannot laugh...
 
BobTheMad:

Try copying the link and pasting it on your [red]address bar[/red] then click on "GO". That worked for me.

--MiggyD
 
So, Toshi, you must not have liked Power Basic.

Thanks for the warning. I think you just saved $170 out of my pocket.

Thanks! (As always, I respect your advice.)

VCA.gif

Alt255@Vorpalcom.Intranets.com
"To run Visual Basic, you must have certain hardware and software installed on your computer.
• Any IBM-compatible machine with an 80286 processor or higher.
• One megabyte of memory."


Visual Basic Programmer's Guide
 
Just to let you all know... I FINALLY figured out a way to make it work. QB 7.x has the ability to create 'overlays' in an application. These overlays basically swap out sections of code into Extended memory when they are not being used. I was able (with minimal difficulty) to place approximately 75K worth of code into 2 overlays with no performance loss.

Thanks for all your suggestions. I probably would not have found this opportunity without them.

If anyone wants more detail on how to do this, lemme know and I will write up a FAQ. Thought for the day: Beware of Gods who cannot laugh...
 
That's sounds interesting, Bob. I haven't used much QB 7 but I really ought to. Write up the FAQ, please. It might give us all an incentive to take that leap.
VCA.gif

Alt255@Vorpalcom.Intranets.com
 
Ok, I wrote up & submitted the FAQ. When I get it approved by Tek-Tips, ai will post the link... Thought for the day: Beware of Gods who cannot laugh...
 
Hello everyone, I'm reading the comments and still don't see a definite answer. I have an old version of QBasic and I need to know how to use upper memory for one of my programs. Any feedback is appreciated.
 
JBDaKid,

I don't believe you can use more than 64kb (probably half of that) with the Qbasic that shipped with MS-DOS. I could be wrong and I hope that somebody points out my error but I believe you will have to obtain QB45 or higher and use a custom library or break up the segments using overlays, as BobTheMad pointed out. The problem with standard Qbasic is that it must interpret the code and I don't think Microsoft wanted anybody to write anything very useful with free software (dirty dogs, they). You really should try to upgrade so, at least, you will be able to compile your apps into EXE's.

If you can't find a copy of QB7 you might try buying PowerBasic, which is supposed to handle the memory woes automatically (I still haven't tried it myself but I'll probably get around to it one of these days.)

Sorry. Maybe another member has a different suggestion.
VCA.gif

Alt255@Vorpalcom.Intranets.com
 
I have to agree with Alt255 on this one. If you really want to be able to create quality applications with QBasic, then you should attempt to locate a copy of QB 4.5 or highter (7.x would be the best though). I toyed around for a while with the evaluation version of PowerBasic, and it seems like a very powerful tool. The 'Future Libraries' also would allow for the extended memory usage.

But if you are looking to modify a current application without having to 'port it over to a new system (like PowerBASIC), or include new library routines (like Future Libraries), then the overlay method I located works great. Thought for the day: Beware of Gods who cannot laugh...
 
Alt255, I didn't mean it as a warning. I just gave a solution that was free (in cost). In fact, I do like PowerBASIC more than QB, but my peers are using QB, so I am too.
I agree with BobTheMad, QB4.0, QB4.5 and 7.1 are quite nice compared to 1.1. Here's a tip: use QB4.0 for programs with lots of floating point calculations.
You CAN use EMS with QBasic 1.1 though. I've seen it done. You just need to get an asm interrupt routine like I'm 95% sure you can do XMS too, using CALL ABSOLUTE and some asm strings. You won't be able to do DIM a#(32767) though, since it doesn't do arrays greater than 64K. The p-code interpreter in Qbsic 1.1 is slower than in QB4.5 too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top