How to program the HP38G

in

SystemRPL or Assembly Language

last change 05/12/98


This page are maintened by J.Y Avenard and G. Squelart

Warning: these informations have been provided with the authorisation from the Hewlett-Packard Company.
Most of these informations can be used as well on the HP48S/SX/G/GX.

To any people who wants to include this document into his own web-page, please, make a link, but DO NOT COPY, since I will update this page quite often.

Important:

Limitation of Liability

This software is provided "as is" to HP 38G software developers and is
subject to change without notice. Hewlett-Packard Company makes no
warranty of any kind with regard to this software, including, but not
limited to the implied warranties of merchantability and fitness for a
particular purpose. Hewlett-Packard Co. shall not be liable for any
errors or for incidental or consequential damages in connection with the
furnishing, performance, or use of this software. The limit of
Hewlett-Packard Companies liability is not to exceed $50.00 per
incidence.

Copyright

This software is "Copyright (C) Hewlett-Packard Co. 1998. All rights
reserved." Redistribution without charge or for a media fee is permitted
provided this file is retained with the programs.

Export Clause:

Developer agrees not to export or re-export the software or any copy or
adaptation in violation of the U.S. Export Administration regulations or
other applicable regulations.

------------

If you need some explanations on how to use these informations, you can always email me.
But please, try to find as most as possible by yourself, I'm very busy and I hope you will understand that it's difficult for me to answer to each email. You can always ask in the HP48 newsgroup comp.sys.hp48, since programming on the HP38 doesn't differ much with the HP48 (especially the tools to compile are the same)

First, you will need (select your development platform):

Then download the Skeleton Aplet for a SystemRpl (or ML) Aplet. This zip file include all the files you need to compile your own aplet. But be aware, that programming an aplet on an HP38G, is far more complicated than programming an HP48G/GX.

You will also need the official entry point list or this BEAUTIFUUUUL one (comparison between the HP48G and HP38G: PDF document)

Using the GNU Tools, under an Unix machine, simply type make to launch the compilation.
Under a PC, you may need to compile the file manually with:
-RPLCOMP empty.s
-SASM empty.m

To test it, simply download the aplet into your HP38G using the connectivity kit.

Programming the HP38G is very similar to the HP48G, for basics information on how to program in SystemRPL, please refer to the Hewlett-Packard RPL Manual. We are actually working on a HP38G version of this manual, but it's a huge work and it may take while before I will put this document here (more than 6000 entry points to comment).

Well, let's go, and enjoy the knowledge !!


HP38G Memory Map

 

=HARDROMEND EQU #F0000        uncovered IROM ends at #EFFFF
=RAMSTART   EQU #F0000        IRAM Home Pos'n (overlays ROM)
=IRAMHOMEmsn EQU #F
=HARDRAMEND EQU #FFFFB        IRAM Home ends at #FFFFB


*****************************************************************
*      B A S I C       M E M O R Y (RAM)       L A Y O U T      *
*                                                               *
*                                  LOW MEMORY                   *
*            RAMSTART -->   +-----------------------+           *
*                           |(Dedicated System RAM) |           *
*                           | ====================  |           *
*                           |  CMOS Test Word       |           *
*                           |  IRAM Size Mask(ghost)|           *
*			    |  IRAM Home Size Mask  |		*
*                           |  HRAMEND (m.s.n.)     |           *
*			    |  WS Fail Stack	    |		*
*                           |  NEXTIRQ (TimeBase)   |           *
*                           |  TIMEOUT (DeepSleep)  |           *
*                           |  TESTMSG Buffer       |           *
*                           |  IRAM Buffer          |           *
*                           |  Uart Buffer          |           *
*                           |  Config Table         |           *
*                           |  Interrupt RAM        |           *
*                           |  Display Ghosts       |           *
*                           |  PrintLCD Buffer      |           *
*                           |  SWAPDISP Saves       |           *
*                           |  VDISP2   (grob ptr)  |           *
*                           |  ADISP    (grob ptr)  |           *
*                           +--                   --+           *
*                           | Updatable Loc'n Ptrs  |           *
*                           |        (17)           |           *
*                           +--                   --+           *
*                           |  Updatable Obj Ptrs   |           *
*                           |  ==================   |           *
*                           |        (37)           |           *
*                           +--                   --+           *
*                           |  Other System Vars    |           *
*                           |  =================    |           *
*                           |  RAMEND (-->EndRam)   |           *
*                           |  AVMEM                |           *
*                           |  ERROR                |           *
*                           |  ATTNFLG              |           *
*                           |  SAVELCDFLG           |           *
*                           +--                   --+           *
*                           | Internal System Flags |           *
*                           | ===================== |           *
*                           |    (4 Flags/Nib)      |           *
*                           +--                   --+           *
*                           | Misc. Other Sys. Vars |           *
*                           | ===================== |           *
*                           |  AppCount             |           *
*                           |    . . .              |           *
*                           |  ANNUNCIATORS         |           *
*                           |  SystemFlags (64)     |           *
*                           |  UserFlags   (64)     |           *
*                           |    . . .              |           *
*                           |   ET. AL.             |           *
*                           |    . . .              |           *
*                           | LastMenuRow           |           *
*                           +--                   --+           *
*                           |    ROM Part Table     |           *
*                           +--                   --+           *
*                           |     DISPLAY GROBS     |           *
*                           |     =============     |           *
*               VDISP2 -->  |   SoftKey Grob        |           *
*               ADISP  -->  |   Stack Grob          |           *
*               GDISP  -->  |   BlackBoard Grob     |           *
*                           +-----------------------+           *
*               TEMPOB -->  |                       |           *
*                           |     TEMPOB Area       |           *
*                           |                       |           *
*              TEMPTOP -->  +-----------------------+           *
*                           |    (Return Stack)     |           *
*                           |          |            |           *
*                           |          |            |           *
*               RSKTOP -->  |         \|/           |           *
*                           |                       |           *
*                           |    Raw Temp Memory    |           *
*                           |                       |           *
*               DSKTOP -->  |         /|\           |           *
*                           |          |            |           *
*                           |          |            |           *
*                           |     (Data Stack)      |           *
*             EDITLINE -->  +-----------------------+           *
*                           |    Edit Line          |           *
*              TEMPENV -->  +-----------------------+           *
*                           |   Temp. Environments  |           *
*              DOLPENV -->  +-----------------------+           *
*                           |  DoLoop Environments  |           *
*             TOUCHTAB -->  +-----------------------+           *
*                           |     Touch Table       |           *
*               USEROB -->  +-----------------------+           *
*                           |   User Object Area    |           *
*             ROMPARTS -->  +-----------------------+           *
*                           |       ROMPARTS        |           *
*               RAMEND -->  +-----------------------+           *
*                                                               *
*****************************************************************

*****************************************************************
=CMOS     EQU RAMSTART          quick RAM corrupt chk.        (5)
=IRAMMASK EQU (CMOS)+5          IRAM Size Config Mask.        (5)
=HOMEMASK EQU (IRAMMASK)+5	Home Size of RAM (mask)       (5)
=HRAMEND  EQU (HOMEMASK)+5	M.S.N. of size of RAM chip    (1)


*****************************************************************
*      RAM Dedicated to Maintaining a Machine Reset History     *
*              4-deep, 18-nib wide stack                        *
*                                                               *
*  The time stamp is the time at which the event occured in     *
*  units of timer 2 ticks if the event permits a valid time     *
*  computation.  Otherwise, the time stamp is zero.  The        *
*  CheckSum is the CRC of the 1st 14 nibs.                      *
*                                                               *
*                (1)       (13)       (4)                       *
*             | Cause | Time Stamp |  CRC  |                    *
*       (Top) |-------+------------+-------|                    *
*      -----> |       |            |       |                    *
*             +-------+------------+-------|                    *
*                                                               *
* The FAILSTK entries must remain contiguous in this order !!   *
*****************************************************************
=FAILSTK1 EQU (HRAMEND)+1         1st level  (Latest Event) (18)
=FAILSTK2 EQU (FAILSTK1)+18        2nd level                 (18)
=FAILSTK3 EQU (FAILSTK2)+18        3rd level                 (18)
=FAILSTK4 EQU (FAILSTK3)+18        Bottom     (Oldest Event) (18)


*****************************************************************
*    The next 2 pairs of entries must remain contiguous.        *
*****************************************************************
=NEXTIRQ    EQU (FAILSTK4)+18   Time at next Timer2 int.     (13)
=TIMECRC    EQU (NEXTIRQ)+13    CRC CheckSum for NEXTIRQ      (4)
*
=TIMExmit   EQU (TIMECRC)+4     ScratchPad (See-SENDTIME)    (13)
=CRCxmit    EQU (TIMExmit)+13   ScratchPad (See-SENDTIME)     (4)



=TIMEOUT    EQU (TIMECRC)+4     Time at scheduled timeout.   (13)
=TIMEOUTCLK EQU (TIMEOUT)+13    System Timeout if Clear       (1)
=LoBatTime  EQU (TIMEOUTCLK)+1  Flag periodic ((*)) updates   (1)
*
=StartTime EQU (LoBatTime)+1    SelfTest Start Time (Ticks)  (13)
=FailTime  EQU (StartTime)+13   SelfTest Fail Time (Ticks)   (13)
=TESTMSG   EQU (FailTime)+13    SelfTest Msg Buffer          (44)

=SW_Image  EQU (TESTMSG)+44     "HH:MM:SS:ss" Stopwatch      (22)
=SW_ETime  EQU (SW_Image)+22    Stopwatch Elapsed Time Ticks (13)

=PortStat  EQU (SW_ETime)+13    Copy of CARDSTAT Nib          (1)
=Port1CRC  EQU (PortStat)+1     CRC for Device in Port1       (4)
** =Port2CRC  EQU (Port1CRC)+4     CRC for Device in Port2       (4)
** Above no longer needed
*****************************************************************
*              Variables used in covered ROM Access             *
*****************************************************************
=AccessInit  EQU (Port1CRC)+4	Saved value of INITEN & sALLOWINTR (2)
=COVERstate  EQU (AccessInit)+2 Iram state before uncovering  (3)
=COVERsave   EQU (COVERstate)+3 Save area for G/DoCovered    (10)
=IRAMBUFF    EQU (COVERsave)+10 Exec Buff (code under IRAM) (256)
=IRAMBSIZE   EQU 537-41-#38
=IRAMBEND    EQU (IRAMBUFF)+(IRAMBSIZE)
* Rom Pointer Object to be used by alternate Graphics Driver
* Words affected: PrintGrob, PrintLCDU
=GraphPrtHook  EQU (IRAMBEND)                                (11)

*****************************************************************
**   Equates below delimit internals of the UART buffer area   **
**      (256 bytes) reserved for the UART buffer area          **
*****************************************************************
=uart_buffer   EQU (GraphPrtHook)+11                        (512)
=uart_buf_end  EQU (uart_buffer)+512		              (2)
=uart_error    EQU (uart_buf_end)+2                           (1)
=uart_buf_st   EQU (uart_error)+1                             (2)
=uart_handshk  EQU (uart_buf_st)+2	                      (1)
=uart_modes    EQU (uart_handshk)+1                           (1)
=uart_parity   EQU (uart_modes)+1                             (1)
=uart_timeout  EQU (uart_parity)+1                            (2)

* IOCNIB saves (IOC) while temporarily changed in OUTUART
=IOCNIB        EQU (uart_timeout)+2                           (1)


*****************************************************************
*   2 sets of configuration entries (2  nibs each) with         *
*   # banks available, and overall config identifier.           *
*                                                               *
*  Format:       (1)       (1)                                  *
*               Status   Size/Address Code                      *
*  CONFRAM:->   +-----------------+                             *
*               |      |          |             Port1           *
*               +-----------------+                             *
*               |      |          |             Port2           *
*               +-----------------+                             *
*               |      |          |             #banks          *
*               +------+----------+                             *
*		|      |			I.D.		*
*               +------+                                        *
*       							*
*       							*
*  The status nib is [r w s 0]; where r="readable",             *
*                                     w="writable",             *
*                                     s="SystemRam"             *
*****************************************************************
=CONFRAM  EQU (IOCNIB)+1                                (3*2 + 1)



*****************************************************************
*   2 sets of configuration entries (2  nibs each) with         *
*   # banks available, overall config identifier, and CRC       *
*   checksum to ensure integrity record current configuration   *
*   status of Port1 and Port2.                                  *
*                                                               *
*  Format:       (1)       (1)                                  *
*               Status   Size/Address Code                      *
*  CONFTAB:->   +----------------------------+                  *
*               |   CRC   (4)                |                  *
*               +----------------------------+                  *
*               |      |          |             Port1           *
*               +-----------------+                             *
*               |      |          |             Port2           *
*               +-----------------+                             *
*               |      |          |             #banks          *
*               +------+----------+                             *
*		|      |			I.D.		*
*               +------+                                        *
*       							*
*       							*
*  The status nib is [r w s 0]; where r="readable",             *
*                                     w="writable",             *
*                                     s="SystemRam"             *
*****************************************************************
=CONFTAB  EQU (CONFRAM)+7 		               (4 + 3*2+1)



* 34 end-of-seq addresses go here (that's right, 34)
=PORT0EOS EQU (CONFTAB)+11                                    (5)
=PORT1EOS EQU (PORT0EOS)+5                                    (5)
=PORT2EOS EQU (PORT1EOS)+5                                    (5)
************ .
************ .						   (31*5)
************ .
******************** END OF CONFRAM EQUATES *********************



*        RAM Dedicated for CPU Save by Interrupt System         *
*===============================================================*
=INTRAM     EQU  (PORT2EOS)+155     a,D1[4321]*,C[15,..,5]*  (16)
=SAVE_MODES EQU  (INTRAM)+16     saves P*,~CY*,mode*,SB*      (5)
=SAVE_C[A]  EQU  (SAVE_MODES)+5  saves C[A]*                  (5)
=SAVE_A     EQU  (SAVE_C[A])+5   saves A[W]*                 (16)
=SAVE_ST    EQU  (SAVE_A)+16     saves S0-S11*                (3)
=SAVE_B     EQU  (SAVE_ST)+3     saves B*                    (16)
=SAVE_D     EQU  (SAVE_B)+16     saves D*                    (16)
=SAVE_R0    EQU  (SAVE_D)+16     saves R0*                   (16)
=SAVE_PC    EQU  (SAVE_R0)+16    saves PC*                    (5)
=SAVE_D0    EQU  (SAVE_PC)+5     saves D0*                    (5)
=SAVE_OR    EQU  (SAVE_D0)+5     saves OR Register (ghost)    (3)


*===============================================================*
* The next 2 vars are used by ATS in order to determine how     *
* much RAM is necessary to be uploaded for Display Capture.     *
* The Operating System uses these vars for purpose of ROM       *
* access underneath IRAM.                                       *
*===============================================================*
=DRSTART     EQU  (SAVE_OR)+3    Display Refresh Lo Bound     (5)
=DREND       EQU  (DRSTART)+5    Display Refresh Hi Bound     (5)


*===============================================================*
*                         CAVEAT                                *
* Code assumes the next two vars contiguous in this order       *
*===============================================================*
=IREG        EQU  (DREND)+5      Saves Interrupt History      (3)
=SEMAPH      EQU  (IREG)+3       Saves control byte for IREG  (2)


=IOSAVE      EQU  (SEMAPH)+2     Saves HiNib of ANNCTRL       (1)
=CSPEED      EQU  (IOSAVE)+1     CPU speed (16hz units)       (5)
=INITEN      EQU  (CSPEED)+5     Warmstart Enable flag        (1)
=HANDSHK     EQU  (INITEN)+1     location of kbd handshake    (1)
=KEYSTATE    EQU  (HANDSHK)+1    location of kbd state       (13)
=INPUTSTREAM EQU  (KEYSTATE)+13  Key Buffer (max 15 keys).   (34)
=POPPEDKEY   EQU  (INPUTSTREAM)+34     Last Key from POPKEY   (2)
********************* END of INTERRUPT EQUATES ******************
 
*****************************************************************
* Ghost copies of Clarke Write Only Control Reg's.              *
*        Description                                        #nibs
* --------------------------------------------------------- -----
=DISP1CTLg  EQU (POPPEDKEY)+2     Ghost for DISP1CTL          (5)
=LINENIBSg  EQU (DISP1CTLg)+5     Ghost for LINENIBS          (3)
=DISP2CTLg  EQU (LINENIBSg)+3     Ghost for DISP2CTL          (5)
=LINECOUNTg EQU (DISP2CTLg)+5     Ghost for LINECOUNT         (2)
*                           CAVEAT                              *
* LINECOUNTg is a copy of what we write into the LINECOUNT Reg. *
* But - It is a bit different than the others.  Writing into    *
* LINECOUNT loads an internal Hdwr holding register.  This      *
* holding register is used every 15 msec to initialize a count  *
* down counter that is decremented with every pxl row refresh.  *
* A read from LINECOUNT does not return the value in the        *
* holding register (ie; what was written to LINECOUNT), but     *
* rather the current value in the count-down counter.  This     *
* allows software to "track" the hardware display refresh.      *
*****************************************************************




*****************************************************************
* 36-nib Save area for CPU registers altered by invocation of   *
* PrintLCD from within the interrupt system via the [ON]-Key    *
* Sequence:                 [ON] [MTH]                          *
*                                                               *
*             CAVEAT: Code assumes next 9 items in order        *
*             ------------------------------------------        *
*                                                               *
=Stk0save  EQU  (LINECOUNTg)+2     Hdwr Stack Level 0         (5)
=Stk1save  EQU  (Stk0save)+5       Hdwr Stack Level 1         (5)
=Stk2save  EQU  (Stk1save)+5       Hdwr Stack Level 2         (5)
=Stk3save  EQU  (Stk2save)+5       Hdwr Stack Level 3         (5)
=Stk4save  EQU  (Stk3save)+5       Hdwr Stack Level 4         (5)
=Stk5save  EQU  (Stk4save)+5       Hdwr Stack Level 5         (5)
=R2[A]save EQU  (Stk5save)+5       R2[A]                      (5)
=R2[S]save EQU  (R2[A]save)+5      R2[S]                      (1)
=R1[A]save EQU  (R2[S]save)+1      R1[A]                      (5)
*****************************************************************




*****************************************************************
* The next 4 locations are used by the SWAPDISP Routine.  This  *
* routine swaps the values of VDISP1 and VDISP3 to implement    *
* fast display switch between the standard stack display and    *
* blackboard.  The previously saved Bit, and Window Offsets     *
* are used to restore DISP1CTL and BITOFFSET for preservation   *
* of left-right and vertical scroll position.                   *
*****************************************************************
=SAVE_BO     EQU (R1[A]save)+5   Save BitOffset               (1)
=SAVE_LC     EQU (SAVE_BO)+1     Save LineCount               (2)
=SAVE_LN     EQU (SAVE_LC)+2     Save LineNibs                (3)
=SAVE_OFFSET EQU (SAVE_LN)+3     Save Window Offset           (5)

*****************************************************************
* The next 5 locations are pointers to the 3 dedicated areas of *
* RAM that are used by the display.  The 3 areas are a Softkey  *
* block, a Stack block, and a Blackboard block.                 *
*                                                               *
*                   -------------------                         *
*         VDISP2 -> | Softkey grob    |      (Low Mem)          *
*                   -------------------                         *
*         ADISP  -> | Stack grob      |                         *
*                   -------------------                         *
*         GDISP  -> | Blackboard grob |      (Hi  Mem)          *
*                   -------------------                         *
*                                                               *
* VDISP2 and ADISP never change (between warmstarts)  and point *
* to the Softkey grob and Stack grob respectively (irregardless *
* of what is currently in the display). GDISP always points to  *
* the Blackboard grob.  VDISP1 & VDISP3 always point to one of  *
* the Stack or Blackboard grobs (with VDISP1 pointing to the    *
* one currently in the display and VDISP3 the other).  VDISP1,  *
*VDISP3, and  GDISP  are updatable pointers to permit expansion *
* of either the Stack or Blackboard grobs.                      *
*****************************************************************
=VDISP2 EQU (SAVE_OFFSET)+5       -->SoftKey grob             (5)
=ADISP  EQU (VDISP2)+5            -->Stack grob               (5)
*


=SYSUPSTART EQU (ADISP)+5
*****************************************************************
** The equates below delimit the internals of updateable
** system variables
*****************************************************************
**** START OF UPDATEABLE LOCATION POINTERS ********
=VDISP1   EQU (SYSUPSTART)  -->Display grob (Stk/Blkbd)       (5)
=VDISP3   EQU (VDISP1)+5    -->Stk/Blkbd (one not in Display) (5)
=GDISP    EQU (VDISP3)+5    -->Blackboard grob                (5)
=TEMPOB   EQU (GDISP)+5     --> TempOb Area                   (5)
=TEMPTOP  EQU (TEMPOB)+5                                      (5)
=RSKTOP   EQU (TEMPTOP)+5                                     (5)
=DSKTOP   EQU (RSKTOP)+5                                      (5)
=EDITLINE EQU (DSKTOP)+5                                      (5)
=TEMPENV  EQU (EDITLINE)+5                                    (5)
=DOLPENV  EQU (TEMPENV)+5                                     (5)
=TOUCHTAB EQU (DOLPENV)+5                                     (5)
=USEROB   EQU (TOUCHTAB)+5  --> UserOb Area                   (5)
=ROMPARTS  EQU (USEROB)+5   --> RomParts Area                 (5)
=CONTEXT  EQU (ROMPARTS)+5                                    (5)
=STOPSIGN EQU (CONTEXT)+5                                     (5)
=UserKeys EQU (STOPSIGN)+5  --> User key assignments          (5)
=ALARMS   EQU (UserKeys)+5  --> System Alarm List             (5)

*****************************************************************
** Non-kernel Updateable Location Pointers File
**
** This file is the central clearing house for
** all updateable location pointers which are in
** the RPL system but not explicity described in
** the ERS, i.e. those beyond STOPSIGN but before
** OBUPSTART. Included in this file are:
**    (1) the equates for these
**        location pointer locations
**    (2) a brief description of their meaning
**    (3) which ROMPART(s) initialize, maintain,
**        and use them
**    (3) the value they assume after RPL is
**        invoked following a Coldstart.
** In addition the number of these additional
** location pointer locations will be reflected in the equate
** value for LOCUPSIZE,
** also defined here. When there are no additional
** locations allocated the value of LOCUPSIZE will be
** equal to the number of location pointers in the
** kernel, that is ??.
*****************************************************************
** The Elsie pointers between
** FSTELSIEPTR and (FSTELSIEPTR)+5*(ELSIEPTRCT)
** will be cleared by CLRPTRS
*****************************************************************
=FSTELSIEPTR EQU (ALARMS)+5
=CALCCXT EQU (ALARMS)+5		--> calculator variables dir	(5)
=PGMCXT  EQU (CALCCXT)+5	--> programming dir		(5)
=NOTESCXT EQU (PGMCXT)+5	--> "notes" directory		(5)
=apletPTR EQU (NOTESCXT)+5	--> current aplet		(5)
=funcPTR EQU (apletPTR)+5	--> current func instance	(5)
=polarPTR EQU (funcPTR)+5	--> current polar instance	(5)
=paramPTR EQU (polarPTR)+5	--> current param instance	(5)
=seqPTR  EQU (paramPTR)+5	--> current sequence instance	(5)
=statPTR EQU (seqPTR)+5		--> current stat instance	(5)
=solvePTR EQU (statPTR)+5	--> current solve instance	(5)
=otherPTR EQU (solvePTR)+5	--> current "other" instance	(5)
=ELSIEPTRCT EQU 11
=LOCUPSIZE  EQU (28)

**** END OF UPDATEABLE SYSTEM LOCATION POINTERS ****

=OBUPSTART EQU ((SYSUPSTART)+5*(LOCUPSIZE))

*###############################################################*
*         All RAM from INTRPPTR to RESRAMEND is cleared         *
*         at ColdStart by the routine initmem.                  *
*                                                               *
*          START OF UPDATEABLE SYSTEM OBJECT POINTERS           *
*###############################################################*
*************************************************************************
*	
*   NOTE: The first updateable system pointer must equate to the symbol 
*   `OBUPSTART' for correct computation of the count `OBUPSIZE'.
*	
*************************************************************************
=INTRPPTR  EQU (OBUPSTART)
=OSAVE     EQU (INTRPPTR)+5

*****************************************************************
**          Non-kernel Updateable Object Pointers
**
**   This section has all updateable object pointers which are in
**   the RPL system but not explicity described in the ERS, i.e.
**   those beyond ERRNAME but before SYSNOUPSTART.
**   Included are:
**
**     (1) the equates for these object pointer locations
**     (2) a brief description of their meaning
**     (3) which ROMPART(s) initialize, maintain, and use them
**     (4) the value they assume after RPL is
**         invoked following a Coldstart.
**
**   In addition the number of these additional object pointer
**   locations is reflected in the equate value for OBUPSIZE,
**   also defined here.  When there are no additional locations
**   allocated the value of OBUPSIZE equals the number of object
**   pointers in the kernel, that is 2.
*****************************************************************


*----------------------------------------------------------------
* The next 5 object pointers form a 5 level stack holding the
* arguments passed to keyword functions. The arguments (ie the
* the pointee's) are saved by the CK<arg> routines. LASTARG1
* points to the arg on the top of the stack saved by CK<arg>,
* LASTARG2 points to the arg 2nd on the stack saved by CK<arg>,
* ... LASTARG5 points to the arg deepest on the stack saved by
* CK<arg>.
*----------------------------------------------------------------
=LASTARG1 EQU (OSAVE)+5              --> Top of Stack
=LASTARG2 EQU (LASTARG1)+5           --> 2nd on Stack
=LASTARG3 EQU (LASTARG2)+5           --> 3rd on Stack
=LASTARG4 EQU (LASTARG3)+5           --> 4th on Stack
=LASTARG5 EQU (LASTARG4)+5           --> Last on Stack


=leeway  EQU (LASTARG5)+5   -->hxs which will be garbage
*                           collected if very-low-memory.

=ITEM1STATE    EQU (leeway)+5  -->list of lists representing the
*                              location of 1st object displayed
*     in the top item on the stack, and the object beyond the
*     last item displayed in the top item on the stack.
*     Initial value : null list

*****************************************************************
***** PGMOFFSET - if non-zero, points to an embedded BINT   *****
***** in the currently running program or command line.     *****
***** This pointer gives both the currently running pgm and *****
***** the string beyond the last completed command.         *****
*****************************************************************
=PGMOFFSET EQU (ITEM1STATE)+5

*****************************************************************
***** NOTE: the variables PDCHXS and PDCSYMB are assumed    *****
***** to be adjacent in this order.                         *****
*****************************************************************
=PDCHXS EQU (PGMOFFSET)+5       --> hxs map of outermost symbolic
*                               object at the top of the stack in
*                               multi-line mode.  initialized to
*                                undefined.
=PDCSYMB EQU (PDCHXS)+5         --> symbolic object whose hxs
*                               map is given by PDCHXS (above).


=KERMERRM EQU (PDCSYMB)+5        --> Kermit error message
=PAINTTREE EQU (KERMERRM)+5    --> hxs of "textbook-mode" graphics
*                                 info.  Init by those routines.
=EXITMSG EQU (PAINTTREE)+5	--> msg set by user in EXIT word

=AppDisplay   EQU (EXITMSG)+5  --> App display object
=AppKeys      EQU (AppDisplay)+5   --> App key assignments
=AppExitCond  EQU (AppKeys)+5	   --> App exit condition
=AppError     EQU (AppExitCond)+5  --> App error handler

=CtlAlarm     EQU (AppError)+5     --> control alarm data

=MenuDef      EQU (CtlAlarm)+5     --> Current menu definition
=LastMenuDef  EQU (MenuDef)+5      --> Last menu definition
=MenuData     EQU (LastMenuDef)+5  --> Menu data for touch table
=MenuRowAct   EQU (MenuData)+5     --> Prev/Next action definition
=LabelDef     EQU (MenuRowAct)+5   --> How to make menu labels
=MenuKeyNS    EQU (LabelDef)+5     --> No-shift menu key handler
=MenuKeyLS    EQU (MenuKeyNS)+5    --> Left-shift menu key handler
=MenuKeyRS    EQU (MenuKeyLS)+5    --> Right-shift menu key handler
=ReviewKey    EQU (MenuKeyRS)+5    --> Review-key definition
=LastContext  EQU (ReviewKey)+5    --> RRP saved for CheckContext
=TrackAct     EQU (LastContext)+5  --> Action when CONTEXT changes
=MenuExitAct  EQU (TrackAct)+5     --> Menu exit action definition

=FlagMBox     EQU (MenuExitAct)+5  --> Flag mailbox
=ViewMBox     EQU (FlagMBox)+5	   --> View mailbox
=ProgMBox     EQU (ViewMBox)+5     --> Program mailbox
=Title	      EQU (ProgMBox)+5	   --> Home Title
=HiLitePtr    EQU (Title)+5	   --> Highlight in window
=WindowPtr    EQU (HiLitePtr)+5	   --> Item at bottom of window
=HStackPtr    EQU (WindowPtr)+5    --> Highlight in stack
=HStackTop    EQU (HStackPtr)+5    --> How many items on stack

=LASTROMWDOB  EQU (HStackTop)+5  --> last user-level ROM-WORD evaluated
=KeyOb	      EQU (LASTROMWDOB)+5  --> Pending key-object
=GraphContext EQU (KeyOb)+5        --> Graphic Context
=Twinkle+     EQU (GraphContext)+5 --> Custom cursor+ routine
=Twinkle-     EQU (Twinkle+)+5     --> Custom cursor- routine
**
=TopicVar1    EQU (Twinkle-)+5	   --> generic topic var 1
=TopicVar2    EQU (TopicVar1)+5    --> generic topic var 2
=TopicVar3    EQU (TopicVar2)+5    --> generic topic var 3
=TopicVar4    EQU (TopicVar3)+5    --> generic topic var 4
=TopicVar5    EQU (TopicVar4)+5    --> generic topic var 5
=TopicVar6    EQU (TopicVar5)+5    --> generic topic var 6
=TopicVar7    EQU (TopicVar6)+5    --> generic topic var 7
=TopicVar8    EQU (TopicVar7)+5    --> generic topic var 8
=TopicVar9    EQU (TopicVar8)+5    --> generic topic var 9
=TopicVar10    EQU (TopicVar9)+5    --> generic topic var 10
=TopicVar11    EQU (TopicVar10)+5    --> generic topic var 11
=TopicVar12    EQU (TopicVar11)+5    --> generic topic var 12
=TopicVar13    EQU (TopicVar12)+5    --> generic topic var 13
=TopicVar14    EQU (TopicVar13)+5    --> generic topic var 14
=TopicVar15    EQU (TopicVar14)+5    --> generic topic var 15
=TopicVar16    EQU (TopicVar15)+5    --> generic topic var 16
=TopicVar17    EQU (TopicVar16)+5    --> generic topic var 17
=TopicVar18    EQU (TopicVar17)+5    --> generic topic var 18
=TopicVar19    EQU (TopicVar18)+5    --> generic topic var 19
=TopicVar20    EQU (TopicVar19)+5    --> generic topic var 20
=TopicVar21    EQU (TopicVar20)+5    --> generic topic var 21
=TopicVar22    EQU (TopicVar21)+5    --> generic topic var 22
=TopicVar23    EQU (TopicVar22)+5    --> generic topic var 23
=TopicVar24    EQU (TopicVar23)+5    --> generic topic var 24
=TopicVar25    EQU (TopicVar24)+5    --> generic topic var 25
=TopicVar26    EQU (TopicVar25)+5    --> generic topic var 26
=TopicVar27    EQU (TopicVar26)+5    --> generic topic var 27
=TopicVar28    EQU (TopicVar27)+5    --> generic topic var 28
=TopicVar29    EQU (TopicVar28)+5    --> generic topic var 29
=TopicVar30    EQU (TopicVar29)+5    --> generic topic var 30
=TopicVar31    EQU (TopicVar30)+5    --> generic topic var 31
=TopicVar32    EQU (TopicVar31)+5    --> generic topic var 32
=TopicVar33    EQU (TopicVar32)+5    --> generic topic var 33
=TopicVar34    EQU (TopicVar33)+5    --> generic topic var 34
=TopicVar35    EQU (TopicVar34)+5    --> generic topic var 35
=TopicVar36    EQU (TopicVar35)+5    --> generic topic var 36
=TopicVar37    EQU (TopicVar36)+5    --> generic topic var 37
=TopicVar38    EQU (TopicVar37)+5    --> generic topic var 38
=TopicVar39    EQU (TopicVar38)+5    --> generic topic var 39
=TopicVar40    EQU (TopicVar39)+5    --> generic topic var 40
=TopicVar41    EQU (TopicVar40)+5    --> generic topic var 41
=TopicVar42    EQU (TopicVar41)+5    --> generic topic var 42
=TopicVar43    EQU (TopicVar42)+5    --> generic topic var 43
=TopicVar44    EQU (TopicVar43)+5    --> generic topic var 44
=TopicVar45    EQU (TopicVar44)+5    --> generic topic var 45
=TopicVar46    EQU (TopicVar45)+5    --> generic topic var 46
=TopicVar47    EQU (TopicVar46)+5    --> generic topic var 47
=TopicVar48    EQU (TopicVar47)+5    --> generic topic var 48
* 49-91 map to 1-43 for swapping in split modes
=TopicVar49    EQU (TopicVar48)+5    --> generic topic var 49
=TopicVar50    EQU (TopicVar49)+5    --> generic topic var 50
=TopicVar51    EQU (TopicVar50)+5    --> generic topic var 51
=TopicVar52    EQU (TopicVar51)+5    --> generic topic var 52
=TopicVar53    EQU (TopicVar52)+5    --> generic topic var 53
=TopicVar54    EQU (TopicVar53)+5    --> generic topic var 54
=TopicVar55    EQU (TopicVar54)+5    --> generic topic var 55
=TopicVar56    EQU (TopicVar55)+5    --> generic topic var 56
=TopicVar57    EQU (TopicVar56)+5    --> generic topic var 57
=TopicVar58    EQU (TopicVar57)+5    --> generic topic var 58
=TopicVar59    EQU (TopicVar58)+5    --> generic topic var 59
=TopicVar60    EQU (TopicVar59)+5    --> generic topic var 60
=TopicVar61    EQU (TopicVar60)+5    --> generic topic var 61
=TopicVar62    EQU (TopicVar61)+5    --> generic topic var 62
=TopicVar63    EQU (TopicVar62)+5    --> generic topic var 63
=TopicVar64    EQU (TopicVar63)+5    --> generic topic var 64
=TopicVar65    EQU (TopicVar64)+5    --> generic topic var 65
=TopicVar66    EQU (TopicVar65)+5    --> generic topic var 66
=TopicVar67    EQU (TopicVar66)+5    --> generic topic var 67
=TopicVar68    EQU (TopicVar67)+5    --> generic topic var 68
=TopicVar69    EQU (TopicVar68)+5    --> generic topic var 69
=TopicVar70    EQU (TopicVar69)+5    --> generic topic var 70
=TopicVar71    EQU (TopicVar70)+5    --> generic topic var 71
=TopicVar72    EQU (TopicVar71)+5    --> generic topic var 72
=TopicVar73    EQU (TopicVar72)+5    --> generic topic var 73
=TopicVar74    EQU (TopicVar73)+5    --> generic topic var 74
=TopicVar75    EQU (TopicVar74)+5    --> generic topic var 75
=TopicVar76    EQU (TopicVar75)+5    --> generic topic var 76
=TopicVar77    EQU (TopicVar76)+5    --> generic topic var 77
=TopicVar78    EQU (TopicVar77)+5    --> generic topic var 78
=TopicVar79    EQU (TopicVar78)+5    --> generic topic var 79
=TopicVar80    EQU (TopicVar79)+5    --> generic topic var 80
=TopicVar81    EQU (TopicVar80)+5    --> generic topic var 81
=TopicVar82    EQU (TopicVar81)+5    --> generic topic var 82
=TopicVar83    EQU (TopicVar82)+5    --> generic topic var 83
=TopicVar84    EQU (TopicVar83)+5    --> generic topic var 84
=TopicVar85    EQU (TopicVar84)+5    --> generic topic var 85
=TopicVar86    EQU (TopicVar85)+5    --> generic topic var 86
=TopicVar87    EQU (TopicVar86)+5    --> generic topic var 87
=TopicVar88    EQU (TopicVar87)+5    --> generic topic var 88
=TopicVar89    EQU (TopicVar88)+5    --> generic topic var 89
=TopicVar90    EQU (TopicVar89)+5    --> generic topic var 90
=TopicVar91    EQU (TopicVar90)+5    --> generic topic var 91
=TopicVarNum   EQU 91                    number of TopicVars
** Begin Topic Outer Loop Variables
=TOLVar1	EQU (TopicVar91)+5	--> TOL var 1
=TOLVar2	EQU (TOLVar1)+5		--> TOL var 2
=TOLVar3	EQU (TOLVar2)+5		--> TOL var 3
=TOLVar4	EQU (TOLVar3)+5		--> TOL var 4
=TOLVar5	EQU (TOLVar4)+5		--> TOL var 5
=TOLVar6	EQU (TOLVar5)+5		--> TOL var 6
=TOLVar7	EQU (TOLVar6)+5		--> TOL var 7
=TOLVar8	EQU (TOLVar7)+5		--> TOL var 8
=TOLVar9	EQU (TOLVar8)+5		--> TOL var 9
=TOLVar10	EQU (TOLVar9)+5		--> TOL var 10
=TOLVar11	EQU (TOLVar10)+5		--> TOL var 11
=TOLVar12	EQU (TOLVar11)+5		--> TOL var 12
=TOLVar13	EQU (TOLVar12)+5		--> TOL var 13
=TOLVar14	EQU (TOLVar13)+5		--> TOL var 14
=TOLVar15	EQU (TOLVar14)+5		--> TOL var 15
=TOLVar16	EQU (TOLVar15)+5		--> TOL var 16
=TOLVar17	EQU (TOLVar16)+5		--> TOL var 17
=TOLVar18	EQU (TOLVar17)+5		--> TOL var 18
=TOLVar19	EQU (TOLVar18)+5		--> TOL var 19
=TOLVar20	EQU (TOLVar19)+5		--> TOL var 20
=TOLVar21	EQU (TOLVar20)+5		--> TOL var 21
=TOLVar22	EQU (TOLVar21)+5		--> TOL var 22
=TOLVar23	EQU (TOLVar22)+5		--> TOL var 23
=TOLVar24	EQU (TOLVar23)+5		--> TOL var 24
=TOLVar25	EQU (TOLVar24)+5		--> TOL var 25
=TOLVar26	EQU (TOLVar25)+5		--> TOL var 26
=TOLVar27	EQU (TOLVar26)+5		--> TOL var 27
=TOLVar28	EQU (TOLVar27)+5		--> TOL var 28
=TOLVar29	EQU (TOLVar28)+5		--> TOL var 29
=TOLVar30	EQU (TOLVar29)+5		--> TOL var 30
=TOLVar31	EQU (TOLVar30)+5		--> TOL var 31
=TOLVar32	EQU (TOLVar31)+5		--> TOL var 32
=TOLVar33	EQU (TOLVar32)+5		--> TOL var 33
=TOLVar34	EQU (TOLVar33)+5		--> TOL var 34
=TOLVar35	EQU (TOLVar34)+5		--> TOL var 35
=TOLVar36	EQU (TOLVar35)+5		--> TOL var 36
=TOLVar37	EQU (TOLVar36)+5		--> TOL var 37
=TOLVar38	EQU (TOLVar37)+5		--> TOL var 38
=TOLVar39	EQU (TOLVar38)+5		--> TOL var 39
=TOLVar40	EQU (TOLVar39)+5		--> TOL var 40
=TOLVar41	EQU (TOLVar40)+5		--> TOL var 41
=TOLVar42	EQU (TOLVar41)+5		--> TOL var 42
=TOLVar43	EQU (TOLVar42)+5		--> TOL var 43
=TOLVar44	EQU (TOLVar43)+5		--> TOL var 44
=TOLVar45	EQU (TOLVar44)+5		--> TOL var 45
=TOLVar46	EQU (TOLVar45)+5		--> TOL var 46
=TOLVar47	EQU (TOLVar46)+5		--> TOL var 47
=TOLVar48	EQU (TOLVar47)+5		--> TOL var 48
=TOLVar49	EQU (TOLVar48)+5		--> TOL var 49
=TOLVar50	EQU (TOLVar49)+5		--> TOL var 50
=TOLVar51	EQU (TOLVar50)+5		--> TOL var 51
=TOLVar52	EQU (TOLVar51)+5		--> TOL var 52
=TOLVar53	EQU (TOLVar52)+5		--> TOL var 53
=TOLVar54	EQU (TOLVar53)+5		--> TOL var 54
=TOLVar55	EQU (TOLVar54)+5		--> TOL var 55
=TOLVar56	EQU (TOLVar55)+5		--> TOL var 56
=TOLVar57	EQU (TOLVar56)+5		--> TOL var 57
=TOLVar58	EQU (TOLVar57)+5		--> TOL var 58
=TOLVar59	EQU (TOLVar58)+5		--> TOL var 59
=TOLVar60	EQU (TOLVar59)+5		--> TOL var 60
=TOLVar61	EQU (TOLVar60)+5		--> TOL var 61
=TOLVar62	EQU (TOLVar61)+5		--> TOL var 62
=TOLVar63	EQU (TOLVar62)+5		--> TOL var 63
=TOLVar64	EQU (TOLVar63)+5		--> TOL var 64
=TOLVar65	EQU (TOLVar64)+5		--> TOL var 65
=TOLVar66	EQU (TOLVar65)+5		--> TOL var 66
=TOLVar67	EQU (TOLVar66)+5		--> TOL var 67
=TOLVar68	EQU (TOLVar67)+5		--> TOL var 68
=TOLVar69	EQU (TOLVar68)+5		--> TOL var 69
=TOLVar70	EQU (TOLVar69)+5		--> TOL var 70
=TOLVar71	EQU (TOLVar70)+5		--> TOL var 71
=TOLVar72	EQU (TOLVar71)+5		--> TOL var 72
=TOLVar73	EQU (TOLVar72)+5		--> TOL var 73
=TOLVar74	EQU (TOLVar73)+5		--> TOL var 74
=TOLVar75	EQU (TOLVar74)+5		--> TOL var 75
=TOLVar76	EQU (TOLVar75)+5		--> TOL var 76
=TOLVar77	EQU (TOLVar76)+5		--> TOL var 77
=TOLVar78	EQU (TOLVar77)+5		--> TOL var 78
=TOLVar79	EQU (TOLVar78)+5		--> TOL var 79
=TOLVar80	EQU (TOLVar79)+5		--> TOL var 80
=TOLVar81	EQU (TOLVar80)+5		--> TOL var 81
=TOLVar82	EQU (TOLVar81)+5		--> TOL var 82
=TOLVar83	EQU (TOLVar82)+5		--> TOL var 83
=TOLVar84	EQU (TOLVar83)+5		--> TOL var 84
=TOLVar85	EQU (TOLVar84)+5		--> TOL var 85
=TOLVar86	EQU (TOLVar85)+5		--> TOL var 86
=TOLVar87	EQU (TOLVar86)+5		--> TOL var 87
=TOLVar88	EQU (TOLVar87)+5		--> TOL var 88
=TOLVar89	EQU (TOLVar88)+5		--> TOL var 89
=TOLVar90	EQU (TOLVar89)+5		--> TOL var 90
=TOLVar91	EQU (TOLVar90)+5		--> TOL var 91
=TOLVar92	EQU (TOLVar91)+5		--> TOL var 92
=TOLVar93	EQU (TOLVar92)+5		--> TOL var 93
=TOLVar94	EQU (TOLVar93)+5		--> TOL var 94
=TOLVar95	EQU (TOLVar94)+5		--> TOL var 95
=TOLVar96	EQU (TOLVar95)+5		--> TOL var 96
=TOLVar97	EQU (TOLVar96)+5		--> TOL var 97
=TOLVar98	EQU (TOLVar97)+5		--> TOL var 98
=TOLVar99	EQU (TOLVar98)+5		--> TOL var 99
=TOLVar100	EQU (TOLVar99)+5		--> TOL var 100
=TOLVar101	EQU (TOLVar100)+5		--> TOL var 101
=TOLVar102	EQU (TOLVar101)+5		--> TOL var 102
=TOLVar103	EQU (TOLVar102)+5		--> TOL var 103
=TOLVar104	EQU (TOLVar103)+5		--> TOL var 104
=TOLVar105	EQU (TOLVar104)+5		--> TOL var 105
=TOLVar106	EQU (TOLVar105)+5		--> TOL var 106
=TOLVar107	EQU (TOLVar106)+5		--> TOL var 107
=TOLVar108	EQU (TOLVar107)+5		--> TOL var 108
=TOLVar109	EQU (TOLVar108)+5		--> TOL var 109
=TOLVar110	EQU (TOLVar109)+5		--> TOL var 110
=TOLVar111	EQU (TOLVar110)+5		--> TOL var 111
=TOLVar112	EQU (TOLVar111)+5		--> TOL var 112
=TOLVar113	EQU (TOLVar112)+5		--> TOL var 113
=TOLVar114	EQU (TOLVar113)+5		--> TOL var 114
=TOLVar115	EQU (TOLVar114)+5		--> TOL var 115
=TOLVar116	EQU (TOLVar115)+5		--> TOL var 116
=TOLVar117	EQU (TOLVar116)+5		--> TOL var 117
=TOLVar118	EQU (TOLVar117)+5		--> TOL var 118
=TOLVar119	EQU (TOLVar118)+5		--> TOL var 119
=TOLVar120	EQU (TOLVar119)+5		--> TOL var 120
=TOLVar121	EQU (TOLVar120)+5		--> TOL var 121
=TOLVar122	EQU (TOLVar121)+5		--> TOL var 122
=TOLVar123	EQU (TOLVar122)+5		--> TOL var 123
=TOLVar124	EQU (TOLVar123)+5		--> TOL var 124
=TOLVar125	EQU (TOLVar124)+5		--> TOL var 125
=TOLVar126	EQU (TOLVar125)+5		--> TOL var 126
=TOLVar127	EQU (TOLVar126)+5		--> TOL var 127
=TOLVar128	EQU (TOLVar127)+5		--> TOL var 128
=TOLVar129	EQU (TOLVar128)+5		--> TOL var 129
=TOLVar130	EQU (TOLVar129)+5		--> TOL var 130
=TOLVar131	EQU (TOLVar130)+5		--> TOL var 131
=TOLVar132	EQU (TOLVar131)+5		--> TOL var 132
=TOLVar133	EQU (TOLVar132)+5		--> TOL var 133
=TOLVar134	EQU (TOLVar133)+5		--> TOL var 134
=TOLVar135	EQU (TOLVar134)+5		--> TOL var 135
=TOLVar136	EQU (TOLVar135)+5		--> TOL var 136
=TOLVar137	EQU (TOLVar136)+5		--> TOL var 137
=TOLVar138	EQU (TOLVar137)+5		--> TOL var 138
=TOLVar139	EQU (TOLVar138)+5		--> TOL var 139
=TOLVar140	EQU (TOLVar139)+5		--> TOL var 140
=TOLVar141	EQU (TOLVar140)+5		--> TOL var 141
=TOLVar142	EQU (TOLVar141)+5		--> TOL var 142
=TOLVar143	EQU (TOLVar142)+5		--> TOL var 143
=TOLVar144	EQU (TOLVar143)+5		--> TOL var 144
=TOLVar145	EQU (TOLVar144)+5		--> TOL var 145
=TOLVar146	EQU (TOLVar145)+5		--> TOL var 146
=TOLVar147	EQU (TOLVar146)+5		--> TOL var 147
=TOLVar148	EQU (TOLVar147)+5		--> TOL var 148
=TOLVar149	EQU (TOLVar148)+5		--> TOL var 149
=TOLVar150	EQU (TOLVar149)+5		--> TOL var 150
=TOLVar151	EQU (TOLVar150)+5		--> TOL var 151
=TOLVar152	EQU (TOLVar151)+5		--> TOL var 152
=TOLVar153	EQU (TOLVar152)+5		--> TOL var 153
=TOLVar154	EQU (TOLVar153)+5		--> TOL var 154
=TOLVar155	EQU (TOLVar154)+5		--> TOL var 155
=TOLVar156	EQU (TOLVar155)+5		--> TOL var 156
=TOLVar157	EQU (TOLVar156)+5		--> TOL var 157
=TOLVar158	EQU (TOLVar157)+5		--> TOL var 158
=TOLVar159	EQU (TOLVar158)+5		--> TOL var 159
=TOLVar160	EQU (TOLVar159)+5		--> TOL var 160
=TOLVar161	EQU (TOLVar160)+5		--> TOL var 161
=TOLVar162	EQU (TOLVar161)+5		--> TOL var 162
=TOLVar163	EQU (TOLVar162)+5		--> TOL var 163
=TOLVar164	EQU (TOLVar163)+5		--> TOL var 164
=TOLVar165	EQU (TOLVar164)+5		--> TOL var 165
=TOLVar166	EQU (TOLVar165)+5		--> TOL var 166
=TOLVar167	EQU (TOLVar166)+5		--> TOL var 167
=TOLVar168	EQU (TOLVar167)+5		--> TOL var 168
=TOLVar169	EQU (TOLVar168)+5		--> TOL var 169
=TOLVar170	EQU (TOLVar169)+5		--> TOL var 170
=TOLVar171	EQU (TOLVar170)+5		--> TOL var 171
=TOLVar172	EQU (TOLVar171)+5		--> TOL var 172
=TOLVar173	EQU (TOLVar172)+5		--> TOL var 173
=TOLVar174	EQU (TOLVar173)+5		--> TOL var 174
=TOLVar175	EQU (TOLVar174)+5		--> TOL var 175
=TOLVar176	EQU (TOLVar175)+5		--> TOL var 176
=TOLVar177	EQU (TOLVar176)+5		--> TOL var 177
=TOLVar178	EQU (TOLVar177)+5		--> TOL var 178
=TOLVar179	EQU (TOLVar178)+5		--> TOL var 179
=TOLVar180	EQU (TOLVar179)+5		--> TOL var 180
=TOLVar181	EQU (TOLVar180)+5		--> TOL var 181
=TOLVar182	EQU (TOLVar181)+5		--> TOL var 182
=TOLVar183	EQU (TOLVar182)+5		--> TOL var 183
=TOLVar184	EQU (TOLVar183)+5		--> TOL var 184
=TOLVar185	EQU (TOLVar184)+5		--> TOL var 185
=TOLVar186	EQU (TOLVar185)+5		--> TOL var 186
=TOLVar187	EQU (TOLVar186)+5		--> TOL var 187
=TOLVar188	EQU (TOLVar187)+5		--> TOL var 188
=TOLVar189	EQU (TOLVar188)+5		--> TOL var 189
=TOLVar190	EQU (TOLVar189)+5		--> TOL var 190
=TOLVar191	EQU (TOLVar190)+5		--> TOL var 191
=TOLVar192	EQU (TOLVar191)+5		--> TOL var 192
=TOLVar193	EQU (TOLVar192)+5		--> TOL var 193
=TOLVar194	EQU (TOLVar193)+5		--> TOL var 194
=TOLVar195	EQU (TOLVar194)+5		--> TOL var 195
=TOLVar196	EQU (TOLVar195)+5		--> TOL var 196
=TOLVar197	EQU (TOLVar196)+5		--> TOL var 197
=TOLVar198	EQU (TOLVar197)+5		--> TOL var 198
=TOLVar199	EQU (TOLVar198)+5		--> TOL var 199
=TOLVar200	EQU (TOLVar199)+5		--> TOL var 200
=TOLVar201	EQU (TOLVar200)+5		--> TOL var 201
=TOLVar202	EQU (TOLVar201)+5		--> TOL var 202
=TOLVar203	EQU (TOLVar202)+5		--> TOL var 203
=TOLVar204	EQU (TOLVar203)+5		--> TOL var 204
=TOLVar205	EQU (TOLVar204)+5		--> TOL var 205
=TOLVar206	EQU (TOLVar205)+5		--> TOL var 206
=TOLVar207	EQU (TOLVar206)+5		--> TOL var 207
=TOLVar208	EQU (TOLVar207)+5		--> TOL var 208
=TOLVar209	EQU (TOLVar208)+5		--> TOL var 209
=TOLVar210	EQU (TOLVar209)+5		--> TOL var 210
=TOLVar211	EQU (TOLVar210)+5		--> TOL var 211
=TOLVar212	EQU (TOLVar211)+5		--> TOL var 212
=TOLVar213	EQU (TOLVar212)+5		--> TOL var 213
=TOLVar214	EQU (TOLVar213)+5		--> TOL var 214
=TOLVar215	EQU (TOLVar214)+5		--> TOL var 215
=TOLVar216	EQU (TOLVar215)+5		--> TOL var 216
*************************************************************************
*	
*   NOTE: The last updateable system pointer must equate to the symbol 
*   `OBUPEND' for correct computation of the count `OBUPSIZE'.
*	
*************************************************************************
=OBUPEND	EQU (TOLVar216)
=TOLVarNum      EQU 216                         number of TOLVars
=OBUPSIZE	EQU (((OBUPEND)-(OBUPSTART))/5)+1

*****************************************************************
*****         END of UPDATEABLE SYSTEM VARIABLES           ******
*****************************************************************

=SYSNOUPSTART EQU ((OBUPSTART)+5*(OBUPSIZE))
*****************************************************************
** Equates below delimit internals of non-updateable system vars
*****************************************************************
=RAMEND  EQU (SYSNOUPSTART)    --> End of RAM                 (5)
=AVMEM   EQU (RAMEND)+5                                       (5)
=ERROR   EQU (AVMEM)+5                                        (5)
=SAVELCDFLG EQU (ERROR)+5                                     (1)
*****************************************************************
*  N.B.   ATTNFLG located on odd address to maintain proper     *
*  loop timing during execution of =Tone.   S.B.  03/28/89      *
*****************************************************************
here     EQU   (SAVELCDFLG)+1
label2     IFNE  (here)%2     If next RAM address odd
=ATTNFLG EQU here                                             (5)
=FIRSTPROC EQU (ATTNFLG)+6    ->StartupProc Secondary         (5)
label2     ELSE               If next RAM address even
=ATTNFLG EQU (here)+1                                         (5)
=FIRSTPROC EQU (ATTNFLG)+5    ->StartupProc Secondary         (5)
label2     ENDIF


**** END of NON-UPDATEABLE SYSTEM VARIABLES *****


*****************************************************************
** Non-kernel Non-Updateable Variables File
**
** This file is the central clearing house for
** all non-updateable  variables which are in
** the RPL system but not explicity described in
** the ERS, i.e. those beyond PLCDFLG but before
** the ROMPART Table. Included in this file are:
**    (1) the equates for these
**        variable's locations
**    (2) a brief description of their meaning
**    (3) which ROMPART(s) initialize, maintain,
**        and use them
**    (3) the value they assume after RPL is
**        invoked following a Coldstart.
** In addition the RAM allocated to these additional
** variable's locations will be reflected in the equate
** value for ROMPTAB, also defined here.
** When there are no additional locations allocated
** the value of ROMPTAB will be EQU to (FIRSTPROC)+5
*****************************************************************



****************************************************************
* Internal System Flags for Charlemagne  (4 flags/nib)         *
*                                                              *
*           ===========================================        *
*           CAVEAT: Because of the change to the manner        *
*           in which these flags are accessed (see the         *
*           routine: testflag), it is necessary that           *
*           they all reside within a 256 nibble block.         *
*              {SysNib1 is used as a base address}             *
*           ===========================================        *
*                                                              *
****************************************************************
=SysNib1  EQU (FIRSTPROC)+5                                    1

**    Flags display area 2 can't be rolled up to become valid.
=NoRolDA2MASK  EQU 1*(#100)+(SysNib1)%256

**   "AbbrStk" flag indicates that the stack display is to be
**   abbreviated to object types only for memory conservation.
=AbbrStkMASK   EQU 2*(#100)+(SysNib1)%256

**   "DA2bIsEd" flag signals whether display area 2b shows
**   the edit line.
=DA2bIsEdMASK  EQU 4*(#100)+(SysNib1)%256

**   Ignore ALARMSDUE in GETKEY (ie; SHUTDN even if ALARMSDUE)
=IgnorAlmMASK  EQU 8*(#100)+(SysNib1)%256
***********************************************
=SysNib2  EQU (SysNib1)+1                                      2

**   Flag for System Request of CLKON state.
=ReqClkOnMASK  EQU 1*(#100)+(SysNib2)%256

**   Flag indicates that we're in Server Mode
=ServModeMASK  EQU 2*(#100)+(SysNib2)%256

**   Flag indicates whether an aplet topic is running.
=InApletMASK   EQU 4*(#100)+(SysNib2)%256

**   Flag indicates the menu system is corrupt.
=BadMenuMASK   EQU 8*(#100)+(SysNib2)%256
***********************************************
=SysNib3  EQU (SysNib2)+1                                      3

*   value after RPL invocation = 1
=UNDOMASK      EQU 1*(#100)+(SysNib3)%256   automatic stack-save

=INSERTMASK    EQU 2*(#100)+(SysNib3)%256   insert/replace mode

=ALGMASK       EQU 4*(#100)+(SysNib3)%256   algebraic-echo mode

=PRINTINGMASK  EQU 8*(#100)+(SysNib3)%256
***********************************************
=SysNib4  EQU (SysNib3)+1                                      4

=DA2aTempMASK  EQU 1*(#100)+(SysNib4)%256
=DA2bTempMASK  EQU 2*(#100)+(SysNib4)%256
=DA3TempMASK   EQU 4*(#100)+(SysNib4)%256

**   BadTOLUI flags potentially corrupt user interface (as
**   defined by the topic outer loop).
=BadTOLUIMASK  EQU 8*(#100)+(SysNib4)%256
***********************************************
=SysNib5  EQU (SysNib4)+1                                      5

*   value after RPL invocation = 1
=COMMANDMASK   EQU 1*(#100)+(SysNib5)%256   "history" stack save

=BLINKMASK     EQU 2*(#100)+(SysNib5)%256   Active Timer1 Int's

=LOWERMASK     EQU 4*(#100)+(SysNib5)%256   lower-case keys

*   Decompilation is for stack representation, not editing
=STKDCMASK     EQU 8*(#100)+(SysNib5)%256
***********************************************
=SysNib6  EQU (SysNib5)+1                                      6

**   "one-user mode" flag indicates whether one key is to be
**   processed in user keys mode.
=Do1UserMASK   EQU 1*(#100)+(SysNib6)%256

**   "Suspended environments OK" flag indicates whether a cmd
**   that would suspend the current environment is allowed.
=ASuspOKMASK   EQU 2*(#100)+(SysNib6)%256

**   BadPOLUI flags potentially corrupt user interface (as
**   defined by the parameterized outer loop).
=BadPOLUIMASK  EQU 4*(#100)+(SysNib6)%256

**   "DA<n>Temp" flags indicte that the specified display area
**   is valid temporarily.
=DA1TempMASK   EQU 8*(#100)+(SysNib6)%256
***********************************************
=SysNib7  EQU (SysNib6)+1                                      7

**   "DA<n>Valid" flags indicate whether the specified display
**   area is known to be valid.
=DA1ValidMASK  EQU 1*(#100)+(SysNib7)%256

=DA2aValdMASK  EQU 2*(#100)+(SysNib7)%256

=DA2bValdMASK  EQU 4*(#100)+(SysNib7)%256

=DA3ValidMASK  EQU 8*(#100)+(SysNib7)%256
***********************************************
=SysNib8  EQU (SysNib7)+1                                      8

**   "DA<n>NoCh" flags indicate whether the specified display
**   area has not been changed.
=DA1NoChMASK   EQU 1*(#100)+(SysNib8)%256

=DA2aNoChMASK  EQU 2*(#100)+(SysNib8)%256

=DA2bNoChMASK  EQU 4*(#100)+(SysNib8)%256

=DA3NoChMASK   EQU 8*(#100)+(SysNib8)%256
***********************************************
=SysNib9  EQU (SysNib8)+1                                      9

**   "DA<n>Bad" flags indicate whether specified display area
**   is known to be invalid.
=DA1BadMASK    EQU 1*(#100)+(SysNib9)%256

=DA2aBadMASK   EQU 2*(#100)+(SysNib9)%256

=DA2bBadMASK   EQU 4*(#100)+(SysNib9)%256

=DA3BadMASK    EQU 8*(#100)+(SysNib9)%256
***********************************************
=SysNib10 EQU (SysNib9)+1                                     10

=EDITLFLAG     EQU SysNib10
=EDITLMASK     EQU 1*(#100)+(SysNib10)%256
=mEditLExists  EQU 1

**   "NAppKey" flag indicates whether non-application keys are
**   allowed in a parameterized outer loop.
=NAppKeyMASK   EQU 2*(#100)+(SysNib10)%256

**  "NUsrKey" flag indicates whether non-user keys are allowed
**   in user keys mode.
=NUsrKeyMASK   EQU 4*(#100)+(SysNib10)%256

**   AppModeFLAG indicates whether an Parameterized Outer Loop
**   Application is currently running.
=AppModeMASK   EQU 8*(#100)+(SysNib10)%256
***********************************************
=SysNib11 EQU (SysNib10)+1                                    11

**   Implicit parenthesized "/", "^", and "SQRT" in EQW
=ParenModFLAG  EQU SysNib11
=ParenModMASK  EQU 1*(#100)+(SysNib11)%256
=ParenModmask  EQU 1

**   1PDC flag is set and cleared by various decomp. routines
**   Set indicates Partial-DeCompile information will not be
**   saved (so no great effort should be made to generate it)
=1PDCMASK      EQU 2*(#100)+(SysNib11)%256

**   The "new edit line" flag indicates whether a new, one-row
**   edit line was just created.
=NewEditLMASK  EQU 4*(#100)+(SysNib11)%256

**   "do standard keys only" flag indicates whether only
**   standard key definitions are to be performed instead of
**   default key processing (includes user key definitions).
=DoStdKeyMASK  EQU 8*(#100)+(SysNib11)%256
***********************************************
=SysNib12 EQU (SysNib11)+1                                    12

**   Flags ticking clock allowed to be displayed in display
**   area 1.   Clock is active if either the System Flag
**   (uCLKON) or the internal system Request flag (ReqClkOn)
**   is set.  Even if CLKON active, we don't always allow it
**   to be displayed (eg; err msg in status area).
=DispTimeMASK EQU 1*(#100)+(SysNib12)%256
** Flags to tell when display is in SplitScreen mode;
** used by plotting, etc. "Right" tells plot code it is
** drawing on right half.
=SplitMASK    EQU 2*(#100)+(SysNib12)%256
=RightMASK    EQU 4*(#100)+(SysNib12)%256
=CurTknMASK   EQU 8*(#100)+(SysNib12)%256
****************************************************************



****************************************************************
*  INTERNAL SYSTEM FLAGS FOR PLUG-INS OR FUTURE SYSTEM MODS    *
****************************************************************
=SysNib13 EQU (SysNib12)+1                                    13

=NOP1MASK13    EQU 1*(#100)+(SysNib13)%256  # UNUSED #
=NOP2MASK13    EQU 2*(#100)+(SysNib13)%256  # UNUSED #
=NOP4MASK13    EQU 4*(#100)+(SysNib13)%256  # UNUSED #
=NOP8MASK13    EQU 8*(#100)+(SysNib13)%256  # UNUSED #
***********************************************
=SysNib14 EQU (SysNib13)+1                                    14

=NOP1MASK14    EQU 1*(#100)+(SysNib14)%256  # UNUSED #
=NOP2MASK14    EQU 2*(#100)+(SysNib14)%256  # UNUSED #
=NOP4MASK14    EQU 4*(#100)+(SysNib14)%256  # UNUSED #
=NOP8MASK14    EQU 8*(#100)+(SysNib14)%256  # UNUSED #
***********************************************
=SysNib15 EQU (SysNib14)+1                                    15

=NOP1MASK15    EQU 1*(#100)+(SysNib15)%256  # UNUSED #
=NOP2MASK15    EQU 2*(#100)+(SysNib15)%256  # UNUSED #
=NOP4MASK15    EQU 4*(#100)+(SysNib15)%256  # UNUSED #
=NOP8MASK15    EQU 8*(#100)+(SysNib15)%256  # UNUSED #
***********************************************
=SysNib16 EQU (SysNib15)+1                                    16

=NOP1MASK16    EQU 1*(#100)+(SysNib16)%256  # UNUSED #
=NOP2MASK16    EQU 2*(#100)+(SysNib16)%256  # UNUSED #
=NOP4MASK16    EQU 4*(#100)+(SysNib16)%256  # UNUSED #
=NOP8MASK16    EQU 8*(#100)+(SysNib16)%256  # UNUSED #
***********************************************
=SysNib17 EQU (SysNib16)+1                                    17

=NOP1MASK17    EQU 1*(#100)+(SysNib17)%256  # UNUSED #
=NOP2MASK17    EQU 2*(#100)+(SysNib17)%256  # UNUSED #
=NOP4MASK17    EQU 4*(#100)+(SysNib17)%256  # UNUSED #
=NOP8MASK17    EQU 8*(#100)+(SysNib17)%256  # UNUSED #
***********************************************
=SysNib18 EQU (SysNib17)+1                                    18

=NOP1MASK18    EQU 1*(#100)+(SysNib18)%256  # UNUSED #
=NOP2MASK18    EQU 2*(#100)+(SysNib18)%256  # UNUSED #
=NOP4MASK18    EQU 4*(#100)+(SysNib18)%256  # UNUSED #
=NOP8MASK18    EQU 8*(#100)+(SysNib18)%256  # UNUSED #
***********************************************
=SysNib19 EQU (SysNib18)+1                                    19

=NOP1MASK19    EQU 1*(#100)+(SysNib19)%256  # UNUSED #
=NOP2MASK19    EQU 2*(#100)+(SysNib19)%256  # UNUSED #
=NOP4MASK19    EQU 4*(#100)+(SysNib19)%256  # UNUSED #
=NOP8MASK19    EQU 8*(#100)+(SysNib19)%256  # UNUSED #
***********************************************
=SysNib20 EQU (SysNib19)+1                                    20

=NOP1MASK20    EQU 1*(#100)+(SysNib20)%256  # UNUSED #
=NOP2MASK20    EQU 2*(#100)+(SysNib20)%256  # UNUSED #
=NOP4MASK20    EQU 4*(#100)+(SysNib20)%256  # UNUSED #
=NOP8MASK20    EQU 8*(#100)+(SysNib20)%256  # UNUSED #
*****************************************************************

*****************************************************************
*            Variables with more than two states:               *
*****************************************************************
=AppCount     EQU (SysNib20)+1                                (2)
* Initial value: 0 		???????????
* Count of nested parameterized	outer loops.


=ITEM1LINES EQU (AppCount)+2    # display lines currently     (1)
*                               occupied by top stack item.
* Initial value : 0


=VIEWLEVEL EQU (ITEM1LINES)+1  stack element currently viewed (5)
* initial value ?


=DEPTHSAVE EQU (VIEWLEVEL)+5  saved value of user-stack depth (5)
*                          in terms of the difference between
*                          [EDITLINE] and [DSKTOP].
* initial value 5


=RNSEED EQU (DEPTHSAVE)+5   real number body used as the     (15)
*           seed forthe random number generator.
* Initial value 0




develop10  IF  DEVELOP
=zero34      EQU (RNSEED)+15    See OffNoBlush (Temporary!!) (34)
=SAVECLK     EQU (zero34)+34    Save of CLKON state           (1)
develop10  ELSE
=SAVECLK     EQU (RNSEED)+15    Save of CLKON state           (1)
develop10  ENDIF


*****************************************************************
*             RAM Supporting the Alarm System                   *
*                                                               *
*  ALARMSDUE      Set by srvc_timer2, cleared by ClrAlarmsDue,  *
*                 and tested by ALARM? and srvc_alert           *
*                                                               *
*  PASTDUE        Set by SetPastDue, cleared by ClrPastDue,     *
*                 and tested by srvc_alert.                     *
*                                                               *
*  DOUSEALARM     Set by [ON][4], cleared by GETKEY and         *
*                 execution of a repeating alarm.  Tested       *
*                 within DoAlarmSrv.                            *
*                                                               *
*  NOALARMSRV     Set by Initmem, tested by srvc_timer2, and    *
*                 CLKUPD.  If set, alarm service bypassed.      *
*                                                               *
*  ALARM#         Written by FirstDue, and STOALARM#.  Fetched  *
*                 by GETALARM#                                  *
*                                                               *
*  PASTDUE#       Written by FirstPast, Fetched by GETPASTDUE#  *
*****************************************************************
=ALARMSDUE  EQU (SAVECLK)+1     Flags Alarm Due               (1)
=PASTDUE    EQU (ALARMSDUE)+1   Flags Past Due Alarm          (1)
=DOUSEALARM EQU (PASTDUE)+1     Flags Deactivate Curr Alarm   (1)
=NOALARMSRV EQU (DOUSEALARM)+1  Flags Disable Alarm Service   (1)
=ALARM#     EQU (NOALARMSRV)+1  Current Alarm#                (5)
=PASTDUE#   EQU (ALARM#)+5      1st Past Due Alarm#           (5)


* LPD_HIST:[P2 P1 Sys alarm]    ((*)) Annunciator Sources       *
=LPD_HIST   EQU (PASTDUE#)+5    Low Power Detect History      (1)



*****************************************************************
*                    ANNUNCIATOR BYTE                           *
*      N.B.: The flags don't directly control the hardware.     *
*                                                               *
*  Bit Symbol     Value   Bit#     ICON       Real Hdwr         *
* -----------     -----  -----   ----------  ------------       *
=Ann_RAD.b     EQU  1    Bit 0    "SoftAnn"    NONE             *
=Ann_IO.b      EQU  2    Bit 1     >>-->        A6              *
=Ann_Susp.b    EQU  4    Bit 2    "SoftAnn"    NONE             *
=Ann_Alert.b   EQU  8    Bit 3     ((*))        A4              *
=Ann_Shift.b   EQU  16   Bit 4     Shift        A1              *
=Ann_ALT.b     EQU  32   Bit 5    Alt Shift     A2              *
=Ann_Alpha.b   EQU  64   Bit 6     Alpha        A3              *
=Ann_Busy.b    EQU  128  Bit 7    HourGlass     A5              *
*****************************************************************
=ANNUNCIATORS EQU (LPD_HIST)+1  Annunciator flags             (2)





*****************  64 (1 bit each) System Flags *****************
=SystemFlags EQU (ANNUNCIATORS)+2    64 System flags         (16)
* initial value unknown at this time

****************   64 (1 bit each) User Flags  ******************
=UserFlags EQU (SystemFlags)+16     64 User Flags            (16)
* initial value unknown at this time





=ELEMENT EQU (UserFlags)+16  decompile obj depth counter      (2)
* initial value #00


=FIRSTCHAR EQU (ELEMENT)+2     offset to 1st visible          (5)
*                              editline chr
*  initial value 1


=CR_COUNT  EQU (FIRSTCHAR)+5    no. of "newline"s in editline (5)
*  initial value 0


=STACKNUM EQU (CR_COUNT)+5      ref. number of 1st visible    (5)
*                               stack item
* value after RPL invocation = 1


=TOPLINE EQU (STACKNUM)+5      editline-segment which appears (5)
*                              first on the screen
* initial value 1


=LASTARGCOUNT EQU (TOPLINE)+5  # of args saved by most   (1)
*          recent CK<num>; value after RPL invocation unknown


=LASTARGf     EQU (LASTARGCOUNT)+1  Flag #Args>3              (1)
*          value after RPL invocation unknown.


=LASTERROR EQU (LASTARGf)+1       save area for error number  (5)
* value after RPL invocation unknown





*****************************************************************
*               CURSOR   CONTROL   VARIABLES                    *
*****************************************************************
=CURSOREPOSN EQU (LASTERROR)+5     cursor editline pos'n      (5)
*  initial value 1


=CURSORROW   EQU (CURSOREPOSN)+5   Dsp Row# containing cursor (5)
* value after RPL invocation = 1


=CURSORPOSN   EQU (CURSORROW)+5    cursor pos'n from left     (2)
*                                  of screen  (0-21)
* value after RPL invocation = 0


=CURSORSTATE EQU (CURSORPOSN)+2    Non-Zero = Show Cursor,    (1)
*                                  Zero = Show underlying chr


=CURSORCHR  EQU (CURSORSTATE)+1    Char under Cursor          (2)
* value after RPL invocation unknown


=CURSORGROB EQU (CURSORCHR)+2    Cursor Grob Data       (20+10*2)
*                       Bit pattern for char underneath cursor.
* value after RPL invocation unknown


=CURSORX    EQU (CURSORGROB)+20+10*2   Pxl X-Coord of Cursor  (5)
* value after RPL invocation unknown


=CURSORY    EQU (CURSORX)+5            Pxl Y-Coord of Cursor  (5)
* value after RPL invocation unknown







=CURRENTMENU EQU  (CURSORY)+5    menu ID # of current menu    (2)
* value after RPL invocation = 1

=MENULEVEL    EQU (CURRENTMENU)+2    user-menu level          (5)
* initial value 0 (incremented in units of 6)

=OLDMENU EQU (MENULEVEL)+5       Saves previous menu number   (2)


=T1COUNT    EQU (OLDMENU)+2      Decremented by srvc_timer1   (1)


=PADCOUNT EQU (T1COUNT)+1        Records number of spaces to  (1)
*         pad control structures in decompile. Initialized
*         before use.


=GARBSCRATCH1 EQU (PADCOUNT)+1  Saves 1 RSTK level in G.C.    (5)

=GARBSCRATCH2 EQU (GARBSCRATCH1)+5  Saves counter in G.C.     (5)

=SAVECROSS EQU (GARBSCRATCH2)+5   cursor moves in plotting   (10)

=PADJSAVE1 EQU (SAVECROSS)+10	  status save in PTRADJUST    (1)

=PADJSAVE2 EQU (PADJSAVE1)+1      RSTK save in PTRADJUST     (10)

=KERMMODE EQU (PADJSAVE2)+10      Kermit Mode information     (1)

=DcompWidth EQU (KERMMODE)+1            String Decomp Width   (2)

* the next N are initialized and used in textbook graphics mode
*****************************************************************
* N.B.: FONTHEIGHT and FONTWIDTH must remain contiguous in this order
*****************************************************************
=FONTHEIGHT EQU (DcompWidth)+2     font-height selector       (1)
=FONTWIDTH  EQU (FONTHEIGHT)+1     font-width selector        (1)
=FONTCOUNT  EQU (FONTWIDTH)+1      counter                    (3)
=NODECOUNT  EQU (FONTCOUNT)+3      expr-tree node count       (3)
=OBTREELEN  EQU (NODECOUNT)+3      object length              (3)
=LASTOP     EQU (OBTREELEN)+3      3-state encoding of        (1)
*                "operand","unary" or "binary" operator last
*
* Note Code assumes next 3 vars contiguous in this order
=LEFTTREE   EQU (LASTOP)+1	                              (3)
=RIGHTTREE  EQU (LEFTTREE)+3	                              (3)
=PARENTTREE EQU (RIGHTTREE)+3	                              (3)
=PRECSTACK  EQU (PARENTTREE)+3  Op Precedence textbook entry  (7)
*
=KEYLIST    EQU (PRECSTACK)+7                                 (5)
=KEYLOCK    EQU (KEYLIST)+5                                   (1)
=ACCUM      EQU (KEYLOCK)+1                                   (1)
*
=OB/EXP?      EQU (ACCUM)+1	                              (1)
=COLWIDTH     EQU (OB/EXP?)+1                                 (2)
=ENTRWISE     EQU (COLWIDTH)+2                                (1)
=PARENCOUNT   EQU (ENTRWISE)+1                                (2)
=STRETCHCOUNT EQU (PARENCOUNT)+2                              (2)
*****************************************************************



=ClkOnNib     EQU (STRETCHCOUNT)+2   Non-zero ==> Ticking Clk (1)


=XmitSrcvTOut EQU (ClkOnNib)+1       XMIT/SRECV timeout	      (2)
*****************************************************************
*   The next 8 locations deal with Print Timing Maintenence     *
*   Code which references these locations assumes that they     *
*   are contiguous and in this order.                           *
*****************************************************************
=DelayCt      EQU (XmitSrcvTOut)+2   REDEYE Print time/line   (2)
=GCOLCOUNT    EQU (DelayCt)+2        Graphics #Cols           (2)
=COLCOUNT     EQU (GCOLCOUNT)+2      Dot Cols on line         (2)
=PrtStatus    EQU (COLCOUNT)+2       CPU Status Bits et al.   (3)
*
*        sTextLast   Bit0   Last byte of line was text
*        sEscLast    Bit1   Last byte= escape character
*        sDoubleWide Bit2   Now printing double wide
*        sGraphics   Bit3   In graphics escape sequence
*
*        sEOL_last   Bit4   Last byte = End Of Line (LF)
*        sPrtViaIO   Bit5   Don't mess with FIFO in PrintWait
*        sWait	     Bit6   Wait for a line to print
*        sLowBatErr  Bit7   Low battery error
*
*        sSend1stLF  Bit8   For double spacing; extra LF needed
*        sNoDblSpace Bit9   Don't do double spacing
*        sEIRUsave   Bit10  Save bit for Clarke IRC EIRU
*        sNoPRLCD    Bit11  Disable PRLCD (I/O fcn executing)

=IOCsave      EQU (PrtStatus)+3     Save of IOC before change (1)
=LineByteCt   EQU (IOCsave)+1       Line Byte Counter         (2)
=FifoByteCt   EQU (LineByteCt)+2    Sum of FIFO Line Counts   (2)
=LastPrntTime EQU (FifoByteCt)+2    Time (Upper 11 nibs)     (11)
=PFIFO        EQU (LastPrntTime)+11 FIFO Buffer              (16)


=MenuRow	EQU (PFIFO)+16                                (5)
=EqPtr          EQU (MenuRow)+5 Points to Curr Eqn in EqList  (5)

*************************************************************************
*
*	The following seven slots are filled with RomPtrs. The first
*	one is used whenever a key is pressed; the next six are used
*	when the menu is defined by an array of RomPtrs.
*
*	Allocating these seven slots avoids building RomPtrs in TempOb
*	and maintaining updatable pointers to them.
*
*************************************************************************

=KeyRomPtr0	EQU (EqPtr)+5		RomPtr for KeyOb	(11)
=KeyRomPtr1	EQU (KeyRomPtr0)+11	RomPtr for MenuKey 1	(11)
=KeyRomPtr2	EQU (KeyRomPtr1)+11	RomPtr for MenuKey 2	(11)
=KeyRomPtr3	EQU (KeyRomPtr2)+11	RomPtr for MenuKey 3	(11)
=KeyRomPtr4	EQU (KeyRomPtr3)+11	RomPtr for MenuKey 4	(11)
=KeyRomPtr5	EQU (KeyRomPtr4)+11	RomPtr for MenuKey 5	(11)
=KeyRomPtr6	EQU (KeyRomPtr5)+11	RomPtr for MenuKey 6	(11)

=LastMenuRow	EQU (KeyRomPtr6)+11				(5)
*****************************************************************
=SYSUPSIZE EQU (OBUPSIZE)+(LOCUPSIZE)

*****************************************************************
*  N.B.  Size of Rompart Table=[3 + (3+5)*(#Romparts)] is odd.  *
*  We locate ROMPTAB on odd address to guarantee that display   *
*  data which follows the table (and precedes TEMPOB) will      *
*  begin at an even address.  This ensures that for normal      *
*  displays, we don't have to muck with the hardware BITOFFSET  *
*  control register (Display Refresh Control).                  *
*****************************************************************
label1     IFNE  ((LastMenuRow)+5)%2     If next RAM address odd
=RESRAMEND EQU (LastMenuRow)+5
label1     ELSE                          If next RAM address even
=RESRAMEND EQU (LastMenuRow)+6
label1     ENDIF

=ROMPTAB   EQU (RESRAMEND)


*                       Aliases                                 *
*===============================================================*
=ORghost     EQU  SAVE_OR
=DISABLE_KBD EQU  HANDSHK
=KEYBUFFER   EQU  INPUTSTREAM
=VDISP       EQU  VDISP1
=LASTARG     EQU  LASTARG1
*
=CURSOR       EQU  CURSOREPOSN
=CURSORPART   EQU  CURSORROW
=CURSOROFFSET EQU  CURSORPOSN
*****************************************************************
         END