TED is an editor which can be invoked from LIMP by entering (run 'ted). It provides sufficient file management facilities to develop LIMP programs. It is discribed herewith. Tiny EDitor ... T E D Command Summary =============================================================================== TED is a line oriented editor (in the TECO/SPEED tradition) written in PROMAL for the C-64. It is small enough (3k bytes) to be incorporated into other application programs. TED is very different from C64 screen editors -- it sacrifices elegance for compactness and versatility. Expect to spend some time getting used to it. TED operates by accepting a string of characters from the keyboard. When a ctl-D character is received TED interprets this string as a sequence of editing commands. TED does NOTHING until it sees a ctl-D. Commands have the format [n]CM[s] where: n is an optional, possibly negative, number which, if absent, defaults to zero; CM is a one or two character (upper or lower case) command mnemonic; and s is a string argument required by some commands. All string arguments are of the form: dtxtd where d is a delimiting character which does not appear in the string data txt. For example FR+myfile+ would read the disk file MYFILE into the workspace. Filename and search pattern arguments are limited to 16 characters. Spaces and carrage returns can be inserted between commands to improve readability. Here are some example commands: J, -5M, S=thunk=. DEL is the only command string editing character. Ctl-C (STOP key) aborts the currently executing command or input string. TED files can contain unprintable character codes (except 00, nul). This is useful, for example, when printer control characters are desired. Non-printing characters are displayed as highlighted ascii codes in square brackets, e.g. [8] is ctl-H. The carrage return character appears as an upper-right corner graphic character. [eof] is displayed at file's end. The cursor position is displayed in reverse video. File Commands ------------- File names must be two or more characters long. File P is the printer and file W is a 12k RAM workspace under the C64 kernal and devices (standalone LIMP only.) FRfn Inserts the contents of the file fn into the buffer before the cursor. Can be used with the workspace, file W, and the FW command to effect cut and paste editing. E.g., to copy five lines following the cursor type: 5fw/w/ fr/w/. nFWfn Write n lines from the cursor to the designated new file, fn. If n=0 (or absent) then the whole text buffer is written. nFUfn File Update. Deletes existing file fn, then performs an FW operation. Q Quit TED, return to caller (LIMP). Cursor Movement --------------- nJ Move cursor to the beginning of line n. nL Move the cursor n lines forward or backward from the current position. If n=0 then the cursor is moved to the beginning of the current line. nM Move the cursor n characters from its current position. Stxt From the current cursor position, search the buffer for txt. E.g. s/aardvark/. Can be used with d and i commands to change text, e.g. s/aardvark/-8di/raccoon/ changes aardvark to raccoon. ? Print the current line number and the amount of free space. Deleting Text ------------- nK Kill n lines before or after the cursor. nD Delete n characters before or after the cursor. Inserting Text -------------- Itxt Insert txt before the cursor. (Note that the last character in the buffer is always a null. This end-of file marker is not written to the output file but, by placing the cursor on it, is used to append text to the buffer.) E.g. i/mytext/ inserts the string: mytext in the text buffer before the cursor. Txt may be many lines. nA Insert the ascii character whose decimal value is n before the cursor. Displaying Text --------------- Text displays include the elbow character for and highlighted numbers for unprintable characters. The cursor postion is shown in reverse video. nT Type n lines before or after the cursor. nW Set the window size to n. After each command sequence a window of n lines each side of the cursor is displayed. If n=0 no display is made. n defaults to 5 when TED is started. Iteration --------- nR This indicates the start of a loop to be executed n times. Loops may be nested up to five deep. End of loop. A loop to find the 5th occurance of the word arc could be coded: 5Rs/arc/ up-arrow Exit the innermost loop if the last search was un-successful. The following changes all occurances of cat to dog: 999Rs/cat/-3di/dog/ Command Modification -------------------- ctl-E Aborts the current input and inserts the previous command sequence at the end of the text buffer. This sequence can then be edited and re-executed using the X command. This can save a lot of typing, for example, when a long command sequence was entered with an error. Instead of retyping it, just hit ctl-E, edit and X it. X Copies the text between the cursor and the end of the text buffer to the command buffer and interprets that text as a sequence of commands. This text must contain a ctl-D like a regular command sequence to terminate execution. (A ctl-D can be inserted in the text with the 4A command.) LED Internals ============= LED uses all available memory which it organizes as follows: --------------------------------------------------------------------- ! text buffer ! input buffer ! free space ! command buffer ! --------------------------------------------------------------------- Commands are input to the input buffer and copied to the command buffer before execution. The text buffer will grow and shrink as required. Insert commands cause the text beyond the cursor to be copied to the the free space to open an area in the text buffer where new text can be inserted. When complete the this copied text is appended to the text buffer.