Author Topic: Memory Display  (Read 1172 times)

0 Members and 1 Guest are viewing this topic.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.795
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1033
  • Likes Given: 1747
Memory Display
« on: 10:04, 02 October 10 »
MEMORY DISPLAY - This was a bit of a flashy Memory Displayer I wrote ages ago (the date is in the program!  :-[ ), it's nothing fancy - no Assembly instructions, it appears to print ASCII codes though (within a printable range). Lots of Windows and colour schemes used here!  :-[
 
Code: [Select]

10 ' Memory Display
20 ' Public Domain - CP/M User
30 ' Written 27/4/1997
40 '
50 ON BREAK GOSUB 200
60 MODE 1:WINDOW 37,40,1,25:INK 3,2:INK 0,0:PAPER 3:CLS:BORDER 2
70 WINDOW#1,1,36,1,3:WINDOW#2,1,36,4,25:WINDOW#3,40,40,1,25:PAPER#1,0:INK 1,26
80 INPUT#1,"Enter Start Address ";start
90 INPUT#1,"Enter Length ";length
100 CLS#1:CLS#2:PAPER#2,0
110 PRINT #1,CHR$(150);STRING$(9,CHR$(154));CHR$(158);STRING$(13,CHR$(154));CHR$(158);STRING$(9,CHR$(154));CHR$(156)
120 PRINT #1,CHR$(149);" Address ";CHR$(149);" Hexidecimal ";CHR$(149);" Decimal ";CHR$(149);
130 PRINT #1,CHR$(147);STRING$(9,CHR$(154));CHR$(155);STRING$(13,CHR$(154));CHR$(155);STRING$(9,CHR$(154));CHR$(153)
140 length=length+start
150 FOR pr=start TO length
160 dis=PEEK(start)
170 IF dis>&20 AND dis<&FF THEN char$=chr$(dis) ELSE char$=" "
180 PRINT #2,TAB(5);HEX$(start);TAB(16);HEX$(PEEK(pr),2);"  ";char$;TAB(29);PEEK(pr)
190 start=start+1:NEXT pr: FOR delay=1 TO 500:NEXT:MODE 2:PAPER 0:WINDOW 1,80,1,25:PEN 1:BORDER 0:END
200 PAPER #3,3:LOCATE#3,1,1:PRINT#3,"Continue Y-N"
210 select$=INKEY$:IF select$<>"Y" AND select$<>"N" THEN 210
220 IF select$="Y" THEN CLS:RETURN ELSE WINDOW 1,40,1,25:LOCATE 5,25:PAPER 0:MODE 2:BORDER 0:END
« Last Edit: 10:15, 02 October 10 by CP/M User »
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline fiorefr73

  • Speccy
  • *
  • Posts: 2
  • Country: it
  • Liked: 3
  • Likes Given: 1
Re: Memory Display
« Reply #1 on: 15:28, 31 March 20 »
Hi AMSDOS,


I'm writing some articles about the Locomotive Basic in an italian free pdf magazine (fanzine) called Retromagazine.
I found your code and I decided to make some changes and use it as a base to show people how to display the memory of an Amstrad CPC with the Locomotive Basic.


I made the some minor changes to:
- display in mode 2
- add binary value of the memory
- stop execution after location FFFF has been reached
- use window#3 for messages


Here is the modified code:
Code: [Select]

10 ' Memory Display
20 ' Public Domain - CP/M User
30 ' Written by AMSDOS 27/4/1997
40 ' Modified by Francesco Fiorentini 29/3/2020
45 row=0
60 MODE 2:WINDOW 39,40,1,25:INK 3,2:INK 0,0:PAPER 3:CLS:BORDER 2
70 WINDOW#1,1,39,1,3:WINDOW#2,1,39,4,25:WINDOW#3,40,80,1,25:PAPER#1,0:INK 3,2
80 row=row+1:LOCATE#3,3,row:INPUT#3,"Enter Start Address ";start
90 row=row+1:LOCATE#3,3,row:INPUT#3,"Enter Length ";length
100 CLS#1:CLS#2:PAPER#2,0
101 REM WINDOW#1 display header
110 PRINT #1,CHR$(150);STRING$(6,CHR$(154));CHR$(158);STRING$(10,CHR$(154));CHR$(158);STRING$(6,CHR$(154));CHR$(158);STRING$(10,CHR$(154));CHR$(156)
120 PRINT #1,CHR$(149);" Addr ";CHR$(149);" Hex Chr  ";CHR$(149);" Dec  ";CHR$(149)"  Binary  ";CHR$(149);CHR$(13)
130 PRINT #1,CHR$(147);STRING$(6,CHR$(154));CHR$(155);STRING$(10,CHR$(154));CHR$(155);STRING$(6,CHR$(154));CHR$(155);STRING$(10,CHR$(154))CHR$(153)
131 REM read the memory
140 length=length+start
150 FOR pr=start TO length
160 dis=PEEK(start)
170 IF dis>&20 AND dis<&FF THEN char$=chr$(dis) ELSE char$=" "
179 REM WINDOW#2 display the memory value
180 PRINT #2,TAB(3);HEX$(start);TAB(11);HEX$(PEEK(pr),2);TAB(15);char$;TAB(20);PEEK(pr);TAB(28);BIN$(PEEK(pr),8)
190 start=start+1:if start > 65535 then goto 191 else NEXT pr
191 row=row+1:PAPER #2,0:LOCATE#3,3,row:PRINT#3,"Memory Map terminated."
192 row=row+1:PAPER #2,0:LOCATE#3,3,row:PRINT#3,"Continue to map? y-n"
193 answ$=INKEY$:IF answ$<>"Y" AND answ$<>"N" AND answ$<>"y" AND answ$<>"n" THEN 193
194 IF answ$ = "Y" or answ$ = "y" THEN GOTO 80
195 row=row+1:PAPER #2,0:LOCATE#3,3,row:PRINT#3,"Goodbye...":for i= 1 to 1000:next i
196 WINDOW 1,40,1,25:LOCATE 5,25:PAPER 0:MODE 2:BORDER 0:END


Regards
fiorefr73
« Last Edit: 15:34, 31 March 20 by fiorefr73 »

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.795
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1033
  • Likes Given: 1747
Re: Memory Display
« Reply #2 on: 22:58, 31 March 20 »
I always remember that only displaying a limited set of characters, if you want the whole set change line 170 to:

Code: [Select]
170 char$=CHR$(1)+CHR$(dis)
which will print out the whole set.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline fiorefr73

  • Speccy
  • *
  • Posts: 2
  • Country: it
  • Liked: 3
  • Likes Given: 1
Re: Memory Display
« Reply #3 on: 23:27, 31 March 20 »
Awesome!  8)


Thanks AMSDOS, I'll give you credits in the article.