Airshack Posted January 16, 2017 Share Posted January 16, 2017 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! Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted January 17, 2017 Share Posted January 17, 2017 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. . . Quote Link to comment Share on other sites More sharing options...
Airshack Posted January 17, 2017 Author Share Posted January 17, 2017 Where can a novice programmer find information on how XB works with the stack? "your string variables are located in the stack space." <===== specifics appreciated Quote Link to comment Share on other sites More sharing options...
Airshack Posted January 17, 2017 Author Share Posted January 17, 2017 2310 FOR LC=1 TO 322320 FOR LR=24 to 1 STEP -12330 CALL GCHAR(LR,LC,C)::IF C = 25 THEN 24602340 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 23902360 IF LC = 32 THEN 23802370 C = 80::CALL GCHAR(LR,LC+1,C2)::GOTO 24002380 CALL GCHAR(LC,LC-1,C)::C2 = 80::GOTO 24002390 CALL GCHAR(LR,LC-1,C)::CALL GCHAR(LR,LC+1, C2)2400 IF C=80 AND C2 =25 THEN 24702410 IF C<> 24 AND C2<> 24 THEN 24302420 CALL VCHAR(LR,LC,81)::GOTO 24702430 IF C<>80 AND C2<> 24 THEN 24502440 CALL VCHAR(LR,LC,82)::GOTO 24702450 CALL VCHAR(LR,LC,83)::GOTO 24702460 NEXT LR2470 NEXT LC Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted January 17, 2017 Share Posted January 17, 2017 (edited) 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 January 17, 2017 by senior_falcon 1 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted January 17, 2017 Share Posted January 17, 2017 I've been having "memory full in 10" when I've got 2.5 to 3k left in program space and around 4.3k of stack. It's a real nightmare. Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted January 17, 2017 Share Posted January 17, 2017 I am assuming that you are running Classic99 with CPU overdrive. If so, try running the program at normal speed and let me know what happens. I have a theory.... 1 Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted January 18, 2017 Share Posted January 18, 2017 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. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.