Design and Implementation of an Advanced Text Editor

by Craig Bruce (csbruce@ccnga.uwaterloo.ca )

Note: Due to the size of the article, no executable or source code is included, but both will be included in ACE Release #15 (ftp://ccnga.uwaterloo.ca/pub/cbm/os/ace/).


Contents

1. INTRODUCTION

This article discusses the design and implementation of the ZED text editor for the ACE operating system (Release #15 and higher). The program and full source code will be freely available when they are ready. ZED is written entirely in assembly language (ACEassembler) and makes heavy use of the full-screen control capabilities of ACE. However, part of the genius of the design of the ACE interface is that its facilities could be replicated into a standalone environment and a new ZED could be made into a one-part program (for greater convenience, with less flexibility).

There was a previous version of ZED, which WAS a standalone program. It was written entirely in _machine_ language (as opposed to assembly language; y'know, hexadecimal and stuff, with a machine-language monitor). Needless to say, upgrading and maintaining the program was a real problem, even though it was only 17K in size. The program also had a couple of limitations, the most serious of which being that all lines were limited to a maximum of 80 characters (plus a carriage return), or they would be split into two physical lines internally. It would also work only on the 80-column C128.

Still, the standalone version had a number of outstanding capabilities, including the ability to edit EXTREMELY large files with an REU and dynamic data structures, the ability to use "burst mode" on devices that supported it, TAB and character-set translation on loading and saving, global search and replace, range delete and recall, and a paragraph "juggling" feature. It is truly an outstanding program (if I do say so myself), and it is my pleasure to use it every day. (I also use Unix's "vi" every day, and I am getting tired of its clumsy user interface... I may just have to port ZED to the Unix environment one of these days).

The ACE version has/will have all of these features and then some. The ACE version supports even larger files by using the ACE dynamic memory management system (see C= Hacking #7 or a newer ACE Programmer's Reference Guide) in addition to its own byte-oriented memory management (see C= Hacking #2) with internal memory (up to 512K on a C128), REUs up to 16 Megs, and RAMLink DACC memory up to 16 Megs. Burst-mode support isn't currently available in ACE (see C= Hacking #3), nor does the ACE version of ZED currently implement the other outstanding editing features of the original ZED mentioned above. (For another C= Hacking reference, ACE does support a three-key rollover for typing convenience (see C= Hacking #6)).

However, the ACE version supports extremely long physical lines (paragraphs) by providing automatic word wrapping and "soft returns" with automatic "text sloshing" (a dynamic form of "juggling"), and it therefore has/will have the functionality of a word processor. The new version also works in all video modes that ACE supports on both the C128 and C64.

On to Chapter 2.


Last Updated: 1995-12-06 Rev A