Checking the ROM

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

Checking the ROM

Post by Shaun_B » Fri Mar 10, 2017 12:03 am

Hi,

As you may have seen elsewhere, I recently acquired some Dutch programming books. One "Zakboekje voor de ZX81" contains a ROM test listing, as follows:

Code: Select all

 1 FAST
 2 LET T=CODE " "
 3 FOR A=T TO 8191
 4 LET T=T+PEEK A
 5 NEXT A
 6 SLOW
 7 IF T=855106 THEN PRINT "NEW ZX81 ROM OK"
 8 IF T=854885 THEN PRINT "OLD ZX81 ROM OK"
 9 IF T<>855106 AND T<>854855 THEN PRINT "ROM FAULT"
There is probably a quicker way of testing the ROM, but this works (or at least it told me that I had a new ROM) - I assume that the ROM codez is the same on Timex machines also?

Regards,

Shaun.
Last edited by Shaun_B on Fri Mar 10, 2017 8:22 am, edited 2 times in total.

User avatar
XavSnap
Posts: 466
Joined: Sat May 10, 2008 3:23 pm

Re: Checking the ROM

Post by XavSnap » Fri Mar 10, 2017 2:41 am

Hi,

Code: Select all

;ROM TEST.
;
ORG +16514
@START
	LD HL,0 ; COUNTER
	LD DE,0 ; ROM OFFSET
	LD BC,0 ; TMP VALUE
	LD A,C
	LD (4021),A
@LOOP1
	LD A,(DE)
	LD C,A
	ADD HL,BC
	JR NC,@RETC

	;ADD MULTI
	LD A,(4021)
	INC A
	LD (4021),A
@RETC
	INC DE
	LD A,D
	CP 20
	JR NZ LOOP1
	LD B,H
	LD C,L
	RET

Code: Select all

1  REM [HEX:\
21,00,00,11,00,00,\
01,00,00,79,32,21,40,1A,\
4F,09,30,07,3A,21,40,3C,\
32,21,40,13,7A,FE,20,20,\
EE,44,4D,C9 ]
10 LET T= USR 16514+PEEK(16417)*65536
20 PRINT T,,,,,
30 SLOW
40 IF T=855106 THEN PRINT "NEW ROM OK"
50 IF T=854885 THEN PRINT "OLD ROM OK"
60 IF T<>855106 AND T<>854855 THEN PRINT "ROM FAULT"

Code: Select all

     1  REM [DEC:\
 33,  0,  0, 17,  0,  0,  1,  0,\
  0,121, 50, 33, 64, 26, 79,  9,\
 48,  7, 58, 33, 64, 60, 50, 33,\
 64, 19,122,254, 32, 32,238, 68,\
 77,201 ]
    10 LET T=USR 16514+PEEK (16417)*65536
    20 PRINT T,,,,,
    30 SLOW 
    40 IF T=855106 THEN PRINT "NEW ROM OK"
    50 IF T=854885 THEN PRINT "OLD ROM OK"
    60 IF T<>855106 AND T<>854855 THEN PRINT "ROM FAULT"
Cap0058.jpg
Cap0058.jpg (75.38 KiB) Viewed 410 times
In emulators (VB81), some hacks bytes had to be placed to trap display and load/save routines.
You had to disconnect them!
CHKROM.P
(1.11 KiB) Downloaded 16 times

User avatar
1024MAK
Posts: 1805
Joined: Mon Sep 26, 2011 9:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Checking the ROM

Post by 1024MAK » Fri Mar 10, 2017 7:39 am

Shaun_B wrote:
Fri Mar 10, 2017 12:03 am
I assume that the ROM codez is the same on Timex machines also?
Yes, the ZX81 and the TS1000 both use the same ROM.

The first ZX81 machines were supplied with a ROM that had a mathematical routine error (old ROM). Sinclair then fitted an extra circuit that partially corrected the bug. Then Sinclair produced a new improved ROM (new ROM)

However, in some contexts, the ZX80 ROM is known as the "old ROM" and the (at the time) "new ROM" is referring to a ZX81 ROM. So this could be either of the ZX81 ROM versions.

Because the TS1000 was brought to the market later than the ZX81, it's likely they were all fitted with the "new" improved ZX81 ROM.

Oh, and in your program listing, one of the LET statements should be a FOR...

Mark

User avatar
XavSnap
Posts: 466
Joined: Sat May 10, 2008 3:23 pm

Re: Checking the ROM

Post by XavSnap » Fri Mar 10, 2017 7:57 am

Many thanks Mark,
I already heard this history in France, between the "Old" (ZX80) and the "New"(ZX81) ROM!

and ...
10 FOR T= USR 16514+PEEK(16417)*65536
:lol:

Have fun...

Shaun_B
Posts: 337
Joined: Wed Apr 22, 2009 9:22 am

Re: Checking the ROM

Post by Shaun_B » Fri Mar 10, 2017 8:10 am

Good spot on the typo. I shouldn't be typing this ZX81 stuff when tired.

Thanks,

Shaun.

User avatar
XavSnap
Posts: 466
Joined: Sat May 10, 2008 3:23 pm

Re: Checking the ROM

Post by XavSnap » Fri Mar 10, 2017 8:15 am

CHKBAS.P
(1.06 KiB) Downloaded 16 times

User avatar
Fwapp
Posts: 147
Joined: Mon Jun 01, 2015 9:32 pm

Re: Checking the ROM

Post by Fwapp » Mon Mar 20, 2017 9:22 pm

Quite funny this, I decided to try and write a little basic program the other night to make it easy to check if the user has a original bugged, bugged and fixed with the kludge on the Z80 or fixed rom. I based it on a table I found on the net. Balford of this manor helped me with the hard maths bit and testing on real hardware.

Then I found this post!

romcheck.JPG
romcheck.JPG (41.3 KiB) Viewed 335 times
ZX80, ZX81 - 2C158C Bugged Rom iss.1, 2C158C "kludge fix" iss1, 2C184E iss1, 2C210E iss3, US NTSC iss1 "straight traces", US NTSC iss3 TS1000

Moggy
Posts: 1514
Joined: Wed Jun 18, 2008 1:00 pm

Re: Checking the ROM

Post by Moggy » Tue Mar 21, 2017 1:48 pm

Whilst it is an easy way to find the differences in the various ROM's I wouldn't put too much store in using the SQR .25 as a yardstick as the fault was, by the ROM's author John Grant own admittance, an error in the DIVISION routine , yet for some reason is always referred to as the "SQR BUG".

Whilst the "Kludge fix" may have tidied up that particular oddity it never cured the maths problem at a deeper level than a simple SQR error.

Although I have used the following links before I will list them again as they make interesting reading for those of a mathematical bent.

https://archive.org/stream/ZX-computing ... 3/mode/2up

https://archive.org/stream/ZX-computing ... 7/mode/1up

https://archive.org/stream/ZX-computing ... 8/mode/1up

One interesting incident I found with the bugged/kludged ROM's was when running one of,Basic games guru Andre's, creations. As a programmer he uses some weird and wonderful equations usually involving SQR in his work and in the example I tried which was a "find the key unlock the door type thing" upon finding the key a bugged ROM meant the door would not open, a kludge fixed ROM would allow the door to only half open but a new ROM non kludged CPU would allow the door to open fully!

Seeing as there are only two known versions of the ROM a much simpler method to use rather than all the convoluted(for such a simple task ;) ) methods I see in earlier posts, is to peek the following...

3875 returns 253 old ZX81 ROM, 205 new ZX81 ROM

5274 returns 128 old ZX81 ROM, 42 new ZX81 ROM

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests