daily pastebin goal
64%
SHARE
TWEET

MEMSRCH.BAS (Memory Search for Telehack)

tchnmncr Mar 21st, 2017 (edited) 22 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 5 REM MEMSRCH.BAS BY TECHMAGE@TELEHACK.COM
  2. 10 PRINT "START ADDRESS (DEC)";
  3. 15 INPUT AS: REM STARTING ADDRESS (DECIMAL)
  4. 20 PRINT "END ADDRESS (DEC)";
  5. 25 INPUT AE: REM ENDING ADDRESS (DECIMAL)
  6. 30 PRINT "SEARCH STRING";
  7. 35 INPUT S$: REM SEARCH STRING
  8. 40 L=LEN(S$): REM LENGTH OF SEARCH STRING
  9. 45 DIM AA(L): REM ADDRESS ARRAY
  10. 50 AC=AS: REM CURRENT ADDRESS (INCREMENTS)
  11. 100 D=PEEK(AC): REM DATA
  12. 110 IF CHR$(D) = MID$(S$,1,1) THEN GOTO 200
  13. 115 AC=AC+1
  14. 120 IF AC >= AE THEN GOTO 300
  15. 125 GOTO 100
  16. 200 REM LOOP TO MATCH ENTIRE STRING
  17. 205 FOR I = 1 TO L
  18. 210 IF CHR$(PEEK(AC+I-1)) <> MID$(S$,I,1) THEN GOTO 115
  19. 215 AA(I)=AC+I-1
  20. 220 NEXT
  21. 225 GOTO 400
  22. 300 PRINT "SEARCH STRING ";
  23. 305 PRINT CHR$(34);S$;CHR$(34);
  24. 310 PRINT " NOT FOUND IN ADDRESS RANGE."
  25. 315 GOTO 420
  26. 400 PRINT "SEARCH STRING ";
  27. 405 PRINT CHR$(34);S$;CHR$(34);
  28. 410 PRINT " FOUND BETWEEN ADDRESSES";
  29. 415 PRINT AA(1);" AND ";AA(L);"."
  30. 420 END
RAW Paste Data
Top