#define KB_ENTER        0x0D
#define KB_DELETE       0x101
#define KB_STO          0x102
#define KB_SIN          0x103
#define KB_COS          0x104
#define KB_TAN          0x105
#define KB_LN           0x106
#define KB_CLEAR        0x107
#define KB_ESC          0x108
#define KB_MENU         0x109
#define KB_MODE         0x10A
#define KB_ON           0x10B
#define KB_F1           0x10C
#define KB_F2           0x10D
#define KB_F3           0x10E
#define KB_F4           0x10F
#define KB_F5           0x110
#define KB_F6           0x111
#define KB_F7           0x112
#define KB_F8           0x113
#define KB_CHS          0x114
#define KB_HOME         KB_OPTION+'Q'
#define KB_YEQ          KB_OPTION+'W'
#define KB_RANGE        KB_OPTION+'E'
#define KB_GRAPH        KB_OPTION+'R'
#define KB_TBLSET       KB_OPTION+'T'
#define KB_TABLE        KB_OPTION+'Y'
#define KB_ENTRY        (KB_2ND+KB_ENTER)
#define KB_SWITCH       (KB_2ND+KB_MENU)
#define KB_C_CED        (KB_2ND+'C')
#define KB_CAPS         (KB_2ND+'Z')
#define KB_TILDE        (KB_2ND+'N')
#define KB_CARET        (KB_2ND+'O')
#define KB_VARLINK      (KB_2ND+'-')
#define KB_CHAR         (KB_2ND+'+')
#define KB_ROOT         (KB_2ND+'*')
#define KB_CATLG        (KB_2ND+'2')
#define KB_CUSTOM       (KB_2ND+'3')
#define KB_SIGMA        (KB_2ND+'4')
#define KB_MATH         (KB_2ND+'5')
#define KB_MEM          (KB_2ND+'6')
#define KB_INTEGRAL     (KB_2ND+'7')
#define KB_DIFF         (KB_2ND+'8')
#define KB_INV_X        (KB_2ND+'9')
#define KB_ANS          (KB_2ND+KB_CHS)
#define KB_ACUTE        (KB_2ND+'E')
#define KB_UMLAUT       (KB_2ND+'U')
#define KB_GRAVE        (KB_2ND+'A')
#define KB_ESZET        (KB_2ND+'S')
#define KB_PGUP         (KB_2ND+KB_UP)
#define KB_PGDN         (KB_2ND+KB_DOWN)
#define KB_BEGIN        (KB_2ND+KB_LEFT)
#define KB_END          (KB_2ND+KB_RIGHT)
#define KB_INSERT       (KB_2ND+KB_DELETE)
#define KB_RCL          (KB_2ND+KB_STO)
#define KB_ASIN         (KB_2ND+KB_SIN)
#define KB_ACOS         (KB_2ND+KB_COS)
#define KB_ATAN         (KB_2ND+KB_TAN)
#define KB_ALN          (KB_2ND+KB_LN)
#define KB_SQRT         (KB_2ND+KB_INV_X)
#define KB_QUIT         (KB_2ND+KB_ESC)
#define KB_OFF          (KB_2ND+KB_ON)
#define KB_TOP          (KB_OPTION+KB_UP)
#define KB_BOTTOM       (KB_OPTION+KB_DOWN)
#define KB_RIGHT_MOST   (KB_OPTION+KB_RIGHT)
#define KB_LEFT_MOST    (KB_OPTION+KB_LEFT)
#define KB_GREEK        (KB_OPTION+'G')
#define KB_COPY         (KB_OPTION+'C')
#define KB_PASTE        (KB_OPTION+'V')
#define KB_CUT          (KB_OPTION+'X')
#define KB_HELP_KEYS    (KB_OPTION+'K')
#define KB_OPEN         (KB_OPTION+'O')
#define KB_SAVE_AS      (KB_OPTION+'S')
#define KB_NEW          (KB_OPTION+'N')
#define KB_FORMAT       (KB_OPTION+'F')
#define KB_UNITS        (KB_OPTION+'P')
#define KB_DELETE_RIGHT (KB_OPTION+KB_DELETE)
#define KB_LEFT         0x151
#define KB_UP           0x152
#define KB_RIGHT        0x154
#define KB_DOWN         0x158
#define KB_MODIFIERS    (KB_2ND|KB_OPTION|KB_SHIFT|KB_DRAG|KB_AUTOREPEAT)
#define LIO_DC          LIO_SPAM
#define W_MIN_Y 18
#define DLG_DEF_TEXT_WIDTH 180
#define DLG_DEF_X0      8
#define ST_SHIFTS    (ST_2ND|ST_OPTION|ST_SHIFT)

#elif defined(_89)
#define MAX_X 159
#define MAX_Y 99
#define TV_PRODUCT      TV_CRAM
#define SC_2ND          (1<<0)
#define SC_SHIFT        (1<<1)
#define SC_DRAG         (1<<1)
#define SC_OPTION       (1<<2)
#define SC_ALPHA        (1<<3)
#define SC_CAPSLOCK     (1<<4)
#define SC_DRAGLOCK     (1<<5)
#define SC_ALPHALOCK    (1<<5)
#define KB_ENTER        0x0D
#define KB_DELETE       0x101
#define KB_STO          0x102
#define KB_CLEAR        0x107
#define KB_ESC          0x108
#define KB_MENU         0x109
#define KB_MODE         0x10A
#define KB_ON           0x10B
#define KB_F1           0x10C
#define KB_F2           0x10D
#define KB_F3           0x10E
#define KB_F4           0x10F
#define KB_F5           0x110
#define KB_F6           0x111
#define KB_F7           0x112
#define KB_F8           0x113
#define KB_CHS          0x114
#define KB_HOME         0x115
#define KB_CATLG        0x116
#define KB_YEQ          KB_OPTION+KB_F1
#define KB_RANGE        KB_OPTION+KB_F2
#define KB_GRAPH        KB_OPTION+KB_F3
#define KB_TBLSET       KB_OPTION+KB_F4
#define KB_TABLE        KB_OPTION+KB_F5
#define KB_ENTRY        (KB_2ND+KB_ENTER)
#define KB_SWITCH       (KB_2ND+KB_MENU)
#define KB_C_CED        (KB_2ND+'C')
#define KB_TILDE        (KB_2ND+'N')
#define KB_CARET        (KB_2ND+'O')
#define KB_VARLINK      (KB_2ND+'-')
#define KB_CHAR         (KB_2ND+'+')
#define KB_ROOT         (KB_2ND+'*')
#define KB_CUSTOM       (KB_2ND+KB_HOME)
#define KB_UNITS        (KB_2ND+'3')
#define KB_MATH         (KB_2ND+'5')
#define KB_MEM          (KB_2ND+'6')
#define KB_INTEGRAL     (KB_2ND+'7')
#define KB_DIFF         (KB_2ND+'8')
#define KB_ANS          (KB_2ND+KB_CHS)
#define KB_ACUTE        (KB_2ND+'E')
#define KB_UMLAUT       (KB_2ND+'U')
#define KB_GRAVE        (KB_2ND+'A')
#define KB_ESZET        (KB_2ND+'S')
#define KB_PGUP         (KB_2ND+KB_UP)
#define KB_PGDN         (KB_2ND+KB_DOWN)
#define KB_BEGIN        (KB_2ND+KB_LEFT)
#define KB_END          (KB_2ND+KB_RIGHT)
#define KB_INSERT       (KB_2ND+KB_DELETE)
#define KB_RCL          (KB_2ND+KB_STO)
#define KB_SIN          (KB_2ND+'Y')
#define KB_COS          (KB_2ND+'Z')
#define KB_TAN          (KB_2ND+'T')
#define KB_LN           (KB_2ND+'X')
#define KB_ASIN         (KB_OPTION+'Y')
#define KB_ACOS         (KB_OPTION+'Z')
#define KB_ATAN         (KB_OPTION+'T')
#define KB_ALN          (KB_OPTION+'X')
#define KB_QUIT         (KB_2ND+KB_ESC)
#define KB_OFF          (KB_2ND+KB_ON)
#define KB_TOP          (KB_OPTION+KB_UP)
#define KB_BOTTOM       (KB_OPTION+KB_DOWN)
#define KB_RIGHT_MOST   (KB_OPTION+KB_RIGHT)
#define KB_LEFT_MOST    (KB_OPTION+KB_LEFT)
#define KB_COPY         (KB_OPTION+KB_SHIFT)
#define KB_PASTE        (KB_OPTION+KB_ESC)
#define KB_CUT          (KB_OPTION+KB_2ND)
#define KB_GREEK        (KB_OPTION+'(')
#define KB_HELP_KEYS    (KB_OPTION+LF_EXPONENT)
#define KB_OPEN         (KB_OPTION+'O')
#define KB_SAVE_AS      (KB_OPTION+'S')
#define KB_NEW          (KB_OPTION+'N')
#define KB_FORMAT       (KB_OPTION+'|')
#define KB_DELETE_RIGHT (KB_OPTION+KB_DELETE)
#define KB_UNDER_SCORE  (KB_OPTION+KB_MODE)
#define KB_INFINITY     (KB_OPTION+KB_CATLG)
#define KB_THETA        (KB_OPTION+'^')
#define KB_AMPER        (KB_OPTION+'*')
#define KB_ATSIGN       (KB_OPTION+KB_STO)
#define KB_EXCLAM       (KB_OPTION+'/')
#define KB_COPYRIGHT    (KB_OPTION+')')
#define KB_CAPS         (KB_SHIFT+KB_ALPHA)
#define KB_ALOCK        (KB_2ND+KB_ALPHA)
#define KB_UP           0x151
#define KB_LEFT         0x152
#define KB_DOWN         0x154
#define KB_RIGHT        0x158
#define KB_MODIFIERS    (KB_2ND|KB_OPTION|KB_SHIFT|KB_DRAG|KB_ALPHA|KB_AUTOREPEAT)