Examining Machine Code

Developer(s): Nels Anderson
Date: 1983
Type: Program
Platform(s): ZX81, TS 1000

A small memory editor for checking and changing machine code. Add it to the end of a program and GOTO 9500, or RUN it on its own. Give a starting address, and the program shows the address and its contents. Type a new value of up to three digits to POKE it (ENTER after fewer than three), ENTER to leave it alone, or / to go back to the previous address. Because it reads keys with INKEY$, use it in SLOW mode. BREAK stops it.

The second listing replaces three lines to show and enter the bytes as two-digit hex numbers. The download has both versions.

Published in Syntax December 1983 (Examining Machine Code).

Related Articles

Look at any address in memory, leave it alone or change its contents, and automatically go to the next address.

Image Gallery

Source Code

9500 PRINT "ADDRESS"
9510 INPUT ADR
9515 SCROLL
9520 PRINT ADR;" ";PEEK ADR;"   ";
9525 LET NEW=0
9530 FOR I=1 TO 3
9535 IF INKEY$<>"" THEN GOTO 9535
9536 IF INKEY$="" THEN GOTO 9536
9540 LET X$=INKEY$
9550 IF X$=CHR$ 118 AND I=1 THEN GOTO 9610
9560 IF X$=CHR$ 118 THEN GOTO 9600
9565 IF X$="/" THEN GOTO 9640
9566 PRINT X$;
9570 LET NEW=NEW*10+VAL X$
9580 NEXT I
9600 POKE ADR,NEW
9610 SCROLL
9620 LET ADR=ADR+1
9630 GOTO 9520
9640 SCROLL
9650 LET ADR=ADR-1
9960 GOTO 9520

9520 PRINT ADR;" ";CHR$ (INT ((PEEK ADR)/16+28));CHR$ ((PEEK ADR)-16*INT ((PEEK ADR)/16)+28);" -";
9530 FOR I=1 TO 2
9570 LET NEW=NEW*16+CODE X$-28

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