Classic Computer Magazine Archive COMPUTE! ISSUE 8 / JANUARY 1981 / PAGE 118

Variable Dump For New Rom Pets

Frank R. Levinson V.M.D.

The following routine lists all defined basic variables and gives their current values. It can be used after execution of a Basic program has been halted with the Stop key, a "Stop" command, or "End". "Continue" will resume execution. The routine lists simple variables only, no arrays.

Since PET Basic only uses the first two letters of variable names, these are the only ones used by the routine. The existing variables are output in alphabetical order, with single letter names preceeding all double keystroke names. Hence, the order of output is: A, B, … Z, A0, A1, …A9, AA, … AZ, B0, … BZ, … ZZ. Floating point variables are listed first. Then interger variables (%) are listed and finally string variables ($). The Stop key is functional during the listing, and may be needed to prevent the strings from scrolling other data off the screen.

The routine sits in the second cassette buffer. Enter it using the Machine Language Monitor by listing memory addresses 0338-03C7 and then changing the values of 033A-03C2 as shown in Figure 1. Save the routine for future use with the following MLM command: S "VARIABLE DUMP", 01, 033A, 03C3

The routine should be loaded before your Basic program or else note and reset the end of basic program pointers at 42 and 43 decimal after loading. Follow this with "Clear"

The routine can be relocated anywhere in memory with one alteration. The location pointed to by the instruction at $0341 (currently BD B7 03) must point to the $22 near the end of the program (currently at $03B7). Change the B7 and 03 to point to the new location of this $22. (Caution, there are two $22s near the end of the program. Get the correct one.) Call the routine at its new location by SYSing to the first byte of the relocated program.

Figure 1. HEX DUMP OF ROUTINE TO DUMP BASIC VARIABLES

0338: -- -- A5 13 48 A0 20 A2
0340: 0B BD B7 03 9D 20 02 CA
0348: 10 F7 8C 29 02 C0 20 F0
0350: 1C 8C 24 02 D0 17 8E 22
0358: 02 AD 12 E8 C9 EF D0 08
0360: 68 85 13 68 68 4C 89 C3
0368: A2 30 8E 23 02 A9 20 85
0370: 77 A9 00 85 45 20 84 CD
0378: A5 45 F0 13 A9 20 85 77
0380: AD 22 02 8D 27 02 AD 23
0388: 02 8D 28 02 20 A8 C9 AE
0390: 23 02 E8 E0 3A 90 D3 E0
0398: 41 90 F7 E0 5B 90 CB AE
03A0: 22 02 E8 E0 41 90 FB E0
03A8: 5B 90 AB A0 24 CC 29 02
03B0: F0 AE 90 8B C8 D0 88 22*
03B8: 20 20 41 92 3D 22 20 41
03C0: 20 3B 00

* Asterisk denotes the $22 that is referenced by the instruction at location $0341