LED, Line Editor vers. 1.0 -- Paul Pomerleau -- August 6, 1987 LED is a subset of the EASE editor. It can be included in any non comercial program. On entry: BC = length of buffer DE = buffer location A = command bits 0 (low bit) -- Zero = ignore BC and HL, use previous values 1 -- One = Set the insert Zero = Leave it as user set it last edit 2 -- One = Insert On Zero = Insert Off 3 -- One = Initailize position (start at first char) Zero = Same position as last edit (Values for BC and DE must be the same as last edit) 4 -- One = Output the line Zero = Use output of last edit (Bit 3 should be One) On exit: BC = length of input A = return code 0 = Normal "Done" 1 = Extension command #1 2 = Extension command #2 etc. Data needed: A buffer pointed to by DE which is two bytes longer than length required. The first location must be contain a zero. Any string terminated by a zero may follow. Example: BUFFER: db 0,'Hello, World!',0 A kill buffer of the name KILL (made PUBLIC) and KILSIZ, a PUBLIC equate, which specifies how long KILL is. KILL must be one byte longer than KILSIZ claims it to be and must contain a string ending with a zero. Example: kilsize equ 1000 KILL: db 'Blech.',0 ds kilsiz + 1 - 7 ; (Length) + (1) - (Length of 'Blech.') public kilsiz, KILL A list of command keys and an equate stating how long the list is. Both made public. Uppercase characters representing control chars and the high bit set representing a preceeding Meta key. After all standard LED functions are acounted for, the program may include other keys which will return control to the program with a Extension Command Number in A. Example: CMDLST: db 'QDSEXAF','S'+80h,'D'+80h,'G','H',127,'T', db 127+80h,'R','Y'+80h,'YUVIPWMC' db 'N'+80h ; Extension Command #1 cmdlen equ $ - CMDLST public CMDLST, cmdlen Example usage: public CMDLST, cmdlen, KILL, kilsiz ext LED org 100h RE_EDIT: xor a ld (KILL),a ; Make sure there's nothing to UNDO ld bc,size ld de,BUFFER+1 ld (de),a dec de ld (de),a ; Clear the buffer -- No initial text ld a,00011111b ; Do output, ; Start at first char, ; Insert On, ; Set insert, ; Use BC, HL. call LED or a ; Was <^Q><^N> hit? jr nz,RE_EDIT ; nz = Yes ld a,c ; Get the length in A ret BUFFER: db 0,'Xyz inc.',0 ds 50 size equ $ - BUFFER - 2 CMDLST: db 'QDSEXAF','S'+80h,'D'+80h,'G','H',127,'T', db 127+80h,'R','Y'+80h,'YUVIPWMC' cmdlen equ $ - CMDLST kilsize equ 1000 KILL: db 'Blech.',0 ds KILSIZ + 1 - 7 ; (Length) + (1) - (Length of 'Blech.') If you make any changes to LED (other than keystroke definitions), please tell me about the change. I'm on Lillipute Z-NODE -- (312) 664-1730 Paul Pomerleau