65h TL$ADDI add top menu item
Input B register - position in menu-list
RT_BBL - item and addresse
Output - none -
Description Inserts a given menu item into the top-level menu at position B. B = 0 means insert at the start, B = 1 means after the first item, B = $FF means insert before the "OFF".

The menu item to be inserted is placed at address RT_BBL. It must consist of :

  • length of item name (byte)
  • item name
  • execution address, or zero (on LZ 0 - 2)

The length of the item name may not be zero. The first character of the item name must be a letter, the following characters may be alphanumeric, or "$" or "%", otherwise error BAD PROCEDURE NAME is returned. Note that the item is not necessarily a legal OPL procedure name. No error will be returned for items names such as "A$$$" or names longer than eight characters.

The item name is followed by an execution address. When the menu item is selected by the user, the operating system will treat the menu item name as an OPL procedure if the execution address is zero. On the LZ a value of 1 means a notepad file and 2 a data file. The operating system will otherwise call a machine code routine at the execution address.

TL$ADDI is called after the "INSERT ITEM" prompt when the MODE key is pressed at the top level. In this case the execution address is zero.

Note that TL$ADDI does not recognise the standard menu items FIND, SAVE etc. as special. This allows the user to replace the standard system menu items with different routines.

Example This is the code used in the CommsLink to insert "COMMS" into top level menu before "OFF":
	      LDX     #COMMS_STRING   ; COPY MENU ITEM FROM COMMS_STRING
        LDD     #END_COMMS-COMMS_STRING
        STD     UTW_S0:         ; NUMBER OF BYTES TO COPY
        LDD     #RTB_BL         ; INTO WORKSPACE FOR TL$ADDI
        OS      UT$CPYB

        LDAB    #FFh            ; B = WHERE TO INSERT THE ITEM
        OS      TL$ADDI         ; INSERT IT
        RTS

COMMS_STRING:
        DB      COMMS1-COMMS_STRING
                                ; LENGTH OF "COMMS"
        DB      "COMMS"         ; NAME OF MENU ITEM TO BE INSERTED
COMMS1: DB      COMMS_START     : START ADDRESS OF COMMS CODE
END_COMMS:
Errors 197 - bad proc name
202 - menu too big
254 - out of memory