Forum
New game: Earthraid - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Gallery (https://www.boriel.com/forum/forumdisplay.php?fid=18)
+---- Thread: New game: Earthraid (/showthread.php?tid=462)

Pages: 1 2 3


Re: New game: Earthraid - boriel - 06-06-2012

slenkar Wrote:I dont see memavail or maxavail in the library directory in program files/boriel tm/zx basic compiler/library or in the wiki
they are in the alloc.bas library.
Code:
#include <alloc.bas>



Re: New game: Earthraid - slenkar - 06-06-2012

boriel Wrote:
slenkar Wrote:I dont see memavail or maxavail in the library directory in program files/boriel tm/zx basic compiler/library or in the wiki
they are in the alloc.bas library.
Code:
#include <alloc.bas>
thanks

I ran a program to print memavail and it said 4764 does this mean 4764 bytes are available?

Code:
#Include <alloc.bas>

Print at 1,1,;"memavail"+STR(memavail)
Print at 3,1,;"maxavail"+STR(maxavail)

I tried allocating some memory and got the same result:

Code:
#Include <alloc.bas>


Dim myarray(40) as Integer
myarray(0)=1
myarray(1)=1
myarray(2)=1
myarray(3)=1
myarray(4)=1
myarray(5)=1
myarray(6)=1

Print at 1,1,;"memavail"+STR(memavail)
Print at 3,1,;"maxavail"+STR(maxavail)



Re: New game: Earthraid - britlion - 06-06-2012

I don't think global variables are allocated on the heap.


Re: New game: Earthraid - boriel - 06-06-2012

britlion Wrote:I don't think global variables are allocated on the heap.
True. Global var are not allocated on the heap. They are "static".
The code above is static and the heap is not affected.
What slenkar wants it a Dynamic Array (not supported yet). Al DIM sentences are just declarations and reserve the memory in compile time, except for local variables (e.g. within a function), which are temporary allocated into the stack.
DIM sentences are *not* executed.

Sinclair BASIC does executes them. In the future, ZX BASIC will allow this to. So you can REDIM arrays on runtime. These are Dynamic Arrays and they will go into the heap.


Re: New game: Earthraid - boriel - 06-06-2012

slenkar Wrote:I ran a program to print memavail and it said 4764 does this mean 4764 bytes are available?
Yes, that's it.
But memavail and maxavail are not the same (see freebasic help).
Anyway, at the moment the heap is only used for string storage.


Re: New game: Earthraid - LCD - 06-26-2012

Version 1.1 is finished and can be downloaded now.
Edit:
Heapsize increased from 100 to 256, should fix the crash.
Faster landscape and movement calculation
AY Soundtrack
some code optimisations
fixed a typo