Previous 15994 Revisions Next

r1335 Monday 26th November, 2007 at 01:00:11 UTC by Nathan Woods
Updated to MAME 0.121u1 core
[ROOT]makefile makefile.mes
[docs]messnew.txt
[src/emu]clifront.c emupal.c emupal.h mame.c mame.h sndintrf.c uimenu.c uitext.c
[src/emu/cpu]cpu.mak
[src/emu/cpu/adsp2100]adsp2100.c
[src/emu/cpu/alph8201]alph8201.c
[src/emu/cpu/cop400]cop400.h
[src/emu/cpu/cp1610]cp1610.c
[src/emu/cpu/e132xs]e132xs.c e132xs.h e132xsop.c*
[src/emu/cpu/f8]f8.c
[src/emu/cpu/h83002]h8periph.c
[src/emu/cpu/hd6309]hd6309.c
[src/emu/cpu/i386]i386.c
[src/emu/cpu/i8039]i8039.c
[src/emu/cpu/i8085]i8085.c
[src/emu/cpu/i86]i286.c i86.c
[src/emu/cpu/i8x41]i8x41.c
[src/emu/cpu/konami]konami.c
[src/emu/cpu/m37710]m37710.c
[src/emu/cpu/m6800]m6800.c
[src/emu/cpu/m68000]m68kmame.h
[src/emu/cpu/mips]mips3drc.c
[src/emu/cpu/nec]nec.c
[src/emu/cpu/pic16c5x]pic16c5x.c
[src/emu/cpu/powerpc]ppc403.c ppcdrc.c
[src/emu/cpu/saturn]saturn.c
[src/emu/cpu/sh2]sh2.c
[src/emu/cpu/sh4]sh4.c
[src/emu/cpu/sharc]sharc.c sharcdsm.c
[src/emu/cpu/t11]t11dasm.c
[src/emu/cpu/tlcs90]tlcs90.c
[src/emu/cpu/tms32025]tms32025.c
[src/emu/cpu/tms32031]tms32031.c
[src/emu/cpu/tms32051]dis32051.c tms32051.c
[src/emu/cpu/tms34010]34010dsm.c
[src/emu/cpu/upd7810]upd7810.c
[src/emu/cpu/v30mz]v30mz.c
[src/emu/cpu/v810]v810.c
[src/emu/cpu/z180]z180.c
[src/emu/cpu/z8000]z8000.c
[src/emu/debug]debugcpu.c
[src/emu/machine]tmp68301.c
[src/emu/sound]3812intf.h astrocde.c ics2115.c iremga20.c k053260.c msm5232.c nes_apu.c pokey.c qsound.c s14001a.c scsp.c tms36xx.c ymz280b.c
[src/lib/util]chd.c
[src/mame]mamedriv.c
[src/mame/drivers]acefruit.c atarifb.c boxer.c bsktball.c canyon.c cherrym.c cischeat.c decocass.c dgpix.c dlair.c eolith16.c exidy.c f-32.c fgoal.c firetrk.c gstream.c lazercmd.c limenko.c malzak.c megadriv.c megatech.c mexico86.c mogura.c namcos86.c pasha2.c segas32.c snk.c tmaster.c turbo.c vamphalf.c
[src/mame/includes]exidy.h firetrk.h
[src/mame/machine]fddebug.c kaneko16.c scudsp.c
[src/mame/video]bankp.c bosco.c canyon.c decocass.c digdug.c equites.c exidy.c exidy440.c fgoal.c firetrk.c galaga.c galaxian.c gaplus.c lazercmd.c malzak.c mappy.c namcos22.c namcos86.c nycaptor.c pacland.c pacman.c pastelg.c polepos.c segasyse.c slapfght.c toaplan1.c toaplan2.c toypop.c twincobr.c vulgus.c xevious.c
[src/mess/drivers]astrocde.c

makefile.mes
r1334r1335
9191# uncomment one of the next lines to build a target-optimized build
9292# NATIVE = 1
9393# ATHLON = 1
94# AMD64 = 1
9495# I686 = 1
9596# P4 = 1
9697# PM = 1
97# AMD64 = 1
98# CORE2 = 1
9899# G4 = 1
99100# G5 = 1
100101# CELL = 1
r1334r1335
197198ARCH = -march=native
198199endif
199200
200# architecture-specific builds get extra options
201201ifdef ATHLON
202202SUFFIX = at
203203ARCH = -march=athlon
204204endif
205205
206ifdef AMD64
207SUFFIX = 64
208ARCH = -march=athlon64
209endif
210
206211ifdef I686
207212SUFFIX = pp
208213ARCH = -march=pentiumpro
r1334r1335
213218ARCH = -march=pentium4
214219endif
215220
216ifdef AMD64
217SUFFIX = 64
218ARCH = -march=athlon64
219endif
220
221221ifdef PM
222222SUFFIX = pm
223ARCH = -march=pentium3 -msse2
223ARCH = -march=pentium-m
224224endif
225225
226ifdef CORE2
227SUFFIX = c2
228ARCH = -march=pentium-m -msse3
229endif
230
226231ifdef G4
227232SUFFIX = g4
228233ARCH = -mcpu=G4
r1334r1335
242247endif
243248
244249
250
245251#-------------------------------------------------
246252# form the name of the executable
247253#-------------------------------------------------
src/mame/machine/scudsp.c
r1334r1335
12431243   dsp_dasm_prefix( DMA_Command[(op & 0x3000) >> 12], buffer, data );
12441244}
12451245
1246void dsp_dasm_opcode( UINT32 op, char *buffer )
1246static void dsp_dasm_opcode( UINT32 op, char *buffer )
12471247{
12481248   switch( (op & 0xc0000000) >> 30 )
12491249   {
src/mame/machine/fddebug.c
r1334r1335
258258static void set_default_key_params(void);
259259static void load_overlay_file(void);
260260static void save_overlay_file(void);
261void fd1094_regenerate_key(void);
261static void fd1094_regenerate_key(void);
262262
263263static int instruction_hook(offs_t curpc);
264264
src/mame/machine/kaneko16.c
r1334r1335
311311    - Supply code snippets to the 68000
312312*/
313313
314void calc3_mcu_run(void)
314static void calc3_mcu_run(void)
315315{
316316   UINT16 mcu_command;
317317
src/mame/mamedriv.c
r1334r1335
36323632   DRIVER( titlef )   /* (c) 1992 (World) */
36333633   DRIVER( titlefu )   /* (c) 1992 (US) */
36343634   DRIVER( scross )   /* (c) 1992 (World) */
3635   DRIVER( scrossu )   /* (c) 1992 (World) */
36353636
36363637   /* Model 1 Games */
36373638   DRIVER( vf )      /* (c) 1993 */
r1334r1335
53675368   DRIVER( choppera )   /* A7003 'KK' (c) 1988 */
53685369   DRIVER( chopperb )   /* A7003 'KK' (c) 1988 */
53695370   DRIVER( legofair )   /* A7003 'KK' (c) 1988 */
5370   DRIVER( ftsoccer )   /*            (c) 1988 */
5371   DRIVER( fsoccer )   /* A6006 'FS' (c) 1988 */
5372   DRIVER( fsoccerb )   /*            (c) 1988 */
53715373   DRIVER( tdfever )   /* A6006 'TD' (c) 1987 */
53725374   DRIVER( tdfeverj )   /* A6006 'TD' (c) 1987 */
53735375   DRIVER( tdfever2 )   /* A6006 'TD'?(c) 1988 */
src/mame/includes/firetrk.h
r1334r1335
3838
3939extern int firetrk_game;
4040
41extern UINT32 firetrk_color1_mask;
42extern UINT32 firetrk_color2_mask;
4143
44
4245/*----------- defined in audio/firetrk.c -----------*/
4346
4447WRITE8_HANDLER( firetrk_skid_reset_w );
src/mame/includes/exidy.h
r1334r1335
5252
5353/*----------- defined in video/exidy.c -----------*/
5454
55#define PALETTE_LEN 8
56#define COLORTABLE_LEN 20
57
5855extern UINT8 *exidy_characterram;
59extern UINT8 *exidy_palette;
60extern UINT16 *exidy_colortable;
6156
62extern UINT8 sidetrac_palette[];
63extern UINT8 targ_palette[];
64extern UINT8 spectar_palette[];
65extern UINT16 exidy_1bpp_colortable[];
66extern UINT16 exidy_2bpp_colortable[];
67
6857extern UINT8 exidy_collision_mask;
6958extern UINT8 exidy_collision_invert;
7059
71PALETTE_INIT( exidy );
60extern UINT8 exidy_color_latch[3];
61
7262VIDEO_START( exidy );
7363VIDEO_EOF( exidy );
7464VIDEO_UPDATE( exidy );
src/mame/video/nycaptor.c
r1334r1335
203203
204204#define mKEY_MASK(x,y) if (input_code_pressed_once(x)){nycaptor_mask|=y;tilemap_mark_all_tiles_dirty( bg_tilemap );}
205205
206void nycaptor_setmask(void)
206static void nycaptor_setmask(void)
207207{
208208  mKEY_MASK(KEYCODE_Q,1); /* bg */
209209  mKEY_MASK(KEYCODE_W,2);
src/mame/video/xevious.c
r1334r1335
1717static tilemap *fg_tilemap,*bg_tilemap;
1818static INT32 xevious_bs[2];
1919
20static colortable *xevious_colortable;
21
2220/***************************************************************************
2321
2422  Convert the color PROMs into a more useable format.
r1334r1335
3937   int i;
4038   #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
4139
42   xevious_colortable = colortable_alloc(machine, 128+1);
40   machine->colortable = colortable_alloc(machine, 128+1);
4341
4442   for (i = 0;i < 128;i++)
4543   {
r1334r1335
6462      bit3 = (color_prom[2*256] >> 3) & 0x01;
6563      b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
6664
67      colortable_palette_set_color(xevious_colortable,i,MAKE_RGB(r,g,b));
65      colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
6866      color_prom++;
6967   }
7068
7169   /* color 0x80 is used by sprites to mark transparency */
72   colortable_palette_set_color(xevious_colortable,0x80,MAKE_RGB(0,0,0));
70   colortable_palette_set_color(machine->colortable,0x80,MAKE_RGB(0,0,0));
7371
7472   color_prom += 128;  /* the bottom part of the PROM is unused */
7573   color_prom += 2*256;
r1334r1335
7876   /* background tiles */
7977   for (i = 0;i < TOTAL_COLORS(1);i++)
8078   {
81      colortable_entry_set_value(xevious_colortable, machine->gfx[1]->color_base + i,
79      colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + i,
8280            (color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(1)] & 0x0f) << 4));
8381
8482      color_prom++;
r1334r1335
9088   {
9189      int c = (color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(2)] & 0x0f) << 4);
9290
93      colortable_entry_set_value(xevious_colortable, machine->gfx[2]->color_base + i,
91      colortable_entry_set_value(machine->colortable, machine->gfx[2]->color_base + i,
9492            (c & 0x80) ? (c & 0x7f) : 0x80);
9593
9694      color_prom++;
r1334r1335
10098   /* foreground characters */
10199   for (i = 0;i < TOTAL_COLORS(0);i++)
102100   {
103      colortable_entry_set_value(xevious_colortable, machine->gfx[0]->color_base + i,
101      colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i,
104102            (i % 2 != 0) ? (i / 2) : 0x80);
105103   }
106104}
r1334r1335
111109{
112110   int i;
113111
114   xevious_colortable = colortable_alloc(machine, 128+1);
112   machine->colortable = colortable_alloc(machine, 128+1);
115113
116114   for (i = 0;i < 128;i++)
117115   {
r1334r1335
136134      bit3 = (color_prom[2*256] >> 3) & 0x01;
137135      b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
138136
139      colortable_palette_set_color(xevious_colortable,i,MAKE_RGB(r,g,b));
137      colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
140138      color_prom++;
141139   }
142140
143141   /* color 0x80 is used by sprites to mark transparency */
144   colortable_palette_set_color(xevious_colortable,0x80,MAKE_RGB(0,0,0));
142   colortable_palette_set_color(machine->colortable,0x80,MAKE_RGB(0,0,0));
145143
146144   color_prom += 128;  /* the bottom part of the PROM is unused */
147145   color_prom += 2*256;
r1334r1335
150148   /* background tiles */
151149   for (i = 0;i < TOTAL_COLORS(1);i++)
152150   {
153      colortable_entry_set_value(xevious_colortable, machine->gfx[1]->color_base + i,
151      colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + i,
154152            (color_prom[0] & 0x0f) | ((color_prom[0x400] & 0x0f) << 4));
155153
156154      color_prom++;
r1334r1335
162160   {
163161      int c = (color_prom[0] & 0x0f) | ((color_prom[0x400] & 0x0f) << 4);
164162
165      colortable_entry_set_value(xevious_colortable, machine->gfx[2]->color_base + i,
163      colortable_entry_set_value(machine->colortable, machine->gfx[2]->color_base + i,
166164            (c & 0x80) ? (c & 0x7f) : 0x80);
167165
168166      color_prom++;
r1334r1335
171169   /* foreground characters */
172170   for (i = 0;i < TOTAL_COLORS(0);i++)
173171   {
174      colortable_entry_set_value(xevious_colortable, machine->gfx[0]->color_base + i,
172      colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i,
175173            (i % 2 != 0) ? (i / 2) : 0x80);
176174   }
177175}
r1334r1335
460458         sx = spriteram_2[offs + 1] - 40 + 0x100*(spriteram_3[offs + 1] & 1);
461459         sy = 28*8-spriteram_2[offs]-1;
462460
463         transmask = colortable_get_transpen_mask(xevious_colortable, machine->gfx[bank], color, 0x80);
461         transmask = colortable_get_transpen_mask(machine->colortable, machine->gfx[bank], color, 0x80);
464462
465463         if (spriteram_3[offs] & 2)  /* double height (?) */
466464         {
src/mame/video/fgoal.c
r1334r1335
9696      {
9797         if (y < 256 && x < 256)
9898         {
99            *BITMAP_ADDR16(fgbitmap, y, x) = 0x38;
99            *BITMAP_ADDR16(fgbitmap, y, x) = 128 + 16;
100100         }
101101      }
102102   }
src/mame/video/twincobr.c
r1334r1335
412412
413413
414414#ifdef MAME_DEBUG
415void twincobr_log_vram(void)
415static void twincobr_log_vram(void)
416416{
417417   if ( input_code_pressed(KEYCODE_M) )
418418   {
src/mame/video/gaplus.c
r1334r1335
1313UINT8 *gaplus_spriteram;
1414
1515static tilemap *bg_tilemap;
16static colortable *gaplus_colortable;
1716
1817
1918/***************************************************************************
r1334r1335
3433   int i;
3534
3635   /* allocate the colortable */
37   gaplus_colortable = colortable_alloc(machine, 256);
36   machine->colortable = colortable_alloc(machine, 256);
3837
3938   for (i = 0;i < 256;i++)
4039   {
r1334r1335
5958      bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
6059      b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
6160
62      colortable_palette_set_color(gaplus_colortable,i,MAKE_RGB(r,g,b));
61      colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
6362   }
6463
6564   color_prom += 0x300;
r1334r1335
6766
6867   /* characters use colors 0xf0-0xff */
6968   for (i = 0;i < machine->gfx[0]->total_colors * machine->gfx[0]->color_granularity;i++)
70      colortable_entry_set_value(gaplus_colortable, machine->gfx[0]->color_base + i, 0xf0 + (*color_prom++ & 0x0f));
69      colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, 0xf0 + (*color_prom++ & 0x0f));
7170
7271   /* sprites */
7372   for (i = 0;i < machine->gfx[1]->total_colors * machine->gfx[1]->color_granularity;i++)
7473   {
75      colortable_entry_set_value(gaplus_colortable, machine->gfx[1]->color_base + i, (color_prom[0] & 0x0f) + ((color_prom[0x200] & 0x0f) << 4));
74      colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + i, (color_prom[0] & 0x0f) + ((color_prom[0x200] & 0x0f) << 4));
7675      color_prom++;
7776   }
7877}
r1334r1335
198197{
199198   bg_tilemap = tilemap_create(get_tile_info,tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,28);
200199
201   colortable_configure_tilemap_groups(gaplus_colortable, bg_tilemap, machine->gfx[0], 0xff);
200   colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 0xff);
202201
203202   spriteram = gaplus_spriteram + 0x780;
204203   spriteram_2 = spriteram + 0x800;
r1334r1335
311310                  flipx,flipy,
312311                  sx + 16*x,sy + 16*y,
313312                  cliprect,TRANSPARENCY_PENS,
314                  colortable_get_transpen_mask(gaplus_colortable, machine->gfx[1], color, 0xff));
313                  colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0xff));
315314            }
316315         }
317316      }
src/mame/video/malzak.c
r1334r1335
206206            sx+=256;
207207
208208         drawgfx(bitmap,machine->gfx[0],field[x*16 + y].code,7,0,0,
209         sx, sy, &machine->screen[0].visarea, TRANSPARENCY_COLOR, 0);
209            sx, sy, &machine->screen[0].visarea, TRANSPARENCY_PEN, 0);
210210      }
211211
212212   // S2636 - Sprites / Collision detection (x2)
src/mame/video/polepos.c
r1334r1335
1515
1616static UINT16 road16_vscroll;
1717
18static colortable *polepos_colortable;
1918static tilemap *bg_tilemap,*tx_tilemap;
2019static int polepos_chacl;
2120
r1334r1335
4140   int i, j;
4241
4342   /* allocate the colortable */
44   polepos_colortable = colortable_alloc(machine, 128);
43   machine->colortable = colortable_alloc(machine, 128);
4544
4645   /*******************************************************
4746     * Color PROMs
r1334r1335
8786      bit3 = (color_prom[0x200 + i] >> 3) & 1;
8887      b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
8988
90      colortable_palette_set_color(polepos_colortable,i,MAKE_RGB(r,g,b));
89      colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
9190   }
9291
9392   /*******************************************************
r1334r1335
9897   for (i = 0; i < 64*4; i++)
9998   {
10099      int color = color_prom[0x300 + i];
101      colortable_entry_set_value(polepos_colortable, 0x0000 + i, (color != 15) ? (0x020 + color) : 0x2f);
102      colortable_entry_set_value(polepos_colortable, 0x0100 + i, (color != 15) ? (0x060 + color) : 0x2f);
100      colortable_entry_set_value(machine->colortable, 0x0000 + i, (color != 15) ? (0x020 + color) : 0x2f);
101      colortable_entry_set_value(machine->colortable, 0x0100 + i, (color != 15) ? (0x060 + color) : 0x2f);
103102   }
104103
105104   /*******************************************************
r1334r1335
111110   for (i = 0; i < 64*4; i++)
112111   {
113112      int color = color_prom[0x400 + i];
114      colortable_entry_set_value(polepos_colortable, 0x0200 + i, 0x000 + color);
113      colortable_entry_set_value(machine->colortable, 0x0200 + i, 0x000 + color);
115114   }
116115
117116   /*******************************************************
r1334r1335
122121   for (i = 0; i < 64*16; i++)
123122   {
124123      int color = color_prom[0xc00 + i];
125      colortable_entry_set_value(polepos_colortable, 0x0300 + i, (color != 15) ? (0x010 + color) : 0x1f);
126      colortable_entry_set_value(polepos_colortable, 0x0700 + i, (color != 15) ? (0x050 + color) : 0x1f);
124      colortable_entry_set_value(machine->colortable, 0x0300 + i, (color != 15) ? (0x010 + color) : 0x1f);
125      colortable_entry_set_value(machine->colortable, 0x0700 + i, (color != 15) ? (0x050 + color) : 0x1f);
127126   }
128127
129128   /*******************************************************
r1334r1335
135134   for (i = 0; i < 64*16; i++)
136135   {
137136      int color = color_prom[0x800 + i];
138      colortable_entry_set_value(polepos_colortable, 0x0b00 + i, 0x040 + color);
137      colortable_entry_set_value(machine->colortable, 0x0b00 + i, 0x040 + color);
139138   }
140139
141140   /* 136014-142, 136014-143, 136014-144 Vertical position modifiers */
r1334r1335
205204   bg_tilemap = tilemap_create(bg_get_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,8,8,64,16);
206205   tx_tilemap = tilemap_create(tx_get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
207206
208   colortable_configure_tilemap_groups(polepos_colortable, tx_tilemap, machine->gfx[0], 0x2f);
207   colortable_configure_tilemap_groups(machine->colortable, tx_tilemap, machine->gfx[0], 0x2f);
209208}
210209
211210
r1334r1335
434433   const gfx_element *gfx = machine->gfx[big ? 3 : 2];
435434   UINT8 *gfxdata = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
436435   UINT8 *scaling_rom = memory_region(REGION_GFX6);
437   UINT32 transmask = colortable_get_transpen_mask(polepos_colortable, gfx, color, 0x1f);
436   UINT32 transmask = colortable_get_transpen_mask(machine->colortable, gfx, color, 0x1f);
438437   int coloroffs = gfx->color_base + color * gfx->color_granularity;
439438   int x,y;
440439
src/mame/video/namcos86.c
r1334r1335
4545PALETTE_INIT( namcos86 )
4646{
4747   int i;
48   int totcolors,totlookup;
48   rgb_t palette[512];
4949
50
51   totcolors = machine->drv->total_colors;
52   totlookup = machine->drv->color_table_len;
53
54   for (i = 0;i < totcolors;i++)
50   for (i = 0;i < 512;i++)
5551   {
5652      int bit0,bit1,bit2,bit3,r,g,b;
5753
58
5954      bit0 = (color_prom[0] >> 0) & 0x01;
6055      bit1 = (color_prom[0] >> 1) & 0x01;
6156      bit2 = (color_prom[0] >> 2) & 0x01;
r1334r1335
6661      bit2 = (color_prom[0] >> 6) & 0x01;
6762      bit3 = (color_prom[0] >> 7) & 0x01;
6863      g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
69      bit0 = (color_prom[totcolors] >> 0) & 0x01;
70      bit1 = (color_prom[totcolors] >> 1) & 0x01;
71      bit2 = (color_prom[totcolors] >> 2) & 0x01;
72      bit3 = (color_prom[totcolors] >> 3) & 0x01;
64      bit0 = (color_prom[512] >> 0) & 0x01;
65      bit1 = (color_prom[512] >> 1) & 0x01;
66      bit2 = (color_prom[512] >> 2) & 0x01;
67      bit3 = (color_prom[512] >> 3) & 0x01;
7368      b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
7469
75      palette_set_color(machine,i,MAKE_RGB(r,g,b));
70      palette[i] = MAKE_RGB(r,g,b);
7671      color_prom++;
7772   }
7873
79   color_prom += totcolors;
74   color_prom += 512;
8075   /* color_prom now points to the beginning of the lookup table */
8176
8277   /* tiles lookup table */
83   for (i = 0;i < totlookup/2;i++)
84      *(colortable++) = *color_prom++;
78   for (i = 0;i < 2048;i++)
79      palette_set_color(machine, i, palette[*color_prom++]);
8580
8681   /* sprites lookup table */
87   for (i = 0;i < totlookup/2;i++)
88      *(colortable++) = *(color_prom++) + totcolors/2;
82   for (i = 0;i < 2048;i++)
83      palette_set_color(machine, 2048 + i, palette[256 + *color_prom++]);
8984
9085   /* color_prom now points to the beginning of the tile address decode PROM */
9186
src/mame/video/galaxian.c
r1334r1335
18441844   }
18451845}
18461846
1847void scramble_draw_stars(running_machine *machine, mame_bitmap *bitmap)
1847static void scramble_draw_stars(running_machine *machine, mame_bitmap *bitmap)
18481848{
18491849   int offs;
18501850
src/mame/video/lazercmd.c
r1334r1335
4747         if (x+xbit < 0 || x+xbit >= HORZ_RES * HORZ_CHR)
4848            continue;
4949
50         *BITMAP_ADDR16(bitmap, y+ybit, x+xbit) = machine->pens[2];
50         *BITMAP_ADDR16(bitmap, y+ybit, x+xbit) = 4;
5151      }
5252   }
5353}
src/mame/video/toaplan1.c
r1334r1335
751751
752752
753753#ifdef MAME_DEBUG
754void toaplan1_log_vram(void)
754static void toaplan1_log_vram(void)
755755{
756756   if ( input_code_pressed(KEYCODE_M) )
757757   {
src/mame/video/toaplan2.c
r1334r1335
10921092
10931093
10941094#ifdef MAME_DEBUG
1095void toaplan2_log_vram(void)
1095static void toaplan2_log_vram(void)
10961096{
10971097   offs_t sprite_voffs, tile_voffs;
10981098   int vid_controllers = 1;
src/mame/video/bankp.c
r1334r1335
1515static int priority;
1616
1717static tilemap *bg_tilemap, *fg_tilemap;
18static colortable *bankp_colortable;
1918
2019
2120/***************************************************************************
r1334r1335
4342PALETTE_INIT( bankp )
4443{
4544   int i;
46   #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
47   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
4845
4946   /* allocate the colortable */
50   bankp_colortable = colortable_alloc(machine, 32);
47   machine->colortable = colortable_alloc(machine, 32);
5148
5249   for (i = 0;i < 32;i++)
5350   {
r1334r1335
6966      bit2 = (*color_prom >> 7) & 0x01;
7067      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
7168
72      colortable_palette_set_color(bankp_colortable,i,MAKE_RGB(r,g,b));
69      colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
7370
7471      color_prom++;
7572   }
r1334r1335
7875
7976   /* charset #1 lookup table */
8077   for (i = 0;i < machine->gfx[0]->total_colors * machine->gfx[0]->color_granularity;i++)
81      colortable_entry_set_value(bankp_colortable, machine->gfx[0]->color_base + i, *color_prom++ & 0x0f);
78      colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, *color_prom++ & 0x0f);
8279
8380   color_prom += 128;   /* skip the bottom half of the PROM - seems to be not used */
8481
8582   /* charset #2 lookup table */
8683   for (i = 0;i < machine->gfx[1]->total_colors * machine->gfx[1]->color_granularity;i++)
87      colortable_entry_set_value(bankp_colortable, machine->gfx[1]->color_base + i, *color_prom++ & 0x0f);
84      colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + i, *color_prom++ & 0x0f);
8885
8986   /* the bottom half of the PROM seems to be not used */
9087}
r1334r1335
163160   fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows,
164161      TILEMAP_TYPE_PEN, 8, 8, 32, 32);
165162
166   colortable_configure_tilemap_groups(bankp_colortable, bg_tilemap, machine->gfx[1], 0);
167   colortable_configure_tilemap_groups(bankp_colortable, fg_tilemap, machine->gfx[0], 0);
163   colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[1], 0);
164   colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 0);
168165}
169166
170167VIDEO_UPDATE( bankp )
src/mame/video/pastelg.c
r1334r1335
116116
117117
118118******************************************************************************/
119void pastelg_vramflip(void)
119static void pastelg_vramflip(void)
120120{
121121   static int pastelg_flipscreen_old = 0;
122122   int x, y;
r1334r1335
150150   nb1413m3_busyflag = 1;
151151}
152152
153void pastelg_gfxdraw(void)
153static void pastelg_gfxdraw(void)
154154{
155155   UINT8 *GFX = memory_region(REGION_GFX1);
156156
src/mame/video/bosco.c
r1334r1335
2626UINT8 *bosco_radarattr;
2727static UINT8 *bosco_radarx,*bosco_radary;
2828
29static colortable *bosco_colortable;
3029
31
3230PALETTE_INIT( bosco )
3331{
3432   int i;
3533
36   bosco_colortable = colortable_alloc(machine, 32+64);
34   machine->colortable = colortable_alloc(machine, 32+64);
3735
3836   /* core palette */
3937   for (i = 0;i < 32;i++)
r1334r1335
5452      bit2 = ((*color_prom) >> 7) & 0x01;
5553      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
5654
57      colortable_palette_set_color(bosco_colortable,i,MAKE_RGB(r,g,b));
55      colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
5856      color_prom++;
5957   }
6058
r1334r1335
7169      bits = (i >> 4) & 0x03;
7270      b = map[bits];
7371
74      colortable_palette_set_color(bosco_colortable,32 + i,MAKE_RGB(r,g,b));
72      colortable_palette_set_color(machine->colortable,32 + i,MAKE_RGB(r,g,b));
7573   }
7674
7775   /* characters / sprites */
7876   for (i = 0;i < 64*4;i++)
7977   {
80      colortable_entry_set_value(bosco_colortable, i, (color_prom[i] & 0x0f) + 0x10);   /* chars */
81      colortable_entry_set_value(bosco_colortable, i+64*4, color_prom[i] & 0x0f);   /* sprites */
78      colortable_entry_set_value(machine->colortable, i, (color_prom[i] & 0x0f) + 0x10);   /* chars */
79      colortable_entry_set_value(machine->colortable, i+64*4, color_prom[i] & 0x0f);   /* sprites */
8280   }
8381
8482   /* bullets lookup table */
8583   /* they use colors 28-31, I think - PAL 5A controls it */
8684   for (i = 0;i < 4;i++)
87      colortable_entry_set_value(bosco_colortable, 64*4+64*4+i, 31-i);
85      colortable_entry_set_value(machine->colortable, 64*4+64*4+i, 31-i);
8886
8987   /* now the stars */
9088   for (i = 0;i < 64;i++)
91      colortable_entry_set_value(bosco_colortable, 64*4+64*4+4+i, 32 + i);
89      colortable_entry_set_value(machine->colortable, 64*4+64*4+4+i, 32 + i);
9290}
9391
9492
r1334r1335
141139   bg_tilemap = tilemap_create(bg_get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
142140   fg_tilemap = tilemap_create(fg_get_tile_info,fg_tilemap_scan,  TILEMAP_TYPE_PEN,8,8, 8,32);
143141
144   colortable_configure_tilemap_groups(bosco_colortable, bg_tilemap, machine->gfx[0], 0x1f);
145   colortable_configure_tilemap_groups(bosco_colortable, fg_tilemap, machine->gfx[0], 0x1f);
142   colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 0x1f);
143   colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 0x1f);
146144
147145   tilemap_set_scrolldx(bg_tilemap,3,3);
148146
r1334r1335
232230            flipx,flipy,
233231            sx,sy,
234232            cliprect,TRANSPARENCY_PENS,
235            colortable_get_transpen_mask(bosco_colortable, machine->gfx[1], color, 0x0f));
233            colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0x0f));
236234   }
237235}
238236
src/mame/video/namcos22.c
r1334r1335
251251typedef struct _poly_extra_data poly_extra_data;
252252struct _poly_extra_data
253253{
254   rgbint fogColor;
255   rgbint fadeColor;
254256   int color;
255257   int bn;
256258   UINT16 flags;
257259   int cmode;
258260   int fogFactor;
259   rgbint fogColor;
260261   int fadeFactor;
261   rgbint fadeColor;
262262   const UINT8 *source;      /* sprites */
263263   int z;
264264   int alpha;
src/mame/video/galaga.c
r1334r1335
1717UINT8 *galaga_ram1,*galaga_ram2,*galaga_ram3;
1818UINT8 galaga_starcontrol[6];
1919static UINT32 stars_scrollx,stars_scrolly;
20static colortable *galaga_colortable;
2120
2221static INT32 galaga_gfxbank; // used by catsbee
2322
r1334r1335
338337{
339338   int i;
340339
341   galaga_colortable = colortable_alloc(machine, 32+64);
340   machine->colortable = colortable_alloc(machine, 32+64);
342341
343342   /* core palette */
344343   for (i = 0;i < 32;i++)
r1334r1335
358357      bit2 = ((*color_prom) >> 7) & 0x01;
359358      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
360359
361      colortable_palette_set_color(galaga_colortable,i,MAKE_RGB(r,g,b));
360      colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
362361      color_prom++;
363362   }
364363
r1334r1335
375374      bits = (i >> 4) & 0x03;
376375      b = map[bits];
377376
378      colortable_palette_set_color(galaga_colortable,32 + i,MAKE_RGB(r,g,b));
377      colortable_palette_set_color(machine->colortable,32 + i,MAKE_RGB(r,g,b));
379378   }
380379
381380   /* characters */
382381   for (i = 0;i < 64*4;i++)
383      colortable_entry_set_value(galaga_colortable, i, (*(color_prom++) & 0x0f) + 0x10);   /* chars */
382      colortable_entry_set_value(machine->colortable, i, (*(color_prom++) & 0x0f) + 0x10);   /* chars */
384383
385384   /* sprites */
386385   for (i = 0;i < 64*4;i++)
387      colortable_entry_set_value(galaga_colortable, 64*4+i, (*(color_prom++) & 0x0f));
386      colortable_entry_set_value(machine->colortable, 64*4+i, (*(color_prom++) & 0x0f));
388387
389388   /* now the stars */
390389   for (i = 0;i < 64;i++)
391      colortable_entry_set_value(galaga_colortable, 64*4+64*4+i, 32 + i);
390      colortable_entry_set_value(machine->colortable, 64*4+64*4+i, 32 + i);
392391}
393392
394393
r1334r1335
442441VIDEO_START( galaga )
443442{
444443   tx_tilemap = tilemap_create(get_tile_info,tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,28);
445   colortable_configure_tilemap_groups(galaga_colortable, tx_tilemap, machine->gfx[0], 0x1f);
444   colortable_configure_tilemap_groups(machine->colortable, tx_tilemap, machine->gfx[0], 0x1f);
446445
447446   galaga_gfxbank = 0;
448447
r1334r1335
536535               flipx,flipy,
537536               sx + 16*x, sy + 16*y,
538537               cliprect,TRANSPARENCY_PENS,
539               colortable_get_transpen_mask(galaga_colortable, machine->gfx[1], color, 0x0f));
538               colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0x0f));
540539         }
541540      }
542541   }
src/mame/video/pacland.c
r1334r1335
3232static UINT8 palette_bank;
3333static const UINT8 *pacland_color_prom;
3434
35static colortable *pacland_colortable;
3635static tilemap *bg_tilemap, *fg_tilemap;
3736static mame_bitmap *fg_bitmap;
3837
r1334r1335
9594
9695      color_prom++;
9796
98      colortable_palette_set_color(pacland_colortable,i,MAKE_RGB(r,g,b));
97      colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
9998   }
10099}
101100
r1334r1335
104103   int i;
105104
106105   /* allocate the colortable */
107   pacland_colortable = colortable_alloc(machine, 256);
106   machine->colortable = colortable_alloc(machine, 256);
108107
109108   pacland_color_prom = color_prom;   /* we'll need this later */
110109   /* skip the palette data, it will be initialized later */
r1334r1335
112111   /* color_prom now points to the beginning of the lookup table */
113112
114113   for (i = 0;i < 0x400;i++)
115      colortable_entry_set_value(pacland_colortable, machine->gfx[0]->color_base + i, *color_prom++);
114      colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, *color_prom++);
116115
117116   /* Background */
118117   for (i = 0;i < 0x400;i++)
119      colortable_entry_set_value(pacland_colortable, machine->gfx[1]->color_base + i, *color_prom++);
118      colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + i, *color_prom++);
120119
121120   /* Sprites */
122121   for (i = 0;i < 0x400;i++)
123      colortable_entry_set_value(pacland_colortable, machine->gfx[2]->color_base + i, *color_prom++);
122      colortable_entry_set_value(machine->colortable, machine->gfx[2]->color_base + i, *color_prom++);
124123
125124   palette_bank = 0;
126125   switch_palette(machine);
r1334r1335
139138      /* iterate over all palette entries except the last one */
140139      for (palentry = 0; palentry < 0x100; palentry++)
141140      {
142         UINT32 mask = colortable_get_transpen_mask(pacland_colortable, machine->gfx[2], i, palentry);
141         UINT32 mask = colortable_get_transpen_mask(machine->colortable, machine->gfx[2], i, palentry);
143142
144143         /* transmask[0] is a mask that is used to draw only high priority sprite pixels; thus, pens
145144               $00-$7F are opaque, and others are transparent */
r1334r1335
216215   assert(machine->gfx[0]->total_colors <= TILEMAP_NUM_GROUPS);
217216   for (color = 0; color < machine->gfx[0]->total_colors; color++)
218217   {
219      UINT32 mask = colortable_get_transpen_mask(pacland_colortable, machine->gfx[0], color, 0x7f);
220      mask |= colortable_get_transpen_mask(pacland_colortable, machine->gfx[0], color, 0xff);
218      UINT32 mask = colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0x7f);
219      mask |= colortable_get_transpen_mask(machine->colortable, machine->gfx[0], color, 0xff);
221220      tilemap_set_transmask(fg_tilemap, color, mask, 0);
222221   }
223222
src/mame/video/canyon.c
r1334r1335
7777      if (rect.max_x > cliprect->max_x) rect.max_x = cliprect->max_x;
7878      if (rect.max_y > cliprect->max_y) rect.max_y = cliprect->max_y;
7979
80      fillbitmap(bitmap, i, &rect);
80      fillbitmap(bitmap, 1 + 2 * i, &rect);
8181   }
8282}
8383
src/mame/video/exidy440.c
r1334r1335
220220 *
221221 *************************************/
222222
223void exidy440_update_firq(void)
223static void exidy440_update_firq(void)
224224{
225225   if (exidy440_firq_vblank || (firq_enable && exidy440_firq_beam))
226226      cpunum_set_input_line(0, 1, ASSERT_LINE);
src/mame/video/toypop.c
r1334r1335
1616UINT16 *toypop_bg_image;
1717static int bitmapflip,palettebank;
1818
19static colortable *toypop_colortable;
2019
21
2220/***************************************************************************
2321
2422  Convert the color PROMs into a more useable format.
r1334r1335
3331   int i;
3432
3533   /* allocate the colortable */
36   toypop_colortable = colortable_alloc(machine, 256);
34   machine->colortable = colortable_alloc(machine, 256);
3735
3836   for (i = 0;i < 256;i++)
3937   {
r1334r1335
5856      bit3 = (color_prom[i+0x200] >> 3) & 0x01;
5957      b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
6058
61      colortable_palette_set_color(toypop_colortable, i, MAKE_RGB(r,g,b));
59      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r,g,b));
6260   }
6361
6462   for (i = 0;i < 256;i++)
r1334r1335
6664      UINT8 entry;
6765
6866      // characters
69      colortable_entry_set_value(toypop_colortable, i + 0*256, (color_prom[i + 0x300] & 0x0f) | 0x70);
70      colortable_entry_set_value(toypop_colortable, i + 1*256, (color_prom[i + 0x300] & 0x0f) | 0xf0);
67      colortable_entry_set_value(machine->colortable, i + 0*256, (color_prom[i + 0x300] & 0x0f) | 0x70);
68      colortable_entry_set_value(machine->colortable, i + 1*256, (color_prom[i + 0x300] & 0x0f) | 0xf0);
7169      // sprites
7270      entry = color_prom[i + 0x500];
73      colortable_entry_set_value(toypop_colortable, i + 2*256, entry);
71      colortable_entry_set_value(machine->colortable, i + 2*256, entry);
7472   }
7573   for (i = 0;i < 16;i++)
7674   {
7775      // background
78      colortable_entry_set_value(toypop_colortable, i + 3*256 + 0*16, 0x60 + i);
79      colortable_entry_set_value(toypop_colortable, i + 3*256 + 1*16, 0xe0 + i);
76      colortable_entry_set_value(machine->colortable, i + 3*256 + 0*16, 0x60 + i);
77      colortable_entry_set_value(machine->colortable, i + 3*256 + 1*16, 0xe0 + i);
8078   }
8179}
8280
r1334r1335
223221***************************************************************************/
224222
225223/* from mappy.c */
226void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xoffs, int yoffs, colortable *ctable, int transcolor);
224void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xoffs, int yoffs, int transcolor);
227225
228226
229227VIDEO_UPDATE( toypop )
r1334r1335
231229   draw_background(bitmap);
232230   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
233231
234   mappy_draw_sprites(machine, bitmap, cliprect, -31, -8, toypop_colortable, 0xff);
232   mappy_draw_sprites(machine, bitmap, cliprect, -31, -8, 0xff);
235233   return 0;
236234}
src/mame/video/digdug.c
r1334r1335
99
1010static INT32 bg_select, tx_color_mode, bg_disable, bg_color_bank;
1111
12static colortable *digdug_colortable;
1312
14
1513/***************************************************************************
1614
1715  Convert the color PROMs.
r1334r1335
3533{
3634   int i;
3735
38   digdug_colortable = colortable_alloc(machine, 32);
36   machine->colortable = colortable_alloc(machine, 32);
3937
4038   for (i = 0;i < 32;i++)
4139   {
r1334r1335
5351      bit1 = (*color_prom >> 6) & 0x01;
5452      bit2 = (*color_prom >> 7) & 0x01;
5553      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
56      colortable_palette_set_color(digdug_colortable,i,MAKE_RGB(r,g,b));
54      colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
5755      color_prom++;
5856   }
5957
6058   /* characters - direct mapping */
6159   for (i = 0; i < 16; i++)
6260   {
63      colortable_entry_set_value(digdug_colortable, i*2+0, 0);
64      colortable_entry_set_value(digdug_colortable, i*2+1, i);
61      colortable_entry_set_value(machine->colortable, i*2+0, 0);
62      colortable_entry_set_value(machine->colortable, i*2+1, i);
6563   }
6664
6765   /* sprites */
6866   for (i = 0;i < 0x100;i++)
69      colortable_entry_set_value(digdug_colortable, 16*2+i, (*color_prom++ & 0x0f) + 0x10);
67      colortable_entry_set_value(machine->colortable, 16*2+i, (*color_prom++ & 0x0f) + 0x10);
7068
7169   /* bg_select */
7270   for (i = 0;i < 0x100;i++)
73      colortable_entry_set_value(digdug_colortable, 16*2+256+i, *color_prom++ & 0x0f);
71      colortable_entry_set_value(machine->colortable, 16*2+256+i, *color_prom++ & 0x0f);
7472}
7573
7674
r1334r1335
292290      {
293291         for (x = 0;x <= size;x++)
294292         {
295            UINT32 transmask = colortable_get_transpen_mask(digdug_colortable, machine->gfx[1], color, 0x1f);
293            UINT32 transmask = colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 0x1f);
296294            drawgfx(bitmap,machine->gfx[1],
297295               sprite + gfx_offs[y ^ (size * flipy)][x ^ (size * flipx)],
298296               color,
src/mame/video/mappy.c
r1334r1335
1010
1111static mame_bitmap *sprite_bitmap;
1212
13static colortable *mappy_colortable;
1413
15
1614/***************************************************************************
1715
1816  Convert the color PROMs.
r1334r1335
5351         2, &resistances[1], bweights, 0, 0);
5452
5553   /* allocate the colortable */
56   mappy_colortable = colortable_alloc(machine, 32);
54   machine->colortable = colortable_alloc(machine, 32);
5755
5856   /* create a lookup table for the palette */
5957   for (i = 0; i < 32; i++)
r1334r1335
7876      bit1 = (color_prom[i] >> 7) & 0x01;
7977      b = combine_2_weights(bweights, bit0, bit1);
8078
81      colortable_palette_set_color(mappy_colortable, i, MAKE_RGB(r, g, b));
79      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
8280   }
8381
8482   /* color_prom now points to the beginning of the lookup table */
r1334r1335
8886   for (i = 0; i < 64*4; i++)
8987   {
9088      UINT8 ctabentry = color_prom[i] & 0x0f;
91      colortable_entry_set_value(mappy_colortable, i, (ctabentry ^ 15) + 0x10);
89      colortable_entry_set_value(machine->colortable, i, (ctabentry ^ 15) + 0x10);
9290   }
9391
9492   /* sprites map to the lower 16 palette entries */
9593   for (i = 64*4; i < 128*4; i++)
9694   {
9795      UINT8 ctabentry = color_prom[i] & 0x0f;
98      colortable_entry_set_value(mappy_colortable, i, ctabentry);
96      colortable_entry_set_value(machine->colortable, i, ctabentry);
9997   }
10098}
10199
r1334r1335
112110         2, &resistances[1], bweights, 0, 0);
113111
114112   /* allocate the colortable */
115   mappy_colortable = colortable_alloc(machine, 32);
113   machine->colortable = colortable_alloc(machine, 32);
116114
117115   /* create a lookup table for the palette */
118116   for (i = 0; i < 32; i++)
r1334r1335
137135      bit1 = (color_prom[i] >> 7) & 0x01;
138136      b = combine_2_weights(bweights, bit0, bit1);
139137
140      colortable_palette_set_color(mappy_colortable, i, MAKE_RGB(r, g, b));
138      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
141139   }
142140
143141   /* color_prom now points to the beginning of the lookup table */
r1334r1335
147145   for (i = 0*4; i < 64*4; i++)
148146   {
149147      UINT8 ctabentry = color_prom[i] & 0x0f;
150      colortable_entry_set_value(mappy_colortable, i, ctabentry + 0x10);
148      colortable_entry_set_value(machine->colortable, i, ctabentry + 0x10);
151149   }
152150
153151   /* sprites map to the lower 16 palette entries */
154152   for (i = 64*4; i < machine->drv->total_colors; i++)
155153   {
156154      UINT8 ctabentry = color_prom[i] & 0x0f;
157      colortable_entry_set_value(mappy_colortable, i, ctabentry);
155      colortable_entry_set_value(machine->colortable, i, ctabentry);
158156   }
159157}
160158
r1334r1335
183181         4, &resistances[0], bweights, 0, 0);
184182
185183   /* allocate the colortable */
186   mappy_colortable = colortable_alloc(machine, 32);
184   machine->colortable = colortable_alloc(machine, 32);
187185
188186   /* create a lookup table for the palette */
189187   for (i = 0; i < 32; i++)
r1334r1335
212210      bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
213211      b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
214212
215      colortable_palette_set_color(mappy_colortable, i, MAKE_RGB(r, g, b));
213      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
216214   }
217215
218216   /* color_prom now points to the beginning of the lookup table */
r1334r1335
222220   for (i = 0; i < 64*4; i++)
223221   {
224222      UINT8 ctabentry = color_prom[i] & 0x0f;
225      colortable_entry_set_value(mappy_colortable, i, ctabentry);
223      colortable_entry_set_value(machine->colortable, i, ctabentry);
226224   }
227225
228226   /* sprites map to the upper 16 palette entries */
229227   for (i = 64*4; i < 128*4; i++)
230228   {
231229      UINT8 ctabentry = color_prom[i] & 0x0f;
232      colortable_entry_set_value(mappy_colortable, i, ctabentry + 0x10);
230      colortable_entry_set_value(machine->colortable, i, ctabentry + 0x10);
233231   }
234232}
235233
r1334r1335
327325   bg_tilemap = tilemap_create(superpac_get_tile_info,superpac_tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,28);
328326   sprite_bitmap = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
329327
330   colortable_configure_tilemap_groups(mappy_colortable, bg_tilemap, machine->gfx[0], 31);
328   colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 31);
331329
332330   spriteram = mappy_spriteram + 0x780;
333331   spriteram_2 = spriteram + 0x800;
r1334r1335
338336{
339337   bg_tilemap = tilemap_create(phozon_get_tile_info,superpac_tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,28);
340338
341   colortable_configure_tilemap_groups(mappy_colortable, bg_tilemap, machine->gfx[0], 15);
339   colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 15);
342340
343341   spriteram = mappy_spriteram + 0x780;
344342   spriteram_2 = spriteram + 0x800;
r1334r1335
349347{
350348   bg_tilemap = tilemap_create(mappy_get_tile_info,mappy_tilemap_scan,TILEMAP_TYPE_PEN,8,8,36,60);
351349
352   colortable_configure_tilemap_groups(mappy_colortable, bg_tilemap, machine->gfx[0], 31);
350   colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 31);
353351   tilemap_set_scroll_cols(bg_tilemap, 36);
354352
355353   spriteram = mappy_spriteram + 0x780;
r1334r1335
402400***************************************************************************/
403401
404402/* also used by toypop.c */
405void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xoffs, int yoffs, colortable *ctable, int transcolor)
403void mappy_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xoffs, int yoffs, int transcolor)
406404{
407405   int offs;
408406
r1334r1335
448446                  flipx,flipy,
449447                  sx + 16*x,sy + 16*y,
450448                  cliprect,TRANSPARENCY_PENS,
451                  colortable_get_transpen_mask(ctable, machine->gfx[1], color, transcolor));
449                  colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, transcolor));
452450            }
453451         }
454452      }
r1334r1335
523521                  flipx,flipy,
524522                  sx + 8*x,sy + 8*y,
525523                  cliprect,TRANSPARENCY_PENS,
526                  colortable_get_transpen_mask(mappy_colortable, machine->gfx[1], color, 31));
524                  colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, 31));
527525            }
528526         }
529527      }
r1334r1335
539537   tilemap_draw(bitmap,cliprect,bg_tilemap,1|TILEMAP_DRAW_OPAQUE,0);
540538
541539   fillbitmap(sprite_bitmap,15,cliprect);
542   mappy_draw_sprites(machine,sprite_bitmap,cliprect,0,0,mappy_colortable,15);
540   mappy_draw_sprites(machine,sprite_bitmap,cliprect,0,0,15);
543541   copybitmap(bitmap,sprite_bitmap,0,0,0,0,cliprect,TRANSPARENCY_PEN,15);
544542
545543   /* Redraw the high priority characters */
r1334r1335
582580   tilemap_draw(bitmap,cliprect,bg_tilemap,0|TILEMAP_DRAW_OPAQUE,0);
583581   tilemap_draw(bitmap,cliprect,bg_tilemap,1|TILEMAP_DRAW_OPAQUE,0);
584582
585   mappy_draw_sprites(machine,bitmap,cliprect,0,0,mappy_colortable,15);
583   mappy_draw_sprites(machine,bitmap,cliprect,0,0,15);
586584
587585   /* Redraw the high priority characters */
588586   tilemap_draw(bitmap,cliprect,bg_tilemap,1,0);
src/mame/video/slapfght.c
r1334r1335
132132}
133133
134134#ifdef MAME_DEBUG
135void slapfght_log_vram(void)
135static void slapfght_log_vram(void)
136136{
137137   if ( input_code_pressed_once(KEYCODE_B) )
138138   {
src/mame/video/equites.c
r1334r1335
3434static int bgcolor[4];
3535static rectangle halfclip;
3636static struct PRESTEP_TYPE { unsigned sy, fdx; } *prestep;
37static colortable *equites_colortable;
3837
3938/******************************************************************************/
4039// Exports
r1334r1335
7877   UINT8 *clut_ptr;
7978   int i;
8079
81   equites_colortable = colortable_alloc(machine, 256);
80   machine->colortable = colortable_alloc(machine, 256);
8281
8382   for (i=0; i<256; i++)
84      colortable_palette_set_color(equites_colortable, i, MAKE_RGB(pal4bit(color_prom[i]), pal4bit(color_prom[i+0x100]), pal4bit(color_prom[i+0x200])));
83      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(pal4bit(color_prom[i]), pal4bit(color_prom[i+0x100]), pal4bit(color_prom[i+0x200])));
8584
8685   for (i=0; i<256; i++)
87      colortable_entry_set_value(equites_colortable, i, i);
86      colortable_entry_set_value(machine->colortable, i, i);
8887
8988   clut_ptr = memory_region(REGION_USER1) + 0x80;
9089   for (i=0; i<128; i++)
91      colortable_entry_set_value(equites_colortable, i+0x100, clut_ptr[i]);
90      colortable_entry_set_value(machine->colortable, i+0x100, clut_ptr[i]);
9291}
9392
9493static TILE_GET_INFO( equites_charinfo )
r1334r1335
120119   UINT8 *prom_ptr;
121120   int i;
122121
123   equites_colortable = colortable_alloc(machine, 256);
122   machine->colortable = colortable_alloc(machine, 256);
124123
125124   for (i=0; i<0x100; i++)
126      colortable_palette_set_color(equites_colortable, i, MAKE_RGB(pal4bit(color_prom[i]), pal4bit(color_prom[i+0x100]), pal4bit(color_prom[i+0x200])));
125      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(pal4bit(color_prom[i]), pal4bit(color_prom[i+0x100]), pal4bit(color_prom[i+0x200])));
127126
128127   for (i = 0; i < 0x100; i++)
129      colortable_entry_set_value(equites_colortable, i, i);
128      colortable_entry_set_value(machine->colortable, i, i);
130129
131130   prom_ptr = memory_region(REGION_USER1);
132131   for (i=0; i<0x80; i++)
133132   {
134      colortable_entry_set_value(equites_colortable, i + 0x100, prom_ptr[i] + 0x10);
135      colortable_entry_set_value(equites_colortable, i + 0x180, prom_ptr[i]);
133      colortable_entry_set_value(machine->colortable, i + 0x100, prom_ptr[i] + 0x10);
134      colortable_entry_set_value(machine->colortable, i + 0x180, prom_ptr[i]);
136135   }
137136
138137   prom_ptr += 0x100;
139138   for (i=0; i<0x400; i++)
140      colortable_entry_set_value(equites_colortable, i + 0x200, prom_ptr[i]);
139      colortable_entry_set_value(machine->colortable, i + 0x200, prom_ptr[i]);
141140}
142141
143142static TILE_GET_INFO( splndrbt_char0info )
r1334r1335
276275   c = *bgcolor;
277276
278277   for (i=0x80; i<0x100; i+=0x08)
279      colortable_entry_set_value(equites_colortable, i, c);
278      colortable_entry_set_value(machine->colortable, i, c);
280279}
281280
282281static void equites_draw_scroll(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
r1334r1335
398397   switch(equites_id)
399398   {
400399      case 0x8511:
401         colortable_entry_set_value(equites_colortable, 0x114, c);
400         colortable_entry_set_value(machine->colortable, 0x114, c);
402401      break;
403402   }
404403}
src/mame/video/decocass.c
r1334r1335
208208     * (ME/ input on 1st paletteram, inverter -> ME/ on 2nd)
209209     */
210210   offset = (offset & 31) ^ 16;
211   paletteram_BBGGGRRR_w( offset, ~data );
211   colortable_palette_set_color(Machine->colortable, offset, MAKE_RGB(pal3bit(~data >> 0), pal3bit(~data >> 3), pal2bit(~data >> 6)));
212212}
213213
214214WRITE8_HANDLER( decocass_charram_w )
src/mame/video/firetrk.c
r1334r1335
419419         continue;
420420      }
421421
422      fillbitmap(helper2, 0xff, NULL);
422423      drawgfx(helper2,
423424         machine->gfx[car[i].layout],
424425         car[i].number,
r1334r1335
428429         car[i].x,
429430         car[i].y,
430431         &playfield_window,
431         TRANSPARENCY_NONE, 0);
432         TRANSPARENCY_PEN, 0);
432433
433434      for (y = car[i].y; y < car[i].y + height; y++)
434435      {
r1334r1335
449450            a = *BITMAP_ADDR16(helper1, y, x);
450451            b = *BITMAP_ADDR16(helper2, y, x);
451452
452            if (b != 0 && a == 1)
453            if (b != 0xff && (firetrk_color1_mask >> a) & 1)
453454            {
454455               firetrk_crash[i] = 1;
455456            }
456            if (b != 0 && a == 2)
457            if (b != 0xff && (firetrk_color2_mask >> a) & 1)
457458            {
458459               firetrk_skid[i] = 1;
459460            }
src/mame/video/exidy.c
r1334r1335
1212UINT8 exidy_collision_mask;
1313UINT8 exidy_collision_invert;
1414
15UINT8 *exidy_palette;
16UINT16 *exidy_colortable;
17
1815static mame_bitmap *motion_object_1_vid;
1916static mame_bitmap *motion_object_2_vid;
2017static mame_bitmap *motion_object_2_clip;
r1334r1335
3128static UINT8 sprite2_xpos;
3229static UINT8 sprite2_ypos;
3330
34static UINT8 color_latch[3];
31UINT8 exidy_color_latch[3];
3532
3633
3734
3835/*************************************
3936 *
40 *  Hard coded palettes
41 *
42 *************************************/
43
44/* Sidetrack/Targ/Spectar don't have a color PROM; colors are changed by the means of 8x3 */
45/* dip switches on the board. Here are the colors they map to. */
46UINT8 sidetrac_palette[PALETTE_LEN*3] =
47{
48   0x00,0x00,0x00,   /* BACKGND */
49   0x00,0x00,0x00,   /* CSPACE0 */
50   0x00,0xff,0x00,   /* CSPACE1 */
51   0xff,0xff,0xff,   /* CSPACE2 */
52   0xff,0xff,0xff,   /* CSPACE3 */
53   0xff,0x00,0xff,   /* 5LINES (unused?) */
54   0xff,0xff,0x00,   /* 5MO2VID  */
55   0xff,0xff,0xff    /* 5MO1VID  */
56};
57
58/* Targ has different colors */
59UINT8 targ_palette[PALETTE_LEN*3] =
60{
61               /* color   use                */
62   0x00,0x00,0xff, /* blue    background         */
63   0x00,0xff,0xff, /* cyan    characters 192-255 */
64   0xff,0xff,0x00, /* yellow  characters 128-191 */
65   0xff,0xff,0xff, /* white   characters  64-127 */
66   0xff,0x00,0x00, /* red     characters   0- 63 */
67   0x00,0xff,0xff, /* cyan    not used           */
68   0xff,0xff,0xff, /* white   bullet sprite      */
69   0x00,0xff,0x00, /* green   wummel sprite      */
70};
71
72/* Spectar has different colors */
73UINT8 spectar_palette[PALETTE_LEN*3] =
74{
75               /* color   use                */
76   0x00,0x00,0xff, /* blue    background         */
77   0x00,0xff,0x00, /* green   characters 192-255 */
78   0x00,0xff,0x00, /* green   characters 128-191 */
79   0xff,0xff,0xff, /* white   characters  64-127 */
80   0xff,0x00,0x00, /* red     characters   0- 63 */
81   0x00,0xff,0x00, /* green   not used           */
82   0xff,0xff,0x00, /* yellow  bullet sprite      */
83   0x00,0xff,0x00, /* green   wummel sprite      */
84};
85
86
87
88/*************************************
89 *
90 *  Hard coded color tables
91 *
92 *************************************/
93
94UINT16 exidy_1bpp_colortable[COLORTABLE_LEN] =
95{
96   /* one-bit characters */
97   0, 4,  /* chars 0x00-0x3F */
98   0, 3,  /* chars 0x40-0x7F */
99   0, 2,  /* chars 0x80-0xBF */
100   0, 1,  /* chars 0xC0-0xFF */
101
102   /* Motion Object 1 */
103   0, 7,
104
105   /* Motion Object 2 */
106   0, 6,
107};
108
109UINT16 exidy_2bpp_colortable[COLORTABLE_LEN] =
110{
111   /* two-bit characters */
112   /* (Because this is 2-bit color, the colorspace is only divided
113        in half instead of in quarters.  That's why 00-3F = 40-7F and
114        80-BF = C0-FF) */
115   0, 0, 4, 3,  /* chars 0x00-0x3F */
116   0, 0, 4, 3,  /* chars 0x40-0x7F */
117   0, 0, 2, 1,  /* chars 0x80-0xBF */
118   0, 0, 2, 1,  /* chars 0xC0-0xFF */
119
120   /* Motion Object 1 */
121   0, 7,
122
123   /* Motion Object 2 */
124   0, 6,
125};
126
127
128
129/*************************************
130 *
131 *  Palettes and colors
132 *
133 *************************************/
134
135PALETTE_INIT( exidy )
136{
137   if (exidy_palette)
138   {
139      int i;
140
141      for (i = 0; i < PALETTE_LEN; i++)
142         palette_set_color_rgb(machine,i,exidy_palette[i*3+0],exidy_palette[i*3+1],exidy_palette[i*3+2]);
143   }
144   memcpy(colortable, exidy_colortable, COLORTABLE_LEN * sizeof(colortable[0]));
145}
146
147
148
149/*************************************
150 *
15137 *  Video startup
15238 *
15339 *************************************/
r1334r1335
15945   motion_object_1_vid = auto_bitmap_alloc(16, 16, machine->screen[0].format);
16046   motion_object_2_vid = auto_bitmap_alloc(16, 16, machine->screen[0].format);
16147   motion_object_2_clip = auto_bitmap_alloc(16, 16, machine->screen[0].format);
48
49   exidy_color_w(0, exidy_color_latch[0]);
50   exidy_color_w(1, exidy_color_latch[1]);
51   exidy_color_w(2, exidy_color_latch[2]);
16252}
16353
16454
r1334r1335
232122 *
233123 *************************************/
234124
125INLINE void set_1_color(int index, int palette)
126{
127   palette_set_color_rgb(Machine, index, pal1bit(exidy_color_latch[2] >> palette), pal1bit(exidy_color_latch[1] >> palette), pal1bit(exidy_color_latch[0] >> palette));
128}
129
235130WRITE8_HANDLER( exidy_color_w )
236131{
237   int i;
132   exidy_color_latch[offset] = data;
238133
239   color_latch[offset] = data;
134   /* motion object 1 */
135   set_1_color(0, 0);
136   set_1_color(1, 7);
240137
241   for (i = 0; i < 8; i++)
242      palette_set_color_rgb(Machine, i, pal1bit(color_latch[2] >> i), pal1bit(color_latch[1] >> i), pal1bit(color_latch[0] >> i));
138   /* motion object 2 */
139   set_1_color(2, 0);
140   set_1_color(3, 6);
141
142   /* one-bit characters */
143   if (Machine->gfx[0]->color_granularity == 2)
144   {
145      set_1_color(4, 0);      /* chars 0x00-0x3F */
146      set_1_color(5, 4);
147      set_1_color(6, 0);      /* chars 0x40-0x7F */
148      set_1_color(7, 3);
149      set_1_color(8, 0);      /* chars 0x80-0xBF */
150      set_1_color(9, 2);
151      set_1_color(10, 0);      /* chars 0xC0-0xFF */
152      set_1_color(11, 1);
153   }
154
155   /* two-bit characters */
156   else
157   {
158      set_1_color(4, 0);      /* chars 0x00-0x3F */
159      set_1_color(5, 0);
160      set_1_color(6, 4);
161      set_1_color(7, 3);
162      set_1_color(8, 0);      /* chars 0x40-0x7F */
163      set_1_color(9, 0);
164      set_1_color(10, 4);
165      set_1_color(11, 3);
166      set_1_color(12, 0);      /* chars 0x80-0xBF */
167      set_1_color(13, 0);
168      set_1_color(14, 2);
169      set_1_color(15, 1);
170      set_1_color(16, 0);      /* chars 0xC0-0xFF */
171      set_1_color(17, 0);
172      set_1_color(18, 2);
173      set_1_color(19, 1);
174   }
243175}
244176
245177
r1334r1335
367299{
368300   UINT8 enable_set = ((sprite_enable & 0x20) != 0);
369301    static const rectangle clip = { 0, 15, 0, 15 };
370    int pen0 = machine->pens[0];
302    int bgmask = machine->gfx[0]->color_granularity - 1;
371303    int org_1_x = 0, org_1_y = 0;
372304    int org_2_x = 0, org_2_y = 0;
373305    int sx, sy;
r1334r1335
390322   update_complete = 0;
391323
392324   /* draw sprite 1 */
325   fillbitmap(motion_object_1_vid, 0xff, &clip);
393326   if (sprite_1_enabled())
394327   {
395328      org_1_x = 236 - sprite1_xpos - 4;
396329      org_1_y = 244 - sprite1_ypos - 4;
397330      drawgfx(motion_object_1_vid, machine->gfx[1],
398331         (spriteno & 0x0f) + 16 * enable_set, 0,
399         0, 0, 0, 0, &clip, TRANSPARENCY_NONE, 0);
332         0, 0, 0, 0, &clip, TRANSPARENCY_PEN, 0);
400333   }
401   else
402      fillbitmap(motion_object_1_vid, pen0, &clip);
403334
404335   /* draw sprite 2 */
336   fillbitmap(motion_object_2_vid, 0xff, &clip);
405337   if (sprite_2_enabled())
406338   {
407339      org_2_x = 236 - sprite2_xpos - 4;
408340      org_2_y = 244 - sprite2_ypos - 4;
409341      drawgfx(motion_object_2_vid, machine->gfx[1],
410342         ((spriteno >> 4) & 0x0f) + 32, 0,
411         0, 0, 0, 0, &clip, TRANSPARENCY_NONE, 0);
343         0, 0, 0, 0, &clip, TRANSPARENCY_PEN, 0);
412344   }
413   else
414      fillbitmap(motion_object_2_vid, pen0, &clip);
415345
416346    /* draw sprite 2 clipped to sprite 1's location */
417   fillbitmap(motion_object_2_clip, pen0, &clip);
347   fillbitmap(motion_object_2_clip, 0xff, &clip);
418348   if (sprite_1_enabled() && sprite_2_enabled())
419349   {
420350      sx = org_2_x - org_1_x;
421351      sy = org_2_y - org_1_y;
422352      drawgfx(motion_object_2_clip, machine->gfx[1],
423353         ((spriteno >> 4) & 0x0f) + 32, 0,
424         0, 0, sx, sy, &clip, TRANSPARENCY_NONE, 0);
354         0, 0, sx, sy, &clip, TRANSPARENCY_PEN, 0);
425355   }
426356
427357    /* scan for collisions */
428358    for (sy = 0; sy < 16; sy++)
429359       for (sx = 0; sx < 16; sx++)
430360       {
431          if (*BITMAP_ADDR16(motion_object_1_vid, sy, sx) != pen0)
361          if (*BITMAP_ADDR16(motion_object_1_vid, sy, sx) != 0xff)
432362          {
433363              UINT8 collision_mask = 0;
434364
435365                /* check for background collision (M1CHAR) */
436            if (*BITMAP_ADDR16(tmpbitmap, org_1_y + sy, org_1_x + sx) != pen0)
366            if (((*BITMAP_ADDR16(tmpbitmap, org_1_y + sy, org_1_x + sx) - 4) & bgmask) != 0)
437367               collision_mask |= 0x04;
438368
439369                /* check for motion object collision (M1M2) */
440            if (*BITMAP_ADDR16(motion_object_2_clip, sy, sx) != pen0)
370            if (*BITMAP_ADDR16(motion_object_2_clip, sy, sx) != 0xff)
441371               collision_mask |= 0x10;
442372
443373            /* if we got one, trigger an interrupt */
444374            if ((collision_mask & exidy_collision_mask) && count++ < 128)
445375               timer_set(video_screen_get_time_until_pos(0, org_1_x + sx, org_1_y + sy), collision_mask, collision_irq_callback);
446376            }
447            if (*BITMAP_ADDR16(motion_object_2_vid, sy, sx) != pen0)
377            if (*BITMAP_ADDR16(motion_object_2_vid, sy, sx) != 0xff)
448378          {
449379                /* check for background collision (M2CHAR) */
450            if (*BITMAP_ADDR16(tmpbitmap, org_2_y + sy, org_2_x + sx) != pen0)
380            if (((*BITMAP_ADDR16(tmpbitmap, org_2_y + sy, org_2_x + sx) - 4) & bgmask) != 0)
451381               if ((exidy_collision_mask & 0x08) && count++ < 128)
452382                  timer_set(video_screen_get_time_until_pos(0, org_2_x + sx, org_2_y + sy), 0x08, collision_irq_callback);
453383            }
src/mame/video/vulgus.c
r1334r1335
1313
1414static int vulgus_palette_bank;
1515static tilemap *fg_tilemap, *bg_tilemap;
16static colortable *vulgus_colortable;
1716
1817
1918/***************************************************************************
r1334r1335
2625{
2726   int i;
2827
29   vulgus_colortable = colortable_alloc(machine, 256);
28   machine->colortable = colortable_alloc(machine, 256);
3029
3130   for (i = 0;i < 256;i++)
3231   {
r1334r1335
4847      bit3 = (color_prom[2*256] >> 3) & 0x01;
4948      b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
5049
51      colortable_palette_set_color(vulgus_colortable,i,MAKE_RGB(r,g,b));
50      colortable_palette_set_color(machine->colortable,i,MAKE_RGB(r,g,b));
5251      color_prom++;
5352   }
5453
r1334r1335
5857
5958   /* characters use colors 32-47 (?) */
6059   for (i = 0;i < machine->gfx[0]->total_colors * machine->gfx[0]->color_granularity;i++)
61      colortable_entry_set_value(vulgus_colortable, machine->gfx[0]->color_base + i, 32 + *color_prom++);
60      colortable_entry_set_value(machine->colortable, machine->gfx[0]->color_base + i, 32 + *color_prom++);
6261
6362   /* sprites use colors 16-31 */
6463   for (i = 0;i < machine->gfx[2]->total_colors * machine->gfx[2]->color_granularity;i++)
65      colortable_entry_set_value(vulgus_colortable, machine->gfx[2]->color_base + i, 16 + *color_prom++);
64      colortable_entry_set_value(machine->colortable, machine->gfx[2]->color_base + i, 16 + *color_prom++);
6665
6766   /* background tiles use colors 0-15, 64-79, 128-143, 192-207 in four banks */
6867   for (i = 0;i < machine->gfx[1]->total_colors * machine->gfx[1]->color_granularity / 4;i++)
6968   {
70      colortable_entry_set_value(vulgus_colortable, machine->gfx[1]->color_base + 0*32*8 + i, *color_prom);
71      colortable_entry_set_value(vulgus_colortable, machine->gfx[1]->color_base + 1*32*8 + i, *color_prom + 64);
72      colortable_entry_set_value(vulgus_colortable, machine->gfx[1]->color_base + 2*32*8 + i, *color_prom + 128);
73      colortable_entry_set_value(vulgus_colortable, machine->gfx[1]->color_base + 3*32*8 + i, *color_prom + 192);
69      colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 0*32*8 + i, *color_prom);
70      colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 1*32*8 + i, *color_prom + 64);
71      colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 2*32*8 + i, *color_prom + 128);
72      colortable_entry_set_value(machine->colortable, machine->gfx[1]->color_base + 3*32*8 + i, *color_prom + 192);
7473      color_prom++;
7574   }
7675}
r1334r1335
121120   fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8, 8,32,32);
122121   bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_cols,TILEMAP_TYPE_PEN,16,16,32,32);
123122
124   colortable_configure_tilemap_groups(vulgus_colortable, fg_tilemap, machine->gfx[0], 47);
123   colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 47);
125124}
126125
127126
src/mame/video/segasyse.c
r1334r1335
334334
335335*******************************************************************************/
336336
337void segae_drawscanline(int line, int chips, int blank)
337static void segae_drawscanline(int line, int chips, int blank)
338338{
339339
340340   UINT8* dest;
src/mame/video/pacman.c
r1334r1335
2020#include "includes/pacman.h"
2121#include "video/resnet.h"
2222
23static colortable *pacman_colortable;
2423static tilemap *bg_tilemap;
2524static UINT8 charbank;
2625static UINT8 spritebank;
r1334r1335
9392         2, &resistances[1], bweights, 0, 0);
9493
9594   /* allocate the colortable */
96   pacman_colortable = colortable_alloc(machine, 32);
95   machine->colortable = colortable_alloc(machine, 32);
9796
9897   /* create a lookup table for the palette */
9998   for (i = 0; i < 32; i++)
r1334r1335
118117      bit1 = (color_prom[i] >> 7) & 0x01;
119118      b = combine_2_weights(bweights, bit0, bit1);
120119
121      colortable_palette_set_color(pacman_colortable, i, MAKE_RGB(r, g, b));
120      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
122121   }
123122
124123   /* color_prom now points to the beginning of the lookup table */
r1334r1335
130129      UINT8 ctabentry = color_prom[i] & 0x0f;
131130
132131      /* first palette bank */
133      colortable_entry_set_value(pacman_colortable, i, ctabentry);
132      colortable_entry_set_value(machine->colortable, i, ctabentry);
134133
135134      /* second palette bank */
136      colortable_entry_set_value(pacman_colortable, i + 64*4, 0x10 + ctabentry);
135      colortable_entry_set_value(machine->colortable, i + 64*4, 0x10 + ctabentry);
137136   }
138137}
139138
r1334r1335
247246               spriteram[offs] & 1,spriteram[offs] & 2,
248247               sx,sy,
249248               &spriteclip,TRANSPARENCY_PENS,
250               colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0));
249               colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0));
251250
252251         /* also plot the sprite with wraparound (tunnel in Crush Roller) */
253252         drawgfx(bitmap,machine->gfx[1],
r1334r1335
256255               spriteram[offs] & 1,spriteram[offs] & 2,
257256               sx - 256,sy,
258257               &spriteclip,TRANSPARENCY_PENS,
259               colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0));
258               colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0));
260259      }
261260      /* In the Pac Man based games (NOT Pengo) the first two sprites must be offset */
262261      /* one pixel to the left to get a more correct placement */
r1334r1335
275274               spriteram[offs] & 1,spriteram[offs] & 2,
276275               sx,sy + xoffsethack,
277276               &spriteclip,TRANSPARENCY_PENS,
278               colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0));
277               colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0));
279278
280279         /* also plot the sprite with wraparound (tunnel in Crush Roller) */
281280         drawgfx(bitmap,machine->gfx[1],
r1334r1335
284283               spriteram[offs] & 2,spriteram[offs] & 1,
285284               sx - 256,sy + xoffsethack,
286285               &spriteclip,TRANSPARENCY_PENS,
287               colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0));
286               colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0));
288287      }
289288   }
290289
r1334r1335
417416            spriteram[offs] & 1,spriteram[offs] & 2,
418417            sx,sy,
419418            cliprect,TRANSPARENCY_PENS,
420            colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0));
419            colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0));
421420   }
422421   /* In the Pac Man based games (NOT Pengo) the first two sprites must be offset */
423422   /* one pixel to the left to get a more correct placement */
r1334r1335
438437            spriteram[offs] & 1,spriteram[offs] & 2,
439438            sx,sy + xoffsethack,
440439            cliprect,TRANSPARENCY_PENS,
441            colortable_get_transpen_mask(pacman_colortable, machine->gfx[1], color & 0x3f, 0));
440            colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color & 0x3f, 0));
442441   }
443442   return 0;
444443}
src/mame/drivers/pasha2.c
r1334r1335
386386}
387387
388388static MACHINE_DRIVER_START( pasha2 )
389   MDRV_CPU_ADD(E116T /*E116XT*/, 20000000)   /* 20 MHz */
389   MDRV_CPU_ADD(E116XT, 20000000*4)      /* 4x internal multiplier */
390390   MDRV_CPU_PROGRAM_MAP(pasha2_map,0)
391391   MDRV_CPU_IO_MAP(pasha2_io,0)
392   MDRV_CPU_VBLANK_INT(irq5_line_pulse, 1)
392   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
393393
394394   MDRV_SCREEN_REFRESH_RATE(60)
395395   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
src/mame/drivers/fgoal.c
r1334r1335
5959{
6060   int i;
6161
62   for (i = 0; i < 64; i++)
63   {
64      int r = (i >> 4) & 3;
65      int g = (i >> 2) & 3;
66      int b = (i >> 0) & 3;
67
68      palette_set_color_rgb(machine,i,
69         intensity(r),
70         intensity(g),
71         intensity(b));
72   }
73
74   palette_set_color(machine,0x40,MAKE_RGB(0x2e,0x80,0x2e));
75   palette_set_color(machine,0x41,MAKE_RGB(0x2e,0x2e,0x2e));
76
7762   /* for B/W screens PCB can be jumpered to use lower half of PROM */
7863
7964   for (i = 0; i < 128; i++)
8065   {
81      colortable[i] = color_prom[0x80 | i] & 63;
66      UINT8 color = color_prom[0x80 | i] & 63;
67      palette_set_color_rgb(machine, i, intensity(color >> 4), intensity(color >> 2), intensity(color >> 0));
8268   }
8369
84   colortable[0x80] = 0x40;
85   colortable[0x81] = 0x40;
86   colortable[0x82] = 0x40;
87   colortable[0x83] = 0x40;
88   colortable[0x84] = 0x40;
89   colortable[0x85] = 0x40;
90   colortable[0x86] = 0x40;
91   colortable[0x87] = 0x40;
70   for (i = 0; i < 8; i++)
71   {
72      palette_set_color(machine, 128 + 0*8 + i, MAKE_RGB(0x2e,0x80,0x2e));
73      palette_set_color(machine, 128 + 1*8 + i, MAKE_RGB(0x2e,0x2e,0x2e));
74   }
9275
93   colortable[0x88] = 0x41;
94   colortable[0x89] = 0x41;
95   colortable[0x8a] = 0x41;
96   colortable[0x8b] = 0x41;
97   colortable[0x8c] = 0x41;
98   colortable[0x8d] = 0x41;
99   colortable[0x8e] = 0x41;
100   colortable[0x8f] = 0x41;
76   /* ball is a fixed color */
77   palette_set_color_rgb(machine, 128 + 16, intensity(0x38 >> 4), intensity(0x38 >> 2), intensity(0x38 >> 0));
10178}
10279
10380
r1334r1335
398375   MDRV_SCREEN_SIZE(256, 263)
399376   MDRV_SCREEN_VISIBLE_AREA(0, 255, 16, 255)
400377   MDRV_GFXDECODE(fgoal)
401   MDRV_PALETTE_LENGTH(64 + 2)
402   MDRV_COLORTABLE_LENGTH(128 + 16)
378   MDRV_PALETTE_LENGTH(128 + 16 + 1)
403379
404380   MDRV_PALETTE_INIT(fgoal)
405381   MDRV_VIDEO_START(fgoal)
src/mame/drivers/megadriv.c
r1334r1335
608608
609609/* Note, In reality this transfer is NOT instant, the 68k isn't paused
610610   as the 68k address bus isn't accessed */
611static void megadrive_do_insta_vram_copy(UINT32 source, UINT16 length);
612611
613612/* Wani Wani World, James Pond 3, Pirates Gold! */
614void megadrive_do_insta_vram_copy(UINT32 source, UINT16 length)
613static void megadrive_do_insta_vram_copy(UINT32 source, UINT16 length)
615614{
616615   int x;
617616
src/mame/drivers/mexico86.c
r1334r1335
383383   MDRV_CPU_ADD_TAG("main",Z80, 24000000/4)      /* 6 MHz, Uses clock divided 24MHz OSC */
384384   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
385385
386   MDRV_CPU_ADD(Z80, 8000000/2)      /* 4 MHz, Uses 8Mhz OSC */
386   MDRV_CPU_ADD(Z80, 24000000/4)      /* 6 MHz, Uses clock divided 24MHz OSC */
387387   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
388388   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
389389
r1334r1335
391391   MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
392392   MDRV_CPU_VBLANK_INT(mexico86_m68705_interrupt,2)
393393
394   MDRV_CPU_ADD_TAG("sub", Z80, 24000000/4)      /* 6 MHz, Uses clock divided 24MHz OSC */
394   MDRV_CPU_ADD_TAG("sub", Z80, 8000000/2)      /* 4 MHz, Uses 8Mhz OSC */
395395   MDRV_CPU_PROGRAM_MAP(sub_cpu_map,0)
396396   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
397397
src/mame/drivers/malzak.c
r1334r1335
391391   8 * 10
392392};
393393
394static const rgb_t saa5050_palette[8] =
395{
396   MAKE_RGB(0x00, 0x00, 0x00),   /* black */
397   MAKE_RGB(0xff, 0x00, 0x00),   /* red */
398   MAKE_RGB(0x00, 0xff, 0x00),   /* green */
399   MAKE_RGB(0xff, 0xff, 0x00),   /* yellow */
400   MAKE_RGB(0x00, 0x00, 0xff),   /* blue */
401   MAKE_RGB(0xff, 0x00, 0xff),   /* magenta */
402   MAKE_RGB(0x00, 0xff, 0xff),   /* cyan */
403   MAKE_RGB(0xff, 0xff, 0xff)   /* white */
404};
405
406/* bgnd, fgnd */
407static   unsigned   short   saa5050_colortable[64 * 2] =
408{
409   0,1, 0,1, 0,2, 0,3, 0,4, 0,5, 0,6, 0,7,
410   1,0, 1,1, 1,2, 1,3, 1,4, 1,5, 1,6, 1,7,
411   2,0, 2,1, 2,2, 2,3, 2,4, 2,5, 2,6, 2,7,
412   3,0, 3,1, 3,2, 3,3, 3,4, 3,5, 3,6, 3,7,
413   4,0, 4,1, 4,2, 4,3, 4,4, 4,5, 4,6, 4,7,
414   5,0, 5,1, 5,2, 5,3, 5,4, 5,5, 5,6, 5,7,
415   6,0, 6,1, 6,2, 6,3, 6,4, 6,5, 6,6, 6,7,
416   7,0, 7,1, 7,2, 7,3, 7,4, 7,5, 7,6, 7,7
417};
418
419394//add s2636 decodes here (i.e. from zac2650) and maybe re-arrange them
420395static GFXDECODE_START( malzak )
421396   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,  0, 16 )
r1334r1335
429404
430405static PALETTE_INIT( malzak )
431406{
432   palette_set_colors(machine, 0, saa5050_palette, ARRAY_LENGTH(saa5050_palette));
433   memcpy(colortable, saa5050_colortable, sizeof (saa5050_colortable));
407   int i;
408
409   for (i = 0; i < 8*8; i++)
410   {
411      palette_set_color_rgb(machine, i * 2 + 0, pal1bit(i >> 3), pal1bit(i >> 4), pal1bit(i >> 5));
412      palette_set_color_rgb(machine, i * 2 + 1, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
413   }
434414}
435415
436416
r1334r1335
478458   MDRV_SCREEN_SIZE(240, 256)   /* vert size is a guess */
479459   MDRV_SCREEN_VISIBLE_AREA(0, 239, 0, 239)
480460   MDRV_GFXDECODE(malzak)
481   MDRV_PALETTE_LENGTH(16)
461   MDRV_PALETTE_LENGTH(128)
482462   MDRV_PALETTE_INIT(malzak)
483   MDRV_COLORTABLE_LENGTH(128)
484463
485464//  MDRV_MACHINE_RESET(malzak)
486465
src/mame/drivers/bsktball.c
r1334r1335
3232 *
3333 *************************************/
3434
35static UINT16 colortable_source[] =
35static PALETTE_INIT( bsktball )
3636{
37   /* Playfield */
38   0x01, 0x00, 0x00, 0x00,
39   0x01, 0x03, 0x03, 0x03,
37   int i;
4038
41   /* Motion */
42   0x01, 0x00, 0x00, 0x00,
43   0x01, 0x00, 0x01, 0x00,
44   0x01, 0x00, 0x02, 0x00,
45   0x01, 0x00, 0x03, 0x00,
39   machine->colortable = colortable_alloc(machine, 4);
4640
47   0x01, 0x01, 0x00, 0x00,
48   0x01, 0x01, 0x01, 0x00,
49   0x01, 0x01, 0x02, 0x00,
50   0x01, 0x01, 0x03, 0x00,
41   colortable_palette_set_color(machine->colortable,0,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
42   colortable_palette_set_color(machine->colortable,1,MAKE_RGB(0x80,0x80,0x80)); /* LIGHT GREY */
43   colortable_palette_set_color(machine->colortable,2,MAKE_RGB(0x50,0x50,0x50)); /* DARK GREY */
44   colortable_palette_set_color(machine->colortable,3,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */
5145
52   0x01, 0x02, 0x00, 0x00,
53   0x01, 0x02, 0x01, 0x00,
54   0x01, 0x02, 0x02, 0x00,
55   0x01, 0x02, 0x03, 0x00,
46   /* playfield */
47   for (i = 0; i < 2; i++)
48   {
49      colortable_entry_set_value(machine->colortable, i*4 + 0, 1);
50      colortable_entry_set_value(machine->colortable, i*4 + 1, 3 * i);
51      colortable_entry_set_value(machine->colortable, i*4 + 2, 3 * i);
52      colortable_entry_set_value(machine->colortable, i*4 + 3, 3 * i);
53   }
5654
57   0x01, 0x03, 0x00, 0x00,
58   0x01, 0x03, 0x01, 0x00,
59   0x01, 0x03, 0x02, 0x00,
60   0x01, 0x03, 0x03, 0x00,
61
62   0x01, 0x00, 0x00, 0x01,
63   0x01, 0x00, 0x01, 0x01,
64   0x01, 0x00, 0x02, 0x01,
65   0x01, 0x00, 0x03, 0x01,
66
67   0x01, 0x01, 0x00, 0x01,
68   0x01, 0x01, 0x01, 0x01,
69   0x01, 0x01, 0x02, 0x01,
70   0x01, 0x01, 0x03, 0x01,
71
72   0x01, 0x02, 0x00, 0x01,
73   0x01, 0x02, 0x01, 0x01,
74   0x01, 0x02, 0x02, 0x01,
75   0x01, 0x02, 0x03, 0x01,
76
77   0x01, 0x03, 0x00, 0x01,
78   0x01, 0x03, 0x01, 0x01,
79   0x01, 0x03, 0x02, 0x01,
80   0x01, 0x03, 0x03, 0x01,
81
82   0x01, 0x00, 0x00, 0x02,
83   0x01, 0x00, 0x01, 0x02,
84   0x01, 0x00, 0x02, 0x02,
85   0x01, 0x00, 0x03, 0x02,
86
87   0x01, 0x01, 0x00, 0x02,
88   0x01, 0x01, 0x01, 0x02,
89   0x01, 0x01, 0x02, 0x02,
90   0x01, 0x01, 0x03, 0x02,
91
92   0x01, 0x02, 0x00, 0x02,
93   0x01, 0x02, 0x01, 0x02,
94   0x01, 0x02, 0x02, 0x02,
95   0x01, 0x02, 0x03, 0x02,
96
97   0x01, 0x03, 0x00, 0x02,
98   0x01, 0x03, 0x01, 0x02,
99   0x01, 0x03, 0x02, 0x02,
100   0x01, 0x03, 0x03, 0x02,
101
102   0x01, 0x00, 0x00, 0x03,
103   0x01, 0x00, 0x01, 0x03,
104   0x01, 0x00, 0x02, 0x03,
105   0x01, 0x00, 0x03, 0x03,
106
107   0x01, 0x01, 0x00, 0x03,
108   0x01, 0x01, 0x01, 0x03,
109   0x01, 0x01, 0x02, 0x03,
110   0x01, 0x01, 0x03, 0x03,
111
112   0x01, 0x02, 0x00, 0x03,
113   0x01, 0x02, 0x01, 0x03,
114   0x01, 0x02, 0x02, 0x03,
115   0x01, 0x02, 0x03, 0x03,
116
117   0x01, 0x03, 0x00, 0x03,
118   0x01, 0x03, 0x01, 0x03,
119   0x01, 0x03, 0x02, 0x03,
120   0x01, 0x03, 0x03, 0x03,
121};
122
123static PALETTE_INIT( bsktball )
124{
125   palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00)); /* BLACK */
126   palette_set_color(machine,1,MAKE_RGB(0x80,0x80,0x80)); /* LIGHT GREY */
127   palette_set_color(machine,2,MAKE_RGB(0x50,0x50,0x50)); /* DARK GREY */
128   palette_set_color(machine,3,MAKE_RGB(0xff,0xff,0xff)); /* WHITE */
129   memcpy(colortable,colortable_source,sizeof(colortable_source));
55   /* motion */
56   for (i = 0; i < 4*4*4; i++)
57   {
58      colortable_entry_set_value(machine->colortable, 2*4 + i*4 + 0, 1);
59      colortable_entry_set_value(machine->colortable, 2*4 + i*4 + 1, (i >> 2) & 3);
60      colortable_entry_set_value(machine->colortable, 2*4 + i*4 + 2, (i >> 0) & 3);
61      colortable_entry_set_value(machine->colortable, 2*4 + i*4 + 3, (i >> 4) & 3);
62   }
13063}
13164
13265
r1334r1335
288221   MDRV_SCREEN_SIZE(32*8, 28*8)
289222   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
290223   MDRV_GFXDECODE(bsktball)
291   MDRV_PALETTE_LENGTH(4)
292   MDRV_COLORTABLE_LENGTH(sizeof(colortable_source) / sizeof(colortable_source[0]))
224   MDRV_PALETTE_LENGTH(2*4 + 4*4*4*4)
293225
294226   MDRV_PALETTE_INIT(bsktball)
295227   MDRV_VIDEO_START(bsktball)
src/mame/drivers/acefruit.c
r1334r1335
240240   palette_set_color( machine, 6, MAKE_RGB(0xff, 0xff, 0xff) );
241241   palette_set_color( machine, 7, MAKE_RGB(0x7f, 0x3f, 0x1f) );
242242
243   colortable[ 0 ] = 0;
244   colortable[ 1 ] = 1;
245   colortable[ 2 ] = 2;
246   colortable[ 3 ] = 3;
247   colortable[ 4 ] = 4;
248   colortable[ 5 ] = 5;
249   colortable[ 6 ] = 6;
250   colortable[ 7 ] = 7;
251
252243   /* tiles */
253   palette_set_color( machine, 8, MAKE_RGB(0xff, 0xff, 0xff) );
254   palette_set_color( machine, 9, MAKE_RGB(0x00, 0x00, 0xff) );
255   palette_set_color( machine, 10, MAKE_RGB(0x00, 0xff, 0x00) );
256   palette_set_color( machine, 11, MAKE_RGB(0xff, 0x00, 0x00) );
257
258   colortable[ 8 ] = 0;
259   colortable[ 9 ] = 8;
260   colortable[ 10 ] = 0;
261   colortable[ 11 ] = 9;
262   colortable[ 12 ] = 0;
263   colortable[ 13 ] = 10;
264   colortable[ 14 ] = 0;
265   colortable[ 15 ] = 11;
244   palette_set_color( machine, 8, MAKE_RGB(0x00, 0x00, 0x00) );
245   palette_set_color( machine, 9, MAKE_RGB(0xff, 0xff, 0xff) );
246   palette_set_color( machine, 10, MAKE_RGB(0x00, 0x00, 0x00) );
247   palette_set_color( machine, 11, MAKE_RGB(0x00, 0x00, 0xff) );
248   palette_set_color( machine, 12, MAKE_RGB(0x00, 0x00, 0x00) );
249   palette_set_color( machine, 13, MAKE_RGB(0x00, 0xff, 0x00) );
250   palette_set_color( machine, 14, MAKE_RGB(0x00, 0x00, 0x00) );
251   palette_set_color( machine, 15, MAKE_RGB(0xff, 0x00, 0x00) );
266252}
267253
268254static ADDRESS_MAP_START( acefruit_map, ADDRESS_SPACE_PROGRAM, 8 )
r1334r1335
573559   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
574560   MDRV_SCREEN_SIZE(512, 256)
575561   MDRV_SCREEN_VISIBLE_AREA(0, 511, 0, 255)
576   MDRV_PALETTE_LENGTH(12)
577   MDRV_COLORTABLE_LENGTH(16)
562   MDRV_PALETTE_LENGTH(16)
578563
579564   MDRV_NVRAM_HANDLER(generic_0fill)
580565
src/mame/drivers/limenko.c
r1334r1335
475475
476476
477477static MACHINE_DRIVER_START( limenko )
478   MDRV_CPU_ADD(E132XT, 80000000)   //E132XN!
478   MDRV_CPU_ADD(E132XN, 20000000*4)   /* 4x internal multiplier */
479479   MDRV_CPU_PROGRAM_MAP(limenko_map,0)
480480   MDRV_CPU_IO_MAP(limenko_io_map,0)
481   MDRV_CPU_VBLANK_INT(irq5_line_hold, 1)
481   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
482482
483483   MDRV_SCREEN_REFRESH_RATE(60)
484484   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
r1334r1335
501501MACHINE_DRIVER_END
502502
503503static MACHINE_DRIVER_START( spotty )
504   MDRV_CPU_ADD(GMS30C2232, 80000000)   /* 20 MHz with 4x internal clock multiplier? */
504   MDRV_CPU_ADD(GMS30C2232, 20000000)   /* 20 MHz, no internal multiplier */
505505   MDRV_CPU_PROGRAM_MAP(spotty_map,0)
506506   MDRV_CPU_IO_MAP(spotty_io_map,0)
507   MDRV_CPU_VBLANK_INT(irq5_line_hold, 1)
507   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
508508
509509   MDRV_CPU_ADD(I8051, 4000000)   /* 4 MHz */
510510   MDRV_CPU_PROGRAM_MAP(spotty_sound_prg_map, 0)
src/mame/drivers/namcos86.c
r1334r1335
10881088   MDRV_SCREEN_SIZE(64*8, 32*8)
10891089   MDRV_SCREEN_VISIBLE_AREA(3 + 8*8, 3 + 44*8-1, 2*8, 30*8-1)
10901090   MDRV_GFXDECODE(namcos86)
1091   MDRV_PALETTE_LENGTH(512)
1092   MDRV_COLORTABLE_LENGTH(4096)
1091   MDRV_PALETTE_LENGTH(4096)
10931092
10941093   MDRV_PALETTE_INIT(namcos86)
10951094   MDRV_VIDEO_START(namcos86)
r1334r1335
12161215   ROM_REGION( 0x1420, REGION_PROMS, 0 )
12171216   ROM_LOAD( "sk3-1.3r",     0x0000, 0x0200, CRC(9e81dedd) SHA1(9d2ddf51788d22ed65db9070684e586b2f64f99e) )   /* red & green components */
12181217   ROM_LOAD( "sk3-2.3s",     0x0200, 0x0200, CRC(cbfec4dd) SHA1(98adf5db270a853ab2a2e1cdd9edfd5657287a96) )   /* blue component */
1219   ROM_LOAD( "sk3-3.4v",     0x0400, 0x0800, CRC(81714109) SHA1(577e513369a4368b7dd29dff80904eb0ac2004ff) )   /* tiles colortable */
1220   ROM_LOAD( "sk3-4.5v",     0x0c00, 0x0800, CRC(1bf25acc) SHA1(a8db254ba4cbb85efc232a5bf9b268534455ad4a) )   /* sprites colortable */
1218   ROM_LOAD( "sk3-3.4v",     0x0400, 0x0800, CRC(81714109) SHA1(577e513369a4368b7dd29dff80904eb0ac2004ff) )   /* tiles color table */
1219   ROM_LOAD( "sk3-4.5v",     0x0c00, 0x0800, CRC(1bf25acc) SHA1(a8db254ba4cbb85efc232a5bf9b268534455ad4a) )   /* sprites color table */
12211220   ROM_LOAD( "sk3-5.6u",     0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) )   /* tile address decoder (used at runtime) */
12221221
12231222   ROM_REGION( 0x10000, REGION_CPU3, 0 )
r1334r1335
12521251   ROM_REGION( 0x1420, REGION_PROMS, 0 )
12531252   ROM_LOAD( "sk3-1.3r",     0x0000, 0x0200, CRC(9e81dedd) SHA1(9d2ddf51788d22ed65db9070684e586b2f64f99e) )   /* red & green components */
12541253   ROM_LOAD( "sk3-2.3s",     0x0200, 0x0200, CRC(cbfec4dd) SHA1(98adf5db270a853ab2a2e1cdd9edfd5657287a96) )   /* blue component */
1255   ROM_LOAD( "sk3-3.4v",     0x0400, 0x0800, CRC(81714109) SHA1(577e513369a4368b7dd29dff80904eb0ac2004ff) )   /* tiles colortable */
1256   ROM_LOAD( "sk3-4.5v",     0x0c00, 0x0800, CRC(1bf25acc) SHA1(a8db254ba4cbb85efc232a5bf9b268534455ad4a) )   /* sprites colortable */
1254   ROM_LOAD( "sk3-3.4v",     0x0400, 0x0800, CRC(81714109) SHA1(577e513369a4368b7dd29dff80904eb0ac2004ff) )   /* tiles color table */
1255   ROM_LOAD( "sk3-4.5v",     0x0c00, 0x0800, CRC(1bf25acc) SHA1(a8db254ba4cbb85efc232a5bf9b268534455ad4a) )   /* sprites color table */
12571256   ROM_LOAD( "sk3-5.6u",     0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) )   /* tile address decoder (used at runtime) */
12581257
12591258   ROM_REGION( 0x10000, REGION_CPU3, 0 )
r1334r1335
12871286   ROM_REGION( 0x1420, REGION_PROMS, 0 )
12881287   ROM_LOAD( "hm1-1.3r",     0x0000, 0x0200, CRC(cc801088) SHA1(d2c39ac1694d9b8c426e253702ecd096e68c6db9) )   /* red & green components */
12891288   ROM_LOAD( "hm1-2.3s",     0x0200, 0x0200, CRC(a1cb71c5) SHA1(d8c33c2e52d64ebf4a07d8a26453e7b872cae413) )   /* blue component */
1290   ROM_LOAD( "hm1-3.4v",     0x0400, 0x0800, CRC(e362d613) SHA1(16d87711c1ac4ac2b649a32a5627cbd62cc5031f) )   /* tiles colortable */
1291   ROM_LOAD( "hm1-4.5v",     0x0c00, 0x0800, CRC(678252b4) SHA1(9e2f7328532be3ac4b48bd5d52cd993108558452) )   /* sprites colortable */
1289   ROM_LOAD( "hm1-3.4v",     0x0400, 0x0800, CRC(e362d613) SHA1(16d87711c1ac4ac2b649a32a5627cbd62cc5031f) )   /* tiles color table */
1290   ROM_LOAD( "hm1-4.5v",     0x0c00, 0x0800, CRC(678252b4) SHA1(9e2f7328532be3ac4b48bd5d52cd993108558452) )   /* sprites color table */
12921291   ROM_LOAD( "hm1-5.6u",     0x1400, 0x0020, CRC(475bf500) SHA1(7e6a91e57d3709a5c70786c8e3ed545ee6026d03) )   /* tile address decoder (used at runtime) */
12931292
12941293   ROM_REGION( 0x10000, REGION_CPU3, 0 )
r1334r1335
13281327   ROM_REGION( 0x1420, REGION_PROMS, 0 )
13291328   ROM_LOAD( "ri1-1.3r",     0x0000, 0x0200, CRC(29cd0400) SHA1(a9b0d09492710e72e34155cd6a7b7c1a34c56b20) )   /* red & green components */
13301329   ROM_LOAD( "ri1-2.3s",     0x0200, 0x0200, CRC(02fd278d) SHA1(db104fc7acf2739def902180981eb7ba10ec3dda) )   /* blue component */
1331   ROM_LOAD( "ri1-3.4v",     0x0400, 0x0800, CRC(cbd7e53f) SHA1(77ef70be4e8a21948d697649352a5e3527086cf2) )   /* tiles colortable */
1332   ROM_LOAD( "ri1-4.5v",     0x0c00, 0x0800, CRC(22921617) SHA1(7304cb5a86f524f912feb8b58801393cce5d3b09) )   /* sprites colortable */
1330   ROM_LOAD( "ri1-3.4v",     0x0400, 0x0800, CRC(cbd7e53f) SHA1(77ef70be4e8a21948d697649352a5e3527086cf2) )   /* tiles color table */
1331   ROM_LOAD( "ri1-4.5v",     0x0c00, 0x0800, CRC(22921617) SHA1(7304cb5a86f524f912feb8b58801393cce5d3b09) )   /* sprites color table */
13331332   ROM_LOAD( "ri1-5.6u",     0x1400, 0x0020, CRC(e2188075) SHA1(be079ace2070433d4d90c757aef3e415b4e21455) )   /* tile address decoder (used at runtime) */
13341333
13351334   ROM_REGION( 0x10000, REGION_CPU3, 0 )
r1334r1335
13701369   ROM_REGION( 0x1420, REGION_PROMS, 0 )
13711370   ROM_LOAD( "gt1-1.3r",     0x0000, 0x0200, CRC(2f0ddddb) SHA1(27fa45c0baf9a48002db11be9b3c0472ecfd986c) )   /* red & green components */
13721371   ROM_LOAD( "gt1-2.3s",     0x0200, 0x0200, CRC(87d27025) SHA1(a50f969d48a99c6d29141458fb3e34b23cf5e67c) )   /* blue component */
1373   ROM_LOAD( "gt1-3.4v",     0x0400, 0x0800, CRC(c178de99) SHA1(67289ef9e5068636023316560f9f1690a8384bfb) )   /* tiles colortable */
1374   ROM_LOAD( "gt1-4.5v",     0x0c00, 0x0800, CRC(9f48ef17) SHA1(78c813dd57326f3f5ab785005ef89ba96303adeb) )   /* sprites colortable */
1372   ROM_LOAD( "gt1-3.4v",     0x0400, 0x0800, CRC(c178de99) SHA1(67289ef9e5068636023316560f9f1690a8384bfb) )   /* tiles color table */
1373   ROM_LOAD( "gt1-4.5v",     0x0c00, 0x0800, CRC(9f48ef17) SHA1(78c813dd57326f3f5ab785005ef89ba96303adeb) )   /* sprites color table */
13751374   ROM_LOAD( "gt1-5.6u",     0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) )   /* tile address decoder (used at runtime) */
13761375
13771376   ROM_REGION( 0x10000, REGION_CPU3, 0 )
r1334r1335
14211420   ROM_REGION( 0x1420, REGION_PROMS, 0 )
14221421   ROM_LOAD( "rt1-1.3r",     0x0000, 0x0200, CRC(8ef3bb9d) SHA1(4636d6b8ba7611b11d4863fab02475dc4a619eaf) )   /* red & green components */
14231422   ROM_LOAD( "rt1-2.3s",     0x0200, 0x0200, CRC(6510a8f2) SHA1(935f140bfa7e6f8cebafa7f1b0de99dd319273d4) )   /* blue component */
1424   ROM_LOAD( "rt1-3.4v",     0x0400, 0x0800, CRC(95c7d944) SHA1(ca5fea028674882a61507ac7c89ada96f5b2674d) )   /* tiles colortable */
1425   ROM_LOAD( "rt1-4.5v",     0x0c00, 0x0800, CRC(1391fec9) SHA1(8ca94e22110b20d2ecdf03610bcc89ff4245920f) )   /* sprites colortable */
1423   ROM_LOAD( "rt1-3.4v",     0x0400, 0x0800, CRC(95c7d944) SHA1(ca5fea028674882a61507ac7c89ada96f5b2674d) )   /* tiles color table */
1424   ROM_LOAD( "rt1-4.5v",     0x0c00, 0x0800, CRC(1391fec9) SHA1(8ca94e22110b20d2ecdf03610bcc89ff4245920f) )   /* sprites color table */
14261425   ROM_LOAD( "rt1-5.6u",     0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) )   /* tile address decoder (used at runtime) */
14271426
14281427   ROM_REGION( 0x10000, REGION_CPU3, 0 )
r1334r1335
14721471   ROM_REGION( 0x1420, REGION_PROMS, 0 )
14731472   ROM_LOAD( "rt1-1.3r",     0x0000, 0x0200, CRC(8ef3bb9d) SHA1(4636d6b8ba7611b11d4863fab02475dc4a619eaf) )   /* red & green components */
14741473   ROM_LOAD( "rt1-2.3s",     0x0200, 0x0200, CRC(6510a8f2) SHA1(935f140bfa7e6f8cebafa7f1b0de99dd319273d4) )   /* blue component */
1475   ROM_LOAD( "rt1-3.4v",     0x0400, 0x0800, CRC(95c7d944) SHA1(ca5fea028674882a61507ac7c89ada96f5b2674d) )   /* tiles colortable */
1476   ROM_LOAD( "rt1-4.5v",     0x0c00, 0x0800, CRC(1391fec9) SHA1(8ca94e22110b20d2ecdf03610bcc89ff4245920f) )   /* sprites colortable */
1474   ROM_LOAD( "rt1-3.4v",     0x0400, 0x0800, CRC(95c7d944) SHA1(ca5fea028674882a61507ac7c89ada96f5b2674d) )   /* tiles color table */
1475   ROM_LOAD( "rt1-4.5v",     0x0c00, 0x0800, CRC(1391fec9) SHA1(8ca94e22110b20d2ecdf03610bcc89ff4245920f) )   /* sprites color table */
14771476   ROM_LOAD( "rt1-5.6u",     0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) )   /* tile address decoder (used at runtime) */
14781477
14791478   ROM_REGION( 0x10000, REGION_CPU3, 0 )
r1334r1335
15231522   ROM_REGION( 0x1420, REGION_PROMS, 0 )
15241523   ROM_LOAD( "wm1-1.3r",     0x0000, 0x0200, CRC(1af8ade8) SHA1(1aa0d314c34abc4154092d4b588214afb0b21e22) )   /* red & green components */
15251524   ROM_LOAD( "wm1-2.3s",     0x0200, 0x0200, CRC(8694e213) SHA1(f00d692e587c3706e71b6eeef21e1ea87c9dd921) )   /* blue component */
1526   ROM_LOAD( "wm1-3.4v",     0x0400, 0x0800, CRC(2ffaf9a4) SHA1(2002df3cc38e05f3e127d05c244cb101d1f1d85f) )   /* tiles colortable */
1527   ROM_LOAD( "wm1-4.5v",     0x0c00, 0x0800, CRC(f4e83e0b) SHA1(b000d884c6e0373b0403bc9d63eb0452c1197491) )   /* sprites colortable */
1525   ROM_LOAD( "wm1-3.4v",     0x0400, 0x0800, CRC(2ffaf9a4) SHA1(2002df3cc38e05f3e127d05c244cb101d1f1d85f) )   /* tiles color table */
1526   ROM_LOAD( "wm1-4.5v",     0x0c00, 0x0800, CRC(f4e83e0b) SHA1(b000d884c6e0373b0403bc9d63eb0452c1197491) )   /* sprites color table */
15281527   ROM_LOAD( "wm1-5.6u",     0x1400, 0x0020, CRC(e4130804) SHA1(e1a3e1383186d036fba6dc8a8681f48f24f59281) )   /* tile address decoder (used at runtime) */
15291528
15301529   ROM_REGION( 0x10000, REGION_CPU3, 0 )
src/mame/drivers/snk.c
r1334r1335
4040
4141Stephh's notes (based on the games Z80 code and some tests) :
4242
431)  'ftsoccer'
431)  'fsoccerb'
4444
4545  - The code to support the rotary jotsticks has been removed and/or patched
4646    in this version (check the 'jmp' instruction at 0x00f1).
r1334r1335
120120 - revamped CPU handshaking, improved clipping and made changes public to
121121   marvins.c, hal21.c and sgladiat.c
122122 - fixed shadows in tnk3, athena, fitegolf, countryc,
123 and ftsoccer
124 - added highlights to tdfever and ftsoccer(needs masking at team selection)
123 and fsoccer
124 - added highlights to tdfever and fsoccer(needs masking at team selection)
125125 - notes:
126126
127127    Mad Crasher and Gladiator(sgladiat.c) have different memory maps but
r1334r1335
466466      case 0x500: return snk_input_port_r( 9 );   // unused by tdfever
467467      case 0x580: return snk_input_port_r( 10 );   // dsw
468468      case 0x600: return snk_input_port_r( 11 );   // dsw
469      case 0x080: return snk_input_port_r( 12 );   // player start (types C and D in 'ftsoccer')
469      case 0x080: return snk_input_port_r( 12 );   // player start (types C and D in 'fsoccer')
470470
471471      case 0x700: return(snk_cpuB_nmi_trigger_r(0));
472472
r1334r1335
12581258MACHINE_DRIVER_END
12591259
12601260
1261static MACHINE_DRIVER_START( ftsoccer )
1261static MACHINE_DRIVER_START( fsoccer )
12621262
12631263   /* basic machine hardware */
12641264   MDRV_CPU_ADD(Z80, 4000000)
r1334r1335
12721272   MDRV_CPU_ADD(Z80, 4000000)
12731273   /* audio CPU */
12741274   MDRV_CPU_PROGRAM_MAP(Y8950_sound_map, 0)
1275   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
1275   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
12761276
12771277   MDRV_SCREEN_REFRESH_RATE(60)
12781278   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
r1334r1335
26652665
26662666/***********************************************************************/
26672667
2668ROM_START( ftsoccer )
2668ROM_START( fsoccer )
26692669   ROM_REGION( 0x10000, REGION_CPU1, 0 )     /* 64k for cpuA code */
2670   ROM_LOAD( "fs3_ver4.bin",  0x00000, 0x10000, CRC(94c3f918) SHA1(7c8343556d6c3897e72f8b41c6fbdc5c58e78b8c) )
2671
2672   ROM_REGION( 0x10000, REGION_CPU2, 0 )     /* 64k for cpuB code */
2673   ROM_LOAD( "fs1_ver4.bin",  0x00000, 0x10000, CRC(97830108) SHA1(dab241baf8d889c768e1fbe25f1e5059b3cbbab6) )
2674
2675   ROM_REGION( 0x10000, REGION_CPU3, 0 )     /* 64k for sound code */
2676   ROM_LOAD( "fs2.bin",  0x00000, 0x10000, CRC(9ee54ea1) SHA1(4e3bbacaa0e247eb8c4043f394e763817a4f9a28) )
2677
2678   ROM_REGION( 0x0c00, REGION_PROMS, 0 )
2679   ROM_LOAD( "prom2.bin", 0x000, 0x400, CRC(bf4ac706) SHA1(b5015563d88dbd93ba2838f01b189812958f142b) ) /* red */
2680   ROM_LOAD( "prom1.bin", 0x400, 0x400, CRC(1bac8010) SHA1(16854b1b6f3d1be48a247796d65aeb90547099b6) ) /* green */
2681   ROM_LOAD( "prom3.bin", 0x800, 0x400, CRC(dbeddb14) SHA1(6053b587a3c8272aefe728a7198a15aa7fb9b2fa) ) /* blue */
2682
2683   ROM_REGION( 0x8000, REGION_GFX1, ROMREGION_DISPOSE ) /* characters */
2684   ROM_LOAD( "fs13.bin",  0x0000, 0x08000, CRC(0de7b7ad) SHA1(4fa54b2acf83f03d09d16fc054ad6623cafe0f4a) )
2685
2686   ROM_REGION( 0x50000, REGION_GFX2, ROMREGION_DISPOSE ) /* background tiles */
2687   ROM_LOAD( "fs14.bin",  0x00000, 0x10000, CRC(38c38b40) SHA1(c4580add0946720441f5ef751d0d4a944cd92ad5) )
2688   ROM_LOAD( "fs15.bin",  0x10000, 0x10000, CRC(a614834f) SHA1(d73930e4bd780915e1b0d7f3fe7cbeaad19c233f) )
2689
2690//  ROM_REGION( 0x40000, REGION_GFX3, ROMREGION_DISPOSE ) /* 16x16 sprites */
2691
2692   ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE ) /* 32x32 sprites */
2693   ROM_LOAD( "fs5.bin",  0x10000, 0x10000, CRC(def2f1d8) SHA1(b72e4dec3306d8afe461ac812b2de67ee85f9dd9) )
2694   ROM_LOAD( "fs6.bin",  0x00000, 0x10000, CRC(588d14b3) SHA1(c0489b061503677a38e4c5800ea8be17aabf4039) )
2695
2696   ROM_LOAD( "fs7.bin",  0x30000, 0x10000, CRC(d584964b) SHA1(7c806fc40dcce700ed0c268abbd2704938b65ff2) )
2697   ROM_LOAD( "fs8.bin",  0x20000, 0x10000, CRC(11156a7d) SHA1(f298a54fa4c118bf8e7c7cccb6c95a4b97daf4d4) )
2698
2699   ROM_LOAD( "fs9.bin",  0x50000, 0x10000, CRC(d8112aa6) SHA1(575dd6dff2f00901603768f2c121eb0ea5afa444) )
2700   ROM_LOAD( "fs10.bin",  0x40000, 0x10000, CRC(e42864d8) SHA1(fe18f58e5507676780fe181e2fb0e0e9d72e276e) )
2701
2702   ROM_LOAD( "fs11.bin",  0x70000, 0x10000, CRC(022f3e96) SHA1(57aa423b8f62015566bc3021300ac7e9682ed500) )
2703   ROM_LOAD( "fs12.bin",  0x60000, 0x10000, CRC(b2442c30) SHA1(ba9331810659726389494ddc7c94c5a02ba80747) )
2704
2705   ROM_REGION( 0x10000, REGION_SOUND1, 0 )
2706   ROM_LOAD( "fs4.bin",  0x00000, 0x10000, CRC(435c3716) SHA1(42053741f60594e7ae8516b3ba600f5badb3620f) )
2707ROM_END
2708
2709ROM_START( fsoccerb )
2710   ROM_REGION( 0x10000, REGION_CPU1, 0 )     /* 64k for cpuA code */
26702711   ROM_LOAD( "ft-003.bin",  0x00000, 0x10000, CRC(649d4448) SHA1(876a4cf3ce3211ee19390deb17a661ec52b419d2) )
26712712
26722713   ROM_REGION( 0x10000, REGION_CPU2, 0 )     /* 64k for cpuB code */
26732714   ROM_LOAD( "ft-001.bin",  0x00000, 0x10000, CRC(2f68e38b) SHA1(0cbf2de24a5a5ae2134eb6f1e1404691554192bc) )
26742715
26752716   ROM_REGION( 0x10000, REGION_CPU3, 0 )     /* 64k for sound code */
2676   ROM_LOAD( "ft-002.bin",  0x00000, 0x10000, CRC(9ee54ea1) SHA1(4e3bbacaa0e247eb8c4043f394e763817a4f9a28) )
2717   ROM_LOAD( "fs2.bin",  0x00000, 0x10000, CRC(9ee54ea1) SHA1(4e3bbacaa0e247eb8c4043f394e763817a4f9a28) )
26772718
26782719   ROM_REGION( 0x0c00, REGION_PROMS, 0 )
26792720   ROM_LOAD( "prom2.bin", 0x000, 0x400, CRC(bf4ac706) SHA1(b5015563d88dbd93ba2838f01b189812958f142b) ) /* red */
r1334r1335
26812722   ROM_LOAD( "prom3.bin", 0x800, 0x400, CRC(dbeddb14) SHA1(6053b587a3c8272aefe728a7198a15aa7fb9b2fa) ) /* blue */
26822723
26832724   ROM_REGION( 0x8000, REGION_GFX1, ROMREGION_DISPOSE ) /* characters */
2684   ROM_LOAD( "ft-013.bin",  0x0000, 0x08000, CRC(0de7b7ad) SHA1(4fa54b2acf83f03d09d16fc054ad6623cafe0f4a) )
2725   ROM_LOAD( "fs13.bin",  0x0000, 0x08000, CRC(0de7b7ad) SHA1(4fa54b2acf83f03d09d16fc054ad6623cafe0f4a) )
26852726
26862727   ROM_REGION( 0x50000, REGION_GFX2, ROMREGION_DISPOSE ) /* background tiles */
2687   ROM_LOAD( "ft-014.bin",  0x00000, 0x10000, CRC(38c38b40) SHA1(c4580add0946720441f5ef751d0d4a944cd92ad5) )
2688   ROM_LOAD( "ft-015.bin",  0x10000, 0x10000, CRC(a614834f) SHA1(d73930e4bd780915e1b0d7f3fe7cbeaad19c233f) )
2728   ROM_LOAD( "fs14.bin",  0x00000, 0x10000, CRC(38c38b40) SHA1(c4580add0946720441f5ef751d0d4a944cd92ad5) )
2729   ROM_LOAD( "fs15.bin",  0x10000, 0x10000, CRC(a614834f) SHA1(d73930e4bd780915e1b0d7f3fe7cbeaad19c233f) )
26892730
26902731//  ROM_REGION( 0x40000, REGION_GFX3, ROMREGION_DISPOSE ) /* 16x16 sprites */
26912732
26922733   ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE ) /* 32x32 sprites */
2693   ROM_LOAD( "ft-005.bin",  0x10000, 0x10000, CRC(def2f1d8) SHA1(b72e4dec3306d8afe461ac812b2de67ee85f9dd9) )
2694   ROM_LOAD( "ft-006.bin",  0x00000, 0x10000, CRC(588d14b3) SHA1(c0489b061503677a38e4c5800ea8be17aabf4039) )
2734   ROM_LOAD( "fs5.bin",  0x10000, 0x10000, CRC(def2f1d8) SHA1(b72e4dec3306d8afe461ac812b2de67ee85f9dd9) )
2735   ROM_LOAD( "fs6.bin",  0x00000, 0x10000, CRC(588d14b3) SHA1(c0489b061503677a38e4c5800ea8be17aabf4039) )
26952736
2696   ROM_LOAD( "ft-007.bin",  0x30000, 0x10000, CRC(d584964b) SHA1(7c806fc40dcce700ed0c268abbd2704938b65ff2) )
2697   ROM_LOAD( "ft-008.bin",  0x20000, 0x10000, CRC(11156a7d) SHA1(f298a54fa4c118bf8e7c7cccb6c95a4b97daf4d4) )
2737   ROM_LOAD( "fs7.bin",  0x30000, 0x10000, CRC(d584964b) SHA1(7c806fc40dcce700ed0c268abbd2704938b65ff2) )
2738   ROM_LOAD( "fs8.bin",  0x20000, 0x10000, CRC(11156a7d) SHA1(f298a54fa4c118bf8e7c7cccb6c95a4b97daf4d4) )
26982739
2699   ROM_LOAD( "ft-009.bin",  0x50000, 0x10000, CRC(d8112aa6) SHA1(575dd6dff2f00901603768f2c121eb0ea5afa444) )
2700   ROM_LOAD( "ft-010.bin",  0x40000, 0x10000, CRC(e42864d8) SHA1(fe18f58e5507676780fe181e2fb0e0e9d72e276e) )
2740   ROM_LOAD( "fs9.bin",  0x50000, 0x10000, CRC(d8112aa6) SHA1(575dd6dff2f00901603768f2c121eb0ea5afa444) )
2741   ROM_LOAD( "fs10.bin",  0x40000, 0x10000, CRC(e42864d8) SHA1(fe18f58e5507676780fe181e2fb0e0e9d72e276e) )
27012742
2702   ROM_LOAD( "ft-011.bin",  0x70000, 0x10000, CRC(022f3e96) SHA1(57aa423b8f62015566bc3021300ac7e9682ed500) )
2703   ROM_LOAD( "ft-012.bin",  0x60000, 0x10000, CRC(b2442c30) SHA1(ba9331810659726389494ddc7c94c5a02ba80747) )
2743   ROM_LOAD( "fs11.bin",  0x70000, 0x10000, CRC(022f3e96) SHA1(57aa423b8f62015566bc3021300ac7e9682ed500) )
2744   ROM_LOAD( "fs12.bin",  0x60000, 0x10000, CRC(b2442c30) SHA1(ba9331810659726389494ddc7c94c5a02ba80747) )
27042745
27052746   ROM_REGION( 0x10000, REGION_SOUND1, 0 )
2706   ROM_LOAD( "ft-004.bin",  0x00000, 0x10000, CRC(435c3716) SHA1(42053741f60594e7ae8516b3ba600f5badb3620f) )
2747   ROM_LOAD( "fs4.bin",  0x00000, 0x10000, CRC(435c3716) SHA1(42053741f60594e7ae8516b3ba600f5badb3620f) )
27072748ROM_END
27082749
27092750/***********************************************************************/
r1334r1335
38173858   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
38183859INPUT_PORTS_END
38193860
3820static INPUT_PORTS_START( ftsoccer )
3861static INPUT_PORTS_START( fsoccer )
38213862   PORT_START_TAG("IN0")
38223863   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
38233864   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
r1334r1335
42504291   /* c080 */ SNK_UNUSED
42514292};
42524293
4253static const SNK_INPUT_PORT_TYPE ftsoccer_io[SNK_MAX_INPUT_PORTS] = {
4294static const SNK_INPUT_PORT_TYPE fsoccer_io[SNK_MAX_INPUT_PORTS] = {
42544295   /* c000 */ SNK_INP0,
42554296   /* c100 */ SNK_INP1, SNK_INP2, SNK_INP3, SNK_INP4, /* joy1..joy4 */
42564297   /* c300 */ SNK_INP5, SNK_INP6, SNK_INP7, SNK_INP8, /* aim1..aim4 */
r1334r1335
44244465   snk_irq_delay = 1000;
44254466}
44264467
4427static DRIVER_INIT( ftsoccer ){
4468static DRIVER_INIT( fsoccer ){
44284469   snk_sound_busy_bit = 0x08;
4429   snk_io = ftsoccer_io;
4470   snk_io = fsoccer_io;
44304471   hard_flags = 0;
44314472   videoram = snk_rambase + 0x800;
44324473   snk_gamegroup = 7;
r1334r1335
44764517GAME( 1986, ikarijpb, ikari,    ikari,    ikarijpb, ikarijpb, ROT270, "bootleg", "Ikari (Japan bootleg)", GAME_NO_COCKTAIL )
44774518GAME( 1986, victroad, 0,        victroad, victroad, victroad, ROT270, "SNK", "Victory Road", GAME_NO_COCKTAIL )
44784519GAME( 1986, dogosoke, victroad, victroad, victroad, dogosoke, ROT270, "SNK", "Dogou Souken", GAME_NO_COCKTAIL )
4479GAME( 1986, dogosokj, victroad, victroad, dogosokj, dogosoke, ROT270, "bootleg", "Dogou Souken (Joystick bootleg)", GAME_NO_COCKTAIL )
4520GAME( 1986, dogosokj, victroad, victroad, dogosokj, dogosoke, ROT270, "bootleg", "Dogou Souken (Joystick hack bootleg)", GAME_NO_COCKTAIL )
44804521GAME( 1987, gwar,     0,        gwar,     gwar,     gwar,     ROT270, "SNK", "Guerrilla War (US)", GAME_NO_COCKTAIL )
44814522GAME( 1987, gwarj,    gwar,     gwar,     gwar,     gwar,     ROT270, "SNK", "Guevara (Japan)", GAME_NO_COCKTAIL )
44824523GAME( 1987, gwara,    gwar,     gwar,     gwar,     gwara,    ROT270, "SNK", "Guerrilla War (Version 1)", GAME_NO_COCKTAIL )
r1334r1335
44924533GAME( 1988, chopperb, chopper,  chopper1, legofair, chopper,  ROT270, "SNK", "Chopper I (US set 3)", GAME_NO_COCKTAIL )
44934534GAME( 1988, legofair, chopper,  chopper1, legofair, chopper,  ROT270, "SNK", "Koukuu Kihei Monogatari - The Legend of Air Cavalry (Japan)", GAME_NO_COCKTAIL )
44944535GAME( 1987, tdfever,  0,        tdfever,  tdfever,  tdfever,  ROT270, "SNK", "TouchDown Fever", GAME_NO_COCKTAIL )
4495GAME( 1987, tdfeverj, tdfever,  tdfever,  tdfeverj,  tdfever, ROT270, "SNK", "TouchDown Fever (Japan)", GAME_NO_COCKTAIL )
4536GAME( 1987, tdfeverj, tdfever,  tdfever,  tdfeverj,  tdfever, ROT270, "SNK", "TouchDown Fever (Japan)", GAME_NO_COCKTAIL )
44964537GAME( 1988, tdfever2, tdfever,  tdfever2, tdfever,  tdfever2, ROT270, "SNK", "TouchDown Fever 2", GAME_NO_COCKTAIL ) /* upgrade kit for Touchdown Fever */
4497GAME( 1988, ftsoccer, 0,        ftsoccer, ftsoccer, ftsoccer, ROT0,   "SNK", "Fighting Soccer", GAME_NO_COCKTAIL )
4538GAME( 1988, fsoccer,  0,        fsoccer,  fsoccer,  fsoccer,  ROT0,   "SNK", "Fighting Soccer (version 4)", GAME_NO_COCKTAIL )
4539GAME( 1988, fsoccerb, fsoccer,  fsoccer,  fsoccer,  fsoccer,  ROT0,   "bootleg", "Fighting Soccer (joystick hack bootleg)", GAME_NO_COCKTAIL )
4540
src/mame/drivers/f-32.c
r1334r1335
134134INPUT_PORTS_END
135135
136136static MACHINE_DRIVER_START( mosaicf2 )
137   MDRV_CPU_ADD_TAG("main", E132XT, 20000000) // E132XN actually! /* 20 MHz */
137   MDRV_CPU_ADD_TAG("main", E132XN, 20000000*4)   /* 4x internal multiplier */
138138   MDRV_CPU_PROGRAM_MAP(common_map,0)
139139   MDRV_CPU_IO_MAP(mosaicf2_io,0)
140   MDRV_CPU_VBLANK_INT(irq5_line_pulse, 1)
140   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
141141
142142   MDRV_SCREEN_REFRESH_RATE(60)
143143   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
src/mame/drivers/dgpix.c
r1334r1335
213213   coin_counter_w(1, data & 2);
214214}
215215
216static READ32_HANDLER( vblank_r )
217{
218   /* burn a bunch of cycles because this is polled frequently during busy loops */
219   activecpu_adjust_icount(-100);
220   return input_port_0_dword_r(offset, 0);
221}
222
216223static ADDRESS_MAP_START( cpu_map, ADDRESS_SPACE_PROGRAM, 32 )
217224   AM_RANGE(0x00000000, 0x007fffff) AM_RAM
218225   AM_RANGE(0x40000000, 0x4003ffff) AM_READWRITE(vram_r, vram_w)
r1334r1335
223230
224231static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 32 )
225232   AM_RANGE(0x0200, 0x0203) AM_READNOP // used to sync with the protecion PIC? tested bits 0 and 1
226   AM_RANGE(0x0400, 0x0403) AM_READWRITE(input_port_0_dword_r, vbuffer_w)
233   AM_RANGE(0x0400, 0x0403) AM_READWRITE(vblank_r, vbuffer_w)
227234   AM_RANGE(0x0a10, 0x0a13) AM_READ(input_port_1_dword_r)
228235   AM_RANGE(0x0200, 0x0203) AM_WRITE(coin_w)
229236   AM_RANGE(0x0c00, 0x0c03) AM_WRITENOP // writes only: 1, 0, 1 at startup
r1334r1335
311318}
312319
313320static MACHINE_DRIVER_START( dgpix )
314   MDRV_CPU_ADD(E132XT, 20000000)
321   MDRV_CPU_ADD(E132XT, 20000000*4)   /* 4x internal multiplier */
315322   MDRV_CPU_PROGRAM_MAP(cpu_map,0)
316323   MDRV_CPU_IO_MAP(io_map,0)
317324
src/mame/drivers/lazercmd.c
r1334r1335
599599   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 2 )
600600GFXDECODE_END
601601
602static UINT16 colortable_source[] =
603{
604    1, 0,
605    0, 1
606};
607602static PALETTE_INIT( lazercmd )
608603{
609   palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00));    /* black */
610   palette_set_color(machine,1,MAKE_RGB(0xb0,0xb0,0xb0));    /* white */
611   palette_set_color(machine,2,MAKE_RGB(0xff,0xff,0xff));   /* bright white */
612   memcpy(colortable,colortable_source,sizeof(colortable_source));
604   palette_set_color(machine,0,MAKE_RGB(0xb0,0xb0,0xb0));    /* white */
605   palette_set_color(machine,1,MAKE_RGB(0x00,0x00,0x00));    /* black */
606
607   palette_set_color(machine,2,MAKE_RGB(0x00,0x00,0x00));    /* black */
608   palette_set_color(machine,3,MAKE_RGB(0xb0,0xb0,0xb0));    /* white */
609
610   palette_set_color(machine,4,MAKE_RGB(0xff,0xff,0xff));    /* bright white */
613611}
614612
615613static MACHINE_DRIVER_START( lazercmd )
r1334r1335
634632   MDRV_SCREEN_VISIBLE_AREA(0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1,
635633                  0 * VERT_CHR, (VERT_RES - 1) * VERT_CHR - 1)
636634   MDRV_GFXDECODE(lazercmd)
637   MDRV_PALETTE_LENGTH(3)
638   MDRV_COLORTABLE_LENGTH(2*2)
635   MDRV_PALETTE_LENGTH(5)
639636
640637   MDRV_PALETTE_INIT(lazercmd)
641638   MDRV_VIDEO_UPDATE(lazercmd)
r1334r1335
670667   MDRV_SCREEN_VISIBLE_AREA(0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1,
671668                   0 * VERT_CHR, VERT_RES * VERT_CHR - 1)
672669   MDRV_GFXDECODE(lazercmd)
673   MDRV_PALETTE_LENGTH(3)
674   MDRV_COLORTABLE_LENGTH(2*2)
670   MDRV_PALETTE_LENGTH(5)
675671
676672   MDRV_PALETTE_INIT(lazercmd)
677673   MDRV_VIDEO_UPDATE(lazercmd)
r1334r1335
706702   MDRV_SCREEN_VISIBLE_AREA(0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1,
707703                  0 * VERT_CHR, (VERT_RES - 1) * VERT_CHR - 1)
708704   MDRV_GFXDECODE(lazercmd)
709   MDRV_PALETTE_LENGTH(3)
710   MDRV_COLORTABLE_LENGTH(2*2)
705   MDRV_PALETTE_LENGTH(5)
711706
712707   MDRV_PALETTE_INIT(lazercmd)
713708   MDRV_VIDEO_UPDATE(lazercmd)
src/mame/drivers/gstream.c
r1334r1335
385385}
386386
387387static MACHINE_DRIVER_START( gstream )
388   MDRV_CPU_ADD_TAG("main", E132XT, 16000000)   /* 16 Mhz? */
388   MDRV_CPU_ADD_TAG("main", E132XT, 16000000*4)   /* 4x internal multiplier */
389389   MDRV_CPU_PROGRAM_MAP(gstream_32bit_map,0)
390390   MDRV_CPU_IO_MAP(gstream_io,0)
391   MDRV_CPU_VBLANK_INT(irq5_line_hold,1)
391   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
392392
393393   MDRV_SCREEN_REFRESH_RATE(60)
394394   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
src/mame/drivers/mogura.c
r1334r1335
1010static PALETTE_INIT( mogura )
1111{
1212   int i,j;
13   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
1413
1514   j = 0;
1615   for (i = 0;i < 0x20;i++)
src/mame/drivers/boxer.c
r1334r1335
8080   palette_set_color(machine,0, MAKE_RGB(0x00,0x00,0x00));
8181   palette_set_color(machine,1, MAKE_RGB(0xff,0xff,0xff));
8282
83   colortable[0] = 0;
84   colortable[1] = 1;
85   colortable[2] = 1;
86   colortable[3] = 0;
83   palette_set_color(machine,2, MAKE_RGB(0xff,0xff,0xff));
84   palette_set_color(machine,3, MAKE_RGB(0x00,0x00,0x00));
8785}
8886
8987
r1334r1335
314312   MDRV_SCREEN_SIZE(256, 262)
315313   MDRV_SCREEN_VISIBLE_AREA(8, 247, 0, 239)
316314   MDRV_GFXDECODE(boxer)
317   MDRV_PALETTE_LENGTH(2)
318   MDRV_COLORTABLE_LENGTH(4)
315   MDRV_PALETTE_LENGTH(4)
319316   MDRV_PALETTE_INIT(boxer)
320317   MDRV_VIDEO_UPDATE(boxer)
321318
src/mame/drivers/tmaster.c
r1334r1335
3333
3434***************************************************************************/
3535
36int okibank;
36static int okibank;
3737static WRITE16_HANDLER( tmaster_oki_bank_w )
3838{
3939   if (ACCESSING_MSB)
r1334r1335
5555
5656***************************************************************************/
5757
58int touchscreen;
58static int touchscreen;
5959
60void show_touchscreen(void)
60static void show_touchscreen(void)
6161{
6262#ifdef MAME_DEBUG
6363   popmessage("% d] %03x %03x - %d",touchscreen,readinputportbytag("TSCREEN_X")&0x1ff,readinputportbytag("TSCREEN_Y"),okibank);
r1334r1335
127127***************************************************************************/
128128
129129static mame_bitmap *tmaster_bitmap[2];
130UINT16 *tmaster_regs;
131UINT16 tmaster_color;
132UINT16 tmaster_addr;
130static UINT16 *tmaster_regs;
131static UINT16 tmaster_color;
132static UINT16 tmaster_addr;
133133
134134static VIDEO_START( tmaster )
135135{
r1334r1335
235235   }
236236}
237237
238WRITE16_HANDLER( tmaster_blitter_w )
238static WRITE16_HANDLER( tmaster_blitter_w )
239239{
240240   COMBINE_DATA( tmaster_regs + offset );
241241   switch (offset*2)
r1334r1335
300300
301301***************************************************************************/
302302
303INPUT_PORTS_START( tmaster )
303static INPUT_PORTS_START( tmaster )
304304   PORT_START_TAG("TSCREEN_X")
305305   PORT_BIT( 0x01ff, 0x100, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1, 0, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(3) PORT_PLAYER(1)
306306   PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_BUTTON1 )   PORT_IMPULSE(5)   // press
src/mame/drivers/cischeat.c
r1334r1335
523523
524524    Within $20 vblanks the motor must reach the target. */
525525
526WRITE16_HANDLER( scudhamm_motor_command_w )
526static WRITE16_HANDLER( scudhamm_motor_command_w )
527527{
528528   COMBINE_DATA( &scudhamm_motor_command );
529529}
src/mame/drivers/turbo.c
r1334r1335
13281328   ROM_LOAD( "pr-5195.cpu-ic53", 0x0020, 0x0020, CRC(181c6d23) SHA1(4749b205cbaa513ee65a644946235d2cfe275648) )  /* sprite state machine */
13291329   ROM_LOAD( "pr-5196.cpu-ic10", 0x0100, 0x0200, CRC(04204bcf) SHA1(5636eb184463ac58fcfd20012d13d14fb0769124) )  /* sprite Y scaling */
13301330   ROM_LOAD( "pr-5197.cpu-ic78", 0x0300, 0x0200, CRC(a42674af) SHA1(db3590dd0d0f8a85d4ba32ac4ee33f2f4ee4c348) )  /* video timing */
1331   ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) )  /* char colortable */
1332   ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) )  /* sprite colortable */
1331   ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) )  /* char color table */
1332   ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) )  /* sprite color table */
13331333ROM_END
13341334
13351335
r1334r1335
13661366   ROM_LOAD( "pr-5195.cpu-ic53", 0x0020, 0x0020, CRC(181c6d23) SHA1(4749b205cbaa513ee65a644946235d2cfe275648) )  /* sprite state machine */
13671367   ROM_LOAD( "pr-5196.cpu-ic10", 0x0100, 0x0200, CRC(04204bcf) SHA1(5636eb184463ac58fcfd20012d13d14fb0769124) )  /* sprite Y scaling */
13681368   ROM_LOAD( "pr-5197.cpu-ic78", 0x0300, 0x0200, CRC(a42674af) SHA1(db3590dd0d0f8a85d4ba32ac4ee33f2f4ee4c348) )  /* video timing */
1369   ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) )  /* char colortable */
1370   ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) )  /* sprite colortable */
1369   ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) )  /* char color table */
1370   ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) )  /* sprite color table */
13711371ROM_END
13721372
13731373
r1334r1335
14041404   ROM_LOAD( "pr-5195.cpu-ic53", 0x0020, 0x0020, CRC(181c6d23) SHA1(4749b205cbaa513ee65a644946235d2cfe275648) )  /* sprite state machine */
14051405   ROM_LOAD( "pr-5196.cpu-ic10", 0x0100, 0x0200, CRC(04204bcf) SHA1(5636eb184463ac58fcfd20012d13d14fb0769124) )  /* sprite Y scaling */
14061406   ROM_LOAD( "pr-5197.cpu-ic78", 0x0300, 0x0200, CRC(a42674af) SHA1(db3590dd0d0f8a85d4ba32ac4ee33f2f4ee4c348) )  /* video timing */
1407   ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) )  /* char colortable */
1408   ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, BAD_DUMP CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) )  /* sprite colortable */
1407   ROM_LOAD( "pr-5198.cpu-ic93", 0x0500, 0x0200, CRC(32e74bc8) SHA1(dd2c812efd7b8f6b31a45e698d6453ea6bec132e) )  /* char color table */
1408   ROM_LOAD( "pr-5199.cpu-ic95", 0x0700, 0x0400, BAD_DUMP CRC(45e997a8) SHA1(023703b90b503310351b12157b1e732e61430fa5) )  /* sprite color table */
14091409ROM_END
14101410
14111411
src/mame/drivers/megatech.c
r1334r1335
10531053   MEGATECH_GAME36(REGION_USER1, REGION_USER2)
10541054ROM_END
10551055
1056/* Game 04 - Great Golf (SMS) - bad dump */
1056/* Game 04 - Great Golf (SMS) */
10571057
10581058#define MEGATECH_GAME04(GAME_REGION, INSTRUCTION_REGION) \
10591059   ROM_REGION( 0x300000, GAME_REGION, 0 ) \
1060   ROM_LOAD( "mp11129f.ic1", 0x000000, 0x020000, BAD_DUMP CRC(942738ba) SHA1(e99d4e39c965fc123a39d75521a274687e917a57) ) \
1060   ROM_LOAD( "mp11129f.ic1", 0x000000, 0x020000, CRC(972c75ac) SHA1(2ae74c8563a3cefb27611d17bf3926865b6ebd45) ) \
10611061    MEGATECH_INSTRUCTION_REGION( INSTRUCTION_REGION, MEGATECH_GAME_IS_SMS ) \
10621062   ROM_LOAD( "12368-04.ic2", 0x000000, 0x08000, CRC(62e5579b) SHA1(e1f531be5c40a1216d4192baeda9352384444410) ) \
10631063
src/mame/drivers/vamphalf.c
r1334r1335
583583static MACHINE_DRIVER_START( common )
584584   MDRV_CPU_ADD_TAG("main", E116T, 50000000)   /* 50 MHz */
585585   MDRV_CPU_PROGRAM_MAP(common_map,0)
586   MDRV_CPU_VBLANK_INT(irq4_line_pulse, 1)
586   MDRV_CPU_VBLANK_INT(irq1_line_hold, 1)
587587
588588   MDRV_SCREEN_REFRESH_RATE(60)
589589   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
r1334r1335
656656
657657static MACHINE_DRIVER_START( wyvernwg )
658658   MDRV_IMPORT_FROM(common)
659   MDRV_CPU_REPLACE("main", E132XT, 50000000)   /* 50 MHz */
659   MDRV_CPU_REPLACE("main", E132T, 50000000)   /* 50 MHz */
660660   MDRV_CPU_PROGRAM_MAP(common_32bit_map,0)
661661   MDRV_CPU_IO_MAP(wyvernwg_io,0)
662662
r1334r1335
665665
666666static MACHINE_DRIVER_START( finalgdr )
667667   MDRV_IMPORT_FROM(common)
668   MDRV_CPU_REPLACE("main", E132XT, 50000000)   /* 50 MHz */
668   MDRV_CPU_REPLACE("main", E132T, 50000000)   /* 50 MHz */
669669   MDRV_CPU_PROGRAM_MAP(common_32bit_map,0)
670670   MDRV_CPU_IO_MAP(finalgdr_io,0)
671671
src/mame/drivers/canyon.c
r1334r1335
4747
4848static PALETTE_INIT( canyon )
4949{
50   palette_set_color(machine, 0, MAKE_RGB(0x00, 0x00, 0x00)); /* BLACK */
51   palette_set_color(machine, 1, MAKE_RGB(0xff, 0xff, 0xff)); /* WHITE */
50   palette_set_color(machine, 0, MAKE_RGB(0x80, 0x80, 0x80)); /* GREY  */
51   palette_set_color(machine, 1, MAKE_RGB(0x00, 0x00, 0x00)); /* BLACK */
5252   palette_set_color(machine, 2, MAKE_RGB(0x80, 0x80, 0x80)); /* GREY  */
53
54   colortable[0] = 2;
55   colortable[1] = 0;
56   colortable[2] = 2;
57   colortable[3] = 1;
53   palette_set_color(machine, 3, MAKE_RGB(0xff, 0xff, 0xff)); /* WHITE */
5854}
5955
6056
r1334r1335
253249   MDRV_SCREEN_SIZE(256, 240)
254250   MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 239)
255251   MDRV_GFXDECODE(canyon)
256   MDRV_PALETTE_LENGTH(3)
257   MDRV_COLORTABLE_LENGTH(4)
252   MDRV_PALETTE_LENGTH(4)
258253
259254   MDRV_PALETTE_INIT(canyon)
260255   MDRV_VIDEO_START(canyon)
src/mame/drivers/atarifb.c
r1334r1335
121121 *
122122 *************************************/
123123
124static const UINT16 colortable_source[] =
124static PALETTE_INIT( atarifb )
125125{
126   0x02, 0x00, /* chars */
127   0x03, 0x02, /* sprites */
128   0x03, 0x00,
129   0x03, 0x01, /* sprite masks */
130   0x03, 0x00,
131   0x03, 0x02,
132};
126   /* chars */
127   palette_set_color(machine,0,MAKE_RGB(0xff,0xff,0xff)); /* white  */
128   palette_set_color(machine,1,MAKE_RGB(0x00,0x00,0x00)); /* black  */
133129
134static PALETTE_INIT( atarifb )
135{
136   palette_set_color(machine,0,MAKE_RGB(0x00,0x00,0x00)); /* black  */
137   palette_set_color(machine,1,MAKE_RGB(0x80,0x80,0x80)); /* grey  */
138   palette_set_color(machine,2,MAKE_RGB(0xff,0xff,0xff)); /* white  */
139   palette_set_color(machine,3,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
140   memcpy(colortable,colortable_source,sizeof(colortable_source));
130   /* sprites */
131   palette_set_color(machine,2,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
132   palette_set_color(machine,3,MAKE_RGB(0xff,0xff,0xff)); /* white  */
133   palette_set_color(machine,4,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
134   palette_set_color(machine,5,MAKE_RGB(0x00,0x00,0x00)); /* black  */
135
136   /* sprite masks */
137   palette_set_color(machine,6,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
138   palette_set_color(machine,7,MAKE_RGB(0x80,0x80,0x80)); /* grey  */
139   palette_set_color(machine,8,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
140   palette_set_color(machine,9,MAKE_RGB(0x00,0x00,0x00)); /* black  */
141   palette_set_color(machine,10,MAKE_RGB(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
142   palette_set_color(machine,11,MAKE_RGB(0xff,0xff,0xff)); /* white  */
141143}
142144
143145
r1334r1335
538540   MDRV_SCREEN_SIZE(38*8, 32*8)
539541   MDRV_SCREEN_VISIBLE_AREA(0*8, 38*8-1, 1*8, 31*8-1)
540542   MDRV_GFXDECODE(atarifb)
541   MDRV_PALETTE_LENGTH(4)
542   MDRV_COLORTABLE_LENGTH(sizeof(colortable_source) / sizeof(colortable_source[0]))
543   MDRV_PALETTE_LENGTH(12)
543544
544545   MDRV_PALETTE_INIT(atarifb)
545546   MDRV_VIDEO_START(generic)
src/mame/drivers/segas32.c
r1334r1335
35333533*/
35343534ROM_START( scross )
35353535   ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* v60 code */
3536   ROM_LOAD32_WORD_x2( "epr15093.bin", 0x000000, 0x040000, CRC(2adc7a4b) SHA1(dca71f00d94898c0758394704d819e13482bf120) )
3537   ROM_LOAD32_WORD_x2( "epr15094.bin", 0x000002, 0x040000, CRC(bbb0ae73) SHA1(0d8837706405f301adf8fa85c8d4813d7600af98) )
3538   ROM_LOAD32_WORD( "epr15018.bin",    0x100000, 0x080000, CRC(3a98385e) SHA1(8088d337655030c28e290da4bbf44cb647dab66c) )
3539   ROM_LOAD32_WORD( "epr15019.bin",    0x100002, 0x080000, CRC(8bf4ac83) SHA1(e594d9d9b42d0765ed8a20a40b7dd92b75124d34) )
3536   ROM_LOAD32_WORD_x2( "epr-15093.bin", 0x000000, 0x040000, CRC(2adc7a4b) SHA1(dca71f00d94898c0758394704d819e13482bf120) )
3537   ROM_LOAD32_WORD_x2( "epr-15094.bin", 0x000002, 0x040000, CRC(bbb0ae73) SHA1(0d8837706405f301adf8fa85c8d4813d7600af98) )
3538   ROM_LOAD32_WORD( "epr-15018.bin",    0x100000, 0x080000, CRC(3a98385e) SHA1(8088d337655030c28e290da4bbf44cb647dab66c) )
3539   ROM_LOAD32_WORD( "epr-15019.bin",    0x100002, 0x080000, CRC(8bf4ac83) SHA1(e594d9d9b42d0765ed8a20a40b7dd92b75124d34) )
35403540
35413541   ROM_REGION( 0x180000, REGION_CPU2, 0 ) /* sound CPU */
3542   ROM_LOAD_x4( "epr15192.bin", 0x100000, 0x20000, CRC(7524290b) SHA1(ee58be2c0c4293ee19622b96ca493f4ce4da0038) )
3542   ROM_LOAD_x4( "epr-15192.bin", 0x100000, 0x20000, CRC(7524290b) SHA1(ee58be2c0c4293ee19622b96ca493f4ce4da0038) )
35433543
35443544   ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */
35453545   /* 1ST AND 2ND HALF IDENTICAL (all roms) */
3546   ROM_LOAD16_BYTE( "epr15020.bin", 0x000000, 0x200000, CRC(65afea2f) SHA1(ad573727398bfac8e94f321be84b60e5690bfba6) )
3547   ROM_LOAD16_BYTE( "epr15021.bin", 0x000001, 0x200000, CRC(27bc6969) SHA1(d6bb446becb2d36b73bca5055357a43b837afc0a) )
3546   ROM_LOAD16_BYTE( "epr-15020.bin", 0x000000, 0x200000, CRC(65afea2f) SHA1(ad573727398bfac8e94f321be84b60e5690bfba6) )
3547   ROM_LOAD16_BYTE( "epr-15021.bin", 0x000001, 0x200000, CRC(27bc6969) SHA1(d6bb446becb2d36b73bca5055357a43b837afc0a) )
35483548
35493549   ROM_REGION32_BE( 0x1000000, REGION_GFX2, 0 ) /* sprites */
35503550   /* 1ST AND 2ND HALF IDENTICAL (all roms) */
3551   ROMX_LOAD( "epr15022.bin", 0x000000, 0x200000, CRC(09ca9608) SHA1(cbd0138c1c7811d42b051fed6a7e3526cc4e457f) , ROM_SKIP(6)|ROM_GROUPWORD )
3552   ROMX_LOAD( "epr15024.bin", 0x000002, 0x200000, CRC(0dc920eb) SHA1(d24d637aa0dcd3bae779ef7e12663df81667dbf7) , ROM_SKIP(6)|ROM_GROUPWORD )
3553   ROMX_LOAD( "epr15026.bin", 0x000004, 0x200000, CRC(67637c37) SHA1(7c250e7e9dd5c07da4fa35bacdfcecd5e8fa4ec7) , ROM_SKIP(6)|ROM_GROUPWORD )
3554   ROMX_LOAD( "epr15028.bin", 0x000006, 0x200000, CRC(9929abdc) SHA1(34b6624ddd3a0aedec0a2b433643a37f745ec66d) , ROM_SKIP(6)|ROM_GROUPWORD )
3555   ROMX_LOAD( "epr15023.bin", 0x800000, 0x200000, CRC(0e42a2bb) SHA1(503214caf5fa9a2324b61e04f378fd1a790322df) , ROM_SKIP(6)|ROM_GROUPWORD )
3556   ROMX_LOAD( "epr15025.bin", 0x800002, 0x200000, CRC(0c677fc6) SHA1(fc2207008417072e7ee91f722797d827e150ce2d) , ROM_SKIP(6)|ROM_GROUPWORD )
3557   ROMX_LOAD( "epr15027.bin", 0x800004, 0x200000, CRC(d6d077f9) SHA1(928cefae9ae58239fbffb1dcee282c6ac1e661fe) , ROM_SKIP(6)|ROM_GROUPWORD )
3558   ROMX_LOAD( "epr15029.bin", 0x800006, 0x200000, CRC(707af749) SHA1(fae5325c983df3cf198878220ad88d47339ac512) , ROM_SKIP(6)|ROM_GROUPWORD )
3551   ROMX_LOAD( "epr-15022.bin", 0x000000, 0x200000, CRC(09ca9608) SHA1(cbd0138c1c7811d42b051fed6a7e3526cc4e457f) , ROM_SKIP(6)|ROM_GROUPWORD )
3552   ROMX_LOAD( "epr-15024.bin", 0x000002, 0x200000, CRC(0dc920eb) SHA1(d24d637aa0dcd3bae779ef7e12663df81667dbf7) , ROM_SKIP(6)|ROM_GROUPWORD )
3553   ROMX_LOAD( "epr-15026.bin", 0x000004, 0x200000, CRC(67637c37) SHA1(7c250e7e9dd5c07da4fa35bacdfcecd5e8fa4ec7) , ROM_SKIP(6)|ROM_GROUPWORD )
3554   ROMX_LOAD( "epr-15028.bin", 0x000006, 0x200000, CRC(9929abdc) SHA1(34b6624ddd3a0aedec0a2b433643a37f745ec66d) , ROM_SKIP(6)|ROM_GROUPWORD )
3555   ROMX_LOAD( "epr-15023.bin", 0x800000, 0x200000, CRC(0e42a2bb) SHA1(503214caf5fa9a2324b61e04f378fd1a790322df) , ROM_SKIP(6)|ROM_GROUPWORD )
3556   ROMX_LOAD( "epr-15025.bin", 0x800002, 0x200000, CRC(0c677fc6) SHA1(fc2207008417072e7ee91f722797d827e150ce2d) , ROM_SKIP(6)|ROM_GROUPWORD )
3557   ROMX_LOAD( "epr-15027.bin", 0x800004, 0x200000, CRC(d6d077f9) SHA1(928cefae9ae58239fbffb1dcee282c6ac1e661fe) , ROM_SKIP(6)|ROM_GROUPWORD )
3558   ROMX_LOAD( "epr-15029.bin", 0x800006, 0x200000, CRC(707af749) SHA1(fae5325c983df3cf198878220ad88d47339ac512) , ROM_SKIP(6)|ROM_GROUPWORD )
35593559
35603560   ROM_REGION( 0x400000, REGION_SOUND1, 0 ) /* Sega PCM sound data */
35613561   /* 1ST AND 2ND HALF IDENTICAL (all roms, are these OK?) */
3562   ROM_LOAD("epr15031.bin", 0x000000, 0x200000, CRC(663a7fd2) SHA1(b4393a687225b075db21960d19a6ddd7a9d7d086) )
3563   ROM_LOAD("epr15032.bin", 0x200000, 0x200000, CRC(cb709f3d) SHA1(3962c8b5907d1f8f611f58ddac693cc47364a79c) )
3562   ROM_LOAD("epr-15031.bin", 0x000000, 0x200000, CRC(663a7fd2) SHA1(b4393a687225b075db21960d19a6ddd7a9d7d086) )
3563   ROM_LOAD("epr-15032.bin", 0x200000, 0x200000, CRC(cb709f3d) SHA1(3962c8b5907d1f8f611f58ddac693cc47364a79c) )
35643564ROM_END
35653565
3566ROM_START( scrossu )
3567   ROM_REGION( 0x200000, REGION_CPU1, 0 ) /* v60 code */
3568   ROM_LOAD32_WORD_x2( "epr-15091.bin", 0x000000, 0x040000, CRC(2c572293) SHA1(6377a6eb6084f7332ce6eeaaf0c37200da792d0c) )
3569   ROM_LOAD32_WORD_x2( "epr-15092.bin", 0x000002, 0x040000, CRC(6e3e175a) SHA1(feaca0720646e2a4b78b376e99dc86788adb98e7) )
3570   ROM_LOAD32_WORD( "epr-15018.bin",    0x100000, 0x080000, CRC(3a98385e) SHA1(8088d337655030c28e290da4bbf44cb647dab66c) )
3571   ROM_LOAD32_WORD( "epr-15019.bin",    0x100002, 0x080000, CRC(8bf4ac83) SHA1(e594d9d9b42d0765ed8a20a40b7dd92b75124d34) )
35663572
3573   ROM_REGION( 0x180000, REGION_CPU2, 0 ) /* sound CPU */
3574   ROM_LOAD_x4( "epr-15192.bin", 0x100000, 0x20000, CRC(7524290b) SHA1(ee58be2c0c4293ee19622b96ca493f4ce4da0038) )
3575
3576   ROM_REGION( 0x400000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */
3577   /* 1ST AND 2ND HALF IDENTICAL (all roms) */
3578   ROM_LOAD16_BYTE( "epr-15020.bin", 0x000000, 0x200000, CRC(65afea2f) SHA1(ad573727398bfac8e94f321be84b60e5690bfba6) )
3579   ROM_LOAD16_BYTE( "epr-15021.bin", 0x000001, 0x200000, CRC(27bc6969) SHA1(d6bb446becb2d36b73bca5055357a43b837afc0a) )
3580
3581   ROM_REGION32_BE( 0x1000000, REGION_GFX2, 0 ) /* sprites */
3582   /* 1ST AND 2ND HALF IDENTICAL (all roms) */
3583   ROMX_LOAD( "epr-15022.bin", 0x000000, 0x200000, CRC(09ca9608) SHA1(cbd0138c1c7811d42b051fed6a7e3526cc4e457f) , ROM_SKIP(6)|ROM_GROUPWORD )
3584   ROMX_LOAD( "epr-15024.bin", 0x000002, 0x200000, CRC(0dc920eb) SHA1(d24d637aa0dcd3bae779ef7e12663df81667dbf7) , ROM_SKIP(6)|ROM_GROUPWORD )
3585   ROMX_LOAD( "epr-15026.bin", 0x000004, 0x200000, CRC(67637c37) SHA1(7c250e7e9dd5c07da4fa35bacdfcecd5e8fa4ec7) , ROM_SKIP(6)|ROM_GROUPWORD )
3586   ROMX_LOAD( "epr-15028.bin", 0x000006, 0x200000, CRC(9929abdc) SHA1(34b6624ddd3a0aedec0a2b433643a37f745ec66d) , ROM_SKIP(6)|ROM_GROUPWORD )
3587   ROMX_LOAD( "epr-15023.bin", 0x800000, 0x200000, CRC(0e42a2bb) SHA1(503214caf5fa9a2324b61e04f378fd1a790322df) , ROM_SKIP(6)|ROM_GROUPWORD )
3588   ROMX_LOAD( "epr-15025.bin", 0x800002, 0x200000, CRC(0c677fc6) SHA1(fc2207008417072e7ee91f722797d827e150ce2d) , ROM_SKIP(6)|ROM_GROUPWORD )
3589   ROMX_LOAD( "epr-15027.bin", 0x800004, 0x200000, CRC(d6d077f9) SHA1(928cefae9ae58239fbffb1dcee282c6ac1e661fe) , ROM_SKIP(6)|ROM_GROUPWORD )
3590   ROMX_LOAD( "epr-15029.bin", 0x800006, 0x200000, CRC(707af749) SHA1(fae5325c983df3cf198878220ad88d47339ac512) , ROM_SKIP(6)|ROM_GROUPWORD )
3591
3592   ROM_REGION( 0x400000, REGION_SOUND1, 0 ) /* Sega PCM sound data */
3593   /* 1ST AND 2ND HALF IDENTICAL (all roms, are these OK?) */
3594   ROM_LOAD("epr-15031.bin", 0x000000, 0x200000, CRC(663a7fd2) SHA1(b4393a687225b075db21960d19a6ddd7a9d7d086) )
3595   ROM_LOAD("epr-15032.bin", 0x200000, 0x200000, CRC(cb709f3d) SHA1(3962c8b5907d1f8f611f58ddac693cc47364a79c) )
3596ROM_END
3597
3598
35673599/**************************************************************************************************************************
35683600 **************************************************************************************************************************
35693601 **************************************************************************************************************************
r1334r1335
40454077GAME( 1992, orunners, 0,        multi32,      orunners, orunners, ROT0, "Sega",   "OutRunners (World)", GAME_IMPERFECT_GRAPHICS )
40464078GAME( 1992, orunneru, orunners, multi32,      orunners, orunners, ROT0, "Sega",   "OutRunners (US)", GAME_IMPERFECT_GRAPHICS )
40474079GAME( 1992, scross,   0,        multi32,      scross,   scross,   ROT0, "Sega",   "Stadium Cross (World)", GAME_IMPERFECT_GRAPHICS )
4080GAME( 1992, scrossu,  scross,   multi32,      scross,   scross,   ROT0, "Sega",   "Stadium Cross (US)", GAME_IMPERFECT_GRAPHICS )
40484081GAME( 1992, titlef,   0,        multi32,      titlef,   titlef,   ROT0, "Sega",   "Title Fight (World)", GAME_IMPERFECT_GRAPHICS )
40494082GAME( 1992, titlefu,  titlef,   multi32,      titlef,   titlef,   ROT0, "Sega",   "Title Fight (US)", GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/decocass.c
r1334r1335
354354static PALETTE_INIT( decocass )
355355{
356356   int i;
357
358   machine->colortable = colortable_alloc(machine, 32);
359
357360   /* set up 32 colors 1:1 pens */
358361   for (i = 0; i < 32; i++)
359      colortable[i] = i;
362      colortable_entry_set_value(machine->colortable, i, i);
360363
361364   /* setup straight/flipped colors for background tiles (D7 of color_center_bot ?) */
362365   for (i = 0; i < 8; i++)
363366   {
364      colortable[32+i] = 3*8+i;
365      colortable[40+i] = 3*8+((i << 1) & 0x04) + ((i >> 1) & 0x02) + (i & 0x01);
367      colortable_entry_set_value(machine->colortable, 32+i, 3*8+i);
368      colortable_entry_set_value(machine->colortable, 40+i, 3*8+((i << 1) & 0x04) + ((i >> 1) & 0x02) + (i & 0x01));
366369   }
367370
368371   /* setup 4 colors for 1bpp object */
369   colortable[48+0*2+0] = 0;
370   colortable[48+0*2+1] = 25;   /* testtape red from 4th palette section? */
371   colortable[48+1*2+0] = 0;
372   colortable[48+1*2+1] = 28;   /* testtape blue from 4th palette section? */
373   colortable[48+2*2+0] = 0;
374   colortable[48+2*2+1] = 26;   /* testtape green from 4th palette section? */
375   colortable[48+3*2+0] = 0;
376   colortable[48+3*2+1] = 23;   /* ???? */
372   colortable_entry_set_value(machine->colortable, 48+0*2+0, 0);
373   colortable_entry_set_value(machine->colortable, 48+0*2+1, 25);   /* testtape red from 4th palette section? */
374   colortable_entry_set_value(machine->colortable, 48+1*2+0, 0);
375   colortable_entry_set_value(machine->colortable, 48+1*2+1, 28);   /* testtape blue from 4th palette section? */
376   colortable_entry_set_value(machine->colortable, 48+2*2+0, 0);
377   colortable_entry_set_value(machine->colortable, 48+2*2+1, 26);   /* testtape green from 4th palette section? */
378   colortable_entry_set_value(machine->colortable, 48+3*2+0, 0);
379   colortable_entry_set_value(machine->colortable, 48+3*2+1, 23);   /* ???? */
377380}
378381
379382
r1334r1335
402405   MDRV_SCREEN_SIZE(32*8, 32*8)
403406   MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 1*8, 31*8-1)
404407   MDRV_GFXDECODE(decocass)
405   MDRV_PALETTE_LENGTH(32)
406   MDRV_COLORTABLE_LENGTH(32+2*8+2*4)
408   MDRV_PALETTE_LENGTH(32+2*8+2*4)
407409
408410   MDRV_PALETTE_INIT(decocass)
409411   MDRV_VIDEO_START(decocass)
src/mame/drivers/dlair.c
r1334r1335
181181
182182   for (i = 0; i < 8; i++)
183183   {
184      palette_set_color_rgb(machine, i, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
185      colortable[2 * i + 0] = 8;
186      colortable[2 * i + 1] = i;
184      palette_set_color(machine, 2 * i + 0, MAKE_RGB(0, 0, 0));
185      palette_set_color_rgb(machine, 2 * i + 1, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
187186   }
188   palette_set_color(machine, 8, MAKE_RGB(0, 0, 0));
189187}
190188
191189
r1334r1335
858856   MDRV_SCREEN_VISIBLE_AREA(0, 199, 0, 239)
859857
860858   MDRV_GFXDECODE(dlair)
861   MDRV_PALETTE_LENGTH(9)
862   MDRV_COLORTABLE_LENGTH(16)
859   MDRV_PALETTE_LENGTH(16)
863860
864861   MDRV_PALETTE_INIT(dleuro)
865862   MDRV_VIDEO_START(dleuro)
src/mame/drivers/firetrk.c
r1334r1335
1515
1616int firetrk_game;
1717
18UINT32 firetrk_color1_mask;
19UINT32 firetrk_color2_mask;
20
1821static int last_service;
1922static int steer_dir[2];
2023static int steer_flag[2];
r1334r1335
244247
245248static PALETTE_INIT( firetrk )
246249{
247   static const UINT16 colortable_source[] =
250   static const UINT8 colortable_source[] =
248251   {
249252      0, 0, 1, 0,
250253      2, 0, 3, 0,
r1334r1335
254257      2, 0, 0, 3,
255258      3, 0, 0, 3
256259   };
260   static const rgb_t palette_source[] =
261   {
262      MAKE_RGB(0x00, 0x00, 0x00),
263      MAKE_RGB(0x5b, 0x5b, 0x5b),
264      MAKE_RGB(0xa4, 0xa4, 0xa4),
265      MAKE_RGB(0xff, 0xff, 0xff)
266   };
267   int i;
257268
258   palette_set_color(machine, 0, MAKE_RGB(0x00, 0x00, 0x00));
259   palette_set_color(machine, 1, MAKE_RGB(0x5b, 0x5b, 0x5b));
260   palette_set_color(machine, 2, MAKE_RGB(0xa4, 0xa4, 0xa4));
261   palette_set_color(machine, 3, MAKE_RGB(0xff, 0xff, 0xff));
262
263   memcpy(colortable, colortable_source, sizeof(colortable_source));
269   firetrk_color1_mask = firetrk_color2_mask = 0;
270   for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
271   {
272      UINT8 color = colortable_source[i];
273      if (color == 1)
274         firetrk_color1_mask |= 1 << i;
275      else if (color == 2)
276         firetrk_color2_mask |= 1 << i;
277      palette_set_color(machine, i, palette_source[color]);
278   }
264279}
265280
266281
r1334r1335
272287
273288static PALETTE_INIT( montecar )
274289{
275   static const UINT16 colortable_source[] =
290   static const UINT8 colortable_source[] =
276291   {
277292      0x00, 0x00, 0x00, 0x01,
278293      0x00, 0x02, 0x00, 0x03,
r1334r1335
280295      0x03, 0x01, 0x03, 0x00,
281296      0x00, 0x00, 0x02, 0x00,
282297      0x02, 0x01, 0x02, 0x02,
283      0x00, 0x05, 0x06, 0x07,
284      0x00, 0x09, 0x0A, 0x0B,
285      0x00, 0x0D, 0x0E, 0x0F,
286      0x00, 0x11, 0x12, 0x13,
287      0x00, 0x15, 0x16, 0x17,
288      0x18, 0x19
298      0x00, 0x10, 0x20, 0x30,
299      0x00, 0x04, 0x08, 0x0C,
300      0x00, 0x44, 0x48, 0x4C,
301      0x00, 0x84, 0x88, 0x8C,
302      0x00, 0xC4, 0xC8, 0xCC
289303   };
290304
291305   /*
r1334r1335
307321     */
308322
309323   const UINT8* p = memory_region(REGION_PROMS);
324   int i;
310325
311   int number = 0;
326   firetrk_color1_mask = firetrk_color2_mask = 0;
327   for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
328   {
329      UINT8 color = colortable_source[i];
330      if (color == 1)
331         firetrk_color1_mask |= 1 << i;
332      else if (color == 2)
333         firetrk_color2_mask |= 1 << i;
334      prom_to_palette(machine, i, p[0x100 + colortable_source[i]]);
335   }
312336
313   prom_to_palette(machine, number++, p[0x100]);
314   prom_to_palette(machine, number++, p[0x101]);
315   prom_to_palette(machine, number++, p[0x102]);
316   prom_to_palette(machine, number++, p[0x103]);
317
318   prom_to_palette(machine, number++, p[0x100]);
319   prom_to_palette(machine, number++, p[0x110]);
320   prom_to_palette(machine, number++, p[0x120]);
321   prom_to_palette(machine, number++, p[0x130]);
322
323   prom_to_palette(machine, number++, p[0x100]);
324   prom_to_palette(machine, number++, p[0x104]);
325   prom_to_palette(machine, number++, p[0x108]);
326   prom_to_palette(machine, number++, p[0x10C]);
327
328   prom_to_palette(machine, number++, p[0x140]);
329   prom_to_palette(machine, number++, p[0x144]);
330   prom_to_palette(machine, number++, p[0x148]);
331   prom_to_palette(machine, number++, p[0x14C]);
332
333   prom_to_palette(machine, number++, p[0x180]);
334   prom_to_palette(machine, number++, p[0x184]);
335   prom_to_palette(machine, number++, p[0x188]);
336   prom_to_palette(machine, number++, p[0x18C]);
337
338   prom_to_palette(machine, number++, p[0x1C0]);
339   prom_to_palette(machine, number++, p[0x1C4]);
340   prom_to_palette(machine, number++, p[0x1C8]);
341   prom_to_palette(machine, number++, p[0x1CC]);
342
343   palette_set_color(machine, number++, MAKE_RGB(0x00, 0x00, 0x00));
344   palette_set_color(machine, number++, MAKE_RGB(0xff, 0xff, 0xff));
345
346   memcpy(colortable, colortable_source, sizeof(colortable_source));
337   palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 0, MAKE_RGB(0x00, 0x00, 0x00));
338   palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 1, MAKE_RGB(0xff, 0xff, 0xff));
347339}
348340
349341
r1334r1335
10741066   MDRV_GFXDECODE(firetrk)
10751067
10761068   MDRV_PALETTE_INIT(firetrk)
1077   MDRV_PALETTE_LENGTH(4)
1078   MDRV_COLORTABLE_LENGTH(28)
1069   MDRV_PALETTE_LENGTH(28)
10791070
10801071   MDRV_VIDEO_START(firetrk)
10811072   MDRV_VIDEO_EOF(firetrk)
r1334r1335
11011092   MDRV_GFXDECODE(superbug)
11021093
11031094   MDRV_PALETTE_INIT(firetrk)
1104   MDRV_PALETTE_LENGTH(4)
1105   MDRV_COLORTABLE_LENGTH(28)
1095   MDRV_PALETTE_LENGTH(28)
11061096
11071097   /* sound hardware */
11081098   MDRV_SOUND_REPLACE("discrete", DISCRETE, 0)
r1334r1335
11221112   MDRV_GFXDECODE(montecar)
11231113
11241114   MDRV_PALETTE_INIT(montecar)
1125   MDRV_PALETTE_LENGTH(26)
1126   MDRV_COLORTABLE_LENGTH(46)
1115   MDRV_PALETTE_LENGTH(46)
11271116
11281117   /* sound hardware */
11291118   MDRV_SOUND_REPLACE("discrete", DISCRETE, 0)
src/mame/drivers/exidy.c
r1334r1335
744744   256,
745745   1,
746746   { 0 },
747   { 0, 1, 2, 3, 4, 5, 6, 7 },
748   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
747   { STEP8(0,1) },
748   { STEP8(0,8) },
749749   8*8
750750};
751751
r1334r1335
755755   256,
756756   2,
757757   { 0, 256*8*8 },
758   { 0, 1, 2, 3, 4, 5, 6, 7 },
759   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
758   { STEP8(0,1) },
759   { STEP8(0,8) },
760760   8*8
761761};
762762
r1334r1335
766766   RGN_FRAC(1,1),
767767   1,
768768   { 0 },
769   { 0, 1, 2, 3, 4, 5, 6, 7, 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7},
770   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8},
769   { STEP8(0,1), STEP8(16*8,1), },
770   { STEP16(0,8) },
771771   8*32
772772};
773773
774774
775775static GFXDECODE_START( 1bpp )
776   GFXDECODE_ENTRY( REGION_CPU1, 0x4800, charlayout_1bpp, 0, 4 )   /* the game dynamically modifies this */
777   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout,    8, 2 )
776   GFXDECODE_ENTRY( REGION_CPU1, 0x4800, charlayout_1bpp, 4, 4 )   /* the game dynamically modifies this */
777   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout,    0, 2 )
778778GFXDECODE_END
779779
780780
781781static GFXDECODE_START( 2bpp )
782   GFXDECODE_ENTRY( REGION_CPU1, 0x6000, charlayout_2bpp, 0, 4 )   /* the game dynamically modifies this */
783   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout,   16, 2 )
782   GFXDECODE_ENTRY( REGION_CPU1, 0x6000, charlayout_2bpp, 4, 4 )   /* the game dynamically modifies this */
783   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout,    0, 2 )
784784GFXDECODE_END
785785
786786
r1334r1335
836836   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
837837   MDRV_SCREEN_RAW_PARAMS(EXIDY_PIXEL_CLOCK, EXIDY_HTOTAL, EXIDY_HBEND, EXIDY_HBSTART, EXIDY_VTOTAL, EXIDY_VBEND, EXIDY_VBSTART)
838838   MDRV_GFXDECODE(1bpp)
839   MDRV_PALETTE_LENGTH(PALETTE_LEN)
840   MDRV_COLORTABLE_LENGTH(COLORTABLE_LEN)
839   MDRV_PALETTE_LENGTH(2*2 + 4*2)
841840
842   MDRV_PALETTE_INIT(exidy)
843841   MDRV_VIDEO_START(exidy)
844842   MDRV_VIDEO_EOF(exidy)
845843   MDRV_VIDEO_UPDATE(exidy)
r1334r1335
913911
914912   /* video hardware */
915913   MDRV_GFXDECODE(2bpp)
914   MDRV_PALETTE_LENGTH(2*2 + 4*4)
916915MACHINE_DRIVER_END
917916
918917
r1334r1335
13411340 *
13421341 *************************************/
13431342
1344static void exidy_common_init(UINT8 palette[], UINT16 colortable[], UINT8 cmask, UINT8 cinvert)
1343static void exidy_common_init(UINT8 cmask, UINT8 cinvert)
13451344{
1346   exidy_palette          = palette;
1347   exidy_colortable       = colortable;
13481345   exidy_collision_mask    = cmask;
13491346   exidy_collision_invert   = cinvert;
13501347   targ_spec_flag          = 0;
r1334r1335
13531350
13541351static DRIVER_INIT( sidetrac )
13551352{
1356   exidy_common_init(sidetrac_palette, exidy_1bpp_colortable, 0x00, 0x00);
1353   exidy_common_init(0x00, 0x00);
13571354
1355   /* hard-coded palette controlled via 8x3 DIP switches on the board */
1356   exidy_color_latch[2] = 0xf8;
1357   exidy_color_latch[1] = 0xdc;
1358   exidy_color_latch[0] = 0xb8;
1359
13581360   /* ROM in place of character RAM */
13591361   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4800, 0x4bff, 0, 0, MWA8_ROM);
13601362}
r1334r1335
13621364
13631365static DRIVER_INIT( targ )
13641366{
1365   exidy_common_init(targ_palette, exidy_1bpp_colortable, 0x00, 0x00);
1367   exidy_common_init(0x00, 0x00);
1368
1369   /* hard-coded palette controlled via 8x3 DIP switches on the board */
1370   exidy_color_latch[2] = 0x5c;
1371   exidy_color_latch[1] = 0xee;
1372   exidy_color_latch[0] = 0x6b;
1373
13661374   targ_spec_flag = 1;
13671375}
13681376
13691377
13701378static DRIVER_INIT( spectar )
13711379{
1372   exidy_common_init(spectar_palette, exidy_1bpp_colortable, 0x00, 0x00);
1380   exidy_common_init(0x00, 0x00);
1381
1382   /* hard-coded palette controlled via 8x3 DIP switches on the board */
1383   exidy_color_latch[2] = 0x58;
1384   exidy_color_latch[1] = 0xee;
1385   exidy_color_latch[0] = 0x09;
13731386}
13741387
13751388static DRIVER_INIT( rallys )
13761389{
1377   exidy_common_init(spectar_palette, exidy_1bpp_colortable, 0x00, 0x00);
1390   exidy_common_init(0x00, 0x00);
13781391
1392   /* hard-coded palette controlled via 8x3 DIP switches on the board */
1393   exidy_color_latch[2] = 0x58;
1394   exidy_color_latch[1] = 0xee;
1395   exidy_color_latch[0] = 0x09;
1396
13791397   /* sprite locations are slightly different */
13801398   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x5000, 0, 0, exidy_sprite1_xpos_w);
13811399   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5001, 0x5001, 0, 0, exidy_sprite1_ypos_w);
r1334r1335
13851403
13861404static DRIVER_INIT( phantoma )
13871405{
1388   exidy_common_init(spectar_palette, exidy_1bpp_colortable, 0x00, 0x00);
1406   exidy_common_init(0x00, 0x00);
13891407
1408   /* hard-coded palette controlled via 8x3 DIP switches on the board */
1409   exidy_color_latch[2] = 0x58;
1410   exidy_color_latch[1] = 0xee;
1411   exidy_color_latch[0] = 0x09;
1412
13901413   /* sprite locations are slightly different */
13911414   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5000, 0x5000, 0, 0, exidy_sprite1_xpos_w);
13921415   memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5001, 0x5001, 0, 0, exidy_sprite1_ypos_w);
r1334r1335
14011424
14021425static DRIVER_INIT( mtrap )
14031426{
1404   exidy_common_init(NULL, exidy_1bpp_colortable, 0x14, 0x00);
1427   exidy_common_init(0x14, 0x00);
14051428}
14061429
14071430
14081431static DRIVER_INIT( venture )
14091432{
1410   exidy_common_init(NULL, exidy_1bpp_colortable, 0x04, 0x04);
1433   exidy_common_init(0x04, 0x04);
14111434}
14121435
14131436
14141437static DRIVER_INIT( teetert )
14151438{
1416   exidy_common_init(NULL, exidy_1bpp_colortable, 0x0c, 0x0c);
1439   exidy_common_init(0x0c, 0x0c);
14171440
14181441   /* special input handler for the dial */
14191442   memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x5101, 0x5101, 0, 0, teetert_input_r);
r1334r1335
14221445
14231446static DRIVER_INIT( pepper2 )
14241447{
1425   exidy_common_init(NULL, exidy_2bpp_colortable, 0x14, 0x04);
1448   exidy_common_init(0x14, 0x04);
14261449
14271450   /* two 6116 character RAMs */
14281451   exidy_characterram = memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x6fff, 0, 0, MRA8_RAM);
r1334r1335
14341457
14351458static DRIVER_INIT( fax )
14361459{
1437   exidy_common_init(NULL, exidy_2bpp_colortable, 0x04, 0x04);
1460   exidy_common_init(0x04, 0x04);
14381461
14391462   /* reset the ROM bank */
14401463   fax_bank_select_w(0,0);
src/mame/drivers/eolith16.c
r1334r1335
163163
164164
165165static MACHINE_DRIVER_START( eolith16 )
166   MDRV_CPU_ADD(E116T, 60000000)      /* 60 MHz */
166   MDRV_CPU_ADD(E116T, 60000000)      /* no internal multiplier */
167167   MDRV_CPU_PROGRAM_MAP(eolith16_map,0)
168168   MDRV_CPU_VBLANK_INT(eolith_speedup,262)
169169
src/mame/drivers/cherrym.c
r1334r1335
1616
1717static PALETTE_INIT( cm )
1818{
19   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
2019   int i;
2120
2221   for ( i = 0; i < machine->drv->total_colors; i++ )
r1334r1335
392391
393392   MDRV_GFXDECODE(cherrym)
394393   MDRV_PALETTE_LENGTH(256)
395   MDRV_COLORTABLE_LENGTH(256)
396394
397395   MDRV_PALETTE_INIT(cm)
398396   MDRV_VIDEO_START(cm)
src/emu/debug/debugcpu.c
r1334r1335
7777    FUNCTION PROTOTYPES
7878***************************************************************************/
7979
80void debug_cpu_exit(running_machine *machine);
80static void debug_cpu_exit(running_machine *machine);
8181static void perform_trace(debug_cpu_info *info);
8282static void prepare_for_step_overout(void);
8383static void process_source_file(void);
r1334r1335
288288    debug_cpu_exit - free all memory
289289-------------------------------------------------*/
290290
291void debug_cpu_exit(running_machine *machine)
291static void debug_cpu_exit(running_machine *machine)
292292{
293293   int cpunum, spacenum;
294294
src/emu/cpu/v30mz/v30mz.c
r1334r1335
949949   I.irq_callback = irqcallback;
950950}
951951
952void v30mz_init(int index, int clock, const void *config, int (*irqcallback)(int)) { nec_init(index, clock, config, irqcallback, 3); }
953int v30mz_execute(int cycles)
952static void v30mz_init(int index, int clock, const void *config, int (*irqcallback)(int)) { nec_init(index, clock, config, irqcallback, 3); }
953static int v30mz_execute(int cycles)
954954{
955955   nec_ICount=cycles;
956956   chip_type=V30MZ;
src/emu/cpu/h83002/h8periph.c
r1334r1335
339339   }
340340}
341341
342#ifdef UNUSED_FUNCTION
342343UINT8 h8_debugger_itu_read8(UINT8 reg)
343344{
344345   UINT8 val;
345346   val = 0;
346347   return val;
347348}
349#endif
348350
349351
350352UINT8 h8_register_read8(UINT32 address)
src/emu/cpu/m68000/m68kmame.h
r1334r1335
9090
9191INLINE unsigned int m68kx_read_immediate_16(unsigned int address)
9292{
93   unsigned int addr = (address) ^ m68k_memory_intf.opcode_xor;
94   unsigned int data;
95
96   if (activecpu_databus_width(ADDRESS_SPACE_PROGRAM) == 8)
97   {
98      data = (cpu_readop(addr) << 8) | (cpu_readop(addr + 1));
99   }
100   else
101   {
102      data = cpu_readop16(addr);
103   }
104
105   return data;
93   return cpu_readop16((address) ^ m68k_memory_intf.opcode_xor);
10694}
10795
10896INLINE unsigned int m68kx_read_immediate_32(unsigned int address)
src/emu/cpu/tms34010/34010dsm.c
r1334r1335
246246}
247247
248248
249unsigned Dasm340x0(char *buff, UINT32 pc, int is_34020)
249static unsigned Dasm340x0(char *buff, UINT32 pc, int is_34020)
250250{
251251   int flags = 0;
252252   UINT8 bad = 0;
src/emu/cpu/tms32031/tms32031.c
r1334r1335
416416static UINT32 hits[0x200*4];
417417#endif
418418
419void tms32031_exit(void)
419static void tms32031_exit(void)
420420{
421421#if (LOG_OPCODE_USAGE)
422422   int i;
src/emu/cpu/cpu.mak
r1334r1335
498498endif
499499
500500$(CPUOBJ)/e132xs/e132xs.o:   $(CPUSRC)/e132xs/e132xs.c \
501                     $(CPUSRC)/e132xs/e132xs.h
501                     $(CPUSRC)/e132xs/e132xs.h \
502                     $(CPUSRC)/e132xs/e132xsop.c
502503
503504
504505
src/emu/cpu/m37710/m37710.c
r1334r1335
5656
5757#define M37710_DEBUG   (0)   // enables verbose logging for peripherals, etc.
5858
59extern void m37710_set_irq_line(int line, int state);
59static void m37710_set_irq_line(int line, int state);
6060
6161/* Our CPU structure */
6262m37710i_cpu_struct m37710i_cpu = {0};
6363
64int m37710_ICount = 0, m37710_fullCount = 0;
64int m37710_ICount = 0;
65static int m37710_fullCount = 0;
6566
6667/* Temporary Variables */
6768uint m37710i_source;
r1334r1335
882883
883884/* external functions */
884885
885void m37710_reset(void)
886static void m37710_reset(void)
886887{
887888   /* Start the CPU */
888889   CPU_STOPPED = 0;
r1334r1335
927928   /* nothing to do yet */
928929}
929930
931#ifdef UNUSED_FUNCTION
930932/* return elapsed cycles in the current slice */
931933int m37710_getcycles(void)
932934{
r1334r1335
940942
941943   m37710_ICount = 0;
942944}
945#endif
943946
944947/* Execute some instructions */
945int m37710_execute(int cycles)
948static int m37710_execute(int cycles)
946949{
947950   m37710_fullCount = cycles;
948951
r1334r1335
959962}
960963
961964/* Set the current CPU context */
962void m37710_set_context(void *src_context)
965static void m37710_set_context(void *src_context)
963966{
964967   m37710i_cpu = *(m37710i_cpu_struct*)src_context;
965968   m37710i_jumping(REG_PB | REG_PC);
966969}
967970
968971/* Get the current Program Counter */
972#ifdef UNUSED_FUNCTION
969973unsigned m37710_get_pc(void)
970974{
971975   return REG_PC;
972976}
977#endif
973978
974979/* Set the Program Counter */
975void m37710_set_pc(unsigned val)
980static void m37710_set_pc(unsigned val)
976981{
977982   REG_PC = MAKE_UINT_16(val);
978983   m37710_jumping(REG_PB | REG_PC);
979984}
980985
981986/* Get the current Stack Pointer */
982unsigned m37710_get_sp(void)
987static unsigned m37710_get_sp(void)
983988{
984989   return REG_S;
985990}
986991
987992/* Set the Stack Pointer */
988void m37710_set_sp(unsigned val)
993static void m37710_set_sp(unsigned val)
989994{
990995   REG_S = MAKE_UINT_16(val);
991996}
992997
993998/* Get a register */
994unsigned m37710_get_reg(int regnum)
999static unsigned m37710_get_reg(int regnum)
9951000{
9961001   return FTABLE_GET_REG(regnum);
9971002}
9981003
9991004/* Set a register */
1000void m37710_set_reg(int regnum, unsigned value)
1005static void m37710_set_reg(int regnum, unsigned value)
10011006{
10021007   FTABLE_SET_REG(regnum, value);
10031008}
r1334r1335
10131018}
10141019
10151020/* Set an interrupt line */
1016void m37710_set_irq_line(int line, int state)
1021static void m37710_set_irq_line(int line, int state)
10171022{
10181023   FTABLE_SET_LINE(line, state);
10191024}
10201025
10211026/* Set the callback that is called when servicing an interrupt */
1027#ifdef UNUSED_FUNCTION
10221028void m37710_set_irq_callback(int (*callback)(int))
10231029{
10241030   INT_ACK = callback;
10251031}
1032#endif
10261033
10271034/* Disassemble an instruction */
10281035#ifdef MAME_DEBUG
r1334r1335
10431050   m37710i_jumping(REG_PB | REG_PC);
10441051}
10451052
1046void m37710_init(int index, int clock, const void *config, int (*irqcallback)(int))
1053static void m37710_init(int index, int clock, const void *config, int (*irqcallback)(int))
10471054{
10481055   INT_ACK = irqcallback;
10491056
src/emu/cpu/sharc/sharc.c
r1334r1335
845845}
846846
847847#if (HAS_ADSP21062)
848void adsp21062_set_info(UINT32 state, cpuinfo *info)
848static void adsp21062_set_info(UINT32 state, cpuinfo *info)
849849{
850850   if (state >= CPUINFO_INT_INPUT_STATE && state <= CPUINFO_INT_INPUT_STATE + 2)
851851   {
r1334r1335
956956   AM_RANGE(0x20000, 0x7ffff) AM_RAM
957957ADDRESS_MAP_END
958958
959void sharc_get_info(UINT32 state, cpuinfo *info)
959static void sharc_get_info(UINT32 state, cpuinfo *info)
960960{
961961   switch(state)
962962   {
src/emu/cpu/sharc/sharcdsm.c
r1334r1335
298298   }
299299}
300300
301void pm_dm_ureg(int g, int d, int i, int m, int ureg, int update)
301static void pm_dm_ureg(int g, int d, int i, int m, int ureg, int update)
302302{
303303   if (update)      // post-modify
304304   {
r1334r1335
353353   }
354354}
355355
356void pm_dm_imm_dreg(int g, int d, int i, int data, int dreg, int update)
356static void pm_dm_imm_dreg(int g, int d, int i, int data, int dreg, int update)
357357{
358358   if (update)      // post-modify
359359   {
r1334r1335
407407   }
408408}
409409
410void pm_dm_dreg(int g, int d, int i, int m, int dreg)
410static void pm_dm_dreg(int g, int d, int i, int m, int dreg)
411411{
412412   if (d)
413413   {
r1334r1335
433433   }
434434}
435435
436void shiftop(int shift, int data, int rn, int rx)
436static void shiftop(int shift, int data, int rn, int rx)
437437{
438438   INT8 data8 = data & 0xff;
439439   int bit6 = data & 0x3f;
src/emu/cpu/z180/z180.c
r1334r1335
743743#define Z180_IOCR_RMASK       0xff
744744#define Z180_IOCR_WMASK       0xff
745745
746int z180_icount;
746static int z180_icount;
747747static Z180_Regs Z180;
748748static UINT32 EA;
749749
r1334r1335
22942294   z180_change_pc(_PCD);
22952295}
22962296
2297#ifdef UNUSED_FUNCTION
22972298READ8_HANDLER( z180_internal_r )
22982299{
22992300   return Z180.io[offset & 0x3f];
r1334r1335
23052306   info.i = data;
23062307   z180_set_info( CPUINFO_INT_REGISTER + Z180_CNTLA0 + (offset & 0x3f), &info );
23072308}
2309#endif
23082310
23092311/****************************************************************************
23102312 * Set IRQ line state
src/emu/cpu/i86/i86.c
r1334r1335
5757/* cpu state                                                               */
5858/***************************************************************************/
5959
60int i8086_ICount;
60static int i8086_ICount;
6161
6262static i8086_Regs I;
6363static unsigned prefix_base;         /* base address of the latest prefix segment */
src/emu/cpu/i86/i286.c
r1334r1335
6565   memory_interface   mem;
6666} i80286_Regs;
6767
68int i80286_ICount;
68static int i80286_ICount;
6969
7070static i80286_Regs I;
7171static unsigned prefix_base;   /* base address of the latest prefix segment */
src/emu/cpu/upd7810/upd7810.c
r1334r1335
14971497   }
14981498}
14991499
1500void upd7810_init(int index, int clock, const void *config, int (*irqcallback)(int))
1500static void upd7810_init(int index, int clock, const void *config, int (*irqcallback)(int))
15011501{
15021502   upd7810.config = *(const UPD7810_CONFIG*) config;
15031503   upd7810.irq_callback = irqcallback;
src/emu/cpu/i8039/i8039.c
r1334r1335
9696} I8039_Regs;
9797
9898static I8039_Regs R;
99int      i8039_ICount;
99static int      i8039_ICount;
100100static int    inst_cycles;
101101static UINT8 Old_T1;
102102
src/emu/cpu/hd6309/hd6309.c
r1334r1335
556556   UpdateState();
557557}
558558
559void hd6309_exit(void)
559static void hd6309_exit(void)
560560{
561561   /* nothing to do ? */
562562}
src/emu/cpu/tlcs90/tlcs90.c
r1334r1335
23022302   return data;
23032303}
23042304
2305void t90_start_timer(int i)
2305static void t90_start_timer(int i)
23062306{
23072307   int prescaler;
23082308   attotime period;
r1334r1335
23492349   logerror("%04X: CPU Timer %d started at %lf Hz\n", activecpu_get_pc(), i, 1.0 / attotime_to_double(period));
23502350}
23512351
2352void t90_start_timer4(void)
2352static void t90_start_timer4(void)
23532353{
23542354   int prescaler;
23552355   attotime period;
r1334r1335
23722372}
23732373
23742374
2375void t90_stop_timer(int i)
2375static void t90_stop_timer(int i)
23762376{
23772377   timer_adjust(T90.timer[i], attotime_never, i, attotime_zero);
23782378   logerror("%04X: CPU Timer %d stopped\n", activecpu_get_pc(), i);
23792379}
23802380
2381void t90_stop_timer4(void)
2381static void t90_stop_timer4(void)
23822382{
23832383   t90_stop_timer(4);
23842384}
src/emu/cpu/e132xs/e132xsop.c
r0r1335
1#define LOCAL_DECODE_INIT \
2   struct regs_decode decode_state; \
3   struct regs_decode *decode = &decode_state; \
4\
5   /* clear 'current regs / flags' */ \
6   decode->src = 0; \
7   decode->dst = 0; \
8   decode->src_value = 0; \
9   decode->next_src_value = 0; \
10   decode->dst_value = 0; \
11   decode->next_dst_value = 0; \
12   decode->sub_type = 0; \
13   decode->extra.u = 0; \
14   decode->src_is_local = 0; \
15   decode->dst_is_local = 0; \
16   decode->same_src_dst = 0; \
17   decode->same_src_dstf = 0; \
18   decode->same_srcf_dst = 0; \
19   decode->op = opcode; \
20
21
22static void hyperstone_op00(UINT16 opcode)
23{
24   LOCAL_DECODE_INIT;
25   RRdecode(decode, 0, 0);
26   hyperstone_chk(decode);
27}
28
29static void hyperstone_op01(UINT16 opcode)
30{
31   LOCAL_DECODE_INIT;
32   RRdecode(decode, 0, 1);
33   hyperstone_chk(decode);
34}
35
36static void hyperstone_op02(UINT16 opcode)
37{
38   LOCAL_DECODE_INIT;
39   RRdecode(decode, 1, 0);
40   hyperstone_chk(decode);
41}
42
43static void hyperstone_op03(UINT16 opcode)
44{
45   LOCAL_DECODE_INIT;
46   RRdecode(decode, 1, 1);
47   hyperstone_chk(decode);
48}
49
50static void hyperstone_op04(UINT16 opcode)
51{
52   LOCAL_DECODE_INIT;
53   RRdecode(decode, 0, 0);
54   hyperstone_movd(decode);
55}
56
57static void hyperstone_op05(UINT16 opcode)
58{
59   LOCAL_DECODE_INIT;
60   RRdecode(decode, 0, 1);
61   hyperstone_movd(decode);
62}
63
64static void hyperstone_op06(UINT16 opcode)
65{
66   LOCAL_DECODE_INIT;
67   RRdecode(decode, 1, 0);
68   hyperstone_movd(decode);
69}
70
71static void hyperstone_op07(UINT16 opcode)
72{
73   LOCAL_DECODE_INIT;
74   RRdecode(decode, 1, 1);
75   hyperstone_movd(decode);
76}
77
78static void hyperstone_op08(UINT16 opcode)
79{
80   LOCAL_DECODE_INIT;
81   RRdecode(decode, 0, 0);
82   hyperstone_divu(decode);
83}
84
85static void hyperstone_op09(UINT16 opcode)
86{
87   LOCAL_DECODE_INIT;
88   RRdecode(decode, 0, 1);
89   hyperstone_divu(decode);
90}
91
92static void hyperstone_op0a(UINT16 opcode)
93{
94   LOCAL_DECODE_INIT;
95   RRdecode(decode, 1, 0);
96   hyperstone_divu(decode);
97}
98
99static void hyperstone_op0b(UINT16 opcode)
100{
101   LOCAL_DECODE_INIT;
102   RRdecode(decode, 1, 1);
103   hyperstone_divu(decode);
104}
105
106static void hyperstone_op0c(UINT16 opcode)
107{
108   LOCAL_DECODE_INIT;
109   RRdecode(decode, 0, 0);
110   hyperstone_divs(decode);
111}
112
113static void hyperstone_op0d(UINT16 opcode)
114{
115   LOCAL_DECODE_INIT;
116   RRdecode(decode, 0, 1);
117   hyperstone_divs(decode);
118}
119
120static void hyperstone_op0e(UINT16 opcode)
121{
122   LOCAL_DECODE_INIT;
123   RRdecode(decode, 1, 0);
124   hyperstone_divs(decode);
125}
126
127static void hyperstone_op0f(UINT16 opcode)
128{
129   LOCAL_DECODE_INIT;
130   RRdecode(decode, 1, 1);
131   hyperstone_divs(decode);
132}
133
134
135
136static void hyperstone_op10(UINT16 opcode)
137{
138   LOCAL_DECODE_INIT;
139   RRlimdecode(decode, 0, 0);
140   hyperstone_xm(decode);
141}
142
143static void hyperstone_op11(UINT16 opcode)
144{
145   LOCAL_DECODE_INIT;
146   RRlimdecode(decode, 0, 1);
147   hyperstone_xm(decode);
148}
149
150static void hyperstone_op12(UINT16 opcode)
151{
152   LOCAL_DECODE_INIT;
153   RRlimdecode(decode, 1, 0);
154   hyperstone_xm(decode);
155}
156
157static void hyperstone_op13(UINT16 opcode)
158{
159   LOCAL_DECODE_INIT;
160   RRlimdecode(decode, 1, 1);
161   hyperstone_xm(decode);
162}
163
164static void hyperstone_op14(UINT16 opcode)
165{
166   LOCAL_DECODE_INIT;
167   RRconstdecode(decode, 0, 0);
168   hyperstone_mask(decode);
169}
170
171static void hyperstone_op15(UINT16 opcode)
172{
173   LOCAL_DECODE_INIT;
174   RRconstdecode(decode, 0, 1);
175   hyperstone_mask(decode);
176}
177
178static void hyperstone_op16(UINT16 opcode)
179{
180   LOCAL_DECODE_INIT;
181   RRconstdecode(decode, 1, 0);
182   hyperstone_mask(decode);
183}
184
185static void hyperstone_op17(UINT16 opcode)
186{
187   LOCAL_DECODE_INIT;
188   RRconstdecode(decode, 1, 1);
189   hyperstone_mask(decode);
190}
191
192static void hyperstone_op18(UINT16 opcode)
193{
194   LOCAL_DECODE_INIT;
195   RRconstdecode(decode, 0, 0);
196   hyperstone_sum(decode);
197}
198
199static void hyperstone_op19(UINT16 opcode)
200{
201   LOCAL_DECODE_INIT;
202   RRconstdecode(decode, 0, 1);
203   hyperstone_sum(decode);
204}
205
206static void hyperstone_op1a(UINT16 opcode)
207{
208   LOCAL_DECODE_INIT;
209   RRconstdecode(decode, 1, 0);
210   hyperstone_sum(decode);
211}
212
213static void hyperstone_op1b(UINT16 opcode)
214{
215   LOCAL_DECODE_INIT;
216   RRconstdecode(decode, 1, 1);
217   hyperstone_sum(decode);
218}
219
220static void hyperstone_op1c(UINT16 opcode)
221{
222   LOCAL_DECODE_INIT;
223   RRconstdecode(decode, 0, 0);
224   hyperstone_sums(decode);
225}
226
227static void hyperstone_op1d(UINT16 opcode)
228{
229   LOCAL_DECODE_INIT;
230   RRconstdecode(decode, 0, 1);
231   hyperstone_sums(decode);
232}
233
234static void hyperstone_op1e(UINT16 opcode)
235{
236   LOCAL_DECODE_INIT;
237   RRconstdecode(decode, 1, 0);
238   hyperstone_sums(decode);
239}
240
241static void hyperstone_op1f(UINT16 opcode)
242{
243   LOCAL_DECODE_INIT;
244   RRconstdecode(decode, 1, 1);
245   hyperstone_sums(decode);
246}
247
248
249
250static void hyperstone_op20(UINT16 opcode)
251{
252   LOCAL_DECODE_INIT;
253   RRdecode(decode, 0, 0);
254   hyperstone_cmp(decode);
255}
256
257static void hyperstone_op21(UINT16 opcode)
258{
259   LOCAL_DECODE_INIT;
260   RRdecode(decode, 0, 1);
261   hyperstone_cmp(decode);
262}
263
264static void hyperstone_op22(UINT16 opcode)
265{
266   LOCAL_DECODE_INIT;
267   RRdecode(decode, 1, 0);
268   hyperstone_cmp(decode);
269}
270
271static void hyperstone_op23(UINT16 opcode)
272{
273   LOCAL_DECODE_INIT;
274   RRdecode(decode, 1, 1);
275   hyperstone_cmp(decode);
276}
277
278static void hyperstone_op24(UINT16 opcode)
279{
280   LOCAL_DECODE_INIT;
281   RRdecodewithHflag(decode, 0, 0);
282   hyperstone_mov(decode);
283}
284
285static void hyperstone_op25(UINT16 opcode)
286{
287   LOCAL_DECODE_INIT;
288   RRdecodewithHflag(decode, 0, 1);
289   hyperstone_mov(decode);
290}
291
292static void hyperstone_op26(UINT16 opcode)
293{
294   LOCAL_DECODE_INIT;
295   RRdecodewithHflag(decode, 1, 0);
296   hyperstone_mov(decode);
297}
298
299static void hyperstone_op27(UINT16 opcode)
300{
301   LOCAL_DECODE_INIT;
302   RRdecodewithHflag(decode, 1, 1);
303   hyperstone_mov(decode);
304}
305
306static void hyperstone_op28(UINT16 opcode)
307{
308   LOCAL_DECODE_INIT;
309   RRdecode(decode, 0, 0);
310   hyperstone_add(decode);
311}
312
313static void hyperstone_op29(UINT16 opcode)
314{
315   LOCAL_DECODE_INIT;
316   RRdecode(decode, 0, 1);
317   hyperstone_add(decode);
318}
319
320static void hyperstone_op2a(UINT16 opcode)
321{
322   LOCAL_DECODE_INIT;
323   RRdecode(decode, 1, 0);
324   hyperstone_add(decode);
325}
326
327static void hyperstone_op2b(UINT16 opcode)
328{
329   LOCAL_DECODE_INIT;
330   RRdecode(decode, 1, 1);
331   hyperstone_add(decode);
332}
333
334static void hyperstone_op2c(UINT16 opcode)
335{
336   LOCAL_DECODE_INIT;
337   RRdecode(decode, 0, 0);
338   hyperstone_adds(decode);
339}
340
341static void hyperstone_op2d(UINT16 opcode)
342{
343   LOCAL_DECODE_INIT;
344   RRdecode(decode, 0, 1);
345   hyperstone_adds(decode);
346}
347
348static void hyperstone_op2e(UINT16 opcode)
349{
350   LOCAL_DECODE_INIT;
351   RRdecode(decode, 1, 0);
352   hyperstone_adds(decode);
353}
354
355static void hyperstone_op2f(UINT16 opcode)
356{
357   LOCAL_DECODE_INIT;
358   RRdecode(decode, 1, 1);
359   hyperstone_adds(decode);
360}
361
362
363
364static void hyperstone_op30(UINT16 opcode)
365{
366   LOCAL_DECODE_INIT;
367   RRdecode(decode, 0, 0);
368   hyperstone_cmpb(decode);
369}
370
371static void hyperstone_op31(UINT16 opcode)
372{
373   LOCAL_DECODE_INIT;
374   RRdecode(decode, 0, 1);
375   hyperstone_cmpb(decode);
376}
377
378static void hyperstone_op32(UINT16 opcode)
379{
380   LOCAL_DECODE_INIT;
381   RRdecode(decode, 1, 0);
382   hyperstone_cmpb(decode);
383}
384
385static void hyperstone_op33(UINT16 opcode)
386{
387   LOCAL_DECODE_INIT;
388   RRdecode(decode, 1, 1);
389   hyperstone_cmpb(decode);
390}
391
392static void hyperstone_op34(UINT16 opcode)
393{
394   LOCAL_DECODE_INIT;
395   RRdecode(decode, 0, 0);
396   hyperstone_andn(decode);
397}
398
399static void hyperstone_op35(UINT16 opcode)
400{
401   LOCAL_DECODE_INIT;
402   RRdecode(decode, 0, 1);
403   hyperstone_andn(decode);
404}
405
406static void hyperstone_op36(UINT16 opcode)
407{
408   LOCAL_DECODE_INIT;
409   RRdecode(decode, 1, 0);
410   hyperstone_andn(decode);
411}
412
413static void hyperstone_op37(UINT16 opcode)
414{
415   LOCAL_DECODE_INIT;
416   RRdecode(decode, 1, 1);
417   hyperstone_andn(decode);
418}
419
420static void hyperstone_op38(UINT16 opcode)
421{
422   LOCAL_DECODE_INIT;
423   RRdecode(decode, 0, 0);
424   hyperstone_or(decode);
425}
426
427static void hyperstone_op39(UINT16 opcode)
428{
429   LOCAL_DECODE_INIT;
430   RRdecode(decode, 0, 1);
431   hyperstone_or(decode);
432}
433
434static void hyperstone_op3a(UINT16 opcode)
435{
436   LOCAL_DECODE_INIT;
437   RRdecode(decode, 1, 0);
438   hyperstone_or(decode);
439}
440
441static void hyperstone_op3b(UINT16 opcode)
442{
443   LOCAL_DECODE_INIT;
444   RRdecode(decode, 1, 1);
445   hyperstone_or(decode);
446}
447
448static void hyperstone_op3c(UINT16 opcode)
449{
450   LOCAL_DECODE_INIT;
451   RRdecode(decode, 0, 0);
452   hyperstone_xor(decode);
453}
454
455static void hyperstone_op3d(UINT16 opcode)
456{
457   LOCAL_DECODE_INIT;
458   RRdecode(decode, 0, 1);
459   hyperstone_xor(decode);
460}
461
462static void hyperstone_op3e(UINT16 opcode)
463{
464   LOCAL_DECODE_INIT;
465   RRdecode(decode, 1, 0);
466   hyperstone_xor(decode);
467}
468
469static void hyperstone_op3f(UINT16 opcode)
470{
471   LOCAL_DECODE_INIT;
472   RRdecode(decode, 1, 1);
473   hyperstone_xor(decode);
474}
475
476
477
478static void hyperstone_op40(UINT16 opcode)
479{
480   LOCAL_DECODE_INIT;
481   RRdecode(decode, 0, 0);
482   hyperstone_subc(decode);
483}
484
485static void hyperstone_op41(UINT16 opcode)
486{
487   LOCAL_DECODE_INIT;
488   RRdecode(decode, 0, 1);
489   hyperstone_subc(decode);
490}
491
492static void hyperstone_op42(UINT16 opcode)
493{
494   LOCAL_DECODE_INIT;
495   RRdecode(decode, 1, 0);
496   hyperstone_subc(decode);
497}
498
499static void hyperstone_op43(UINT16 opcode)
500{
501   LOCAL_DECODE_INIT;
502   RRdecode(decode, 1, 1);
503   hyperstone_subc(decode);
504}
505
506static void hyperstone_op44(UINT16 opcode)
507{
508   LOCAL_DECODE_INIT;
509   RRdecode(decode, 0, 0);
510   hyperstone_not(decode);
511}
512
513static void hyperstone_op45(UINT16 opcode)
514{
515   LOCAL_DECODE_INIT;
516   RRdecode(decode, 0, 1);
517   hyperstone_not(decode);
518}
519
520static void hyperstone_op46(UINT16 opcode)
521{
522   LOCAL_DECODE_INIT;
523   RRdecode(decode, 1, 0);
524   hyperstone_not(decode);
525}
526
527static void hyperstone_op47(UINT16 opcode)
528{
529   LOCAL_DECODE_INIT;
530   RRdecode(decode, 1, 1);
531   hyperstone_not(decode);
532}
533
534static void hyperstone_op48(UINT16 opcode)
535{
536   LOCAL_DECODE_INIT;
537   RRdecode(decode, 0, 0);
538   hyperstone_sub(decode);
539}
540
541static void hyperstone_op49(UINT16 opcode)
542{
543   LOCAL_DECODE_INIT;
544   RRdecode(decode, 0, 1);
545   hyperstone_sub(decode);
546}
547
548static void hyperstone_op4a(UINT16 opcode)
549{
550   LOCAL_DECODE_INIT;
551   RRdecode(decode, 1, 0);
552   hyperstone_sub(decode);
553}
554
555static void hyperstone_op4b(UINT16 opcode)
556{
557   LOCAL_DECODE_INIT;
558   RRdecode(decode, 1, 1);
559   hyperstone_sub(decode);
560}
561
562static void hyperstone_op4c(UINT16 opcode)
563{
564   LOCAL_DECODE_INIT;
565   RRdecode(decode, 0, 0);
566   hyperstone_subs(decode);
567}
568
569static void hyperstone_op4d(UINT16 opcode)
570{
571   LOCAL_DECODE_INIT;
572   RRdecode(decode, 0, 1);
573   hyperstone_subs(decode);
574}
575
576static void hyperstone_op4e(UINT16 opcode)
577{
578   LOCAL_DECODE_INIT;
579   RRdecode(decode, 1, 0);
580   hyperstone_subs(decode);
581}
582
583static void hyperstone_op4f(UINT16 opcode)
584{
585   LOCAL_DECODE_INIT;
586   RRdecode(decode, 1, 1);
587   hyperstone_subs(decode);
588}
589
590
591
592static void hyperstone_op50(UINT16 opcode)
593{
594   LOCAL_DECODE_INIT;
595   RRdecode(decode, 0, 0);
596   hyperstone_addc(decode);
597}
598
599static void hyperstone_op51(UINT16 opcode)
600{
601   LOCAL_DECODE_INIT;
602   RRdecode(decode, 0, 1);
603   hyperstone_addc(decode);
604}
605
606static void hyperstone_op52(UINT16 opcode)
607{
608   LOCAL_DECODE_INIT;
609   RRdecode(decode, 1, 0);
610   hyperstone_addc(decode);
611}
612
613static void hyperstone_op53(UINT16 opcode)
614{
615   LOCAL_DECODE_INIT;
616   RRdecode(decode, 1, 1);
617   hyperstone_addc(decode);
618}
619
620static void hyperstone_op54(UINT16 opcode)
621{
622   LOCAL_DECODE_INIT;
623   RRdecode(decode, 0, 0);
624   hyperstone_and(decode);
625}
626
627static void hyperstone_op55(UINT16 opcode)
628{
629   LOCAL_DECODE_INIT;
630   RRdecode(decode, 0, 1);
631   hyperstone_and(decode);
632}
633
634static void hyperstone_op56(UINT16 opcode)
635{
636   LOCAL_DECODE_INIT;
637   RRdecode(decode, 1, 0);
638   hyperstone_and(decode);
639}
640
641static void hyperstone_op57(UINT16 opcode)
642{
643   LOCAL_DECODE_INIT;
644   RRdecode(decode, 1, 1);
645   hyperstone_and(decode);
646}
647
648static void hyperstone_op58(UINT16 opcode)
649{
650   LOCAL_DECODE_INIT;
651   RRdecode(decode, 0, 0);
652   hyperstone_neg(decode);
653}
654
655static void hyperstone_op59(UINT16 opcode)
656{
657   LOCAL_DECODE_INIT;
658   RRdecode(decode, 0, 1);
659   hyperstone_neg(decode);
660}
661
662static void hyperstone_op5a(UINT16 opcode)
663{
664   LOCAL_DECODE_INIT;
665   RRdecode(decode, 1, 0);
666   hyperstone_neg(decode);
667}
668
669static void hyperstone_op5b(UINT16 opcode)
670{
671   LOCAL_DECODE_INIT;
672   RRdecode(decode, 1, 1);
673   hyperstone_neg(decode);
674}
675
676static void hyperstone_op5c(UINT16 opcode)
677{
678   LOCAL_DECODE_INIT;
679   RRdecode(decode, 0, 0);
680   hyperstone_negs(decode);
681}
682
683static void hyperstone_op5d(UINT16 opcode)
684{
685   LOCAL_DECODE_INIT;
686   RRdecode(decode, 0, 1);
687   hyperstone_negs(decode);
688}
689
690static void hyperstone_op5e(UINT16 opcode)
691{
692   LOCAL_DECODE_INIT;
693   RRdecode(decode, 1, 0);
694   hyperstone_negs(decode);
695}
696
697static void hyperstone_op5f(UINT16 opcode)
698{
699   LOCAL_DECODE_INIT;
700   RRdecode(decode, 1, 1);
701   hyperstone_negs(decode);
702}
703
704
705
706static void hyperstone_op60(UINT16 opcode)
707{
708   LOCAL_DECODE_INIT;
709   Rimmdecode(decode, 0, 0);
710   hyperstone_cmpi(decode);
711}
712
713static void hyperstone_op61(UINT16 opcode)
714{
715   LOCAL_DECODE_INIT;
716   Rimmdecode(decode, 0, 1);
717   hyperstone_cmpi(decode);
718}
719
720static void hyperstone_op62(UINT16 opcode)
721{
722   LOCAL_DECODE_INIT;
723   Rimmdecode(decode, 1, 0);
724   hyperstone_cmpi(decode);
725}
726
727static void hyperstone_op63(UINT16 opcode)
728{
729   LOCAL_DECODE_INIT;
730   Rimmdecode(decode, 1, 1);
731   hyperstone_cmpi(decode);
732}
733
734static void hyperstone_op64(UINT16 opcode)
735{
736   LOCAL_DECODE_INIT;
737   RimmdecodewithHflag(decode, 0, 0);
738   hyperstone_movi(decode);
739}
740
741static void hyperstone_op65(UINT16 opcode)
742{
743   LOCAL_DECODE_INIT;
744   RimmdecodewithHflag(decode, 0, 1);
745   hyperstone_movi(decode);
746}
747
748static void hyperstone_op66(UINT16 opcode)
749{
750   LOCAL_DECODE_INIT;
751   RimmdecodewithHflag(decode, 1, 0);
752   hyperstone_movi(decode);
753}
754
755static void hyperstone_op67(UINT16 opcode)
756{
757   LOCAL_DECODE_INIT;
758   RimmdecodewithHflag(decode, 1, 1);
759   hyperstone_movi(decode);
760}
761
762static void hyperstone_op68(UINT16 opcode)
763{
764   LOCAL_DECODE_INIT;
765   Rimmdecode(decode, 0, 0);
766   hyperstone_addi(decode);
767}
768
769static void hyperstone_op69(UINT16 opcode)
770{
771   LOCAL_DECODE_INIT;
772   Rimmdecode(decode, 0, 1);
773   hyperstone_addi(decode);
774}
775
776static void hyperstone_op6a(UINT16 opcode)
777{
778   LOCAL_DECODE_INIT;
779   Rimmdecode(decode, 1, 0);
780   hyperstone_addi(decode);
781}
782
783static void hyperstone_op6b(UINT16 opcode)
784{
785   LOCAL_DECODE_INIT;
786   Rimmdecode(decode, 1, 1);
787   hyperstone_addi(decode);
788}
789
790static void hyperstone_op6c(UINT16 opcode)
791{
792   LOCAL_DECODE_INIT;
793   Rimmdecode(decode, 0, 0);
794   hyperstone_addsi(decode);
795}
796
797static void hyperstone_op6d(UINT16 opcode)
798{
799   LOCAL_DECODE_INIT;
800   Rimmdecode(decode, 0, 1);
801   hyperstone_addsi(decode);
802}
803
804static void hyperstone_op6e(UINT16 opcode)
805{
806   LOCAL_DECODE_INIT;
807   Rimmdecode(decode, 1, 0);
808   hyperstone_addsi(decode);
809}
810
811static void hyperstone_op6f(UINT16 opcode)
812{
813   LOCAL_DECODE_INIT;
814   Rimmdecode(decode, 1, 1);
815   hyperstone_addsi(decode);
816}
817
818
819
820static void hyperstone_op70(UINT16 opcode)
821{
822   LOCAL_DECODE_INIT;
823   Rimmdecode(decode, 0, 0);
824   hyperstone_cmpbi(decode);
825}
826
827static void hyperstone_op71(UINT16 opcode)
828{
829   LOCAL_DECODE_INIT;
830   Rimmdecode(decode, 0, 1);
831   hyperstone_cmpbi(decode);
832}
833
834static void hyperstone_op72(UINT16 opcode)
835{
836   LOCAL_DECODE_INIT;
837   Rimmdecode(decode, 1, 0);
838   hyperstone_cmpbi(decode);
839}
840
841static void hyperstone_op73(UINT16 opcode)
842{
843   LOCAL_DECODE_INIT;
844   Rimmdecode(decode, 1, 1);
845   hyperstone_cmpbi(decode);
846}
847
848static void hyperstone_op74(UINT16 opcode)
849{
850   LOCAL_DECODE_INIT;
851   Rimmdecode(decode, 0, 0);
852   hyperstone_andni(decode);
853}
854
855static void hyperstone_op75(UINT16 opcode)
856{
857   LOCAL_DECODE_INIT;
858   Rimmdecode(decode, 0, 1);
859   hyperstone_andni(decode);
860}
861
862static void hyperstone_op76(UINT16 opcode)
863{
864   LOCAL_DECODE_INIT;
865   Rimmdecode(decode, 1, 0);
866   hyperstone_andni(decode);
867}
868
869static void hyperstone_op77(UINT16 opcode)
870{
871   LOCAL_DECODE_INIT;
872   Rimmdecode(decode, 1, 1);
873   hyperstone_andni(decode);
874}
875
876static void hyperstone_op78(UINT16 opcode)
877{
878   LOCAL_DECODE_INIT;
879   Rimmdecode(decode, 0, 0);
880   hyperstone_ori(decode);
881}
882
883static void hyperstone_op79(UINT16 opcode)
884{
885   LOCAL_DECODE_INIT;
886   Rimmdecode(decode, 0, 1);
887   hyperstone_ori(decode);
888}
889
890static void hyperstone_op7a(UINT16 opcode)
891{
892   LOCAL_DECODE_INIT;
893   Rimmdecode(decode, 1, 0);
894   hyperstone_ori(decode);
895}
896
897static void hyperstone_op7b(UINT16 opcode)
898{
899   LOCAL_DECODE_INIT;
900   Rimmdecode(decode, 1, 1);
901   hyperstone_ori(decode);
902}
903
904static void hyperstone_op7c(UINT16 opcode)
905{
906   LOCAL_DECODE_INIT;
907   Rimmdecode(decode, 0, 0);
908   hyperstone_xori(decode);
909}
910
911static void hyperstone_op7d(UINT16 opcode)
912{
913   LOCAL_DECODE_INIT;
914   Rimmdecode(decode, 0, 1);
915   hyperstone_xori(decode);
916}
917
918static void hyperstone_op7e(UINT16 opcode)
919{
920   LOCAL_DECODE_INIT;
921   Rimmdecode(decode, 1, 0);
922   hyperstone_xori(decode);
923}
924
925static void hyperstone_op7f(UINT16 opcode)
926{
927   LOCAL_DECODE_INIT;
928   Rimmdecode(decode, 1, 1);
929   hyperstone_xori(decode);
930}
931
932
933
934static void hyperstone_op80(UINT16 opcode)
935{
936   LOCAL_DECODE_INIT;
937   Lndecode(decode);
938   hyperstone_shrdi(decode);
939}
940
941static void hyperstone_op81(UINT16 opcode)
942{
943   LOCAL_DECODE_INIT;
944   Lndecode(decode);
945   hyperstone_shrdi(decode);
946}
947
948static void hyperstone_op82(UINT16 opcode)
949{
950   LOCAL_DECODE_INIT;
951   LLdecode(decode);
952   hyperstone_shrd(decode);
953}
954
955static void hyperstone_op83(UINT16 opcode)
956{
957   LOCAL_DECODE_INIT;
958   LLdecode(decode);
959   hyperstone_shr(decode);
960}
961
962static void hyperstone_op84(UINT16 opcode)
963{
964   LOCAL_DECODE_INIT;
965   Lndecode(decode);
966   hyperstone_sardi(decode);
967}
968
969static void hyperstone_op85(UINT16 opcode)
970{
971   LOCAL_DECODE_INIT;
972   Lndecode(decode);
973   hyperstone_sardi(decode);
974}
975
976static void hyperstone_op86(UINT16 opcode)
977{
978   LOCAL_DECODE_INIT;
979   LLdecode(decode);
980   hyperstone_sard(decode);
981}
982
983static void hyperstone_op87(UINT16 opcode)
984{
985   LOCAL_DECODE_INIT;
986   LLdecode(decode);
987   hyperstone_sar(decode);
988}
989
990static void hyperstone_op88(UINT16 opcode)
991{
992   LOCAL_DECODE_INIT;
993   Lndecode(decode);
994   hyperstone_shldi(decode);
995}
996
997static void hyperstone_op89(UINT16 opcode)
998{
999   LOCAL_DECODE_INIT;
1000   Lndecode(decode);
1001   hyperstone_shldi(decode);
1002}
1003
1004static void hyperstone_op8a(UINT16 opcode)
1005{
1006   LOCAL_DECODE_INIT;
1007   LLdecode(decode);
1008   hyperstone_shld(decode);
1009}
1010
1011static void hyperstone_op8b(UINT16 opcode)
1012{
1013   LOCAL_DECODE_INIT;
1014   LLdecode(decode);
1015   hyperstone_shl(decode);
1016}
1017
1018static void hyperstone_op8c(UINT16 opcode)
1019{
1020   LOCAL_DECODE_INIT;
1021   no_decode(decode);
1022   reserved(decode);
1023}
1024
1025static void hyperstone_op8d(UINT16 opcode)
1026{
1027   LOCAL_DECODE_INIT;
1028   no_decode(decode);
1029   reserved(decode);
1030}
1031
1032static void hyperstone_op8e(UINT16 opcode)
1033{
1034   LOCAL_DECODE_INIT;
1035   LLdecode(decode);
1036   hyperstone_testlz(decode);
1037}
1038
1039static void hyperstone_op8f(UINT16 opcode)
1040{
1041   LOCAL_DECODE_INIT;
1042   LLdecode(decode);
1043   hyperstone_rol(decode);
1044}
1045
1046
1047
1048static void hyperstone_op90(UINT16 opcode)
1049{
1050   LOCAL_DECODE_INIT;
1051   RRdisdecode(decode, 0, 0);
1052   hyperstone_ldxx1(decode);
1053}
1054
1055static void hyperstone_op91(UINT16 opcode)
1056{
1057   LOCAL_DECODE_INIT;
1058   RRdisdecode(decode, 0, 1);
1059   hyperstone_ldxx1(decode);
1060}
1061
1062static void hyperstone_op92(UINT16 opcode)
1063{
1064   LOCAL_DECODE_INIT;
1065   RRdisdecode(decode, 1, 0);
1066   hyperstone_ldxx1(decode);
1067}
1068
1069static void hyperstone_op93(UINT16 opcode)
1070{
1071   LOCAL_DECODE_INIT;
1072   RRdisdecode(decode, 1, 1);
1073   hyperstone_ldxx1(decode);
1074}
1075
1076static void hyperstone_op94(UINT16 opcode)
1077{
1078   LOCAL_DECODE_INIT;
1079   RRdisdecode(decode, 0, 0);
1080   hyperstone_ldxx2(decode);
1081}
1082
1083static void hyperstone_op95(UINT16 opcode)
1084{
1085   LOCAL_DECODE_INIT;
1086   RRdisdecode(decode, 0, 1);
1087   hyperstone_ldxx2(decode);
1088}
1089
1090static void hyperstone_op96(UINT16 opcode)
1091{
1092   LOCAL_DECODE_INIT;
1093   RRdisdecode(decode, 1, 0);
1094   hyperstone_ldxx2(decode);
1095}
1096
1097static void hyperstone_op97(UINT16 opcode)
1098{
1099   LOCAL_DECODE_INIT;
1100   RRdisdecode(decode, 1, 1);
1101   hyperstone_ldxx2(decode);
1102}
1103
1104static void hyperstone_op98(UINT16 opcode)
1105{
1106   LOCAL_DECODE_INIT;
1107   RRdisdecode(decode, 0, 0);
1108   hyperstone_stxx1(decode);
1109}
1110
1111static void hyperstone_op99(UINT16 opcode)
1112{
1113   LOCAL_DECODE_INIT;
1114   RRdisdecode(decode, 0, 1);
1115   hyperstone_stxx1(decode);
1116}
1117
1118static void hyperstone_op9a(UINT16 opcode)
1119{
1120   LOCAL_DECODE_INIT;
1121   RRdisdecode(decode, 1, 0);
1122   hyperstone_stxx1(decode);
1123}
1124
1125static void hyperstone_op9b(UINT16 opcode)
1126{
1127   LOCAL_DECODE_INIT;
1128   RRdisdecode(decode, 1, 1);
1129   hyperstone_stxx1(decode);
1130}
1131
1132static void hyperstone_op9c(UINT16 opcode)
1133{
1134   LOCAL_DECODE_INIT;
1135   RRdisdecode(decode, 0, 0);
1136   hyperstone_stxx2(decode);
1137}
1138
1139static void hyperstone_op9d(UINT16 opcode)
1140{
1141   LOCAL_DECODE_INIT;
1142   RRdisdecode(decode, 0, 1);
1143   hyperstone_stxx2(decode);
1144}
1145
1146static void hyperstone_op9e(UINT16 opcode)
1147{
1148   LOCAL_DECODE_INIT;
1149   RRdisdecode(decode, 1, 0);
1150   hyperstone_stxx2(decode);
1151}
1152
1153static void hyperstone_op9f(UINT16 opcode)
1154{
1155   LOCAL_DECODE_INIT;
1156   RRdisdecode(decode, 1, 1);
1157   hyperstone_stxx2(decode);
1158}
1159
1160
1161
1162static void hyperstone_opa0(UINT16 opcode)
1163{
1164   LOCAL_DECODE_INIT;
1165   Rndecode(decode, 0);
1166   hyperstone_shri(decode);
1167}
1168
1169static void hyperstone_opa1(UINT16 opcode)
1170{
1171   LOCAL_DECODE_INIT;
1172   Rndecode(decode, 0);
1173   hyperstone_shri(decode);
1174}
1175
1176static void hyperstone_opa2(UINT16 opcode)
1177{
1178   LOCAL_DECODE_INIT;
1179   Rndecode(decode, 1);
1180   hyperstone_shri(decode);
1181}
1182
1183static void hyperstone_opa3(UINT16 opcode)
1184{
1185   LOCAL_DECODE_INIT;
1186   Rndecode(decode, 1);
1187   hyperstone_shri(decode);
1188}
1189
1190static void hyperstone_opa4(UINT16 opcode)
1191{
1192   LOCAL_DECODE_INIT;
1193   Rndecode(decode, 0);
1194   hyperstone_sari(decode);
1195}
1196
1197static void hyperstone_opa5(UINT16 opcode)
1198{
1199   LOCAL_DECODE_INIT;
1200   Rndecode(decode, 0);
1201   hyperstone_sari(decode);
1202}
1203
1204static void hyperstone_opa6(UINT16 opcode)
1205{
1206   LOCAL_DECODE_INIT;
1207   Rndecode(decode, 1);
1208   hyperstone_sari(decode);
1209}
1210
1211static void hyperstone_opa7(UINT16 opcode)
1212{
1213   LOCAL_DECODE_INIT;
1214   Rndecode(decode, 1);
1215   hyperstone_sari(decode);
1216}
1217
1218static void hyperstone_opa8(UINT16 opcode)
1219{
1220   LOCAL_DECODE_INIT;
1221   Rndecode(decode, 0);
1222   hyperstone_shli(decode);
1223}
1224
1225static void hyperstone_opa9(UINT16 opcode)
1226{
1227   LOCAL_DECODE_INIT;
1228   Rndecode(decode, 0);
1229   hyperstone_shli(decode);
1230}
1231
1232static void hyperstone_opaa(UINT16 opcode)
1233{
1234   LOCAL_DECODE_INIT;
1235   Rndecode(decode, 1);
1236   hyperstone_shli(decode);
1237}
1238
1239static void hyperstone_opab(UINT16 opcode)
1240{
1241   LOCAL_DECODE_INIT;
1242   Rndecode(decode, 1);
1243   hyperstone_shli(decode);
1244}
1245
1246static void hyperstone_opac(UINT16 opcode)
1247{
1248   LOCAL_DECODE_INIT;
1249   no_decode(decode);
1250   reserved(decode);
1251}
1252
1253static void hyperstone_opad(UINT16 opcode)
1254{
1255   LOCAL_DECODE_INIT;
1256   no_decode(decode);
1257   reserved(decode);
1258}
1259
1260static void hyperstone_opae(UINT16 opcode)
1261{
1262   LOCAL_DECODE_INIT;
1263   no_decode(decode);
1264   reserved(decode);
1265}
1266
1267static void hyperstone_opaf(UINT16 opcode)
1268{
1269   LOCAL_DECODE_INIT;
1270   no_decode(decode);
1271   reserved(decode);
1272}
1273
1274
1275
1276static void hyperstone_opb0(UINT16 opcode)
1277{
1278   LOCAL_DECODE_INIT;
1279   RRdecode(decode, 0, 0);
1280   hyperstone_mulu(decode);
1281}
1282
1283static void hyperstone_opb1(UINT16 opcode)
1284{
1285   LOCAL_DECODE_INIT;
1286   RRdecode(decode, 0, 1);
1287   hyperstone_mulu(decode);
1288}
1289
1290static void hyperstone_opb2(UINT16 opcode)
1291{
1292   LOCAL_DECODE_INIT;
1293   RRdecode(decode, 1, 0);
1294   hyperstone_mulu(decode);
1295}
1296
1297static void hyperstone_opb3(UINT16 opcode)
1298{
1299   LOCAL_DECODE_INIT;
1300   RRdecode(decode, 1, 1);
1301   hyperstone_mulu(decode);
1302}
1303
1304static void hyperstone_opb4(UINT16 opcode)
1305{
1306   LOCAL_DECODE_INIT;
1307   RRdecode(decode, 0, 0);
1308   hyperstone_muls(decode);
1309}
1310
1311static void hyperstone_opb5(UINT16 opcode)
1312{
1313   LOCAL_DECODE_INIT;
1314   RRdecode(decode, 0, 1);
1315   hyperstone_muls(decode);
1316}
1317
1318static void hyperstone_opb6(UINT16 opcode)
1319{
1320   LOCAL_DECODE_INIT;
1321   RRdecode(decode, 1, 0);
1322   hyperstone_muls(decode);
1323}
1324
1325static void hyperstone_opb7(UINT16 opcode)
1326{
1327   LOCAL_DECODE_INIT;
1328   RRdecode(decode, 1, 1);
1329   hyperstone_muls(decode);
1330}
1331
1332static void hyperstone_opb8(UINT16 opcode)
1333{
1334   LOCAL_DECODE_INIT;
1335   Rndecode(decode, 0);
1336   hyperstone_set(decode);
1337}
1338
1339static void hyperstone_opb9(UINT16 opcode)
1340{
1341   LOCAL_DECODE_INIT;
1342   Rndecode(decode, 0);
1343   hyperstone_set(decode);
1344}
1345
1346static void hyperstone_opba(UINT16 opcode)
1347{
1348   LOCAL_DECODE_INIT;
1349   Rndecode(decode, 1);
1350   hyperstone_set(decode);
1351}
1352
1353static void hyperstone_opbb(UINT16 opcode)
1354{
1355   LOCAL_DECODE_INIT;
1356   Rndecode(decode, 1);
1357   hyperstone_set(decode);
1358}
1359
1360static void hyperstone_opbc(UINT16 opcode)
1361{
1362   LOCAL_DECODE_INIT;
1363   RRdecode(decode, 0, 0);
1364   hyperstone_mul(decode);
1365}
1366
1367static void hyperstone_opbd(UINT16 opcode)
1368{
1369   LOCAL_DECODE_INIT;
1370   RRdecode(decode, 0, 1);
1371   hyperstone_mul(decode);
1372}
1373
1374static void hyperstone_opbe(UINT16 opcode)
1375{
1376   LOCAL_DECODE_INIT;
1377   RRdecode(decode, 1, 0);
1378   hyperstone_mul(decode);
1379}
1380
1381static void hyperstone_opbf(UINT16 opcode)
1382{
1383   LOCAL_DECODE_INIT;
1384   RRdecode(decode, 1, 1);
1385   hyperstone_mul(decode);
1386}
1387
1388
1389
1390static void hyperstone_opc0(UINT16 opcode)
1391{
1392   LOCAL_DECODE_INIT;
1393   LLdecode(decode);
1394   hyperstone_fadd(decode);
1395}
1396
1397static void hyperstone_opc1(UINT16 opcode)
1398{
1399   LOCAL_DECODE_INIT;
1400   LLdecode(decode);
1401   hyperstone_faddd(decode);
1402}
1403
1404static void hyperstone_opc2(UINT16 opcode)
1405{
1406   LOCAL_DECODE_INIT;
1407   LLdecode(decode);
1408   hyperstone_fsub(decode);
1409}
1410
1411static void hyperstone_opc3(UINT16 opcode)
1412{
1413   LOCAL_DECODE_INIT;
1414   LLdecode(decode);
1415   hyperstone_fsubd(decode);
1416}
1417
1418static void hyperstone_opc4(UINT16 opcode)
1419{
1420   LOCAL_DECODE_INIT;
1421   LLdecode(decode);
1422   hyperstone_fmul(decode);
1423}
1424
1425static void hyperstone_opc5(UINT16 opcode)
1426{
1427   LOCAL_DECODE_INIT;
1428   LLdecode(decode);
1429   hyperstone_fmuld(decode);
1430}
1431
1432static void hyperstone_opc6(UINT16 opcode)
1433{
1434   LOCAL_DECODE_INIT;
1435   LLdecode(decode);
1436   hyperstone_fdiv(decode);
1437}
1438
1439static void hyperstone_opc7(UINT16 opcode)
1440{
1441   LOCAL_DECODE_INIT;
1442   LLdecode(decode);
1443   hyperstone_fdivd(decode);
1444}
1445
1446static void hyperstone_opc8(UINT16 opcode)
1447{
1448   LOCAL_DECODE_INIT;
1449   LLdecode(decode);
1450   hyperstone_fcmp(decode);
1451}
1452
1453static void hyperstone_opc9(UINT16 opcode)
1454{
1455   LOCAL_DECODE_INIT;
1456   LLdecode(decode);
1457   hyperstone_fcmpd(decode);
1458}
1459
1460static void hyperstone_opca(UINT16 opcode)
1461{
1462   LOCAL_DECODE_INIT;
1463   LLdecode(decode);
1464   hyperstone_fcmpu(decode);
1465}
1466
1467static void hyperstone_opcb(UINT16 opcode)
1468{
1469   LOCAL_DECODE_INIT;
1470   LLdecode(decode);
1471   hyperstone_fcmpud(decode);
1472}
1473
1474static void hyperstone_opcc(UINT16 opcode)
1475{
1476   LOCAL_DECODE_INIT;
1477   LLdecode(decode);
1478   hyperstone_fcvt(decode);
1479}
1480
1481static void hyperstone_opcd(UINT16 opcode)
1482{
1483   LOCAL_DECODE_INIT;
1484   LLdecode(decode);
1485   hyperstone_fcvtd(decode);
1486}
1487
1488static void hyperstone_opce(UINT16 opcode)
1489{
1490   LOCAL_DECODE_INIT;
1491   LLextdecode(decode);
1492   hyperstone_extend(decode);
1493}
1494
1495static void hyperstone_opcf(UINT16 opcode)
1496{
1497   LOCAL_DECODE_INIT;
1498   LLdecode(decode);
1499   hyperstone_do(decode);
1500}
1501
1502
1503
1504static void hyperstone_opd0(UINT16 opcode)
1505{
1506   LOCAL_DECODE_INIT;
1507   LRdecode(decode, 0);
1508   hyperstone_ldwr(decode);
1509}
1510
1511static void hyperstone_opd1(UINT16 opcode)
1512{
1513   LOCAL_DECODE_INIT;
1514   LRdecode(decode, 1);
1515   hyperstone_ldwr(decode);
1516}
1517
1518static void hyperstone_opd2(UINT16 opcode)
1519{
1520   LOCAL_DECODE_INIT;
1521   LRdecode(decode, 0);
1522   hyperstone_lddr(decode);
1523}
1524
1525static void hyperstone_opd3(UINT16 opcode)
1526{
1527   LOCAL_DECODE_INIT;
1528   LRdecode(decode, 1);
1529   hyperstone_lddr(decode);
1530}
1531
1532static void hyperstone_opd4(UINT16 opcode)
1533{
1534   LOCAL_DECODE_INIT;
1535   LRdecode(decode, 0);
1536   hyperstone_ldwp(decode);
1537}
1538
1539static void hyperstone_opd5(UINT16 opcode)
1540{
1541   LOCAL_DECODE_INIT;
1542   LRdecode(decode, 1);
1543   hyperstone_ldwp(decode);
1544}
1545
1546static void hyperstone_opd6(UINT16 opcode)
1547{
1548   LOCAL_DECODE_INIT;
1549   LRdecode(decode, 0);
1550   hyperstone_lddp(decode);
1551}
1552
1553static void hyperstone_opd7(UINT16 opcode)
1554{
1555   LOCAL_DECODE_INIT;
1556   LRdecode(decode, 1);
1557   hyperstone_lddp(decode);
1558}
1559
1560static void hyperstone_opd8(UINT16 opcode)
1561{
1562   LOCAL_DECODE_INIT;
1563   LRdecode(decode, 0);
1564   hyperstone_stwr(decode);
1565}
1566
1567static void hyperstone_opd9(UINT16 opcode)
1568{
1569   LOCAL_DECODE_INIT;
1570   LRdecode(decode, 1);
1571   hyperstone_stwr(decode);
1572}
1573
1574static void hyperstone_opda(UINT16 opcode)
1575{
1576   LOCAL_DECODE_INIT;
1577   LRdecode(decode, 0);
1578   hyperstone_stdr(decode);
1579}
1580
1581static void hyperstone_opdb(UINT16 opcode)
1582{
1583   LOCAL_DECODE_INIT;
1584   LRdecode(decode, 1);
1585   hyperstone_stdr(decode);
1586}
1587
1588static void hyperstone_opdc(UINT16 opcode)
1589{
1590   LOCAL_DECODE_INIT;
1591   LRdecode(decode, 0);
1592   hyperstone_stwp(decode);
1593}
1594
1595static void hyperstone_opdd(UINT16 opcode)
1596{
1597   LOCAL_DECODE_INIT;
1598   LRdecode(decode, 1);
1599   hyperstone_stwp(decode);
1600}
1601
1602static void hyperstone_opde(UINT16 opcode)
1603{
1604   LOCAL_DECODE_INIT;
1605   LRdecode(decode, 0);
1606   hyperstone_stdp(decode);
1607}
1608
1609static void hyperstone_opdf(UINT16 opcode)
1610{
1611   LOCAL_DECODE_INIT;
1612   LRdecode(decode, 1);
1613   hyperstone_stdp(decode);
1614}
1615
1616
1617
1618static void hyperstone_ope0(UINT16 opcode)
1619{
1620   LOCAL_DECODE_INIT;
1621   PCreldecode(decode);
1622   hyperstone_dbv(decode);
1623}
1624
1625static void hyperstone_ope1(UINT16 opcode)
1626{
1627   LOCAL_DECODE_INIT;
1628   PCreldecode(decode);
1629   hyperstone_dbnv(decode);
1630}
1631
1632static void hyperstone_ope2(UINT16 opcode)
1633{
1634   LOCAL_DECODE_INIT;
1635   PCreldecode(decode);
1636   hyperstone_dbe(decode);
1637}
1638
1639static void hyperstone_ope3(UINT16 opcode)
1640{
1641   LOCAL_DECODE_INIT;
1642   PCreldecode(decode);
1643   hyperstone_dbne(decode);
1644}
1645
1646static void hyperstone_ope4(UINT16 opcode)
1647{
1648   LOCAL_DECODE_INIT;
1649   PCreldecode(decode);
1650   hyperstone_dbc(decode);
1651}
1652
1653static void hyperstone_ope5(UINT16 opcode)
1654{
1655   LOCAL_DECODE_INIT;
1656   PCreldecode(decode);
1657   hyperstone_dbnc(decode);
1658}
1659
1660static void hyperstone_ope6(UINT16 opcode)
1661{
1662   LOCAL_DECODE_INIT;
1663   PCreldecode(decode);
1664   hyperstone_dbse(decode);
1665}
1666
1667static void hyperstone_ope7(UINT16 opcode)
1668{
1669   LOCAL_DECODE_INIT;
1670   PCreldecode(decode);
1671   hyperstone_dbht(decode);
1672}
1673
1674static void hyperstone_ope8(UINT16 opcode)
1675{
1676   LOCAL_DECODE_INIT;
1677   PCreldecode(decode);
1678   hyperstone_dbn(decode);
1679}
1680
1681static void hyperstone_ope9(UINT16 opcode)
1682{
1683   LOCAL_DECODE_INIT;
1684   PCreldecode(decode);
1685   hyperstone_dbnn(decode);
1686}
1687
1688static void hyperstone_opea(UINT16 opcode)
1689{
1690   LOCAL_DECODE_INIT;
1691   PCreldecode(decode);
1692   hyperstone_dble(decode);
1693}
1694
1695static void hyperstone_opeb(UINT16 opcode)
1696{
1697   LOCAL_DECODE_INIT;
1698   PCreldecode(decode);
1699   hyperstone_dbgt(decode);
1700}
1701
1702static void hyperstone_opec(UINT16 opcode)
1703{
1704   LOCAL_DECODE_INIT;
1705   PCreldecode(decode);
1706   hyperstone_dbr(decode);
1707}
1708
1709static void hyperstone_oped(UINT16 opcode)
1710{
1711   LOCAL_DECODE_INIT;
1712   LLdecode(decode);
1713   hyperstone_frame(decode);
1714}
1715
1716static void hyperstone_opee(UINT16 opcode)
1717{
1718   LOCAL_DECODE_INIT;
1719   LRconstdecode(decode, 0);
1720   hyperstone_call(decode);
1721}
1722
1723static void hyperstone_opef(UINT16 opcode)
1724{
1725   LOCAL_DECODE_INIT;
1726   LRconstdecode(decode, 1);
1727   hyperstone_call(decode);
1728}
1729
1730
1731
1732static void hyperstone_opf0(UINT16 opcode)
1733{
1734   LOCAL_DECODE_INIT;
1735   PCreldecode(decode);
1736   hyperstone_bv(decode);
1737}
1738
1739static void hyperstone_opf1(UINT16 opcode)
1740{
1741   LOCAL_DECODE_INIT;
1742   PCreldecode(decode);
1743   hyperstone_bnv(decode);
1744}
1745
1746static void hyperstone_opf2(UINT16 opcode)
1747{
1748   LOCAL_DECODE_INIT;
1749   PCreldecode(decode);
1750   hyperstone_be(decode);
1751}
1752
1753static void hyperstone_opf3(UINT16 opcode)
1754{
1755   LOCAL_DECODE_INIT;
1756   PCreldecode(decode);
1757   hyperstone_bne(decode);
1758}
1759
1760static void hyperstone_opf4(UINT16 opcode)
1761{
1762   LOCAL_DECODE_INIT;
1763   PCreldecode(decode);
1764   hyperstone_bc(decode);
1765}
1766
1767static void hyperstone_opf5(UINT16 opcode)
1768{
1769   LOCAL_DECODE_INIT;
1770   PCreldecode(decode);
1771   hyperstone_bnc(decode);
1772}
1773
1774static void hyperstone_opf6(UINT16 opcode)
1775{
1776   LOCAL_DECODE_INIT;
1777   PCreldecode(decode);
1778   hyperstone_bse(decode);
1779}
1780
1781static void hyperstone_opf7(UINT16 opcode)
1782{
1783   LOCAL_DECODE_INIT;
1784   PCreldecode(decode);
1785   hyperstone_bht(decode);
1786}
1787
1788static void hyperstone_opf8(UINT16 opcode)
1789{
1790   LOCAL_DECODE_INIT;
1791   PCreldecode(decode);
1792   hyperstone_bn(decode);
1793}
1794
1795static void hyperstone_opf9(UINT16 opcode)
1796{
1797   LOCAL_DECODE_INIT;
1798   PCreldecode(decode);
1799   hyperstone_bnn(decode);
1800}
1801
1802static void hyperstone_opfa(UINT16 opcode)
1803{
1804   LOCAL_DECODE_INIT;
1805   PCreldecode(decode);
1806   hyperstone_ble(decode);
1807}
1808
1809static void hyperstone_opfb(UINT16 opcode)
1810{
1811   LOCAL_DECODE_INIT;
1812   PCreldecode(decode);
1813   hyperstone_bgt(decode);
1814}
1815
1816static void hyperstone_opfc(UINT16 opcode)
1817{
1818   LOCAL_DECODE_INIT;
1819   PCreldecode(decode);
1820   hyperstone_br(decode);
1821}
1822
1823static void hyperstone_opfd(UINT16 opcode)
1824{
1825   LOCAL_DECODE_INIT;
1826   PCadrdecode(decode);
1827   hyperstone_trap(decode);
1828}
1829
1830static void hyperstone_opfe(UINT16 opcode)
1831{
1832   LOCAL_DECODE_INIT;
1833   PCadrdecode(decode);
1834   hyperstone_trap(decode);
1835}
1836
1837static void hyperstone_opff(UINT16 opcode)
1838{
1839   LOCAL_DECODE_INIT;
1840   PCadrdecode(decode);
1841   hyperstone_trap(decode);
1842}
1843
1844
1845static void (*hyperstone_op[0x100])(UINT16 opcode) =
1846{
1847   hyperstone_op00, hyperstone_op01, hyperstone_op02, hyperstone_op03,
1848   hyperstone_op04, hyperstone_op05, hyperstone_op06, hyperstone_op07,
1849   hyperstone_op08, hyperstone_op09, hyperstone_op0a, hyperstone_op0b,
1850   hyperstone_op0c, hyperstone_op0d, hyperstone_op0e, hyperstone_op0f,
1851
1852   hyperstone_op10, hyperstone_op11, hyperstone_op12, hyperstone_op13,
1853   hyperstone_op14, hyperstone_op15, hyperstone_op16, hyperstone_op17,
1854   hyperstone_op18, hyperstone_op19, hyperstone_op1a, hyperstone_op1b,
1855   hyperstone_op1c, hyperstone_op1d, hyperstone_op1e, hyperstone_op1f,
1856
1857   hyperstone_op20, hyperstone_op21, hyperstone_op22, hyperstone_op23,
1858   hyperstone_op24, hyperstone_op25, hyperstone_op26, hyperstone_op27,
1859   hyperstone_op28, hyperstone_op29, hyperstone_op2a, hyperstone_op2b,
1860   hyperstone_op2c, hyperstone_op2d, hyperstone_op2e, hyperstone_op2f,
1861
1862   hyperstone_op30, hyperstone_op31, hyperstone_op32, hyperstone_op33,
1863   hyperstone_op34, hyperstone_op35, hyperstone_op36, hyperstone_op37,
1864   hyperstone_op38, hyperstone_op39, hyperstone_op3a, hyperstone_op3b,
1865   hyperstone_op3c, hyperstone_op3d, hyperstone_op3e, hyperstone_op3f,
1866
1867   hyperstone_op40, hyperstone_op41, hyperstone_op42, hyperstone_op43,
1868   hyperstone_op44, hyperstone_op45, hyperstone_op46, hyperstone_op47,
1869   hyperstone_op48, hyperstone_op49, hyperstone_op4a, hyperstone_op4b,
1870   hyperstone_op4c, hyperstone_op4d, hyperstone_op4e, hyperstone_op4f,
1871
1872   hyperstone_op50, hyperstone_op51, hyperstone_op52, hyperstone_op53,
1873   hyperstone_op54, hyperstone_op55, hyperstone_op56, hyperstone_op57,
1874   hyperstone_op58, hyperstone_op59, hyperstone_op5a, hyperstone_op5b,
1875   hyperstone_op5c, hyperstone_op5d, hyperstone_op5e, hyperstone_op5f,
1876
1877   hyperstone_op60, hyperstone_op61, hyperstone_op62, hyperstone_op63,
1878   hyperstone_op64, hyperstone_op65, hyperstone_op66, hyperstone_op67,
1879   hyperstone_op68, hyperstone_op69, hyperstone_op6a, hyperstone_op6b,
1880   hyperstone_op6c, hyperstone_op6d, hyperstone_op6e, hyperstone_op6f,
1881
1882   hyperstone_op70, hyperstone_op71, hyperstone_op72, hyperstone_op73,
1883   hyperstone_op74, hyperstone_op75, hyperstone_op76, hyperstone_op77,
1884   hyperstone_op78, hyperstone_op79, hyperstone_op7a, hyperstone_op7b,
1885   hyperstone_op7c, hyperstone_op7d, hyperstone_op7e, hyperstone_op7f,
1886
1887   hyperstone_op80, hyperstone_op81, hyperstone_op82, hyperstone_op83,
1888   hyperstone_op84, hyperstone_op85, hyperstone_op86, hyperstone_op87,
1889   hyperstone_op88, hyperstone_op89, hyperstone_op8a, hyperstone_op8b,
1890   hyperstone_op8c, hyperstone_op8d, hyperstone_op8e, hyperstone_op8f,
1891
1892   hyperstone_op90, hyperstone_op91, hyperstone_op92, hyperstone_op93,
1893   hyperstone_op94, hyperstone_op95, hyperstone_op96, hyperstone_op97,
1894   hyperstone_op98, hyperstone_op99, hyperstone_op9a, hyperstone_op9b,
1895   hyperstone_op9c, hyperstone_op9d, hyperstone_op9e, hyperstone_op9f,
1896
1897   hyperstone_opa0, hyperstone_opa1, hyperstone_opa2, hyperstone_opa3,
1898   hyperstone_opa4, hyperstone_opa5, hyperstone_opa6, hyperstone_opa7,
1899   hyperstone_opa8, hyperstone_opa9, hyperstone_opaa, hyperstone_opab,
1900   hyperstone_opac, hyperstone_opad, hyperstone_opae, hyperstone_opaf,
1901
1902   hyperstone_opb0, hyperstone_opb1, hyperstone_opb2, hyperstone_opb3,
1903   hyperstone_opb4, hyperstone_opb5, hyperstone_opb6, hyperstone_opb7,
1904   hyperstone_opb8, hyperstone_opb9, hyperstone_opba, hyperstone_opbb,
1905   hyperstone_opbc, hyperstone_opbd, hyperstone_opbe, hyperstone_opbf,
1906
1907   hyperstone_opc0, hyperstone_opc1, hyperstone_opc2, hyperstone_opc3,
1908   hyperstone_opc4, hyperstone_opc5, hyperstone_opc6, hyperstone_opc7,
1909   hyperstone_opc8, hyperstone_opc9, hyperstone_opca, hyperstone_opcb,
1910   hyperstone_opcc, hyperstone_opcd, hyperstone_opce, hyperstone_opcf,
1911
1912   hyperstone_opd0, hyperstone_opd1, hyperstone_opd2, hyperstone_opd3,
1913   hyperstone_opd4, hyperstone_opd5, hyperstone_opd6, hyperstone_opd7,
1914   hyperstone_opd8, hyperstone_opd9, hyperstone_opda, hyperstone_opdb,
1915   hyperstone_opdc, hyperstone_opdd, hyperstone_opde, hyperstone_opdf,
1916
1917   hyperstone_ope0, hyperstone_ope1, hyperstone_ope2, hyperstone_ope3,
1918   hyperstone_ope4, hyperstone_ope5, hyperstone_ope6, hyperstone_ope7,
1919   hyperstone_ope8, hyperstone_ope9, hyperstone_opea, hyperstone_opeb,
1920   hyperstone_opec, hyperstone_oped, hyperstone_opee, hyperstone_opef,
1921
1922   hyperstone_opf0, hyperstone_opf1, hyperstone_opf2, hyperstone_opf3,
1923   hyperstone_opf4, hyperstone_opf5, hyperstone_opf6, hyperstone_opf7,
1924   hyperstone_opf8, hyperstone_opf9, hyperstone_opfa, hyperstone_opfb,
1925   hyperstone_opfc, hyperstone_opfd, hyperstone_opfe, hyperstone_opff
1926};
src/emu/cpu/e132xs/e132xs.c
r1334r1335
212212*********************************************************************/
213213
214214#include "debugger.h"
215#include "eminline.h"
215216#include "e132xs.h"
216217#include "osd_cpu.h"
217218
219#ifdef MAME_DEBUG
220#define DEBUG_PRINTF(x) do { mame_printf_debug x; } while (0)
221#else
222#define DEBUG_PRINTF(x) do { } while (0)
223#endif
224
218225static UINT8  (*hyp_cpu_read_byte)(offs_t address);
219226static UINT16 (*hyp_cpu_read_half_word)(offs_t address);
220227static UINT32 (*hyp_cpu_read_word)(offs_t address);
r1334r1335
231238
232239static int hyperstone_ICount;
233240
234static void hyperstone_chk(void);
235static void hyperstone_movd(void);
236static void hyperstone_divu(void);
237static void hyperstone_divs(void);
238static void hyperstone_xm(void);
239static void hyperstone_mask(void);
240static void hyperstone_sum(void);
241static void hyperstone_sums(void);
242static void hyperstone_cmp(void);
243static void hyperstone_mov(void);
244static void hyperstone_add(void);
245static void hyperstone_adds(void);
246static void hyperstone_cmpb(void);
247static void hyperstone_andn(void);
248static void hyperstone_or(void);
249static void hyperstone_xor(void);
250static void hyperstone_subc(void);
251static void hyperstone_not(void);
252static void hyperstone_sub(void);
253static void hyperstone_subs(void);
254static void hyperstone_addc(void);
255static void hyperstone_and(void);
256static void hyperstone_neg(void);
257static void hyperstone_negs(void);
258static void hyperstone_cmpi(void);
259static void hyperstone_movi(void);
260static void hyperstone_addi(void);
261static void hyperstone_addsi(void);
262static void hyperstone_cmpbi(void);
263static void hyperstone_andni(void);
264static void hyperstone_ori(void);
265static void hyperstone_xori(void);
266static void hyperstone_shrdi(void);
267static void hyperstone_shrd(void);
268static void hyperstone_shr(void);
269static void hyperstone_sardi(void);
270static void hyperstone_sard(void);
271static void hyperstone_sar(void);
272static void hyperstone_shldi(void);
273static void hyperstone_shld(void);
274static void hyperstone_shl(void);
275static void reserved(void);
276static void hyperstone_testlz(void);
277static void hyperstone_rol(void);
278static void hyperstone_ldxx1(void);
279static void hyperstone_ldxx2(void);
280static void hyperstone_stxx1(void);
281static void hyperstone_stxx2(void);
282static void hyperstone_shri(void);
283static void hyperstone_sari(void);
284static void hyperstone_shli(void);
285static void hyperstone_mulu(void);
286static void hyperstone_muls(void);
287static void hyperstone_set(void);
288static void hyperstone_mul(void);
289static void hyperstone_fadd(void);
290static void hyperstone_faddd(void);
291static void hyperstone_fsub(void);
292static void hyperstone_fsubd(void);
293static void hyperstone_fmul(void);
294static void hyperstone_fmuld(void);
295static void hyperstone_fdiv(void);
296static void hyperstone_fdivd(void);
297static void hyperstone_fcmp(void);
298static void hyperstone_fcmpd(void);
299static void hyperstone_fcmpu(void);
300static void hyperstone_fcmpud(void);
301static void hyperstone_fcvt(void);
302static void hyperstone_fcvtd(void);
303static void hyperstone_extend(void);
304static void hyperstone_do(void);
305static void hyperstone_ldwr(void);
306static void hyperstone_lddr(void);
307static void hyperstone_ldwp(void);
308static void hyperstone_lddp(void);
309static void hyperstone_stwr(void);
310static void hyperstone_stdr(void);
311static void hyperstone_stwp(void);
312static void hyperstone_stdp(void);
313static void hyperstone_dbv(void);
314static void hyperstone_dbnv(void);
315static void hyperstone_dbe(void);
316static void hyperstone_dbne(void);
317static void hyperstone_dbc(void);
318static void hyperstone_dbnc(void);
319static void hyperstone_dbse(void);
320static void hyperstone_dbht(void);
321static void hyperstone_dbn(void);
322static void hyperstone_dbnn(void);
323static void hyperstone_dble(void);
324static void hyperstone_dbgt(void);
325static void hyperstone_dbr(void);
326static void hyperstone_frame(void);
327static void hyperstone_call(void);
328static void hyperstone_bv(void);
329static void hyperstone_bnv(void);
330static void hyperstone_be(void);
331static void hyperstone_bne(void);
332static void hyperstone_bc(void);
333static void hyperstone_bnc(void);
334static void hyperstone_bse(void);
335static void hyperstone_bht(void);
336static void hyperstone_bn(void);
337static void hyperstone_bnn(void);
338static void hyperstone_ble(void);
339static void hyperstone_bgt(void);
340static void hyperstone_br(void);
341static void hyperstone_trap(void);
342
343241/* Registers */
344242
345243enum
r1334r1335
417315   UINT16   op;      // opcode
418316   UINT32   trap_entry; // entry point to get trap address
419317
420   UINT8   n;
421   INT32   delay_timer;
422   int      timer_clocks;
318   UINT8   clock_scale_mask;
319   UINT8   clock_scale;
320   UINT8   clock_cycles_1;
321   UINT8   clock_cycles_2;
322   UINT8   clock_cycles_4;
323   UINT8   clock_cycles_6;
423324
325   UINT64   tr_base_cycles;
326   UINT32   tr_base_value;
327   UINT32   tr_clocks_per_tick;
328   UINT8   timer_int_pending;
329   emu_timer *timer;
330
424331   struct _delay delay;
425332
426333   int   (*irq_callback)(int irqline);
427334
428   INT32 h_clear;
429335   INT32 instruction_length;
430336   INT32 intblock;
431337
r1334r1335
433339
434340static hyperstone_regs hyperstone;
435341
436static struct regs_decode
342struct regs_decode
437343{
438344   UINT8   src, dst;       // destination and source register code
439345   UINT32   src_value;      // current source register value
r1334r1335
443349   UINT8   sub_type;      // sub type opcode (for DD and X_CODE bits)
444350   union
445351   {
446         UINT32 u;
447         INT32  s;
352      UINT32 u;
353      INT32  s;
448354   } extra;            // extra value such as immediate value, const, pcrel, ...
449   void   (*set_src_register)(UINT8 reg, UINT32 data);  // set local / global source register
450   void   (*set_dst_register)(UINT8 reg, UINT32 data);  // set local / global destination register
451   UINT8   src_is_pc;
452   UINT8   dst_is_pc;
453   UINT8   src_is_sr;
454   UINT8   dst_is_sr;
355   UINT8   src_is_local;
356   UINT8   dst_is_local;
455357   UINT8   same_src_dst;
456358   UINT8   same_src_dstf;
457359   UINT8   same_srcf_dst;
458} current_regs;
360   UINT16   op;
361};
459362
460#define SREG  current_regs.src_value
461#define SREGF current_regs.next_src_value
462#define DREG  current_regs.dst_value
463#define DREGF current_regs.next_dst_value
464#define EXTRA_U current_regs.extra.u
465#define EXTRA_S current_regs.extra.s
363static void check_interrupts(void);
466364
467#define SET_SREG( _data_ )  (*current_regs.set_src_register)(current_regs.src, _data_)
468#define SET_SREGF( _data_ ) (*current_regs.set_src_register)(current_regs.src + 1, _data_)
469#define SET_DREG( _data_ )  (*current_regs.set_dst_register)(current_regs.dst, _data_)
470#define SET_DREGF( _data_ ) (*current_regs.set_dst_register)(current_regs.dst + 1, _data_)
365#define SREG  (decode)->src_value
366#define SREGF (decode)->next_src_value
367#define DREG  (decode)->dst_value
368#define DREGF (decode)->next_dst_value
369#define EXTRA_U (decode)->extra.u
370#define EXTRA_S (decode)->extra.s
371#define OP    (decode)->op
471372
472#define SRC_IS_PC      current_regs.src_is_pc
473#define DST_IS_PC      current_regs.dst_is_pc
474#define SRC_IS_SR      current_regs.src_is_sr
475#define DST_IS_SR      current_regs.dst_is_sr
476#define SAME_SRC_DST   current_regs.same_src_dst
477#define SAME_SRC_DSTF  current_regs.same_src_dstf
478#define SAME_SRCF_DST  current_regs.same_srcf_dst
373#define SET_SREG( _data_ )  ((decode)->src_is_local ? set_local_register((decode)->src, _data_) : set_global_register((decode)->src, _data_))
374#define SET_SREGF( _data_ ) ((decode)->src_is_local ? set_local_register((decode)->src + 1, _data_) : set_global_register((decode)->src + 1, _data_))
375#define SET_DREG( _data_ )  ((decode)->dst_is_local ? set_local_register((decode)->dst, _data_) : set_global_register((decode)->dst, _data_))
376#define SET_DREGF( _data_ ) ((decode)->dst_is_local ? set_local_register((decode)->dst + 1, _data_) : set_global_register((decode)->dst + 1, _data_))
479377
378#define SRC_IS_PC      (!(decode)->src_is_local && (decode)->src == PC_REGISTER)
379#define DST_IS_PC      (!(decode)->dst_is_local && (decode)->dst == PC_REGISTER)
380#define SRC_IS_SR      (!(decode)->src_is_local && (decode)->src == SR_REGISTER)
381#define DST_IS_SR      (!(decode)->dst_is_local && (decode)->dst == SR_REGISTER)
382#define SAME_SRC_DST   (decode)->same_src_dst
383#define SAME_SRC_DSTF  (decode)->same_src_dstf
384#define SAME_SRCF_DST  (decode)->same_srcf_dst
385
480386#if (HAS_E116T || HAS_E116XT || HAS_E116XS || HAS_E116XSR || HAS_GMS30C2116 || HAS_GMS30C2216)
481387static UINT32 program_read_dword_16be(offs_t address)
482388{
r1334r1335
502408#endif
503409
504410
505/* Opcodes table */
506static void (*hyperstone_op[0x100])(void) = {
507   hyperstone_chk,    hyperstone_chk,  hyperstone_chk,   hyperstone_chk,      /* CHK - CHKZ - NOP */
508   hyperstone_movd, hyperstone_movd, hyperstone_movd,  hyperstone_movd,   /* MOVD - RET */
509   hyperstone_divu, hyperstone_divu, hyperstone_divu,  hyperstone_divu,   /* DIVU */
510   hyperstone_divs, hyperstone_divs, hyperstone_divs,  hyperstone_divs,   /* DIVS */
511   hyperstone_xm,    hyperstone_xm,   hyperstone_xm,    hyperstone_xm,      /* XMx - XXx */
512   hyperstone_mask, hyperstone_mask, hyperstone_mask,  hyperstone_mask,   /* MASK */
513   hyperstone_sum,  hyperstone_sum,  hyperstone_sum,   hyperstone_sum,      /* SUM */
514   hyperstone_sums, hyperstone_sums, hyperstone_sums,  hyperstone_sums,   /* SUMS */
515   hyperstone_cmp,  hyperstone_cmp,  hyperstone_cmp,   hyperstone_cmp,      /* CMP */
516   hyperstone_mov,  hyperstone_mov,  hyperstone_mov,   hyperstone_mov,      /* MOV */
517   hyperstone_add,  hyperstone_add,  hyperstone_add,   hyperstone_add,      /* ADD */
518   hyperstone_adds, hyperstone_adds, hyperstone_adds,  hyperstone_adds,   /* ADDS */
519   hyperstone_cmpb, hyperstone_cmpb, hyperstone_cmpb,  hyperstone_cmpb,   /* CMPB */
520   hyperstone_andn, hyperstone_andn, hyperstone_andn,  hyperstone_andn,   /* ANDN */
521   hyperstone_or,   hyperstone_or,   hyperstone_or,    hyperstone_or,      /* OR */
522   hyperstone_xor,  hyperstone_xor,  hyperstone_xor,   hyperstone_xor,      /* XOR */
523   hyperstone_subc, hyperstone_subc, hyperstone_subc,  hyperstone_subc,   /* SUBC */
524   hyperstone_not,  hyperstone_not,  hyperstone_not,   hyperstone_not,      /* NOT */
525   hyperstone_sub,  hyperstone_sub,  hyperstone_sub,   hyperstone_sub,      /* SUB */
526   hyperstone_subs, hyperstone_subs, hyperstone_subs,  hyperstone_subs,   /* SUBS */
527   hyperstone_addc, hyperstone_addc, hyperstone_addc,  hyperstone_addc,   /* ADDC */
528   hyperstone_and,  hyperstone_and,  hyperstone_and,   hyperstone_and,      /* AND */
529   hyperstone_neg,  hyperstone_neg,  hyperstone_neg,   hyperstone_neg,      /* NEG */
530   hyperstone_negs, hyperstone_negs, hyperstone_negs,  hyperstone_negs,   /* NEGS */
531   hyperstone_cmpi, hyperstone_cmpi, hyperstone_cmpi,  hyperstone_cmpi,   /* CMPI */
532   hyperstone_movi, hyperstone_movi, hyperstone_movi,  hyperstone_movi,   /* MOVI */
533   hyperstone_addi, hyperstone_addi, hyperstone_addi,  hyperstone_addi,   /* ADDI */
534   hyperstone_addsi,hyperstone_addsi,hyperstone_addsi, hyperstone_addsi,   /* ADDSI */
535   hyperstone_cmpbi,hyperstone_cmpbi,hyperstone_cmpbi, hyperstone_cmpbi,   /* CMPBI */
536   hyperstone_andni,hyperstone_andni,hyperstone_andni, hyperstone_andni,   /* ANDNI */
537   hyperstone_ori,  hyperstone_ori,  hyperstone_ori,   hyperstone_ori,      /* ORI */
538   hyperstone_xori, hyperstone_xori, hyperstone_xori,  hyperstone_xori,   /* XORI */
539   hyperstone_shrdi,hyperstone_shrdi,hyperstone_shrd,  hyperstone_shr,      /* SHRDI, SHRD, SHR */
540   hyperstone_sardi,hyperstone_sardi,hyperstone_sard,  hyperstone_sar,      /* SARDI, SARD, SAR */
541   hyperstone_shldi,hyperstone_shldi,hyperstone_shld,  hyperstone_shl,      /* SHLDI, SHLD, SHL */
542   reserved,       reserved,        hyperstone_testlz,hyperstone_rol,      /* RESERVED, TESTLZ, ROL */
543   hyperstone_ldxx1,hyperstone_ldxx1,hyperstone_ldxx1, hyperstone_ldxx1,   /* LDxx.D/A/IOD/IOA */
544   hyperstone_ldxx2,hyperstone_ldxx2,hyperstone_ldxx2, hyperstone_ldxx2,   /* LDxx.N/S */
545   hyperstone_stxx1,hyperstone_stxx1,hyperstone_stxx1, hyperstone_stxx1,   /* STxx.D/A/IOD/IOA */
546   hyperstone_stxx2,hyperstone_stxx2,hyperstone_stxx2, hyperstone_stxx2,   /* STxx.N/S */
547   hyperstone_shri, hyperstone_shri, hyperstone_shri,  hyperstone_shri,   /* SHRI */
548   hyperstone_sari, hyperstone_sari, hyperstone_sari,  hyperstone_sari,   /* SARI */
549   hyperstone_shli, hyperstone_shli, hyperstone_shli,  hyperstone_shli,   /* SHLI */
550   reserved,       reserved,        reserved,         reserved,         /* RESERVED */
551   hyperstone_mulu, hyperstone_mulu, hyperstone_mulu,  hyperstone_mulu,   /* MULU */
552   hyperstone_muls, hyperstone_muls, hyperstone_muls,  hyperstone_muls,   /* MULS */
553   hyperstone_set,  hyperstone_set,  hyperstone_set,   hyperstone_set,      /* SETxx - SETADR - FETCH */
554   hyperstone_mul,  hyperstone_mul,  hyperstone_mul,   hyperstone_mul,      /* MUL */
555   hyperstone_fadd, hyperstone_faddd,hyperstone_fsub,  hyperstone_fsubd,   /* FADD, FADDD, FSUB, FSUBD */
556   hyperstone_fmul, hyperstone_fmuld,hyperstone_fdiv,  hyperstone_fdivd,   /* FMUL, FMULD, FDIV, FDIVD */
557   hyperstone_fcmp, hyperstone_fcmpd,hyperstone_fcmpu, hyperstone_fcmpud,   /* FCMP, FCMPD, FCMPU, FCMPUD */
558   hyperstone_fcvt, hyperstone_fcvtd,hyperstone_extend,hyperstone_do,      /* FCVT, FCVTD, EXTEND, DO */
559   hyperstone_ldwr, hyperstone_ldwr, hyperstone_lddr,  hyperstone_lddr,   /* LDW.R, LDD.R */
560   hyperstone_ldwp, hyperstone_ldwp, hyperstone_lddp,  hyperstone_lddp,   /* LDW.P, LDD.P */
561   hyperstone_stwr, hyperstone_stwr, hyperstone_stdr,  hyperstone_stdr,   /* STW.R, STD.R */
562   hyperstone_stwp, hyperstone_stwp, hyperstone_stdp,  hyperstone_stdp,   /* STW.P, STD.P */
563   hyperstone_dbv,  hyperstone_dbnv, hyperstone_dbe,   hyperstone_dbne,   /* DBV, DBNV, DBE, DBNE */
564   hyperstone_dbc,  hyperstone_dbnc, hyperstone_dbse,  hyperstone_dbht,   /* DBC, DBNC, DBSE, DBHT */
565   hyperstone_dbn,  hyperstone_dbnn, hyperstone_dble,  hyperstone_dbgt,   /* DBN, DBNN, DBLE, DBGT */
566   hyperstone_dbr,  hyperstone_frame,hyperstone_call,  hyperstone_call,   /* DBR, FRAME, CALL */
567   hyperstone_bv,   hyperstone_bnv,  hyperstone_be,    hyperstone_bne,      /* BV, BNV, BE, BNE */
568   hyperstone_bc,   hyperstone_bnc,  hyperstone_bse,   hyperstone_bht,      /* BC, BNC, BSE, BHT */
569   hyperstone_bn,   hyperstone_bnn,  hyperstone_ble,   hyperstone_bgt,      /* BN, BNN, BLE, BGT */
570    hyperstone_br,   hyperstone_trap, hyperstone_trap,  hyperstone_trap      /* BR, TRAPxx - TRAP */
571};
572
573411// 4Kb IRAM (On-Chip Memory)
574412#if (HAS_E116T || HAS_GMS30C2116)
575413
r1334r1335
680518         break;
681519
682520      default:
683         logerror("Set entry point to a reserved value: %d\n", which);
521         DEBUG_PRINTF(("Set entry point to a reserved value: %d\n", which));
684522         break;
685523   }
686524}
687525
688#define OP            hyperstone.op
689
690526#define PPC            hyperstone.ppc //previous pc
691527#define PC            hyperstone.global_regs[0] //Program Counter
692528#define SR            hyperstone.global_regs[1] //Status Register
r1334r1335
698534#define BCR            hyperstone.global_regs[20] //Bus Control Register
699535#define TPR            hyperstone.global_regs[21] //Timer Prescaler Register
700536#define TCR            hyperstone.global_regs[22] //Timer Compare Register
701#define TR            hyperstone.global_regs[23] //Timer Register
537#define TR            compute_tr() //Timer Register
702538#define WCR            hyperstone.global_regs[24] //Watchdog Compare Register
703539#define ISR            hyperstone.global_regs[25] //Input Status Register
704540#define FCR            hyperstone.global_regs[26] //Function Control Register
r1334r1335
761597//other bits are reversed, in particular 7 - 5 for the operating system.
762598//the user program can only changes the above 2 flags
763599
600
601
602
603static UINT32 compute_tr(void)
604{
605   UINT64 cycles_since_base = activecpu_gettotalcycles64() - hyperstone.tr_base_cycles;
606   UINT64 clocks_since_base = cycles_since_base >> hyperstone.clock_scale;
607   return hyperstone.tr_base_value + (clocks_since_base / hyperstone.tr_clocks_per_tick);
608}
609
610static void update_timer_prescale(void)
611{
612   UINT32 prevtr = compute_tr();
613   TPR &= ~0x80000000;
614   hyperstone.clock_scale = (TPR >> 26) & hyperstone.clock_scale_mask;
615   hyperstone.clock_cycles_1 = 1 << hyperstone.clock_scale;
616   hyperstone.clock_cycles_2 = 2 << hyperstone.clock_scale;
617   hyperstone.clock_cycles_4 = 4 << hyperstone.clock_scale;
618   hyperstone.clock_cycles_6 = 6 << hyperstone.clock_scale;
619   hyperstone.tr_clocks_per_tick = ((TPR >> 16) & 0xff) + 2;
620   hyperstone.tr_base_value = prevtr;
621   hyperstone.tr_base_cycles = activecpu_gettotalcycles64();
622}
623
624static void adjust_timer_interrupt(void)
625{
626   UINT64 cycles_since_base = activecpu_gettotalcycles64() - hyperstone.tr_base_cycles;
627   UINT64 clocks_since_base = cycles_since_base >> hyperstone.clock_scale;
628   UINT64 cycles_until_next_clock = cycles_since_base - (clocks_since_base << hyperstone.clock_scale);
629   int cpunum = cpu_getactivecpu();
630
631   if (cycles_until_next_clock == 0)
632      cycles_until_next_clock = (UINT64)(1 << hyperstone.clock_scale);
633
634   /* special case: if we have a change pending, set a timer to fire then */
635   if (TPR & 0x80000000)
636   {
637      UINT64 clocks_until_int = hyperstone.tr_clocks_per_tick - (clocks_since_base % hyperstone.tr_clocks_per_tick);
638      UINT64 cycles_until_int = (clocks_until_int << hyperstone.clock_scale) + cycles_until_next_clock;
639      timer_adjust(hyperstone.timer, ATTOTIME_IN_CYCLES(cycles_until_int + 1, cpunum), cpunum * 2 + 1, attotime_never);
640   }
641
642   /* else if the timer interrupt is enabled, configure it to fire at the appropriate time */
643   else if (!(FCR & 0x00800000))
644   {
645      UINT32 curtr = hyperstone.tr_base_value + (clocks_since_base / hyperstone.tr_clocks_per_tick);
646      UINT32 delta = TCR - curtr;
647      if (delta > 0x80000000)
648      {
649         if (!hyperstone.timer_int_pending)
650            timer_adjust(hyperstone.timer, attotime_zero, cpunum * 2 + 0, attotime_never);
651      }
652      else
653      {
654         UINT64 clocks_until_int = mulu_32x32(delta, hyperstone.tr_clocks_per_tick);
655         UINT64 cycles_until_int = (clocks_until_int << hyperstone.clock_scale) + cycles_until_next_clock;
656         timer_adjust(hyperstone.timer, ATTOTIME_IN_CYCLES(cycles_until_int, cpunum), cpunum * 2 + 0, attotime_never);
657      }
658   }
659
660   /* otherwise, disable the timer */
661   else
662      timer_adjust(hyperstone.timer, attotime_never, 0, attotime_never);
663}
664
665static TIMER_CALLBACK( timer_callback )
666{
667   int update = param & 1;
668   int cpunum = param >> 1;
669
670   cpuintrf_push_context(cpunum);
671
672   /* update the values if necessary */
673   if (update)
674      update_timer_prescale();
675
676   /* see if the timer is right for firing */
677   if (!((compute_tr() - TCR) & 0x80000000))
678      hyperstone.timer_int_pending = 1;
679
680   /* adjust ourselves for the next time */
681   else
682      adjust_timer_interrupt();
683
684   cpuintrf_pop_context();
685}
686
687
688
689
764690static UINT32 get_global_register(UINT8 code)
765691{
766692/*
r1334r1335
774700        case 29:
775701        case 30:
776702        case 31:
777            mame_printf_debug("read _Reserved_ Global Register %d @ %08X\n",code,PC);
703            DEBUG_PRINTF(("read _Reserved_ Global Register %d @ %08X\n",code,PC));
778704            break;
779705
780706        case BCR_REGISTER:
781            mame_printf_debug("read write-only BCR register @ %08X\n",PC);
707            DEBUG_PRINTF(("read write-only BCR register @ %08X\n",PC));
782708            return 0;
783709
784710        case TPR_REGISTER:
785            mame_printf_debug("read write-only TPR register @ %08X\n",PC);
711            DEBUG_PRINTF(("read write-only TPR register @ %08X\n",PC));
786712            return 0;
787713
788714        case FCR_REGISTER:
789            mame_printf_debug("read write-only FCR register @ %08X\n",PC);
715            DEBUG_PRINTF(("read write-only FCR register @ %08X\n",PC));
790716            return 0;
791717
792718        case MCR_REGISTER:
793            mame_printf_debug("read write-only MCR register @ %08X\n",PC);
719            DEBUG_PRINTF(("read write-only MCR register @ %08X\n",PC));
794720            return 0;
795721        }
796722    }
797723*/
724   if (code == TR_REGISTER)
725   {
726      /* it is common to poll this in a loop */
727      if (hyperstone_ICount > hyperstone.tr_clocks_per_tick / 2)
728         hyperstone_ICount -= hyperstone.tr_clocks_per_tick / 2;
729      return compute_tr();
730   }
798731   return hyperstone.global_regs[code];
799732}
800733
801static void set_global_register(UINT8 code, UINT32 val)
734INLINE void set_global_register(UINT8 code, UINT32 val)
802735{
803736   //TODO: add correct FER set instruction
804737
r1334r1335
810743   else if( code == SR_REGISTER )
811744   {
812745      SET_LOW_SR(val); // only a RET instruction can change the full content of SR
813
814746      SR &= ~0x40; //reserved bit 6 always zero
747      if (hyperstone.intblock < 1)
748         hyperstone.intblock = 1;
815749   }
816750   else
817751   {
752      UINT32 oldval = hyperstone.global_regs[code];
818753      if( code != ISR_REGISTER )
819754         hyperstone.global_regs[code] = val;
820755      else
821         logerror("Written to ISR register. PC = %08X\n", PC);
756         DEBUG_PRINTF(("Written to ISR register. PC = %08X\n", PC));
822757
823758      //are these set only when privilege bit is set?
824759      if( code >= 16 )
r1334r1335
834769            break;
835770/*
836771            case ISR_REGISTER:
837                mame_printf_debug("written %08X to read-only ISR register\n",val);
772                DEBUG_PRINTF(("written %08X to read-only ISR register\n",val));
838773                break;
839774
840            case 22:
841//              mame_printf_debug("written %08X to TCR register\n",val);
775            case TCR_REGISTER:
776//              DEBUG_PRINTF(("written %08X to TCR register\n",val));
842777                break;
843778
844779            case 23:
845//              mame_printf_debug("written %08X to TR register\n",val);
780//              DEBUG_PRINTF(("written %08X to TR register\n",val));
846781                break;
847782
848783            case 24:
849//              mame_printf_debug("written %08X to WCR register\n",val);
784//              DEBUG_PRINTF(("written %08X to WCR register\n",val));
850785                break;
851786
852787            case 16:
r1334r1335
855790            case 29:
856791            case 30:
857792            case 31:
858                mame_printf_debug("written %08X to _Reserved_ Global Register %d\n",val,code);
793                DEBUG_PRINTF(("written %08X to _Reserved_ Global Register %d\n",val,code));
859794                break;
860795
861796            case BCR_REGISTER:
862797                break;
863798*/
799         case TR_REGISTER:
800            hyperstone.tr_base_value = val;
801            hyperstone.tr_base_cycles = activecpu_gettotalcycles64();
802            adjust_timer_interrupt();
803            break;
804
864805         case TPR_REGISTER:
806            if (!(val & 0x80000000)) /* change immediately */
807               update_timer_prescale();
808            adjust_timer_interrupt();
809            break;
865810
866            hyperstone.n = (val & 0xff0000) >> 16;
867
868            if(!(val & 0x80000000)) /* change immediately */
869            {
870               hyperstone.delay_timer = 0;
871               hyperstone.timer_clocks = hyperstone.n + 2;
811            case TCR_REGISTER:
812               if (oldval != val)
813               {
814               adjust_timer_interrupt();
815               if (hyperstone.intblock < 1)
816                  hyperstone.intblock = 1;
872817            }
873            else
874            {
875               hyperstone.delay_timer = 1;
876            }
818                break;
877819
878            break;
879/*
880820            case FCR_REGISTER:
881                switch((val & 0x3000)>>12)
882                {
883                case 0:
884                    mame_printf_debug("IO3 interrupt mode\n");
885                    break;
886                case 1:
887                    mame_printf_debug("IO3 timing mode\n");
888                    break;
889                case 2:
890                    mame_printf_debug("watchdog mode\n");
891                    break;
892                case 3:
893                    // IO3 standard mode
894                    break;
895                }
821               if ((oldval ^ val) & 0x00800000)
822               adjust_timer_interrupt();
823            if (hyperstone.intblock < 1)
824               hyperstone.intblock = 1;
896825                break;
897*/
826
898827         case MCR_REGISTER:
899828            // bits 14..12 EntryTableMap
900829            hyperstone_set_trap_entry((val & 0x7000) >> 12);
901
902830            break;
903831         }
904832      }
905833   }
906834}
907835
908static void set_local_register(UINT8 code, UINT32 val)
836INLINE void set_local_register(UINT8 code, UINT32 val)
909837{
910838   UINT8 new_code = (code + GET_FP) % 64;
911839
r1334r1335
928856
929857#define LOCAL  1
930858
931static void decode_source(int local, int hflag)
859static const INT32 immediate_values[32] =
932860{
933   if(local)
934   {
935      UINT8 code = current_regs.src;
936      current_regs.set_src_register = set_local_register;
937      code = (current_regs.src + GET_FP) % 64; // registers offset by frame pointer
938      SREG = hyperstone.local_regs[code];
939      code = (current_regs.src + 1 + GET_FP) % 64;
940      SREGF = hyperstone.local_regs[code];
941   }
942   else
943   {
944      current_regs.set_src_register = set_global_register;
861   0, 1, 2, 3, 4, 5, 6, 7,
862   8, 9, 10, 11, 12, 13, 14, 15,
863   16, 0, 0, 0, 32, 64, 128, 0x80000000,
864   -8, -7, -6, -5, -4, -3, -2, -1
865};
945866
946      if(hflag)
947         current_regs.src += hflag * 16;
867#define WRITE_ONLY_REGMASK   ((1 << BCR_REGISTER) | (1 << TPR_REGISTER) | (1 << FCR_REGISTER) | (1 << MCR_REGISTER))
948868
949      SREG = hyperstone.global_regs[current_regs.src];
869#define decode_source(decode, local, hflag)                                 \
870do                                                               \
871{                                                               \
872   if(local)                                                      \
873   {                                                            \
874      UINT8 code = (decode)->src;                                       \
875      (decode)->src_is_local = 1;                                       \
876      code = ((decode)->src + GET_FP) % 64; /* registers offset by frame pointer  */\
877      SREG = hyperstone.local_regs[code];                                 \
878      code = ((decode)->src + 1 + GET_FP) % 64;                           \
879      SREGF = hyperstone.local_regs[code];                              \
880   }                                                            \
881   else                                                         \
882   {                                                            \
883      (decode)->src_is_local = 0;                                       \
884                                                               \
885      if (!hflag)                                                   \
886      {                                                         \
887         SREG = get_global_register((decode)->src);                        \
888                                                               \
889         /* bound safe */                                          \
890         if ((decode)->src != 15)                                    \
891            SREGF = get_global_register((decode)->src + 1);                  \
892      }                                                         \
893      else                                                      \
894      {                                                         \
895         (decode)->src += 16;                                       \
896                                                               \
897         SREG = get_global_register((decode)->src);                        \
898         if ((WRITE_ONLY_REGMASK >> (decode)->src) & 1)                     \
899            SREG = 0; /* write-only registers */                        \
900         else if ((decode)->src == ISR_REGISTER)                           \
901            DEBUG_PRINTF(("read src ISR. PC = %08X\n",PPC));               \
902                                                               \
903         /* bound safe */                                          \
904         if ((decode)->src != 31)                                    \
905            SREGF = get_global_register((decode)->src + 1);                  \
906      }                                                         \
907   }                                                            \
908} while (0)
950909
951      /* bound safe */
952      if(current_regs.src != 15 && current_regs.src != 31)
953         SREGF = hyperstone.global_regs[current_regs.src + 1];
910#define decode_dest(decode, local, hflag)                                 \
911do                                                               \
912{                                                               \
913   if(local)                                                      \
914   {                                                            \
915      UINT8 code = (decode)->dst;                                       \
916      (decode)->dst_is_local = 1;                                       \
917      code = ((decode)->dst + GET_FP) % 64; /* registers offset by frame pointer */\
918      DREG = hyperstone.local_regs[code];                                 \
919      code = ((decode)->dst + 1 + GET_FP) % 64;                           \
920      DREGF = hyperstone.local_regs[code];                              \
921   }                                                            \
922   else                                                         \
923   {                                                            \
924      (decode)->dst_is_local = 0;                                       \
925                                                               \
926      if (!hflag)                                                   \
927      {                                                         \
928         DREG = get_global_register((decode)->dst);                        \
929                                                               \
930         /* bound safe */                                          \
931         if ((decode)->dst != 15)                                    \
932            DREGF = get_global_register((decode)->dst + 1);                  \
933      }                                                         \
934      else                                                      \
935      {                                                         \
936         (decode)->dst += 16;                                       \
937                                                               \
938         DREG = get_global_register((decode)->dst);                        \
939         if( (decode)->dst == ISR_REGISTER )                              \
940            DEBUG_PRINTF(("read dst ISR. PC = %08X\n",PPC));               \
941                                                               \
942         /* bound safe */                                          \
943         if ((decode)->dst != 31)                                    \
944            DREGF = get_global_register((decode)->dst + 1);                  \
945      }                                                         \
946   }                                                            \
947} while (0)
954948
955      if(current_regs.src == PC_REGISTER)
956         SRC_IS_PC = 1;
957      else if(current_regs.src == SR_REGISTER)
958         SRC_IS_SR = 1;
959      else if( current_regs.src == BCR_REGISTER || current_regs.src == TPR_REGISTER ||
960             current_regs.src == FCR_REGISTER || current_regs.src == MCR_REGISTER )
961      {
962         SREG = 0; // write-only registers
963      }
964      else if( current_regs.src == ISR_REGISTER )
965         mame_printf_debug("read src ISR. PC = %08X\n",PPC);
966   }
967}
949#define decode_RR(decode, dlocal, slocal)                                 \
950do                                                               \
951{                                                               \
952   (decode)->src = SRC_CODE;                                          \
953   (decode)->dst = DST_CODE;                                          \
954   decode_source(decode, slocal, 0);                                    \
955   decode_dest(decode, dlocal, 0);                                       \
956                                                               \
957   if( (slocal) == (dlocal) && SRC_CODE == DST_CODE )                        \
958      SAME_SRC_DST = 1;                                             \
959                                                               \
960   if( (slocal) == LOCAL && (dlocal) == LOCAL )                           \
961   {                                                            \
962      if( SRC_CODE == ((DST_CODE + 1) % 64) )                              \
963         SAME_SRC_DSTF = 1;                                          \
964                                                               \
965      if( ((SRC_CODE + 1) % 64) == DST_CODE )                              \
966         SAME_SRCF_DST = 1;                                          \
967   }                                                            \
968   else if( (slocal) == 0 && (dlocal) == 0 )                              \
969   {                                                            \
970      if( SRC_CODE == (DST_CODE + 1) )                                 \
971         SAME_SRC_DSTF = 1;                                          \
972                                                               \
973      if( (SRC_CODE + 1) == DST_CODE )                                 \
974         SAME_SRCF_DST = 1;                                          \
975   }                                                            \
976} while (0)
968977
969static void decode_dest(int local, int hflag)
970{
971   if(local)
972   {
973      UINT8 code = current_regs.dst;
974      current_regs.set_dst_register = set_local_register;
975      code = (current_regs.dst + GET_FP) % 64; // registers offset by frame pointer
976      DREG = hyperstone.local_regs[code];
977      code = (current_regs.dst + 1 + GET_FP) % 64;
978      DREGF = hyperstone.local_regs[code];
979   }
980   else
981   {
982      current_regs.set_dst_register = set_global_register;
978#define decode_LL(decode)                                             \
979do                                                               \
980{                                                               \
981   (decode)->src = SRC_CODE;                                          \
982   (decode)->dst = DST_CODE;                                          \
983   decode_source(decode, LOCAL, 0);                                    \
984   decode_dest(decode, LOCAL, 0);                                       \
985                                                               \
986   if( SRC_CODE == DST_CODE )                                          \
987      SAME_SRC_DST = 1;                                             \
988                                                               \
989   if( SRC_CODE == ((DST_CODE + 1) % 64) )                                 \
990      SAME_SRC_DSTF = 1;                                             \
991} while (0)
983992
984      if(hflag)
985         current_regs.dst += hflag * 16;
993#define decode_LR(decode, slocal)                                       \
994do                                                               \
995{                                                               \
996   (decode)->src = SRC_CODE;                                          \
997   (decode)->dst = DST_CODE;                                          \
998   decode_source(decode, slocal, 0);                                    \
999   decode_dest(decode, LOCAL, 0);                                       \
1000                                                               \
1001   if( ((SRC_CODE + 1) % 64) == DST_CODE && slocal == LOCAL )                  \
1002      SAME_SRCF_DST = 1;                                             \
1003} while (0)
9861004
987      DREG = hyperstone.global_regs[current_regs.dst];
1005#define check_delay_PC()                                             \
1006do                                                               \
1007{                                                               \
1008   /* if PC is used in a delay instruction, the delayed PC should be used */      \
1009   if( hyperstone.delay.delay_cmd == DELAY_EXECUTE )                        \
1010   {                                                            \
1011      PC = hyperstone.delay.delay_pc;                                    \
1012      hyperstone.delay.delay_cmd = NO_DELAY;                              \
1013   }                                                            \
1014} while (0)
9881015
989      /* bound safe */
990      if(current_regs.dst != 15 && current_regs.dst != 31)
991         DREGF = hyperstone.global_regs[current_regs.dst + 1];
1016#define decode_immediate(decode, nbit)                                    \
1017do                                                               \
1018{                                                               \
1019   if (!nbit)                                                      \
1020      EXTRA_U = immediate_values[OP & 0x0f];                              \
1021   else                                                         \
1022      switch( OP & 0x0f )                                             \
1023      {                                                         \
1024         default:                                                \
1025            EXTRA_U = immediate_values[0x10 + (OP & 0x0f)];                  \
1026            break;                                                \
1027                                                               \
1028         case 1:                                                   \
1029            hyperstone.instruction_length = 3;                           \
1030            EXTRA_U = (READ_OP(PC) << 16) | READ_OP(PC + 2);               \
1031            PC += 4;                                             \
1032            break;                                                \
1033                                                               \
1034         case 2:                                                   \
1035            hyperstone.instruction_length = 2;                           \
1036            EXTRA_U = READ_OP(PC);                                    \
1037            PC += 2;                                             \
1038            break;                                                \
1039                                                               \
1040         case 3:                                                   \
1041            hyperstone.instruction_length = 2;                           \
1042            EXTRA_U = 0xffff0000 | READ_OP(PC);                           \
1043            PC += 2;                                             \
1044            break;                                                \
1045      }                                                         \
1046} while (0)
9921047
993      if(current_regs.dst == PC_REGISTER)
994         DST_IS_PC = 1;
995      else if(current_regs.dst == SR_REGISTER)
996         DST_IS_SR = 1;
997      else if( current_regs.src == ISR_REGISTER )
998         mame_printf_debug("read dst ISR. PC = %08X\n",PPC);
999   }
1000}
1048#define decode_const(decode)                                          \
1049do                                                               \
1050{                                                               \
1051   UINT16 imm_1 = READ_OP(PC);                                          \
1052                                                               \
1053   PC += 2;                                                      \
1054   hyperstone.instruction_length = 2;                                    \
1055                                                               \
1056   if( E_BIT(imm_1) )                                                \
1057   {                                                            \
1058      UINT16 imm_2 = READ_OP(PC);                                       \
1059                                                               \
1060      PC += 2;                                                   \
1061      hyperstone.instruction_length = 3;                                 \
1062                                                               \
1063      EXTRA_S = imm_2;                                             \
1064      EXTRA_S |= ((imm_1 & 0x3fff) << 16);                              \
1065                                                               \
1066      if( S_BIT_CONST(imm_1) )                                       \
1067      {                                                         \
1068         EXTRA_S |= 0xc0000000;                                       \
1069      }                                                         \
1070   }                                                            \
1071   else                                                         \
1072   {                                                            \
1073      EXTRA_S = imm_1 & 0x3fff;                                       \
1074                                                               \
1075      if( S_BIT_CONST(imm_1) )                                       \
1076      {                                                         \
1077         EXTRA_S |= 0xffffc000;                                       \
1078      }                                                         \
1079   }                                                            \
1080} while (0)
10011081
1002INLINE void decode_RR(void)
1003{
1004   current_regs.src = SRC_CODE;
1005   current_regs.dst = DST_CODE;
1006   decode_source(S_BIT, 0);
1007   decode_dest(D_BIT, 0);
1082#define decode_pcrel(decode)                                          \
1083do                                                               \
1084{                                                               \
1085   if( OP & 0x80 )                                                   \
1086   {                                                            \
1087      UINT16 next = READ_OP(PC);                                       \
1088                                                               \
1089      PC += 2;                                                   \
1090      hyperstone.instruction_length = 2;                                 \
1091                                                               \
1092      EXTRA_S = (OP & 0x7f) << 16;                                    \
1093      EXTRA_S |= (next & 0xfffe);                                       \
1094                                                               \
1095      if( next & 1 )                                                \
1096         EXTRA_S |= 0xff800000;                                       \
1097   }                                                            \
1098   else                                                         \
1099   {                                                            \
1100      EXTRA_S = OP & 0x7e;                                          \
1101                                                               \
1102      if( OP & 1 )                                                \
1103         EXTRA_S |= 0xffffff80;                                       \
1104   }                                                            \
1105} while (0)
10081106
1009   if( SRC_CODE == DST_CODE && S_BIT == D_BIT )
1010      SAME_SRC_DST = 1;
1107#define decode_dis(decode)                                             \
1108do                                                               \
1109{                                                               \
1110   UINT16 next_1 = READ_OP(PC);                                       \
1111                                                               \
1112   PC += 2;                                                      \
1113   hyperstone.instruction_length = 2;                                    \
1114                                                               \
1115   (decode)->sub_type = DD(next_1);                                    \
1116                                                               \
1117   if( E_BIT(next_1) )                                                \
1118   {                                                            \
1119      UINT16 next_2 = READ_OP(PC);                                    \
1120                                                               \
1121      PC += 2;                                                   \
1122      hyperstone.instruction_length = 3;                                 \
1123                                                               \
1124      EXTRA_S = next_2;                                             \
1125      EXTRA_S |= ((next_1 & 0xfff) << 16);                              \
1126                                                               \
1127      if( S_BIT_CONST(next_1) )                                       \
1128      {                                                         \
1129         EXTRA_S |= 0xf0000000;                                       \
1130      }                                                         \
1131   }                                                            \
1132   else                                                         \
1133   {                                                            \
1134      EXTRA_S = next_1 & 0xfff;                                       \
1135                                                               \
1136      if( S_BIT_CONST(next_1) )                                       \
1137      {                                                         \
1138         EXTRA_S |= 0xfffff000;                                       \
1139      }                                                         \
1140   }                                                            \
1141} while (0)
10111142
1012   if( S_BIT == LOCAL && D_BIT == LOCAL )
1013   {
1014      if( SRC_CODE == ((DST_CODE + 1) % 64) )
1015         SAME_SRC_DSTF = 1;
1143#define decode_lim(decode)                                             \
1144do                                                               \
1145{                                                               \
1146   UINT32 next = READ_OP(PC);                                          \
1147   PC += 2;                                                      \
1148   hyperstone.instruction_length = 2;                                    \
1149                                                               \
1150   (decode)->sub_type = X_CODE(next);                                    \
1151                                                               \
1152   if( E_BIT(next) )                                                \
1153   {                                                            \
1154      EXTRA_U = ((next & 0xfff) << 16) | READ_OP(PC);                        \
1155      PC += 2;                                                   \
1156      hyperstone.instruction_length = 3;                                 \
1157   }                                                            \
1158   else                                                         \
1159   {                                                            \
1160      EXTRA_U = next & 0xfff;                                          \
1161   }                                                            \
1162} while (0)
10161163
1017      if( ((SRC_CODE + 1) % 64) == DST_CODE )
1018         SAME_SRCF_DST = 1;
1019   }
1020   else if( S_BIT == 0 && D_BIT == 0 )
1021   {
1022      if( SRC_CODE == (DST_CODE + 1) )
1023         SAME_SRC_DSTF = 1;
1164#define RRdecode(decode, dlocal, slocal)                                 \
1165do                                                               \
1166{                                                               \
1167   check_delay_PC();                                                \
1168   decode_RR(decode, dlocal, slocal);                                    \
1169} while (0)
10241170
1025      if( (SRC_CODE + 1) == DST_CODE )
1026         SAME_SRCF_DST = 1;
1027   }
1028}
1171#define RRlimdecode(decode, dlocal, slocal)                                 \
1172do                                                               \
1173{                                                               \
1174   decode_lim(decode);                                                \
1175   check_delay_PC();                                                \
1176   decode_RR(decode, dlocal, slocal);                                    \
1177} while (0)
10291178
1030INLINE void decode_LL(void)
1031{
1032   current_regs.src = SRC_CODE;
1033   current_regs.dst = DST_CODE;
1034   decode_source(LOCAL, 0);
1035   decode_dest(LOCAL, 0);
1179#define RRconstdecode(decode, dlocal, slocal)                              \
1180do                                                               \
1181{                                                               \
1182   decode_const(decode);                                             \
1183   check_delay_PC();                                                \
1184   decode_RR(decode, dlocal, slocal);                                    \
1185} while (0)
10361186
1037   if( SRC_CODE == DST_CODE )
1038      SAME_SRC_DST = 1;
1187#define RRdisdecode(decode, dlocal, slocal)                                 \
1188do                                                               \
1189{                                                               \
1190   decode_dis(decode);                                                \
1191   check_delay_PC();                                                \
1192   decode_RR(decode, dlocal, slocal);                                    \
1193} while (0)
10391194
1040   if( SRC_CODE == ((DST_CODE + 1) % 64) )
1041      SAME_SRC_DSTF = 1;
1042}
1195#define RRdecodewithHflag(decode, dlocal, slocal)                           \
1196do                                                               \
1197{                                                               \
1198   check_delay_PC();                                                \
1199   (decode)->src = SRC_CODE;                                          \
1200   (decode)->dst = DST_CODE;                                          \
1201   decode_source(decode, slocal, GET_H);                                 \
1202   decode_dest(decode, dlocal, GET_H);                                    \
1203                                                               \
1204   if(GET_H)                                                      \
1205      if(slocal == 0 && dlocal == 0)                                    \
1206         DEBUG_PRINTF(("MOV with hflag and 2 GRegs! PC = %08X\n",PPC));         \
1207} while (0)
10431208
1044INLINE void decode_LR(void)
1045{
1046   current_regs.src = SRC_CODE;
1047   current_regs.dst = DST_CODE;
1048   decode_source(S_BIT, 0);
1049   decode_dest(LOCAL, 0);
1209#define Rimmdecode(decode, dlocal, nbit)                                 \
1210do                                                               \
1211{                                                               \
1212   decode_immediate(decode, nbit);                                       \
1213   check_delay_PC();                                                \
1214   (decode)->dst = DST_CODE;                                          \
1215   decode_dest(decode, dlocal, 0);                                       \
1216} while (0)
10501217
1051   if( ((SRC_CODE + 1) % 64) == DST_CODE && S_BIT == LOCAL )
1052      SAME_SRCF_DST = 1;
1053}
1218#define Rndecode(decode, dlocal)                                       \
1219do                                                               \
1220{                                                               \
1221   check_delay_PC();                                                \
1222   (decode)->dst = DST_CODE;                                          \
1223   decode_dest(decode, dlocal, 0);                                       \
1224} while (0)
10541225
1055INLINE void check_delay_PC(void)
1056{
1057   // if PC is used in a delay instruction, the delayed PC should be used
1058   if( hyperstone.delay.delay_cmd == DELAY_EXECUTE )
1059   {
1060      PC = hyperstone.delay.delay_pc;
1061      hyperstone.delay.delay_cmd = NO_DELAY;
1062   }
1063}
1226#define RimmdecodewithHflag(decode, dlocal, nbit)                           \
1227do                                                               \
1228{                                                               \
1229   decode_immediate(decode, nbit);                                       \
1230   check_delay_PC();                                                \
1231   (decode)->dst = DST_CODE;                                          \
1232   decode_dest(decode, dlocal, GET_H);                                    \
1233} while (0)
10641234
1065INLINE void decode_immediate(void)
1066{
1067   switch( N_VALUE )
1068   {
1069      case 0:   case 1:  case 2:  case 3:  case 4:  case 5:  case 6:  case 7: case 8:
1070      case 9:   case 10: case 11: case 12: case 13: case 14: case 15: case 16:
1071         EXTRA_U = N_VALUE;
1072         break;
1235#define Lndecode(decode)                                             \
1236do                                                               \
1237{                                                               \
1238   check_delay_PC();                                                \
1239   (decode)->dst = DST_CODE;                                          \
1240   decode_dest(decode, LOCAL, 0);                                       \
1241} while (0)
10731242
1074      case 17:
1075         hyperstone.instruction_length = 3;
1076         EXTRA_U = (READ_OP(PC) << 16) | READ_OP(PC + 2);
1077         PC += 4;
1078         break;
1243#define LLdecode(decode)                                             \
1244do                                                               \
1245{                                                               \
1246   check_delay_PC();                                                \
1247   decode_LL(decode);                                                \
1248} while (0)
10791249
1080      case 18:
1081         hyperstone.instruction_length = 2;
1082         EXTRA_U = READ_OP(PC);
1083         PC += 2;
1084         break;
1250#define LLextdecode(decode)                                             \
1251do                                                               \
1252{                                                               \
1253   hyperstone.instruction_length = 2;                                    \
1254   EXTRA_U = READ_OP(PC);                                             \
1255   PC += 2;                                                      \
1256   check_delay_PC();                                                \
1257   decode_LL(decode);                                                \
1258} while (0)
10851259
1086      case 19:
1087         hyperstone.instruction_length = 2;
1088         EXTRA_U = 0xffff0000 | READ_OP(PC);
1089         PC += 2;
1090         break;
1260#define LRdecode(decode, slocal)                                       \
1261do                                                               \
1262{                                                               \
1263   check_delay_PC();                                                \
1264   decode_LR(decode, slocal);                                          \
1265} while (0)
10911266
1092      case 20:
1093         EXTRA_U = 32;   // bit 5 = 1, others = 0
1094         break;
1267#define LRconstdecode(decode, slocal)                                    \
1268do                                                               \
1269{                                                               \
1270   decode_const(decode);                                             \
1271   check_delay_PC();                                                \
1272   decode_LR(decode, slocal);                                          \
1273} while (0)
10951274
1096      case 21:
1097         EXTRA_U = 64;   // bit 6 = 1, others = 0
1098         break;
1275#define PCreldecode(decode)                                             \
1276do                                                               \
1277{                                                               \
1278   decode_pcrel(decode);                                             \
1279   check_delay_PC();                                                \
1280} while (0)
10991281
1100      case 22:
1101         EXTRA_U = 128; // bit 7 = 1, others = 0
1102         break;
1282#define PCadrdecode(decode)                                             \
1283do                                                               \
1284{                                                               \
1285   check_delay_PC();                                                \
1286} while (0)
11031287
1104      case 23:
1105         EXTRA_U = 0x80000000; // bit 31 = 1, others = 0 (2 at the power of 31)
1106         break;
1288#define no_decode(decode)                                             \
1289do                                                               \
1290{                                                               \
1291} while (0)
11071292
1108      case 24:
1109         EXTRA_U = -8;
1110         break;
11111293
1112      case 25:
1113         EXTRA_U = -7;
1114         break;
1115
1116      case 26:
1117         EXTRA_U = -6;
1118         break;
1119
1120      case 27:
1121         EXTRA_U = -5;
1122         break;
1123
1124      case 28:
1125         EXTRA_U = -4;
1126         break;
1127
1128      case 29:
1129         EXTRA_U = -3;
1130         break;
1131
1132      case 30:
1133         EXTRA_U = -2;
1134         break;
1135
1136      case 31:
1137         EXTRA_U = -1;
1138         break;
1139   }
1140}
1141
1142INLINE void decode_const(void)
1294INLINE void execute_br(struct regs_decode *decode)
11431295{
1144   UINT16 imm_1 = READ_OP(PC);
1145
1146   PC += 2;
1147   hyperstone.instruction_length = 2;
1148
1149   if( E_BIT(imm_1) )
1150   {
1151      UINT16 imm_2 = READ_OP(PC);
1152
1153      PC += 2;
1154      hyperstone.instruction_length = 3;
1155
1156      EXTRA_S = imm_2;
1157      EXTRA_S |= ((imm_1 & 0x3fff) << 16);
1158
1159      if( S_BIT_CONST(imm_1) )
1160      {
1161         EXTRA_S |= 0xc0000000;
1162      }
1163   }
1164   else
1165   {
1166      EXTRA_S = imm_1 & 0x3fff;
1167
1168      if( S_BIT_CONST(imm_1) )
1169      {
1170         EXTRA_S |= 0xffffc000;
1171      }
1172   }
1173}
1174
1175INLINE void decode_pcrel(void)
1176{
1177   if( OP & 0x80 )
1178   {
1179      UINT16 next = READ_OP(PC);
1180
1181      PC += 2;
1182      hyperstone.instruction_length = 2;
1183
1184      EXTRA_S = (OP & 0x7f) << 16;
1185      EXTRA_S |= (next & 0xfffe);
1186
1187      if( next & 1 )
1188         EXTRA_S |= 0xff800000;
1189   }
1190   else
1191   {
1192      EXTRA_S = OP & 0x7e;
1193
1194      if( OP & 1 )
1195         EXTRA_S |= 0xffffff80;
1196   }
1197}
1198
1199INLINE void decode_dis(void)
1200{
1201   UINT16 next_1 = READ_OP(PC);
1202
1203   PC += 2;
1204   hyperstone.instruction_length = 2;
1205
1206   current_regs.sub_type = DD(next_1);
1207
1208   if( E_BIT(next_1) )
1209   {
1210      UINT16 next_2 = READ_OP(PC);
1211
1212      PC += 2;
1213      hyperstone.instruction_length = 3;
1214
1215      EXTRA_S = next_2;
1216      EXTRA_S |= ((next_1 & 0xfff) << 16);
1217
1218      if( S_BIT_CONST(next_1) )
1219      {
1220         EXTRA_S |= 0xf0000000;
1221      }
1222   }
1223   else
1224   {
1225      EXTRA_S = next_1 & 0xfff;
1226
1227      if( S_BIT_CONST(next_1) )
1228      {
1229         EXTRA_S |= 0xfffff000;
1230      }
1231   }
1232}
1233
1234INLINE void decode_lim(void)
1235{
1236   UINT32 next = READ_OP(PC);
1237   PC += 2;
1238   hyperstone.instruction_length = 2;
1239
1240   current_regs.sub_type = X_CODE(next);
1241
1242   if( E_BIT(next) )
1243   {
1244      EXTRA_U = ((next & 0xfff) << 16) | READ_OP(PC);
1245      PC += 2;
1246      hyperstone.instruction_length = 3;
1247   }
1248   else
1249   {
1250      EXTRA_U = next & 0xfff;
1251   }
1252}
1253
1254/* used in the jumptable */
1255INLINE void RRdecode(void)
1256{
1257   check_delay_PC();
1258   decode_RR();
1259}
1260
1261INLINE void RRlimdecode(void)
1262{
1263   decode_lim();
1264   check_delay_PC();
1265   decode_RR();
1266}
1267
1268INLINE void RRconstdecode(void)
1269{
1270   decode_const();
1271   check_delay_PC();
1272   decode_RR();
1273}
1274
1275INLINE void RRdisdecode(void)
1276{
1277   decode_dis();
1278   check_delay_PC();
1279   decode_RR();
1280}
1281
1282INLINE void RRdecodewithHflag(void)
1283{
1284   check_delay_PC();
1285   current_regs.src = SRC_CODE;
1286   current_regs.dst = DST_CODE;
1287   decode_source(S_BIT, GET_H);
1288   decode_dest(D_BIT, GET_H);
1289
1290   if(GET_H)
1291      if(S_BIT == 0 && D_BIT == 0)
1292         popmessage("MOV with hflag and 2 GRegs! PC = %08X\n",PPC);
1293}
1294
1295INLINE void Rimmdecode(void)
1296{
1297   decode_immediate();
1298   check_delay_PC();
1299   current_regs.dst = DST_CODE;
1300   decode_dest(D_BIT, 0);
1301}
1302
1303INLINE void Rndecode(void)
1304{
1305   check_delay_PC();
1306   current_regs.dst = DST_CODE;
1307   decode_dest(D_BIT, 0);
1308}
1309
1310INLINE void RimmdecodewithHflag(void)
1311{
1312   decode_immediate();
1313   check_delay_PC();
1314   current_regs.dst = DST_CODE;
1315   decode_dest(D_BIT, GET_H);
1316}
1317
1318INLINE void Lndecode(void)
1319{
1320   check_delay_PC();
1321   current_regs.dst = DST_CODE;
1322   decode_dest(LOCAL, 0);
1323}
1324
1325INLINE void LLdecode(void)
1326{
1327   check_delay_PC();
1328   decode_LL();
1329}
1330
1331INLINE void LLextdecode(void)
1332{
1333   hyperstone.instruction_length = 2;
1334   EXTRA_U = READ_OP(PC);
1335   PC += 2;
1336   check_delay_PC();
1337   decode_LL();
1338}
1339
1340INLINE void LRdecode(void)
1341{
1342   check_delay_PC();
1343   decode_LR();
1344}
1345
1346INLINE void LRconstdecode(void)
1347{
1348   decode_const();
1349   check_delay_PC();
1350   decode_LR();
1351}
1352
1353INLINE void PCreldecode(void)
1354{
1355   decode_pcrel();
1356   check_delay_PC();
1357}
1358
1359INLINE void PCadrdecode(void)
1360{
1361   check_delay_PC();
1362}
1363
1364INLINE void no_decode(void)
1365{
1366
1367}
1368
1369
1370/* Decode helper table */
1371static void (*hyperstone_decode[0x100])(void) = {
1372/*00*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* CHK - CHKZ - NOP */
1373/*04*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* MOVD - RET */
1374/*08*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* DIVU */
1375/*0c*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* DIVS */
1376/*10*/ RRlimdecode,         RRlimdecode,         RRlimdecode,         RRlimdecode,         /* XMx - XXx */
1377/*14*/ RRconstdecode,       RRconstdecode,       RRconstdecode,       RRconstdecode,       /* MASK */
1378/*18*/ RRconstdecode,       RRconstdecode,       RRconstdecode,       RRconstdecode,       /* SUM */
1379/*1c*/ RRconstdecode,       RRconstdecode,       RRconstdecode,       RRconstdecode,       /* SUMS */
1380/*20*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* CMP */
1381/*24*/ RRdecodewithHflag,   RRdecodewithHflag,   RRdecodewithHflag,   RRdecodewithHflag,   /* MOV */
1382/*28*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* ADD */
1383/*2c*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* ADDS */
1384/*30*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* CMPB */
1385/*34*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* ANDN */
1386/*38*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* OR */
1387/*3c*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* XOR */
1388/*40*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* SUBC */
1389/*44*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* NOT */
1390/*48*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* SUB */
1391/*4c*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* SUBS */
1392/*50*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* ADDC */
1393/*54*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* AND */
1394/*58*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* NEG */
1395/*5c*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* NEGS */
1396/*60*/ Rimmdecode,          Rimmdecode,          Rimmdecode,          Rimmdecode,          /* CMPI */
1397/*64*/ RimmdecodewithHflag, RimmdecodewithHflag, RimmdecodewithHflag, RimmdecodewithHflag, /* MOVI */
1398/*68*/ Rimmdecode,          Rimmdecode,          Rimmdecode,          Rimmdecode,          /* ADDI */
1399/*6c*/ Rimmdecode,          Rimmdecode,          Rimmdecode,          Rimmdecode,          /* ADDSI */
1400/*70*/ Rimmdecode,          Rimmdecode,          Rimmdecode,          Rimmdecode,          /* CMPBI */
1401/*74*/ Rimmdecode,          Rimmdecode,          Rimmdecode,          Rimmdecode,          /* ANDNI */
1402/*78*/ Rimmdecode,          Rimmdecode,          Rimmdecode,          Rimmdecode,          /* ORI */
1403/*7c*/ Rimmdecode,          Rimmdecode,          Rimmdecode,          Rimmdecode,          /* XORI */
1404/*80*/ Lndecode,            Lndecode,            LLdecode,            LLdecode,            /* SHRDI, SHRD, SHR */
1405/*84*/ Lndecode,            Lndecode,            LLdecode,            LLdecode,            /* SARDI, SARD, SAR */
1406/*88*/ Lndecode,            Lndecode,            LLdecode,            LLdecode,            /* SHLDI, SHLD, SHL */
1407/*8c*/ no_decode,           no_decode,           LLdecode,            LLdecode,            /* RESERVED, TESTLZ, ROL */
1408/*90*/ RRdisdecode,         RRdisdecode,         RRdisdecode,         RRdisdecode,         /* LDxx.D/A/IOD/IOA */
1409/*94*/ RRdisdecode,         RRdisdecode,         RRdisdecode,         RRdisdecode,         /* LDxx.N/S */
1410/*98*/ RRdisdecode,         RRdisdecode,         RRdisdecode,         RRdisdecode,         /* STxx.D/A/IOD/IOA */
1411/*9c*/ RRdisdecode,         RRdisdecode,         RRdisdecode,         RRdisdecode,         /* STxx.N/S */
1412/*a0*/ Rndecode,            Rndecode,            Rndecode,            Rndecode,            /* SHRI */
1413/*a4*/ Rndecode,            Rndecode,            Rndecode,            Rndecode,            /* SARI */
1414/*a8*/ Rndecode,            Rndecode,            Rndecode,            Rndecode,            /* SHLI */
1415/*ac*/ no_decode,           no_decode,           no_decode,           no_decode,           /* RESERVED */
1416/*b0*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* MULU */
1417/*b4*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* MULS */
1418/*b8*/ Rndecode,            Rndecode,            Rndecode,            Rndecode,            /* SETxx - SETADR - FETCH */
1419/*bc*/ RRdecode,            RRdecode,            RRdecode,            RRdecode,            /* MUL */
1420/*c0*/ LLdecode,            LLdecode,            LLdecode,            LLdecode,            /* FADD, FADDD, FSUB, FSUBD */
1421/*c4*/ LLdecode,            LLdecode,            LLdecode,            LLdecode,            /* FMUL, FMULD, FDIV, FDIVD */
1422/*c8*/ LLdecode,            LLdecode,            LLdecode,            LLdecode,            /* FCMP, FCMPD, FCMPU, FCMPUD */
1423/*cc*/ LLdecode,            LLdecode,            LLextdecode,         LLdecode,            /* FCVT, FCVTD, EXTEND, DO */
1424/*d0*/ LRdecode,            LRdecode,            LRdecode,            LRdecode,            /* LDW.R, LDD.R */
1425/*d4*/ LRdecode,            LRdecode,            LRdecode,            LRdecode,            /* LDW.P, LDD.P */
1426/*d8*/ LRdecode,            LRdecode,            LRdecode,            LRdecode,            /* STW.R, STD.R */
1427/*dc*/ LRdecode,            LRdecode,            LRdecode,            LRdecode,            /* STW.P, STD.P */
1428/*e0*/ PCreldecode,         PCreldecode,         PCreldecode,         PCreldecode,         /* DBV, DBNV, DBE, DBNE */
1429/*e4*/ PCreldecode,         PCreldecode,         PCreldecode,         PCreldecode,         /* DBC, DBNC, DBSE, DBHT */
1430/*e8*/ PCreldecode,         PCreldecode,         PCreldecode,         PCreldecode,         /* DBN, DBNN, DBLE, DBGT */
1431/*ec*/ PCreldecode,         LLdecode,            LRconstdecode,       LRconstdecode,       /* DBR, FRAME, CALL */
1432/*f0*/ PCreldecode,         PCreldecode,         PCreldecode,         PCreldecode,         /* BV, BNV, BE, BNE */
1433/*f4*/ PCreldecode,         PCreldecode,         PCreldecode,         PCreldecode,         /* BC, BNC, BSE, BHT */
1434/*f8*/ PCreldecode,         PCreldecode,         PCreldecode,         PCreldecode,         /* BN, BNN, BLE, BGT */
1435/*fc*/ PCreldecode,         PCadrdecode,         PCadrdecode,         PCadrdecode          /* BR, TRAPxx - TRAP */
1436};
1437
1438INLINE void execute_br(void)
1439{
14401296   PPC = PC;
14411297   PC += EXTRA_S;
14421298   change_pc(PC);
14431299   SET_M(0);
14441300
1445   hyperstone_ICount -= 2;
1301   hyperstone_ICount -= hyperstone.clock_cycles_2;
14461302}
14471303
1448INLINE void execute_dbr(void)
1304INLINE void execute_dbr(struct regs_decode *decode)
14491305{
1450   hyperstone.delay.delay_cmd = DELAY_TAKEN;
1306   hyperstone.delay.delay_cmd = DELAY_EXECUTE;
14511307   hyperstone.delay.delay_pc  = PC + EXTRA_S;
14521308
14531309   hyperstone.intblock = 3;
r1334r1335
14791335   PC = addr;
14801336   change_pc(PC);
14811337
1482   hyperstone_ICount -= 2;
1338   hyperstone_ICount -= hyperstone.clock_cycles_2;
14831339}
14841340
14851341
r1334r1335
15091365   PC = addr;
15101366   change_pc(PC);
15111367
1512   hyperstone_ICount -= 2;
1368   hyperstone_ICount -= hyperstone.clock_cycles_2;
15131369}
15141370
15151371/* TODO: mask Parity Error and Extended Overflow exceptions */
r1334r1335
15381394   PC = addr;
15391395   change_pc(PC);
15401396
1541   mame_printf_debug("EXCEPTION! PPC = %08X PC = %08X\n",PPC-2,PC-2);
1542   hyperstone_ICount -= 2;
1397   DEBUG_PRINTF(("EXCEPTION! PPC = %08X PC = %08X\n",PPC-2,PC-2));
1398   hyperstone_ICount -= hyperstone.clock_cycles_2;
15431399}
15441400
1545static void execute_software(void)
1401static void execute_software(struct regs_decode *decode)
15461402{
15471403   UINT8 reg;
15481404   UINT32 oldSR;
r1334r1335
15571413   //since it's sure the register is in the register part of the stack,
15581414   //set the stack address to a value above the highest address
15591415   //that can be set by a following frame instruction
1560   stack_of_dst = (SP & ~0xff) + 64*4 + (((GET_FP + current_regs.dst) % 64) * 4); //converted to 32bits offset
1416   stack_of_dst = (SP & ~0xff) + 64*4 + (((GET_FP + decode->dst) % 64) * 4); //converted to 32bits offset
15611417
15621418   oldSR = SR;
15631419
r1334r1335
15911447        6 - IO3     (trap 54)
15921448        7 - TIMER   (trap 55)
15931449*/
1594static void set_irq_line(int irqline, int state)
1450
1451#define INT1_LINE_STATE      ((ISR >> 0) & 1)
1452#define INT2_LINE_STATE      ((ISR >> 1) & 1)
1453#define INT3_LINE_STATE      ((ISR >> 2) & 1)
1454#define INT4_LINE_STATE      ((ISR >> 3) & 1)
1455#define IO1_LINE_STATE      ((ISR >> 4) & 1)
1456#define IO2_LINE_STATE      ((ISR >> 5) & 1)
1457#define IO3_LINE_STATE      ((ISR >> 6) & 1)
1458
1459static void check_interrupts(void)
15951460{
15961461   /* Interrupt-Lock flag isn't set */
1462   if (GET_L || hyperstone.intblock > 0)
1463      return;
15971464
1598   if(hyperstone.intblock)
1465   /* quick exit if nothing */
1466   if (!hyperstone.timer_int_pending && (ISR & 0x7f) == 0)
15991467      return;
16001468
1601   if( !GET_L && state )
1469   /* IO3 is priority 5; state is in bit 6 of ISR; FCR bit 10 enables input and FCR bit 8 inhibits interrupt */
1470   if (IO3_LINE_STATE && (FCR & 0x00000500) == 0x00000400)
16021471   {
1603      int execint=0;
1604      switch(irqline)
1605      {
1606         case 0:    if( (FCR&(1<<6)) && (!(FCR&(1<<4))) ) execint=1; // IO2
1607            break;
1608         case 1:    if( (FCR&(1<<2)) && (!(FCR&(1<<0))) ) execint=1; // IO1
1609            break;
1610         case 2:    if( !(FCR&(1<<31)) ) execint=1; //  int 4
1611            break;
1612         case 3:    if( !(FCR&(1<<30)) ) execint=1; //  int 3
1613            break;
1614         case 4:    if( !(FCR&(1<<29)) ) execint=1; //  int 2
1615            break;
1616         case 5:    if( !(FCR&(1<<28)) ) execint=1; //  int 1
1617            break;
1618         case 6:    if( (FCR&(1<<10)) && (!(FCR&(1<<8))) ) execint=1; // IO3
1619            break;
1620         case 7:    if( !(FCR&(1<<23)) ) execint=1; //  timer
1621            break;
1622      }
1623/*
1624        if( (FCR&(1<<6)) && (!(FCR&(1<<4))) ) mame_printf_debug("IO2 en\n"); // IO2
1472      execute_int(get_trap_addr(IO3));
1473      (*hyperstone.irq_callback)(IRQ_IO3);
1474      return;
1475   }
16251476
1626        if( (FCR&(1<<2)) && (!(FCR&(1<<0))) ) mame_printf_debug("IO1 en\n"); // IO1
1477   /* timer int might be priority 6 if FCR bits 20-21 == 3; FCR bit 23 inhibits interrupt */
1478   if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00300000)
1479   {
1480      hyperstone.timer_int_pending = 0;
1481      execute_int(get_trap_addr(TIMER));
1482      return;
1483   }
16271484
1628        if( !(FCR&(1<<31)) ) mame_printf_debug("int4 en\n"); //  int 4
1485   /* INT1 is priority 7; state is in bit 0 of ISR; FCR bit 28 inhibits interrupt */
1486   if (INT1_LINE_STATE && (FCR & 0x10000000) == 0x00000000)
1487   {
1488      execute_int(get_trap_addr(INT1));
1489      (*hyperstone.irq_callback)(IRQ_INT1);
1490      return;
1491   }
16291492
1630        if( !(FCR&(1<<30)) ) mame_printf_debug("int3 en\n"); //  int 3
1493   /* timer int might be priority 8 if FCR bits 20-21 == 2; FCR bit 23 inhibits interrupt */
1494   if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00200000)
1495   {
1496      hyperstone.timer_int_pending = 0;
1497      execute_int(get_trap_addr(TIMER));
1498      return;
1499   }
16311500
1632        if( !(FCR&(1<<29)) ) mame_printf_debug("int2 en\n"); //  int 2
1501   /* INT2 is priority 9; state is in bit 1 of ISR; FCR bit 29 inhibits interrupt */
1502   if (INT2_LINE_STATE && (FCR & 0x20000000) == 0x00000000)
1503   {
1504      execute_int(get_trap_addr(INT2));
1505      (*hyperstone.irq_callback)(IRQ_INT2);
1506      return;
1507   }
16331508
1634        if( !(FCR&(1<<28)) ) mame_printf_debug("int1 en\n"); //  int 1
1509   /* timer int might be priority 10 if FCR bits 20-21 == 1; FCR bit 23 inhibits interrupt */
1510   if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00100000)
1511   {
1512      hyperstone.timer_int_pending = 0;
1513      execute_int(get_trap_addr(TIMER));
1514      return;
1515   }
16351516
1636        if( (FCR&(1<<10)) && (!(FCR&(1<<8))) ) mame_printf_debug("IO3 en\n"); // IO3
1517   /* INT3 is priority 11; state is in bit 2 of ISR; FCR bit 30 inhibits interrupt */
1518   if (INT3_LINE_STATE && (FCR & 0x40000000) == 0x00000000)
1519   {
1520      execute_int(get_trap_addr(INT3));
1521      (*hyperstone.irq_callback)(IRQ_INT3);
1522      return;
1523   }
16371524
1638      //  if( !(FCR&(1<<23)) ) mame_printf_debug("timer irq!\n"); //  timer
1639*/
1640      if(execint)
1641      {
1642         execute_int(get_trap_addr(irqline + 48));
1643         (*hyperstone.irq_callback)(irqline);
1644      }
1525   /* timer int might be priority 12 if FCR bits 20-21 == 0; FCR bit 23 inhibits interrupt */
1526   if (hyperstone.timer_int_pending && (FCR & 0x00b00000) == 0x00000000)
1527   {
1528      hyperstone.timer_int_pending = 0;
1529      execute_int(get_trap_addr(TIMER));
1530      return;
16451531   }
1532
1533   /* INT4 is priority 13; state is in bit 3 of ISR; FCR bit 31 inhibits interrupt */
1534   if (INT4_LINE_STATE && (FCR & 0x80000000) == 0x00000000)
1535   {
1536      execute_int(get_trap_addr(INT4));
1537      (*hyperstone.irq_callback)(IRQ_INT4);
1538      return;
1539   }
1540
1541   /* IO1 is priority 14; state is in bit 4 of ISR; FCR bit 2 enables input and FCR bit 0 inhibits interrupt */
1542   if (IO1_LINE_STATE && (FCR & 0x00000005) == 0x00000004)
1543   {
1544      execute_int(get_trap_addr(IO1));
1545      (*hyperstone.irq_callback)(IRQ_IO3);
1546      return;
1547   }
1548
1549   /* IO2 is priority 15; state is in bit 5 of ISR; FCR bit 6 enables input and FCR bit 4 inhibits interrupt */
1550   if (IO2_LINE_STATE && (FCR & 0x00000050) == 0x00000040)
1551   {
1552      execute_int(get_trap_addr(IO2));
1553      (*hyperstone.irq_callback)(IRQ_IO2);
1554      return;
1555   }
16461556}
16471557
1648static void hyperstone_init(int index, int clock, const void *config, int (*irqcallback)(int))
1558static void set_irq_line(int irqline, int state)
16491559{
1560   if (state)
1561      ISR |= 1 << irqline;
1562   else
1563      ISR &= ~(1 << irqline);
1564}
1565
1566static void hyperstone_init(int index, int clock, const void *config, int (*irqcallback)(int), int scale_mask)
1567{
16501568   state_save_register_item_array("E132XS", index, hyperstone.global_regs);
16511569   state_save_register_item_array("E132XS", index, hyperstone.local_regs);
16521570   state_save_register_item("E132XS", index, hyperstone.ppc);
16531571   state_save_register_item("E132XS", index, hyperstone.trap_entry);
16541572   state_save_register_item("E132XS", index, hyperstone.delay.delay_pc);
1655   state_save_register_item("E132XS", index, hyperstone.op);
1656   state_save_register_item("E132XS", index, hyperstone.n);
1657   state_save_register_item("E132XS", index, hyperstone.h_clear);
16581573   state_save_register_item("E132XS", index, hyperstone.instruction_length);
16591574   state_save_register_item("E132XS", index, hyperstone.intblock);
1660   state_save_register_item("E132XS", index, hyperstone.delay_timer);
16611575   state_save_register_item("E132XS", index, hyperstone.delay.delay_cmd);
1662   state_save_register_item("E132XS", index, hyperstone.timer_clocks);
1576   state_save_register_item("E132XS", index, hyperstone.tr_clocks_per_tick);
16631577
16641578   hyperstone.irq_callback = irqcallback;
1579   hyperstone.timer = timer_alloc(timer_callback);
1580   hyperstone.clock_scale_mask = scale_mask;
16651581}
16661582
16671583#if (HAS_E116T || HAS_E116XT || HAS_E116XS || HAS_E116XSR || HAS_GMS30C2116 || HAS_GMS30C2216)
1668static void e116_init(int index, int clock, const void *config, int (*irqcallback)(int))
1584static void e116_init(int index, int clock, const void *config, int (*irqcallback)(int), int scale_mask)
16691585{
16701586   hyp_cpu_read_byte      = program_read_byte_16be;
16711587   hyp_cpu_read_half_word = program_read_word_16be;
r1334r1335
16791595
16801596   hyp_type_16bit = 1;
16811597
1682   hyperstone_init(index, clock, config, irqcallback);
1598   hyperstone_init(index, clock, config, irqcallback, scale_mask);
16831599}
1600
1601static void e116t_init(int index, int clock, const void *config, int (*irqcallback)(int))
1602{
1603   e116_init(index, clock, config, irqcallback, 0);
1604}
1605
1606static void e116xt_init(int index, int clock, const void *config, int (*irqcallback)(int))
1607{
1608   e116_init(index, clock, config, irqcallback, 3);
1609}
1610
1611static void e116xs_init(int index, int clock, const void *config, int (*irqcallback)(int))
1612{
1613   e116_init(index, clock, config, irqcallback, 7);
1614}
1615
1616static void e116xsr_init(int index, int clock, const void *config, int (*irqcallback)(int))
1617{
1618   e116_init(index, clock, config, irqcallback, 7);
1619}
1620
1621static void gms30c2116_init(int index, int clock, const void *config, int (*irqcallback)(int))
1622{
1623   e116_init(index, clock, config, irqcallback, 0);
1624}
1625
1626static void gms30c2216_init(int index, int clock, const void *config, int (*irqcallback)(int))
1627{
1628   e116_init(index, clock, config, irqcallback, 0);
1629}
16841630#endif
16851631
16861632#if (HAS_E132N || HAS_E132T || HAS_E132XN || HAS_E132XT || HAS_E132XS || HAS_E132XSR || HAS_GMS30C2132 || HAS_GMS30C2232)
1687static void e132_init(int index, int clock, const void *config, int (*irqcallback)(int))
1633static void e132_init(int index, int clock, const void *config, int (*irqcallback)(int), int scale_mask)
16881634{
16891635   hyp_cpu_read_byte      = program_read_byte_32be;
16901636   hyp_cpu_read_half_word = program_read_word_32be;
r1334r1335
16981644
16991645   hyp_type_16bit = 0;
17001646
1701   hyperstone_init(index, clock, config, irqcallback);
1647   hyperstone_init(index, clock, config, irqcallback, scale_mask);
17021648}
1649
1650static void e132n_init(int index, int clock, const void *config, int (*irqcallback)(int))
1651{
1652   e132_init(index, clock, config, irqcallback, 0);
1653}
1654
1655static void e132t_init(int index, int clock, const void *config, int (*irqcallback)(int))
1656{
1657   e132_init(index, clock, config, irqcallback, 0);
1658}
1659
1660static void e132xn_init(int index, int clock, const void *config, int (*irqcallback)(int))
1661{
1662   e132_init(index, clock, config, irqcallback, 3);
1663}
1664
1665static void e132xt_init(int index, int clock, const void *config, int (*irqcallback)(int))
1666{
1667   e132_init(index, clock, config, irqcallback, 3);
1668}
1669
1670static void e132xs_init(int index, int clock, const void *config, int (*irqcallback)(int))
1671{
1672   e132_init(index, clock, config, irqcallback, 7);
1673}
1674
1675static void e132xsr_init(int index, int clock, const void *config, int (*irqcallback)(int))
1676{
1677   e132_init(index, clock, config, irqcallback, 7);
1678}
1679
1680static void gms30c2132_init(int index, int clock, const void *config, int (*irqcallback)(int))
1681{
1682   e132_init(index, clock, config, irqcallback, 0);
1683}
1684
1685static void gms30c2232_init(int index, int clock, const void *config, int (*irqcallback)(int))
1686{
1687   e132_init(index, clock, config, irqcallback, 0);
1688}
17031689#endif
17041690
17051691static void hyperstone_reset(void)
17061692{
17071693   //TODO: Add different reset initializations for BCR, MCR, FCR, TPR
17081694
1695   emu_timer *save_timer;
17091696   int (*save_irqcallback)(int);
17101697
1698   save_timer = hyperstone.timer;
17111699   save_irqcallback = hyperstone.irq_callback;
17121700   memset(&hyperstone, 0, sizeof(hyperstone_regs));
17131701   hyperstone.irq_callback = save_irqcallback;
1702   hyperstone.timer = save_timer;
17141703
1715   hyperstone.h_clear = 0;
1716   hyperstone.instruction_length = 0;
1704   hyperstone.tr_clocks_per_tick = 2;
17171705
17181706   hyperstone_set_trap_entry(E132XS_ENTRY_MEM3); /* default entry point @ MEM3 */
17191707
r1334r1335
17361724   SET_L_REG(0, (PC & 0xfffffffe) | GET_S);
17371725   SET_L_REG(1, SR);
17381726
1739   hyperstone_ICount -= 2;
1727   hyperstone_ICount -= hyperstone.clock_cycles_2;
17401728}
17411729
17421730static void hyperstone_exit(void)
r1334r1335
17441732   // nothing to do
17451733}
17461734
1747/* Handle the timer, increasing its value after "timer_clocks" clocks and returning the new icount base that needs to be used for the next check */
1748static int handle_timers(int current_icount, int previous_icount)
1749{
1750   int diff = previous_icount - current_icount;
1751   int new_icount_base;
1752
1753   if(diff >= hyperstone.timer_clocks)
1754   {
1755      TR++; // wrap around to 0 modulo 32 bits
1756
1757      if( hyperstone.delay_timer )
1758      {
1759         hyperstone.delay_timer = 0;
1760         hyperstone.timer_clocks = hyperstone.n + 2;
1761      }
1762
1763      new_icount_base = current_icount + (diff - hyperstone.timer_clocks);
1764   }
1765   else
1766   {
1767      new_icount_base = previous_icount;
1768   }
1769
1770   if(!hyperstone.intblock)
1771   {
1772      if( !((TR - TCR) & 0x80000000) )
1773      {
1774         /* generate a timer interrupt */
1775         set_irq_line(7, PULSE_LINE);
1776      }
1777   }
1778
1779   return new_icount_base;
1780}
1781
1782static int hyperstone_execute(int cycles)
1783{
1784   int old_icount = cycles;
1785   hyperstone_ICount = cycles;
1786
1787   do
1788   {
1789      PPC = PC;   /* copy PC to previous PC */
1790
1791      CALL_MAME_DEBUG;
1792
1793      OP = READ_OP(PC);
1794
1795      PC += 2;
1796
1797      if(GET_H)
1798      {
1799         hyperstone.h_clear = 1;
1800      }
1801
1802      hyperstone.instruction_length = 1;
1803
1804      /* clear 'current regs / flags' */
1805      current_regs.src = 0;
1806      current_regs.dst = 0;
1807      current_regs.src_value = 0;
1808      current_regs.next_src_value = 0;
1809      current_regs.dst_value = 0;
1810      current_regs.next_dst_value = 0;
1811      current_regs.sub_type = 0;
1812      current_regs.extra.u = 0;
1813      current_regs.extra.s = 0;
1814      current_regs.set_src_register = NULL;
1815      current_regs.set_dst_register = NULL;
1816      current_regs.src_is_pc = 0;
1817      current_regs.dst_is_pc = 0;
1818      current_regs.src_is_sr = 0;
1819      current_regs.dst_is_sr = 0;
1820      current_regs.same_src_dst = 0;
1821      current_regs.same_src_dstf = 0;
1822      current_regs.same_srcf_dst = 0;
1823
1824      /* decode current opcode details into current regs */
1825      hyperstone_decode[(OP & 0xff00) >> 8]();
1826
1827      /* execute opcode */
1828      hyperstone_op[(OP & 0xff00) >> 8]();
1829
1830      SET_ILC(hyperstone.instruction_length & 3);
1831
1832      old_icount = handle_timers(hyperstone_ICount, old_icount);
1833
1834      if(hyperstone.h_clear)
1835      {
1836         SET_H(0);
1837         hyperstone.h_clear = 0;
1838      }
1839
1840      if( GET_T && GET_P && hyperstone.delay.delay_cmd == NO_DELAY ) /* Not in a Delayed Branch instructions */
1841      {
1842         UINT32 addr = get_trap_addr(TRACE_EXCEPTION);
1843         execute_exception(addr);
1844      }
1845
1846      if( hyperstone.delay.delay_cmd == DELAY_TAKEN )
1847      {
1848         hyperstone.delay.delay_cmd = DELAY_EXECUTE;
1849      }
1850
1851      if(hyperstone.intblock > 0)
1852      {
1853         hyperstone.intblock--;
1854      }
1855
1856   } while( hyperstone_ICount > 0 );
1857
1858   return cycles - hyperstone_ICount;
1859}
1860
18611735static void hyperstone_get_context(void *regs)
18621736{
18631737   /* copy the context */
r1334r1335
18811755
18821756/* Opcodes */
18831757
1884static void hyperstone_chk(void)
1758INLINE void hyperstone_chk(struct regs_decode *decode)
18851759{
18861760   UINT32 addr = get_trap_addr(RANGE_ERROR);
18871761
r1334r1335
19041778      }
19051779   }
19061780
1907   hyperstone_ICount -= 1;
1781   hyperstone_ICount -= hyperstone.clock_cycles_1;
19081782}
19091783
1910static void hyperstone_movd(void)
1784INLINE void hyperstone_movd(struct regs_decode *decode)
19111785{
19121786   if( DST_IS_PC ) // Rd denotes PC
19131787   {
r1334r1335
19181792
19191793      if( SRC_IS_PC || SRC_IS_SR )
19201794      {
1921         logerror("Denoted PC or SR in RET instruction. PC = %08X\n", PC);
1795         DEBUG_PRINTF(("Denoted PC or SR in RET instruction. PC = %08X\n", PC));
19221796      }
19231797      else
19241798      {
r1334r1335
19291803         PC = SET_PC(SREG);
19301804         change_pc(PC);
19311805         SR = (SREGF & 0xffe00000) | ((SREG & 0x01) << 18 ) | (SREGF & 0x3ffff);
1806         if (hyperstone.intblock < 1)
1807            hyperstone.intblock = 1;
19321808
19331809         hyperstone.instruction_length = 0; // undefined
19341810
r1334r1335
19591835      }
19601836
19611837      //TODO: no 1!
1962      hyperstone_ICount -= 1;
1838      hyperstone_ICount -= hyperstone.clock_cycles_1;
19631839   }
19641840   else if( SRC_IS_SR ) // Rd doesn't denote PC and Rs denotes SR
19651841   {
r1334r1335
19681844      SET_Z(1);
19691845      SET_N(0);
19701846
1971      hyperstone_ICount -= 2;
1847      hyperstone_ICount -= hyperstone.clock_cycles_2;
19721848   }
19731849   else // Rd doesn't denote PC and Rs doesn't denote SR
19741850   {
r1334r1335
19811857      SET_Z( tmp == 0 ? 1 : 0 );
19821858      SET_N( SIGN_BIT(SREG) );
19831859
1984      hyperstone_ICount -= 2;
1860      hyperstone_ICount -= hyperstone.clock_cycles_2;
19851861   }
19861862}
19871863
1988static void hyperstone_divu(void)
1864INLINE void hyperstone_divu(struct regs_decode *decode)
19891865{
19901866   if( SAME_SRC_DST || SAME_SRC_DSTF )
19911867   {
1992      logerror("Denoted the same register code in hyperstone_divu instruction. PC = %08X\n", PC);
1868      DEBUG_PRINTF(("Denoted the same register code in hyperstone_divu instruction. PC = %08X\n", PC));
19931869   }
19941870   else
19951871   {
19961872      if( SRC_IS_PC || SRC_IS_SR )
19971873      {
1998         logerror("Denoted PC or SR as source register in hyperstone_divu instruction. PC = %08X\n", PC);
1874         DEBUG_PRINTF(("Denoted PC or SR as source register in hyperstone_divu instruction. PC = %08X\n", PC));
19991875      }
20001876      else
20011877      {
r1334r1335
20311907      }
20321908   }
20331909
2034   hyperstone_ICount -= 36;
1910   hyperstone_ICount -= 36 << hyperstone.clock_scale;
20351911}
20361912
2037static void hyperstone_divs(void)
1913INLINE void hyperstone_divs(struct regs_decode *decode)
20381914{
20391915   if( SAME_SRC_DST || SAME_SRC_DSTF )
20401916   {
2041      logerror("Denoted the same register code in hyperstone_divs instruction. PC = %08X\n", PC);
1917      DEBUG_PRINTF(("Denoted the same register code in hyperstone_divs instruction. PC = %08X\n", PC));
20421918   }
20431919   else
20441920   {
20451921      if( SRC_IS_PC || SRC_IS_SR )
20461922      {
2047         logerror("Denoted PC or SR as source register in hyperstone_divs instruction. PC = %08X\n", PC);
1923         DEBUG_PRINTF(("Denoted PC or SR as source register in hyperstone_divs instruction. PC = %08X\n", PC));
20481924      }
20491925      else
20501926      {
r1334r1335
20801956      }
20811957   }
20821958
2083   hyperstone_ICount -= 36;
1959   hyperstone_ICount -= 36 << hyperstone.clock_scale;
20841960}
20851961
2086static void hyperstone_xm(void)
1962INLINE void hyperstone_xm(struct regs_decode *decode)
20871963{
20881964   if( SRC_IS_SR || DST_IS_SR || DST_IS_PC )
20891965   {
2090      logerror("Denoted PC or SR in hyperstone_xm. PC = %08X\n", PC);
1966      DEBUG_PRINTF(("Denoted PC or SR in hyperstone_xm. PC = %08X\n", PC));
20911967   }
20921968   else
20931969   {
2094      switch( current_regs.sub_type ) // x_code
1970      switch( decode->sub_type ) // x_code
20951971      {
20961972         case 0:
20971973         case 1:
r1334r1335
21091985            }
21101986            else
21111987            {
2112               SREG <<= current_regs.sub_type;
1988               SREG <<= decode->sub_type;
21131989            }
21141990
21151991            break;
r1334r1335
21181994         case 5:
21191995         case 6:
21201996         case 7:
2121            current_regs.sub_type -= 4;
2122            SREG <<= current_regs.sub_type;
1997            decode->sub_type -= 4;
1998            SREG <<= decode->sub_type;
21231999
21242000            break;
21252001      }
r1334r1335
21272003      SET_DREG(SREG);
21282004   }
21292005
2130   hyperstone_ICount -= 1;
2006   hyperstone_ICount -= hyperstone.clock_cycles_1;
21312007}
21322008
2133static void hyperstone_mask(void)
2009INLINE void hyperstone_mask(struct regs_decode *decode)
21342010{
21352011   DREG = SREG & EXTRA_U;
21362012
21372013   SET_DREG(DREG);
21382014   SET_Z( DREG == 0 ? 1 : 0 );
21392015
2140   hyperstone_ICount -= 1;
2016   hyperstone_ICount -= hyperstone.clock_cycles_1;
21412017}
21422018
2143static void hyperstone_sum(void)
2019INLINE void hyperstone_sum(struct regs_decode *decode)
21442020{
21452021   UINT64 tmp;
21462022
r1334r1335
21612037   SET_Z( DREG == 0 ? 1 : 0 );
21622038   SET_N( SIGN_BIT(DREG) );
21632039
2164   hyperstone_ICount -= 1;
2040   hyperstone_ICount -= hyperstone.clock_cycles_1;
21652041}
21662042
2167static void hyperstone_sums(void)
2043INLINE void hyperstone_sums(struct regs_decode *decode)
21682044{
21692045   INT32 res;
21702046   INT64 tmp;
r1334r1335
21862062   SET_Z( res == 0 ? 1 : 0 );
21872063   SET_N( SIGN_BIT(res) );
21882064
2189   hyperstone_ICount -= 1;
2065   hyperstone_ICount -= hyperstone.clock_cycles_1;
21902066
21912067   if( GET_V && !SRC_IS_SR )
21922068   {
r1334r1335
21952071   }
21962072}
21972073
2198static void hyperstone_cmp(void)
2074INLINE void hyperstone_cmp(struct regs_decode *decode)
21992075{
22002076   UINT64 tmp;
22012077
r1334r1335
22202096   else
22212097      SET_C(0);
22222098
2223   hyperstone_ICount -= 1;
2099   hyperstone_ICount -= hyperstone.clock_cycles_1;
22242100}
22252101
2226static void hyperstone_mov(void)
2102INLINE void hyperstone_mov(struct regs_decode *decode)
22272103{
2228   if( !GET_S && current_regs.dst >= 16 )
2104   if( !GET_S && decode->dst >= 16 )
22292105   {
22302106      UINT32 addr = get_trap_addr(PRIVILEGE_ERROR);
22312107      execute_exception(addr);
r1334r1335
22392115   SET_Z( SREG == 0 ? 1 : 0 );
22402116   SET_N( SIGN_BIT(SREG) );
22412117
2242   hyperstone_ICount -= 1;
2118   hyperstone_ICount -= hyperstone.clock_cycles_1;
22432119}
22442120
22452121
2246static void hyperstone_add(void)
2122INLINE void hyperstone_add(struct regs_decode *decode)
22472123{
22482124   UINT64 tmp;
22492125
r1334r1335
22632139   SET_Z( DREG == 0 ? 1 : 0 );
22642140   SET_N( SIGN_BIT(DREG) );
22652141
2266   hyperstone_ICount -= 1;
2142   hyperstone_ICount -= hyperstone.clock_cycles_1;
22672143}
22682144
2269static void hyperstone_adds(void)
2145INLINE void hyperstone_adds(struct regs_decode *decode)
22702146{
22712147   INT32 res;
22722148   INT64 tmp;
r1334r1335
22882164   SET_Z( res == 0 ? 1 : 0 );
22892165   SET_N( SIGN_BIT(res) );
22902166
2291   hyperstone_ICount -= 1;
2167   hyperstone_ICount -= hyperstone.clock_cycles_1;
22922168
22932169   if( GET_V )
22942170   {
r1334r1335
22972173   }
22982174}
22992175
2300static void hyperstone_cmpb(void)
2176INLINE void hyperstone_cmpb(struct regs_decode *decode)
23012177{
23022178   SET_Z( (DREG & SREG) == 0 ? 1 : 0 );
23032179
2304   hyperstone_ICount -= 1;
2180   hyperstone_ICount -= hyperstone.clock_cycles_1;
23052181}
23062182
2307static void hyperstone_andn(void)
2183INLINE void hyperstone_andn(struct regs_decode *decode)
23082184{
23092185   DREG = DREG & ~SREG;
23102186
23112187   SET_DREG(DREG);
23122188   SET_Z( DREG == 0 ? 1 : 0 );
23132189
2314   hyperstone_ICount -= 1;
2190   hyperstone_ICount -= hyperstone.clock_cycles_1;
23152191}
23162192
2317static void hyperstone_or(void)
2193INLINE void hyperstone_or(struct regs_decode *decode)
23182194{
23192195   DREG = DREG | SREG;
23202196
23212197   SET_DREG(DREG);
23222198   SET_Z( DREG == 0 ? 1 : 0 );
23232199
2324   hyperstone_ICount -= 1;
2200   hyperstone_ICount -= hyperstone.clock_cycles_1;
23252201}
23262202
2327static void hyperstone_xor(void)
2203INLINE void hyperstone_xor(struct regs_decode *decode)
23282204{
23292205   DREG = DREG ^ SREG;
23302206
23312207   SET_DREG(DREG);
23322208   SET_Z( DREG == 0 ? 1 : 0 );
23332209
2334   hyperstone_ICount -= 1;
2210   hyperstone_ICount -= hyperstone.clock_cycles_1;
23352211}
23362212
2337static void hyperstone_subc(void)
2213INLINE void hyperstone_subc(struct regs_decode *decode)
23382214{
23392215   UINT64 tmp;
23402216
r1334r1335
23672243   SET_Z( GET_Z & (DREG == 0 ? 1 : 0) );
23682244   SET_N( SIGN_BIT(DREG) );
23692245
2370   hyperstone_ICount -= 1;
2246   hyperstone_ICount -= hyperstone.clock_cycles_1;
23712247}
23722248
2373static void hyperstone_not(void)
2249INLINE void hyperstone_not(struct regs_decode *decode)
23742250{
23752251   SET_DREG(~SREG);
23762252   SET_Z( ~SREG == 0 ? 1 : 0 );
23772253
2378   hyperstone_ICount -= 1;
2254   hyperstone_ICount -= hyperstone.clock_cycles_1;
23792255}
23802256
2381static void hyperstone_sub(void)
2257INLINE void hyperstone_sub(struct regs_decode *decode)
23822258{
23832259   UINT64 tmp;
23842260
r1334r1335
23982274   SET_Z( DREG == 0 ? 1 : 0 );
23992275   SET_N( SIGN_BIT(DREG) );
24002276
2401   hyperstone_ICount -= 1;
2277   hyperstone_ICount -= hyperstone.clock_cycles_1;
24022278}
24032279
2404static void hyperstone_subs(void)
2280INLINE void hyperstone_subs(struct regs_decode *decode)
24052281{
24062282   INT32 res;
24072283   INT64 tmp;
r1334r1335
24242300   SET_Z( res == 0 ? 1 : 0 );
24252301   SET_N( SIGN_BIT(res) );
24262302
2427   hyperstone_ICount -= 1;
2303   hyperstone_ICount -= hyperstone.clock_cycles_1;
24282304
24292305   if( GET_V )
24302306   {
r1334r1335
24332309   }
24342310}
24352311
2436static void hyperstone_addc(void)
2312INLINE void hyperstone_addc(struct regs_decode *decode)
24372313{
24382314   UINT64 tmp;
24392315
r1334r1335
24712347   SET_Z( GET_Z & (DREG == 0 ? 1 : 0) );
24722348   SET_N( SIGN_BIT(DREG) );
24732349
2474   hyperstone_ICount -= 1;
2350   hyperstone_ICount -= hyperstone.clock_cycles_1;
24752351}
24762352
2477static void hyperstone_and(void)
2353INLINE void hyperstone_and(struct regs_decode *decode)
24782354{
24792355   DREG = DREG & SREG;
24802356
24812357   SET_DREG(DREG);
24822358   SET_Z( DREG == 0 ? 1 : 0 );
24832359
2484   hyperstone_ICount -= 1;
2360   hyperstone_ICount -= hyperstone.clock_cycles_1;
24852361}
24862362
2487static void hyperstone_neg(void)
2363INLINE void hyperstone_neg(struct regs_decode *decode)
24882364{
24892365   UINT64 tmp;
24902366
r1334r1335
25022378   SET_Z( DREG == 0 ? 1 : 0 );
25032379   SET_N( SIGN_BIT(DREG) );
25042380
2505   hyperstone_ICount -= 1;
2381   hyperstone_ICount -= hyperstone.clock_cycles_1;
25062382}
25072383
2508static void hyperstone_negs(void)
2384INLINE void hyperstone_negs(struct regs_decode *decode)
25092385{
25102386   INT32 res;
25112387   INT64 tmp;
r1334r1335
25282404   SET_N( SIGN_BIT(res) );
25292405
25302406
2531   hyperstone_ICount -= 1;
2407   hyperstone_ICount -= hyperstone.clock_cycles_1;
25322408
25332409   if( GET_V && !SRC_IS_SR ) //trap doesn't occur when source is SR
25342410   {
r1334r1335
25372413   }
25382414}
25392415
2540static void hyperstone_cmpi(void)
2416INLINE void hyperstone_cmpi(struct regs_decode *decode)
25412417{
25422418   UINT64 tmp;
25432419
r1334r1335
25592435   else
25602436      SET_C(0);
25612437
2562   hyperstone_ICount -= 1;
2438   hyperstone_ICount -= hyperstone.clock_cycles_1;
25632439}
25642440
2565static void hyperstone_movi(void)
2441INLINE void hyperstone_movi(struct regs_decode *decode)
25662442{
2567   if( !GET_S && current_regs.dst >= 16 )
2443   if( !GET_S && decode->dst >= 16 )
25682444   {
25692445      UINT32 addr = get_trap_addr(PRIVILEGE_ERROR);
25702446      execute_exception(addr);
r1334r1335
25822458   SET_V(0); // or V undefined ?
25832459#endif
25842460
2585   hyperstone_ICount -= 1;
2461   hyperstone_ICount -= hyperstone.clock_cycles_1;
25862462}
25872463
2588static void hyperstone_addi(void)
2464INLINE void hyperstone_addi(struct regs_decode *decode)
25892465{
25902466   UINT32 imm;
25912467   UINT64 tmp;
r1334r1335
26092485   SET_Z( DREG == 0 ? 1 : 0 );
26102486   SET_N( SIGN_BIT(DREG) );
26112487
2612   hyperstone_ICount -= 1;
2488   hyperstone_ICount -= hyperstone.clock_cycles_1;
26132489}
26142490
2615static void hyperstone_addsi(void)
2491INLINE void hyperstone_addsi(struct regs_decode *decode)
26162492{
26172493   INT32 imm, res;
26182494   INT64 tmp;
r1334r1335
26362512   SET_Z( res == 0 ? 1 : 0 );
26372513   SET_N( SIGN_BIT(res) );
26382514
2639   hyperstone_ICount -= 1;
2515   hyperstone_ICount -= hyperstone.clock_cycles_1;
26402516
26412517   if( GET_V )
26422518   {
r1334r1335
26452521   }
26462522}
26472523
2648static void hyperstone_cmpbi(void)
2524INLINE void hyperstone_cmpbi(struct regs_decode *decode)
26492525{
26502526   UINT32 imm;
26512527
r1334r1335
26712547         SET_Z(0);
26722548   }
26732549
2674   hyperstone_ICount -= 1;
2550   hyperstone_ICount -= hyperstone.clock_cycles_1;
26752551}
26762552
2677static void hyperstone_andni(void)
2553INLINE void hyperstone_andni(struct regs_decode *decode)
26782554{
26792555   UINT32 imm;
26802556
r1334r1335
26882564   SET_DREG(DREG);
26892565   SET_Z( DREG == 0 ? 1 : 0 );
26902566
2691   hyperstone_ICount -= 1;
2567   hyperstone_ICount -= hyperstone.clock_cycles_1;
26922568}
26932569
2694static void hyperstone_ori(void)
2570INLINE void hyperstone_ori(struct regs_decode *decode)
26952571{
26962572   DREG = DREG | EXTRA_U;
26972573
26982574   SET_DREG(DREG);
26992575   SET_Z( DREG == 0 ? 1 : 0 );
27002576
2701   hyperstone_ICount -= 1;
2577   hyperstone_ICount -= hyperstone.clock_cycles_1;
27022578}
27032579
2704static void hyperstone_xori(void)
2580INLINE void hyperstone_xori(struct regs_decode *decode)
27052581{
27062582   DREG = DREG ^ EXTRA_U;
27072583
27082584   SET_DREG(DREG);
27092585   SET_Z( DREG == 0 ? 1 : 0 );
27102586
2711   hyperstone_ICount -= 1;
2587   hyperstone_ICount -= hyperstone.clock_cycles_1;
27122588}
27132589
2714static void hyperstone_shrdi(void)
2590INLINE void hyperstone_shrdi(struct regs_decode *decode)
27152591{
27162592   UINT32 low_order, high_order;
27172593   UINT64 val;
r1334r1335
27362612   SET_Z( val == 0 ? 1 : 0 );
27372613   SET_N( SIGN_BIT(high_order) );
27382614
2739   hyperstone_ICount -= 2;
2615   hyperstone_ICount -= hyperstone.clock_cycles_2;
27402616}
27412617
2742static void hyperstone_shrd(void)
2618INLINE void hyperstone_shrd(struct regs_decode *decode)
27432619{
27442620   UINT32 low_order, high_order;
27452621   UINT64 val;
r1334r1335
27482624   // result undefined if Ls denotes the same register as Ld or Ldf
27492625   if( SAME_SRC_DST || SAME_SRC_DSTF )
27502626   {
2751      logerror("Denoted same registers in hyperstone_shrd. PC = %08X\n", PC);
2627      DEBUG_PRINTF(("Denoted same registers in hyperstone_shrd. PC = %08X\n", PC));
27522628   }
27532629   else
27542630   {
r1334r1335
27742650      SET_N( SIGN_BIT(high_order) );
27752651   }
27762652
2777   hyperstone_ICount -= 2;
2653   hyperstone_ICount -= hyperstone.clock_cycles_2;
27782654}
27792655
2780static void hyperstone_shr(void)
2656INLINE void hyperstone_shr(struct regs_decode *decode)
27812657{
27822658   UINT32 ret;
27832659   UINT8 n;
r1334r1335
27962672   SET_Z( ret == 0 ? 1 : 0 );
27972673   SET_N( SIGN_BIT(ret) );
27982674
2799   hyperstone_ICount -= 1;
2675   hyperstone_ICount -= hyperstone.clock_cycles_1;
28002676}
28012677
2802static void hyperstone_sardi(void)
2678INLINE void hyperstone_sardi(struct regs_decode *decode)
28032679{
28042680   UINT32 low_order, high_order;
28052681   UINT64 val;
r1334r1335
28362712   SET_Z( val == 0 ? 1 : 0 );
28372713   SET_N( SIGN_BIT(high_order) );
28382714
2839   hyperstone_ICount -= 2;
2715   hyperstone_ICount -= hyperstone.clock_cycles_2;
28402716}
28412717
2842static void hyperstone_sard(void)
2718INLINE void hyperstone_sard(struct regs_decode *decode)
28432719{
28442720   UINT32 low_order, high_order;
28452721   UINT64 val;
r1334r1335
28502726   // result undefined if Ls denotes the same register as Ld or Ldf
28512727   if( SAME_SRC_DST || SAME_SRC_DSTF )
28522728   {
2853      logerror("Denoted same registers in hyperstone_sard. PC = %08X\n", PC);
2729      DEBUG_PRINTF(("Denoted same registers in hyperstone_sard. PC = %08X\n", PC));
28542730   }
28552731   else
28562732   {
r1334r1335
28862762      SET_N( SIGN_BIT(high_order) );
28872763   }
28882764
2889   hyperstone_ICount -= 2;
2765   hyperstone_ICount -= hyperstone.clock_cycles_2;
28902766}
28912767
2892static void hyperstone_sar(void)
2768INLINE void hyperstone_sar(struct regs_decode *decode)
28932769{
28942770   UINT32 ret;
28952771   UINT8 n, sign_bit;
r1334r1335
29182794   SET_Z( ret == 0 ? 1 : 0 );
29192795   SET_N( SIGN_BIT(ret) );
29202796
2921   hyperstone_ICount -= 1;
2797   hyperstone_ICount -= hyperstone.clock_cycles_1;
29222798}
29232799
2924static void hyperstone_shldi(void)
2800INLINE void hyperstone_shldi(struct regs_decode *decode)
29252801{
29262802   UINT32 low_order, high_order, tmp;
29272803   UINT64 val, mask;
r1334r1335
29512827   SET_Z( val == 0 ? 1 : 0 );
29522828   SET_N( SIGN_BIT(high_order) );
29532829
2954   hyperstone_ICount -= 2;
2830   hyperstone_ICount -= hyperstone.clock_cycles_2;
29552831}
29562832
2957static void hyperstone_shld(void)
2833INLINE void hyperstone_shld(struct regs_decode *decode)
29582834{
29592835   UINT32 low_order, high_order, tmp, n;
29602836   UINT64 val, mask;
r1334r1335
29642840   // result undefined if Ls denotes the same register as Ld or Ldf
29652841   if( SAME_SRC_DST || SAME_SRC_DSTF )
29662842   {
2967      logerror("Denoted same registers in hyperstone_shld. PC = %08X\n", PC);
2843      DEBUG_PRINTF(("Denoted same registers in hyperstone_shld. PC = %08X\n", PC));
29682844   }
29692845   else
29702846   {
r1334r1335
29952871      SET_N( SIGN_BIT(high_order) );
29962872   }
29972873
2998   hyperstone_ICount -= 2;
2874   hyperstone_ICount -= hyperstone.clock_cycles_2;
29992875}
30002876
3001static void hyperstone_shl(void)
2877INLINE void hyperstone_shl(struct regs_decode *decode)
30022878{
30032879   UINT32 base, ret, n;
30042880   UINT64 mask;
r1334r1335
30192895   SET_Z( ret == 0 ? 1 : 0 );
30202896   SET_N( SIGN_BIT(ret) );
30212897
3022   hyperstone_ICount -= 1;
2898   hyperstone_ICount -= hyperstone.clock_cycles_1;
30232899}
30242900
3025static void reserved(void)
2901static void reserved(struct regs_decode *decode)
30262902{
3027   logerror("Executed Reserved opcode. PC = %08X OP = %04X\n", PC, OP);
2903   DEBUG_PRINTF(("Executed Reserved opcode. PC = %08X OP = %04X\n", PC, OP));
30282904}
30292905
3030static void hyperstone_testlz(void)
2906INLINE void hyperstone_testlz(struct regs_decode *decode)
30312907{
30322908   UINT8 zeros = 0;
30332909   UINT32 mask;
r1334r1335
30452921
30462922   SET_DREG(zeros);
30472923
3048   hyperstone_ICount -= 2;
2924   hyperstone_ICount -= hyperstone.clock_cycles_2;
30492925}
30502926
3051static void hyperstone_rol(void)
2927INLINE void hyperstone_rol(struct regs_decode *decode)
30522928{
30532929   UINT32 val, base;
30542930   UINT8 n;
r1334r1335
30812957   SET_Z( val == 0 ? 1 : 0 );
30822958   SET_N( SIGN_BIT(val) );
30832959
3084   hyperstone_ICount -= 1;
2960   hyperstone_ICount -= hyperstone.clock_cycles_1;
30852961}
30862962
30872963//TODO: add trap error
3088static void hyperstone_ldxx1(void)
2964INLINE void hyperstone_ldxx1(struct regs_decode *decode)
30892965{
30902966   UINT32 load;
30912967
30922968   if( DST_IS_SR )
30932969   {
3094      switch( current_regs.sub_type )
2970      switch( decode->sub_type )
30952971      {
30962972         case 0: // LDBS.A
30972973
r1334r1335
31373013               load = IO_READ_W((EXTRA_S & ~3) + 4);
31383014               SET_SREGF(load);
31393015
3140               hyperstone_ICount -= 1; // extra cycle
3016               hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle
31413017            }
31423018            else if( (EXTRA_S & 3) == 2 ) // LDW.IOA
31433019            {
r1334r1335
31523028               load = READ_W((EXTRA_S & ~1) + 4);
31533029               SET_SREGF(load);
31543030
3155               hyperstone_ICount -= 1; // extra cycle
3031               hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle
31563032            }
31573033            else                      // LDW.A
31583034            {
r1334r1335
31653041   }
31663042   else
31673043   {
3168      switch( current_regs.sub_type )
3044      switch( decode->sub_type )
31693045      {
31703046         case 0: // LDBS.D
31713047
r1334r1335
32113087               load = IO_READ_W(DREG + (EXTRA_S & ~3) + 4);
32123088               SET_SREGF(load);
32133089
3214               hyperstone_ICount -= 1; // extra cycle
3090               hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle
32153091            }
32163092            else if( (EXTRA_S & 3) == 2 ) // LDW.IOD
32173093            {
r1334r1335
32263102               load = READ_W(DREG + (EXTRA_S & ~1) + 4);
32273103               SET_SREGF(load);
32283104
3229               hyperstone_ICount -= 1; // extra cycle
3105               hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle
32303106            }
32313107            else                      // LDW.D
32323108            {
r1334r1335
32383114      }
32393115   }
32403116
3241   hyperstone_ICount -= 1;
3117   hyperstone_ICount -= hyperstone.clock_cycles_1;
32423118}
32433119
3244static void hyperstone_ldxx2(void)
3120INLINE void hyperstone_ldxx2(struct regs_decode *decode)
32453121{
32463122   UINT32 load;
32473123
32483124   if( DST_IS_PC || DST_IS_SR )
32493125   {
3250      logerror("Denoted PC or SR in hyperstone_ldxx2. PC = %08X\n", PC);
3126      DEBUG_PRINTF(("Denoted PC or SR in hyperstone_ldxx2. PC = %08X\n", PC));
32513127   }
32523128   else
32533129   {
3254      switch( current_regs.sub_type )
3130      switch( decode->sub_type )
32553131      {
32563132         case 0: // LDBS.N
32573133
32583134            if(SAME_SRC_DST)
3259               popmessage("LDBS.N denoted same regs @ %08X",PPC);
3135               DEBUG_PRINTF(("LDBS.N denoted same regs @ %08X",PPC));
32603136
32613137            load = READ_B(DREG);
32623138            load |= (load & 0x80) ? 0xffffff00 : 0;
r1334r1335
32703146         case 1: // LDBU.N
32713147
32723148            if(SAME_SRC_DST)
3273               popmessage("LDBU.N denoted same regs @ %08X",PPC);
3149               DEBUG_PRINTF(("LDBU.N denoted same regs @ %08X",PPC));
32743150
32753151            load = READ_B(DREG);
32763152            SET_SREG(load);
r1334r1335
32893165               load |= (load & 0x8000) ? 0xffff0000 : 0;
32903166
32913167               if(SAME_SRC_DST)
3292                  popmessage("LDHS.N denoted same regs @ %08X",PPC);
3168                  DEBUG_PRINTF(("LDHS.N denoted same regs @ %08X",PPC));
32933169            }
32943170            /*
32953171                else          // LDHU.N
r1334r1335
33103186            if( (EXTRA_S & 3) == 3 )      // LDW.S
33113187            {
33123188               if(SAME_SRC_DST)
3313                  popmessage("LDW.S denoted same regs @ %08X",PPC);
3189                  DEBUG_PRINTF(("LDW.S denoted same regs @ %08X",PPC));
33143190
33153191               if(DREG < SP)
33163192                  SET_SREG(READ_W(DREG));
r1334r1335
33203196               if(!SAME_SRC_DST)
33213197                  SET_DREG(DREG + (EXTRA_S & ~3));
33223198
3323               hyperstone_ICount -= 2; // extra cycles
3199               hyperstone_ICount -= hyperstone.clock_cycles_2; // extra cycles
33243200            }
33253201            else if( (EXTRA_S & 3) == 2 ) // Reserved
33263202            {
3327               logerror("Executed Reserved instruction in hyperstone_ldxx2. PC = %08X\n", PC);
3203               DEBUG_PRINTF(("Executed Reserved instruction in hyperstone_ldxx2. PC = %08X\n", PC));
33283204            }
33293205            else if( (EXTRA_S & 3) == 1 ) // LDD.N
33303206            {
33313207               if(SAME_SRC_DST || SAME_SRCF_DST)
3332                  popmessage("LDD.N denoted same regs @ %08X",PPC);
3208                  DEBUG_PRINTF(("LDD.N denoted same regs @ %08X",PPC));
33333209
33343210               load = READ_W(DREG);
33353211               SET_SREG(load);
r1334r1335
33403216               if(!SAME_SRC_DST && !SAME_SRCF_DST)
33413217                  SET_DREG(DREG + (EXTRA_S & ~1));
33423218
3343               hyperstone_ICount -= 1; // extra cycle
3219               hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle
33443220            }
33453221            else                      // LDW.N
33463222            {
33473223               if(SAME_SRC_DST)
3348                  popmessage("LDW.N denoted same regs @ %08X",PPC);
3224                  DEBUG_PRINTF(("LDW.N denoted same regs @ %08X",PPC));
33493225
33503226               load = READ_W(DREG);
33513227               SET_SREG(load);
r1334r1335
33583234      }
33593235   }
33603236
3361   hyperstone_ICount -= 1;
3237   hyperstone_ICount -= hyperstone.clock_cycles_1;
33623238}
33633239
33643240//TODO: add trap error
3365static void hyperstone_stxx1(void)
3241INLINE void hyperstone_stxx1(struct regs_decode *decode)
33663242{
33673243   if( SRC_IS_SR )
33683244      SREG = SREGF = 0;
33693245
33703246   if( DST_IS_SR )
33713247   {
3372      switch( current_regs.sub_type )
3248      switch( decode->sub_type )
33733249      {
33743250         case 0: // STBS.A
33753251
r1334r1335
34083284               IO_WRITE_W(EXTRA_S & ~3, SREG);
34093285               IO_WRITE_W((EXTRA_S & ~3) + 4, SREGF);
34103286
3411               hyperstone_ICount -= 1; // extra cycle
3287               hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle
34123288            }
34133289            else if( (EXTRA_S & 3) == 2 ) // STW.IOA
34143290            {
r1334r1335
34193295               WRITE_W(EXTRA_S & ~1, SREG);
34203296               WRITE_W((EXTRA_S & ~1) + 4, SREGF);
34213297
3422               hyperstone_ICount -= 1; // extra cycle
3298               hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle
34233299            }
34243300            else                      // STW.A
34253301            {
r1334r1335
34313307   }
34323308   else
34333309   {
3434      switch( current_regs.sub_type )
3310      switch( decode->sub_type )
34353311      {
34363312         case 0: // STBS.D
34373313
r1334r1335
34703346               IO_WRITE_W(DREG + (EXTRA_S & ~3), SREG);
34713347               IO_WRITE_W(DREG + (EXTRA_S & ~3) + 4, SREGF);
34723348
3473               hyperstone_ICount -= 1; // extra cycle
3349               hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle
34743350            }
34753351            else if( (EXTRA_S & 3) == 2 ) // STW.IOD
34763352            {
r1334r1335
34813357               WRITE_W(DREG + (EXTRA_S & ~1), SREG);
34823358               WRITE_W(DREG + (EXTRA_S & ~1) + 4, SREGF);
34833359
3484               hyperstone_ICount -= 1; // extra cycle
3360               hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle
34853361            }
34863362            else                      // STW.D
34873363            {
r1334r1335
34923368      }
34933369   }
34943370
3495   hyperstone_ICount -= 1;
3371   hyperstone_ICount -= hyperstone.clock_cycles_1;
34963372}
34973373
3498static void hyperstone_stxx2(void)
3374INLINE void hyperstone_stxx2(struct regs_decode *decode)
34993375{
35003376   if( SRC_IS_SR )
35013377      SREG = SREGF = 0;
35023378
35033379   if( DST_IS_PC || DST_IS_SR )
35043380   {
3505      logerror("Denoted PC or SR in hyperstone_stxx2. PC = %08X\n", PC);
3381      DEBUG_PRINTF(("Denoted PC or SR in hyperstone_stxx2. PC = %08X\n", PC));
35063382   }
35073383   else
35083384   {
3509      switch( current_regs.sub_type )
3385      switch( decode->sub_type )
35103386      {
35113387         case 0: // STBS.N
35123388
r1334r1335
35493425                  WRITE_W(DREG, SREG);
35503426               else
35513427               {
3552                  if(((DREG & 0xfc) >> 2) == ((current_regs.src + GET_FP) % 64) && S_BIT == LOCAL)
3553                     popmessage("STW.S denoted the same local register @ %08X\n",PPC);
3428                  if(((DREG & 0xfc) >> 2) == ((decode->src + GET_FP) % 64) && S_BIT == LOCAL)
3429                     DEBUG_PRINTF(("STW.S denoted the same local register @ %08X\n",PPC));
35543430
35553431                  SET_ABS_L_REG((DREG & 0xfc) >> 2,SREG);
35563432               }
35573433
35583434               SET_DREG(DREG + (EXTRA_S & ~3));
35593435
3560               hyperstone_ICount -= 2; // extra cycles
3436               hyperstone_ICount -= hyperstone.clock_cycles_2; // extra cycles
35613437
35623438            }
35633439            else if( (EXTRA_S & 3) == 2 ) // Reserved
35643440            {
3565               logerror("Executed Reserved instruction in hyperstone_stxx2. PC = %08X\n", PC);
3441               DEBUG_PRINTF(("Executed Reserved instruction in hyperstone_stxx2. PC = %08X\n", PC));
35663442            }
35673443            else if( (EXTRA_S & 3) == 1 ) // STD.N
35683444            {
r1334r1335
35743450               else
35753451                  WRITE_W(DREG + 4, SREGF);
35763452
3577               hyperstone_ICount -= 1; // extra cycle
3453               hyperstone_ICount -= hyperstone.clock_cycles_1; // extra cycle
35783454            }
35793455            else                      // STW.N
35803456            {
r1334r1335
35863462      }
35873463   }
35883464
3589   hyperstone_ICount -= 1;
3465   hyperstone_ICount -= hyperstone.clock_cycles_1;
35903466}
35913467
3592static void hyperstone_shri(void)
3468INLINE void hyperstone_shri(struct regs_decode *decode)
35933469{
35943470   UINT32 val;
35953471
r1334r1335
36063482   SET_Z( val == 0 ? 1 : 0 );
36073483   SET_N( SIGN_BIT(val) );
36083484
3609   hyperstone_ICount -= 1;
3485   hyperstone_ICount -= hyperstone.clock_cycles_1;
36103486}
36113487
3612static void hyperstone_sari(void)
3488INLINE void hyperstone_sari(struct regs_decode *decode)
36133489{
36143490   UINT32 val;
36153491   UINT8 sign_bit;
r1334r1335
36373513   SET_Z( val == 0 ? 1 : 0 );
36383514   SET_N( SIGN_BIT(val) );
36393515
3640   hyperstone_ICount -= 1;
3516   hyperstone_ICount -= hyperstone.clock_cycles_1;
36413517}
36423518
3643static void hyperstone_shli(void)
3519INLINE void hyperstone_shli(struct regs_decode *decode)
36443520{
36453521   UINT32 val, val2;
36463522   UINT64 mask;
r1334r1335
36603536   SET_Z( val2 == 0 ? 1 : 0 );
36613537   SET_N( SIGN_BIT(val2) );
36623538
3663   hyperstone_ICount -= 1;
3539   hyperstone_ICount -= hyperstone.clock_cycles_1;
36643540}
36653541
3666static void hyperstone_mulu(void)
3542INLINE void hyperstone_mulu(struct regs_decode *decode)
36673543{
36683544   UINT32 low_order, high_order;
36693545   UINT64 double_word;
r1334r1335
36713547   // PC or SR aren't denoted, else result is undefined
36723548   if( SRC_IS_PC || SRC_IS_SR || DST_IS_PC || DST_IS_SR  )
36733549   {
3674      logerror("Denoted PC or SR in hyperstone_mulu instruction. PC = %08X\n", PC);
3550      DEBUG_PRINTF(("Denoted PC or SR in hyperstone_mulu instruction. PC = %08X\n", PC));
36753551   }
36763552   else
36773553   {
r1334r1335
36883564   }
36893565
36903566   if(SREG <= 0xffff && DREG <= 0xffff)
3691      hyperstone_ICount -= 4;
3567      hyperstone_ICount -= hyperstone.clock_cycles_4;
36923568   else
3693      hyperstone_ICount -= 6;
3569      hyperstone_ICount -= hyperstone.clock_cycles_6;
36943570}
36953571
3696static void hyperstone_muls(void)
3572INLINE void hyperstone_muls(struct regs_decode *decode)
36973573{
36983574   UINT32 low_order, high_order;
36993575   INT64 double_word;
r1334r1335
37013577   // PC or SR aren't denoted, else result is undefined
37023578   if( SRC_IS_PC || SRC_IS_SR || DST_IS_PC || DST_IS_SR  )
37033579   {
3704      logerror("Denoted PC or SR in hyperstone_muls instruction. PC = %08X\n", PC);
3580      DEBUG_PRINTF(("Denoted PC or SR in hyperstone_muls instruction. PC = %08X\n", PC));
37053581   }
37063582   else
37073583   {
r1334r1335
37173593   }
37183594
37193595   if((SREG >= 0xffff8000 && SREG <= 0x7fff) && (DREG >= 0xffff8000 && DREG <= 0x7fff))
3720      hyperstone_ICount -= 4;
3596      hyperstone_ICount -= hyperstone.clock_cycles_4;
37213597   else
3722      hyperstone_ICount -= 6;
3598      hyperstone_ICount -= hyperstone.clock_cycles_6;
37233599}
37243600
3725static void hyperstone_set(void)
3601INLINE void hyperstone_set(struct regs_decode *decode)
37263602{
37273603   int n = N_VALUE;
37283604
37293605   if( DST_IS_PC )
37303606   {
3731      logerror("Denoted PC in hyperstone_set. PC = %08X\n", PC);
3607      DEBUG_PRINTF(("Denoted PC in hyperstone_set. PC = %08X\n", PC));
37323608   }
37333609   else if( DST_IS_SR )
37343610   {
37353611      //TODO: add fetch opcode when there's the pipeline
37363612
37373613      //TODO: no 1!
3738      hyperstone_ICount -= 1;
3614      hyperstone_ICount -= hyperstone.clock_cycles_1;
37393615   }
37403616   else
37413617   {
r1334r1335
37593635         case 16:
37603636         case 17:
37613637         case 19:
3762            logerror("Used reserved N value (%d) in hyperstone_set. PC = %08X\n", n, PC);
3638            DEBUG_PRINTF(("Used reserved N value (%d) in hyperstone_set. PC = %08X\n", n, PC));
37633639            break;
37643640
37653641         // SETxx
r1334r1335
40643940            break;
40653941      }
40663942
4067      hyperstone_ICount -= 1;
3943      hyperstone_ICount -= hyperstone.clock_cycles_1;
40683944   }
40693945}
40703946
4071static void hyperstone_mul(void)
3947INLINE void hyperstone_mul(struct regs_decode *decode)
40723948{
40733949   UINT32 single_word;
40743950
40753951   // PC or SR aren't denoted, else result is undefined
40763952   if( SRC_IS_PC || SRC_IS_SR || DST_IS_PC || DST_IS_SR  )
40773953   {
4078      logerror("Denoted PC or SR in hyperstone_mul instruction. PC = %08X\n", PC);
3954      DEBUG_PRINTF(("Denoted PC or SR in hyperstone_mul instruction. PC = %08X\n", PC));
40793955   }
40803956   else
40813957   {
r1334r1335
40883964   }
40893965
40903966   if((SREG >= 0xffff8000 && SREG <= 0x7fff) && (DREG >= 0xffff8000 && DREG <= 0x7fff))
4091      hyperstone_ICount -= 3;
3967      hyperstone_ICount -= 3 << hyperstone.clock_scale;
40923968   else
4093      hyperstone_ICount -= 5;
3969      hyperstone_ICount -= 5 << hyperstone.clock_scale;
40943970}
40953971
4096static void hyperstone_fadd(void)
3972INLINE void hyperstone_fadd(struct regs_decode *decode)
40973973{
4098   execute_software();
4099   hyperstone_ICount -= 6;
3974   execute_software(decode);
3975   hyperstone_ICount -= hyperstone.clock_cycles_6;
41003976}
41013977
4102static void hyperstone_faddd(void)
3978INLINE void hyperstone_faddd(struct regs_decode *decode)
41033979{
4104   execute_software();
4105   hyperstone_ICount -= 6;
3980   execute_software(decode);
3981   hyperstone_ICount -= hyperstone.clock_cycles_6;
41063982}
41073983
4108static void hyperstone_fsub(void)
3984INLINE void hyperstone_fsub(struct regs_decode *decode)
41093985{
4110   execute_software();
4111   hyperstone_ICount -= 6;
3986   execute_software(decode);
3987   hyperstone_ICount -= hyperstone.clock_cycles_6;
41123988}
41133989
4114static void hyperstone_fsubd(void)
3990INLINE void hyperstone_fsubd(struct regs_decode *decode)
41153991{
4116   execute_software();
4117   hyperstone_ICount -= 6;
3992   execute_software(decode);
3993   hyperstone_ICount -= hyperstone.clock_cycles_6;
41183994}
41193995
4120static void hyperstone_fmul(void)
3996INLINE void hyperstone_fmul(struct regs_decode *decode)
41213997{
4122   execute_software();
4123   hyperstone_ICount -= 6;
3998   execute_software(decode);
3999   hyperstone_ICount -= hyperstone.clock_cycles_6;
41244000}
41254001
4126static void hyperstone_fmuld(void)
4002INLINE void hyperstone_fmuld(struct regs_decode *decode)
41274003{
4128   execute_software();
4129   hyperstone_ICount -= 6;
4004   execute_software(decode);
4005   hyperstone_ICount -= hyperstone.clock_cycles_6;
41304006}
41314007
4132static void hyperstone_fdiv(void)
4008INLINE void hyperstone_fdiv(struct regs_decode *decode)
41334009{
4134   execute_software();
4135   hyperstone_ICount -= 6;
4010   execute_software(decode);
4011   hyperstone_ICount -= hyperstone.clock_cycles_6;
41364012}
41374013
4138static void hyperstone_fdivd(void)
4014INLINE void hyperstone_fdivd(struct regs_decode *decode)
41394015{
4140   execute_software();
4141   hyperstone_ICount -= 6;
4016   execute_software(decode);
4017   hyperstone_ICount -= hyperstone.clock_cycles_6;
41424018}
41434019
4144static void hyperstone_fcmp(void)
4020INLINE void hyperstone_fcmp(struct regs_decode *decode)
41454021{
4146   execute_software();
4147   hyperstone_ICount -= 6;
4022   execute_software(decode);
4023   hyperstone_ICount -= hyperstone.clock_cycles_6;
41484024}
41494025
4150static void hyperstone_fcmpd(void)
4026INLINE void hyperstone_fcmpd(struct regs_decode *decode)
41514027{
4152   execute_software();
4153   hyperstone_ICount -= 6;
4028   execute_software(decode);
4029   hyperstone_ICount -= hyperstone.clock_cycles_6;
41544030}
41554031
4156static void hyperstone_fcmpu(void)
4032INLINE void hyperstone_fcmpu(struct regs_decode *decode)
41574033{
4158   execute_software();
4159   hyperstone_ICount -= 6;
4034   execute_software(decode);
4035   hyperstone_ICount -= hyperstone.clock_cycles_6;
41604036}
41614037
4162static void hyperstone_fcmpud(void)
4038INLINE void hyperstone_fcmpud(struct regs_decode *decode)
41634039{
4164   execute_software();
4165   hyperstone_ICount -= 6;
4040   execute_software(decode);
4041   hyperstone_ICount -= hyperstone.clock_cycles_6;
41664042}
41674043
4168static void hyperstone_fcvt(void)
4044INLINE void hyperstone_fcvt(struct regs_decode *decode)
41694045{
4170   execute_software();
4171   hyperstone_ICount -= 6;
4046   execute_software(decode);
4047   hyperstone_ICount -= hyperstone.clock_cycles_6;
41724048}
41734049
4174static void hyperstone_fcvtd(void)
4050INLINE void hyperstone_fcvtd(struct regs_decode *decode)
41754051{
4176   execute_software();
4177   hyperstone_ICount -= 6;
4052   execute_software(decode);
4053   hyperstone_ICount -= hyperstone.clock_cycles_6;
41784054}
41794055
4180static void hyperstone_extend(void)
4056INLINE void hyperstone_extend(struct regs_decode *decode)
41814057{
41824058   //TODO: add locks, overflow error and other things
41834059   UINT32 vals, vald;
r1334r1335
43714247         break;
43724248      }
43734249      default:
4374         logerror("Executed Illegal extended opcode (%X). PC = %08X\n", EXTRA_U, PC);
4250         DEBUG_PRINTF(("Executed Illegal extended opcode (%X). PC = %08X\n", EXTRA_U, PC));
43754251         break;
43764252   }
43774253
4378   hyperstone_ICount -= 1; //TODO: with the latency it can change
4254   hyperstone_ICount -= hyperstone.clock_cycles_1; //TODO: with the latency it can change
43794255}
43804256
4381static void hyperstone_do(void)
4257INLINE void hyperstone_do(struct regs_decode *decode)
43824258{
43834259   fatalerror("Executed hyperstone_do instruction. PC = %08X", PPC);
43844260}
43854261
4386static void hyperstone_ldwr(void)
4262INLINE void hyperstone_ldwr(struct regs_decode *decode)
43874263{
43884264   SET_SREG(READ_W(DREG));
43894265
4390   hyperstone_ICount -= 1;
4266   hyperstone_ICount -= hyperstone.clock_cycles_1;
43914267}
43924268
4393static void hyperstone_lddr(void)
4269INLINE void hyperstone_lddr(struct regs_decode *decode)
43944270{
43954271   SET_SREG(READ_W(DREG));
43964272   SET_SREGF(READ_W(DREG + 4));
43974273
4398   hyperstone_ICount -= 2;
4274   hyperstone_ICount -= hyperstone.clock_cycles_2;
43994275}
44004276
4401static void hyperstone_ldwp(void)
4277INLINE void hyperstone_ldwp(struct regs_decode *decode)
44024278{
44034279   SET_SREG(READ_W(DREG));
44044280
44054281   // post increment the destination register if it's different from the source one
44064282   // (needed by Hidden Catch)
4407   if(!(current_regs.src == current_regs.dst && S_BIT == LOCAL))
4283   if(!(decode->src == decode->dst && S_BIT == LOCAL))
44084284      SET_DREG(DREG + 4);
44094285
4410   hyperstone_ICount -= 1;
4286   hyperstone_ICount -= hyperstone.clock_cycles_1;
44114287}
44124288
4413static void hyperstone_lddp(void)
4289INLINE void hyperstone_lddp(struct regs_decode *decode)
44144290{
44154291   SET_SREG(READ_W(DREG));
44164292   SET_SREGF(READ_W(DREG + 4));
44174293
44184294   // post increment the destination register if it's different from the source one
44194295   // and from the "next source" one
4420   if(!(current_regs.src == current_regs.dst && S_BIT == LOCAL) &&   !SAME_SRCF_DST )
4296   if(!(decode->src == decode->dst && S_BIT == LOCAL) &&   !SAME_SRCF_DST )
44214297   {
44224298      SET_DREG(DREG + 8);
44234299   }
44244300   else
44254301   {
4426      popmessage("LDD.P denoted same regs @ %08X",PPC);
4302      DEBUG_PRINTF(("LDD.P denoted same regs @ %08X",PPC));
44274303   }
44284304
4429   hyperstone_ICount -= 2;
4305   hyperstone_ICount -= hyperstone.clock_cycles_2;
44304306}
44314307
4432static void hyperstone_stwr(void)
4308INLINE void hyperstone_stwr(struct regs_decode *decode)
44334309{
44344310   if( SRC_IS_SR )
44354311      SREG = 0;
44364312
44374313   WRITE_W(DREG, SREG);
44384314
4439   hyperstone_ICount -= 1;
4315   hyperstone_ICount -= hyperstone.clock_cycles_1;
44404316}
44414317
4442static void hyperstone_stdr(void)
4318INLINE void hyperstone_stdr(struct regs_decode *decode)
44434319{
44444320   if( SRC_IS_SR )
44454321      SREG = SREGF = 0;
r1334r1335
44474323   WRITE_W(DREG, SREG);
44484324   WRITE_W(DREG + 4, SREGF);
44494325
4450   hyperstone_ICount -= 2;
4326   hyperstone_ICount -= hyperstone.clock_cycles_2;
44514327}
44524328
4453static void hyperstone_stwp(void)
4329INLINE void hyperstone_stwp(struct regs_decode *decode)
44544330{
44554331   if( SRC_IS_SR )
44564332      SREG = 0;
r1334r1335
44584334   WRITE_W(DREG, SREG);
44594335   SET_DREG(DREG + 4);
44604336
4461   hyperstone_ICount -= 1;
4337   hyperstone_ICount -= hyperstone.clock_cycles_1;
44624338}
44634339
4464static void hyperstone_stdp(void)
4340INLINE void hyperstone_stdp(struct regs_decode *decode)
44654341{
44664342   if( SRC_IS_SR )
44674343      SREG = SREGF = 0;
r1334r1335
44744350   else
44754351      WRITE_W(DREG + 4, SREGF);
44764352
4477   hyperstone_ICount -= 2;
4353   hyperstone_ICount -= hyperstone.clock_cycles_2;
44784354}
44794355
4480static void hyperstone_dbv(void)
4356INLINE void hyperstone_dbv(struct regs_decode *decode)
44814357{
44824358   if( GET_V )
4483      execute_dbr();
4359      execute_dbr(decode);
44844360
4485   hyperstone_ICount -= 1;
4361   hyperstone_ICount -= hyperstone.clock_cycles_1;
44864362}
44874363
4488static void hyperstone_dbnv(void)
4364INLINE void hyperstone_dbnv(struct regs_decode *decode)
44894365{
44904366   if( !GET_V )
4491      execute_dbr();
4367      execute_dbr(decode);
44924368
4493   hyperstone_ICount -= 1;
4369   hyperstone_ICount -= hyperstone.clock_cycles_1;
44944370}
44954371
4496static void hyperstone_dbe(void) //or DBZ
4372INLINE void hyperstone_dbe(struct regs_decode *decode) //or DBZ
44974373{
44984374   if( GET_Z )
4499      execute_dbr();
4375      execute_dbr(decode);
45004376
4501   hyperstone_ICount -= 1;
4377   hyperstone_ICount -= hyperstone.clock_cycles_1;
45024378}
45034379
4504static void hyperstone_dbne(void) //or DBNZ
4380INLINE void hyperstone_dbne(struct regs_decode *decode) //or DBNZ
45054381{
45064382   if( !GET_Z )
4507      execute_dbr();
4383      execute_dbr(decode);
45084384
4509   hyperstone_ICount -= 1;
4385   hyperstone_ICount -= hyperstone.clock_cycles_1;
45104386}
45114387
4512static void hyperstone_dbc(void) //or DBST
4388INLINE void hyperstone_dbc(struct regs_decode *decode) //or DBST
45134389{
45144390   if( GET_C )
4515      execute_dbr();
4391      execute_dbr(decode);
45164392
4517   hyperstone_ICount -= 1;
4393   hyperstone_ICount -= hyperstone.clock_cycles_1;
45184394}
45194395
4520static void hyperstone_dbnc(void) //or DBHE
4396INLINE void hyperstone_dbnc(struct regs_decode *decode) //or DBHE
45214397{
45224398   if( !GET_C )
4523      execute_dbr();
4399      execute_dbr(decode);
45244400
4525   hyperstone_ICount -= 1;
4401   hyperstone_ICount -= hyperstone.clock_cycles_1;
45264402}
45274403
4528static void hyperstone_dbse(void)
4404INLINE void hyperstone_dbse(struct regs_decode *decode)
45294405{
45304406   if( GET_C || GET_Z )
4531      execute_dbr();
4407      execute_dbr(decode);
45324408
4533   hyperstone_ICount -= 1;
4409   hyperstone_ICount -= hyperstone.clock_cycles_1;
45344410}
45354411
4536static void hyperstone_dbht(void)
4412INLINE void hyperstone_dbht(struct regs_decode *decode)
45374413{
45384414   if( !GET_C && !GET_Z )
4539      execute_dbr();
4415      execute_dbr(decode);
45404416
4541   hyperstone_ICount -= 1;
4417   hyperstone_ICount -= hyperstone.clock_cycles_1;
45424418}
45434419
4544static void hyperstone_dbn(void) //or DBLT
4420INLINE void hyperstone_dbn(struct regs_decode *decode) //or DBLT
45454421{
45464422   if( GET_N )
4547      execute_dbr();
4423      execute_dbr(decode);
45484424
4549   hyperstone_ICount -= 1;
4425   hyperstone_ICount -= hyperstone.clock_cycles_1;
45504426}
45514427
4552static void hyperstone_dbnn(void) //or DBGE
4428INLINE void hyperstone_dbnn(struct regs_decode *decode) //or DBGE
45534429{
45544430   if( !GET_N )
4555      execute_dbr();
4431      execute_dbr(decode);
45564432
4557   hyperstone_ICount -= 1;
4433   hyperstone_ICount -= hyperstone.clock_cycles_1;
45584434}
45594435
4560static void hyperstone_dble(void)
4436INLINE void hyperstone_dble(struct regs_decode *decode)
45614437{
45624438   if( GET_N || GET_Z )
4563      execute_dbr();
4439      execute_dbr(decode);
45644440
4565   hyperstone_ICount -= 1;
4441   hyperstone_ICount -= hyperstone.clock_cycles_1;
45664442}
45674443
4568static void hyperstone_dbgt(void)
4444INLINE void hyperstone_dbgt(struct regs_decode *decode)
45694445{
45704446   if( !GET_N && !GET_Z )
4571      execute_dbr();
4447      execute_dbr(decode);
45724448
4573   hyperstone_ICount -= 1;
4449   hyperstone_ICount -= hyperstone.clock_cycles_1;
45744450}
45754451
4576static void hyperstone_dbr(void)
4452INLINE void hyperstone_dbr(struct regs_decode *decode)
45774453{
4578   execute_dbr();
4454   execute_dbr(decode);
45794455}
45804456
4581static void hyperstone_frame(void)
4457INLINE void hyperstone_frame(struct regs_decode *decode)
45824458{
45834459   INT8 difference; // really it's 7 bits
45844460   UINT8 realfp = GET_FP - SRC_CODE;
r1334r1335
46174493   }
46184494
46194495   //TODO: no 1!
4620   hyperstone_ICount -= 1;
4496   hyperstone_ICount -= hyperstone.clock_cycles_1;
46214497}
46224498
4623static void hyperstone_call(void)
4499INLINE void hyperstone_call(struct regs_decode *decode)
46244500{
46254501   if( SRC_IS_SR )
46264502      SREG = 0;
46274503
46284504   if( !DST_CODE )
4629      current_regs.dst = 16;
4505      decode->dst = 16;
46304506
46314507   EXTRA_S = (EXTRA_S & ~1) + SREG;
46324508
r1334r1335
46354511   SET_DREG((PC & 0xfffffffe) | GET_S);
46364512   SET_DREGF(SR);
46374513
4638   SET_FP(GET_FP + current_regs.dst);
4514   SET_FP(GET_FP + decode->dst);
46394515
46404516   SET_FL(6); //default value for call
46414517   SET_M(0);
r1334r1335
46494525   //TODO: add interrupt locks, errors, ....
46504526
46514527   //TODO: no 1!
4652   hyperstone_ICount -= 1;
4528   hyperstone_ICount -= hyperstone.clock_cycles_1;
46534529}
46544530
4655static void hyperstone_bv(void)
4531INLINE void hyperstone_bv(struct regs_decode *decode)
46564532{
46574533   if( GET_V )
4658      execute_br();
4534      execute_br(decode);
46594535   else
4660      hyperstone_ICount -= 1;
4536      hyperstone_ICount -= hyperstone.clock_cycles_1;
46614537}
46624538
4663static void hyperstone_bnv(void)
4539INLINE void hyperstone_bnv(struct regs_decode *decode)
46644540{
46654541   if( !GET_V )
4666      execute_br();
4542      execute_br(decode);
46674543   else
4668      hyperstone_ICount -= 1;
4544      hyperstone_ICount -= hyperstone.clock_cycles_1;
46694545}
46704546
4671static void hyperstone_be(void) //or BZ
4547INLINE void hyperstone_be(struct regs_decode *decode) //or BZ
46724548{
46734549   if( GET_Z )
4674      execute_br();
4550      execute_br(decode);
46754551   else
4676      hyperstone_ICount -= 1;
4552      hyperstone_ICount -= hyperstone.clock_cycles_1;
46774553}
46784554
4679static void hyperstone_bne(void) //or BNZ
4555INLINE void hyperstone_bne(struct regs_decode *decode) //or BNZ
46804556{
46814557   if( !GET_Z )
4682      execute_br();
4558      execute_br(decode);
46834559   else
4684      hyperstone_ICount -= 1;
4560      hyperstone_ICount -= hyperstone.clock_cycles_1;
46854561}
46864562
4687static void hyperstone_bc(void) //or BST
4563INLINE void hyperstone_bc(struct regs_decode *decode) //or BST
46884564{
46894565   if( GET_C )
4690      execute_br();
4566      execute_br(decode);
46914567   else
4692      hyperstone_ICount -= 1;
4568      hyperstone_ICount -= hyperstone.clock_cycles_1;
46934569}
46944570
4695static void hyperstone_bnc(void) //or BHE
4571INLINE void hyperstone_bnc(struct regs_decode *decode) //or BHE
46964572{
46974573   if( !GET_C )
4698      execute_br();
4574      execute_br(decode);
46994575   else
4700      hyperstone_ICount -= 1;
4576      hyperstone_ICount -= hyperstone.clock_cycles_1;
47014577}
47024578
4703static void hyperstone_bse(void)
4579INLINE void hyperstone_bse(struct regs_decode *decode)
47044580{
47054581   if( GET_C || GET_Z )
4706      execute_br();
4582      execute_br(decode);
47074583   else
4708      hyperstone_ICount -= 1;
4584      hyperstone_ICount -= hyperstone.clock_cycles_1;
47094585}
47104586
4711static void hyperstone_bht(void)
4587INLINE void hyperstone_bht(struct regs_decode *decode)
47124588{
47134589   if( !GET_C && !GET_Z )
4714      execute_br();
4590      execute_br(decode);
47154591   else
4716      hyperstone_ICount -= 1;
4592      hyperstone_ICount -= hyperstone.clock_cycles_1;
47174593}
47184594
4719static void hyperstone_bn(void) //or BLT
4595INLINE void hyperstone_bn(struct regs_decode *decode) //or BLT
47204596{
47214597   if( GET_N )
4722      execute_br();
4598      execute_br(decode);
47234599   else
4724      hyperstone_ICount -= 1;
4600      hyperstone_ICount -= hyperstone.clock_cycles_1;
47254601}
47264602
4727static void hyperstone_bnn(void) //or BGE
4603INLINE void hyperstone_bnn(struct regs_decode *decode) //or BGE
47284604{
47294605   if( !GET_N )
4730      execute_br();
4606      execute_br(decode);
47314607   else
4732      hyperstone_ICount -= 1;
4608      hyperstone_ICount -= hyperstone.clock_cycles_1;
47334609}
47344610
4735static void hyperstone_ble(void)
4611INLINE void hyperstone_ble(struct regs_decode *decode)
47364612{
47374613   if( GET_N || GET_Z )
4738      execute_br();
4614      execute_br(decode);
47394615   else
4740      hyperstone_ICount -= 1;
4616      hyperstone_ICount -= hyperstone.clock_cycles_1;
47414617}
47424618
4743static void hyperstone_bgt(void)
4619INLINE void hyperstone_bgt(struct regs_decode *decode)
47444620{
47454621   if( !GET_N && !GET_Z )
4746      execute_br();
4622      execute_br(decode);
47474623   else
4748      hyperstone_ICount -= 1;
4624      hyperstone_ICount -= hyperstone.clock_cycles_1;
47494625}
47504626
4751static void hyperstone_br(void)
4627INLINE void hyperstone_br(struct regs_decode *decode)
47524628{
4753   execute_br();
4629   execute_br(decode);
47544630}
47554631
4756static void hyperstone_trap(void)
4632INLINE void hyperstone_trap(struct regs_decode *decode)
47574633{
47584634   UINT8 code, trapno;
47594635   UINT32 addr;
r1334r1335
48374713         break;
48384714   }
48394715
4840   hyperstone_ICount -= 1;
4716   hyperstone_ICount -= hyperstone.clock_cycles_1;
48414717}
48424718
48434719
4720#include "e132xsop.c"
4721
4722
4723static int hyperstone_execute(int cycles)
4724{
4725   hyperstone_ICount = cycles;
4726
4727   if (hyperstone.intblock < 0)
4728      hyperstone.intblock = 0;
4729   check_interrupts();
4730
4731   do
4732   {
4733      UINT32 oldh = SR & 0x00000020;
4734      UINT16 opcode;
4735
4736      PPC = PC;   /* copy PC to previous PC */
4737      CALL_MAME_DEBUG;
4738
4739      opcode = READ_OP(PC);
4740      PC += 2;
4741
4742      hyperstone.instruction_length = 1;
4743
4744      /* execute opcode */
4745      (*hyperstone_op[(opcode & 0xff00) >> 8])(opcode);
4746
4747      /* clear the H state if it was previously set */
4748      SR ^= oldh;
4749
4750      SET_ILC(hyperstone.instruction_length & 3);
4751
4752      if( GET_T && GET_P && hyperstone.delay.delay_cmd == NO_DELAY ) /* Not in a Delayed Branch instructions */
4753      {
4754         UINT32 addr = get_trap_addr(TRACE_EXCEPTION);
4755         execute_exception(addr);
4756      }
4757
4758      if (--hyperstone.intblock == 0)
4759         check_interrupts();
4760
4761   } while( hyperstone_ICount > 0 );
4762
4763   return cycles - hyperstone_ICount;
4764}
4765
4766
48444767/**************************************************************************
48454768 * Generic set_info
48464769 **************************************************************************/
r1334r1335
48554778      case CPUINFO_INT_REGISTER + E132XS_PC:         PC = info->i; change_pc(PC);         break;
48564779      case CPUINFO_INT_REGISTER + E132XS_SR:         SR = info->i;                     break;
48574780      case CPUINFO_INT_REGISTER + E132XS_FER:         FER = info->i;                     break;
4858      case CPUINFO_INT_REGISTER + E132XS_G3:         hyperstone.global_regs[3] = info->i;   break;
4859      case CPUINFO_INT_REGISTER + E132XS_G4:         hyperstone.global_regs[4] = info->i;   break;
4860      case CPUINFO_INT_REGISTER + E132XS_G5:         hyperstone.global_regs[5] = info->i;   break;
4861      case CPUINFO_INT_REGISTER + E132XS_G6:         hyperstone.global_regs[6] = info->i;   break;
4862      case CPUINFO_INT_REGISTER + E132XS_G7:         hyperstone.global_regs[7] = info->i;   break;
4863      case CPUINFO_INT_REGISTER + E132XS_G8:         hyperstone.global_regs[8] = info->i;   break;
4864      case CPUINFO_INT_REGISTER + E132XS_G9:         hyperstone.global_regs[9] = info->i;   break;
4865      case CPUINFO_INT_REGISTER + E132XS_G10:         hyperstone.global_regs[10] = info->i;   break;
4866      case CPUINFO_INT_REGISTER + E132XS_G11:         hyperstone.global_regs[11] = info->i;   break;
4867      case CPUINFO_INT_REGISTER + E132XS_G12:         hyperstone.global_regs[12] = info->i;   break;
4868      case CPUINFO_INT_REGISTER + E132XS_G13:         hyperstone.global_regs[13] = info->i;   break;
4869      case CPUINFO_INT_REGISTER + E132XS_G14:         hyperstone.global_regs[14] = info->i;   break;
4870      case CPUINFO_INT_REGISTER + E132XS_G15:         hyperstone.global_regs[15] = info->i;   break;
4871      case CPUINFO_INT_REGISTER + E132XS_G16:         hyperstone.global_regs[16] = info->i;   break;
4872      case CPUINFO_INT_REGISTER + E132XS_G17:         hyperstone.global_regs[17] = info->i;   break;
4781      case CPUINFO_INT_REGISTER + E132XS_G3:         set_global_register(3, info->i);   break;
4782      case CPUINFO_INT_REGISTER + E132XS_G4:         set_global_register(4, info->i);   break;
4783      case CPUINFO_INT_REGISTER + E132XS_G5:         set_global_register(5, info->i);   break;
4784      case CPUINFO_INT_REGISTER + E132XS_G6:         set_global_register(6, info->i);   break;
4785      case CPUINFO_INT_REGISTER + E132XS_G7:         set_global_register(7, info->i);   break;
4786      case CPUINFO_INT_REGISTER + E132XS_G8:         set_global_register(8, info->i);   break;
4787      case CPUINFO_INT_REGISTER + E132XS_G9:         set_global_register(9, info->i);   break;
4788      case CPUINFO_INT_REGISTER + E132XS_G10:         set_global_register(10, info->i);   break;
4789      case CPUINFO_INT_REGISTER + E132XS_G11:         set_global_register(11, info->i);   break;
4790      case CPUINFO_INT_REGISTER + E132XS_G12:         set_global_register(12, info->i);   break;
4791      case CPUINFO_INT_REGISTER + E132XS_G13:         set_global_register(13, info->i);   break;
4792      case CPUINFO_INT_REGISTER + E132XS_G14:         set_global_register(14, info->i);   break;
4793      case CPUINFO_INT_REGISTER + E132XS_G15:         set_global_register(15, info->i);   break;
4794      case CPUINFO_INT_REGISTER + E132XS_G16:         set_global_register(16, info->i);   break;
4795      case CPUINFO_INT_REGISTER + E132XS_G17:         set_global_register(17, info->i);   break;
48734796      case CPUINFO_INT_SP:
48744797      case CPUINFO_INT_REGISTER + E132XS_SP:         SP  = info->i;                     break;
48754798      case CPUINFO_INT_REGISTER + E132XS_UB:         UB  = info->i;                     break;
48764799      case CPUINFO_INT_REGISTER + E132XS_BCR:         BCR = info->i;                     break;
48774800      case CPUINFO_INT_REGISTER + E132XS_TPR:         TPR = info->i;                     break;
48784801      case CPUINFO_INT_REGISTER + E132XS_TCR:         TCR = info->i;                     break;
4879      case CPUINFO_INT_REGISTER + E132XS_TR:         TR = info->i;                     break;
4802      case CPUINFO_INT_REGISTER + E132XS_TR:         set_global_register(TR_REGISTER, info->i);   break;
48804803      case CPUINFO_INT_REGISTER + E132XS_WCR:         WCR = info->i;                     break;
48814804      case CPUINFO_INT_REGISTER + E132XS_ISR:         ISR = info->i;                     break;
48824805      case CPUINFO_INT_REGISTER + E132XS_FCR:         FCR = info->i;                     break;
48834806      case CPUINFO_INT_REGISTER + E132XS_MCR:         MCR = info->i;                     break;
4884      case CPUINFO_INT_REGISTER + E132XS_G28:         hyperstone.global_regs[28] = info->i;   break;
4885      case CPUINFO_INT_REGISTER + E132XS_G29:         hyperstone.global_regs[29] = info->i;   break;
4886      case CPUINFO_INT_REGISTER + E132XS_G30:         hyperstone.global_regs[30] = info->i;   break;
4887      case CPUINFO_INT_REGISTER + E132XS_G31:         hyperstone.global_regs[31] = info->i;   break;
4807      case CPUINFO_INT_REGISTER + E132XS_G28:         set_global_register(28, info->i);   break;
4808      case CPUINFO_INT_REGISTER + E132XS_G29:         set_global_register(29, info->i);   break;
4809      case CPUINFO_INT_REGISTER + E132XS_G30:         set_global_register(30, info->i);   break;
4810      case CPUINFO_INT_REGISTER + E132XS_G31:         set_global_register(31, info->i);   break;
48884811      case CPUINFO_INT_REGISTER + E132XS_CL0:         hyperstone.local_regs[(0 + GET_FP) % 64] = info->i; break;
48894812      case CPUINFO_INT_REGISTER + E132XS_CL1:         hyperstone.local_regs[(1 + GET_FP) % 64] = info->i; break;
48904813      case CPUINFO_INT_REGISTER + E132XS_CL2:         hyperstone.local_regs[(2 + GET_FP) % 64] = info->i; break;
r1334r1335
49814904 * Generic get_info
49824905 **************************************************************************/
49834906
4984void hyperstone_get_info(UINT32 state, cpuinfo *info)
4907static void hyperstone_get_info(UINT32 state, cpuinfo *info)
49854908{
49864909   switch (state)
49874910   {
r1334r1335
50124935      case CPUINFO_INT_REGISTER + E132XS_PC:         info->i =  PC;                     break;
50134936      case CPUINFO_INT_REGISTER + E132XS_SR:         info->i =  SR;                     break;
50144937      case CPUINFO_INT_REGISTER + E132XS_FER:         info->i =  FER;                     break;
5015      case CPUINFO_INT_REGISTER + E132XS_G3:         info->i =  hyperstone.global_regs[3];   break;
5016      case CPUINFO_INT_REGISTER + E132XS_G4:         info->i =  hyperstone.global_regs[4];   break;
5017      case CPUINFO_INT_REGISTER + E132XS_G5:         info->i =  hyperstone.global_regs[5];   break;
5018      case CPUINFO_INT_REGISTER + E132XS_G6:         info->i =  hyperstone.global_regs[6];   break;
5019      case CPUINFO_INT_REGISTER + E132XS_G7:         info->i =  hyperstone.global_regs[7];   break;
5020      case CPUINFO_INT_REGISTER + E132XS_G8:         info->i =  hyperstone.global_regs[8];   break;
5021      case CPUINFO_INT_REGISTER + E132XS_G9:         info->i =  hyperstone.global_regs[9];   break;
5022      case CPUINFO_INT_REGISTER + E132XS_G10:         info->i =  hyperstone.global_regs[10];   break;
5023      case CPUINFO_INT_REGISTER + E132XS_G11:         info->i =  hyperstone.global_regs[11];   break;
5024      case CPUINFO_INT_REGISTER + E132XS_G12:         info->i =  hyperstone.global_regs[12];   break;
5025      case CPUINFO_INT_REGISTER + E132XS_G13:         info->i =  hyperstone.global_regs[13];   break;
5026      case CPUINFO_INT_REGISTER + E132XS_G14:         info->i =  hyperstone.global_regs[14];   break;
5027      case CPUINFO_INT_REGISTER + E132XS_G15:         info->i =  hyperstone.global_regs[15];   break;
5028      case CPUINFO_INT_REGISTER + E132XS_G16:         info->i =  hyperstone.global_regs[16];   break;
5029      case CPUINFO_INT_REGISTER + E132XS_G17:         info->i =  hyperstone.global_regs[17];   break;
4938      case CPUINFO_INT_REGISTER + E132XS_G3:         info->i =  get_global_register(3);   break;
4939      case CPUINFO_INT_REGISTER + E132XS_G4:         info->i =  get_global_register(4);   break;
4940      case CPUINFO_INT_REGISTER + E132XS_G5:         info->i =  get_global_register(5);   break;
4941      case CPUINFO_INT_REGISTER + E132XS_G6:         info->i =  get_global_register(6);   break;
4942      case CPUINFO_INT_REGISTER + E132XS_G7:         info->i =  get_global_register(7);   break;
4943      case CPUINFO_INT_REGISTER + E132XS_G8:         info->i =  get_global_register(8);   break;
4944      case CPUINFO_INT_REGISTER + E132XS_G9:         info->i =  get_global_register(9);   break;
4945      case CPUINFO_INT_REGISTER + E132XS_G10:         info->i =  get_global_register(10);   break;
4946      case CPUINFO_INT_REGISTER + E132XS_G11:         info->i =  get_global_register(11);   break;
4947      case CPUINFO_INT_REGISTER + E132XS_G12:         info->i =  get_global_register(12);   break;
4948      case CPUINFO_INT_REGISTER + E132XS_G13:         info->i =  get_global_register(13);   break;
4949      case CPUINFO_INT_REGISTER + E132XS_G14:         info->i =  get_global_register(14);   break;
4950      case CPUINFO_INT_REGISTER + E132XS_G15:         info->i =  get_global_register(15);   break;
4951      case CPUINFO_INT_REGISTER + E132XS_G16:         info->i =  get_global_register(16);   break;
4952      case CPUINFO_INT_REGISTER + E132XS_G17:         info->i =  get_global_register(17);   break;
50304953      case CPUINFO_INT_SP:
50314954      case CPUINFO_INT_REGISTER + E132XS_SP:         info->i =  SP;                     break;
50324955      case CPUINFO_INT_REGISTER + E132XS_UB:         info->i =  UB;                     break;
r1334r1335
50384961      case CPUINFO_INT_REGISTER + E132XS_ISR:         info->i =  ISR;                     break;
50394962      case CPUINFO_INT_REGISTER + E132XS_FCR:         info->i =  FCR;                     break;
50404963      case CPUINFO_INT_REGISTER + E132XS_MCR:         info->i =  MCR;                     break;
5041      case CPUINFO_INT_REGISTER + E132XS_G28:         info->i =  hyperstone.global_regs[28];   break;
5042      case CPUINFO_INT_REGISTER + E132XS_G29:         info->i =  hyperstone.global_regs[29];   break;
5043      case CPUINFO_INT_REGISTER + E132XS_G30:         info->i =  hyperstone.global_regs[30];   break;
5044      case CPUINFO_INT_REGISTER + E132XS_G31:         info->i =  hyperstone.global_regs[31];   break;
4964      case CPUINFO_INT_REGISTER + E132XS_G28:         info->i =  get_global_register(28);   break;
4965      case CPUINFO_INT_REGISTER + E132XS_G29:         info->i =  get_global_register(29);   break;
4966      case CPUINFO_INT_REGISTER + E132XS_G30:         info->i =  get_global_register(30);   break;
4967      case CPUINFO_INT_REGISTER + E132XS_G31:         info->i =  get_global_register(31);   break;
50454968      case CPUINFO_INT_REGISTER + E132XS_CL0:         info->i =  hyperstone.local_regs[(0 + GET_FP) % 64]; break;
50464969      case CPUINFO_INT_REGISTER + E132XS_CL1:         info->i =  hyperstone.local_regs[(1 + GET_FP) % 64]; break;
50474970      case CPUINFO_INT_REGISTER + E132XS_CL2:         info->i =  hyperstone.local_regs[(2 + GET_FP) % 64]; break;
r1334r1335
51275050      case CPUINFO_PTR_SET_INFO:                  info->setinfo = hyperstone_set_info;   break;
51285051      case CPUINFO_PTR_GET_CONTEXT:               info->getcontext = hyperstone_get_context; break;
51295052      case CPUINFO_PTR_SET_CONTEXT:               info->setcontext = hyperstone_set_context; break;
5130      case CPUINFO_PTR_INIT:                     info->init = hyperstone_init;         break;
5053      case CPUINFO_PTR_INIT:                     info->init = NULL;                  break;
51315054      case CPUINFO_PTR_RESET:                     info->reset = hyperstone_reset;         break;
51325055      case CPUINFO_PTR_EXIT:                     info->exit = hyperstone_exit;         break;
51335056      case CPUINFO_PTR_EXECUTE:                  info->execute = hyperstone_execute;      break;
r1334r1335
52955218      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_4k_iram_map; break;
52965219
52975220      /* --- the following bits of info are returned as pointers to data or functions --- */
5298      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
5221      case CPUINFO_PTR_INIT:                     info->init = e116t_init;               break;
52995222
53005223      /* --- the following bits of info are returned as NULL-terminated strings --- */
53015224      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-16T");            break;
r1334r1335
53185241      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_8k_iram_map; break;
53195242
53205243      /* --- the following bits of info are returned as pointers to data or functions --- */
5321      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
5244      case CPUINFO_PTR_INIT:                     info->init = e116xt_init;               break;
53225245
53235246      /* --- the following bits of info are returned as NULL-terminated strings --- */
53245247      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-16XT");            break;
r1334r1335
53415264      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_16k_iram_map; break;
53425265
53435266      /* --- the following bits of info are returned as pointers to data or functions --- */
5344      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
5267      case CPUINFO_PTR_INIT:                     info->init = e116xs_init;               break;
53455268
53465269      /* --- the following bits of info are returned as NULL-terminated strings --- */
53475270      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-16XS");            break;
r1334r1335
53645287      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_16k_iram_map; break;
53655288
53665289      /* --- the following bits of info are returned as pointers to data or functions --- */
5367      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
5290      case CPUINFO_PTR_INIT:                     info->init = e116xsr_init;               break;
53685291
53695292      /* --- the following bits of info are returned as NULL-terminated strings --- */
53705293      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-16XSR");         break;
r1334r1335
53875310      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break;
53885311
53895312      /* --- the following bits of info are returned as pointers to data or functions --- */
5390      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
5313      case CPUINFO_PTR_INIT:                     info->init = e132n_init;               break;
53915314
53925315      /* --- the following bits of info are returned as NULL-terminated strings --- */
53935316      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32N");            break;
r1334r1335
54105333      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break;
54115334
54125335      /* --- the following bits of info are returned as pointers to data or functions --- */
5413      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
5336      case CPUINFO_PTR_INIT:                     info->init = e132t_init;               break;
54145337
54155338      /* --- the following bits of info are returned as NULL-terminated strings --- */
54165339      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32T");            break;
r1334r1335
54335356      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break;
54345357
54355358      /* --- the following bits of info are returned as pointers to data or functions --- */
5436      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
5359      case CPUINFO_PTR_INIT:                     info->init = e132xn_init;               break;
54375360
54385361      /* --- the following bits of info are returned as NULL-terminated strings --- */
54395362      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32XN");            break;
r1334r1335
54565379      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break;
54575380
54585381      /* --- the following bits of info are returned as pointers to data or functions --- */
5459      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
5382      case CPUINFO_PTR_INIT:                     info->init = e132xt_init;               break;
54605383
54615384      /* --- the following bits of info are returned as NULL-terminated strings --- */
54625385      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32XT");            break;
r1334r1335
54795402      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_16k_iram_map; break;
54805403
54815404      /* --- the following bits of info are returned as pointers to data or functions --- */
5482      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
5405      case CPUINFO_PTR_INIT:                     info->init = e132xs_init;               break;
54835406
54845407      /* --- the following bits of info are returned as NULL-terminated strings --- */
54855408      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32XS");            break;
r1334r1335
55025425      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_16k_iram_map; break;
55035426
55045427      /* --- the following bits of info are returned as pointers to data or functions --- */
5505      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
5428      case CPUINFO_PTR_INIT:                     info->init = e132xsr_init;               break;
55065429
55075430      /* --- the following bits of info are returned as NULL-terminated strings --- */
55085431      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32XSR");         break;
r1334r1335
55255448      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_4k_iram_map; break;
55265449
55275450      /* --- the following bits of info are returned as pointers to data or functions --- */
5528      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
5451      case CPUINFO_PTR_INIT:                     info->init = gms30c2116_init;               break;
55295452
55305453      /* --- the following bits of info are returned as NULL-terminated strings --- */
55315454      case CPUINFO_STR_NAME:                     strcpy(info->s, "GMS30C2116");         break;
r1334r1335
55485471      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_4k_iram_map; break;
55495472
55505473      /* --- the following bits of info are returned as pointers to data or functions --- */
5551      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
5474      case CPUINFO_PTR_INIT:                     info->init = gms30c2132_init;               break;
55525475
55535476      /* --- the following bits of info are returned as NULL-terminated strings --- */
55545477      case CPUINFO_STR_NAME:                     strcpy(info->s, "GMS30C2132");         break;
r1334r1335
55715494      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e116_8k_iram_map; break;
55725495
55735496      /* --- the following bits of info are returned as pointers to data or functions --- */
5574      case CPUINFO_PTR_INIT:                     info->init = e116_init;               break;
5497      case CPUINFO_PTR_INIT:                     info->init = gms30c2216_init;               break;
55755498
55765499      /* --- the following bits of info are returned as NULL-terminated strings --- */
55775500      case CPUINFO_STR_NAME:                     strcpy(info->s, "GMS30C2216");         break;
r1334r1335
55945517      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map = construct_map_e132_8k_iram_map; break;
55955518
55965519      /* --- the following bits of info are returned as pointers to data or functions --- */
5597      case CPUINFO_PTR_INIT:                     info->init = e132_init;               break;
5520      case CPUINFO_PTR_INIT:                     info->init = gms30c2232_init;               break;
55985521
55995522      /* --- the following bits of info are returned as NULL-terminated strings --- */
56005523      case CPUINFO_STR_NAME:                     strcpy(info->s, "GMS30C2232");         break;
src/emu/cpu/e132xs/e132xs.h
r1334r1335
33
44#include "cpuintrf.h"
55
6/*
7    A note about clock multipliers and dividers:
8
9    E1-16[T] and E1-32[T] accept a straight clock
10
11    E1-16X[T|N] and E1-32X[T|N] accept a clock and multiply it
12        internally by 4; in the emulator, you MUST specify 4 * XTAL
13        to achieve the correct speed
14
15    E1-16XS[R] and E1-32XS[R] accept a clock and multiply it
16        internally by 8; in the emulator, you MUST specify 8 * XTAL
17        to achieve the correct speed
18*/
19
20
21
622/* Functions */
723
824#if (HAS_E116T)
r1334r1335
98114#define SR_REGISTER          1
99115#define BCR_REGISTER      20
100116#define TPR_REGISTER      21
117#define TCR_REGISTER      22
118#define TR_REGISTER         23
101119#define ISR_REGISTER      25
102120#define FCR_REGISTER      26
103121#define MCR_REGISTER      27
r1334r1335
127145/* Delay values */
128146#define NO_DELAY      0
129147#define DELAY_EXECUTE   1
130#define DELAY_TAKEN      2
131148
149/* IRQ numbers */
150#define IRQ_INT1      0
151#define IRQ_INT2      1
152#define IRQ_INT3      2
153#define IRQ_INT4      3
154#define IRQ_IO1         4
155#define IRQ_IO2         5
156#define IRQ_IO3         6
157
132158/* Trap numbers */
133159#define IO2               48
134160#define IO1               49
src/emu/cpu/i386/i386.c
r1334r1335
5555   seg->d = (seg->flags & 0x4000) ? 1 : 0;
5656}
5757
58void i386_load_segment_descriptor( int segment )
58static void i386_load_segment_descriptor( int segment )
5959{
6060   if (PROTECTED_MODE)
6161   {
r1334r1335
496496   CHANGE_PC(I.eip);
497497}
498498
499void i386_init(int index, int clock, const void *config, int (*irqcallback)(int))
499static void i386_init(int index, int clock, const void *config, int (*irqcallback)(int))
500500{
501501   int i, j;
502502   static const int regs8[8] = {AL,CL,DL,BL,AH,CH,DH,BH};
r1334r1335
614614   }
615615}
616616
617void i386_reset(void)
617static void i386_reset(void)
618618{
619619   int (*save_irqcallback)(int);
620620
r1334r1335
696696   }
697697}
698698
699int i386_execute(int num_cycles)
699static int i386_execute(int num_cycles)
700700{
701701   I.cycles = num_cycles;
702702   I.base_cycles = num_cycles;
r1334r1335
10671067
10681068#if (HAS_I486)
10691069
1070void i486_init(int index, int clock, const void *config, int (*irqcallback)(int))
1070static void i486_init(int index, int clock, const void *config, int (*irqcallback)(int))
10711071{
10721072   i386_init(index, clock, config, irqcallback);
10731073}
r1334r1335
11731173
11741174#if (HAS_PENTIUM)
11751175
1176void pentium_init(int index, int clock, const void *config, int (*irqcallback)(int))
1176static void pentium_init(int index, int clock, const void *config, int (*irqcallback)(int))
11771177{
11781178   i386_init(index, clock, config, irqcallback);
11791179}
r1334r1335
12991299
13001300#if (HAS_MEDIAGX)
13011301
1302void mediagx_init(int index, int clock, const void *config, int (*irqcallback)(int))
1302static void mediagx_init(int index, int clock, const void *config, int (*irqcallback)(int))
13031303{
13041304   i386_init(index, clock, config, irqcallback);
13051305}
src/emu/cpu/adsp2100/adsp2100.c
r1334r1335
20482048   }
20492049}
20502050
2051void adsp21xx_load_boot_data(UINT8 *srcdata, UINT32 *dstdata)
2051static void adsp21xx_load_boot_data(UINT8 *srcdata, UINT32 *dstdata)
20522052{
20532053   /* see how many words we need to copy */
20542054   int pagelen = (srcdata[(3)] + 1) * 8;
src/emu/cpu/cop400/cop400.h
r1334r1335
3636};
3737
3838extern void cop410_get_info(UINT32 state, cpuinfo *info);
39extern void cop411_get_info(UINT32 state, cpuinfo *info);
3940extern void cop420_get_info(UINT32 state, cpuinfo *info);
4041
4142#ifdef MAME_DEBUG
src/emu/cpu/i8085/i8085.c
r1334r1335
12611261   }
12621262}
12631263
1264int i8085_execute(int cycles)
1264static int i8085_execute(int cycles)
12651265{
12661266
12671267   i8085_ICount = cycles;
r1334r1335
15361536 **************************************************************************/
15371537#if (HAS_8080)
15381538
1539void i8080_init(int index, int clock, const void *config, int (*irqcallback)(int))
1539static void i8080_init(int index, int clock, const void *config, int (*irqcallback)(int))
15401540{
15411541   init_tables();
15421542   I.cputype = 0;
r1334r1335
15581558   state_save_register_item_array("i8080", index, I.irq_state);
15591559}
15601560
1561void i8080_set_irq_line(int irqline, int state)
1561static void i8080_set_irq_line(int irqline, int state)
15621562{
15631563   if (irqline == INPUT_LINE_NMI)
15641564   {
src/emu/cpu/powerpc/ppc403.c
r1334r1335
566566/**************************************************************************/
567567/* PPC403 Serial Port */
568568
569UINT8 ppc403_spu_r(UINT32 a)
569static UINT8 ppc403_spu_r(UINT32 a)
570570{
571571   switch(a & 0xf)
572572   {
r1334r1335
582582   }
583583}
584584
585void ppc403_spu_w(UINT32 a, UINT8 d)
585static void ppc403_spu_w(UINT32 a, UINT8 d)
586586{
587587   switch(a & 0xf)
588588   {
src/emu/cpu/powerpc/ppcdrc.c
r1334r1335
3333static void ppcdrc602_set_irq_line(int irqline, int state);
3434#endif
3535#if (HAS_PPC403)
36UINT8 ppc403_spu_r(UINT32 a);
37void ppc403_spu_w(UINT32 a, UINT8 d);
36static UINT8 ppc403_spu_r(UINT32 a);
37static void ppc403_spu_w(UINT32 a, UINT8 d);
3838static void ppcdrc403_init(int index, int clock, const void *_config, int (*irqcallback)(int));
3939static void ppcdrc403_exit(void);
4040static void ppcdrc403_reset(void);
r1334r1335
10021002
10031003/* Initialization and shutdown */
10041004
1005void ppc_init(void)
1005static void ppc_init(void)
10061006{
10071007   int i,j;
10081008
r1334r1335
19391939   }
19401940}
19411941
1942void ppc_get_info(UINT32 state, cpuinfo *info)
1942static void ppc_get_info(UINT32 state, cpuinfo *info)
19431943{
19441944   switch(state)
19451945   {
r1334r1335
20772077
20782078/* PowerPC 403 */
20792079#if (HAS_PPC403)
2080void ppc403_set_info(UINT32 state, cpuinfo *info)
2080static void ppc403_set_info(UINT32 state, cpuinfo *info)
20812081{
20822082   if (state >= CPUINFO_INT_INPUT_STATE && state <= CPUINFO_INT_INPUT_STATE + 5)
20832083   {
r1334r1335
21152115
21162116/* PowerPC 603 */
21172117#if (HAS_PPC603)
2118void ppc603_set_info(UINT32 state, cpuinfo *info)
2118static void ppc603_set_info(UINT32 state, cpuinfo *info)
21192119{
21202120   if (state >= CPUINFO_INT_INPUT_STATE && state <= CPUINFO_INT_INPUT_STATE + 5)
21212121   {
r1334r1335
21652165
21662166/* PowerPC 602 */
21672167#if (HAS_PPC602)
2168void ppc602_set_info(UINT32 state, cpuinfo *info)
2168static void ppc602_set_info(UINT32 state, cpuinfo *info)
21692169{
21702170   if (state >= CPUINFO_INT_INPUT_STATE && state <= CPUINFO_INT_INPUT_STATE + 5)
21712171   {
src/emu/cpu/z8000/z8000.c
r1334r1335
8484    int (*irq_callback)(int irqline);
8585}   z8000_Regs;
8686
87int z8000_ICount;
87static int z8000_ICount;
8888
8989/* current CPU context */
9090static z8000_Regs Z;
src/emu/cpu/sh2/sh2.c
r1334r1335
28452845   return sh2.m[offset];
28462846}
28472847
2848void sh2_set_frt_input(int cpunum, int state)
2848static void sh2_set_frt_input(int cpunum, int state)
28492849{
28502850   if(state == PULSE_LINE)
28512851   {
src/emu/cpu/tms32051/tms32051.c
r1334r1335
670670}
671671
672672#if (HAS_TMS32051)
673void tms32051_set_info(UINT32 state, cpuinfo *info)
673static void tms32051_set_info(UINT32 state, cpuinfo *info)
674674{
675675   if (state >= CPUINFO_INT_INPUT_STATE && state <= CPUINFO_INT_INPUT_STATE + 5)
676676   {
src/emu/cpu/tms32051/dis32051.c
r1334r1335
127127   return buffer;
128128}
129129
130void dasm_group_be(UINT16 opcode)
130static void dasm_group_be(UINT16 opcode)
131131{
132132   int subop = opcode & 0xff;
133133
src/emu/cpu/sh4/sh4.c
r1334r1335
39443944   return sh4.m[offset];
39453945}
39463946
3947void sh4_set_frt_input(int cpunum, int state)
3947static void sh4_set_frt_input(int cpunum, int state)
39483948{
39493949   if(state == PULSE_LINE)
39503950   {
r1334r1335
39843984   cpuintrf_pop_context();
39853985}
39863986
3987void sh4_set_irln_input(int cpunum, int value)
3987static void sh4_set_irln_input(int cpunum, int value)
39883988{
39893989   if (sh4.irln == value)
39903990      return;
r1334r1335
42214221
42224222}
42234223
4224void sh4_dma_ddt(struct sh4_ddt_dma *s)
4224static void sh4_dma_ddt(struct sh4_ddt_dma *s)
42254225{
42264226UINT32 chcr;
42274227UINT32 *p32bits;
src/emu/cpu/alph8201/alph8201.c
r1334r1335
184184}   s_opcode;
185185
186186static ALPHA8201_Regs R;
187int      ALPHA8201_ICount;
187static int      ALPHA8201_ICount;
188188static int    inst_cycles;
189189
190190#define intRAM   R.RAM
src/emu/cpu/nec/nec.c
r1334r1335
11451145
11461146/* Wrappers for the different CPU types */
11471147#if (HAS_V20||HAS_V25)
1148void v20_init(int index, int clock, const void *config, int (*irqcallback)(int))
1148static void v20_init(int index, int clock, const void *config, int (*irqcallback)(int))
11491149{
11501150   nec_init(index, clock, config, irqcallback, 0);
11511151   configure_memory_8bit();
11521152}
1153int v20_execute(int cycles)
1153static int v20_execute(int cycles)
11541154{
11551155   nec_ICount=cycles;
11561156   chip_type=V20;
r1334r1335
11771177#endif
11781178
11791179#if (HAS_V30||HAS_V35)
1180void v30_init(int index, int clock, const void *config, int (*irqcallback)(int))
1180static void v30_init(int index, int clock, const void *config, int (*irqcallback)(int))
11811181{
11821182   nec_init(index, clock, config, irqcallback, 1);
11831183   configure_memory_16bit();
11841184}
1185int v30_execute(int cycles) {
1185static int v30_execute(int cycles) {
11861186   nec_ICount=cycles;
11871187   chip_type=V30;
11881188
r1334r1335
12081208#endif
12091209
12101210#if (HAS_V33)
1211void v33_init(int index, int clock, const void *config, int (*irqcallback)(int))
1211static void v33_init(int index, int clock, const void *config, int (*irqcallback)(int))
12121212{
12131213   nec_init(index, clock, config, irqcallback, 2);
12141214   configure_memory_16bit();
12151215}
1216int v33_execute(int cycles)
1216static int v33_execute(int cycles)
12171217{
12181218   nec_ICount=cycles;
12191219   chip_type=V33;
r1334r1335
13011301 * Generic get_info
13021302 **************************************************************************/
13031303
1304void nec_get_info(UINT32 state, cpuinfo *info)
1304static void nec_get_info(UINT32 state, cpuinfo *info)
13051305{
13061306   int flags;
13071307
src/emu/cpu/mips/mips3drc.c
r1334r1335
550550}
551551
552552
553void mips3_get_info(UINT32 state, cpuinfo *info)
553static void mips3_get_info(UINT32 state, cpuinfo *info)
554554{
555555   switch (state)
556556   {
src/emu/cpu/f8/f8.c
r1334r1335
5656    int     irq_request;
5757}   f8_Regs;
5858
59int f8_icount;
59static int f8_icount;
6060
6161static f8_Regs f8;
6262
r1334r1335
15311531   f8.is = (f8.is & 0x38) | ((f8.is - 1) & 0x07);
15321532}
15331533
1534void f8_reset(void)
1534static void f8_reset(void)
15351535{
15361536   UINT8 data;
15371537   int i;
r1334r1335
15701570}
15711571
15721572/* Execute cycles - returns number of cycles actually run */
1573int f8_execute(int cycles)
1573static int f8_execute(int cycles)
15741574{
15751575    f8_icount = cycles;
15761576
src/emu/cpu/v810/v810.c
r1334r1335
945945   /* 0x3f */ opOUTW     // out.w reg2, disp16[reg1]     6b
946946};
947947
948void v810_init(int index, int clock, const void *config, int (*irqcallback)(int))
948static void v810_init(int index, int clock, const void *config, int (*irqcallback)(int))
949949{
950950   v810.irq_line = CLEAR_LINE;
951951   v810.nmi_line = CLEAR_LINE;
r1334r1335
958958
959959}
960960
961void v810_reset(void)
961static void v810_reset(void)
962962{
963963   int i;
964964   for(i=0;i<64;i++)   v810.reg[i]=0;
r1334r1335
967967   ECR   = 0x0000fff0;
968968}
969969
970int v810_execute(int cycles)
970static int v810_execute(int cycles)
971971{
972972   v810_ICount = cycles;
973973   while(v810_ICount>=0)
r1334r1335
981981   return cycles-v810_ICount;
982982}
983983
984void v810_get_context(void *dst)
984static void v810_get_context(void *dst)
985985{
986986   if(dst)
987987      *(v810info *)dst = v810;
988988}
989989
990void v810_set_context(void *src)
990static void v810_set_context(void *src)
991991{
992992   if(src)
993993      v810 = *(v810info *)src;
src/emu/cpu/tms32025/tms32025.c
r1334r1335
130130#endif
131131
132132
133UINT16 *tms32025_pgmmap[0x200];
134UINT16 *tms32025_datamap[0x200];
133static UINT16 *tms32025_pgmmap[0x200];
134static UINT16 *tms32025_datamap[0x200];
135135
136136#define SET_PC(x)   do { R.PC = (x); change_pc(R.PC<<1); } while (0)
137137
src/emu/cpu/pic16c5x/pic16c5x.c
r1334r1335
10781078 *  PIC16C54 Reset
10791079 ****************************************************************************/
10801080
1081void pic16C54_reset(void)
1081static void pic16C54_reset(void)
10821082{
10831083   picmodel = 0x16C54;
10841084   picRAMmask = 0x1f;
r1334r1335
11301130 *  PIC16C55 Reset
11311131 ****************************************************************************/
11321132
1133void pic16C55_reset(void)
1133static void pic16C55_reset(void)
11341134{
11351135   picmodel = 0x16C55;
11361136   picRAMmask = 0x1f;
r1334r1335
11821182 *  PIC16C56 Reset
11831183 ****************************************************************************/
11841184
1185void pic16C56_reset(void)
1185static void pic16C56_reset(void)
11861186{
11871187   picmodel = 0x16C56;
11881188   picRAMmask = 0x1f;
r1334r1335
12391239 *  PIC16C57 Reset
12401240 ****************************************************************************/
12411241
1242void pic16C57_reset(void)
1242static void pic16C57_reset(void)
12431243{
12441244   picmodel = 0x16C57;
12451245   picRAMmask = 0x7f;
r1334r1335
12971297 *  PIC16C58 Reset
12981298 ****************************************************************************/
12991299
1300void pic16C58_reset(void)
1300static void pic16C58_reset(void)
13011301{
13021302   picmodel = 0x16C58;
13031303   picRAMmask = 0x7f;
src/emu/cpu/t11/t11dasm.c
r1334r1335
1717
1818#define PARAM_WORD(v)   ((v) = rombase[pc - pcbase] | (rombase[pc + 1 - pcbase] << 8), pc += 2)
1919
20unsigned MakeEA (char **ea, int lo, unsigned pc, int width)
20static unsigned MakeEA (char **ea, int lo, unsigned pc, int width)
2121{
2222   char *buffer = cpuintrf_temp_str();
2323   int reg, pm;
src/emu/cpu/m6800/m6800.c
r1334r1335
12991299 * M6803 almost (fully?) equal to the M6801
13001300 ****************************************************************************/
13011301#if (HAS_M6803)
1302void m6803_init(int index, int clock, const void *config, int (*irqcallback)(int))
1302static void m6803_init(int index, int clock, const void *config, int (*irqcallback)(int))
13031303{
13041304//  m6800.subtype = SUBTYPE_M6803;
13051305   m6800.insn = m6803_insn;
src/emu/cpu/cp1610/cp1610.c
r1334r1335
15451545   cp1610_icount -= 8;
15461546}
15471547
1548void cp1610_reset(void)
1548static void cp1610_reset(void)
15491549{
15501550   /* This is how we set the reset vector */
15511551   cpunum_set_input_line(cpu_getactivecpu(), CP1610_RESET, PULSE_LINE);
r1334r1335
21572157}
21582158
21592159/* Execute cycles - returns number of cycles actually run */
2160int cp1610_execute(int cycles)
2160static int cp1610_execute(int cycles)
21612161{
21622162   UINT16 opcode;
21632163
r1334r1335
33823382      cp1610 = *(cp1610_Regs *) src;
33833383}
33843384
3385void cp1610_init(int index, int clock, const void *config, int (*irqcallback)(int))
3385static void cp1610_init(int index, int clock, const void *config, int (*irqcallback)(int))
33863386{
33873387   cp1610.intr_enabled = 0;
33883388   cp1610.reset_pending = 0;
src/emu/cpu/saturn/saturn.c
r1334r1335
153153   saturn.pending_irq = 0;
154154}
155155
156int saturn_execute(int cycles)
156static int saturn_execute(int cycles)
157157{
158158   saturn_ICount = cycles;
159159
r1334r1335
195195   return cycles - saturn_ICount;
196196}
197197
198#ifdef UNUSED_FUNCTION
198199void saturn_set_nmi_line(int state)
199200{
200201   if (saturn.nmi_state == state) return;
r1334r1335
225226{
226227   saturn.irq_callback = callback;
227228}
229#endif
228230
229231#if 0
230232static void saturn_state_save(void *file)
src/emu/cpu/i8x41/i8x41.c
r1334r1335
111111   int    (*irq_callback)(int irqline);
112112}   I8X41;
113113
114int i8x41_ICount;
114static int i8x41_ICount;
115115
116116static I8X41 i8x41;
117117
src/emu/cpu/konami/konami.c
r1334r1335
167167   }
168168
169169/* public globals */
170int konami_ICount=50000;
171int konami_Flags;   /* flags for speed optimization (obsolete!!) */
170static int konami_ICount=50000;
171//int konami_Flags; /* flags for speed optimization (obsolete!!) */
172172
173173/* these are re-defined in konami.h TO RAM, ROM or functions in memory.c */
174174#define RM(Addr)         KONAMI_RDMEM(Addr)
src/emu/uitext.c
r1334r1335
1818#endif /* MESS */
1919
2020
21lang_struct lang;
21static lang_struct lang;
2222
2323/* All entries in this table must match the enum ordering in "uitext.h" */
2424static const char *mame_default_text[] =
src/emu/uimenu.c
r1334r1335
531531    bottom
532532-------------------------------------------------*/
533533
534void ui_menu_draw_text_box(const char *text)
534static void ui_menu_draw_text_box(const char *text)
535535{
536536   const char *priortext = ui_getstring(UI_returntoprior);
537537   float line_height = ui_get_line_height();
src/emu/mame.c
r1334r1335
10731073    appropriate callback
10741074-------------------------------------------------*/
10751075
1076#ifdef UNUSED_FUNCTION
10761077void mame_printf_log(const char *format, ...)
10771078{
10781079   va_list argptr;
r1334r1335
10891090   (*output_cb[OUTPUT_CHANNEL_LOG])(output_cb_param[OUTPUT_CHANNEL_LOG], format, argptr);
10901091   va_end(argptr);
10911092}
1093#endif
10921094
10931095
10941096
src/emu/machine/tmp68301.c
r1334r1335
6161   }
6262}
6363
64void tmp68301_update_timer( int i )
64static void tmp68301_update_timer( int i )
6565{
6666   UINT16 TCR   =   tmp68301_regs[(0x200 + i * 0x20)/2];
6767   UINT16 MAX1   =   tmp68301_regs[(0x204 + i * 0x20)/2];
src/emu/mame.h
r1334r1335
186186/* fix me - some games try to modify remapped_colortable directly */
187187/* search for "palette hack" to find instances */
188188   const pen_t *         pens;            /* remapped palette pen numbers */
189   struct _colortable_t *   colortable;         /* global colortable for remapping */
189190   const UINT16 *         game_colortable;   /* lookup table used to map gfx pen numbers to color numbers */
190191   const pen_t *         remapped_colortable;/* the above, already remapped through Machine->pens */
191192   pen_t *               shadow_table;      /* table for looking up a shadowed pen */
src/emu/sound/iremga20.c
r1334r1335
5656   struct IremGA20_channel_def channel[4];
5757};
5858
59void IremGA20_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
59static void IremGA20_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
6060{
6161   struct IremGA20_chip_def *chip = param;
6262   UINT32 rate[4], pos[4], frac[4], end[4], vol[4], play[4];
src/emu/sound/qsound.c
r1334r1335
9191};
9292
9393/* Function prototypes */
94void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length );
95void qsound_set_command(struct qsound_info *chip, int data, int value);
94static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length );
95static void qsound_set_command(struct qsound_info *chip, int data, int value);
9696
9797static void *qsound_start(int sndindex, int clock, const void *config)
9898{
r1334r1335
198198   return 0x80;
199199}
200200
201void qsound_set_command(struct qsound_info *chip, int data, int value)
201static void qsound_set_command(struct qsound_info *chip, int data, int value)
202202{
203203   int ch=0,reg=0;
204204   if (data < 0x80)
r1334r1335
313313}
314314
315315
316void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
316static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
317317{
318318   struct qsound_info *chip = param;
319319   int i,j;
src/emu/sound/3812intf.h
r1334r1335
2525/* YM3812 */
2626READ8_HANDLER ( YM3812_status_port_0_r );
2727WRITE8_HANDLER( YM3812_control_port_0_w );
28READ8_HANDLER( YM3812_read_port_0_r );
2829WRITE8_HANDLER( YM3812_write_port_0_w );
2930
3031READ8_HANDLER ( YM3812_status_port_1_r );
3132WRITE8_HANDLER( YM3812_control_port_1_w );
33READ8_HANDLER( YM3812_read_port_1_r );
3234WRITE8_HANDLER( YM3812_write_port_1_w );
3335
3436
3537/* YM3526 */
3638READ8_HANDLER ( YM3526_status_port_0_r );
3739WRITE8_HANDLER( YM3526_control_port_0_w );
40READ8_HANDLER( YM3526_read_port_0_r );
3841WRITE8_HANDLER( YM3526_write_port_0_w );
3942
4043READ8_HANDLER ( YM3526_status_port_1_r );
4144WRITE8_HANDLER( YM3526_control_port_1_w );
45READ8_HANDLER( YM3526_read_port_1_r );
4246WRITE8_HANDLER( YM3526_write_port_1_w );
4347
4448
src/emu/sound/ymz280b.c
r1334r1335
707707
708708***********************************************************************************************/
709709
710#ifdef UNUSED_FUNCTION
710711void YMZ280B_sh_stop(void)
711712{
712713#if MAKE_WAVS
r1334r1335
721722}
722723#endif
723724}
725#endif
724726
725727
726728
src/emu/sound/astrocde.c
r1334r1335
287287 *
288288 *************************************/
289289
290void astrocade_sound_w(UINT8 num, offs_t offset, UINT8 data)
290static void astrocade_sound_w(UINT8 num, offs_t offset, UINT8 data)
291291{
292292   struct astrocade_info *chip = sndti_token(SOUND_ASTROCADE, num);
293293
src/emu/sound/pokey.c
r1334r1335
551551#endif
552552
553553
554void pokey_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
554static void pokey_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
555555{
556556   struct POKEYregisters *chip = param;
557557   stream_sample_t *buffer = _buffer[0];
r1334r1335
10371037}
10381038
10391039
1040void pokey_register_w(int chip, int offs, int data)
1040static void pokey_register_w(int chip, int offs, int data)
10411041{
10421042   struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip);
10431043   int ch_mask = 0, new_val;
r1334r1335
14731473   timer_set_ptr(attotime_mul(p->clock_period, after), p, pokey_serin_ready);
14741474}
14751475
1476void pokey_break_w(int chip, int shift)
1476static void pokey_break_w(int chip, int shift)
14771477{
14781478   struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip);
14791479    if( shift )                     /* shift code ? */
r1334r1335
15101510   pokey_break_w(3, shift);
15111511}
15121512
1513void pokey_kbcode_w(int chip, int kbcode, int make)
1513static void pokey_kbcode_w(int chip, int kbcode, int make)
15141514{
15151515   struct POKEYregisters *p = sndti_token(SOUND_POKEY, chip);
15161516    /* make code ? */
src/emu/sound/tms36xx.c
r1334r1335
447447   tms->tune_max = note + 1;
448448}
449449
450void tms3617_enable(struct TMS36XX *tms, int enable)
450static void tms3617_enable(struct TMS36XX *tms, int enable)
451451{
452452   int i, bits = 0;
453453
src/emu/sound/scsp.c
r1334r1335
13701370   cpunum_set_input_line(2,dma_transfer_end,HOLD_LINE);
13711371}
13721372
1373#ifdef UNUSED_FUNCTION
13731374int SCSP_IRQCB(void *param)
13741375{
13751376   CheckPendingIRQ(param);
13761377   return -1;
13771378}
1379#endif
13781380
13791381static void SCSP_Update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int samples)
13801382{
src/emu/sound/msm5232.c
r1334r1335
665665#endif
666666
667667
668void MSM5232_update_one(void *param, stream_sample_t **inputs, stream_sample_t** buffer, int samples)
668static void MSM5232_update_one(void *param, stream_sample_t **inputs, stream_sample_t** buffer, int samples)
669669{
670670   MSM5232 * chip = param;
671671   stream_sample_t *buf1 = buffer[0];
src/emu/sound/ics2115.c
r1334r1335
526526   //  if (ICS2115LOGERROR) logerror("ICS2115: wi %d, %02x (%04x)\n", offset, data, caller_get_pc());
527527}
528528
529void ics2115_reset(void *_chip)
529static void ics2115_reset(void *_chip)
530530{
531531   struct ics2115 *chip = _chip;
532532   chip->irq_en = 0;
src/emu/sound/s14001a.c
r1334r1335
289289#endif
290290}
291291
292void s14001a_clock(S14001AChip *chip) /* called once per clock */
292static void s14001a_clock(S14001AChip *chip) /* called once per clock */
293293{
294294   UINT8 CurDelta; // Current delta
295295
src/emu/sound/k053260.c
r1334r1335
9494#define MAXOUT 0x7fff
9595#define MINOUT -0x8000
9696
97void K053260_update( void * param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) {
97static void K053260_update( void * param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) {
9898   static long dpcmcnv[] = { 0,1,2,4,8,16,32,64, -128, -64, -32, -16, -8, -4, -2, -1};
9999
100100   int i, j, lvol[4], rvol[4], play[4], loop[4], ppcm_data[4], ppcm[4];
r1334r1335
250250#endif
251251}
252252
253void K053260_write( int chip, offs_t offset, UINT8 data )
253static void K053260_write( int chip, offs_t offset, UINT8 data )
254254{
255255   int i, t;
256256   int r = offset;
r1334r1335
367367   }
368368}
369369
370UINT8 K053260_read( int chip, offs_t offset )
370static UINT8 K053260_read( int chip, offs_t offset )
371371{
372372   struct K053260_chip_def *ic = sndti_token(SOUND_K053260, chip);
373373
src/emu/sound/nes_apu.c
r1334r1335
657657WRITE8_HANDLER( NESPSG_1_w ) {apu_write(1,offset,data);}
658658
659659/* UPDATE APU SYSTEM */
660void NESPSG_update_sound(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
660static void NESPSG_update_sound(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
661661{
662662  struct nesapu_info *info = param;
663663  apu_update(info, buffer[0], length);
src/emu/sndintrf.c
r1334r1335
6767    EXTERNAL PROTOTYPES
6868***************************************************************************/
6969
70void dummy_sound_get_info(void *token, UINT32 state, sndinfo *info);
70static void dummy_sound_get_info(void *token, UINT32 state, sndinfo *info);
7171void custom_get_info(void *token, UINT32 state, sndinfo *info);
7272void samples_get_info(void *token, UINT32 state, sndinfo *info);
7373void dac_get_info(void *token, UINT32 state, sndinfo *info);
r1334r1335
945945}
946946
947947
948void dummy_sound_get_info(void *token, UINT32 state, sndinfo *info)
948static void dummy_sound_get_info(void *token, UINT32 state, sndinfo *info)
949949{
950950   switch (state)
951951   {
src/emu/clifront.c
r1334r1335
6767    COMMAND-LINE OPTIONS
6868***************************************************************************/
6969
70const options_entry cli_options[] =
70static const options_entry cli_options[] =
7171{
7272   /* core commands */
7373   { NULL,                       NULL,       OPTION_HEADER,     "CORE COMMANDS" },
src/emu/emupal.c
r1334r1335
5959};
6060
6161
62/* typedef struct _colortable colortable; */
63struct _colortable
62/* typedef struct _colortable_t colortable_t; */
63struct _colortable_t
6464{
6565   running_machine *   machine;         /* associated machine */
6666   UINT32            entries;         /* number of entries */
r1334r1335
365365    with the given number of entries
366366-------------------------------------------------*/
367367
368colortable *colortable_alloc(running_machine *machine, UINT32 palettesize)
368colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize)
369369{
370   colortable *ctable;
370   colortable_t *ctable;
371371   UINT32 index;
372372
373373   /* allocate the colortable */
r1334r1335
400400    of a colortable entry
401401-------------------------------------------------*/
402402
403void colortable_entry_set_value(colortable *ctable, UINT32 entry, UINT16 value)
403void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value)
404404{
405405   /* ensure values are within range */
406406   assert(entry < ctable->entries);
r1334r1335
420420    of a colortable entry
421421-------------------------------------------------*/
422422
423UINT16 colortable_entry_get_value(colortable *ctable, UINT32 entry)
423UINT16 colortable_entry_get_value(colortable_t *ctable, UINT32 entry)
424424{
425425   assert(entry < ctable->entries);
426426   return ctable->raw[entry];
r1334r1335
432432    color of a colortable palette entry
433433-------------------------------------------------*/
434434
435void colortable_palette_set_color(colortable *ctable, UINT32 entry, rgb_t color)
435void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t color)
436436{
437437   /* ensure values are within range */
438438   assert(entry < ctable->palentries);
r1334r1335
460460    of a colortable palette entry
461461-------------------------------------------------*/
462462
463rgb_t colortable_palette_get_color(colortable *ctable, UINT32 entry)
463rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry)
464464{
465465   assert(entry < ctable->palentries);
466466   return ctable->palette[entry];
r1334r1335
473473    color
474474-------------------------------------------------*/
475475
476UINT32 colortable_get_transpen_mask(colortable *ctable, const gfx_element *gfx, int color, int transcolor)
476UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx, int color, int transcolor)
477477{
478478   UINT32 entry = gfx->color_base + (color % gfx->total_colors) * gfx->color_granularity;
479479   UINT32 mask = 0;
r1334r1335
503503    (each group maps to a gfx color)
504504-------------------------------------------------*/
505505
506void colortable_configure_tilemap_groups(colortable *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor)
506void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor)
507507{
508508   int color;
509509
src/emu/emupal.h
r1334r1335
112112    TYPE DEFINITIONS
113113***************************************************************************/
114114
115typedef struct _colortable colortable;
115typedef struct _colortable_t colortable_t;
116116
117117
118118
r1334r1335
154154/* ----- colortable management ----- */
155155
156156/* allocate a new colortable with the given number of entries */
157colortable *colortable_alloc(running_machine *machine, UINT32 palettesize);
157colortable_t *colortable_alloc(running_machine *machine, UINT32 palettesize);
158158
159159/* set the value of a colortable entry */
160void colortable_entry_set_value(colortable *ctable, UINT32 entry, UINT16 value);
160void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value);
161161
162162/* return the value of a colortable entry */
163UINT16 colortable_entry_get_value(colortable *ctable, UINT32 entry);
163UINT16 colortable_entry_get_value(colortable_t *ctable, UINT32 entry);
164164
165165/* change the color of a colortable palette entry */
166void colortable_palette_set_color(colortable *ctable, UINT32 entry, rgb_t color);
166void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t color);
167167
168168/* return the color of a colortable palette entry */
169rgb_t colortable_palette_get_color(colortable *ctable, UINT32 entry);
169rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry);
170170
171171/* return a 32-bit transparency mask for a given gfx element and color */
172UINT32 colortable_get_transpen_mask(colortable *ctable, const gfx_element *gfx, int color, int transcolor);
172UINT32 colortable_get_transpen_mask(colortable_t *ctable, const gfx_element *gfx, int color, int transcolor);
173173
174174/* configure groups in a tilemap to represent transparency based on colortable entries (each group maps to a gfx color) */
175void colortable_configure_tilemap_groups(colortable *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor);
175void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap *tmap, const gfx_element *gfx, int transcolor);
176176
177177
178178
src/lib/util/chd.c
r1334r1335
835835    filename
836836-------------------------------------------------*/
837837
838#ifdef UNUSED_FUNCTION
838839void chd_multi_filename(const char *origname, char *finalname, int index)
839840{
840841   char *extension;
r1334r1335
856857      findex[2] = 'h';
857858   strcpy(extension, findex);
858859}
860#endif
859861
860862
861863
src/mess/drivers/astrocde.c
r1334r1335
4646
4747static WRITE8_HANDLER( astrocade_soundblock1_w )
4848{
49   extern void astrocade_sound_w(UINT8 num, offs_t offset, UINT8 data);
50   astrocade_sound_w(0, (offset>>8)&7, data);
49   astrocade_sound1_w(offset + 0x18, data);
5150}
5251
5352ADDRESS_MAP_START( astrocade_mem, ADDRESS_SPACE_PROGRAM, 8 )
docs/messnew.txt
r1334r1335
2626
2727Source Changes:
2828----------------
29(none)
29- The core is based on MAME 0.121u1.  This incorporates all features of the
30  update to this core.  [MAME team]
3031
3132
3233
makefile
r1334r1335
9191# uncomment one of the next lines to build a target-optimized build
9292# NATIVE = 1
9393# ATHLON = 1
94# AMD64 = 1
9495# I686 = 1
9596# P4 = 1
9697# PM = 1
97# AMD64 = 1
98# CORE2 = 1
9899# G4 = 1
99100# G5 = 1
100101# CELL = 1
r1334r1335
198199ARCH = -march=athlon
199200endif
200201
202ifdef AMD64
203SUFFIX = 64
204ARCH = -march=athlon64
205endif
206
201207ifdef I686
202208SUFFIX = pp
203209ARCH = -march=pentiumpro
r1334r1335
208214ARCH = -march=pentium4
209215endif
210216
211ifdef AMD64
212SUFFIX = 64
213ARCH = -march=athlon64
214endif
215
216217ifdef PM
217218SUFFIX = pm
218ARCH = -march=pentium3 -msse2
219ARCH = -march=pentium-m
219220endif
220221
222ifdef CORE2
223SUFFIX = c2
224ARCH = -march=pentium-m -msse3
225endif
226
221227ifdef G4
222228SUFFIX = g4
223229ARCH = -mcpu=G4
r1334r1335
237243endif
238244
239245
246
240247#-------------------------------------------------
241248# form the name of the executable
242249#-------------------------------------------------

Previous 15994 Revisions Next


© 1998-2018 The MESS Team