Line Recharacterizing — 4K and 8K

Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v3 n4 (Volume 3, Issue 4)
Date: April 1982
Pages: 19

Here’s a way to replace characters or keywords in lines or blocks of lines. Try this example for 4K ROM:

  10 PRINT A AND B
20 PRINT B AND C
30 PRINT C AND D
40 PRINT D AND E
50 STOP
60 FOR S=16423 TO 16475
70 IF PEEK(S)=224 THEN POKE (S),(225)
80 IF PEEK(S)=248 THEN STOP
90 NEXT S

Enter these lines, then type GO TO 60, press NEWLINE. You’ll get an error message. Press NL again and you’ll see these program lines:

  10 PRINT A OR B
20 PRINT B OR C
30 PRINT C OR D
40 PRINT D OR E

S starts at the first address for program lines and checks each byte. When it finds a 224 (character code for AND, it replaces it with 225 (code for OR).

To do the same thing with an 8K ROM, change these lines:

  60 FOR S=16509 TO 16561.
70 IF PEEK S=218 THEN POKE S,217
80 IF PEEK S=227 THEN STOP

These changes substitute 8K addresses and character codes.