Scans the 8K ROM up to address 7679 for the Z80 CALL instruction (code 205) and the conditional CALLs, builds a list of called and calling addresses, sorts it and displays it a screen at a time, with a count at the end. The scan and sort take about 20 minutes. Syntax counted 295 unconditional and 27 conditional calls.
Run it once and SAVE it with the list; GOTO 1000 shows the list again, and GOTO 2000 LPRINTs it. The listing has Syntax’s modifications of December 1983, and the article gives a table of further changes for the Spectrum and TS2068 ROM.
Published in Syntax December 1983 (8K ROMCALLS).
Source Code
1 REM THIS PROGRAM LISTS ALL CALLS IN 8K 0F ROM.
2 REM BY MARTY IRONS, K2MI, 46 MAGIC CIRCLE DR., GOSHEN. NY 10924
3 REM 5 MAY 1982
4 REM THIS PROGRAM TAKES ABOUT 20 MINUTES TO SCAN THE ROMSORT AND START TO PRINT
5 REM "GOTO 1000" TO LIST ALL CALLS, AFTER RUNNING IT AND SAVING IT.
6 REM MODIFIED BY SYNTAX DEC 83
10 DIM C$(400,10)
20 LET MAX=0
30 FAST
100 FOR I=0 TO 7679
110 LET V=PEEK I
120 IF V<196 THEN GOTO 290
130 IF V=205 THEN GOTO 200
140 IF V-8*(INT (V/8))<>4 THEN GOTO 290
200 REM TEST CALLED ADDRESS
205 LET V=PEEK (I+1)+256*PEEK (I+2)
210 IF V>7679 THEN GOTO 290
215 REM THIS IS A CALL
220 LET MAX=MAX+1
230 LET V$=STR$ (V)+(STR$ (I+100000))(2 TO 6)
240 IF LEN V$>9 THEN GOTO 270
250 LET V$="0"+V$
260 GOTO 240
270 LET C$(MAX)=V$
280 LET I=I+2
290 NEXT I
300 PRINT "SORTING ";MAX;" ENTRIES"
302 PAUSE 100
304 CLS
310 FOR I=1 TO MAX-1
320 LET P=I
330 FOR J=I+1 TO MAX
340 IF C$(J)<C$(P) THEN LET P=J
350 NEXT J
360 LET Z$=C$(P)
370 LET C$(P)=C$(I)
380 LET C$(I)=Z$
390 NEXT I
400 PRINT "SORT COMPLETE"
410 PAUSE 100
420 CLS
430 GOTO 1000
500 PRINT "CALLED ROUTINES IN ROM"
510 PRINT
520 PRINT "CALLED ADDR","CALLING ADDR"
530 PRINT
540 RETURN
1000 GOSUB 500
1010 FOR I=1 TO MAX
1020 IF PEEK 16442>3 THEN GOTO 1070
1030 INPUT Z$
1040 CLS
1050 IF Z$<>"" THEN GOTO 9999
1060 GOSUB 500
1070 PRINT " ";C$(I,1 TO 5)," ";C$(I,6 TO 10)
1080 NEXT I
1200 PRINT
1210 PRINT " THERE ARE ";MAX;" CALLS"
1220 GOTO 9999
2000 REM IF YOU HAVE A PRINTER "GOTO 2000" TO PRINT ALL CALLS.
2010 LPRINT "CALLED ROUTINES IN ROM"
2020 LPRINT
2030 LPRINT "CALLED ADDR","CALLING ADDR"
2040 LPRINT
2050 FOR I=1 TO MAX
2060 LPRINT " ";C$(I,1 TO 5)," ";C$(I,6 TO 10)
2070 NEXT I
9999 STOPNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

