"Display Messages" is a program which will do just that on the VIC color screen. The message appears on the right, one character at a time, moves leftward across the screen, and then vanishes. The program can be used to display business hours, holiday greetings, information, directions, and so forth. Passersby can't resist reading the messages.
Program 1 can be incorporated easily as a subroutine in games and other programs where an eye-catcher is needed. It is a demonstration and you can quickly substitute a message of your own by changing the DATA statements at the end of the program. Be sure to type the program exactly as shown. After you have the program running, try changing the number of cursors-left in line 50 and see what happens. Try changing the TAB(20) to another number. This should give you some idea of how the program moves your message.
The key is line 50, with the proper number of tabs and cursors-left. Most important is the CHR$(20), which actually causes the movement by removing a space at column 2, line 11. That makes everything move one space to the left.
Note: The VIC will not print some punctuation marks — including commas and colons — from the DATA statements unless they are enclosed in quotation marks. Program 1 is useful for short, reusable messages. These can be stored easily on tape.
However, long messages require very long DATA statements which are time-consuming and awkward. Program 2 allows direct typing of your message without the use of DATA statements. The program also offers a choice of screen and letter colors and provides two areas for stationary messages to appear. The mid-screen area is used for the moving display, while the upper- and lower-screen portions may be used for up to five lines of stationary messages or graphics. The format is as follows:
- Choose screen and border colors
- Top screen message (yes or no)
- letter color
- five lines of messages
- Bottom screen message (yes or no)
- letter color
- five lines of messages
- Moving display letter color
- reverse or normal letters
- number of characters needed
- Write display message
The length of any message is determined and limited only by the amount of memory available. You select the approximate number of characters needed and perform a DIM statement on A$. It will hold the characters entered for your display message.
RETURN Key Options
The RETURN is used to speed input. Using RETURN for any input requested in the program will give preset values; for colors RETURN selects blue; for screen and border, RETURN gives cyan with white screen; and for yes or no questions, RETURN gives a no answer. Once the message is running it is in an endless loop. To stop the program, hit the RUN/STOP key and the RESTORE key at the same time.
The program as shown does not have the capability to save and store a message on tape for later use. That takes more memory and, therefore, limits the length of messages you can write. If you have an expanded VIC-20, however, you need not worry about memory space. Additions and changes for the Display Messages program are included to change it into a display and save program (see Program 3). Program 3 can be used on an unexpanded VIC-20 if you are careful to use 25 or fewer characters in your moving display message. If you use more than 25 characters, there is not enough memory to complete the save portion of the program. You will get an "out of memory" error and will have lost your message.
Ideas For Other Programs
Several programming ideas here might prove useful in other programs. One is the use of the letter color subroutine. If you look at lines 400 to 510, you will notice that the routine uses DATA statements to select the correct CHR$ number. The number of the color input in line 420 tells line 440 how many of the DATA statements to read in line 510. The CHR$ number read from the DATA statement then sets the color for CHR$(X(G)) which is used in the program to PRINT the color selected.
By adding and changing the lines from Program 3, you will have a program which can save a display on a file tape. This file tape can be used later with Program 4 to play back your message.
You can also have upper- and lowercase letters in your display messages by pressing the SHIFT and COMMODORE keys at the same time. Do this at the beginning of the program. You can save the program on a file tape, recover it using the load display, then press the SHIFT and COMMODORE keys to restore proper case.
Program 4 recovers the data from a file tape containing the message. Lines 30-130 use this data to display the message. You may notice that in line 224 the value of I has been doubled. This is necessary because as the data is saved on the file tape with a GET# statement, a CHR$(13), a RETURN, is entered after each data bit. Without doubling (I) you are returned only half of your message, and it contains a space between each character. Line 80 then takes the doubled (I) and by using a STEP 2 eliminates all of the spaces caused by the GET# statement. The result is a display message exactly like the one saved by the display and save program.
If you put Program 4 as the first program on a file tape, then save your messages after it, you'll have easy access to your library of messages. Just one tape is needed since the load and file are together.
If you would like the programs, but don't have time to type them in, send $3, a tape, and a stamped, self-addressed mailer to:
306 Yorktown Dr.
Goshen, IN 46526