
 1000  *********************************
 1010  *                               *
 1020  *           F A D D             *
 1030  *                               *
 1040  *  ( FIND ADDRESS REFERENCES )  *
 1050  *   -------------------------   *
 1060  *                               *
 1070  *    A PUBLIC DOMAIN UTILITY    *
 1080  *                               *
 1090  *     BY.. BROOKE W BOERING     *
 1100  *                               *
 1110  *********************************
 1350  
 1360  * TO USE:
 1370  * 1- BLOAD FADD.OBJ
 1380  * 2- GET TO MONITOR
 1390  * 3- 'FAT FINGER' YOUR ADDRESS
 1400  *    INTO 6-7 IN HI-LO ORDER.
 1410  *   NOTE ------> ^^ ^^ <-------
 1420  * 4- EXECUTE WITH A '300G'
 1430  
 1460  *---------------------------------
 1470  *         E Q U A T E S
 1480  
 1490  TARGHI .EQ $6
 1500  TARGLO .EQ $7
 1510  * NOTE: ABOVE REVERSES NORMAL LO/HI-BYTE
 1520  *  ORDER FOR EASIER KEYIN FROM MONITOR
 1530  WHER   .EQ $8
 1540  WHERLO .EQ $8
 1550  WHERHI .EQ $9
 1560  
 1570  LENGTH  .EQ $2F
 1580  PCL     .EQ $3A
 1590  PCH     .EQ $3B
 1600  COLOR   .EQ $30
 1610  
 1620  INSDS2  .EQ $F88E
 1630  INSTDSP .EQ $F8D0
 1640  PCADJ3  .EQ $F956
 1650  CROUT   .EQ $FD8E
 1660  *---------------------------------
 1670         .OR $300
 1680  *      .TF B.FADD
 1690  *---------------------------------
 1700  START
 1710  
 1720   LDX #0
 1730   STX WHERLO   START AT BEGINNING
 1740   STX WHERHI   OF MEMORY
 1750  
 1760  *-- CHECK FOR DIRECT REFERENCE
 1770  .1
 1780   LDY #0
 1790   LDA (WHER),Y GET WHERAT-LO
 1800   STA COLOR    SAVE TEMP
 1810   LDA (WHER),Y GET IT AGAIN
 1820   CMP COLOR    STILL THE SAME?
 1830   BNE .8       NO, SKIP IT, NO MEMORY HERE
 1840  * (FALL THROUGH IF MEMORY AT THIS ADDRESS)
 1850  
 1860   CMP TARGLO   ? TARGET-LO ?
 1870   BNE .3       NO, GO AHEAD
 1880   INY
 1890   LDA (WHER),Y GET WHERAT-HI
 1900   CMP TARGHI   ? TARGET-HI ?
 1910   BNE .3       NO, GO AHEAD
 1920  * (FALL THROUGH IF 2-BYTE MATCH ON TARGET)
 1930  
 1940  *-- APPARENT MATCH;
 1950  *     MAKE SURE IT'S A 3-BYTE INSTRUCTION
 1960  .2
 1970   LDY WHERHI   GET ADDRESS OF MATCH
 1980   LDX WHERLO
 1990   BNE .24
 2000   DEY          POINT TO INSTRUCTION BYTE
 2010  .24
 2020   DEX
 2030   STX PCL      AND SET PROGRAM COUNTER
 2040   STY PCH
 2050  
 2060   LDX #0
 2070   LDA (PCL,X)  GET OPCODE
 2080   JSR INSDS2   USE MONITOR DISASSEMBLER ROUTINE
 2090   LDA LENGTH
 2100   CMP #2       3-BYTE INSTRUCTION?
 2110   BEQ .6       OK; GO AHEAD TO DISPLAY
 2120  * (FALL THROUGH WHEN NOT A 3-BYTE INSTR)
 2130  
 2140  *-- CHECK FOR RELATIVE BRANCH
 2150  .3
 2160   LDY #0
 2170   LDA (WHER),Y GET INSTRUCTION BYTE
 2180   AND #$1F     ISOLATE SIGNIFICANT BITS
 2190   CMP #$10     A BRANCH INSTRUCTION?
 2200   BNE .8       DEFINITELY NOT
 2210  * (FALL THROUGH WHEN A BRANCH INSTRUCTION)
 2220  
 2230  *-- TEST IF BRANCHING TO TARGET
 2240  *     NOTE: USING MONITOR TECHNIQUE
 2250  .4
 2260   LDX WHERLO   PRESET FOR PCADJ3
 2270   LDY WHERHI
 2280   STX PCL      SET PC TO OPCODE BYTE
 2290   STY PCH
 2300   LDY #1
 2310   LDA (WHER),Y GET OFFSET BYTE
 2320   JSR PCADJ3   LEAVES EFFECTIVE ADDRESS-1
 2330  *             IN Y AND A
 2340   TAX
 2350   INX
 2360   BNE .43
 2370   INY
 2380  .43
 2390  *-- NOW 'BRANCH TO' ADDRESS IS IN Y AND X
 2400   CPX TARGLO
 2410   BNE .8
 2420   CPY TARGHI
 2430   BNE .8
 2440  * (FALL THROUGH ON MATCH)
 2450  
 2460  *-- DISPLAY MATCHED INSTRUCTION
 2470  .6
 2480  * PCL/PCH ARE SET
 2490   JSR INSTDSP  <= MONITOR ROUTINE
 2500  
 2510  *-- ALLOW KEYED PAUSE/RELEASE
 2520  .7
 2530   BIT $C000    KEY DOWN?
 2540   BPL .8       NO, GO AHEAD
 2550   BIT $C010    YES, CLEAR STROBE
 2560  .77
 2570   BIT $C000    RELEASED?
 2580   BPL .77      NO, LOOP TIL SO
 2590   BIT $C010    YES, CLEAR STROBE
 2600  
 2610  *-- POST DISPLAY (OR NO MATCH)
 2620  .8
 2630   INC WHERLO   KICK ADDRESS
 2640   BNE .1       LOOP 255 OF 256
 2650   INC WHERHI   KICK ADDR PAGE#
 2660   BEQ .9       EXIT AT 65536 OVFLO
 2670  
 2680  *-- AT NEW PAGE !!
 2690   LDA WHERHI
 2700   CMP #$C0     AT THE I/O PORTS ?
 2710   BNE .1       NO, LOOP BACK
 2720   LDA #$D0     YES, SKIP 'EM
 2730   STA WHERHI   : (AVOID PROBLEMS)
 2740   BNE .1       LOOP BACK
 2750  
 2760  .9
 2770   JMP CROUT    RETURN THROUGH CROUT

