Checking the ROM

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

Checking the ROM

Post by Shaun_B »

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 9:22 am, edited 2 times in total.
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Checking the ROM

Post by XavSnap »

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 5073 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 273 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
1024MAK
Posts: 5102
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Checking the ROM

Post by 1024MAK »

Shaun_B wrote: Fri Mar 10, 2017 1:03 amI 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
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Checking the ROM

Post by XavSnap »

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

Re: Checking the ROM

Post by Shaun_B »

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

Thanks,

Shaun.
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Checking the ROM

Post by XavSnap »

CHKBAS.P
(1.06 KiB) Downloaded 265 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
Fwapp
Posts: 152
Joined: Mon Jun 01, 2015 10:32 pm

Re: Checking the ROM

Post by Fwapp »

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 4998 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: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: Checking the ROM

Post by Moggy »

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