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: 451
Joined: Wed Apr 22, 2009 10:22 am

How do I find out...

Post by Shaun_B » Wed Apr 14, 2010 11:04 am

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: 761
Joined: Sat May 10, 2008 4:23 pm

Re: How do I find out...

Post by XavSnap » Wed Apr 14, 2010 12:37 pm

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.

User avatar
XavSnap
Posts: 761
Joined: Sat May 10, 2008 4:23 pm

Re: How do I find out...

Post by XavSnap » Wed Apr 14, 2010 3:06 pm

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 !

Shaun_B
Posts: 451
Joined: Wed Apr 22, 2009 10:22 am

Re: How do I find out...

Post by Shaun_B » Thu Apr 15, 2010 11:44 am

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: 761
Joined: Sat May 10, 2008 4:23 pm

Re: How do I find out...

Post by XavSnap » Thu Apr 15, 2010 5:47 pm

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

Shaun_B
Posts: 451
Joined: Wed Apr 22, 2009 10:22 am

Re: How do I find out...

Post by Shaun_B » Sun Apr 18, 2010 6:03 pm

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: 761
Joined: Sat May 10, 2008 4:23 pm

Re: How do I find out...

Post by XavSnap » Mon Apr 19, 2010 3:42 pm

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

angus
Posts: 131
Joined: Mon Jun 20, 2011 1:28 pm

Re: How do I find out...

Post by angus » Fri Aug 12, 2011 8:26 pm

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: 1546
Joined: Fri May 09, 2008 2:48 pm
Location: notts UK

Re: How do I find out...

Post by Andy Rea » Fri Aug 12, 2011 9:08 pm

print (peek 16386 + 256 * peek 16387) - (peek 16404 + 256 * peek 16405)

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

Andy
6 x ZX81, 1 x TS1500 , 1 x +3e, 1 x timex 2040 printer, 1 x timex 2020 cassette deck, siclair printer and some spectrum

sirmorris
Posts: 2813
Joined: Thu May 08, 2008 5:45 pm

Re: How do I find out...

Post by sirmorris » Fri Apr 13, 2018 12:49 pm

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

Post Reply