Forum

Notifications
Clear all

Load Overflow - Question for the pros

2 Posts
2 Users
1 Reactions
44 Views
 mike
(@mike)
Eminent Member
Joined: 2 months ago
Posts: 14
Topic starter  

Are there some experts out there that describe more in detail "Load Overflow" for Color 64? 

Manual states:

"Another feature of the new LOAD command is that it checks if a BASIC program has overflowed memory and overwritten variables. If this does occur, then the BBS program automatically shuts down and displays an error message indicating a LOAD overflow. All variables will be lost, and the message index will have to be regenerated. This error occurs when a BASIC overlay is bigger than √bbs.init, and it would overwrite variable memory -- often wreaking havoc on the BBS program when gone unchecked."

This seems easy to understand, but my mods are easily tripping this error when I'm not near the threshold size of √bbs.init.

Is there a better checklist out there of DOs and Don'ts when creating a new overlay to avoid this error?


   
Quote
(@desert-fox)
Member Admin
Joined: 7 years ago
Posts: 14
 

Mike,

I am certainly not a pro but I have done this for awhile.  Once again I can only speak for Color64 7.xx. I seem to remember you being in version 8 so I don't know if these ideas will help but they have worked for me. The first is DIM KILLER that Greg wrote. I use it just before the game start in an overlay. I'm gonna do a copy and paste here that you can work with...


The following is a programming tip that allows you to remove all dim'edarrays added in an online game. The advantage of not letting too many
extra variables build up is reduced garbage collects and reducing the chances of an out of memory error when having many games on your system. You see, everytime a new variable is used in Commodore BASIC, that variable will stay in memory until you reboot the
BBS. Too many new variables will use up what little memory is left, causing the computer to give an error.

Anyway, add this routine to the beginning of your module and when the module is exited, any dim'd variables created will automatically be removed from memory

52000 c=peek(49)+256*peek(50)-peek(47)-256*peek(48):gosub52020
52010 c=c+peek(47)+256*peek(48):poke50,int(c/256):poke49,c-256*peek(50):return
52020 beginning of your program

(change the line numbers as needed)

One important note... you cannot use the variable c in your module.

Anyway, using this routine along with any modules that dim large arrays will greatly increase the performance of your system (and all others using your modules).

Greg Pfountz


The other tip is also a help...

This little module will automatically  reboot your system if it detects  FRE(0) bytes fall below a predefined level. This could be useful if you
are running many different games and  mods, each of which are adding their own unique variables to your system causing your BBS to run slower and increasing the risk of an out of memory error.

In line 12010, you may want to change the iffre(0)<4000then... to less than 4000 should you find your system rebooting itself too often. Ideally
the mod would be set to reboot after 2 or 3 different online games have been played.

This version 3 addresses a couple problems found in version 2. If your system was performing a FREBOOT just before midnight and finished just
after midnight, your system would forget to increase the date. And if your caller did not look at the clock at all after the midnight hour and
logged off, the ND variable was not being set preventing freboot from running. This version fixes both of these cases by not allowing a
FREBOOT to start if it is 11:50 - 11:59 and by forcing a read of the time of day clock before checking the ND variable. Hopefully, this
version will work reliable for everyone now!!

Also added in this version is a small entry into the caller log when a freboot is made. This could be useful when trying to decide where to
set the iffre(0)<4000then... statement. This mod goes in bbs.init.

9988 gosub1110:ifndorleft$(t$,4)="11:5"thenreturn
9989 lg$=nu$+c2$+"‡Freboot - "+t$:gosub8010:fori=1to9:poke630+i,13:next
9990 poke632,82:poke633,85:poke634,78:poke198,9:sysc(20):goto9999
12010 gosub16950:dd=d(3):ud=d(4):dt=0:cs$="":print:iffre(0)<4000thengosub9988


These two items have helped me to have minimal errors(stack overflows, out of memory etc.)

Again these fixes work in version 7. If you are using version 8 I believe you should be using the GAME MOD system.

If you have any thing else you can email me at [email protected] or post here.

 

DF

 

This post was modified 4 days ago 2 times by ][avok

   
mike reacted
ReplyQuote
Share: