trying to use osso-games-startup as gui
[drnoksnes] / globals.cpp
1 /*
2  * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
3  *
4  * (c) Copyright 1996 - 2001 Gary Henderson (gary.henderson@ntlworld.com) and
5  *                           Jerremy Koot (jkoot@snes9x.com)
6  *
7  * Super FX C emulator code 
8  * (c) Copyright 1997 - 1999 Ivar (ivar@snes9x.com) and
9  *                           Gary Henderson.
10  * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
11  *
12  * DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson.
13  * C4 asm and some C emulation code (c) Copyright 2000 zsKnight and _Demo_.
14  * C4 C code (c) Copyright 2001 Gary Henderson (gary.henderson@ntlworld.com).
15  *
16  * DOS port code contains the works of other authors. See headers in
17  * individual files.
18  *
19  * Snes9x homepage: http://www.snes9x.com
20  *
21  * Permission to use, copy, modify and distribute Snes9x in both binary and
22  * source form, for non-commercial purposes, is hereby granted without fee,
23  * providing that this license information and copyright notice appear with
24  * all copies and any derived work.
25  *
26  * This software is provided 'as-is', without any express or implied
27  * warranty. In no event shall the authors be held liable for any damages
28  * arising from the use of this software.
29  *
30  * Snes9x is freeware for PERSONAL USE only. Commercial users should
31  * seek permission of the copyright holders first. Commercial use includes
32  * charging money for Snes9x or software derived from Snes9x.
33  *
34  * The copyright holders request that bug fixes and improvements to the code
35  * should be forwarded to them so everyone can benefit from the modifications
36  * in future versions.
37  *
38  * Super NES and Super Nintendo Entertainment System are trademarks of
39  * Nintendo Co., Limited and its subsidiary companies.
40  */
41 #include "snes9x.h"
42 #include "memmap.h"
43 #include "ppu.h"
44 #include "dsp1.h"
45 #include "missing.h"
46 #include "cpuexec.h"
47 #include "debug.h"
48 #include "apu.h"
49 #include "dma.h"
50 #include "fxemu.h"
51 #include "gfx.h"
52 #include "soundux.h"
53 #include "cheats.h"
54 #include "sa1.h"
55 // #include "netplay.h" // XXX ?
56
57 START_EXTERN_C
58 char String[513];
59
60 struct Missing missing;
61
62 struct SICPU ICPU;
63
64 struct SCPUState CPU;
65
66 //struct SRegisters Registers;
67
68 struct SAPU APU;
69
70 struct SIAPU IAPU;
71
72 struct SAPURegisters APURegisters;
73
74 struct SSettings Settings;
75
76 struct SDSP1 DSP1;
77
78 struct SSA1Registers SA1Registers;
79
80 struct SSA1 SA1;
81
82
83 uint8 *SRAM = NULL;
84 uint8 *ROM = NULL;
85 uint8 *RegRAM = NULL;
86 uint8 *C4RAM = NULL;
87
88 long OpAddress = 0;
89
90 CMemory Memory;
91
92 struct SSNESGameFixes SNESGameFixes;
93
94 #ifndef ASM_SPC700
95 uint8 A1 = 0, A2 = 0, A3 = 0, A4 = 0, W1 = 0, W2 = 0, W3 = 0, W4 = 0;
96 uint8 Ans8 = 0;
97 uint16 Ans16 = 0;
98 uint32 Ans32 = 0;
99 uint8 Work8 = 0;
100 uint16 Work16 = 0;
101 uint32 Work32 = 0;
102 signed char Int8 = 0;
103 short Int16 = 0;
104 long Int32 = 0;
105 #endif
106
107 END_EXTERN_C
108
109 #ifndef ZSNES_FX
110 struct FxInit_s SuperFX;
111 #else
112 START_EXTERN_C
113 uint8 *SFXPlotTable = NULL;
114 END_EXTERN_C
115 #endif
116
117 struct SPPU PPU;
118 struct InternalPPU IPPU;
119
120 struct SDMA DMA[8];
121
122 uint8 *HDMAMemPointers [8];
123 uint8 *HDMABasePointers [8];
124
125 struct SBG BG;
126
127 struct SGFX GFX;
128 struct SLineData LineData[240];
129 struct SLineMatrixData LineMatrixData [240];
130
131 uint8 Mode7Depths [2];
132 NormalTileRenderer DrawTilePtr = NULL;
133 ClippedTileRenderer DrawClippedTilePtr = NULL;
134 NormalTileRenderer DrawHiResTilePtr = NULL;
135 ClippedTileRenderer DrawHiResClippedTilePtr = NULL;
136 LargePixelRenderer DrawLargePixelPtr = NULL;
137
138 uint32 odd_high[4][16];
139 uint32 odd_low[4][16];
140 uint32 even_high[4][16];
141 uint32 even_low[4][16];
142
143 #ifdef GFX_MULTI_FORMAT
144
145 uint32 RED_LOW_BIT_MASK = RED_LOW_BIT_MASK_RGB565;
146 uint32 GREEN_LOW_BIT_MASK = GREEN_LOW_BIT_MASK_RGB565;
147 uint32 BLUE_LOW_BIT_MASK = BLUE_LOW_BIT_MASK_RGB565;
148 uint32 RED_HI_BIT_MASK = RED_HI_BIT_MASK_RGB565;
149 uint32 GREEN_HI_BIT_MASK = GREEN_HI_BIT_MASK_RGB565;
150 uint32 BLUE_HI_BIT_MASK = BLUE_HI_BIT_MASK_RGB565;
151 uint32 MAX_RED = MAX_RED_RGB565;
152 uint32 MAX_GREEN = MAX_GREEN_RGB565;
153 uint32 MAX_BLUE = MAX_BLUE_RGB565;
154 uint32 SPARE_RGB_BIT_MASK = SPARE_RGB_BIT_MASK_RGB565;
155 uint32 GREEN_HI_BIT = (MAX_GREEN_RGB565 + 1) >> 1;
156 uint32 RGB_LOW_BITS_MASK = (RED_LOW_BIT_MASK_RGB565 | 
157                             GREEN_LOW_BIT_MASK_RGB565 |
158                             BLUE_LOW_BIT_MASK_RGB565);
159 uint32 RGB_HI_BITS_MASK = (RED_HI_BIT_MASK_RGB565 |
160                            GREEN_HI_BIT_MASK_RGB565 |
161                            BLUE_HI_BIT_MASK_RGB565);
162 uint32 RGB_HI_BITS_MASKx2 = (RED_HI_BIT_MASK_RGB565 |
163                              GREEN_HI_BIT_MASK_RGB565 |
164                              BLUE_HI_BIT_MASK_RGB565) << 1;
165 uint32 RGB_REMOVE_LOW_BITS_MASK = ~RGB_LOW_BITS_MASK;
166 uint32 FIRST_COLOR_MASK = FIRST_COLOR_MASK_RGB565;
167 uint32 SECOND_COLOR_MASK = SECOND_COLOR_MASK_RGB565;
168 uint32 THIRD_COLOR_MASK = THIRD_COLOR_MASK_RGB565;
169 uint32 ALPHA_BITS_MASK = ALPHA_BITS_MASK_RGB565;
170 uint32 FIRST_THIRD_COLOR_MASK = 0;
171 uint32 TWO_LOW_BITS_MASK = 0;
172 uint32 HIGH_BITS_SHIFTED_TWO_MASK = 0;
173
174 uint32 current_graphic_format = RGB565;
175 #endif
176
177 uint8 GetBank = 0;
178 struct SCheatData Cheat;
179
180 SoundStatus so;
181 SSoundData SoundData;
182 int Echo [24000];
183 int DummyEchoBuffer [SOUND_BUFFER_SIZE];
184 int MixBuffer [SOUND_BUFFER_SIZE];
185 int EchoBuffer [SOUND_BUFFER_SIZE];
186 int FilterTaps [8];
187 unsigned long Z = 0;
188 int Loop [16];
189
190 uint16 SignExtend [2] = {
191     0x00, 0xff00
192 };
193
194 int HDMA_ModeByteCounts [8] = {
195     1, 2, 2, 4, 4, 0, 0, 0
196 };
197
198 uint8 BitShifts[8][4] =
199 {
200     {2, 2, 2, 2},       // 0
201     {4, 4, 2, 0},       // 1
202     {4, 4, 0, 0},       // 2
203     {8, 4, 0, 0},       // 3
204     {8, 2, 0, 0},       // 4
205     {4, 2, 0, 0},       // 5
206     {4, 0, 0, 0},       // 6
207     {8, 0, 0, 0}        // 7
208 };
209 uint8 TileShifts[8][4] =
210 {
211     {4, 4, 4, 4},       // 0
212     {5, 5, 4, 0},       // 1
213     {5, 5, 0, 0},       // 2
214     {6, 5, 0, 0},       // 3
215     {6, 4, 0, 0},       // 4
216     {5, 4, 0, 0},       // 5
217     {5, 0, 0, 0},       // 6
218     {6, 0, 0, 0}        // 7
219 };
220 uint8 PaletteShifts[8][4] =
221 {
222     {2, 2, 2, 2},       // 0
223     {4, 4, 2, 0},       // 1
224     {4, 4, 0, 0},       // 2
225     {0, 4, 0, 0},       // 3
226     {0, 2, 0, 0},       // 4
227     {4, 2, 0, 0},       // 5
228     {4, 0, 0, 0},       // 6
229     {0, 0, 0, 0}        // 7
230 };
231 uint8 PaletteMasks[8][4] =
232 {
233     {7, 7, 7, 7},       // 0
234     {7, 7, 7, 0},       // 1
235     {7, 7, 0, 0},       // 2
236     {0, 7, 0, 0},       // 3
237     {0, 7, 0, 0},       // 4
238     {7, 7, 0, 0},       // 5
239     {7, 0, 0, 0},       // 6
240     {0, 0, 0, 0}        // 7
241 };
242 uint8 Depths[8][4] =
243 {
244     {TILE_2BIT, TILE_2BIT, TILE_2BIT, TILE_2BIT}, // 0
245     {TILE_4BIT, TILE_4BIT, TILE_2BIT, 0},         // 1
246     {TILE_4BIT, TILE_4BIT, 0, 0},                 // 2
247     {TILE_8BIT, TILE_4BIT, 0, 0},                 // 3
248     {TILE_8BIT, TILE_2BIT, 0, 0},                 // 4
249     {TILE_4BIT, TILE_2BIT, 0, 0},                 // 5
250     {TILE_8BIT, 0, 0, 0},                         // 6
251     {0, 0, 0, 0}                                  // 7
252 };
253 uint8 BGSizes [2] = {
254     8, 16
255 };
256 uint16 DirectColourMaps [8][256];
257
258 long FilterValues[4][2] =
259 {
260     {0, 0},
261     {240, 0},
262     {488, -240},
263     {460, -208}
264 };
265
266 int NoiseFreq [32] = {
267     0, 16, 21, 25, 31, 42, 50, 63, 84, 100, 125, 167, 200, 250, 333,
268     400, 500, 667, 800, 1000, 1300, 1600, 2000, 2700, 3200, 4000,
269     5300, 6400, 8000, 10700, 16000, 32000
270 };
271
272 uint32 HeadMask [4] = {
273 #ifdef LSB_FIRST
274     0xffffffff, 0xffffff00, 0xffff0000, 0xff000000
275 #else
276     0xffffffff, 0x00ffffff, 0x0000ffff, 0x000000ff
277 #endif
278 };
279
280 uint32 TailMask [5] = {
281 #ifdef LSB_FIRST
282     0x00000000, 0x000000ff, 0x0000ffff, 0x00ffffff, 0xffffffff
283 #else
284     0x00000000, 0xff000000, 0xffff0000, 0xffffff00, 0xffffffff
285 #endif
286 };
287
288 START_EXTERN_C
289 uint8 APUROM [64] =
290 {
291     0xCD,0xEF,0xBD,0xE8,0x00,0xC6,0x1D,0xD0,0xFC,0x8F,0xAA,0xF4,0x8F,
292     0xBB,0xF5,0x78,0xCC,0xF4,0xD0,0xFB,0x2F,0x19,0xEB,0xF4,0xD0,0xFC,
293     0x7E,0xF4,0xD0,0x0B,0xE4,0xF5,0xCB,0xF4,0xD7,0x00,0xFC,0xD0,0xF3,
294     0xAB,0x01,0x10,0xEF,0x7E,0xF4,0x10,0xEB,0xBA,0xF6,0xDA,0x00,0xBA,
295     0xF4,0xC4,0xF4,0xDD,0x5D,0xD0,0xDB,0x1F,0x00,0x00,0xC0,0xFF
296 };
297
298 #ifdef NETPLAY_SUPPORT
299 struct SNetPlay NetPlay;
300 #endif
301
302 // Raw SPC700 instruction cycle lengths
303 int32 S9xAPUCycleLengths [256] = 
304 {
305     /*        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */
306     /* 00 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 5, 4, 5, 4, 6, 8, 
307     /* 10 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 6, 5, 2, 2, 4, 6, 
308     /* 20 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 5, 4, 5, 4, 5, 4, 
309     /* 30 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 6, 5, 2, 2, 3, 8, 
310     /* 40 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 4, 4, 5, 4, 6, 6, 
311     /* 50 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 4, 5, 2, 2, 4, 3, 
312     /* 60 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 4, 4, 5, 4, 5, 5, 
313     /* 70 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 5, 5, 2, 2, 3, 6, 
314     /* 80 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 5, 4, 5, 2, 4, 5, 
315     /* 90 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 5, 5, 2, 2,12, 5, 
316     /* a0 */  3, 8, 4, 5, 3, 4, 3, 6, 2, 6, 4, 4, 5, 2, 4, 4, 
317     /* b0 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 5, 5, 2, 2, 3, 4, 
318     /* c0 */  3, 8, 4, 5, 4, 5, 4, 7, 2, 5, 6, 4, 5, 2, 4, 9, 
319     /* d0 */  2, 8, 4, 5, 5, 6, 6, 7, 4, 5, 4, 5, 2, 2, 6, 3, 
320     /* e0 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 4, 5, 3, 4, 3, 4, 3, 
321     /* f0 */  2, 8, 4, 5, 4, 5, 5, 6, 3, 4, 5, 4, 2, 2, 4, 3
322 };
323
324 // Actual data used by CPU emulation, will be scaled by APUReset routine
325 // to be relative to the 65c816 instruction lengths.
326 int32 S9xAPUCycles [256] =
327 {
328     /*        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */
329     /* 00 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 5, 4, 5, 4, 6, 8, 
330     /* 10 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 6, 5, 2, 2, 4, 6, 
331     /* 20 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 5, 4, 5, 4, 5, 4, 
332     /* 30 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 6, 5, 2, 2, 3, 8, 
333     /* 40 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 4, 4, 5, 4, 6, 6, 
334     /* 50 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 4, 5, 2, 2, 4, 3, 
335     /* 60 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 4, 4, 5, 4, 5, 5, 
336     /* 70 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 5, 5, 2, 2, 3, 6, 
337     /* 80 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 6, 5, 4, 5, 2, 4, 5, 
338     /* 90 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 5, 5, 2, 2,12, 5, 
339     /* a0 */  3, 8, 4, 5, 3, 4, 3, 6, 2, 6, 4, 4, 5, 2, 4, 4, 
340     /* b0 */  2, 8, 4, 5, 4, 5, 5, 6, 5, 5, 5, 5, 2, 2, 3, 4, 
341     /* c0 */  3, 8, 4, 5, 4, 5, 4, 7, 2, 5, 6, 4, 5, 2, 4, 9, 
342     /* d0 */  2, 8, 4, 5, 5, 6, 6, 7, 4, 5, 4, 5, 2, 2, 6, 3, 
343     /* e0 */  2, 8, 4, 5, 3, 4, 3, 6, 2, 4, 5, 3, 4, 3, 4, 3, 
344     /* f0 */  2, 8, 4, 5, 4, 5, 5, 6, 3, 4, 5, 4, 2, 2, 4, 3
345 };
346
347 #ifndef VAR_CYCLES
348 uint8 S9xE1M1X1 [256] = {
349         8, 6, 8, 4, 5, 3, 5, 6, 3, 2, 2, 4, 6, 4, 6, 5,         /* e=1, m=1, x=1 */
350         2, 5, 5, 7, 5, 4, 6, 6, 2, 4, 2, 2, 6, 4, 7, 5,
351         6, 6, 8, 4, 3, 3, 5, 6, 4, 2, 2, 5, 4, 4, 6, 5,
352         2, 5, 5, 7, 4, 4, 6, 6, 2, 4, 2, 2, 4, 4, 7, 5,
353         7, 6, 2, 4, 0, 3, 5, 6, 3, 2, 2, 3, 3, 4, 6, 5,
354         2, 5, 5, 7, 0, 4, 6, 6, 2, 4, 3, 2, 4, 4, 7, 5,
355         6, 6, 6, 4, 3, 3, 5, 6, 4, 2, 2, 6, 5, 4, 6, 5,
356         2, 5, 5, 7, 4, 4, 6, 6, 2, 4, 4, 2, 6, 4, 7, 5,
357         2, 6, 3, 4, 3, 3, 3, 6, 2, 2, 2, 3, 4, 4, 4, 5,
358         2, 5, 5, 7, 4, 4, 4, 6, 2, 4, 2, 2, 4, 4, 4, 5,
359         2, 6, 2, 4, 3, 3, 3, 6, 2, 2, 2, 4, 4, 4, 4, 5,
360         2, 5, 5, 7, 4, 4, 4, 6, 2, 4, 2, 2, 4, 4, 4, 5,
361         2, 6, 3, 4, 3, 3, 5, 6, 2, 2, 2, 3, 4, 4, 6, 5,
362         2, 5, 5, 7, 6, 4, 6, 6, 2, 4, 3, 3, 6, 4, 7, 5,
363         2, 6, 3, 4, 3, 3, 5, 6, 2, 2, 2, 3, 4, 4, 6, 5,
364         2, 5, 5, 7, 5, 4, 6, 6, 2, 4, 4, 2, 6, 4, 7, 5
365 };
366
367 uint8 S9xE0M1X1 [256] = {
368         8, 6, 8, 4, 5, 3, 5, 6, 3, 2, 2, 4, 6, 4, 6, 5,         /* e=0, m=1, x=1 */
369         2, 5, 5, 7, 5, 4, 6, 6, 2, 4, 2, 2, 6, 4, 7, 5,
370         6, 6, 8, 4, 3, 3, 5, 6, 4, 2, 2, 5, 4, 4, 6, 5,
371         2, 5, 5, 7, 4, 4, 6, 6, 2, 4, 2, 2, 4, 4, 7, 5,
372         7, 6, 2, 4, 0, 3, 5, 6, 3, 2, 2, 3, 3, 4, 6, 5,
373         2, 5, 5, 7, 0, 4, 6, 6, 2, 4, 3, 2, 4, 4, 7, 5,
374         6, 6, 6, 4, 3, 3, 5, 6, 4, 2, 2, 6, 5, 4, 6, 5,
375         2, 5, 5, 7, 4, 4, 6, 6, 2, 4, 4, 2, 6, 4, 7, 5,
376         2, 6, 3, 4, 3, 3, 3, 6, 2, 2, 2, 3, 4, 4, 4, 5,
377         2, 5, 5, 7, 4, 4, 4, 6, 2, 4, 2, 2, 4, 4, 4, 5,
378         2, 6, 2, 4, 3, 3, 3, 6, 2, 2, 2, 4, 4, 4, 4, 5,
379         2, 5, 5, 7, 4, 4, 4, 6, 2, 4, 2, 2, 4, 4, 4, 5,
380         2, 6, 3, 4, 3, 3, 5, 6, 2, 2, 2, 3, 4, 4, 6, 5,
381         2, 5, 5, 7, 6, 4, 6, 6, 2, 4, 3, 3, 6, 4, 7, 5,
382         2, 6, 3, 4, 3, 3, 5, 6, 2, 2, 2, 3, 4, 4, 6, 5,
383         2, 5, 5, 7, 5, 4, 6, 6, 2, 4, 4, 2, 6, 4, 7, 5
384 };
385
386 uint8 S9xE0M0X1 [256] = {
387         8, 7, 8, 5, 7, 4, 7, 7, 3, 3, 2, 4, 8, 5, 8, 6,         /* e=0, m=0, x=1 */
388         2, 6, 6, 8, 7, 5, 8, 7, 2, 5, 2, 2, 8, 5, 9, 6,
389         6, 7, 8, 5, 4, 4, 7, 7, 4, 3, 2, 5, 5, 5, 8, 6,
390         2, 6, 6, 8, 5, 5, 8, 7, 2, 5, 2, 2, 5, 5, 9, 6,
391         7, 7, 2, 5, 0, 4, 7, 7, 4, 3, 2, 3, 3, 5, 8, 6,
392         2, 6, 6, 8, 0, 5, 8, 7, 2, 5, 3, 2, 4, 5, 9, 6,
393         6, 7, 6, 5, 4, 4, 7, 7, 5, 3, 2, 6, 5, 5, 8, 6,
394         2, 6, 6, 8, 5, 5, 8, 7, 2, 5, 4, 2, 6, 5, 9, 6,
395         2, 7, 3, 5, 3, 4, 3, 7, 2, 3, 2, 3, 4, 5, 4, 6,
396         2, 6, 6, 8, 4, 5, 4, 7, 2, 5, 2, 2, 5, 5, 5, 6,
397         2, 7, 2, 5, 3, 4, 3, 7, 2, 3, 2, 4, 4, 5, 4, 6,
398         2, 6, 6, 8, 4, 5, 4, 7, 2, 5, 2, 2, 4, 5, 4, 6,
399         2, 7, 3, 5, 3, 4, 7, 7, 2, 3, 2, 3, 4, 5, 8, 6,
400         2, 6, 6, 8, 6, 5, 8, 7, 2, 5, 3, 3, 6, 5, 9, 6,
401         2, 7, 3, 5, 3, 4, 7, 7, 2, 3, 2, 3, 4, 5, 8, 6,
402         2, 6, 6, 8, 5, 5, 8, 7, 2, 5, 4, 2, 6, 5, 9, 6
403 };
404
405 uint8 S9xE0M1X0 [256] = {
406         8, 6, 8, 4, 5, 3, 5, 6, 3, 2, 2, 4, 6, 4, 6, 5,         /* e=0, m=1, x=0 */
407         2, 6, 5, 7, 5, 4, 6, 6, 2, 5, 2, 2, 6, 5, 7, 5,
408         6, 6, 8, 4, 3, 3, 5, 6, 4, 2, 2, 5, 4, 4, 6, 5,
409         2, 6, 5, 7, 4, 4, 6, 6, 2, 5, 2, 2, 5, 5, 7, 5,
410         7, 6, 2, 4, 0, 3, 5, 6, 4, 2, 2, 3, 3, 4, 6, 5,
411         2, 6, 5, 7, 0, 4, 6, 6, 2, 5, 4, 2, 4, 5, 7, 5,
412         6, 6, 6, 4, 3, 3, 5, 6, 5, 2, 2, 6, 5, 4, 6, 5,
413         2, 6, 5, 7, 4, 4, 6, 6, 2, 5, 5, 2, 6, 5, 7, 5,
414         2, 6, 3, 4, 4, 3, 4, 6, 2, 2, 2, 3, 5, 4, 5, 5,
415         2, 6, 5, 7, 5, 4, 5, 6, 2, 5, 2, 2, 4, 5, 5, 5,
416         3, 6, 3, 4, 4, 3, 4, 6, 2, 2, 2, 4, 5, 4, 5, 5,
417         2, 6, 5, 7, 5, 4, 5, 6, 2, 5, 2, 2, 5, 5, 5, 5,
418         3, 6, 3, 4, 4, 3, 6, 6, 2, 2, 2, 3, 5, 4, 6, 5,
419         2, 6, 5, 7, 6, 4, 8, 6, 2, 5, 4, 3, 6, 5, 7, 5,
420         3, 6, 3, 4, 4, 3, 6, 6, 2, 2, 2, 3, 5, 4, 6, 5,
421         2, 6, 5, 7, 5, 4, 8, 6, 2, 5, 5, 2, 6, 5, 7, 5
422 };
423
424 uint8 S9xE0M0X0 [256] = {
425         8, 7, 8, 5, 7, 4, 7, 7, 3, 3, 2, 4, 8, 5, 8, 6,         /* e=0, m=0, x=0 */
426         2, 7, 6, 8, 7, 5, 8, 7, 2, 6, 2, 2, 8, 6, 9, 6,
427         6, 7, 8, 5, 4, 4, 7, 7, 4, 3, 2, 5, 5, 5, 8, 6,
428         2, 7, 6, 8, 5, 5, 8, 7, 2, 6, 2, 2, 6, 6, 9, 6,
429         7, 7, 2, 5, 0, 4, 7, 7, 3, 3, 2, 3, 3, 5, 8, 6,
430         2, 7, 6, 8, 0, 5, 8, 7, 2, 6, 4, 2, 4, 6, 9, 6,
431         6, 7, 6, 5, 4, 4, 7, 7, 4, 3, 2, 6, 5, 5, 8, 6,
432         2, 7, 6, 8, 5, 5, 8, 7, 2, 6, 5, 2, 6, 6, 9, 6,
433         2, 7, 3, 5, 4, 4, 4, 7, 2, 3, 2, 3, 5, 5, 5, 6,
434         2, 7, 6, 8, 5, 5, 5, 7, 2, 6, 2, 2, 5, 6, 6, 6,
435         3, 7, 3, 5, 4, 4, 4, 7, 2, 3, 2, 4, 5, 5, 5, 6,
436         2, 7, 6, 8, 5, 5, 5, 7, 2, 6, 2, 2, 5, 6, 5, 6,
437         3, 7, 3, 5, 4, 4, 7, 7, 2, 3, 2, 3, 5, 5, 8, 6,
438         2, 7, 6, 8, 6, 5, 8, 7, 2, 6, 4, 3, 6, 6, 9, 6,
439         3, 7, 3, 5, 4, 4, 7, 7, 2, 3, 2, 3, 5, 5, 8, 6,
440         2, 7, 6, 8, 5, 5, 8, 7, 2, 6, 5, 2, 6, 6, 9, 6
441 };
442 #endif
443
444 END_EXTERN_C