Make a greeting with Spectrum BASIC
Make the Spectrum display words you chose. You will change a stored instruction, run it and explain why the messages appear in their order.
You do not need programming experience. Use a browser and internet connection. The editable listing accepts your device’s normal keyboard; typing directly into the recreated Spectrum uses the special key combinations explained in the lesson.
Open the lesson
Open Make the Spectrum answer. Read the opening and follow it down to Run an editable listing. You may try the Spectrum keyboard instructions on the way, or use the editable listing for this activity. You do not have to enter the program twice.
The listing contains three numbered instructions. PRINT displays the text
inside quotation marks. Each instruction here finishes with a new line.
The numbers identify stored program lines; this program follows their increasing
order when it runs.
Predict the starting result
Read the three numbered lines in the editable listing. Without running yet, write or say which messages you expect and in what order. Then choose Run this code and compare the Spectrum’s greeting with your prediction.
Choose Back to the listing to return to your editable program.
Change one message
In line 10, replace only the word Welcome with a short greeting of your own.
Keep its quotation marks and the rest of the line. Leave lines 15 and 20 alone.
Predict which message will change and which will stay the same. Choose Run this code, compare, then return with Back to the listing.
Explain what PRINT asks the machine to do and why changing line 10 leaves the
other instructions in place. If something differs from your prediction, use
When the screen disagrees in the lesson to investigate.
Keep your greeting and stop
Copy your complete three-line listing into a plain text file, such as
greeting.txt, and save it somewhere you can find again. Reload the lesson,
replace the whole editable listing with the text from your saved file and choose
Run this code. Check that your chosen words reappear. This tests your own
kept source, rather than a fresh example.
You can also open Listing options and choose Download tape to keep a
.tap file for an emulator with tape-loading controls. A tape image is a
loadable program, not a picture of the screen. The current editable browser
panel reopens readable source by pasting it into the listing.
You have reached a stopping point when your changed greeting runs, you can explain the change and you have kept a copy. Before using Reset to original, keep any edits you want; that button restores the lesson’s starting listing.
Try another question
If you want another experiment, change line number 15 to 25 in the text editor. Leave its message unchanged. Predict the order before running. This edits the complete source listing; entering numbered lines directly into the Spectrum uses a different editing procedure, explained in the lesson.
If you already program, compare this numbered-line model with how your usual language stores and runs a program. Which parts of your explanation apply to this example, and which depend on the language?
Continue or work on paper
Continue with Remember a name; keep the program to store a name separately from the instruction that displays it.
If the browser tools are unavailable, read the complete greeting in the lesson, trace the three messages on paper and write your changed line. Mark the result as a prediction until you can run it. Keep that sheet for your next session.