Full Version: Qbasics for Windows
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
For a long time, to be able to use big dimensions in the Quickbasic I have been thinking to use the Windows. In some helps it is said that the Quickbasic also can be used for the Windows but never I have known how.

I made a test for a big dimension in the Visual Basics 1, 2 and 3 for Windows:

Dim Nothing(100, 100, 100) As Integer

The Visual Basics for Windows 1 and 2 respond with the error message: "Subscript Out of Range"; but NOT in the Visual Basic 3.

Making the Link knowledge base I found the next article that I put as the first article:

Determining the Default Exetype Value in Microsoft Link

In this article it is said that, beginning with the version 5.3 of the Link it's possible to create executables for Windows.

Seeing the versions of the several Quickbasics Links in the QBasics Files Dictionary, it can be read that only the Visual Basics for Ms-Dos have the version 5.31.009 to be used for Windows.

I did install the Visbasic Dos.

Now, to create an executable for the Windows I have been trying the next three steps using the files of the Visbasic Dos:

(Step One).~ The Link, to create an executable, it needs an object file (Test.Obj). The object file (Test.Obj) it is produced by the Basic Compiler using the source file (Test.Bas).

Using the next line in any Basic compiler:

Dim Nothing(100, 100, 100) As Integer

it responds with the error: "Subscript Out of Range". So that, as a source file I used the next lines in the source file Test.Bas:

Input "Put a number for a matrix of 3 dimensions: ", Variable
Dim Test(Variable, Variable, Variable) As Integer

In that way it is possible to produce the file Test.Obj.

(Step Two).~ The Link also it needs a definitions file (Test.Def) in the one which you indicate in what operating system you are going to use the executable. The definitions file (Test.Def) only it's a text file. In this case, apparently only it needs to have the next line in this case:

"Exetype Windows"

It is Not necessary to indicate that it is for the Windows 3.0 because that it is defaulted from the Link 5.3, that can be read in the article:

Prb: Link versions 5.03 to 5.2 Require Exetype Windows Stmt.

(Step Three).~ To use the Link to create the executable Test.Exe using the next command line:

Link  Test.Obj, Test.Exe, , , Test.Def

It compiles without any error, but when I run the Test.exe always shows the next error message:

"This program requires Microsoft Windows."

I don't know why it can't detect the Windows.
What is it wrong in all this?
I am using Windows 98SE.
I couldn't test this in a Windows 3.1
I also found this next article in the Link knowledge base about that error message:

Prb: Unexpected "This Program Requires Microsoft Windows" Msg

It says that, that error it's present compiling from the Fortran and it is advisable to take out an error produced by the Link using the program Exehdr.exe with the option /Reseterror.

This utility it is in the PDS downloads. I ran this program in the indicated way but I had the same error message.

Also I tried interchanging the Ms-Dos versions for the program Test.Exe put in the Setver.exe: 6.22, 4.10, 7.00, 7.10
Just for testing I did install the files of the PDS to be able of compiling for OS/2 Protected Mode the Test.Obj file and linking with the Link utility of the Visbasic Dos to get made the Test.Exe but in this case the error message responded was: "This program can not be run in Ms-Dos mode".

I think the message changed because the executable was made for the OS/2 protected mode Not the Dos. That leads me to think that the utility Link it's correct. So, the error must be somewhere else.

If doubt$ = "This program requires Microsoft Windows." Then
Print "What kind of Windows can be?"
End If
I have already tested it in Windows 3.11 without results. I have found that that message it's because the system it's expecting to find a visual program containing forms for Windows.

Using the Visbasic Dos to convert that code in a form with a single command button and using the utilities of the Visbasic Dos like the Projects Translator and the Forms Translator, the program can be easily loaded in the Visbasic 1 for Windows or the 3 just receiving a message that those binary forms will be upgrated to be run.

Using the Visbasic 3 my computer of 128MBS. of Ram could support:

Dim Anything(200, 200, 200) As Integer

This is not the solution that I want because I have not been looking for a 'Visbasics Dos for Windows' solution but a 'QBasics for Windows' solution. But to test it has been pleasant.


A few remarks are in order.

First, to test the maximum value of x for a three-dimensioned array in QuickBASIC (QB), I wrote a simple program, which consists of the first five lines of the code below.

When the program is run, I find that the value of i where the array fails is 20, making ARRAY(19,19,19) the maximum array for the stated conditions.

Next, since you are looking for large, three-dimension arrays in QB, and that is not possible, to my knowledge, beyond the above dimension 19, I propose the use of multiple such arrays.  And, to illustrate this, I came up with the following QB program.  Comments?:


'Array.bas creates two, 3-dimensional arrays of dimension (19,19,19), which
'is the maximum size of 3-dimension array I could create in my QB4.5, using
'the following code, before it produces a "Subscript out of range" message:
FOR i = 1 TO 100
  REDIM array(i, i, i)

'ARRAY.BAS, by Ralph A. Esquivel, 01/09/08, shows how to use two arrays and,
'by extrapolating the program, a large number of such arrays.

x = 19 'array size to use is (x,x,x), which allows:
'1*6,859 =  6,859 elements for one array
'2*6,859 = 13,718 elemens for two arrays

DIM array1(x, x, x) AS DOUBLE
  FOR i = 1 TO x
    FOR j = 1 TO x
      FOR k = 1 TO x
        a = a + 1
        array1(i, j, k) = a
        PRINT array1(i, j, k);
      NEXT k
    NEXT j
  NEXT i

DIM array2(x, x, x) AS DOUBLE
  FOR i = 1 TO x
    FOR j = 1 TO x
      FOR k = 1 TO x
        a = a + 1
        array2(i, j, k) = a
        PRINT array2(i, j, k);
      NEXT k
    NEXT j
  NEXT i

Above, I posted a possible solution to your thoughts on large arrays in QB.  Since then, I have explored farther, and have found that I can create a number (N) of three-dimensional arrays of the type  A(x,x,x), as follows:
            Total # of
  x    N  Elements
25    5  78125
24    6  82944
23    6  73002
22    7  74536
21    9  83349
20  10  80000
19  12  82308
18  14  81648
17  17  83521
16  20  81920

It would seem safe to assume that just about anybody should be able to approach those levels, which falls short of your desired three-dimensional arrays with x = 100 (1,000,000 elements), and higher, as the most I could get, using my method, would be 78,125 elements using 5 arrays with  x=25 (equivalent to a (42,42,42) array), or  82,944 elements using 6 arrays with x=24 (equivalent to a (43,43,43) aray).

However, back in 1986, I had the problem that Bechtel, the engineering company that I worked for, had a requirement for a 100-bus electrical voltage-drop program.  We had a BASIC program we bought from General Electric that was good for 25 busses.  It turned out that there were 4 (or was it 5?) three-dimensional arrays of (bus,bus,bus) size.  I tweeked that program, and got 28 buses maximum!  Finally, I learned of an IBM (or was it MicroSoft?) program that allowed one to use "far memory", which allowed me to convert the original 25-bus program to 120 busses.  Unfortunately, I don't have that program, nor do I remember its name.  Perhaps an intense search could find it?
I use the PDS. I did try just using the next lines.

FOR iii = 1 TO 24
REDIM array(iii, iii, iii) 'AS STRING
PRINT iii;
NEXT iii

The results were:
In the QBx: 24 without /AH, 36 with /AH
In the QBx: 21 without /AH, 21 with /AH Redimming As Strings
Compiled: 24 without /AH, 48 with /AH <---
Compiled: 23 without /AH, 23 with /AH  Redimming As Strings

You report that you managed to create a 3-dimension array(x,x,x), with a maximum value of x of 24 (36 using /ah), while in PDS.  But, for strings, the maximum value of x$ was 21, whether using or not using the /ah switch.  Interestingly, bt understandable, your results indicate that the /ah switch applies only to numeric arrays.

Also, as you have confirmed, QuickBASIC 7.1 (PDS), cannot produce, by itself, 3-dimensioned arrays with more than some 25^3 = 15625 elements (15625*4 = 62,500 bytes) without using /ah, and some 36^3 = 46656 elements (186,624 bytes) using /ah.  Please note that I was able to obtain exactly that number of elements and bytes with 6 arrays, each with an x of 24, or 24^3*6 = 82944 elements = 186,624 bytes. This corresponds, very nearly, to the available memory in the 640K allotted to QuickBASIC programs. 

So, we seem to be butting our heads on the memory available to QuickBASIC 4.5 and PDS.  I still believe we need to link our QB program to another program, that allows using far memory, as I used long ago.

What do you think about the above?  Where can we find such a program to allow using far memory?
(01-31-2008, 06:58 AM)Ralph link Wrote:I still believe we need to link our QB program to another program, that allows using far memory, as I used long ago.

I believe so too.

(01-31-2008, 06:58 AM)Ralph link Wrote:Where can we find such a program to allow using far memory?

Possibly between asm coders.
Pages: 1 2 3