invent 8bit

SAM Coupé Code Search

Search SAM data/code files for specific words

Small code-search utility released on FRED 55 Bits & Bobs. We didn't have IDEs back in those days so I wrote this little utility to find strings (methods, text) in code files on disk -- useful when you forget where you left something.

Firstly is a code searcher program by Martin 'Duhh' Fitzpatrick. It's a really simple program, but very useful. The main reason I like it is that you can see where it is in the code, so you know how long to wait rather than looking at a black screen.

Source code

basic
   10 MODE 3: CSIZE 8,8
   20 PEN 3
   30 PRINT AT 0,0;"Welcome to Code Searcher....."
   40 PRINT AT 10,10;"1. Load Code File"
   50 PRINT AT 12,10;"2. Search File For Word"
   60 PRINT AT 14,10;"3. View Whole File"
   70 GET k$
   80 LET start=30000,prup=0
   90 IF k$="2" THEN GO SUB wordsearch
  100 IF k$="3" THEN GO SUB fullsearch
  110 IF k$="1" THEN GO SUB loadie
  120 GO TO 10
  130 FOR a=30000 TO 524288
  140 LABEL fullsearch
  150 CLS : IF prup>0 THEN GO TO 170
  160 INPUT "SEARCH SPEED? ";sp
  165 INPUT "START? (30000 to )";start
  170 FOR a=start TO 524288
  180 LET a$= MEM$ (a TO a)
  190 IF CODE a$>31 THEN PRINT a$;: LET a=a+sp
  200 IF INKEY$ ="x"  OR INKEY$ ="X" THEN CLS : PRINT AT 0,0;"EXITED SEARCH AT ";a: PAUSE : RUN
  210 NEXT a
  220 RETURN
  230 LABEL wordsearch
  240 LET prup=0
  250 CLS
  260 INPUT "SEARCH FOR? ";s$
  270 LET b= LEN s$-1
  275 INPUT "SEARCH SPEED? ";sp
  276 INPUT "START? (30000 to )";st
  280 PRINT AT 0,0;s$;"  "
  290 FOR a=st TO 524288
  300 PRINT AT 1,0;a;"  "
  310 LET a$= MEM$ (a TO a+b)
  320 IF CODE a$(b+1)<32 THEN LET a=a+sp: LET prup=0
  330 IF a$=s$ THEN BEEP 0.1,1: LET start=a: LET k$="3" : RETURN
  340 IF CODE a$(b+1)>31 THEN LET prup=prup+1
  350 IF prup>b THEN PRINT AT 2,0;a$
  360 NEXT a
  370 RETURN
  380 LABEL loadie
  390 DIR 1
  400 INPUT "CODE FILENAME? ";c$
  410 LOAD c$  CODE 30000
  420 RETURN
  430 MODE 3: CSIZE 8,8
  440 LOAD "CodeS.txt"  CODE 30000
  450 FOR a=0 TO 2792
  452 LET c=30000+a
  453 PRINT MEM$ (c TO c);
  454 NEXT a
  460 PAUSE : RUN
  470 DEF PROC rs: SAVE "CodeSEARCH" LINE 430: PRINT "DONE!": END PROC

It looks like search speed is more like step size and will miss

Over 10,000 developers have bought Create GUI Applications with Python & Qt!
Create GUI Applications with Python & Qt5
More info Get the book

Downloadable ebook (PDF, ePub) & Complete Source code

To support developers in [[ countryRegion ]] I give a [[ localizedDiscount[couponCode] ]]% discount on all books and courses.

[[ activeDiscount.description ]] I'm giving a [[ activeDiscount.discount ]]% discount on all books and courses.