Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New game: Earthraid
#31
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>
Reply
#32
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)
Reply
#33
I don't think global variables are allocated on the heap.
Reply
#34
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.
Reply
#35
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.
Reply
#36
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
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)