Page 1 of 1

How do I find out...

Posted: Wed Apr 14, 2010 11:04 am
by Shaun_B
Hi,

How do I find out how many free bytes are left on my ZX81? I know there was a way to PEEK at two memory locations, but I can't remember which one.

Regards,

Shaun.

Re: How do I find out...

Posted: Wed Apr 14, 2010 12:37 pm
by XavSnap
Hi,

You had to use the (?) XuR button !
:?
Or have a look to the end of "Président" software on the Ordi-5 #10...
http://zx81.ordi5.free.fr/djv/
I had to extract Zx81 Basic codes...
:D
I will put the "Président" text file on the web as soon as.

Re: How do I find out...

Posted: Wed Apr 14, 2010 3:06 pm
by XavSnap
Hi,

Code: Select all

# RAMTOP=16388/16389
# DFILE =16396/16397
# VARS=16400/16401
# STKEND=16412/16413
# BASIC PRG OFFSET=16509
# CLS=2602

9996 PRINT " " AND USR 2602;PEEK 16388+256*PEEK 16389-PEEK 16413,"  RAM"
9997 PRINT PEEK 16412+256*PEEK 16413
9998 PRINT PEEK 16396+256*PEEK 16397-16509," PRG. LEN."
9999 PRINT PEEK 16388+256*PEEK 16389-PEEK 16400-256*PEEK 16401," STACKS"
Have Fun !

Re: How do I find out...

Posted: Thu Apr 15, 2010 11:44 am
by Shaun_B
Hi,

Thanks for the tip. For some reason, it's telling me that I have around 32,000 bytes free? I have a Memotech 16K RAM Pack which is second hand, and it's not a unit I've owned from new... therefore does this mean that it's been internally modified to boost the RAM?

Regards,

Shaun.

Re: How do I find out...

Posted: Thu Apr 15, 2010 5:47 pm
by XavSnap
Shaun_B wrote:Hi,

Thanks for the tip. For some reason, it's telling me that I have around 32,000 bytes free? I have a Memotech 16K RAM Pack which is second hand, and it's not a unit I've owned from new... therefore does this mean that it's been internally modified to boost the RAM?

Regards,

Shaun.
True !
Perhaps 16k+16k=32k (max memory offset) ?

Re: How do I find out...

Posted: Sun Apr 18, 2010 6:03 pm
by Shaun_B
Actually, I've been looking at the ZX81's memory map, and it appears that your programme example (for how many free bytes) is incorrect, as follows:

Code: Select all

9999 PRINT PEEK 16388+256*PEEK 16389-PEEK 16412-256*PEEK 16413;" BYTES FREE"
I actually have a 32K RAM PACK, but in order to access anything above the default RAM TOP, I need to tell the ZX81 to do so, as follows:

Code: Select all

1 POKE 16388,255
2 POKE 16389,255
Regards,

Shaun.

Re: How do I find out...

Posted: Mon Apr 19, 2010 3:42 pm
by XavSnap
HI,

Init your Ram Pack and type-in this code !
(Sinclair 16k RamPack doc.)

Code: Select all

1 POKE 18000,33

2 POKE 18001,11

3 POKE 18002,0

4 POKE 18003,57

5 POKE 18004,68

6 POKE 18005,77

7 POKE 18006,201

8 PRINT (USR (18000) – 16373)/1024; ''K''

Re: How do I find out...

Posted: Fri Aug 12, 2011 8:26 pm
by angus
The program immediately above will give you the total RAM present but not how much is free. It will return the same answer whether you've started anew or done the pokes after entering 15K of code.

Re: How do I find out...

Posted: Fri Aug 12, 2011 9:08 pm
by Andy Rea
print (peek 16386 + 256 * peek 16387) - (peek 16404 + 256 * peek 16405)

that should give you a rough approximation, its errsp minus eline

Andy

Re: How do I find out...

Posted: Fri Apr 13, 2018 12:49 pm
by sirmorris
If you're wanting to do this on a ZX80 it's different. see here.