\t Thing Vectors

\j To enable the thing system to be used from user code, versions 2.03
onwards of the HOTKEY System II add a strange Thing to the end of the Thing
list. This Thing has the name THING and is not accessible using the Thing
system and so may not be removed.
The THING Thing is $18 bytes long.

\f   THH_FLAG   $00  long   'THG%'
     THH_TYPE   $04  long   -1
     TH_ENTRY   $08  long   absolute address of TH_ENTRY routine
     TH_EXEC    $0C  long   absolute address of TH_EXEC routine

\j To find the THING Thing, pick up the pointer SYS_LTHG ($B8 on from the
base of the system variables), and follow the linked list to the end.
The last item in the list should be the THING Thing.


\t Hotkey Vectors

\j The Hotkey vectors are in the Hotkey Thing. These are available in all
HOTKEY System II versions.


\t Thing Entry Points

\f TH_ENTRY 

 This entry point is for calling from user mode: in SMS2 it would be
 replaced by a TRAP #1, and the entry vectors added in with the rest.
 The parameters are exactly the same as for the SMS2 version, though.
 Under QDOS, all calls to SMS.ZTHG must be made in user mode, as
 must calls to FTHG on behalf of another Job.
 
       Registers:
               Entry                           Exit
       D0      key                             error code
       D1      Job ID or -1 (UTHG, FTHG)       preserved
       D2      additional parameter            additional return (U/FTHG)
                                               job ID            (NTHU)
       D3      additional parameter            preserved         (FTHG)
               timeout                         version ID        (UTHG)
       A0      name of thing (all but LTHG)    preserved
       A1      pointer to thing linkage (LTHG) 
                                               pointer to thing  (UTHG)
               pointer to usage block          next usage block  (NTHU)
       A2      additional parameter            additional return (U/FTHG)
 
       D0 call and return values may be:
       SMS.LTHG        link in thing   FEX  thing already exists
       SMS.RTHG        remove thing    FDIU thing in use 
                                       ITNF thing not found
       SMS.UTHG        use thing       IMEM insufficient memory
                                       ITNF thing not found
                                       any other returns from Thing itself
       SMS.FTHG        free thing      ITNF thing not found
                                       any other returns from Thing itself
       SMS.ZTHG        zap thing       ITNF thing not found
       SMS.NTHG        next thing      ITNF thing not found
       SMS.NTHU        next user       ITNF thing not found
                                       IJOB user not found

\f TH_EXEC
 
 This executes the code of an executable thing, setting the standard parameter
 string and opening a file for the job if required
 
       Registers:
               Entry                           Exit
       D0                                      error code
       D1      owner, or 0, or -1              job ID
       D2      priority | timeout              preserved
       A0      file name                       preserved
       A1      parameter string                preserved
