UK Vintage Radio Repair and Restoration Powered By Google Custom Search Vintage Radio and TV Service Data

Go Back   UK Vintage Radio Repair and Restoration Discussion Forum > Specific Vintage Equipment > Vintage Computers

Notices

Vintage Computers Any vintage computer systems, calculators, video games etc., but with an emphasis on 1980s and earlier equipment.

Closed Thread
 
Thread Tools
Old 8th Oct 2015, 10:41 pm   #1
jay_oldstuff
Octode
 
jay_oldstuff's Avatar
 
Join Date: Jan 2005
Location: Hyde, Greater Manchester, UK.
Posts: 1,074
Default ZX81 memory test program.

Hi all, I've been playing with a sinclair zx81 computer and have been experimenting with replacing the two 2114 4bit ram ic's with a HM6264 8bit x8k SRAM I built a little daughter board so as to minimize modifications to the ZX81 only having to pick up A11 and A12 from the board. the computer works fine but now i need help, I should have 8k but am not sure the best way to test, all the software i have ether runs in 1k or 16k. does anyone know a bit of basic i can run that will show the amount of ram found on screen? Ill freely admit the electronics is the fun bit for me and my basic programming skills are very limited.

Jay
__________________
The light at the end of the tunnel is probably the headlight of an oncoming train
jay_oldstuff is offline  
Old 8th Oct 2015, 11:27 pm   #2
Oldcodger
Nonode
 
Join Date: Oct 2014
Location: West Midlands, UK.
Posts: 2,181
Default Re: ZX81 memory test program.

From memory ,there was an inbuilt test program on Sinclairs. but what models and ow to access it, I can't remember .I remember it on the +2 as pressing a set of keys simultaneously
Oldcodger is offline  
Old 9th Oct 2015, 12:34 am   #3
arjoll
Dekatron
 
arjoll's Avatar
 
Join Date: May 2006
Location: Invercargill, New Zealand
Posts: 3,458
Default Re: ZX81 memory test program.

Did a quick google and found this page - it's for the Timex US version, but should be the same. You should be able to PEEK 16388 to get RAMTOP, which is given as:

18431 For 2k internal ram
32767 for 16k Ram Pack
49511 for 32k Ram Pack
65535 for 64k Ram Pack

Based on that, I'd expect to see 17407 for the internal 1k, and 24575 if your 8k upgrade is recognised.
arjoll is offline  
Old 9th Oct 2015, 12:46 am   #4
cmjones01
Nonode
 
Join Date: Oct 2008
Location: Warsaw, Poland and Cambridge, UK
Posts: 2,681
Default Re: ZX81 memory test program.

Somewhere deep in my memory was the word RAMTOP, which I think is the highest address available in RAM on the ZX81, possibly with the exception of the screen memory. A quick web search revealed this:

PRINT PEEK 16388+256*PEEK 16389

as a way to find out what it is. However, it may be that the ROM isn't clever enough to figure out the value of RAMTOP for itself as anything other than 1K or 16K, so to use your 8K you may have to manually set it:

POKE 16389, 96

The first 16K of the ZX81 memory map is the 8K ROM, then a repeat of the 8K ROM. RAM starts at 16K, so location 16389 (the high byte of RAMTOP) will contain 68 for a 1K machine.

It will be interesting to see what RAMTOP is on your 8K machine.

Chris
__________________
What's going on in the workshop? http://martin-jones.com/
cmjones01 is offline  
Old 9th Oct 2015, 12:56 am   #5
cmjones01
Nonode
 
Join Date: Oct 2008
Location: Warsaw, Poland and Cambridge, UK
Posts: 2,681
Default Re: ZX81 memory test program.

I've just written this little program which seems to work:

10 FOR N=16640 TO 65536 STEP 256
20 POKE N,0
30 IF PEEK N<>0 THEN GOTO 50
40 NEXT N
50 PRINT "MEMORY SIZE ";(N/1024)-16;"K"

Try it out!

Chris
Attached Thumbnails
Click image for larger version

Name:	zx81-memtest-listing.jpg
Views:	1405
Size:	20.4 KB
ID:	114047   Click image for larger version

Name:	zx81-memtest-output.jpg
Views:	1236
Size:	17.3 KB
ID:	114048  
__________________
What's going on in the workshop? http://martin-jones.com/
cmjones01 is offline  
Old 9th Oct 2015, 5:46 am   #6
arjoll
Dekatron
 
arjoll's Avatar
 
Join Date: May 2006
Location: Invercargill, New Zealand
Posts: 3,458
Default Re: ZX81 memory test program.

Quote:
Originally Posted by arjoll View Post
You should be able to PEEK 16388 to get RAMTOP
Quote:
Originally Posted by cmjones01 View Post
PRINT PEEK 16388+256*PEEK 16389
Hmmm - yes, of course, what Chris said.....there's no way PEEKing one location is going to give you any more than 256 It's been a looonnnnggg time!
arjoll is offline  
Old 9th Oct 2015, 9:33 pm   #7
jay_oldstuff
Octode
 
jay_oldstuff's Avatar
 
Join Date: Jan 2005
Location: Hyde, Greater Manchester, UK.
Posts: 1,074
Default Re: ZX81 memory test program.

Thanks Chris that was just what I was after. unfortunately I've had a bit of a setback, the HM6264 8bit x8k SRAM ic I have been using seems to have died (it was one from my stocks and I'm unsure of its origins) I've tried the zx81 with its original 2114s back in and it works fine. need to find another SRAM to try.

Jay
__________________
The light at the end of the tunnel is probably the headlight of an oncoming train
jay_oldstuff is offline  
Old 10th Oct 2015, 2:51 am   #8
julie_m
Dekatron
 
Join Date: May 2008
Location: Derby, UK.
Posts: 7,735
Default Re: ZX81 memory test program.

I'm sure I've had situations with an overheating 16K RAM pack sometimes not showing up as the full 16K when peeking RAMTOP -- I think the machine does a primitive memory test on reset, writing 00 to locations in turn and trying to read back until it returns FF, indicating that the inputs are floating high in the absence of anything connected to them. And obviously the warm chips returned something wrong and stopped the test short.

As a quick and dirty test, you can use the DIM statement in BASIC to create an array. The ZX81 will try to reserve space for it and if there is not enough memory, it will crash with error 4 (out of memory).

To test for 8K, try
Code:
DIM A(1400)
This needs to reserve 7000 bytes for the array (the ZX81 stores all numbers as floating-point, using 8 bits for the exponent and 32 bits for the mantissa for a total of 5 bytes) and will obviously fail with 4/0 on a 1K machine, but it will work on a machine with 8K or 16K.

If you then try
Code:
NEW
DIM A(3000)
This will need to reserve 15000 bytes for the array; it will work on a 16K machine, but will give error 4/0 on a machine with less memory.

A pair of 6264s and a single transistor to invert A13 (so as select one of the two chips when A13 is low and the other when A13 is high) would give you the full 16K, of course.
__________________
If I have seen further than others, it is because I was standing on a pile of failed experiments.
julie_m is offline  
Old 10th Oct 2015, 9:11 am   #9
mole42uk
Nonode
 
mole42uk's Avatar
 
Join Date: Aug 2010
Location: Resolven, Wales; and Bristol, England
Posts: 2,614
Default Re: ZX81 memory test program.

ISTR that Clive used to buy 'regrade' RAM chips and use whichever half worked. Lots of problems with memory in those early Sinclair machines. There must be an on-board test to see what RAM is available.
__________________
Richard

Index:
recursive loop: see recursive loop
mole42uk is offline  
Old 10th Oct 2015, 1:16 pm   #10
julie_m
Dekatron
 
Join Date: May 2008
Location: Derby, UK.
Posts: 7,735
Default Re: ZX81 memory test program.

That was for the upper 32K on the Spectrum. Refreshed by the Z80 (which is only supposed to be able to refresh 16KB of DRAM) -- the lower 16K is refreshed by the video ULA (part of the reason for the weirdy byte ordering; the address lines are deliberately used out-of-order so the mere act of reading the display buffer is enough to keep the whole 16K refreshed.

The ZX81 used static RAM internally; RAM expansions were generally built with DRAM, with their own internal refresh logic. (The Z80 helpfully lets you know when it is doing a register-to-register operation and so not needing to address memory, so you can interleave accesses.
__________________
If I have seen further than others, it is because I was standing on a pile of failed experiments.
julie_m is offline  
Old 14th Oct 2015, 8:50 am   #11
mole42uk
Nonode
 
mole42uk's Avatar
 
Join Date: Aug 2010
Location: Resolven, Wales; and Bristol, England
Posts: 2,614
Default Re: ZX81 memory test program.

Ah, thanks Julie. I wasn't overly familiar with the Sinclair computers after the Mk14 - I went on to a NASCOM. It's a long time since I did any work in Z80 machine code, and we were writing computer games using mostly EPROM and only a little bit of RAM.
__________________
Richard

Index:
recursive loop: see recursive loop
mole42uk is offline  
Closed Thread




All times are GMT +1. The time now is 3:08 am.


All information and advice on this forum is subject to the WARNING AND DISCLAIMER located at https://www.vintage-radio.net/rules.html.
Failure to heed this warning may result in death or serious injury to yourself and/or others.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright ©2002 - 2023, Paul Stenning.