1000 'MEMPEEK.BAS - John Schnell - Nov. 1982...Used by permission of N.Y.P.C. 1001 'From MICROCOMPUTING, March 1983, pg 18. 1010 ' A program to display memory 1020 KEY OFF : COLOR 7,0 : CLS 1030 PRINT TAB(25)"*** Memory Lister ***" 1040 PRINT :PRINT :PRINT 1050 PRINT "Memory Lister will display the contents of a selected segment of memory in" 1060 PRINT "256 byte blocks per screen. The contents are displayed in HEXIDECIMAL and in" 1070 PRINT "ASCII format. From the menu, select the segment you wish to examine." 1080 PRINT :PRINT 1090 PRINT TAB(25)"U = User selected segment." 1100 PRINT TAB(25)"D = DOS segment of memory." 1110 PRINT TAB(25)"P = This program in memory." 1120 PRINT TAB(25)"R = ROM contents in memory." 1125 PRINT TAB(25)"C + Color screen buffer." 1130 PRINT TAB(25)"M = Monochrome screen buffer." 1140 PRINT TAB(25)"E = End program." 1150 PRINT :PRINT :PRINT 1160 PRINT TAB(25)"Please enter your choice : "; 1170 DEF SEG = 0: POKE 1047,PEEK(1047) OR 64 1180 RESP$ = INPUT$(1) 1190 CHOICE = INSTR("UDPRCME",RESP$) : IF CHOICE = 0 THEN BEEP:GOTO 1170 1200 CLS: ON CHOICE GOTO 1210,1300,1330,1390,1412,1420: GOTO 1830 1210 'user selection 1220 INPUT "Enter start of segment in hexadecimal (0000 to FFFF ) : ";SEGMENT$ 1230 IF LEN(SEGMENT$)<1 OR LEN(SEGMENT$)>4 THEN BEEP: GOTO 1220 1240 FOR LOOP=1 TO 4: IF MID$(SEGMENT$,LOOP,1)<"0" OR MID$(SEGMENT$,LOOP,1)>"F" THEN BEEP: GOTO 1220 ELSE NEXT LOOP 1250 PRINT :PRINT 1260 INPUT "Enter memory offset in hexadecimal ( 0000 to FFFF ) : ";OFFSET$ 1270 IF LEN(OFFSET$)<1 OR LEN(OFFSET$)>4 THEN BEEP: GOTO 1260 1280 FOR LOOP=1 TO 4: IF MID$(OFFSET$,LOOP,1)<"0" OR MID$(OFFSET$,LOOP,1)>"F" THEN BEEP: GOTO 1260 ELSE NEXT LOOP 1290 LOCATE 19,23:PRINT ">> User Selected Segment <<":GOTO 1450 1300 'display of DOS 1310 SEGMENT$ = "0000": OFFSET$ ="0000" 1320 LOCATE 19,23:PRINT ">> Display of DOS <<":GOTO 1450 1330 'display of program in memory 1340 DEF SEG = 0: BASIC = PEEK(&H510)+PEEK(&H511)*256 1350 DEF SEG: PROGRAM = PEEK(&H30)+PEEK(&H31)*256 1360 SEGMENT$=RIGHT$("0000"+HEX$(BASIC),4) 1370 OFFSET$=RIGHT$("0000"+HEX$(PROGRAM),4) 1380 LOCATE 19,23:PRINT ">> Display program in Mem. <<":GOTO 1450 1390 ' beginning of rom in high memory 1400 SEGMENT$="F000":OFFSET$="E000" 1410 LOCATE 19,23:PRINT ">> Display ROM in High Mem. <<":GOTO 1450 1411 'color screen buffer 1412 SEGMENT$="B800":OFFSET$="0000" 1413 LOCATE 19,23:PRINT">> Display Color ScreenBuff. <<":GOTO 1450 1420 'monochrome screen buffer 1430 SEGMENT$="B000":OFFSET$="0000" 1440 LOCATE 19,23:PRINT ">> Display Mono Screen Buff. <<":GOTO 1450 1450 'press spacebar to start 1460 LOCATE 21,1:PRINT TAB(25)"SEGMENT starts at : &H" SEGMENT$ 1470 PRINT TAB(25)"OFFSET starts at : &H" OFFSET$ 1480 PRINT :PRINT TAB(25)"PressTO START :"; 1490 RESP$=INPUT$(1): IF RESP$<>" " THEN BEEP, GOTO 1490 1500 'routine for displaying the contents of memory on the screen 1510 CUR.SEG$="&H"+SEGMENT$: CUR.OFF$="&H"+OFFSET$ 1520 HEXVAL$="0123456789ABCDEF01234567890ABCDE": HEXHEADING=VAL("&H"+RIGHT$(OFFSET$,1))+1 1530 LINECOUNT=1:ADDR.FMT$="\ \ =":BYTE.FMT$="\\ " 1540 FOR LOOP=VAL(CUR.OFF$) TO 65336! STEP 16:DEF SEG=VAL(CUR.SEG$) 1550 IF LINECOUNT =1 THEN CLS:DIVIDER=3:PRINT TAB(25);"SEGMENT STARTS AT : "CUR.SEG$ ELSE 1620 1560 PRINT "offset";TAB(28)"hexidecimal values";TAB(69)"ASCII code"; 1570 COLOR 0,7:PRINT "hex "; 1580 FOR LOOP1=HEXHEADING TO HEXHEADING+15 1590 DIVIDER = DIVIDER+1:IF DIVIDER = 4 THEN PRINT CHR$(221);:DIVIDER=0 1600 PRINT MID$(HEXVAL$,LOOP1,1)+" "; 1610 NEXT LOOP1:PRINT CHR$(221)+" "MID$(HEXVAL$,HEXHEADING,16):COLOR 7,0:DIVIDER=3 1620 ADDR$=RIGHT$("0000"+HEX$(LOOP),4) 1630 PRINT USING ADDR.FMT$;ADDR$; 1640 FOR LOOP2 = LOOP TO LOOP+15 1650 BYTECONTENT$=RIGHT$("00"+HEX$(PEEK(LOOP2)),2) 1660 DIVIDER=DIVIDER+1:IF DIVIDER=4 THEN PRINT CHR$(221);:DIVIDER =0 1670 PRINT USING BYTE.FMT$;BYTECONTENT$; 1680 NEXT LOOP2 1690 PRINT CHR$(221)+" "; 1700 FOR LOOP3=LOOP TO LOOP+15 1710 CHAR$=CHR$(PEEK(LOOP3)): IF CHAR$=>" " THEN PRINT CHAR$;ELSE PRINT "."; 1720 NEXT LOOP3 1730 PRINT 1740 LINECOUNT=LINECOUNT+1: IF LINECOUNT<17 THEN 1810 1750 PRINT 1760 COLOR 0,7:PRINT " < SPACE-BAR > continues forward, < - > backward, < M > returns to menu ";: COLOR 7,0 1770 DEF SEG = 0:POKE 1047, PEEK(1047) OR 64 1780 RESP$=INPUT$(1) 1790 IF RESP$="M" THEN BEEP:GOTO 1020 1795 IF RESP$="-" THEN LOOP=LOOP-512: LINECOUNT=1:GOTO 1810 1800 IF RESP$<>" " THEN BEEP:GOTO 1770 ELSE LINECOUNT=1 1810 NEXT LOOP 1820 GOTO 1020 1830 END