Devpac80 Companion cover: MON80, HiSoft's monitor, showing the companion's SUM program disassembled on the Tatung Einstein
← Back to Modules
module
4

The Editor

Introduction

VS Code let you click anywhere, select with the mouse and paste. ED80 has no mouse: everything is a key, and nearly every key is CONTROL and a letter. They look arbitrary at first. They are not - they are a map drawn on the left of the keyboard, and after an hour you stop thinking about them.

Moving

Hold CONTROL for all of these. (In MAME: Ctrl.)

KeysMoves
CONTROL-S / CONTROL-Da character left / right
CONTROL-A / CONTROL-Fa word left / right - to the start of the word
CONTROL-E / CONTROL-Xa line up / down
CONTROL-R / CONTROL-Ca page up / down - 21 lines
CONTROL-Q then S / Dto the start / end of the line
CONTROL-Q then R / Cto the start / end of the whole file

Look at where the first eight sit on the keyboard: E above, X below, S and D either side, A and F further out for the bigger step, R and C outside those for the biggest. CONTROL-Q in front turns a move into "all the way".

The top row always tells you where you are, as LINE and COL. At the right of the bottom row, ED80 shows the last command it took, so you can see what it thought you pressed.

Deleting

KeysDeletes
DEL (or CONTROL-Y)the character to the left of the cursor
SHIFT-DEL (or CONTROL-Z)the whole line
CONTROL-Q then DELfrom the start of the line up to the cursor
CONTROL-Q then SHIFT-DELfrom the cursor to the end of the line

(In MAME: DEL is Backspace.)

Blocks

A block is a stretch of text you mark, and then copy, move or delete in one go.

KeysDoes
CONTROL-K then Bmarks where the block starts
CONTROL-K then Kmarks where it ends
CONTROL-K then Ccopies the block to the cursor
CONTROL-K then Vmoves the block to the cursor
CONTROL-K then Ydeletes the block
CONTROL-O then Pputs the block you last deleted back, at the cursor

Both marks include the character under the cursor. So to mark whole lines, put the start mark at the start of the first line, and the end mark at the start of the line after the last one you want - the block then ends with that line's first character. If that line is blank, its first "character" is just the end of the line, and you have marked your lines exactly.

Copying Four Lines

Load S3's program:

ED80 HELLO.GEN

ED80 puts you at line 1, column 1. You are going to add a fifth letter by copying the four lines that print the O, and changing the copy.

  1. CONTROL-C - a page down. LINE:22, the blank line before RET.
  2. CONTROL-E three times - LINE:19, the start of LD A,"O".
  3. CONTROL-K then B - the start of the block.
  4. CONTROL-X three times - LINE:22, the blank line.
  5. CONTROL-K then K - the end of the block. It takes in the blank line's end, so the block is the three instructions and the blank line.
  6. CONTROL-X - LINE:23, the start of RET.
  7. CONTROL-K then C - the copy goes in front of RET, and the cursor stays where it was: at the start of the copy.

The block copied in front of RET

Now change the copy's O:

  1. CONTROL-Q then D - the end of the line, after the closing ".
  2. CONTROL-S - back one, onto the ".
  3. DEL - the O to its left goes.
  4. Type !.

The copy changed to "!"

Save with CONTROL-K CONTROL-X and ENTER, and assemble and run as before.

The Code

What HELLO.GEN is now:

; HELLO - THE ASSEMBLY COURSE'S S3

        LD A,"H"
        RST 8
        DEFB 158       ; ZOUTC

        LD A,"E"
        RST 8
        DEFB 158

        LD A,"L"
        RST 8
        DEFB 158

        LD A,"L"
        RST 8
        DEFB 158

        LD A,"O"
        RST 8
        DEFB 158

        LD A,"!"
        RST 8
        DEFB 158

        RET

Edit, assemble and run

The eleven steps above, then CONTROL-K CONTROL-X, ENTER, and:

GEN80 HELLO
HELLO

What you should see

0:HELLO
HELLO!
0:

Saving over HELLO.GEN kept the version before as HELLO.BAK - type DIR and it is there. ED80 does that every time you save over a file: the last version is never more than one rename away.

Leaving Without Saving

If an edit has gone wrong and you want the file as it was, CONTROL-K then Q. ED80 asks:

Abandon text: Sure?

Y goes back to 0: without writing anything.

Change One Thing

  • Mark the four "!" lines again and delete them with CONTROL-K Y. Now go to the end of the file with CONTROL-Q C and press CONTROL-O P. Where does the block go? Before you assemble it, think: what will the program print? Leave with CONTROL-K Q if you would rather keep your HELLO!.
  • Put the cursor in the middle of DEFB 158 ; ZOUTC and try CONTROL-Q DEL and then CONTROL-Q SHIFT-DEL. Which part of the line does each take? Leave with CONTROL-K Q and Y.
  • Mark the "E" lines as a block and use CONTROL-K V instead of C to move them in front of RET. What does the program print now?

Summary

CONTROL-E S D X and friends move; DEL, SHIFT-DEL and the CONTROL-Q versions delete; CONTROL-K B and K mark a block - both ends included - and C, V and Y copy, move and delete it. CONTROL-K X saves (the old file kept as .BAK); CONTROL-K Q abandons.

Next

S5: what GEN80 does when your program is wrong.

Get the Newsletter

New guides, disk images and community finds, roughly once a quarter. No spam, we promise, this isn't Tatung's marketing department.
Your subscription could not be saved. Please try again.
Your subscription has been successful.

Newsletter

Subscribe to our newsletter and stay updated.