10 A=1:ABC=2:LONG.NAME=3:VERY.LONG.VARIABLE.NAME=4
15 DIM B(3):B(0)=1:B(1)=2:B(3)=3
20 DEF SEG
21 OPEN "memdump.txt" FOR OUTPUT AS 1
22 ' reserve space for vars - or addresses shift
23 PROG=0: SCAL=0: ARRY=0: ENDA=0: S=0: E=0: MEM=0
25 PRINT#1,  "program: ";: PROG = PEEK(&H30) + PEEK(&H31)*256: PRINT#1, PROG
30 PRINT#1,  "scalars: ";: SCAL = PEEK(&H358) + PEEK(&H359)*256: PRINT#1, SCAL
40 PRINT#1,  "arrays : ";: ARRY = PEEK(&H35A) + PEEK(&H35B)*256: PRINT#1, ARRY
50 PRINT#1,  "end arr: ";: ENDA = PEEK(&H35C) + PEEK(&H35D)*256: PRINT#1, ENDA
60 S = PROG: E = SCAL: GOSUB 1000
70 S = SCAL: E = ARRY: GOSUB 1000
80 S = ARRY: E = ENDA: GOSUB 1000
999 CLOSE: END
1000 ' dump memory
1010 PRINT#1,
1020 PRINT#1, S " TO " E-1
1060 FOR MEM = S TO E-1
1065 IF 0 = (MEM-S) MOD 16 THEN PRINT#1,
1070 PRINT#1, USING "\\  "; HEX$(PEEK(MEM));
1080 NEXT
1090 PRINT#1,
1100 RETURN

