Classic Computer Magazine Archive COMPUTE! ISSUE 10 / MARCH 1981 / PAGE 164

Hooray for SYS (Correction)

Harvey B. Herman Greensboro, NC 27412

There is a problem with the APPEND programs (Jan. 1981 COMPUTE!) for "old" and "new" PETs. I recently learned that there are four kinds of PET cassette tapes. Unfortunately, in my ignorance, I only tested two types, both of which worked. The third very common PET tape, made with "new" ROMs, was ignored and, in fact, does not work. An easy fix which will cover most, but not all, cases is to change line 230, in both APPEND programs to:

230 C = C - 3 : T = C + 1 : IFPEEK(635) = 0 THEN
C = C - 1 : T = T - 2

The programs will now work with the PET tapes which users are most likely to encounter. It may be instructive to discuss the remaining problems in more detail as readers may not be aware of it and could come to grief, as I did.

Both versions of APPEND were designed to work with tapes made on "old" and "new" machines. There is a difference in tapes — original ROMs save starting at hex 400 (dec 1024) and upgrade ROMs save starting at hex 401 (dec 1025). The APPEND programs, as published, checked for start save at statement 230 and made a minor correction depending on which machine was used to make the tape. What I did not know was that new machines saved one byte less on either end. A short program which is written and saved on an "old" machine saves, for example, from hex 400 to hex 424 (call this case 1). The same program, if written and saved on a new machine (call this case 2) would be saved from hex 401 to hex 423 (one less on both ends). If the case 1 tape for the example program, is loaded into a "new" machine and saved, we get a tape which I will call case 3. This tape is a hybrid of cases 1 and 2. Locations saved are from hex 401 to hex 424. My tests for APPEND were done unwittingly with case 1 and case 3 tapes. The line 230 correction discussed above, will allow the program to work with case 2 tapes. Hybrid case 3 tapes will not work but can easily be converted to case 2 after loading by decrementing the location pointer at hex 28 and 29 (dec 42 and 43) and resaving the program. Thus, after loading our short example (case 3 or case 1 tape) change location hex 28 (dec 42) from hex 24 (dec 36) to hex 23 (dec 35) and save again. This new tape (now case 2) and the old one (if case 1) will both append properly. There is also a hybrid case 4 which requires the location pointer on old PETs to be incremented but I think you get the idea.

I want to thank Brien L. Wheeler for calling my attention to a possible error in APPEND and apologize to all readers for this inconvenience.