Search Memory

From BeebWiki
Jump to: navigation, search


Here is a simple program to search memory for particular assembly code.

You can type in Assembly Mnemonics and the program will assemble the code and search for that code in memory.

   10 REM Memory Search, For BASIC ROM Routines
   20 MODE7
   30 INPUTLINE"Enter Assembly Code to Search for"'"  : "A$
   40 OSCLI"*KEY0 P%=&900:["+A$+"|M"+"G.80|M"
   50 *FX138,0,128
   60 VDU21
   70 END
   80 Z%=(P%-1)-&900
   90 VDU6
  100 FORI%=&8000TO&BFFF
  110 M%=0:FORJ%=&900TO(&900+Z%)
  120 IF?J%=?(I%+(J%-&900)) M%=M%+1
  130 NEXT
  140 IFM%=Z%+1 PRINT"Found at &";~I%
  150 NEXT
  160 PRINT'"End of search."
  170 END