Classic Computer Magazine Archive PROGRAM LISTING: 84-12/SAVER.SRC


10       *=  $0600
20       PLA         ; no. of bytes
30       PLA         ; save start address
40       STA 1       ; of string that holds
50       PLA         ; the list of items
60       STA 0
70       PLA         ; get & store the
80       STA 3       ; item no. to search
90       PLA         ; in a counter
0100     STA 2
0110     LDA #1
0120     STA 212     ; set BEGIN=1
0130     LDY #0
0140     STY 213
0150     LDA (0),Y   ; get a char from string
0160     BPL 1579    ; is it inverse?
0170     DEC 2       ; yes, decrement counter
0180     BNE 1579
0190     LDA 3
0200     BNE 1577    ; found item yet?
0210     INY         ; yes, now find length
0220     LDA (0),Y   ;of item and
0230     BPL 1569
0240     STY 1       ; store in loc. 1
0250     RTS         ; return to BASIC
0260     DEC 3       ; haven't found item yet, so
0270     INC 212     ; BEGIN=BEGIN+1
0280     BNE 1585
0290     INC 213
0300     INC 0       ; point to next
0310     BNE 1557    ; char in string
0320     INC 1
0330     BNE 1557    ; branch!

Back to previous page