ABh LG$EDIT in-memory editor
Input B register - Function number.
The individual functions have parameters specified below.
Output X register - current line
A register - flags:
    bit7 - true if numbered
    bit2 - true if prompt to be capitalized
    bit1 - true if no title required
    bit0 - true if changed
B register - position in current line X
Description

General entry point for language editor. Does not handle data files.

Provides the following in-memory editor functions:

  • Function 0 - Initialise params
    Input Parameters:
    • A register - Block file type
    • UTW_S0 - low byte of the tag of allocator cell to use (= cell_tag - 2000)
  • Function 1 - New
    Input Parameters:
    • X register - New name
  • Function 2 - Edit existing cell
    Input Parameters:
    • X register - Current line (0 for 1st line)
    • A register - Offset in current line
    • UTW_S0 (msb) - flags:
      • bit7 - true if numbered
      • bit2 - true if prompt to be capitalized
      • bit1 - true if no title required
      • bit0 - true if changed
  • Function 3 - Find
  • Function 4 - Zap
  • Function 5 - Top
  • Function 6 - Bottom
  • Function 7 - Print
  • Function 8 - Restore editor status for PROG etc.

Note the following:

  • Restore (lg$edit (8)) must be called when finished with editor.
  • UDG 0 must always be defined as the icon for the title line before calling EDIT (lg$edit (2)).
  • The flags returned by LG$EDIT and passed to EDIT (lg$edit (2)) may be ignored by passing 0 in the MSB of UTW_S0 before EDIT in which case normal editing as with CM/XP will occur.
  • The cell must exist before calling LG$EDIT but may be zeroed.
  • The NEW function inserts a name at the start of an existing cell.

To edit an existing cell, the cell MUST have a name terminated by a colon at the start. The lines are all terminated by a 0.

This call is not available on CM/XP machines.

Example To create a cell for editing and edit it:
        CLRA                    ; 0 initial size of the cell
        CLRB
        OS      AL$GRAB
        BCS     ERROR           ; Report error
        STX     CELL            ; Save the tag
        XGDX
        SUBD    #ALT_BASE
        STAB    UTW_S0:         ;cell*2
        CLRA                    ;don't care about lang type of cell
        CLRB                    ;initialise cell
        OS      LG$EDIT
        LDX     #NAME
        LDAB    #1              ;insert name into zeroed cell
        OS      LG$EDIT
        BCS     ERROR           ;out of memory
        CLRA                    ;initialise editor positions
        CLRB            STAB    CURRENT_POS
        STD     CURRENT_LINE
LOOP:
        LDX     #ICON_PATTERN   ;point to 8 byte icon pattern
        CLRA                    ;8 byte pattern
        CLRB                    ;udg 0
        OS      DP$UDG          ;define udg 0 as the icon for lg$edit (2)
        CLR     UTW_S0          ;not numberd,and dont care if changed
        LDX     CURRENT_LINE    ;X:=0 for line 0
        LDAA    CURRENT_POS
        LDAB    #2              ;edit existing cell
        OS      LG$EDIT         ;exit on MODE key,display left intact
        STAB    CURRENT_POS
        STX     CURRENT_LINE
        BSR     MYMENU          ;C set b=0 means exit, else c set means error
        BCC     LOOP            ;edit again
        TSTB
        BEQ     OUT
        OS      ER$MESS         ;display error and edit again
        BRA     LOOP 
OUT:    LDAB    #8
        OS      LG$EDIT         ;MUST RESTORE editor
        RTS

NAME:   ASCIC   "CAPTURE"
Errors - none -