How do I find out...

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

How do I find out...

Post 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.
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: How do I find out...

Post 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.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: How do I find out...

Post 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 !
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: How do I find out...

Post 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.
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: How do I find out...

Post 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) ?
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: How do I find out...

Post 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.
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: How do I find out...

Post 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''
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
angus
Posts: 142
Joined: Mon Jun 20, 2011 1:28 pm

Re: How do I find out...

Post 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.
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: How do I find out...

Post 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
what's that Smell.... smells like fresh flux and solder fumes...
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: How do I find out...

Post by sirmorris »

If you're wanting to do this on a ZX80 it's different. see here.
Post Reply