Jump to content
IGNORED

Memory Full using XB256 Help!


Airshack
 Share

Recommended Posts

So yesterday I was working on my first XB256 program and the Memory Full message popped up after attempting to run a new revision. Looks more like MEMORY LOW to me! How about all that stack space. Excuse my ignorance on the matter but is there any way to access that stack space in XB or XB 256? How can memory be full with nearly 1k clearly available?

 

Please school me on my options here. Re-writing code more efficiently is a known option.

 

Thanks guys!

post-46538-0-01992100-1484606977_thumb.jpg

Link to comment
Share on other sites

What was the routine in 2340 trying to do? It may not have had enough memory remaining to finish that specific task. As to the differences between program space and stack space, your string variables are located in the stack space, which is actually part of your VDP memory space. Your program space is CPU memory. There isn't a way to shuffle memory around between the two memory types, as they are on completely different busses. . .

Link to comment
Share on other sites

2310 FOR LC=1 TO 32
2320 FOR LR=24 to 1 STEP -1
2330 CALL GCHAR(LR,LC,C)::IF C = 25 THEN 2460
2340 LR = LR+1::VCHAR(LR,LC,80,25-LR) <==== A case of the missing "CALL." Why didn't I get " * SYNTAX ERROR " in place of " * MEMORY FULL IN 2340"??
2350 IF LC >1 AND LC < 32 THEN 2390
2360 IF LC = 32 THEN 2380
2370 C = 80::CALL GCHAR(LR,LC+1,C2)::GOTO 2400
2380 CALL GCHAR(LC,LC-1,C)::C2 = 80::GOTO 2400
2390 CALL GCHAR(LR,LC-1,C)::CALL GCHAR(LR,LC+1, C2)
2400 IF C=80 AND C2 =25 THEN 2470
2410 IF C<> 24 AND C2<> 24 THEN 2430
2420 CALL VCHAR(LR,LC,81)::GOTO 2470
2430 IF C<>80 AND C2<> 24 THEN 2450
2440 CALL VCHAR(LR,LC,82)::GOTO 2470
2450 CALL VCHAR(LR,LC,83)::GOTO 2470
2460 NEXT LR
2470 NEXT LC

Link to comment
Share on other sites

2340 LR = LR+1::VCHAR(LR,LC,80,25-LR) <==== A case of the missing "CALL." Why didn't I get " * SYNTAX ERROR " in place of " * MEMORY FULL IN 2340"??

Mystery to me, Grasshopper.

 

(Edit) The more I look at it the stranger it seems. My quick test with VCHAR without the CALL worked as expected by giving a SYNTAX ERROR. If the prescan has been turned off that might do it.

Edited by senior_falcon
  • Like 1
Link to comment
Share on other sites

Because both VDP ram and CPU ram are used, there are two ways to run out of memory.

The prescan that happens when a program starts up will allocate space for numeric variables in cpu ram and string variables in vdp ram. If there is not enough room in either area you will get the "memory full" message. String variables are initialized with a null length, but as the program runs they take up more memory (up to 255 bytes) depending on how long the string is. So, If there is not enough memory in CPU ram the program should not even get past the prescan but should give you the error message immediately.

10 DIM A(10000) will give the memory error before the program can do anything.

Or:

10 X$=RPT$("X",250)

20 DIM TEST$(10000)

30 FOR I=1 TO 10000::TEST$(I)=X$::NEXT I

This program will get started and keep plugging long string variables into the array TEST$ until it runs out of vdp memory and gives you the memory full message.

One way to know when the error happens is to BREAK 10 then RUN then SIZE and you can see how much memory is left after the prescan but before the program actually starts.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...