Memory Monitor

Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Utility

Memory Monitor is a utility program that displays the contents of sequential memory addresses starting from a user-specified location. Each entry is printed in two columns across the screen, showing the address and its PEEK value, with 11-character spacing between columns. After filling the screen or pressing “A”, the user is presented with a menu to continue from the current address, restart from a new address, send a hard copy to a printer, or stop the program. The columnar layout is managed by toggling the display column variable between 0 and 22 (then 33, which resets to 0) and incrementing the row counter accordingly.


Program Structure

The program is organized into three logical phases: address input (line 5), the display loop (lines 740), and a post-screen menu (lines 5095), with a clean STOP at line 100 and a SAVE at line 110.

  1. Initialization — Line 5 prompts for a starting address; line 7 resets column (d) and row (c) counters; line 10 clears the screen.
  2. Display loop — Lines 1240 print address/value pairs, advance screen position, and check for a full screen or keypress.
  3. Menu — Line 50 presents four options; lines 6095 branch on the user’s choice.

Column Layout Logic

The two-column layout is driven by the variable d, which holds the PRINT AT column position. The sequence is:

  • Line 30: if d <= 22, add 11, moving from column 0 to column 11, then to 22.
  • Line 31: if d = 33 (i.e., 22 + 11 overshot the right edge), reset d to 0.
  • Line 33: if d just reset to 0, increment the row counter c.

This gives three display columns at positions 0, 11, and 22 — each entry consuming approximately 11 characters (“AAAAA = NNN”). The check at line 30 uses <= 22, so d passes through 0, 11, and 22 before triggering the reset at 33.

Screen-Full Detection and Early Exit

Line 34 checks whether the row counter c has reached 22, indicating a full screen, and branches to the menu at line 50. Line 35 provides an early exit: pressing “a” or “A” during the loop also jumps to the menu, giving the user an escape without waiting for a complete screen.

Menu Options

KeyAction
cClear screen, reset row/column, continue from current address
sRestart from a new starting address (line 5)
hSend screen to printer via COPY, then return to menu
aJump to STOP at line 100

Unrecognized input falls through to line 95, which loops back to the menu prompt.

Bugs and Anomalies

  • Column counter creep: Line 30 uses <= 22, so d advances from 22 to 33 before the reset at line 31. This is functionally correct but relies on the intermediate value of 33 being a reliable sentinel — if any future edit changes the spacing, the sentinel would need updating.
  • Continue option resets position but not address: When “c” is chosen (line 60), c is reset to 0 but d is not explicitly reset to 0. Since line 7 is not revisited, d retains whatever value it had when the screen filled, potentially misaligning the first row of the next screen. However, since d is always left at 0 when c reaches 22 (due to the three-column cycle), in practice this may not manifest as a visible bug.
  • No upper-bound address check: The program does not guard against PEEKing addresses outside valid RAM, which could produce unexpected results at the edges of the address space.
  • SAVE "MEMORY" LINE 0: LINE 0 targets a non-existent line, so the program loads without auto-running, requiring a manual RUN.

Content

Appears On

Related Products

Related Articles

Related Content

Image Gallery

Source Code

   5 INPUT "ENTER STARTING MEMORY ADDRESS.";a
   7 LET c=0:LET d=0
  10 CLS 
  12 GO TO 20
  15 LET a=a+1
  20 PRINT AT c,d;a;" = "; PEEK a
  30 IF d <=22 THEN LET d=d+11
  31 IF d=33 THEN LET d=0
  33 IF d=0 THEN LET c=c+1
  34 IF c=22 THEN GO TO 50
  35 IF INKEY$="a" OR INKEY$="A" THEN GO TO 50
  40 GO TO 15
  50 INPUT "CONT(C)STRT(S)COPY(H)STOP(A)";b$
  60 IF b$="c" THEN CLS :LET c=0:GO TO 15
  70 IF b$="s" THEN GO TO 5
  80 IF b$="h" THEN COPY :GO TO 50
  90 IF b$="a" THEN GO TO 100
  95 GO TO 50
 100 STOP 
 110 SAVE "MEMORY" LINE 0

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

People

No people associated with this content.

Scroll to Top