
 1000  *SAVE S.MESSAGE SEARCH
 1010  *--------------------------------
 1020  *   FIND ALL MESSAGES IN COM-WARE II VERSION 5.0-3
 1030  *
 1040  *      ALL MESSAGES ARE PRECEDED BY "JSR $3866"
 1050  *      AND END WITH A $00 BYTE:
 1060  *
 1070  *      20 66 38 <MSG> 00
 1080  *--------------------------------
 1090  MSG.PNTR   .EQ $00,01
 1100  END.PNTR   .EQ $02,03
 1110  *--------------------------------
 1120  PRINTAX .EQ $F941
 1130  COUT    .EQ $FDED
 1140  CROUT   .EQ $FD8E
 1150  *--------------------------------
 1160  KEYBOARD   .EQ $C000
 1170  STROBE     .EQ $C010
 1180  *--------------------------------
 1190  FIND   LDA #$900    COMWARE WAS BLOADED AT $900
 1200         STA MSG.PNTR
 1210         LDA /$900
 1220         STA MSG.PNTR+1
 1230  .1     LDA MSG.PNTR
 1240         CMP #$5125   COMWARE ENDS AT $5125
 1250         LDA MSG.PNTR+1
 1260         SBC /$5125
 1270         BCC .2       ...NOT AT END YET
 1280         RTS          ...FINISHED
 1290  *---SEARCH FOR A $20 BYTE--------
 1300  .2     LDY #0
 1310         LDA (MSG.PNTR),Y
 1320         CMP #$20
 1330         BEQ .4       FOUND $20
 1340  .3     JSR INC
 1350         BNE .1       ...ALWAYS
 1360  *---CHECK FOR $66, $38 AFTER $20---
 1370  .4     INY
 1380         LDA (MSG.PNTR),Y
 1390         CMP #$66
 1400         BNE .3
 1410         INY
 1420         LDA (MSG.PNTR),Y
 1430         CMP #$38
 1440         BNE .3
 1450  *---FOUND A MESSAGE!-------------
 1460         LDX #10
 1470         JSR MARGIN
 1480         JSR PAUSE
 1490         JSR INC      SKIP OVER THE $20, $66, $38
 1500         JSR INC
 1510         JSR INC
 1520         LDA MSG.PNTR+1        PRINT STARTING ADDRESS
 1530         STA END.PNTR+1
 1540         LDX MSG.PNTR
 1550         STX END.PNTR
 1560         JSR PRINTAX
 1570  *---SEARCH FOR END OF STRING-----
 1580         LDY #0
 1590  .5     LDA (END.PNTR),Y
 1600         BEQ .6       FOUND END
 1610         INC END.PNTR
 1620         BNE .5
 1630         INC END.PNTR+1
 1640         BNE .5
 1650  *---FOUND END OF STRING----------
 1660  .6     LDA #"."     PRINT "..."
 1670         JSR COUT
 1680         JSR COUT     PRINT THE END ADDRESS
 1690         JSR COUT
 1700         LDA END.PNTR+1
 1710         LDX END.PNTR
 1720         JSR PRINTAX
 1730         LDA #$A0     PRINT "   "
 1740         JSR COUT
 1750         JSR COUT
 1760         JSR COUT
 1770  *---PRINT OUT THE STRING---------
 1780         LDY #0
 1790         LDX #0
 1800  .7     LDA (MSG.PNTR),Y
 1810         BEQ .9       ...END OF STRING
 1820         ORA #$80
 1830         CMP #$A0     PRINTING CHARACTER
 1840         BCS .8       ...YES, GO PRINT IT
 1850         ORA #$40     ...NO, CONTROL, CHANGE TO 
 1860         PHA             PRINTING FORM
 1870         LDA #"^"     PRINT "^" FOLLOWED BE CHAR
 1880         INX
 1890         JSR COUT
 1900         PLA
 1910  .8     JSR COUT
 1920         INX
 1930         JSR INC      ADVANCE MSG.PNTR
 1940         CPX #55      IS THIS LINE FULL?
 1950         BCC .7       ...NO, KEEP GOING
 1960         LDX #24      ...YES, START NEW LINE
 1970         JSR MARGIN   INDENT
 1980         LDX #0
 1990         BEQ .7       ...ALWAYS
 2000  *--------------------------------
 2010  .9     JSR CROUT
 2020         JMP .1
 2030  *--------------------------------
 2040  INC    INC MSG.PNTR
 2050         BNE .1
 2060         INC MSG.PNTR+1
 2070  .1     RTS
 2080  *--------------------------------
 2090  PAUSE  LDA KEYBOARD      ANY KEY PRESSED?
 2100         BPL .3            ...NO, RETURN
 2110         STA STROBE        ...YES, CLEAR STROBE
 2120         CMP #$8D          WAS KEY <RETURN>?
 2130         BNE .2            ...NO, JUST A PAUSE
 2140  .1     JMP $3D0          ...YES, ABORT
 2150  .2     LDA KEYBOARD      ANY KEY PRESSED?
 2160         BPL .2            ...NO, KEEP WAITING
 2170         STA STROBE        ...YES, CLEAR STROBE
 2180         CMP #$8D          WAS KEY <RETURN>?
 2190         BEQ .1            ...YES, ABORT
 2200  .3     RTS               ...NO, END OF PAUSE
 2210  *--------------------------------
 2220  MARGIN JSR CROUT    START A NEW LINE
 2230         LDA #$A0     SKIP OVER (X) SPACES
 2240  .10    JSR COUT
 2250         DEX
 2260         BNE .10
 2270         RTS

