Memory Display

See all articles from SYNC v1 n2

The Memory Display Program presents 16 Bytes of memory in binary, octal, decimal, and character. You can enter a one-to four-digit hexadecimal starting address, or hit NEWLINE, if you want to continue without a new entry. To end the display, enter Z.

Address E00 (hex) houses the generator portion of the ROM, the RAM is at address 4000 (hex), and the program begins at address 4028 (hex). Lines 60 to 90 convert the hexidecimal address to decimal; lines 110 to 140 call the subroutine to print the address in hex, and lines 180 to 210 trigger the subroutine to print the memory contents in binary, while lines 220 to 240 print in octal, and lines 250 to 270 in hexidecimal. Line 280 prints the contents in decimal with leading zeros, and the character. Lines 310 to 430 convert the decimal number in X to N digits using radix R, and then prints the digits. If the radix is 2 (binary) a black or white square is printed instead of 0 or 1.

 10 LET A = - 16
20 INPUT A$
30 IF A$="Z" THEN LIST
40 LET A = A + 16
50 IF A$ = " " THEN GOTO 100
60 LET A = 0
70 LET A = A * 16 + CODE (A$) - 28
80 LET A$ = TL$ (A$)
90 IF NOT A$ = " " THEN GOTO 70
100 CLS
110 LET R = 16
120 LET N = 4
130 LET X = A
140 GOSUB 310
150 PRINT A
160 PRINT
170 FOR I = 0 TO 15
180 LET R = 2
190 LET N = 8
200 LET X = PEEK (A+1)
210 GOSUB 310
220 LET R = 8
230 LET N = 3
240 GOSUB 310
250 LET R = 16
260 LET N = 2
270 GOSUB 310
280 PRINT TL$ (STR$ (X + 1000));" "; CHR$ (X)
290 NEXT I
300 GOTO 20
310 LET Y = X
320 LET F = R ** (N - 1)
330 FOR J = 1 TO N
340 LET D = Y/F
350 LET Y = Y - D * F
360 LET F = F/R
370 IF NOT R = 2 THEN GOTO 400
380 IF D = 1 THEN LET D = 128
390 LET D = D - 28
400 PRINT CHR$ (D + 28);
410 NEXT J
420 PRINT " ";
430 RETURN

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