Memory Window

Author(s): Neil Marshall
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n1 (Volume 2, Issue 1)
Date: January 1981
Pages: 6

Here’s a simple utility program that displays 16 consecutive bytes of memory in hexidecimal, decimal, and character formats. It requires a 4 hex digit starting address (upper limit 7FEF or 32751). Addresses less than 4 digits or larger than 7FEF can result in an error. Non-hex input is ignored. For example, try 40AA to display lines 120 and 130.

  10 CLEAR
20 DIM A(3)
30 DIM B(3)
40 LET C=0
50 INPUT H$
60 CLS
70 FOR J=0 TO 3
80 IF CODE(H$)<28 THEN GO TO 10
90 IF CODE(H$)>43 THEN GO TO 10
100 LET C=C+(CODE(H$)-28)*(16**(3-J))
110 LET H$=TL$(H$)
120 NEXT J
130 FOR I=0 TO 15
140 LET D=C
150 LET E=PEEK(D)
160 LET F=E
170 FOR J=0 TO 3
180 LET A(J)=D/(16**(3-J))
190 LET D=D-(16**(3-J)*A(J))
200 LET B(J)=F/(16**(3-J))
210 LET F=F-(16**(3-J)*B(J))
220 NEXT J
230 LET C=C+1
240 FOR J=0 TO 3
250 PRINT CHR$(A(J)+28);
260 NEXT J
270 PRINT,
280 FOR J=2 TO 3
290 PRINT CHR$(B(J)+28);
300 NEXT J
310 PRINT ,E,
320 PRINT CHR$(E)
330 NEXT I
340 GO TO 10

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