Page 1 of 1

Checking the ROM

Posted: Fri Mar 10, 2017 1:03 am
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.

Re: Checking the ROM

Posted: Fri Mar 10, 2017 3:41 am
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 5081 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 274 times

Re: Checking the ROM

Posted: Fri Mar 10, 2017 8:39 am
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

Re: Checking the ROM

Posted: Fri Mar 10, 2017 8:57 am
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...

Re: Checking the ROM

Posted: Fri Mar 10, 2017 9:10 am
by Shaun_B
Good spot on the typo. I shouldn't be typing this ZX81 stuff when tired.

Thanks,

Shaun.

Re: Checking the ROM

Posted: Fri Mar 10, 2017 9:15 am
by XavSnap
CHKBAS.P
(1.06 KiB) Downloaded 265 times

Re: Checking the ROM

Posted: Mon Mar 20, 2017 10:22 pm
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 5006 times

Re: Checking the ROM

Posted: Tue Mar 21, 2017 2:48 pm
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