1 #ifndef __COMPAT 2 #define __COMPAT 3 4 #include <default.h> 5 6 /* Begin Auto-Generated Part */ 7 #define KEY_DIAMOND (PSEUDO_CONST_KBD(16384,8192)) 8 #define KEY_DOWN (PSEUDO_CONST_KBD(340,344)) 9 #define KEY_DOWNLEFT (PSEUDO_CONST_KBD(342,345)) 10 #define KEY_LEFT (PSEUDO_CONST_KBD(338,337)) 11 #define KEY_OFF2 (PSEUDO_CONST_KBD(16651,8459)) 12 #define KEY_RIGHT (PSEUDO_CONST_KBD(344,340)) 13 #define KEY_SHIFT (PSEUDO_CONST_KBD(8192,16384)) 14 #define KEY_UP (PSEUDO_CONST_KBD(337,338)) 15 #define KEY_UPRIGHT (PSEUDO_CONST_KBD(345,342)) 16 #define LCD_HEIGHT (PSEUDO_CONST_SCREEN(100,128)) 17 #define LCD_LINE_BYTES (PSEUDO_CONST_SCREEN(20,30)) 18 #define LCD_WIDTH (PSEUDO_CONST_SCREEN(160,240)) 19 #define RR_0 (PSEUDO_CONST_KBD(4,9)),(PSEUDO_CONST_KBD(0,5)) 20 #define RR_1 (PSEUDO_CONST_KBD(4,1)),(PSEUDO_CONST_KBD(1,5)) 21 #define RR_2 (PSEUDO_CONST_KBD(3,1)),(PSEUDO_CONST_KBD(1,6)) 22 #define RR_3 (PSEUDO_CONST_KBD(2,1)),(PSEUDO_CONST_KBD(1,7)) 23 #define RR_4 (PSEUDO_CONST_KBD(4,2)),(PSEUDO_CONST_KBD(2,5)) 24 #define RR_5 (PSEUDO_CONST_KBD(3,2)),(PSEUDO_CONST_KBD(2,6)) 25 #define RR_6 2,(PSEUDO_CONST_KBD(2,7)) 26 #define RR_7 (PSEUDO_CONST_KBD(4,3)),(PSEUDO_CONST_KBD(3,5)) 27 #define RR_8 3,(PSEUDO_CONST_KBD(3,6)) 28 #define RR_9 (PSEUDO_CONST_KBD(2,3)),(PSEUDO_CONST_KBD(3,7)) 29 #define RR_2ND 0,(PSEUDO_CONST_KBD(4,0)) 30 #define RR_A (PSEUDO_CONST_KBD(RR_NO_KEY,9)),(PSEUDO_CONST_KBD(RR_NO_KEY,2)) 31 #define RR_ALPHA (PSEUDO_CONST_KBD(0,RR_NO_KEY)),(PSEUDO_CONST_KBD(7,RR_NO_KEY)) 32 #define RR_APPS (PSEUDO_CONST_KBD(5,7)),(PSEUDO_CONST_KBD(0,6)) 33 #define RR_B (PSEUDO_CONST_KBD(RR_NO_KEY,5)),(PSEUDO_CONST_KBD(RR_NO_KEY,1)) 34 #define RR_BCKSPC (PSEUDO_CONST_KBD(2,8)),(PSEUDO_CONST_KBD(6,0)) 35 #define RR_C (PSEUDO_CONST_KBD(RR_NO_KEY,3)),(PSEUDO_CONST_KBD(RR_NO_KEY,1)) 36 #define RR_CATALOG (PSEUDO_CONST_KBD(3,RR_NO_KEY)),(PSEUDO_CONST_KBD(6,RR_NO_KEY)) 37 #define RR_CLEAR (PSEUDO_CONST_KBD(1,7)),(PSEUDO_CONST_KBD(6,5)) 38 #define RR_COMMA (PSEUDO_CONST_KBD(2,4)),(PSEUDO_CONST_KBD(4,7)) 39 #define RR_COS (PSEUDO_CONST_KBD(RR_NO_KEY,5)),(PSEUDO_CONST_KBD(RR_NO_KEY,6)) 40 #define RR_D (PSEUDO_CONST_KBD(RR_NO_KEY,2)),(PSEUDO_CONST_KBD(RR_NO_KEY,2)) 41 #define RR_DIAMOND 0,(PSEUDO_CONST_KBD(6,1)) 42 #define RR_DIVIDE (PSEUDO_CONST_KBD(1,5)),(PSEUDO_CONST_KBD(4,0)) 43 #define RR_DOT (PSEUDO_CONST_KBD(3,9)),(PSEUDO_CONST_KBD(0,6)) 44 #define RR_DOWN 0,(PSEUDO_CONST_KBD(2,7)) 45 #define RR_E (PSEUDO_CONST_KBD(RR_NO_KEY,2)),(PSEUDO_CONST_KBD(RR_NO_KEY,3)) 46 #define RR_EE (PSEUDO_CONST_KBD(5,RR_NO_KEY)),(PSEUDO_CONST_KBD(2,RR_NO_KEY)) 47 #define RR_ENTER1 (PSEUDO_CONST_KBD(1,9)),(PSEUDO_CONST_KBD(0,1)) 48 #define RR_ENTER2 (PSEUDO_CONST_KBD(1,6)),(PSEUDO_CONST_KBD(0,6)) 49 #define RR_ENTER RR_ENTER1 50 #define RR_EQUALS (PSEUDO_CONST_KBD(5,7)),(PSEUDO_CONST_KBD(4,0)) 51 #define RR_ESC (PSEUDO_CONST_KBD(6,8)),(PSEUDO_CONST_KBD(0,6)) 52 #define RR_F1 (PSEUDO_CONST_KBD(5,6)),(PSEUDO_CONST_KBD(7,4)) 53 #define RR_F2 4,(PSEUDO_CONST_KBD(7,4)) 54 #define RR_F3 (PSEUDO_CONST_KBD(3,2)),(PSEUDO_CONST_KBD(7,4)) 55 #define RR_F4 (PSEUDO_CONST_KBD(2,9)),(PSEUDO_CONST_KBD(7,4)) 56 #define RR_F5 (PSEUDO_CONST_KBD(1,7)),(PSEUDO_CONST_KBD(7,4)) 57 #define RR_F6 (PSEUDO_CONST_KBD(RR_NO_KEY,5)),(PSEUDO_CONST_KBD(RR_NO_KEY,4)) 58 #define RR_F7 (PSEUDO_CONST_KBD(RR_NO_KEY,3)),(PSEUDO_CONST_KBD(RR_NO_KEY,4)) 59 #define RR_F8 (PSEUDO_CONST_KBD(RR_NO_KEY,1)),(PSEUDO_CONST_KBD(RR_NO_KEY,4)) 60 #define RR_F (PSEUDO_CONST_KBD(RR_NO_KEY,3)),(PSEUDO_CONST_KBD(RR_NO_KEY,2)) 61 #define RR_G (PSEUDO_CONST_KBD(RR_NO_KEY,4)),(PSEUDO_CONST_KBD(RR_NO_KEY,2)) 62 #define RR_H (PSEUDO_CONST_KBD(RR_NO_KEY,5)),(PSEUDO_CONST_KBD(RR_NO_KEY,2)) 63 #define RR_HAND (PSEUDO_CONST_KBD(RR_NO_KEY,0)),(PSEUDO_CONST_KBD(RR_NO_KEY,3)) 64 #define RR_HOME (PSEUDO_CONST_KBD(5,RR_NO_KEY)),(PSEUDO_CONST_KBD(6,RR_NO_KEY)) 65 #define RR_I (PSEUDO_CONST_KBD(RR_NO_KEY,7)),(PSEUDO_CONST_KBD(RR_NO_KEY,3)) 66 #define RR_J (PSEUDO_CONST_KBD(RR_NO_KEY,6)),(PSEUDO_CONST_KBD(RR_NO_KEY,2)) 67 #define RR_K (PSEUDO_CONST_KBD(RR_NO_KEY,7)),(PSEUDO_CONST_KBD(RR_NO_KEY,2)) 68 #define RR_L (PSEUDO_CONST_KBD(RR_NO_KEY,8)),(PSEUDO_CONST_KBD(RR_NO_KEY,2)) 69 #define RR_LEFT 0,(PSEUDO_CONST_KBD(1,4)) 70 #define RR_LN (PSEUDO_CONST_KBD(RR_NO_KEY,6)),(PSEUDO_CONST_KBD(RR_NO_KEY,5)) 71 #define RR_M (PSEUDO_CONST_KBD(RR_NO_KEY,7)),(PSEUDO_CONST_KBD(RR_NO_KEY,1)) 72 #define RR_MINUS (PSEUDO_CONST_KBD(1,9)),(PSEUDO_CONST_KBD(2,0)) 73 #define RR_MODE (PSEUDO_CONST_KBD(4,8)),(PSEUDO_CONST_KBD(6,5)) 74 #define RR_MULTIPLY (PSEUDO_CONST_KBD(1,7)),(PSEUDO_CONST_KBD(3,7)) 75 #define RR_N (PSEUDO_CONST_KBD(RR_NO_KEY,6)),(PSEUDO_CONST_KBD(RR_NO_KEY,1)) 76 #define RR_NEGATE (PSEUDO_CONST_KBD(2,9)),(PSEUDO_CONST_KBD(0,7)) 77 #define RR_NO_KEY 0xF 78 #define RR_O (PSEUDO_CONST_KBD(RR_NO_KEY,8)),(PSEUDO_CONST_KBD(RR_NO_KEY,3)) 79 #define RR_P (PSEUDO_CONST_KBD(RR_NO_KEY,6)),(PSEUDO_CONST_KBD(RR_NO_KEY,7)) 80 #define RR_PAREN_CLOSE (PSEUDO_CONST_KBD(3,4)),(PSEUDO_CONST_KBD(4,6)) 81 #define RR_PAREN_OPEN 4,(PSEUDO_CONST_KBD(4,5)) 82 #define RR_PLUS (PSEUDO_CONST_KBD(1,8)),(PSEUDO_CONST_KBD(1,4)) 83 #define RR_POWER (PSEUDO_CONST_KBD(1,6)),(PSEUDO_CONST_KBD(5,0)) 84 #define RR_Q (PSEUDO_CONST_KBD(RR_NO_KEY,9)),(PSEUDO_CONST_KBD(RR_NO_KEY,3)) 85 #define RR_R (PSEUDO_CONST_KBD(RR_NO_KEY,3)),(PSEUDO_CONST_KBD(RR_NO_KEY,3)) 86 #define RR_RIGHT 0,(PSEUDO_CONST_KBD(3,6)) 87 #define RR_S (PSEUDO_CONST_KBD(RR_NO_KEY,1)),(PSEUDO_CONST_KBD(RR_NO_KEY,2)) 88 #define RR_SHIFT 0,(PSEUDO_CONST_KBD(5,2)) 89 #define RR_SIN (PSEUDO_CONST_KBD(RR_NO_KEY,5)),(PSEUDO_CONST_KBD(RR_NO_KEY,5)) 90 #define RR_SPACE (PSEUDO_CONST_KBD(RR_NO_KEY,4)),(PSEUDO_CONST_KBD(RR_NO_KEY,0)) 91 #define RR_STORE (PSEUDO_CONST_KBD(5,3)),(PSEUDO_CONST_KBD(1,0)) 92 #define RR_T (PSEUDO_CONST_KBD(2,4)),(PSEUDO_CONST_KBD(5,3)) 93 #define RR_TAN (PSEUDO_CONST_KBD(RR_NO_KEY,5)),(PSEUDO_CONST_KBD(RR_NO_KEY,7)) 94 #define RR_THETA (PSEUDO_CONST_KBD(RR_NO_KEY,8)),(PSEUDO_CONST_KBD(RR_NO_KEY,1)) 95 #define RR_U (PSEUDO_CONST_KBD(RR_NO_KEY,6)),(PSEUDO_CONST_KBD(RR_NO_KEY,3)) 96 #define RR_UP 0,(PSEUDO_CONST_KBD(0,5)) 97 #define RR_V (PSEUDO_CONST_KBD(RR_NO_KEY,4)),(PSEUDO_CONST_KBD(RR_NO_KEY,1)) 98 #define RR_W (PSEUDO_CONST_KBD(RR_NO_KEY,1)),(PSEUDO_CONST_KBD(RR_NO_KEY,3)) 99 #define RR_WITH (PSEUDO_CONST_KBD(5,RR_NO_KEY)),(PSEUDO_CONST_KBD(3,RR_NO_KEY)) 100 #define RR_X (PSEUDO_CONST_KBD(5,2)),(PSEUDO_CONST_KBD(5,1)) 101 #define RR_Y (PSEUDO_CONST_KBD(4,5)),(PSEUDO_CONST_KBD(5,3)) 102 #define RR_Z (PSEUDO_CONST_KBD(3,1)),(PSEUDO_CONST_KBD(5,1)) 103 #define TI89_CLASSIC (TI89&&HW_VERSION<3) 104 #define TI89_TITANIUM (TI89&&HW_VERSION>=3) 105 #define TI89 (CALCULATOR==0) 106 #define TI92PLUS (CALCULATOR==1) 107 #define V200 (CALCULATOR==3) 108 #define PSEUDO_CONST_CALC(calc92,calc89,calc92plus,calcv200) (CALCULATOR?((CALCULATOR==1)?(calc92plus):(calcv200)):(calc89)) 109 #define PSEUDO_CONST_KBD(kbd89,kbd92) PSEUDO_CONST_CALC(kbd92,kbd89,kbd92,kbd92) 110 #define PSEUDO_CONST_SCREEN(screen89,screen92) PSEUDO_CONST_CALC(screen92,screen89,screen92,screen92) 111 /* End Auto-Generated Part */ 112 113 #ifdef DOORS 114 #define _CALCULATOR _ram_call (0,const unsigned char*) 115 #define HW_VERSION ((unsigned short)(_CALCULATOR[1])) 116 #else /* !DOORS */ 117 unsigned short __get_hw_version(void) __attribute__((const)); 118 #define HW_VERSION (__get_hw_version()) 119 #endif /* !DOORS */ 120 121 #if defined (_TI89_ONLY) 122 #define ROM_base ((void*)(((unsigned long)__jmp_tbl)&0xE00000)) 123 #define CALCULATOR 0 124 #elif defined (_TI92PLUS_ONLY) 125 #define ROM_base ((void*)0x400000) 126 #define CALCULATOR 1 127 #elif defined (_V200_ONLY) 128 #define ROM_base ((void*)(((unsigned long)__jmp_tbl)&0xE00000)) 129 #define CALCULATOR 3 130 #else /* not only one calculator */ 131 132 #ifdef DOORS 133 134 #define ROM_base _ram_call (3,const void*) 135 /* PreOs 0.70 says CALCULATOR is -1 on the Titanium. We don't. */ 136 #define CALCULATOR ((signed char)_CALCULATOR[0]>0?_CALCULATOR[0]:0) 137 138 #undef LCD_WIDTH 139 #define LCD_WIDTH _ram_call (1,unsigned long) 140 #undef LCD_HEIGHT 141 #define LCD_HEIGHT _ram_call (2,unsigned long) 142 #undef LCD_LINE_BYTES 143 #define LCD_LINE_BYTES _ram_call (4,unsigned long) 144 145 #undef KEY_LEFT 146 #define KEY_LEFT _ram_call (5,unsigned long) 147 #undef KEY_RIGHT 148 #define KEY_RIGHT _ram_call (6,unsigned long) 149 #undef KEY_UP 150 #define KEY_UP _ram_call (7,unsigned long) 151 #undef KEY_DOWN 152 #define KEY_DOWN _ram_call (8,unsigned long) 153 #undef KEY_UPRIGHT 154 #define KEY_UPRIGHT _ram_call (9,unsigned long) 155 #undef KEY_DOWNLEFT 156 #define KEY_DOWNLEFT _ram_call (A,unsigned long) 157 #undef KEY_DIAMOND 158 #define KEY_DIAMOND _ram_call (B,unsigned long) 159 #undef KEY_SHIFT 160 #define KEY_SHIFT _ram_call (D,unsigned long) 161 162 #else /* !DOORS */ 163 164 #define ROM_base ((void*)(((unsigned long)__jmp_tbl)&0xE00000)) 165 166 #ifdef NO_CALC_DETECT 167 168 #ifdef USE_V200 169 #define CALCULATOR (ROM_base==(void*)0x400000?1:(((unsigned char*)(_rom_call_addr(2F)))[2]>=200?3:0)) 170 #else 171 #define CALCULATOR (ROM_base==(void*)0x400000) 172 #endif 173 174 #else /* !NO_CALC_DETECT */ 175 176 extern const short __calculator; 177 #ifdef USE_TI89 178 #define CALCULATOR (__calculator) 179 #else /* !USE_TI89 */ 180 /* Special optimization: __calculator cannot be 0 */ 181 #define CALCULATOR (__calculator==3?3:1) 182 #endif /* !USE_TI89 */ 183 184 #endif /* !NO_CALC_DETECT */ 185 186 #endif /* !DOORS */ 187 188 #ifdef OPTIMIZE_CALC_CONSTS 189 #undef PSEUDO_CONST_CALC 190 #define PSEUDO_CONST_CALC(calc92,calc89,calc92plus,calcv200) ({extern void __ld_calc_const_##calc92##_##calc89##_##calc92plus##_##calcv200;(unsigned short)&__ld_calc_const_##calc92##_##calc89##_##calc92plus##_##calcv200;}) 191 #endif /* OPTIMIZE_CALC_CONSTS */ 192 193 #endif /* not only one calculator */ 194 195 #pragma GCC poison TI92 196 //#define TI92 (CALCULATOR==2) 197 198 #endif 199