problem with OUT OF MEMORY
problem with OUT OF MEMORY
(OP)
for those of you who want to jump straight into the question, basically...
i'm looking for a programming environment thats essentially just like qbasic but can compile using more memory.
for the longer explanation... ive been writing a game in Qbasic (4.5) and ive reached a point where i cant add anything without getting a "OUT OF MEMORY" error when i compile. so what next?
as for what ive done so far, i tried downloading some other compilers. i was hoping visual basic was similar, but its not... i tried a compiler called rapidQ, but i didnt understand it at all (although i cant say i spent much time there...) and i tried freebasic, which claims to be just like Qbasic, but i couldnt even get to the command prompt for it. after installing it and running the shortcut it puts on my desktop it only opens a dos command prompt, and i tried running every .exe in the folder and they all seem to do nothing.
basically i just want to be able to finish this little project of mine without having to learn a whole new programming language. i dont understand much about compilers im finding, but i just want something that can run my code. which id love to link for you if you're interested! but there doesnt seem to be an attachment option...
anyway any help would be appreciated! thanks in advance!
i'm looking for a programming environment thats essentially just like qbasic but can compile using more memory.
for the longer explanation... ive been writing a game in Qbasic (4.5) and ive reached a point where i cant add anything without getting a "OUT OF MEMORY" error when i compile. so what next?
as for what ive done so far, i tried downloading some other compilers. i was hoping visual basic was similar, but its not... i tried a compiler called rapidQ, but i didnt understand it at all (although i cant say i spent much time there...) and i tried freebasic, which claims to be just like Qbasic, but i couldnt even get to the command prompt for it. after installing it and running the shortcut it puts on my desktop it only opens a dos command prompt, and i tried running every .exe in the folder and they all seem to do nothing.
basically i just want to be able to finish this little project of mine without having to learn a whole new programming language. i dont understand much about compilers im finding, but i just want something that can run my code. which id love to link for you if you're interested! but there doesnt seem to be an attachment option...
anyway any help would be appreciated! thanks in advance!
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
http://ve
and downloaded it, but it contains no installation instructions
i found some other instructions, but they seem incomplete... heres a screenshot of where i ended up
http://i7
basically, how do i install it?
RE: problem with OUT OF MEMORY
htt
Unzip it to its own directory such as PDS71. It should be enough to get you going.
RE: problem with OUT OF MEMORY
As far as the install you tried, I ran it, got the same error you did, then just ran setup again and it ran to completion...
RE: problem with OUT OF MEMORY
ive been able to continue my game because i realized i was reserving way more memory than needed (every graphic i reserved 280 when i could get by with 256, etc...) so i lowered some numbers. but i realize this is only a temporary fix, and ill probably run out again.
vbs7.1 talks about tapping into extended or expanded memory though, and i tried reading the help files like 4 times and doing what they said, but i guess i dont understand it.
for example, in the expanded memory help it says if i run the program by typing QBX /e:500 /EN it should reserve 500k extra for me. but it just didnt recognize the command. any suggestions?
and thanks for your help so far!
(side note: the help sections im referring to are in contents->Qbx memory and capacity)
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
? fre(-3)
The value returned will be remaining space in expanded memory (in kilobytes). The following is from the help file on Using Expanded Memory.
If expanded memory is available to QBX, it automatically moves all units of program code between 512 bytes and 16K in size, inclusive, out of conventional memory into expanded memory. Each procedure (function or sub) is a unit of code. The module-level code also constitutes a unit of code.
To see how large each procedure is, use the View Subs ommand (press F2). You can determine which units are larger than 16K and need to be divided into smaller units.
What is the statement where you run out of memory and is this a run-time error or while editing?
RE: problem with OUT OF MEMORY
i noticed the bit about moving things 16k-512k... all my subs are 11 or less (but i have 36 subs that all do various seperate tasks...) so its not moving them into expanded memory right? anyway i can tell it to move things 6k and up or something?...
i use a lot of variables, and right now the out of memory error highlights one of the arrays close to the end of all my DIM SHARED statements at the beginning
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
file, try splitting it up butting some of the subs in separate bas files with no executible code then use the load option (first time) to load all the bas files. then when you compile, it will compile each separately then link them together allowing larger programs. That may help.
RE: problem with OUT OF MEMORY
Using FRE(-3) and Expanded Memory
o If expanded memory is not available, FRE(-3) returns the message "Feature unavailable."
What operating system are you using? By default, XP's command prompt is giving me 4MB of expanded memory.
FRE(-3) in QB 4.5 returns a different value, "The size of the next free block of string storage"
What type of variable does array Bob() contain?
And be sure to read Buff1's post.
RE: problem with OUT OF MEMORY
oh and by the way im running XP as well. the bob() array was just whatever the default value is, which i believe is int? i didnt set a standard manually...
in response to buff1, your solution sounds like it should help, but i dont seem to fully understand how to do it. for example, i wrote 2 programs. one called loadtes1.bas which simply contained (brackets not really there :P
{dim shared a
a = 3
printA
print "in the main program, a =";a}
and then i made a second program called loadtes2.bas. which had nothing but a sub called printA which had
{print "in the sub a =";a}
i opened loadtes1.bas and used load to add loadtes2.bas as a module. and when i ran the program i got
"in the sub a = 0
in the main program, a = 3"
so i know its accessing the sub, but apparently its not passing the variable a to the second program. can i make a shared through everything? or will i have to pass the variables im using into the sub every time? cuz my subs often check various arrays of 8 players worth of data, which would be a pain to pass into the subs :(
thanks everyone helping btw!
RE: problem with OUT OF MEMORY
First, do yuo want to continue using 4.5 or try to get PDS 7.1 going?
Next, the default variable used by QuickBasic is single-precision, which requires 4 bytes. If you don't require floating-point and no value exceeds 32767 or is less than -32768, than a DEFINT A-Z at the beginning of your program may gain you more space as integers occupy only 2 bytes.
In order to share variables between modules, you will need to use a COMMON statement in each module listing the variables you wish to share.
RE: problem with OUT OF MEMORY
DIM SHARED temphand(12)
nothing special. i tried initializing it again and it flags it as a duplicate definition, so it should be registering it, i have no idea why defint a-z would be making it not work.
aha! thanks for the load tip, apparentl i need COMMON SHARED for every variable! ill try breaking up some pieces and see how it goes...
well heres a question i just though of. so say i split the program into 2 bas files. some of the memory be allocated for one bas and one for the other? or will it just double my memory pool? cuz if i start every bas with COMMON SHARED how will it know which .bas to allocate the memory too?
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
THe following will look daunting, but try to read through it. It has many good points about program modules, COMMON, COMMON SHARED, SHARED, DIM SHARED, $DYNAMIC and $STATIC Arrays,huge arrays, and sample programs.
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
so with defint a-z. as mentioned it causes at least one of my arrays to supposedly be not defined. i was putting defint a-z right after all my declare subs, screen 13, and randomize timer, and right before all my DIM SHARED statements. i tried putting defint a-z as my very first line of code, and it then tells me there is a parameter type mismatch for m subs which have variables passed into them. i declare them "DECLARE SUB a(b,c)" basically, but with more useful names. no idea whats wrong there.
i tried the rem $dynamic statement. which to my understanding should make all my arrays dynamic and thus store them in far memory (limit 640k as opposed to 64k) but then i tried testing how much space i had with my bob() array and it still has a near limit.
i loaded my bas in vbs which shows how big my subs are, and without counting subs that are only 1k i counted 72k (its pobably rounding up a lot...) and my understanding is the code amount caps at 64k per bas. so i probably need to split the code up. i started trying that, but either you cant have common 2 dimensional arrays, or you have to define them diferently. but when i say
common shared playerspick(5,8)
it expects a ) after the 5
any ideas on any of the 3 said problems?
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
DECLARE SUB drawbots ()
DECLARE SUB wallcheck (playerdircheck, playerwallcheck)
DECLARE SUB drawmap ()
'then goes straight to...
DIM movx(8), movy(8), botalive(8), botdir(8), movebackqueue(8), movequeue(8)
COMMON SHARED movx(), movy(), botalive(), botdir(), movequeue(), movebackqueue()
COMMON SHARED movebackyes, j, players, wallyes, saycollideyes, press$
'then to non common variables like...
DIM SHARED x, y, map, map(12, 12, 2), movcheckx(8), movchecky(8)
DIM SHARED beltB2R(257), beltL2B(257), beltT2L(257), beltR2T(257), beltB2L(257)
'then to the main thing. that what you're looking for?
RE: problem with OUT OF MEMORY
A simple dynamic two-dimensional array example.
TEST1.BAS
CODE
COMMON TwoDimensional() AS INTEGER
REM $DYNAMIC
DIM TwoDimensional(5, 5) AS INTEGER
FOR x = 1 TO 5: FOR y = 1 TO 5
TwoDimensional(x, y) = x * 10 + y
NEXT y, x
PrintArray
TEST2.BAS
CODE
SUB PrintArray
CLS
FOR x = 1 TO 5: FOR y = 1 TO 5
PRINT TwoDimensional(x, y);
NEXT y: PRINT : NEXT x
END SUB
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
Main module
CODE
DECLARE SUB drawbots ()
DECLARE SUB wallcheck (playerdircheck, playerwallcheck)
DECLARE SUB drawmap ()
'then goes straight to...
COMMON SHARED movx(), movy(), botalive(), botdir(), movequeue(), movebackqueue()
COMMON SHARED movebackyes, j, players, wallyes, saycollideyes, press$
REM $DYNAMIC
DIM movx(8), movy(8), botalive(8), botdir(8), movebackqueue(8), movequeue(8)
'then to non common variables like...
DIM SHARED x, y, map, map(12, 12, 2), movcheckx(8), movchecky(8)
DIM SHARED beltB2R(257), beltL2B(257), beltT2L(257), beltR2T(257), beltB2L(257)
CODE
COMMON SHARED movebackyes, j, players, wallyes, saycollideyes, press$
RE: problem with OUT OF MEMORY
RE: problem with OUT OF MEMORY
On each saving BASIC writes DECLARE (at least QBasic does that).
so it puts parameter types in DECLARE, like
DECLARE SUB wallcheck (playerdircheck!, playerwallcheck!)
(see "!")?
after adding DEFINT parameter type is changed, hence error
"parameter type mismatch"
You can just delete that DECLARE lines.
Then you save, Basic will re-create this line now with integer parameters.
RE: problem with OUT OF MEMORY
See history at
http://www.network54.com/Forum/190883/message/1156376791/Monopoly
The point: you probably don't need more memory. You need to improve your coding techniques.
If you like, post your program at http://www.network54.com/Forum/190883/
for an evaluation.
Mac
RE: problem with OUT OF MEMORY
Glad for you!
Mac