Behavior of basic free ram when loading loaders of games.

Por nikodr

Paladin (748)

imagem de nikodr

10-07-2007, 11:05

Hello i downloaded bubble rain from imanok's website at http://www.imanok.cjb.net/ .
Now in the autoexec.bas file in the first line there is this

10 CLS:IFFRE(0)<24000 THEN: Print"Pulsa CTRL al encender el ordenador":new

In line 20 there starts the loader with some pokes and the loading of files.

Now i wanted to test what would happen if i removed that line and see what happens if the basic does not have enough ram to load the loader.So i put a rem on line 10 that checks for ram and press run.The game worked with no problems.I wonder if this is the case with other games.Why put that message if the game runs well even without pressing the control?

Entrar ou registrar-se para comentar

Por ro

Scribe (4698)

imagem de ro

10-07-2007, 11:33

Depending on machines with diskdrives.

Any extra attached diskdrive will eat some RAM at the top of the BASIC memory.
The check is not foolproof since startadr of BASIC can vary. (won't go into detail, I'm lazy)

When BASIC starts on #8000 and FREEMEM must be 24000 (#5DC0), the END adr of BASIC is 8000+5DC0=DDC0
This could mean that the programmer is using #DE00 and higher (assembly).
If another extra disk was attached and free mem was, for example, #5400 then END adr of BASIC would be D4000. That will overlap with the code of the program (bubble rain in this case)

But, maybe the coder had other intentions.. dunno. BASIC sux anyway. Running Naked in a Field of Flowers

edit: OR it's becuz BASIC is dynamic. Indeed you might endup with variables getting lost when END adr is reached (like Imanok just explained, gheh).

Por Imanok

Paragon (1191)

imagem de Imanok

10-07-2007, 11:33

In all games running under a kun basic compiler there's a limited amount of memory to be used in every turbo-block. This free memory depends on the size of the rest of the basic program too, so I try to get as free memory as possible to avoid possible problems and I force the user to press CTRL to get a little more.

The problems I found by not doing this... well... sometimes, some variable values are lost and you get a strange behaviour or there's a moment where "Out of memory" error message appears.

You should consider not all MSXes have the same amount of free memory when they boot.

Por ismolnik

Supporter (5)

imagem de ismolnik

02-08-2007, 18:17

yes?

Por ro

Scribe (4698)

imagem de ro

03-08-2007, 08:25

Altho, removing line 10 but booting your MSX with CTRL pressed anyway will ofcourse also word Smile
(typically funny)