Search and replace

Darren  Liston,
Stockport
Cheshire.
from Your Computer, August 1982, page 85

Search and replace will search the screen for a character you specify and re-
place it with any other. Load this machine-code routine into a Rem statement
no shorter than 23 bytes long. Search and replace runs in a 16K ZX-81 only.

Z-80 Assembly listing	Hexadacimal dump
LD HL,(D.FILE)		2A 0C 40
LD B,24d		06 19
DEC HL			2B
INC HL			23
LD A,(HL)		7E
CP 118			FE 76
JRNZ, +3		20 03
DJNZ -8			10 F8
RET			C9
CP CHR$(n)		FE CHR.$(n)
JRNZ -13		20 F3
LD (HL),CHR$(x)		36 CHR$(x)
JR -17			18 EF

If this machine-code routine is loaded into a Rem statement then Poking the 
values:

	16530, CHR$(n)

where CHR$(n) means the character to be searched for.

	16534, CHR$(x)

where CHR$(x) means the character to be replaced.

