twelve

In DOSBox 0.74, I can run GWBASIC.EXE without any problem (DOSBox reports 632 KB of free conventional memory). It is GW-BASIC's version 3.10 dated 01-07-1989 with filesize 72576 bytes. On screen it shows:

GW-BASIC 3.10
(C) Copyright Microsoft 1983,1986

61934 Bytes free

Whenever I try to launch the program in one true DOS 6.20, so without the use of any emulator, I receive an "Out of memory" message and the DOS prompt reappears instantly.
I have reduced the setup of that DOS system to the bare minimum, and currently I have 589552 bytes of free conventional memory as reported by the MEM command. To me 575 KB seems like an insane memory requirement. I think in the past I could run GW-BASIC in DOS 3.3 on an XT computer (8088) that had only 512KB of conventional memory.
So what is the minimum memory requirement for GW-BASIC? Or broader, what are the system requirements to run GW-BASIC, in case that "Out of memory" message is to be taken as a generic, but silly error message?

[ Further steps ]

Raffzahn's point about requiring 'at least 1 floppy drive' looked promising to me. I quickly attached an USB floppy drive and witnessed the Equipment Status change from 0026h to 0027h which means BIOS recognized the floppy drive. Sadly, it did not help in launching GW-BASIC.
Next I dug out an old Pentium 166MHz and there launching GW-BASIC worked flawlessly. Following this, I tried to mimic the Pentium's DOS setup on the current system (Intel Pentium 1.73 GHz dual core processor T2080) but found it wasn't the cure I was looking for.

[ Conclusion ]

My real intrest in GW-BASIC was to study how the PLAY statement operates and what differences there might be between GW-BASIC and QBASIC in this respect. Since by now I have taken the trouble of setting up the old Pentium, I can already do all the testing that I need. So I won't pursue this on the newer computer, where it's probably the more advanced hardware that causes the problem. Next quote from paxdiablo's answer rouds it up:

I suppose the bottom line there is that it's not that the memory requirements are an issue, but that the ability to run it at all (at least in a supported manner) is the problem.

fourteen
  • twelve
    99% certain that not only did it not require 512K but that it would run in a very small amount of memory. I suspect the 61,934 bytes is not "that's all that was left from 632 KB" but rather "that's all that was left from a 64 KB segment". If I'm correct, then the memory needed to run it would be basically "DOS requirements" + "code requirements" + 64 KB. Likely 256 KB would be enough in an earlier version of DOS . Later versions (e.g., 5 and 6) tended to rely on EMS to relocate things and end up with more RAM, but without EMS things don't always work so well. May 19 at 15:32
  • five
    GW-BASIC is (very roughly) BASICA. COM plus the ROM BASIC core, and it’s intended for computers without ROM BASIC. The Basic program + data will be limited to a max of single 64kb segment but it can surely do with a lot less because its ROM BASIC core could run on 16KB of RAM. I would expect it to run handily on less than 96KB and I would be shocked if it needed more than 128KB, but I personally never tried on less than 256KB, so not an answer. May 19 at 16:57
  • three
    Also, DOS’s error for an EXE that asks for too much memory in the header is “Program too big to fit in memory”. “Out of memory” has to be a runtime error, which is weird here. I have to wonder if the EXE is corrupted? May 19 at 17:25
  • two
    Certainly IBM Basic ran in 16k. I ran it in 1984 on a IBM PC (at Watson Labs) on a IBM PC with a whopping 32k. More intensive calculations on Raman spectra were done on the (IBM) mainframe using various languages including Rexx. May 20 at 1:56
  • one
    The 3.10 version you're running might be configured oddly. The more readily-available GW-BASIC 3.23 might work better. Even the very old v1.90 from Columbia Data Products Software Suite And User Manuals (circa 1982) seems to run on a fully-expanded system
    –  scruss
    May 20 at 16:57

5 Answers five

Reset to default
thirteen

One thing you may want to look at. I remember encountering a bug in one of the Borland products in that they complained of being out of memory on a 640K, himem-aware, DOS 6.22 system.

That was due to the fact it used a signed comparison sequence rather than unsigned (e.g., jl rather than jb ). This led to the problem that anything greater than 512K available indicated a negative value. So, if the program needed 128K and erroneously calculated it had -32K free, it would assume not enough memory.

To fix this, I had to track down the jump instruction and change it to the correct type.

I have no idea if this is the same cause of the problem that you're seeing but, given GW-BASIC was first introduced with MSDOS 1 (I think) and was supplanted by QBasic in MSDOS 5, it's possible it never ran in a system where more than 512k was free. Your comment that it ran on a system "that had only 512KB of conventional memory" also seems to gel with this possibility.

One way to check if this is the cause is to reduce your memory supply to below the 512K barrier and see if it magically starts working.

Finding the errant instruction (in the Borland product) wasn't easy but was eventually achieved by meticulously disassembling and testing changes and, eventually, using something like the Sourcer intelligent disassembler which made it much easier (assuming that you can still find it).

The task may be less work in this case since at least one version of the program is available on GitHub . However, there's probably a big difference between that version and 3.10.

In fact, initial analysis of that early version seems to indicate the 512K boundary is unlikely to be the problem - the "Out of memory" message only shows up during FDB allocation: INIFDB calls FALLOC which generates that message if there's not enough room between the pointer to the free string space and the end of that string space.

It tries once, then retries after garbage collection if first attempt failed, then generates that error if it still fails.

That limited error generation scenario seems strange but there may be other occurrences "hidden" in the fact this code was automatically translated from an earlier (8080?) version so includes such beauties as INS86 71, 36, FRETOP instead of real 8086 mnemonics like CMP FRETOP, BX .

In any case, this (translated) version very much uses segments so it's likely that you'll only have a single segment for code/data/stack. In other words, its limits will be related to 64K rather than 640K.


You should also take note of the information on the GW-BASIC Wikipedia page :

Microsoft did not offer a generic version of MS-DOS until v3.20 in 1986; before then, all variants of the operating system were OEM versions.

Some variants of BASIC has extra features to support a particular machine. For example, the AT&T and Tandy versions of DOS include a special GW-BASIC that supports their enhanced sound and graphics capabilities.

On the assumption that GW-BASIC versions tracked the MSDOS version number, that means your version 3.10 is an OEM-specific version so may well have very hardware-specific stuff embedded in it. You would probably be better moving to at least the generic 3.20 (or the latest available, 3.23).

That might also explain why it works in DOSBox and not on raw hardware. Since the former is meant to provide the ability to run a great many older programs, it may well have far more (emulated) hardware options than a normal system.


On your comment that GW-BASIC ran fine on DOS 3.3, that may well be true. It's doubtful Microsoft expended any effort in getting GW-BASIC running under MSDOS 5+ since QBasic was by then the anointed method.

Hence, any bug report where it may not run under MSDOS 6 would probably have been rejected outright by Microsoft. If it runs in the same MSDOS version under DOSBox, that may be entirely by accident :-)

In fact, I'm not even sure it makes sense to think about what version of MSDOS is running in DOSBox. I seem to recall it doesn't actually run a real version, instead opting for running its own code that faithfully reproduces the behaviour. From the Wikipedia page for DOSBox (my emphasis):

DOSBox is a full-system emulator that provides BIOS interrupts and contains its own internal DOS-like shell. This means that it can be used without owning a license to any real DOS operating system.

I suppose the bottom line there is that it's not that the memory requirements are an issue, but that the ability to run it at all (at least in a supported manner) is the problem.


six
  • one
    While something like this is possible, there were add-on boards to expand all the way up to 640K pretty early on, certainly before MS/PC-DOS 5. May 20 at 2:42
  • four
    I used GW-BASIC on MS-DOS 3.3 with 640K of RAM without running into “Out of memory” errors, so I doubt this explains the issue in the question. And GW-BASIC runs fine under MS-DOS 5.0 and 6.x. May 20 at 10:30
  • @manassehkatz-Moving2Codidact: DOS 5 allows portions of itself to be located at storage outside the 16-bit 8086 addressing space. In some configurations, the amount of memory available to an application under DOS 5 could thus be higher than under earlier versions. If e.g. an application's code would take 80K, free memory on a 640K machine would be less than 512K if the OS used more than 48K. but more than 512K if the OS uses less.
    –  supercat
    May 20 at 17:13
  • I wonder if he has a different copy of GW-BASIC than I do because my copy works.
    –  Joshua
    May 20 at 18:52
  • two
    I found the same signed / unsigned comparison error in the IBM Cobol compiler. It would also report not enough memory if there was more than 512kB.
    –  badjohn
    May 22 at 6:28
nine

There is no single GW-BASIC. Each OEM could customize portions of it to fit its own custom hardware. For example, I had an Epson computer with a 640x400 all-pixel-addressable video adapter on the motherboard and GW-BASIC had customizations to SCREEN, PSET etc. to use it fully.

It’s possible the copy of GW-BASIC you are using is designed for a computer with hardware that is emulated by DOSBox but not present in the actual PC with DOS 6.20, and that GW-BASIC is crashing while trying to initialize/reset that hardware.

It’s not a strong possibility in your case because I would expect such a version of GW-BASIC to include a copyright notice from the OEM at startup, and you don’t report any such message.

two
  • The version of GW-BASIC that I use, is the one that was bundled with the 8088 XT that I bought in 1990. And indeed, I have never seen any OEM copyright notice appear. May 21 at 20:27
  • Euro, I think that was true up until 3.20. That's where MS started shipping a generic version.
    –  paxdiablo
    May 22 at 3:17
nine

On screen it shows:

GW-BASIC 3.10

(C) Copyright Microsoft 1983,1986

61934 Bytes free

Looks quite fine to me.

Whenever I try to launch the program in one true DOS 6.20, so without the use of any emulator, I receive an "Out of memory" message and the DOS prompt reappears instantly.

Does 'The Program' here refer to GW-BASIC or a BASIC program launched with GW-BASIC?

GW-BASIC is a modified BASIC(A) which itself is a rather straight port of MBASIC 5 from 8080 to 8088. It is a plain 16-bit application and allocates a single data segment of up to 64 KiB as workspace.

That segment can further be controlled by the /m:m[,n] command line switch where m sets the amount of memory it uses within the data segment (decimal) and n the amount of paragraphs beyond that to be reserved for user need.

GW-BASIC also allocates a stack space within the data segment (part of the 'm' memory). This is set by default to 512 bytes. It can be changed by using CLEAR ,,s with S being the size of desired stack. This needs to be done at the start of a program, as CLEAR clears all variables and the stack.

Out of memory is reported at startup when either of these values cannot be guaranteed. During execution it will happen when a program reserves too many variables or runs out of stack space - for example with too many nested GOSUB or FOR .

So what is the minimum memory requirement for GW-BASIC? Or broader, what are the system requirements to run GW-BASIC

GW-BASIC was part of DOS 3.20 and runs on any 3.20 capable system which in turn means at least 1 floppy drive and 128 KiB of RAM or better.

five
  • one
    With 'launch the program' I exclusively refer to launching GW-BASIC itself. Your point about requiring 'at least 1 floppy drive' looked promising to me. I quickly attached an USB floppy drive and witnessed the Equipment Status change from 0026h to 0027h which means BIOS recognized the drive. Sadly, it did not help in launching GW-BASIC. May 21 at 20:49
  • @SepRoland Ok, this is helpful. So is it the DOS message or a custom one?
    –  Raffzahn
    May 22 at 14:35
  • I strongly believe the 'Out of memory' message originates from GW-BASIC. DOS displays (error) messages on the console wherever the cursor is, but I receive this message on the top row of the screen even if the cursor was at a row further down. Also, and this I found by subsequently running Norton Editor, the video mode had changed from CO80 to MONO . I have never seen DOS do that on its own. May 26 at 14:10
  • @SepRoland Ok, helpful detail.
    –  Raffzahn
    May 27 at 8:56
  • @SepRoland: I think you're right, that particular string shows up even in the very early GWBasic that MS has released the source for.
    –  paxdiablo
    May 28 at 9:50
one

Did you try loadfix? Even with setver older programs that run completely in the first 64k of ram on dos 5 and newer systems had this issue. If you choose not to do this then I'd suggest leaving dos low and throw something else up there if you want.

New contributor
Michael T is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct .
one

I think your issue is a simple incompatibility with DOS 6.x.

Your GWBASIC came with DOS 3.10. I’d wouldn’t expect it to work with anything but DOS 3.10.

Early DOS 3.x releases saw a lot of changes as networking support and various things were just then being introduced. 3.10 was quickly replaced by 3.20 in 1986, and finally the long-lived 3.30 in 1987. Point being, 3.10 could have lots of things going on, and because it wasn’t in use for long, it really didn’t matter. Back then the programs that came with a specific version of DOS were tightly coupled to that release. That’s why later SETVER was introduced, to allow faking DOS version reported to an application. That didn’t mean it was guaranteed to work, only that the version check is disabled. But even that was meant for 3rd party applications, not the bundled ones.

You’ll want to run it in its native habitat— DOS 3.10. If that isn’t possible, you might have better luck with the DOS 3.30 version since it was around longer and there is a higher chance that later DOS releases were tested and made to work with it.

New contributor
bitslasher is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct .
one
  • As I mentioned in the original post, "I dug out an old Pentium 166MHz and there launching GW-BASIC worked flawlessly." I should have added that I run DOS 6.20 on that old computer too. So it's not necessarily the more recent DOS version that is to blame. 8 hours ago

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .