Classic Computer Magazine Archive ANTIC VOL. 4, NO. 8 / DECEMBER 1985



Foil those evil bulletin board crashers


Bulletin board sysops can now foil destructive "crashers" with this machine language USR call.  BBS Crashbuster quickly strips all non-standard ATASCII characters from input strings.  The BASIC demonstration program runs on all Atari 8-bit computers with disk or cassette.  We also included the source code for non-sysop assembly language mavens.

A genuine concern for any system operator (sysop) of an electronic bulletin board (BBS) is "board crashers" who try to shut down the BBS by sending invalid string characters. (Antic won't encourage this destructive behavior by including any examples.-ANTIC ED)

The Atari BASIC INPUT statement gives you very little control over the characters allowed. Most often, the sysop installs a slow FOR-NEXT loop to check a string for invalid characters before accepting it. This wastes time and precious memory.

Listing 1 is a short BASIC demonstration program containing a machine language (ML) routine that checks your input string for invalid characters and translates them to normal ASCII printable characters.
   The variable in the USR call at line 1000 (A = USR...) returns one of several values. A zero means that all is well and no invalid characters were in the string. A number between one and 255 is a count of the number of invalid characters that were found and corrected.
   The USR routine also checks for in-valid call formats. The program must have the string address followed by the string's length, which must be between one and 255. If one of these parameters is left off, or if you have too many, the ML routine will return safely to BASIC with a value of 256 in the calling variable.

Type the BASIC listing carefully and check it with TYPO II. If you're good at typing Atari special characters, type line 1000 as is, and don't bother typing line 15 and the lines from 2000 to the end. Antic Disk subscribers simply type RUN "D:CRBUSTBAS" to use the program.
   For those of us who don't like typing special characters, line 1000 will be created by lines 15 and 2000-etc. Should you decide to use these lines, skip line 1000 and type in the rest of the program. Check Listing 1 with TYPO II and SAVE a copy before you RUN it. Line 1000 will be printed on the screen, along with the unneeded line numbers. Move the cursor to each line number and press [RETURN]. The resulting program, consisting of lines 5 through 1010, may now be SAVEd.
   When RUN, the program will prompt you to enter a string. It will then print the converted invalid characters in L$ and the total number of these "garbage" characters.
   This routine should save budding sysops a lot of headaches with would-be crashers. But also, if you are writing any type of program that expects normal keyboard inputs, this routine can quickly clean up your strings.
   Listing 2 is the assembly language source code. Disk subscribers will find it on the monthly disk as CRBUST. M65. It need not be typed in, but you will require the MAC/65 assembler. cartridge if you wish to modify it. The source code can be easily modified for different types of translations. For example, you can also check for lower case characters and convert them directly to upper case.

Matthew Ratcliff is one of Antic's most dependable high-level programmers.

Listing 1   CRBUST.BAS Download

Listing 2   CRBUST.M65 Download / View