FAQ  •  Register  •  Login

New game: Earthraid

Moderator: nitrofurano

<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Wed Jun 06, 2012 6:42 pm

Re: New game: Earthraid

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>
<<

slenkar

Posts: 282

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Wed Jun 06, 2012 6:50 pm

Re: New game: Earthraid

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)
<<

britlion

Posts: 766

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Wed Jun 06, 2012 9:22 pm

Re: New game: Earthraid

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

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Wed Jun 06, 2012 10:20 pm

Re: New game: Earthraid

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.
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Wed Jun 06, 2012 10:22 pm

Re: New game: Earthraid

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.
<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Tue Jun 26, 2012 8:19 pm

Re: New game: Earthraid

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!
Previous

Return to Gallery

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO