
In S4 you typed a program straight through and saved it. Programs are not written like that; they are written, read, and changed, and this section is the keys that let you move about a file and take things out of it. ED80 was HiSoft's programmer's editor for all CP/M machines, and it works the way WordStar did, which in 1985 meant the way everyone expected - with one difference on this disc that you have already met.
Most editors of the period used CONTROL and a letter for every command. ED80's manual does too, and lets you change any of them; on the course disc's copy they have been moved onto the GRPH key, so a command is GRPH held down and a letter. (In MAME: GRPH is F8.) If you hold CONTROL instead, ED80 takes the letter as text and puts ^E or the like into your program; DEL takes it out again.
While a two-key command is waiting for its second key, a ? appears in the status line.
| Keys | What it does |
|---|---|
| GRPH-S, GRPH-D | Left a character, right a character |
| GRPH-A, GRPH-F | Left a word, right a word |
| GRPH-E, GRPH-X | Up a line, down a line |
| GRPH-C | Down a screenful - on a short file, to the end |
| GRPH-Q then D | To the end of the line |
| GRPH-Q then R | To the start of the file |
| GRPH-Q then C | To the end of the file |
The arrow keys will not do any of this: on the Einstein they type [, ] and ^ (S3).
| Keys | What it does |
|---|---|
| DEL | Delete the character to the left of the cursor |
| GRPH-G | Delete the character under the cursor |
| CTRL-Y | Delete the whole line |
CTRL-Y is the one command on this copy that stayed on CONTROL. (In MAME: Ctrl and Y.)
ED80 starts in insert mode: what you type goes in at the cursor and pushes the rest of the line along. GRPH-V switches to change mode, in which what you type overwrites what is there - useful for correcting one letter in the middle of a word - and GRPH-V again switches back. The status line says which you are in, when you can see it.
GRPH-O then I turns auto-indent on (I/AUTO appears in the status line) and off again. With it on, ENTER starts the next line under the first character of the one before, which is what you want in a program where most lines are indented like the one above. Every listing in this course is indented by four spaces inside main; with auto-indent on you type the four spaces once.
ED80 was written for an 80-column screen, and on the Einstein's 40 its top status line wraps round: the second half of it - the mode, and any message - is drawn over the first line of your text. Your text is still there, and scrolling the file by a line brings it back into view. It is a nuisance rather than a fault, and you will stop noticing it.
GRPH-J shows a screen of ED80's commands - the ones above and the rest, including blocks and find-and-replace, which this course does not need. ENTER brings your file back.
| Keys | What it does |
|---|---|
| GRPH-K then X | Save and exit. ED80 shows Filename: with the file's name; ENTER accepts it. Any file already saved under that name is kept as .BAK |
| GRPH-K then Q | Exit without saving. ED80 asks Abandon text: Sure?; Y and it is gone |
There is no "save and stay". Save with GRPH-K X, and ED NAME.C again when you want to go on.
No new program. Open S4's again:
ED HELLO.C
and try every key in the tables above on it. Then leave with GRPH-K Q and Y, so that nothing you did is kept.
Starting from
The disc as S4 left it, with HELLO.C on it.
What you should see
The cursor moving as each table says; a ? in the status line after GRPH-Q, GRPH-K or GRPH-O until the second key; Abandon text: Sure? at the end, and 0: after Y.
Einstein, press GRPH-V, and type Tatung. What happens to the letters that were there? Press GRPH-V again and type it again.printf line, and press ENTER. Where does the cursor land?5.1 Open HELLO.C, add a second printf line above the first using only GRPH-Q R, GRPH-X and ENTER to get there, and save it.
5.2 Open the same file, delete the line you added with CTRL-Y, and leave without saving. Then DISP HELLO.C and say why the line is still there.
Worked solutions are in Appendix II.
| Symptom | Cause |
|---|---|
^E, ^X or another ^ pair appears in the text | CONTROL and a letter. The command key is GRPH. DEL removes it. |
A ? sits in the status line and the next key does something odd | A GRPH-Q, GRPH-K or GRPH-O was waiting for its second key. |
| The first line of the file seems to have vanished | It is under the wrapped status line. GRPH-X and GRPH-E bring it back into view. |
| Typing overwrites instead of inserting | GRPH-V was pressed. Press it again. |
Filename: appears when you did not expect it | GRPH-K X. ENTER saves under that name; DEL and retype to change it. |
GRPH and a letter is a command: S/D/A/F/E/X/C move, G deletes, Q-D and Q-R and Q-C jump, V toggles change mode, O-I auto-indent, J help; DEL deletes left and CTRL-Y the line. GRPH-K X saves and exits, GRPH-K Q abandons. The status line wraps over the first text row on 40 columns.
S6, What The Compiler Makes - the memory map read, why an empty program is 6K, and keeping the disc from filling up.