Using 2068 Report Codes

Author(s): Paul Bingham
Publication: SyncWare News
Pub Details: SyncWare News v5 n2 (Volume 5, Issue 2)
Date: November/December 1987
Pages: 10

This may sound like just another dry ROM article to some 2068 owners. But I promise you it is not. Now to prove this to you, type in and run the short program called “Fun Report Codes” (Listing 1). Instead of the old “0 , OK”, you will see a smiley face in front of the line and statement number! How did we do that?

I’ll give you the long and the short of it. The short of it is that our little machine code program in line 20 changed the contents of the “N” character in the 2068’s UDG area to a smiley face. When we called upon a particular error code it printed the face.

The long of it really isn’t that long. If you flip to page 288 in the 2068 user’s manual you will find various report codes listed. Change the 101 in line 30 to 255 and rerun the program. Now change it to zero and rerun it. Now try 1 and run it. It is obvious that we have hit upon the method of obtaining the ROM’s error codes. Numbers 255 and 1 thru 26 give us all the report codes listed in the manual. If you were to try placing 27 in line 30, you will see a report hiding in ROM that doesn’t appear in the manual–“S Missing LROS”! Using numbers beyond 27 give mostly gobbledygook until we use 101. This prints N from the UDG which is the character we’ve exploited in Listing 1.

The Z80 chip that is the heart of every 2068 (and ZX81 or TS1000) recognizes eight special one-byte calls in machine code called “restarts”. They each call specific ROM addresses. In our case, we used RST 8 (207) which calls the report code routine! We can use this any time we choose to as long as we first set HL as a pointer to the report code we want. In Listing 1, we set HL equal to the address in RAM of our 101. A little experimenting may turn up some other useful symbols besides our UDG “N” or the ROM’s resident report codes. And they are so easy to call!

I hope you will explore this area–let me know if you find any thing interesting! My address is : P. Bingham, POB 2034, Mesa, AZ 85214.

Listing 1

   1 REM      Fun Report Code
10 FOR t=45000 TO 45030: READ n: POKE t,n: NEXT t
20 DATA 33,192,255,54,60,35,54,66,35,54,165,35,54,129,35,54,165,35,54,153,35,54,66,35,54,60,33,134,191,207
30 DATA 101
40 RANDOMIZE USR 45000
☺ , 40:1

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.