
You will mistype things. Everybody does, and on a machine where a program is typed in by hand it matters more than it sounds: a forty-line program is a lot of typing to repeat because of one wrong letter.
BBC BASIC is well equipped for this. You can move about a line before you press ENTER, you can call a stored line back up and change it, and three commands take care of the numbering.
Before you press ENTER, the line is just characters on the screen and you can change them. The keys are all CTRL and a letter:
| Key | What it does |
|---|---|
| DELETE | rubs out the character to the left |
| CTRL-H | moves left, without rubbing anything out |
| CTRL-D (or TAB) | moves right |
| CTRL-K | jumps to the start of the line |
| CTRL-J (or the down arrow) | jumps to the end of the line |
| CTRL-F | deletes the character under the cursor |
| SHIFT-DELETE | opens a space at the cursor, to type into |
| CTRL-U | clears from the cursor to the end of the line |
| CTRL-X | clears from the cursor back to the start of the line |
In MAME: DELETE is Backspace, and CTRL is Ctrl (Control on a Mac, not Command).
Typing replaces what is under the cursor. Move back over a mistake and type the right letter on top of it. If you need an extra letter, SHIFT-DELETE opens a space for it first.
The arrow keys do not move the cursor. On the Einstein the left, right and up arrows type characters - [, ] and ^, which appear on the screen as little arrows. If you press one by accident you will see it arrive. CTRL-H is the left arrow you wanted.
EDIT brings a stored line back to be changed:
EDIT 10
BBC BASIC prints line 10, number and all, and puts the cursor at the start of it. Everything in the table above works on it. Press ENTER and the changed line is stored in place of the old one - it does not matter where on the line the cursor is when you do. Press ESC and the edit is abandoned: the line stays as it was.
The number is part of what you are editing. Change it, and the line is stored under the new number as well - the old one is still there. That makes EDIT the way to copy a line.
Typing 10, 20, 30 at the start of every line gets dull. AUTO does it:
AUTO
BBC BASIC offers 10 and waits. Type the rest of the line and press ENTER, and it offers 20. And so on. ESC stops it: you see Escape, the > comes back, and the number it was offering is not used.
AUTO 100,5 starts at 100 and goes up in fives.
Once you have squeezed lines into 21, 22 and 23 and run out of room, RENUMBER tidies the whole program up:
RENUMBER
renumbers from 10 in tens. RENUMBER 100,5 starts at 100 and steps by 5.
It fixes the jumps as well. You will meet GOTO later, a line that sends the program to another line by number; when RENUMBER moves that line, it rewrites the GOTO to match.
A number on its own deletes one line, as S4 showed. For a run of them:
DELETE 20,40
deletes lines 20 to 40, both included. There is no OLD for this: they are gone.
Type these three lines, deliberately getting line 10 wrong:
10 PRINT "THE CAT SAT"
20 PRINT "ON THE MAT"
30 PRINT "THE END"
Now make it a bat instead of a cat without retyping the line:
C of CAT.Starting from
A fresh boot, or NEW.
What you should see
After the edit, LIST shows line 10 changed and the other two untouched, and RUN gives:
>RUN
THE BAT SAT
ON THE MAT
THE END
>

EDIT 10 again, move the cursor onto the 1 of 10, type 4 and press ENTER. Now LIST. How many lines are there, and which is which?RENUMBER 100,5 and LIST. What have the line numbers become?5.1 Use AUTO to type a three-line program that prints ONE, TWO and THREE. Leave AUTO when you are done, and LIST it.
5.2 Type a program numbered 1, 2 and 3. Make it 10, 20 and 30 without retyping any of it.
5.3 Add lines 40 and 50 to that program, then remove lines 20 to 40 in one command.
Worked solutions are in Appendix II.
| Symptom | Cause |
|---|---|
| A little arrow appears in your line | You pressed an arrow key, which types a character. Rub it out with DELETE, and move with the CTRL keys. |
| Letters you typed replaced the ones that were there | Typing overwrites. Press SHIFT-DELETE first to open a space. |
Mistake after EDIT | The line you stored is not what you meant - the cursor was somewhere else when you typed. EDIT it again. |
You EDITed a line and now there are two | You changed its number. The old line is still there; delete it with its number alone if you meant to move it. |
AUTO keeps offering numbers | Press ESC. |
CTRL-H, CTRL-D, CTRL-K and CTRL-J move about a line; DELETE, CTRL-F, CTRL-U and CTRL-X remove things; typing overwrites. EDIT brings a stored line back to be changed or copied. AUTO numbers for you, RENUMBER tidies up, and DELETE removes a run of lines.
S6, Keeping Your Work - saving a program to disc, and getting it back after the Einstein has been switched off.