Classic Computer Magazine Archive PROGRAM LISTING: 85-12/CRBUST.M65


10 ; BBS CRASHBUSTER, LISTING 2
20 ; BY MATTHEW RATCLIFF
30 ; (c) 1985, ANTIC PUBLISHING
40 ;
50 ;FORM: A=USR(PROG,ADR(L$),LEN(L$))
60 ;
70 RESULT =  $D4     ; RETURN # OF BAD CHARACTERS
80 TXADR =   $D6     ;SAVE STRING ADDR
90 SAVCR =   $D8     ;SAVE CHARACTER TO SEE IF CHANGED
0100     *=  $4000   ;CAN GO ANYWHERE
0110 START
0120     LDA #0      ;ZERO-OUT RESULT
0130     STA RESULT
0140     STA RESULT+1
0150     PLA         ;GET ARGS
0160     BEQ ERROR   ;DISALLOW BAD CALLS
0170     CMP #2      ;MUST BE 2
0180     BEQ AOK     ;GOOD..PROCESS IT
0190     TAX         ;BAD CALL, CLEAN UP STACK
0200 ER1 PLA 
0210     PLA 
0220     DEX 
0230     BNE ER1
0240 ERROR INC RESULT+1
0250 ;THIS WILL RETURN 256 IN CALLING
0260 ;VARIABLE, INDICATING INVALID CALL.
0270     RTS 
0280 AOK PLA 
0290     STA TXADR+1
0300     PLA 
0310     STA TXADR   ;GET STRING ADDRESS
0320     PLA 
0330     PLA         ;GET LENGTH
0340     TAY         ;USE AS INDEX
0350 LOOP
0360     LDA (TXADR),Y
0370     STA SAVCR   ;SAVE CHARACTER
0380     AND #$7F    ;DISALLOW INVERSE
0390     SEC 
0400     CMP #32     ;CHECK FOR CONTROL CARS
0410     BCS NCTL    ;NO CONTROL-GOOD
0420     CLC         ;YES, THEN ADD 64
0430     ADC #64     ;TO MAKE IT ASCII CHARACTER
0440 ;CONTROL-LETTERS & INVERSE-CONTROL-LETTERS
0450 ;BECOME EQUIVALENT VALID LETTERS.
0460 NCTL SEC 
0470     CMP #123    ;NO CHARS ABOVE CHR$(123),"z"
0480     BCC OK1
0490     SBC #64     ;TOO BIG, MAKE CTRL-";" A ";"
0500 ;ALSO TAKES CARE OF ESCAPE-CTRL EDIT KEYS
0510 OK1 CMP #96     ;NOT CTRL-PERIOD EITHER
0520     BNE ALLOK
0530     LDA #46     ;CTRL-PERIOD, MAKE IT PERIOD ONLY
0540 ALLOK STA (TXADR),Y
0550     CMP SAVCR
0560     BEQ TEST
0570     INC RESULT  ;KEEP "BAD" COUNT
0580 TEST DEY 
0590     BPL LOOP
0600     RTS         ;CLEANED UP, BACK TO BASIC
0610     .END 

Back to previous page