Previous 15994 Revisions Next

r10614 Monday 28th February, 2011 at 13:24:31 UTC by Miodrag Milanović
Update to MAME 0.141u3
[src/emu]attotime.h audit.h fileio.c fileio.h hash.c hash.h info.c inptport.c rendlay.h romload.c screen.h softlist.c video.c
[src/emu/cpu/i386]i386priv.h
[src/emu/cpu/m68000]m68k_in.c m68kfpu.c
[src/emu/imagedev]multcart.c
[src/emu/machine]secflash.h x76f041.c x76f100.c
[src/emu/sound]aica.c bsmt2000.c okiadpcm.c okiadpcm.h okim9810.c okim9810.h rf5c68.c sn76496.c spu.c spu.h spu_tables.c spureverb.c spureverb.h
[src/emu/video]generic.c
[src/lib/util]cdrom.h
[src/mame]mame.mak mamedriv.c
[src/mame/audio]spacefb.c
[src/mame/drivers]ace.c armedf.c astrocde.c atarifb.c atarig42.c atetris.c bartop52.c blockade.c btime.c bwing.c by17.c by35.c cd32.c cham24.c cinemat.c circus.c cischeat.c clshroad.c compgolf.c cosmic.c csplayh5.c cyclemb.c ddragon3.c de_3.c de_3b.c deco_ld.c destroyr.c dooyong.c dynax.c exidy.c exidy440.c fantland.c firetrk.c fromanc2.c galpanic.c ghosteo.c goldnpkr.c gomoku.c gottlieb.c gunpey.c halleys.c hornet.c hyhoo.c igs011.c jchan.c jollyjgr.c kaneko16.c ksys573.c lgp.c m90.c magmax.c mainsnk.c mastboy.c mcr68.c megatech.c mlanding.c monzagp.c mpu4.c mpu4drvr.c multigam.c namcos10.c naomi.c nbmj8688.c nbmj8891.c nbmj8900.c nbmj8991.c nbmj9195.c niyanpai.c nss.c pangofun.c pastelg.c pcat_dyn.c pgm.c pingpong.c pirates.c playch10.c polepos.c popeye.c punchout.c roul.c segac2.c seta2.c sfbonus.c sigmab98.c snesb.c snowbros.c spacefb.c srmp2.c ssfindo.c subsino.c suprnova.c taito_f2.c terracre.c tickee.c toaplan1.c triplhnt.c tubep.c upscope.c vcombat.c victory.c vsnes.c warpwarp.c white_mod.c whitestar.c williams.c wiping.c xtheball.c
[src/mame/etc]jrcrypt.c
[src/mame/includes]atarig42.h clshroad.h dkong.h dooyong.h exidy.h exidy440.h gatron.h gomoku.h hyhoo.h m90.h magmax.h megadriv.h micro3d.h nbmj8688.h nbmj8891.h nbmj8900.h nbmj8991.h nbmj9195.h niyanpai.h pastelg.h pgm.h pingpong.h pirates.h playch10.h pokechmp.h popeye.h punchout.h segas32.h seta2.h shootout.h spacefb.h terracre.h triplhnt.h tubep.h victory.h vigilant.h vsnes.h warpwarp.h williams.h wiping.h xorworld.h
[src/mame/layout]blockade.lay geebee.lay navarone.lay* outrun.lay
[src/mame/machine]archimds.c dec0.c md_cart.c megadriv.c naomibd.c pgmcrypt.c playch10.c psx.c scramble.c vsnes.c williams.c zs01.c
[src/mame/video]20pacgal.c amiga.c argus.c cischeat.c clshroad.c crgolf.c dkong.c exidy.c exidy440.c gatron.c gomoku.c hyhoo.c m90.c magmax.c nbmj8688.c nbmj8891.c nbmj8900.c nbmj8991.c nbmj9195.c niyanpai.c pacman.c pastelg.c pingpong.c pirates.c playch10.c pokechmp.c popeye.c punchout.c redalert.c segas32.c seta2.c shootout.c spacefb.c taito_b.c terracre.c triplhnt.c tubep.c victory.c vigilant.c warpwarp.c williams.c wiping.c xorworld.c
[src/osd/sdl]drawogl.c drawsdl.c window.h
[src/tools]chdcd.c

src/mame/audio/spacefb.c
r10613r10614
1111#include "includes/spacefb.h"
1212
1313
14
15static UINT8 spacefb_sound_latch;
16
17
18
1914READ8_HANDLER( spacefb_audio_p2_r )
2015{
21   return (spacefb_sound_latch & 0x18) << 1;
16   spacefb_state *state = space->machine->driver_data<spacefb_state>();
17   return (state->sound_latch & 0x18) << 1;
2218}
2319
2420
2521READ8_HANDLER( spacefb_audio_t0_r )
2622{
27   return spacefb_sound_latch & 0x20;
23   spacefb_state *state = space->machine->driver_data<spacefb_state>();
24   return state->sound_latch & 0x20;
2825}
2926
3027
3128READ8_HANDLER( spacefb_audio_t1_r )
3229{
33   return spacefb_sound_latch & 0x04;
30   spacefb_state *state = space->machine->driver_data<spacefb_state>();
31   return state->sound_latch & 0x04;
3432}
3533
3634
3735WRITE8_HANDLER( spacefb_port_1_w )
3836{
37   spacefb_state *state = space->machine->driver_data<spacefb_state>();
3938   device_t *samples = space->machine->device("samples");
4039
4140   cputag_set_input_line(space->machine, "audiocpu", 0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
4241
4342   /* enemy killed */
44   if (!(data & 0x01) && (spacefb_sound_latch & 0x01))  sample_start(samples, 0,0,0);
43   if (!(data & 0x01) && (state->sound_latch & 0x01))  sample_start(samples, 0,0,0);
4544
4645   /* ship fire */
47   if (!(data & 0x40) && (spacefb_sound_latch & 0x40))  sample_start(samples, 1,1,0);
46   if (!(data & 0x40) && (state->sound_latch & 0x40))  sample_start(samples, 1,1,0);
4847
4948   /*
5049     *  Explosion Noise
r10613r10614
5453     *  Fortunately it seems like the recorded sample of the spaceship death is the longest the sample plays for.
5554     *  We loop it just in case it runs out
5655     */
57   if ((data & 0x80) != (spacefb_sound_latch & 0x80))
56   if ((data & 0x80) != (state->sound_latch & 0x80))
5857   {
5958      if (data & 0x80)
6059         /* play decaying noise */
r10613r10614
6463         sample_start(samples, 2,2,1);
6564   }
6665
67   spacefb_sound_latch = data;
66   state->sound_latch = data;
6867}
6968
7069
src/mame/machine/md_cart.c
r10613r10614
198198
199199   if ((state->md_cart.ssf2_lastoff != offset) || (state->md_cart.ssf2_lastdata != data))
200200   {
201      state->md_cart.ssf2_lastoff = offset;
201      state->md_cart.ssf2_lastoff = offset;
202202      state->md_cart.ssf2_lastdata = data;
203203      switch (offset << 1)
204204      {
r10613r10614
13011301   switch (state->md_cart.type)
13021302   {
13031303      // These types only come from xml
1304      // TODO: Eventually megadriv_backupram should point to the allocated cart:sram region!
1304      // TODO: Eventually megadriv_backupram should point to the allocated cart:sram region!
13051305      // For now, we only use the region as a placeholder to carry size info...
13061306      case SEGA_SRAM:
13071307         state->md_cart.sram_start = 0x200000;
src/mame/machine/playch10.c
r10613r10614
55#include "includes/playch10.h"
66
77/* prototypes */
8static void pc10_set_mirroring( int mirroring );
8static void pc10_set_mirroring( playch10_state *state, int mirroring );
99static WRITE8_HANDLER( pc10_nt_w );
1010static READ8_HANDLER( pc10_nt_r );
1111static WRITE8_HANDLER( pc10_chr_w );
r10613r10614
1313static void pc10_set_videorom_bank( running_machine *machine, int first, int count, int bank, int size );
1414static void set_videoram_bank( running_machine *machine, int first, int count, int bank, int size );
1515
16typedef struct
17{
18   int writable;   // 1 for RAM, 0 for ROM
19   UINT8* chr;      // direct access to the memory
20} chr_bank;
2116
22
23/* Globals */
24int pc10_sdcs;         /* ShareD Chip Select */
25int pc10_dispmask;      /* Display Mask */
26int pc10_nmi_enable;   /* nmi enable */
27int pc10_dog_di;      /* watchdog disable */
28int pc10_int_detect;   /* interrupt detect */
29static int pc10_gun_controller;
30int pc10_game_mode;      /* Used in Single monitor version to display Game or PPU */
31int pc10_dispmask_old;
32
33/* Locals */
34static int cart_sel;
35static int cntrl_mask;
36static int input_latch[2];
37static int mirroring;
38
39static int MMC2_bank[4], MMC2_bank_latch[2];
40
41static UINT8* vrom;            // used for games with cart gfx loaded (a,c,e,f,g,h)
42static UINT8* vram = NULL;      // used for boards h, b, d, i, k (Presumably, 8K. 16K didn't work in MESS)
43static UINT8* nametable[4];      // For non-mirroring boards, this can be moved to a direct mapping
44static UINT8* nt_ram = NULL;   // Per-board size! Some boards clearly need 4K. Some MAY use 2K. Research needed.
45static chr_bank chr_page[8];   // Simple wrapper for ROM/RAM, since we could be banking either (Hboard)
46
4717/*************************************
4818 *
4919 *  Init machine
r10613r10614
5222
5323MACHINE_RESET( pc10 )
5424{
25   playch10_state *state = machine->driver_data<playch10_state>();
5526   device_t *rp5h01 = machine->device("rp5h01");
5627
5728   /* initialize latches and flip-flops */
58   pc10_nmi_enable = pc10_dog_di = pc10_dispmask = pc10_sdcs = pc10_int_detect = 0;
29   state->pc10_nmi_enable = state->pc10_dog_di = state->pc10_dispmask = state->pc10_sdcs = state->pc10_int_detect = 0;
5930
60   pc10_game_mode = pc10_dispmask_old = 0;
31   state->pc10_game_mode = state->pc10_dispmask_old = 0;
6132
62   cart_sel = 0;
63   cntrl_mask = 1;
33   state->cart_sel = 0;
34   state->cntrl_mask = 1;
6435
65   input_latch[0] = input_latch[1] = 0;
36   state->input_latch[0] = state->input_latch[1] = 0;
6637
6738   /* variables used only in MMC2 game (mapper 9)  */
68   MMC2_bank[0] = MMC2_bank[1] = MMC2_bank[2] = MMC2_bank[3] = 0;
69   MMC2_bank_latch[0] = MMC2_bank_latch[1] = 0xfe;
39   state->MMC2_bank[0] = state->MMC2_bank[1] = state->MMC2_bank[2] = state->MMC2_bank[3] = 0;
40   state->MMC2_bank_latch[0] = state->MMC2_bank_latch[1] = 0xfe;
7041
7142   /* reset the security chip */
7243   rp5h01_enable_w(rp5h01, 0, 0);
r10613r10614
7445   rp5h01_reset_w(rp5h01, 0, 1);
7546   rp5h01_enable_w(rp5h01, 0, 1);
7647
77   pc10_set_mirroring(mirroring);
48   pc10_set_mirroring(state, state->mirroring);
7849}
7950
8051MACHINE_START( pc10 )
8152{
82   vrom = machine->region("gfx2")->base();
53   playch10_state *state = machine->driver_data<playch10_state>();
54   state->vrom = machine->region("gfx2")->base();
8355
8456   /* allocate 4K of nametable ram here */
8557   /* move to individual boards as documentation of actual boards allows */
86   nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
58   state->nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
8759
8860   memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0, 0x1fff, 0, 0, pc10_chr_r, pc10_chr_w);
8961   memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, pc10_nt_r, pc10_nt_w);
9062
91   if (NULL != vram)
63   if (NULL != state->vram)
9264      set_videoram_bank(machine, 0, 8, 0, 8);
9365   else pc10_set_videorom_bank(machine, 0, 8, 0, 8);
9466
9567   nvram_device *nvram = machine->device<nvram_device>("nvram");
9668   if (nvram != NULL)
97      nvram->set_base(machine->region( "cart" )->base() + 0x6000, 0x1000);
69      nvram->set_base(machine->region("cart" )->base() + 0x6000, 0x1000);
9870}
9971
10072MACHINE_START( playch10_hboard )
10173{
102   vrom = machine->region("gfx2")->base();
74   playch10_state *state = machine->driver_data<playch10_state>();
75   state->vrom = machine->region("gfx2")->base();
10376
10477   /* allocate 4K of nametable ram here */
10578   /* move to individual boards as documentation of actual boards allows */
106   nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
79   state->nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
10780   /* allocate vram */
10881
109   vram = auto_alloc_array(machine, UINT8, 0x2000);
82   state->vram = auto_alloc_array(machine, UINT8, 0x2000);
11083
11184   memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0, 0x1fff, 0, 0, pc10_chr_r, pc10_chr_w);
11285   memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, pc10_nt_r, pc10_nt_w);
r10613r10614
12093
12194CUSTOM_INPUT( pc10_int_detect_r )
12295{
123   return ~pc10_int_detect & 1;
96   playch10_state *state = field->port->machine->driver_data<playch10_state>();
97   return ~state->pc10_int_detect & 1;
12498}
12599
126100WRITE8_HANDLER( pc10_SDCS_w )
127101{
102   playch10_state *state = space->machine->driver_data<playch10_state>();
128103   /*
129104        Hooked to CLR on LS194A - Sheet 2, bottom left.
130105        Drives character and color code to 0.
131106        It's used to keep the screen black during redraws.
132107        Also hooked to the video sram. Prevent writes.
133108    */
134   pc10_sdcs = ~data & 1;
109   state->pc10_sdcs = ~data & 1;
135110}
136111
137112WRITE8_HANDLER( pc10_CNTRLMASK_w )
138113{
139   cntrl_mask = ~data & 1;
114   playch10_state *state = space->machine->driver_data<playch10_state>();
115   state->cntrl_mask = ~data & 1;
140116}
141117
142118WRITE8_HANDLER( pc10_DISPMASK_w )
143119{
144   pc10_dispmask = ~data & 1;
120   playch10_state *state = space->machine->driver_data<playch10_state>();
121   state->pc10_dispmask = ~data & 1;
145122}
146123
147124WRITE8_HANDLER( pc10_SOUNDMASK_w )
r10613r10614
151128
152129WRITE8_HANDLER( pc10_NMIENABLE_w )
153130{
154   pc10_nmi_enable = data & 1;
131   playch10_state *state = space->machine->driver_data<playch10_state>();
132   state->pc10_nmi_enable = data & 1;
155133}
156134
157135WRITE8_HANDLER( pc10_DOGDI_w )
158136{
159   pc10_dog_di = data & 1;
137   playch10_state *state = space->machine->driver_data<playch10_state>();
138   state->pc10_dog_di = data & 1;
160139}
161140
162141WRITE8_HANDLER( pc10_GAMERES_w )
r10613r10614
177156
178157READ8_HANDLER( pc10_detectclr_r )
179158{
180   pc10_int_detect = 0;
159   playch10_state *state = space->machine->driver_data<playch10_state>();
160   state->pc10_int_detect = 0;
181161
182162   return 0;
183163}
184164
185165WRITE8_HANDLER( pc10_CARTSEL_w )
186166{
187   cart_sel &= ~(1 << offset);
188   cart_sel |= (data & 1) << offset;
167   playch10_state *state = space->machine->driver_data<playch10_state>();
168   state->cart_sel &= ~(1 << offset);
169   state->cart_sel |= (data & 1) << offset;
189170}
190171
191172
r10613r10614
197178
198179READ8_HANDLER( pc10_prot_r )
199180{
181   playch10_state *state = space->machine->driver_data<playch10_state>();
200182   device_t *rp5h01 = space->machine->device("rp5h01");
201183   int data = 0xe7;
202184
203185   /* we only support a single cart connected at slot 0 */
204   if (cart_sel == 0)
186   if (state->cart_sel == 0)
205187   {
206188      rp5h01_enable_w(rp5h01, 0, 0);
207189      data |= ((~rp5h01_counter_r(rp5h01, 0)) << 4) & 0x10;   /* D4 */
r10613r10614
213195
214196WRITE8_HANDLER( pc10_prot_w )
215197{
198   playch10_state *state = space->machine->driver_data<playch10_state>();
216199   device_t *rp5h01 = space->machine->device("rp5h01");
217200   /* we only support a single cart connected at slot 0 */
218   if (cart_sel == 0)
201   if (state->cart_sel == 0)
219202   {
220203      rp5h01_enable_w(rp5h01, 0, 0);
221204      rp5h01_test_w(rp5h01, 0, data & 0x10);      /* D4 */
r10613r10614
241224
242225WRITE8_HANDLER( pc10_in0_w )
243226{
227   playch10_state *state = space->machine->driver_data<playch10_state>();
244228   /* Toggling bit 0 high then low resets both controllers */
245229   if (data & 1)
246230      return;
247231
248232   /* load up the latches */
249   input_latch[0] = input_port_read(space->machine, "P1");
250   input_latch[1] = input_port_read(space->machine, "P2");
233   state->input_latch[0] = input_port_read(space->machine, "P1");
234   state->input_latch[1] = input_port_read(space->machine, "P2");
251235
252236   /* apply any masking from the BIOS */
253   if (cntrl_mask)
237   if (state->cntrl_mask)
254238   {
255239      /* mask out select and start */
256      input_latch[0] &= ~0x0c;
240      state->input_latch[0] &= ~0x0c;
257241   }
258242}
259243
260244READ8_HANDLER( pc10_in0_r )
261245{
262   int ret = (input_latch[0]) & 1;
246   playch10_state *state = space->machine->driver_data<playch10_state>();
247   int ret = (state->input_latch[0]) & 1;
263248
264249   /* shift */
265   input_latch[0] >>= 1;
250   state->input_latch[0] >>= 1;
266251
267252   /* some games expect bit 6 to be set because the last entry on the data bus shows up */
268253   /* in the unused upper 3 bits, so typically a read from $4016 leaves 0x40 there. */
r10613r10614
273258
274259READ8_HANDLER( pc10_in1_r )
275260{
276   int ret = (input_latch[1]) & 1;
261   playch10_state *state = space->machine->driver_data<playch10_state>();
262   int ret = (state->input_latch[1]) & 1;
277263
278264   /* shift */
279   input_latch[1] >>= 1;
265   state->input_latch[1] >>= 1;
280266
281267   /* do the gun thing */
282   if (pc10_gun_controller)
268   if (state->pc10_gun_controller)
283269   {
284270      device_t *ppu = space->machine->device("ppu");
285271      int trigger = input_port_read(space->machine, "P1");
r10613r10614
304290      }
305291
306292      /* now, add the trigger if not masked */
307      if (!cntrl_mask)
293      if (!state->cntrl_mask)
308294      {
309295         ret |= (trigger & 2) << 3;
310296      }
r10613r10614
324310
325311static WRITE8_HANDLER( pc10_nt_w )
326312{
313   playch10_state *state = space->machine->driver_data<playch10_state>();
327314   int page = ((offset & 0xc00) >> 10);
328   nametable[page][offset & 0x3ff] = data;
315   state->nametable[page][offset & 0x3ff] = data;
329316}
330317
331318static READ8_HANDLER( pc10_nt_r )
332319{
320   playch10_state *state = space->machine->driver_data<playch10_state>();
333321   int page = ((offset & 0xc00) >> 10);
334   return nametable[page][offset & 0x3ff];
322   return state->nametable[page][offset & 0x3ff];
335323}
336324
337325static WRITE8_HANDLER( pc10_chr_w )
338326{
327   playch10_state *state = space->machine->driver_data<playch10_state>();
339328   int bank = offset >> 10;
340   if (chr_page[bank].writable)
329   if (state->chr_page[bank].writable)
341330   {
342      chr_page[bank].chr[offset & 0x3ff] = data;
331      state->chr_page[bank].chr[offset & 0x3ff] = data;
343332   }
344333}
345334
346335static READ8_HANDLER( pc10_chr_r )
347336{
337   playch10_state *state = space->machine->driver_data<playch10_state>();
348338   int bank = offset >> 10;
349   return chr_page[bank].chr[offset & 0x3ff];
339   return state->chr_page[bank].chr[offset & 0x3ff];
350340}
351341
352static void pc10_set_mirroring( int mirroring )
342static void pc10_set_mirroring( playch10_state *state, int mirroring )
353343{
354344   switch (mirroring)
355345   {
356346   case PPU_MIRROR_LOW:
357      nametable[0] = nametable[1] = nametable[2] = nametable[3] = nt_ram;
347      state->nametable[0] = state->nametable[1] = state->nametable[2] = state->nametable[3] = state->nt_ram;
358348      break;
359349   case PPU_MIRROR_HIGH:
360      nametable[0] = nametable[1] = nametable[2] = nametable[3] = nt_ram + 0x400;
350      state->nametable[0] = state->nametable[1] = state->nametable[2] = state->nametable[3] = state->nt_ram + 0x400;
361351      break;
362352   case PPU_MIRROR_HORZ:
363      nametable[0] = nt_ram;
364      nametable[1] = nt_ram;
365      nametable[2] = nt_ram + 0x400;
366      nametable[3] = nt_ram + 0x400;
353      state->nametable[0] = state->nt_ram;
354      state->nametable[1] = state->nt_ram;
355      state->nametable[2] = state->nt_ram + 0x400;
356      state->nametable[3] = state->nt_ram + 0x400;
367357      break;
368358   case PPU_MIRROR_VERT:
369      nametable[0] = nt_ram;
370      nametable[1] = nt_ram + 0x400;
371      nametable[2] = nt_ram;
372      nametable[3] = nt_ram + 0x400;
359      state->nametable[0] = state->nt_ram;
360      state->nametable[1] = state->nt_ram + 0x400;
361      state->nametable[2] = state->nt_ram;
362      state->nametable[3] = state->nt_ram + 0x400;
373363      break;
374364   case PPU_MIRROR_NONE:
375365   default:
376      nametable[0] = nt_ram;
377      nametable[1] = nt_ram + 0x400;
378      nametable[2] = nt_ram + 0x800;
379      nametable[3] = nt_ram + 0xc00;
366      state->nametable[0] = state->nt_ram;
367      state->nametable[1] = state->nt_ram + 0x400;
368      state->nametable[2] = state->nt_ram + 0x800;
369      state->nametable[3] = state->nt_ram + 0xc00;
380370      break;
381371   }
382372}
r10613r10614
391381
392382static void pc10_set_videorom_bank( running_machine *machine, int first, int count, int bank, int size )
393383{
384   playch10_state *state = machine->driver_data<playch10_state>();
394385   int i, len;
395386   /* first = first bank to map */
396387   /* count = number of 1K banks to map */
r10613r10614
409400
410401   for (i = 0; i < count; i++)
411402   {
412      chr_page[i + first].writable = 0;
413      chr_page[i + first].chr=vrom + (i * 0x400) + (bank * size * 0x400);
403      state->chr_page[i + first].writable = 0;
404      state->chr_page[i + first].chr=state->vrom + (i * 0x400) + (bank * size * 0x400);
414405   }
415406}
416407
417408static void set_videoram_bank( running_machine *machine, int first, int count, int bank, int size )
418409{
410   playch10_state *state = machine->driver_data<playch10_state>();
419411   int i;
420412   /* first = first bank to map */
421413   /* count = number of 1K banks to map */
r10613r10614
429421
430422   for (i = 0; i < count; i++)
431423   {
432      chr_page[i + first].writable = 1;
433      chr_page[i + first].chr = vram + (((i * 0x400) + (bank * size * 0x400)) & 0x1fff);
424      state->chr_page[i + first].writable = 1;
425      state->chr_page[i + first].chr = state->vram + (((i * 0x400) + (bank * size * 0x400)) & 0x1fff);
434426   }
435427}
436428
r10613r10614
442434
443435DRIVER_INIT( playch10 )
444436{
445   vram = NULL;
437   playch10_state *state = machine->driver_data<playch10_state>();
438   state->vram = NULL;
446439
447440   /* set the controller to default */
448   pc10_gun_controller = 0;
441   state->pc10_gun_controller = 0;
449442
450443   /* default mirroring */
451   mirroring = PPU_MIRROR_NONE;
444   state->mirroring = PPU_MIRROR_NONE;
452445}
453446
454447/**********************************************************************************
r10613r10614
461454
462455DRIVER_INIT( pc_gun )
463456{
457   playch10_state *state = machine->driver_data<playch10_state>();
464458   /* common init */
465459   DRIVER_INIT_CALL(playch10);
466460
467461   /* we have no vram, make sure switching games doesn't point to an old allocation */
468   vram = NULL;
462   state->vram = NULL;
469463
470464   /* set the control type */
471   pc10_gun_controller = 1;
465   state->pc10_gun_controller = 1;
472466}
473467
474468
r10613r10614
476470
477471DRIVER_INIT( pc_hrz )
478472{
473   playch10_state *state = machine->driver_data<playch10_state>();
479474   /* common init */
480475   DRIVER_INIT_CALL(playch10);
481476
482477   /* setup mirroring */
483   mirroring = PPU_MIRROR_HORZ;
478   state->mirroring = PPU_MIRROR_HORZ;
484479}
485480
486481/* MMC1 mapper, used by D and F boards */
487482
488static int mmc1_shiftreg;
489static int mmc1_shiftcount;
490static int mmc1_rom_mask;
491483
492484static WRITE8_HANDLER( mmc1_rom_switch_w )
493485{
486   playch10_state *state = space->machine->driver_data<playch10_state>();
494487   /* basically, a MMC1 mapper from the nes */
495488   static int size16k, switchlow, vrom4k;
496489
r10613r10614
499492   /* reset mapper */
500493   if (data & 0x80)
501494   {
502      mmc1_shiftreg = mmc1_shiftcount = 0;
495      state->mmc1_shiftreg = state->mmc1_shiftcount = 0;
503496
504497      size16k = 1;
505498      switchlow = 1;
r10613r10614
509502   }
510503
511504   /* see if we need to clock in data */
512   if (mmc1_shiftcount < 5)
505   if (state->mmc1_shiftcount < 5)
513506   {
514      mmc1_shiftreg >>= 1;
515      mmc1_shiftreg |= (data & 1) << 4;
516      mmc1_shiftcount++;
507      state->mmc1_shiftreg >>= 1;
508      state->mmc1_shiftreg |= (data & 1) << 4;
509      state->mmc1_shiftcount++;
517510   }
518511
519512   /* are we done shifting? */
520   if (mmc1_shiftcount == 5)
513   if (state->mmc1_shiftcount == 5)
521514   {
522515      /* reset count */
523      mmc1_shiftcount = 0;
516      state->mmc1_shiftcount = 0;
524517
525518      /* apply data to registers */
526519      switch (reg)
r10613r10614
529522            {
530523               int _mirroring;
531524
532               vrom4k = mmc1_shiftreg & 0x10;
533               size16k = mmc1_shiftreg & 0x08;
534               switchlow = mmc1_shiftreg & 0x04;
525               vrom4k = state->mmc1_shiftreg & 0x10;
526               size16k = state->mmc1_shiftreg & 0x08;
527               switchlow = state->mmc1_shiftreg & 0x04;
535528
536               switch (mmc1_shiftreg & 3)
529               switch (state->mmc1_shiftreg & 3)
537530               {
538531                  case 0:
539532                     _mirroring = PPU_MIRROR_LOW;
r10613r10614
554547               }
555548
556549               /* apply mirroring */
557               pc10_set_mirroring(_mirroring);
550               pc10_set_mirroring(state, _mirroring);
558551            }
559552         break;
560553
561554         case 1:   /* video rom banking - bank 0 - 4k or 8k */
562            if (vram)
563               set_videoram_bank(space->machine, 0, (vrom4k) ? 4 : 8, (mmc1_shiftreg & 0x1f), 4);
555            if (state->vram)
556               set_videoram_bank(space->machine, 0, (vrom4k) ? 4 : 8, (state->mmc1_shiftreg & 0x1f), 4);
564557            else
565               pc10_set_videorom_bank(space->machine, 0, (vrom4k) ? 4 : 8, (mmc1_shiftreg & 0x1f), 4);
558               pc10_set_videorom_bank(space->machine, 0, (vrom4k) ? 4 : 8, (state->mmc1_shiftreg & 0x1f), 4);
566559         break;
567560
568561         case 2: /* video rom banking - bank 1 - 4k only */
569562            if (vrom4k)
570563            {
571               if (vram)
572                  set_videoram_bank(space->machine, 0, (vrom4k) ? 4 : 8, (mmc1_shiftreg & 0x1f), 4);
564               if (state->vram)
565                  set_videoram_bank(space->machine, 0, (vrom4k) ? 4 : 8, (state->mmc1_shiftreg & 0x1f), 4);
573566               else
574                  pc10_set_videorom_bank(space->machine, 4, 4, (mmc1_shiftreg & 0x1f), 4);
567                  pc10_set_videorom_bank(space->machine, 4, 4, (state->mmc1_shiftreg & 0x1f), 4);
575568            }
576569         break;
577570
578571         case 3:   /* program banking */
579572            {
580               int bank = (mmc1_shiftreg & mmc1_rom_mask) * 0x4000;
573               int bank = (state->mmc1_shiftreg & state->mmc1_rom_mask) * 0x4000;
581574               UINT8 *prg = space->machine->region("cart")->base();
582575
583576               if (!size16k)
r10613r10614
615608
616609DRIVER_INIT( pcaboard )
617610{
611   playch10_state *state = machine->driver_data<playch10_state>();
618612   /* switches vrom with writes to the $803e-$8041 area */
619613   memory_install_write8_handler(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x8000, 0x8fff, 0, 0, aboard_vrom_switch_w );
620614
r10613r10614
622616   DRIVER_INIT_CALL(playch10);
623617
624618   /* set the mirroring here */
625   mirroring = PPU_MIRROR_VERT;
619   state->mirroring = PPU_MIRROR_VERT;
626620
627621   /* we have no vram, make sure switching games doesn't point to an old allocation */
628   vram = NULL;
622   state->vram = NULL;
629623}
630624
631625/**********************************************************************************/
r10613r10614
641635
642636DRIVER_INIT( pcbboard )
643637{
638   playch10_state *state = machine->driver_data<playch10_state>();
644639   UINT8 *prg = machine->region("cart")->base();
645640
646641   /* We do manual banking, in case the code falls through */
r10613r10614
654649   DRIVER_INIT_CALL(playch10);
655650
656651   /* allocate vram */
657   vram = auto_alloc_array(machine, UINT8, 0x2000);
652   state->vram = auto_alloc_array(machine, UINT8, 0x2000);
658653
659654   /* set the mirroring here */
660   mirroring = PPU_MIRROR_VERT;
655   state->mirroring = PPU_MIRROR_VERT;
661656   /* special init */
662657   set_videoram_bank(machine, 0, 8, 0, 8);
663658}
r10613r10614
672667
673668DRIVER_INIT( pccboard )
674669{
670   playch10_state *state = machine->driver_data<playch10_state>();
675671   /* switches vrom with writes to $6000 */
676672   memory_install_write8_handler(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x6000, 0x6000, 0, 0, cboard_vrom_switch_w );
677673
678674   /* we have no vram, make sure switching games doesn't point to an old allocation */
679   vram = NULL;
675   state->vram = NULL;
680676
681677   /* common init */
682678   DRIVER_INIT_CALL(playch10);
r10613r10614
687683
688684DRIVER_INIT( pcdboard )
689685{
686   playch10_state *state = machine->driver_data<playch10_state>();
690687   UINT8 *prg = machine->region("cart")->base();
691688
692689   /* We do manual banking, in case the code falls through */
693690   /* Copy the initial banks */
694691   memcpy(&prg[0x08000], &prg[0x28000], 0x8000);
695692
696   mmc1_rom_mask = 0x07;
693   state->mmc1_rom_mask = 0x07;
697694
698695   /* MMC mapper at writes to $8000-$ffff */
699696   memory_install_write8_handler(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w );
r10613r10614
702699   /* common init */
703700   DRIVER_INIT_CALL(playch10);
704701   /* allocate vram */
705   vram = auto_alloc_array(machine, UINT8, 0x2000);
702   state->vram = auto_alloc_array(machine, UINT8, 0x2000);
706703   /* special init */
707704   set_videoram_bank(machine, 0, 8, 0, 8);
708705}
r10613r10614
711708
712709DRIVER_INIT( pcdboard_2 )
713710{
711   playch10_state *state = machine->driver_data<playch10_state>();
714712   /* extra ram at $6000-$7fff */
715713   memory_install_ram(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, NULL );
716714
r10613r10614
718716   DRIVER_INIT_CALL(pcdboard);
719717
720718   /* allocate vram */
721   vram = auto_alloc_array(machine, UINT8, 0x2000);
719   state->vram = auto_alloc_array(machine, UINT8, 0x2000);
722720   /* special init */
723721   set_videoram_bank(machine, 0, 8, 0, 8);
724722}
r10613r10614
729727/* callback for the ppu_latch */
730728static void mapper9_latch( device_t *ppu, offs_t offset )
731729{
730   playch10_state *state = ppu->machine->driver_data<playch10_state>();
732731
733   if((offset & 0x1ff0) == 0x0fd0 && MMC2_bank_latch[0] != 0xfd)
732   if((offset & 0x1ff0) == 0x0fd0 && state->MMC2_bank_latch[0] != 0xfd)
734733   {
735      MMC2_bank_latch[0] = 0xfd;
736      pc10_set_videorom_bank(ppu->machine, 0, 4, MMC2_bank[0], 4);
734      state->MMC2_bank_latch[0] = 0xfd;
735      pc10_set_videorom_bank(ppu->machine, 0, 4, state->MMC2_bank[0], 4);
737736   }
738   else if((offset & 0x1ff0) == 0x0fe0 && MMC2_bank_latch[0] != 0xfe)
737   else if((offset & 0x1ff0) == 0x0fe0 && state->MMC2_bank_latch[0] != 0xfe)
739738   {
740      MMC2_bank_latch[0] = 0xfe;
741      pc10_set_videorom_bank(ppu->machine, 0, 4, MMC2_bank[1], 4);
739      state->MMC2_bank_latch[0] = 0xfe;
740      pc10_set_videorom_bank(ppu->machine, 0, 4, state->MMC2_bank[1], 4);
742741   }
743   else if((offset & 0x1ff0) == 0x1fd0 && MMC2_bank_latch[1] != 0xfd)
742   else if((offset & 0x1ff0) == 0x1fd0 && state->MMC2_bank_latch[1] != 0xfd)
744743   {
745      MMC2_bank_latch[1] = 0xfd;
746      pc10_set_videorom_bank(ppu->machine, 4, 4, MMC2_bank[2], 4);
744      state->MMC2_bank_latch[1] = 0xfd;
745      pc10_set_videorom_bank(ppu->machine, 4, 4, state->MMC2_bank[2], 4);
747746   }
748   else if((offset & 0x1ff0) == 0x1fe0 && MMC2_bank_latch[1] != 0xfe)
747   else if((offset & 0x1ff0) == 0x1fe0 && state->MMC2_bank_latch[1] != 0xfe)
749748   {
750      MMC2_bank_latch[1] = 0xfe;
751      pc10_set_videorom_bank(ppu->machine, 4, 4, MMC2_bank[3], 4);
749      state->MMC2_bank_latch[1] = 0xfe;
750      pc10_set_videorom_bank(ppu->machine, 4, 4, state->MMC2_bank[3], 4);
752751   }
753752}
754753
755754static WRITE8_HANDLER( eboard_rom_switch_w )
756755{
756   playch10_state *state = space->machine->driver_data<playch10_state>();
757757   /* a variation of mapper 9 on a nes */
758758   switch (offset & 0x7000)
759759   {
r10613r10614
766766      break;
767767
768768      case 0x3000: /* gfx bank 0 - 4k */
769         MMC2_bank[0] = data;
770         if (MMC2_bank_latch[0] == 0xfd)
769         state->MMC2_bank[0] = data;
770         if (state->MMC2_bank_latch[0] == 0xfd)
771771            pc10_set_videorom_bank(space->machine, 0, 4, data, 4);
772772      break;
773773
774774      case 0x4000: /* gfx bank 0 - 4k */
775         MMC2_bank[1] = data;
776         if (MMC2_bank_latch[0] == 0xfe)
775         state->MMC2_bank[1] = data;
776         if (state->MMC2_bank_latch[0] == 0xfe)
777777            pc10_set_videorom_bank(space->machine, 0, 4, data, 4);
778778      break;
779779
780780      case 0x5000: /* gfx bank 1 - 4k */
781         MMC2_bank[2] = data;
782         if (MMC2_bank_latch[1] == 0xfd)
781         state->MMC2_bank[2] = data;
782         if (state->MMC2_bank_latch[1] == 0xfd)
783783            pc10_set_videorom_bank(space->machine, 4, 4, data, 4);
784784      break;
785785
786786      case 0x6000: /* gfx bank 1 - 4k */
787         MMC2_bank[3] = data;
788         if (MMC2_bank_latch[1] == 0xfe)
787         state->MMC2_bank[3] = data;
788         if (state->MMC2_bank_latch[1] == 0xfe)
789789            pc10_set_videorom_bank(space->machine, 4, 4, data, 4);
790790      break;
791791
792792      case 0x7000: /* mirroring */
793         pc10_set_mirroring(data ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
793         pc10_set_mirroring(state, data ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
794794
795795      break;
796796   }
r10613r10614
798798
799799DRIVER_INIT( pceboard )
800800{
801   playch10_state *state = machine->driver_data<playch10_state>();
801802   UINT8 *prg = machine->region("cart")->base();
802803
803804   /* we have no vram, make sure switching games doesn't point to an old allocation */
804   vram = NULL;
805   state->vram = NULL;
805806
806807   /* We do manual banking, in case the code falls through */
807808   /* Copy the initial banks */
r10613r10614
825826
826827DRIVER_INIT( pcfboard )
827828{
829   playch10_state *state = machine->driver_data<playch10_state>();
828830   UINT8 *prg = machine->region("cart")->base();
829831
830832   /* we have no vram, make sure switching games doesn't point to an old allocation */
831   vram = NULL;
833   state->vram = NULL;
832834
833835   /* We do manual banking, in case the code falls through */
834836   /* Copy the initial banks */
835837   memcpy(&prg[0x08000], &prg[0x28000], 0x8000);
836838
837   mmc1_rom_mask = 0x07;
839   state->mmc1_rom_mask = 0x07;
838840
839841   /* MMC mapper at writes to $8000-$ffff */
840842   memory_install_write8_handler(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w );
r10613r10614
847849
848850DRIVER_INIT( pcfboard_2 )
849851{
852   playch10_state *state = machine->driver_data<playch10_state>();
850853   /* extra ram at $6000-$6fff */
851854   memory_install_ram(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x6000, 0x6fff, 0, 0, NULL );
852855
853   vram = NULL;
856   state->vram = NULL;
854857
855858   /* common init */
856859   DRIVER_INIT_CALL(pcfboard);
r10613r10614
859862/**********************************************************************************/
860863/* G Board games (Super Mario Bros. 3) */
861864
862static int gboard_scanline_counter;
863static int gboard_scanline_latch;
864static int gboard_banks[2];
865static int gboard_4screen;
866static int gboard_last_bank;
867static int gboard_command;
868865
869866static void gboard_scanline_cb( device_t *device, int scanline, int vblank, int blanked )
870867{
868   playch10_state *state = device->machine->driver_data<playch10_state>();
871869   if (!vblank && !blanked)
872870   {
873      if (--gboard_scanline_counter == -1)
871      if (--state->gboard_scanline_counter == -1)
874872      {
875         gboard_scanline_counter = gboard_scanline_latch;
873         state->gboard_scanline_counter = state->gboard_scanline_latch;
876874         generic_pulse_irq_line(device->machine->device("cart"), 0);
877875      }
878876   }
r10613r10614
880878
881879static WRITE8_HANDLER( gboard_rom_switch_w )
882880{
881   playch10_state *state = space->machine->driver_data<playch10_state>();
883882   device_t *ppu = space->machine->device("ppu");
884883
885884   /* basically, a MMC3 mapper from the nes */
r10613r10614
887886   switch (offset & 0x7001)
888887   {
889888      case 0x0000:
890         gboard_command = data;
889         state->gboard_command = data;
891890
892         if (gboard_last_bank != (data & 0xc0))
891         if (state->gboard_last_bank != (data & 0xc0))
893892         {
894893            int bank;
895894            UINT8 *prg = space->machine->region("cart")->base();
896895
897896            /* reset the banks */
898            if (gboard_command & 0x40)
897            if (state->gboard_command & 0x40)
899898            {
900899               /* high bank */
901               bank = gboard_banks[0] * 0x2000 + 0x10000;
900               bank = state->gboard_banks[0] * 0x2000 + 0x10000;
902901
903902               memcpy(&prg[0x0c000], &prg[bank], 0x2000);
904903               memcpy(&prg[0x08000], &prg[0x4c000], 0x2000);
r10613r10614
906905            else
907906            {
908907               /* low bank */
909               bank = gboard_banks[0] * 0x2000 + 0x10000;
908               bank = state->gboard_banks[0] * 0x2000 + 0x10000;
910909
911910               memcpy(&prg[0x08000], &prg[bank], 0x2000);
912911               memcpy(&prg[0x0c000], &prg[0x4c000], 0x2000);
913912            }
914913
915914            /* mid bank */
916            bank = gboard_banks[1] * 0x2000 + 0x10000;
915            bank = state->gboard_banks[1] * 0x2000 + 0x10000;
917916            memcpy(&prg[0x0a000], &prg[bank], 0x2000);
918917
919            gboard_last_bank = data & 0xc0;
918            state->gboard_last_bank = data & 0xc0;
920919         }
921920      break;
922921
923922      case 0x0001:
924923         {
925            UINT8 cmd = gboard_command & 0x07;
926            int page = (gboard_command & 0x80) >> 5;
924            UINT8 cmd = state->gboard_command & 0x07;
925            int page = (state->gboard_command & 0x80) >> 5;
927926            int bank;
928927
929928            switch (cmd)
r10613r10614
946945               case 6: /* program banking */
947946               {
948947                  UINT8 *prg = space->machine->region("cart")->base();
949                  if (gboard_command & 0x40)
948                  if (state->gboard_command & 0x40)
950949                  {
951950                     /* high bank */
952                     gboard_banks[0] = data & 0x1f;
953                     bank = (gboard_banks[0]) * 0x2000 + 0x10000;
951                     state->gboard_banks[0] = data & 0x1f;
952                     bank = (state->gboard_banks[0]) * 0x2000 + 0x10000;
954953
955954                     memcpy(&prg[0x0c000], &prg[bank], 0x2000);
956955                     memcpy(&prg[0x08000], &prg[0x4c000], 0x2000);
r10613r10614
958957                  else
959958                  {
960959                     /* low bank */
961                     gboard_banks[0] = data & 0x1f;
962                     bank = (gboard_banks[0]) * 0x2000 + 0x10000;
960                     state->gboard_banks[0] = data & 0x1f;
961                     bank = (state->gboard_banks[0]) * 0x2000 + 0x10000;
963962
964963                     memcpy(&prg[0x08000], &prg[bank], 0x2000);
965964                     memcpy(&prg[0x0c000], &prg[0x4c000], 0x2000);
r10613r10614
971970                  {
972971                     /* mid bank */
973972                     UINT8 *prg = space->machine->region("cart")->base();
974                     gboard_banks[1] = data & 0x1f;
975                     bank = gboard_banks[1] * 0x2000 + 0x10000;
973                     state->gboard_banks[1] = data & 0x1f;
974                     bank = state->gboard_banks[1] * 0x2000 + 0x10000;
976975
977976                     memcpy(&prg[0x0a000], &prg[bank], 0x2000);
978977                  }
r10613r10614
982981      break;
983982
984983      case 0x2000: /* mirroring */
985         if (!gboard_4screen)
984         if (!state->gboard_4screen)
986985         {
987986            if (data & 0x40)
988               pc10_set_mirroring(PPU_MIRROR_HIGH);
987               pc10_set_mirroring(state, PPU_MIRROR_HIGH);
989988            else
990               pc10_set_mirroring((data & 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
989               pc10_set_mirroring(state, (data & 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
991990         }
992991      break;
993992
r10613r10614
996995      break;
997996
998997      case 0x4000: /* scanline counter */
999         gboard_scanline_counter = data;
998         state->gboard_scanline_counter = data;
1000999      break;
10011000
10021001      case 0x4001: /* scanline latch */
1003         gboard_scanline_latch = data;
1002         state->gboard_scanline_latch = data;
10041003      break;
10051004
10061005      case 0x6000: /* disable irqs */
r10613r10614
10151014
10161015DRIVER_INIT( pcgboard )
10171016{
1017   playch10_state *state = machine->driver_data<playch10_state>();
10181018   UINT8 *prg = machine->region("cart")->base();
1019   vram = NULL;
1019   state->vram = NULL;
10201020
10211021   /* We do manual banking, in case the code falls through */
10221022   /* Copy the initial banks */
r10613r10614
10291029   /* extra ram at $6000-$7fff */
10301030   memory_install_ram(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, NULL );
10311031
1032   gboard_banks[0] = 0x1e;
1033   gboard_banks[1] = 0x1f;
1034   gboard_scanline_counter = 0;
1035   gboard_scanline_latch = 0;
1036   gboard_4screen = 0;
1032   state->gboard_banks[0] = 0x1e;
1033   state->gboard_banks[1] = 0x1f;
1034   state->gboard_scanline_counter = 0;
1035   state->gboard_scanline_latch = 0;
1036   state->gboard_4screen = 0;
10371037
10381038   /* common init */
10391039   DRIVER_INIT_CALL(playch10);
r10613r10614
10411041
10421042DRIVER_INIT( pcgboard_type2 )
10431043{
1044   vram = NULL;
1044   playch10_state *state = machine->driver_data<playch10_state>();
1045   state->vram = NULL;
10451046   /* common init */
10461047   DRIVER_INIT_CALL(pcgboard);
10471048
10481049   /* enable 4 screen mirror */
1049   gboard_4screen = 1;
1050   state->gboard_4screen = 1;
10501051}
10511052
10521053/**********************************************************************************/
r10613r10614
10541055
10551056static WRITE8_HANDLER( iboard_rom_switch_w )
10561057{
1058   playch10_state *state = space->machine->driver_data<playch10_state>();
10571059   int bank = data & 7;
10581060   UINT8 *prg = space->machine->region("cart")->base();
10591061
10601062   if (data & 0x10)
1061      pc10_set_mirroring(PPU_MIRROR_HIGH);
1063      pc10_set_mirroring(state, PPU_MIRROR_HIGH);
10621064   else
1063      pc10_set_mirroring(PPU_MIRROR_LOW);
1065      pc10_set_mirroring(state, PPU_MIRROR_LOW);
10641066
10651067   memcpy(&prg[0x08000], &prg[bank * 0x8000 + 0x10000], 0x8000);
10661068}
10671069
10681070DRIVER_INIT( pciboard )
10691071{
1072   playch10_state *state = machine->driver_data<playch10_state>();
10701073   UINT8 *prg = machine->region("cart")->base();
10711074
10721075   /* We do manual banking, in case the code falls through */
r10613r10614
10801083   DRIVER_INIT_CALL(playch10);
10811084
10821085   /* allocate vram */
1083   vram = auto_alloc_array(machine, UINT8, 0x2000);
1086   state->vram = auto_alloc_array(machine, UINT8, 0x2000);
10841087   /* special init */
10851088   set_videoram_bank(machine, 0, 8, 0, 8);
10861089}
r10613r10614
10901093
10911094static WRITE8_HANDLER( hboard_rom_switch_w )
10921095{
1096   playch10_state *state = space->machine->driver_data<playch10_state>();
10931097   switch (offset & 0x7001)
10941098   {
10951099      case 0x0001:
10961100         {
1097            UINT8 cmd = gboard_command & 0x07;
1098            int page = (gboard_command & 0x80) >> 5;
1101            UINT8 cmd = state->gboard_command & 0x07;
1102            int page = (state->gboard_command & 0x80) >> 5;
10991103
11001104            switch (cmd)
11011105            {
r10613r10614
11361140
11371141DRIVER_INIT( pchboard )
11381142{
1143   playch10_state *state = machine->driver_data<playch10_state>();
11391144   UINT8 *prg = machine->region("cart")->base();
11401145   memcpy(&prg[0x08000], &prg[0x4c000], 0x4000);
11411146   memcpy(&prg[0x0c000], &prg[0x4c000], 0x4000);
r10613r10614
11461151   /* extra ram at $6000-$7fff */
11471152   memory_install_ram(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, NULL );
11481153
1149   gboard_banks[0] = 0x1e;
1150   gboard_banks[1] = 0x1f;
1151   gboard_scanline_counter = 0;
1152   gboard_scanline_latch = 0;
1153   gboard_last_bank = 0xff;
1154   gboard_command = 0;
1154   state->gboard_banks[0] = 0x1e;
1155   state->gboard_banks[1] = 0x1f;
1156   state->gboard_scanline_counter = 0;
1157   state->gboard_scanline_latch = 0;
1158   state->gboard_last_bank = 0xff;
1159   state->gboard_command = 0;
11551160
11561161   /* common init */
11571162   DRIVER_INIT_CALL(playch10);
r10613r10614
11621167
11631168DRIVER_INIT( pckboard )
11641169{
1170   playch10_state *state = machine->driver_data<playch10_state>();
11651171   UINT8 *prg = machine->region("cart")->base();
11661172
11671173   /* We do manual banking, in case the code falls through */
11681174   /* Copy the initial banks */
11691175   memcpy(&prg[0x08000], &prg[0x48000], 0x8000);
11701176
1171   mmc1_rom_mask = 0x0f;
1177   state->mmc1_rom_mask = 0x0f;
11721178
11731179   /* extra ram at $6000-$7fff */
11741180   memory_install_ram(cputag_get_address_space(machine, "cart", ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, NULL );
r10613r10614
11801186   DRIVER_INIT_CALL(playch10);
11811187
11821188   /* allocate vram */
1183   vram = auto_alloc_array(machine, UINT8, 0x2000);
1189   state->vram = auto_alloc_array(machine, UINT8, 0x2000);
11841190   /* special init */
11851191   set_videoram_bank(machine, 0, 8, 0, 8);
11861192}
src/mame/machine/pgmcrypt.c
r10613r10614
454454  0x7c, 0x01, 0x43, 0xdb, 0x53, 0x85, 0xfe, 0x78, 0x91, 0x40, 0xa3, 0xdf, 0x4f, 0xff, 0x10, 0x6c,
455455};
456456
457void pgm_mm_decrypt(running_machine *machine)
457void pgm_mm_decrypt(running_machine *machine) // and dw2001
458458{
459459   int i;
460460   UINT16 *src = (UINT16 *)(machine->region("user1")->base());
r10613r10614
946946   }
947947}
948948
949/* not 100% correct */
950static const UINT8 dw2001_tab[256] = {
951    0xd0,0x45,0xbc,0x84,0x93,0x60,0x7d,0x49,0x68,0xb1,0x54,0xa2,0x05,0x29,0x41,0x20,
952    0x04,0x08,0x52,0x25,0x89,0xf4,0x69,0x9f,0x24,0x46,0x3d,0xf1,0xf9,0xab,0xa6,0x2d,
953    0x18,0x19,0x6d,0x33,0x79,0x23,0x3b,0x1d,0xe0,0xb8,0x61,0x1a,0xe1,0x4c,0x5d,0x3f,
954    0x5e,0x02,0xe3,0x4d,0x9e,0X80,0x28,0x50,0xa0,0x81,0xe4,0xa5,0x97,0xa1,0x86,0x36,
955    0x1e,0xed,0x16,0x8a,0x44,0x06,0x64,0x12,0x9a,0x7e,0xce,0x9b,0xef,0xf7,0x3e,0xf8,
956    0x15,0x07,0xcb,0x6f,0x8e,0x3c,0x82,0x70,0x62,0x8d,0x66,0x7a,0x4e,0xd3,0xb6,0x6a,
957    0x51,0xa7,0x2c,0xc7,0xa4,0x0b,0xb5,0xe5,0x88,0xbd,0x5a,0x5b,0x1b,0xae,0xe6,0X5F,
958    0x2e,0x92,0x8c,0xb7,0x96,0xba,0x99,0xbb,0xbe,0x0e,0xbf,0xe7,0x2f,0xe9,0x30,0x37,
959    0x98,0xac,0x4a,0x94,0x38,0xf3,0x39,0xb2,0x55,0x72,0x7b,0xee,0xdd,0x6e,0x11,0xd5,
960    0x26,0xa8,0x71,0xd6,0x74,0x7f,0x13,0xc2,0x56,0xea,0xa9,0xaf,0XC3,0x42,0x03,0xb3,
961    0xc4,0x6b,0x47,0xf0,0x31,0xf5,0xaa,0x58,0x8f,0x48,0x75,0x95,0x35,0x8b,0x57,0x3a,
962    0x73,0x0c,0x59,0xd8,0x14,0x65,0xd7,0x00,0xfa,0xdc,0x34,0xde,0xc0,0xb0,0x87,0xc1,
963    0xc8,0xcd,0xd4,0x2a,0xda,0xe8,0xd2,0x83,0x0d,0xca,0xf2,0x0f,0xeb,0xec,0x9c,0x1f,
964    0xad,0x22,0xd1,0x4b,0x5c,0xf6,0x17,0xc5,0x67,0x9d,0xfb,0xc9,0xcc,0x32,0x1c,0xb4,
965    0xd9,0xe2,0xcf,0x90,0xb9,0x2b,0x61,0xc6,0x76,0x21,0x77,0x27,0xfc,0xfd,0x0a,0x09,
966    0x7c,0x01,0x43,0xdb,0x53,0x87,0xfe,0x78,0x91,0x40,0xa3,0xdf,0x4f,0xff,0x10,0x6c,
967};
968
969void pgm_dw2001_decrypt(running_machine *machine)
970{
971   int i;
972   UINT16 *src = (UINT16 *)(machine->region("user1")->base());
973
974   int rom_size = 0x200000;
975
976   for(i=0; i<rom_size/2; i++) {
977       UINT16 x = src[i];
978
979   if((i & 0x000480) != 0x00080)
980      x^=0x0001;
981
982   if((i & 0x004008) == 0x004008)
983      x^=0x0002;
984
985   if((i & 0x000030) == 0x000010)
986      x^=0x0004;
987
988   if((i & 0x000242) != 0x000042)
989      x^=0x0008;
990
991   if((i & 0x02004) != 0x00004)
992      x^=0x0020;
993
994   if((i & 0x11800) != 0x10000)
995      x^=0x0040;
996
997   if((i & 0x00820) == 0x00820)
998      x^=0x0080;
999
1000       x ^= dw2001_tab[(i >> 1) & 0xff] << 8;
1001
1002       src[i] = x;
1003   }
1004}
1005
1006/* todo: */
1007949static const UINT8 py2k2_tab[256] = {
1008950   0x74, 0xe8, 0xa8, 0x64, 0x26, 0x44, 0xa6, 0x9a, 0xa5, 0x69, 0xa2, 0xd3, 0x6d, 0xba, 0xff, 0xf3,
1009951   0xeb, 0x6e, 0xe3, 0x70, 0x72, 0x58, 0x27, 0xd9, 0xe4, 0x9f, 0x50, 0xa2, 0xdd, 0xce, 0x6e, 0xf6,
src/mame/machine/scramble.c
r10613r10614
597597   /* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
598598   offs_t A;
599599   UINT8 *rom = machine->region("audiocpu")->base();
600     
601     
600
601
602602   for (A = 0;A < 0x0800;A++)
603603      rom[A] = BITSWAP8(rom[A],7,6,5,4,3,2,0,1);
604604}
src/mame/machine/vsnes.c
r10613r10614
1111#include "video/ppu2c0x.h"
1212#include "includes/vsnes.h"
1313
14/* Globals */
15static int vsnes_do_vrom_bank;
1614
17/* Locals */
18static int input_latch[4];
19
20static int sound_fix=0;
21static UINT8 last_bank;
22
2315/* PPU notes */
2416/* nametable is, per Lord Nightmare, always 4K per PPU */
2517/* The vsnes system has relatively few banking options for CHR */
2618/* Each driver will use ROM or RAM for CHR, never both, and RAM is never banked */
2719/* This leads to the memory system being an optimal place to perform banking */
2820
29/* need double pointers for vsdual */
30static UINT8* vram = NULL;
31static UINT8* vrom[2];
32static UINT8* nt_ram[2];
33static UINT8* nt_page[2][4]; // because mirroring is used.
34static UINT32 vrom_size[2];
35static int vrom_banks;
36
3721/* Prototypes for mapping board components to PPU bus */
3822static WRITE8_HANDLER( vsnes_nt0_w );
3923static WRITE8_HANDLER( vsnes_nt1_w );
r10613r10614
5034
5135WRITE8_HANDLER( vsnes_in0_w )
5236{
37   vsnes_state *state = space->machine->driver_data<vsnes_state>();
5338   /* Toggling bit 0 high then low resets both controllers */
5439   if (data & 1)
5540   {
5641      /* load up the latches */
57      input_latch[0] = input_port_read(space->machine, "IN0");
58      input_latch[1] = input_port_read(space->machine, "IN1");
42      state->input_latch[0] = input_port_read(space->machine, "IN0");
43      state->input_latch[1] = input_port_read(space->machine, "IN1");
5944   }
6045}
6146
6247static READ8_HANDLER( gun_in0_r )
6348{
64   int ret = (input_latch[0]) & 1;
49   vsnes_state *state = space->machine->driver_data<vsnes_state>();
50   int ret = (state->input_latch[0]) & 1;
6551
6652   /* shift */
67   input_latch[0] >>= 1;
53   state->input_latch[0] >>= 1;
6854
6955   ret |= input_port_read(space->machine, "COINS");            /* merge coins, etc */
7056   ret |= (input_port_read(space->machine, "DSW0") & 3) << 3;      /* merge 2 dipswitches */
r10613r10614
7258/* The gun games expect a 1 returned on every 5th read after sound_fix is reset*/
7359/* Info Supplied by Ben Parnell <xodnizel@home.com> of FCE Ultra fame */
7460
75   if (sound_fix == 4)
61   if (state->sound_fix == 4)
7662   {
7763      ret = 1;
7864   }
7965
80   sound_fix++;
66   state->sound_fix++;
8167
8268   return ret;
8369
r10613r10614
8571
8672READ8_HANDLER( vsnes_in0_r )
8773{
74   vsnes_state *state = space->machine->driver_data<vsnes_state>();
8875
89   int ret = (input_latch[0]) & 1;
76   int ret = (state->input_latch[0]) & 1;
9077
9178   /* shift */
92   input_latch[0] >>= 1;
79   state->input_latch[0] >>= 1;
9380
9481   ret |= input_port_read(space->machine, "COINS");            /* merge coins, etc */
9582   ret |= (input_port_read(space->machine, "DSW0") & 3) << 3;      /* merge 2 dipswitches */
r10613r10614
10087
10188READ8_HANDLER( vsnes_in1_r )
10289{
103   int ret = (input_latch[1]) & 1;
90   vsnes_state *state = space->machine->driver_data<vsnes_state>();
91   int ret = (state->input_latch[1]) & 1;
10492
10593   ret |= input_port_read(space->machine, "DSW0") & ~3;         /* merge the rest of the dipswitches */
10694
10795   /* shift */
108   input_latch[1] >>= 1;
96   state->input_latch[1] >>= 1;
10997
11098   return ret;
11199}
112100
113101WRITE8_HANDLER( vsnes_in0_1_w )
114102{
103   vsnes_state *state = space->machine->driver_data<vsnes_state>();
115104   /* Toggling bit 0 high then low resets both controllers */
116105   if (data & 1)
117106   {
118107      /* load up the latches */
119      input_latch[2] = input_port_read(space->machine, "IN2");
120      input_latch[3] = input_port_read(space->machine, "IN3");
108      state->input_latch[2] = input_port_read(space->machine, "IN2");
109      state->input_latch[3] = input_port_read(space->machine, "IN3");
121110   }
122111}
123112
124113READ8_HANDLER( vsnes_in0_1_r )
125114{
126   int ret = (input_latch[2]) & 1;
115   vsnes_state *state = space->machine->driver_data<vsnes_state>();
116   int ret = (state->input_latch[2]) & 1;
127117
128118   /* shift */
129   input_latch[2] >>= 1;
119   state->input_latch[2] >>= 1;
130120
131121   ret |= input_port_read(space->machine, "COINS2");            /* merge coins, etc */
132122   ret |= (input_port_read(space->machine, "DSW1") & 3) << 3;      /* merge 2 dipswitches */
r10613r10614
135125
136126READ8_HANDLER( vsnes_in1_1_r )
137127{
138   int ret = (input_latch[3]) & 1;
128   vsnes_state *state = space->machine->driver_data<vsnes_state>();
129   int ret = (state->input_latch[3]) & 1;
139130
140131   ret |= input_port_read(space->machine, "DSW1") & ~3;         /* merge the rest of the dipswitches */
141132
142133   /* shift */
143   input_latch[3] >>= 1;
134   state->input_latch[3] >>= 1;
144135
145136   return ret;
146137
r10613r10614
154145
155146MACHINE_RESET( vsnes )
156147{
148   vsnes_state *state = machine->driver_data<vsnes_state>();
157149
158   last_bank = 0xff;
159   sound_fix = 0;
160   input_latch[0] = input_latch[1] = 0;
161   input_latch[2] = input_latch[3] = 0;
150   state->last_bank = 0xff;
151   state->sound_fix = 0;
152   state->input_latch[0] = state->input_latch[1] = 0;
153   state->input_latch[2] = state->input_latch[3] = 0;
162154
163155}
164156
r10613r10614
170162
171163MACHINE_RESET( vsdual )
172164{
165   vsnes_state *state = machine->driver_data<vsnes_state>();
173166
174   input_latch[0] = input_latch[1] = 0;
175   input_latch[2] = input_latch[3] = 0;
167   state->input_latch[0] = state->input_latch[1] = 0;
168   state->input_latch[2] = state->input_latch[3] = 0;
176169
177170}
178171
r10613r10614
184177
185178static void v_set_videorom_bank( running_machine* machine, int start, int count, int vrom_start_bank )
186179{
180   vsnes_state *state = machine->driver_data<vsnes_state>();
187181   int i;
188182
189183   assert(start + count <= 8);
190184
191   vrom_start_bank &= (vrom_banks - 1);
192   assert(vrom_start_bank + count <= vrom_banks);
185   vrom_start_bank &= (state->vrom_banks - 1);
186   assert(vrom_start_bank + count <= state->vrom_banks);
193187
194188   /* bank_size_in_kb is used to determine how large the "bank" parameter is */
195189   /* count determines the size of the area mapped */
r10613r10614
201195
202196MACHINE_START( vsnes )
203197{
198   vsnes_state *state = machine->driver_data<vsnes_state>();
204199   address_space *ppu1_space = cpu_get_address_space(machine->device("ppu1"), ADDRESS_SPACE_PROGRAM);
205200   int i;
206201
207202   /* establish nametable ram */
208   nt_ram[0] = auto_alloc_array(machine, UINT8, 0x1000);
203   state->nt_ram[0] = auto_alloc_array(machine, UINT8, 0x1000);
209204   /* set mirroring */
210   nt_page[0][0] = nt_ram[0];
211   nt_page[0][1] = nt_ram[0] + 0x400;
212   nt_page[0][2] = nt_ram[0] + 0x800;
213   nt_page[0][3] = nt_ram[0] + 0xc00;
205   state->nt_page[0][0] = state->nt_ram[0];
206   state->nt_page[0][1] = state->nt_ram[0] + 0x400;
207   state->nt_page[0][2] = state->nt_ram[0] + 0x800;
208   state->nt_page[0][3] = state->nt_ram[0] + 0xc00;
214209
215210   memory_install_readwrite8_handler(ppu1_space, 0x2000, 0x3eff, 0, 0, vsnes_nt0_r, vsnes_nt0_w);
216211
217   vrom[0] = machine->region("gfx1")->base();
218   vrom_size[0] = machine->region("gfx1")->bytes();
219   vrom_banks = vrom_size[0] / 0x400;
212   state->vrom[0] = machine->region("gfx1")->base();
213   state->vrom_size[0] = machine->region("gfx1")->bytes();
214   state->vrom_banks = state->vrom_size[0] / 0x400;
220215
221216   /* establish chr banks */
222217   /* bank 1 is used already! */
223218   /* DRIVER_INIT is called first - means we can handle this different for VRAM games! */
224   if (NULL != vrom[0])
219   if (NULL != state->vrom[0])
225220   {
226221      for (i = 0; i < 8; i++)
227222      {
228223         memory_install_read_bank(ppu1_space, 0x0400 * i, 0x0400 * i + 0x03ff, 0, 0, chr_banknames[i]);
229         memory_configure_bank(machine, chr_banknames[i], 0, vrom_banks, vrom[0], 0x400);
224         memory_configure_bank(machine, chr_banknames[i], 0, state->vrom_banks, state->vrom[0], 0x400);
230225      }
231226      v_set_videorom_bank(machine, 0, 8, 0);
232227   }
233228   else
234229   {
235      memory_install_ram(ppu1_space, 0x0000, 0x1fff, 0, 0, vram);
230      memory_install_ram(ppu1_space, 0x0000, 0x1fff, 0, 0, state->vram);
236231   }
237232}
238233
239234MACHINE_START( vsdual )
240235{
241   vrom[0] = machine->region("gfx1")->base();
242   vrom[1] = machine->region("gfx2")->base();
243   vrom_size[0] = machine->region("gfx1")->bytes();
244   vrom_size[1] = machine->region("gfx2")->bytes();
236   vsnes_state *state = machine->driver_data<vsnes_state>();
237   state->vrom[0] = machine->region("gfx1")->base();
238   state->vrom[1] = machine->region("gfx2")->base();
239   state->vrom_size[0] = machine->region("gfx1")->bytes();
240   state->vrom_size[1] = machine->region("gfx2")->bytes();
245241
246242   /* establish nametable ram */
247   nt_ram[0] = auto_alloc_array(machine, UINT8, 0x1000);
248   nt_ram[1] = auto_alloc_array(machine, UINT8, 0x1000);
243   state->nt_ram[0] = auto_alloc_array(machine, UINT8, 0x1000);
244   state->nt_ram[1] = auto_alloc_array(machine, UINT8, 0x1000);
249245   /* set mirroring */
250   nt_page[0][0] = nt_ram[0];
251   nt_page[0][1] = nt_ram[0] + 0x400;
252   nt_page[0][2] = nt_ram[0] + 0x800;
253   nt_page[0][3] = nt_ram[0] + 0xc00;
254   nt_page[1][0] = nt_ram[1];
255   nt_page[1][1] = nt_ram[1] + 0x400;
256   nt_page[1][2] = nt_ram[1] + 0x800;
257   nt_page[1][3] = nt_ram[1] + 0xc00;
246   state->nt_page[0][0] = state->nt_ram[0];
247   state->nt_page[0][1] = state->nt_ram[0] + 0x400;
248   state->nt_page[0][2] = state->nt_ram[0] + 0x800;
249   state->nt_page[0][3] = state->nt_ram[0] + 0xc00;
250   state->nt_page[1][0] = state->nt_ram[1];
251   state->nt_page[1][1] = state->nt_ram[1] + 0x400;
252   state->nt_page[1][2] = state->nt_ram[1] + 0x800;
253   state->nt_page[1][3] = state->nt_ram[1] + 0xc00;
258254
259255   memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu1"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, vsnes_nt0_r, vsnes_nt0_w);
260256   memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu2"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, vsnes_nt1_r, vsnes_nt1_w);
r10613r10614
262258   memory_install_read_bank(cpu_get_address_space(machine->device("ppu1"), ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, "bank2");
263259   // read only!
264260   memory_install_read_bank(cpu_get_address_space(machine->device("ppu2"), ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, "bank3");
265   memory_configure_bank(machine, "bank2", 0, vrom_size[0] / 0x2000, vrom[0], 0x2000);
266   memory_configure_bank(machine, "bank3", 0, vrom_size[1] / 0x2000, vrom[1], 0x2000);
261   memory_configure_bank(machine, "bank2", 0, state->vrom_size[0] / 0x2000, state->vrom[0], 0x2000);
262   memory_configure_bank(machine, "bank3", 0, state->vrom_size[1] / 0x2000, state->vrom[1], 0x2000);
267263   memory_set_bank(machine, "bank2", 0);
268264   memory_set_bank(machine, "bank3", 0);
269265}
r10613r10614
276272
277273static WRITE8_HANDLER( vsnes_nt0_w )
278274{
275   vsnes_state *state = space->machine->driver_data<vsnes_state>();
279276   int page = ((offset & 0xc00) >> 10);
280   nt_page[0][page][offset & 0x3ff] = data;
277   state->nt_page[0][page][offset & 0x3ff] = data;
281278}
282279
283280static WRITE8_HANDLER( vsnes_nt1_w )
284281{
282   vsnes_state *state = space->machine->driver_data<vsnes_state>();
285283   int page = ((offset & 0xc00) >> 10);
286   nt_page[1][page][offset & 0x3ff] = data;
284   state->nt_page[1][page][offset & 0x3ff] = data;
287285}
288286
289287static READ8_HANDLER( vsnes_nt0_r )
290288{
289   vsnes_state *state = space->machine->driver_data<vsnes_state>();
291290   int page = ((offset&0xc00) >> 10);
292   return nt_page[0][page][offset & 0x3ff];
291   return state->nt_page[0][page][offset & 0x3ff];
293292}
294293
295294static READ8_HANDLER( vsnes_nt1_r )
296295{
296   vsnes_state *state = space->machine->driver_data<vsnes_state>();
297297   int page = ((offset & 0xc00) >> 10);
298   return nt_page[1][page][offset & 0x3ff];
298   return state->nt_page[1][page][offset & 0x3ff];
299299}
300300
301static void v_set_mirroring( int ppu, int mirroring )
301static void v_set_mirroring( vsnes_state *state, int ppu, int mirroring )
302302{
303303   switch (mirroring)
304304   {
305305   case PPU_MIRROR_LOW:
306      nt_page[ppu][0] = nt_page[ppu][1] = nt_page[ppu][2] = nt_page[ppu][3] = nt_ram[ppu];
306      state->nt_page[ppu][0] = state->nt_page[ppu][1] = state->nt_page[ppu][2] = state->nt_page[ppu][3] = state->nt_ram[ppu];
307307      break;
308308   case PPU_MIRROR_HIGH:
309      nt_page[ppu][0] = nt_page[ppu][1] = nt_page[ppu][2] = nt_page[ppu][3] = nt_ram[ppu] + 0x400;
309      state->nt_page[ppu][0] = state->nt_page[ppu][1] = state->nt_page[ppu][2] = state->nt_page[ppu][3] = state->nt_ram[ppu] + 0x400;
310310      break;
311311   case PPU_MIRROR_HORZ:
312      nt_page[ppu][0] = nt_ram[ppu];
313      nt_page[ppu][1] = nt_ram[ppu];
314      nt_page[ppu][2] = nt_ram[ppu] + 0x400;
315      nt_page[ppu][3] = nt_ram[ppu] + 0x400;
312      state->nt_page[ppu][0] = state->nt_ram[ppu];
313      state->nt_page[ppu][1] = state->nt_ram[ppu];
314      state->nt_page[ppu][2] = state->nt_ram[ppu] + 0x400;
315      state->nt_page[ppu][3] = state->nt_ram[ppu] + 0x400;
316316      break;
317317   case PPU_MIRROR_VERT:
318      nt_page[ppu][0] = nt_ram[ppu];
319      nt_page[ppu][1] = nt_ram[ppu] + 0x400;
320      nt_page[ppu][2] = nt_ram[ppu];
321      nt_page[ppu][3] = nt_ram[ppu] + 0x400;
318      state->nt_page[ppu][0] = state->nt_ram[ppu];
319      state->nt_page[ppu][1] = state->nt_ram[ppu] + 0x400;
320      state->nt_page[ppu][2] = state->nt_ram[ppu];
321      state->nt_page[ppu][3] = state->nt_ram[ppu] + 0x400;
322322      break;
323323   case PPU_MIRROR_NONE:
324324   default:
325      nt_page[ppu][0] = nt_ram[ppu];
326      nt_page[ppu][1] = nt_ram[ppu] + 0x400;
327      nt_page[ppu][2] = nt_ram[ppu] + 0x800;
328      nt_page[ppu][3] = nt_ram[ppu] + 0xc00;
325      state->nt_page[ppu][0] = state->nt_ram[ppu];
326      state->nt_page[ppu][1] = state->nt_ram[ppu] + 0x400;
327      state->nt_page[ppu][2] = state->nt_ram[ppu] + 0x800;
328      state->nt_page[ppu][3] = state->nt_ram[ppu] + 0xc00;
329329      break;
330330   }
331331
r10613r10614
362362
363363static WRITE8_HANDLER( gun_in0_w )
364364{
365   vsnes_state *state = space->machine->driver_data<vsnes_state>();
365366   device_t *ppu1 = space->machine->device("ppu1");
366   static int zapstore;
367367
368   if (vsnes_do_vrom_bank)
368   if (state->do_vrom_bank)
369369   {
370370      /* switch vrom */
371371      v_set_videorom_bank(space->machine, 0, 8, (data & 4) ? 8 : 0);
r10613r10614
376376   {
377377
378378      /* load up the latches */
379      input_latch[0] = input_port_read(space->machine, "IN0");
379      state->input_latch[0] = input_port_read(space->machine, "IN0");
380380
381381      /* do the gun thing */
382382      int x = input_port_read(space->machine, "GUNX");
r10613r10614
393393      if ((pix == color_base + 0x20 ) || (pix == color_base + 0x30) ||
394394         (pix == color_base + 0x33 ) || (pix == color_base + 0x34))
395395      {
396         input_latch[0] |= 0x40;
396         state->input_latch[0] |= 0x40;
397397      }
398398
399      input_latch[1] = input_port_read(space->machine, "IN1");
399      state->input_latch[1] = input_port_read(space->machine, "IN1");
400400   }
401401
402    if ((zapstore & 1) && (!(data & 1)))
402    if ((state->zapstore & 1) && (!(data & 1)))
403403   /* reset sound_fix to keep sound from hanging */
404404    {
405      sound_fix = 0;
405      state->sound_fix = 0;
406406   }
407407
408    zapstore = data;
408    state->zapstore = data;
409409}
410410
411411DRIVER_INIT( vsgun )
412412{
413   vsnes_state *state = machine->driver_data<vsnes_state>();
413414   /* VROM switching is enabled with bit 2 of $4016 */
414415   memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, gun_in0_r, gun_in0_w);
415   vsnes_do_vrom_bank = 1;
416   state->do_vrom_bank = 1;
416417}
417418
418419/**********************************************************************************/
r10613r10614
460461
461462static WRITE8_HANDLER( vsgshoe_gun_in0_w )
462463{
463   static int old_bank = 0;
464   vsnes_state *state = space->machine->driver_data<vsnes_state>();
464465   int addr;
465   if((data & 0x04) != old_bank)
466   if((data & 0x04) != state->old_bank)
466467   {
467468      UINT8 *prg = space->machine->region("maincpu")->base();
468      old_bank = data & 0x04;
469      addr = old_bank ? 0x12000: 0x10000;
469      state->old_bank = data & 0x04;
470      addr = state->old_bank ? 0x12000: 0x10000;
470471      memcpy(&prg[0x08000], &prg[addr], 0x2000);
471472   }
472473
r10613r10614
475476
476477DRIVER_INIT( vsgshoe )
477478{
479   vsnes_state *state = machine->driver_data<vsnes_state>();
478480   /* set up the default bank */
479481   UINT8 *prg = machine->region("maincpu")->base();
480482   memcpy (&prg[0x08000], &prg[0x12000], 0x2000);
r10613r10614
482484   /* vrom switching is enabled with bit 2 of $4016 */
483485   memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, gun_in0_r, vsgshoe_gun_in0_w);
484486
485   vsnes_do_vrom_bank = 1;
487   state->do_vrom_bank = 1;
486488}
487489
488490/**********************************************************************************/
489491/* Dr Mario: ROMs bankings at $8000-$ffff */
490492
491static int drmario_shiftreg;
492static int drmario_shiftcount;
493493
494494static WRITE8_HANDLER( drmario_rom_banking )
495495{
496   vsnes_state *state = space->machine->driver_data<vsnes_state>();
496497   /* basically, a MMC1 mapper from the nes */
497   static int size16k, switchlow, vrom4k;
498498
499499   int reg = (offset >> 13);
500500
501501   /* reset mapper */
502502   if (data & 0x80)
503503   {
504      drmario_shiftreg = drmario_shiftcount = 0;
504      state->drmario_shiftreg = state->drmario_shiftcount = 0;
505505
506      size16k = 1;
506      state->size16k = 1;
507507
508      switchlow = 1;
509      vrom4k = 0;
508      state->switchlow = 1;
509      state->vrom4k = 0;
510510
511511      return;
512512   }
513513
514514   /* see if we need to clock in data */
515   if (drmario_shiftcount < 5)
515   if (state->drmario_shiftcount < 5)
516516   {
517      drmario_shiftreg >>= 1;
518      drmario_shiftreg |= (data & 1) << 4;
519      drmario_shiftcount++;
517      state->drmario_shiftreg >>= 1;
518      state->drmario_shiftreg |= (data & 1) << 4;
519      state->drmario_shiftcount++;
520520   }
521521
522522   /* are we done shifting? */
523   if (drmario_shiftcount == 5)
523   if (state->drmario_shiftcount == 5)
524524   {
525525      /* reset count */
526      drmario_shiftcount = 0;
526      state->drmario_shiftcount = 0;
527527
528528      /* apply data to registers */
529529      switch (reg)
r10613r10614
532532            {
533533               int mirroring;
534534
535               vrom4k = drmario_shiftreg & 0x10;
536               size16k = drmario_shiftreg & 0x08;
537               switchlow = drmario_shiftreg & 0x04;
535               state->vrom4k = state->drmario_shiftreg & 0x10;
536               state->size16k = state->drmario_shiftreg & 0x08;
537               state->switchlow = state->drmario_shiftreg & 0x04;
538538
539               switch (drmario_shiftreg & 3)
539               switch (state->drmario_shiftreg & 3)
540540               {
541541                  case 0:
542542                     mirroring = PPU_MIRROR_LOW;
r10613r10614
557557               }
558558
559559               /* apply mirroring */
560               v_set_mirroring(1, mirroring);
560               v_set_mirroring(state, 1, mirroring);
561561            }
562562         break;
563563
564564         case 1:   /* video rom banking - bank 0 - 4k or 8k */
565            if (!vram)
566               v_set_videorom_bank(space->machine, 0, (vrom4k) ? 4 : 8, drmario_shiftreg * 4);
565            if (!state->vram)
566               v_set_videorom_bank(space->machine, 0, (state->vrom4k) ? 4 : 8, state->drmario_shiftreg * 4);
567567         break;
568568
569569         case 2: /* video rom banking - bank 1 - 4k only */
570            if (vrom4k && !vram)
571               v_set_videorom_bank(space->machine, 4, 4, drmario_shiftreg * 4);
570            if (state->vrom4k && !state->vram)
571               v_set_videorom_bank(space->machine, 4, 4, state->drmario_shiftreg * 4);
572572         break;
573573
574574         case 3:   /* program banking */
575575            {
576               int bank = (drmario_shiftreg & 0x03) * 0x4000;
576               int bank = (state->drmario_shiftreg & 0x03) * 0x4000;
577577               UINT8 *prg = space->machine->region("maincpu")->base();
578578
579               if (!size16k)
579               if (!state->size16k)
580580               {
581581                  /* switch 32k */
582582                  memcpy(&prg[0x08000], &prg[0x010000 + bank], 0x8000);
r10613r10614
584584               else
585585               {
586586                  /* switch 16k */
587                  if (switchlow)
587                  if (state->switchlow)
588588                  {
589589                     /* low */
590590                     memcpy(&prg[0x08000], &prg[0x010000 + bank], 0x4000);
r10613r10614
599599         break;
600600      }
601601
602      drmario_shiftreg = 0;
602      state->drmario_shiftreg = 0;
603603   }
604604}
605605
606606DRIVER_INIT( drmario )
607607{
608   vsnes_state *state = machine->driver_data<vsnes_state>();
608609   /* We do manual banking, in case the code falls through */
609610   /* Copy the initial banks */
610611   UINT8 *prg = machine->region("maincpu")->base();
r10613r10614
614615   /* MMC1 mapper at writes to $8000-$ffff */
615616   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, drmario_rom_banking);
616617
617   drmario_shiftreg = 0;
618   drmario_shiftcount = 0;
618   state->drmario_shiftreg = 0;
619   state->drmario_shiftcount = 0;
619620}
620621
621622/**********************************************************************************/
r10613r10614
631632
632633DRIVER_INIT( vsvram )
633634{
635   vsnes_state *state = machine->driver_data<vsnes_state>();
634636   /* when starting the game, the 1st 16k and the last 16k are loaded into the 2 banks */
635637   UINT8 *prg = machine->region("maincpu")->base();
636638   memcpy(&prg[0x08000], &prg[0x28000], 0x8000);
r10613r10614
638640   /* banking is done with writes to the $8000-$ffff area */
639641   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, vsvram_rom_banking);
640642
641   /* allocate vram */
642   vram = auto_alloc_array(machine, UINT8, 0x2000);
643   /* allocate state->vram */
644   state->vram = auto_alloc_array(machine, UINT8, 0x2000);
643645}
644646
645647/**********************************************************************************/
646648
647static int MMC3_cmd;
648static int MMC3_prg_bank[4];
649static int MMC3_chr_bank[6];
650static int MMC3_prg_mask;
651static int IRQ_enable, IRQ_count, IRQ_count_latch;
652649
653650static void mapper4_set_prg( running_machine *machine )
654651{
652   vsnes_state *state = machine->driver_data<vsnes_state>();
655653   UINT8 *prg = machine->region("maincpu")->base();
656   UINT8 prg_flip = (MMC3_cmd & 0x40) ? 2 : 0;
654   UINT8 prg_flip = (state->MMC3_cmd & 0x40) ? 2 : 0;
657655
658   memcpy(&prg[0x8000], &prg[0x2000 * (MMC3_prg_bank[0 ^ prg_flip] & MMC3_prg_mask) + 0x10000], 0x2000);
659   memcpy(&prg[0xa000], &prg[0x2000 * (MMC3_prg_bank[1] & MMC3_prg_mask) + 0x10000], 0x2000);
660   memcpy(&prg[0xc000], &prg[0x2000 * (MMC3_prg_bank[2 ^ prg_flip] & MMC3_prg_mask) + 0x10000], 0x2000);
661   memcpy(&prg[0xe000], &prg[0x2000 * (MMC3_prg_bank[3] & MMC3_prg_mask) + 0x10000], 0x2000);
656   memcpy(&prg[0x8000], &prg[0x2000 * (state->MMC3_prg_bank[0 ^ prg_flip] & state->MMC3_prg_mask) + 0x10000], 0x2000);
657   memcpy(&prg[0xa000], &prg[0x2000 * (state->MMC3_prg_bank[1] & state->MMC3_prg_mask) + 0x10000], 0x2000);
658   memcpy(&prg[0xc000], &prg[0x2000 * (state->MMC3_prg_bank[2 ^ prg_flip] & state->MMC3_prg_mask) + 0x10000], 0x2000);
659   memcpy(&prg[0xe000], &prg[0x2000 * (state->MMC3_prg_bank[3] & state->MMC3_prg_mask) + 0x10000], 0x2000);
662660}
663661
664662static void mapper4_set_chr( running_machine *machine )
665663{
666   UINT8 chr_page = (MMC3_cmd & 0x80) >> 5;
664   vsnes_state *state = machine->driver_data<vsnes_state>();
665   UINT8 chr_page = (state->MMC3_cmd & 0x80) >> 5;
667666
668   v_set_videorom_bank(machine, chr_page ^ 0, 1, MMC3_chr_bank[0] & ~0x01);
669   v_set_videorom_bank(machine, chr_page ^ 1, 1, MMC3_chr_bank[0] |  0x01);
670   v_set_videorom_bank(machine, chr_page ^ 2, 1, MMC3_chr_bank[1] & ~0x01);
671   v_set_videorom_bank(machine, chr_page ^ 3, 1, MMC3_chr_bank[1] |  0x01);
672   v_set_videorom_bank(machine, chr_page ^ 4, 1, MMC3_chr_bank[2]);
673   v_set_videorom_bank(machine, chr_page ^ 5, 1, MMC3_chr_bank[3]);
674   v_set_videorom_bank(machine, chr_page ^ 6, 1, MMC3_chr_bank[4]);
675   v_set_videorom_bank(machine, chr_page ^ 7, 1, MMC3_chr_bank[5]);
667   v_set_videorom_bank(machine, chr_page ^ 0, 1, state->MMC3_chr_bank[0] & ~0x01);
668   v_set_videorom_bank(machine, chr_page ^ 1, 1, state->MMC3_chr_bank[0] |  0x01);
669   v_set_videorom_bank(machine, chr_page ^ 2, 1, state->MMC3_chr_bank[1] & ~0x01);
670   v_set_videorom_bank(machine, chr_page ^ 3, 1, state->MMC3_chr_bank[1] |  0x01);
671   v_set_videorom_bank(machine, chr_page ^ 4, 1, state->MMC3_chr_bank[2]);
672   v_set_videorom_bank(machine, chr_page ^ 5, 1, state->MMC3_chr_bank[3]);
673   v_set_videorom_bank(machine, chr_page ^ 6, 1, state->MMC3_chr_bank[4]);
674   v_set_videorom_bank(machine, chr_page ^ 7, 1, state->MMC3_chr_bank[5]);
676675}
677676
678677#define BOTTOM_VISIBLE_SCANLINE   239      /* The bottommost visible scanline */
r10613r10614
680679
681680static void mapper4_irq( device_t *device, int scanline, int vblank, int blanked )
682681{
682   vsnes_state *state = device->machine->driver_data<vsnes_state>();
683683   if (scanline < PPU_BOTTOM_VISIBLE_SCANLINE)
684684   {
685      int priorCount = IRQ_count;
686      if ((IRQ_count == 0))
685      int priorCount = state->IRQ_count;
686      if ((state->IRQ_count == 0))
687687      {
688         IRQ_count = IRQ_count_latch;
688         state->IRQ_count = state->IRQ_count_latch;
689689      }
690690      else
691         IRQ_count--;
691         state->IRQ_count--;
692692
693      if (IRQ_enable && !blanked && (IRQ_count == 0) && priorCount)
693      if (state->IRQ_enable && !blanked && (state->IRQ_count == 0) && priorCount)
694694      {
695695         cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE);
696696      }
r10613r10614
699699
700700static WRITE8_HANDLER( mapper4_w )
701701{
702   vsnes_state *state = space->machine->driver_data<vsnes_state>();
702703   device_t *ppu1 = space->machine->device("ppu1");
703704   UINT8 MMC3_helper, cmd;
704705
705706   switch (offset & 0x6001)
706707   {
707708      case 0x0000: /* $8000 */
708         MMC3_helper = MMC3_cmd ^ data;
709         MMC3_cmd = data;
709         MMC3_helper = state->MMC3_cmd ^ data;
710         state->MMC3_cmd = data;
710711
711712         /* Has PRG Mode changed? */
712713         if (MMC3_helper & 0x40)
r10613r10614
718719         break;
719720
720721      case 0x0001: /* $8001 */
721         cmd = MMC3_cmd & 0x07;
722         cmd = state->MMC3_cmd & 0x07;
722723         switch (cmd)
723724         {
724725            case 0: case 1:   // these do not need to be separated: we take care of them in set_chr!
725726            case 2: case 3: case 4: case 5:
726               MMC3_chr_bank[cmd] = data;
727               state->MMC3_chr_bank[cmd] = data;
727728               mapper4_set_chr(space->machine);
728729               break;
729730            case 6:
730731            case 7:
731               MMC3_prg_bank[cmd - 6] = data;
732               state->MMC3_prg_bank[cmd - 6] = data;
732733               mapper4_set_prg(space->machine);
733734               break;
734735         }
r10613r10614
736737
737738      case 0x2000: /* $a000 */
738739         if (data & 0x40)
739            v_set_mirroring(1, PPU_MIRROR_HIGH);
740            v_set_mirroring(state, 1, PPU_MIRROR_HIGH);
740741         else
741742         {
742743            if (data & 0x01)
743               v_set_mirroring(1, PPU_MIRROR_HORZ);
744               v_set_mirroring(state, 1, PPU_MIRROR_HORZ);
744745            else
745               v_set_mirroring(1, PPU_MIRROR_VERT);
746               v_set_mirroring(state, 1, PPU_MIRROR_VERT);
746747         }
747748         break;
748749
r10613r10614
751752
752753         break;
753754      case 0x4000: /* $c000 - IRQ scanline counter */
754         IRQ_count = data;
755         state->IRQ_count = data;
755756
756757         break;
757758
758759      case 0x4001: /* $c001 - IRQ scanline latch */
759         IRQ_count_latch = data;
760         state->IRQ_count_latch = data;
760761
761762         break;
762763
763764      case 0x6000: /* $e000 - Disable IRQs */
764         IRQ_enable = 0;
765         IRQ_count = IRQ_count_latch;
765         state->IRQ_enable = 0;
766         state->IRQ_count = state->IRQ_count_latch;
766767
767768         ppu2c0x_set_scanline_callback (ppu1, 0);
768769
769770         break;
770771
771772      case 0x6001: /* $e001 - Enable IRQs */
772         IRQ_enable = 1;
773         state->IRQ_enable = 1;
773774         ppu2c0x_set_scanline_callback (ppu1, mapper4_irq);
774775
775776         break;
r10613r10614
784785
785786DRIVER_INIT( MMC3 )
786787{
788   vsnes_state *state = machine->driver_data<vsnes_state>();
787789   UINT8 *prg = machine->region("maincpu")->base();
788   IRQ_enable = IRQ_count = IRQ_count_latch = 0;
790   state->IRQ_enable = state->IRQ_count = state->IRQ_count_latch = 0;
789791   int MMC3_prg_chunks = (machine->region("maincpu")->bytes() - 0x10000) / 0x4000;
790792
791   MMC3_prg_bank[0] = MMC3_prg_bank[2] = 0xfe;
792   MMC3_prg_bank[1] = MMC3_prg_bank[3] = 0xff;
793   MMC3_cmd = 0;
793   state->MMC3_prg_bank[0] = state->MMC3_prg_bank[2] = 0xfe;
794   state->MMC3_prg_bank[1] = state->MMC3_prg_bank[3] = 0xff;
795   state->MMC3_cmd = 0;
794796
795   MMC3_prg_mask = ((MMC3_prg_chunks << 1) - 1);
797   state->MMC3_prg_mask = ((MMC3_prg_chunks << 1) - 1);
796798
797799   memcpy(&prg[0x8000], &prg[(MMC3_prg_chunks - 1) * 0x4000 + 0x10000], 0x2000);
798800   memcpy(&prg[0xa000], &prg[(MMC3_prg_chunks - 1) * 0x4000 + 0x12000], 0x2000);
r10613r10614
810812
811813static READ8_HANDLER( rbi_hack_r )
812814{
815   vsnes_state *state = space->machine->driver_data<vsnes_state>();
813816   /* Supplied by Ben Parnell <xodnizel@home.com> of FCE Ultra fame */
814817
815   static int VSindex;
816818
817819   if (offset == 0)
818820   {
819      VSindex=0;
821      state->VSindex=0;
820822      return 0xFF;
821823
822824   }
823825   else
824826   {
825      switch(VSindex++)
827      switch(state->VSindex++)
826828      {
827829         case 9:
828830             return 0x6F;
r10613r10614
846848
847849/* Vs. Super Xevious */
848850
849static int supxevs_prot_index = 0;
850851
851852static READ8_HANDLER( supxevs_read_prot_1_r )
852853{
r10613r10614
855856
856857static READ8_HANDLER( supxevs_read_prot_2_r )
857858{
858   if (supxevs_prot_index)
859   vsnes_state *state = space->machine->driver_data<vsnes_state>();
860   if (state->supxevs_prot_index)
859861      return 0;
860862   else
861863      return 0x01;
r10613r10614
863865
864866static READ8_HANDLER( supxevs_read_prot_3_r )
865867{
866   if (supxevs_prot_index)
868   vsnes_state *state = space->machine->driver_data<vsnes_state>();
869   if (state->supxevs_prot_index)
867870      return 0xd1;
868871   else
869872      return 0x89;
r10613r10614
871874
872875static READ8_HANDLER( supxevs_read_prot_4_r )
873876{
874   if (supxevs_prot_index)
877   vsnes_state *state = space->machine->driver_data<vsnes_state>();
878   if (state->supxevs_prot_index)
875879   {
876      supxevs_prot_index = 0;
880      state->supxevs_prot_index = 0;
877881      return 0x3e;
878882   }
879883   else
880884   {
881      supxevs_prot_index = 1;
885      state->supxevs_prot_index = 1;
882886      return 0x37;
883887   }
884888}
r10613r10614
899903
900904static READ8_HANDLER( tko_security_r )
901905{
902   static int security_counter;
906   vsnes_state *state = space->machine->driver_data<vsnes_state>();
903907   static const UINT8 security_data[] = {
904908      0xff, 0xbf, 0xb7, 0x97, 0x97, 0x17, 0x57, 0x4f,
905909      0x6f, 0x6b, 0xeb, 0xa9, 0xb1, 0x90, 0x94, 0x14,
r10613r10614
909913
910914   if (offset == 0)
911915   {
912      security_counter = 0;
916      state->security_counter = 0;
913917      return 0;
914918   }
915919
916   return security_data[(security_counter++)];
920   return security_data[(state->security_counter++)];
917921
918922}
919923
r10613r10614
929933
930934DRIVER_INIT( vsfdf )
931935{
936   vsnes_state *state = machine->driver_data<vsnes_state>();
932937   DRIVER_INIT_CALL(MMC3);
933938
934939   memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4016, 0x4016, 0, 0, gun_in0_r, gun_in0_w);
935940
936   vsnes_do_vrom_bank = 0;
941   state->do_vrom_bank = 0;
937942}
938943
939944/**********************************************************************************/
r10613r10614
987992/**********************************************************************************/
988993/* Vs. Raid on Bungeling Bay (Japan) */
989994
990static int ret;
991995static WRITE8_HANDLER( set_bnglngby_irq_w )
992996{
993   ret = data;
997   vsnes_state *state = space->machine->driver_data<vsnes_state>();
998   state->ret = data;
994999   cputag_set_input_line(space->machine, "maincpu", 0, (data & 2) ? ASSERT_LINE : CLEAR_LINE);
9951000   /* other values ??? */
9961001   /* 0, 4, 84 */
r10613r10614
9981003
9991004static READ8_HANDLER( set_bnglngby_irq_r )
10001005{
1001   return ret;
1006   vsnes_state *state = space->machine->driver_data<vsnes_state>();
1007   return state->ret;
10021008}
10031009
10041010DRIVER_INIT( bnglngby )
10051011{
1012   vsnes_state *state = machine->driver_data<vsnes_state>();
10061013   memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0231, 0x0231, 0, 0, set_bnglngby_irq_r, set_bnglngby_irq_w);
10071014
10081015   /* extra ram */
10091016   memory_install_ram(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x6000, 0x7fff, 0, 0, NULL);
10101017
1011   ret = 0;
1018   state->ret = 0;
10121019
10131020   /* normal banking */
10141021   DRIVER_INIT_CALL(vsnormal);
src/mame/machine/megadriv.c
r10613r10614
38653865
38663866
38673867#define TOCCMD_CURPOS    (0x0)
3868#define TOCCMD_TRKPOS     (0x1)
3868#define TOCCMD_TRKPOS    (0x1)
38693869#define TOCCMD_CURTRK    (0x2)
38703870#define TOCCMD_LENGTH    (0x3)
38713871#define TOCCMD_FIRSTLAST (0x4)
r10613r10614
41814181   int elapsedlba;
41824182   UINT32 msf;
41834183   CDD_STATUS &= 0xFF;
4184   //   UINT32 end_msf = ;
4184   //  UINT32 end_msf = ;
41854185   if(segacd.cd == NULL) // no cd is there, bail out
41864186      return;
41874187   CDD_STATUS |= SCD_STATUS;
r10613r10614
45064506      {
45074507         space->write_byte(0xff2000+(((dstoffset*2)+1)&0x1fff),data >> 8);
45084508         space->write_byte(0xff2000+(((dstoffset*2)+3)&0x1fff),data & 0xff);
4509      //   printf("PCM_DMA writing %04x %04x\n",0xff2000+(dstoffset*2), data);
4509      //  printf("PCM_DMA writing %04x %04x\n",0xff2000+(dstoffset*2), data);
45104510      }
45114511      else
45124512      {
r10613r10614
46944694{
46954695   "Get Status",         // 0
46964696   "Stop ALL",            // 1
4697   "Handle TOC",          // 2
4697   "Handle TOC",         // 2
46984698   "Play",               // 3
46994699   "Seek",               // 4
47004700   "<undefined>",         // 5
r10613r10614
52735273         // do we care about the ret bit?? HOTA is missing some startup screens...
52745274         //if (!segacd_ret)
52755275         //{
5276         //   return segacd_dataram[offset+0x20000/2];
5276         //  return segacd_dataram[offset+0x20000/2];
52775277         //}
52785278         //else
52795279         {
r10613r10614
59015901   segacd_gfx_conversion_timer->adjust(attotime::never);
59025902
59035903   segacd_hock_timer = machine->scheduler().timer_alloc(FUNC(segacd_access_timer_callback));
5904//   segacd_hock_timer->adjust( attotime::from_nsec(20000000), 0, attotime::from_nsec(20000000));
5904//  segacd_hock_timer->adjust( attotime::from_nsec(20000000), 0, attotime::from_nsec(20000000));
59055905   segacd_hock_timer->adjust( attotime::from_hz(75),0, attotime::from_hz(75));
59065906
59075907   segacd_irq3_timer = machine->scheduler().timer_alloc(FUNC(segacd_irq3_timer_callback));
r10613r10614
61256125{
61266126   UINT16 control = CDD_CONTROL;
61276127
6128//   printf("segacd_irq_mask_w %04x %04x (CDD control is %04x)\n",data, mem_mask, control);
6128//  printf("segacd_irq_mask_w %04x %04x (CDD control is %04x)\n",data, mem_mask, control);
61296129
61306130   if (data & 0x10)
61316131   {
r10613r10614
62076207   {
62086208      segacd_stampsize = data & 0x07;
62096209      //if (data & 0xf8)
6210      //   printf("    unused bits (LSB) set in stampsize!\n");
6210      //  printf("    unused bits (LSB) set in stampsize!\n");
62116211
62126212      //if (data&1) printf("    Repeat On\n");
62136213      //else printf("    Repeat Off\n");
r10613r10614
64466446static WRITE16_HANDLER( segacd_imagebuffer_offset_w )
64476447{
64486448   COMBINE_DATA(&segacd_imagebuffer_offset);
6449//   printf("segacd_imagebuffer_offset_w %04x\n", segacd_imagebuffer_offset);
6449//  printf("segacd_imagebuffer_offset_w %04x\n", segacd_imagebuffer_offset);
64506450}
64516451
64526452static READ16_HANDLER( segacd_imagebuffer_vcell_size_r )
src/mame/machine/zs01.c
r10613r10614
415415                     switch(write_buffer[0] & 1) {
416416                     case COMMAND_WRITE:
417417                        memcpy(&data[data_offset()], &write_buffer[2], SIZE_DATA_BUFFER);
418                       
418
419419                        /* todo: find out what should be returned. */
420420                        memset(&read_buffer[0] , 0, SIZE_WRITE_BUFFER);
421421                        break;
r10613r10614
519519         verboselog(1, "goto start\n");
520520         state = STATE_LOAD_COMMAND;
521521         break;
522         //   default:
523         //      verboselog(1, "skipped start (default)\n");
524         //      break;
522         //  default:
523         //      verboselog(1, "skipped start (default)\n");
524         //      break;
525525      }
526526
527527      bit = 0;
src/mame/machine/naomibd.c
r10613r10614
22
33    Naomi plug-in board emulator
44
5    emulator by Samuele Zannoli
6    protection chip by R. Belmont, reverse engineering by Deunan Knute
5    emulator by Samuele Zannoli and R. Belmont
6    reverse engineering by ElSemi, Deunan Knute, Andreas Naive, Olivier Galibert, and Cah4e3
77
88**************************************************************************/
99
r10613r10614
6161    In other words, disable DMA once before using PIO (most games using both access types do that when the DMA terminates).
6262    This bit is also used to reset the chip's internal protection mechanism on "Oh! My Goddess" to a known state.
6363
64    * bit 29 (mode bit 1) is address shuffle bit
64    * bit 29 (mode bit 1) is "M1" compression bit on Actel carts, other functions on others
6565    It's actually the opposite, when set the addressing is following the chip layout and when cleared the protection chip will have it's fun
66    with address lines 10 to 23(?). It's not a simple swap function, rather a lookup table and one with repeating results too.
67    The few games I got to work never made any use of that bit, it's always set for all normal reads.
66    doing a decompression + XOR on the data for Actel carts.  Non-Actel carts may ignore this bit or remap the address space.
6867
6968    * bit 28 (mode bit 0) is unused (so far)
7069    Or it could really be the last address bit to allow up to 512MB of data on a cart?
r10613r10614
179178
180179#define NAOMIBD_FLAG_AUTO_ADVANCE   (8)   // address auto-advances on read
181180#define NAOMIBD_FLAG_SPECIAL_MODE   (4)   // used to access protection registers
182#define NAOMIBD_FLAG_ADDRESS_SHUFFLE   (2)   // 0 to let protection chip en/decrypt, 1 for normal
181#define NAOMIBD_FLAG_DMA_COMPRESSION    (2)   // 0 protection chip decompresses DMA data, 1 for normal DMA reads
183182
184#define NAOMIBD_PRINTF_PROTECTION   (1)   // 1 to printf protection access details
183#define NAOMIBD_PRINTF_PROTECTION   (0)   // 1 to printf protection access details
185184
186185/*************************************
187186 *
r10613r10614
189188 *
190189 *************************************/
191190
192#define MAX_PROT_REGIONS   (32)
191#define PACK_BUF_SIZE (32768)
193192
193enum
194{
195   CMD_READY = 0,
196   CMD_FETCH,
197   CMD_REPEAT
198};
199
194200typedef struct _naomibd_config_table naomibd_config_table;
195201struct _naomibd_config_table
196202{
197203   const char *name;
198   int reverse_bytes;
199   int live_key;
200   UINT32   transtbl[MAX_PROT_REGIONS*3];
204   int m2m3_key;
205    int m1_key;
201206};
202207
208typedef struct _naomibd_prot naomibd_prot;
209struct _naomibd_prot
210{
211   UINT16 last_word, aux_word, pak_word, heading_word;
212   UINT16 *ptr;
213   int count, pak_bit, control_bits, pak_state, dec_count, pak_buf_size, pak_buf_pos;
214    int pak_fetch_ofs;
215    UINT8 pak_byte, cmd_byte;
216    int seed;
217    UINT8 pak_buf[PACK_BUF_SIZE];
218
219    UINT8 *s_input;
220    UINT8 s_xor[4];
221    UINT8 s_dict[111];
222    int s_subst, s_out_len, s_out_cnt, s_shift, s_bits, s_in_len, s_in_pos;
223};
224
203225typedef struct _naomibd_state naomibd_state;
204226struct _naomibd_state
205227{
r10613r10614
208230   device_t *device;            /* pointer to our containing device */
209231
210232   UINT8 *            memory;
211   UINT8 *            protdata;
212233   chd_file *         gdromchd;
213234   UINT8 *            picdata;
214235   UINT32            rom_offset, rom_offset_flags, dma_count;
r10613r10614
216237   UINT32            prot_offset, prot_key;
217238   UINT32            aw_offset, aw_file_base, aw_file_offset;
218239
219   INT32            prot_sum;
220
221   const UINT32         *prot_translate;
222   int            prot_reverse_bytes;
223
224240   // live decrypt vars
225   UINT32            dc_gamekey, dc_seqkey, dc_seed;
226   UINT8            dc_cart_ram[128*1024];   // internal cartridge RAM
227   INT32            dc_m3_ptr, dc_m2_ptr, dc_readback;
241   UINT32            dc_gamekey, dc_seqkey, dc_dmakey;
242   UINT8            dc_cart_ram[256*1024];   // internal cartridge RAM
243   INT32            dc_m3_ptr;
228244
229   #if NAOMIBD_PRINTF_PROTECTION
230   int            prot_pio_count;
231   #endif
245   naomibd_prot      prot;
232246};
233247
234248// maps protection offsets to real addresses
r10613r10614
237251static const naomibd_config_table naomibd_translate_tbl[] =
238252{
239253   // games where on-the-fly decryption works (many of these are fully playable in MAME, just slow)
240   { "18wheelr", 0, 0x07cf54, { 0x1502, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
241   { "alpilota", 0, 0x070e41, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
242   { "alpiltdx", 0, 0x070e41, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
243   { "capsnk", 0, 0, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
244   { "capsnka", 0, 0, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
245   { "crackndj", 0, 0x1c2347, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
246   { "crzytaxi", 0, 0x0d2f45, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
247   { "csmash", 1, 0x103347, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
248   { "csmasho", 1, 0x103347, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
249   { "cspike", 0, 0x0e2010, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
250   { "deathcox", 0, 0x0b64d0, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
251   { "derbyoc", 0, 0x0fee35, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
252   { "dybb99", 0, 0x048a01, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
253   { "f355twin", 0, 0x06efd4, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
254   { "f355twn2", 0, 0x1666c6, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
255   { "ggram2", 0, 0x074a61, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
256   { "gundmct",  0, 0x0e8010, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
257   { "gwing2",  0, 0x0b25d0, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
258   { "hmgeo",   0, 0x038510, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
259   { "jambo",    0, 0x0fab95, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
260   { "otrigger", 0, 0x0fea94, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
261   { "pjustic", 0, 0x0725d0, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
262   { "pstone", 0, 0x0e69c1, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
263   { "pstone2", 0, 0x0b8dc0, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
264   { "puyoda", 0, 0x0acd40, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
265   { "ringout", 0, 0x0b1e40, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
266   { "samba", 0, 0x0a8b5d, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
267   { "samba2k", 0, 0x1702cf, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
268   { "slasho", 0, 0x1a66ca, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
269   { "smlg99", 0, 0x048a01, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
270   { "spawn", 0, 0x078d01, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
271   { "sstrkfgt", 0, 0x132303, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
272   { "suchie3", 0, 0x0368e1, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
273   { "toyfight", 0, 0x02ca85, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
274   { "vf4cart", 0, 0x2ef2f96, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
275   { "vtennis", 0, 0x03eb15, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
276   { "vonot", 0, 0x010715, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
277   { "wldkicks", 0, 0xae2901, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
278   { "wwfroyal",0, 0x1627c3, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
279   { "zerogu2", 0, 0x07c010, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
280   { "zombrvn", 0, 0x012b41, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
281
282   // games where the encryption is stacked with the ASIC's compression
283   { "doa2", 0, -1, { -1, 0x500, 0, -1, 0x20504, 0x20000, -1, 0x40508, 0x40000, -1, 0x6050c, 0x60000, -1, 0x80510, 0x80000,   // 0x8ad01, has compression
284          -1, 0xa0514, 0xa0000, -1, 0xc0518, 0xc0000, -1, 0xe051c, 0xe0000, -1, 0x100520,0x100000, -1, 0x118a3a, 0x120000,
285          -1, 0x12c0d8, 0x140000, -1, 0x147e22, 0x160000, -1, 0x1645ce, 0x180000, -1, 0x17c6b2, 0x1a0000,
286          -1, 0x19902e, 0x1c0000, -1, 0x1b562a, 0x1e0000, -1, 0xffffffff, 0xffffffff } },
287   { "doa2m", 0, -1, { -1, 0x500, 0, -1, 0x20504, 0x20000, -1, 0x40508, 0x40000, -1, 0x6050c, 0x60000, -1, 0x80510, 0x80000,
288          -1, 0xa0514, 0xa0000, -1, 0xc0518, 0xc0000, -1, 0xe051c, 0xe0000, -1, 0x100520,0x100000, -1, 0x11a5b4, 0x120000,
289          -1, 0x12e7c4, 0x140000, -1, 0x1471f6, 0x160000, -1, 0x1640c4, 0x180000, -1, 0x1806ca, 0x1a0000,
290          -1, 0x199df4, 0x1c0000, -1, 0x1b5d0a, 0x1e0000, 0xffffffff, 0xffffffff } },
291   { "ggx",      0, -1, { -1, 0x200000, 0x100000, -1, 0x210004, 0x110000, -1, 0x220008, 0x120000, -1, 0x228000, 0x130000,   // 0x76110, uses compression
292                0x3af9, 0, 0x000000, 0x2288, 0, 0x010000, 0xe5e6, 0, 0x020000, 0xebb0, 0, 0x030000,
293           0x0228, 0, 0x040000, 0x872c, 0, 0x050000, 0xbba0, 0, 0x060000, 0x772f, 0, 0x070000,
294           0x2924, 0, 0x080000, 0x3222, 0, 0x090000, 0x7954, 0, 0x0a0000, 0x5acd, 0, 0x0b0000,
295           0xdd19, 0, 0x0c0000, 0x2428, 0, 0x0d0000, 0x3329, 0, 0x0e0000, 0x2142, 0, 0x0f0000,
296                0xffffffff, 0xffffffff, 0xffffffff } },
297   { "sgtetris", 0, -1, { 0x1234, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },   // 0x08ae51, uses compression
298//  { "virnbao", 0, 0x68b58, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },     // note: "virnba" set doesn't have protection
299//  { "vs2_2k", 0, 0x88b08, { 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff } },
254   { "18wheelr", 0x07cf54, 0 },
255   { "alpilota", 0x070e41, 0 },
256   { "alpiltdx", 0x070e41, 0 },
257   { "capsnk", 0, 0 },
258   { "capsnka", 0, 0 },
259   { "crackndj", 0x1c2347, 0 },
260   { "crzytaxi", 0x0d2f45, 0 },
261   { "csmash", 0x103347, 0 },
262   { "csmasho", 0x103347, 0 },
263   { "cspike", 0x0e2010, 0 },
264   { "deathcox", 0x0b64d0, 0 },
265   { "derbyoc", 0x0fee35, 0 },
266   { "doa2", 0x8ad01, 0 },
267   { "doa2m", 0x8ad01, 0 },
268   { "dybb99", 0x048a01, 0 },
269   { "f355twin", 0x06efd4, 0 },
270   { "f355twn2", 0x1666c6, 0 },
271   { "ggram2", 0x074a61, 0 },
272   { "ggx", 0x076110, 0 },
273    { "gram2000", 0, 0x7f805c3f },
274   { "gundmct", 0x0e8010, 0 },
275   { "gwing2",  0x0b25d0, 0 },
276   { "hmgeo",   0x038510, 0 },
277   { "jambo",   0x0fab95, 0 },
278    { "kick4csh", 0, 0x820857c9 },
279    { "mvsc2", 0, 0xc18b6e7c },
280   { "otrigger", 0x0fea94, 0 },
281   { "pjustic", 0x0725d0, 0 },
282   { "pstone", 0x0e69c1, 0 },
283   { "pstone2", 0x0b8dc0, 0 },
284   { "puyoda", 0x0acd40, 0 },
285    { "qmegamis", 0, 0xcd9b4896 },
286   { "ringout", 0x0b1e40, 0 },
287   { "samba", 0x0a8b5d, 0 },
288   { "samba2k", 0x1702cf, 0 },
289   { "sgtetris", 0x8ae51, 0 },
290    { "shootopl", 0, 0xa0f37ca7 },
291    { "shootpl", 0, 0x9d8de9cd },
292    { "shootplm", 0, 0x9d8de9cd },
293   { "slasho", 0x1a66ca, 0 },
294   { "smlg99", 0x048a01, 0 },
295   { "spawn", 0x078d01, 0 },
296   { "sstrkfgt", 0x132303, 0 },
297   { "suchie3", 0x0368e1, 0 },
298   { "toyfight", 0x02ca85, 0 },
299   { "vf4cart", 0x2ef2f96, 0 },
300    { "vf4evoct", 0, 0x1e5bb0cd },
301    { "virnbao", 0x68b58, 0 },      // note: "virnba" set doesn't have protection
302    { "vs2_2k", 0x88b08, 0 },
303   { "vtennis", 0x03eb15, 0 },
304   { "vtenis2c", 0, 0x2d2d4743 },
305   { "vonot", 0x010715, 0 },
306   { "wldkicks", 0xae2901, 0 },
307   { "wwfroyal", 0x1627c3, 0 },
308   { "zerogu2", 0x07c010, 0 },
309   { "zombrvn", 0x012b41, 0 },
300310};
301311
302312// forward declaration for decrypt function
303static void stream_decrypt(UINT32 game_key, UINT32 sequence_key, UINT16 seed, UINT8* ciphertext, UINT8* plaintext, int length);
304313static UINT16 block_decrypt(UINT32 game_key, UINT16 sequence_key, UINT16 counter, UINT16 data);
305314
306315/***************************************************************************
r10613r10614
331340int naomibd_interrupt_callback(device_t *device, naomibd_interrupt_func callback)
332341{
333342   naomibd_config *config = (naomibd_config *)downcast<const legacy_device_config_base &>(device->baseconfig()).inline_config();
334   //naomibd_state *v = get_safe_token(device);
335
336343   config->interrupt = callback;
337344   return 0;
338345}
r10613r10614
343350   return v->type;
344351}
345352
353// M1 decryption/decompression
354static UINT8 naomibd_m1dec_readbyte(naomibd_state *naomibd)
355{
356    UINT8 v;
346357
358    switch (naomibd->prot.s_in_pos & 3)
359    {
360        case 0:
361            v = naomibd->prot.s_input[naomibd->prot.s_in_pos + 3];
362            v ^= naomibd->prot.s_input[naomibd->prot.s_in_pos + 1];
363            break;
364
365        case 1:
366            v = naomibd->prot.s_input[naomibd->prot.s_in_pos + 1];
367            v ^= naomibd->prot.s_input[naomibd->prot.s_in_pos - 1];
368            break;
369
370        case 2:
371            v = naomibd->prot.s_input[naomibd->prot.s_in_pos - 1];
372            break;
373
374        case 3:
375            v = naomibd->prot.s_input[naomibd->prot.s_in_pos - 3];
376            break;
377    }
378
379    v ^= naomibd->prot.s_xor[naomibd->prot.s_in_pos & 3];
380    naomibd->prot.s_in_pos++;
381    return v;
382}
383
384static void naomibd_m1dec_storebyte (naomibd_state *naomibd, UINT8 b)
385{
386    if (naomibd->prot.s_subst && naomibd->prot.s_out_cnt >= 2)
387    {
388        b = naomibd->dc_cart_ram[naomibd->prot.s_out_cnt - 2] - b;
389    }
390    naomibd->dc_cart_ram[naomibd->prot.s_out_cnt] = b;
391    naomibd->prot.s_out_cnt++;
392
393    if (naomibd->prot.s_out_cnt >= (256*1024))
394    {
395        fatalerror("naomibd: M1 decode exceeds buffer size!\n");
396    }
397}
398
399static void naomibd_m1dec_shiftin(naomibd_state *naomibd)
400{
401    naomibd->prot.s_shift <<= 8;
402    naomibd->prot.s_shift |= naomibd_m1dec_readbyte(naomibd);
403    naomibd->prot.s_bits += 8;
404}
405
406static void naomibd_m1_decode(naomibd_state *naomibd)
407{
408    int i, eos;
409
410    naomibd->prot.s_xor [0] = (UINT8)naomibd->dc_dmakey;
411    naomibd->prot.s_xor [1] = (UINT8)(naomibd->dc_dmakey >> 8);
412    naomibd->prot.s_xor [2] = (UINT8)(naomibd->dc_dmakey >> 16);
413    naomibd->prot.s_xor [3] = (UINT8)(naomibd->dc_dmakey >> 24);
414
415   #if NAOMIBD_PRINTF_PROTECTION
416    printf("M1 decode: dma offset %x, key %x\n", naomibd->dma_offset, naomibd->dc_dmakey);
417    #endif
418
419    naomibd->prot.s_input = naomibd->memory + naomibd->dma_offset;
420    naomibd->prot.s_in_pos = 0;
421
422    // read in the dictionary
423    for (i = 0; i < 111; i++)
424    {
425        naomibd->prot.s_dict [i] = naomibd_m1dec_readbyte(naomibd);
426    }
427
428    // control bits
429    naomibd->prot.s_subst = (naomibd->prot.s_dict [0] & 64) ? 1 : 0;
430
431    // command stream
432    naomibd->prot.s_out_cnt = 0, eos = 0;
433    naomibd->prot.s_shift = 0, naomibd->prot.s_bits = 0;
434    while (!eos)
435    {
436        int code, addr, t;
437
438        if (naomibd->prot.s_bits < 2)
439            naomibd_m1dec_shiftin(naomibd);
440
441        code = (naomibd->prot.s_shift >> (naomibd->prot.s_bits - 2)) & 3;
442        switch (code)
443        {
444            case 0:
445                // 00-aa
446                if (naomibd->prot.s_bits < 4)
447                    naomibd_m1dec_shiftin(naomibd);
448                addr = (naomibd->prot.s_shift >> (naomibd->prot.s_bits - 4)) & 3;
449                naomibd->prot.s_bits -= 4;
450                if (addr == 0)
451                {
452                    // quotation
453                    if (naomibd->prot.s_bits < 8)
454                        naomibd_m1dec_shiftin (naomibd);
455                    t = (naomibd->prot.s_shift >> (naomibd->prot.s_bits - 8)) & 255;
456                    naomibd->prot.s_bits -= 8;
457                    naomibd_m1dec_storebyte(naomibd, t);
458                    break;
459                }
460                naomibd_m1dec_storebyte(naomibd, naomibd->prot.s_dict [addr]);
461                break;
462
463                case 1:
464                    if (naomibd->prot.s_bits < 5)
465                        naomibd_m1dec_shiftin (naomibd);
466                    t = (naomibd->prot.s_shift >> (naomibd->prot.s_bits - 3)) & 1;
467                    if (t == 0)
468                    {
469                        // 010-aa
470                        addr = (naomibd->prot.s_shift >> (naomibd->prot.s_bits - 5)) & 3;
471                        addr += 4;
472                        naomibd->prot.s_bits -= 5;
473                    }
474                    else
475                    {
476                        // 011-aaa
477                        if (naomibd->prot.s_bits < 6)
478                            naomibd_m1dec_shiftin (naomibd);
479                        addr = (naomibd->prot.s_shift >> (naomibd->prot.s_bits - 6)) & 7;
480                        addr += 8;
481                        naomibd->prot.s_bits -= 6;
482                    }
483                    naomibd_m1dec_storebyte(naomibd, naomibd->prot.s_dict [addr]);
484                    break;
485
486                case 2:
487                    if (naomibd->prot.s_bits < 7)
488                        naomibd_m1dec_shiftin(naomibd);
489                    // 10-aaaaa
490                    addr = (naomibd->prot.s_shift >> (naomibd->prot.s_bits - 7)) & 31;
491                    addr += 16;
492                    naomibd->prot.s_bits -= 7;
493                    naomibd_m1dec_storebyte(naomibd, naomibd->prot.s_dict [addr]);
494                    break;
495
496                case 3:
497                    if (naomibd->prot.s_bits < 8)
498                        naomibd_m1dec_shiftin(naomibd);
499                    // 11-aaaaaa
500                    addr = (naomibd->prot.s_shift >> (naomibd->prot.s_bits - 8)) & 63;
501                    addr += 48;
502                    naomibd->prot.s_bits -= 8;
503                    if (addr == 111)
504                    {
505                        // end of stream
506                        eos = 1;
507                    }
508                    else
509                    {
510                        naomibd_m1dec_storebyte(naomibd, naomibd->prot.s_dict [addr]);
511                    }
512                    break;
513        }
514    }
515}
516
517// Streaming M2/M3 protection and decompression
518
519INLINE UINT16 bswap16(UINT16 in)
520{
521    return ((in>>8) | (in<<8));
522}
523
524static UINT16 naomibd_get_decrypted_stream(naomibd_state *naomibd)
525{
526   UINT16 wordn = bswap16(naomibd->prot.ptr[naomibd->prot.count++]);
527
528   naomibd->prot.aux_word = block_decrypt(naomibd->dc_gamekey, naomibd->dc_seqkey, naomibd->prot.seed++, wordn);
529   wordn = (naomibd->prot.last_word&~3) | (naomibd->prot.aux_word&3);
530   naomibd->prot.last_word = naomibd->prot.aux_word;
531
532   return wordn;
533}
534
535static void naomibd_init_stream(naomibd_state *naomibd)
536{
537   naomibd->prot.last_word = 0;
538
539   naomibd->prot.control_bits = naomibd_get_decrypted_stream(naomibd);
540   naomibd->prot.heading_word = naomibd_get_decrypted_stream(naomibd);
541
542   if (naomibd->prot.control_bits & 2)
543   {
544      naomibd->prot.pak_bit = 0;
545      naomibd->prot.pak_state = CMD_READY;
546      naomibd->prot.dec_count = 0;
547      naomibd->prot.pak_buf_size = 256 << (naomibd->prot.control_bits & 1);
548      naomibd->prot.pak_buf_pos = 0;
549   }
550}
551
552static UINT16 naomibd_get_compressed_bit(naomibd_state *naomibd)
553{
554   if(naomibd->prot.pak_bit == 0)
555   {
556       naomibd->prot.pak_bit = 15;
557       naomibd->prot.pak_word = naomibd_get_decrypted_stream(naomibd);
558   }
559   else
560   {
561       naomibd->prot.pak_bit--;
562       naomibd->prot.pak_word<<=1;
563   }
564   return naomibd->prot.pak_word >> 15;
565}
566
567static UINT16 naomibd_get_decompressed_stream(naomibd_state *naomibd)
568{
569/* node format
5700xxxxxxx - next node index
5711a0bbccc - end node
572           a - 0 = repeat
573               1 = fetch
574           b - if a = 1
575               00 - fetch  0
576               01 - fetch  1
577               11 - fetch -1
578               if a = 0
579               000
580           c - repeat/fetch counter
581               count = ccc + 1
58211111111 - empty node
583*/
584   static UINT8 trees[9][2][32] = {
585      {
586         {0x01,0x10,0x0f,0x05,0xc4,0x13,0x87,0x0a,0xcc,0x81,0xce,0x0c,0x86,0x0e,0x84,0xc2,
587          0x11,0xc1,0xc3,0xcf,0x15,0xc8,0xcd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
588         {0xc7,0x02,0x03,0x04,0x80,0x06,0x07,0x08,0x09,0xc9,0x0b,0x0d,0x82,0x83,0x85,0xc0,
589          0x12,0xc6,0xc5,0x14,0x16,0xca,0xcb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
590      },
591      {
592         {0x02,0x80,0x05,0x04,0x81,0x10,0x15,0x82,0x09,0x83,0x0b,0x0c,0x0d,0xdc,0x0f,0xde,
593          0x1c,0xcf,0xc5,0xdd,0x86,0x16,0x87,0x18,0x19,0x1a,0xda,0xca,0xc9,0x1e,0xce,0xff,},
594         {0x01,0x17,0x03,0x0a,0x08,0x06,0x07,0xc2,0xd9,0xc4,0xd8,0xc8,0x0e,0x84,0xcb,0x85,
595          0x11,0x12,0x13,0x14,0xcd,0x1b,0xdb,0xc7,0xc0,0xc1,0x1d,0xdf,0xc3,0xc6,0xcc,0xff,},
596      },
597      {
598         {0xc6,0x80,0x03,0x0b,0x05,0x07,0x82,0x08,0x15,0xdc,0xdd,0x0c,0xd9,0xc2,0x14,0x10,
599          0x85,0x86,0x18,0x16,0xc5,0xc4,0xc8,0xc9,0xc0,0xcc,0xff,0xff,0xff,0xff,0xff,0xff,},
600         {0x01,0x02,0x12,0x04,0x81,0x06,0x83,0xc3,0x09,0x0a,0x84,0x11,0x0d,0x0e,0x0f,0x19,
601          0xca,0xc1,0x13,0xd8,0xda,0xdb,0x17,0xde,0xcd,0xcb,0xff,0xff,0xff,0xff,0xff,0xff,},
602      },
603      {
604         {0x01,0x80,0x0d,0x04,0x05,0x15,0x83,0x08,0xd9,0x10,0x0b,0x0c,0x84,0x0e,0xc0,0x14,
605          0x12,0xcb,0x13,0xca,0xc8,0xc2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
606         {0xc5,0x02,0x03,0x07,0x81,0x06,0x82,0xcc,0x09,0x0a,0xc9,0x11,0xc4,0x0f,0x85,0xd8,
607          0xda,0xdb,0xc3,0xdc,0xdd,0xc1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
608      },
609      {
610         {0x01,0x80,0x06,0x0c,0x05,0x81,0xd8,0x84,0x09,0xdc,0x0b,0x0f,0x0d,0x0e,0x10,0xdb,
611          0x11,0xca,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
612         {0xc4,0x02,0x03,0x04,0xcb,0x0a,0x07,0x08,0xd9,0x82,0xc8,0x83,0xc0,0xc1,0xda,0xc2,
613          0xc9,0xc3,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
614      },
615      {
616         {0x01,0x02,0x06,0x0a,0x83,0x0b,0x07,0x08,0x09,0x82,0xd8,0x0c,0xd9,0xda,0xff,0xff,
617          0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
618         {0xc3,0x80,0x03,0x04,0x05,0x81,0xca,0xc8,0xdb,0xc9,0xc0,0xc1,0x0d,0xc2,0xff,0xff,
619          0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
620      },
621      {
622         {0x01,0x02,0x03,0x04,0x81,0x07,0x08,0xd8,0xda,0xd9,0xff,0xff,0xff,0xff,0xff,0xff,
623          0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
624         {0xc2,0x80,0x05,0xc9,0xc8,0x06,0x82,0xc0,0x09,0xc1,0xff,0xff,0xff,0xff,0xff,0xff,
625          0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
626      },
627      {
628         {0x01,0x80,0x04,0xc8,0xc0,0xd9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
629          0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
630         {0xc1,0x02,0x03,0x81,0x05,0xd8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
631          0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
632      },
633      {
634         {0x01,0xd8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
635          0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
636         {0xc0,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
637          0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,},
638      },
639   };
640
641   UINT32 word_complete = 2;
642   UINT16 wordn = 0;
643
644   while(word_complete)
645   {
646      switch(naomibd->prot.pak_state)
647      {
648      case CMD_READY:
649      {
650         UINT32 tmp = 0;
651         INT32 slot = (naomibd->prot.pak_buf_pos & (naomibd->prot.pak_buf_size-1));
652         if(slot > 0)
653         {
654            if(slot < (naomibd->prot.pak_buf_size-7))
655               slot = 1;
656            else
657               slot = (slot & 7) + 1;
658         }
659         while (!(tmp&0x80))
660           if(naomibd_get_compressed_bit(naomibd))
661              tmp = trees[slot][1][tmp];
662           else
663              tmp = trees[slot][0][tmp];
664         if(tmp != 0xff)
665         {
666            naomibd->prot.pak_byte = (tmp&7)+1;
667            if(tmp&0x40)
668            {
669               static INT32 cmds[4] = {0, 1, 0, -1};
670               naomibd->prot.pak_fetch_ofs = cmds[(tmp&0x18)>>3];
671               naomibd->prot.pak_state = CMD_FETCH;
672            }
673            else
674            {
675               UINT8 byten;
676               naomibd->prot.pak_state = CMD_REPEAT;
677               byten =          naomibd_get_compressed_bit(naomibd)  << 1;
678               byten = (byten | naomibd_get_compressed_bit(naomibd)) << 1;
679               byten = (byten | naomibd_get_compressed_bit(naomibd)) << 1;
680               byten = (byten | naomibd_get_compressed_bit(naomibd)) << 1;
681               byten = (byten | naomibd_get_compressed_bit(naomibd)) << 1;
682               byten = (byten | naomibd_get_compressed_bit(naomibd)) << 1;
683               byten = (byten | naomibd_get_compressed_bit(naomibd)) << 1;
684               byten =  byten | naomibd_get_compressed_bit(naomibd);
685               naomibd->prot.cmd_byte = byten;
686            }
687         }
688         break;
689      }
690      case CMD_FETCH:
691         naomibd->prot.cmd_byte = naomibd->prot.pak_buf[(naomibd->prot.pak_buf_pos-naomibd->prot.pak_buf_size+naomibd->prot.pak_fetch_ofs)&(PACK_BUF_SIZE-1)];
692
693      case CMD_REPEAT:
694         naomibd->prot.pak_buf[naomibd->prot.pak_buf_pos&(PACK_BUF_SIZE-1)]=naomibd->prot.cmd_byte;
695         if(word_complete&2)
696       {
697            wordn = naomibd->prot.cmd_byte << 8;
698       }
699         else
700       {
701            wordn = wordn | naomibd->prot.cmd_byte;
702       }
703         word_complete--;
704         naomibd->prot.pak_byte--;
705         naomibd->prot.pak_buf_pos++;
706         if(naomibd->prot.pak_byte == 0) naomibd->prot.pak_state = CMD_READY;
707         break;
708      }
709   }
710   return wordn;
711}
712
713// stream read protected PIO hook
714//-----------------------------------------------------------
715static UINT16 naomibd_get_data_stream(naomibd_state *naomibd)
716{
717   UINT16 wordn;
718
719   if(naomibd->prot.control_bits&2)
720   {
721      wordn = naomibd_get_decompressed_stream(naomibd);
722   }
723   else
724   {
725      wordn = naomibd_get_decrypted_stream(naomibd);
726   }
727
728   return wordn;
729}
730
347731void *naomibd_get_memory(device_t *device)
348732{
733   naomibd_state *naomibd = get_safe_token(device);
734
735    // for M1 decodes, return the buffer we'll DMA from
736   if (!(naomibd->dma_offset_flags & NAOMIBD_FLAG_DMA_COMPRESSION) && (naomibd->type == ROM_BOARD) && (naomibd->dc_dmakey != 0))
737    {
738        // perform the M1 decode
739        naomibd_m1_decode(naomibd);
740
741        // return the pointer to our output buffer
742        return naomibd->dc_cart_ram;
743    }
744
745    if (!(naomibd->dma_offset_flags & NAOMIBD_FLAG_DMA_COMPRESSION) && (naomibd->type == ROM_BOARD))
746    {
747        logerror("Unhandled M1 DMA with key %x, flags %x, offset %x\n", naomibd->dc_dmakey, naomibd->dma_offset_flags, naomibd->dma_offset);
748    }
749
349750   return get_safe_token(device)->memory;
350751}
351752
352
353753offs_t naomibd_get_dmaoffset(device_t *device)
354754{
755   naomibd_state *naomibd = get_safe_token(device);
355756   offs_t result = 0;
356757
357758   #if NAOMIBD_PRINTF_PROTECTION
r10613r10614
359760   #endif
360761
361762   // if the flag is cleared that lets the protection chip go,
362   // we need to handle this specially.  but not on DIMM boards.
363   if (!(get_safe_token(device)->dma_offset_flags & NAOMIBD_FLAG_ADDRESS_SHUFFLE) && (get_safe_token(device)->type == ROM_BOARD))
763   // we need to handle this specially.  but not on DIMM boards or if there's no key.
764   if (!(naomibd->dma_offset_flags & NAOMIBD_FLAG_DMA_COMPRESSION) && (naomibd->type == ROM_BOARD) && (naomibd->dc_dmakey != 0))
364765   {
365      if (!strcmp(device->machine->gamedrv->name, "qmegamis"))
366      {
367         result = 0x9000000;
368         return result;
369      }
370      else if (!strcmp(device->machine->gamedrv->name, "mvsc2"))
371      {
372         switch (get_safe_token(device)->dma_offset)
373         {
374            case 0x08000000: result = 0x8800000;   break;
375            case 0x08026440: result = 0x8830000;   break;
376            case 0x0803bda0: result = 0x8850000;   break;
377            case 0x0805a560: result = 0x8870000;   break;
378            case 0x0805b720: result = 0x8880000;   break;
379            case 0x0808b7e0: result = 0x88a0000;   break;
380            default:
381               result = get_safe_token(device)->dma_offset;
382               break;
383         }
384
385         return result;
386      }
387      else
388      {
389         logerror("Protected DMA not handled for this game (dma_offset %x)\n", get_safe_token(device)->dma_offset);
390      }
766        // no offset, start at the beginning of cart ram for M1 transfers
767        result = 0;
391768   }
769    else
770    {
771        result = get_safe_token(device)->dma_offset;
772    }
392773
393   result = get_safe_token(device)->dma_offset;
394774   return result;
395775}
396776
r10613r10614
426806   device->save_item(NAME(v->aw_offset));
427807   device->save_item(NAME(v->aw_file_base));
428808   device->save_item(NAME(v->aw_file_offset));
809   device->save_item(NAME(v->dc_m3_ptr));
810   device->save_item(NAME(v->dc_cart_ram));
811    device->save_item(NAME(v->prot.last_word));
812    device->save_item(NAME(v->prot.aux_word));
813    device->save_item(NAME(v->prot.pak_word));
814    device->save_item(NAME(v->prot.heading_word));
815    device->save_item(NAME(v->prot.count));
816    device->save_item(NAME(v->prot.pak_bit));
817    device->save_item(NAME(v->prot.control_bits));
818    device->save_item(NAME(v->prot.pak_state));
819    device->save_item(NAME(v->prot.dec_count));
820    device->save_item(NAME(v->prot.pak_buf_size));
821    device->save_item(NAME(v->prot.pak_buf_pos));
822    device->save_item(NAME(v->prot.pak_fetch_ofs));
823    device->save_item(NAME(v->prot.pak_byte));
824    device->save_item(NAME(v->prot.cmd_byte));
825    device->save_item(NAME(v->prot.seed));
826    device->save_item(NAME(v->prot.s_xor));
827    device->save_item(NAME(v->prot.s_dict));
828    device->save_item(NAME(v->prot.s_subst));
829    device->save_item(NAME(v->prot.s_out_len));
830    device->save_item(NAME(v->prot.s_out_cnt));
831    device->save_item(NAME(v->prot.s_shift));
832    device->save_item(NAME(v->prot.s_bits));
833    device->save_item(NAME(v->prot.s_in_len));
834    device->save_item(NAME(v->prot.s_in_pos));
429835}
430836
431837
r10613r10614
438844
439845static void soft_reset(naomibd_state *v)
440846{
441   v->prot_sum = 0;
442
443847   v->dc_m3_ptr = 0;
444848   v->dc_seqkey = 0;
445849}
r10613r10614
474878         // can we live-decrypt this game?
475879         if (v->dc_gamekey != -1)
476880         {
477            ret = (UINT64)(v->dc_cart_ram[v->dc_readback+1] | (v->dc_cart_ram[v->dc_readback]<<8));
478            v->dc_readback += 2;
881            ret = (UINT64)naomibd_get_data_stream(v);
479882         }
480883         else
481884         {
482            if (v->rom_offset == 0x1fffe)
483            {
484               UINT8 *prot = (UINT8 *)v->protdata;
485               UINT32 byte_offset = v->prot_offset*2;
486
487               // this is a good time to clear the prot_sum
488               v->prot_sum = 0;
489
490               if (v->prot_translate == NULL)
491               {
492                  #if NAOMIBD_PRINTF_PROTECTION
493                  v->prot_pio_count += 2;
494                  printf("naomibd: reading protection data, but none was supplied (now %x bytes)\n", v->prot_pio_count);
495                  #endif
496                  return 0;
497               }
498
499               #if NAOMIBD_PRINTF_PROTECTION
500               v->prot_pio_count += 2;
501               printf("naomibd: PIO read count %x\n", v->prot_pio_count);
502               #endif
503
504               if (v->prot_reverse_bytes)
505               {
506                  ret = (UINT64)(prot[byte_offset+1] | (prot[byte_offset]<<8));
507               }
508               else
509               {
510                  ret = (UINT64)(prot[byte_offset] | (prot[byte_offset+1]<<8));
511               }
512
513               v->prot_offset++;
514            }
515            #if NAOMIBD_PRINTF_PROTECTION
516            else
517            {
518               printf("Bad protection offset read %x\n", v->rom_offset);
519            }
520            #endif
885                ret = U64(0);
521886         }
522887      }
523888      else
r10613r10614
619984               v->aw_offset &= 0xffff;
620985               v->aw_offset |= ((data>>16) & 0xffff0000);
621986               v->dma_offset = v->aw_offset*2;
622               v->dma_offset_flags = NAOMIBD_FLAG_ADDRESS_SHUFFLE|NAOMIBD_FLAG_AUTO_ADVANCE;   // force normal DMA mode
987               v->dma_offset_flags = NAOMIBD_FLAG_DMA_COMPRESSION|NAOMIBD_FLAG_AUTO_ADVANCE;   // force normal DMA mode
623988               //printf("EPR_OFFSETH = %x, dma_offset %x\n", (UINT32)(data>>32), v->dma_offset);
624989            }
625990
r10613r10614
7121077            // DMA_OFFSETH
7131078            v->dma_offset &= 0xffff;
7141079            v->dma_offset |= (data >> 16) & 0x1fff0000;
715            v->dma_offset_flags = (data>>28);
1080            v->dma_offset_flags = (data>>(28+16));
7161081         }
7171082         if(ACCESSING_BITS_0_15)
7181083         {
r10613r10614
7331098                  v->prot_key = data;
7341099
7351100                  #if NAOMIBD_PRINTF_PROTECTION
736                  printf("Protection: set up read @ %x, key %x sum %x (PIO %x DMA %x) [%s]\n", v->prot_offset*2, v->prot_key, v->prot_sum, v->rom_offset, v->dma_offset, device->machine->describe_context());
737
738                  v->prot_pio_count = 0;
1101                  printf("Protection: set up read @ %x, key %x (PIO %x DMA %x) [%s]\n", v->prot_offset*2, v->prot_key, v->rom_offset, v->dma_offset, device->machine->describe_context());
7391102                  #endif
7401103
7411104                  // if dc_gamekey isn't -1, we can live-decrypt this one
7421105                  if (v->dc_gamekey != -1)
7431106                  {
744                     UINT8 temp_ram[128*1024];
7451107                     UINT8 *ROM = (UINT8 *)v->memory;
7461108
747                     v->dc_seed = 0;
748                     v->dc_readback = 0;
7491109                     v->dc_seqkey = v->prot_key;
7501110
751                     #if NAOMIBD_PRINTF_PROTECTION
752                     printf("M2/M3 decrypt: gamekey %x seqkey %x seed %x length %x\n", v->dc_gamekey, v->dc_seqkey, v->dc_seed, v->dc_m3_ptr);
753                     #endif
754
755                     // M2: just decrypt up to the size limit since we don't know the size in advance
7561111                     if (v->prot_offset != 0x2000000/2)
7571112                     {
758                        // decrypt to temp buffer
759                        stream_decrypt(v->dc_gamekey, v->dc_seqkey, v->prot_offset&0xffff, &ROM[v->prot_offset*2], temp_ram, 128*1024);
1113                        // M2: decrypt from ROM
1114                        v->prot.ptr = (UINT16 *)&ROM[v->prot_offset*2];
1115                        v->prot.seed = v->prot_offset&0xffff;
1116                         #if NAOMIBD_PRINTF_PROTECTION
1117                         printf("M2 decrypt: gamekey %x seqkey %x length %x\n", v->dc_gamekey, v->dc_seqkey, v->dc_m3_ptr);
1118                         #endif
7601119                     }
7611120                     else
7621121                     {
763                        // decrypt cart ram to temp buffer
764                        stream_decrypt(v->dc_gamekey, v->dc_seqkey, v->dc_seed, v->dc_cart_ram, temp_ram, v->dc_m3_ptr);
1122                        // M3: decrypt from cart ram
1123                        v->prot.ptr = (UINT16 *)v->dc_cart_ram;
1124                        v->prot.seed = 0;
1125                         #if NAOMIBD_PRINTF_PROTECTION
1126                         printf("M3 decrypt: gamekey %x seqkey %x length %x\n", v->dc_gamekey, v->dc_seqkey, v->dc_m3_ptr);
1127                         #endif
7651128                     }
7661129
767                     #if NAOMIBD_PRINTF_PROTECTION
768                     printf("result: %02x %02x %02x %02x %02x %02x %02x %02x\n",
769                        temp_ram[0], temp_ram[1], temp_ram[2], temp_ram[3],
770                        temp_ram[4], temp_ram[5], temp_ram[6], temp_ram[7]);
771                     #endif
1130                     v->prot.count = 0;
1131                     naomibd_init_stream(v);
7721132
773                     // copy results to cart ram for readback
774                     memcpy(v->dc_cart_ram, temp_ram, 128*1024);
775
7761133                     v->dc_m3_ptr = 0;
777                     v->prot_sum = 0;
7781134                  }
779                  else
780                  {
781                     // translate address if necessary
782                     if (v->prot_translate != NULL)
783                     {
784                        int i = 0;
785                        while (v->prot_translate[i+1] != 0xffffffff)
786                        {
787                           // should we match by key, address, or sum?
788                           if (v->prot_translate[i] == -2)   // match sum
789                           {
790                              if (v->prot_translate[i+1] == v->prot_sum)
791                              {
792                                 #if NAOMIBD_PRINTF_PROTECTION
793                                 printf("Protection: got sum %x, translated to %x\n", v->prot_sum, v->prot_translate[i+2]);
794                                 #endif
795                                 v->prot_offset = v->prot_translate[i+2]/2;
796                                 break;
797                              }
798                              else
799                              {
800                                 i+= 3;
801                              }
802                           }
803                           else if (v->prot_translate[i] == -1)   // match address
804                           {
805                              if (v->prot_translate[i+1] == (v->prot_offset*2))
806                              {
807                                 #if NAOMIBD_PRINTF_PROTECTION
808                                 printf("Protection: got offset %x, translated to %x\n", v->prot_offset, v->prot_translate[i+2]);
809                                 #endif
810                                 v->prot_offset = v->prot_translate[i+2]/2;
811                                 break;
812                              }
813                              else
814                              {
815                                 i += 3;
816                              }
817                           }
818                           else   // match key
819                           {
820                              if (v->prot_translate[i] == v->prot_key)
821                              {
822                                 #if NAOMIBD_PRINTF_PROTECTION
823                                 printf("Protection: got key %x, translated to %x\n", v->prot_key, v->prot_translate[i+2]);
824                                 #endif
825                                 v->prot_offset = v->prot_translate[i+2]/2;
826                                 break;
827                              }
828                              else
829                              {
830                                 i+= 3;
831                              }
832                           }
833                        }
834                     }
835                     #if NAOMIBD_PRINTF_PROTECTION
836                     else
837                     {
838                        printf("naomibd: protection not handled for this game\n");
839                     }
840                     #endif
841                  }
1135                        #if NAOMIBD_PRINTF_PROTECTION
1136                        else
1137                        {
1138                            printf("naomibd: protection not handled for this game\n");
1139                        }
1140                        #endif
8421141                  break;
8431142
8441143               case 0x2000000:
8451144               case 0x2020000:
846                  #if NAOMIBD_PRINTF_PROTECTION
847                  printf("Protection write %04x to upload @ %x\n", (UINT32)(data&0xffff), v->dc_m3_ptr);
848                  #endif
849                  v->prot_sum += (INT16)(data&0xffff);
850
8511145                  v->dc_cart_ram[v->dc_m3_ptr] = (data&0xff);
8521146                  v->dc_cart_ram[v->dc_m3_ptr+1] = (data>>8)&0xff;
8531147                  v->dc_m3_ptr += 2;
r10613r10614
17031997    return aux;
17041998}
17051999
1706static void stream_decrypt(UINT32 game_key, UINT32 sequence_key, UINT16 seed, UINT8* ciphertext, UINT8* plaintext, int length)
1707{
1708    UINT16 counter = seed;
1709    UINT16 last_word;
1710    UINT16 plain_word;
1711    UINT16 aux_word;
1712    int control_bits;
1713    UINT16 heading_word;
1714
1715    last_word = block_decrypt(game_key, sequence_key, counter, *ciphertext<<8 | *(ciphertext+1));
1716    control_bits = last_word&3;
1717    ++counter; ciphertext+=2;
1718
1719    aux_word = block_decrypt(game_key, sequence_key, counter, *ciphertext<<8 | *(ciphertext+1));
1720    heading_word = (last_word&~3) | (aux_word&3);
1721    last_word = aux_word;
1722    ++counter; ciphertext+=2;
1723
1724    if (BIT(control_bits,1)==0)  // no decompression, just decryption
1725    {
1726        for (; length>0; length-=2, ++counter, ciphertext+=2)
1727        {
1728            aux_word = block_decrypt(game_key, sequence_key, counter, *ciphertext<<8 | *(ciphertext+1));
1729            plain_word = (last_word&~3) | (aux_word&3);
1730            last_word = aux_word;
1731
1732            *(plaintext++) = plain_word>>8;
1733            *(plaintext++) = plain_word&0xff;
1734        }
1735    }
1736    else  // decryption plus decompression
1737    {
1738       fatalerror("NAOMI ASIC compression unsupported\n");
1739        return;  // not implemented, decompression has not been fully reverse engineered as of february/2010
1740    }
1741}
1742
17432000/***************************************************************************
17442001    DEVICE INTERFACE
17452002***************************************************************************/
r10613r10614
17662023   /* store a pointer back to the device */
17672024   v->device = device;
17682025
1769   /* find the protection address translation for this game */
1770   v->prot_translate = (UINT32 *)0;
1771   #if NAOMIBD_PRINTF_PROTECTION
1772   v->prot_pio_count = 0;
1773   #endif
2026    v->dc_dmakey = 0;
2027
17742028   for (i=0; i<ARRAY_LENGTH(naomibd_translate_tbl); i++)
17752029   {
17762030      if (!strcmp(device->machine->gamedrv->name, naomibd_translate_tbl[i].name))
17772031      {
1778         v->prot_translate = &naomibd_translate_tbl[i].transtbl[0];
1779         v->prot_reverse_bytes = naomibd_translate_tbl[i].reverse_bytes;
1780         v->dc_gamekey = naomibd_translate_tbl[i].live_key;
2032            v->dc_gamekey = naomibd_translate_tbl[i].m2m3_key;
2033            v->dc_dmakey = naomibd_translate_tbl[i].m1_key;
17812034         break;
17822035      }
17832036   }
r10613r10614
17872040   {
17882041      case ROM_BOARD:
17892042         v->memory = (UINT8 *)device->machine->region(config->regiontag)->base();
1790         v->protdata = (UINT8 *)device->machine->region("naomibd_prot")->base();
17912043         break;
17922044
17932045      case AW_ROM_BOARD:
src/mame/machine/archimds.c
r10613r10614
10081008   // now go ahead and set the mapping in the page table
10091009   memc_pages[log] = phys + (memc*0x80);
10101010
1011   printf("PC=%08x = MEMC_PAGE(%d): W %08x: log %x to phys %x, MEMC %d, perms %d\n", cpu_get_pc(space->cpu),memc_pagesize, data, log, phys, memc, perms);
1011//  printf("PC=%08x = MEMC_PAGE(%d): W %08x: log %x to phys %x, MEMC %d, perms %d\n", cpu_get_pc(space->cpu),memc_pagesize, data, log, phys, memc, perms);
10121012}
10131013
src/mame/machine/psx.c
r10613r10614
533533         p_psx->n_dicr = ( p_psx->n_dicr & ( 0x80000000 | ~mem_mask ) ) |
534534            ( p_psx->n_dicr & ~data & 0x7f000000 & mem_mask ) |
535535            ( data & 0x00ffffff & mem_mask );
536     
536
537537         if( ( p_psx->n_dicr & 0x80000000 ) != 0 && ( p_psx->n_dicr & 0x7f000000 ) == 0 )
538538         {
539539            verboselog( p_psx, 2, "dma interrupt cleared\n" );
src/mame/machine/dec0.c
r10613r10614
465465      case 0x20d: hgt = 0x280;         break; /*|*/
466466      case 0x20e: hgt = 0x240;         break; /*|*/
467467      case 0x20f: hgt = 0x200;         break; /*L*/
468      case 0x534: state->i8751_return = hgt;    break; /*Shot height*/
468      case 0x534: state->i8751_return = hgt;   break; /*Shot height*/
469469
470470      /*At the ending screen(???)*/
471471      //case 0x3b4: state->i8751_return = 0;       break;
src/mame/machine/williams.c
r10613r10614
1515#include "sound/hc55516.h"
1616
1717
18/* banking addresses set by the drivers */
19UINT8 *mayday_protection;
20
21/* internal bank switching tracking */
22static UINT8 blaster_bank;
23static UINT8 vram_bank;
24
25/* other stuff */
26static UINT16 joust2_current_sound_data;
27
2818/* older-Williams routines */
2919static void williams_main_irq(device_t *device, int state);
3020static void williams_main_firq(device_t *device, int state);
r10613r10614
3323static WRITE8_DEVICE_HANDLER( playball_snd_cmd_w );
3424
3525/* input port mapping */
36static UINT8 port_select;
3726static WRITE8_DEVICE_HANDLER( williams_port_select_w );
3827static READ8_DEVICE_HANDLER( williams_input_port_49way_0_5_r );
3928static READ8_DEVICE_HANDLER( williams_49way_port_0_r );
r10613r10614
352341
353342static MACHINE_START( williams_common )
354343{
344   williams_state *state = machine->driver_data<williams_state>();
355345   /* configure the memory bank */
356   memory_configure_bank(machine, "bank1", 0, 1, williams_videoram, 0);
346   memory_configure_bank(machine, "bank1", 0, 1, state->videoram, 0);
357347   memory_configure_bank(machine, "bank1", 1, 1, machine->region("maincpu")->base() + 0x10000, 0);
358348
359   state_save_register_global(machine, vram_bank);
349   state_save_register_global(machine, state->vram_bank);
360350}
361351
362352
r10613r10614
441431
442432static STATE_POSTLOAD( williams2_postload )
443433{
434   williams_state *state = machine->driver_data<williams_state>();
444435   address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
445   williams2_bank_select_w(space, 0, vram_bank);
436   williams2_bank_select_w(space, 0, state->vram_bank);
446437}
447438
448439
449440MACHINE_START( williams2 )
450441{
442   williams_state *state = machine->driver_data<williams_state>();
451443   /* configure memory banks */
452   memory_configure_bank(machine, "bank1", 0, 1, williams_videoram, 0);
444   memory_configure_bank(machine, "bank1", 0, 1, state->videoram, 0);
453445   memory_configure_bank(machine, "bank1", 1, 4, machine->region("maincpu")->base() + 0x10000, 0x10000);
454446
455447   /* register for save states */
456   state_save_register_global(machine, vram_bank);
448   state_save_register_global(machine, state->vram_bank);
457449   machine->state().register_postload(williams2_postload, NULL);
458450}
459451
r10613r10614
484476
485477WRITE8_HANDLER( williams_vram_select_w )
486478{
479   williams_state *state = space->machine->driver_data<williams_state>();
487480   /* VRAM/ROM banking from bit 0 */
488   vram_bank = data & 0x01;
489   memory_set_bank(space->machine, "bank1", vram_bank);
481   state->vram_bank = data & 0x01;
482   memory_set_bank(space->machine, "bank1", state->vram_bank);
490483
491484   /* cocktail flip from bit 1 */
492   williams_cocktail = data & 0x02;
485   state->cocktail = data & 0x02;
493486}
494487
495488
496489WRITE8_HANDLER( williams2_bank_select_w )
497490{
498   vram_bank = data & 0x07;
491   williams_state *state = space->machine->driver_data<williams_state>();
492   state->vram_bank = data & 0x07;
499493
500494   /* the low two bits control the paging */
501   switch (vram_bank & 0x03)
495   switch (state->vram_bank & 0x03)
502496   {
503497      /* page 0 is video ram */
504498      case 0:
505499         memory_install_read_bank(space, 0x0000, 0x8fff, 0, 0, "bank1");
506500         memory_install_write_bank(space, 0x8000, 0x87ff, 0, 0, "bank4");
507501         memory_set_bank(space->machine, "bank1", 0);
508         memory_set_bankptr(space->machine, "bank4", &williams_videoram[0x8000]);
502         memory_set_bankptr(space->machine, "bank4", &state->videoram[0x8000]);
509503         break;
510504
511505      /* pages 1 and 2 are ROM */
r10613r10614
513507      case 2:
514508         memory_install_read_bank(space, 0x0000, 0x8fff, 0, 0, "bank1");
515509         memory_install_write_bank(space, 0x8000, 0x87ff, 0, 0, "bank4");
516         memory_set_bank(space->machine, "bank1", 1 + ((vram_bank & 6) >> 1));
517         memory_set_bankptr(space->machine, "bank4", &williams_videoram[0x8000]);
510         memory_set_bank(space->machine, "bank1", 1 + ((state->vram_bank & 6) >> 1));
511         memory_set_bankptr(space->machine, "bank4", &state->videoram[0x8000]);
518512         break;
519513
520514      /* page 3 accesses palette RAM; the remaining areas are as if page 1 ROM was selected */
521515      case 3:
522516         memory_install_read_bank(space, 0x8000, 0x87ff, 0, 0, "bank4");
523517         memory_install_write8_handler(space, 0x8000, 0x87ff, 0, 0, williams2_paletteram_w);
524         memory_set_bank(space->machine, "bank1", 1 + ((vram_bank & 4) >> 1));
518         memory_set_bank(space->machine, "bank1", 1 + ((state->vram_bank & 4) >> 1));
525519         memory_set_bankptr(space->machine, "bank4", space->machine->generic.paletteram.v);
526520         break;
527521   }
r10613r10614
577571
578572WRITE8_DEVICE_HANDLER( williams_port_select_w )
579573{
580   port_select = data;
574   williams_state *state = device->machine->driver_data<williams_state>();
575   state->port_select = data;
581576}
582577
583578CUSTOM_INPUT( williams_mux_r )
584579{
580   williams_state *state = field->port->machine->driver_data<williams_state>();
585581   const char *tag = (const char *)param;
586582
587   if (port_select != 0)
583   if (state->port_select != 0)
588584      tag += strlen(tag) + 1;
589585
590586   return input_port_read(field->port->machine, tag);
r10613r10614
624620
625621READ8_DEVICE_HANDLER( williams_input_port_49way_0_5_r )
626622{
627   if (port_select)
623   williams_state *state = device->machine->driver_data<williams_state>();
624   if (state->port_select)
628625      return williams_49way_port_0_r(device, 0);
629626   else
630627      return input_port_read(device->machine, "IN3");
r10613r10614
727724
728725static STATE_POSTLOAD( defender_postload )
729726{
727   williams_state *state = machine->driver_data<williams_state>();
730728   address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
731   defender_bank_select_w(space, 0, vram_bank);
729   defender_bank_select_w(space, 0, state->vram_bank);
732730}
733731
734732
r10613r10614
755753
756754WRITE8_HANDLER( defender_video_control_w )
757755{
758   williams_cocktail = data & 0x01;
756   williams_state *state = space->machine->driver_data<williams_state>();
757   state->cocktail = data & 0x01;
759758}
760759
761760
762761WRITE8_HANDLER( defender_bank_select_w )
763762{
764   vram_bank = data & 0x0f;
763   williams_state *state = space->machine->driver_data<williams_state>();
764   state->vram_bank = data & 0x0f;
765765
766766   /* set bank address */
767767   switch (data)
r10613r10614
783783      case 9:
784784         memory_install_read_bank(space, 0xc000, 0xcfff, 0, 0, "bank1");
785785         memory_unmap_write(space, 0xc000, 0xcfff, 0, 0);
786         memory_set_bank(space->machine, "bank1", vram_bank - 1);
786         memory_set_bank(space->machine, "bank1", state->vram_bank - 1);
787787         break;
788788
789789      /* pages A-F are not connected */
r10613r10614
803803
804804READ8_HANDLER( mayday_protection_r )
805805{
806   williams_state *state = space->machine->driver_data<williams_state>();
806807   /* Mayday does some kind of protection check that is not currently understood  */
807808   /* However, the results of that protection check are stored at $a190 and $a191 */
808809   /* These are compared against $a193 and $a194, respectively. Thus, to prevent  */
809810   /* the protection from resetting the space->machine, we just return $a193 for $a190,  */
810811   /* and $a194 for $a191. */
811   return mayday_protection[offset + 3];
812   return state->mayday_protection[offset + 3];
812813}
813814
814815
r10613r10614
821822
822823WRITE8_HANDLER( sinistar_vram_select_w )
823824{
825   williams_state *state = space->machine->driver_data<williams_state>();
824826   /* low two bits are standard */
825827   williams_vram_select_w(space, offset, data);
826828
827829   /* window enable from bit 2 (clips to 0x7400) */
828   williams_blitter_window_enable = data & 0x04;
830   state->blitter_window_enable = data & 0x04;
829831}
830832
831833
r10613r10614
838840
839841MACHINE_START( blaster )
840842{
843   williams_state *state = machine->driver_data<williams_state>();
841844   MACHINE_START_CALL(williams_common);
842845
843846   /* banking is different for blaster */
844   memory_configure_bank(machine, "bank1", 0, 1, williams_videoram, 0);
847   memory_configure_bank(machine, "bank1", 0, 1, state->videoram, 0);
845848   memory_configure_bank(machine, "bank1", 1, 16, machine->region("maincpu")->base() + 0x18000, 0x4000);
846849
847   memory_configure_bank(machine, "bank2", 0, 1, williams_videoram + 0x4000, 0);
850   memory_configure_bank(machine, "bank2", 0, 1, state->videoram + 0x4000, 0);
848851   memory_configure_bank(machine, "bank2", 1, 16, machine->region("maincpu")->base() + 0x10000, 0x0000);
849852
850   state_save_register_global(machine, blaster_bank);
853   state_save_register_global(machine, state->blaster_bank);
851854}
852855
853856
r10613r10614
859862
860863INLINE void update_blaster_banking(running_machine *machine)
861864{
862   memory_set_bank(machine, "bank1", vram_bank * (blaster_bank + 1));
863   memory_set_bank(machine, "bank2", vram_bank * (blaster_bank + 1));
865   williams_state *state = machine->driver_data<williams_state>();
866   memory_set_bank(machine, "bank1", state->vram_bank * (state->blaster_bank + 1));
867   memory_set_bank(machine, "bank2", state->vram_bank * (state->blaster_bank + 1));
864868}
865869
866870
867871WRITE8_HANDLER( blaster_vram_select_w )
868872{
873   williams_state *state = space->machine->driver_data<williams_state>();
869874   /* VRAM/ROM banking from bit 0 */
870   vram_bank = data & 0x01;
875   state->vram_bank = data & 0x01;
871876   update_blaster_banking(space->machine);
872877
873878   /* cocktail flip from bit 1 */
874   williams_cocktail = data & 0x02;
879   state->cocktail = data & 0x02;
875880
876881   /* window enable from bit 2 (clips to 0x9700) */
877   williams_blitter_window_enable = data & 0x04;
882   state->blitter_window_enable = data & 0x04;
878883}
879884
880885
881886WRITE8_HANDLER( blaster_bank_select_w )
882887{
883   blaster_bank = data & 15;
888   williams_state *state = space->machine->driver_data<williams_state>();
889   state->blaster_bank = data & 15;
884890   update_blaster_banking(space->machine);
885891}
886892
r10613r10614
947953
948954MACHINE_START( joust2 )
949955{
956   williams_state *state = machine->driver_data<williams_state>();
950957   MACHINE_START_CALL(williams2);
951958   williams_cvsd_init(machine);
952   state_save_register_global(machine, joust2_current_sound_data);
959   state_save_register_global(machine, state->joust2_current_sound_data);
953960}
954961
955962
r10613r10614
972979
973980static WRITE8_DEVICE_HANDLER( joust2_pia_3_cb1_w )
974981{
982   williams_state *state = device->machine->driver_data<williams_state>();
975983   pia6821_device *pia_3 = device->machine->device<pia6821_device>("cvsdpia");
976984
977   joust2_current_sound_data = (joust2_current_sound_data & ~0x100) | ((data << 8) & 0x100);
985   state->joust2_current_sound_data = (state->joust2_current_sound_data & ~0x100) | ((data << 8) & 0x100);
978986   pia6821_cb1_w(pia_3, data);
979987}
980988
981989
982990static WRITE8_DEVICE_HANDLER( joust2_snd_cmd_w )
983991{
984   joust2_current_sound_data = (joust2_current_sound_data & ~0xff) | (data & 0xff);
985   williams_cvsd_data_w(device->machine, joust2_current_sound_data);
986   device->machine->scheduler().synchronize(FUNC(joust2_deferred_snd_cmd_w), joust2_current_sound_data);
992   williams_state *state = device->machine->driver_data<williams_state>();
993   state->joust2_current_sound_data = (state->joust2_current_sound_data & ~0xff) | (data & 0xff);
994   williams_cvsd_data_w(device->machine, state->joust2_current_sound_data);
995   device->machine->scheduler().synchronize(FUNC(joust2_deferred_snd_cmd_w), state->joust2_current_sound_data);
987996}
src/mame/mamedriv.c
r10613r10614
33853385   /* Namco System 10 */
33863386   DRIVER( mrdrilr2 )   /* 2000.07 Mr Driller 2 (DR21 Ver.A) */
33873387   DRIVER( mrdrlr2a )      /* 2000.?? Mr Driller 2 (DR22 Ver.A) */
3388   DRIVER( ptblank3 )    /* 2000.12 Point Blank 3 / Gunbalina */
3388   DRIVER( ptblank3 )   /* 2000.12 Point Blank 3 / Gunbalina */
33893389                  /* 2001.02 Photo Battole */
33903390                  /* 2001.02 Taiko no Tatsujin */
33913391                  /* 2001.03 Gahaha Ippatsudou */
r10613r10614
49284928   DRIVER( ftspeed )   /* 2004.09 Faster than Speed */
49294929   DRIVER( kov7sprt )   /* 2004.?? Knights of Valour - The Seven Sprits */
49304930   DRIVER( vfurlong )   /* 2005.03 Net Select Keiba Victory Furlong */
4931                  /* 2005.03 The Rumble Fish 2 */
4931   DRIVER( rumblef2 )   /* 2005.03 The Rumble Fish 2 */
49324932   DRIVER( ngbc )      /* 2005.07 NeoGeo Battle Colloseum */
49334933   DRIVER( samsptk )   /* 2005.09 Samurai Spirits Tenkaichi Kenkakuden */
49344934   DRIVER( kofxi )      /* 2005.10 The King of Fighters XI */
r10613r10614
80538053   DRIVER( funcube2 )   /* (c) 2001 Namco */
80548054   DRIVER( funcube4 )   /* (c) 2001 Namco */
80558055   DRIVER( trophyh )   /* (c) 2002 Sammy USA Corporation */
8056   DRIVER( reelquak )   /* (c) ???? <unknown> */
80568057
80578058   /* SSV System (Seta, Sammy, Visco) games */
80588059   DRIVER( srmp4 )      /* (c) 1993 Seta */
r10613r10614
85568557
85578558   /* Sigma B98 / Sammy Medal Games */
85588559   DRIVER( gegege )   /* (c) 1997 Banpresto / Sigma */
8560   DRIVER( sammymdl )   /* (c) 2000-2003 Sammy */
85598561   DRIVER( animalc )   /* (c) 2000 Sammy */
85608562   DRIVER( itazuram )   /* (c) 2000 Sammy */
85618563   DRIVER( pyenaget )   /* (c) 2000 Sammy */
r10613r10614
86858687   DRIVER( kov2106 )      /* (c) 2000 */
86868688   DRIVER( kov2103 )      /* (c) 2000 */
86878689   DRIVER( kov2102 )      /* (c) 2000 */
8690   DRIVER( kov2101 )      /* (c) 2000 */
86888691   DRIVER( kov2100 )      /* (c) 2000 */
86898692   DRIVER( kov2p )         /* (c) 2000 */
86908693   DRIVER( kov2p205 )      /* (c) 2000 */
r10613r10614
94319434   DRIVER( poizone )   /* (c) 1990 Sisteme */
94329435   DRIVER( ssfindo )   /* (c) 1999 Icarus */
94339436   DRIVER( ppcar )      /* (c) 1999 Icarus */
9437   DRIVER( tetfight)   /* (c) 2001 Sego */
94349438   DRIVER( imolagp )   /* (c) 1981 Leante Games */
94359439   DRIVER( dambustr )   /* (c) 1981 South West Research */
94369440   DRIVER( dambustra )   /* (c) 1981 South West Research */
r10613r10614
96069610   DRIVER( smoto20 )   /* (c) 1996 Subsino */
96079611   DRIVER( smoto16 )   /* (c) 1996 Subsino */
96089612   DRIVER( mtrain )   /* (c) 1996 Subsino */
9613   DRIVER( mtrainnv )   /* (c) 1996 Subsino */
96099614   DRIVER( expcard )   /* (c) 1998 American Alpha */
96109615   DRIVER( saklove )   /* (c) 1998 Subsino */
96119616   DRIVER( bishjan )   /* (c) 1999 Subsino */
r10613r10614
96889693   DRIVER( sloco93 )   /* 1993, Unknown */
96899694   DRIVER( sloco93a )   /* 1993, Unknown */
96909695   DRIVER( maverik )   /* 198?, Unknown */
9696   DRIVER( brasil86 )   /* 1986, Unknown */
9697   DRIVER( brasil87 )   /* 1987, Unknown */
96919698   DRIVER( brasil89 )   /* 1989, Unknown */
9699   DRIVER( brasil89a )   /* 1989, Unknown */
9700   DRIVER( brasil93 )   /* 1993, Unknown */
96929701   DRIVER( poker91 )   /* 1991, Unknown */
96939702   DRIVER( genie )      /* (c) 198? Video Fun Games Ltd. */
96949703   DRIVER( silverga )   /* 1983, Unknown */
r10613r10614
1074910758   DRIVER( freedom  )
1075010759   DRIVER( matahari )
1075110760   DRIVER( nightrdr )
10761   DRIVER( nightr20 )
1075210762   DRIVER( pwerplay )
1075310763   DRIVER( stk_sprs )
1075410764
r10613r10614
1076310773   DRIVER( cybrnaut )
1076410774   DRIVER( dollyptn )
1076510775   DRIVER( eballdlx )
10776   DRIVER( eballd14 )
1076610777   DRIVER( elektra  )
1076710778   DRIVER( embryon  )
1076810779   DRIVER( fathom   )
r10613r10614
1095310964   DRIVER( tomy_h30 )
1095410965   DRIVER( wwfr_106 )
1095510966   DRIVER( wwfr_103 )
10956   DRIVER( titanic )
10957   DRIVER( monopred )
10958   DRIVER( wackadoo )
1095910967
1096010968
1096110969   // de_3b.c
r10613r10614
1098010988   DRIVER( frankstg )
1098110989   DRIVER( mav_402 )
1098210990   DRIVER( mav_401 )
10991   DRIVER( mav_400 )
1098310992   DRIVER( mav_100 )
1098410993   DRIVER( detest )
10994   DRIVER( ctcheese )
1098510995
1098610996
1098710997   // flicker.c
r10613r10614
1157411584
1157511585   // whitestar.c
1157611586   DRIVER( apollo13 )
11587   DRIVER( aust301 )
11588   DRIVER( aust300 )
11589   DRIVER( aust201 )
1157711590   DRIVER( austin )
1157811591   DRIVER( austnew )
1157911592   DRIVER( austinf )
r10613r10614
1160811621   DRIVER( id4 )
1160911622   DRIVER( lostspc )
1161011623   DRIVER( monopolp )
11611   DRIVER( monopole )
11624   DRIVER( monop303 )
11625   DRIVER( monop301 )
11626   DRIVER( monop251 )
11627   DRIVER( monop233 )
1161211628   DRIVER( monopolf )
1161311629   DRIVER( monopolg )
1161411630   DRIVER( monopoli )
r10613r10614
1161611632   DRIVER( mononew )
1161711633   DRIVER( nfl )
1161811634   DRIVER( playboys )
11635   DRIVER( playboys_303 )
11636   DRIVER( playboys_300 )
1161911637   DRIVER( playnew )
1162011638   DRIVER( playboyf )
11639   DRIVER( playboyf_303 )
11640   DRIVER( playboyf_300 )
1162111641   DRIVER( playboyg )
11642   DRIVER( playboyg_303 )
11643   DRIVER( playboyg_300 )
1162211644   DRIVER( playboyi )
11645   DRIVER( playboyi_303 )
11646   DRIVER( playboyi_300 )
1162311647   DRIVER( playboyl )
11648   DRIVER( playboyl_303 )
11649   DRIVER( playboyl_300 )
1162411650   DRIVER( rctycn )
11651   DRIVER( rctycn_701 )
11652   DRIVER( rctycn_400 )
1162511653   DRIVER( rctnew )
1162611654   DRIVER( rctycng )
11655   DRIVER( rctycng_701 )
11656   DRIVER( rctycng_400 )
1162711657   DRIVER( rctycnf )
11658   DRIVER( rctycnf_701 )
11659   DRIVER( rctycnf_400 )
1162811660   DRIVER( rctycni )
11661   DRIVER( rctycni_701 )
11662   DRIVER( rctycni_400 )
1162911663   DRIVER( rctycnl )
11664   DRIVER( rctycnl_701 )
11665   DRIVER( rctycnl_400 )
1163011666   DRIVER( shrkysht )
11667   DRIVER( shrky_207 )
1163111668   DRIVER( shrknew )
11632   DRIVER( shrky_gr )
11633   DRIVER( shrky_fr )
11634   DRIVER( shrky_it )
11669   DRIVER( shrkygr )
11670   DRIVER( shrkygr_207 )
11671   DRIVER( shrkyfr )
11672   DRIVER( shrkyfr_207 )
11673   DRIVER( shrkyit )
11674   DRIVER( shrkyit_207 )
1163511675   DRIVER( sprk_103 )
1163611676   DRIVER( sprk_090 )
1163711677   DRIVER( spacejam )
r10613r10614
1164911689   DRIVER( strxt_it )
1165011690   DRIVER( strxt_sp )
1165111691   DRIVER( term3 )
11692   DRIVER( term3_205 )
1165211693   DRIVER( t3new )
1165311694   DRIVER( term3g )
1165411695   DRIVER( term3l )
11696   DRIVER( term3l_205 )
1165511697   DRIVER( term3f )
11698   DRIVER( term3f_205 )
1165611699   DRIVER( term3i )
11700   DRIVER( term3i_205 )
1165711701   DRIVER( jplstw22 )
1165811702   DRIVER( jplstw20 )
1165911703   DRIVER( simpprty )
r10613r10614
1166811712   DRIVER( twst_404 )
1166911713   DRIVER( twst_300 )
1167011714   DRIVER( viprsega )
11715   DRIVER( ctchzdlx )
11716   DRIVER( titanic )
11717   DRIVER( monopred )
11718   DRIVER( wackadoo )
1167111719
1167211720
1167311721   // white_mod.c
1167411722   DRIVER( elvisp )
11723   DRIVER( elvisp4 )
11724   DRIVER( elvisp303 )
11725   DRIVER( elvisp302 )
1167511726   DRIVER( elvisl )
11727   DRIVER( elvisl4 )
11728   DRIVER( elvisl303 )
11729   DRIVER( elvisl302 )
1167611730   DRIVER( elvisg )
11731   DRIVER( elvisg4 )
11732   DRIVER( elvisg303 )
11733   DRIVER( elvisg302 )
1167711734   DRIVER( elvisf )
11735   DRIVER( elvisf4 )
11736   DRIVER( elvisf303 )
11737   DRIVER( elvisf302 )
1167811738   DRIVER( elvisi )
11739   DRIVER( elvisi4 )
11740   DRIVER( elvisi303 )
11741   DRIVER( elvisi302 )
1167911742   DRIVER( gprix )
1168011743   DRIVER( gprixg )
1168111744   DRIVER( gprixl )
r10613r10614
1168411747   DRIVER( nascar )
1168511748   DRIVER( nascarl )
1168611749   DRIVER( ripleys )
11750   DRIVER( rip310 )
11751   DRIVER( rip302 )
11752   DRIVER( rip300 )
1168711753   DRIVER( ripleysf )
11754   DRIVER( ripf310 )
11755   DRIVER( ripf302 )
11756   DRIVER( ripf300 )
1168811757   DRIVER( ripleysg )
11758   DRIVER( ripg310 )
11759   DRIVER( ripg302 )
11760   DRIVER( ripg300 )
1168911761   DRIVER( ripleysi )
11762   DRIVER( ripi310 )
11763   DRIVER( ripi302 )
11764   DRIVER( ripi300 )
1169011765   DRIVER( ripleysl )
11766   DRIVER( ripl310 )
11767   DRIVER( ripl302 )
11768   DRIVER( ripl300 )
1169111769   DRIVER( lotr )
11770   DRIVER( lotr9 )
11771   DRIVER( lotr8 )
11772   DRIVER( lotr7 )
11773   DRIVER( lotr401 )
1169211774   DRIVER( lotr_le )
1169311775   DRIVER( lotr_sp )
11776   DRIVER( lotr_sp9 )
11777   DRIVER( lotr_sp8 )
11778   DRIVER( lotr_sp7 )
11779   DRIVER( lotr_sp401 )
1169411780   DRIVER( lotr_gr )
11781   DRIVER( lotr_gr9 )
11782   DRIVER( lotr_gr8 )
11783   DRIVER( lotr_gr7 )
11784   DRIVER( lotr_gr401 )
1169511785   DRIVER( lotr_fr )
11786   DRIVER( lotr_fr9 )
11787   DRIVER( lotr_fr8 )
11788   DRIVER( lotr_fr7 )
11789   DRIVER( lotr_fr401 )
1169611790   DRIVER( lotr_it )
11791   DRIVER( lotr_it9 )
11792   DRIVER( lotr_it8 )
11793   DRIVER( lotr_it7 )
11794   DRIVER( lotr_it401 )
1169711795   DRIVER( sopranos )
1169811796   DRIVER( soprano3 )
1169911797   DRIVER( sopranog )
src/mame/includes/nbmj9195.h
r10613r10614
1#define   VRAM_MAX   2
2
3#define   SCANLINE_MIN   0
4#define   SCANLINE_MAX   512
5
6
7class nbmj9195_state : public driver_device
8{
9public:
10   nbmj9195_state(running_machine &machine, const driver_device_config_base &config)
11      : driver_device(machine, config) { }
12
13   int inputport;
14   int dipswbitsel;
15   int outcoin_flag;
16   int mscoutm_inputport;
17   UINT8 *nvram;
18   size_t nvram_size;
19   UINT8 pio_dir[5 * 2];
20   UINT8 pio_latch[5 * 2];
21   int scrollx[VRAM_MAX];
22   int scrolly[VRAM_MAX];
23   int scrollx_raster[VRAM_MAX][SCANLINE_MAX];
24   int scanline[VRAM_MAX];
25   int blitter_destx[VRAM_MAX];
26   int blitter_desty[VRAM_MAX];
27   int blitter_sizex[VRAM_MAX];
28   int blitter_sizey[VRAM_MAX];
29   int blitter_src_addr[VRAM_MAX];
30   int blitter_direction_x[VRAM_MAX];
31   int blitter_direction_y[VRAM_MAX];
32   int dispflag[VRAM_MAX];
33   int flipscreen[VRAM_MAX];
34   int clutmode[VRAM_MAX];
35   int transparency[VRAM_MAX];
36   int clutsel;
37   int screen_refresh;
38   int gfxflag2;
39   int gfxdraw_mode;
40   int nb19010_busyctr;
41   int nb19010_busyflag;
42   bitmap_t *tmpbitmap[VRAM_MAX];
43   UINT16 *videoram[VRAM_MAX];
44   UINT16 *videoworkram[VRAM_MAX];
45   UINT8 *palette;
46   UINT8 *nb22090_palette;
47   UINT8 *clut[VRAM_MAX];
48   int flipscreen_old[VRAM_MAX];
49};
50
51
152/*----------- defined in video/nbmj9195.c -----------*/
253
354SCREEN_UPDATE( nbmj9195 );
r10613r10614
1768WRITE8_HANDLER( nbmj9195_clut_0_w );
1869WRITE8_HANDLER( nbmj9195_clut_1_w );
1970
20void nbmj9195_clutsel_w(int data);
21void nbmj9195_gfxflag2_w(int data);
71void nbmj9195_clutsel_w(address_space *space, int data);
72void nbmj9195_gfxflag2_w(address_space *space, int data);
src/mame/includes/niyanpai.h
r10613r10614
1#define   VRAM_MAX   3
2
3class niyanpai_state : public driver_device
4{
5public:
6   niyanpai_state(running_machine &machine, const driver_device_config_base &config)
7      : driver_device(machine, config) { }
8
9   int musobana_inputport;
10   int musobana_outcoin_flag;
11   UINT8 pio_dir[5];
12   UINT8 pio_latch[5];
13   int scrollx[VRAM_MAX];
14   int scrolly[VRAM_MAX];
15   int blitter_destx[VRAM_MAX];
16   int blitter_desty[VRAM_MAX];
17   int blitter_sizex[VRAM_MAX];
18   int blitter_sizey[VRAM_MAX];
19   int blitter_src_addr[VRAM_MAX];
20   int blitter_direction_x[VRAM_MAX];
21   int blitter_direction_y[VRAM_MAX];
22   int dispflag[VRAM_MAX];
23   int flipscreen[VRAM_MAX];
24   int clutmode[VRAM_MAX];
25   int transparency[VRAM_MAX];
26   int clutsel[VRAM_MAX];
27   int screen_refresh;
28   int nb19010_busyctr;
29   int nb19010_busyflag;
30   bitmap_t *tmpbitmap[VRAM_MAX];
31   UINT16 *videoram[VRAM_MAX];
32   UINT16 *videoworkram[VRAM_MAX];
33   UINT16 *palette;
34   UINT8 *clut[VRAM_MAX];
35   int flipscreen_old[VRAM_MAX];
36};
37
38
139/*----------- defined in video/niyanpai.c -----------*/
240
341SCREEN_UPDATE( niyanpai );
src/mame/includes/seta2.h
r10613r10614
88   optional_shared_ptr<UINT16> m_nvram;
99
1010   UINT16 *vregs;
11   int yoffset;
11   int xoffset, yoffset;
1212   int keyboard_row;
1313
1414   UINT16 *spriteram;
r10613r10614
3232WRITE16_HANDLER( seta2_vregs_w );
3333
3434VIDEO_START( seta2 );
35VIDEO_START( seta2_offset );
35VIDEO_START( seta2_xoffset );
36VIDEO_START( seta2_yoffset );
3637SCREEN_UPDATE( seta2 );
3738SCREEN_EOF( seta2 );
38
39
src/mame/includes/shootout.h
r10613r10614
99   UINT8 *spriteram;
1010   UINT8 *videoram;
1111   UINT8 *textram;
12   int bFlicker;
1213};
1314
1415
src/mame/includes/megadriv.h
r10613r10614
104104public:
105105   md_boot_state(running_machine &machine, const driver_device_config_base &config)
106106   : md_base_state(machine, config) { }
107   
108   // bootleg specific   
107
108   // bootleg specific
109109   int aladmdb_mcu_port;
110110};
111111
r10613r10614
114114public:
115115   segac2_state(running_machine &machine, const driver_device_config_base &config)
116116   : md_base_state(machine, config) { }
117   
117
118118   // for Print Club only
119119   int cam_data;
120   
120
121121   int segac2_enable_display;
122   
122
123123   UINT16* paletteram;
124   
124
125125   /* internal states */
126126   UINT8      misc_io_data[0x10];   /* holds values written to the I/O chip */
127   
127
128128   /* protection-related tracking */
129129   int (*prot_func)(int in);      /* emulation of protection chip */
130130   UINT8      prot_write_buf;      /* remembers what was written */
131131   UINT8      prot_read_buf;      /* remembers what was returned */
132   
132
133133   /* palette-related variables */
134134   UINT8      segac2_alt_palette_mode;
135135   UINT8      palbank;
136136   UINT8      bg_palbase;
137137   UINT8      sp_palbase;
138   
138
139139   /* sound-related variables */
140140   UINT8      sound_banks;      /* number of sound banks */
141141};
r10613r10614
145145public:
146146   mplay_state(running_machine &machine, const driver_device_config_base &config)
147147   : md_base_state(machine, config) { }
148   
148
149149   UINT32 bios_mode;  // determines whether ROM banks or Game data
150150   // is to read from 0x8000-0xffff
151   
151
152152   UINT32 bios_bank; // ROM bank selection
153153   UINT16 game_banksel;  // Game bank selection
154154   UINT32 readpos;  // serial bank selection position (9-bit)
155155   UINT32 mp_bios_bank_addr;
156   
156
157157   UINT32 bios_width;  // determines the way the game info ROM is read
158158   UINT8 bios_ctrl[6];
159159   UINT8 bios_6600;
160160   UINT8 bios_6403;
161161   UINT8 bios_6404;
162   
162
163163   UINT16 *genesis_io_ram;
164164   UINT8* ic3_ram;
165165   UINT8* ic37_ram;
r10613r10614
171171public:
172172   mtech_state(running_machine &machine, const driver_device_config_base &config)
173173   : md_base_state(machine, config) { }
174   
174
175175   UINT8 mt_cart_select_reg;
176176   UINT32 bios_port_ctrl;
177177   int current_game_is_sms; // is the current game SMS based (running on genesis z80, in VDP compatibility mode)
178178   UINT32 bios_ctrl_inputs;
179179   UINT8 bios_ctrl[6];
180   
180
181181   int mt_bank_addr;
182   
182
183183   int cart_is_genesis[8];
184   
184
185185   /* Megatech BIOS specific */
186186   UINT8* megatech_banked_ram;
187187};
r10613r10614
190190struct _megadriv_cart
191191{
192192   int type;
193   
193
194194   // SRAM related
195195   UINT16 *sram;
196196   int last_loaded_image_length;
r10613r10614
198198   int sram_active, sram_readonly;
199199   int sram_handlers_installed;
200200   int sram_detected;
201   
201
202202   // EEPROM related
203203   int has_serial_eeprom;
204   
204
205205   // I2C related
206206   UINT8 i2c_mem, i2c_clk;
207   
207
208208   // mapper related (mostly for pirate carts)
209209   UINT16 squirrel_king_extra;
210210   UINT16 lion2_prot1_data, lion2_prot2_data;
r10613r10614
218218public:
219219   md_cons_state(running_machine &machine, const driver_device_config_base &config)
220220   : md_base_state(machine, config) { }
221   
221
222222   emu_timer *mess_io_timeout[3];
223223   int mess_io_stage[3];
224   UINT8 jcart_io_data[2];   
225   
224   UINT8 jcart_io_data[2];
225
226226   megadriv_cart md_cart;
227227};
228228
r10613r10614
231231public:
232232   pico_state(running_machine &machine, const driver_device_config_base &config)
233233   : md_cons_state(machine, config) { }
234   
234
235235   UINT8 page_register;
236236};
237237
src/mame/includes/terracre.h
r10613r10614
55      : driver_device(machine, config) { }
66
77   UINT16 *videoram;
8   const UINT16 *mpProtData;
9   UINT8 mAmazonProtCmd;
10   UINT8 mAmazonProtReg[6];
11   UINT16 *amazon_videoram;
12   UINT16 xscroll;
13   UINT16 yscroll;
14   tilemap_t *background;
15   tilemap_t *foreground;
816};
917
1018
1119/*----------- defined in video/terracre.c -----------*/
1220
13extern UINT16 *amazon_videoram;
14
1521PALETTE_INIT( amazon );
1622WRITE16_HANDLER( amazon_background_w );
1723WRITE16_HANDLER( amazon_foreground_w );
src/mame/includes/punchout.h
r10613r10614
1class punchout_state : public driver_device
2{
3public:
4   punchout_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   int rp5c01_mode_sel;
8   int rp5c01_mem[16*4];
9   UINT8 *bg_top_videoram;
10   UINT8 *bg_bot_videoram;
11   UINT8 *armwrest_fg_videoram;
12   UINT8 *spr1_videoram;
13   UINT8 *spr2_videoram;
14   UINT8 *spr1_ctrlram;
15   UINT8 *spr2_ctrlram;
16   UINT8 *palettebank;
17   tilemap_t *bg_top_tilemap;
18   tilemap_t *bg_bot_tilemap;
19   tilemap_t *fg_tilemap;
20   tilemap_t *spr1_tilemap;
21   tilemap_t *spr1_tilemap_flipx;
22   tilemap_t *spr2_tilemap;
23   int palette_reverse_top;
24   int palette_reverse_bot;
25};
26
27
128/*----------- defined in video/punchout.c -----------*/
229
3extern UINT8 *punchout_bg_top_videoram;
4extern UINT8 *punchout_bg_bot_videoram;
5extern UINT8 *armwrest_fg_videoram;
6extern UINT8 *punchout_spr1_videoram;
7extern UINT8 *punchout_spr2_videoram;
8extern UINT8 *punchout_spr1_ctrlram;
9extern UINT8 *punchout_spr2_ctrlram;
10extern UINT8 *punchout_palettebank;
11
1230WRITE8_HANDLER( punchout_bg_top_videoram_w );
1331WRITE8_HANDLER( punchout_bg_bot_videoram_w );
1432WRITE8_HANDLER( armwrest_fg_videoram_w );
src/mame/includes/xorworld.h
r10613r10614
55      : driver_device(machine, config) { }
66
77   UINT16 *videoram;
8   tilemap_t *bg_tilemap;
89};
910
1011
src/mame/includes/dkong.h
r10613r10614
180180   UINT8             dma_latch;
181181   UINT8             flip;
182182
183   /* radarscp_step */
184   double cv1;
185   double cv2;
186   double vg1;
187   double vg2;
188   double vg3;
189   double cv3;
190   double cv4;
191   int pixelcnt;
192
193   /* radarscp_scanline */
194   int counter;
195
183196   /* reverse address lookup map - hunchbkd */
184197   INT16             rev_map[0x200];
185198};
src/mame/includes/wiping.h
r10613r10614
1class wiping_state : public driver_device
2{
3public:
4   wiping_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   UINT8 *sharedram1;
8   UINT8 *sharedram2;
9   UINT8 *videoram;
10   UINT8 *colorram;
11   int flipscreen;
12   UINT8 *soundregs;
13};
14
15
116/*----------- defined in video/wiping.c -----------*/
217
3extern UINT8 *wiping_videoram;
4extern UINT8 *wiping_colorram;
5
618WRITE8_HANDLER( wiping_flipscreen_w );
719PALETTE_INIT( wiping );
820SCREEN_UPDATE( wiping );
src/mame/includes/popeye.h
r10613r10614
1class popeye_state : public driver_device
2{
3public:
4   popeye_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   UINT8 prot0;
8   UINT8 prot1;
9   UINT8 prot_shift;
10   int dswbit;
11   UINT8 *videoram;
12   UINT8 *colorram;
13   UINT8 *background_pos;
14   UINT8 *palettebank;
15   UINT8 *bitmapram;
16   bitmap_t *tmpbitmap2;
17   UINT8 invertmask;
18   UINT8 bitmap_type;
19   tilemap_t *fg_tilemap;
20   UINT8 lastflip;
21};
22
23
124/*----------- defined in video/popeye.c -----------*/
225
3extern UINT8 *popeye_videoram;
4extern UINT8 *popeye_colorram;
5extern UINT8 *popeye_background_pos;
6extern UINT8 *popeye_palettebank;
7
826WRITE8_HANDLER( popeye_videoram_w );
927WRITE8_HANDLER( popeye_colorram_w );
1028WRITE8_HANDLER( popeye_bitmap_w );
src/mame/includes/pgm.h
r10613r10614
9393void pgm_kovshp_decrypt(running_machine *machine);
9494void pgm_killbldp_decrypt(running_machine *machine);
9595void pgm_svg_decrypt(running_machine *machine);
96void pgm_dw2001_decrypt(running_machine *machine);
9796void pgm_ket_decrypt(running_machine *machine);
9897void pgm_espgal_decrypt(running_machine *machine);
9998
src/mame/includes/pastelg.h
r10613r10614
1class pastelg_state : public driver_device
2{
3public:
4   pastelg_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   UINT8 mux_data;
8   int blitter_destx;
9   int blitter_desty;
10   int blitter_sizex;
11   int blitter_sizey;
12   int blitter_src_addr;
13   int gfxrom;
14   int dispflag;
15   int flipscreen;
16   int blitter_direction_x;
17   int blitter_direction_y;
18   int palbank;
19   UINT8 *videoram;
20   UINT8 *clut;
21   int flipscreen_old;
22};
23
24
125/*----------- defined in video/pastelg.c -----------*/
226
327PALETTE_INIT( pastelg );
r10613r10614
1135WRITE8_HANDLER( pastelg_blitter_w );
1236READ8_HANDLER( threeds_rom_readback_r );
1337
14int pastelg_blitter_src_addr_r(void);
38int pastelg_blitter_src_addr_r(address_space *space);
src/mame/includes/atarig42.h
r10613r10614
3030   UINT16 *      sloop_base;
3131
3232   device_t *      rle;
33   UINT32         last_accesses[8];
3334};
3435
3536
src/mame/includes/warpwarp.h
r10613r10614
77extern int warpwarp_ball_on;
88extern int warpwarp_ball_h, warpwarp_ball_v;
99extern int warpwarp_ball_pen, warpwarp_ball_sizex, warpwarp_ball_sizey;
10extern int geebee_handleoverlay;
1110
1211PALETTE_INIT( geebee );
1312PALETTE_INIT( navarone );
src/mame/includes/spacefb.h
r10613r10614
2424#define SPACEFB_INT_TRIGGER_COUNT_2      (0x0f0)
2525
2626
27class spacefb_state : public driver_device
28{
29public:
30   spacefb_state(running_machine &machine, const driver_device_config_base &config)
31      : driver_device(machine, config) { }
32
33   UINT8 sound_latch;
34   emu_timer *interrupt_timer;
35   UINT8 *videoram;
36   size_t videoram_size;
37   UINT8 *object_present_map;
38   UINT8 port_0;
39   UINT8 port_2;
40   UINT32 star_shift_reg;
41   double color_weights_rg[3];
42   double color_weights_b[2];
43};
44
45
2746/*----------- defined in audio/spacefb.c -----------*/
2847
2948MACHINE_CONFIG_EXTERN( spacefb_audio );
r10613r10614
3655
3756/*----------- defined in video/spacefb.c -----------*/
3857
39extern UINT8 *spacefb_videoram;
40extern size_t spacefb_videoram_size;
41
4258VIDEO_START( spacefb );
4359SCREEN_UPDATE( spacefb );
4460
src/mame/includes/nbmj8891.h
r10613r10614
1class nbmj8891_state : public driver_device
2{
3public:
4   nbmj8891_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   int scrolly;
8   int blitter_destx;
9   int blitter_desty;
10   int blitter_sizex;
11   int blitter_sizey;
12   int blitter_src_addr;
13   int blitter_direction_x;
14   int blitter_direction_y;
15   int vram;
16   int gfxrom;
17   int dispflag;
18   int flipscreen;
19   int clutsel;
20   int screen_refresh;
21   int gfxdraw_mode;
22   bitmap_t *tmpbitmap0;
23   bitmap_t *tmpbitmap1;
24   UINT8 *videoram0;
25   UINT8 *videoram1;
26   UINT8 *palette;
27   UINT8 *clut;
28   int param_old[0x10];
29   int param_cnt;
30   int flipscreen_old;
31};
32
33
134/*----------- defined in video/nbmj8891.c -----------*/
235
336SCREEN_UPDATE( nbmj8891 );
src/mame/includes/magmax.h
r10613r10614
55      : driver_device(machine, config) { }
66
77   UINT16 *videoram;
8   UINT8 sound_latch;
9   UINT8 LS74_clr;
10   UINT8 LS74_q;
11   UINT8 gain_control;
12   emu_timer *interrupt_timer;
13   UINT16 *vreg;
14   UINT16 *scroll_x;
15   UINT16 *scroll_y;
16   int flipscreen;
17   UINT32 *prom_tab;
818};
919
1020
1121/*----------- defined in video/magmax.c -----------*/
1222
13extern UINT16 *magmax_vreg;
14extern UINT16 *magmax_scroll_x;
15extern UINT16 *magmax_scroll_y;
16
1723PALETTE_INIT( magmax );
1824SCREEN_UPDATE( magmax );
1925VIDEO_START( magmax );
src/mame/includes/gatron.h
r10613r10614
55      : driver_device(machine, config) { }
66
77   UINT8 *videoram;
8   tilemap_t *bg_tilemap;
89};
910
1011
src/mame/includes/nbmj8688.h
r10613r10614
1class nbmj8688_state : public driver_device
2{
3public:
4   nbmj8688_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   int mjsikaku_scrolly;
8   int blitter_destx;
9   int blitter_desty;
10   int blitter_sizex;
11   int blitter_sizey;
12   int blitter_direction_x;
13   int blitter_direction_y;
14   int blitter_src_addr;
15   int mjsikaku_gfxrom;
16   int mjsikaku_dispflag;
17   int mjsikaku_gfxflag2;
18   int mjsikaku_gfxflag3;
19   int mjsikaku_flipscreen;
20   int mjsikaku_screen_refresh;
21   int mjsikaku_gfxmode;
22   bitmap_t *mjsikaku_tmpbitmap;
23   UINT16 *mjsikaku_videoram;
24   UINT8 *clut;
25   UINT8 *HD61830B_ram[2];
26   int HD61830B_instr[2];
27   int HD61830B_addr[2];
28   int mjsikaku_flipscreen_old;
29};
30
31
132/*----------- defined in video/nbmj8688.c -----------*/
233
334PALETTE_INIT( mbmj8688_8bit );
src/mame/includes/vsnes.h
r10613r10614
1class vsnes_state : public driver_device
2{
3public:
4   vsnes_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   UINT8 *work_ram;
8   UINT8 *work_ram_1;
9   int coin;
10   int do_vrom_bank;
11   int input_latch[4];
12   int sound_fix;
13   UINT8 last_bank;
14   UINT8* vram;
15   UINT8* vrom[2];
16   UINT8* nt_ram[2];
17   UINT8* nt_page[2][4];
18   UINT32 vrom_size[2];
19   int vrom_banks;
20   int zapstore;
21   int old_bank;
22   int drmario_shiftreg;
23   int drmario_shiftcount;
24   int size16k;
25   int switchlow;
26   int vrom4k;
27   int MMC3_cmd;
28   int MMC3_prg_bank[4];
29   int MMC3_chr_bank[6];
30   int MMC3_prg_mask;
31   int IRQ_enable;
32   int IRQ_count;
33   int IRQ_count_latch;
34   int VSindex;
35   int supxevs_prot_index;
36   int security_counter;
37   int ret;
38};
39
40
141/*----------- defined in video/vsnes.c -----------*/
242
343VIDEO_START( vsnes );
src/mame/includes/victory.h
r10613r10614
1616#define VICTORY_VBSTART               (0x100)
1717
1818
19/* microcode state */
20struct micro_t
21{
22   UINT16      i;
23   UINT16      pc;
24   UINT8      r,g,b;
25   UINT8      x,xp,y,yp;
26   UINT8      cmd,cmdlo;
27   emu_timer *   timer;
28   UINT8      timer_active;
29   attotime   endtime;
30};
31
32class victory_state : public driver_device
33{
34public:
35   victory_state(running_machine &machine, const driver_device_config_base &config)
36      : driver_device(machine, config) { }
37
38   UINT8 *videoram;
39   UINT8 *charram;
40   UINT16 paletteram[0x40];
41   UINT8 *bgbitmap;
42   UINT8 *fgbitmap;
43   UINT8 *rram;
44   UINT8 *gram;
45   UINT8 *bram;
46   UINT8 vblank_irq;
47   UINT8 fgcoll;
48   UINT8 fgcollx;
49   UINT8 fgcolly;
50   UINT8 bgcoll;
51   UINT8 bgcollx;
52   UINT8 bgcolly;
53   UINT8 scrollx;
54   UINT8 scrolly;
55   UINT8 video_control;
56   struct micro_t micro;
57};
58
59
1960/*----------- defined in video/victory.c -----------*/
2061
21extern UINT8 *victory_videoram;
22extern UINT8 *victory_charram;
23
2462VIDEO_START( victory );
2563SCREEN_UPDATE( victory );
2664INTERRUPT_GEN( victory_vblank_interrupt );
src/mame/includes/vigilant.h
r10613r10614
55      : driver_device(machine, config) { }
66
77   UINT8 *videoram;
8   int horiz_scroll_low;
9   int horiz_scroll_high;
10   int rear_horiz_scroll_low;
11   int rear_horiz_scroll_high;
12   int rear_color;
13   int rear_disable;
14   int rear_refresh;
15   bitmap_t *bg_bitmap;
816};
917
1018
src/mame/includes/nbmj8991.h
r10613r10614
1class nbmj8991_state : public driver_device
2{
3public:
4   nbmj8991_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   int scrollx;
8   int scrolly;
9   int blitter_destx;
10   int blitter_desty;
11   int blitter_sizex;
12   int blitter_sizey;
13   int blitter_src_addr;
14   int blitter_direction_x;
15   int blitter_direction_y;
16   int gfxrom;
17   int dispflag;
18   int flipscreen;
19   int clutsel;
20   int screen_refresh;
21   bitmap_t *tmpbitmap;
22   UINT8 *videoram;
23   UINT8 *clut;
24   int flipscreen_old;
25};
26
27
128/*----------- defined in video/nbmj8991.c -----------*/
229
330SCREEN_UPDATE( nbmj8991_type1 );
src/mame/includes/exidy440.h
r10613r10614
77#define EXIDY440_MASTER_CLOCK      (XTAL_12_9792MHz)
88
99
10class exidy440_state : public driver_device
11{
12public:
13   exidy440_state(running_machine &machine, const driver_device_config_base &config)
14      : driver_device(machine, config) { }
15
16   UINT8 bank;
17   const UINT8 *showdown_bank_data[2];
18   INT8 showdown_bank_select;
19   UINT8 showdown_bank_offset;
20   UINT8 *imageram;
21   UINT8 *scanline;
22   UINT8 firq_vblank;
23   UINT8 firq_beam;
24   UINT8 *topsecex_yscroll;
25   UINT8 latched_x;
26   UINT8 *local_videoram;
27   UINT8 *local_paletteram;
28   UINT8 firq_enable;
29   UINT8 firq_select;
30   UINT8 palettebank_io;
31   UINT8 palettebank_vis;
32};
33
34
1035/*----------- defined in drivers/exidy440.c -----------*/
1136
1237void exidy440_bank_select(running_machine *machine, UINT8 bank);
r10613r10614
1439
1540/*----------- defined in video/exidy440.c -----------*/
1641
17extern UINT8 *exidy440_imageram;
18extern UINT8 *exidy440_scanline;
19extern UINT8  exidy440_firq_vblank;
20extern UINT8  exidy440_firq_beam;
21extern UINT8 *topsecex_yscroll;
22
2342INTERRUPT_GEN( exidy440_vblank_interrupt );
2443
2544READ8_HANDLER( exidy440_videoram_r );
src/mame/includes/pingpong.h
r10613r10614
1class pingpong_state : public driver_device
2{
3public:
4   pingpong_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   int intenable;
8   int question_addr_high;
9   UINT8 *videoram;
10   UINT8 *colorram;
11   tilemap_t *bg_tilemap;
12};
13
14
115/*----------- defined in video/pingpong.c -----------*/
216
3extern UINT8 *pingpong_videoram;
4extern UINT8 *pingpong_colorram;
5
617WRITE8_HANDLER( pingpong_videoram_w );
718WRITE8_HANDLER( pingpong_colorram_w );
819
src/mame/includes/pokechmp.h
r10613r10614
55      : driver_device(machine, config) { }
66
77   UINT8 *videoram;
8   tilemap_t *bg_tilemap;
89};
910
1011
src/mame/includes/nbmj8900.h
r10613r10614
1class nbmj8900_state : public driver_device
2{
3public:
4   nbmj8900_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   int scrolly;
8   int blitter_destx;
9   int blitter_desty;
10   int blitter_sizex;
11   int blitter_sizey;
12   int blitter_src_addr;
13   int blitter_direction_x;
14   int blitter_direction_y;
15   int vram;
16   int gfxrom;
17   int dispflag;
18   int flipscreen;
19   int clutsel;
20   int screen_refresh;
21   int gfxdraw_mode;
22   int screen_height;
23   int screen_width;
24   bitmap_t *tmpbitmap0;
25   bitmap_t *tmpbitmap1;
26   UINT8 *videoram0;
27   UINT8 *videoram1;
28   UINT8 *palette;
29   UINT8 *clut;
30   int flipscreen_old;
31};
32
33
134/*----------- defined in video/nbmj8900.c -----------*/
235
336SCREEN_UPDATE( nbmj8900 );
src/mame/includes/micro3d.h
r10613r10614
1717public:
1818   micro3d_state(running_machine &machine, const driver_device_config_base &config)
1919      : driver_device(machine, config) { }
20   
20
2121   UINT16            *shared_ram;
2222   device_t         *duart68681;
2323   UINT8            m68681_tx0;
src/mame/includes/m90.h
r10613r10614
1class m90_state : public driver_device
2{
3public:
4   m90_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   UINT32 bankaddress;
8   UINT16 *video_data;
9   UINT16 *spriteram;
10   UINT16 video_control_data[8];
11   tilemap_t *pf1_layer;
12   tilemap_t *pf2_layer;
13   tilemap_t *pf1_wide_layer;
14   tilemap_t *pf2_wide_layer;
15   int last_pf1;
16   int last_pf2;
17};
18
19
120/*----------- defined in video/m90.c -----------*/
221
3extern UINT16 *m90_video_data;
4
522VIDEO_START( m90 );
623VIDEO_START( dynablsb );
724VIDEO_START( bomblord );
src/mame/includes/playch10.h
r10613r10614
1typedef struct
2{
3   int writable;   // 1 for RAM, 0 for ROM
4   UINT8* chr;      // direct access to the memory
5} chr_bank;
6
17class playch10_state : public driver_device
28{
39public:
r10613r10614
511      : driver_device(machine, config) { }
612
713   UINT8 *videoram;
14   UINT8 *ram_8w;
15   UINT8 *work_ram;
16   int up_8w;
17   UINT8 *timedata;
18   int pc10_nmi_enable;
19   int pc10_dog_di;
20   int pc10_sdcs;
21   int pc10_dispmask;
22   int pc10_int_detect;
23   int pc10_game_mode;
24   int pc10_dispmask_old;
25   int pc10_gun_controller;
26   int cart_sel;
27   int cntrl_mask;
28   int input_latch[2];
29   int mirroring;
30   int MMC2_bank[4];
31   int MMC2_bank_latch[2];
32   UINT8* vrom;
33   UINT8* vram;
34   UINT8* nametable[4];
35   UINT8* nt_ram;
36   chr_bank chr_page[8];
37   int mmc1_shiftreg;
38   int mmc1_shiftcount;
39   int mmc1_rom_mask;
40   int gboard_scanline_counter;
41   int gboard_scanline_latch;
42   int gboard_banks[2];
43   int gboard_4screen;
44   int gboard_last_bank;
45   int gboard_command;
46   int pc10_bios;
47   tilemap_t *bg_tilemap;
848};
949
1050
r10613r10614
4787WRITE8_HANDLER( pc10_CARTSEL_w );
4888WRITE8_HANDLER( pc10_in0_w );
4989
50extern int pc10_nmi_enable;
51extern int pc10_dog_di;
52extern int pc10_sdcs;         /* ShareD Chip Select */
53extern int pc10_dispmask;      /* Display Mask */
54extern int pc10_int_detect;
55extern int pc10_game_mode;
56extern int pc10_dispmask_old;
5790
5891
5992/*----------- defined in video/playch10.c -----------*/
src/mame/includes/segas32.h
r10613r10614
5656   UINT8 sprite_control[8];
5757   UINT32 *spriteram_32bit;
5858   void (*system32_prot_vblank)(device_t *device);
59   int print_count;
5960};
6061
6162
src/mame/includes/gomoku.h
r10613r10614
11#include "devlegcy.h"
22
3class gomoku_state : public driver_device
4{
5public:
6   gomoku_state(running_machine &machine, const driver_device_config_base &config)
7      : driver_device(machine, config) { }
8
9   UINT8 *videoram;
10   UINT8 *colorram;
11   UINT8 *bgram;
12   int flipscreen;
13   int bg_dispsw;
14   tilemap_t *fg_tilemap;
15   bitmap_t *bg_bitmap;
16};
17
18
319/*----------- defined in audio/gomoku.c -----------*/
420
521WRITE8_DEVICE_HANDLER( gomoku_sound1_w );
r10613r10614
1026
1127/*----------- defined in video/gomoku.c -----------*/
1228
13extern UINT8 *gomoku_videoram;
14extern UINT8 *gomoku_colorram;
15extern UINT8 *gomoku_bgram;
16
1729PALETTE_INIT( gomoku );
1830VIDEO_START( gomoku );
1931SCREEN_UPDATE( gomoku );
src/mame/includes/tubep.h
r10613r10614
1class tubep_state : public driver_device
2{
3public:
4   tubep_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   UINT8 sound_latch;
8   UINT8 ls74;
9   UINT8 ls377;
10   emu_timer *interrupt_timer;
11   int curr_scanline;
12   UINT8 *rjammer_backgroundram;
13   UINT8 *backgroundram;
14   UINT8 *textram;
15   UINT8 *sprite_colorsharedram;
16   UINT8 *spritemap;
17   UINT8 prom2[32];
18   UINT32 romD_addr;
19   UINT32 romEF_addr;
20   UINT32 E16_add_b;
21   UINT32 HINV;
22   UINT32 VINV;
23   UINT32 XSize;
24   UINT32 YSize;
25   UINT32 mark_1;
26   UINT32 mark_2;
27   UINT32 colorram_addr_hi;
28   UINT32 ls273_g6;
29   UINT32 ls273_j6;
30   UINT32 romHI_addr_mid;
31   UINT32 romHI_addr_msb;
32   UINT8 DISP;
33   UINT8 background_romsel;
34   UINT8 color_A4;
35   UINT8 ls175_b7;
36   UINT8 ls175_e8;
37   UINT8 ls377_data;
38   UINT32 page;
39};
40
41
142/*----------- defined in video/tubep.c -----------*/
243
3void tubep_vblank_end(void);
44void tubep_vblank_end(running_machine *machine);
445PALETTE_INIT( tubep );
546SCREEN_UPDATE( tubep );
647PALETTE_INIT( rjammer );
r10613r10614
849VIDEO_START( tubep );
950VIDEO_RESET( tubep );
1051
11extern UINT8 *rjammer_backgroundram;
12extern UINT8 *tubep_backgroundram;
13extern UINT8 *tubep_textram;
14extern UINT8 *tubep_sprite_colorsharedram;
1552
1653extern WRITE8_HANDLER( tubep_textram_w );
1754extern WRITE8_HANDLER( rjammer_background_LS377_w );
src/mame/includes/exidy.h
r10613r10614
1919#define EXIDY_VSSTART               (0x100)
2020
2121
22class exidy_state : public driver_device
23{
24public:
25   exidy_state(running_machine &machine, const driver_device_config_base &config)
26      : driver_device(machine, config) { }
27
28   UINT8 last_dial;
29   UINT8 *videoram;
30   UINT8 *characterram;
31   UINT8 *color_latch;
32   UINT8 *sprite1_xpos;
33   UINT8 *sprite1_ypos;
34   UINT8 *sprite2_xpos;
35   UINT8 *sprite2_ypos;
36   UINT8 *spriteno;
37   UINT8 *sprite_enable;
38   UINT8 collision_mask;
39   UINT8 collision_invert;
40   int is_2bpp;
41   UINT8 int_condition;
42   bitmap_t *background_bitmap;
43   bitmap_t *motion_object_1_vid;
44   bitmap_t *motion_object_2_vid;
45   bitmap_t *motion_object_2_clip;
46};
47
48
2249/*----------- defined in video/exidy.c -----------*/
2350
24extern UINT8 *exidy_videoram;
25extern UINT8 *exidy_characterram;
26extern UINT8 *exidy_color_latch;
27extern UINT8 *exidy_sprite1_xpos;
28extern UINT8 *exidy_sprite1_ypos;
29extern UINT8 *exidy_sprite2_xpos;
30extern UINT8 *exidy_sprite2_ypos;
31extern UINT8 *exidy_spriteno;
32extern UINT8 *exidy_sprite_enable;
33
34void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp);
51void exidy_video_config(running_machine *machine, UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp);
3552VIDEO_START( exidy );
3653SCREEN_UPDATE( exidy );
3754
src/mame/includes/hyhoo.h
r10613r10614
1class hyhoo_state : public driver_device
2{
3public:
4   hyhoo_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   UINT8 *clut;
8   int blitter_destx;
9   int blitter_desty;
10   int blitter_sizex;
11   int blitter_sizey;
12   int blitter_src_addr;
13   int blitter_direction_x;
14   int blitter_direction_y;
15   int gfxrom;
16   int dispflag;
17   int highcolorflag;
18   int flipscreen;
19   bitmap_t *tmpbitmap;
20};
21
22
123/*----------- defined in video/hyhoo.c -----------*/
224
3extern UINT8 *hyhoo_clut;
4
525SCREEN_UPDATE( hyhoo );
626VIDEO_START( hyhoo );
727
src/mame/includes/clshroad.h
r10613r10614
1class clshroad_state : public driver_device
2{
3public:
4   clshroad_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   UINT8 *vram_0;
8   UINT8 *vram_1;
9   UINT8 *vregs;
10   tilemap_t *tilemap_0a;
11   tilemap_t *tilemap_0b;
12   tilemap_t *tilemap_1;
13};
14
15
116/*----------- defined in video/clshroad.c -----------*/
217
3extern UINT8 *clshroad_vram_0, *clshroad_vram_1;
4extern UINT8 *clshroad_vregs;
5
618WRITE8_HANDLER( clshroad_vram_0_w );
719WRITE8_HANDLER( clshroad_vram_1_w );
820WRITE8_HANDLER( clshroad_flipscreen_w );
src/mame/includes/dooyong.h
r10613r10614
3333   int fg_gfx;
3434   int fg2_gfx;
3535   int tx_tilemap_mode;
36   
36
3737   int interrupt_line_1, interrupt_line_2;
3838};
3939
src/mame/includes/williams.h
r10613r10614
1515        m_nvram(*this, "nvram") { }
1616
1717   required_shared_ptr<UINT8>   m_nvram;
18   UINT8 sound_int_state;
19   UINT8 audio_talkback;
20   UINT8 audio_sync;
21   device_t *sound_cpu;
22   device_t *soundalt_cpu;
23   UINT8 *mayday_protection;
24   UINT8 *videoram;
25   UINT8 *williams2_tileram;
26   UINT8 *blaster_palette_0;
27   UINT8 *blaster_scanline_control;
28   UINT8 blitter_config;
29   UINT16 blitter_clip_address;
30   UINT8 blitter_window_enable;
31   UINT8 williams2_tilemap_config;
32   UINT8 cocktail;
33   UINT8 blaster_bank;
34   UINT8 vram_bank;
35   UINT16 joust2_current_sound_data;
36   UINT8 port_select;
37   rgb_t *palette_lookup;
38   UINT8 blitterram[8];
39   UINT8 blitter_xor;
40   UINT8 blitter_remap_index;
41   const UINT8 *blitter_remap;
42   UINT8 *blitter_remap_lookup;
43   rgb_t blaster_color0;
44   UINT8 blaster_video_control;
45   tilemap_t *bg_tilemap;
46   UINT16 tilemap_xscroll;
47   UINT8 williams2_fg_color;
1848};
1949
2050
r10613r10614
87117CUSTOM_INPUT( williams_mux_r );
88118
89119/* Mayday protection */
90extern UINT8 *mayday_protection;
91120READ8_HANDLER( mayday_protection_r );
92121
93122WRITE8_HANDLER( defender_video_control_w );
r10613r10614
102131#define WILLIAMS_TILEMAP_TSHOOT      1      /* IC79 is a 74LS157 selector jumpered to be enabled */
103132#define WILLIAMS_TILEMAP_JOUST2      2      /* IC79 is a 74LS157 selector jumpered to be disabled */
104133
105/* RAM globals */
106extern UINT8 *williams_videoram;
107extern UINT8 *williams2_tileram;
108extern UINT8 *blaster_palette_0;
109extern UINT8 *blaster_scanline_control;
110
111/* blitter globals */
112extern UINT8 williams_blitter_config;
113extern UINT16 williams_blitter_clip_address;
114extern UINT8 williams_blitter_window_enable;
115
116/* tilemap globals */
117extern UINT8 williams2_tilemap_config;
118
119/* rendering globals */
120extern UINT8 williams_cocktail;
121
122
123134WRITE8_HANDLER( williams_blitter_w );
124135WRITE8_HANDLER( blaster_remap_select_w );
125136WRITE8_HANDLER( blaster_video_control_w );
src/mame/includes/triplhnt.h
r10613r10614
1616#define TRIPLHNT_LAMP_EN      NODE_05
1717
1818
19class triplhnt_state : public driver_device
20{
21public:
22   triplhnt_state(running_machine &machine, const driver_device_config_base &config)
23      : driver_device(machine, config) { }
24
25   UINT8 cmos[16];
26   UINT8 da_latch;
27   UINT8 misc_flags;
28   UINT8 cmos_latch;
29   UINT8 hit_code;
30   UINT8* playfield_ram;
31   UINT8* vpos_ram;
32   UINT8* hpos_ram;
33   UINT8* code_ram;
34   UINT8* orga_ram;
35   int sprite_zoom;
36   int sprite_bank;
37   bitmap_t* helper;
38   tilemap_t* bg_tilemap;
39};
40
41
1942/*----------- defined in drivers/triplhnt.c -----------*/
2043
2144void triplhnt_set_collision(running_machine *machine, int data);
r10613r10614
3255VIDEO_START( triplhnt );
3356SCREEN_UPDATE( triplhnt );
3457
35extern UINT8* triplhnt_playfield_ram;
36extern UINT8* triplhnt_vpos_ram;
37extern UINT8* triplhnt_hpos_ram;
38extern UINT8* triplhnt_code_ram;
39extern UINT8* triplhnt_orga_ram;
4058
41extern int triplhnt_sprite_zoom;
42extern int triplhnt_sprite_bank;
src/mame/includes/pirates.h
r10613r10614
1class pirates_state : public driver_device
2{
3public:
4   pirates_state(running_machine &machine, const driver_device_config_base &config)
5      : driver_device(machine, config) { }
6
7   UINT16 *tx_tileram;
8   UINT16 *spriteram;
9   UINT16 *fg_tileram;
10   UINT16 *bg_tileram;
11   UINT16 *scroll;
12   tilemap_t *tx_tilemap;
13   tilemap_t *fg_tilemap;
14   tilemap_t *bg_tilemap;
15};
16
17
118/*----------- defined in video/pirates.c -----------*/
219
3extern UINT16 *pirates_tx_tileram, *pirates_spriteram;
4extern UINT16 *pirates_fg_tileram,  *pirates_bg_tileram;
5extern UINT16 *pirates_scroll;
6
720WRITE16_HANDLER( pirates_tx_tileram_w );
821WRITE16_HANDLER( pirates_fg_tileram_w );
922WRITE16_HANDLER( pirates_bg_tileram_w );
src/mame/mame.mak
r10613r10614
737737$(MAMEOBJ)/jaleco.a: \
738738   $(DRIVERS)/aeroboto.o $(VIDEO)/aeroboto.o \
739739   $(DRIVERS)/argus.o $(VIDEO)/argus.o \
740   $(VIDEO)/jalblend.o \
741740   $(DRIVERS)/bestleag.o \
742741   $(DRIVERS)/bigstrkb.o $(VIDEO)/bigstrkb.o \
743742   $(DRIVERS)/blueprnt.o $(VIDEO)/blueprnt.o \
r10613r10614
758757   $(DRIVERS)/stepstag.o \
759758   $(DRIVERS)/tetrisp2.o $(VIDEO)/tetrisp2.o \
760759   $(MACHINE)/ms32crpt.o \
760   $(VIDEO)/jalblend.o \
761761
762762$(MAMEOBJ)/jpm.a: \
763763   $(DRIVERS)/guab.o \
r10613r10614
947947   $(DRIVERS)/namcona1.o $(VIDEO)/namcona1.o \
948948   $(DRIVERS)/namconb1.o $(VIDEO)/namconb1.o \
949949   $(DRIVERS)/namcond1.o $(MACHINE)/namcond1.o $(VIDEO)/ygv608.o \
950   $(DRIVERS)/namcops2.o \
950951   $(DRIVERS)/namcos1.o $(MACHINE)/namcos1.o $(VIDEO)/namcos1.o \
951952   $(DRIVERS)/namcos10.o \
952953   $(DRIVERS)/namcos11.o \
r10613r10614
964965   $(DRIVERS)/tceptor.o $(VIDEO)/tceptor.o \
965966   $(DRIVERS)/toypop.o $(VIDEO)/toypop.o \
966967   $(DRIVERS)/turrett.o \
967   $(DRIVERS)/warpwarp.o $(AUDIO)/warpwarp.o $(VIDEO)/warpwarp.o \
968   $(DRIVERS)/warpwarp.o $(AUDIO)/geebee.o $(AUDIO)/warpwarp.o $(VIDEO)/warpwarp.o \
968969   $(MACHINE)/namcoio.o \
969   $(AUDIO)/geebee.o \
970970   $(MACHINE)/namco06.o \
971971   $(MACHINE)/namco50.o \
972972   $(MACHINE)/namco51.o \
r10613r10614
979979   $(VIDEO)/digdug.o \
980980   $(MACHINE)/psx.o $(VIDEO)/psx.o \
981981   $(MACHINE)/xevious.o $(VIDEO)/xevious.o \
982   $(DRIVERS)/namcops2.o \
983982
984983$(MAMEOBJ)/nasco.a: \
985984   $(DRIVERS)/crgolf.o $(VIDEO)/crgolf.o \
r10613r10614
10191018   $(MACHINE)/nb1413m3.o \
10201019
10211020$(MAMEOBJ)/nintendo.a: \
1021   $(DRIVERS)/cham24.o \
10221022   $(DRIVERS)/dkong.o $(AUDIO)/dkong.o $(VIDEO)/dkong.o \
1023   $(DRIVERS)/cham24.o \
1024   $(DRIVERS)/snesb.o \
10251023   $(DRIVERS)/mario.o $(AUDIO)/mario.o $(VIDEO)/mario.o \
10261024   $(DRIVERS)/multigam.o \
10271025   $(DRIVERS)/n8080.o $(AUDIO)/n8080.o $(VIDEO)/n8080.o \
r10613r10614
10301028   $(DRIVERS)/popeye.o $(VIDEO)/popeye.o \
10311029   $(DRIVERS)/punchout.o $(VIDEO)/punchout.o \
10321030   $(DRIVERS)/sfcbox.o \
1031   $(DRIVERS)/snesb.o \
10331032   $(DRIVERS)/spacefb.o $(AUDIO)/spacefb.o  $(VIDEO)/spacefb.o \
10341033   $(DRIVERS)/vsnes.o $(MACHINE)/vsnes.o $(VIDEO)/vsnes.o \
10351034   $(VIDEO)/ppu2c0x.o \
r10613r10614
10811080   $(MACHINE)/theglobp.o \
10821081
10831082$(MAMEOBJ)/pce.a: \
1083   $(DRIVERS)/ggconnie.o \
1084   $(DRIVERS)/paranoia.o \
10841085   $(DRIVERS)/uapce.o \
1085   $(DRIVERS)/paranoia.o \
1086   $(DRIVERS)/ggconnie.o \
10871086   $(MACHINE)/pcecommn.o $(VIDEO)/vdc.o \
10881087
10891088$(MAMEOBJ)/phoenix.a: \
r10613r10614
11921191   $(VIDEO)/stvvdp1.o $(VIDEO)/stvvdp2.o \
11931192
11941193$(MAMEOBJ)/seibu.a: \
1194   $(DRIVERS)/bloodbro.o $(VIDEO)/bloodbro.o \
1195   $(DRIVERS)/cabal.o $(VIDEO)/cabal.o \
11951196   $(DRIVERS)/cshooter.o \
11961197   $(DRIVERS)/dcon.o $(VIDEO)/dcon.o \
11971198   $(DRIVERS)/deadang.o $(VIDEO)/deadang.o \
11981199   $(DRIVERS)/dynduke.o $(VIDEO)/dynduke.o \
1200   $(DRIVERS)/feversoc.o \
1201   $(DRIVERS)/goal92.o $(VIDEO)/goal92.o \
1202   $(DRIVERS)/goodejan.o \
11991203   $(DRIVERS)/kncljoe.o $(VIDEO)/kncljoe.o \
1204   $(DRIVERS)/legionna.o $(VIDEO)/legionna.o \
12001205   $(DRIVERS)/mustache.o $(VIDEO)/mustache.o \
12011206   $(DRIVERS)/panicr.o \
12021207   $(DRIVERS)/raiden.o $(VIDEO)/raiden.o \
12031208   $(DRIVERS)/raiden2.o $(MACHINE)/r2crypt.o \
12041209   $(DRIVERS)/r2dx_v33.o \
12051210   $(DRIVERS)/seibuspi.o $(MACHINE)/seibuspi.o $(VIDEO)/seibuspi.o \
1206   $(VIDEO)/sei_crtc.o \
12071211   $(DRIVERS)/sengokmj.o \
1208   $(DRIVERS)/goodejan.o \
12091212   $(DRIVERS)/stfight.o $(MACHINE)/stfight.o $(VIDEO)/stfight.o \
1213   $(DRIVERS)/toki.o $(VIDEO)/toki.o \
12101214   $(DRIVERS)/wiz.o $(VIDEO)/wiz.o \
1215   $(MACHINE)/seicop.o \
12111216   $(MACHINE)/spisprit.o \
12121217   $(AUDIO)/seibu.o \
1213   $(DRIVERS)/bloodbro.o $(VIDEO)/bloodbro.o \
1214   $(DRIVERS)/cabal.o $(VIDEO)/cabal.o \
1215   $(DRIVERS)/goal92.o $(VIDEO)/goal92.o \
1216   $(DRIVERS)/legionna.o $(VIDEO)/legionna.o \
1217   $(MACHINE)/seicop.o \
1218   $(DRIVERS)/toki.o $(VIDEO)/toki.o \
1219   $(DRIVERS)/feversoc.o \
1218   $(VIDEO)/sei_crtc.o \
12201219
12211220$(MAMEOBJ)/seta.a: \
12221221   $(DRIVERS)/aleck64.o $(MACHINE)/n64.o $(VIDEO)/n64.o $(VIDEO)/rdpblend.o $(VIDEO)/rdpfb.o $(VIDEO)/rdpspn16.o $(VIDEO)/rdptpipe.o \
r10613r10614
12771276   $(DRIVERS)/strnskil.o $(VIDEO)/strnskil.o \
12781277
12791278$(MAMEOBJ)/suna.a: \
1279   $(DRIVERS)/go2000.o \
12801280   $(DRIVERS)/goindol.o $(VIDEO)/goindol.o \
12811281   $(DRIVERS)/suna8.o $(AUDIO)/suna8.o $(VIDEO)/suna8.o \
12821282   $(DRIVERS)/suna16.o $(VIDEO)/suna16.o \
1283   $(DRIVERS)/go2000.o \
12841283
12851284$(MAMEOBJ)/taito.a: \
12861285   $(DRIVERS)/40love.o $(VIDEO)/40love.o \
r10613r10614
20042003                  $(LAYOUT)/babydad.lh
20052004
20062005$(DRIVERS)/warpwarp.o:   $(LAYOUT)/geebee.lh \
2006                  $(LAYOUT)/navarone.lh \
20072007                  $(LAYOUT)/sos.lh
20082008
20092009$(DRIVERS)/wecleman.o:   $(LAYOUT)/wecleman.lh
src/mame/video/nbmj9195.c
r10613r10614
1111#include "includes/nbmj9195.h"
1212
1313
14#define   VRAM_MAX   2
15
16#define   SCANLINE_MIN   0
17#define   SCANLINE_MAX   512
18
19
20static int nbmj9195_scrollx[VRAM_MAX], nbmj9195_scrolly[VRAM_MAX];
21static int nbmj9195_scrollx_raster[VRAM_MAX][SCANLINE_MAX];
22static int nbmj9195_scanline[VRAM_MAX];
23static int blitter_destx[VRAM_MAX], blitter_desty[VRAM_MAX];
24static int blitter_sizex[VRAM_MAX], blitter_sizey[VRAM_MAX];
25static int blitter_src_addr[VRAM_MAX];
26static int blitter_direction_x[VRAM_MAX], blitter_direction_y[VRAM_MAX];
27static int nbmj9195_dispflag[VRAM_MAX];
28static int nbmj9195_flipscreen[VRAM_MAX];
29static int nbmj9195_clutmode[VRAM_MAX];
30static int nbmj9195_transparency[VRAM_MAX];
31static int nbmj9195_clutsel;
32static int nbmj9195_screen_refresh;
33static int nbmj9195_gfxflag2;
34static int gfxdraw_mode;
35static int nb19010_busyctr;
36static int nb19010_busyflag;
37
38static bitmap_t *nbmj9195_tmpbitmap[VRAM_MAX];
39static UINT16 *nbmj9195_videoram[VRAM_MAX];
40static UINT16 *nbmj9195_videoworkram[VRAM_MAX];
41static UINT8 *nbmj9195_palette, *nbmj9195_nb22090_palette;
42static UINT8 *nbmj9195_clut[VRAM_MAX];
43
44
4514static void nbmj9195_vramflip(running_machine *machine, int vram);
4615static void nbmj9195_gfxdraw(running_machine *machine, int vram);
4716
r10613r10614
5221******************************************************************************/
5322READ8_HANDLER( nbmj9195_palette_r )
5423{
55   return nbmj9195_palette[offset];
24   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
25   return state->palette[offset];
5626}
5727
5828WRITE8_HANDLER( nbmj9195_palette_w )
5929{
30   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
6031   int r, g, b;
6132
62   nbmj9195_palette[offset] = data;
33   state->palette[offset] = data;
6334
6435   if (offset & 1)
6536   {
6637      offset &= 0x1fe;
6738
68      r = ((nbmj9195_palette[offset + 0] & 0x0f) >> 0);
69      g = ((nbmj9195_palette[offset + 0] & 0xf0) >> 4);
70      b = ((nbmj9195_palette[offset + 1] & 0x0f) >> 0);
39      r = ((state->palette[offset + 0] & 0x0f) >> 0);
40      g = ((state->palette[offset + 0] & 0xf0) >> 4);
41      b = ((state->palette[offset + 1] & 0x0f) >> 0);
7142
7243      palette_set_color_rgb(space->machine, (offset >> 1), pal4bit(r), pal4bit(g), pal4bit(b));
7344   }
r10613r10614
7546
7647READ8_HANDLER( nbmj9195_nb22090_palette_r )
7748{
78   return nbmj9195_nb22090_palette[offset];
49   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
50   return state->nb22090_palette[offset];
7951}
8052
8153WRITE8_HANDLER( nbmj9195_nb22090_palette_w )
8254{
55   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
8356   int r, g, b;
8457   int offs_h, offs_l;
8558
86   nbmj9195_nb22090_palette[offset] = data;
59   state->nb22090_palette[offset] = data;
8760
8861   offs_h = (offset / 0x0300);
8962   offs_l = (offset & 0x00ff);
9063
91   r = nbmj9195_nb22090_palette[(0x000 + (offs_h * 0x300) + offs_l)];
92   g = nbmj9195_nb22090_palette[(0x100 + (offs_h * 0x300) + offs_l)];
93   b = nbmj9195_nb22090_palette[(0x200 + (offs_h * 0x300) + offs_l)];
64   r = state->nb22090_palette[(0x000 + (offs_h * 0x300) + offs_l)];
65   g = state->nb22090_palette[(0x100 + (offs_h * 0x300) + offs_l)];
66   b = state->nb22090_palette[(0x200 + (offs_h * 0x300) + offs_l)];
9467
9568   palette_set_color(space->machine, ((offs_h * 0x100) + offs_l), MAKE_RGB(r, g, b));
9669}
r10613r10614
9972
10073
10174******************************************************************************/
102static int nbmj9195_blitter_r(running_machine *machine, int vram, int offset)
75static int nbmj9195_blitter_r(address_space *space, int offset, int vram)
10376{
77   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
10478   int ret;
105   UINT8 *GFXROM = machine->region("gfx1")->base();
79   UINT8 *GFXROM = space->machine->region("gfx1")->base();
10680
10781   switch (offset)
10882   {
109      case 0x00:   ret = 0xfe | ((nb19010_busyflag & 0x01) ^ 0x01); break;   // NB19010 Busy Flag
110      case 0x01:   ret = GFXROM[blitter_src_addr[vram]]; break;         // NB19010 GFX-ROM Read
83      case 0x00:   ret = 0xfe | ((state->nb19010_busyflag & 0x01) ^ 0x01); break;   // NB19010 Busy Flag
84      case 0x01:   ret = GFXROM[state->blitter_src_addr[vram]]; break;         // NB19010 GFX-ROM Read
11185      default:   ret = 0xff; break;
11286   }
11387
11488   return ret;
11589}
11690
117static void nbmj9195_blitter_w(running_machine *machine, int vram, int offset, int data)
91static void nbmj9195_blitter_w(address_space *space, int offset, int data, int vram)
11892{
93   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
11994   int new_line;
12095
12196   switch (offset)
12297   {
123      case 0x00:   blitter_direction_x[vram] = (data & 0x01) ? 1 : 0;
124               blitter_direction_y[vram] = (data & 0x02) ? 1 : 0;
125               nbmj9195_clutmode[vram] = (data & 0x04) ? 1 : 0;
98      case 0x00:   state->blitter_direction_x[vram] = (data & 0x01) ? 1 : 0;
99               state->blitter_direction_y[vram] = (data & 0x02) ? 1 : 0;
100               state->clutmode[vram] = (data & 0x04) ? 1 : 0;
126101            //  if (data & 0x08) popmessage("Unknown GFX Flag!! (0x08)");
127               nbmj9195_transparency[vram] = (data & 0x10) ? 1 : 0;
102               state->transparency[vram] = (data & 0x10) ? 1 : 0;
128103            //  if (data & 0x20) popmessage("Unknown GFX Flag!! (0x20)");
129               nbmj9195_flipscreen[vram] = (data & 0x40) ? 0 : 1;
130               nbmj9195_dispflag[vram] = (data & 0x80) ? 1 : 0;
131               nbmj9195_vramflip(machine, vram);
104               state->flipscreen[vram] = (data & 0x40) ? 0 : 1;
105               state->dispflag[vram] = (data & 0x80) ? 1 : 0;
106               nbmj9195_vramflip(space->machine, vram);
132107               break;
133      case 0x01:   nbmj9195_scrollx[vram] = (nbmj9195_scrollx[vram] & 0x0100) | data; break;
134      case 0x02:   nbmj9195_scrollx[vram] = (nbmj9195_scrollx[vram] & 0x00ff) | ((data << 8) & 0x0100);
135               new_line = machine->primary_screen->vpos();
136               if (nbmj9195_flipscreen[vram])
108      case 0x01:   state->scrollx[vram] = (state->scrollx[vram] & 0x0100) | data; break;
109      case 0x02:   state->scrollx[vram] = (state->scrollx[vram] & 0x00ff) | ((data << 8) & 0x0100);
110               new_line = space->machine->primary_screen->vpos();
111               if (state->flipscreen[vram])
137112               {
138                  for ( ; nbmj9195_scanline[vram] < new_line; nbmj9195_scanline[vram]++)
139                     nbmj9195_scrollx_raster[vram][nbmj9195_scanline[vram]] = (((-nbmj9195_scrollx[vram]) - 0x4e)  & 0x1ff) << 1;
113                  for ( ; state->scanline[vram] < new_line; state->scanline[vram]++)
114                     state->scrollx_raster[vram][state->scanline[vram]] = (((-state->scrollx[vram]) - 0x4e)  & 0x1ff) << 1;
140115               }
141116               else
142117               {
143                  for ( ; nbmj9195_scanline[vram] < new_line; nbmj9195_scanline[vram]++)
144                     nbmj9195_scrollx_raster[vram][(nbmj9195_scanline[vram] ^ 0x1ff)] = (((-nbmj9195_scrollx[vram]) - 0x4e)  & 0x1ff) << 1;
118                  for ( ; state->scanline[vram] < new_line; state->scanline[vram]++)
119                     state->scrollx_raster[vram][(state->scanline[vram] ^ 0x1ff)] = (((-state->scrollx[vram]) - 0x4e)  & 0x1ff) << 1;
145120               }
146121               break;
147      case 0x03:   nbmj9195_scrolly[vram] = (nbmj9195_scrolly[vram] & 0x0100) | data; break;
148      case 0x04:   nbmj9195_scrolly[vram] = (nbmj9195_scrolly[vram] & 0x00ff) | ((data << 8) & 0x0100); break;
149      case 0x05:   blitter_src_addr[vram] = (blitter_src_addr[vram] & 0xffff00) | data; break;
150      case 0x06:   blitter_src_addr[vram] = (blitter_src_addr[vram] & 0xff00ff) | (data << 8); break;
151      case 0x07:   blitter_src_addr[vram] = (blitter_src_addr[vram] & 0x00ffff) | (data << 16); break;
152      case 0x08:   blitter_sizex[vram] = data; break;
153      case 0x09:   blitter_sizey[vram] = data; break;
154      case 0x0a:   blitter_destx[vram] = (blitter_destx[vram]  & 0xff00) | data; break;
155      case 0x0b:   blitter_destx[vram] = (blitter_destx[vram]  & 0x00ff) | (data << 8); break;
156      case 0x0c:   blitter_desty[vram] = (blitter_desty[vram]  & 0xff00) | data; break;
157      case 0x0d:   blitter_desty[vram] = (blitter_desty[vram]  & 0x00ff) | (data << 8);
158               nbmj9195_gfxdraw(machine, vram);
122      case 0x03:   state->scrolly[vram] = (state->scrolly[vram] & 0x0100) | data; break;
123      case 0x04:   state->scrolly[vram] = (state->scrolly[vram] & 0x00ff) | ((data << 8) & 0x0100); break;
124      case 0x05:   state->blitter_src_addr[vram] = (state->blitter_src_addr[vram] & 0xffff00) | data; break;
125      case 0x06:   state->blitter_src_addr[vram] = (state->blitter_src_addr[vram] & 0xff00ff) | (data << 8); break;
126      case 0x07:   state->blitter_src_addr[vram] = (state->blitter_src_addr[vram] & 0x00ffff) | (data << 16); break;
127      case 0x08:   state->blitter_sizex[vram] = data; break;
128      case 0x09:   state->blitter_sizey[vram] = data; break;
129      case 0x0a:   state->blitter_destx[vram] = (state->blitter_destx[vram]  & 0xff00) | data; break;
130      case 0x0b:   state->blitter_destx[vram] = (state->blitter_destx[vram]  & 0x00ff) | (data << 8); break;
131      case 0x0c:   state->blitter_desty[vram] = (state->blitter_desty[vram]  & 0xff00) | data; break;
132      case 0x0d:   state->blitter_desty[vram] = (state->blitter_desty[vram]  & 0x00ff) | (data << 8);
133               nbmj9195_gfxdraw(space->machine, vram);
159134               break;
160135      default:   break;
161136   }
162137}
163138
164void nbmj9195_clutsel_w(int data)
139void nbmj9195_clutsel_w(address_space *space, int data)
165140{
166   nbmj9195_clutsel = data;
141   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
142   state->clutsel = data;
167143}
168144
169static void nbmj9195_clut_w(int vram, int offset, int data)
145static void nbmj9195_clut_w(address_space *space, int offset, int data, int vram)
170146{
171   nbmj9195_clut[vram][((nbmj9195_clutsel & 0xff) * 0x10) + (offset & 0x0f)] = data;
147   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
148   state->clut[vram][((state->clutsel & 0xff) * 0x10) + (offset & 0x0f)] = data;
172149}
173150
174void nbmj9195_gfxflag2_w(int data)
151void nbmj9195_gfxflag2_w(address_space *space, int data)
175152{
176   nbmj9195_gfxflag2 = data;
153   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
154   state->gfxflag2 = data;
177155}
178156
179157/******************************************************************************
r10613r10614
182160******************************************************************************/
183161static void nbmj9195_vramflip(running_machine *machine, int vram)
184162{
185   static int nbmj9195_flipscreen_old[VRAM_MAX] = { 0, 0 };
163   nbmj9195_state *state = machine->driver_data<nbmj9195_state>();
186164   int x, y;
187165   UINT16 color1, color2;
188166   int width = machine->primary_screen->width();
189167   int height = machine->primary_screen->height();
190168
191   if (nbmj9195_flipscreen[vram] == nbmj9195_flipscreen_old[vram]) return;
169   if (state->flipscreen[vram] == state->flipscreen_old[vram]) return;
192170
193171   for (y = 0; y < (height / 2); y++)
194172   {
195173      for (x = 0; x < width; x++)
196174      {
197         color1 = nbmj9195_videoram[vram][(y * width) + x];
198         color2 = nbmj9195_videoram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)];
199         nbmj9195_videoram[vram][(y * width) + x] = color2;
200         nbmj9195_videoram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)] = color1;
175         color1 = state->videoram[vram][(y * width) + x];
176         color2 = state->videoram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)];
177         state->videoram[vram][(y * width) + x] = color2;
178         state->videoram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)] = color1;
201179      }
202180   }
203181
204   if (gfxdraw_mode == 2)
182   if (state->gfxdraw_mode == 2)
205183   {
206184      for (y = 0; y < (height / 2); y++)
207185      {
208186         for (x = 0; x < width; x++)
209187         {
210            color1 = nbmj9195_videoworkram[vram][(y * width) + x];
211            color2 = nbmj9195_videoworkram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)];
212            nbmj9195_videoworkram[vram][(y * width) + x] = color2;
213            nbmj9195_videoworkram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)] = color1;
188            color1 = state->videoworkram[vram][(y * width) + x];
189            color2 = state->videoworkram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)];
190            state->videoworkram[vram][(y * width) + x] = color2;
191            state->videoworkram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)] = color1;
214192         }
215193      }
216194   }
217195
218   nbmj9195_flipscreen_old[vram] = nbmj9195_flipscreen[vram];
219   nbmj9195_screen_refresh = 1;
196   state->flipscreen_old[vram] = state->flipscreen[vram];
197   state->screen_refresh = 1;
220198}
221199
222200static void update_pixel(running_machine *machine, int vram, int x, int y)
223201{
224   UINT16 color = nbmj9195_videoram[vram][(y * machine->primary_screen->width()) + x];
225   *BITMAP_ADDR16(nbmj9195_tmpbitmap[vram], y, x) = color;
202   nbmj9195_state *state = machine->driver_data<nbmj9195_state>();
203   UINT16 color = state->videoram[vram][(y * machine->primary_screen->width()) + x];
204   *BITMAP_ADDR16(state->tmpbitmap[vram], y, x) = color;
226205}
227206
228207static TIMER_CALLBACK( blitter_timer_callback )
229208{
230   nb19010_busyflag = 1;
209   nbmj9195_state *state = machine->driver_data<nbmj9195_state>();
210   state->nb19010_busyflag = 1;
231211}
232212
233213static void nbmj9195_gfxdraw(running_machine *machine, int vram)
234214{
215   nbmj9195_state *state = machine->driver_data<nbmj9195_state>();
235216   UINT8 *GFX = machine->region("gfx1")->base();
236217   int width = machine->primary_screen->width();
237218
r10613r10614
244225   UINT16 color, color1, color2;
245226   int gfxaddr, gfxlen;
246227
247   nb19010_busyctr = 0;
228   state->nb19010_busyctr = 0;
248229
249   if ((gfxdraw_mode == 2) && (nbmj9195_clutmode[vram]))
230   if ((state->gfxdraw_mode == 2) && (state->clutmode[vram]))
250231   {
251232      // NB22090 clut256 mode
252      blitter_sizex[vram] = GFX[((blitter_src_addr[vram] + 0) & 0x00ffffff)];
253      blitter_sizey[vram] = GFX[((blitter_src_addr[vram] + 1) & 0x00ffffff)];
233      state->blitter_sizex[vram] = GFX[((state->blitter_src_addr[vram] + 0) & 0x00ffffff)];
234      state->blitter_sizey[vram] = GFX[((state->blitter_src_addr[vram] + 1) & 0x00ffffff)];
254235   }
255236
256   if (blitter_direction_x[vram])
237   if (state->blitter_direction_x[vram])
257238   {
258      startx = blitter_destx[vram];
259      sizex = blitter_sizex[vram];
239      startx = state->blitter_destx[vram];
240      sizex = state->blitter_sizex[vram];
260241      skipx = 1;
261242   }
262243   else
263244   {
264      startx = blitter_destx[vram] + blitter_sizex[vram];
265      sizex = blitter_sizex[vram];
245      startx = state->blitter_destx[vram] + state->blitter_sizex[vram];
246      sizex = state->blitter_sizex[vram];
266247      skipx = -1;
267248   }
268249
269   if (blitter_direction_y[vram])
250   if (state->blitter_direction_y[vram])
270251   {
271      starty = blitter_desty[vram];
272      sizey = blitter_sizey[vram];
252      starty = state->blitter_desty[vram];
253      sizey = state->blitter_sizey[vram];
273254      skipy = 1;
274255   }
275256   else
276257   {
277      starty = blitter_desty[vram] + blitter_sizey[vram];
278      sizey = blitter_sizey[vram];
258      starty = state->blitter_desty[vram] + state->blitter_sizey[vram];
259      sizey = state->blitter_sizey[vram];
279260      skipy = -1;
280261   }
281262
282263   gfxlen = machine->region("gfx1")->bytes();
283   gfxaddr = ((blitter_src_addr[vram] + 2) & 0x00ffffff);
264   gfxaddr = ((state->blitter_src_addr[vram] + 2) & 0x00ffffff);
284265
285266   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
286267   {
r10613r10614
301282         dx2 = (2 * x + 1) & 0x3ff;
302283         dy = y & 0x1ff;
303284
304         if (!nbmj9195_flipscreen[vram])
285         if (!state->flipscreen[vram])
305286         {
306287            dx1 ^= 0x3ff;
307288            dx2 ^= 0x3ff;
308289            dy ^= 0x1ff;
309290         }
310291
311         if (blitter_direction_x[vram])
292         if (state->blitter_direction_x[vram])
312293         {
313294            // flip
314295            color1 = (color & 0x0f) >> 0;
r10613r10614
321302            color2 = (color & 0x0f) >> 0;
322303         }
323304
324         if ((gfxdraw_mode == 2) && (nbmj9195_clutmode[vram]))
305         if ((state->gfxdraw_mode == 2) && (state->clutmode[vram]))
325306         {
326307            // clut256 mode
327308
328            if (nbmj9195_gfxflag2 & 0xc0)
309            if (state->gfxflag2 & 0xc0)
329310            {
330311               // clut256 mode 1st(low)
331               nbmj9195_videoworkram[vram][(dy * width) + dx1] &= 0x00f0;
332               nbmj9195_videoworkram[vram][(dy * width) + dx1] |= color1 & 0x0f;
333               nbmj9195_videoworkram[vram][(dy * width) + dx2] &= 0x00f0;
334               nbmj9195_videoworkram[vram][(dy * width) + dx2] |= color2 & 0x0f;
312               state->videoworkram[vram][(dy * width) + dx1] &= 0x00f0;
313               state->videoworkram[vram][(dy * width) + dx1] |= color1 & 0x0f;
314               state->videoworkram[vram][(dy * width) + dx2] &= 0x00f0;
315               state->videoworkram[vram][(dy * width) + dx2] |= color2 & 0x0f;
335316
336317               continue;
337318            }
338319            else
339320            {
340321               // clut256 mode 2nd(high)
341               nbmj9195_videoworkram[vram][(dy * width) + dx1] &= 0x000f;
342               nbmj9195_videoworkram[vram][(dy * width) + dx1] |= (color1 & 0x0f) << 4;
343               nbmj9195_videoworkram[vram][(dy * width) + dx2] &= 0x000f;
344               nbmj9195_videoworkram[vram][(dy * width) + dx2] |= (color2 & 0x0f) << 4;
322               state->videoworkram[vram][(dy * width) + dx1] &= 0x000f;
323               state->videoworkram[vram][(dy * width) + dx1] |= (color1 & 0x0f) << 4;
324               state->videoworkram[vram][(dy * width) + dx2] &= 0x000f;
325               state->videoworkram[vram][(dy * width) + dx2] |= (color2 & 0x0f) << 4;
345326
346               nbmj9195_videoworkram[vram][(dy * width) + dx1] += nbmj9195_clut[vram][(nbmj9195_clutsel * 0x10)];
347               nbmj9195_videoworkram[vram][(dy * width) + dx2] += nbmj9195_clut[vram][(nbmj9195_clutsel * 0x10)];
327               state->videoworkram[vram][(dy * width) + dx1] += state->clut[vram][(state->clutsel * 0x10)];
328               state->videoworkram[vram][(dy * width) + dx2] += state->clut[vram][(state->clutsel * 0x10)];
348329            }
349330
350            color1 = nbmj9195_videoworkram[vram][(dy * width) + dx1];
351            color2 = nbmj9195_videoworkram[vram][(dy * width) + dx2];
331            color1 = state->videoworkram[vram][(dy * width) + dx1];
332            color2 = state->videoworkram[vram][(dy * width) + dx2];
352333         }
353334         else
354335         {
355336            // clut16 mode
356            color1 = nbmj9195_clut[vram][(nbmj9195_clutsel * 0x10) + color1];
357            color2 = nbmj9195_clut[vram][(nbmj9195_clutsel * 0x10) + color2];
337            color1 = state->clut[vram][(state->clutsel * 0x10) + color1];
338            color2 = state->clut[vram][(state->clutsel * 0x10) + color2];
358339         }
359340
360         if (gfxdraw_mode == 2)
341         if (state->gfxdraw_mode == 2)
361342         {
362343            color1 |= (0x0100 * vram);
363344            color2 |= (0x0100 * vram);
364345         }
365346
366         if (((color1 & 0x00ff) != 0x00ff) || (!nbmj9195_transparency[vram]))
347         if (((color1 & 0x00ff) != 0x00ff) || (!state->transparency[vram]))
367348         {
368            nbmj9195_videoram[vram][(dy * width) + dx1] = color1;
349            state->videoram[vram][(dy * width) + dx1] = color1;
369350            update_pixel(machine, vram, dx1, dy);
370351         }
371         if (((color2 & 0x00ff) != 0x00ff) || (!nbmj9195_transparency[vram]))
352         if (((color2 & 0x00ff) != 0x00ff) || (!state->transparency[vram]))
372353         {
373            nbmj9195_videoram[vram][(dy * width) + dx2] = color2;
354            state->videoram[vram][(dy * width) + dx2] = color2;
374355            update_pixel(machine, vram, dx2, dy);
375356         }
376357
377         nb19010_busyctr++;
358         state->nb19010_busyctr++;
378359      }
379360   }
380361
381   if ((gfxdraw_mode == 2) && (nbmj9195_clutmode[vram]))
362   if ((state->gfxdraw_mode == 2) && (state->clutmode[vram]))
382363   {
383364      // NB22090 clut256 mode
384      blitter_src_addr[vram] = gfxaddr;
365      state->blitter_src_addr[vram] = gfxaddr;
385366   }
386367
387   nb19010_busyflag = 0;
368   state->nb19010_busyflag = 0;
388369
389370   /* 1650ns per count */
390   machine->scheduler().timer_set(attotime::from_nsec(nb19010_busyctr * 1650), FUNC(blitter_timer_callback));
371   machine->scheduler().timer_set(attotime::from_nsec(state->nb19010_busyctr * 1650), FUNC(blitter_timer_callback));
391372}
392373
393374/******************************************************************************
394375
395376
396377******************************************************************************/
397WRITE8_HANDLER( nbmj9195_blitter_0_w )   { nbmj9195_blitter_w(space->machine, 0, offset, data); }
398WRITE8_HANDLER( nbmj9195_blitter_1_w )   { nbmj9195_blitter_w(space->machine, 1, offset, data); }
378WRITE8_HANDLER( nbmj9195_blitter_0_w )   { nbmj9195_blitter_w(space, offset, data, 0); }
379WRITE8_HANDLER( nbmj9195_blitter_1_w )   { nbmj9195_blitter_w(space, offset, data, 1); }
399380
400READ8_HANDLER( nbmj9195_blitter_0_r )   { return nbmj9195_blitter_r(space->machine, 0, offset); }
401READ8_HANDLER( nbmj9195_blitter_1_r )   { return nbmj9195_blitter_r(space->machine, 1, offset); }
381READ8_HANDLER( nbmj9195_blitter_0_r )   { return nbmj9195_blitter_r(space, offset, 0); }
382READ8_HANDLER( nbmj9195_blitter_1_r )   { return nbmj9195_blitter_r(space, offset, 1); }
402383
403WRITE8_HANDLER( nbmj9195_clut_0_w )      { nbmj9195_clut_w(0, offset, data); }
404WRITE8_HANDLER( nbmj9195_clut_1_w )      { nbmj9195_clut_w(1, offset, data); }
384WRITE8_HANDLER( nbmj9195_clut_0_w )      { nbmj9195_clut_w(space, offset, data, 0); }
385WRITE8_HANDLER( nbmj9195_clut_1_w )      { nbmj9195_clut_w(space, offset, data, 1); }
405386
406387/******************************************************************************
407388
r10613r10614
409390******************************************************************************/
410391VIDEO_START( nbmj9195_1layer )
411392{
393   nbmj9195_state *state = machine->driver_data<nbmj9195_state>();
412394   int width = machine->primary_screen->width();
413395   int height = machine->primary_screen->height();
414396
415   nbmj9195_tmpbitmap[0] = machine->primary_screen->alloc_compatible_bitmap();
416   nbmj9195_videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
417   nbmj9195_palette = auto_alloc_array(machine, UINT8, 0x200);
418   nbmj9195_clut[0] = auto_alloc_array(machine, UINT8, 0x1000);
419   nbmj9195_scanline[0] = nbmj9195_scanline[1] = SCANLINE_MIN;
420   nb19010_busyflag = 1;
421   gfxdraw_mode = 0;
397   state->tmpbitmap[0] = machine->primary_screen->alloc_compatible_bitmap();
398   state->videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
399   state->palette = auto_alloc_array(machine, UINT8, 0x200);
400   state->clut[0] = auto_alloc_array(machine, UINT8, 0x1000);
401   state->scanline[0] = state->scanline[1] = SCANLINE_MIN;
402   state->nb19010_busyflag = 1;
403   state->gfxdraw_mode = 0;
422404}
423405
424406VIDEO_START( nbmj9195_2layer )
425407{
408   nbmj9195_state *state = machine->driver_data<nbmj9195_state>();
426409   int width = machine->primary_screen->width();
427410   int height = machine->primary_screen->height();
428411
429   nbmj9195_tmpbitmap[0] = machine->primary_screen->alloc_compatible_bitmap();
430   nbmj9195_tmpbitmap[1] = machine->primary_screen->alloc_compatible_bitmap();
431   nbmj9195_videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
432   nbmj9195_videoram[1] = auto_alloc_array_clear(machine, UINT16, width * height);
433   nbmj9195_palette = auto_alloc_array(machine, UINT8, 0x200);
434   nbmj9195_clut[0] = auto_alloc_array(machine, UINT8, 0x1000);
435   nbmj9195_clut[1] = auto_alloc_array(machine, UINT8, 0x1000);
436   nbmj9195_scanline[0] = nbmj9195_scanline[1] = SCANLINE_MIN;
437   nb19010_busyflag = 1;
438   gfxdraw_mode = 1;
412   state->tmpbitmap[0] = machine->primary_screen->alloc_compatible_bitmap();
413   state->tmpbitmap[1] = machine->primary_screen->alloc_compatible_bitmap();
414   state->videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
415   state->videoram[1] = auto_alloc_array_clear(machine, UINT16, width * height);
416   state->palette = auto_alloc_array(machine, UINT8, 0x200);
417   state->clut[0] = auto_alloc_array(machine, UINT8, 0x1000);
418   state->clut[1] = auto_alloc_array(machine, UINT8, 0x1000);
419   state->scanline[0] = state->scanline[1] = SCANLINE_MIN;
420   state->nb19010_busyflag = 1;
421   state->gfxdraw_mode = 1;
439422}
440423
441424VIDEO_START( nbmj9195_nb22090 )
442425{
426   nbmj9195_state *state = machine->driver_data<nbmj9195_state>();
443427   int width = machine->primary_screen->width();
444428   int height = machine->primary_screen->height();
445429
446   nbmj9195_tmpbitmap[0] = machine->primary_screen->alloc_compatible_bitmap();
447   nbmj9195_tmpbitmap[1] = machine->primary_screen->alloc_compatible_bitmap();
448   nbmj9195_videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
449   nbmj9195_videoram[1] = auto_alloc_array_clear(machine, UINT16, width * height);
450   nbmj9195_videoworkram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
451   nbmj9195_videoworkram[1] = auto_alloc_array_clear(machine, UINT16, width * height);
452   nbmj9195_nb22090_palette = auto_alloc_array(machine, UINT8, 0xc00);
453   nbmj9195_clut[0] = auto_alloc_array(machine, UINT8, 0x1000);
454   nbmj9195_clut[1] = auto_alloc_array(machine, UINT8, 0x1000);
455   nbmj9195_scanline[0] = nbmj9195_scanline[1] = SCANLINE_MIN;
456   nb19010_busyflag = 1;
457   gfxdraw_mode = 2;
430   state->tmpbitmap[0] = machine->primary_screen->alloc_compatible_bitmap();
431   state->tmpbitmap[1] = machine->primary_screen->alloc_compatible_bitmap();
432   state->videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
433   state->videoram[1] = auto_alloc_array_clear(machine, UINT16, width * height);
434   state->videoworkram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
435   state->videoworkram[1] = auto_alloc_array_clear(machine, UINT16, width * height);
436   state->nb22090_palette = auto_alloc_array(machine, UINT8, 0xc00);
437   state->clut[0] = auto_alloc_array(machine, UINT8, 0x1000);
438   state->clut[1] = auto_alloc_array(machine, UINT8, 0x1000);
439   state->scanline[0] = state->scanline[1] = SCANLINE_MIN;
440   state->nb19010_busyflag = 1;
441   state->gfxdraw_mode = 2;
458442}
459443
460444/******************************************************************************
r10613r10614
463447******************************************************************************/
464448SCREEN_UPDATE( nbmj9195 )
465449{
450   nbmj9195_state *state = screen->machine->driver_data<nbmj9195_state>();
466451   int i;
467452   int x, y;
468453   int scrolly[2];
469454
470   if (nbmj9195_screen_refresh)
455   if (state->screen_refresh)
471456   {
472457      int width = screen->width();
473458      int height = screen->height();
474459
475      nbmj9195_screen_refresh = 0;
460      state->screen_refresh = 0;
476461
477462      for (y = 0; y < height; y++)
478463         for (x = 0; x < width; x++)
479464         {
480465            update_pixel(screen->machine, 0, x, y);
481466
482            if (gfxdraw_mode)
467            if (state->gfxdraw_mode)
483468               update_pixel(screen->machine, 1, x, y);
484469         }
485470   }
486471
487472   for (i = 0; i < 2; i++)
488473   {
489      if (nbmj9195_flipscreen[i])
474      if (state->flipscreen[i])
490475      {
491         for ( ; nbmj9195_scanline[i] < SCANLINE_MAX; nbmj9195_scanline[i]++)
476         for ( ; state->scanline[i] < SCANLINE_MAX; state->scanline[i]++)
492477         {
493            nbmj9195_scrollx_raster[i][nbmj9195_scanline[i]] = (((-nbmj9195_scrollx[i]) - 0x4e)  & 0x1ff) << 1;
478            state->scrollx_raster[i][state->scanline[i]] = (((-state->scrollx[i]) - 0x4e)  & 0x1ff) << 1;
494479         }
495         scrolly[i] = (-nbmj9195_scrolly[i]) & 0x1ff;
480         scrolly[i] = (-state->scrolly[i]) & 0x1ff;
496481      }
497482      else
498483      {
499         for ( ; nbmj9195_scanline[i] < SCANLINE_MAX; nbmj9195_scanline[i]++)
484         for ( ; state->scanline[i] < SCANLINE_MAX; state->scanline[i]++)
500485         {
501            nbmj9195_scrollx_raster[i][(nbmj9195_scanline[i] ^ 0x1ff)] = (((-nbmj9195_scrollx[i]) - 0x4e)  & 0x1ff) << 1;
486            state->scrollx_raster[i][(state->scanline[i] ^ 0x1ff)] = (((-state->scrollx[i]) - 0x4e)  & 0x1ff) << 1;
502487         }
503         scrolly[i] = nbmj9195_scrolly[i] & 0x1ff;
488         scrolly[i] = state->scrolly[i] & 0x1ff;
504489      }
505      nbmj9195_scanline[i] = SCANLINE_MIN;
490      state->scanline[i] = SCANLINE_MIN;
506491   }
507492
508   if (nbmj9195_dispflag[0])
493   if (state->dispflag[0])
509494      // nbmj9195 1layer
510      copyscrollbitmap(bitmap, nbmj9195_tmpbitmap[0], SCANLINE_MAX, nbmj9195_scrollx_raster[0], 1, &scrolly[0], cliprect);
495      copyscrollbitmap(bitmap, state->tmpbitmap[0], SCANLINE_MAX, state->scrollx_raster[0], 1, &scrolly[0], cliprect);
511496   else
512497      bitmap_fill(bitmap, 0, 0x0ff);
513498
514   if (nbmj9195_dispflag[1])
499   if (state->dispflag[1])
515500   {
516      if (gfxdraw_mode == 1)
501      if (state->gfxdraw_mode == 1)
517502         // nbmj9195 2layer
518         copyscrollbitmap_trans(bitmap, nbmj9195_tmpbitmap[1], SCANLINE_MAX, nbmj9195_scrollx_raster[1], 1, &scrolly[1], cliprect, 0x0ff);
503         copyscrollbitmap_trans(bitmap, state->tmpbitmap[1], SCANLINE_MAX, state->scrollx_raster[1], 1, &scrolly[1], cliprect, 0x0ff);
519504
520      if (gfxdraw_mode == 2)
505      if (state->gfxdraw_mode == 2)
521506         // nbmj9195 nb22090 2layer
522         copyscrollbitmap_trans(bitmap, nbmj9195_tmpbitmap[1], SCANLINE_MAX, nbmj9195_scrollx_raster[1], 1, &scrolly[1], cliprect, 0x1ff);
507         copyscrollbitmap_trans(bitmap, state->tmpbitmap[1], SCANLINE_MAX, state->scrollx_raster[1], 1, &scrolly[1], cliprect, 0x1ff);
523508   }
524509   return 0;
525510}
src/mame/video/niyanpai.c
r10613r10614
1010#include "includes/niyanpai.h"
1111
1212
13#define   VRAM_MAX   3
14
15
16static int niyanpai_scrollx[VRAM_MAX], niyanpai_scrolly[VRAM_MAX];
17static int blitter_destx[VRAM_MAX], blitter_desty[VRAM_MAX];
18static int blitter_sizex[VRAM_MAX], blitter_sizey[VRAM_MAX];
19static int blitter_src_addr[VRAM_MAX];
20static int blitter_direction_x[VRAM_MAX], blitter_direction_y[VRAM_MAX];
21static int niyanpai_dispflag[VRAM_MAX];
22static int niyanpai_flipscreen[VRAM_MAX];
23static int niyanpai_clutmode[VRAM_MAX];
24static int niyanpai_transparency[VRAM_MAX];
25static int niyanpai_clutsel[VRAM_MAX];
26static int niyanpai_screen_refresh;
27static int nb19010_busyctr;
28static int nb19010_busyflag;
29
30static bitmap_t *niyanpai_tmpbitmap[VRAM_MAX];
31static UINT16 *niyanpai_videoram[VRAM_MAX];
32static UINT16 *niyanpai_videoworkram[VRAM_MAX];
33static UINT16 *niyanpai_palette;
34static UINT8 *niyanpai_clut[VRAM_MAX];
35
36
3713static void niyanpai_vramflip(running_machine *machine, int vram);
3814static void niyanpai_gfxdraw(running_machine *machine, int vram);
3915
r10613r10614
4420******************************************************************************/
4521READ16_HANDLER( niyanpai_palette_r )
4622{
47   return niyanpai_palette[offset];
23   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
24   return state->palette[offset];
4825}
4926
5027WRITE16_HANDLER( niyanpai_palette_w )
5128{
29   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
5230   int r, g, b;
5331   int offs_h, offs_l;
54   UINT16 oldword = niyanpai_palette[offset];
32   UINT16 oldword = state->palette[offset];
5533   UINT16 newword;
5634
57   COMBINE_DATA(&niyanpai_palette[offset]);
58   newword = niyanpai_palette[offset];
35   COMBINE_DATA(&state->palette[offset]);
36   newword = state->palette[offset];
5937
6038   if (oldword != newword)
6139   {
r10613r10614
6442
6543      if (ACCESSING_BITS_8_15)
6644      {
67         r  = ((niyanpai_palette[(0x000 + (offs_h * 0x180) + offs_l)] & 0xff00) >> 8);
68         g  = ((niyanpai_palette[(0x080 + (offs_h * 0x180) + offs_l)] & 0xff00) >> 8);
69         b  = ((niyanpai_palette[(0x100 + (offs_h * 0x180) + offs_l)] & 0xff00) >> 8);
45         r  = ((state->palette[(0x000 + (offs_h * 0x180) + offs_l)] & 0xff00) >> 8);
46         g  = ((state->palette[(0x080 + (offs_h * 0x180) + offs_l)] & 0xff00) >> 8);
47         b  = ((state->palette[(0x100 + (offs_h * 0x180) + offs_l)] & 0xff00) >> 8);
7048
7149         palette_set_color(space->machine, ((offs_h << 8) + (offs_l << 1) + 0), MAKE_RGB(r, g, b));
7250      }
7351
7452      if (ACCESSING_BITS_0_7)
7553      {
76         r  = ((niyanpai_palette[(0x000 + (offs_h * 0x180) + offs_l)] & 0x00ff) >> 0);
77         g  = ((niyanpai_palette[(0x080 + (offs_h * 0x180) + offs_l)] & 0x00ff) >> 0);
78         b  = ((niyanpai_palette[(0x100 + (offs_h * 0x180) + offs_l)] & 0x00ff) >> 0);
54         r  = ((state->palette[(0x000 + (offs_h * 0x180) + offs_l)] & 0x00ff) >> 0);
55         g  = ((state->palette[(0x080 + (offs_h * 0x180) + offs_l)] & 0x00ff) >> 0);
56         b  = ((state->palette[(0x100 + (offs_h * 0x180) + offs_l)] & 0x00ff) >> 0);
7957
8058         palette_set_color(space->machine, ((offs_h << 8) + (offs_l << 1) + 1), MAKE_RGB(r, g, b));
8159      }
r10613r10614
8866******************************************************************************/
8967static int niyanpai_blitter_r(running_machine *machine, int vram, int offset)
9068{
69   niyanpai_state *state = machine->driver_data<niyanpai_state>();
9170   int ret;
9271   UINT8 *GFXROM = machine->region("gfx1")->base();
9372
9473   switch (offset)
9574   {
96      case 0x00:   ret = 0xfe | ((nb19010_busyflag & 0x01) ^ 0x01); break;   // NB19010 Busy Flag
97      case 0x01:   ret = GFXROM[blitter_src_addr[vram]]; break;         // NB19010 GFX-ROM Read
75      case 0x00:   ret = 0xfe | ((state->nb19010_busyflag & 0x01) ^ 0x01); break;   // NB19010 Busy Flag
76      case 0x01:   ret = GFXROM[state->blitter_src_addr[vram]]; break;         // NB19010 GFX-ROM Read
9877      default:   ret = 0xff; break;
9978   }
10079
r10613r10614
10382
10483static void niyanpai_blitter_w(running_machine *machine, int vram, int offset, int data)
10584{
85   niyanpai_state *state = machine->driver_data<niyanpai_state>();
10686   switch (offset)
10787   {
108      case 0x00:   blitter_direction_x[vram] = (data & 0x01) ? 1 : 0;
109               blitter_direction_y[vram] = (data & 0x02) ? 1 : 0;
110               niyanpai_clutmode[vram] = (data & 0x04) ? 1 : 0;
88      case 0x00:   state->blitter_direction_x[vram] = (data & 0x01) ? 1 : 0;
89               state->blitter_direction_y[vram] = (data & 0x02) ? 1 : 0;
90               state->clutmode[vram] = (data & 0x04) ? 1 : 0;
11191            //  if (data & 0x08) popmessage("Unknown GFX Flag!! (0x08)");
112               niyanpai_transparency[vram] = (data & 0x10) ? 1 : 0;
92               state->transparency[vram] = (data & 0x10) ? 1 : 0;
11393            //  if (data & 0x20) popmessage("Unknown GFX Flag!! (0x20)");
114               niyanpai_flipscreen[vram] = (data & 0x40) ? 0 : 1;
115               niyanpai_dispflag[vram] = (data & 0x80) ? 1 : 0;
94               state->flipscreen[vram] = (data & 0x40) ? 0 : 1;
95               state->dispflag[vram] = (data & 0x80) ? 1 : 0;
11696               niyanpai_vramflip(machine, vram);
11797               break;
118      case 0x01:   niyanpai_scrollx[vram] = (niyanpai_scrollx[vram] & 0x0100) | data; break;
119      case 0x02:   niyanpai_scrollx[vram] = (niyanpai_scrollx[vram] & 0x00ff) | ((data << 8) & 0x0100); break;
120      case 0x03:   niyanpai_scrolly[vram] = (niyanpai_scrolly[vram] & 0x0100) | data; break;
121      case 0x04:   niyanpai_scrolly[vram] = (niyanpai_scrolly[vram] & 0x00ff) | ((data << 8) & 0x0100); break;
122      case 0x05:   blitter_src_addr[vram] = (blitter_src_addr[vram] & 0xffff00) | data; break;
123      case 0x06:   blitter_src_addr[vram] = (blitter_src_addr[vram] & 0xff00ff) | (data << 8); break;
124      case 0x07:   blitter_src_addr[vram] = (blitter_src_addr[vram] & 0x00ffff) | (data << 16); break;
125      case 0x08:   blitter_sizex[vram] = data; break;
126      case 0x09:   blitter_sizey[vram] = data; break;
127      case 0x0a:   blitter_destx[vram] = (blitter_destx[vram]  & 0xff00) | data; break;
128      case 0x0b:   blitter_destx[vram] = (blitter_destx[vram]  & 0x00ff) | (data << 8); break;
129      case 0x0c:   blitter_desty[vram] = (blitter_desty[vram]  & 0xff00) | data; break;
130      case 0x0d:   blitter_desty[vram] = (blitter_desty[vram]  & 0x00ff) | (data << 8);
98      case 0x01:   state->scrollx[vram] = (state->scrollx[vram] & 0x0100) | data; break;
99      case 0x02:   state->scrollx[vram] = (state->scrollx[vram] & 0x00ff) | ((data << 8) & 0x0100); break;
100      case 0x03:   state->scrolly[vram] = (state->scrolly[vram] & 0x0100) | data; break;
101      case 0x04:   state->scrolly[vram] = (state->scrolly[vram] & 0x00ff) | ((data << 8) & 0x0100); break;
102      case 0x05:   state->blitter_src_addr[vram] = (state->blitter_src_addr[vram] & 0xffff00) | data; break;
103      case 0x06:   state->blitter_src_addr[vram] = (state->blitter_src_addr[vram] & 0xff00ff) | (data << 8); break;
104      case 0x07:   state->blitter_src_addr[vram] = (state->blitter_src_addr[vram] & 0x00ffff) | (data << 16); break;
105      case 0x08:   state->blitter_sizex[vram] = data; break;
106      case 0x09:   state->blitter_sizey[vram] = data; break;
107      case 0x0a:   state->blitter_destx[vram] = (state->blitter_destx[vram]  & 0xff00) | data; break;
108      case 0x0b:   state->blitter_destx[vram] = (state->blitter_destx[vram]  & 0x00ff) | (data << 8); break;
109      case 0x0c:   state->blitter_desty[vram] = (state->blitter_desty[vram]  & 0xff00) | data; break;
110      case 0x0d:   state->blitter_desty[vram] = (state->blitter_desty[vram]  & 0x00ff) | (data << 8);
131111               niyanpai_gfxdraw(machine, vram);
132112               break;
133113      default:   break;
134114   }
135115}
136116
137static void niyanpai_clutsel_w(int vram, int data)
117static void niyanpai_clutsel_w(running_machine *machine, int vram, int data)
138118{
139   niyanpai_clutsel[vram] = data;
119   niyanpai_state *state = machine->driver_data<niyanpai_state>();
120   state->clutsel[vram] = data;
140121}
141122
142static void niyanpai_clut_w(int vram, int offset, int data)
123static void niyanpai_clut_w(running_machine *machine, int vram, int offset, int data)
143124{
144   niyanpai_clut[vram][((niyanpai_clutsel[vram] & 0xff) * 0x10) + (offset & 0x0f)] = data;
125   niyanpai_state *state = machine->driver_data<niyanpai_state>();
126   state->clut[vram][((state->clutsel[vram] & 0xff) * 0x10) + (offset & 0x0f)] = data;
145127}
146128
147129/******************************************************************************
r10613r10614
150132******************************************************************************/
151133static void niyanpai_vramflip(running_machine *machine, int vram)
152134{
153   static int niyanpai_flipscreen_old[VRAM_MAX] = { 0, 0, 0 };
135   niyanpai_state *state = machine->driver_data<niyanpai_state>();
154136   int x, y;
155137   UINT16 color1, color2;
156138   int width = machine->primary_screen->width();
157139   int height = machine->primary_screen->height();
158140
159   if (niyanpai_flipscreen[vram] == niyanpai_flipscreen_old[vram]) return;
141   if (state->flipscreen[vram] == state->flipscreen_old[vram]) return;
160142
161143   for (y = 0; y < (height / 2); y++)
162144   {
163145      for (x = 0; x < width; x++)
164146      {
165         color1 = niyanpai_videoram[vram][(y * width) + x];
166         color2 = niyanpai_videoram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)];
167         niyanpai_videoram[vram][(y * width) + x] = color2;
168         niyanpai_videoram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)] = color1;
147         color1 = state->videoram[vram][(y * width) + x];
148         color2 = state->videoram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)];
149         state->videoram[vram][(y * width) + x] = color2;
150         state->videoram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)] = color1;
169151      }
170152   }
171153
r10613r10614
173155   {
174156      for (x = 0; x < width; x++)
175157      {
176         color1 = niyanpai_videoworkram[vram][(y * width) + x];
177         color2 = niyanpai_videoworkram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)];
178         niyanpai_videoworkram[vram][(y * width) + x] = color2;
179         niyanpai_videoworkram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)] = color1;
158         color1 = state->videoworkram[vram][(y * width) + x];
159         color2 = state->videoworkram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)];
160         state->videoworkram[vram][(y * width) + x] = color2;
161         state->videoworkram[vram][((y ^ 0x1ff) * width) + (x ^ 0x3ff)] = color1;
180162      }
181163   }
182164
183   niyanpai_flipscreen_old[vram] = niyanpai_flipscreen[vram];
184   niyanpai_screen_refresh = 1;
165   state->flipscreen_old[vram] = state->flipscreen[vram];
166   state->screen_refresh = 1;
185167}
186168
187169static void update_pixel(running_machine *machine, int vram, int x, int y)
188170{
189   UINT16 color = niyanpai_videoram[vram][(y * machine->primary_screen->width()) + x];
190   *BITMAP_ADDR16(niyanpai_tmpbitmap[vram], y, x) = color;
171   niyanpai_state *state = machine->driver_data<niyanpai_state>();
172   UINT16 color = state->videoram[vram][(y * machine->primary_screen->width()) + x];
173   *BITMAP_ADDR16(state->tmpbitmap[vram], y, x) = color;
191174}
192175
193176static TIMER_CALLBACK( blitter_timer_callback )
194177{
195   nb19010_busyflag = 1;
178   niyanpai_state *state = machine->driver_data<niyanpai_state>();
179   state->nb19010_busyflag = 1;
196180}
197181
198182static void niyanpai_gfxdraw(running_machine *machine, int vram)
199183{
184   niyanpai_state *state = machine->driver_data<niyanpai_state>();
200185   UINT8 *GFX = machine->region("gfx1")->base();
201186   int width = machine->primary_screen->width();
202187
r10613r10614
209194   UINT16 color, color1, color2;
210195   int gfxaddr, gfxlen;
211196
212   nb19010_busyctr = 0;
197   state->nb19010_busyctr = 0;
213198
214   if (niyanpai_clutmode[vram])
199   if (state->clutmode[vram])
215200   {
216201      // NB22090 clut256 mode
217      blitter_sizex[vram] = GFX[((blitter_src_addr[vram] + 0) & 0x00ffffff)];
218      blitter_sizey[vram] = GFX[((blitter_src_addr[vram] + 1) & 0x00ffffff)];
202      state->blitter_sizex[vram] = GFX[((state->blitter_src_addr[vram] + 0) & 0x00ffffff)];
203      state->blitter_sizey[vram] = GFX[((state->blitter_src_addr[vram] + 1) & 0x00ffffff)];
219204   }
220205
221   if (blitter_direction_x[vram])
206   if (state->blitter_direction_x[vram])
222207   {
223      startx = blitter_destx[vram];
224      sizex = blitter_sizex[vram];
208      startx = state->blitter_destx[vram];
209      sizex = state->blitter_sizex[vram];
225210      skipx = 1;
226211   }
227212   else
228213   {
229      startx = blitter_destx[vram] + blitter_sizex[vram];
230      sizex = blitter_sizex[vram];
214      startx = state->blitter_destx[vram] + state->blitter_sizex[vram];
215      sizex = state->blitter_sizex[vram];
231216      skipx = -1;
232217   }
233218
234   if (blitter_direction_y[vram])
219   if (state->blitter_direction_y[vram])
235220   {
236      starty = blitter_desty[vram];
237      sizey = blitter_sizey[vram];
221      starty = state->blitter_desty[vram];
222      sizey = state->blitter_sizey[vram];
238223      skipy = 1;
239224   }
240225   else
241226   {
242      starty = blitter_desty[vram] + blitter_sizey[vram];
243      sizey = blitter_sizey[vram];
227      starty = state->blitter_desty[vram] + state->blitter_sizey[vram];
228      sizey = state->blitter_sizey[vram];
244229      skipy = -1;
245230   }
246231
247232   gfxlen = machine->region("gfx1")->bytes();
248   gfxaddr = ((blitter_src_addr[vram] + 2) & 0x00ffffff);
233   gfxaddr = ((state->blitter_src_addr[vram] + 2) & 0x00ffffff);
249234
250235   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
251236   {
r10613r10614
266251         dx2 = (2 * x + 1) & 0x3ff;
267252         dy = y & 0x1ff;
268253
269         if (!niyanpai_flipscreen[vram])
254         if (!state->flipscreen[vram])
270255         {
271256            dx1 ^= 0x3ff;
272257            dx2 ^= 0x3ff;
273258            dy ^= 0x1ff;
274259         }
275260
276         if (blitter_direction_x[vram])
261         if (state->blitter_direction_x[vram])
277262         {
278263            // flip
279264            color1 = (color & 0x0f) >> 0;
r10613r10614
286271            color2 = (color & 0x0f) >> 0;
287272         }
288273
289         if (niyanpai_clutmode[vram])
274         if (state->clutmode[vram])
290275         {
291276            // clut256 mode
292277
293            if (niyanpai_clutsel[vram] & 0x80)
278            if (state->clutsel[vram] & 0x80)
294279            {
295280               // clut256 mode 1st(low)
296               niyanpai_videoworkram[vram][(dy * width) + dx1] &= 0x00f0;
297               niyanpai_videoworkram[vram][(dy * width) + dx1] |= color1 & 0x0f;
298               niyanpai_videoworkram[vram][(dy * width) + dx2] &= 0x00f0;
299               niyanpai_videoworkram[vram][(dy * width) + dx2] |= color2 & 0x0f;
281               state->videoworkram[vram][(dy * width) + dx1] &= 0x00f0;
282               state->videoworkram[vram][(dy * width) + dx1] |= color1 & 0x0f;
283               state->videoworkram[vram][(dy * width) + dx2] &= 0x00f0;
284               state->videoworkram[vram][(dy * width) + dx2] |= color2 & 0x0f;
300285
301286               continue;
302287            }
303288            else
304289            {
305290               // clut256 mode 2nd(high)
306               niyanpai_videoworkram[vram][(dy * width) + dx1] &= 0x000f;
307               niyanpai_videoworkram[vram][(dy * width) + dx1] |= (color1 & 0x0f) << 4;
308               niyanpai_videoworkram[vram][(dy * width) + dx2] &= 0x000f;
309               niyanpai_videoworkram[vram][(dy * width) + dx2] |= (color2 & 0x0f) << 4;
291               state->videoworkram[vram][(dy * width) + dx1] &= 0x000f;
292               state->videoworkram[vram][(dy * width) + dx1] |= (color1 & 0x0f) << 4;
293               state->videoworkram[vram][(dy * width) + dx2] &= 0x000f;
294               state->videoworkram[vram][(dy * width) + dx2] |= (color2 & 0x0f) << 4;
310295
311      //          niyanpai_videoworkram[vram][(dy * width) + dx1] += niyanpai_clut[vram][(niyanpai_clutsel[vram] * 0x10)];
312      //          niyanpai_videoworkram[vram][(dy * width) + dx2] += niyanpai_clut[vram][(niyanpai_clutsel[vram] * 0x10)];
296      //          state->videoworkram[vram][(dy * width) + dx1] += state->clut[vram][(state->clutsel[vram] * 0x10)];
297      //          state->videoworkram[vram][(dy * width) + dx2] += state->clut[vram][(state->clutsel[vram] * 0x10)];
313298            }
314299
315            color1 = niyanpai_videoworkram[vram][(dy * width) + dx1];
316            color2 = niyanpai_videoworkram[vram][(dy * width) + dx2];
300            color1 = state->videoworkram[vram][(dy * width) + dx1];
301            color2 = state->videoworkram[vram][(dy * width) + dx2];
317302         }
318303         else
319304         {
320305            // clut16 mode
321            color1 = niyanpai_clut[vram][(niyanpai_clutsel[vram] * 0x10) + color1];
322            color2 = niyanpai_clut[vram][(niyanpai_clutsel[vram] * 0x10) + color2];
306            color1 = state->clut[vram][(state->clutsel[vram] * 0x10) + color1];
307            color2 = state->clut[vram][(state->clutsel[vram] * 0x10) + color2];
323308         }
324309
325310         color1 |= (0x0100 * vram);
326311         color2 |= (0x0100 * vram);
327312
328         if (((color1 & 0x00ff) != 0x00ff) || (!niyanpai_transparency[vram]))
313         if (((color1 & 0x00ff) != 0x00ff) || (!state->transparency[vram]))
329314         {
330            niyanpai_videoram[vram][(dy * width) + dx1] = color1;
315            state->videoram[vram][(dy * width) + dx1] = color1;
331316            update_pixel(machine, vram, dx1, dy);
332317         }
333         if (((color2 & 0x00ff) != 0x00ff) || (!niyanpai_transparency[vram]))
318         if (((color2 & 0x00ff) != 0x00ff) || (!state->transparency[vram]))
334319         {
335            niyanpai_videoram[vram][(dy * width) + dx2] = color2;
320            state->videoram[vram][(dy * width) + dx2] = color2;
336321            update_pixel(machine, vram, dx2, dy);
337322         }
338323
339         nb19010_busyctr++;
324         state->nb19010_busyctr++;
340325      }
341326   }
342327
343   if (niyanpai_clutmode[vram])
328   if (state->clutmode[vram])
344329   {
345330      // NB22090 clut256 mode
346      blitter_src_addr[vram] = gfxaddr;
331      state->blitter_src_addr[vram] = gfxaddr;
347332   }
348333
349   nb19010_busyflag = 0;
350   machine->scheduler().timer_set(attotime::from_nsec(1650 * nb19010_busyctr), FUNC(blitter_timer_callback));
334   state->nb19010_busyflag = 0;
335   machine->scheduler().timer_set(attotime::from_nsec(1650 * state->nb19010_busyctr), FUNC(blitter_timer_callback));
351336}
352337
353338/******************************************************************************
r10613r10614
362347READ16_HANDLER( niyanpai_blitter_1_r )   { return niyanpai_blitter_r(space->machine, 1, offset); }
363348READ16_HANDLER( niyanpai_blitter_2_r )   { return niyanpai_blitter_r(space->machine, 2, offset); }
364349
365WRITE16_HANDLER( niyanpai_clut_0_w )   { niyanpai_clut_w(0, offset, data); }
366WRITE16_HANDLER( niyanpai_clut_1_w )   { niyanpai_clut_w(1, offset, data); }
367WRITE16_HANDLER( niyanpai_clut_2_w )   { niyanpai_clut_w(2, offset, data); }
350WRITE16_HANDLER( niyanpai_clut_0_w )   { niyanpai_clut_w(space->machine, 0, offset, data); }
351WRITE16_HANDLER( niyanpai_clut_1_w )   { niyanpai_clut_w(space->machine, 1, offset, data); }
352WRITE16_HANDLER( niyanpai_clut_2_w )   { niyanpai_clut_w(space->machine, 2, offset, data); }
368353
369WRITE16_HANDLER( niyanpai_clutsel_0_w )   { niyanpai_clutsel_w(0, data); }
370WRITE16_HANDLER( niyanpai_clutsel_1_w )   { niyanpai_clutsel_w(1, data); }
371WRITE16_HANDLER( niyanpai_clutsel_2_w )   { niyanpai_clutsel_w(2, data); }
354WRITE16_HANDLER( niyanpai_clutsel_0_w )   { niyanpai_clutsel_w(space->machine, 0, data); }
355WRITE16_HANDLER( niyanpai_clutsel_1_w )   { niyanpai_clutsel_w(space->machine, 1, data); }
356WRITE16_HANDLER( niyanpai_clutsel_2_w )   { niyanpai_clutsel_w(space->machine, 2, data); }
372357
373358/******************************************************************************
374359
r10613r10614
376361******************************************************************************/
377362VIDEO_START( niyanpai )
378363{
364   niyanpai_state *state = machine->driver_data<niyanpai_state>();
379365   int width = machine->primary_screen->width();
380366   int height = machine->primary_screen->height();
381367
382   niyanpai_tmpbitmap[0] = machine->primary_screen->alloc_compatible_bitmap();
383   niyanpai_tmpbitmap[1] = machine->primary_screen->alloc_compatible_bitmap();
384   niyanpai_tmpbitmap[2] = machine->primary_screen->alloc_compatible_bitmap();
385   niyanpai_videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
386   niyanpai_videoram[1] = auto_alloc_array_clear(machine, UINT16, width * height);
387   niyanpai_videoram[2] = auto_alloc_array_clear(machine, UINT16, width * height);
388   niyanpai_videoworkram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
389   niyanpai_videoworkram[1] = auto_alloc_array_clear(machine, UINT16, width * height);
390   niyanpai_videoworkram[2] = auto_alloc_array_clear(machine, UINT16, width * height);
391   niyanpai_palette = auto_alloc_array(machine, UINT16, 0x480);
392   niyanpai_clut[0] = auto_alloc_array(machine, UINT8, 0x1000);
393   niyanpai_clut[1] = auto_alloc_array(machine, UINT8, 0x1000);
394   niyanpai_clut[2] = auto_alloc_array(machine, UINT8, 0x1000);
395   nb19010_busyflag = 1;
368   state->tmpbitmap[0] = machine->primary_screen->alloc_compatible_bitmap();
369   state->tmpbitmap[1] = machine->primary_screen->alloc_compatible_bitmap();
370   state->tmpbitmap[2] = machine->primary_screen->alloc_compatible_bitmap();
371   state->videoram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
372   state->videoram[1] = auto_alloc_array_clear(machine, UINT16, width * height);
373   state->videoram[2] = auto_alloc_array_clear(machine, UINT16, width * height);
374   state->videoworkram[0] = auto_alloc_array_clear(machine, UINT16, width * height);
375   state->videoworkram[1] = auto_alloc_array_clear(machine, UINT16, width * height);
376   state->videoworkram[2] = auto_alloc_array_clear(machine, UINT16, width * height);
377   state->palette = auto_alloc_array(machine, UINT16, 0x480);
378   state->clut[0] = auto_alloc_array(machine, UINT8, 0x1000);
379   state->clut[1] = auto_alloc_array(machine, UINT8, 0x1000);
380   state->clut[2] = auto_alloc_array(machine, UINT8, 0x1000);
381   state->nb19010_busyflag = 1;
396382}
397383
398384/******************************************************************************
r10613r10614
401387******************************************************************************/
402388SCREEN_UPDATE( niyanpai )
403389{
390   niyanpai_state *state = screen->machine->driver_data<niyanpai_state>();
404391   int i;
405392   int x, y;
406393   int scrollx[3], scrolly[3];
407394
408   if (niyanpai_screen_refresh)
395   if (state->screen_refresh)
409396   {
410397      int width = screen->width();
411398      int height = screen->height();
412399
413      niyanpai_screen_refresh = 0;
400      state->screen_refresh = 0;
414401
415402      for (y = 0; y < height; y++)
416403         for (x = 0; x < width; x++)
r10613r10614
423410
424411   for (i = 0; i < 3; i++)
425412   {
426      if (niyanpai_flipscreen[i])
413      if (state->flipscreen[i])
427414      {
428         scrollx[i] = (((-niyanpai_scrollx[i]) - 0x4e)  & 0x1ff) << 1;
429         scrolly[i] = (-niyanpai_scrolly[i]) & 0x1ff;
415         scrollx[i] = (((-state->scrollx[i]) - 0x4e)  & 0x1ff) << 1;
416         scrolly[i] = (-state->scrolly[i]) & 0x1ff;
430417      }
431418      else
432419      {
433         scrollx[i] = (((-niyanpai_scrollx[i]) - 0x4e)  & 0x1ff) << 1;
434         scrolly[i] = niyanpai_scrolly[i] & 0x1ff;
420         scrollx[i] = (((-state->scrollx[i]) - 0x4e)  & 0x1ff) << 1;
421         scrolly[i] = state->scrolly[i] & 0x1ff;
435422      }
436423   }
437424
438   if (niyanpai_dispflag[0])
439      copyscrollbitmap(bitmap, niyanpai_tmpbitmap[0], 1, &scrollx[0], 1, &scrolly[0], cliprect);
425   if (state->dispflag[0])
426      copyscrollbitmap(bitmap, state->tmpbitmap[0], 1, &scrollx[0], 1, &scrolly[0], cliprect);
440427   else
441428      bitmap_fill(bitmap, 0, 0x00ff);
442429
443   if (niyanpai_dispflag[1])
444      copyscrollbitmap_trans(bitmap, niyanpai_tmpbitmap[1], 1, &scrollx[1], 1, &scrolly[1], cliprect, 0x01ff);
430   if (state->dispflag[1])
431      copyscrollbitmap_trans(bitmap, state->tmpbitmap[1], 1, &scrollx[1], 1, &scrolly[1], cliprect, 0x01ff);
445432
446   if (niyanpai_dispflag[2])
447      copyscrollbitmap_trans(bitmap, niyanpai_tmpbitmap[2], 1, &scrollx[2], 1, &scrolly[2], cliprect, 0x02ff);
433   if (state->dispflag[2])
434      copyscrollbitmap_trans(bitmap, state->tmpbitmap[2], 1, &scrollx[2], 1, &scrolly[2], cliprect, 0x02ff);
448435
449436   return 0;
450437}
src/mame/video/seta2.c
r10613r10614
1515    Offset:     Bits:                   Value:
1616
1717        0.w     f--- ---- ---- ----     Last sprite
18                -edc ---- ---- ----     ?
19                ---c ---- ---- ----     0 = Each sprite specifies its size, 1 = use the size in the following words
20                ---- b--- ---- ----     ?
21                ---- -a98 ---- ----     tile color depth
18                -ed- ---- ---- ----     ?
19                ---c ---- ---- ----     0 = Each sprite specifies its size, 1 = Use the global size (following words)
20                ---- b--- ---- ----     Shadow
21                ---- -a98 ---- ----     Tile color depth
2222                ---- ---- 7654 3210     Number of sprites - 1
2323
24        2.w     fedc ---- ---- ----     Number of tiles?
25                ---- ba-- ---- ----     Number of tiles along X (1 << n)
24        2.w     fedc ba-- ---- ----     X global size
2625                ---- --98 7654 3210     X displacement
2726
28        4.w     fedc ---- ---- ----     Number of tiles?
29                ---- ba-- ---- ----     Number of tiles along Y (1 << n)
27        4.w     fedc ba-- ---- ----     Y global size
3028                ---- --98 7654 3210     Y displacement
3129
3230        6.w     f--- ---- ---- ----     Single-sprite(s) type: tile (0) or row of tiles (1)
33                -edc ba98 7654 3210     Offset of the single-sprite(s) data
31                -edc ba98 7654 3210     Offset of the single-sprite(s) data (8 bytes each)
3432
3533
3634    A single-sprite can be a tile or some horizontal rows of tiles.
3735
3836    Tile case:
3937
40        0.w     fedc ---- ---- ----     Number of tiles?
38        0.w     fedc ---- ---- ----
4139                ---- ba-- ---- ----     Number of tiles along X (1 << n)
4240                ---- --98 7654 3210     X
4341
44        2.w     fedc ---- ---- ----     Number of tiles?
42        2.w     fedc ---- ---- ----
4543                ---- ba-- ---- ----     Number of tiles along Y (1 << n)
4644                ---- --98 7654 3210     Y
4745
r10613r10614
5553
5654    Row case:
5755
58        0.w     fedc ba-- ---- ----
56        0.w     fedc ba-- ---- ----     Number of columns
5957                ---- --98 7654 3210     X
6058
6159        2.w     fedc ba-- ---- ----     Number of rows - 1
6260                ---- --98 7654 3210     Y
6361
6462        4.w     f--- ---- ---- ----     Tile size: 8x8 (0) or 16x16 (1)
65                -edc ba-- ---- ----     "Tilemap" page
66                ---- --98 7654 3210     "Tilemap" Scroll X
63                -edc ba-- ---- ----     "Tilemap" page (0x2000 bytes each)
64                ---- --98 7654 3210     "Tilemap" scroll X
6765
6866        6.w     fedc ba9- ---- ----
69                ---- ---8 7654 3210     "Tilemap" Scroll Y
67                ---- ---8 7654 3210     "Tilemap" scroll Y
7068
69
70    Shadows (same principle as ssv.c):
71
72    The low bits of the pens from a "shadowing" tile (regardless of color code)
73    substitute the top bits of the color index (0-7fff) in the frame buffer.
74
7175***************************************************************************/
7276
7377#include "emu.h"
r10613r10614
7579
7680/***************************************************************************
7781
78
7982                                Video Registers
8083
8184    Offset:     Bits:                   Value:
8285
83    0/2/4/6                             ? Horizontal
84    8/a/c/e                             ? Vertical
86    0/2/4/6                             ? Horizontal (same as ssv.c?)
87    8/a/c/e                             ? Vertical   (same as ssv.c?)
8588
8689    10
8790    12                                  Offset X?
r10613r10614
9194    18
9295    1a                                  Offset Y?
9396    1c                                  Zoom Y? low bits
94    1e                                  Zoom Y? high bits
97    1e                                  Zoom Y? high bits *
9598
99    26                                  1->0 during INT0, before writing sprites
100
96101    30          fedc ba98 7654 321-
97102                ---- ---- ---- ---0     Disable video
98103
99104    32..3f                              ?
100105
106    * A value of 0x0100 is means no zoom, a value of 0x0200 will halve the size.
107      A value less than 0x0100 probably means magnification.
101108
102    * A value of 1 is means no zoom, a value of 2 will halve the size.
103      It's unknown whether a value less than 1 means magnification (probably yes)
104
105109***************************************************************************/
106110
107111WRITE16_HANDLER( seta2_vregs_w )
r10613r10614
157161
158162***************************************************************************/
159163
164static void seta_drawgfx(   bitmap_t *bitmap, const rectangle *cliprect, const gfx_element *gfx,
165                     UINT32 code,UINT32 color,int flipx,int flipy,int x0,int y0,
166                     int shadow_depth )
167{
168   const UINT8 *addr, *source;
169   UINT8 pen;
170   UINT16 *dest;
171   int sx, x1, dx;
172   int sy, y1, dy;
173
174   addr   =   gfx_element_get_data(gfx, code  % gfx->total_elements);
175   color   =   gfx->color_granularity * (color % gfx->total_colors);
176
177   if ( flipx )   {   x1 = x0-1;            x0 += gfx->width-1;      dx = -1;   }
178   else         {   x1 = x0 + gfx->width;                     dx =  1;   }
179
180   if ( flipy )   {   y1 = y0-1;            y0 += gfx->height-1;   dy = -1;   }
181   else         {   y1 = y0 + gfx->height;                     dy =  1;   }
182
183#define SETA_DRAWGFX(SETPIXELCOLOR)                                    \
184   for ( sy = y0; sy != y1; sy += dy )                                 \
185   {                                                         \
186      if ( sy >= cliprect->min_y && sy <= cliprect->max_y )               \
187      {                                                      \
188         source   =   addr;                                       \
189         dest   =   BITMAP_ADDR16(bitmap, sy, 0);                     \
190                                                            \
191         for ( sx = x0; sx != x1; sx += dx )                           \
192         {                                                   \
193            pen = *source++;                                    \
194                                                            \
195            if ( pen && sx >= cliprect->min_x && sx <= cliprect->max_x )   \
196               SETPIXELCOLOR                                    \
197         }                                                   \
198      }                                                      \
199                                                            \
200      addr   +=   gfx->line_modulo;                                 \
201   }
202
203   if (shadow_depth)
204   {
205      int pen_shift = 15 - shadow_depth;
206      int pen_mask  = (1 << pen_shift) - 1;
207      SETA_DRAWGFX( { dest[sx] = ((dest[sx] & pen_mask) | (pen << pen_shift)) & 0x7fff; } )
208   }
209   else
210   {
211      SETA_DRAWGFX( { dest[sx] = (color + pen) & 0x7fff; } )
212   }
213}
214
160215static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
161216{
162   /* Sprites list */
217   // Sprites list
163218
164219   seta2_state *state = machine->driver_data<seta2_state>();
220   // When debugging, use state->spriteram here, and run mame -update_in_pause
165221   UINT16 *buffered_spriteram16 = state->buffered_spriteram;
166222   UINT16 *s1  = buffered_spriteram16 + 0x3000/2;
167223   UINT16 *end = &buffered_spriteram16[state->spriteram_size/2];
168224
169225   for ( ; s1 < end; s1+=4 )
170226   {
171      int gfx;
227      const gfx_element *gfx;
172228      int num      = s1[0];
173229      int xoffs   = s1[1];
174230      int yoffs   = s1[2];
175231      int sprite   = s1[3];
176232
177      /* Single-sprite address */
233      // Single-sprite address
178234      UINT16 *s2 = &buffered_spriteram16[(sprite & 0x7fff) * 4];
179235
180      /* Single-sprite tile size */
181      int global_sizex = xoffs & 0x0c00;
182      int global_sizey = yoffs & 0x0c00;
236      // Single-sprite size
237      int global_sizex = xoffs & 0xfc00;
238      int global_sizey = yoffs & 0xfc00;
183239
184      int use_global_size = num & 0x1000;
240      int use_global_size   =   num & 0x1000;
241      int use_shadow      =   num & 0x0800;
185242
186243      xoffs &= 0x3ff;
187244      yoffs &= 0x3ff;
188245
189      /* Color depth */
246      // Color depth
247      int shadow_depth;
190248      switch (num & 0x0700)
191249      {
192250         default:
193251            popmessage("unknown gfxset %x",(num & 0x0700)>>8);
194            gfx = machine->rand()&3; break;
195         case 0x0700:   // 8bpp tiles (76543210)
196            gfx = 3; break;
197         case 0x0600:   // 6bpp tiles (--543210) (myangel sliding blocks test)
198            gfx = 2; break;
199         case 0x0500:   // 4bpp tiles (3210----)
200            gfx = 1; break;
201         case 0x0400:   // 4bpp tiles (----3210)
202            gfx = 0; break;
252            shadow_depth = 0;
253            gfx = machine->gfx[machine->rand()&3];
254            break;
255         case 0x0700:         // 8bpp tiles (76543210)
256            shadow_depth = 8;   // ?
257            gfx = machine->gfx[3];
258            break;
259         case 0x0600:         // 6bpp tiles (--543210) (myangel sliding blocks test)
260            shadow_depth = 6;   // ?
261            gfx = machine->gfx[2];
262            break;
263         case 0x0500:         // 4bpp tiles (3210----)
264            shadow_depth = 4;   // ?
265            gfx = machine->gfx[1];
266            break;
267         case 0x0400:         // 4bpp tiles (----3210)
268            shadow_depth = 3;   // reelquak
269            gfx = machine->gfx[0];
270            break;
203271//          case 0x0300:
204272//              unknown
205         case 0x0200:   // 3bpp tiles?  (-----210) (myangel "Graduate Tests")
206            gfx = 4; break;
207         case 0x0100:   // 2bpp tiles??? (--10----) (myangel2 question bubble, myangel endgame)
208            gfx = 5; break;
209         case 0x0000:   // no idea!
210            gfx = 0; break;
273         case 0x0200:         // 3bpp tiles?  (-----210) (myangel "Graduate Tests")
274            shadow_depth = 3;   // ?
275            gfx = machine->gfx[4];
276            break;
277         case 0x0100:         // 2bpp tiles??? (--10----) (myangel2 question bubble, myangel endgame)
278            shadow_depth = 2;   // myangel2
279            gfx = machine->gfx[5];
280            break;
281         case 0x0000:         // no idea!
282            shadow_depth = 4;   // ?
283            gfx = machine->gfx[0];
284            break;
211285      }
286      if (!use_shadow)
287         shadow_depth = 0;
212288
213      /* Number of single-sprites */
289      // Number of single-sprites
214290      num = (num & 0x00ff) + 1;
215291
216292      for( ; num > 0; num--,s2+=4 )
r10613r10614
222298         if (sprite & 0x8000)
223299         {
224300            rectangle clip;
225            int dx,x,y;
301            int dx, x, y;
226302            int flipx;
227303            int flipy;
228304            int sx       = s2[0];
r10613r10614
231307            int scrolly  = s2[3];
232308            int tilesize = (scrollx & 0x8000) >> 15;
233309            int page     = (scrollx & 0x7c00) >> 10;
234            int height   = ((sy & 0xfc00) >> 10) + 1;
235310
311            int width    = use_global_size ? global_sizex : sx;
312            int height   = use_global_size ? global_sizey : sy;
313            height = ((height & 0xfc00) >> 10) + 1;
314            width  = ((width  & 0xfc00) >> 10)/* + 1*/;   // reelquak reels
315            if (!width)
316               continue;
317
236318            sx &= 0x3ff;
237319            sy &= 0x1ff;
320
321            scrollx += state->xoffset;
238322            scrollx &= 0x3ff;
239323            scrolly &= 0x1ff;
240324
241            clip.min_y = (sy + yoffs) & 0x1ff;
325            // sprite clipping region (x)
326            clip.min_x = (sx + xoffs) & 0x3ff;
327            clip.min_x = (clip.min_x & 0x1ff) - (clip.min_x & 0x200);
328            clip.max_x = clip.min_x + width * 0x10 - 1;
329
330            if (clip.min_x > cliprect->max_x)   continue;
331            if (clip.max_x < cliprect->min_x)   continue;
332            if (clip.min_x < cliprect->min_x)   clip.min_x = cliprect->min_x;
333            if (clip.max_x > cliprect->max_x)   clip.max_x = cliprect->max_x;
334
335            // sprite clipping region (y)
336            clip.min_y = ((sy + yoffs) & 0x1ff) - state->yoffset;
242337            clip.max_y = clip.min_y + height * 0x10 - 1;
243338
244339            if (clip.min_y > cliprect->max_y)   continue;
245340            if (clip.max_y < cliprect->min_y)   continue;
246
247            clip.min_x = cliprect->min_x;
248            clip.max_x = cliprect->max_x;
249
250341            if (clip.min_y < cliprect->min_y)   clip.min_y = cliprect->min_y;
251342            if (clip.max_y > cliprect->max_y)   clip.max_y = cliprect->max_y;
252343
253344            dx = sx + (scrollx & 0x3ff) + xoffs + 0x10;
254345
255            /* Draw the rows */
256            /* I don't think the following is entirely correct (when using 16x16
257                   tiles x should probably loop from 0 to 0x20) but it seems to work
258                   fine in all the games we have for now. */
346            // Draw the rows
259347            for (y = 0; y < (0x40 >> tilesize); y++)
260348            {
261349               int py = ((scrolly - (y+1) * (8 << tilesize) + 0x10) & 0x1ff) - 0x10 - state->yoffset;
262350
263               if (py < clip.min_y - 0x10) continue;
264               if (py > clip.max_y) continue;
265
266               for (x = 0; x < 0x40;x++)
351               for (x = 0; x < 0x40; x++)
267352               {
268353                  int px = ((dx + x * (8 << tilesize) + 0x10) & 0x3ff) - 0x10;
269354                  int tx, ty;
270355                  int attr, code, color;
271356                  UINT16 *s3;
272357
273                  if (px < clip.min_x - 0x10) continue;
274                  if (px > clip.max_x) continue;
275
276358                  s3   =   &buffered_spriteram16[2 * ((page * 0x2000/4) + ((y & 0x1f) << 6) + (x & 0x03f))];
277359
278360                  attr  = s3[0];
r10613r10614
287369                  {
288370                     for (tx = 0; tx <= tilesize; tx++)
289371                     {
290                        drawgfx_transpen(bitmap, cliprect,machine->gfx[gfx],
372                        int dst_x = (px + (flipx ? tilesize-tx : tx) * 8) & 0x3ff;
373                        int dst_y = (py + (flipy ? tilesize-ty : ty) * 8) & 0x1ff;
374
375                        dst_x = (dst_x & 0x1ff) - (dst_x & 0x200);
376
377                        seta_drawgfx(bitmap, &clip, gfx,
291378                              code ^ tx ^ (ty<<1),
292379                              color,
293380                              flipx, flipy,
294                              px + (flipx ? tilesize-tx : tx) * 8, py + (flipy ? tilesize-ty : ty) * 8,0 );
381                              dst_x, dst_y,
382                              shadow_depth );
295383                     }
296384                  }
297385
r10613r10614
320408            sy += yoffs;
321409
322410            sx = (sx & 0x1ff) - (sx & 0x200);
411
323412            sy &= 0x1ff;
324413            sy -= state->yoffset;
325414
r10613r10614
329418            {
330419               for (x = 0; x <= sizex; x++)
331420               {
332                  drawgfx_transpen(bitmap, cliprect,machine->gfx[gfx],
421                  seta_drawgfx(bitmap, cliprect, gfx,
333422                        code++,
334423                        color,
335424                        flipx, flipy,
336                        sx + (flipx ? sizex-x : x) * 8, sy + (flipy ? sizey-y : y) * 8,0 );
425                        sx + (flipx ? sizex-x : x) * 8, sy + (flipy ? sizey-y : y) * 8,
426                        shadow_depth );
337427               }
338428            }
339429         }
340430      }
341431
342      if (s1[0] & 0x8000) break;   /* end of list marker */
343   }   /* sprite list */
432      if (s1[0] & 0x8000) break;   // end of list marker
433   }   // sprite list
344434}
345435
346436
r10613r10614
363453
364454   state->buffered_spriteram = auto_alloc_array(machine, UINT16, state->spriteram_size/2);
365455
456   state->xoffset = 0;
366457   state->yoffset = 0;
458
459    state_save_register_global_pointer(machine, state->vregs, 0x40);
367460}
368461
369VIDEO_START( seta2_offset )
462VIDEO_START( seta2_xoffset )
370463{
371464   seta2_state *state = machine->driver_data<seta2_state>();
372465
373466   VIDEO_START_CALL(seta2);
374467
468   state->xoffset = 0x200;
469}
470
471VIDEO_START( seta2_yoffset )
472{
473   seta2_state *state = machine->driver_data<seta2_state>();
474
475   VIDEO_START_CALL(seta2);
476
375477   state->yoffset = 0x10;
376478}
377479
r10613r10614
379481{
380482   seta2_state *state = screen->machine->driver_data<seta2_state>();
381483
382   /* Black or pen 0? */
383   bitmap_fill(bitmap,cliprect,0);
484   // Black or pen 0?
485   bitmap_fill(bitmap, cliprect, screen->machine->pens[0]);
384486
385   if (state->vregs[0x30/2] & 1)   return 0;      // BLANK SCREEN
487   if ( (state->vregs[0x30/2] & 1) == 0 )   // 1 = BLANK SCREEN
488      draw_sprites(screen->machine, bitmap, cliprect);
386489
387   draw_sprites(screen->machine,bitmap,cliprect);
388490   return 0;
389491}
390492
r10613r10614
392494{
393495   seta2_state *state = machine->driver_data<seta2_state>();
394496
395   /* Buffer sprites by 1 frame */
497   // Buffer sprites by 1 frame
396498   memcpy(state->buffered_spriteram, state->spriteram, state->spriteram_size);
397499}
src/mame/video/shootout.c
r10613r10614
9595{
9696   shootout_state *state = machine->driver_data<shootout_state>();
9797   UINT8 *spriteram = state->spriteram;
98   static int bFlicker;
9998   const gfx_element *gfx = machine->gfx[1];
10099   const UINT8 *source = spriteram+127*4;
101100   int count;
102101
103   bFlicker = !bFlicker;
102   state->bFlicker = !state->bFlicker;
104103
105104   for( count=0; count<128; count++ )
106105   {
r10613r10614
115114            -------x    enable
116115        */
117116      if ( attributes & 0x01 ){ /* visible */
118         if( bFlicker || (attributes&0x02)==0 ){
117         if( state->bFlicker || (attributes&0x02)==0 ){
119118            int priority_mask = (attributes&0x08)?0x2:0;
120119            int sx = (240 - source[2])&0xff;
121120            int sy = (240 - source[0])&0xff;
src/mame/video/terracre.c
r10613r10614
99#include "emu.h"
1010#include "includes/terracre.h"
1111
12static UINT16 xscroll;
13static UINT16 yscroll;
14static tilemap_t *background, *foreground;
1512
16UINT16 *amazon_videoram;
17
1813static
1914TILE_GET_INFO( get_bg_tile_info )
2015{
16   terracre_state *state = machine->driver_data<terracre_state>();
2117   /* xxxx.----.----.----
2218     * ----.xx--.----.----
2319     * ----.--xx.xxxx.xxxx */
24   unsigned data = amazon_videoram[tile_index];
20   unsigned data = state->amazon_videoram[tile_index];
2521   unsigned color = data>>11;
2622   SET_TILE_INFO( 1,data&0x3ff,color,0 );
2723}
r10613r10614
156152
157153WRITE16_HANDLER( amazon_background_w )
158154{
159   COMBINE_DATA( &amazon_videoram[offset] );
160   tilemap_mark_tile_dirty( background, offset );
155   terracre_state *state = space->machine->driver_data<terracre_state>();
156   COMBINE_DATA( &state->amazon_videoram[offset] );
157   tilemap_mark_tile_dirty( state->background, offset );
161158}
162159
163160WRITE16_HANDLER( amazon_foreground_w )
r10613r10614
165162   terracre_state *state = space->machine->driver_data<terracre_state>();
166163   UINT16 *videoram = state->videoram;
167164   COMBINE_DATA( &videoram[offset] );
168   tilemap_mark_tile_dirty( foreground, offset );
165   tilemap_mark_tile_dirty( state->foreground, offset );
169166}
170167
171168WRITE16_HANDLER( amazon_flipscreen_w )
r10613r10614
180177
181178WRITE16_HANDLER( amazon_scrolly_w )
182179{
183   COMBINE_DATA(&yscroll);
184   tilemap_set_scrolly(background,0,yscroll);
180   terracre_state *state = space->machine->driver_data<terracre_state>();
181   COMBINE_DATA(&state->yscroll);
182   tilemap_set_scrolly(state->background,0,state->yscroll);
185183}
186184
187185WRITE16_HANDLER( amazon_scrollx_w )
188186{
189   COMBINE_DATA(&xscroll);
190   tilemap_set_scrollx(background,0,xscroll);
187   terracre_state *state = space->machine->driver_data<terracre_state>();
188   COMBINE_DATA(&state->xscroll);
189   tilemap_set_scrollx(state->background,0,state->xscroll);
191190}
192191
193192VIDEO_START( amazon )
194193{
195   background = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols,16,16,64,32);
196   foreground = tilemap_create(machine, get_fg_tile_info,tilemap_scan_cols,8,8,64,32);
197   tilemap_set_transparent_pen(foreground,0xf);
194   terracre_state *state = machine->driver_data<terracre_state>();
195   state->background = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols,16,16,64,32);
196   state->foreground = tilemap_create(machine, get_fg_tile_info,tilemap_scan_cols,8,8,64,32);
197   tilemap_set_transparent_pen(state->foreground,0xf);
198198
199199   /* register for saving */
200   state_save_register_global(machine, xscroll);
201   state_save_register_global(machine, yscroll);
200   state_save_register_global(machine, state->xscroll);
201   state_save_register_global(machine, state->yscroll);
202202}
203203
204204SCREEN_UPDATE( amazon )
205205{
206   if( xscroll&0x2000 )
206   terracre_state *state = screen->machine->driver_data<terracre_state>();
207   if( state->xscroll&0x2000 )
207208      bitmap_fill( bitmap,cliprect ,get_black_pen(screen->machine));
208209   else
209      tilemap_draw( bitmap,cliprect, background, 0, 0 );
210      tilemap_draw( bitmap,cliprect, state->background, 0, 0 );
210211
211212   draw_sprites(screen->machine, bitmap,cliprect );
212   tilemap_draw( bitmap,cliprect, foreground, 0, 0 );
213   tilemap_draw( bitmap,cliprect, state->foreground, 0, 0 );
213214   return 0;
214215}
src/mame/video/amiga.c
r10613r10614
259259      word0 = (word0 >> 1) & 0xff;
260260      if (word0 >= min)
261261      {
262         if (delay[word0] == 0)
262         if (delay[word0] == 0)
263263         {
264264            if (LOG_COPPER)
265265               logerror("%02X.%02X: Write to %s = %04x\n", state->last_scanline, xpos / 2, amiga_custom_names[word0 & 0xff], word1);
src/mame/video/argus.c
r10613r10614
914914      {
915915         int step=state->mosaic;
916916         UINT32 *dest;
917         int x,y,xx,yy;
917         int x,y,xx,yy,c=0;
918918         int width = screen.width();
919919         int height = screen.height();
920920
r10613r10614
923923         for (y=0;y<width+step;y+=step)
924924            for (x=0;x<height+step;x+=step)
925925            {
926               static int c=0;
927
928               if (y<height && x< width)
926               if (y < height && x < width)
929927                  c=*BITMAP_ADDR32(state->mosaicbitmap, y, x);
930928
931929               if (state->mosaic<0)
r10613r10614
958956      tilemap_draw(state->mosaicbitmap, cliprect, state->bg1_tilemap, 0, 0);
959957      {
960958         UINT32 *dest;
961         int x,y,xx,yy;
959         int x,y,xx,yy,c=0;
962960         int width = screen.width();
963961         int height = screen.height();
964962
965963         for (y = 0; y < width+step; y += step)
966964            for (x = 0; x < height+step; x += step)
967965            {
968               static int c = 0;
969
970966               if (y < height && x < width)
971967                  c = *BITMAP_ADDR32(state->mosaicbitmap, y, x);
972968
src/mame/video/punchout.c
r10613r10614
1010#include "includes/punchout.h"
1111
1212
13static tilemap_t *bg_top_tilemap;
14static tilemap_t *bg_bot_tilemap;
15static tilemap_t *fg_tilemap;   // bottom only
16
17static tilemap_t *spr1_tilemap;
18static tilemap_t *spr1_tilemap_flipx;
19static tilemap_t *spr2_tilemap;
20
21UINT8 *punchout_bg_top_videoram;
22UINT8 *punchout_bg_bot_videoram;
23UINT8 *armwrest_fg_videoram;
24UINT8 *punchout_spr1_videoram;
25UINT8 *punchout_spr2_videoram;
26UINT8 *punchout_spr1_ctrlram;
27UINT8 *punchout_spr2_ctrlram;
28UINT8 *punchout_palettebank;
29
30
31
32/* these depend on jumpers(?) on the board and change from game to game */
33static int palette_reverse_top, palette_reverse_bot;
34
35
3613DRIVER_INIT( punchout )
3714{
38   palette_reverse_top = 0x00;
39   palette_reverse_bot = 0xff;
15   punchout_state *state = machine->driver_data<punchout_state>();
16   state->palette_reverse_top = 0x00;
17   state->palette_reverse_bot = 0xff;
4018}
4119
4220DRIVER_INIT( spnchout )
4321{
44   palette_reverse_top = 0x00;
45   palette_reverse_bot = 0xff;
22   punchout_state *state = machine->driver_data<punchout_state>();
23   state->palette_reverse_top = 0x00;
24   state->palette_reverse_bot = 0xff;
4625}
4726
4827DRIVER_INIT( spnchotj )
4928{
50   palette_reverse_top = 0xff;
51   palette_reverse_bot = 0xff;
29   punchout_state *state = machine->driver_data<punchout_state>();
30   state->palette_reverse_top = 0xff;
31   state->palette_reverse_bot = 0xff;
5232}
5333
5434DRIVER_INIT( armwrest )
5535{
56   palette_reverse_top = 0x00;
57   palette_reverse_bot = 0x00;
36   punchout_state *state = machine->driver_data<punchout_state>();
37   state->palette_reverse_top = 0x00;
38   state->palette_reverse_bot = 0x00;
5839}
5940
6041
r10613r10614
6849
6950static TILE_GET_INFO( top_get_info )
7051{
71   int attr = punchout_bg_top_videoram[tile_index*2 + 1];
72   int code = punchout_bg_top_videoram[tile_index*2] + ((attr & 0x03) << 8);
52   punchout_state *state = machine->driver_data<punchout_state>();
53   int attr = state->bg_top_videoram[tile_index*2 + 1];
54   int code = state->bg_top_videoram[tile_index*2] + ((attr & 0x03) << 8);
7355   int color = ((attr & 0x7c) >> 2);
7456   int flipx = attr & 0x80;
7557   SET_TILE_INFO(0, code, color, flipx ? TILE_FLIPX : 0);
r10613r10614
7759
7860static TILE_GET_INFO( armwrest_top_get_info )
7961{
80   int attr = punchout_bg_top_videoram[tile_index*2 + 1];
81   int code = punchout_bg_top_videoram[tile_index*2] + ((attr & 0x03) << 8) + ((attr & 0x80) << 3);
62   punchout_state *state = machine->driver_data<punchout_state>();
63   int attr = state->bg_top_videoram[tile_index*2 + 1];
64   int code = state->bg_top_videoram[tile_index*2] + ((attr & 0x03) << 8) + ((attr & 0x80) << 3);
8265   int color = ((attr & 0x7c) >> 2);
8366   SET_TILE_INFO(0, code, color, 0);
8467}
8568
8669static TILE_GET_INFO( bot_get_info )
8770{
88   int attr = punchout_bg_bot_videoram[tile_index*2 + 1];
89   int code = punchout_bg_bot_videoram[tile_index*2] + ((attr & 0x03) << 8);
71   punchout_state *state = machine->driver_data<punchout_state>();
72   int attr = state->bg_bot_videoram[tile_index*2 + 1];
73   int code = state->bg_bot_videoram[tile_index*2] + ((attr & 0x03) << 8);
9074   int color = ((attr & 0x7c) >> 2);
9175   int flipx = attr & 0x80;
9276   SET_TILE_INFO(1, code, color, flipx ? TILE_FLIPX : 0);
r10613r10614
9478
9579static TILE_GET_INFO( armwrest_bot_get_info )
9680{
97   int attr = punchout_bg_bot_videoram[tile_index*2 + 1];
98   int code = punchout_bg_bot_videoram[tile_index*2] + ((attr & 0x03) << 8);
81   punchout_state *state = machine->driver_data<punchout_state>();
82   int attr = state->bg_bot_videoram[tile_index*2 + 1];
83   int code = state->bg_bot_videoram[tile_index*2] + ((attr & 0x03) << 8);
9984   int color = ((attr & 0x7c) >> 2) + 0x40;
10085   int flipx = attr & 0x80;
10186   SET_TILE_INFO(0, code, color, flipx ? TILE_FLIPX : 0);
r10613r10614
10388
10489static TILE_GET_INFO( bs1_get_info )
10590{
106   int attr = punchout_spr1_videoram[tile_index*4 + 3];
107   int code = punchout_spr1_videoram[tile_index*4] + ((punchout_spr1_videoram[tile_index*4 + 1] & 0x1f) << 8);
91   punchout_state *state = machine->driver_data<punchout_state>();
92   int attr = state->spr1_videoram[tile_index*4 + 3];
93   int code = state->spr1_videoram[tile_index*4] + ((state->spr1_videoram[tile_index*4 + 1] & 0x1f) << 8);
10894   int color = attr & 0x1f;
10995   int flipx = attr & 0x80;
11096   SET_TILE_INFO(2, code, color, flipx ? TILE_FLIPX : 0);
r10613r10614
11298
11399static TILE_GET_INFO( bs2_get_info )
114100{
115   int attr = punchout_spr2_videoram[tile_index*4 + 3];
116   int code = punchout_spr2_videoram[tile_index*4] + ((punchout_spr2_videoram[tile_index*4 + 1] & 0x0f) << 8);
101   punchout_state *state = machine->driver_data<punchout_state>();
102   int attr = state->spr2_videoram[tile_index*4 + 3];
103   int code = state->spr2_videoram[tile_index*4] + ((state->spr2_videoram[tile_index*4 + 1] & 0x0f) << 8);
117104   int color = attr & 0x3f;
118105   int flipx = attr & 0x80;
119106   SET_TILE_INFO(3, code, color, flipx ? TILE_FLIPX : 0);
r10613r10614
121108
122109static TILE_GET_INFO( armwrest_fg_get_info )
123110{
124   int attr = armwrest_fg_videoram[tile_index*2 + 1];
125   int code = armwrest_fg_videoram[tile_index*2] + 256 * (attr & 0x07);
111   punchout_state *state = machine->driver_data<punchout_state>();
112   int attr = state->armwrest_fg_videoram[tile_index*2 + 1];
113   int code = state->armwrest_fg_videoram[tile_index*2] + 256 * (attr & 0x07);
126114   int color = ((attr & 0xf8) >> 3);
127115   int flipx = attr & 0x80;
128116   SET_TILE_INFO(1, code, color, flipx ? TILE_FLIPX : 0);
r10613r10614
144132
145133VIDEO_START( punchout )
146134{
147   bg_top_tilemap = tilemap_create(machine, top_get_info, tilemap_scan_rows,  8,8, 32,32);
148   bg_bot_tilemap = tilemap_create(machine, bot_get_info, tilemap_scan_rows,  8,8, 64,32);
149   tilemap_set_scroll_rows(bg_bot_tilemap, 32);
135   punchout_state *state = machine->driver_data<punchout_state>();
136   state->bg_top_tilemap = tilemap_create(machine, top_get_info, tilemap_scan_rows,  8,8, 32,32);
137   state->bg_bot_tilemap = tilemap_create(machine, bot_get_info, tilemap_scan_rows,  8,8, 64,32);
138   tilemap_set_scroll_rows(state->bg_bot_tilemap, 32);
150139
151   spr1_tilemap = tilemap_create(machine, bs1_get_info, tilemap_scan_rows,  8,8, 16,32);
152   spr2_tilemap = tilemap_create(machine, bs2_get_info, tilemap_scan_rows,  8,8, 16,32);
140   state->spr1_tilemap = tilemap_create(machine, bs1_get_info, tilemap_scan_rows,  8,8, 16,32);
141   state->spr2_tilemap = tilemap_create(machine, bs2_get_info, tilemap_scan_rows,  8,8, 16,32);
153142
154   fg_tilemap = NULL;
143   state->fg_tilemap = NULL;
155144
156   tilemap_set_transparent_pen(spr1_tilemap, 0x07);
157   tilemap_set_transparent_pen(spr2_tilemap, 0x03);
145   tilemap_set_transparent_pen(state->spr1_tilemap, 0x07);
146   tilemap_set_transparent_pen(state->spr2_tilemap, 0x03);
158147}
159148
160149
161150VIDEO_START( armwrest )
162151{
163   bg_top_tilemap = tilemap_create(machine, armwrest_top_get_info, tilemap_scan_rows,  8,8, 32,32);
164   bg_bot_tilemap = tilemap_create(machine, armwrest_bot_get_info, tilemap_scan_rows,  8,8, 32,32);
152   punchout_state *state = machine->driver_data<punchout_state>();
153   state->bg_top_tilemap = tilemap_create(machine, armwrest_top_get_info, tilemap_scan_rows,  8,8, 32,32);
154   state->bg_bot_tilemap = tilemap_create(machine, armwrest_bot_get_info, tilemap_scan_rows,  8,8, 32,32);
165155
166   spr1_tilemap =       tilemap_create(machine, bs1_get_info, armwrest_bs1_scan,  8,8, 32,16);
167   spr1_tilemap_flipx = tilemap_create(machine, bs1_get_info, armwrest_bs1_scan_flipx,  8,8, 32,16);
168   spr2_tilemap = tilemap_create(machine, bs2_get_info, tilemap_scan_rows,  8,8, 16,32);
169   fg_tilemap = tilemap_create(machine, armwrest_fg_get_info, tilemap_scan_rows,  8,8, 32,32);
156   state->spr1_tilemap =       tilemap_create(machine, bs1_get_info, armwrest_bs1_scan,  8,8, 32,16);
157   state->spr1_tilemap_flipx = tilemap_create(machine, bs1_get_info, armwrest_bs1_scan_flipx,  8,8, 32,16);
158   state->spr2_tilemap = tilemap_create(machine, bs2_get_info, tilemap_scan_rows,  8,8, 16,32);
159   state->fg_tilemap = tilemap_create(machine, armwrest_fg_get_info, tilemap_scan_rows,  8,8, 32,32);
170160
171   tilemap_set_transparent_pen(spr1_tilemap, 0x07);
172   tilemap_set_transparent_pen(spr1_tilemap_flipx, 0x07);
173   tilemap_set_transparent_pen(spr2_tilemap, 0x03);
174   tilemap_set_transparent_pen(fg_tilemap, 0x07);
161   tilemap_set_transparent_pen(state->spr1_tilemap, 0x07);
162   tilemap_set_transparent_pen(state->spr1_tilemap_flipx, 0x07);
163   tilemap_set_transparent_pen(state->spr2_tilemap, 0x03);
164   tilemap_set_transparent_pen(state->fg_tilemap, 0x07);
175165}
176166
177167
178168
179169WRITE8_HANDLER( punchout_bg_top_videoram_w )
180170{
181   punchout_bg_top_videoram[offset] = data;
182   tilemap_mark_tile_dirty(bg_top_tilemap, offset/2);
171   punchout_state *state = space->machine->driver_data<punchout_state>();
172   state->bg_top_videoram[offset] = data;
173   tilemap_mark_tile_dirty(state->bg_top_tilemap, offset/2);
183174}
184175
185176WRITE8_HANDLER( punchout_bg_bot_videoram_w )
186177{
187   punchout_bg_bot_videoram[offset] = data;
188   tilemap_mark_tile_dirty(bg_bot_tilemap, offset/2);
178   punchout_state *state = space->machine->driver_data<punchout_state>();
179   state->bg_bot_videoram[offset] = data;
180   tilemap_mark_tile_dirty(state->bg_bot_tilemap, offset/2);
189181}
190182
191183WRITE8_HANDLER( armwrest_fg_videoram_w )
192184{
193   armwrest_fg_videoram[offset] = data;
194   tilemap_mark_tile_dirty(fg_tilemap, offset/2);
185   punchout_state *state = space->machine->driver_data<punchout_state>();
186   state->armwrest_fg_videoram[offset] = data;
187   tilemap_mark_tile_dirty(state->fg_tilemap, offset/2);
195188}
196189
197190WRITE8_HANDLER( punchout_spr1_videoram_w )
198191{
199   punchout_spr1_videoram[offset] = data;
200   tilemap_mark_tile_dirty(spr1_tilemap, offset/4);
201   if (spr1_tilemap_flipx)
202      tilemap_mark_tile_dirty(spr1_tilemap_flipx, offset/4);
192   punchout_state *state = space->machine->driver_data<punchout_state>();
193   state->spr1_videoram[offset] = data;
194   tilemap_mark_tile_dirty(state->spr1_tilemap, offset/4);
195   if (state->spr1_tilemap_flipx)
196      tilemap_mark_tile_dirty(state->spr1_tilemap_flipx, offset/4);
203197}
204198
205199WRITE8_HANDLER( punchout_spr2_videoram_w )
206200{
207   punchout_spr2_videoram[offset] = data;
208   tilemap_mark_tile_dirty(spr2_tilemap, offset/4);
201   punchout_state *state = space->machine->driver_data<punchout_state>();
202   state->spr2_videoram[offset] = data;
203   tilemap_mark_tile_dirty(state->spr2_tilemap, offset/4);
209204}
210205
211206
212207
213static void draw_big_sprite(bitmap_t *bitmap, const rectangle *cliprect, int palette)
208static void draw_big_sprite(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int palette)
214209{
210   punchout_state *state = machine->driver_data<punchout_state>();
215211   int zoom;
216212
217   zoom = punchout_spr1_ctrlram[0] + 256 * (punchout_spr1_ctrlram[1] & 0x0f);
213   zoom = state->spr1_ctrlram[0] + 256 * (state->spr1_ctrlram[1] & 0x0f);
218214   if (zoom)
219215   {
220216      int sx,sy;
221217      UINT32 startx,starty;
222218      int incxx,incyy;
223219
224      sx = 4096 - (punchout_spr1_ctrlram[2] + 256 * (punchout_spr1_ctrlram[3] & 0x0f));
220      sx = 4096 - (state->spr1_ctrlram[2] + 256 * (state->spr1_ctrlram[3] & 0x0f));
225221      if (sx > 4096-4*127) sx -= 4096;
226222
227      sy = -(punchout_spr1_ctrlram[4] + 256 * (punchout_spr1_ctrlram[5] & 1));
223      sy = -(state->spr1_ctrlram[4] + 256 * (state->spr1_ctrlram[5] & 1));
228224      if (sy <= -256 + zoom/0x40) sy += 512;
229225      sy += 12;
230226
r10613r10614
236232      startx += 3740 * zoom;   /* adjustment to match the screen shots */
237233      starty -= 178 * zoom;   /* and make the hall of fame picture nice */
238234
239      if (punchout_spr1_ctrlram[6] & 1)   /* flip x */
235      if (state->spr1_ctrlram[6] & 1)   /* flip x */
240236      {
241237         startx = ((16 * 8) << 16) - startx - 1;
242238         incxx = -incxx;
243239      }
244240
245      tilemap_set_palette_offset(spr1_tilemap, 0x100 * palette);
241      tilemap_set_palette_offset(state->spr1_tilemap, 0x100 * palette);
246242
247      tilemap_draw_roz(bitmap,cliprect,spr1_tilemap,
243      tilemap_draw_roz(bitmap,cliprect,state->spr1_tilemap,
248244         startx,starty + 0x200*(2) * zoom,
249245         incxx,0,0,incyy,   /* zoom, no rotation */
250246         0,   /* no wraparound */
r10613r10614
253249}
254250
255251
256static void armwrest_draw_big_sprite(bitmap_t *bitmap, const rectangle *cliprect, int palette)
252static void armwrest_draw_big_sprite(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int palette)
257253{
254   punchout_state *state = machine->driver_data<punchout_state>();
258255   int zoom;
259256
260   zoom = punchout_spr1_ctrlram[0] + 256 * (punchout_spr1_ctrlram[1] & 0x0f);
257   zoom = state->spr1_ctrlram[0] + 256 * (state->spr1_ctrlram[1] & 0x0f);
261258   if (zoom)
262259   {
263260      int sx,sy;
r10613r10614
265262      int incxx,incyy;
266263      tilemap_t *_tilemap;
267264
268      sx = 4096 - (punchout_spr1_ctrlram[2] + 256 * (punchout_spr1_ctrlram[3] & 0x0f));
265      sx = 4096 - (state->spr1_ctrlram[2] + 256 * (state->spr1_ctrlram[3] & 0x0f));
269266      if (sx > 2048) sx -= 4096;
270267
271      sy = -(punchout_spr1_ctrlram[4] + 256 * (punchout_spr1_ctrlram[5] & 1));
268      sy = -(state->spr1_ctrlram[4] + 256 * (state->spr1_ctrlram[5] & 1));
272269      if (sy <= -256 + zoom/0x40) sy += 512;
273270      sy += 12;
274271
r10613r10614
280277      startx += 3740 * zoom;   /* adjustment to match the screen shots */
281278      starty -= 178 * zoom;   /* and make the hall of fame picture nice */
282279
283      if (punchout_spr1_ctrlram[6] & 1)   /* flip x */
280      if (state->spr1_ctrlram[6] & 1)   /* flip x */
284281      {
285         _tilemap = spr1_tilemap_flipx;
282         _tilemap = state->spr1_tilemap_flipx;
286283         startx = ((32 * 8) << 16) - startx - 1;
287284         incxx = -incxx;
288285      }
289286      else
290         _tilemap = spr1_tilemap;
287         _tilemap = state->spr1_tilemap;
291288
292289      tilemap_set_palette_offset(_tilemap, 0x100 * palette);
293290
r10613r10614
301298
302299static void drawbs2(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
303300{
301   punchout_state *state = machine->driver_data<punchout_state>();
304302   int sx,sy;
305303   int incxx;
306304
307   sx = 512 - (punchout_spr2_ctrlram[0] + 256 * (punchout_spr2_ctrlram[1] & 1));
305   sx = 512 - (state->spr2_ctrlram[0] + 256 * (state->spr2_ctrlram[1] & 1));
308306   if (sx > 512-127) sx -= 512;
309307   sx -= 55;   /* adjustment to match the screen shots */
310308
311   sy = -punchout_spr2_ctrlram[2] + 256 * (punchout_spr2_ctrlram[3] & 1);
309   sy = -state->spr2_ctrlram[2] + 256 * (state->spr2_ctrlram[3] & 1);
312310   sy += 3;   /* adjustment to match the screen shots */
313311
314312   sx = -sx << 16;
315313   sy = -sy << 16;
316314
317   if (punchout_spr2_ctrlram[4] & 1)   /* flip x */
315   if (state->spr2_ctrlram[4] & 1)   /* flip x */
318316   {
319317      sx = ((16 * 8) << 16) - sx - 1;
320318      incxx = -1;
r10613r10614
323321      incxx = 1;
324322
325323   // this tilemap doesn't actually zoom, but draw_roz is the only way to draw it without wraparound
326   tilemap_draw_roz(bitmap,cliprect,spr2_tilemap,
324   tilemap_draw_roz(bitmap,cliprect,state->spr2_tilemap,
327325      sx, sy, incxx << 16, 0, 0, 1 << 16,
328326      0, 0, 0);
329327}
r10613r10614
332330
333331static void punchout_copy_top_palette(running_machine *machine, int bank)
334332{
333   punchout_state *state = machine->driver_data<punchout_state>();
335334   int i;
336335   const UINT8 *color_prom = machine->region("proms")->base();
337336
r10613r10614
345344      g = 255 - pal4bit(color_prom[i + 0x200 + base]);
346345      b = 255 - pal4bit(color_prom[i + 0x400 + base]);
347346
348      palette_set_color(machine, i ^ palette_reverse_top, MAKE_RGB(r, g, b));
347      palette_set_color(machine, i ^ state->palette_reverse_top, MAKE_RGB(r, g, b));
349348   }
350349}
351350
352351static void punchout_copy_bot_palette(running_machine *machine, int bank)
353352{
353   punchout_state *state = machine->driver_data<punchout_state>();
354354   int i;
355355   const UINT8 *color_prom = machine->region("proms")->base() + 0x600;
356356
r10613r10614
364364      g = 255 - pal4bit(color_prom[i + 0x200 + base]);
365365      b = 255 - pal4bit(color_prom[i + 0x400 + base]);
366366
367      palette_set_color(machine, (i ^ palette_reverse_bot) + 0x100, MAKE_RGB(r, g, b));
367      palette_set_color(machine, (i ^ state->palette_reverse_bot) + 0x100, MAKE_RGB(r, g, b));
368368   }
369369}
370370
371371
372372SCREEN_UPDATE( punchout )
373373{
374   punchout_state *state = screen->machine->driver_data<punchout_state>();
374375   device_t *top_screen    = screen->machine->device("top");
375376   device_t *bottom_screen = screen->machine->device("bottom");
376377
377378   if (screen == top_screen)
378379   {
379      punchout_copy_top_palette(screen->machine, BIT(*punchout_palettebank,1));
380      punchout_copy_top_palette(screen->machine, BIT(*state->palettebank,1));
380381
381      tilemap_draw(bitmap, cliprect, bg_top_tilemap, 0, 0);
382      tilemap_draw(bitmap, cliprect, state->bg_top_tilemap, 0, 0);
382383
383      if (punchout_spr1_ctrlram[7] & 1)   /* display in top monitor */
384         draw_big_sprite(bitmap, cliprect, 0);
384      if (state->spr1_ctrlram[7] & 1)   /* display in top monitor */
385         draw_big_sprite(screen->machine, bitmap, cliprect, 0);
385386   }
386387   else if (screen == bottom_screen)
387388   {
388389      int offs;
389390
390      punchout_copy_bot_palette(screen->machine, BIT(*punchout_palettebank,0));
391      punchout_copy_bot_palette(screen->machine, BIT(*state->palettebank,0));
391392
392393      /* copy the character mapped graphics */
393394      for (offs = 0;offs < 32;offs++)
394         tilemap_set_scrollx(bg_bot_tilemap, offs, 58 + punchout_bg_bot_videoram[2*offs] + 256 * (punchout_bg_bot_videoram[2*offs + 1] & 0x01));
395         tilemap_set_scrollx(state->bg_bot_tilemap, offs, 58 + state->bg_bot_videoram[2*offs] + 256 * (state->bg_bot_videoram[2*offs + 1] & 0x01));
395396
396      tilemap_draw(bitmap, cliprect, bg_bot_tilemap, 0, 0);
397      tilemap_draw(bitmap, cliprect, state->bg_bot_tilemap, 0, 0);
397398
398      if (punchout_spr1_ctrlram[7] & 2)   /* display in bottom monitor */
399         draw_big_sprite(bitmap, cliprect, 1);
399      if (state->spr1_ctrlram[7] & 2)   /* display in bottom monitor */
400         draw_big_sprite(screen->machine, bitmap, cliprect, 1);
400401      drawbs2(screen->machine, bitmap, cliprect);
401402   }
402403   return 0;
r10613r10614
405406
406407SCREEN_UPDATE( armwrest )
407408{
409   punchout_state *state = screen->machine->driver_data<punchout_state>();
408410   device_t *top_screen    = screen->machine->device("top");
409411   device_t *bottom_screen = screen->machine->device("bottom");
410412
411413   if (screen == top_screen)
412414   {
413      punchout_copy_top_palette(screen->machine, BIT(*punchout_palettebank,1));
415      punchout_copy_top_palette(screen->machine, BIT(*state->palettebank,1));
414416
415      tilemap_draw(bitmap, cliprect, bg_top_tilemap, 0, 0);
417      tilemap_draw(bitmap, cliprect, state->bg_top_tilemap, 0, 0);
416418
417      if (punchout_spr1_ctrlram[7] & 1)   /* display in top monitor */
418         armwrest_draw_big_sprite(bitmap, cliprect, 0);
419      if (state->spr1_ctrlram[7] & 1)   /* display in top monitor */
420         armwrest_draw_big_sprite(screen->machine, bitmap, cliprect, 0);
419421   }
420422   else if (screen == bottom_screen)
421423   {
422      punchout_copy_bot_palette(screen->machine, BIT(*punchout_palettebank,0));
424      punchout_copy_bot_palette(screen->machine, BIT(*state->palettebank,0));
423425
424      tilemap_draw(bitmap, cliprect, bg_bot_tilemap, 0, 0);
426      tilemap_draw(bitmap, cliprect, state->bg_bot_tilemap, 0, 0);
425427
426      if (punchout_spr1_ctrlram[7] & 2)   /* display in bottom monitor */
427         armwrest_draw_big_sprite(bitmap, cliprect, 1);
428      if (state->spr1_ctrlram[7] & 2)   /* display in bottom monitor */
429         armwrest_draw_big_sprite(screen->machine, bitmap, cliprect, 1);
428430      drawbs2(screen->machine, bitmap, cliprect);
429431
430      tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
432      tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
431433   }
432434   return 0;
433435}
src/mame/video/xorworld.c
r10613r10614
11#include "emu.h"
22#include "includes/xorworld.h"
33
4static tilemap_t *bg_tilemap;
54
65/***************************************************************************
76
r10613r10614
5453   xorworld_state *state = space->machine->driver_data<xorworld_state>();
5554   UINT16 *videoram = state->videoram;
5655   COMBINE_DATA(&videoram[offset]);
57   tilemap_mark_tile_dirty(bg_tilemap, offset);
56   tilemap_mark_tile_dirty(state->bg_tilemap, offset);
5857}
5958
6059/*
r10613r10614
7978
8079VIDEO_START( xorworld )
8180{
82   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
81   xorworld_state *state = machine->driver_data<xorworld_state>();
82   state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
8383       8, 8, 32, 32);
8484}
8585
r10613r10614
114114
115115SCREEN_UPDATE( xorworld )
116116{
117   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
117   xorworld_state *state = screen->machine->driver_data<xorworld_state>();
118   tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
118119   draw_sprites(screen->machine, bitmap, cliprect);
119120   return 0;
120121}
src/mame/video/dkong.c
r10613r10614
719719     * TRS1 board states 3.3u.
720720     */
721721
722   static double cv1=0,cv2=0,vg1=0,vg2=0,vg3=0,cv3=0,cv4=0;
723722   double vg3i;
724   static int pixelcnt = 0;
725723   double diff;
726724   int sig;
727725
r10613r10614
750748      state->rflip_sig = !state->rflip_sig;
751749
752750   if  (sig) /*  128VF */
753      diff = (0.0 - cv1);
751      diff = (0.0 - state->cv1);
754752   else
755      diff = (3.4 - cv1);
753      diff = (3.4 - state->cv1);
756754   diff = diff - diff*exp(0.0 - (1.0/RC1 * dt) );
757   cv1 += diff;
755   state->cv1 += diff;
758756
759   diff = (cv1 - cv2 - vg1);
757   diff = (state->cv1 - state->cv2 - state->vg1);
760758   diff = diff - diff*exp(0.0 - (1.0/RC2 * dt) );
761   cv2 += diff;
759   state->cv2 += diff;
762760
763   vg1 = (cv1 - cv2)*0.9 + 0.1 * vg2;
764   vg2 = 5*CD4049(machine, vg1/5);
761   state->vg1 = (state->cv1 - state->cv2)*0.9 + 0.1 * state->vg2;
762   state->vg2 = 5*CD4049(machine, state->vg1/5);
765763
766764   /* on the real hardware, the gain would be 1.
767765     * This will not work here.
768766     */
769   vg3i = 0.9*vg2 + 0.1 * vg3;
770   vg3 = 5*CD4049(machine, vg3i/5);
767   vg3i = 0.9*state->vg2 + 0.1 * state->vg3;
768   state->vg3 = 5*CD4049(machine, vg3i/5);
771769
772   state->blue_level = (int)(vg3/5.0*255);
770   state->blue_level = (int)(state->vg3/5.0*255);
773771
774772   /*
775773     * Grid signal
r10613r10614
778776     */
779777   if (state->grid_on && latch8_bit5_r(state->dev_vp2, 0))
780778   {
781      diff = (0.0 - cv3);
779      diff = (0.0 - state->cv3);
782780      diff = diff - diff*exp(0.0 - (1.0/RC32 * dt) );
783781   }
784782   else
785783   {
786      diff = (5.0 - cv3);
784      diff = (5.0 - state->cv3);
787785      diff = diff - diff*exp(0.0 - (1.0/RC31 * dt) );
788786   }
789   cv3 += diff;
787   state->cv3 += diff;
790788
791   diff = (vg2 - 0.8 * cv3 - cv4);
789   diff = (state->vg2 - 0.8 * state->cv3 - state->cv4);
792790   diff = diff - diff*exp(0.0 - (1.0/RC4 * dt) );
793   cv4 += diff;
791   state->cv4 += diff;
794792
795   if (CD4049(machine, CD4049(machine, vg2 - cv4))>2.4/5.0) /* TTL - Level */
793   if (CD4049(machine, CD4049(machine, state->vg2 - state->cv4))>2.4/5.0) /* TTL - Level */
796794      state->grid_sig = 0;
797795   else
798796      state->grid_sig = 1;
799797
800798   /* stars */
801   pixelcnt += HTOTAL;
802   if (pixelcnt > period2 )
799   state->pixelcnt += HTOTAL;
800   if (state->pixelcnt > period2 )
803801   {
804802      state->star_ff = !state->star_ff;
805      pixelcnt = pixelcnt - period2;
803      state->pixelcnt = state->pixelcnt - period2;
806804   }
807805
808806}
r10613r10614
842840   int       table_len = state->gfx3_len;
843841   int          x,y,offset;
844842   UINT16         *pixel;
845   static int      counter=0;
846843   const rectangle &visarea = machine->primary_screen->visible_area();
847844
848845   y = scanline;
849846   radarscp_step(machine, y);
850847   if (y <= visarea.min_y || y > visarea.max_y)
851      counter = 0;
848      state->counter = 0;
852849   offset = (state->flip ^ state->rflip_sig) ? 0x000 : 0x400;
853850   x = 0;
854851   while (x < machine->primary_screen->width())
855852   {
856853      pixel = BITMAP_ADDR16(state->bg_bits, y, x);
857      if ((counter < table_len) && (x == 4 * (table[counter|offset] & 0x7f)))
854      if ((state->counter < table_len) && (x == 4 * (table[state->counter|offset] & 0x7f)))
858855      {
859         if ( state->star_ff && (table[counter|offset] & 0x80) )   /* star */
856         if ( state->star_ff && (table[state->counter|offset] & 0x80) )   /* star */
860857            *pixel = RADARSCP_STAR_COL;
861         else if (state->grid_sig && !(table[counter|offset] & 0x80))         /* radar */
858         else if (state->grid_sig && !(table[state->counter|offset] & 0x80))         /* radar */
862859            *pixel = RADARSCP_GRID_COL_OFFSET+state->grid_col;
863860         else
864861            *pixel = RADARSCP_BCK_COL_OFFSET + state->blue_level;
865         counter++;
862         state->counter++;
866863      }
867864      else
868865         *pixel = RADARSCP_BCK_COL_OFFSET + state->blue_level;
869866      x++;
870867   }
871   while ((counter < table_len) && ( x < 4 * (table[counter|offset] & 0x7f)))
872      counter++;
868   while ((state->counter < table_len) && ( x < 4 * (table[state->counter|offset] & 0x7f)))
869      state->counter++;
873870}
874871
875872static TIMER_CALLBACK( scanline_callback )
src/mame/video/20pacgal.c
r10613r10614
434434   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
435435   MCFG_SCREEN_SIZE(SCREEN_WIDTH, SCREEN_HEIGHT)
436436   MCFG_SCREEN_VISIBLE_AREA(0, SCREEN_WIDTH - 1, 0, SCREEN_HEIGHT - 1)
437   MCFG_SCREEN_UPDATE(20pacgal)   
437   MCFG_SCREEN_UPDATE(20pacgal)
438438MACHINE_CONFIG_END
src/mame/video/redalert.c
r10613r10614
439439
440440MACHINE_CONFIG_FRAGMENT( demoneye_video )
441441   MCFG_VIDEO_START(redalert)
442   
442
443443   MCFG_SCREEN_ADD("screen", RASTER)
444444   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
445445   MCFG_SCREEN_REFRESH_RATE(60)
r10613r10614
453453MACHINE_CONFIG_FRAGMENT( panther_video )
454454
455455   MCFG_VIDEO_START(ww3)
456   
456
457457   MCFG_SCREEN_ADD("screen", RASTER)
458458   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
459459   MCFG_SCREEN_REFRESH_RATE(60)
src/mame/video/taito_b.c
r10613r10614
213213         zoomy = zoomylatch;
214214
215215         /* Note: like taito_f2.c, this zoom implementation is wrong,
216         chopped up into 16x16 sections instead of one sprite. This
217         is especially visible in rambo3. */
216            chopped up into 16x16 sections instead of one sprite. This
217            is especially visible in rambo3. */
218218
219219         x = xlatch + (x_no * (0xff - zoomx) + 15) / 16;
220220         y = ylatch + (y_no * (0xff - zoomy) + 15) / 16;
src/mame/video/wiping.c
r10613r10614
1111#include "includes/wiping.h"
1212
1313
14static int flipscreen;
15UINT8 *wiping_videoram;
16UINT8 *wiping_colorram;
17
18
1914/***************************************************************************
2015
2116  Convert the color PROMs into a more useable format.
r10613r10614
8681
8782WRITE8_HANDLER( wiping_flipscreen_w )
8883{
89   flipscreen = (data & 1);
84   wiping_state *state = space->machine->driver_data<wiping_state>();
85   state->flipscreen = (data & 1);
9086}
9187
9288
9389SCREEN_UPDATE( wiping )
9490{
91   wiping_state *state = screen->machine->driver_data<wiping_state>();
9592   UINT8 *spriteram = screen->machine->generic.spriteram.u8;
9693   int offs;
9794
r10613r10614
118115         sy = my - 2;
119116      }
120117
121      if (flipscreen)
118      if (state->flipscreen)
122119      {
123120         sx = 35 - sx;
124121         sy = 27 - sy;
125122      }
126123
127124      drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],
128            wiping_videoram[offs],
129            wiping_colorram[offs] & 0x3f,
130            flipscreen,flipscreen,
125            state->videoram[offs],
126            state->colorram[offs] & 0x3f,
127            state->flipscreen,state->flipscreen,
131128            sx*8,sy*8);
132129   }
133130
r10613r10614
145142      flipy = spriteram[offs] & 0x40;
146143      flipx = spriteram[offs] & 0x80;
147144
148      if (flipscreen)
145      if (state->flipscreen)
149146      {
150147         sy = 208 - sy;
151148         flipx = !flipx;
r10613r10614
163160   /* redraw high priority chars */
164161   for (offs = 0x3ff; offs > 0; offs--)
165162   {
166      if (wiping_colorram[offs] & 0x80)
163      if (state->colorram[offs] & 0x80)
167164      {
168165         int mx,my,sx,sy;
169166
r10613r10614
186183            sy = my - 2;
187184         }
188185
189         if (flipscreen)
186         if (state->flipscreen)
190187         {
191188            sx = 35 - sx;
192189            sy = 27 - sy;
193190         }
194191
195192         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],
196               wiping_videoram[offs],
197               wiping_colorram[offs] & 0x3f,
198               flipscreen,flipscreen,
193               state->videoram[offs],
194               state->colorram[offs] & 0x3f,
195               state->flipscreen,state->flipscreen,
199196               sx*8,sy*8);
200197           }
201198   }
r10613r10614
204201#if 0
205202{
206203   int i,j;
207   extern UINT8 *wiping_soundregs;
208204
209205   for (i = 0;i < 8;i++)
210206   {
211207      for (j = 0;j < 8;j++)
212208      {
213209         char buf[40];
214         sprintf(buf,"%01x",wiping_soundregs[i*8+j]&0xf);
210         sprintf(buf,"%01x",state->soundregs[i*8+j]&0xf);
215211         ui_draw_text(buf,j*10,i*8);
216212      }
217213   }
r10613r10614
221217      for (j = 0;j < 8;j++)
222218      {
223219         char buf[40];
224         sprintf(buf,"%01x",wiping_soundregs[0x2000+i*8+j]>>4);
220         sprintf(buf,"%01x",state->soundregs[0x2000+i*8+j]>>4);
225221         ui_draw_text(buf,j*10,80+i*8);
226222      }
227223   }
src/mame/video/popeye.c
r10613r10614
99#include "emu.h"
1010#include "includes/popeye.h"
1111
12UINT8 *popeye_videoram;
13UINT8 *popeye_colorram;
14UINT8 *popeye_background_pos;
15UINT8 *popeye_palettebank;
16static UINT8 *popeye_bitmapram;
1712static const size_t popeye_bitmapram_size = 0x2000;
1813
19static bitmap_t *tmpbitmap2;
20static UINT8 invertmask;
21static UINT8 bitmap_type;
2214enum { TYPE_SKYSKIPR, TYPE_POPEYE };
2315
24static tilemap_t *fg_tilemap;
2516
26static UINT8 lastflip;
2717
2818/***************************************************************************
2919
r10613r10614
6151***************************************************************************/
6252static void convert_color_prom(running_machine *machine,const UINT8 *color_prom)
6353{
54   popeye_state *state = machine->driver_data<popeye_state>();
6455   int i;
6556
6657
r10613r10614
7465      int bit0,bit1,bit2,r,g,b;
7566
7667      /* red component */
77      bit0 = ((color_prom[prom_offs] ^ invertmask) >> 0) & 0x01;
78      bit1 = ((color_prom[prom_offs] ^ invertmask) >> 1) & 0x01;
79      bit2 = ((color_prom[prom_offs] ^ invertmask) >> 2) & 0x01;
68      bit0 = ((color_prom[prom_offs] ^ state->invertmask) >> 0) & 0x01;
69      bit1 = ((color_prom[prom_offs] ^ state->invertmask) >> 1) & 0x01;
70      bit2 = ((color_prom[prom_offs] ^ state->invertmask) >> 2) & 0x01;
8071      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
8172      /* green component */
82      bit0 = ((color_prom[prom_offs] ^ invertmask) >> 3) & 0x01;
83      bit1 = ((color_prom[prom_offs] ^ invertmask) >> 4) & 0x01;
84      bit2 = ((color_prom[prom_offs] ^ invertmask) >> 5) & 0x01;
73      bit0 = ((color_prom[prom_offs] ^ state->invertmask) >> 3) & 0x01;
74      bit1 = ((color_prom[prom_offs] ^ state->invertmask) >> 4) & 0x01;
75      bit2 = ((color_prom[prom_offs] ^ state->invertmask) >> 5) & 0x01;
8576      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
8677      /* blue component */
8778      bit0 = 0;
88      bit1 = ((color_prom[prom_offs] ^ invertmask) >> 6) & 0x01;
89      bit2 = ((color_prom[prom_offs] ^ invertmask) >> 7) & 0x01;
79      bit1 = ((color_prom[prom_offs] ^ state->invertmask) >> 6) & 0x01;
80      bit2 = ((color_prom[prom_offs] ^ state->invertmask) >> 7) & 0x01;
9081      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
9182
9283      palette_set_color(machine,16 + (2 * i) + 1,MAKE_RGB(r,g,b));
r10613r10614
10192
10293
10394      /* red component */
104      bit0 = ((color_prom[0] ^ invertmask) >> 0) & 0x01;
105      bit1 = ((color_prom[0] ^ invertmask) >> 1) & 0x01;
106      bit2 = ((color_prom[0] ^ invertmask) >> 2) & 0x01;
95      bit0 = ((color_prom[0] ^ state->invertmask) >> 0) & 0x01;
96      bit1 = ((color_prom[0] ^ state->invertmask) >> 1) & 0x01;
97      bit2 = ((color_prom[0] ^ state->invertmask) >> 2) & 0x01;
10798      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
10899      /* green component */
109      bit0 = ((color_prom[0] ^ invertmask) >> 3) & 0x01;
110      bit1 = ((color_prom[256] ^ invertmask) >> 0) & 0x01;
111      bit2 = ((color_prom[256] ^ invertmask) >> 1) & 0x01;
100      bit0 = ((color_prom[0] ^ state->invertmask) >> 3) & 0x01;
101      bit1 = ((color_prom[256] ^ state->invertmask) >> 0) & 0x01;
102      bit2 = ((color_prom[256] ^ state->invertmask) >> 1) & 0x01;
112103      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
113104      /* blue component */
114105      bit0 = 0;
115      bit1 = ((color_prom[256] ^ invertmask) >> 2) & 0x01;
116      bit2 = ((color_prom[256] ^ invertmask) >> 3) & 0x01;
106      bit1 = ((color_prom[256] ^ state->invertmask) >> 2) & 0x01;
107      bit2 = ((color_prom[256] ^ state->invertmask) >> 3) & 0x01;
117108      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
118109
119110      palette_set_color(machine,48+i,MAKE_RGB(r,g,b));
r10613r10614
124115
125116PALETTE_INIT( popeye )
126117{
127   invertmask = 0xff;
118   popeye_state *state = machine->driver_data<popeye_state>();
119   state->invertmask = 0xff;
128120
129121   convert_color_prom(machine,color_prom);
130122}
131123
132124PALETTE_INIT( popeyebl )
133125{
134   invertmask = 0x00;
126   popeye_state *state = machine->driver_data<popeye_state>();
127   state->invertmask = 0x00;
135128
136129   convert_color_prom(machine,color_prom);
137130}
138131
139132static void set_background_palette(running_machine *machine,int bank)
140133{
134   popeye_state *state = machine->driver_data<popeye_state>();
141135   int i;
142136   UINT8 *color_prom = machine->region("proms")->base() + 16 * bank;
143137
r10613r10614
147141      int r,g,b;
148142
149143      /* red component */
150      bit0 = ((*color_prom ^ invertmask) >> 0) & 0x01;
151      bit1 = ((*color_prom ^ invertmask) >> 1) & 0x01;
152      bit2 = ((*color_prom ^ invertmask) >> 2) & 0x01;
144      bit0 = ((*color_prom ^ state->invertmask) >> 0) & 0x01;
145      bit1 = ((*color_prom ^ state->invertmask) >> 1) & 0x01;
146      bit2 = ((*color_prom ^ state->invertmask) >> 2) & 0x01;
153147      r = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
154148      /* green component */
155      bit0 = ((*color_prom ^ invertmask) >> 3) & 0x01;
156      bit1 = ((*color_prom ^ invertmask) >> 4) & 0x01;
157      bit2 = ((*color_prom ^ invertmask) >> 5) & 0x01;
149      bit0 = ((*color_prom ^ state->invertmask) >> 3) & 0x01;
150      bit1 = ((*color_prom ^ state->invertmask) >> 4) & 0x01;
151      bit2 = ((*color_prom ^ state->invertmask) >> 5) & 0x01;
158152      g = 0x1c * bit0 + 0x31 * bit1 + 0x47 * bit2;
159153      /* blue component */
160154      bit0 = 0;
161      bit1 = ((*color_prom ^ invertmask) >> 6) & 0x01;
162      bit2 = ((*color_prom ^ invertmask) >> 7) & 0x01;
163      if (bitmap_type == TYPE_SKYSKIPR)
155      bit1 = ((*color_prom ^ state->invertmask) >> 6) & 0x01;
156      bit2 = ((*color_prom ^ state->invertmask) >> 7) & 0x01;
157      if (state->bitmap_type == TYPE_SKYSKIPR)
164158      {
165159         /* Sky Skipper has different weights */
166160         bit0 = bit1;
r10613r10614
176170
177171WRITE8_HANDLER( popeye_videoram_w )
178172{
179   popeye_videoram[offset] = data;
180   tilemap_mark_tile_dirty(fg_tilemap, offset);
173   popeye_state *state = space->machine->driver_data<popeye_state>();
174   state->videoram[offset] = data;
175   tilemap_mark_tile_dirty(state->fg_tilemap, offset);
181176}
182177
183178WRITE8_HANDLER( popeye_colorram_w )
184179{
185   popeye_colorram[offset] = data;
186   tilemap_mark_tile_dirty(fg_tilemap, offset);
180   popeye_state *state = space->machine->driver_data<popeye_state>();
181   state->colorram[offset] = data;
182   tilemap_mark_tile_dirty(state->fg_tilemap, offset);
187183}
188184
189185WRITE8_HANDLER( popeye_bitmap_w )
190186{
187   popeye_state *state = space->machine->driver_data<popeye_state>();
191188   int sx,sy,x,y,colour;
192189
193   popeye_bitmapram[offset] = data;
190   state->bitmapram[offset] = data;
194191
195   if (bitmap_type == TYPE_SKYSKIPR)
192   if (state->bitmap_type == TYPE_SKYSKIPR)
196193   {
197194      sx = 8 * (offset % 128);
198195      sy = 8 * (offset / 128);
r10613r10614
205202      {
206203         for (x = 0; x < 8; x++)
207204         {
208            *BITMAP_ADDR16(tmpbitmap2, sy+y, sx+x) = colour;
205            *BITMAP_ADDR16(state->tmpbitmap2, sy+y, sx+x) = colour;
209206         }
210207      }
211208   }
r10613r10614
222219      {
223220         for (x = 0; x < 8; x++)
224221         {
225            *BITMAP_ADDR16(tmpbitmap2, sy+y, sx+x) = colour;
222            *BITMAP_ADDR16(state->tmpbitmap2, sy+y, sx+x) = colour;
226223         }
227224      }
228225   }
r10613r10614
239236
240237static TILE_GET_INFO( get_fg_tile_info )
241238{
242   int code = popeye_videoram[tile_index];
243   int color = popeye_colorram[tile_index] & 0x0f;
239   popeye_state *state = machine->driver_data<popeye_state>();
240   int code = state->videoram[tile_index];
241   int color = state->colorram[tile_index] & 0x0f;
244242
245243   SET_TILE_INFO(0, code, color, 0);
246244}
247245
248246VIDEO_START( skyskipr )
249247{
250   popeye_bitmapram = auto_alloc_array(machine, UINT8, popeye_bitmapram_size);
251   tmpbitmap2 = auto_bitmap_alloc(machine,1024,1024,machine->primary_screen->format());   /* actually 1024x512 but not rolling over vertically? */
248   popeye_state *state = machine->driver_data<popeye_state>();
249   state->bitmapram = auto_alloc_array(machine, UINT8, popeye_bitmapram_size);
250   state->tmpbitmap2 = auto_bitmap_alloc(machine,1024,1024,machine->primary_screen->format());   /* actually 1024x512 but not rolling over vertically? */
252251
253   bitmap_type = TYPE_SKYSKIPR;
252   state->bitmap_type = TYPE_SKYSKIPR;
254253
255   fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 16, 16, 32, 32);
256   tilemap_set_transparent_pen(fg_tilemap, 0);
254   state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 16, 16, 32, 32);
255   tilemap_set_transparent_pen(state->fg_tilemap, 0);
257256
258    lastflip = 0;
257    state->lastflip = 0;
259258
260    state_save_register_global(machine, lastflip);
261    state_save_register_global_bitmap(machine, tmpbitmap2);
262    state_save_register_global_pointer(machine, popeye_bitmapram, popeye_bitmapram_size);
259    state_save_register_global(machine, state->lastflip);
260    state_save_register_global_bitmap(machine, state->tmpbitmap2);
261    state_save_register_global_pointer(machine, state->bitmapram, popeye_bitmapram_size);
263262}
264263
265264VIDEO_START( popeye )
266265{
267   popeye_bitmapram = auto_alloc_array(machine, UINT8, popeye_bitmapram_size);
268   tmpbitmap2 = auto_bitmap_alloc(machine,512,512,machine->primary_screen->format());
266   popeye_state *state = machine->driver_data<popeye_state>();
267   state->bitmapram = auto_alloc_array(machine, UINT8, popeye_bitmapram_size);
268   state->tmpbitmap2 = auto_bitmap_alloc(machine,512,512,machine->primary_screen->format());
269269
270   bitmap_type = TYPE_POPEYE;
270   state->bitmap_type = TYPE_POPEYE;
271271
272   fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 16, 16, 32, 32);
273   tilemap_set_transparent_pen(fg_tilemap, 0);
272   state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 16, 16, 32, 32);
273   tilemap_set_transparent_pen(state->fg_tilemap, 0);
274274
275    lastflip = 0;
275    state->lastflip = 0;
276276
277    state_save_register_global(machine, lastflip);
278    state_save_register_global_bitmap(machine, tmpbitmap2);
279    state_save_register_global_pointer(machine, popeye_bitmapram, popeye_bitmapram_size);
277    state_save_register_global(machine, state->lastflip);
278    state_save_register_global_bitmap(machine, state->tmpbitmap2);
279    state_save_register_global_pointer(machine, state->bitmapram, popeye_bitmapram_size);
280280}
281281
282282static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
283283{
284   popeye_state *state = machine->driver_data<popeye_state>();
284285   int offs;
285286   address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
286287
287   if (lastflip != flip_screen_get(machine))
288   if (state->lastflip != flip_screen_get(machine))
288289   {
289290      for (offs = 0;offs < popeye_bitmapram_size;offs++)
290         popeye_bitmap_w(space,offs,popeye_bitmapram[offs]);
291         popeye_bitmap_w(space,offs,state->bitmapram[offs]);
291292
292      lastflip = flip_screen_get(machine);
293      state->lastflip = flip_screen_get(machine);
293294   }
294295
295   set_background_palette(machine, (*popeye_palettebank & 0x08) >> 3);
296   set_background_palette(machine, (*state->palettebank & 0x08) >> 3);
296297
297   if (popeye_background_pos[1] == 0)   /* no background */
298   if (state->background_pos[1] == 0)   /* no background */
298299      bitmap_fill(bitmap,cliprect,0);
299300   else
300301   {
301302      /* copy the background graphics */
302      int scrollx = 200 - popeye_background_pos[0] - 256*(popeye_background_pos[2]&1); /* ??? */
303      int scrolly = 2 * (256 - popeye_background_pos[1]);
303      int scrollx = 200 - state->background_pos[0] - 256*(state->background_pos[2]&1); /* ??? */
304      int scrolly = 2 * (256 - state->background_pos[1]);
304305
305      if (bitmap_type == TYPE_SKYSKIPR)
306      if (state->bitmap_type == TYPE_SKYSKIPR)
306307         scrollx = 2*scrollx - 512;
307308
308309      if (flip_screen_get(machine))
309310      {
310         if (bitmap_type == TYPE_POPEYE)
311         if (state->bitmap_type == TYPE_POPEYE)
311312            scrollx = -scrollx;
312313         scrolly = -scrolly;
313314      }
314315
315      copyscrollbitmap(bitmap,tmpbitmap2,1,&scrollx,1,&scrolly,cliprect);
316      copyscrollbitmap(bitmap,state->tmpbitmap2,1,&scrollx,1,&scrolly,cliprect);
316317   }
317318}
318319
319320static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
320321{
322   popeye_state *state = machine->driver_data<popeye_state>();
321323   UINT8 *spriteram = machine->generic.spriteram.u8;
322324   int offs;
323325
r10613r10614
339341
340342      code = (spriteram[offs + 2] & 0x7f) + ((spriteram[offs + 3] & 0x10) << 3)
341343                     + ((spriteram[offs + 3] & 0x04) << 6);
342      color = (spriteram[offs + 3] & 0x07) + 8*(*popeye_palettebank & 0x07);
343      if (bitmap_type == TYPE_SKYSKIPR)
344      color = (spriteram[offs + 3] & 0x07) + 8*(*state->palettebank & 0x07);
345      if (state->bitmap_type == TYPE_SKYSKIPR)
344346      {
345347         /* Two of the PROM address pins are tied together and one is not connected... */
346348         color = (color & 0x0f) | ((color & 0x08) << 1);
r10613r10614
371373
372374SCREEN_UPDATE( popeye )
373375{
376   popeye_state *state = screen->machine->driver_data<popeye_state>();
374377   draw_background(screen->machine, bitmap, cliprect);
375378   draw_sprites(screen->machine, bitmap, cliprect);
376   tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
379   tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
377380   return 0;
378381}
src/mame/video/pastelg.c
r10613r10614
1111#include "includes/pastelg.h"
1212
1313
14static int blitter_destx, blitter_desty;
15static int blitter_sizex, blitter_sizey;
16static int blitter_src_addr;
17static int pastelg_gfxrom;
18static int pastelg_dispflag;
19static int pastelg_flipscreen;
20static int blitter_direction_x, blitter_direction_y;
21static int pastelg_palbank;
22
23static UINT8 *pastelg_videoram;
24static UINT8 *pastelg_clut;
25
26
2714static void pastelg_vramflip(running_machine *machine);
2815static void pastelg_gfxdraw(running_machine *machine);
2916
r10613r10614
6249
6350WRITE8_HANDLER( pastelg_clut_w )
6451{
65   pastelg_clut[offset] = data;
52   pastelg_state *state = space->machine->driver_data<pastelg_state>();
53   state->clut[offset] = data;
6654}
6755
6856/******************************************************************************
6957
7058
7159******************************************************************************/
72int pastelg_blitter_src_addr_r(void)
60int pastelg_blitter_src_addr_r(address_space *space)
7361{
74   return blitter_src_addr;
62   pastelg_state *state = space->machine->driver_data<pastelg_state>();
63   return state->blitter_src_addr;
7564}
7665
7766WRITE8_HANDLER( pastelg_blitter_w )
7867{
68   pastelg_state *state = space->machine->driver_data<pastelg_state>();
7969   switch (offset)
8070   {
81      case 0: blitter_src_addr = (blitter_src_addr & 0xff00) | data; break;
82      case 1: blitter_src_addr = (blitter_src_addr & 0x00ff) | (data << 8); break;
83      case 2: blitter_destx = data; break;
84      case 3: blitter_desty = data; break;
85      case 4: blitter_sizex = data; break;
86      case 5: blitter_sizey = data;
71      case 0: state->blitter_src_addr = (state->blitter_src_addr & 0xff00) | data; break;
72      case 1: state->blitter_src_addr = (state->blitter_src_addr & 0x00ff) | (data << 8); break;
73      case 2: state->blitter_destx = data; break;
74      case 3: state->blitter_desty = data; break;
75      case 4: state->blitter_sizex = data; break;
76      case 5: state->blitter_sizey = data;
8777            /* writing here also starts the blit */
8878            pastelg_gfxdraw(space->machine);
8979            break;
90      case 6:   blitter_direction_x = (data & 0x01) ? 1 : 0;
91            blitter_direction_y = (data & 0x02) ? 1 : 0;
92            pastelg_flipscreen = (data & 0x04) ? 0 : 1;
93            pastelg_dispflag = (data & 0x08) ? 0 : 1;
80      case 6:   state->blitter_direction_x = (data & 0x01) ? 1 : 0;
81            state->blitter_direction_y = (data & 0x02) ? 1 : 0;
82            state->flipscreen = (data & 0x04) ? 0 : 1;
83            state->dispflag = (data & 0x08) ? 0 : 1;
9484            pastelg_vramflip(space->machine);
9585            break;
9686   }
r10613r10614
9989
10090WRITE8_HANDLER( threeds_romsel_w )
10191{
92   pastelg_state *state = space->machine->driver_data<pastelg_state>();
10293   if (data&0xfc) printf("%02x\n",data);
103   pastelg_gfxrom = (data & 0x3);
94   state->gfxrom = (data & 0x3);
10495}
10596
10697WRITE8_HANDLER( threeds_output_w )
10798{
108   pastelg_palbank = ((data & 0x10) >> 4);
99   pastelg_state *state = space->machine->driver_data<pastelg_state>();
100   state->palbank = ((data & 0x10) >> 4);
109101
110102}
111103
112104READ8_HANDLER( threeds_rom_readback_r )
113105{
106   pastelg_state *state = space->machine->driver_data<pastelg_state>();
114107   UINT8 *GFX = space->machine->region("gfx1")->base();
115108
116   return GFX[(blitter_src_addr | (pastelg_gfxrom << 16)) & 0x3ffff];
109   return GFX[(state->blitter_src_addr | (state->gfxrom << 16)) & 0x3ffff];
117110}
118111
119112
120113WRITE8_HANDLER( pastelg_romsel_w )
121114{
115   pastelg_state *state = space->machine->driver_data<pastelg_state>();
122116   int gfxlen = space->machine->region("gfx1")->bytes();
123   pastelg_gfxrom = ((data & 0xc0) >> 6);
124   pastelg_palbank = ((data & 0x10) >> 4);
117   state->gfxrom = ((data & 0xc0) >> 6);
118   state->palbank = ((data & 0x10) >> 4);
125119   nb1413m3_sndrombank1_w(space, 0, data);
126120
127   if ((pastelg_gfxrom << 16) > (gfxlen - 1))
121   if ((state->gfxrom << 16) > (gfxlen - 1))
128122   {
129123#ifdef MAME_DEBUG
130124      popmessage("GFXROM BANK OVER!!");
131125#endif
132      pastelg_gfxrom &= (gfxlen / 0x20000 - 1);
126      state->gfxrom &= (gfxlen / 0x20000 - 1);
133127   }
134128}
135129
r10613r10614
139133******************************************************************************/
140134static void pastelg_vramflip(running_machine *machine)
141135{
142   static int pastelg_flipscreen_old = 0;
136   pastelg_state *state = machine->driver_data<pastelg_state>();
143137   int x, y;
144138   UINT8 color1, color2;
145139   int width = machine->primary_screen->width();
146140   int height = machine->primary_screen->height();
147141
148   if (pastelg_flipscreen == pastelg_flipscreen_old) return;
142   if (state->flipscreen == state->flipscreen_old) return;
149143
150144   for (y = 0; y < height; y++)
151145   {
152146      for (x = 0; x < width; x++)
153147      {
154         color1 = pastelg_videoram[(y * width) + x];
155         color2 = pastelg_videoram[((y ^ 0xff) * width) + (x ^ 0xff)];
156         pastelg_videoram[(y * width) + x] = color2;
157         pastelg_videoram[((y ^ 0xff) * width) + (x ^ 0xff)] = color1;
148         color1 = state->videoram[(y * width) + x];
149         color2 = state->videoram[((y ^ 0xff) * width) + (x ^ 0xff)];
150         state->videoram[(y * width) + x] = color2;
151         state->videoram[((y ^ 0xff) * width) + (x ^ 0xff)] = color1;
158152      }
159153   }
160154
161   pastelg_flipscreen_old = pastelg_flipscreen;
155   state->flipscreen_old = state->flipscreen;
162156}
163157
164158static TIMER_CALLBACK( blitter_timer_callback )
r10613r10614
168162
169163static void pastelg_gfxdraw(running_machine *machine)
170164{
165   pastelg_state *state = machine->driver_data<pastelg_state>();
171166   UINT8 *GFX = machine->region("gfx1")->base();
172167   int width = machine->primary_screen->width();
173168
r10613r10614
184179
185180   nb1413m3_busyctr = 0;
186181
187   startx = blitter_destx + blitter_sizex;
188   starty = blitter_desty + blitter_sizey;
182   startx = state->blitter_destx + state->blitter_sizex;
183   starty = state->blitter_desty + state->blitter_sizey;
189184
190185
191   if (blitter_direction_x)
186   if (state->blitter_direction_x)
192187   {
193      if (blitter_sizex&0x80) sizex = 0xff-blitter_sizex;
194      else sizex=blitter_sizex;
188      if (state->blitter_sizex&0x80) sizex = 0xff-state->blitter_sizex;
189      else sizex=state->blitter_sizex;
195190      incx = 1;
196191   }
197192   else
198193   {
199      sizex = blitter_sizex;
194      sizex = state->blitter_sizex;
200195      incx = -1;
201196   }
202197
203   if (blitter_direction_y)
198   if (state->blitter_direction_y)
204199   {
205      if (blitter_sizey&0x80) sizey = 0xff-blitter_sizey;
206      else sizey=blitter_sizey;
200      if (state->blitter_sizey&0x80) sizey = 0xff-state->blitter_sizey;
201      else sizey=state->blitter_sizey;
207202      incy = 1;
208203   }
209204   else
210205   {
211      sizey = blitter_sizey;
206      sizey = state->blitter_sizey;
212207      incy = -1;
213208   }
214209
215210   gfxlen = machine->region("gfx1")->bytes();
216   gfxaddr = (pastelg_gfxrom << 16) + blitter_src_addr;
211   gfxaddr = (state->gfxrom << 16) + state->blitter_src_addr;
217212
218213   readflag = 0;
219214
r10613r10614
226221
227222      for (ctrx = sizex; ctrx >= 0; ctrx--)
228223      {
229         gfxaddr = (pastelg_gfxrom << 16) + ((blitter_src_addr + count));
224         gfxaddr = (state->gfxrom << 16) + ((state->blitter_src_addr + count));
230225
231226         if ((gfxaddr > (gfxlen - 1)))
232227         {
r10613r10614
241236         dx = x & 0xff;
242237         dy = y & 0xff;
243238
244         if (pastelg_flipscreen)
239         if (state->flipscreen)
245240         {
246241            dx ^= 0xff;
247242            dy ^= 0xff;
r10613r10614
261256
262257         readflag ^= 1;
263258
264         if (pastelg_clut[color] & 0xf0)
259         if (state->clut[color] & 0xf0)
265260         {
266261            if (color)
267262            {
268               color = ((pastelg_palbank * 0x10) + color);
269               pastelg_videoram[(dy * width) + dx] = color;
263               color = ((state->palbank * 0x10) + color);
264               state->videoram[(dy * width) + dx] = color;
270265            }
271266         }
272267         else
273268         {
274            if(pastelg_clut[color] != 0)
269            if(state->clut[color] != 0)
275270            {
276               color = ((pastelg_palbank * 0x10) + pastelg_clut[color]);
277               pastelg_videoram[(dy * width) + dx] = color;
271               color = ((state->palbank * 0x10) + state->clut[color]);
272               state->videoram[(dy * width) + dx] = color;
278273            }
279274         }
280275
r10613r10614
295290******************************************************************************/
296291VIDEO_START( pastelg )
297292{
293   pastelg_state *state = machine->driver_data<pastelg_state>();
298294   int width = machine->primary_screen->width();
299295   int height = machine->primary_screen->height();
300296
301   pastelg_videoram = auto_alloc_array_clear(machine, UINT8, width * height);
302   pastelg_clut = auto_alloc_array(machine, UINT8, 0x10);
297   state->videoram = auto_alloc_array_clear(machine, UINT8, width * height);
298   state->clut = auto_alloc_array(machine, UINT8, 0x10);
303299}
304300
305301/******************************************************************************
r10613r10614
308304******************************************************************************/
309305SCREEN_UPDATE( pastelg )
310306{
311   if (pastelg_dispflag)
307   pastelg_state *state = screen->machine->driver_data<pastelg_state>();
308   if (state->dispflag)
312309   {
313310      int x, y;
314311      int width = screen->width();
r10613r10614
316313
317314      for (y = 0; y < height; y++)
318315         for (x = 0; x < width; x++)
319            *BITMAP_ADDR16(bitmap, y, x) = pastelg_videoram[(y * width) + x];
316            *BITMAP_ADDR16(bitmap, y, x) = state->videoram[(y * width) + x];
320317   }
321318   else
322319      bitmap_fill(bitmap, cliprect, 0);
src/mame/video/cischeat.c
r10613r10614
11101110***************************************************************************/
11111111
11121112#ifdef MAME_DEBUG
1113static int show_unknown;
11141113#define CISCHEAT_LAYERSCTRL \
11151114state->debugsprites = 0; \
11161115if ( input_code_pressed(screen->machine, KEYCODE_Z) || input_code_pressed(screen->machine, KEYCODE_X) ) \
r10613r10614
11311130\
11321131{ \
11331132   if ( input_code_pressed(screen->machine, KEYCODE_Z) && input_code_pressed_once(screen->machine, KEYCODE_U) ) \
1134      show_unknown ^= 1; \
1135   if (show_unknown) \
1133      state->show_unknown ^= 1; \
1134   if (state->show_unknown) \
11361135      popmessage("0:%04X 2:%04X 4:%04X 6:%04X c:%04X", \
11371136         megasys1_vregs[0],megasys1_vregs[1],megasys1_vregs[2],megasys1_vregs[3],megasys1_vregs[0xc/2] ); \
11381137}
src/mame/video/warpwarp.c
r10613r10614
1212
1313
1414UINT8 *geebee_videoram,*warpwarp_videoram;
15int geebee_handleoverlay;
1615int geebee_bgw;
1716int warpwarp_ball_on;
1817int warpwarp_ball_h,warpwarp_ball_v;
r10613r10614
121120***************************************************************************/
122121
123122/* convert from 32x32 to 34x28 */
124static UINT32 tilemap_scan(UINT32 col,UINT32 row,UINT32 num_cols,UINT32 num_rows)
123static TILEMAP_MAPPER( tilemap_scan )
125124{
126125   int offs;
127126
r10613r10614
239238
240239SCREEN_UPDATE( geebee )
241240{
242   /* use an overlay only in upright mode */
243   if (geebee_handleoverlay)
244      output_set_value("overlay", (input_port_read(screen->machine, "DSW2") & 0x01) == 0);
245
246241   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
247242
248243   draw_ball(bitmap,cliprect,warpwarp_ball_pen);
src/mame/video/spacefb.c
r10613r10614
99#include "video/resnet.h"
1010
1111
12UINT8 *spacefb_videoram;
13size_t spacefb_videoram_size;
14
15static UINT8 *object_present_map;
16static UINT8 port_0;
17static UINT8 port_2;
18static UINT32 star_shift_reg;
19
20static double color_weights_rg[3], color_weights_b[2];
21
22
23
2412/*************************************
2513 *
2614 *  Port setters
r10613r10614
2917
3018WRITE8_HANDLER( spacefb_port_0_w )
3119{
20   spacefb_state *state = space->machine->driver_data<spacefb_state>();
3221   space->machine->primary_screen->update_now();
33   port_0 = data;
22   state->port_0 = data;
3423}
3524
3625
3726WRITE8_HANDLER( spacefb_port_2_w )
3827{
28   spacefb_state *state = space->machine->driver_data<spacefb_state>();
3929   space->machine->primary_screen->update_now();
40   port_2 = data;
30   state->port_2 = data;
4131}
4232
4333
r10613r10614
7969
8070VIDEO_START( spacefb )
8171{
72   spacefb_state *state = machine->driver_data<spacefb_state>();
8273   int width, height;
8374
8475   /* compute the color gun weights */
r10613r10614
8677   static const int resistances_b [] = {       470, 220 };
8778
8879   compute_resistor_weights(0, 0xff, -1.0,
89                      3, resistances_rg, color_weights_rg, 470, 0,
90                      2, resistances_b,  color_weights_b,  470, 0,
80                      3, resistances_rg, state->color_weights_rg, 470, 0,
81                      2, resistances_b,  state->color_weights_b,  470, 0,
9182                      0, 0, 0, 0, 0);
9283
9384   width = machine->primary_screen->width();
9485   height = machine->primary_screen->height();
95   object_present_map = auto_alloc_array(machine, UINT8, width * height);
86   state->object_present_map = auto_alloc_array(machine, UINT8, width * height);
9687
9788   /* this start value positions the stars to match the flyer screen shot,
9889       but most likely, the actual star position is random as the hardware
9990       uses whatever value is on the shift register on power-up */
100   star_shift_reg = 0x18f89;
91   state->star_shift_reg = 0x18f89;
10192}
10293
10394
r10613r10614
111102#define NUM_STARFIELD_PENS   (0x40)
112103
113104
114INLINE void shift_star_generator(void)
105INLINE void shift_star_generator(spacefb_state *state)
115106{
116   star_shift_reg = ((star_shift_reg << 1) | (((~star_shift_reg >> 16) & 0x01) ^ ((star_shift_reg >> 4) & 0x01))) & 0x1ffff;
107   state->star_shift_reg = ((state->star_shift_reg << 1) | (((~state->star_shift_reg >> 16) & 0x01) ^ ((state->star_shift_reg >> 4) & 0x01))) & 0x1ffff;
117108}
118109
119110
120static void get_starfield_pens(pen_t *pens)
111static void get_starfield_pens(spacefb_state *state, pen_t *pens)
121112{
122113   /* generate the pens based on the various enable bits */
123114   int i;
124115
125   int color_contrast_r   = port_2 & 0x01;
126   int color_contrast_g   = port_2 & 0x02;
127   int color_contrast_b   = port_2 & 0x04;
128   int background_red     = port_2 & 0x08;
129   int background_blue    = port_2 & 0x10;
130   int disable_star_field = port_2 & 0x80;
116   int color_contrast_r   = state->port_2 & 0x01;
117   int color_contrast_g   = state->port_2 & 0x02;
118   int color_contrast_b   = state->port_2 & 0x04;
119   int background_red     = state->port_2 & 0x08;
120   int background_blue    = state->port_2 & 0x10;
121   int disable_star_field = state->port_2 & 0x80;
131122
132123   for (i = 0; i < NUM_STARFIELD_PENS; i++)
133124   {
r10613r10614
138129      UINT8 ra = (((i >> 4) & 0x01) || background_red) && !disable_star_field;
139130      UINT8 rb =  ((i >> 5) & 0x01) && color_contrast_r && !disable_star_field;
140131
141      UINT8 r = combine_3_weights(color_weights_rg, 0, rb, ra);
142      UINT8 g = combine_3_weights(color_weights_rg, 0, gb, ga);
143      UINT8 b = combine_2_weights(color_weights_b,     bb, ba);
132      UINT8 r = combine_3_weights(state->color_weights_rg, 0, rb, ra);
133      UINT8 g = combine_3_weights(state->color_weights_rg, 0, gb, ga);
134      UINT8 b = combine_2_weights(state->color_weights_b,     bb, ba);
144135
145136      pens[i] = MAKE_RGB(r, g, b);
146137   }
r10613r10614
149140
150141static void draw_starfield(screen_device &screen, bitmap_t *bitmap, const rectangle *cliprect)
151142{
143   spacefb_state *state = screen.machine->driver_data<spacefb_state>();
152144   int y;
153145   pen_t pens[NUM_STARFIELD_PENS];
154146
155   get_starfield_pens(pens);
147   get_starfield_pens(state, pens);
156148
157149   /* the shift register is always shifting -- do the portion in the top VBLANK */
158150   if (cliprect->min_y == screen.visible_area().min_y)
r10613r10614
163155      int clock_count = (SPACEFB_HBSTART - SPACEFB_HBEND) * SPACEFB_VBEND - 1;
164156
165157      for (i = 0; i < clock_count; i++)
166         shift_star_generator();
158         shift_star_generator(state);
167159   }
168160
169161   /* visible region of the screen */
r10613r10614
173165
174166      for (x = SPACEFB_HBEND; x < SPACEFB_HBSTART; x++)
175167      {
176         if (object_present_map[(y * bitmap->width) + x] == 0)
168         if (state->object_present_map[(y * bitmap->width) + x] == 0)
177169         {
178170            /* draw the star - the 4 possible values come from the effect of the two XOR gates */
179            if (((star_shift_reg & 0x1c0ff) == 0x0c0b7) ||
180               ((star_shift_reg & 0x1c0ff) == 0x0c0d7) ||
181               ((star_shift_reg & 0x1c0ff) == 0x0c0bb) ||
182               ((star_shift_reg & 0x1c0ff) == 0x0c0db))
183               *BITMAP_ADDR32(bitmap, y, x) = pens[(star_shift_reg >> 8) & 0x3f];
171            if (((state->star_shift_reg & 0x1c0ff) == 0x0c0b7) ||
172               ((state->star_shift_reg & 0x1c0ff) == 0x0c0d7) ||
173               ((state->star_shift_reg & 0x1c0ff) == 0x0c0bb) ||
174               ((state->star_shift_reg & 0x1c0ff) == 0x0c0db))
175               *BITMAP_ADDR32(bitmap, y, x) = pens[(state->star_shift_reg >> 8) & 0x3f];
184176            else
185177               *BITMAP_ADDR32(bitmap, y, x) = pens[0];
186178         }
187179
188         shift_star_generator();
180         shift_star_generator(state);
189181      }
190182   }
191183
r10613r10614
196188      int clock_count = (SPACEFB_HBSTART - SPACEFB_HBEND) * (SPACEFB_VTOTAL - SPACEFB_VBSTART);
197189
198190      for (i = 0; i < clock_count; i++)
199         shift_star_generator();
191         shift_star_generator(state);
200192   }
201193}
202194
r10613r10614
217209
218210static void get_sprite_pens(running_machine *machine, pen_t *pens)
219211{
212   spacefb_state *state = machine->driver_data<spacefb_state>();
220213   static const double fade_weights[] = { 1.0, 1.5, 2.5, 4.0 };
221214   const UINT8 *prom = machine->region("proms")->base();
222215   int i;
223216
224217   for (i = 0; i < NUM_SPRITE_PENS; i++)
225218   {
226      UINT8 data = prom[((port_0 & 0x40) >> 2) | (i & 0x0f)];
219      UINT8 data = prom[((state->port_0 & 0x40) >> 2) | (i & 0x0f)];
227220
228221      UINT8 r0 = (data >> 0) & 0x01;
229222      UINT8 r1 = (data >> 1) & 0x01;
r10613r10614
236229      UINT8 b1 = (data >> 6) & 0x01;
237230      UINT8 b2 = (data >> 7) & 0x01;
238231
239      UINT8 r = combine_3_weights(color_weights_rg, r0, r1, r2);
240      UINT8 g = combine_3_weights(color_weights_rg, g0, g1, g2);
241      UINT8 b = combine_2_weights(color_weights_b,      b1, b2);
232      UINT8 r = combine_3_weights(state->color_weights_rg, r0, r1, r2);
233      UINT8 g = combine_3_weights(state->color_weights_rg, g0, g1, g2);
234      UINT8 b = combine_2_weights(state->color_weights_b,      b1, b2);
242235
243236      if (i >> 4)
244237      {
r10613r10614
257250
258251static void draw_bullet(running_machine *machine, offs_t offs, pen_t pen, bitmap_t *bitmap, const rectangle *cliprect, int flip)
259252{
253   spacefb_state *state = machine->driver_data<spacefb_state>();
260254   UINT8 sy;
261255
262256   UINT8 *gfx = machine->region("gfx2")->base();
263257
264   UINT8 code = spacefb_videoram[offs + 0x0200] & 0x3f;
265   UINT8 y = ~spacefb_videoram[offs + 0x0100] - 2;
258   UINT8 code = state->videoram[offs + 0x0200] & 0x3f;
259   UINT8 y = ~state->videoram[offs + 0x0100] - 2;
266260
267261   for (sy = 0; sy < 4; sy++)
268262   {
269263      UINT8 sx, dy;
270264
271265      UINT8 data = gfx[(code << 2) | sy];
272      UINT8 x = spacefb_videoram[offs + 0x0000];
266      UINT8 x = state->videoram[offs + 0x0000];
273267
274268      if (flip)
275269         dy = ~y;
r10613r10614
292286               *BITMAP_ADDR32(bitmap, dy, dx + 0) = pen;
293287               *BITMAP_ADDR32(bitmap, dy, dx + 1) = pen;
294288
295               object_present_map[(dy * bitmap->width) + dx + 0] = 1;
296               object_present_map[(dy * bitmap->width) + dx + 1] = 1;
289               state->object_present_map[(dy * bitmap->width) + dx + 0] = 1;
290               state->object_present_map[(dy * bitmap->width) + dx + 1] = 1;
297291            }
298292
299293            x = x + 1;
r10613r10614
308302
309303static void draw_sprite(running_machine *machine, offs_t offs, pen_t *pens, bitmap_t *bitmap, const rectangle *cliprect, int flip)
310304{
305   spacefb_state *state = machine->driver_data<spacefb_state>();
311306   UINT8 sy;
312307
313308   UINT8 *gfx = machine->region("gfx1")->base();
314309
315   UINT8 code = ~spacefb_videoram[offs + 0x0200];
316   UINT8 color_base = (~spacefb_videoram[offs + 0x0300] & 0x0f) << 2;
317   UINT8 y = ~spacefb_videoram[offs + 0x0100] - 2;
310   UINT8 code = ~state->videoram[offs + 0x0200];
311   UINT8 color_base = (~state->videoram[offs + 0x0300] & 0x0f) << 2;
312   UINT8 y = ~state->videoram[offs + 0x0100] - 2;
318313
319314   for (sy = 0; sy < 8; sy++)
320315   {
r10613r10614
323318      UINT8 data1 = gfx[0x0000 | (code << 3) | (sy ^ 0x07)];
324319      UINT8 data2 = gfx[0x0800 | (code << 3) | (sy ^ 0x07)];
325320
326      UINT8 x = spacefb_videoram[offs + 0x0000] - 3;
321      UINT8 x = state->videoram[offs + 0x0000] - 3;
327322
328323      if (flip)
329324         dy = ~y;
r10613r10614
349344            *BITMAP_ADDR32(bitmap, dy, dx + 0) = pen;
350345            *BITMAP_ADDR32(bitmap, dy, dx + 1) = pen;
351346
352            object_present_map[(dy * bitmap->width) + dx + 0] = (data != 0);
353            object_present_map[(dy * bitmap->width) + dx + 1] = (data != 0);
347            state->object_present_map[(dy * bitmap->width) + dx + 0] = (data != 0);
348            state->object_present_map[(dy * bitmap->width) + dx + 1] = (data != 0);
354349
355350            x = x + 1;
356351            data1 = data1 >> 1;
r10613r10614
365360
366361static void draw_objects(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
367362{
363   spacefb_state *state = machine->driver_data<spacefb_state>();
368364   pen_t sprite_pens[NUM_SPRITE_PENS];
369365
370   offs_t offs = (port_0 & 0x20) ? 0x80 : 0x00;
371   int flip = port_0 & 0x01;
366   offs_t offs = (state->port_0 & 0x20) ? 0x80 : 0x00;
367   int flip = state->port_0 & 0x01;
372368
373369   /* since the way the schematics show the bullet color
374370       connected is impossible, just use pure red for now */
r10613r10614
376372
377373   get_sprite_pens(machine, sprite_pens);
378374
379   memset(object_present_map, 0, bitmap->width * bitmap->height);
375   memset(state->object_present_map, 0, bitmap->width * bitmap->height);
380376
381377   while (1)
382378   {
383      if (spacefb_videoram[offs + 0x0300] & 0x20)
379      if (state->videoram[offs + 0x0300] & 0x20)
384380         draw_bullet(machine, offs, bullet_pen, bitmap, cliprect, flip);
385      else if (spacefb_videoram[offs + 0x0300] & 0x40)
381      else if (state->videoram[offs + 0x0300] & 0x40)
386382         draw_sprite(machine, offs, sprite_pens, bitmap, cliprect, flip);
387383
388384      /* next object */
src/mame/video/nbmj8891.c
r10613r10614
1111#include "includes/nbmj8891.h"
1212
1313
14static int nbmj8891_scrolly;
15static int blitter_destx, blitter_desty;
16static int blitter_sizex, blitter_sizey;
17static int blitter_src_addr;
18static int blitter_direction_x, blitter_direction_y;
19static int nbmj8891_vram;
20static int nbmj8891_gfxrom;
21static int nbmj8891_dispflag;
22static int nbmj8891_flipscreen;
23static int nbmj8891_clutsel;
24static int nbmj8891_screen_refresh;
25static int gfxdraw_mode;
26
27static bitmap_t *nbmj8891_tmpbitmap0, *nbmj8891_tmpbitmap1;
28static UINT8 *nbmj8891_videoram0, *nbmj8891_videoram1;
29static UINT8 *nbmj8891_palette;
30static UINT8 *nbmj8891_clut;
31
32
3314static void nbmj8891_vramflip(running_machine *machine, int vram);
3415static void nbmj8891_gfxdraw(running_machine *machine);
3516
r10613r10614
4021******************************************************************************/
4122READ8_HANDLER( nbmj8891_palette_type1_r )
4223{
43   return nbmj8891_palette[offset];
24   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
25   return state->palette[offset];
4426}
4527
4628WRITE8_HANDLER( nbmj8891_palette_type1_w )
4729{
30   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
4831   int r, g, b;
4932
50   nbmj8891_palette[offset] = data;
33   state->palette[offset] = data;
5134
5235   if (!(offset & 1)) return;
5336
5437   offset &= 0x1fe;
5538
56   r = ((nbmj8891_palette[offset + 0] & 0x0f) >> 0);
57   g = ((nbmj8891_palette[offset + 1] & 0xf0) >> 4);
58   b = ((nbmj8891_palette[offset + 1] & 0x0f) >> 0);
39   r = ((state->palette[offset + 0] & 0x0f) >> 0);
40   g = ((state->palette[offset + 1] & 0xf0) >> 4);
41   b = ((state->palette[offset + 1] & 0x0f) >> 0);
5942
6043   palette_set_color_rgb(space->machine, (offset >> 1), pal4bit(r), pal4bit(g), pal4bit(b));
6144}
6245
6346READ8_HANDLER( nbmj8891_palette_type2_r )
6447{
65   return nbmj8891_palette[offset];
48   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
49   return state->palette[offset];
6650}
6751
6852WRITE8_HANDLER( nbmj8891_palette_type2_w )
6953{
54   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
7055   int r, g, b;
7156
72   nbmj8891_palette[offset] = data;
57   state->palette[offset] = data;
7358
7459   if (!(offset & 0x100)) return;
7560
7661   offset &= 0x0ff;
7762
78   r = ((nbmj8891_palette[offset + 0x000] & 0x0f) >> 0);
79   g = ((nbmj8891_palette[offset + 0x000] & 0xf0) >> 4);
80   b = ((nbmj8891_palette[offset + 0x100] & 0x0f) >> 0);
63   r = ((state->palette[offset + 0x000] & 0x0f) >> 0);
64   g = ((state->palette[offset + 0x000] & 0xf0) >> 4);
65   b = ((state->palette[offset + 0x100] & 0x0f) >> 0);
8166
8267   palette_set_color_rgb(space->machine, (offset & 0x0ff), pal4bit(r), pal4bit(g), pal4bit(b));
8368}
8469
8570READ8_HANDLER( nbmj8891_palette_type3_r )
8671{
87   return nbmj8891_palette[offset];
72   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
73   return state->palette[offset];
8874}
8975
9076WRITE8_HANDLER( nbmj8891_palette_type3_w )
9177{
78   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
9279   int r, g, b;
9380
94   nbmj8891_palette[offset] = data;
81   state->palette[offset] = data;
9582
9683   if (!(offset & 1)) return;
9784
9885   offset &= 0x1fe;
9986
100   r = ((nbmj8891_palette[offset + 1] & 0x0f) >> 0);
101   g = ((nbmj8891_palette[offset + 0] & 0xf0) >> 4);
102   b = ((nbmj8891_palette[offset + 0] & 0x0f) >> 0);
87   r = ((state->palette[offset + 1] & 0x0f) >> 0);
88   g = ((state->palette[offset + 0] & 0xf0) >> 4);
89   b = ((state->palette[offset + 0] & 0x0f) >> 0);
10390
10491   palette_set_color_rgb(space->machine, (offset >> 1), pal4bit(r), pal4bit(g), pal4bit(b));
10592}
10693
10794WRITE8_HANDLER( nbmj8891_clutsel_w )
10895{
109   nbmj8891_clutsel = data;
96   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
97   state->clutsel = data;
11098}
11199
112100READ8_HANDLER( nbmj8891_clut_r )
113101{
114   return nbmj8891_clut[offset];
102   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
103   return state->clut[offset];
115104}
116105
117106WRITE8_HANDLER( nbmj8891_clut_w )
118107{
119   nbmj8891_clut[((nbmj8891_clutsel & 0x7f) * 0x10) + (offset & 0x0f)] = data;
108   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
109   state->clut[((state->clutsel & 0x7f) * 0x10) + (offset & 0x0f)] = data;
120110}
121111
122112/******************************************************************************
r10613r10614
125115******************************************************************************/
126116WRITE8_HANDLER( nbmj8891_blitter_w )
127117{
118   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
128119   switch (offset)
129120   {
130      case 0x00:   blitter_src_addr = (blitter_src_addr & 0xff00) | data; break;
131      case 0x01:   blitter_src_addr = (blitter_src_addr & 0x00ff) | (data << 8); break;
132      case 0x02:   blitter_destx = data; break;
133      case 0x03:   blitter_desty = data; break;
134      case 0x04:   blitter_sizex = data; break;
135      case 0x05:   blitter_sizey = data;
121      case 0x00:   state->blitter_src_addr = (state->blitter_src_addr & 0xff00) | data; break;
122      case 0x01:   state->blitter_src_addr = (state->blitter_src_addr & 0x00ff) | (data << 8); break;
123      case 0x02:   state->blitter_destx = data; break;
124      case 0x03:   state->blitter_desty = data; break;
125      case 0x04:   state->blitter_sizex = data; break;
126      case 0x05:   state->blitter_sizey = data;
136127               /* writing here also starts the blit */
137128               nbmj8891_gfxdraw(space->machine);
138129               break;
139      case 0x06:   blitter_direction_x = (data & 0x01) ? 1 : 0;
140               blitter_direction_y = (data & 0x02) ? 1 : 0;
141               nbmj8891_flipscreen = (data & 0x04) ? 1 : 0;
142               nbmj8891_dispflag = (data & 0x08) ? 0 : 1;
143               if (gfxdraw_mode) nbmj8891_vramflip(space->machine, 1);
130      case 0x06:   state->blitter_direction_x = (data & 0x01) ? 1 : 0;
131               state->blitter_direction_y = (data & 0x02) ? 1 : 0;
132               state->flipscreen = (data & 0x04) ? 1 : 0;
133               state->dispflag = (data & 0x08) ? 0 : 1;
134               if (state->gfxdraw_mode) nbmj8891_vramflip(space->machine, 1);
144135               nbmj8891_vramflip(space->machine, 0);
145136               break;
146137      case 0x07:   break;
r10613r10614
149140
150141WRITE8_HANDLER( nbmj8891_taiwanmb_blitter_w )
151142{
143   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
152144   switch (offset)
153145   {
154      case 0:   blitter_src_addr = (blitter_src_addr & 0xff00) | data; break;
155      case 1:   blitter_src_addr = (blitter_src_addr & 0x00ff) | (data << 8); break;
156      case 2:   blitter_destx = data; break;
157      case 3:   blitter_desty = data; break;
158      case 4:   blitter_sizex = (data - 1) & 0xff; break;
159      case 5:   blitter_sizey = (data - 1) & 0xff; break;
146      case 0:   state->blitter_src_addr = (state->blitter_src_addr & 0xff00) | data; break;
147      case 1:   state->blitter_src_addr = (state->blitter_src_addr & 0x00ff) | (data << 8); break;
148      case 2:   state->blitter_destx = data; break;
149      case 3:   state->blitter_desty = data; break;
150      case 4:   state->blitter_sizex = (data - 1) & 0xff; break;
151      case 5:   state->blitter_sizey = (data - 1) & 0xff; break;
160152   }
161153}
162154
r10613r10614
167159
168160WRITE8_HANDLER( nbmj8891_taiwanmb_gfxflag_w )
169161{
170   nbmj8891_flipscreen = (data & 0x04) ? 1 : 0;
162   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
163   state->flipscreen = (data & 0x04) ? 1 : 0;
171164
172165   nbmj8891_vramflip(space->machine, 0);
173166}
174167
175168WRITE8_HANDLER( nbmj8891_taiwanmb_mcu_w )
176169{
177   static int param_old[0x10];
178   static int param_cnt = 0;
170   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
179171
180   param_old[param_cnt & 0x0f] = data;
172   state->param_old[state->param_cnt & 0x0f] = data;
181173
182174   if (data == 0x00)
183175   {
184      blitter_direction_x = 0;
185      blitter_direction_y = 0;
186      blitter_destx = 0;
187      blitter_desty = 0;
188      blitter_sizex = 0;
189      blitter_sizey = 0;
190      nbmj8891_dispflag = 0;
176      state->blitter_direction_x = 0;
177      state->blitter_direction_y = 0;
178      state->blitter_destx = 0;
179      state->blitter_desty = 0;
180      state->blitter_sizex = 0;
181      state->blitter_sizey = 0;
182      state->dispflag = 0;
191183   }
192184
193185/*
194186    if (data == 0x02)
195187    {
196        if (param_old[(param_cnt - 1) & 0x0f] == 0x18)
188        if (state->param_old[(state->param_cnt - 1) & 0x0f] == 0x18)
197189        {
198            nbmj8891_dispflag = 1;
190            state->dispflag = 1;
199191        }
200        else if (param_old[(param_cnt - 1) & 0x0f] == 0x1a)
192        else if (state->param_old[(state->param_cnt - 1) & 0x0f] == 0x1a)
201193        {
202            nbmj8891_dispflag = 0;
194            state->dispflag = 0;
203195        }
204196    }
205197*/
r10613r10614
211203
212204   if (data == 0x12)
213205   {
214      if (param_old[(param_cnt - 1) & 0x0f] == 0x08)
206      if (state->param_old[(state->param_cnt - 1) & 0x0f] == 0x08)
215207      {
216         blitter_direction_x = 1;
217         blitter_direction_y = 0;
218         blitter_destx += blitter_sizex + 1;
219         blitter_desty += 0;
220         blitter_sizex ^= 0xff;
221         blitter_sizey ^= 0x00;
208         state->blitter_direction_x = 1;
209         state->blitter_direction_y = 0;
210         state->blitter_destx += state->blitter_sizex + 1;
211         state->blitter_desty += 0;
212         state->blitter_sizex ^= 0xff;
213         state->blitter_sizey ^= 0x00;
222214      }
223      else if (param_old[(param_cnt - 1) & 0x0f] == 0x0a)
215      else if (state->param_old[(state->param_cnt - 1) & 0x0f] == 0x0a)
224216      {
225         blitter_direction_x = 0;
226         blitter_direction_y = 1;
227         blitter_destx += 0;
228         blitter_desty += blitter_sizey + 1;
229         blitter_sizex ^= 0x00;
230         blitter_sizey ^= 0xff;
217         state->blitter_direction_x = 0;
218         state->blitter_direction_y = 1;
219         state->blitter_destx += 0;
220         state->blitter_desty += state->blitter_sizey + 1;
221         state->blitter_sizex ^= 0x00;
222         state->blitter_sizey ^= 0xff;
231223      }
232      else if (param_old[(param_cnt - 1) & 0x0f] == 0x0c)
224      else if (state->param_old[(state->param_cnt - 1) & 0x0f] == 0x0c)
233225      {
234         blitter_direction_x = 1;
235         blitter_direction_y = 1;
236         blitter_destx += blitter_sizex + 1;
237         blitter_desty += blitter_sizey + 1;
238         blitter_sizex ^= 0xff;
239         blitter_sizey ^= 0xff;
226         state->blitter_direction_x = 1;
227         state->blitter_direction_y = 1;
228         state->blitter_destx += state->blitter_sizex + 1;
229         state->blitter_desty += state->blitter_sizey + 1;
230         state->blitter_sizex ^= 0xff;
231         state->blitter_sizey ^= 0xff;
240232      }
241      else if (param_old[(param_cnt - 1) & 0x0f] == 0x0e)
233      else if (state->param_old[(state->param_cnt - 1) & 0x0f] == 0x0e)
242234      {
243         blitter_direction_x = 0;
244         blitter_direction_y = 0;
245         blitter_destx += 0;
246         blitter_desty += 0;
247         blitter_sizex ^= 0x00;
248         blitter_sizey ^= 0x00;
235         state->blitter_direction_x = 0;
236         state->blitter_direction_y = 0;
237         state->blitter_destx += 0;
238         state->blitter_desty += 0;
239         state->blitter_sizex ^= 0x00;
240         state->blitter_sizey ^= 0x00;
249241      }
250242
251243      nbmj8891_gfxdraw(space->machine);
252244   }
253245
254//  blitter_direction_x = 0;                // for debug
255//  blitter_direction_y = 0;                // for debug
256   nbmj8891_dispflag = 1;               // for debug
246//  state->blitter_direction_x = 0;                // for debug
247//  state->blitter_direction_y = 0;                // for debug
248   state->dispflag = 1;               // for debug
257249
258   param_cnt++;
250   state->param_cnt++;
259251}
260252
261253WRITE8_HANDLER( nbmj8891_scrolly_w )
262254{
263   nbmj8891_scrolly = data;
255   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
256   state->scrolly = data;
264257}
265258
266259WRITE8_HANDLER( nbmj8891_vramsel_w )
267260{
261   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
268262   /* protection - not sure about this */
269263   nb1413m3_sndromrgntag = (data & 0x20) ? "protection" : "voice";
270264
271   nbmj8891_vram = data;
265   state->vram = data;
272266}
273267
274268WRITE8_HANDLER( nbmj8891_romsel_w )
275269{
270   nbmj8891_state *state = space->machine->driver_data<nbmj8891_state>();
276271   int gfxlen = space->machine->region("gfx1")->bytes();
277   nbmj8891_gfxrom = (data & 0x0f);
272   state->gfxrom = (data & 0x0f);
278273
279   if ((0x20000 * nbmj8891_gfxrom) > (gfxlen - 1))
274   if ((0x20000 * state->gfxrom) > (gfxlen - 1))
280275   {
281276#ifdef MAME_DEBUG
282277      popmessage("GFXROM BANK OVER!!");
283278#endif
284      nbmj8891_gfxrom &= (gfxlen / 0x20000 - 1);
279      state->gfxrom &= (gfxlen / 0x20000 - 1);
285280   }
286281}
287282
r10613r10614
291286******************************************************************************/
292287void nbmj8891_vramflip(running_machine *machine, int vram)
293288{
294   static int nbmj8891_flipscreen_old = 0;
289   nbmj8891_state *state = machine->driver_data<nbmj8891_state>();
295290   int x, y;
296291   UINT8 color1, color2;
297292   UINT8 *vidram;
r10613r10614
299294   int width = machine->primary_screen->width();
300295   int height = machine->primary_screen->height();
301296
302   if (nbmj8891_flipscreen == nbmj8891_flipscreen_old) return;
297   if (state->flipscreen == state->flipscreen_old) return;
303298
304   vidram = vram ? nbmj8891_videoram1 : nbmj8891_videoram0;
299   vidram = vram ? state->videoram1 : state->videoram0;
305300
306301   for (y = 0; y < (height / 2); y++)
307302   {
r10613r10614
314309      }
315310   }
316311
317   nbmj8891_flipscreen_old = nbmj8891_flipscreen;
318   nbmj8891_screen_refresh = 1;
312   state->flipscreen_old = state->flipscreen;
313   state->screen_refresh = 1;
319314}
320315
321316
322317static void update_pixel0(running_machine *machine, int x, int y)
323318{
324   UINT8 color = nbmj8891_videoram0[(y * machine->primary_screen->width()) + x];
325   *BITMAP_ADDR16(nbmj8891_tmpbitmap0, y, x) = color;
319   nbmj8891_state *state = machine->driver_data<nbmj8891_state>();
320   UINT8 color = state->videoram0[(y * machine->primary_screen->width()) + x];
321   *BITMAP_ADDR16(state->tmpbitmap0, y, x) = color;
326322}
327323
328324static void update_pixel1(running_machine *machine, int x, int y)
329325{
330   UINT8 color = nbmj8891_videoram1[(y * machine->primary_screen->width()) + x];
331   *BITMAP_ADDR16(nbmj8891_tmpbitmap1, y, x) = (color == 0x7f) ? 0xff : color;
326   nbmj8891_state *state = machine->driver_data<nbmj8891_state>();
327   UINT8 color = state->videoram1[(y * machine->primary_screen->width()) + x];
328   *BITMAP_ADDR16(state->tmpbitmap1, y, x) = (color == 0x7f) ? 0xff : color;
332329}
333330
334331static TIMER_CALLBACK( blitter_timer_callback )
r10613r10614
338335
339336static void nbmj8891_gfxdraw(running_machine *machine)
340337{
338   nbmj8891_state *state = machine->driver_data<nbmj8891_state>();
341339   UINT8 *GFX = machine->region("gfx1")->base();
342340   int width = machine->primary_screen->width();
343341
r10613r10614
352350
353351   nb1413m3_busyctr = 0;
354352
355   startx = blitter_destx + blitter_sizex;
356   starty = blitter_desty + blitter_sizey;
353   startx = state->blitter_destx + state->blitter_sizex;
354   starty = state->blitter_desty + state->blitter_sizey;
357355
358   if (blitter_direction_x)
356   if (state->blitter_direction_x)
359357   {
360      sizex = blitter_sizex ^ 0xff;
358      sizex = state->blitter_sizex ^ 0xff;
361359      skipx = 1;
362360   }
363361   else
364362   {
365      sizex = blitter_sizex;
363      sizex = state->blitter_sizex;
366364      skipx = -1;
367365   }
368366
369   if (blitter_direction_y)
367   if (state->blitter_direction_y)
370368   {
371      sizey = blitter_sizey ^ 0xff;
369      sizey = state->blitter_sizey ^ 0xff;
372370      skipy = 1;
373371   }
374372   else
375373   {
376      sizey = blitter_sizey;
374      sizey = state->blitter_sizey;
377375      skipy = -1;
378376   }
379377
380378   gfxlen = machine->region("gfx1")->bytes();
381   gfxaddr = (nbmj8891_gfxrom << 17) + (blitter_src_addr << 1);
379   gfxaddr = (state->gfxrom << 17) + (state->blitter_src_addr << 1);
382380
383381   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
384382   {
r10613r10614
403401         dx1 = (2 * x + 0) & 0x1ff;
404402         dx2 = (2 * x + 1) & 0x1ff;
405403
406         if (gfxdraw_mode)
404         if (state->gfxdraw_mode)
407405         {
408406            // 2 layer type
409407            dy1 = y & 0xff;
410            dy2 = (y + nbmj8891_scrolly) & 0xff;
408            dy2 = (y + state->scrolly) & 0xff;
411409         }
412410         else
413411         {
414412            // 1 layer type
415            dy1 = (y + nbmj8891_scrolly) & 0xff;
413            dy1 = (y + state->scrolly) & 0xff;
416414            dy2 = 0;
417415         }
418416
419         if (!nbmj8891_flipscreen)
417         if (!state->flipscreen)
420418         {
421419            dx1 ^= 0x1ff;
422420            dx2 ^= 0x1ff;
r10613r10614
424422            dy2 ^= 0xff;
425423         }
426424
427         if (blitter_direction_x)
425         if (state->blitter_direction_x)
428426         {
429427            // flip
430428            color1 = (color & 0x0f) >> 0;
r10613r10614
437435            color2 = (color & 0x0f) >> 0;
438436         }
439437
440         color1 = nbmj8891_clut[((nbmj8891_clutsel & 0x7f) << 4) + color1];
441         color2 = nbmj8891_clut[((nbmj8891_clutsel & 0x7f) << 4) + color2];
438         color1 = state->clut[((state->clutsel & 0x7f) << 4) + color1];
439         color2 = state->clut[((state->clutsel & 0x7f) << 4) + color2];
442440
443         if ((!gfxdraw_mode) || (nbmj8891_vram & 0x01))
441         if ((!state->gfxdraw_mode) || (state->vram & 0x01))
444442         {
445443            // layer 1
446444            if (color1 != 0xff)
447445            {
448               nbmj8891_videoram0[(dy1 * width) + dx1] = color1;
446               state->videoram0[(dy1 * width) + dx1] = color1;
449447               update_pixel0(machine, dx1, dy1);
450448            }
451449            if (color2 != 0xff)
452450            {
453               nbmj8891_videoram0[(dy1 * width) + dx2] = color2;
451               state->videoram0[(dy1 * width) + dx2] = color2;
454452               update_pixel0(machine, dx2, dy1);
455453            }
456454         }
457         if (gfxdraw_mode && (nbmj8891_vram & 0x02))
455         if (state->gfxdraw_mode && (state->vram & 0x02))
458456         {
459457            // layer 2
460            if (nbmj8891_vram & 0x08)
458            if (state->vram & 0x08)
461459            {
462460               // transparent enable
463461               if (color1 != 0xff)
464462               {
465                  nbmj8891_videoram1[(dy2 * width) + dx1] = color1;
463                  state->videoram1[(dy2 * width) + dx1] = color1;
466464                  update_pixel1(machine, dx1, dy2);
467465               }
468466               if (color2 != 0xff)
469467               {
470                  nbmj8891_videoram1[(dy2 * width) + dx2] = color2;
468                  state->videoram1[(dy2 * width) + dx2] = color2;
471469                  update_pixel1(machine, dx2, dy2);
472470               }
473471            }
474472            else
475473            {
476474               // transparent disable
477               nbmj8891_videoram1[(dy2 * width) + dx1] = color1;
475               state->videoram1[(dy2 * width) + dx1] = color1;
478476               update_pixel1(machine, dx1, dy2);
479               nbmj8891_videoram1[(dy2 * width) + dx2] = color2;
477               state->videoram1[(dy2 * width) + dx2] = color2;
480478               update_pixel1(machine, dx2, dy2);
481479            }
482480         }
r10613r10614
495493******************************************************************************/
496494VIDEO_START( nbmj8891_1layer )
497495{
496   nbmj8891_state *state = machine->driver_data<nbmj8891_state>();
498497   UINT8 *CLUT = machine->region("protection")->base();
499498   int i;
500499   int width = machine->primary_screen->width();
501500   int height = machine->primary_screen->height();
502501
503   nbmj8891_tmpbitmap0 = machine->primary_screen->alloc_compatible_bitmap();
504   nbmj8891_videoram0 = auto_alloc_array(machine, UINT8, width * height);
505   nbmj8891_palette = auto_alloc_array(machine, UINT8, 0x200);
506   nbmj8891_clut = auto_alloc_array(machine, UINT8, 0x800);
507   memset(nbmj8891_videoram0, 0xff, (width * height * sizeof(char)));
508   gfxdraw_mode = 0;
502   state->tmpbitmap0 = machine->primary_screen->alloc_compatible_bitmap();
503   state->videoram0 = auto_alloc_array(machine, UINT8, width * height);
504   state->palette = auto_alloc_array(machine, UINT8, 0x200);
505   state->clut = auto_alloc_array(machine, UINT8, 0x800);
506   memset(state->videoram0, 0xff, (width * height * sizeof(char)));
507   state->gfxdraw_mode = 0;
509508
510509   if (nb1413m3_type == NB1413M3_TAIWANMB)
511      for (i = 0; i < 0x0800; i++) nbmj8891_clut[i] = CLUT[i];
510      for (i = 0; i < 0x0800; i++) state->clut[i] = CLUT[i];
512511}
513512
514513VIDEO_START( nbmj8891_2layer )
515514{
515   nbmj8891_state *state = machine->driver_data<nbmj8891_state>();
516516   int width = machine->primary_screen->width();
517517   int height = machine->primary_screen->height();
518518
519   nbmj8891_tmpbitmap0 = machine->primary_screen->alloc_compatible_bitmap();
520   nbmj8891_tmpbitmap1 = machine->primary_screen->alloc_compatible_bitmap();
521   nbmj8891_videoram0 = auto_alloc_array(machine, UINT8, width * height);
522   nbmj8891_videoram1 = auto_alloc_array(machine, UINT8, width * height);
523   nbmj8891_palette = auto_alloc_array(machine, UINT8, 0x200);
524   nbmj8891_clut = auto_alloc_array(machine, UINT8, 0x800);
525   memset(nbmj8891_videoram0, 0xff, (width * height * sizeof(UINT8)));
526   memset(nbmj8891_videoram1, 0xff, (width * height * sizeof(UINT8)));
527   gfxdraw_mode = 1;
519   state->tmpbitmap0 = machine->primary_screen->alloc_compatible_bitmap();
520   state->tmpbitmap1 = machine->primary_screen->alloc_compatible_bitmap();
521   state->videoram0 = auto_alloc_array(machine, UINT8, width * height);
522   state->videoram1 = auto_alloc_array(machine, UINT8, width * height);
523   state->palette = auto_alloc_array(machine, UINT8, 0x200);
524   state->clut = auto_alloc_array(machine, UINT8, 0x800);
525   memset(state->videoram0, 0xff, (width * height * sizeof(UINT8)));
526   memset(state->videoram1, 0xff, (width * height * sizeof(UINT8)));
527   state->gfxdraw_mode = 1;
528528}
529529
530530/******************************************************************************
r10613r10614
533533******************************************************************************/
534534SCREEN_UPDATE( nbmj8891 )
535535{
536   nbmj8891_state *state = screen->machine->driver_data<nbmj8891_state>();
536537   int x, y;
537538
538   if (nbmj8891_screen_refresh)
539   if (state->screen_refresh)
539540   {
540541      int width = screen->width();
541542      int height = screen->height();
542543
543      nbmj8891_screen_refresh = 0;
544      state->screen_refresh = 0;
544545      for (y = 0; y < height; y++)
545546         for (x = 0; x < width; x++)
546547            update_pixel0(screen->machine, x, y);
547548
548      if (gfxdraw_mode)
549      if (state->gfxdraw_mode)
549550         for (y = 0; y < height; y++)
550551            for (x = 0; x < width; x++)
551552               update_pixel1(screen->machine, x, y);
552553   }
553554
554   if (nbmj8891_dispflag)
555   if (state->dispflag)
555556   {
556      static int scrolly;
557      if (!nbmj8891_flipscreen) scrolly =   nbmj8891_scrolly;
558      else                      scrolly = (-nbmj8891_scrolly) & 0xff;
557      int scrolly;
558      if (!state->flipscreen) scrolly =   state->scrolly;
559      else                      scrolly = (-state->scrolly) & 0xff;
559560
560      if (gfxdraw_mode)
561      if (state->gfxdraw_mode)
561562      {
562         copyscrollbitmap      (bitmap, nbmj8891_tmpbitmap0, 0, 0, 0, 0, cliprect);
563         copyscrollbitmap_trans(bitmap, nbmj8891_tmpbitmap1, 0, 0, 1, &scrolly, cliprect, 0xff);
563         copyscrollbitmap      (bitmap, state->tmpbitmap0, 0, 0, 0, 0, cliprect);
564         copyscrollbitmap_trans(bitmap, state->tmpbitmap1, 0, 0, 1, &scrolly, cliprect, 0xff);
564565      }
565566      else
566         copyscrollbitmap(bitmap, nbmj8891_tmpbitmap0, 0, 0, 1, &scrolly, cliprect);
567         copyscrollbitmap(bitmap, state->tmpbitmap0, 0, 0, 1, &scrolly, cliprect);
567568   }
568569   else
569570      bitmap_fill(bitmap, 0, 0xff);
src/mame/video/magmax.c
r10613r10614
1010#include "emu.h"
1111#include "includes/magmax.h"
1212
13UINT16 *magmax_scroll_x;
14UINT16 *magmax_scroll_y;
15UINT16 *magmax_vreg;
16static int flipscreen = 0;
1713
18static UINT32 *prom_tab;
19
20
2114/***************************************************************************
2215
2316  Convert the color PROMs into a more useable format.
r10613r10614
7063
7164VIDEO_START( magmax )
7265{
66   magmax_state *state = machine->driver_data<magmax_state>();
7367   int i,v;
7468   UINT8 * prom14D = machine->region("user2")->base();
7569
7670   /* Set up save state */
77   state_save_register_global(machine, flipscreen);
71   state_save_register_global(machine, state->flipscreen);
7872
79   prom_tab = auto_alloc_array(machine, UINT32, 256);
73   state->prom_tab = auto_alloc_array(machine, UINT32, 256);
8074
8175   /* Allocate temporary bitmap */
8276   machine->generic.tmpbitmap = machine->primary_screen->alloc_compatible_bitmap();
r10613r10614
8478   for (i=0; i<256; i++)
8579   {
8680      v = (prom14D[i] << 4) + prom14D[i + 0x100];
87      prom_tab[i] = ((v&0x1f)<<8) | ((v&0x10)<<10) | ((v&0xe0)>>1); /*convert data into more useful format*/
81      state->prom_tab[i] = ((v&0x1f)<<8) | ((v&0x10)<<10) | ((v&0xe0)>>1); /*convert data into more useful format*/
8882   }
8983}
9084
r10613r10614
9892   int offs;
9993
10094   /* bit 2 flip screen */
101   flipscreen = *magmax_vreg & 0x04;
95   state->flipscreen = *state->vreg & 0x04;
10296
10397   /* copy the background graphics */
104   if (*magmax_vreg & 0x40)      /* background disable */
98   if (*state->vreg & 0x40)      /* background disable */
10599      bitmap_fill(bitmap, cliprect, 0);
106100   else
107101   {
108102      int v;
109103      UINT8 * rom18B = screen->machine->region("user1")->base();
110      UINT32 scroll_h = (*magmax_scroll_x) & 0x3fff;
111      UINT32 scroll_v = (*magmax_scroll_y) & 0xff;
104      UINT32 scroll_h = (*state->scroll_x) & 0x3fff;
105      UINT32 scroll_v = (*state->scroll_y) & 0xff;
112106
113107      /*clear background-over-sprites bitmap*/
114108      bitmap_fill(screen->machine->generic.tmpbitmap, NULL, 0);
r10613r10614
142136                  LS283 =   LS283 + rom18B[ map_v_scr_1fe_6 + h ] + 0xff01;
143137            }
144138
145            prom_data = prom_tab[ (LS283 >> 6) & 0xff ];
139            prom_data = state->prom_tab[ (LS283 >> 6) & 0xff ];
146140
147141            rom18D_addr &= 0x20f8;
148142            rom18D_addr += (prom_data & 0x1f00) + ((LS283 & 0x38) >>3);
r10613r10614
165159               *BITMAP_ADDR16(screen->machine->generic.tmpbitmap, v, h) = line_data[h];
166160         }
167161
168         if (flipscreen)
162         if (state->flipscreen)
169163         {
170164            int i;
171165            UINT16 line_data_flip_x[256];
r10613r10614
196190         sx = (spriteram16[offs + 3] & 0xff) - 0x80 + 0x100 * (attr & 0x01);
197191         sy = 239 - sy;
198192
199         if (flipscreen)
193         if (state->flipscreen)
200194         {
201195            sx = 255-16 - sx;
202196            sy = 239 - sy;
r10613r10614
205199         }
206200
207201         if (code & 0x80)   /* sprite bankswitch */
208            code += (*magmax_vreg & 0x30) * 0x8;
202            code += (*state->vreg & 0x30) * 0x8;
209203
210204         drawgfx_transmask(bitmap, cliprect, screen->machine->gfx[1],
211205               code,
r10613r10614
216210      }
217211   }
218212
219   if (!(*magmax_vreg & 0x40))      /* background disable */
220      copybitmap_trans(bitmap, screen->machine->generic.tmpbitmap, flipscreen,flipscreen,0,0, cliprect, 0);
213   if (!(*state->vreg & 0x40))      /* background disable */
214      copybitmap_trans(bitmap, screen->machine->generic.tmpbitmap, state->flipscreen,state->flipscreen,0,0, cliprect, 0);
221215
222216   /* draw the foreground characters */
223217   for (offs = 32*32-1; offs >= 0; offs -= 1)
224218   {
225      //int page = (*magmax_vreg>>3) & 0x1;
219      //int page = (*state->vreg>>3) & 0x1;
226220      int code;
227221
228222      code = videoram[offs /*+ page*/] & 0xff;
r10613r10614
231225         int sx = (offs % 32);
232226         int sy = (offs / 32);
233227
234         if (flipscreen)
228         if (state->flipscreen)
235229         {
236230            sx = 31 - sx;
237231            sy = 31 - sy;
r10613r10614
240234         drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[0],
241235               code,
242236               0,
243               flipscreen, flipscreen,
237               state->flipscreen, state->flipscreen,
244238               8 * sx, 8 * sy, 0x0f);
245239      }
246240   }
src/mame/video/gatron.c
r10613r10614
2020#include "emu.h"
2121#include "includes/gatron.h"
2222
23static tilemap_t *bg_tilemap;
2423
25
2624WRITE8_HANDLER( gat_videoram_w )
2725{
2826   gatron_state *state = space->machine->driver_data<gatron_state>();
2927   UINT8 *videoram = state->videoram;
3028   videoram[offset] = data;
31   tilemap_mark_tile_dirty(bg_tilemap, offset);
29   tilemap_mark_tile_dirty(state->bg_tilemap, offset);
3230}
3331
3432static TILE_GET_INFO( get_bg_tile_info )
r10613r10614
4947
5048VIDEO_START( gat )
5149{
52   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols, 8, 16, 48, 16);
50   gatron_state *state = machine->driver_data<gatron_state>();
51   state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols, 8, 16, 48, 16);
5352}
5453
5554SCREEN_UPDATE( gat )
5655{
57   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
56   gatron_state *state = screen->machine->driver_data<gatron_state>();
57   tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
5858   return 0;
5959}
6060
src/mame/video/nbmj8688.c
r10613r10614
1111#include "includes/nbmj8688.h"
1212
1313
14static int mjsikaku_scrolly;
15static int blitter_destx, blitter_desty;
16static int blitter_sizex, blitter_sizey;
17static int blitter_direction_x, blitter_direction_y;
18static int blitter_src_addr;
19static int mjsikaku_gfxrom;
20static int mjsikaku_dispflag;
21static int mjsikaku_gfxflag2;
22static int mjsikaku_gfxflag3;
23static int mjsikaku_flipscreen;
24static int mjsikaku_screen_refresh;
25static int mjsikaku_gfxmode;
26
27static bitmap_t *mjsikaku_tmpbitmap;
28static UINT16 *mjsikaku_videoram;
29static UINT8 *nbmj8688_clut;
30
31static UINT8 *HD61830B_ram[2];
32static int HD61830B_instr[2];
33static int HD61830B_addr[2];
34
35
36static void mjsikaku_vramflip(void);
14static void mjsikaku_vramflip(nbmj8688_state *state);
3715static void mbmj8688_gfxdraw(running_machine *machine, int gfxtype);
3816
3917
r10613r10614
127105
128106WRITE8_HANDLER( nbmj8688_clut_w )
129107{
130   nbmj8688_clut[offset] = (data ^ 0xff);
108   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
109   state->clut[offset] = (data ^ 0xff);
131110}
132111
133112/******************************************************************************
r10613r10614
137116
138117WRITE8_HANDLER( nbmj8688_blitter_w )
139118{
119   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
140120   switch (offset)
141121   {
142      case 0x00:   blitter_src_addr = (blitter_src_addr & 0xff00) | data; break;
143      case 0x01:   blitter_src_addr = (blitter_src_addr & 0x00ff) | (data << 8); break;
144      case 0x02:   blitter_destx = data; break;
145      case 0x03:   blitter_desty = data; break;
146      case 0x04:   blitter_sizex = data; break;
147      case 0x05:   blitter_sizey = data;
122      case 0x00:   state->blitter_src_addr = (state->blitter_src_addr & 0xff00) | data; break;
123      case 0x01:   state->blitter_src_addr = (state->blitter_src_addr & 0x00ff) | (data << 8); break;
124      case 0x02:   state->blitter_destx = data; break;
125      case 0x03:   state->blitter_desty = data; break;
126      case 0x04:   state->blitter_sizex = data; break;
127      case 0x05:   state->blitter_sizey = data;
148128               /* writing here also starts the blit */
149               mbmj8688_gfxdraw(space->machine, mjsikaku_gfxmode);
129               mbmj8688_gfxdraw(space->machine, state->mjsikaku_gfxmode);
150130               break;
151      case 0x06:   blitter_direction_x = (data & 0x01) ? 1 : 0;
152               blitter_direction_y = (data & 0x02) ? 1 : 0;
153               mjsikaku_flipscreen = (data & 0x04) ? 0 : 1;
154               mjsikaku_dispflag = (data & 0x08) ? 0 : 1;
155               mjsikaku_vramflip();
131      case 0x06:   state->blitter_direction_x = (data & 0x01) ? 1 : 0;
132               state->blitter_direction_y = (data & 0x02) ? 1 : 0;
133               state->mjsikaku_flipscreen = (data & 0x04) ? 0 : 1;
134               state->mjsikaku_dispflag = (data & 0x08) ? 0 : 1;
135               mjsikaku_vramflip(state);
156136               break;
157137      case 0x07:   break;
158138   }
r10613r10614
160140
161141WRITE8_HANDLER( mjsikaku_gfxflag2_w )
162142{
163   mjsikaku_gfxflag2 = data;
143   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
144   state->mjsikaku_gfxflag2 = data;
164145
165146   if (nb1413m3_type == NB1413M3_SEIHAM
166147         || nb1413m3_type == NB1413M3_KORINAI
167148         || nb1413m3_type == NB1413M3_KORINAIM
168149         || nb1413m3_type == NB1413M3_LIVEGAL)
169      mjsikaku_gfxflag2 ^= 0x20;
150      state->mjsikaku_gfxflag2 ^= 0x20;
170151
171152   if (nb1413m3_type == NB1413M3_OJOUSANM
172153         || nb1413m3_type == NB1413M3_RYUUHA)
173      mjsikaku_gfxflag2 |= 0x20;
154      state->mjsikaku_gfxflag2 |= 0x20;
174155}
175156
176157static WRITE8_HANDLER( mjsikaku_gfxflag3_w )
177158{
178   mjsikaku_gfxflag3 = (data & 0xe0);
159   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
160   state->mjsikaku_gfxflag3 = (data & 0xe0);
179161}
180162
181163WRITE8_HANDLER( mjsikaku_scrolly_w )
182164{
183   mjsikaku_scrolly = data;
165   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
166   state->mjsikaku_scrolly = data;
184167}
185168
186169WRITE8_HANDLER( mjsikaku_romsel_w )
187170{
171   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
188172   int gfxlen = space->machine->region("gfx1")->bytes();
189   mjsikaku_gfxrom = (data & 0x0f);
173   state->mjsikaku_gfxrom = (data & 0x0f);
190174
191   if ((mjsikaku_gfxrom << 17) > (gfxlen - 1))
175   if ((state->mjsikaku_gfxrom << 17) > (gfxlen - 1))
192176   {
193177#ifdef MAME_DEBUG
194178      popmessage("GFXROM BANK OVER!!");
195179#endif
196      mjsikaku_gfxrom &= (gfxlen / 0x20000 - 1);
180      state->mjsikaku_gfxrom &= (gfxlen / 0x20000 - 1);
197181   }
198182}
199183
200184WRITE8_HANDLER( secolove_romsel_w )
201185{
186   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
202187   int gfxlen = space->machine->region("gfx1")->bytes();
203   mjsikaku_gfxrom = ((data & 0xc0) >> 4) + (data & 0x03);
188   state->mjsikaku_gfxrom = ((data & 0xc0) >> 4) + (data & 0x03);
204189   mjsikaku_gfxflag2_w(space, 0, data);
205190
206   if ((mjsikaku_gfxrom << 17) > (gfxlen - 1))
191   if ((state->mjsikaku_gfxrom << 17) > (gfxlen - 1))
207192   {
208193#ifdef MAME_DEBUG
209194      popmessage("GFXROM BANK OVER!!");
210195#endif
211      mjsikaku_gfxrom &= (gfxlen / 0x20000 - 1);
196      state->mjsikaku_gfxrom &= (gfxlen / 0x20000 - 1);
212197   }
213198}
214199
215200WRITE8_HANDLER( crystalg_romsel_w )
216201{
202   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
217203   int gfxlen = space->machine->region("gfx1")->bytes();
218   mjsikaku_gfxrom = (data & 0x03);
204   state->mjsikaku_gfxrom = (data & 0x03);
219205   mjsikaku_gfxflag2_w(space, 0, data);
220206
221   if ((mjsikaku_gfxrom << 17) > (gfxlen - 1))
207   if ((state->mjsikaku_gfxrom << 17) > (gfxlen - 1))
222208   {
223209#ifdef MAME_DEBUG
224210      popmessage("GFXROM BANK OVER!!");
225211#endif
226      mjsikaku_gfxrom &= (gfxlen / 0x20000 - 1);
212      state->mjsikaku_gfxrom &= (gfxlen / 0x20000 - 1);
227213   }
228214}
229215
230216WRITE8_HANDLER( seiha_romsel_w )
231217{
218   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
232219   int gfxlen = space->machine->region("gfx1")->bytes();
233   mjsikaku_gfxrom = (data & 0x1f);
220   state->mjsikaku_gfxrom = (data & 0x1f);
234221   mjsikaku_gfxflag3_w(space, 0, data);
235222
236   if ((mjsikaku_gfxrom << 17) > (gfxlen - 1))
223   if ((state->mjsikaku_gfxrom << 17) > (gfxlen - 1))
237224   {
238225#ifdef MAME_DEBUG
239226      popmessage("GFXROM BANK OVER!!");
240227#endif
241      mjsikaku_gfxrom &= (gfxlen / 0x20000 - 1);
228      state->mjsikaku_gfxrom &= (gfxlen / 0x20000 - 1);
242229   }
243230}
244231
r10613r10614
246233
247234
248235******************************************************************************/
249void mjsikaku_vramflip(void)
236void mjsikaku_vramflip(nbmj8688_state *state)
250237{
251   static int mjsikaku_flipscreen_old = 0;
252238   int x, y;
253239   UINT16 color1, color2;
254240
255   if (mjsikaku_flipscreen == mjsikaku_flipscreen_old) return;
241   if (state->mjsikaku_flipscreen == state->mjsikaku_flipscreen_old) return;
256242
257243   for (y = 0; y < (256 / 2); y++)
258244   {
259245      for (x = 0; x < 512; x++)
260246      {
261         color1 = mjsikaku_videoram[(y * 512) + x];
262         color2 = mjsikaku_videoram[((y ^ 0xff) * 512) + (x ^ 0x1ff)];
263         mjsikaku_videoram[(y * 512) + x] = color2;
264         mjsikaku_videoram[((y ^ 0xff) * 512) + (x ^ 0x1ff)] = color1;
247         color1 = state->mjsikaku_videoram[(y * 512) + x];
248         color2 = state->mjsikaku_videoram[((y ^ 0xff) * 512) + (x ^ 0x1ff)];
249         state->mjsikaku_videoram[(y * 512) + x] = color2;
250         state->mjsikaku_videoram[((y ^ 0xff) * 512) + (x ^ 0x1ff)] = color1;
265251      }
266252   }
267253
268   mjsikaku_flipscreen_old = mjsikaku_flipscreen;
269   mjsikaku_screen_refresh = 1;
254   state->mjsikaku_flipscreen_old = state->mjsikaku_flipscreen;
255   state->mjsikaku_screen_refresh = 1;
270256}
271257
272258
273static void update_pixel(int x, int y)
259static void update_pixel(nbmj8688_state *state, int x, int y)
274260{
275   int color = mjsikaku_videoram[(y * 512) + x];
276   *BITMAP_ADDR16(mjsikaku_tmpbitmap, y, x) = color;
261   int color = state->mjsikaku_videoram[(y * 512) + x];
262   *BITMAP_ADDR16(state->mjsikaku_tmpbitmap, y, x) = color;
277263}
278264
279static void writeram_low(int x, int y, int color)
265static void writeram_low(nbmj8688_state *state, int x, int y, int color)
280266{
281   mjsikaku_videoram[(y * 512) + x] &= 0xff00;
282   mjsikaku_videoram[(y * 512) + x] |= color;
283   update_pixel(x, y);
267   state->mjsikaku_videoram[(y * 512) + x] &= 0xff00;
268   state->mjsikaku_videoram[(y * 512) + x] |= color;
269   update_pixel(state, x, y);
284270}
285271
286static void writeram_high(int x, int y, int color)
272static void writeram_high(nbmj8688_state *state, int x, int y, int color)
287273{
288   mjsikaku_videoram[(y * 512) + x] &= 0x00ff;
289   mjsikaku_videoram[(y * 512) + x] |= color << 8;
290   update_pixel(x, y);
274   state->mjsikaku_videoram[(y * 512) + x] &= 0x00ff;
275   state->mjsikaku_videoram[(y * 512) + x] |= color << 8;
276   update_pixel(state, x, y);
291277}
292278
293279static TIMER_CALLBACK( blitter_timer_callback )
r10613r10614
297283
298284static void mbmj8688_gfxdraw(running_machine *machine, int gfxtype)
299285{
286   nbmj8688_state *state = machine->driver_data<nbmj8688_state>();
300287   UINT8 *GFX = machine->region("gfx1")->base();
301288
302289   int x, y;
r10613r10614
310297
311298   if (gfxtype == GFXTYPE_PURE_12BIT)
312299   {
313      if (mjsikaku_gfxflag2 & 0x20) return;
300      if (state->mjsikaku_gfxflag2 & 0x20) return;
314301   }
315302
316303   nb1413m3_busyctr = 0;
317304
318   startx = blitter_destx + blitter_sizex;
319   starty = blitter_desty + blitter_sizey;
305   startx = state->blitter_destx + state->blitter_sizex;
306   starty = state->blitter_desty + state->blitter_sizey;
320307
321   if (blitter_direction_x)
308   if (state->blitter_direction_x)
322309   {
323      sizex = blitter_sizex ^ 0xff;
310      sizex = state->blitter_sizex ^ 0xff;
324311      skipx = 1;
325312   }
326313   else
327314   {
328      sizex = blitter_sizex;
315      sizex = state->blitter_sizex;
329316      skipx = -1;
330317   }
331318
332   if (blitter_direction_y)
319   if (state->blitter_direction_y)
333320   {
334      sizey = blitter_sizey ^ 0xff;
321      sizey = state->blitter_sizey ^ 0xff;
335322      skipy = 1;
336323   }
337324   else
338325   {
339      sizey = blitter_sizey;
326      sizey = state->blitter_sizey;
340327      skipy = -1;
341328   }
342329
343330   gfxlen = machine->region("gfx1")->bytes();
344   gfxaddr = (mjsikaku_gfxrom << 17) + (blitter_src_addr << 1);
331   gfxaddr = (state->mjsikaku_gfxrom << 17) + (state->blitter_src_addr << 1);
345332//popmessage("ADDR:%08X DX:%03d DY:%03d SX:%03d SY:%03d", gfxaddr, startx, starty, sizex, sizey);
346//if (blitter_direction_x|blitter_direction_y) popmessage("ADDR:%08X FX:%01d FY:%01d", gfxaddr, blitter_direction_x, blitter_direction_y);
333//if (state->blitter_direction_x|state->blitter_direction_y) popmessage("ADDR:%08X FX:%01d FY:%01d", gfxaddr, state->blitter_direction_x, state->blitter_direction_y);
347334
348335   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
349336   {
r10613r10614
361348
362349         dx1 = (2 * x + 0) & 0x1ff;
363350         dx2 = (2 * x + 1) & 0x1ff;
364         dy = (y + mjsikaku_scrolly) & 0xff;
351         dy = (y + state->mjsikaku_scrolly) & 0xff;
365352
366         if (mjsikaku_flipscreen)
353         if (state->mjsikaku_flipscreen)
367354         {
368355            dx1 ^= 0x1ff;
369356            dx2 ^= 0x1ff;
r10613r10614
372359
373360         if (gfxtype == GFXTYPE_HYBRID_16BIT)
374361         {
375            if (mjsikaku_gfxflag3 & 0x40)
362            if (state->mjsikaku_gfxflag3 & 0x40)
376363            {
377364               // direct mode
378365
379               if (mjsikaku_gfxflag3 & 0x80)
366               if (state->mjsikaku_gfxflag3 & 0x80)
380367               {
381368                  /* least significant bits */
382369                  if (color != 0xff)
383370                  {
384                     writeram_low(dx1, dy, color);
385                     writeram_low(dx2, dy, color);
371                     writeram_low(state, dx1, dy, color);
372                     writeram_low(state, dx2, dy, color);
386373                  }
387374               }
388375               else
r10613r10614
390377                  /* most significant bits */
391378                  if (color != 0xff)
392379                  {
393                     writeram_high(dx1, dy, color);
394                     writeram_high(dx2, dy, color);
380                     writeram_high(state, dx1, dy, color);
381                     writeram_high(state, dx2, dy, color);
395382                  }
396383               }
397384            }
r10613r10614
401388               // lookup table mode
402389
403390               // unknown flag (seiha, seiham)
404            //  if (mjsikaku_gfxflag3 & 0x80) return;
391            //  if (state->mjsikaku_gfxflag3 & 0x80) return;
405392
406393               // unknown (seiha, seiham, iemoto, ojousan)
407               if (!(mjsikaku_gfxflag2 & 0x20)) return;
394               if (!(state->mjsikaku_gfxflag2 & 0x20)) return;
408395
409               if (blitter_direction_x)
396               if (state->blitter_direction_x)
410397               {
411398                  // flip
412399                  color1 = (color & 0x0f) >> 0;
r10613r10614
419406                  color2 = (color & 0x0f) >> 0;
420407               }
421408
422               color1 = (nbmj8688_clut[color1] << 8) | ((nbmj8688_clut[color1 | 0x10] & 0x0f) << 4);
423               color2 = (nbmj8688_clut[color2] << 8) | ((nbmj8688_clut[color2 | 0x10] & 0x0f) << 4);
409               color1 = (state->clut[color1] << 8) | ((state->clut[color1 | 0x10] & 0x0f) << 4);
410               color2 = (state->clut[color2] << 8) | ((state->clut[color2 | 0x10] & 0x0f) << 4);
424411
425412               if (color1 != 0xfff0)
426413               {
427414                  /* extend color from 12-bit to 16-bit */
428415                  color1 = (color1 & 0xffc0) | ((color1 & 0x20) >> 1) | ((color1 & 0x10) >> 2);
429                  mjsikaku_videoram[(dy * 512) + dx1] = color1;
430                  update_pixel(dx1, dy);
416                  state->mjsikaku_videoram[(dy * 512) + dx1] = color1;
417                  update_pixel(state, dx1, dy);
431418               }
432419
433420               if (color2 != 0xfff0)
434421               {
435422                  /* extend color from 12-bit to 16-bit */
436423                  color2 = (color2 & 0xffc0) | ((color2 & 0x20) >> 1) | ((color2 & 0x10) >> 2);
437                  mjsikaku_videoram[(dy * 512) + dx2] = color2;
438                  update_pixel(dx2, dy);
424                  state->mjsikaku_videoram[(dy * 512) + dx2] = color2;
425                  update_pixel(state, dx2, dy);
439426               }
440427            }
441428         }
r10613r10614
443430         {
444431            /* 12-bit palette with 4-to-12 bit lookup table */
445432
446            if (blitter_direction_x)
433            if (state->blitter_direction_x)
447434            {
448435               // flip
449436               color1 = (color & 0x0f) >> 0;
r10613r10614
456443               color2 = (color & 0x0f) >> 0;
457444            }
458445
459            color1 = nbmj8688_clut[color1] | ((nbmj8688_clut[color1 | 0x10] & 0x0f) << 8);
460            color2 = nbmj8688_clut[color2] | ((nbmj8688_clut[color2 | 0x10] & 0x0f) << 8);
446            color1 = state->clut[color1] | ((state->clut[color1 | 0x10] & 0x0f) << 8);
447            color2 = state->clut[color2] | ((state->clut[color2 | 0x10] & 0x0f) << 8);
461448
462449            if (color1 != 0x0fff)
463450            {
464               mjsikaku_videoram[(dy * 512) + dx1] = color1;
465               update_pixel(dx1, dy);
451               state->mjsikaku_videoram[(dy * 512) + dx1] = color1;
452               update_pixel(state, dx1, dy);
466453            }
467454            if (color2 != 0x0fff)
468455            {
469               mjsikaku_videoram[(dy * 512) + dx2] = color2;
470               update_pixel(dx2, dy);
456               state->mjsikaku_videoram[(dy * 512) + dx2] = color2;
457               update_pixel(state, dx2, dy);
471458            }
472459         }
473460         else
474461         {
475            if (gfxtype == GFXTYPE_HYBRID_12BIT && (mjsikaku_gfxflag2 & 0x20))
462            if (gfxtype == GFXTYPE_HYBRID_12BIT && (state->mjsikaku_gfxflag2 & 0x20))
476463            {
477464               /* 4096 colors mode, wedged in on top of normal mode
478465                       Here we affect only the 4 least significant bits, the others are
479466                       changed as usual.
480467                     */
481468
482               if (mjsikaku_gfxflag2 & 0x10)
469               if (state->mjsikaku_gfxflag2 & 0x10)
483470               {
484471                  // 4096 colors low mode (2nd draw upper)
485                  color = nbmj8688_clut[((color & 0xf0) >> 4)];
472                  color = state->clut[((color & 0xf0) >> 4)];
486473               }
487474               else
488475               {
489476                  // 4096 colors low mode (1st draw lower)
490                  color = nbmj8688_clut[((color & 0x0f) >> 0)];
477                  color = state->clut[((color & 0x0f) >> 0)];
491478               }
492479
493480               if (color != 0xff)
494481               {
495482                  color &= 0x0f;
496                  writeram_high(dx1, dy, color);
497                  writeram_high(dx2, dy, color);
483                  writeram_high(state, dx1, dy, color);
484                  writeram_high(state, dx2, dy, color);
498485               }
499486            }
500487            else
501488            {
502               if (mjsikaku_gfxflag2 & 0x04)
489               if (state->mjsikaku_gfxflag2 & 0x04)
503490               {
504491                  // direct mode
505492
r10613r10614
509496               {
510497                  // lookup table mode
511498
512                  if (blitter_direction_x)
499                  if (state->blitter_direction_x)
513500                  {
514501                     // flip
515502                     color1 = (color & 0x0f) >> 0;
r10613r10614
522509                     color2 = (color & 0x0f) >> 0;
523510                  }
524511
525                  color1 = nbmj8688_clut[color1];
526                  color2 = nbmj8688_clut[color2];
512                  color1 = state->clut[color1];
513                  color2 = state->clut[color2];
527514               }
528515
529               if (gfxtype == GFXTYPE_PURE_16BIT && !(mjsikaku_gfxflag2 & 0x20))
516               if (gfxtype == GFXTYPE_PURE_16BIT && !(state->mjsikaku_gfxflag2 & 0x20))
530517               {
531518                  /* 16-bit palette most significant bits */
532                  if (color1 != 0xff) writeram_high(dx1, dy, color1);
533                  if (color2 != 0xff) writeram_high(dx2, dy, color2);
519                  if (color1 != 0xff) writeram_high(state, dx1, dy, color1);
520                  if (color2 != 0xff) writeram_high(state, dx2, dy, color2);
534521               }
535522               else
536523               {
537524                  /* 8-bit palette or 16-bit palette least significant bits */
538                  if (color1 != 0xff) writeram_low(dx1, dy, color1);
539                  if (color2 != 0xff) writeram_low(dx2, dy, color2);
525                  if (color1 != 0xff) writeram_low(state, dx1, dy, color1);
526                  if (color2 != 0xff) writeram_low(state, dx2, dy, color2);
540527               }
541528            }
542529         }
r10613r10614
561548
562549static void common_video_start(running_machine *machine)
563550{
564   mjsikaku_tmpbitmap = auto_bitmap_alloc(machine, 512, 256, machine->primary_screen->format());
565   mjsikaku_videoram = auto_alloc_array_clear(machine, UINT16, 512 * 256);
566   nbmj8688_clut = auto_alloc_array(machine, UINT8, 0x20);
551   nbmj8688_state *state = machine->driver_data<nbmj8688_state>();
552   state->mjsikaku_tmpbitmap = auto_bitmap_alloc(machine, 512, 256, machine->primary_screen->format());
553   state->mjsikaku_videoram = auto_alloc_array_clear(machine, UINT16, 512 * 256);
554   state->clut = auto_alloc_array(machine, UINT8, 0x20);
567555
568   mjsikaku_scrolly = 0;   // reset because crystalg/crystal2 don't write to this register
556   state->mjsikaku_scrolly = 0;   // reset because crystalg/crystal2 don't write to this register
569557}
570558
571559VIDEO_START( mbmj8688_8bit )
572560{
573   mjsikaku_gfxmode = GFXTYPE_8BIT;
561   nbmj8688_state *state = machine->driver_data<nbmj8688_state>();
562   state->mjsikaku_gfxmode = GFXTYPE_8BIT;
574563   common_video_start(machine);
575564}
576565
577566VIDEO_START( mbmj8688_hybrid_12bit )
578567{
579   mjsikaku_gfxmode = GFXTYPE_HYBRID_12BIT;
568   nbmj8688_state *state = machine->driver_data<nbmj8688_state>();
569   state->mjsikaku_gfxmode = GFXTYPE_HYBRID_12BIT;
580570   common_video_start(machine);
581571}
582572
583573VIDEO_START( mbmj8688_pure_12bit )
584574{
585   mjsikaku_gfxmode = GFXTYPE_PURE_12BIT;
575   nbmj8688_state *state = machine->driver_data<nbmj8688_state>();
576   state->mjsikaku_gfxmode = GFXTYPE_PURE_12BIT;
586577   common_video_start(machine);
587578}
588579
589580VIDEO_START( mbmj8688_hybrid_16bit )
590581{
591   mjsikaku_gfxmode = GFXTYPE_HYBRID_16BIT;
582   nbmj8688_state *state = machine->driver_data<nbmj8688_state>();
583   state->mjsikaku_gfxmode = GFXTYPE_HYBRID_16BIT;
592584   common_video_start(machine);
593585}
594586
595587VIDEO_START( mbmj8688_pure_16bit )
596588{
597   mjsikaku_gfxmode = GFXTYPE_PURE_16BIT;
589   nbmj8688_state *state = machine->driver_data<nbmj8688_state>();
590   state->mjsikaku_gfxmode = GFXTYPE_PURE_16BIT;
598591   common_video_start(machine);
599592}
600593
601594VIDEO_START( mbmj8688_pure_16bit_LCD )
602595{
603   mjsikaku_gfxmode = GFXTYPE_PURE_16BIT;
596   nbmj8688_state *state = machine->driver_data<nbmj8688_state>();
597   state->mjsikaku_gfxmode = GFXTYPE_PURE_16BIT;
604598
605   HD61830B_ram[0] = auto_alloc_array(machine, UINT8, 0x10000);
606   HD61830B_ram[1] = auto_alloc_array(machine, UINT8, 0x10000);
599   state->HD61830B_ram[0] = auto_alloc_array(machine, UINT8, 0x10000);
600   state->HD61830B_ram[1] = auto_alloc_array(machine, UINT8, 0x10000);
607601
608602   common_video_start(machine);
609603}
r10613r10614
616610
617611******************************************************************************/
618612
619static void nbmj8688_HD61830B_instr_w(int chip,int offset,int data)
613static void nbmj8688_HD61830B_instr_w(address_space *space,int offset,int data,int chip)
620614{
621   HD61830B_instr[chip] = data;
615   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
616   state->HD61830B_instr[chip] = data;
622617}
623618
624static void nbmj8688_HD61830B_data_w(int chip,int offset,int data)
619static void nbmj8688_HD61830B_data_w(address_space *space,int offset,int data,int chip)
625620{
626   switch (HD61830B_instr[chip])
621   nbmj8688_state *state = space->machine->driver_data<nbmj8688_state>();
622   switch (state->HD61830B_instr[chip])
627623   {
628624      case 0x0a:   // set cursor address (low order)
629         HD61830B_addr[chip] = (HD61830B_addr[chip] & 0xff00) | data;
625         state->HD61830B_addr[chip] = (state->HD61830B_addr[chip] & 0xff00) | data;
630626         break;
631627      case 0x0b:   // set cursor address (high order)
632         HD61830B_addr[chip] = (HD61830B_addr[chip] & 0x00ff) | (data << 8);
628         state->HD61830B_addr[chip] = (state->HD61830B_addr[chip] & 0x00ff) | (data << 8);
633629         break;
634630      case 0x0c:   // write display data
635         HD61830B_ram[chip][HD61830B_addr[chip]++] = data;
631         state->HD61830B_ram[chip][state->HD61830B_addr[chip]++] = data;
636632         break;
637633      default:
638logerror("HD61830B unsupported instruction %02x %02x\n",HD61830B_instr[chip],data);
634logerror("HD61830B unsupported instruction %02x %02x\n",state->HD61830B_instr[chip],data);
639635         break;
640636   }
641637}
642638
643639WRITE8_HANDLER( nbmj8688_HD61830B_0_instr_w )
644640{
645   nbmj8688_HD61830B_instr_w(0,offset,data);
641   nbmj8688_HD61830B_instr_w(space,offset,data,0);
646642}
647643
648644WRITE8_HANDLER( nbmj8688_HD61830B_1_instr_w )
649645{
650   nbmj8688_HD61830B_instr_w(1,offset,data);
646   nbmj8688_HD61830B_instr_w(space,offset,data,1);
651647}
652648
653649WRITE8_HANDLER( nbmj8688_HD61830B_both_instr_w )
654650{
655   nbmj8688_HD61830B_instr_w(0,offset,data);
656   nbmj8688_HD61830B_instr_w(1,offset,data);
651   nbmj8688_HD61830B_instr_w(space,offset,data,0);
652   nbmj8688_HD61830B_instr_w(space,offset,data,1);
657653}
658654
659655WRITE8_HANDLER( nbmj8688_HD61830B_0_data_w )
660656{
661   nbmj8688_HD61830B_data_w(0,offset,data);
657   nbmj8688_HD61830B_data_w(space,offset,data,0);
662658}
663659
664660WRITE8_HANDLER( nbmj8688_HD61830B_1_data_w )
665661{
666   nbmj8688_HD61830B_data_w(1,offset,data);
662   nbmj8688_HD61830B_data_w(space,offset,data,1);
667663}
668664
669665WRITE8_HANDLER( nbmj8688_HD61830B_both_data_w )
670666{
671   nbmj8688_HD61830B_data_w(0,offset,data);
672   nbmj8688_HD61830B_data_w(1,offset,data);
667   nbmj8688_HD61830B_data_w(space,offset,data,0);
668   nbmj8688_HD61830B_data_w(space,offset,data,1);
673669}
674670
675671
r10613r10614
682678
683679SCREEN_UPDATE( mbmj8688 )
684680{
681   nbmj8688_state *state = screen->machine->driver_data<nbmj8688_state>();
685682   int x, y;
686683
687   if (mjsikaku_screen_refresh)
684   if (state->mjsikaku_screen_refresh)
688685   {
689      mjsikaku_screen_refresh = 0;
686      state->mjsikaku_screen_refresh = 0;
690687      for (y = 0; y < 256; y++)
691688      {
692689         for (x = 0; x < 512; x++)
693690         {
694            update_pixel(x,y);
691            update_pixel(state, x, y);
695692         }
696693      }
697694   }
698695
699   if (mjsikaku_dispflag)
696   if (state->mjsikaku_dispflag)
700697   {
701698      int scrolly;
702      if (mjsikaku_flipscreen) scrolly =   mjsikaku_scrolly;
703      else                     scrolly = (-mjsikaku_scrolly) & 0xff;
699      if (state->mjsikaku_flipscreen) scrolly =   state->mjsikaku_scrolly;
700      else                     scrolly = (-state->mjsikaku_scrolly) & 0xff;
704701
705      copybitmap(bitmap, mjsikaku_tmpbitmap, 0, 0, 0, scrolly,       cliprect);
706      copybitmap(bitmap, mjsikaku_tmpbitmap, 0, 0, 0, scrolly - 256, cliprect);
702      copybitmap(bitmap, state->mjsikaku_tmpbitmap, 0, 0, 0, scrolly,       cliprect);
703      copybitmap(bitmap, state->mjsikaku_tmpbitmap, 0, 0, 0, scrolly - 256, cliprect);
707704   }
708705   else
709706      bitmap_fill(bitmap, 0, 0);
r10613r10614
715712
716713SCREEN_UPDATE( mbmj8688_lcd0 )
717714{
715   nbmj8688_state *state = screen->machine->driver_data<nbmj8688_state>();
718716   int x, y, b;
719717
720718   for (y = 0;y < 64;y++)
721719      for (x = 0;x < 60;x++)
722720      {
723         int data = HD61830B_ram[0][y * 60 + x];
721         int data = state->HD61830B_ram[0][y * 60 + x];
724722
725723         for (b = 0;b < 8;b++)
726724            *BITMAP_ADDR16(bitmap, y, (8*x+b)) = (data & (1<<b)) ? 0x0000 : 0x18ff;
r10613r10614
730728
731729SCREEN_UPDATE( mbmj8688_lcd1 )
732730{
731   nbmj8688_state *state = screen->machine->driver_data<nbmj8688_state>();
733732   int x, y, b;
734733
735734   for (y = 0;y < 64;y++)
736735      for (x = 0;x < 60;x++)
737736      {
738         int data = HD61830B_ram[1][y * 60 + x];
737         int data = state->HD61830B_ram[1][y * 60 + x];
739738
740739         for (b = 0;b < 8;b++)
741740            *BITMAP_ADDR16(bitmap, y, (8*x+b)) = (data & (1<<b)) ? 0x0000 : 0x18ff;
src/mame/video/victory.c
r10613r10614
88#include "includes/victory.h"
99
1010
11/* globally-accessible storage */
12UINT8 *victory_videoram;
13UINT8 *victory_charram;
1411
15/* local allocated storage */
16static UINT16 victory_paletteram[0x40];   /* 9 bits used */
17static UINT8 *bgbitmap;
18static UINT8 *fgbitmap;
19static UINT8 *rram, *gram, *bram;
20
21/* interrupt, collision, and control states */
22static UINT8 vblank_irq;
23static UINT8 fgcoll, fgcollx, fgcolly;
24static UINT8 bgcoll, bgcollx, bgcolly;
25static UINT8 scrollx, scrolly;
26static UINT8 video_control;
27
28/* microcode state */
29static struct
30{
31   UINT16      i;
32   UINT16      pc;
33   UINT8      r,g,b;
34   UINT8      x,xp,y,yp;
35   UINT8      cmd,cmdlo;
36   emu_timer *   timer;
37   UINT8      timer_active;
38   attotime   endtime;
39} micro;
40
41
4212/* number of ticks per clock of the microcode state machine   */
4313/* from what I can tell, this should be divided by 32, not 8  */
4414/* but the interrupt test does some precise timing, and fails */
r10613r10614
5323
5424
5525/* function prototypes */
56static int command2(void);
26static int command2(running_machine *machine);
5727static int command3(running_machine *machine);
5828static int command4(running_machine *machine);
5929static int command5(running_machine *machine);
60static int command6(void);
30static int command6(running_machine *machine);
6131static int command7(running_machine *machine);
6232
6333
r10613r10614
7040
7141VIDEO_START( victory )
7242{
43   victory_state *state = machine->driver_data<victory_state>();
7344   /* allocate bitmapram */
74   rram = auto_alloc_array(machine, UINT8, 0x4000);
75   gram = auto_alloc_array(machine, UINT8, 0x4000);
76   bram = auto_alloc_array(machine, UINT8, 0x4000);
45   state->rram = auto_alloc_array(machine, UINT8, 0x4000);
46   state->gram = auto_alloc_array(machine, UINT8, 0x4000);
47   state->bram = auto_alloc_array(machine, UINT8, 0x4000);
7748
7849   /* allocate bitmaps */
79   bgbitmap = auto_alloc_array(machine, UINT8, 256 * 256);
80   fgbitmap = auto_alloc_array(machine, UINT8, 256 * 256);
50   state->bgbitmap = auto_alloc_array(machine, UINT8, 256 * 256);
51   state->fgbitmap = auto_alloc_array(machine, UINT8, 256 * 256);
8152
8253   /* reset globals */
83   vblank_irq = 0;
84   fgcoll = fgcollx = fgcolly = 0;
85   bgcoll = bgcollx = bgcolly = 0;
86   scrollx = scrolly = 0;
87   video_control = 0;
88   memset(&micro, 0, sizeof(micro));
89   micro.timer = machine->scheduler().timer_alloc(FUNC(NULL));
54   state->vblank_irq = 0;
55   state->fgcoll = state->fgcollx = state->fgcolly = 0;
56   state->bgcoll = state->bgcollx = state->bgcolly = 0;
57   state->scrollx = state->scrolly = 0;
58   state->video_control = 0;
59   memset(&state->micro, 0, sizeof(state->micro));
60   state->micro.timer = machine->scheduler().timer_alloc(FUNC(NULL));
9061
9162   /* register for state saving */
92   state_save_register_global_array(machine, victory_paletteram);
63   state_save_register_global_array(machine, state->paletteram);
9364}
9465
9566
r10613r10614
10273
10374static void victory_update_irq(running_machine *machine)
10475{
105   if (vblank_irq || fgcoll || (bgcoll && (video_control & 0x20)))
76   victory_state *state = machine->driver_data<victory_state>();
77   if (state->vblank_irq || state->fgcoll || (state->bgcoll && (state->video_control & 0x20)))
10678      cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
10779   else
10880      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
r10613r10614
11183
11284INTERRUPT_GEN( victory_vblank_interrupt )
11385{
114   vblank_irq = 1;
86   victory_state *state = device->machine->driver_data<victory_state>();
87   state->vblank_irq = 1;
11588
11689   victory_update_irq(device->machine);
11790}
r10613r10614
12699
127100WRITE8_HANDLER( victory_paletteram_w )
128101{
129   victory_paletteram[offset & 0x3f] = ((offset & 0x80) << 1) | data;
102   victory_state *state = space->machine->driver_data<victory_state>();
103   state->paletteram[offset & 0x3f] = ((offset & 0x80) << 1) | data;
130104}
131105
132106
133107static void set_palette(running_machine *machine)
134108{
109   victory_state *state = machine->driver_data<victory_state>();
135110   offs_t offs;
136111
137112   for (offs = 0; offs < 0x40; offs++)
138113   {
139      UINT16 data = victory_paletteram[offs];
114      UINT16 data = state->paletteram[offs];
140115
141116      palette_set_color_rgb(machine, offs, pal3bit(data >> 6), pal3bit(data >> 0), pal3bit(data >> 3));
142117   }
r10613r10614
152127
153128READ8_HANDLER( victory_video_control_r )
154129{
130   victory_state *state = space->machine->driver_data<victory_state>();
155131   int result = 0;
156132
157133   switch (offset)
158134   {
159135      case 0x00:   /* 5XFIQ */
160         result = fgcollx;
136         result = state->fgcollx;
161137         if (LOG_COLLISION) logerror("%04X:5XFIQ read = %02X\n", cpu_get_previouspc(space->cpu), result);
162138         return result;
163139
164140      case 0x01:   /* 5CLFIQ */
165         result = fgcolly;
166         if (fgcoll)
141         result = state->fgcolly;
142         if (state->fgcoll)
167143         {
168            fgcoll = 0;
144            state->fgcoll = 0;
169145            victory_update_irq(space->machine);
170146         }
171147         if (LOG_COLLISION) logerror("%04X:5CLFIQ read = %02X\n", cpu_get_previouspc(space->cpu), result);
172148         return result;
173149
174150      case 0x02:   /* 5BACKX */
175         result = bgcollx & 0xfc;
151         result = state->bgcollx & 0xfc;
176152         if (LOG_COLLISION) logerror("%04X:5BACKX read = %02X\n", cpu_get_previouspc(space->cpu), result);
177153         return result;
178154
179155      case 0x03:   /* 5BACKY */
180         result = bgcolly;
181         if (bgcoll)
156         result = state->bgcolly;
157         if (state->bgcoll)
182158         {
183            bgcoll = 0;
159            state->bgcoll = 0;
184160            victory_update_irq(space->machine);
185161         }
186162         if (LOG_COLLISION) logerror("%04X:5BACKY read = %02X\n", cpu_get_previouspc(space->cpu), result);
r10613r10614
192168         // D5 = 5VIRQ
193169         // D4 = 5BCIRQ (3B1)
194170         // D3 = SL256
195         if (micro.timer_active && micro.timer->elapsed() < micro.endtime)
171         if (state->micro.timer_active && state->micro.timer->elapsed() < state->micro.endtime)
196172            result |= 0x80;
197         result |= (~fgcoll & 1) << 6;
198         result |= (~vblank_irq & 1) << 5;
199         result |= (~bgcoll & 1) << 4;
173         result |= (~state->fgcoll & 1) << 6;
174         result |= (~state->vblank_irq & 1) << 5;
175         result |= (~state->bgcoll & 1) << 4;
200176         result |= (space->machine->primary_screen->vpos() & 0x100) >> 5;
201177         if (LOG_COLLISION) logerror("%04X:5STAT read = %02X\n", cpu_get_previouspc(space->cpu), result);
202178         return result;
r10613r10614
218194
219195WRITE8_HANDLER( victory_video_control_w )
220196{
197   victory_state *state = space->machine->driver_data<victory_state>();
198   struct micro_t &micro = state->micro;
221199   switch (offset)
222200   {
223201      case 0x00:   /* LOAD IL */
r10613r10614
246224         else if (micro.cmdlo == 6)
247225         {
248226            if (LOG_MICROCODE) logerror("  Command 6 triggered\n");
249            command6();
227            command6(space->machine);
250228         }
251229         break;
252230
r10613r10614
286264         if (micro.cmdlo == 2)
287265         {
288266            if (LOG_MICROCODE) logerror("  Command 2 triggered by write to B\n");
289            command2();
267            command2(space->machine);
290268         }
291269         else if (micro.cmdlo == 7)
292270         {
r10613r10614
297275
298276      case 0x08:   /* SCROLLX */
299277         if (LOG_MICROCODE) logerror("%04X:SCROLLX write = %02X\n", cpu_get_previouspc(space->cpu), data);
300         scrollx = data;
278         state->scrollx = data;
301279         break;
302280
303281      case 0x09:   /* SCROLLY */
304282         if (LOG_MICROCODE) logerror("%04X:SCROLLY write = %02X\n", cpu_get_previouspc(space->cpu), data);
305         scrolly = data;
283         state->scrolly = data;
306284         break;
307285
308286      case 0x0a:   /* CONTROL */
r10613r10614
314292         // D2 = BIR12
315293         // D1 = SELOVER
316294         if (LOG_MICROCODE) logerror("%04X:CONTROL write = %02X\n", cpu_get_previouspc(space->cpu), data);
317         video_control = data;
295         state->video_control = data;
318296         break;
319297
320298      case 0x0b:   /* CLRVIRQ */
321299         if (LOG_MICROCODE) logerror("%04X:CLRVIRQ write = %02X\n", cpu_get_previouspc(space->cpu), data);
322         vblank_irq = 0;
300         state->vblank_irq = 0;
323301         victory_update_irq(space->machine);
324302         break;
325303
r10613r10614
524502 *
525503 *************************************/
526504
527INLINE void count_states(int states)
505INLINE void count_states(struct micro_t &micro, int states)
528506{
529507   attotime state_time = MICRO_STATE_CLOCK_PERIOD * states;
530508
r10613r10614
552530 *
553531 *************************************/
554532
555static int command2(void)
533static int command2(running_machine *machine)
556534{
535   victory_state *state = machine->driver_data<victory_state>();
536   struct micro_t &micro = state->micro;
557537/*
558538    Actual microcode:
559539          02    00                    0   0  ZERORAM, INCI, SWVRAM
r10613r10614
566546   int addr = micro.i++ & 0x3fff;
567547
568548   if (micro.cmd & 0x10)
569      gram[addr] = micro.g;
549      state->gram[addr] = micro.g;
570550   if (micro.cmd & 0x20)
571      bram[addr] = micro.b;
551      state->bram[addr] = micro.b;
572552   if (micro.cmd & 0x40)
573      rram[addr] = micro.r;
553      state->rram[addr] = micro.r;
574554
575   count_states(3);
555   count_states(micro, 3);
576556   return 0;
577557}
578558
r10613r10614
586566
587567static int command3(running_machine *machine)
588568{
569   victory_state *state = machine->driver_data<victory_state>();
570   struct micro_t &micro = state->micro;
589571/*
590572    Actual microcode:
591573          03    1C                    2   0  SLOADLH, SXFERY
r10613r10614
624606         UINT8 src;
625607
626608         /* non-collision-detect case */
627         if (!(micro.cmd & 0x08) || fgcoll)
609         if (!(micro.cmd & 0x08) || state->fgcoll)
628610         {
629611            if (micro.cmd & 0x10)
630612            {
631               src = gram[srcoffs];
632               gram[dstoffs + 0] ^= src >> shift;
633               gram[dstoffs + 1] ^= src << nshift;
613               src = state->gram[srcoffs];
614               state->gram[dstoffs + 0] ^= src >> shift;
615               state->gram[dstoffs + 1] ^= src << nshift;
634616            }
635617            if (micro.cmd & 0x20)
636618            {
637               src = bram[srcoffs];
638               bram[dstoffs + 0] ^= src >> shift;
639               bram[dstoffs + 1] ^= src << nshift;
619               src = state->bram[srcoffs];
620               state->bram[dstoffs + 0] ^= src >> shift;
621               state->bram[dstoffs + 1] ^= src << nshift;
640622            }
641623            if (micro.cmd & 0x40)
642624            {
643               src = rram[srcoffs];
644               rram[dstoffs + 0] ^= src >> shift;
645               rram[dstoffs + 1] ^= src << nshift;
625               src = state->rram[srcoffs];
626               state->rram[dstoffs + 0] ^= src >> shift;
627               state->rram[dstoffs + 1] ^= src << nshift;
646628            }
647629         }
648630
r10613r10614
651633         {
652634            if (micro.cmd & 0x10)
653635            {
654               src = gram[srcoffs];
655               if ((gram[dstoffs + 0] & (src >> shift)) | (gram[dstoffs + 1] & (src << nshift)))
656                  fgcoll = 1, fgcollx = micro.xp, fgcolly = sy - 1;
657               gram[dstoffs + 0] ^= src >> shift;
658               gram[dstoffs + 1] ^= src << nshift;
636               src = state->gram[srcoffs];
637               if ((state->gram[dstoffs + 0] & (src >> shift)) | (state->gram[dstoffs + 1] & (src << nshift)))
638                  state->fgcoll = 1, state->fgcollx = micro.xp, state->fgcolly = sy - 1;
639               state->gram[dstoffs + 0] ^= src >> shift;
640               state->gram[dstoffs + 1] ^= src << nshift;
659641            }
660642            if (micro.cmd & 0x20)
661643            {
662               src = bram[srcoffs];
663               if ((bram[dstoffs + 0] & (src >> shift)) | (bram[dstoffs + 1] & (src << nshift)))
664                  fgcoll = 1, fgcollx = micro.xp, fgcolly = sy - 1;
665               bram[dstoffs + 0] ^= src >> shift;
666               bram[dstoffs + 1] ^= src << nshift;
644               src = state->bram[srcoffs];
645               if ((state->bram[dstoffs + 0] & (src >> shift)) | (state->bram[dstoffs + 1] & (src << nshift)))
646                  state->fgcoll = 1, state->fgcollx = micro.xp, state->fgcolly = sy - 1;
647               state->bram[dstoffs + 0] ^= src >> shift;
648               state->bram[dstoffs + 1] ^= src << nshift;
667649            }
668650            if (micro.cmd & 0x40)
669651            {
670               src = rram[srcoffs];
671               if ((rram[dstoffs + 0] & (src >> shift)) | (rram[dstoffs + 1] & (src << nshift)))
672                  fgcoll = 1, fgcollx = micro.xp, fgcolly = sy - 1;
673               rram[dstoffs + 0] ^= src >> shift;
674               rram[dstoffs + 1] ^= src << nshift;
652               src = state->rram[srcoffs];
653               if ((state->rram[dstoffs + 0] & (src >> shift)) | (state->rram[dstoffs + 1] & (src << nshift)))
654                  state->fgcoll = 1, state->fgcollx = micro.xp, state->fgcolly = sy - 1;
655               state->rram[dstoffs + 0] ^= src >> shift;
656               state->rram[dstoffs + 1] ^= src << nshift;
675657            }
676            if (fgcoll) victory_update_irq(machine);
658            if (state->fgcoll) victory_update_irq(machine);
677659         }
678660      }
679661   }
680662
681   count_states(3 + (2 + 2 * ycount) * xcount);
663   count_states(micro, 3 + (2 + 2 * ycount) * xcount);
682664
683665   return micro.cmd & 0x80;
684666}
r10613r10614
693675
694676static int command4(running_machine *machine)
695677{
678   victory_state *state = machine->driver_data<victory_state>();
679   struct micro_t &micro = state->micro;
696680/*
697681    Actual microcode:
698682          04    1A                    2   0  SLOADPC
r10613r10614
714698
715699   if (LOG_MICROCODE) logerror("================= EXECUTE BEGIN\n");
716700
717   count_states(4);
701   count_states(micro, 4);
718702
719703   micro.pc = micro.yp << 1;
720704   do
721705   {
722      micro.cmd = gram[0x2000 + micro.pc];
706      micro.cmd = state->gram[0x2000 + micro.pc];
723707      micro.cmdlo = micro.cmd & 7;
724      micro.i = (bram[0x2000 + micro.pc] << 8) | rram[0x2000 + micro.pc];
725      micro.r = gram[0x2001 + micro.pc];
726      micro.xp = rram[0x2001 + micro.pc];
727      micro.yp = bram[0x2001 + micro.pc];
708      micro.i = (state->bram[0x2000 + micro.pc] << 8) | state->rram[0x2000 + micro.pc];
709      micro.r = state->gram[0x2001 + micro.pc];
710      micro.xp = state->rram[0x2001 + micro.pc];
711      micro.yp = state->bram[0x2001 + micro.pc];
728712      if (LOG_MICROCODE) logerror("PC=%03X  CMD=%02X I=%04X R=%02X X=%02X Y=%02X\n", micro.pc, micro.cmd, micro.i, micro.r, micro.xp, micro.yp);
729713      micro.pc = (micro.pc + 2) & 0x1ff;
730714
r10613r10614
732716      {
733717         case 0:                                    break;
734718         case 1:                                    break;
735         case 2:   keep_going = command2();               break;
719         case 2:   keep_going = command2(machine);               break;
736720         case 3:   keep_going = command3(machine);            break;
737721         case 4:   micro.pc = micro.yp << 1; keep_going = 1;   break;
738722         case 5:   keep_going = command5(machine);            break;
739         case 6:   keep_going = command6();               break;
723         case 6:   keep_going = command6(machine);               break;
740724         case 7:   keep_going = command7(machine);            break;
741725      }
742726   } while (keep_going);
r10613r10614
756740
757741static int command5(running_machine *machine)
758742{
743   victory_state *state = machine->driver_data<victory_state>();
744   struct micro_t &micro = state->micro;
759745/*
760746    Actual microcode:
761747          05    0A                    1   0  SXFERY, ADD128+SACCCLEAR, SACCCLK
r10613r10614
809795   int c;
810796
811797   /* non-collision-detect case */
812   if (!(micro.cmd & 0x08) || fgcoll)
798   if (!(micro.cmd & 0x08) || state->fgcoll)
813799   {
814800      for (c = micro.i & 0xff; c < 0x100; c++)
815801      {
r10613r10614
817803         int shift = x & 7;
818804         int nshift = 8 - shift;
819805
820         gram[addr + 0] ^= micro.g >> shift;
821         gram[addr + 1] ^= micro.g << nshift;
822         bram[addr + 0] ^= micro.b >> shift;
823         bram[addr + 1] ^= micro.b << nshift;
824         rram[addr + 0] ^= micro.r >> shift;
825         rram[addr + 1] ^= micro.r << nshift;
806         state->gram[addr + 0] ^= micro.g >> shift;
807         state->gram[addr + 1] ^= micro.g << nshift;
808         state->bram[addr + 0] ^= micro.b >> shift;
809         state->bram[addr + 1] ^= micro.b << nshift;
810         state->rram[addr + 0] ^= micro.r >> shift;
811         state->rram[addr + 1] ^= micro.r << nshift;
826812
827813         acc += i;
828814         if (acc & 0x100)
r10613r10614
848834         int shift = x & 7;
849835         int nshift = 8 - shift;
850836
851         if ((gram[addr + 0] & (micro.g >> shift)) | (gram[addr + 1] & (micro.g << nshift)) |
852            (bram[addr + 0] & (micro.b >> shift)) | (bram[addr + 1] & (micro.b << nshift)) |
853            (rram[addr + 0] & (micro.r >> shift)) | (rram[addr + 1] & (micro.r << nshift)))
854            fgcoll = 1, fgcollx = x, fgcolly = y;
837         if ((state->gram[addr + 0] & (micro.g >> shift)) | (state->gram[addr + 1] & (micro.g << nshift)) |
838            (state->bram[addr + 0] & (micro.b >> shift)) | (state->bram[addr + 1] & (micro.b << nshift)) |
839            (state->rram[addr + 0] & (micro.r >> shift)) | (state->rram[addr + 1] & (micro.r << nshift)))
840            state->fgcoll = 1, state->fgcollx = x, state->fgcolly = y;
855841
856         gram[addr + 0] ^= micro.g >> shift;
857         gram[addr + 1] ^= micro.g << nshift;
858         bram[addr + 0] ^= micro.b >> shift;
859         bram[addr + 1] ^= micro.b << nshift;
860         rram[addr + 0] ^= micro.r >> shift;
861         rram[addr + 1] ^= micro.r << nshift;
842         state->gram[addr + 0] ^= micro.g >> shift;
843         state->gram[addr + 1] ^= micro.g << nshift;
844         state->bram[addr + 0] ^= micro.b >> shift;
845         state->bram[addr + 1] ^= micro.b << nshift;
846         state->rram[addr + 0] ^= micro.r >> shift;
847         state->rram[addr + 1] ^= micro.r << nshift;
862848
863849         acc += i;
864850         if (acc & 0x100)
r10613r10614
873859         }
874860         acc &= 0xff;
875861      }
876      if (fgcoll) victory_update_irq(machine);
862      if (state->fgcoll) victory_update_irq(machine);
877863   }
878864
879865   micro.xp = x;
880866
881   count_states(3 + 2 * (0x100 - (micro.i & 0xff)));
867   count_states(micro, 3 + 2 * (0x100 - (micro.i & 0xff)));
882868
883869   return micro.cmd & 0x80;
884870}
r10613r10614
891877 *
892878 *************************************/
893879
894static int command6(void)
880static int command6(running_machine *machine)
895881{
882   victory_state *state = machine->driver_data<victory_state>();
883   struct micro_t &micro = state->micro;
896884/*
897885    Actual microcode:
898886          06    0C                    0   0  SLOADLH, SLOADPC
r10613r10614
920908      micro.pc &= 0x1ff;
921909
922910      if (micro.cmd & 0x10)
923         gram[daddr] = gram[saddr];
911         state->gram[daddr] = state->gram[saddr];
924912      if (micro.cmd & 0x20)
925         bram[daddr] = bram[saddr];
913         state->bram[daddr] = state->bram[saddr];
926914      if (micro.cmd & 0x40)
927         rram[daddr] = rram[saddr];
915         state->rram[daddr] = state->rram[saddr];
928916   }
929917
930   count_states(3 + 2 * (64 - (micro.r & 31) * 2));
918   count_states(micro, 3 + 2 * (64 - (micro.r & 31) * 2));
931919
932920   return micro.cmd & 0x80;
933921}
r10613r10614
942930
943931static int command7(running_machine *machine)
944932{
933   victory_state *state = machine->driver_data<victory_state>();
934   struct micro_t &micro = state->micro;
945935/*
946936    Actual microcode:
947937          07    08                    1   0  SXFERY, SXFERX+INCX
r10613r10614
960950   int nshift = 8 - shift;
961951
962952   /* non-collision-detect case */
963   if (!(micro.cmd & 0x08) || fgcoll)
953   if (!(micro.cmd & 0x08) || state->fgcoll)
964954   {
965955      if (micro.cmd & 0x10)
966956      {
967         gram[addr + 0] ^= micro.g >> shift;
968         gram[addr + 1] ^= micro.g << nshift;
957         state->gram[addr + 0] ^= micro.g >> shift;
958         state->gram[addr + 1] ^= micro.g << nshift;
969959      }
970960      if (micro.cmd & 0x20)
971961      {
972         bram[addr + 0] ^= micro.b >> shift;
973         bram[addr + 1] ^= micro.b << nshift;
962         state->bram[addr + 0] ^= micro.b >> shift;
963         state->bram[addr + 1] ^= micro.b << nshift;
974964      }
975965      if (micro.cmd & 0x40)
976966      {
977         rram[addr + 0] ^= micro.r >> shift;
978         rram[addr + 1] ^= micro.r << nshift;
967         state->rram[addr + 0] ^= micro.r >> shift;
968         state->rram[addr + 1] ^= micro.r << nshift;
979969      }
980970   }
981971
r10613r10614
984974   {
985975      if (micro.cmd & 0x10)
986976      {
987         if ((gram[addr + 0] & (micro.g >> shift)) | (gram[addr + 1] & (micro.g << nshift)))
988            fgcoll = 1, fgcollx = micro.xp + 8, fgcolly = micro.yp;
989         gram[addr + 0] ^= micro.g >> shift;
990         gram[addr + 1] ^= micro.g << nshift;
977         if ((state->gram[addr + 0] & (micro.g >> shift)) | (state->gram[addr + 1] & (micro.g << nshift)))
978            state->fgcoll = 1, state->fgcollx = micro.xp + 8, state->fgcolly = micro.yp;
979         state->gram[addr + 0] ^= micro.g >> shift;
980         state->gram[addr + 1] ^= micro.g << nshift;
991981      }
992982      if (micro.cmd & 0x20)
993983      {
994         if ((bram[addr + 0] & (micro.b >> shift)) | (bram[addr + 1] & (micro.b << nshift)))
995            fgcoll = 1, fgcollx = micro.xp + 8, fgcolly = micro.yp;
996         bram[addr + 0] ^= micro.b >> shift;
997         bram[addr + 1] ^= micro.b << nshift;
984         if ((state->bram[addr + 0] & (micro.b >> shift)) | (state->bram[addr + 1] & (micro.b << nshift)))
985            state->fgcoll = 1, state->fgcollx = micro.xp + 8, state->fgcolly = micro.yp;
986         state->bram[addr + 0] ^= micro.b >> shift;
987         state->bram[addr + 1] ^= micro.b << nshift;
998988      }
999989      if (micro.cmd & 0x40)
1000990      {
1001         if ((rram[addr + 0] & (micro.r >> shift)) | (rram[addr + 1] & (micro.r << nshift)))
1002            fgcoll = 1, fgcollx = micro.xp + 8, fgcolly = micro.yp;
1003         rram[addr + 0] ^= micro.r >> shift;
1004         rram[addr + 1] ^= micro.r << nshift;
991         if ((state->rram[addr + 0] & (micro.r >> shift)) | (state->rram[addr + 1] & (micro.r << nshift)))
992            state->fgcoll = 1, state->fgcollx = micro.xp + 8, state->fgcolly = micro.yp;
993         state->rram[addr + 0] ^= micro.r >> shift;
994         state->rram[addr + 1] ^= micro.r << nshift;
1005995      }
1006      if (fgcoll) victory_update_irq(machine);
996      if (state->fgcoll) victory_update_irq(machine);
1007997   }
1008998
1009   count_states(4);
999   count_states(micro, 4);
10101000
10111001   return micro.cmd & 0x80;
10121002}
r10613r10614
10181008 *
10191009 *************************************/
10201010
1021static void update_background(void)
1011static void update_background(running_machine *machine)
10221012{
1013   victory_state *state = machine->driver_data<victory_state>();
10231014   int x, y, row, offs;
10241015
10251016   for (y = offs = 0; y < 32; y++)
10261017      for (x = 0; x < 32; x++, offs++)
10271018      {
1028         int code = victory_videoram[offs];
1019         int code = state->videoram[offs];
10291020
10301021         for (row = 0; row < 8; row++)
10311022         {
1032            UINT8 pix2 = victory_charram[0x0000 + 8 * code + row];
1033            UINT8 pix1 = victory_charram[0x0800 + 8 * code + row];
1034            UINT8 pix0 = victory_charram[0x1000 + 8 * code + row];
1035            UINT8 *dst = &bgbitmap[(y * 8 + row) * 256 + x * 8];
1023            UINT8 pix2 = state->charram[0x0000 + 8 * code + row];
1024            UINT8 pix1 = state->charram[0x0800 + 8 * code + row];
1025            UINT8 pix0 = state->charram[0x1000 + 8 * code + row];
1026            UINT8 *dst = &state->bgbitmap[(y * 8 + row) * 256 + x * 8];
10361027
10371028            *dst++ = ((pix2 & 0x80) >> 5) | ((pix1 & 0x80) >> 6) | ((pix0 & 0x80) >> 7);
10381029            *dst++ = ((pix2 & 0x40) >> 4) | ((pix1 & 0x40) >> 5) | ((pix0 & 0x40) >> 6);
r10613r10614
10531044 *
10541045 *************************************/
10551046
1056static void update_foreground(void)
1047static void update_foreground(running_machine *machine)
10571048{
1049   victory_state *state = machine->driver_data<victory_state>();
10581050   int x, y;
10591051
10601052   for (y = 0; y < 256; y++)
10611053   {
1062      UINT8 *dst = &fgbitmap[y * 256];
1054      UINT8 *dst = &state->fgbitmap[y * 256];
10631055
10641056      /* assemble the RGB bits for each 8-pixel chunk */
10651057      for (x = 0; x < 256; x += 8)
10661058      {
1067         UINT8 g = gram[y * 32 + x / 8];
1068         UINT8 b = bram[y * 32 + x / 8];
1069         UINT8 r = rram[y * 32 + x / 8];
1059         UINT8 g = state->gram[y * 32 + x / 8];
1060         UINT8 b = state->bram[y * 32 + x / 8];
1061         UINT8 r = state->rram[y * 32 + x / 8];
10701062
10711063         *dst++ = ((r & 0x80) >> 5) | ((b & 0x80) >> 6) | ((g & 0x80) >> 7);
10721064         *dst++ = ((r & 0x40) >> 4) | ((b & 0x40) >> 5) | ((g & 0x40) >> 6);
r10613r10614
10831075
10841076static TIMER_CALLBACK( bgcoll_irq_callback )
10851077{
1086   bgcollx = param & 0xff;
1087   bgcolly = param >> 8;
1088   bgcoll = 1;
1078   victory_state *state = machine->driver_data<victory_state>();
1079   state->bgcollx = param & 0xff;
1080   state->bgcolly = param >> 8;
1081   state->bgcoll = 1;
10891082   victory_update_irq(machine);
10901083}
10911084
r10613r10614
10991092
11001093SCREEN_UPDATE( victory )
11011094{
1102   int bgcollmask = (video_control & 4) ? 4 : 7;
1095   victory_state *state = screen->machine->driver_data<victory_state>();
1096   int bgcollmask = (state->video_control & 4) ? 4 : 7;
11031097   int count = 0;
11041098   int x, y;
11051099
r10613r10614
11071101   set_palette(screen->machine);
11081102
11091103   /* update the foreground & background */
1110   update_foreground();
1111   update_background();
1104   update_foreground(screen->machine);
1105   update_background(screen->machine);
11121106
11131107   /* blend the bitmaps and do collision detection */
11141108   for (y = 0; y < 256; y++)
11151109   {
11161110      UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0);
1117      UINT8 sy = scrolly + y;
1118      UINT8 *fg = &fgbitmap[y * 256];
1119      UINT8 *bg = &bgbitmap[sy * 256];
1111      UINT8 sy = state->scrolly + y;
1112      UINT8 *fg = &state->fgbitmap[y * 256];
1113      UINT8 *bg = &state->bgbitmap[sy * 256];
11201114
11211115      /* do the blending */
11221116      for (x = 0; x < 256; x++)
11231117      {
11241118         int fpix = *fg++;
1125         int bpix = bg[(x + scrollx) & 255];
1119         int bpix = bg[(x + state->scrollx) & 255];
11261120         scanline[x] = bpix | (fpix << 3);
11271121         if (fpix && (bpix & bgcollmask) && count++ < 128)
11281122            screen->machine->scheduler().timer_set(screen->time_until_pos(y, x), FUNC(bgcoll_irq_callback), x | (y << 8));
src/mame/video/vigilant.c
r10613r10614
2424   6*8, 32*8-1
2525};
2626
27//UINT8 *vigilant_paletteram;
28//UINT8 *vigilant_sprite_paletteram;
2927
30static int horiz_scroll_low=0;
31static int horiz_scroll_high=0;
32static int rear_horiz_scroll_low=0;
33static int rear_horiz_scroll_high=0;
34static int rear_color=0;
35static int rear_disable;
36
37static int rear_refresh;
38
39static bitmap_t *bg_bitmap;
40
41
4228VIDEO_START( vigilant )
4329{
44   bg_bitmap = auto_bitmap_alloc(machine,512*4,256,machine->primary_screen->format());
30   vigilant_state *state = machine->driver_data<vigilant_state>();
31   state->bg_bitmap = auto_bitmap_alloc(machine,512*4,256,machine->primary_screen->format());
4532}
4633
4734
4835VIDEO_RESET( vigilant )
4936{
50   horiz_scroll_low = 0;
51   horiz_scroll_high = 0;
52   rear_horiz_scroll_low = 0;
53   rear_horiz_scroll_high = 0;
54   rear_color = 0;
55   rear_disable = 1;
56   rear_refresh = 1;
37   vigilant_state *state = machine->driver_data<vigilant_state>();
38   state->horiz_scroll_low = 0;
39   state->horiz_scroll_high = 0;
40   state->rear_horiz_scroll_low = 0;
41   state->rear_horiz_scroll_high = 0;
42   state->rear_color = 0;
43   state->rear_disable = 1;
44   state->rear_refresh = 1;
5745}
5846
5947
r10613r10614
6553 **************************************************************************/
6654static void update_background(running_machine *machine)
6755{
56   vigilant_state *state = machine->driver_data<vigilant_state>();
6857   int row,col,page;
6958   int charcode;
7059
r10613r10614
7867      {
7968         for( col=0; col<512; col+=32 )
8069         {
81            drawgfx_opaque(bg_bitmap,
70            drawgfx_opaque(state->bg_bitmap,
8271                  0,machine->gfx[2],
8372                  charcode,
8473                  row < 128 ? 0 : 1,
r10613r10614
133122 **************************************************************************/
134123WRITE8_HANDLER( vigilant_horiz_scroll_w )
135124{
125   vigilant_state *state = space->machine->driver_data<vigilant_state>();
136126   if (offset==0)
137      horiz_scroll_low = data;
127      state->horiz_scroll_low = data;
138128   else
139      horiz_scroll_high = (data & 0x01) * 256;
129      state->horiz_scroll_high = (data & 0x01) * 256;
140130}
141131
142132/***************************************************************************
r10613r10614
147137***************************************************************************/
148138WRITE8_HANDLER( vigilant_rear_horiz_scroll_w )
149139{
140   vigilant_state *state = space->machine->driver_data<vigilant_state>();
150141   if (offset==0)
151      rear_horiz_scroll_low = data;
142      state->rear_horiz_scroll_low = data;
152143   else
153      rear_horiz_scroll_high = (data & 0x07) * 256;
144      state->rear_horiz_scroll_high = (data & 0x07) * 256;
154145}
155146
156147/***************************************************************************
r10613r10614
170161 **************************************************************************/
171162WRITE8_HANDLER( vigilant_rear_color_w )
172163{
173   rear_disable = data & 0x40;
174   rear_color = (data & 0x0d);
164   vigilant_state *state = space->machine->driver_data<vigilant_state>();
165   state->rear_disable = data & 0x40;
166   state->rear_color = (data & 0x0d);
175167}
176168
177169/***************************************************************************
r10613r10614
185177   vigilant_state *state = machine->driver_data<vigilant_state>();
186178   UINT8 *videoram = state->videoram;
187179   int offs;
188   int scroll = -(horiz_scroll_low + horiz_scroll_high);
180   int scroll = -(state->horiz_scroll_low + state->horiz_scroll_high);
189181
190182
191183   for (offs = 0; offs < 0x1000; offs += 2)
r10613r10614
231223
232224static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
233225{
234   int scrollx = 0x17a + 16*8 - (rear_horiz_scroll_low + rear_horiz_scroll_high);
226   vigilant_state *state = machine->driver_data<vigilant_state>();
227   int scrollx = 0x17a + 16*8 - (state->rear_horiz_scroll_low + state->rear_horiz_scroll_high);
235228
236229
237   if (rear_refresh)
230   if (state->rear_refresh)
238231   {
239232      update_background(machine);
240      rear_refresh=0;
233      state->rear_refresh=0;
241234   }
242235
243   copyscrollbitmap(bitmap,bg_bitmap,1,&scrollx,0,0,&bottomvisiblearea);
236   copyscrollbitmap(bitmap,state->bg_bitmap,1,&scrollx,0,0,&bottomvisiblearea);
244237}
245238
246239
r10613r10614
307300
308301SCREEN_UPDATE( vigilant )
309302{
303   vigilant_state *state = screen->machine->driver_data<vigilant_state>();
310304   int i;
311305
312306   /* copy the background palette */
r10613r10614
315309      int r,g,b;
316310
317311
318      r = (screen->machine->generic.paletteram.u8[0x400 + 16 * rear_color + i] << 3) & 0xFF;
319      g = (screen->machine->generic.paletteram.u8[0x500 + 16 * rear_color + i] << 3) & 0xFF;
320      b = (screen->machine->generic.paletteram.u8[0x600 + 16 * rear_color + i] << 3) & 0xFF;
312      r = (screen->machine->generic.paletteram.u8[0x400 + 16 * state->rear_color + i] << 3) & 0xFF;
313      g = (screen->machine->generic.paletteram.u8[0x500 + 16 * state->rear_color + i] << 3) & 0xFF;
314      b = (screen->machine->generic.paletteram.u8[0x600 + 16 * state->rear_color + i] << 3) & 0xFF;
321315
322316      palette_set_color(screen->machine,512 + i,MAKE_RGB(r,g,b));
323317
324      r = (screen->machine->generic.paletteram.u8[0x400 + 16 * rear_color + 32 + i] << 3) & 0xFF;
325      g = (screen->machine->generic.paletteram.u8[0x500 + 16 * rear_color + 32 + i] << 3) & 0xFF;
326      b = (screen->machine->generic.paletteram.u8[0x600 + 16 * rear_color + 32 + i] << 3) & 0xFF;
318      r = (screen->machine->generic.paletteram.u8[0x400 + 16 * state->rear_color + 32 + i] << 3) & 0xFF;
319      g = (screen->machine->generic.paletteram.u8[0x500 + 16 * state->rear_color + 32 + i] << 3) & 0xFF;
320      b = (screen->machine->generic.paletteram.u8[0x600 + 16 * state->rear_color + 32 + i] << 3) & 0xFF;
327321
328322      palette_set_color(screen->machine,512 + 16 + i,MAKE_RGB(r,g,b));
329323   }
330324
331   if (rear_disable)    /* opaque foreground */
325   if (state->rear_disable)    /* opaque foreground */
332326   {
333327      draw_foreground(screen->machine,bitmap,cliprect,0,1);
334328      draw_sprites(screen->machine,bitmap,&bottomvisiblearea);
src/mame/video/nbmj8991.c
r10613r10614
1111#include "includes/nbmj8991.h"
1212
1313
14static int nbmj8991_scrollx, nbmj8991_scrolly;
15static int blitter_destx, blitter_desty;
16static int blitter_sizex, blitter_sizey;
17static int blitter_src_addr;
18static int blitter_direction_x, blitter_direction_y;
19static int nbmj8991_gfxrom;
20static int nbmj8991_dispflag;
21static int nbmj8991_flipscreen;
22static int nbmj8991_clutsel;
23static int nbmj8991_screen_refresh;
24
25static bitmap_t *nbmj8991_tmpbitmap;
26static UINT8 *nbmj8991_videoram;
27static UINT8 *nbmj8991_clut;
28
29
3014static void nbmj8991_vramflip(running_machine *machine);
3115static void nbmj8991_gfxdraw(running_machine *machine);
3216static void update_pixel(running_machine *machine, int x, int y);
r10613r10614
9478******************************************************************************/
9579WRITE8_HANDLER( nbmj8991_blitter_w )
9680{
81   nbmj8991_state *state = space->machine->driver_data<nbmj8991_state>();
9782   int gfxlen = space->machine->region("gfx1")->bytes();
9883
9984   switch (offset)
10085   {
101      case 0x00:   blitter_src_addr = (blitter_src_addr & 0xff00) | data; break;
102      case 0x01:   blitter_src_addr = (blitter_src_addr & 0x00ff) | (data << 8); break;
86      case 0x00:   state->blitter_src_addr = (state->blitter_src_addr & 0xff00) | data; break;
87      case 0x01:   state->blitter_src_addr = (state->blitter_src_addr & 0x00ff) | (data << 8); break;
10388      case 0x02:   break;
10489      case 0x03:   break;
105      case 0x04:   blitter_sizex = data; break;
106      case 0x05:   blitter_sizey = data;
90      case 0x04:   state->blitter_sizex = data; break;
91      case 0x05:   state->blitter_sizey = data;
10792               /* writing here also starts the blit */
10893               nbmj8991_gfxdraw(space->machine);
10994               break;
110      case 0x06:   blitter_direction_x = (data & 0x01) ? 1 : 0;
111               blitter_direction_y = (data & 0x02) ? 1 : 0;
112               nbmj8991_flipscreen = (data & 0x04) ? 0 : 1;
113               nbmj8991_dispflag = (data & 0x10) ? 0 : 1;
95      case 0x06:   state->blitter_direction_x = (data & 0x01) ? 1 : 0;
96               state->blitter_direction_y = (data & 0x02) ? 1 : 0;
97               state->flipscreen = (data & 0x04) ? 0 : 1;
98               state->dispflag = (data & 0x10) ? 0 : 1;
11499               nbmj8991_vramflip(space->machine);
115100               break;
116101      case 0x07:   break;
117      case 0x10:   blitter_destx = (blitter_destx & 0xff00) | data; break;
118      case 0x20:   blitter_desty = (blitter_desty & 0xff00) | data; break;
119      case 0x30:   nbmj8991_scrollx = (nbmj8991_scrollx & 0xff00) | data; break;
120      case 0x40:   nbmj8991_scrolly = (nbmj8991_scrolly & 0xff00) | data; break;
121      case 0x50:   blitter_destx = (blitter_destx & 0x00ff) | ((data & 0x01) << 8);
122               blitter_desty = (blitter_desty & 0x00ff) | ((data & 0x02) << 7);
123               nbmj8991_scrollx = (nbmj8991_scrollx & 0x00ff) | ((data & 0x04) << 6);
124               nbmj8991_scrolly = (nbmj8991_scrolly & 0x00ff) | ((data & 0x08) << 5);
102      case 0x10:   state->blitter_destx = (state->blitter_destx & 0xff00) | data; break;
103      case 0x20:   state->blitter_desty = (state->blitter_desty & 0xff00) | data; break;
104      case 0x30:   state->scrollx = (state->scrollx & 0xff00) | data; break;
105      case 0x40:   state->scrolly = (state->scrolly & 0xff00) | data; break;
106      case 0x50:   state->blitter_destx = (state->blitter_destx & 0x00ff) | ((data & 0x01) << 8);
107               state->blitter_desty = (state->blitter_desty & 0x00ff) | ((data & 0x02) << 7);
108               state->scrollx = (state->scrollx & 0x00ff) | ((data & 0x04) << 6);
109               state->scrolly = (state->scrolly & 0x00ff) | ((data & 0x08) << 5);
125110               break;
126      case 0x60:   nbmj8991_gfxrom = data; break;
127      case 0x70:   nbmj8991_clutsel = data; break;
111      case 0x60:   state->gfxrom = data; break;
112      case 0x70:   state->clutsel = data; break;
128113   }
129114
130   if ((0x20000 * nbmj8991_gfxrom) > (gfxlen - 1))
115   if ((0x20000 * state->gfxrom) > (gfxlen - 1))
131116   {
132117#ifdef MAME_DEBUG
133118      popmessage("GFXROM BANK OVER!!");
134119#endif
135      nbmj8991_gfxrom &= (gfxlen / 0x20000 - 1);
120      state->gfxrom &= (gfxlen / 0x20000 - 1);
136121   }
137122}
138123
139124READ8_HANDLER( nbmj8991_clut_r )
140125{
141   return nbmj8991_clut[offset];
126   nbmj8991_state *state = space->machine->driver_data<nbmj8991_state>();
127   return state->clut[offset];
142128}
143129
144130WRITE8_HANDLER( nbmj8991_clut_w )
145131{
146   nbmj8991_clut[((nbmj8991_clutsel & 0x7f) * 0x10) + (offset & 0x0f)] = data;
132   nbmj8991_state *state = space->machine->driver_data<nbmj8991_state>();
133   state->clut[((state->clutsel & 0x7f) * 0x10) + (offset & 0x0f)] = data;
147134}
148135
149136/******************************************************************************
r10613r10614
152139******************************************************************************/
153140static void nbmj8991_vramflip(running_machine *machine)
154141{
155   static int nbmj8991_flipscreen_old = 0;
142   nbmj8991_state *state = machine->driver_data<nbmj8991_state>();
156143   int x, y;
157144   UINT8 color1, color2;
158145   int width = machine->primary_screen->width();
159146   int height = machine->primary_screen->height();
160147
161   if (nbmj8991_flipscreen == nbmj8991_flipscreen_old) return;
148   if (state->flipscreen == state->flipscreen_old) return;
162149
163150   for (y = 0; y < height / 2; y++)
164151   {
165152      for (x = 0; x < width / 2; x++)
166153      {
167154         // rotate 180 degrees (   0,   0) - ( 511, 511)
168         color1 = nbmj8991_videoram[(y * width) + x];
169         color2 = nbmj8991_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)];
170         nbmj8991_videoram[(y * width) + x] = color2;
171         nbmj8991_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)] = color1;
155         color1 = state->videoram[(y * width) + x];
156         color2 = state->videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)];
157         state->videoram[(y * width) + x] = color2;
158         state->videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)] = color1;
172159         // rotate 180 degrees ( 512,   0) - (1023, 511)
173         color1 = nbmj8991_videoram[(y * width) + (x + (width / 2))];
174         color2 = nbmj8991_videoram[(((height - 1) - y) * width) + ((((width / 2) - 1) - x) + (width / 2))];
175         nbmj8991_videoram[(y * width) + (x + (width / 2))] = color2;
176         nbmj8991_videoram[(((height - 1) - y) * width) + ((((width / 2) - 1) - x) + (width / 2))] = color1;
160         color1 = state->videoram[(y * width) + (x + (width / 2))];
161         color2 = state->videoram[(((height - 1) - y) * width) + ((((width / 2) - 1) - x) + (width / 2))];
162         state->videoram[(y * width) + (x + (width / 2))] = color2;
163         state->videoram[(((height - 1) - y) * width) + ((((width / 2) - 1) - x) + (width / 2))] = color1;
177164      }
178165   }
179166
180   nbmj8991_flipscreen_old = nbmj8991_flipscreen;
181   nbmj8991_screen_refresh = 1;
167   state->flipscreen_old = state->flipscreen;
168   state->screen_refresh = 1;
182169}
183170
184171static void update_pixel(running_machine *machine, int x, int y)
185172{
186   UINT8 color = nbmj8991_videoram[(y * machine->primary_screen->width()) + x];
187   *BITMAP_ADDR16(nbmj8991_tmpbitmap, y, x) = color;
173   nbmj8991_state *state = machine->driver_data<nbmj8991_state>();
174   UINT8 color = state->videoram[(y * machine->primary_screen->width()) + x];
175   *BITMAP_ADDR16(state->tmpbitmap, y, x) = color;
188176}
189177
190178static TIMER_CALLBACK( blitter_timer_callback )
r10613r10614
194182
195183static void nbmj8991_gfxdraw(running_machine *machine)
196184{
185   nbmj8991_state *state = machine->driver_data<nbmj8991_state>();
197186   UINT8 *GFX = machine->region("gfx1")->base();
198187   int width = machine->primary_screen->width();
199188
r10613r10614
208197
209198   nb1413m3_busyctr = 0;
210199
211   if (blitter_direction_x)
200   if (state->blitter_direction_x)
212201   {
213      startx = blitter_destx;
214      sizex = blitter_sizex ^ 0xff;
202      startx = state->blitter_destx;
203      sizex = state->blitter_sizex ^ 0xff;
215204      skipx = 1;
216205   }
217206   else
218207   {
219      startx = blitter_destx + blitter_sizex;
220      sizex = blitter_sizex;
208      startx = state->blitter_destx + state->blitter_sizex;
209      sizex = state->blitter_sizex;
221210      skipx = -1;
222211   }
223212
224   if (blitter_direction_y)
213   if (state->blitter_direction_y)
225214   {
226      starty = blitter_desty;
227      sizey = blitter_sizey ^ 0xff;
215      starty = state->blitter_desty;
216      sizey = state->blitter_sizey ^ 0xff;
228217      skipy = 1;
229218   }
230219   else
231220   {
232      starty = blitter_desty + blitter_sizey;
233      sizey = blitter_sizey;
221      starty = state->blitter_desty + state->blitter_sizey;
222      sizey = state->blitter_sizey;
234223      skipy = -1;
235224   }
236225
237226   gfxlen = machine->region("gfx1")->bytes();
238   gfxaddr = (nbmj8991_gfxrom << 17) + (blitter_src_addr << 1);
227   gfxaddr = (state->gfxrom << 17) + (state->blitter_src_addr << 1);
239228
240229   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
241230   {
r10613r10614
255244         dx2 = (2 * x + 1) & 0x3ff;
256245         dy = y & 0x1ff;
257246
258         if (!nbmj8991_flipscreen)
247         if (!state->flipscreen)
259248         {
260249            dx1 ^= 0x1ff;
261250            dx2 ^= 0x1ff;
262251            dy ^= 0x1ff;
263252         }
264253
265         if (blitter_direction_x)
254         if (state->blitter_direction_x)
266255         {
267256            // flip
268257            color1 = (color & 0x0f) >> 0;
r10613r10614
275264            color2 = (color & 0x0f) >> 0;
276265         }
277266
278         color1 = nbmj8991_clut[((nbmj8991_clutsel & 0x7f) * 0x10) + color1];
279         color2 = nbmj8991_clut[((nbmj8991_clutsel & 0x7f) * 0x10) + color2];
267         color1 = state->clut[((state->clutsel & 0x7f) * 0x10) + color1];
268         color2 = state->clut[((state->clutsel & 0x7f) * 0x10) + color2];
280269
281270         if (color1 != 0xff)
282271         {
283            nbmj8991_videoram[(dy * width) + dx1] = color1;
272            state->videoram[(dy * width) + dx1] = color1;
284273            update_pixel(machine, dx1, dy);
285274         }
286275         if (color2 != 0xff)
287276         {
288            nbmj8991_videoram[(dy * width) + dx2] = color2;
277            state->videoram[(dy * width) + dx2] = color2;
289278            update_pixel(machine, dx2, dy);
290279         }
291280
r10613r10614
303292******************************************************************************/
304293VIDEO_START( nbmj8991 )
305294{
295   nbmj8991_state *state = machine->driver_data<nbmj8991_state>();
306296   int width = machine->primary_screen->width();
307297   int height = machine->primary_screen->height();
308298
309   nbmj8991_tmpbitmap = machine->primary_screen->alloc_compatible_bitmap();
310   nbmj8991_videoram = auto_alloc_array(machine, UINT8, width * height);
311   nbmj8991_clut = auto_alloc_array(machine, UINT8, 0x800);
312   memset(nbmj8991_videoram, 0x00, (width * height * sizeof(UINT8)));
299   state->tmpbitmap = machine->primary_screen->alloc_compatible_bitmap();
300   state->videoram = auto_alloc_array(machine, UINT8, width * height);
301   state->clut = auto_alloc_array(machine, UINT8, 0x800);
302   memset(state->videoram, 0x00, (width * height * sizeof(UINT8)));
313303}
314304
315305SCREEN_UPDATE( nbmj8991_type1 )
316306{
307   nbmj8991_state *state = screen->machine->driver_data<nbmj8991_state>();
317308   int x, y;
318309
319   if (nbmj8991_screen_refresh)
310   if (state->screen_refresh)
320311   {
321312      int width = screen->machine->primary_screen->width();
322313      int height = screen->machine->primary_screen->height();
323314
324      nbmj8991_screen_refresh = 0;
315      state->screen_refresh = 0;
325316
326317      for (y = 0; y < height; y++)
327318         for (x = 0; x < width; x++)
328319            update_pixel(screen->machine, x, y);
329320   }
330321
331   if (nbmj8991_dispflag)
322   if (state->dispflag)
332323   {
333      static int scrollx, scrolly;
324      int scrollx, scrolly;
334325
335      if (nbmj8991_flipscreen)
326      if (state->flipscreen)
336327      {
337         scrollx = (((-nbmj8991_scrollx) + 0x000) & 0x1ff) * 2;
338         scrolly =  ((-nbmj8991_scrolly) - 0x00f) & 0x1ff;
328         scrollx = (((-state->scrollx) + 0x000) & 0x1ff) * 2;
329         scrolly =  ((-state->scrolly) - 0x00f) & 0x1ff;
339330      }
340331      else
341332      {
342         scrollx = (((-nbmj8991_scrollx) - 0x100) & 0x1ff) * 2;
343         scrolly =  (( nbmj8991_scrolly) + 0x0f1) & 0x1ff;
333         scrollx = (((-state->scrollx) - 0x100) & 0x1ff) * 2;
334         scrolly =  (( state->scrolly) + 0x0f1) & 0x1ff;
344335      }
345336
346      copyscrollbitmap(bitmap, nbmj8991_tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect);
337      copyscrollbitmap(bitmap, state->tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect);
347338   }
348339   else
349340      bitmap_fill(bitmap, 0, 0);
r10613r10614
353344
354345SCREEN_UPDATE( nbmj8991_type2 )
355346{
347   nbmj8991_state *state = screen->machine->driver_data<nbmj8991_state>();
356348   int x, y;
357349
358   if (nbmj8991_screen_refresh)
350   if (state->screen_refresh)
359351   {
360352      int width = screen->width();
361353      int height = screen->height();
362354
363      nbmj8991_screen_refresh = 0;
355      state->screen_refresh = 0;
364356
365357      for (y = 0; y < height; y++)
366358         for (x = 0; x < width; x++)
r10613r10614
369361
370362   if (nb1413m3_inputport & 0x20)
371363   {
372      static int scrollx, scrolly;
364      int scrollx, scrolly;
373365
374      if (nbmj8991_flipscreen)
366      if (state->flipscreen)
375367      {
376         scrollx = (((-nbmj8991_scrollx) + 0x000) & 0x1ff) * 2;
377         scrolly =  ((-nbmj8991_scrolly) - 0x00f) & 0x1ff;
368         scrollx = (((-state->scrollx) + 0x000) & 0x1ff) * 2;
369         scrolly =  ((-state->scrolly) - 0x00f) & 0x1ff;
378370      }
379371      else
380372      {
381         scrollx = (((-nbmj8991_scrollx) - 0x100) & 0x1ff) * 2;
382         scrolly =  (( nbmj8991_scrolly) + 0x0f1) & 0x1ff;
373         scrollx = (((-state->scrollx) - 0x100) & 0x1ff) * 2;
374         scrolly =  (( state->scrolly) + 0x0f1) & 0x1ff;
383375      }
384376
385      copyscrollbitmap(bitmap, nbmj8991_tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect);
377      copyscrollbitmap(bitmap, state->tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect);
386378   }
387379   else
388380      bitmap_fill(bitmap, 0, 0);
src/mame/video/exidy440.c
r10613r10614
2626#define SPRITE_COUNT      (0x28)
2727
2828
29/* globals */
30UINT8 *exidy440_scanline;
31UINT8 *exidy440_imageram;
32UINT8  exidy440_firq_vblank;
33UINT8  exidy440_firq_beam;
34UINT8 *topsecex_yscroll;
35
36/* local allocated storage */
37static UINT8 exidy440_latched_x;
38static UINT8 *local_videoram;
39static UINT8 *local_paletteram;
40
41/* local variables */
42static UINT8 firq_enable;
43static UINT8 firq_select;
44static UINT8 palettebank_io;
45static UINT8 palettebank_vis;
46
4729/* function prototypes */
4830static void exidy440_update_firq(running_machine *machine);
4931
r10613r10614
5739
5840static VIDEO_START( exidy440 )
5941{
42   exidy440_state *state = machine->driver_data<exidy440_state>();
6043   /* reset the system */
61   firq_enable = 0;
62   firq_select = 0;
63   palettebank_io = 0;
64   palettebank_vis = 0;
65   exidy440_firq_vblank = 0;
66   exidy440_firq_beam = 0;
44   state->firq_enable = 0;
45   state->firq_select = 0;
46   state->palettebank_io = 0;
47   state->palettebank_vis = 0;
48   state->firq_vblank = 0;
49   state->firq_beam = 0;
6750
6851   /* allocate a buffer for VRAM */
69   local_videoram = auto_alloc_array(machine, UINT8, 256 * 256 * 2);
70   memset(local_videoram, 0, 256 * 256 * 2);
52   state->local_videoram = auto_alloc_array(machine, UINT8, 256 * 256 * 2);
53   memset(state->local_videoram, 0, 256 * 256 * 2);
7154
7255   /* allocate a buffer for palette RAM */
73   local_paletteram = auto_alloc_array(machine, UINT8, 512 * 2);
74   memset(local_paletteram, 0, 512 * 2);
56   state->local_paletteram = auto_alloc_array(machine, UINT8, 512 * 2);
57   memset(state->local_paletteram, 0, 512 * 2);
7558}
7659
7760
7861static VIDEO_START( topsecex )
7962{
63   exidy440_state *state = machine->driver_data<exidy440_state>();
8064   VIDEO_START_CALL(exidy440);
8165
82   *topsecex_yscroll = 0;
66   *state->topsecex_yscroll = 0;
8367}
8468
8569
r10613r10614
9276
9377READ8_HANDLER( exidy440_videoram_r )
9478{
95   UINT8 *base = &local_videoram[(*exidy440_scanline * 256 + offset) * 2];
79   exidy440_state *state = space->machine->driver_data<exidy440_state>();
80   UINT8 *base = &state->local_videoram[(*state->scanline * 256 + offset) * 2];
9681
9782   /* combine the two pixel values into one byte */
9883   return (base[0] << 4) | base[1];
r10613r10614
10186
10287WRITE8_HANDLER( exidy440_videoram_w )
10388{
104   UINT8 *base = &local_videoram[(*exidy440_scanline * 256 + offset) * 2];
89   exidy440_state *state = space->machine->driver_data<exidy440_state>();
90   UINT8 *base = &state->local_videoram[(*state->scanline * 256 + offset) * 2];
10591
10692   /* expand the two pixel values into two bytes */
10793   base[0] = (data >> 4) & 15;
r10613r10614
118104
119105READ8_HANDLER( exidy440_paletteram_r )
120106{
121   return local_paletteram[palettebank_io * 512 + offset];
107   exidy440_state *state = space->machine->driver_data<exidy440_state>();
108   return state->local_paletteram[state->palettebank_io * 512 + offset];
122109}
123110
124111
125112WRITE8_HANDLER( exidy440_paletteram_w )
126113{
114   exidy440_state *state = space->machine->driver_data<exidy440_state>();
127115   /* update palette ram in the I/O bank */
128   local_paletteram[palettebank_io * 512 + offset] = data;
116   state->local_paletteram[state->palettebank_io * 512 + offset] = data;
129117
130118   /* if we're modifying the active palette, change the color immediately */
131   if (palettebank_io == palettebank_vis)
119   if (state->palettebank_io == state->palettebank_vis)
132120   {
133121      int word;
134122
135123      /* combine two bytes into a word */
136      offset = palettebank_vis * 512 + (offset & 0x1fe);
137      word = (local_paletteram[offset] << 8) + local_paletteram[offset + 1];
124      offset = state->palettebank_vis * 512 + (offset & 0x1fe);
125      word = (state->local_paletteram[offset] << 8) + state->local_paletteram[offset + 1];
138126
139127      /* extract the 5-5-5 RGB colors */
140128      palette_set_color_rgb(space->machine, offset / 2, pal5bit(word >> 10), pal5bit(word >> 5), pal5bit(word >> 0));
r10613r10614
151139
152140READ8_HANDLER( exidy440_horizontal_pos_r )
153141{
142   exidy440_state *state = space->machine->driver_data<exidy440_state>();
154143   /* clear the FIRQ on a read here */
155   exidy440_firq_beam = 0;
144   state->firq_beam = 0;
156145   exidy440_update_firq(space->machine);
157146
158147   /* according to the schems, this value is only latched on an FIRQ
159148     * caused by collision or beam */
160   return exidy440_latched_x;
149   return state->latched_x;
161150}
162151
163152
r10613r10614
197186
198187WRITE8_HANDLER( exidy440_control_w )
199188{
200   int oldvis = palettebank_vis;
189   exidy440_state *state = space->machine->driver_data<exidy440_state>();
190   int oldvis = state->palettebank_vis;
201191
202192   /* extract the various bits */
203193   exidy440_bank_select(space->machine, data >> 4);
204   firq_enable = (data >> 3) & 1;
205   firq_select = (data >> 2) & 1;
206   palettebank_io = (data >> 1) & 1;
207   palettebank_vis = data & 1;
194   state->firq_enable = (data >> 3) & 1;
195   state->firq_select = (data >> 2) & 1;
196   state->palettebank_io = (data >> 1) & 1;
197   state->palettebank_vis = data & 1;
208198
209199   /* update the FIRQ in case we enabled something */
210200   exidy440_update_firq(space->machine);
211201
212202   /* if we're swapping palettes, change all the colors */
213   if (oldvis != palettebank_vis)
203   if (oldvis != state->palettebank_vis)
214204   {
215205      int i;
216206
217207      /* pick colors from the visible bank */
218      offset = palettebank_vis * 512;
208      offset = state->palettebank_vis * 512;
219209      for (i = 0; i < 256; i++, offset += 2)
220210      {
221211         /* extract a word and the 5-5-5 RGB components */
222         int word = (local_paletteram[offset] << 8) + local_paletteram[offset + 1];
212         int word = (state->local_paletteram[offset] << 8) + state->local_paletteram[offset + 1];
223213         palette_set_color_rgb(space->machine, i, pal5bit(word >> 10), pal5bit(word >> 5), pal5bit(word >> 0));
224214      }
225215   }
r10613r10614
228218
229219WRITE8_HANDLER( exidy440_interrupt_clear_w )
230220{
221   exidy440_state *state = space->machine->driver_data<exidy440_state>();
231222   /* clear the VBLANK FIRQ on a write here */
232   exidy440_firq_vblank = 0;
223   state->firq_vblank = 0;
233224   exidy440_update_firq(space->machine);
234225}
235226
r10613r10614
243234
244235static void exidy440_update_firq(running_machine *machine)
245236{
246   if (exidy440_firq_vblank || (firq_enable && exidy440_firq_beam))
237   exidy440_state *state = machine->driver_data<exidy440_state>();
238   if (state->firq_vblank || (state->firq_enable && state->firq_beam))
247239      cputag_set_input_line(machine, "maincpu", 1, ASSERT_LINE);
248240   else
249241      cputag_set_input_line(machine, "maincpu", 1, CLEAR_LINE);
r10613r10614
252244
253245INTERRUPT_GEN( exidy440_vblank_interrupt )
254246{
247   exidy440_state *state = device->machine->driver_data<exidy440_state>();
255248   /* set the FIRQ line on a VBLANK */
256   exidy440_firq_vblank = 1;
249   state->firq_vblank = 1;
257250   exidy440_update_firq(device->machine);
258251}
259252
r10613r10614
267260
268261static TIMER_CALLBACK( beam_firq_callback )
269262{
263   exidy440_state *state = machine->driver_data<exidy440_state>();
270264   /* generate the interrupt, if we're selected */
271   if (firq_select && firq_enable)
265   if (state->firq_select && state->firq_enable)
272266   {
273      exidy440_firq_beam = 1;
267      state->firq_beam = 1;
274268      exidy440_update_firq(machine);
275269   }
276270
r10613r10614
278272   param = (param + 1) / 2;
279273
280274   /* latch the x value; this convolution comes from the read routine */
281   exidy440_latched_x = (param + 3) ^ 2;
275   state->latched_x = (param + 3) ^ 2;
282276}
283277
284278
285279static TIMER_CALLBACK( collide_firq_callback )
286280{
281   exidy440_state *state = machine->driver_data<exidy440_state>();
287282   /* generate the interrupt, if we're selected */
288   if (!firq_select && firq_enable)
283   if (!state->firq_select && state->firq_enable)
289284   {
290      exidy440_firq_beam = 1;
285      state->firq_beam = 1;
291286      exidy440_update_firq(machine);
292287   }
293288
r10613r10614
295290   param = (param + 1) / 2;
296291
297292   /* latch the x value; this convolution comes from the read routine */
298   exidy440_latched_x = (param + 3) ^ 2;
293   state->latched_x = (param + 3) ^ 2;
299294}
300295
301296
r10613r10614
309304static void draw_sprites(screen_device &screen, bitmap_t *bitmap, const rectangle *cliprect,
310305                   int scroll_offset, int check_collision)
311306{
307   exidy440_state *state = screen.machine->driver_data<exidy440_state>();
312308   int i;
313309
314310   /* get a pointer to the palette to look for collision flags */
315   UINT8 *palette = &local_paletteram[palettebank_vis * 512];
311   UINT8 *palette = &state->local_paletteram[state->palettebank_vis * 512];
316312   int count = 0;
317313
318314   /* draw the sprite images, checking for collisions along the way */
r10613r10614
331327         continue;
332328
333329      /* get a pointer to the source image */
334      src = &exidy440_imageram[image * 128];
330      src = &state->imageram[image * 128];
335331
336332      /* account for large positive offsets meaning small negative values */
337333      if (xoffs >= 0x1ff - 16)
r10613r10614
354350         /* only draw scanlines that are in this cliprect */
355351         if (yoffs <= cliprect->max_y)
356352         {
357            UINT8 *old = &local_videoram[sy * 512 + xoffs];
353            UINT8 *old = &state->local_videoram[sy * 512 + xoffs];
358354            int currx = xoffs;
359355
360356            /* loop over x */
r10613r10614
409405static void update_screen(screen_device &screen, bitmap_t *bitmap, const rectangle *cliprect,
410406                    int scroll_offset, int check_collision)
411407{
408   exidy440_state *state = screen.machine->driver_data<exidy440_state>();
412409   int y, sy;
413410
414411   /* draw any dirty scanlines from the VRAM directly */
r10613r10614
420417         sy -= (VBSTART - VBEND);
421418
422419      /* draw line */
423      draw_scanline8(bitmap, 0, y, (HBSTART - HBEND), &local_videoram[sy * 512], NULL);
420      draw_scanline8(bitmap, 0, y, (HBSTART - HBEND), &state->local_videoram[sy * 512], NULL);
424421   }
425422
426423   /* draw the sprites */
r10613r10614
469466
470467static SCREEN_UPDATE( topsecex )
471468{
469   exidy440_state *state = screen->machine->driver_data<exidy440_state>();
472470   /* redraw the screen */
473   update_screen(*screen, bitmap, cliprect, *topsecex_yscroll, FALSE);
471   update_screen(*screen, bitmap, cliprect, *state->topsecex_yscroll, FALSE);
474472
475473   return 0;
476474}
src/mame/video/pingpong.c
r10613r10614
99#include "emu.h"
1010#include "includes/pingpong.h"
1111
12static tilemap_t *bg_tilemap;
13UINT8 *pingpong_videoram;
14UINT8 *pingpong_colorram;
1512
1613
1714/* This is strange; it's unlikely that the sprites actually have a hardware */
r10613r10614
9895
9996WRITE8_HANDLER( pingpong_videoram_w )
10097{
101   pingpong_videoram[offset] = data;
102   tilemap_mark_tile_dirty(bg_tilemap, offset);
98   pingpong_state *state = space->machine->driver_data<pingpong_state>();
99   state->videoram[offset] = data;
100   tilemap_mark_tile_dirty(state->bg_tilemap, offset);
103101}
104102
105103WRITE8_HANDLER( pingpong_colorram_w )
106104{
107   pingpong_colorram[offset] = data;
108   tilemap_mark_tile_dirty(bg_tilemap, offset);
105   pingpong_state *state = space->machine->driver_data<pingpong_state>();
106   state->colorram[offset] = data;
107   tilemap_mark_tile_dirty(state->bg_tilemap, offset);
109108}
110109
111110static TILE_GET_INFO( get_bg_tile_info )
112111{
113   int attr = pingpong_colorram[tile_index];
114   int code = pingpong_videoram[tile_index] + ((attr & 0x20) << 3);
112   pingpong_state *state = machine->driver_data<pingpong_state>();
113   int attr = state->colorram[tile_index];
114   int code = state->videoram[tile_index] + ((attr & 0x20) << 3);
115115   int color = attr & 0x1f;
116116   int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
117117
r10613r10614
120120
121121VIDEO_START( pingpong )
122122{
123   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
123   pingpong_state *state = machine->driver_data<pingpong_state>();
124   state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
124125}
125126
126127static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
r10613r10614
152153
153154SCREEN_UPDATE( pingpong )
154155{
155   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
156   pingpong_state *state = screen->machine->driver_data<pingpong_state>();
157   tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
156158   draw_sprites(screen->machine, bitmap, cliprect);
157159   return 0;
158160}
src/mame/video/pokechmp.c
r10613r10614
33#include "emu.h"
44#include "includes/pokechmp.h"
55
6static tilemap_t *bg_tilemap;
76
87WRITE8_HANDLER( pokechmp_videoram_w )
98{
109   pokechmp_state *state = space->machine->driver_data<pokechmp_state>();
1110   UINT8 *videoram = state->videoram;
1211   videoram[offset] = data;
13   tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
12   tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
1413}
1514
1615WRITE8_HANDLER( pokechmp_flipscreen_w )
r10613r10614
3433
3534VIDEO_START( pokechmp )
3635{
37   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
36   pokechmp_state *state = machine->driver_data<pokechmp_state>();
37   state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
3838       8, 8, 32, 32);
3939}
4040
r10613r10614
7373
7474SCREEN_UPDATE( pokechmp )
7575{
76   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
76   pokechmp_state *state = screen->machine->driver_data<pokechmp_state>();
77   tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
7778   draw_sprites(screen->machine, bitmap, cliprect);
7879   return 0;
7980}
src/mame/video/crgolf.c
r10613r10614
201201   MCFG_SCREEN_VISIBLE_AREA(0, 255, 8, 247)
202202   MCFG_SCREEN_REFRESH_RATE(60)
203203   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
204   MCFG_SCREEN_UPDATE(crgolf)   
204   MCFG_SCREEN_UPDATE(crgolf)
205205MACHINE_CONFIG_END
src/mame/video/nbmj8900.c
r10613r10614
1111#include "includes/nbmj8900.h"
1212
1313
14static int nbmj8900_scrolly;
15static int blitter_destx, blitter_desty;
16static int blitter_sizex, blitter_sizey;
17static int blitter_src_addr;
18static int blitter_direction_x, blitter_direction_y;
19static int nbmj8900_vram;
20static int nbmj8900_gfxrom;
21static int nbmj8900_dispflag;
22static int nbmj8900_flipscreen;
23static int nbmj8900_clutsel;
24static int nbmj8900_screen_refresh;
25static int gfxdraw_mode;
26
27static int screen_height;
28static int screen_width;
29
30static bitmap_t *nbmj8900_tmpbitmap0, *nbmj8900_tmpbitmap1;
31static UINT8 *nbmj8900_videoram0, *nbmj8900_videoram1;
32static UINT8 *nbmj8900_palette;
33static UINT8 *nbmj8900_clut;
34
35
3614static void nbmj8900_vramflip(running_machine *machine, int vram);
3715static void nbmj8900_gfxdraw(running_machine *machine);
3816
r10613r10614
4321******************************************************************************/
4422READ8_HANDLER( nbmj8900_palette_type1_r )
4523{
46   return nbmj8900_palette[offset];
24   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
25   return state->palette[offset];
4726}
4827
4928WRITE8_HANDLER( nbmj8900_palette_type1_w )
5029{
30   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
5131   int r, g, b;
5232
53   nbmj8900_palette[offset] = data;
33   state->palette[offset] = data;
5434
5535   if (!(offset & 1)) return;
5636
5737   offset &= 0x1fe;
5838
59   r = ((nbmj8900_palette[offset + 0] & 0x0f) >> 0);
60   g = ((nbmj8900_palette[offset + 1] & 0xf0) >> 4);
61   b = ((nbmj8900_palette[offset + 1] & 0x0f) >> 0);
39   r = ((state->palette[offset + 0] & 0x0f) >> 0);
40   g = ((state->palette[offset + 1] & 0xf0) >> 4);
41   b = ((state->palette[offset + 1] & 0x0f) >> 0);
6242
6343   palette_set_color_rgb(space->machine, (offset >> 1), pal4bit(r), pal4bit(g), pal4bit(b));
6444}
r10613r10614
6646#ifdef UNUSED_FUNCTION
6747READ8_HANDLER( nbmj8900_palette_type2_r )
6848{
69   return nbmj8900_palette[offset];
49   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
50   return state->palette[offset];
7051}
7152
7253WRITE8_HANDLER( nbmj8900_palette_type2_w )
7354{
55   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
7456   int r, g, b;
7557
76   nbmj8900_palette[offset] = data;
58   state->palette[offset] = data;
7759
7860   if (!(offset & 0x100)) return;
7961
8062   offset &= 0x0ff;
8163
82   r = ((nbmj8900_palette[offset + 0x000] & 0x0f) >> 0);
83   g = ((nbmj8900_palette[offset + 0x000] & 0xf0) >> 4);
84   b = ((nbmj8900_palette[offset + 0x100] & 0x0f) >> 0);
64   r = ((state->palette[offset + 0x000] & 0x0f) >> 0);
65   g = ((state->palette[offset + 0x000] & 0xf0) >> 4);
66   b = ((state->palette[offset + 0x100] & 0x0f) >> 0);
8567
8668   palette_set_color_rgb(space->machine, (offset & 0x0ff), pal4bit(r), pal4bit(g), pal4bit(b));
8769}
8870
8971READ8_HANDLER( nbmj8900_palette_type3_r )
9072{
91   return nbmj8900_palette[offset];
73   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
74   return state->palette[offset];
9275}
9376
9477WRITE8_HANDLER( nbmj8900_palette_type3_w )
9578{
79   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
9680   int r, g, b;
9781
98   nbmj8900_palette[offset] = data;
82   state->palette[offset] = data;
9983
10084   if (!(offset & 1)) return;
10185
10286   offset &= 0x1fe;
10387
104   r = ((nbmj8900_palette[offset + 1] & 0x0f) >> 0);
105   g = ((nbmj8900_palette[offset + 0] & 0xf0) >> 4);
106   b = ((nbmj8900_palette[offset + 0] & 0x0f) >> 0);
88   r = ((state->palette[offset + 1] & 0x0f) >> 0);
89   g = ((state->palette[offset + 0] & 0xf0) >> 4);
90   b = ((state->palette[offset + 0] & 0x0f) >> 0);
10791
10892   palette_set_color_rgb(space->machine, (offset >> 1), pal4bit(r), pal4bit(g), pal4bit(b));
10993}
r10613r10614
11195
11296WRITE8_HANDLER( nbmj8900_clutsel_w )
11397{
114   nbmj8900_clutsel = data;
98   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
99   state->clutsel = data;
115100}
116101
117102READ8_HANDLER( nbmj8900_clut_r )
118103{
119   return nbmj8900_clut[offset];
104   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
105   return state->clut[offset];
120106}
121107
122108WRITE8_HANDLER( nbmj8900_clut_w )
123109{
124   nbmj8900_clut[((nbmj8900_clutsel & 0x7f) * 0x10) + (offset & 0x0f)] = data;
110   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
111   state->clut[((state->clutsel & 0x7f) * 0x10) + (offset & 0x0f)] = data;
125112}
126113
127114/******************************************************************************
r10613r10614
130117******************************************************************************/
131118WRITE8_HANDLER( nbmj8900_blitter_w )
132119{
120   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
133121   switch (offset)
134122   {
135      case 0x00:   blitter_src_addr = (blitter_src_addr & 0xff00) | data; break;
136      case 0x01:   blitter_src_addr = (blitter_src_addr & 0x00ff) | (data << 8); break;
137      case 0x02:   blitter_destx = data; break;
138      case 0x03:   blitter_desty = data; break;
139      case 0x04:   blitter_sizex = data; break;
140      case 0x05:   blitter_sizey = data;
123      case 0x00:   state->blitter_src_addr = (state->blitter_src_addr & 0xff00) | data; break;
124      case 0x01:   state->blitter_src_addr = (state->blitter_src_addr & 0x00ff) | (data << 8); break;
125      case 0x02:   state->blitter_destx = data; break;
126      case 0x03:   state->blitter_desty = data; break;
127      case 0x04:   state->blitter_sizex = data; break;
128      case 0x05:   state->blitter_sizey = data;
141129               /* writing here also starts the blit */
142130               nbmj8900_gfxdraw(space->machine);
143131               break;
144      case 0x06:   blitter_direction_x = (data & 0x01) ? 1 : 0;
145               blitter_direction_y = (data & 0x02) ? 1 : 0;
146               nbmj8900_flipscreen = (data & 0x04) ? 1 : 0;
147               nbmj8900_dispflag = (data & 0x08) ? 0 : 1;
148               if (gfxdraw_mode) nbmj8900_vramflip(space->machine, 1);
132      case 0x06:   state->blitter_direction_x = (data & 0x01) ? 1 : 0;
133               state->blitter_direction_y = (data & 0x02) ? 1 : 0;
134               state->flipscreen = (data & 0x04) ? 1 : 0;
135               state->dispflag = (data & 0x08) ? 0 : 1;
136               if (state->gfxdraw_mode) nbmj8900_vramflip(space->machine, 1);
149137               nbmj8900_vramflip(space->machine, 0);
150138               break;
151139      case 0x07:   break;
r10613r10614
154142
155143WRITE8_HANDLER( nbmj8900_scrolly_w )
156144{
157   nbmj8900_scrolly = data;
145   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
146   state->scrolly = data;
158147}
159148
160149WRITE8_HANDLER( nbmj8900_vramsel_w )
161150{
151   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
162152   /* protection - not sure about this */
163153   nb1413m3_sndromrgntag = (data & 0x20) ? "protdata" : "voice";
164154
165   nbmj8900_vram = data;
155   state->vram = data;
166156}
167157
168158WRITE8_HANDLER( nbmj8900_romsel_w )
169159{
170   nbmj8900_gfxrom = (data & 0x0f);
160   nbmj8900_state *state = space->machine->driver_data<nbmj8900_state>();
161   state->gfxrom = (data & 0x0f);
171162
172   if ((0x20000 * nbmj8900_gfxrom) > (space->machine->region("gfx")->bytes() - 1))
163   if ((0x20000 * state->gfxrom) > (space->machine->region("gfx")->bytes() - 1))
173164   {
174165#ifdef MAME_DEBUG
175166      popmessage("GFXROM BANK OVER!!");
176167#endif
177      nbmj8900_gfxrom &= (space->machine->region("gfx")->bytes() / 0x20000 - 1);
168      state->gfxrom &= (space->machine->region("gfx")->bytes() / 0x20000 - 1);
178169   }
179170}
180171
r10613r10614
184175******************************************************************************/
185176void nbmj8900_vramflip(running_machine *machine, int vram)
186177{
187   static int nbmj8900_flipscreen_old = 0;
178   nbmj8900_state *state = machine->driver_data<nbmj8900_state>();
188179   int x, y;
189180   unsigned char color1, color2;
190181   unsigned char *vidram;
191182   int width = machine->primary_screen->width();
192183   int height = machine->primary_screen->height();
193184
194   if (nbmj8900_flipscreen == nbmj8900_flipscreen_old) return;
185   if (state->flipscreen == state->flipscreen_old) return;
195186
196   vidram = vram ? nbmj8900_videoram1 : nbmj8900_videoram0;
187   vidram = vram ? state->videoram1 : state->videoram0;
197188
198189   for (y = 0; y < (height / 2); y++)
199190   {
r10613r10614
206197      }
207198   }
208199
209   nbmj8900_flipscreen_old = nbmj8900_flipscreen;
210   nbmj8900_screen_refresh = 1;
200   state->flipscreen_old = state->flipscreen;
201   state->screen_refresh = 1;
211202}
212203
213204
214205static void update_pixel0(running_machine *machine, int x, int y)
215206{
216   UINT8 color = nbmj8900_videoram0[(y * screen_width) + x];
217   *BITMAP_ADDR16(nbmj8900_tmpbitmap0, y, x) = machine->pens[color];
207   nbmj8900_state *state = machine->driver_data<nbmj8900_state>();
208   UINT8 color = state->videoram0[(y * state->screen_width) + x];
209   *BITMAP_ADDR16(state->tmpbitmap0, y, x) = machine->pens[color];
218210}
219211
220212static void update_pixel1(running_machine *machine, int x, int y)
221213{
222   UINT8 color = nbmj8900_videoram1[(y * screen_width) + x];
223   *BITMAP_ADDR16(nbmj8900_tmpbitmap1, y, x) = machine->pens[color];
214   nbmj8900_state *state = machine->driver_data<nbmj8900_state>();
215   UINT8 color = state->videoram1[(y * state->screen_width) + x];
216   *BITMAP_ADDR16(state->tmpbitmap1, y, x) = machine->pens[color];
224217}
225218
226219static TIMER_CALLBACK( blitter_timer_callback )
r10613r10614
230223
231224static void nbmj8900_gfxdraw(running_machine *machine)
232225{
226   nbmj8900_state *state = machine->driver_data<nbmj8900_state>();
233227   unsigned char *GFX = machine->region("gfx")->base();
234228
235229   int x, y;
r10613r10614
243237
244238   nb1413m3_busyctr = 0;
245239
246   startx = blitter_destx + blitter_sizex;
247   starty = blitter_desty + blitter_sizey;
240   startx = state->blitter_destx + state->blitter_sizex;
241   starty = state->blitter_desty + state->blitter_sizey;
248242
249   if (blitter_direction_x)
243   if (state->blitter_direction_x)
250244   {
251      sizex = blitter_sizex ^ 0xff;
245      sizex = state->blitter_sizex ^ 0xff;
252246      skipx = 1;
253247   }
254248   else
255249   {
256      sizex = blitter_sizex;
250      sizex = state->blitter_sizex;
257251      skipx = -1;
258252   }
259253
260   if (blitter_direction_y)
254   if (state->blitter_direction_y)
261255   {
262      sizey = blitter_sizey ^ 0xff;
256      sizey = state->blitter_sizey ^ 0xff;
263257      skipy = 1;
264258   }
265259   else
266260   {
267      sizey = blitter_sizey;
261      sizey = state->blitter_sizey;
268262      skipy = -1;
269263   }
270264
271   gfxaddr = (nbmj8900_gfxrom << 17) + (blitter_src_addr << 1);
265   gfxaddr = (state->gfxrom << 17) + (state->blitter_src_addr << 1);
272266
273267   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
274268   {
r10613r10614
293287         dx1 = (2 * x + 0) & 0x1ff;
294288         dx2 = (2 * x + 1) & 0x1ff;
295289
296         if (gfxdraw_mode)
290         if (state->gfxdraw_mode)
297291         {
298292            // 2 layer type
299293            dy1 = y & 0xff;
300            dy2 = (y + nbmj8900_scrolly) & 0xff;
294            dy2 = (y + state->scrolly) & 0xff;
301295         }
302296         else
303297         {
304298            // 1 layer type
305            dy1 = (y + nbmj8900_scrolly) & 0xff;
299            dy1 = (y + state->scrolly) & 0xff;
306300            dy2 = 0;
307301         }
308302
309         if (!nbmj8900_flipscreen)
303         if (!state->flipscreen)
310304         {
311305            dx1 ^= 0x1ff;
312306            dx2 ^= 0x1ff;
r10613r10614
314308            dy2 ^= 0xff;
315309         }
316310
317         if (blitter_direction_x)
311         if (state->blitter_direction_x)
318312         {
319313            // flip
320314            color1 = (color & 0x0f) >> 0;
r10613r10614
327321            color2 = (color & 0x0f) >> 0;
328322         }
329323
330         color1 = nbmj8900_clut[((nbmj8900_clutsel & 0x7f) << 4) + color1];
331         color2 = nbmj8900_clut[((nbmj8900_clutsel & 0x7f) << 4) + color2];
324         color1 = state->clut[((state->clutsel & 0x7f) << 4) + color1];
325         color2 = state->clut[((state->clutsel & 0x7f) << 4) + color2];
332326
333         if ((!gfxdraw_mode) || (nbmj8900_vram & 0x01))
327         if ((!state->gfxdraw_mode) || (state->vram & 0x01))
334328         {
335329            // layer 1
336330            if (color1 != 0xff)
337331            {
338               nbmj8900_videoram0[(dy1 * screen_width) + dx1] = color1;
332               state->videoram0[(dy1 * state->screen_width) + dx1] = color1;
339333               update_pixel0(machine, dx1, dy1);
340334            }
341335            if (color2 != 0xff)
342336            {
343               nbmj8900_videoram0[(dy1 * screen_width) + dx2] = color2;
337               state->videoram0[(dy1 * state->screen_width) + dx2] = color2;
344338               update_pixel0(machine, dx2, dy1);
345339            }
346340         }
347         if (gfxdraw_mode && (nbmj8900_vram & 0x02))
341         if (state->gfxdraw_mode && (state->vram & 0x02))
348342         {
349343            // layer 2
350            if (nbmj8900_vram & 0x08)
344            if (state->vram & 0x08)
351345            {
352346               // transparent enable
353347               if (color1 != 0xff)
354348               {
355                  nbmj8900_videoram1[(dy2 * screen_width) + dx1] = color1;
349                  state->videoram1[(dy2 * state->screen_width) + dx1] = color1;
356350                  update_pixel1(machine, dx1, dy2);
357351               }
358352               if (color2 != 0xff)
359353               {
360                  nbmj8900_videoram1[(dy2 * screen_width) + dx2] = color2;
354                  state->videoram1[(dy2 * state->screen_width) + dx2] = color2;
361355                  update_pixel1(machine, dx2, dy2);
362356               }
363357            }
364358            else
365359            {
366360               // transparent disable
367               nbmj8900_videoram1[(dy2 * screen_width) + dx1] = color1;
361               state->videoram1[(dy2 * state->screen_width) + dx1] = color1;
368362               update_pixel1(machine, dx1, dy2);
369               nbmj8900_videoram1[(dy2 * screen_width) + dx2] = color2;
363               state->videoram1[(dy2 * state->screen_width) + dx2] = color2;
370364               update_pixel1(machine, dx2, dy2);
371365            }
372366         }
r10613r10614
385379******************************************************************************/
386380VIDEO_START( nbmj8900_2layer )
387381{
388   screen_width = machine->primary_screen->width();
389   screen_height = machine->primary_screen->height();
382   nbmj8900_state *state = machine->driver_data<nbmj8900_state>();
383   state->screen_width = machine->primary_screen->width();
384   state->screen_height = machine->primary_screen->height();
390385
391   nbmj8900_tmpbitmap0 = machine->primary_screen->alloc_compatible_bitmap();
392   nbmj8900_tmpbitmap1 = machine->primary_screen->alloc_compatible_bitmap();
393   nbmj8900_videoram0 = auto_alloc_array(machine, UINT8, screen_width * screen_height);
394   nbmj8900_videoram1 = auto_alloc_array(machine, UINT8, screen_width * screen_height);
395   nbmj8900_palette = auto_alloc_array(machine, UINT8, 0x200);
396   nbmj8900_clut = auto_alloc_array(machine, UINT8, 0x800);
397   memset(nbmj8900_videoram0, 0xff, (screen_width * screen_height * sizeof(UINT8)));
398   memset(nbmj8900_videoram1, 0xff, (screen_width * screen_height * sizeof(UINT8)));
386   state->tmpbitmap0 = machine->primary_screen->alloc_compatible_bitmap();
387   state->tmpbitmap1 = machine->primary_screen->alloc_compatible_bitmap();
388   state->videoram0 = auto_alloc_array(machine, UINT8, state->screen_width * state->screen_height);
389   state->videoram1 = auto_alloc_array(machine, UINT8, state->screen_width * state->screen_height);
390   state->palette = auto_alloc_array(machine, UINT8, 0x200);
391   state->clut = auto_alloc_array(machine, UINT8, 0x800);
392   memset(state->videoram0, 0xff, (state->screen_width * state->screen_height * sizeof(UINT8)));
393   memset(state->videoram1, 0xff, (state->screen_width * state->screen_height * sizeof(UINT8)));
399394//  machine->pens[0x07f] = 0xff;    /* palette_transparent_pen */
400   gfxdraw_mode = 1;
395   state->gfxdraw_mode = 1;
401396}
402397
403398/******************************************************************************
r10613r10614
406401******************************************************************************/
407402SCREEN_UPDATE( nbmj8900 )
408403{
404   nbmj8900_state *state = screen->machine->driver_data<nbmj8900_state>();
409405   int x, y;
410406
411   if (nbmj8900_screen_refresh)
407   if (state->screen_refresh)
412408   {
413      nbmj8900_screen_refresh = 0;
414      for (y = 0; y < screen_height; y++)
409      state->screen_refresh = 0;
410      for (y = 0; y < state->screen_height; y++)
415411      {
416         for (x = 0; x < screen_width; x++)
412         for (x = 0; x < state->screen_width; x++)
417413         {
418414            update_pixel0(screen->machine, x, y);
419415         }
420416      }
421      if (gfxdraw_mode)
417      if (state->gfxdraw_mode)
422418      {
423         for (y = 0; y < screen_height; y++)
419         for (y = 0; y < state->screen_height; y++)
424420         {
425            for (x = 0; x < screen_width; x++)
421            for (x = 0; x < state->screen_width; x++)
426422            {
427423               update_pixel1(screen->machine, x, y);
428424            }
r10613r10614
430426      }
431427   }
432428
433   if (nbmj8900_dispflag)
429   if (state->dispflag)
434430   {
435      static int scrolly;
436      if (!nbmj8900_flipscreen) scrolly =   nbmj8900_scrolly;
437      else                      scrolly = (-nbmj8900_scrolly) & 0xff;
431      int scrolly;
432      if (!state->flipscreen) scrolly =   state->scrolly;
433      else                      scrolly = (-state->scrolly) & 0xff;
438434
439      if (gfxdraw_mode)
435      if (state->gfxdraw_mode)
440436      {
441         copyscrollbitmap(bitmap, nbmj8900_tmpbitmap0, 0, 0, 0, 0, cliprect);
442         copyscrollbitmap_trans(bitmap, nbmj8900_tmpbitmap1, 0, 0, 1, &scrolly, cliprect, 0xff);
437         copyscrollbitmap(bitmap, state->tmpbitmap0, 0, 0, 0, 0, cliprect);
438         copyscrollbitmap_trans(bitmap, state->tmpbitmap1, 0, 0, 1, &scrolly, cliprect, 0xff);
443439      }
444440      else
445441      {
446         copyscrollbitmap(bitmap, nbmj8900_tmpbitmap0, 0, 0, 1, &scrolly, cliprect);
442         copyscrollbitmap(bitmap, state->tmpbitmap0, 0, 0, 1, &scrolly, cliprect);
447443      }
448444   }
449445   else
src/mame/video/m90.c
r10613r10614
2929#include "emu.h"
3030#include "includes/m90.h"
3131
32static UINT16 *m90_spriteram;
33UINT16 *m90_video_data;
34static UINT16 m90_video_control_data[8];
35static tilemap_t *pf1_layer,*pf2_layer,*pf1_wide_layer,*pf2_wide_layer;
3632
3733INLINE void get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer,int page_mask)
3834{
35   m90_state *state = machine->driver_data<m90_state>();
3936   int tile,color;
40   tile_index = 2*tile_index + ((m90_video_control_data[5+layer] & page_mask) * 0x2000);
37   tile_index = 2*tile_index + ((state->video_control_data[5+layer] & page_mask) * 0x2000);
4138
42   tile=m90_video_data[tile_index];
43   color=m90_video_data[tile_index+1];
39   tile=state->video_data[tile_index];
40   color=state->video_data[tile_index+1];
4441   SET_TILE_INFO(
4542         0,
4643         tile,
r10613r10614
5148
5249INLINE void bomblord_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer)
5350{
51   m90_state *state = machine->driver_data<m90_state>();
5452   int tile,color;
5553   tile_index = 2*tile_index + (layer * 0x2000);
5654
57   tile=m90_video_data[tile_index];
58   color=m90_video_data[tile_index+1];
55   tile=state->video_data[tile_index];
56   color=state->video_data[tile_index+1];
5957   SET_TILE_INFO(
6058         0,
6159         tile,
r10613r10614
6664
6765INLINE void dynablsb_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int layer)
6866{
67   m90_state *state = machine->driver_data<m90_state>();
6968   int tile,color;
7069   tile_index = 2*tile_index + (layer * 0x2000);
7170
72   tile=m90_video_data[tile_index];
73   color=m90_video_data[tile_index+1];
71   tile=state->video_data[tile_index];
72   color=state->video_data[tile_index+1];
7473   SET_TILE_INFO(
7574         0,
7675         tile,
r10613r10614
9695
9796VIDEO_START( m90 )
9897{
99   pf1_layer =      tilemap_create(machine, get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
100   pf1_wide_layer = tilemap_create(machine, get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
101   pf2_layer =      tilemap_create(machine, get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
102   pf2_wide_layer = tilemap_create(machine, get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
98   m90_state *state = machine->driver_data<m90_state>();
99   state->pf1_layer =      tilemap_create(machine, get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
100   state->pf1_wide_layer = tilemap_create(machine, get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
101   state->pf2_layer =      tilemap_create(machine, get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
102   state->pf2_wide_layer = tilemap_create(machine, get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
103103
104   tilemap_set_transparent_pen(pf1_layer,0);
105   tilemap_set_transparent_pen(pf1_wide_layer,0);
104   tilemap_set_transparent_pen(state->pf1_layer,0);
105   tilemap_set_transparent_pen(state->pf1_wide_layer,0);
106106
107   state_save_register_global_array(machine, m90_video_control_data);
107   state_save_register_global_array(machine, state->video_control_data);
108108}
109109
110110VIDEO_START( bomblord )
111111{
112   pf1_layer =      tilemap_create(machine, bomblord_get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
113   pf1_wide_layer = tilemap_create(machine, bomblord_get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
114   pf2_layer =      tilemap_create(machine, bomblord_get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
115   pf2_wide_layer = tilemap_create(machine, bomblord_get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
112   m90_state *state = machine->driver_data<m90_state>();
113   state->pf1_layer =      tilemap_create(machine, bomblord_get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
114   state->pf1_wide_layer = tilemap_create(machine, bomblord_get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
115   state->pf2_layer =      tilemap_create(machine, bomblord_get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
116   state->pf2_wide_layer = tilemap_create(machine, bomblord_get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
116117
117   tilemap_set_transparent_pen(pf2_layer,0);
118   tilemap_set_transparent_pen(pf2_wide_layer,0);
119   tilemap_set_transparent_pen(pf1_layer,0);
120   tilemap_set_transparent_pen(pf1_wide_layer,0);
118   tilemap_set_transparent_pen(state->pf2_layer,0);
119   tilemap_set_transparent_pen(state->pf2_wide_layer,0);
120   tilemap_set_transparent_pen(state->pf1_layer,0);
121   tilemap_set_transparent_pen(state->pf1_wide_layer,0);
121122
122   state_save_register_global_array(machine, m90_video_control_data);
123   state_save_register_global_array(machine, state->video_control_data);
123124}
124125
125126VIDEO_START( dynablsb )
126127{
127   pf1_layer =      tilemap_create(machine, dynablsb_get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
128   pf1_wide_layer = tilemap_create(machine, dynablsb_get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
129   pf2_layer =      tilemap_create(machine, dynablsb_get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
130   pf2_wide_layer = tilemap_create(machine, dynablsb_get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
128   m90_state *state = machine->driver_data<m90_state>();
129   state->pf1_layer =      tilemap_create(machine, dynablsb_get_pf1_tile_info, tilemap_scan_rows,8,8,64,64);
130   state->pf1_wide_layer = tilemap_create(machine, dynablsb_get_pf1w_tile_info,tilemap_scan_rows,8,8,128,64);
131   state->pf2_layer =      tilemap_create(machine, dynablsb_get_pf2_tile_info, tilemap_scan_rows,8,8,64,64);
132   state->pf2_wide_layer = tilemap_create(machine, dynablsb_get_pf2w_tile_info,tilemap_scan_rows,8,8,128,64);
131133
132   tilemap_set_transparent_pen(pf2_layer,0);
133   tilemap_set_transparent_pen(pf2_wide_layer,0);
134   tilemap_set_transparent_pen(state->pf2_layer,0);
135   tilemap_set_transparent_pen(state->pf2_wide_layer,0);
134136
135   state_save_register_global_array(machine, m90_video_control_data);
137   state_save_register_global_array(machine, state->video_control_data);
136138}
137139
138140static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
139141{
142   m90_state *state = machine->driver_data<m90_state>();
140143   int offs;
141144
142145   for (offs = 0x1f2/2; offs >= 0; offs -= 3)
143146   {
144147      int x,y,sprite,colour,fx,fy,y_multi,i;
145148
146      sprite = m90_spriteram[offs+1];
147      colour = (m90_spriteram[offs+0] >> 9) & 0x0f;
149      sprite = state->spriteram[offs+1];
150      colour = (state->spriteram[offs+0] >> 9) & 0x0f;
148151
149      y = m90_spriteram[offs+0] & 0x1ff;
150      x = m90_spriteram[offs+2] & 0x1ff;
152      y = state->spriteram[offs+0] & 0x1ff;
153      x = state->spriteram[offs+2] & 0x1ff;
151154
152155      x = x - 16;
153156      y = 512 - y;
154157
155      fx = (m90_spriteram[offs+2] >> 8) & 0x02;
156      fy = (m90_spriteram[offs+0] >> 8) & 0x80;
158      fx = (state->spriteram[offs+2] >> 8) & 0x02;
159      fy = (state->spriteram[offs+0] >> 8) & 0x80;
157160
158      y_multi = 1 << ((m90_spriteram[offs+0] & 0x6000) >> 13);
161      y_multi = 1 << ((state->spriteram[offs+0] & 0x6000) >> 13);
159162      y -= 16 * y_multi;
160163
161164      for (i = 0;i < y_multi;i++)
162165
163         if (m90_video_control_data[7] & 0x01)
166         if (state->video_control_data[7] & 0x01)
164167            pdrawgfx_transpen(bitmap,cliprect,machine->gfx[1],
165168               sprite + (fy ? y_multi-1 - i : i),
166169               colour,
r10613r10614
168171               x,y+i*16,
169172               machine->priority_bitmap,
170173               (colour & 0x08) ? 0x00 : 0x02,0);
171         else if (m90_video_control_data[7] & 0x02)
174         else if (state->video_control_data[7] & 0x02)
172175            pdrawgfx_transpen(bitmap,cliprect,machine->gfx[1],
173176               sprite + (fy ? y_multi-1 - i : i),
174177               colour,
r10613r10614
266269
267270WRITE16_HANDLER( m90_video_control_w )
268271{
269   COMBINE_DATA(&m90_video_control_data[offset]);
272   m90_state *state = space->machine->driver_data<m90_state>();
273   COMBINE_DATA(&state->video_control_data[offset]);
270274}
271275
272276static void markdirty(tilemap_t *tmap,int page,offs_t offset)
r10613r10614
279283
280284WRITE16_HANDLER( m90_video_w )
281285{
282   COMBINE_DATA(&m90_video_data[offset]);
286   m90_state *state = space->machine->driver_data<m90_state>();
287   COMBINE_DATA(&state->video_data[offset]);
283288
284   markdirty(pf1_layer,     m90_video_control_data[5] & 0x3,offset);
285   markdirty(pf1_wide_layer,m90_video_control_data[5] & 0x2,offset);
286   markdirty(pf2_layer,     m90_video_control_data[6] & 0x3,offset);
287   markdirty(pf2_wide_layer,m90_video_control_data[6] & 0x2,offset);
289   markdirty(state->pf1_layer,     state->video_control_data[5] & 0x3,offset);
290   markdirty(state->pf1_wide_layer,state->video_control_data[5] & 0x2,offset);
291   markdirty(state->pf2_layer,     state->video_control_data[6] & 0x3,offset);
292   markdirty(state->pf2_wide_layer,state->video_control_data[6] & 0x2,offset);
288293}
289294
290295SCREEN_UPDATE( m90 )
291296{
292   static int last_pf1,last_pf2;
293   int pf1_base = m90_video_control_data[5] & 0x3;
294   int pf2_base = m90_video_control_data[6] & 0x3;
297   m90_state *state = screen->machine->driver_data<m90_state>();
298   int pf1_base = state->video_control_data[5] & 0x3;
299   int pf2_base = state->video_control_data[6] & 0x3;
295300   int i,pf1_enable,pf2_enable, video_enable;
296301
297   if (m90_video_control_data[7]&0x04) video_enable=0; else video_enable=1;
298   if (m90_video_control_data[5]&0x10) pf1_enable=0; else pf1_enable=1;
299   if (m90_video_control_data[6]&0x10) pf2_enable=0; else pf2_enable=1;
302   if (state->video_control_data[7]&0x04) video_enable=0; else video_enable=1;
303   if (state->video_control_data[5]&0x10) pf1_enable=0; else pf1_enable=1;
304   if (state->video_control_data[6]&0x10) pf2_enable=0; else pf2_enable=1;
300305
301// tilemap_set_enable(pf1_layer,pf1_enable);
302// tilemap_set_enable(pf2_layer,pf2_enable);
303// tilemap_set_enable(pf1_wide_layer,pf1_enable);
304// tilemap_set_enable(pf2_wide_layer,pf2_enable);
306// tilemap_set_enable(state->pf1_layer,pf1_enable);
307// tilemap_set_enable(state->pf2_layer,pf2_enable);
308// tilemap_set_enable(state->pf1_wide_layer,pf1_enable);
309// tilemap_set_enable(state->pf2_wide_layer,pf2_enable);
305310
306311   /* Dirty tilemaps if VRAM base changes */
307   if (pf1_base!=last_pf1)
312   if (pf1_base!=state->last_pf1)
308313   {
309      tilemap_mark_all_tiles_dirty(pf1_layer);
310      tilemap_mark_all_tiles_dirty(pf1_wide_layer);
314      tilemap_mark_all_tiles_dirty(state->pf1_layer);
315      tilemap_mark_all_tiles_dirty(state->pf1_wide_layer);
311316   }
312   if (pf2_base!=last_pf2)
317   if (pf2_base!=state->last_pf2)
313318   {
314      tilemap_mark_all_tiles_dirty(pf2_layer);
315      tilemap_mark_all_tiles_dirty(pf2_wide_layer);
319      tilemap_mark_all_tiles_dirty(state->pf2_layer);
320      tilemap_mark_all_tiles_dirty(state->pf2_wide_layer);
316321   }
317   last_pf1=pf1_base;
318   last_pf2=pf2_base;
322   state->last_pf1=pf1_base;
323   state->last_pf2=pf2_base;
319324
320   m90_spriteram=m90_video_data+0xee00/2;
325   state->spriteram=state->video_data+0xee00/2;
321326
322327   /* Setup scrolling */
323   if (m90_video_control_data[5]&0x20)
328   if (state->video_control_data[5]&0x20)
324329   {
325      tilemap_set_scroll_rows(pf1_layer,512);
326      tilemap_set_scroll_rows(pf1_wide_layer,512);
330      tilemap_set_scroll_rows(state->pf1_layer,512);
331      tilemap_set_scroll_rows(state->pf1_wide_layer,512);
327332
328333      for (i=0; i<512; i++)
329         tilemap_set_scrollx( pf1_layer,i, m90_video_data[0xf000/2+i]+2);
334         tilemap_set_scrollx( state->pf1_layer,i, state->video_data[0xf000/2+i]+2);
330335      for (i=0; i<512; i++)
331         tilemap_set_scrollx( pf1_wide_layer,i, m90_video_data[0xf000/2+i]+256+2);
336         tilemap_set_scrollx( state->pf1_wide_layer,i, state->video_data[0xf000/2+i]+256+2);
332337
333338   }
334339   else
335340   {
336      tilemap_set_scroll_rows(pf1_layer,1);
337      tilemap_set_scroll_rows(pf1_wide_layer,1);
338      tilemap_set_scrollx( pf1_layer,0, m90_video_control_data[1]+2);
339      tilemap_set_scrollx( pf1_wide_layer,0, m90_video_control_data[1]+256+2);
341      tilemap_set_scroll_rows(state->pf1_layer,1);
342      tilemap_set_scroll_rows(state->pf1_wide_layer,1);
343      tilemap_set_scrollx( state->pf1_layer,0, state->video_control_data[1]+2);
344      tilemap_set_scrollx( state->pf1_wide_layer,0, state->video_control_data[1]+256+2);
340345   }
341346
342347   /* Setup scrolling */
343   if (m90_video_control_data[6]&0x20)
348   if (state->video_control_data[6]&0x20)
344349   {
345      tilemap_set_scroll_rows(pf2_layer,512);
346      tilemap_set_scroll_rows(pf2_wide_layer,512);
350      tilemap_set_scroll_rows(state->pf2_layer,512);
351      tilemap_set_scroll_rows(state->pf2_wide_layer,512);
347352      for (i=0; i<512; i++)
348         tilemap_set_scrollx( pf2_layer,i, m90_video_data[0xf400/2+i]-2);
353         tilemap_set_scrollx( state->pf2_layer,i, state->video_data[0xf400/2+i]-2);
349354      for (i=0; i<512; i++)
350         tilemap_set_scrollx( pf2_wide_layer,i, m90_video_data[0xf400/2+i]+256-2);
355         tilemap_set_scrollx( state->pf2_wide_layer,i, state->video_data[0xf400/2+i]+256-2);
351356   } else {
352      tilemap_set_scroll_rows(pf2_layer,1);
353      tilemap_set_scroll_rows(pf2_wide_layer,1);
354      tilemap_set_scrollx( pf2_layer,0, m90_video_control_data[3]-2);
355      tilemap_set_scrollx( pf2_wide_layer,0, m90_video_control_data[3]+256-2 );
357      tilemap_set_scroll_rows(state->pf2_layer,1);
358      tilemap_set_scroll_rows(state->pf2_wide_layer,1);
359      tilemap_set_scrollx( state->pf2_layer,0, state->video_control_data[3]-2);
360      tilemap_set_scrollx( state->pf2_wide_layer,0, state->video_control_data[3]+256-2 );
356361   }
357362
358363   bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
r10613r10614
363368      if (pf2_enable)
364369      {
365370         // use the playfield 2 y-offset table for each scanline
366         if (m90_video_control_data[6] & 0x40)
371         if (state->video_control_data[6] & 0x40)
367372         {
368373            int line;
369374            rectangle clip;
r10613r10614
374379            {
375380               clip.min_y = clip.max_y = line;
376381
377               if (m90_video_control_data[6] & 0x4)
382               if (state->video_control_data[6] & 0x4)
378383               {
379                  tilemap_set_scrolly(pf2_wide_layer, 0, 0x200 + m90_video_data[0xfc00/2 + line]);
380                  tilemap_draw(bitmap,&clip,pf2_wide_layer,0,0);
381                  tilemap_draw(bitmap,&clip,pf2_wide_layer,1,1);
384                  tilemap_set_scrolly(state->pf2_wide_layer, 0, 0x200 + state->video_data[0xfc00/2 + line]);
385                  tilemap_draw(bitmap,&clip,state->pf2_wide_layer,0,0);
386                  tilemap_draw(bitmap,&clip,state->pf2_wide_layer,1,1);
382387               } else {
383                  tilemap_set_scrolly(pf2_layer, 0, 0x200 + m90_video_data[0xfc00/2 + line]);
384                  tilemap_draw(bitmap,&clip,pf2_layer,0,0);
385                  tilemap_draw(bitmap,&clip,pf2_layer,1,1);
388                  tilemap_set_scrolly(state->pf2_layer, 0, 0x200 + state->video_data[0xfc00/2 + line]);
389                  tilemap_draw(bitmap,&clip,state->pf2_layer,0,0);
390                  tilemap_draw(bitmap,&clip,state->pf2_layer,1,1);
386391               }
387392            }
388393         }
389394         else
390395         {
391            if (m90_video_control_data[6] & 0x4)
396            if (state->video_control_data[6] & 0x4)
392397            {
393               tilemap_set_scrolly( pf2_wide_layer,0, m90_video_control_data[2] );
394               tilemap_draw(bitmap,cliprect,pf2_wide_layer,0,0);
395               tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1);
398               tilemap_set_scrolly( state->pf2_wide_layer,0, state->video_control_data[2] );
399               tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,0,0);
400               tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,1,1);
396401            } else {
397               tilemap_set_scrolly( pf2_layer,0, m90_video_control_data[2] );
398               tilemap_draw(bitmap,cliprect,pf2_layer,0,0);
399               tilemap_draw(bitmap,cliprect,pf2_layer,1,1);
402               tilemap_set_scrolly( state->pf2_layer,0, state->video_control_data[2] );
403               tilemap_draw(bitmap,cliprect,state->pf2_layer,0,0);
404               tilemap_draw(bitmap,cliprect,state->pf2_layer,1,1);
400405            }
401406         }
402407      }
r10613r10614
408413      if (pf1_enable)
409414      {
410415         // use the playfield 1 y-offset table for each scanline
411         if (m90_video_control_data[5] & 0x40)
416         if (state->video_control_data[5] & 0x40)
412417         {
413418            int line;
414419            rectangle clip;
r10613r10614
419424            {
420425               clip.min_y = clip.max_y = line;
421426
422               if (m90_video_control_data[5] & 0x4)
427               if (state->video_control_data[5] & 0x4)
423428               {
424                  tilemap_set_scrolly(pf1_wide_layer, 0, 0x200 + m90_video_data[0xf800/2 + line]);
425                  tilemap_draw(bitmap,&clip,pf1_wide_layer,0,0);
426                  tilemap_draw(bitmap,&clip,pf1_wide_layer,1,1);
429                  tilemap_set_scrolly(state->pf1_wide_layer, 0, 0x200 + state->video_data[0xf800/2 + line]);
430                  tilemap_draw(bitmap,&clip,state->pf1_wide_layer,0,0);
431                  tilemap_draw(bitmap,&clip,state->pf1_wide_layer,1,1);
427432               } else {
428                  tilemap_set_scrolly(pf1_layer, 0, 0x200 + m90_video_data[0xf800/2 + line]);
429                  tilemap_draw(bitmap,&clip,pf1_layer,0,0);
430                  tilemap_draw(bitmap,&clip,pf1_layer,1,1);
433                  tilemap_set_scrolly(state->pf1_layer, 0, 0x200 + state->video_data[0xf800/2 + line]);
434                  tilemap_draw(bitmap,&clip,state->pf1_layer,0,0);
435                  tilemap_draw(bitmap,&clip,state->pf1_layer,1,1);
431436               }
432437            }
433438         }
434439         else
435440         {
436            if (m90_video_control_data[5] & 0x4)
441            if (state->video_control_data[5] & 0x4)
437442            {
438               tilemap_set_scrolly( pf1_wide_layer,0, m90_video_control_data[0] );
439               tilemap_draw(bitmap,cliprect,pf1_wide_layer,0,0);
440               tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1);
443               tilemap_set_scrolly( state->pf1_wide_layer,0, state->video_control_data[0] );
444               tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,0,0);
445               tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,1,1);
441446            } else {
442               tilemap_set_scrolly( pf1_layer,0, m90_video_control_data[0] );
443               tilemap_draw(bitmap,cliprect,pf1_layer,0,0);
444               tilemap_draw(bitmap,cliprect,pf1_layer,1,1);
447               tilemap_set_scrolly( state->pf1_layer,0, state->video_control_data[0] );
448               tilemap_draw(bitmap,cliprect,state->pf1_layer,0,0);
449               tilemap_draw(bitmap,cliprect,state->pf1_layer,1,1);
445450            }
446451         }
447452      }
r10613r10614
457462
458463SCREEN_UPDATE( bomblord )
459464{
465   m90_state *state = screen->machine->driver_data<m90_state>();
460466   int i;
461467   bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
462468   bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
463469
464470   /* Setup scrolling */
465   if (m90_video_control_data[6]&0x20) {
466      tilemap_set_scroll_rows(pf1_layer,512);
467      tilemap_set_scroll_rows(pf1_wide_layer,512);
471   if (state->video_control_data[6]&0x20) {
472      tilemap_set_scroll_rows(state->pf1_layer,512);
473      tilemap_set_scroll_rows(state->pf1_wide_layer,512);
468474      for (i=0; i<512; i++)
469         tilemap_set_scrollx( pf1_layer,i, m90_video_data[0xf400/2+i]-12);
475         tilemap_set_scrollx( state->pf1_layer,i, state->video_data[0xf400/2+i]-12);
470476      for (i=0; i<512; i++)
471         tilemap_set_scrollx( pf1_wide_layer,i, m90_video_data[0xf400/2+i]-12+256);
477         tilemap_set_scrollx( state->pf1_wide_layer,i, state->video_data[0xf400/2+i]-12+256);
472478   } else {
473      tilemap_set_scroll_rows(pf1_layer,1);
474      tilemap_set_scroll_rows(pf1_wide_layer,1);
475      tilemap_set_scrollx( pf1_layer,0,  m90_video_data[0xf004/2]-12);
476      tilemap_set_scrollx( pf1_wide_layer,0, m90_video_data[0xf004/2]-12 );
479      tilemap_set_scroll_rows(state->pf1_layer,1);
480      tilemap_set_scroll_rows(state->pf1_wide_layer,1);
481      tilemap_set_scrollx( state->pf1_layer,0,  state->video_data[0xf004/2]-12);
482      tilemap_set_scrollx( state->pf1_wide_layer,0, state->video_data[0xf004/2]-12 );
477483   }
478484
479   if (m90_video_control_data[6] & 0x02) {
480      tilemap_mark_all_tiles_dirty(pf2_wide_layer);
481      tilemap_set_scrollx( pf2_wide_layer,0, m90_video_data[0xf000/2]-16 );
482      tilemap_set_scrolly( pf2_wide_layer,0, m90_video_data[0xf008/2]+388 );
483      tilemap_draw(bitmap,cliprect,pf2_wide_layer,0,0);
484      tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1);
485   if (state->video_control_data[6] & 0x02) {
486      tilemap_mark_all_tiles_dirty(state->pf2_wide_layer);
487      tilemap_set_scrollx( state->pf2_wide_layer,0, state->video_data[0xf000/2]-16 );
488      tilemap_set_scrolly( state->pf2_wide_layer,0, state->video_data[0xf008/2]+388 );
489      tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,0,0);
490      tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,1,1);
485491   } else {
486      tilemap_mark_all_tiles_dirty(pf2_layer);
487      tilemap_set_scrollx( pf2_layer,0, m90_video_data[0xf000/2]-16 );
488      tilemap_set_scrolly( pf2_layer,0, m90_video_data[0xf008/2]-120 );
489      tilemap_draw(bitmap,cliprect,pf2_layer,0,0);
490      tilemap_draw(bitmap,cliprect,pf2_layer,1,1);
492      tilemap_mark_all_tiles_dirty(state->pf2_layer);
493      tilemap_set_scrollx( state->pf2_layer,0, state->video_data[0xf000/2]-16 );
494      tilemap_set_scrolly( state->pf2_layer,0, state->video_data[0xf008/2]-120 );
495      tilemap_draw(bitmap,cliprect,state->pf2_layer,0,0);
496      tilemap_draw(bitmap,cliprect,state->pf2_layer,1,1);
491497   }
492498
493   if (m90_video_control_data[6] & 0x04) {
494      tilemap_mark_all_tiles_dirty(pf1_wide_layer);
495      tilemap_set_scrolly( pf1_wide_layer,0, m90_video_data[0xf00c/2]+392 );
496      tilemap_draw(bitmap,cliprect,pf1_wide_layer,0,0);
497      tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1);
499   if (state->video_control_data[6] & 0x04) {
500      tilemap_mark_all_tiles_dirty(state->pf1_wide_layer);
501      tilemap_set_scrolly( state->pf1_wide_layer,0, state->video_data[0xf00c/2]+392 );
502      tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,0,0);
503      tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,1,1);
498504   } else {
499      tilemap_mark_all_tiles_dirty(pf1_layer);
500      tilemap_set_scrolly( pf1_layer,0, m90_video_data[0xf00c/2]-116 );
501      tilemap_draw(bitmap,cliprect,pf1_layer,0,0);
502      tilemap_draw(bitmap,cliprect,pf1_layer,1,1);
505      tilemap_mark_all_tiles_dirty(state->pf1_layer);
506      tilemap_set_scrolly( state->pf1_layer,0, state->video_data[0xf00c/2]-116 );
507      tilemap_draw(bitmap,cliprect,state->pf1_layer,0,0);
508      tilemap_draw(bitmap,cliprect,state->pf1_layer,1,1);
503509   }
504510
505511   bomblord_draw_sprites(screen->machine,bitmap,cliprect);
r10613r10614
509515
510516SCREEN_UPDATE( dynablsb )
511517{
518   m90_state *state = screen->machine->driver_data<m90_state>();
512519   bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
513520   bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
514521
515   if (!(m90_video_data[0xf008/2] & 0x4000)) {
516      tilemap_mark_all_tiles_dirty(pf1_wide_layer);
517      tilemap_set_scroll_rows(pf1_wide_layer,1);
518      tilemap_set_scrollx( pf1_wide_layer,0, m90_video_data[0xf004/2]+64);
519      tilemap_set_scrolly( pf1_wide_layer,0, m90_video_data[0xf006/2]+512);
520      tilemap_draw(bitmap,cliprect,pf1_wide_layer,0,0);
521      tilemap_draw(bitmap,cliprect,pf1_wide_layer,1,1);
522   if (!(state->video_data[0xf008/2] & 0x4000)) {
523      tilemap_mark_all_tiles_dirty(state->pf1_wide_layer);
524      tilemap_set_scroll_rows(state->pf1_wide_layer,1);
525      tilemap_set_scrollx( state->pf1_wide_layer,0, state->video_data[0xf004/2]+64);
526      tilemap_set_scrolly( state->pf1_wide_layer,0, state->video_data[0xf006/2]+512);
527      tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,0,0);
528      tilemap_draw(bitmap,cliprect,state->pf1_wide_layer,1,1);
522529   } else {
523      tilemap_mark_all_tiles_dirty(pf1_layer);
524      tilemap_set_scroll_rows(pf1_layer,1);
525      tilemap_set_scrollx( pf1_layer,0, m90_video_data[0xf004/2]+64);
526      tilemap_set_scrolly( pf1_layer,0, m90_video_data[0xf006/2]+4);
527      tilemap_draw(bitmap,cliprect,pf1_layer,0,0);
528      tilemap_draw(bitmap,cliprect,pf1_layer,1,1);
530      tilemap_mark_all_tiles_dirty(state->pf1_layer);
531      tilemap_set_scroll_rows(state->pf1_layer,1);
532      tilemap_set_scrollx( state->pf1_layer,0, state->video_data[0xf004/2]+64);
533      tilemap_set_scrolly( state->pf1_layer,0, state->video_data[0xf006/2]+4);
534      tilemap_draw(bitmap,cliprect,state->pf1_layer,0,0);
535      tilemap_draw(bitmap,cliprect,state->pf1_layer,1,1);
529536   }
530537
531   if (!(m90_video_data[0xf008/2] & 0x8000)) {
532      tilemap_mark_all_tiles_dirty(pf2_wide_layer);
533      tilemap_set_scroll_rows(pf2_wide_layer,1);
534      tilemap_set_scrollx( pf2_wide_layer,0, m90_video_data[0xf000/2]+68);
535      tilemap_set_scrolly( pf2_wide_layer,0, m90_video_data[0xf002/2]+512);
536      tilemap_draw(bitmap,cliprect,pf2_wide_layer,0,0);
537      tilemap_draw(bitmap,cliprect,pf2_wide_layer,1,1);
538   if (!(state->video_data[0xf008/2] & 0x8000)) {
539      tilemap_mark_all_tiles_dirty(state->pf2_wide_layer);
540      tilemap_set_scroll_rows(state->pf2_wide_layer,1);
541      tilemap_set_scrollx( state->pf2_wide_layer,0, state->video_data[0xf000/2]+68);
542      tilemap_set_scrolly( state->pf2_wide_layer,0, state->video_data[0xf002/2]+512);
543      tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,0,0);
544      tilemap_draw(bitmap,cliprect,state->pf2_wide_layer,1,1);
538545   } else {
539      tilemap_mark_all_tiles_dirty(pf2_layer);
540      tilemap_set_scroll_rows(pf2_layer,1);
541      tilemap_set_scrollx( pf2_layer,0, m90_video_data[0xf000/2]+68);
542      tilemap_set_scrolly( pf2_layer,0, m90_video_data[0xf002/2]+4);
543      tilemap_draw(bitmap,cliprect,pf2_layer,0,0);
544      tilemap_draw(bitmap,cliprect,pf2_layer,1,1);
546      tilemap_mark_all_tiles_dirty(state->pf2_layer);
547      tilemap_set_scroll_rows(state->pf2_layer,1);
548      tilemap_set_scrollx( state->pf2_layer,0, state->video_data[0xf000/2]+68);
549      tilemap_set_scrolly( state->pf2_layer,0, state->video_data[0xf002/2]+4);
550      tilemap_draw(bitmap,cliprect,state->pf2_layer,0,0);
551      tilemap_draw(bitmap,cliprect,state->pf2_layer,1,1);
545552   }
546553
547554   dynablsb_draw_sprites(screen->machine,bitmap,cliprect);
src/mame/video/playch10.c
r10613r10614
22#include "video/ppu2c0x.h"
33#include "includes/playch10.h"
44
5static int pc10_bios;
65
7static tilemap_t *bg_tilemap;
86
97WRITE8_HANDLER( playch10_videoram_w )
108{
119   playch10_state *state = space->machine->driver_data<playch10_state>();
1210   UINT8 *videoram = state->videoram;
13   if (pc10_sdcs)
11   if (state->pc10_sdcs)
1412   {
1513      videoram[offset] = data;
16      tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
14      tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
1715   }
1816}
1917
r10613r10614
6159
6260static void ppu_irq( device_t *device, int *ppu_regs )
6361{
62   playch10_state *state = device->machine->driver_data<playch10_state>();
6463   cputag_set_input_line(device->machine, "cart", INPUT_LINE_NMI, PULSE_LINE );
65   pc10_int_detect = 1;
64   state->pc10_int_detect = 1;
6665}
6766
6867/* our ppu interface                                           */
r10613r10614
9897
9998VIDEO_START( playch10 )
10099{
100   playch10_state *state = machine->driver_data<playch10_state>();
101101   const UINT8 *bios = machine->region("maincpu")->base();
102   pc10_bios = (bios[3] == 0x2a) ? 1 : 2;
102   state->pc10_bios = (bios[3] == 0x2a) ? 1 : 2;
103103
104   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
104   state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
105105       8, 8, 32, 32);
106106}
107107
108108VIDEO_START( playch10_hboard )
109109{
110   playch10_state *state = machine->driver_data<playch10_state>();
110111   const UINT8 *bios = machine->region("maincpu")->base();
111   pc10_bios = (bios[3] == 0x2a) ? 1 : 2;
112   state->pc10_bios = (bios[3] == 0x2a) ? 1 : 2;
112113
113   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
114   state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
114115       8, 8, 32, 32);
115116}
116117
r10613r10614
122123
123124SCREEN_UPDATE( playch10 )
124125{
126   playch10_state *state = screen->machine->driver_data<playch10_state>();
125127   device_t *ppu = screen->machine->device("ppu");
126128
127129   /* Dual monitor version */
128   if (pc10_bios == 1)
130   if (state->pc10_bios == 1)
129131   {
130132      device_t *top_screen = screen->machine->device("top");
131133
r10613r10614
137139
138140      if (screen == top_screen)
139141      {
140         if ( !pc10_dispmask )
142         if ( !state->pc10_dispmask )
141143            /* render the ppu */
142144            ppu2c0x_render( ppu, bitmap, 0, 0, 0, 0 );
143145         else
r10613r10614
147149      {
148150         /* When the bios is accessing vram, the video circuitry can't access it */
149151
150         if ( !pc10_sdcs )
151            tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
152         if ( !state->pc10_sdcs )
153            tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
152154         else
153155            bitmap_fill(bitmap, cliprect, 0);
154156      }
r10613r10614
159161
160162      top_monitor.max_y = ( top_monitor.max_y - top_monitor.min_y ) / 2;
161163
162      if(pc10_dispmask_old != pc10_dispmask)
164      if(state->pc10_dispmask_old != state->pc10_dispmask)
163165      {
164         pc10_dispmask_old = pc10_dispmask;
166         state->pc10_dispmask_old = state->pc10_dispmask;
165167
166         if(pc10_dispmask)
167            pc10_game_mode ^= 1;
168         if(state->pc10_dispmask)
169            state->pc10_game_mode ^= 1;
168170      }
169171
170      if ( pc10_game_mode )
172      if ( state->pc10_game_mode )
171173         /* render the ppu */
172174         ppu2c0x_render( ppu, bitmap, 0, 0, 0, 0 );
173175      else
174176      {
175177         /* When the bios is accessing vram, the video circuitry can't access it */
176         if ( !pc10_sdcs )
177            tilemap_draw(bitmap, &top_monitor, bg_tilemap, 0, 0);
178         if ( !state->pc10_sdcs )
179            tilemap_draw(bitmap, &top_monitor, state->bg_tilemap, 0, 0);
178180      }
179181   }
180182   return 0;
src/mame/video/segas32.c
r10613r10614
23532353
23542354static void print_mixer_data(segas32_state *state, int which)
23552355{
2356   static int count = 0;
2357   if (++count > 60 * 5)
2356   if (++state->print_count > 60 * 5)
23582357   {
23592358      mame_printf_debug("\n");
23602359      mame_printf_debug("OP: %04X\n", state->system32_videoram[0x1ff8e/2]);
r10613r10614
24182417         state->mixer_control[which][0x2d],
24192418         state->mixer_control[which][0x2e],
24202419         state->mixer_control[which][0x2f]);
2421      count = 0;
2420      state->print_count = 0;
24222421   }
24232422}
24242423
src/mame/video/gomoku.c
r10613r10614
1212#include "includes/gomoku.h"
1313
1414
15static int gomoku_flipscreen;
16static int gomoku_bg_dispsw;
17static tilemap_t *fg_tilemap;
18static bitmap_t *gomoku_bg_bitmap;
19
20UINT8 *gomoku_videoram;
21UINT8 *gomoku_colorram;
22UINT8 *gomoku_bgram;
23
24
2515/******************************************************************************
2616
2717    palette RAM
r10613r10614
6555
6656static TILE_GET_INFO( get_fg_tile_info )
6757{
68   int code = (gomoku_videoram[tile_index]);
69   int attr = (gomoku_colorram[tile_index]);
58   gomoku_state *state = machine->driver_data<gomoku_state>();
59   int code = (state->videoram[tile_index]);
60   int attr = (state->colorram[tile_index]);
7061   int color = (attr& 0x0f);
7162   int flipyx = (attr & 0xc0) >> 6;
7263
r10613r10614
7970
8071WRITE8_HANDLER( gomoku_videoram_w )
8172{
82   gomoku_videoram[offset] = data;
83   tilemap_mark_tile_dirty(fg_tilemap,offset);
73   gomoku_state *state = space->machine->driver_data<gomoku_state>();
74   state->videoram[offset] = data;
75   tilemap_mark_tile_dirty(state->fg_tilemap,offset);
8476}
8577
8678WRITE8_HANDLER( gomoku_colorram_w )
8779{
88   gomoku_colorram[offset] = data;
89   tilemap_mark_tile_dirty(fg_tilemap,offset);
80   gomoku_state *state = space->machine->driver_data<gomoku_state>();
81   state->colorram[offset] = data;
82   tilemap_mark_tile_dirty(state->fg_tilemap,offset);
9083}
9184
9285WRITE8_HANDLER( gomoku_bgram_w )
9386{
94   gomoku_bgram[offset] = data;
87   gomoku_state *state = space->machine->driver_data<gomoku_state>();
88   state->bgram[offset] = data;
9589}
9690
9791WRITE8_HANDLER( gomoku_flipscreen_w )
9892{
99   gomoku_flipscreen = (data & 0x02) ? 0 : 1;
93   gomoku_state *state = space->machine->driver_data<gomoku_state>();
94   state->flipscreen = (data & 0x02) ? 0 : 1;
10095}
10196
10297WRITE8_HANDLER( gomoku_bg_dispsw_w )
10398{
104   gomoku_bg_dispsw = (data & 0x02) ? 0 : 1;
99   gomoku_state *state = space->machine->driver_data<gomoku_state>();
100   state->bg_dispsw = (data & 0x02) ? 0 : 1;
105101}
106102
107103
r10613r10614
113109
114110VIDEO_START( gomoku )
115111{
112   gomoku_state *state = machine->driver_data<gomoku_state>();
116113   UINT8 *GOMOKU_BG_X = machine->region( "user1" )->base();
117114   UINT8 *GOMOKU_BG_Y = machine->region( "user2" )->base();
118115   UINT8 *GOMOKU_BG_D = machine->region( "user3" )->base();
r10613r10614
120117   int bgdata;
121118   int color;
122119
123   gomoku_bg_bitmap = machine->primary_screen->alloc_compatible_bitmap();
120   state->bg_bitmap = machine->primary_screen->alloc_compatible_bitmap();
124121
125   fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,32, 32);
122   state->fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,32, 32);
126123
127   tilemap_set_transparent_pen(fg_tilemap,0);
124   tilemap_set_transparent_pen(state->fg_tilemap,0);
128125
129126   /* make background bitmap */
130   bitmap_fill(gomoku_bg_bitmap, 0, 0x20);
127   bitmap_fill(state->bg_bitmap, 0, 0x20);
131128
132129   // board
133130   for (y = 0; y < 256; y++)
r10613r10614
141138         if (bgdata & 0x01) color = 0x21;   // board (brown)
142139         if (bgdata & 0x02) color = 0x20;   // frame line (while)
143140
144         *BITMAP_ADDR16(gomoku_bg_bitmap, (255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color;
141         *BITMAP_ADDR16(state->bg_bitmap, (255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color;
145142      }
146143   }
147144}
r10613r10614
155152
156153SCREEN_UPDATE( gomoku )
157154{
155   gomoku_state *state = screen->machine->driver_data<gomoku_state>();
158156   UINT8 *GOMOKU_BG_X = screen->machine->region( "user1" )->base();
159157   UINT8 *GOMOKU_BG_Y = screen->machine->region( "user2" )->base();
160158   UINT8 *GOMOKU_BG_D = screen->machine->region( "user3" )->base();
r10613r10614
165163   int color;
166164
167165   /* draw background layer */
168   if (gomoku_bg_dispsw)
166   if (state->bg_dispsw)
169167   {
170168      /* copy bg bitmap */
171      copybitmap(bitmap, gomoku_bg_bitmap, 0, 0, 0, 0, cliprect);
169      copybitmap(bitmap, state->bg_bitmap, 0, 0, 0, 0, cliprect);
172170
173171      // stone
174172      for (y = 0; y < 256; y++)
r10613r10614
178176            bgoffs = ((((255 - x - 2) / 14) | (((255 - y - 10) / 14) << 4)) & 0xff);
179177
180178            bgdata = GOMOKU_BG_D[ GOMOKU_BG_X[x] + (GOMOKU_BG_Y[y] << 4) ];
181            bgram = gomoku_bgram[bgoffs];
179            bgram = state->bgram[bgoffs];
182180
183181            if (bgdata & 0x04)
184182            {
r10613r10614
206204            bgoffs = ((((255 - x - 2) / 14) | (((255 - y - 10) / 14) << 4)) & 0xff);
207205
208206            bgdata = GOMOKU_BG_D[ GOMOKU_BG_X[x] + (GOMOKU_BG_Y[y] << 4) ];
209            bgram = gomoku_bgram[bgoffs];
207            bgram = state->bgram[bgoffs];
210208
211209            if (bgdata & 0x08)
212210            {
r10613r10614
231229      bitmap_fill(bitmap, 0, 0x20);
232230   }
233231
234   tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
232   tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
235233   return 0;
236234}
src/mame/video/tubep.c
r10613r10614
1111#include "video/resnet.h"
1212
1313
14UINT8 *tubep_textram;
15UINT8 *rjammer_backgroundram;
16UINT8 *tubep_backgroundram;
17UINT8 *tubep_sprite_colorsharedram;
18
19static UINT8 *spritemap;
20static UINT8 prom2[32];
21
22/* Globals */
23/*static UINT8 graph_ctrl[10];*/
24static UINT32   romD_addr =0;
25static UINT32   romEF_addr =0;
26static UINT32   E16_add_b = 0;
27static UINT32   HINV = 0;
28static UINT32   VINV = 0;
29static UINT32   XSize = 0;
30static UINT32   YSize = 0;
31static UINT32   mark_1 = 0;
32static UINT32   mark_2 = 0;
33static UINT32   colorram_addr_hi = 0;
34static UINT32   ls273_g6 = 0;
35static UINT32   ls273_j6 = 0;
36static UINT32   romHI_addr_mid = 0;
37static UINT32   romHI_addr_msb = 0;
38static UINT8   DISP = 0;
39static UINT8   background_romsel = 0;
40static UINT8   color_A4 = 0;
41static UINT8   ls175_b7;
42static UINT8   ls175_e8;
43static UINT8   ls377_data = 0;
44static UINT32   page = 0;
45
46
47
4814/***************************************************************************
4915
5016  Convert the color PROMs into a more useable format.
r10613r10614
167133
168134PALETTE_INIT( tubep )
169135{
136   tubep_state *state = machine->driver_data<tubep_state>();
170137   int i,r,g,b;
171138
172139   /* background/sprites palette variables */
r10613r10614
230197   /* sprites use the second PROM to control 8 x LS368. We copy content of this PROM over here */
231198   for (i = 0; i < 32; i++)
232199   {
233      prom2[i] = *color_prom;
200      state->prom2[i] = *color_prom;
234201      color_prom++;
235202   }
236203
r10613r10614
371338
372339VIDEO_START( tubep )
373340{
374   spritemap = auto_alloc_array(machine, UINT8, 256*256*2);
341   tubep_state *state = machine->driver_data<tubep_state>();
342   state->spritemap = auto_alloc_array(machine, UINT8, 256*256*2);
375343
376344   /* Set up save state */
377   state_save_register_global(machine, romD_addr);
378   state_save_register_global(machine, romEF_addr);
379   state_save_register_global(machine, E16_add_b);
380   state_save_register_global(machine, HINV);
381   state_save_register_global(machine, VINV);
382   state_save_register_global(machine, XSize);
383   state_save_register_global(machine, YSize);
384   state_save_register_global(machine, mark_1);
385   state_save_register_global(machine, mark_2);
386   state_save_register_global(machine, colorram_addr_hi);
387   state_save_register_global(machine, ls273_g6);
388   state_save_register_global(machine, ls273_j6);
389   state_save_register_global(machine, romHI_addr_mid);
390   state_save_register_global(machine, romHI_addr_msb);
391   state_save_register_global(machine, DISP);
392   state_save_register_global(machine, background_romsel);
393   state_save_register_global(machine, color_A4);
394   state_save_register_global(machine, ls175_b7);
395   state_save_register_global(machine, ls175_e8);
396   state_save_register_global(machine, ls377_data);
397   state_save_register_global(machine, page);
345   state_save_register_global(machine, state->romD_addr);
346   state_save_register_global(machine, state->romEF_addr);
347   state_save_register_global(machine, state->E16_add_b);
348   state_save_register_global(machine, state->HINV);
349   state_save_register_global(machine, state->VINV);
350   state_save_register_global(machine, state->XSize);
351   state_save_register_global(machine, state->YSize);
352   state_save_register_global(machine, state->mark_1);
353   state_save_register_global(machine, state->mark_2);
354   state_save_register_global(machine, state->colorram_addr_hi);
355   state_save_register_global(machine, state->ls273_g6);
356   state_save_register_global(machine, state->ls273_j6);
357   state_save_register_global(machine, state->romHI_addr_mid);
358   state_save_register_global(machine, state->romHI_addr_msb);
359   state_save_register_global(machine, state->DISP);
360   state_save_register_global(machine, state->background_romsel);
361   state_save_register_global(machine, state->color_A4);
362   state_save_register_global(machine, state->ls175_b7);
363   state_save_register_global(machine, state->ls175_e8);
364   state_save_register_global(machine, state->ls377_data);
365   state_save_register_global(machine, state->page);
398366}
399367
400368
401369VIDEO_RESET( tubep )
402370{
403   memset(spritemap,0,256*256*2);
371   tubep_state *state = machine->driver_data<tubep_state>();
372   memset(state->spritemap,0,256*256*2);
404373
405   romD_addr = 0;
406   romEF_addr = 0;
407   E16_add_b = 0;
408   HINV = 0;
409   VINV = 0;
410   XSize = 0;
411   YSize = 0;
412   mark_1 = 0;
413   mark_2 = 0;
414   colorram_addr_hi = 0;
415   ls273_g6 = 0;
416   ls273_j6 = 0;
417   romHI_addr_mid = 0;
418   romHI_addr_msb = 0;
419   DISP = 0;
420   background_romsel = 0;
421   color_A4 = 0;
422   ls175_b7 = 0x0f | 0xf0;
423   ls175_e8 = 0x0f;
424   ls377_data = 0;
425   page = 0;
374   state->romD_addr = 0;
375   state->romEF_addr = 0;
376   state->E16_add_b = 0;
377   state->HINV = 0;
378   state->VINV = 0;
379   state->XSize = 0;
380   state->YSize = 0;
381   state->mark_1 = 0;
382   state->mark_2 = 0;
383   state->colorram_addr_hi = 0;
384   state->ls273_g6 = 0;
385   state->ls273_j6 = 0;
386   state->romHI_addr_mid = 0;
387   state->romHI_addr_msb = 0;
388   state->DISP = 0;
389   state->background_romsel = 0;
390   state->color_A4 = 0;
391   state->ls175_b7 = 0x0f | 0xf0;
392   state->ls175_e8 = 0x0f;
393   state->ls377_data = 0;
394   state->page = 0;
426395}
427396
428397
429398WRITE8_HANDLER( tubep_textram_w )
430399{
431   tubep_textram[offset] = data;
400   tubep_state *state = space->machine->driver_data<tubep_state>();
401   state->textram[offset] = data;
432402}
433403
434404
435405WRITE8_HANDLER( tubep_background_romselect_w )
436406{
437   background_romsel = data & 1;
407   tubep_state *state = space->machine->driver_data<tubep_state>();
408   state->background_romsel = data & 1;
438409}
439410
440411
441412WRITE8_HANDLER( tubep_colorproms_A4_line_w )
442413{
443   color_A4 = (data & 1)<<4;
414   tubep_state *state = space->machine->driver_data<tubep_state>();
415   state->color_A4 = (data & 1)<<4;
444416}
445417
446418
447419WRITE8_HANDLER( tubep_background_a000_w )
448420{
449   ls175_b7 = ((data & 0x0f) ^ 0x0f) | 0xf0;
421   tubep_state *state = space->machine->driver_data<tubep_state>();
422   state->ls175_b7 = ((data & 0x0f) ^ 0x0f) | 0xf0;
450423}
451424
452425
453426WRITE8_HANDLER( tubep_background_c000_w )
454427{
455   ls175_e8 = ((data & 0x0f) ^ 0x0f);
428   tubep_state *state = space->machine->driver_data<tubep_state>();
429   state->ls175_e8 = ((data & 0x0f) ^ 0x0f);
456430}
457431
458432
r10613r10614
464438
465439static void draw_sprite(running_machine *machine)
466440{
441   tubep_state *state = machine->driver_data<tubep_state>();
467442   UINT32   XDOT;
468443   UINT32   YDOT;
469444   UINT8 * romCxx  = machine->region("user2")->base()+0x00000;
r10613r10614
472447   UINT8 * romHI2  = romCxx+0x14000;
473448
474449
475   for (YDOT=0; (YDOT^YSize) != 0x00; YDOT++)
450   for (YDOT=0; (YDOT^state->YSize) != 0x00; YDOT++)
476451   {
477452   /* upper part of the schematic */
478      UINT32 ls273_e12 = romD10[ romD_addr | YDOT ] & 0x7f;
479      UINT32 romEF_addr_now = romEF_addr | ls273_e12;
453      UINT32 ls273_e12 = romD10[ state->romD_addr | YDOT ] & 0x7f;
454      UINT32 romEF_addr_now = state->romEF_addr | ls273_e12;
480455      UINT32 E16_add_a = romEF13[ romEF_addr_now ] |
481456                   ((romEF13[0x1000 + romEF_addr_now ]&0x0f)<<8);
482      UINT32 F16_add_b = E16_add_a + E16_add_b;
457      UINT32 F16_add_b = E16_add_a + state->E16_add_b;
483458
484459   /* lower part of the schematic */
485      UINT32 romHI_addr = (YDOT) | (romHI_addr_mid) | (((romHI_addr_msb + 0x800) )&0x1800);
460      UINT32 romHI_addr = (YDOT) | (state->romHI_addr_mid) | (((state->romHI_addr_msb + 0x800) )&0x1800);
486461      UINT32 ls273_g4 = romHI2[ romHI_addr ];
487462      UINT32 ls273_j4 = romHI2[0x2000+ romHI_addr ];
488      UINT32 ls86_gh5 = ls273_g4 ^ VINV;
489      UINT32 ls86_ij5 = ls273_j4 ^ VINV;
463      UINT32 ls86_gh5 = ls273_g4 ^ state->VINV;
464      UINT32 ls86_ij5 = ls273_j4 ^ state->VINV;
490465
491      UINT32 ls157_gh7= ls273_g6 | (mark_2);
492      UINT32 ls157_ij7= ls273_j6 | (mark_1);
493      UINT32 ls283_gh8= (VINV & 1) + ls86_gh5 + ((ls86_gh5 & 0x80)<<1) + ls157_gh7;
494      UINT32 ls283_ij8= (VINV & 1) + ls86_ij5 + ((ls86_ij5 & 0x80)<<1) + ls157_ij7;
466      UINT32 ls157_gh7= state->ls273_g6 | (state->mark_2);
467      UINT32 ls157_ij7= state->ls273_j6 | (state->mark_1);
468      UINT32 ls283_gh8= (state->VINV & 1) + ls86_gh5 + ((ls86_gh5 & 0x80)<<1) + ls157_gh7;
469      UINT32 ls283_ij8= (state->VINV & 1) + ls86_ij5 + ((ls86_ij5 & 0x80)<<1) + ls157_ij7;
495470
496471      UINT32 ls273_g9 = ls283_gh8;
497472      UINT32 ls273_j9 = ls283_ij8;
498473
499      for (XDOT=0; (XDOT^XSize) != 0x00; XDOT++)
474      for (XDOT=0; (XDOT^state->XSize) != 0x00; XDOT++)
500475      {
501476   /* upper part of the schematic */
502         UINT32 romD10_out = romD10[ romD_addr | XDOT ];
477         UINT32 romD10_out = romD10[ state->romD_addr | XDOT ];
503478         UINT32 F16_add_a = (romD10_out & 0x7e) >>1;
504479         UINT32 romCxx_addr = (F16_add_a + F16_add_b ) & 0xffff;
505480         UINT32 romCxx_out = romCxx[ romCxx_addr ];
506481
507482         UINT32 colorram_addr_lo = (romD10_out&1) ? (romCxx_out>>4)&0x0f: (romCxx_out>>0)&0x0f;
508483
509         UINT8 sp_data = tubep_sprite_colorsharedram[ colorram_addr_hi | colorram_addr_lo ] & 0x0f; /* 2114 4-bit RAM */
484         UINT8 sp_data = state->sprite_colorsharedram[ state->colorram_addr_hi | colorram_addr_lo ] & 0x0f; /* 2114 4-bit RAM */
510485
511486   /* lower part of the schematic */
512         romHI_addr = (XDOT) | (romHI_addr_mid) | (romHI_addr_msb);
487         romHI_addr = (XDOT) | (state->romHI_addr_mid) | (state->romHI_addr_msb);
513488         ls273_g4 = romHI2[ romHI_addr ];
514489         ls273_j4 = romHI2[0x2000+ romHI_addr ];
515         ls86_gh5 = ls273_g4 ^ HINV;
516         ls86_ij5 = ls273_j4 ^ HINV;
490         ls86_gh5 = ls273_g4 ^ state->HINV;
491         ls86_ij5 = ls273_j4 ^ state->HINV;
517492
518493         ls157_gh7= ls273_g9;
519494         ls157_ij7= ls273_j9;
520         ls283_gh8= (HINV & 1) + ls86_gh5 + ((ls86_gh5 & 0x80)<<1) + ls157_gh7;
521         ls283_ij8= (HINV & 1) + ls86_ij5 + ((ls86_ij5 & 0x80)<<1) + ls157_ij7;
495         ls283_gh8= (state->HINV & 1) + ls86_gh5 + ((ls86_gh5 & 0x80)<<1) + ls157_gh7;
496         ls283_ij8= (state->HINV & 1) + ls86_ij5 + ((ls86_ij5 & 0x80)<<1) + ls157_ij7;
522497
523498
524499         if ( !((ls283_gh8&256) | (ls283_ij8&256)) ) /* skip wrapped sprite area - PAL12L6 (PLA019 in Roller Jammer schematics)*/
525500         {
526            if ( spritemap[ (ls283_gh8&255) + (ls283_ij8&255)*256 + DISP*256*256 ] == 0x0f )
527               spritemap[ (ls283_gh8&255) + (ls283_ij8&255)*256 + DISP*256*256 ] = sp_data;
501            if ( state->spritemap[ (ls283_gh8&255) + (ls283_ij8&255)*256 + state->DISP*256*256 ] == 0x0f )
502               state->spritemap[ (ls283_gh8&255) + (ls283_ij8&255)*256 + state->DISP*256*256 ] = sp_data;
528503         }
529504      }
530505   }
r10613r10614
533508
534509WRITE8_HANDLER( tubep_sprite_control_w )
535510{
511   tubep_state *state = space->machine->driver_data<tubep_state>();
536512   if (offset < 10)
537513   {
538514      /*graph_ctrl[offset] = data;*/
539515      switch(offset)
540516      {
541517      case 0:   /*a*/
542         romEF_addr = (0x010 | (data & 0x0f))<<7; /*roms @F13, @E13 have A11 lines connected to +5V directly */
543         HINV = (data & 0x10) ? 0xff: 0x00;
544         VINV = (data & 0x20) ? 0xff: 0x00;
518         state->romEF_addr = (0x010 | (data & 0x0f))<<7; /*roms @F13, @E13 have A11 lines connected to +5V directly */
519         state->HINV = (data & 0x10) ? 0xff: 0x00;
520         state->VINV = (data & 0x20) ? 0xff: 0x00;
545521         break;
546522
547523      case 1:   /*b: XSize-1 */
548         XSize = data & 0x7f;
549         mark_2 = (data&0x80)<<1;
524         state->XSize = data & 0x7f;
525         state->mark_2 = (data&0x80)<<1;
550526         break;
551527
552528      case 2:   /*c: YSize-1 */
553         YSize = data & 0x7f;
554         mark_1 = (data&0x80)<<1;
529         state->YSize = data & 0x7f;
530         state->mark_1 = (data&0x80)<<1;
555531         break;
556532
557533      case 3:   /*d*/
558         ls273_g6 = (data & 0xff);
534         state->ls273_g6 = (data & 0xff);
559535         break;
560536
561537      case 4:   /*e*/
562         ls273_j6 = (data & 0xff);
538         state->ls273_j6 = (data & 0xff);
563539         break;
564540
565541      case 5:   /*f*/
566         romHI_addr_mid = (data & 0x0f)<<7;
567         romHI_addr_msb = (data & 0x30)<<7;
542         state->romHI_addr_mid = (data & 0x0f)<<7;
543         state->romHI_addr_msb = (data & 0x30)<<7;
568544         break;
569545
570546      case 6:   /*g*/
571         romD_addr = (data & 0x3f)<<7;
547         state->romD_addr = (data & 0x3f)<<7;
572548         break;
573549
574550      case 7:   /*h: adder input LSB*/
575         E16_add_b = ((data & 0xff) << 0) | (E16_add_b & 0xff00);
551         state->E16_add_b = ((data & 0xff) << 0) | (state->E16_add_b & 0xff00);
576552         break;
577553
578554      case 8:   /*J: adder input MSB*/
579         E16_add_b = ((data & 0xff) << 8) | (E16_add_b & 0x00ff);
555         state->E16_add_b = ((data & 0xff) << 8) | (state->E16_add_b & 0x00ff);
580556         break;
581557
582558      case 9:   /*K*/
583559         /*write to: LS174 @J3 to set color bank (hi address lines to 2114 colorram @J1 ) */
584         colorram_addr_hi = (data & 0x3f) << 4;
560         state->colorram_addr_hi = (data & 0x3f) << 4;
585561
586562         /*write to: LS74 @D13 to clear the interrupt line /SINT
587            /SINT line will be reasserted in XSize * YSize cycles (RH0 signal cycles)
563            /SINT line will be reasserted in state->XSize * state->YSize cycles (RH0 signal cycles)
588564            */
589565         /* 1.clear the /SINT interrupt line */
590566         cputag_set_input_line(space->machine, "mcu", 0, CLEAR_LINE);
591567
592568         /* 2.assert /SINT again after this time */
593         space->machine->scheduler().timer_set( attotime::from_hz(19968000/8) * ((XSize+1)*(YSize+1)), FUNC(sprite_timer_callback));
569         space->machine->scheduler().timer_set( attotime::from_hz(19968000/8) * ((state->XSize+1)*(state->YSize+1)), FUNC(sprite_timer_callback));
594570
595571         /* 3.clear of /SINT starts sprite drawing circuit */
596572         draw_sprite(space->machine);
r10613r10614
599575   }
600576}
601577
602void tubep_vblank_end(void)
578void tubep_vblank_end(running_machine *machine)
603579{
604   DISP = DISP ^ 1;
605   /* logerror("EOF: DISP after this is=%i, and clearing it now.\n", DISP); */
580   tubep_state *state = machine->driver_data<tubep_state>();
581   state->DISP = state->DISP ^ 1;
582   /* logerror("EOF: DISP after this is=%i, and clearing it now.\n", state->DISP); */
606583   /* clear the new frame (the one that was (just) displayed)*/
607   memset(spritemap+DISP*256*256, 0x0f, 256*256);
584   memset(state->spritemap+state->DISP*256*256, 0x0f, 256*256);
608585}
609586
610587
611588SCREEN_UPDATE( tubep )
612589{
613   int DISP_ = DISP^1;
590   tubep_state *state = screen->machine->driver_data<tubep_state>();
591   int DISP_ = state->DISP^1;
614592
615593   pen_t pen_base = 32; //change it later
616594
617595   UINT32 v;
618596   UINT8 *text_gfx_base = screen->machine->region("gfx1")->base();
619   UINT8 *romBxx = screen->machine->region("user1")->base() + 0x2000*background_romsel;
597   UINT8 *romBxx = screen->machine->region("user1")->base() + 0x2000*state->background_romsel;
620598
621   /* logerror(" update: from DISP=%i y_min=%3i y_max=%3i\n", DISP_, cliprect->min_y, cliprect->max_y+1); */
599   /* logerror(" update: from state->DISP=%i y_min=%3i y_max=%3i\n", DISP_, cliprect->min_y, cliprect->max_y+1); */
622600
623601   for (v = cliprect->min_y; v <= cliprect->max_y; v++)   /* only for current scanline */
624602   {
r10613r10614
632610
633611         sp_data2 = sp_data1;
634612         sp_data1 = sp_data0;
635         sp_data0 = spritemap[ h + v*256 +(DISP_*256*256) ];
613         sp_data0 = state->spritemap[ h + v*256 +(DISP_*256*256) ];
636614
637615         text_offs = ((v >> 3) << 6) | ((h >> 3) << 1);
638         text_code = tubep_textram[text_offs];
616         text_code = state->textram[text_offs];
639617         text_gfx_data = text_gfx_base[(text_code << 3) | (v & 0x07)];
640618
641619         if (text_gfx_data & (0x80 >> (h & 0x07)))
642            *BITMAP_ADDR16(bitmap, v, h) = (tubep_textram[text_offs + 1] & 0x0f) | color_A4;
620            *BITMAP_ADDR16(bitmap, v, h) = (state->textram[text_offs + 1] & 0x0f) | state->color_A4;
643621         else
644622         {
645623            UINT32 bg_data;
r10613r10614
653631            UINT8 romB_data_h = romBxx[ 0x4000 + 0x4000*rom_select + romB_addr ];
654632            /* romB_data_h = output of LS374 @B3 or @B4 */
655633
656            UINT32 VR_addr = ((romB_data_h + ls175_b7) & 0xfe) << 2;
634            UINT32 VR_addr = ((romB_data_h + state->ls175_b7) & 0xfe) << 2;
657635            /* VR_addr = output of LS157s @B1 and @B6 */
658636
659            UINT8 xor_logic = (((h^v)&0x80)>>7) ^ (background_romsel & (((v&0x80)>>7)^1));
637            UINT8 xor_logic = (((h^v)&0x80)>>7) ^ (state->background_romsel & (((v&0x80)>>7)^1));
660638
661639            /* read from ROMs: B1/2 */
662640            UINT8 romB_data_l = romBxx[ romB_addr ] ^ (xor_logic?0xff:0x00);
r10613r10614
664642
665643            UINT8 ls157_b11 = (romB_data_l >> ((rom_select==0)?4:0))&0x0f;
666644
667            UINT8 ls283_b12 = (ls157_b11 + ls175_e8) & 0x0f;
645            UINT8 ls283_b12 = (ls157_b11 + state->ls175_e8) & 0x0f;
668646
669647            VR_addr |= (ls283_b12>>1);
670648
671            bg_data = tubep_backgroundram[ VR_addr ];
649            bg_data = state->backgroundram[ VR_addr ];
672650
673651            romB_data_h>>=2;
674652
r10613r10614
678656               sp_data = sp_data1;
679657
680658            if (sp_data != 0x0f)
681               bg_data = prom2[sp_data | color_A4];
659               bg_data = state->prom2[sp_data | state->color_A4];
682660
683661            *BITMAP_ADDR16(bitmap, v, h) = pen_base + bg_data*64 + romB_data_h;
684662         }
r10613r10614
753731
754732WRITE8_HANDLER( rjammer_background_LS377_w )
755733{
756   ls377_data = data & 0xff;
734   tubep_state *state = space->machine->driver_data<tubep_state>();
735   state->ls377_data = data & 0xff;
757736}
758737
759738
760739WRITE8_HANDLER( rjammer_background_page_w )
761740{
762   page = (data & 1) * 0x200;
741   tubep_state *state = space->machine->driver_data<tubep_state>();
742   state->page = (data & 1) * 0x200;
763743}
764744
765745
766746SCREEN_UPDATE( rjammer )
767747{
768   int DISP_ = DISP^1;
748   tubep_state *state = screen->machine->driver_data<tubep_state>();
749   int DISP_ = state->DISP^1;
769750
770751   UINT32 v;
771752   UINT8 *text_gfx_base = screen->machine->region("gfx1")->base();
r10613r10614
785766      UINT8 pal14h4_pin18;
786767      UINT8 pal14h4_pin13;
787768
788      UINT32 addr = (v*2) | page;
789      UINT32 ram_data = rjammer_backgroundram[ addr ] + 256*(rjammer_backgroundram[ addr+1 ]&0x2f);
769      UINT32 addr = (v*2) | state->page;
770      UINT32 ram_data = state->rjammer_backgroundram[ addr ] + 256*(state->rjammer_backgroundram[ addr+1 ]&0x2f);
790771
791      addr = (v>>3) | ((ls377_data&0x1f)<<5);
772      addr = (v>>3) | ((state->ls377_data&0x1f)<<5);
792773      pal14h4_pin13 = (rom19C[addr] >> ((v&7)^7) ) &1;
793774      pal14h4_pin19 = (ram_data>>13) & 1;
794775
r10613r10614
800781
801782         sp_data2 = sp_data1;
802783         sp_data1 = sp_data0;
803         sp_data0 = spritemap[ h + v*256 +(DISP_*256*256) ];
784         sp_data0 = state->spritemap[ h + v*256 +(DISP_*256*256) ];
804785
805786         text_offs = ((v >> 3) << 6) | ((h >> 3) << 1);
806         text_code = tubep_textram[text_offs];
787         text_code = state->textram[text_offs];
807788         text_gfx_data = text_gfx_base[(text_code << 3) | (v & 0x07)];
808789
809790         if (text_gfx_data & (0x80 >> (h & 0x07)))
810            *BITMAP_ADDR16(bitmap, v, h) = 0x10 | (tubep_textram[text_offs + 1] & 0x0f);
791            *BITMAP_ADDR16(bitmap, v, h) = 0x10 | (state->textram[text_offs + 1] & 0x0f);
811792         else
812793         {
813794            UINT32 sp_data;
r10613r10614
842823               else
843824                  bg_data = (rom11_data>>4) & 0x0f;
844825
845               addr = (h>>3) | (ls377_data<<5);
826               addr = (h>>3) | (state->ls377_data<<5);
846827               pal14h4_pin18 = (rom19C[addr] >> ((h&7)^7) ) &1;
847828
848829               /*
src/mame/video/exidy.c
r10613r10614
99#include "includes/exidy.h"
1010
1111
12UINT8 *exidy_videoram;
13UINT8 *exidy_characterram;
14UINT8 *exidy_color_latch;
15UINT8 *exidy_sprite1_xpos;
16UINT8 *exidy_sprite1_ypos;
17UINT8 *exidy_sprite2_xpos;
18UINT8 *exidy_sprite2_ypos;
19UINT8 *exidy_spriteno;
20UINT8 *exidy_sprite_enable;
2112
22static UINT8 collision_mask;
23static UINT8 collision_invert;
24static int is_2bpp;
25static UINT8 int_condition;
26
27static bitmap_t *background_bitmap;
28static bitmap_t *motion_object_1_vid;
29static bitmap_t *motion_object_2_vid;
30static bitmap_t *motion_object_2_clip;
31
32
33
3413/*************************************
3514 *
3615 *  Video configuration
3716 *
3817 *************************************/
3918
40void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp)
19void exidy_video_config(running_machine *machine, UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp)
4120{
42   collision_mask   = _collision_mask;
43   collision_invert = _collision_invert;
44   is_2bpp          = _is_2bpp;
21   exidy_state *state = machine->driver_data<exidy_state>();
22   state->collision_mask   = _collision_mask;
23   state->collision_invert = _collision_invert;
24   state->is_2bpp          = _is_2bpp;
4525}
4626
4727
r10613r10614
5434
5535VIDEO_START( exidy )
5636{
37   exidy_state *state = machine->driver_data<exidy_state>();
5738   bitmap_format format = machine->primary_screen->format();
5839
59   background_bitmap = machine->primary_screen->alloc_compatible_bitmap();
60   motion_object_1_vid = auto_bitmap_alloc(machine, 16, 16, format);
61   motion_object_2_vid = auto_bitmap_alloc(machine, 16, 16, format);
62   motion_object_2_clip = auto_bitmap_alloc(machine, 16, 16, format);
40   state->background_bitmap = machine->primary_screen->alloc_compatible_bitmap();
41   state->motion_object_1_vid = auto_bitmap_alloc(machine, 16, 16, format);
42   state->motion_object_2_vid = auto_bitmap_alloc(machine, 16, 16, format);
43   state->motion_object_2_clip = auto_bitmap_alloc(machine, 16, 16, format);
6344
64    state_save_register_global(machine, collision_mask);
65    state_save_register_global(machine, collision_invert);
66    state_save_register_global(machine, is_2bpp);
67    state_save_register_global(machine, int_condition);
68    state_save_register_global_bitmap(machine, background_bitmap);
69    state_save_register_global_bitmap(machine, motion_object_1_vid);
70    state_save_register_global_bitmap(machine, motion_object_2_vid);
71    state_save_register_global_bitmap(machine, motion_object_2_clip);
45   state_save_register_global(machine, state->collision_mask);
46   state_save_register_global(machine, state->collision_invert);
47   state_save_register_global(machine, state->is_2bpp);
48   state_save_register_global(machine, state->int_condition);
49   state_save_register_global_bitmap(machine, state->background_bitmap);
50   state_save_register_global_bitmap(machine, state->motion_object_1_vid);
51   state_save_register_global_bitmap(machine, state->motion_object_2_vid);
52   state_save_register_global_bitmap(machine, state->motion_object_2_clip);
7253}
7354
7455
r10613r10614
8162
8263INLINE void latch_condition(running_machine *machine, int collision)
8364{
84   collision ^= collision_invert;
85   int_condition = (input_port_read(machine, "INTSOURCE") & ~0x1c) | (collision & collision_mask);
65   exidy_state *state = machine->driver_data<exidy_state>();
66   collision ^= state->collision_invert;
67   state->int_condition = (input_port_read(machine, "INTSOURCE") & ~0x1c) | (collision & state->collision_mask);
8668}
8769
8870
8971INTERRUPT_GEN( exidy_vblank_interrupt )
9072{
73   exidy_state *state = device->machine->driver_data<exidy_state>();
9174   /* latch the current condition */
9275   latch_condition(device->machine, 0);
93   int_condition &= ~0x80;
76   state->int_condition &= ~0x80;
9477
9578   /* set the IRQ line */
9679   cpu_set_input_line(device, 0, ASSERT_LINE);
r10613r10614
11093
11194READ8_HANDLER( exidy_interrupt_r )
11295{
96   exidy_state *state = space->machine->driver_data<exidy_state>();
11397   /* clear any interrupts */
11498   cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
11599
116100   /* return the latched condition */
117   return int_condition;
101   return state->int_condition;
118102}
119103
120104
r10613r10614
127111
128112INLINE void set_1_color(running_machine *machine, int index, int which)
129113{
114   exidy_state *state = machine->driver_data<exidy_state>();
130115   palette_set_color_rgb(machine, index,
131                    pal1bit(exidy_color_latch[2] >> which),
132                    pal1bit(exidy_color_latch[1] >> which),
133                    pal1bit(exidy_color_latch[0] >> which));
116                    pal1bit(state->color_latch[2] >> which),
117                    pal1bit(state->color_latch[1] >> which),
118                    pal1bit(state->color_latch[0] >> which));
134119}
135120
136121static void set_colors(running_machine *machine)
r10613r10614
158143 *
159144 *************************************/
160145
161static void draw_background(void)
146static void draw_background(running_machine *machine)
162147{
148   exidy_state *state = machine->driver_data<exidy_state>();
163149   offs_t offs;
164150
165151   pen_t off_pen = 0;
r10613r10614
170156      pen_t on_pen_1, on_pen_2;
171157
172158      UINT8 y = offs >> 5 << 3;
173      UINT8 code = exidy_videoram[offs];
159      UINT8 code = state->videoram[offs];
174160
175      if (is_2bpp)
161      if (state->is_2bpp)
176162      {
177163         on_pen_1 = 4 + ((code >> 6) & 0x02);
178164         on_pen_2 = 5 + ((code >> 6) & 0x02);
r10613r10614
188174         int i;
189175         UINT8 x = offs << 3;
190176
191         if (is_2bpp)
177         if (state->is_2bpp)
192178         {
193            UINT8 data1 = exidy_characterram[0x000 | (code << 3) | cy];
194            UINT8 data2 = exidy_characterram[0x800 | (code << 3) | cy];
179            UINT8 data1 = state->characterram[0x000 | (code << 3) | cy];
180            UINT8 data2 = state->characterram[0x800 | (code << 3) | cy];
195181
196182            for (i = 0; i < 8; i++)
197183            {
198184               if (data1 & 0x80)
199                  *BITMAP_ADDR16(background_bitmap, y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1;
185                  *BITMAP_ADDR16(state->background_bitmap, y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1;
200186               else
201                  *BITMAP_ADDR16(background_bitmap, y, x) = off_pen;
187                  *BITMAP_ADDR16(state->background_bitmap, y, x) = off_pen;
202188
203189               x = x + 1;
204190               data1 = data1 << 1;
r10613r10614
208194         /* 1bpp */
209195         else
210196         {
211            UINT8 data = exidy_characterram[(code << 3) | cy];
197            UINT8 data = state->characterram[(code << 3) | cy];
212198
213199            for (i = 0; i < 8; i++)
214200            {
215               *BITMAP_ADDR16(background_bitmap, y, x) = (data & 0x80) ? on_pen_1 : off_pen;
201               *BITMAP_ADDR16(state->background_bitmap, y, x) = (data & 0x80) ? on_pen_1 : off_pen;
216202
217203               x = x + 1;
218204               data = data << 1;
r10613r10614
232218 *
233219 *************************************/
234220
235INLINE int sprite_1_enabled(void)
221INLINE int sprite_1_enabled(exidy_state *state)
236222{
237223   /* if the collision_mask is 0x00, then we are on old hardware that always has */
238224   /* sprite 1 enabled regardless */
239   return (!(*exidy_sprite_enable & 0x80) || (*exidy_sprite_enable & 0x10) || (collision_mask == 0x00));
225   return (!(*state->sprite_enable & 0x80) || (*state->sprite_enable & 0x10) || (state->collision_mask == 0x00));
240226}
241227
242228
243229static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
244230{
231   exidy_state *state = machine->driver_data<exidy_state>();
245232   /* draw sprite 2 first */
246   int sprite_set_2 = ((*exidy_sprite_enable & 0x40) != 0);
233   int sprite_set_2 = ((*state->sprite_enable & 0x40) != 0);
247234
248   int sx = 236 - *exidy_sprite2_xpos - 4;
249   int sy = 244 - *exidy_sprite2_ypos - 4;
235   int sx = 236 - *state->sprite2_xpos - 4;
236   int sy = 244 - *state->sprite2_ypos - 4;
250237
251238   drawgfx_transpen(bitmap, cliprect, machine->gfx[0],
252         ((*exidy_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 1,
239         ((*state->spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 1,
253240         0, 0, sx, sy, 0);
254241
255242   /* draw sprite 1 next */
256   if (sprite_1_enabled())
243   if (sprite_1_enabled(state))
257244   {
258      int sprite_set_1 = ((*exidy_sprite_enable & 0x20) != 0);
245      int sprite_set_1 = ((*state->sprite_enable & 0x20) != 0);
259246
260      sx = 236 - *exidy_sprite1_xpos - 4;
261      sy = 244 - *exidy_sprite1_ypos - 4;
247      sx = 236 - *state->sprite1_xpos - 4;
248      sy = 244 - *state->sprite1_ypos - 4;
262249
263250      if (sy < 0) sy = 0;
264251
265252      drawgfx_transpen(bitmap, cliprect, machine->gfx[0],
266            (*exidy_spriteno & 0x0f) + 16 * sprite_set_1, 0,
253            (*state->spriteno & 0x0f) + 16 * sprite_set_1, 0,
267254            0, 0, sx, sy, 0);
268255   }
269256
r10613r10614
301288
302289static void check_collision(running_machine *machine)
303290{
304   UINT8 sprite_set_1 = ((*exidy_sprite_enable & 0x20) != 0);
305   UINT8 sprite_set_2 = ((*exidy_sprite_enable & 0x40) != 0);
306    static const rectangle clip = { 0, 15, 0, 15 };
307    int org_1_x = 0, org_1_y = 0;
308    int org_2_x = 0, org_2_y = 0;
309    int sx, sy;
291   exidy_state *state = machine->driver_data<exidy_state>();
292   UINT8 sprite_set_1 = ((*state->sprite_enable & 0x20) != 0);
293   UINT8 sprite_set_2 = ((*state->sprite_enable & 0x40) != 0);
294   static const rectangle clip = { 0, 15, 0, 15 };
295   int org_1_x = 0, org_1_y = 0;
296   int org_2_x = 0, org_2_y = 0;
297   int sx, sy;
310298   int count = 0;
311299
312300   /* if there is nothing to detect, bail */
313   if (collision_mask == 0)
301   if (state->collision_mask == 0)
314302      return;
315303
316304   /* draw sprite 1 */
317   bitmap_fill(motion_object_1_vid, &clip, 0xff);
318   if (sprite_1_enabled())
305   bitmap_fill(state->motion_object_1_vid, &clip, 0xff);
306   if (sprite_1_enabled(state))
319307   {
320      org_1_x = 236 - *exidy_sprite1_xpos - 4;
321      org_1_y = 244 - *exidy_sprite1_ypos - 4;
322      drawgfx_transpen(motion_object_1_vid, &clip, machine->gfx[0],
323            (*exidy_spriteno & 0x0f) + 16 * sprite_set_1, 0,
308      org_1_x = 236 - *state->sprite1_xpos - 4;
309      org_1_y = 244 - *state->sprite1_ypos - 4;
310      drawgfx_transpen(state->motion_object_1_vid, &clip, machine->gfx[0],
311            (*state->spriteno & 0x0f) + 16 * sprite_set_1, 0,
324312            0, 0, 0, 0, 0);
325313   }
326314
327315   /* draw sprite 2 */
328   bitmap_fill(motion_object_2_vid, &clip, 0xff);
329   org_2_x = 236 - *exidy_sprite2_xpos - 4;
330   org_2_y = 244 - *exidy_sprite2_ypos - 4;
331   drawgfx_transpen(motion_object_2_vid, &clip, machine->gfx[0],
332         ((*exidy_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
316   bitmap_fill(state->motion_object_2_vid, &clip, 0xff);
317   org_2_x = 236 - *state->sprite2_xpos - 4;
318   org_2_y = 244 - *state->sprite2_ypos - 4;
319   drawgfx_transpen(state->motion_object_2_vid, &clip, machine->gfx[0],
320         ((*state->spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
333321         0, 0, 0, 0, 0);
334322
335323   /* draw sprite 2 clipped to sprite 1's location */
336   bitmap_fill(motion_object_2_clip, &clip, 0xff);
337   if (sprite_1_enabled())
324   bitmap_fill(state->motion_object_2_clip, &clip, 0xff);
325   if (sprite_1_enabled(state))
338326   {
339327      sx = org_2_x - org_1_x;
340328      sy = org_2_y - org_1_y;
341      drawgfx_transpen(motion_object_2_clip, &clip, machine->gfx[0],
342            ((*exidy_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
329      drawgfx_transpen(state->motion_object_2_clip, &clip, machine->gfx[0],
330            ((*state->spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
343331            0, 0, sx, sy, 0);
344332   }
345333
r10613r10614
347335   for (sy = 0; sy < 16; sy++)
348336      for (sx = 0; sx < 16; sx++)
349337      {
350          if (*BITMAP_ADDR16(motion_object_1_vid, sy, sx) != 0xff)
338         if (*BITMAP_ADDR16(state->motion_object_1_vid, sy, sx) != 0xff)
351339         {
352340            UINT8 current_collision_mask = 0;
353341
354342            /* check for background collision (M1CHAR) */
355            if (*BITMAP_ADDR16(background_bitmap, org_1_y + sy, org_1_x + sx) != 0)
343            if (*BITMAP_ADDR16(state->background_bitmap, org_1_y + sy, org_1_x + sx) != 0)
356344               current_collision_mask |= 0x04;
357345
358346            /* check for motion object collision (M1M2) */
359            if (*BITMAP_ADDR16(motion_object_2_clip, sy, sx) != 0xff)
347            if (*BITMAP_ADDR16(state->motion_object_2_clip, sy, sx) != 0xff)
360348               current_collision_mask |= 0x10;
361349
362350            /* if we got one, trigger an interrupt */
363            if ((current_collision_mask & collision_mask) && (count++ < 128))
351            if ((current_collision_mask & state->collision_mask) && (count++ < 128))
364352               machine->scheduler().timer_set(machine->primary_screen->time_until_pos(org_1_x + sx, org_1_y + sy), FUNC(collision_irq_callback), current_collision_mask);
365353         }
366354
367         if (*BITMAP_ADDR16(motion_object_2_vid, sy, sx) != 0xff)
355         if (*BITMAP_ADDR16(state->motion_object_2_vid, sy, sx) != 0xff)
368356         {
369357            /* check for background collision (M2CHAR) */
370            if (*BITMAP_ADDR16(background_bitmap, org_2_y + sy, org_2_x + sx) != 0)
371               if ((collision_mask & 0x08) && (count++ < 128))
358            if (*BITMAP_ADDR16(state->background_bitmap, org_2_y + sy, org_2_x + sx) != 0)
359               if ((state->collision_mask & 0x08) && (count++ < 128))
372360                  machine->scheduler().timer_set(machine->primary_screen->time_until_pos(org_2_x + sx, org_2_y + sy), FUNC(collision_irq_callback), 0x08);
373361         }
374362      }
r10613r10614
384372
385373SCREEN_UPDATE( exidy )
386374{
375   exidy_state *state = screen->machine->driver_data<exidy_state>();
387376   /* refresh the colors from the palette (static or dynamic) */
388377   set_colors(screen->machine);
389378
390379   /* update the background and draw it */
391   draw_background();
392   copybitmap(bitmap, background_bitmap, 0, 0, 0, 0, cliprect);
380   draw_background(screen->machine);
381   copybitmap(bitmap, state->background_bitmap, 0, 0, 0, 0, cliprect);
393382
394383   /* draw the sprites */
395384   draw_sprites(screen->machine, bitmap, NULL);
src/mame/video/hyhoo.c
r10613r10614
1010#include "includes/nb1413m3.h"
1111#include "includes/hyhoo.h"
1212
13UINT8 *hyhoo_clut;
1413
15static int blitter_destx, blitter_desty;
16static int blitter_sizex, blitter_sizey;
17static int blitter_src_addr;
18static int blitter_direction_x, blitter_direction_y;
19static int hyhoo_gfxrom;
20static int hyhoo_dispflag;
21static int hyhoo_highcolorflag;
22static int hyhoo_flipscreen;
23
24static bitmap_t *hyhoo_tmpbitmap;
2514static void hyhoo_gfxdraw(running_machine *machine);
2615
2716
2817WRITE8_HANDLER( hyhoo_blitter_w )
2918{
19   hyhoo_state *state = space->machine->driver_data<hyhoo_state>();
3020   switch (offset)
3121   {
32      case 0x00:   blitter_src_addr = (blitter_src_addr & 0xff00) | data;
22      case 0x00:   state->blitter_src_addr = (state->blitter_src_addr & 0xff00) | data;
3323               nb1413m3_gfxradr_l_w(space, 0, data); break;
34      case 0x01:   blitter_src_addr = (blitter_src_addr & 0x00ff) | (data << 8);
24      case 0x01:   state->blitter_src_addr = (state->blitter_src_addr & 0x00ff) | (data << 8);
3525               nb1413m3_gfxradr_h_w(space, 0, data); break;
36      case 0x02:   blitter_destx = data; break;
37      case 0x03:   blitter_desty = data; break;
38      case 0x04:   blitter_sizex = data; break;
39      case 0x05:   blitter_sizey = data;
26      case 0x02:   state->blitter_destx = data; break;
27      case 0x03:   state->blitter_desty = data; break;
28      case 0x04:   state->blitter_sizex = data; break;
29      case 0x05:   state->blitter_sizey = data;
4030               /* writing here also starts the blit */
4131               hyhoo_gfxdraw(space->machine);
4232               break;
43      case 0x06:   blitter_direction_x = (data >> 0) & 0x01;
44               blitter_direction_y = (data >> 1) & 0x01;
45               hyhoo_flipscreen = (~data >> 2) & 0x01;
46               hyhoo_dispflag = (~data >> 3) & 0x01;
33      case 0x06:   state->blitter_direction_x = (data >> 0) & 0x01;
34               state->blitter_direction_y = (data >> 1) & 0x01;
35               state->flipscreen = (~data >> 2) & 0x01;
36               state->dispflag = (~data >> 3) & 0x01;
4737               break;
4838      case 0x07:   break;
4939   }
r10613r10614
5242
5343WRITE8_HANDLER( hyhoo_romsel_w )
5444{
45   hyhoo_state *state = space->machine->driver_data<hyhoo_state>();
5546   int gfxlen = space->machine->region("gfx1")->bytes();
56   hyhoo_gfxrom = (((data & 0xc0) >> 4) + (data & 0x03));
57   hyhoo_highcolorflag = data;
47   state->gfxrom = (((data & 0xc0) >> 4) + (data & 0x03));
48   state->highcolorflag = data;
5849   nb1413m3_gfxrombank_w(space, 0, data);
5950
60   if ((0x20000 * hyhoo_gfxrom) > (gfxlen - 1))
51   if ((0x20000 * state->gfxrom) > (gfxlen - 1))
6152   {
6253#ifdef MAME_DEBUG
6354      popmessage("GFXROM BANK OVER!!");
6455#endif
65      hyhoo_gfxrom &= (gfxlen / 0x20000 - 1);
56      state->gfxrom &= (gfxlen / 0x20000 - 1);
6657   }
6758}
6859
r10613r10614
7465
7566static void hyhoo_gfxdraw(running_machine *machine)
7667{
68   hyhoo_state *state = machine->driver_data<hyhoo_state>();
7769   UINT8 *GFX = machine->region("gfx1")->base();
7870
7971   int x, y;
r10613r10614
8981
9082   nb1413m3_busyctr = 0;
9183
92   hyhoo_gfxrom |= ((nb1413m3_sndrombank1 & 0x02) << 3);
84   state->gfxrom |= ((nb1413m3_sndrombank1 & 0x02) << 3);
9385
94   startx = blitter_destx + blitter_sizex;
95   starty = blitter_desty + blitter_sizey;
86   startx = state->blitter_destx + state->blitter_sizex;
87   starty = state->blitter_desty + state->blitter_sizey;
9688
97   if (blitter_direction_x)
89   if (state->blitter_direction_x)
9890   {
99      sizex = blitter_sizex ^ 0xff;
91      sizex = state->blitter_sizex ^ 0xff;
10092      skipx = 1;
10193   }
10294   else
10395   {
104      sizex = blitter_sizex;
96      sizex = state->blitter_sizex;
10597      skipx = -1;
10698   }
10799
108   if (blitter_direction_y)
100   if (state->blitter_direction_y)
109101   {
110      sizey = blitter_sizey ^ 0xff;
102      sizey = state->blitter_sizey ^ 0xff;
111103      skipy = 1;
112104   }
113105   else
114106   {
115      sizey = blitter_sizey;
107      sizey = state->blitter_sizey;
116108      skipy = -1;
117109   }
118110
119111   gfxlen = machine->region("gfx1")->bytes();
120   gfxaddr = (hyhoo_gfxrom << 17) + (blitter_src_addr << 1);
112   gfxaddr = (state->gfxrom << 17) + (state->blitter_src_addr << 1);
121113
122114   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
123115   {
r10613r10614
137129         dx2 = (2 * x + 1) & 0x1ff;
138130         dy = y & 0xff;
139131
140         if (hyhoo_highcolorflag & 0x04)
132         if (state->highcolorflag & 0x04)
141133         {
142134            // direct mode
143135
144136            if (color != 0xff)
145137            {
146               if (hyhoo_highcolorflag & 0x20)
138               if (state->highcolorflag & 0x20)
147139               {
148140                  /* least significant bits */
149141
r10613r10614
156148
157149                  pen = MAKE_RGB(pal6bit(r), pal5bit(g), pal5bit(b));
158150
159                  *BITMAP_ADDR32(hyhoo_tmpbitmap, dy, dx1) = *BITMAP_ADDR32(hyhoo_tmpbitmap, dy, dx1) | pen;
160                  *BITMAP_ADDR32(hyhoo_tmpbitmap, dy, dx2) = *BITMAP_ADDR32(hyhoo_tmpbitmap, dy, dx2) | pen;
151                  *BITMAP_ADDR32(state->tmpbitmap, dy, dx1) = *BITMAP_ADDR32(state->tmpbitmap, dy, dx1) | pen;
152                  *BITMAP_ADDR32(state->tmpbitmap, dy, dx2) = *BITMAP_ADDR32(state->tmpbitmap, dy, dx2) | pen;
161153               }
162154               else
163155               {
r10613r10614
172164
173165                  pen = MAKE_RGB(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3));
174166
175                  *BITMAP_ADDR32(hyhoo_tmpbitmap, dy, dx1) = pen;
176                  *BITMAP_ADDR32(hyhoo_tmpbitmap, dy, dx2) = pen;
167                  *BITMAP_ADDR32(state->tmpbitmap, dy, dx1) = pen;
168                  *BITMAP_ADDR32(state->tmpbitmap, dy, dx2) = pen;
177169               }
178170            }
179171         }
r10613r10614
181173         {
182174            // lookup table mode
183175
184            if (blitter_direction_x)
176            if (state->blitter_direction_x)
185177            {
186178               // flip
187179               color1 = (color & 0x0f) >> 0;
r10613r10614
194186               color2 = (color & 0x0f) >> 0;
195187            }
196188
197            if (hyhoo_clut[color1])
189            if (state->clut[color1])
198190            {
199191               // src xxxxxxxx_bbgggrrr
200192               // dst bbxxxggg_xxrrrxxx
201193
202               r = ((~hyhoo_clut[color1] & 0x07) >> 0) & 0x07;
203               g = ((~hyhoo_clut[color1] & 0x38) >> 3) & 0x07;
204               b = ((~hyhoo_clut[color1] & 0xc0) >> 6) & 0x03;
194               r = ((~state->clut[color1] & 0x07) >> 0) & 0x07;
195               g = ((~state->clut[color1] & 0x38) >> 3) & 0x07;
196               b = ((~state->clut[color1] & 0xc0) >> 6) & 0x03;
205197
206198               pen = MAKE_RGB(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3));
207199
208               *BITMAP_ADDR32(hyhoo_tmpbitmap, dy, dx1) = pen;
200               *BITMAP_ADDR32(state->tmpbitmap, dy, dx1) = pen;
209201            }
210202
211            if (hyhoo_clut[color2])
203            if (state->clut[color2])
212204            {
213205               // src xxxxxxxx_bbgggrrr
214206               // dst bbxxxggg_xxrrrxxx
215207
216               r = ((~hyhoo_clut[color2] & 0x07) >> 0) & 0x07;
217               g = ((~hyhoo_clut[color2] & 0x38) >> 3) & 0x07;
218               b = ((~hyhoo_clut[color2] & 0xc0) >> 6) & 0x03;
208               r = ((~state->clut[color2] & 0x07) >> 0) & 0x07;
209               g = ((~state->clut[color2] & 0x38) >> 3) & 0x07;
210               b = ((~state->clut[color2] & 0xc0) >> 6) & 0x03;
219211
220212               pen = MAKE_RGB(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3));
221213
222               *BITMAP_ADDR32(hyhoo_tmpbitmap, dy, dx2) = pen;
214               *BITMAP_ADDR32(state->tmpbitmap, dy, dx2) = pen;
223215            }
224216         }
225217
r10613r10614
234226
235227VIDEO_START( hyhoo )
236228{
237   hyhoo_tmpbitmap = machine->primary_screen->alloc_compatible_bitmap();
229   hyhoo_state *state = machine->driver_data<hyhoo_state>();
230   state->tmpbitmap = machine->primary_screen->alloc_compatible_bitmap();
238231}
239232
240233
241234SCREEN_UPDATE( hyhoo )
242235{
243   if (hyhoo_dispflag)
244      copybitmap(bitmap, hyhoo_tmpbitmap, hyhoo_flipscreen, hyhoo_flipscreen, 0, 0, cliprect);
236   hyhoo_state *state = screen->machine->driver_data<hyhoo_state>();
237   if (state->dispflag)
238      copybitmap(bitmap, state->tmpbitmap, state->flipscreen, state->flipscreen, 0, 0, cliprect);
245239   else
246240      bitmap_fill(bitmap, cliprect, RGB_BLACK);
247241
src/mame/video/pacman.c
r10613r10614
313313   xoffsethack = 0;
314314
315315   bg_tilemap = tilemap_create( machine, pacman_get_tile_info, pacman_scan_rows,  8, 8, 36, 28 );
316
317   tilemap_set_scrolldx( bg_tilemap, 0, 384 - 288 );
318   tilemap_set_scrolldy( bg_tilemap, 0, 264 - 224 );
316319}
317320
318321WRITE8_HANDLER( pengo_palettebank_w )
src/mame/video/clshroad.c
r10613r10614
3333#include "emu.h"
3434#include "includes/clshroad.h"
3535
36/* Variables only used here: */
3736
38static tilemap_t *tilemap_0a, *tilemap_0b, *tilemap_1;
39
40/* Variables & functions needed by drivers: */
41
42UINT8 *clshroad_vram_0, *clshroad_vram_1;
43UINT8 *clshroad_vregs;
44
4537WRITE8_HANDLER( clshroad_flipscreen_w )
4638{
4739   flip_screen_set(space->machine,  data & 1 );
r10613r10614
112104
113105static TILE_GET_INFO( get_tile_info_0a )
114106{
107   clshroad_state *state = machine->driver_data<clshroad_state>();
115108   UINT8 code;
116109   tile_index = (tile_index & 0x1f) + (tile_index & ~0x1f)*2;
117   code   =   clshroad_vram_0[ tile_index * 2 + 0x40 ];
118//  color   =   clshroad_vram_0[ tile_index * 2 + 0x41 ];
110   code   =   state->vram_0[ tile_index * 2 + 0x40 ];
111//  color   =   state->vram_0[ tile_index * 2 + 0x41 ];
119112   SET_TILE_INFO(
120113         1,
121114         code,
r10613r10614
125118
126119static TILE_GET_INFO( get_tile_info_0b )
127120{
121   clshroad_state *state = machine->driver_data<clshroad_state>();
128122   UINT8 code;
129123   tile_index = (tile_index & 0x1f) + (tile_index & ~0x1f)*2;
130   code   =   clshroad_vram_0[ tile_index * 2 + 0x00 ];
131//  color   =   clshroad_vram_0[ tile_index * 2 + 0x01 ];
124   code   =   state->vram_0[ tile_index * 2 + 0x00 ];
125//  color   =   state->vram_0[ tile_index * 2 + 0x01 ];
132126   SET_TILE_INFO(
133127         1,
134128         code,
r10613r10614
138132
139133WRITE8_HANDLER( clshroad_vram_0_w )
140134{
135   clshroad_state *state = space->machine->driver_data<clshroad_state>();
141136   int tile_index = offset / 2;
142137   int tile = (tile_index & 0x1f) + (tile_index & ~0x3f)/2;
143   clshroad_vram_0[offset] = data;
144   if (tile_index & 0x20)   tilemap_mark_tile_dirty(tilemap_0a, tile);
145   else               tilemap_mark_tile_dirty(tilemap_0b, tile);
138   state->vram_0[offset] = data;
139   if (tile_index & 0x20)   tilemap_mark_tile_dirty(state->tilemap_0a, tile);
140   else               tilemap_mark_tile_dirty(state->tilemap_0b, tile);
146141}
147142
148143/***************************************************************************
r10613r10614
182177
183178static TILE_GET_INFO( get_tile_info_fb1 )
184179{
185   UINT8 code   =   clshroad_vram_1[ tile_index + 0x000 ];
186   UINT8 color   =   clshroad_vram_1[ tile_index + 0x400 ] & 0x3f;
180   clshroad_state *state = machine->driver_data<clshroad_state>();
181   UINT8 code   =   state->vram_1[ tile_index + 0x000 ];
182   UINT8 color   =   state->vram_1[ tile_index + 0x400 ] & 0x3f;
187183   tileinfo->group = color;
188184   SET_TILE_INFO(
189185         2,
r10613r10614
194190
195191static TILE_GET_INFO( get_tile_info_1 )
196192{
197   UINT8 code   =   clshroad_vram_1[ tile_index + 0x000 ];
198   UINT8 color   =   clshroad_vram_1[ tile_index + 0x400 ];
193   clshroad_state *state = machine->driver_data<clshroad_state>();
194   UINT8 code   =   state->vram_1[ tile_index + 0x000 ];
195   UINT8 color   =   state->vram_1[ tile_index + 0x400 ];
199196   SET_TILE_INFO(
200197         2,
201198         code + ((color & 0xf0)<<4),
r10613r10614
205202
206203WRITE8_HANDLER( clshroad_vram_1_w )
207204{
208   clshroad_vram_1[offset] = data;
209   tilemap_mark_tile_dirty(tilemap_1, offset % 0x400);
205   clshroad_state *state = space->machine->driver_data<clshroad_state>();
206   state->vram_1[offset] = data;
207   tilemap_mark_tile_dirty(state->tilemap_1, offset % 0x400);
210208}
211209
212210
213211VIDEO_START( firebatl )
214212{
213   clshroad_state *state = machine->driver_data<clshroad_state>();
215214   /* These 2 use the graphics and scroll value */
216   tilemap_0a = tilemap_create(machine, get_tile_info_0a,tilemap_scan_rows,16,16,0x20,0x10);
217   tilemap_0b = tilemap_create(machine, get_tile_info_0b,tilemap_scan_rows,16,16,0x20,0x10);
215   state->tilemap_0a = tilemap_create(machine, get_tile_info_0a,tilemap_scan_rows,16,16,0x20,0x10);
216   state->tilemap_0b = tilemap_create(machine, get_tile_info_0b,tilemap_scan_rows,16,16,0x20,0x10);
218217   /* Text (No scrolling) */
219   tilemap_1  = tilemap_create(machine, get_tile_info_fb1,tilemap_scan_rows_extra,8,8,0x24,0x20);
218   state->tilemap_1  = tilemap_create(machine, get_tile_info_fb1,tilemap_scan_rows_extra,8,8,0x24,0x20);
220219
221   tilemap_set_scroll_rows( tilemap_0a, 1);
222   tilemap_set_scroll_rows( tilemap_0b, 1);
223   tilemap_set_scroll_rows( tilemap_1,  1);
220   tilemap_set_scroll_rows( state->tilemap_0a, 1);
221   tilemap_set_scroll_rows( state->tilemap_0b, 1);
222   tilemap_set_scroll_rows( state->tilemap_1,  1);
224223
225   tilemap_set_scroll_cols( tilemap_0a, 1);
226   tilemap_set_scroll_cols( tilemap_0b, 1);
227   tilemap_set_scroll_cols( tilemap_1,  1);
224   tilemap_set_scroll_cols( state->tilemap_0a, 1);
225   tilemap_set_scroll_cols( state->tilemap_0b, 1);
226   tilemap_set_scroll_cols( state->tilemap_1,  1);
228227
229   tilemap_set_scrolldx( tilemap_0a, -0x30, -0xb5);
230   tilemap_set_scrolldx( tilemap_0b, -0x30, -0xb5);
228   tilemap_set_scrolldx( state->tilemap_0a, -0x30, -0xb5);
229   tilemap_set_scrolldx( state->tilemap_0b, -0x30, -0xb5);
231230
232   tilemap_set_transparent_pen( tilemap_0b, 0 );
233   colortable_configure_tilemap_groups(machine->colortable, tilemap_1, machine->gfx[2], 0x0f);
231   tilemap_set_transparent_pen( state->tilemap_0b, 0 );
232   colortable_configure_tilemap_groups(machine->colortable, state->tilemap_1, machine->gfx[2], 0x0f);
234233}
235234
236235VIDEO_START( clshroad )
237236{
237   clshroad_state *state = machine->driver_data<clshroad_state>();
238238   /* These 2 use the graphics and scroll value */
239   tilemap_0a = tilemap_create(machine, get_tile_info_0a,tilemap_scan_rows,16,16,0x20,0x10);
240   tilemap_0b = tilemap_create(machine, get_tile_info_0b,tilemap_scan_rows,16,16,0x20,0x10);
239   state->tilemap_0a = tilemap_create(machine, get_tile_info_0a,tilemap_scan_rows,16,16,0x20,0x10);
240   state->tilemap_0b = tilemap_create(machine, get_tile_info_0b,tilemap_scan_rows,16,16,0x20,0x10);
241241   /* Text (No scrolling) */
242   tilemap_1  = tilemap_create(machine, get_tile_info_1,tilemap_scan_rows_extra,8,8,0x24,0x20);
242   state->tilemap_1  = tilemap_create(machine, get_tile_info_1,tilemap_scan_rows_extra,8,8,0x24,0x20);
243243
244   tilemap_set_scroll_rows( tilemap_0a, 1);
245   tilemap_set_scroll_rows( tilemap_0b, 1);
246   tilemap_set_scroll_rows( tilemap_1,  1);
244   tilemap_set_scroll_rows( state->tilemap_0a, 1);
245   tilemap_set_scroll_rows( state->tilemap_0b, 1);
246   tilemap_set_scroll_rows( state->tilemap_1,  1);
247247
248   tilemap_set_scroll_cols( tilemap_0a, 1);
249   tilemap_set_scroll_cols( tilemap_0b, 1);
250   tilemap_set_scroll_cols( tilemap_1,  1);
248   tilemap_set_scroll_cols( state->tilemap_0a, 1);
249   tilemap_set_scroll_cols( state->tilemap_0b, 1);
250   tilemap_set_scroll_cols( state->tilemap_1,  1);
251251
252   tilemap_set_scrolldx( tilemap_0a, -0x30, -0xb5);
253   tilemap_set_scrolldx( tilemap_0b, -0x30, -0xb5);
252   tilemap_set_scrolldx( state->tilemap_0a, -0x30, -0xb5);
253   tilemap_set_scrolldx( state->tilemap_0b, -0x30, -0xb5);
254254
255   tilemap_set_transparent_pen( tilemap_0b, 0x0f );
256   tilemap_set_transparent_pen( tilemap_1,  0x0f );
255   tilemap_set_transparent_pen( state->tilemap_0b, 0x0f );
256   tilemap_set_transparent_pen( state->tilemap_1,  0x0f );
257257}
258258
259259
r10613r10614
328328
329329SCREEN_UPDATE( clshroad )
330330{
331   int scrollx  = clshroad_vregs[ 0 ] + (clshroad_vregs[ 1 ] << 8);
332//  int priority = clshroad_vregs[ 2 ];
331   clshroad_state *state = screen->machine->driver_data<clshroad_state>();
332   int scrollx  = state->vregs[ 0 ] + (state->vregs[ 1 ] << 8);
333//  int priority = state->vregs[ 2 ];
333334
334335   /* Only horizontal scrolling (these 2 layers use the same value) */
335   tilemap_set_scrollx(tilemap_0a, 0, scrollx);
336   tilemap_set_scrollx(tilemap_0b, 0, scrollx);
336   tilemap_set_scrollx(state->tilemap_0a, 0, scrollx);
337   tilemap_set_scrollx(state->tilemap_0b, 0, scrollx);
337338
338   tilemap_draw(bitmap,cliprect,tilemap_0a,0,0);   // Opaque
339   tilemap_draw(bitmap,cliprect,tilemap_0b,0,0);
339   tilemap_draw(bitmap,cliprect,state->tilemap_0a,0,0);   // Opaque
340   tilemap_draw(bitmap,cliprect,state->tilemap_0b,0,0);
340341   draw_sprites(screen->machine,bitmap,cliprect);
341   tilemap_draw(bitmap,cliprect,tilemap_1,0,0);
342   tilemap_draw(bitmap,cliprect,state->tilemap_1,0,0);
342343   return 0;
343344}
src/mame/video/williams.c
r10613r10614
9999
100100/*************************************
101101 *
102 *  Global variables
103 *
104 *************************************/
105
106/* RAM globals */
107UINT8 *williams_videoram;
108UINT8 *williams2_tileram;
109UINT8 *blaster_palette_0;
110UINT8 *blaster_scanline_control;
111
112/* blitter globals */
113UINT8 williams_blitter_config;
114UINT16 williams_blitter_clip_address;
115UINT8 williams_blitter_window_enable;
116
117/* tilemap globals */
118UINT8 williams2_tilemap_config;
119
120/* rendering globals */
121UINT8 williams_cocktail;
122
123
124
125/*************************************
126 *
127 *  Static global variables
128 *
129 *************************************/
130
131/* palette variables */
132static rgb_t *palette_lookup;
133
134/* blitter variables */
135static UINT8 blitterram[8];
136static UINT8 blitter_xor;
137static UINT8 blitter_remap_index;
138static const UINT8 *blitter_remap;
139static UINT8 *blitter_remap_lookup;
140
141/* Blaster-specific variables */
142static rgb_t blaster_color0;
143static UINT8 blaster_video_control;
144
145/* tilemap variables */
146static tilemap_t *bg_tilemap;
147static UINT16 tilemap_xscroll;
148static UINT8 williams2_fg_color;
149
150
151
152/*************************************
153 *
154102 *  Prototypes
155103 *
156104 *************************************/
r10613r10614
170118
171119static void state_save_register(running_machine *machine)
172120{
173   state_save_register_global(machine, williams_blitter_window_enable);
174   state_save_register_global(machine, williams_cocktail);
175   state_save_register_global_array(machine, blitterram);
176   state_save_register_global(machine, blitter_remap_index);
177   state_save_register_global(machine, blaster_color0);
178   state_save_register_global(machine, blaster_video_control);
179   state_save_register_global(machine, tilemap_xscroll);
180   state_save_register_global(machine, williams2_fg_color);
121   williams_state *state = machine->driver_data<williams_state>();
122   state_save_register_global(machine, state->blitter_window_enable);
123   state_save_register_global(machine, state->cocktail);
124   state_save_register_global_array(machine, state->blitterram);
125   state_save_register_global(machine, state->blitter_remap_index);
126   state_save_register_global(machine, state->blaster_color0);
127   state_save_register_global(machine, state->blaster_video_control);
128   state_save_register_global(machine, state->tilemap_xscroll);
129   state_save_register_global(machine, state->williams2_fg_color);
181130}
182131
183132
184133VIDEO_START( williams )
185134{
186   blitter_init(machine, williams_blitter_config, NULL);
135   williams_state *state = machine->driver_data<williams_state>();
136   blitter_init(machine, state->blitter_config, NULL);
187137   create_palette_lookup(machine);
188138   state_save_register(machine);
189139}
r10613r10614
191141
192142VIDEO_START( blaster )
193143{
194   blitter_init(machine, williams_blitter_config, machine->region("proms")->base());
144   williams_state *state = machine->driver_data<williams_state>();
145   blitter_init(machine, state->blitter_config, machine->region("proms")->base());
195146   create_palette_lookup(machine);
196147   state_save_register(machine);
197148}
r10613r10614
199150
200151VIDEO_START( williams2 )
201152{
202   blitter_init(machine, williams_blitter_config, NULL);
153   williams_state *state = machine->driver_data<williams_state>();
154   blitter_init(machine, state->blitter_config, NULL);
203155
204156   /* allocate paletteram */
205157   machine->generic.paletteram.u8 = auto_alloc_array(machine, UINT8, 0x400 * 2);
206158   state_save_register_global_pointer(machine, machine->generic.paletteram.u8, 0x400 * 2);
207159
208160   /* create the tilemap */
209   bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_cols,  24,16, 128,16);
210   tilemap_set_scrolldx(bg_tilemap, 2, 0);
161   state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_cols,  24,16, 128,16);
162   tilemap_set_scrolldx(state->bg_tilemap, 2, 0);
211163
212164   state_save_register(machine);
213165}
r10613r10614
222174
223175SCREEN_UPDATE( williams )
224176{
177   williams_state *state = screen->machine->driver_data<williams_state>();
225178   rgb_t pens[16];
226179   int x, y;
227180
228181   /* precompute the palette */
229182   for (x = 0; x < 16; x++)
230      pens[x] = palette_lookup[screen->machine->generic.paletteram.u8[x]];
183      pens[x] = state->palette_lookup[screen->machine->generic.paletteram.u8[x]];
231184
232185   /* loop over rows */
233186   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
234187   {
235      UINT8 *source = &williams_videoram[y];
188      UINT8 *source = &state->videoram[y];
236189      UINT32 *dest = BITMAP_ADDR32(bitmap, y, 0);
237190
238191      /* loop over columns */
r10613r10614
249202
250203SCREEN_UPDATE( blaster )
251204{
205   williams_state *state = screen->machine->driver_data<williams_state>();
252206   rgb_t pens[16];
253207   int x, y;
254208
255209   /* precompute the palette */
256210   for (x = 0; x < 16; x++)
257      pens[x] = palette_lookup[screen->machine->generic.paletteram.u8[x]];
211      pens[x] = state->palette_lookup[screen->machine->generic.paletteram.u8[x]];
258212
259213   /* if we're blitting from the top, start with a 0 for color 0 */
260   if (cliprect->min_y == screen->visible_area().min_y || !(blaster_video_control & 1))
261      blaster_color0 = pens[0];
214   if (cliprect->min_y == screen->visible_area().min_y || !(state->blaster_video_control & 1))
215      state->blaster_color0 = pens[0];
262216
263217   /* loop over rows */
264218   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
265219   {
266      int erase_behind = blaster_video_control & blaster_scanline_control[y] & 2;
267      UINT8 *source = &williams_videoram[y];
220      int erase_behind = state->blaster_video_control & state->blaster_scanline_control[y] & 2;
221      UINT8 *source = &state->videoram[y];
268222      UINT32 *dest = BITMAP_ADDR32(bitmap, y, 0);
269223
270224      /* latch a new color0 pen? */
271      if (blaster_video_control & blaster_scanline_control[y] & 1)
272         blaster_color0 = palette_lookup[blaster_palette_0[y] ^ 0xff];
225      if (state->blaster_video_control & state->blaster_scanline_control[y] & 1)
226         state->blaster_color0 = state->palette_lookup[state->blaster_palette_0[y] ^ 0xff];
273227
274228      /* loop over columns */
275229      for (x = cliprect->min_x & ~1; x <= cliprect->max_x; x += 2)
r10613r10614
281235            source[(x/2) * 256] = 0;
282236
283237         /* now draw */
284         dest[x+0] = (pix & 0xf0) ? pens[pix >> 4] : blaster_color0;
285         dest[x+1] = (pix & 0x0f) ? pens[pix & 0x0f] : blaster_color0;
238         dest[x+0] = (pix & 0xf0) ? pens[pix >> 4] : state->blaster_color0;
239         dest[x+1] = (pix & 0x0f) ? pens[pix & 0x0f] : state->blaster_color0;
286240      }
287241   }
288242   return 0;
r10613r10614
291245
292246SCREEN_UPDATE( williams2 )
293247{
248   williams_state *state = screen->machine->driver_data<williams_state>();
294249   rgb_t pens[16];
295250   int x, y;
296251
297252   /* draw the background */
298   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
253   tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
299254
300255   /* fetch the relevant pens */
301256   for (x = 1; x < 16; x++)
302      pens[x] = palette_get_color(screen->machine, williams2_fg_color * 16 + x);
257      pens[x] = palette_get_color(screen->machine, state->williams2_fg_color * 16 + x);
303258
304259   /* loop over rows */
305260   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
306261   {
307      UINT8 *source = &williams_videoram[y];
262      UINT8 *source = &state->videoram[y];
308263      UINT32 *dest = BITMAP_ADDR32(bitmap, y, 0);
309264
310265      /* loop over columns */
r10613r10614
331286
332287static void create_palette_lookup(running_machine *machine)
333288{
289   williams_state *state = machine->driver_data<williams_state>();
334290   static const int resistances_rg[3] = { 1200, 560, 330 };
335291   static const int resistances_b[2]  = { 560, 330 };
336292   double weights_r[3], weights_g[3], weights_b[2];
r10613r10614
345301         2, resistances_b,  weights_b, 0, 0);
346302
347303   /* build a palette lookup */
348   palette_lookup = auto_alloc_array(machine, rgb_t, 256);
304   state->palette_lookup = auto_alloc_array(machine, rgb_t, 256);
349305   for (i = 0; i < 256; i++)
350306   {
351307      int r = combine_3_weights(weights_r, BIT(i,0), BIT(i,1), BIT(i,2));
352308      int g = combine_3_weights(weights_g, BIT(i,3), BIT(i,4), BIT(i,5));
353309      int b = combine_2_weights(weights_b, BIT(i,6), BIT(i,7));
354310
355      palette_lookup[i] = MAKE_RGB(r, g, b);
311      state->palette_lookup[i] = MAKE_RGB(r, g, b);
356312   }
357313}
358314
r10613r10614
384340
385341WRITE8_HANDLER( williams2_fg_select_w )
386342{
387   williams2_fg_color = data & 0x3f;
343   williams_state *state = space->machine->driver_data<williams_state>();
344   state->williams2_fg_color = data & 0x3f;
388345}
389346
390347
r10613r10614
416373
417374static TILE_GET_INFO( get_tile_info )
418375{
376   williams_state *state = machine->driver_data<williams_state>();
419377   int mask = machine->gfx[0]->total_elements - 1;
420   int data = williams2_tileram[tile_index];
378   int data = state->williams2_tileram[tile_index];
421379   int y = (tile_index >> 1) & 7;
422380   int color = 0;
423381
424   switch (williams2_tilemap_config)
382   switch (state->williams2_tilemap_config)
425383   {
426384      case WILLIAMS_TILEMAP_MYSTICM:
427385      {
r10613r10614
450408
451409WRITE8_HANDLER( williams2_bg_select_w )
452410{
411   williams_state *state = space->machine->driver_data<williams_state>();
453412   /* based on the tilemap config, only certain bits are used */
454413   /* the rest are determined by other factors */
455   switch (williams2_tilemap_config)
414   switch (state->williams2_tilemap_config)
456415   {
457416      case WILLIAMS_TILEMAP_MYSTICM:
458417         /* IC79 is a 74LS85 comparator that controls the low bit */
r10613r10614
469428         data &= 0x3f;
470429         break;
471430   }
472   tilemap_set_palette_offset(bg_tilemap, data * 16);
431   tilemap_set_palette_offset(state->bg_tilemap, data * 16);
473432}
474433
475434
476435WRITE8_HANDLER( williams2_tileram_w )
477436{
478   williams2_tileram[offset] = data;
479   tilemap_mark_tile_dirty(bg_tilemap, offset);
437   williams_state *state = space->machine->driver_data<williams_state>();
438   state->williams2_tileram[offset] = data;
439   tilemap_mark_tile_dirty(state->bg_tilemap, offset);
480440}
481441
482442
483443WRITE8_HANDLER( williams2_xscroll_low_w )
484444{
485   tilemap_xscroll = (tilemap_xscroll & ~0x00f) | ((data & 0x80) >> 4) | (data & 0x07);
486   tilemap_set_scrollx(bg_tilemap, 0, (tilemap_xscroll & 7) + ((tilemap_xscroll >> 3) * 6));
445   williams_state *state = space->machine->driver_data<williams_state>();
446   state->tilemap_xscroll = (state->tilemap_xscroll & ~0x00f) | ((data & 0x80) >> 4) | (data & 0x07);
447   tilemap_set_scrollx(state->bg_tilemap, 0, (state->tilemap_xscroll & 7) + ((state->tilemap_xscroll >> 3) * 6));
487448}
488449
489450
490451WRITE8_HANDLER( williams2_xscroll_high_w )
491452{
492   tilemap_xscroll = (tilemap_xscroll & 0x00f) | (data << 4);
493   tilemap_set_scrollx(bg_tilemap, 0, (tilemap_xscroll & 7) + ((tilemap_xscroll >> 3) * 6));
453   williams_state *state = space->machine->driver_data<williams_state>();
454   state->tilemap_xscroll = (state->tilemap_xscroll & 0x00f) | (data << 4);
455   tilemap_set_scrollx(state->bg_tilemap, 0, (state->tilemap_xscroll & 7) + ((state->tilemap_xscroll >> 3) * 6));
494456}
495457
496458
r10613r10614
503465
504466WRITE8_HANDLER( blaster_remap_select_w )
505467{
506   blitter_remap_index = data;
507   blitter_remap = blitter_remap_lookup + data * 256;
468   williams_state *state = space->machine->driver_data<williams_state>();
469   state->blitter_remap_index = data;
470   state->blitter_remap = state->blitter_remap_lookup + data * 256;
508471}
509472
510473
511474WRITE8_HANDLER( blaster_video_control_w )
512475{
513   blaster_video_control = data;
476   williams_state *state = space->machine->driver_data<williams_state>();
477   state->blaster_video_control = data;
514478}
515479
516480
r10613r10614
523487
524488static void blitter_init(running_machine *machine, int blitter_config, const UINT8 *remap_prom)
525489{
490   williams_state *state = machine->driver_data<williams_state>();
526491   static const UINT8 dummy_table[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
527492   int i,j;
528493
529494   /* by default, there is no clipping window - this will be touched only by games that have one */
530   williams_blitter_window_enable = 0;
495   state->blitter_window_enable = 0;
531496
532497   /* switch off the video config */
533   blitter_xor = (blitter_config == WILLIAMS_BLITTER_SC01) ? 4 : 0;
498   state->blitter_xor = (blitter_config == WILLIAMS_BLITTER_SC01) ? 4 : 0;
534499
535500   /* create the remap table; if no PROM, make an identity remap table */
536   blitter_remap_lookup = auto_alloc_array(machine, UINT8, 256 * 256);
537   blitter_remap_index = 0;
538   blitter_remap = blitter_remap_lookup;
501   state->blitter_remap_lookup = auto_alloc_array(machine, UINT8, 256 * 256);
502   state->blitter_remap_index = 0;
503   state->blitter_remap = state->blitter_remap_lookup;
539504   for (i = 0; i < 256; i++)
540505   {
541506      const UINT8 *table = remap_prom ? (remap_prom + (i & 0x7f) * 16) : dummy_table;
542507      for (j = 0; j < 256; j++)
543         blitter_remap_lookup[i * 256 + j] = (table[j >> 4] << 4) | table[j & 0x0f];
508         state->blitter_remap_lookup[i * 256 + j] = (table[j >> 4] << 4) | table[j & 0x0f];
544509   }
545510}
546511
547512
548513WRITE8_HANDLER( williams_blitter_w )
549514{
515   williams_state *state = space->machine->driver_data<williams_state>();
550516   int sstart, dstart, w, h, accesses;
551517   int estimated_clocks_at_4MHz;
552518
553519   /* store the data */
554   blitterram[offset] = data;
520   state->blitterram[offset] = data;
555521
556522   /* only writes to location 0 trigger the blit */
557523   if (offset != 0)
558524      return;
559525
560526   /* compute the starting locations */
561   sstart = (blitterram[2] << 8) + blitterram[3];
562   dstart = (blitterram[4] << 8) + blitterram[5];
527   sstart = (state->blitterram[2] << 8) + state->blitterram[3];
528   dstart = (state->blitterram[4] << 8) + state->blitterram[5];
563529
564530   /* compute the width and height */
565   w = blitterram[6] ^ blitter_xor;
566   h = blitterram[7] ^ blitter_xor;
531   w = state->blitterram[6] ^ state->blitter_xor;
532   h = state->blitterram[7] ^ state->blitter_xor;
567533
568534   /* adjust the width and height */
569535   if (w == 0) w = 1;
r10613r10614
582548   /* Log blits */
583549   logerror("%04X:Blit @ %3d : %02X%02X -> %02X%02X, %3dx%3d, mask=%02X, flags=%02X, icount=%d, win=%d\n",
584550         cpu_get_pc(space->cpu), space->machine->primary_screen->vpos(),
585         blitterram[2], blitterram[3],
586         blitterram[4], blitterram[5],
587         blitterram[6], blitterram[7],
588         blitterram[1], blitterram[0],
589         ((estimated_clocks_at_4MHz + 3) / 4), williams_blitter_window_enable);
551         state->blitterram[2], state->blitterram[3],
552         state->blitterram[4], state->blitterram[5],
553         state->blitterram[6], state->blitterram[7],
554         state->blitterram[1], state->blitterram[0],
555         ((estimated_clocks_at_4MHz + 3) / 4), state->blitter_window_enable);
590556}
591557
592558
593559WRITE8_HANDLER( williams2_blit_window_enable_w )
594560{
595   williams_blitter_window_enable = data & 0x01;
561   williams_state *state = space->machine->driver_data<williams_state>();
562   state->blitter_window_enable = data & 0x01;
596563}
597564
598565
r10613r10614
605572
606573INLINE void blit_pixel(address_space *space, int offset, int srcdata, int data, int mask, int solid)
607574{
575   williams_state *state = space->machine->driver_data<williams_state>();
608576   /* always read from video RAM regardless of the bank setting */
609   int pix = (offset < 0xc000) ? williams_videoram[offset] : space->read_byte(offset);
577   int pix = (offset < 0xc000) ? state->videoram[offset] : space->read_byte(offset);
610578
611579   /* handle transparency */
612580   if (data & 0x08)
r10613r10614
625593   /* if the window is enabled, only blit to videoram below the clipping address */
626594   /* note that we have to allow blits to non-video RAM (e.g. tileram) because those */
627595   /* are not blocked by the window enable */
628   if (!williams_blitter_window_enable || offset < williams_blitter_clip_address || offset >= 0xc000)
596   if (!state->blitter_window_enable || offset < state->blitter_clip_address || offset >= 0xc000)
629597      space->write_byte(offset, pix);
630598}
631599
632600
633601static int blitter_core(address_space *space, int sstart, int dstart, int w, int h, int data)
634602{
603   williams_state *state = space->machine->driver_data<williams_state>();
635604   int source, sxadv, syadv;
636605   int dest, dxadv, dyadv;
637606   int i, j, solid;
r10613r10614
652621      return accesses;
653622
654623   /* set the solid pixel value to the mask value */
655   solid = blitterram[1];
624   solid = state->blitterram[1];
656625
657626   /* first case: no shifting */
658627   if (!(data & 0x20))
r10613r10614
666635         /* loop over the width */
667636         for (j = w; j > 0; j--)
668637         {
669            blit_pixel(space, dest, blitter_remap[space->read_byte(source)], data, keepmask, solid);
638            blit_pixel(space, dest, state->blitter_remap[space->read_byte(source)], data, keepmask, solid);
670639            accesses += 2;
671640
672641            /* advance */
r10613r10614
700669         dest = dstart & 0xffff;
701670
702671         /* left edge case */
703         pixdata = blitter_remap[space->read_byte(source)];
672         pixdata = state->blitter_remap[space->read_byte(source)];
704673         blit_pixel(space, dest, (pixdata >> 4) & 0x0f, data, keepmask | 0xf0, solid);
705674         accesses += 2;
706675
r10613r10614
710679         /* loop over the width */
711680         for (j = w - 1; j > 0; j--)
712681         {
713            pixdata = (pixdata << 8) | blitter_remap[space->read_byte(source)];
682            pixdata = (pixdata << 8) | state->blitter_remap[space->read_byte(source)];
714683            blit_pixel(space, dest, (pixdata >> 4) & 0xff, data, keepmask, solid);
715684            accesses += 2;
716685
src/mame/video/triplhnt.c
r10613r10614
88#include "includes/triplhnt.h"
99
1010
11UINT8* triplhnt_playfield_ram;
12UINT8* triplhnt_hpos_ram;
13UINT8* triplhnt_vpos_ram;
14UINT8* triplhnt_code_ram;
15UINT8* triplhnt_orga_ram;
16
17int triplhnt_sprite_zoom;
18int triplhnt_sprite_bank;
19
20static bitmap_t* helper;
21static tilemap_t* bg_tilemap;
22
23
2411static TILE_GET_INFO( get_tile_info )
2512{
26   int code = triplhnt_playfield_ram[tile_index] & 0x3f;
13   triplhnt_state *state = machine->driver_data<triplhnt_state>();
14   int code = state->playfield_ram[tile_index] & 0x3f;
2715
2816   SET_TILE_INFO(2, code, code == 0x3f ? 1 : 0, 0);
2917}
r10613r10614
3119
3220VIDEO_START( triplhnt )
3321{
34   helper = machine->primary_screen->alloc_compatible_bitmap();
22   triplhnt_state *state = machine->driver_data<triplhnt_state>();
23   state->helper = machine->primary_screen->alloc_compatible_bitmap();
3524
36   bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 16, 16, 16, 16);
25   state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 16, 16, 16, 16);
3726}
3827
3928
r10613r10614
4534
4635static void draw_sprites(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
4736{
37   triplhnt_state *state = machine->driver_data<triplhnt_state>();
4838   int i;
4939
5040   int hit_line = 999;
r10613r10614
5444   {
5545      rectangle rect;
5646
57      int j = (triplhnt_orga_ram[i] & 15) ^ 15;
47      int j = (state->orga_ram[i] & 15) ^ 15;
5848
5949      /* software sorts sprites by x and stores order in orga RAM */
6050
61      int hpos = triplhnt_hpos_ram[j] ^ 255;
62      int vpos = triplhnt_vpos_ram[j] ^ 255;
63      int code = triplhnt_code_ram[j] ^ 255;
51      int hpos = state->hpos_ram[j] ^ 255;
52      int vpos = state->vpos_ram[j] ^ 255;
53      int code = state->code_ram[j] ^ 255;
6454
6555      if (hpos == 255)
6656         continue;
6757
6858      /* sprite placement might be wrong */
6959
70      if (triplhnt_sprite_zoom)
60      if (state->sprite_zoom)
7161      {
7262         rect.min_x = hpos - 16;
7363         rect.min_y = 196 - vpos;
r10613r10614
8474
8575      /* render sprite to auxiliary bitmap */
8676
87      drawgfx_opaque(helper, cliprect, machine->gfx[triplhnt_sprite_zoom],
88         2 * code + triplhnt_sprite_bank, 0, code & 8, 0,
77      drawgfx_opaque(state->helper, cliprect, machine->gfx[state->sprite_zoom],
78         2 * code + state->sprite_bank, 0, code & 8, 0,
8979         rect.min_x, rect.min_y);
9080
9181      if (rect.min_x < cliprect->min_x)
r10613r10614
10797         {
10898            for (y = rect.min_y; y <= rect.max_y; y++)
10999            {
110               pen_t a = *BITMAP_ADDR16(helper, y, x);
100               pen_t a = *BITMAP_ADDR16(state->helper, y, x);
111101               pen_t b = *BITMAP_ADDR16(bitmap, y, x);
112102
113103               if (a == 2 && b == 7)
r10613r10614
130120
131121SCREEN_UPDATE( triplhnt )
132122{
123   triplhnt_state *state = screen->machine->driver_data<triplhnt_state>();
133124   device_t *discrete = screen->machine->device("discrete");
134125
135   tilemap_mark_all_tiles_dirty(bg_tilemap);
126   tilemap_mark_all_tiles_dirty(state->bg_tilemap);
136127
137   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
128   tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
138129
139130   draw_sprites(screen->machine, bitmap, cliprect);
140131
141   discrete_sound_w(discrete, TRIPLHNT_BEAR_ROAR_DATA, triplhnt_playfield_ram[0xfa] & 15);
142   discrete_sound_w(discrete, TRIPLHNT_SHOT_DATA, triplhnt_playfield_ram[0xfc] & 15);
132   discrete_sound_w(discrete, TRIPLHNT_BEAR_ROAR_DATA, state->playfield_ram[0xfa] & 15);
133   discrete_sound_w(discrete, TRIPLHNT_SHOT_DATA, state->playfield_ram[0xfc] & 15);
143134   return 0;
144135}
src/mame/video/pirates.c
r10613r10614
22#include "includes/pirates.h"
33
44
5UINT16 *pirates_tx_tileram, *pirates_spriteram;
6UINT16 *pirates_fg_tileram,  *pirates_bg_tileram;
7UINT16 *pirates_scroll;
8
9static tilemap_t *tx_tilemap, *fg_tilemap, *bg_tilemap;
10
115/* Video Hardware */
126
137/* tilemaps */
148
159static TILE_GET_INFO( get_tx_tile_info )
1610{
17   int code = pirates_tx_tileram[tile_index*2];
18   int colr = pirates_tx_tileram[tile_index*2+1];
11   pirates_state *state = machine->driver_data<pirates_state>();
12   int code = state->tx_tileram[tile_index*2];
13   int colr = state->tx_tileram[tile_index*2+1];
1914
2015   SET_TILE_INFO(0,code,colr,0);
2116}
2217
2318static TILE_GET_INFO( get_fg_tile_info )
2419{
25   int code = pirates_fg_tileram[tile_index*2];
26   int colr = pirates_fg_tileram[tile_index*2+1]+0x80;
20   pirates_state *state = machine->driver_data<pirates_state>();
21   int code = state->fg_tileram[tile_index*2];
22   int colr = state->fg_tileram[tile_index*2+1]+0x80;
2723
2824   SET_TILE_INFO(0,code,colr,0);
2925}
3026
3127static TILE_GET_INFO( get_bg_tile_info )
3228{
33   int code = pirates_bg_tileram[tile_index*2];
34   int colr = pirates_bg_tileram[tile_index*2+1]+ 0x100;
29   pirates_state *state = machine->driver_data<pirates_state>();
30   int code = state->bg_tileram[tile_index*2];
31   int colr = state->bg_tileram[tile_index*2+1]+ 0x100;
3532
3633   SET_TILE_INFO(0,code,colr,0);
3734}
r10613r10614
4138
4239VIDEO_START(pirates)
4340{
44   tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_cols,8,8,36,32);
41   pirates_state *state = machine->driver_data<pirates_state>();
42   state->tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_cols,8,8,36,32);
4543
4644   /* Not sure how big they can be, Pirates uses only 32 columns, Genix 44 */
47   fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_cols,8,8,64,32);
48   bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols,     8,8,64,32);
45   state->fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_cols,8,8,64,32);
46   state->bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols,     8,8,64,32);
4947
50   tilemap_set_transparent_pen(tx_tilemap,0);
51   tilemap_set_transparent_pen(fg_tilemap,0);
48   tilemap_set_transparent_pen(state->tx_tilemap,0);
49   tilemap_set_transparent_pen(state->fg_tilemap,0);
5250}
5351
5452
5553
5654WRITE16_HANDLER( pirates_tx_tileram_w )
5755{
58   COMBINE_DATA(pirates_tx_tileram+offset);
59   tilemap_mark_tile_dirty(tx_tilemap,offset/2);
56   pirates_state *state = space->machine->driver_data<pirates_state>();
57   COMBINE_DATA(state->tx_tileram+offset);
58   tilemap_mark_tile_dirty(state->tx_tilemap,offset/2);
6059}
6160
6261WRITE16_HANDLER( pirates_fg_tileram_w )
6362{
64   COMBINE_DATA(pirates_fg_tileram+offset);
65   tilemap_mark_tile_dirty(fg_tilemap,offset/2);
63   pirates_state *state = space->machine->driver_data<pirates_state>();
64   COMBINE_DATA(state->fg_tileram+offset);
65   tilemap_mark_tile_dirty(state->fg_tilemap,offset/2);
6666}
6767
6868WRITE16_HANDLER( pirates_bg_tileram_w )
6969{
70   COMBINE_DATA(pirates_bg_tileram+offset);
71   tilemap_mark_tile_dirty(bg_tilemap,offset/2);
70   pirates_state *state = space->machine->driver_data<pirates_state>();
71   COMBINE_DATA(state->bg_tileram+offset);
72   tilemap_mark_tile_dirty(state->bg_tilemap,offset/2);
7273}
7374
7475
7576
7677static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
7778{
79   pirates_state *state = machine->driver_data<pirates_state>();
7880   const gfx_element *gfx = machine->gfx[1];
79   UINT16 *source = pirates_spriteram + 4;
81   UINT16 *source = state->spriteram + 4;
8082   UINT16 *finish = source + 0x800/2-4;
8183
8284   while( source<finish )
r10613r10614
107109
108110SCREEN_UPDATE(pirates)
109111{
110   tilemap_set_scrollx(bg_tilemap,0,pirates_scroll[0]);
111   tilemap_set_scrollx(fg_tilemap,0,pirates_scroll[0]);
112   tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
113   tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
112   pirates_state *state = screen->machine->driver_data<pirates_state>();
113   tilemap_set_scrollx(state->bg_tilemap,0,state->scroll[0]);
114   tilemap_set_scrollx(state->fg_tilemap,0,state->scroll[0]);
115   tilemap_draw(bitmap,cliprect,state->bg_tilemap,0,0);
116   tilemap_draw(bitmap,cliprect,state->fg_tilemap,0,0);
114117   draw_sprites(screen->machine,bitmap,cliprect);
115   tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
118   tilemap_draw(bitmap,cliprect,state->tx_tilemap,0,0);
116119   return 0;
117120}
src/mame/etc/jrcrypt.c
r10613r10614
487487void Load(char *name,byte *buffer,int from, int length)
488488{
489489/*
490   emu_file file(options, NULL, OPEN_FLAG_READ);
491   file_error filerr = file.open(name);
492   if (filerr != FILERR_NONE)
493      return;
494   while (length--)
495      buffer[from++]=file->getc();
490    emu_file file(options, NULL, OPEN_FLAG_READ);
491    file_error filerr = file.open(name);
492    if (filerr != FILERR_NONE)
493        return;
494    while (length--)
495        buffer[from++]=file->getc();
496496*/
497497}
498498
src/mame/layout/blockade.lay
r10613r10614
11<?xml version="1.0"?>
22<mamelayout version="2">
3   <element name="overlay">
3   <element name="overlay_green">
44      <rect>
5         <bounds left="0" top="0" right="256" bottom="224" />
5         <bounds left="0" top="0" right="4" bottom="3" />
66         <color red="0.25" green="1.0" blue="0.125" />
77      </rect>
88   </element>
9   <element name="overlay_yellow">
10      <rect>
11         <bounds left="0" top="0" right="4" bottom="3" />
12         <color red="1.0" green="1.0" blue="0.125" />
13      </rect>
14   </element>
915
10   <view name="Color Overlay">
16   <view name="Green Overlay">
1117      <screen index="0">
1218         <bounds left="0" top="0" right="4" bottom="3" />
1319      </screen>
14      <overlay name="overlay" element="overlay">
20      <overlay name="overlay" element="overlay_green">
1521         <bounds left="0" top="0" right="4" bottom="3" />
1622      </overlay>
1723   </view>
24   <view name="Yellow Overlay">
25      <screen index="0">
26         <bounds left="0" top="0" right="4" bottom="3" />
27      </screen>
28      <overlay name="overlay" element="overlay_yellow">
29         <bounds left="0" top="0" right="4" bottom="3" />
30      </overlay>
31   </view>
1832</mamelayout>
src/mame/layout/outrun.lay
r10613r10614
33   <element name="shifter" defstate="0">
44      <rect>
55         <bounds left="0" right="32" top="0" bottom="64" />
6         <color red="0.8" green="0.0" blue="0.0" />
6         <color red="0.8" green="0.4" blue="0.3" />
77      </rect>
88      <rect>
99         <bounds left="2" right="30" top="2" bottom="62" />
10         <color red="0.0" green="0.0" blue="0.0" />
10         <color red="0.2" green="0.18" blue="0.16" />
1111      </rect>
1212      <rect>
1313         <bounds left="14" right="18" top="15" bottom="49" />
r10613r10614
2323      </disk>
2424      <text string="LOW" state="0">
2525         <bounds left="3" right="29" top="2" bottom="12" />
26         <color red="1.0" green="1.0" blue="0.0" />
26         <color red="1.0" green="1.0" blue="0.4" />
2727      </text>
2828      <text string="LOW" state="1">
2929         <bounds left="3" right="29" top="2" bottom="12" />
r10613r10614
3636      </text>
3737      <text string="HIGH" state="1">
3838         <bounds left="3" right="29" top="52" bottom="62" />
39         <color red="1.0" green="1.0" blue="0.0" />
39         <color red="1.0" green="1.0" blue="0.4" />
4040      </text>
4141      <disk state="0">
4242         <bounds left="9" right="23" top="14" bottom="28" />
43         <color red="0.8" green="0.0" blue="0.0" />
43         <color red="0.8" green="0.4" blue="0.3" />
4444      </disk>
4545      <disk state="1">
4646         <bounds left="9" right="23" top="36" bottom="50" />
47         <color red="0.8" green="0.0" blue="0.0" />
47         <color red="0.8" green="0.4" blue="0.3" />
4848      </disk>
4949   </element>
5050   <view name="Shifter-R">
r10613r10614
5353      </screen>     
5454      <bezel element="shifter" inputtag="SERVICE" inputmask="0x10">
5555         <bounds x="606" y="414" width="32" height="64" />
56         <color alpha="0.9" />
56         <color alpha="0.6" />
5757      </bezel>
5858   </view>
5959   <view name="Shifter-L">
r10613r10614
6262      </screen>     
6363      <bezel element="shifter" inputtag="SERVICE" inputmask="0x10">
6464         <bounds x="2" y="414" width="32" height="64" />
65         <color alpha="0.9" />
65         <color alpha="0.6" />
6666      </bezel>
6767   </view>
6868</mamelayout>
src/mame/layout/geebee.lay
r10613r10614
11<?xml version="1.0"?>
22<mamelayout version="2">
3   <element name="overlay" defstate="1">
4      <rect state="1">
5         <bounds left="0" top="0" right="28" bottom="34" />
3   <element name="overlay">
4      <rect>
5         <bounds left="0" top="0" right="224" bottom="272" />
66         <color red="1" green="1" blue="1" />
77      </rect>
8      <rect state="1">
9         <bounds left="0" top="0" right="1" bottom="0" />
10         <color red="1" green="1" blue="1" />
11      </rect>
12      <rect state="1">
13         <bounds left="0" top="32" right="28" bottom="34" />
14         <color red="1" green="1" blue="1" />
15      </rect>
168
17      <rect state="1">
18         <bounds left="0" top="1" right="28" bottom="4" />
19         <color red="0.878" green="0" blue="0.627" />
20      </rect>
21
22      <rect state="1">
23         <bounds left="24" top="4" right="28" bottom="5" />
9      <rect>
10         <bounds left="191.5" top="7.5" right="224" bottom="40.5" />
2411         <color red="0.627" green="0" blue="0.878" />
2512      </rect>
26      <rect state="1">
27         <bounds left="0" top="4" right="4" bottom="5" />
13      <rect>
14         <bounds left="0" top="7.5" right="32.5" bottom="40.5" />
2815         <color red="0.627" green="0" blue="0.878" />
2916      </rect>
3017
31      <rect state="1">
32         <bounds left="4" top="4" right="24" bottom="5" />
18      <rect>
19         <bounds left="23.5" top="7.5" right="200.5" bottom="32.5" />
20         <color red="0.878" green="0" blue="0.627" />
21      </rect>
22
23      <rect>
24         <bounds left="32.5" top="32.5" right="191.5" bottom="40.5" />
3325         <color red="1" green="0.816" blue="0" />
3426      </rect>
3527     
36      <rect state="1">
37         <bounds left="27" top="5" right="28" bottom="28" />
28      <rect>
29         <bounds left="215.5" top="40.5" right="224" bottom="223.5" />
3830         <color red="0.627" green="0" blue="0.878" />
3931      </rect>
40      <rect state="1">
41         <bounds left="0" top="5" right="1" bottom="28" />
32      <rect>
33         <bounds left="0" top="40.5" right="8.5" bottom="223.5" />
4234         <color red="0.627" green="0" blue="0.878" />
4335      </rect>
4436
45      <rect state="1">
46         <bounds left="24" top="5" right="27" bottom="28" />
47         <color red="0" green="0" blue="1" />
37      <rect>
38         <bounds left="191.5" top="40.5" right="215.5" bottom="223.5" />
39         <color red="0" green="0.333" blue="1" />
4840      </rect>
49      <rect state="1">
50         <bounds left="1" top="5" right="4" bottom="28" />
51         <color red="0" green="0" blue="1" />
41      <rect>
42         <bounds left="8.5" top="40.5" right="32.5" bottom="223.5" />
43         <color red="0" green="0.333" blue="1" />
5244      </rect>
53      <rect state="1">
54         <bounds left="13" top="12" right="15" bottom="13" />
55         <color red="0" green="0" blue="1" />
45      <rect>
46         <bounds left="103.625" top="95.5" right="120.375" bottom="104.5" />
47         <color red="0" green="0.333" blue="1" />
5648      </rect>
57      <rect state="1">
58         <bounds left="16" top="21" right="18" bottom="23" />
59         <color red="0" green="0" blue="1" />
49      <rect>
50         <bounds left="128" top="168" right="144" bottom="184" />
51         <color red="0" green="0.333" blue="1" />
6052      </rect>
61      <rect state="1">
62         <bounds left="10" top="21" right="12" bottom="23" />
63         <color red="0" green="0" blue="1" />
53      <rect>
54         <bounds left="80" top="168" right="96" bottom="184" />
55         <color red="0" green="0.333" blue="1" />
6456      </rect>
6557
66      <rect state="1">
67         <bounds left="0" top="28" right="28" bottom="29" />
58      <rect>
59         <bounds left="0" top="223.5" right="224" bottom="232.5" />
6860         <color red="0.878" green="0" blue="0.627" />
6961      </rect>
70      <rect state="1">
71         <bounds left="0" top="29" right="28" bottom="32" />
62      <rect>
63         <bounds left="0" top="232.5" right="224" bottom="256" />
7264         <color red="0.627" green="0" blue="0.878" />
7365      </rect>
7466   </element>
src/mame/layout/navarone.lay
r0r10614
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="overlay">
4      <rect>
5         <bounds left="0" top="0" right="224" bottom="272" />
6         <color red="0.2" green="0.9" blue="1" />
7      </rect>
8
9      <rect>
10         <bounds left="22" top="33" right="202" bottom="238" />
11         <color red="0.2" green="1" blue="0.2" />
12      </rect>
13      <rect>
14         <bounds left="22" top="23" right="25" bottom="247" />
15         <color red="0.2" green="1.0" blue="0.2" />
16      </rect>
17      <rect>
18         <bounds left="199" top="23" right="202" bottom="247" />
19         <color red="0.2" green="1.0" blue="0.2" />
20      </rect>
21
22      <rect>
23         <bounds left="97" top="97" right="127" bottom="127" />
24         <color red="1" green="0.9" blue="0.2" />
25      </rect>
26   </element>
27
28   <view name="Color Overlay">
29      <screen index="0">
30         <bounds left="0" top="0" right="3" bottom="4" />
31      </screen>
32      <overlay name="overlay" element="overlay">
33         <bounds left="0" top="0" right="3" bottom="4" />
34      </overlay>
35   </view>
36</mamelayout>
src/mame/drivers/mainsnk.c
r10613r10614
415415
416416   MCFG_PALETTE_INIT(mainsnk)
417417   MCFG_VIDEO_START(mainsnk)
418   
418
419419   MCFG_SPEAKER_STANDARD_MONO("mono")
420420
421421   MCFG_SOUND_ADD("ay1", AY8910, 2000000)
src/mame/drivers/snowbros.c
r10613r10614
14941494   MCFG_GFXDECODE(wb)
14951495   MCFG_SCREEN_MODIFY("screen")
14961496   MCFG_SCREEN_UPDATE(wintbob)
1497   MCFG_SCREEN_EOF(0)
14971498MACHINE_CONFIG_END
14981499
14991500
src/mame/drivers/nbmj9195.c
r10613r10614
3737#endif
3838
3939
40static int nbmj9195_inputport;
41static int nbmj9195_dipswbitsel;
42static int nbmj9195_outcoin_flag;
43static int mscoutm_inputport;
44
45
46static UINT8 *nbmj9195_nvram;
47static size_t nbmj9195_nvram_size;
48
49
5040static NVRAM_HANDLER( nbmj9195 )
5141{
42   nbmj9195_state *state = machine->driver_data<nbmj9195_state>();
5243   if (read_or_write)
53      file->write(nbmj9195_nvram, nbmj9195_nvram_size);
44      file->write(state->nvram, state->nvram_size);
5445   else {
5546      if (file)
56         file->read(nbmj9195_nvram, nbmj9195_nvram_size);
47         file->read(state->nvram, state->nvram_size);
5748      else
58         memset(nbmj9195_nvram, 0, nbmj9195_nvram_size);
49         memset(state->nvram, 0, state->nvram_size);
5950   }
6051}
6152
r10613r10614
8172   soundlatch_clear_w(space, 0, 0);
8273}
8374
84static void nbmj9195_outcoin_flag_w(int data)
75static void nbmj9195_outcoin_flag_w(address_space *space, int data)
8576{
77   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
8678   // bit0: coin in counter
8779   // bit1: coin out counter
8880   // bit2: hopper
8981   // bit3: coin lockout
9082
91   if (data & 0x04) nbmj9195_outcoin_flag ^= 1;
92   else nbmj9195_outcoin_flag = 1;
83   if (data & 0x04) state->outcoin_flag ^= 1;
84   else state->outcoin_flag = 1;
9385}
9486
9587static WRITE8_HANDLER( nbmj9195_inputportsel_w )
9688{
97   nbmj9195_inputport = (data ^ 0xff);
89   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
90   state->inputport = (data ^ 0xff);
9891}
9992
10093static int nbmj9195_dipsw_r(running_machine *machine)
10194{
102   return ((((input_port_read(machine, "DSWA") & 0xff) | ((input_port_read(machine, "DSWB") & 0xff) << 8)) >> nbmj9195_dipswbitsel) & 0x01);
95   nbmj9195_state *state = machine->driver_data<nbmj9195_state>();
96   return ((((input_port_read(machine, "DSWA") & 0xff) | ((input_port_read(machine, "DSWB") & 0xff) << 8)) >> state->dipswbitsel) & 0x01);
10397}
10498
105static void nbmj9195_dipswbitsel_w(int data)
99static void nbmj9195_dipswbitsel_w(address_space *space, int data)
106100{
101   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
107102   switch (data & 0xc0)
108103   {
109104      case 0x00:
110         nbmj9195_dipswbitsel = 0;
105         state->dipswbitsel = 0;
111106         break;
112107      case 0x40:
113108         break;
114109      case 0x80:
115110         break;
116111      case 0xc0:
117         nbmj9195_dipswbitsel = ((nbmj9195_dipswbitsel + 1) & 0x0f);
112         state->dipswbitsel = ((state->dipswbitsel + 1) & 0x0f);
118113         break;
119114      default:
120115         break;
121116   }
122117}
123118
124static void mscoutm_inputportsel_w(int data)
119static void mscoutm_inputportsel_w(address_space *space, int data)
125120{
126   mscoutm_inputport = (data ^ 0xff);
121   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
122   state->mscoutm_inputport = (data ^ 0xff);
127123}
128124
129125static READ8_HANDLER( mscoutm_dipsw_0_r )
r10613r10614
147143
148144/* TMPZ84C011 PIO emulation */
149145
150static UINT8 pio_dir[5 * 2], pio_latch[5 * 2];
151146
152147static READ8_HANDLER( tmpz84c011_pio_r )
153148{
149   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
154150   int portdata;
155151
156152   if ((!strcmp(space->machine->gamedrv->name, "mscoutm")) ||
r10613r10614
166162            break;
167163         case 1:         /* PB_0 */
168164            // PLAYER1 KEY, DIPSW A/B
169            switch (mscoutm_inputport)
165            switch (state->mscoutm_inputport)
170166            {
171167               case 0x01:
172168                  portdata = input_port_read(space->machine, "KEY0");
r10613r10614
191187            break;
192188         case 2:         /* PC_0 */
193189            // PLAYER2 KEY
194            switch (mscoutm_inputport)
190            switch (state->mscoutm_inputport)
195191            {
196192               case 0x01:
197193                  portdata = input_port_read(space->machine, "KEY5");
r10613r10614
249245      {
250246         case 0:         /* PA_0 */
251247            // COIN IN, ETC...
252            portdata = ((input_port_read(space->machine, "SYSTEM") & 0xfe) | nbmj9195_outcoin_flag);
248            portdata = ((input_port_read(space->machine, "SYSTEM") & 0xfe) | state->outcoin_flag);
253249            break;
254250         case 1:         /* PB_0 */
255251            // PLAYER1 KEY, DIPSW A/B
256            switch (nbmj9195_inputport)
252            switch (state->inputport)
257253            {
258254               case 0x01:
259255                  portdata = input_port_read(space->machine, "KEY0");
r10613r10614
277273            break;
278274         case 2:         /* PC_0 */
279275            // PLAYER2 KEY
280            switch (nbmj9195_inputport)
276            switch (state->inputport)
281277            {
282278               case 0x01:
283279                  portdata = input_port_read(space->machine, "KEY5");
r10613r10614
342338      switch (offset)
343339      {
344340         case 0:         /* PA_0 */
345            mscoutm_inputportsel_w(data);   // NB22090
341            mscoutm_inputportsel_w(space, data);   // NB22090
346342            break;
347343         case 1:         /* PB_0 */
348344            break;
349345         case 2:         /* PC_0 */
350346            break;
351347         case 3:         /* PD_0 */
352            nbmj9195_clutsel_w(data);
348            nbmj9195_clutsel_w(space, data);
353349            break;
354350         case 4:         /* PE_0 */
355            nbmj9195_gfxflag2_w(data);      // NB22090
351            nbmj9195_gfxflag2_w(space, data);      // NB22090
356352            break;
357353
358354         case 5:         /* PA_1 */
r10613r10614
384380         case 1:         /* PB_0 */
385381            break;
386382         case 2:         /* PC_0 */
387            nbmj9195_dipswbitsel_w(data);
383            nbmj9195_dipswbitsel_w(space, data);
388384            break;
389385         case 3:         /* PD_0 */
390            nbmj9195_clutsel_w(data);
386            nbmj9195_clutsel_w(space, data);
391387            break;
392388         case 4:         /* PE_0 */
393            nbmj9195_outcoin_flag_w(data);
389            nbmj9195_outcoin_flag_w(space, data);
394390            break;
395391
396392         case 5:         /* PA_1 */
r10613r10614
419415/* CPU interface */
420416
421417/* device 0 */
422static READ8_HANDLER( tmpz84c011_0_pa_r )   { return (tmpz84c011_pio_r(space,0) & ~pio_dir[0]) | (pio_latch[0] & pio_dir[0]); }
423static READ8_HANDLER( tmpz84c011_0_pb_r )   { return (tmpz84c011_pio_r(space,1) & ~pio_dir[1]) | (pio_latch[1] & pio_dir[1]); }
424static READ8_HANDLER( tmpz84c011_0_pc_r )   { return (tmpz84c011_pio_r(space,2) & ~pio_dir[2]) | (pio_latch[2] & pio_dir[2]); }
425static READ8_HANDLER( tmpz84c011_0_pd_r )   { return (tmpz84c011_pio_r(space,3) & ~pio_dir[3]) | (pio_latch[3] & pio_dir[3]); }
426static READ8_HANDLER( tmpz84c011_0_pe_r )   { return (tmpz84c011_pio_r(space,4) & ~pio_dir[4]) | (pio_latch[4] & pio_dir[4]); }
418static READ8_HANDLER( tmpz84c011_0_pa_r )
419{
420   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return (tmpz84c011_pio_r(space,0) & ~state->pio_dir[0]) | (state->pio_latch[0] & state->pio_dir[0]);
421}
422static READ8_HANDLER( tmpz84c011_0_pb_r )
423{
424   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return (tmpz84c011_pio_r(space,1) & ~state->pio_dir[1]) | (state->pio_latch[1] & state->pio_dir[1]);
425}
427426
428static WRITE8_HANDLER( tmpz84c011_0_pa_w )   { pio_latch[0] = data; tmpz84c011_pio_w(space, 0, data); }
429static WRITE8_HANDLER( tmpz84c011_0_pb_w )   { pio_latch[1] = data; tmpz84c011_pio_w(space, 1, data); }
430static WRITE8_HANDLER( tmpz84c011_0_pc_w )   { pio_latch[2] = data; tmpz84c011_pio_w(space, 2, data); }
431static WRITE8_HANDLER( tmpz84c011_0_pd_w )   { pio_latch[3] = data; tmpz84c011_pio_w(space, 3, data); }
432static WRITE8_HANDLER( tmpz84c011_0_pe_w )   { pio_latch[4] = data; tmpz84c011_pio_w(space, 4, data); }
427static READ8_HANDLER( tmpz84c011_0_pc_r )
428{
429   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return (tmpz84c011_pio_r(space,2) & ~state->pio_dir[2]) | (state->pio_latch[2] & state->pio_dir[2]);
430}
433431
434static READ8_HANDLER( tmpz84c011_0_dir_pa_r )   { return pio_dir[0]; }
435static READ8_HANDLER( tmpz84c011_0_dir_pb_r )   { return pio_dir[1]; }
436static READ8_HANDLER( tmpz84c011_0_dir_pc_r )   { return pio_dir[2]; }
437static READ8_HANDLER( tmpz84c011_0_dir_pd_r )   { return pio_dir[3]; }
438static READ8_HANDLER( tmpz84c011_0_dir_pe_r )   { return pio_dir[4]; }
432static READ8_HANDLER( tmpz84c011_0_pd_r )
433{
434   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return (tmpz84c011_pio_r(space,3) & ~state->pio_dir[3]) | (state->pio_latch[3] & state->pio_dir[3]);
435}
439436
440static WRITE8_HANDLER( tmpz84c011_0_dir_pa_w )   { pio_dir[0] = data; }
441static WRITE8_HANDLER( tmpz84c011_0_dir_pb_w )   { pio_dir[1] = data; }
442static WRITE8_HANDLER( tmpz84c011_0_dir_pc_w )   { pio_dir[2] = data; }
443static WRITE8_HANDLER( tmpz84c011_0_dir_pd_w )   { pio_dir[3] = data; }
444static WRITE8_HANDLER( tmpz84c011_0_dir_pe_w )   { pio_dir[4] = data; }
437static READ8_HANDLER( tmpz84c011_0_pe_r )
438{
439   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return (tmpz84c011_pio_r(space,4) & ~state->pio_dir[4]) | (state->pio_latch[4] & state->pio_dir[4]);
440}
445441
442
443static WRITE8_HANDLER( tmpz84c011_0_pa_w )
444{
445   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
446   state->pio_latch[0] = data;
447   tmpz84c011_pio_w(space, 0, data);
448}
449
450static WRITE8_HANDLER( tmpz84c011_0_pb_w )
451{
452   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
453   state->pio_latch[1] = data;
454   tmpz84c011_pio_w(space, 1, data);
455}
456
457static WRITE8_HANDLER( tmpz84c011_0_pc_w )
458{
459   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
460   state->pio_latch[2] = data;
461   tmpz84c011_pio_w(space, 2, data);
462}
463
464static WRITE8_HANDLER( tmpz84c011_0_pd_w )
465{
466   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
467   state->pio_latch[3] = data;
468   tmpz84c011_pio_w(space, 3, data);
469}
470
471static WRITE8_HANDLER( tmpz84c011_0_pe_w )
472{
473   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
474   state->pio_latch[4] = data;
475   tmpz84c011_pio_w(space, 4, data);
476}
477
478
479static READ8_HANDLER( tmpz84c011_0_dir_pa_r )
480{
481   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return state->pio_dir[0];
482}
483
484static READ8_HANDLER( tmpz84c011_0_dir_pb_r )
485{
486   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return state->pio_dir[1];
487}
488
489static READ8_HANDLER( tmpz84c011_0_dir_pc_r )
490{
491   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return state->pio_dir[2];
492}
493
494static READ8_HANDLER( tmpz84c011_0_dir_pd_r )
495{
496   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return state->pio_dir[3];
497}
498
499static READ8_HANDLER( tmpz84c011_0_dir_pe_r )
500{
501   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return state->pio_dir[4];
502}
503
504
505static WRITE8_HANDLER( tmpz84c011_0_dir_pa_w )
506{
507   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
508   state->pio_dir[0] = data;
509}
510
511static WRITE8_HANDLER( tmpz84c011_0_dir_pb_w )
512{
513   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
514   state->pio_dir[1] = data;
515}
516
517static WRITE8_HANDLER( tmpz84c011_0_dir_pc_w )
518{
519   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
520   state->pio_dir[2] = data;
521}
522
523static WRITE8_HANDLER( tmpz84c011_0_dir_pd_w )
524{
525   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
526   state->pio_dir[3] = data;
527}
528
529static WRITE8_HANDLER( tmpz84c011_0_dir_pe_w )
530{
531   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
532   state->pio_dir[4] = data;
533}
534
535
446536/* device 1 */
447static READ8_HANDLER( tmpz84c011_1_pa_r )   { return (tmpz84c011_pio_r(space,5) & ~pio_dir[5]) | (pio_latch[5] & pio_dir[5]); }
448static READ8_HANDLER( tmpz84c011_1_pb_r )   { return (tmpz84c011_pio_r(space,6) & ~pio_dir[6]) | (pio_latch[6] & pio_dir[6]); }
449static READ8_HANDLER( tmpz84c011_1_pc_r )   { return (tmpz84c011_pio_r(space,7) & ~pio_dir[7]) | (pio_latch[7] & pio_dir[7]); }
450static READ8_HANDLER( tmpz84c011_1_pd_r )   { return (tmpz84c011_pio_r(space,8) & ~pio_dir[8]) | (pio_latch[8] & pio_dir[8]); }
451static READ8_HANDLER( tmpz84c011_1_pe_r )   { return (tmpz84c011_pio_r(space,9) & ~pio_dir[9]) | (pio_latch[9] & pio_dir[9]); }
537static READ8_HANDLER( tmpz84c011_1_pa_r )
538{
539   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return (tmpz84c011_pio_r(space,5) & ~state->pio_dir[5]) | (state->pio_latch[5] & state->pio_dir[5]);
540}
452541
453static WRITE8_HANDLER( tmpz84c011_1_pa_w )   { pio_latch[5] = data; tmpz84c011_pio_w(space, 5, data); }
454static WRITE8_HANDLER( tmpz84c011_1_pb_w )   { pio_latch[6] = data; tmpz84c011_pio_w(space, 6, data); }
455static WRITE8_HANDLER( tmpz84c011_1_pc_w )   { pio_latch[7] = data; tmpz84c011_pio_w(space, 7, data); }
456static WRITE8_HANDLER( tmpz84c011_1_pd_w )   { pio_latch[8] = data; tmpz84c011_pio_w(space, 8, data); }
457static WRITE8_HANDLER( tmpz84c011_1_pe_w )   { pio_latch[9] = data; tmpz84c011_pio_w(space, 9, data); }
542static READ8_HANDLER( tmpz84c011_1_pb_r )
543{
544   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return (tmpz84c011_pio_r(space,6) & ~state->pio_dir[6]) | (state->pio_latch[6] & state->pio_dir[6]);
545}
458546
459static READ8_HANDLER( tmpz84c011_1_dir_pa_r )   { return pio_dir[5]; }
460static READ8_HANDLER( tmpz84c011_1_dir_pb_r )   { return pio_dir[6]; }
461static READ8_HANDLER( tmpz84c011_1_dir_pc_r )   { return pio_dir[7]; }
462static READ8_HANDLER( tmpz84c011_1_dir_pd_r )   { return pio_dir[8]; }
463static READ8_HANDLER( tmpz84c011_1_dir_pe_r )   { return pio_dir[9]; }
547static READ8_HANDLER( tmpz84c011_1_pc_r )
548{
549   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return (tmpz84c011_pio_r(space,7) & ~state->pio_dir[7]) | (state->pio_latch[7] & state->pio_dir[7]);
550}
464551
465static WRITE8_HANDLER( tmpz84c011_1_dir_pa_w )   { pio_dir[5] = data; }
466static WRITE8_HANDLER( tmpz84c011_1_dir_pb_w )   { pio_dir[6] = data; }
467static WRITE8_HANDLER( tmpz84c011_1_dir_pc_w )   { pio_dir[7] = data; }
468static WRITE8_HANDLER( tmpz84c011_1_dir_pd_w )   { pio_dir[8] = data; }
469static WRITE8_HANDLER( tmpz84c011_1_dir_pe_w )   { pio_dir[9] = data; }
552static READ8_HANDLER( tmpz84c011_1_pd_r )
553{
554   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return (tmpz84c011_pio_r(space,8) & ~state->pio_dir[8]) | (state->pio_latch[8] & state->pio_dir[8]);
555}
470556
557static READ8_HANDLER( tmpz84c011_1_pe_r )
558{
559   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return (tmpz84c011_pio_r(space,9) & ~state->pio_dir[9]) | (state->pio_latch[9] & state->pio_dir[9]);
560}
561
562
563static WRITE8_HANDLER( tmpz84c011_1_pa_w )
564{
565   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
566   state->pio_latch[5] = data;
567   tmpz84c011_pio_w(space, 5, data);
568}
569
570static WRITE8_HANDLER( tmpz84c011_1_pb_w )
571{
572   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
573   state->pio_latch[6] = data;
574   tmpz84c011_pio_w(space, 6, data);
575}
576
577static WRITE8_HANDLER( tmpz84c011_1_pc_w )
578{
579   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
580   state->pio_latch[7] = data;
581   tmpz84c011_pio_w(space, 7, data);
582}
583
584static WRITE8_HANDLER( tmpz84c011_1_pd_w )
585{
586   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
587   state->pio_latch[8] = data;
588   tmpz84c011_pio_w(space, 8, data);
589}
590
591static WRITE8_HANDLER( tmpz84c011_1_pe_w )
592{
593   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
594   state->pio_latch[9] = data;
595   tmpz84c011_pio_w(space, 9, data);
596}
597
598
599static READ8_HANDLER( tmpz84c011_1_dir_pa_r )
600{
601   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return state->pio_dir[5];
602}
603
604static READ8_HANDLER( tmpz84c011_1_dir_pb_r )
605{
606   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return state->pio_dir[6];
607}
608
609static READ8_HANDLER( tmpz84c011_1_dir_pc_r )
610{
611   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return state->pio_dir[7];
612}
613
614static READ8_HANDLER( tmpz84c011_1_dir_pd_r )
615{
616   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return state->pio_dir[8];
617}
618
619static READ8_HANDLER( tmpz84c011_1_dir_pe_r )
620{
621   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>(); return state->pio_dir[9];
622}
623
624
625static WRITE8_HANDLER( tmpz84c011_1_dir_pa_w )
626{
627   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
628   state->pio_dir[5] = data;
629}
630
631static WRITE8_HANDLER( tmpz84c011_1_dir_pb_w )
632{
633   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
634   state->pio_dir[6] = data;
635}
636
637static WRITE8_HANDLER( tmpz84c011_1_dir_pc_w )
638{
639   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
640   state->pio_dir[7] = data;
641}
642
643static WRITE8_HANDLER( tmpz84c011_1_dir_pd_w )
644{
645   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
646   state->pio_dir[8] = data;
647}
648
649static WRITE8_HANDLER( tmpz84c011_1_dir_pe_w )
650{
651   nbmj9195_state *state = space->machine->driver_data<nbmj9195_state>();
652   state->pio_dir[9] = data;
653}
654
471655/* CTC of main cpu, ch0 trigger is vblank */
472656static INTERRUPT_GEN( ctc0_trg1 )
473657{
r10613r10614
496680
497681static MACHINE_RESET( sailorws )
498682{
683   nbmj9195_state *state = machine->driver_data<nbmj9195_state>();
499684   address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
500685   int i;
501686
502687   // initialize TMPZ84C011 PIO
503688   for (i = 0; i < (5 * 2); i++)
504689   {
505      pio_dir[i] = pio_latch[i] = 0;
690      state->pio_dir[i] = state->pio_latch[i] = 0;
506691      tmpz84c011_pio_w(space, i, 0);
507692   }
508693}
r10613r10614
536721static ADDRESS_MAP_START( sailorws_map, ADDRESS_SPACE_PROGRAM, 8 )
537722   AM_RANGE(0x0000, 0xefff) AM_ROM
538723   AM_RANGE(0xf000, 0xf1ff) AM_READWRITE(nbmj9195_palette_r,nbmj9195_palette_w)
539   AM_RANGE(0xf800, 0xffff) AM_RAM AM_BASE(&nbmj9195_nvram) AM_SIZE(&nbmj9195_nvram_size)
724   AM_RANGE(0xf800, 0xffff) AM_RAM AM_BASE_MEMBER(nbmj9195_state, nvram) AM_SIZE_MEMBER(nbmj9195_state, nvram_size)
540725ADDRESS_MAP_END
541726
542727static ADDRESS_MAP_START( mjuraden_map, ADDRESS_SPACE_PROGRAM, 8 )
r10613r10614
548733static ADDRESS_MAP_START( koinomp_map, ADDRESS_SPACE_PROGRAM, 8 )
549734   AM_RANGE(0x0000, 0xdfff) AM_ROM
550735   AM_RANGE(0xe000, 0xe1ff) AM_READWRITE(nbmj9195_palette_r,nbmj9195_palette_w)
551   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(&nbmj9195_nvram) AM_SIZE(&nbmj9195_nvram_size)
736   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(nbmj9195_state, nvram) AM_SIZE_MEMBER(nbmj9195_state, nvram_size)
552737ADDRESS_MAP_END
553738
554739static ADDRESS_MAP_START( ngpgal_map, ADDRESS_SPACE_PROGRAM, 8 )
r10613r10614
29113096};
29123097
29133098
2914static MACHINE_CONFIG_START( NBMJDRV1, driver_device )
3099static MACHINE_CONFIG_START( NBMJDRV1, nbmj9195_state )
29153100
29163101   /* basic machine hardware */
29173102   MCFG_CPU_ADD("maincpu", Z80, 12000000/2)      /* TMPZ84C011, 6.00 MHz */
src/mame/drivers/csplayh5.c
r10613r10614
2525#include "machine/nvram.h"
2626#include "cpu/h83002/h8.h"
2727
28static bitmap_t *vdp0_bitmap;
2928
29class csplayh5_state : public driver_device
30{
31public:
32   csplayh5_state(running_machine &machine, const driver_device_config_base &config)
33      : driver_device(machine, config) { }
34
35   bitmap_t *vdp0_bitmap;
36   UINT16 mux_data;
37   UINT8 pio_dir[5];
38   UINT8 pio_latch[5];
39};
40
41
42
3043#define USE_H8 0
3144
3245// from MSX2 driver, may be not accurate for this HW
r10613r10614
4558
4659static VIDEO_START( csplayh5 )
4760{
48   vdp0_bitmap = machine->primary_screen->alloc_compatible_bitmap();
49   v9938_init (machine, 0, *machine->primary_screen, vdp0_bitmap, MODEL_V9958, 0x20000, csplayh5_vdp0_interrupt);
61   csplayh5_state *state = machine->driver_data<csplayh5_state>();
62   state->vdp0_bitmap = machine->primary_screen->alloc_compatible_bitmap();
63   v9938_init (machine, 0, *machine->primary_screen, state->vdp0_bitmap, MODEL_V9958, 0x20000, csplayh5_vdp0_interrupt);
5064   v9938_reset(0);
5165}
5266
5367static SCREEN_UPDATE( csplayh5 )
5468{
69   csplayh5_state *state = screen->machine->driver_data<csplayh5_state>();
5570   bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
5671
57   copybitmap(bitmap, vdp0_bitmap, 0, 0, 0, 0, cliprect);
72   copybitmap(bitmap, state->vdp0_bitmap, 0, 0, 0, 0, cliprect);
5873
5974   return 0;
6075}
6176
62static UINT16 mux_data;
6377
6478static READ16_HANDLER( csplayh5_mux_r )
6579{
66   switch(mux_data)
80   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
81   switch(state->mux_data)
6782   {
6883      case 0x01: return input_port_read(space->machine, "KEY0");
6984      case 0x02: return input_port_read(space->machine, "KEY1");
r10613r10614
7792
7893static WRITE16_HANDLER( csplayh5_mux_w )
7994{
80   mux_data = (~data & 0x1f);
95   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
96   state->mux_data = (~data & 0x1f);
8197}
8298
8399static WRITE16_HANDLER( csplayh5_sound_w )
r10613r10614
133149*/
134150
135151/* TMPZ84C011 PIO emulation */
136static UINT8 pio_dir[5], pio_latch[5];
137152
138153#define SIGNED_DAC   0      // 0:unsigned DAC, 1:signed DAC
139154#if SIGNED_DAC
r10613r10614
217232
218233
219234/* CPU interface */
220static READ8_HANDLER( tmpz84c011_0_pa_r )   { return (tmpz84c011_pio_r(space,0) & ~pio_dir[0]) | (pio_latch[0] & pio_dir[0]); }
221static READ8_HANDLER( tmpz84c011_0_pb_r )   { return (tmpz84c011_pio_r(space,1) & ~pio_dir[1]) | (pio_latch[1] & pio_dir[1]); }
222static READ8_HANDLER( tmpz84c011_0_pc_r )   { return (tmpz84c011_pio_r(space,2) & ~pio_dir[2]) | (pio_latch[2] & pio_dir[2]); }
223static READ8_HANDLER( tmpz84c011_0_pd_r )   { return (tmpz84c011_pio_r(space,3) & ~pio_dir[3]) | (pio_latch[3] & pio_dir[3]); }
224static READ8_HANDLER( tmpz84c011_0_pe_r )   { return (tmpz84c011_pio_r(space,4) & ~pio_dir[4]) | (pio_latch[4] & pio_dir[4]); }
235static READ8_HANDLER( tmpz84c011_0_pa_r )
236{
237   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
238   return (tmpz84c011_pio_r(space,0) & ~state->pio_dir[0]) | (state->pio_latch[0] & state->pio_dir[0]);
239}
225240
226static WRITE8_HANDLER( tmpz84c011_0_pa_w )   { pio_latch[0] = data; tmpz84c011_pio_w(space, 0, data); }
227static WRITE8_HANDLER( tmpz84c011_0_pb_w )   { pio_latch[1] = data; tmpz84c011_pio_w(space, 1, data); }
228static WRITE8_HANDLER( tmpz84c011_0_pc_w )   { pio_latch[2] = data; tmpz84c011_pio_w(space, 2, data); }
229static WRITE8_HANDLER( tmpz84c011_0_pd_w )   { pio_latch[3] = data; tmpz84c011_pio_w(space, 3, data); }
230static WRITE8_HANDLER( tmpz84c011_0_pe_w )   { pio_latch[4] = data; tmpz84c011_pio_w(space, 4, data); }
241static READ8_HANDLER( tmpz84c011_0_pb_r )
242{
243   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
244   return (tmpz84c011_pio_r(space,1) & ~state->pio_dir[1]) | (state->pio_latch[1] & state->pio_dir[1]);
245}
231246
232static READ8_HANDLER( tmpz84c011_0_dir_pa_r )   { return pio_dir[0]; }
233static READ8_HANDLER( tmpz84c011_0_dir_pb_r )   { return pio_dir[1]; }
234static READ8_HANDLER( tmpz84c011_0_dir_pc_r )   { return pio_dir[2]; }
235static READ8_HANDLER( tmpz84c011_0_dir_pd_r )   { return pio_dir[3]; }
236static READ8_HANDLER( tmpz84c011_0_dir_pe_r )   { return pio_dir[4]; }
247static READ8_HANDLER( tmpz84c011_0_pc_r )
248{
249   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
250   return (tmpz84c011_pio_r(space,2) & ~state->pio_dir[2]) | (state->pio_latch[2] & state->pio_dir[2]);
251}
237252
238static WRITE8_HANDLER( tmpz84c011_0_dir_pa_w )   { pio_dir[0] = data; }
239static WRITE8_HANDLER( tmpz84c011_0_dir_pb_w )   { pio_dir[1] = data; }
240static WRITE8_HANDLER( tmpz84c011_0_dir_pc_w )   { pio_dir[2] = data; }
241static WRITE8_HANDLER( tmpz84c011_0_dir_pd_w )   { pio_dir[3] = data; }
242static WRITE8_HANDLER( tmpz84c011_0_dir_pe_w )   { pio_dir[4] = data; }
253static READ8_HANDLER( tmpz84c011_0_pd_r )
254{
255   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
256   return (tmpz84c011_pio_r(space,3) & ~state->pio_dir[3]) | (state->pio_latch[3] & state->pio_dir[3]);
257}
243258
259static READ8_HANDLER( tmpz84c011_0_pe_r )
260{
261   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
262   return (tmpz84c011_pio_r(space,4) & ~state->pio_dir[4]) | (state->pio_latch[4] & state->pio_dir[4]);
263}
264
265static WRITE8_HANDLER( tmpz84c011_0_pa_w )
266{
267   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
268   state->pio_latch[0] = data;
269   tmpz84c011_pio_w(space, 0, data);
270}
271
272static WRITE8_HANDLER( tmpz84c011_0_pb_w )
273{
274   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
275   state->pio_latch[1] = data;
276   tmpz84c011_pio_w(space, 1, data);
277}
278
279static WRITE8_HANDLER( tmpz84c011_0_pc_w )
280{
281   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
282   state->pio_latch[2] = data;
283   tmpz84c011_pio_w(space, 2, data);
284}
285
286static WRITE8_HANDLER( tmpz84c011_0_pd_w )
287{
288   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
289   state->pio_latch[3] = data;
290   tmpz84c011_pio_w(space, 3, data);
291}
292
293static WRITE8_HANDLER( tmpz84c011_0_pe_w )
294{
295   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
296   state->pio_latch[4] = data;
297   tmpz84c011_pio_w(space, 4, data);
298}
299
300
301static READ8_HANDLER( tmpz84c011_0_dir_pa_r )
302{
303   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
304   return state->pio_dir[0];
305}
306
307static READ8_HANDLER( tmpz84c011_0_dir_pb_r )
308{
309   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
310   return state->pio_dir[1];
311}
312
313static READ8_HANDLER( tmpz84c011_0_dir_pc_r )
314{
315   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
316   return state->pio_dir[2];
317}
318
319static READ8_HANDLER( tmpz84c011_0_dir_pd_r )
320{
321   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
322   return state->pio_dir[3];
323}
324
325static READ8_HANDLER( tmpz84c011_0_dir_pe_r )
326{
327   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
328   return state->pio_dir[4];
329}
330
331
332static WRITE8_HANDLER( tmpz84c011_0_dir_pa_w )
333{
334   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
335   state->pio_dir[0] = data;
336}
337
338static WRITE8_HANDLER( tmpz84c011_0_dir_pb_w )
339{
340   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
341   state->pio_dir[1] = data;
342}
343
344static WRITE8_HANDLER( tmpz84c011_0_dir_pc_w )
345{
346   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
347   state->pio_dir[2] = data;
348}
349
350static WRITE8_HANDLER( tmpz84c011_0_dir_pd_w )
351{
352   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
353   state->pio_dir[3] = data;
354}
355
356static WRITE8_HANDLER( tmpz84c011_0_dir_pe_w )
357{
358   csplayh5_state *state = space->machine->driver_data<csplayh5_state>();
359   state->pio_dir[4] = data;
360}
361
362
244363static ADDRESS_MAP_START( csplayh5_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
245364   AM_RANGE(0x0000, 0x77ff) AM_ROM
246365   AM_RANGE(0x7800, 0x7fff) AM_RAM
r10613r10614
467586
468587static MACHINE_RESET( csplayh5 )
469588{
589   csplayh5_state *state = machine->driver_data<csplayh5_state>();
470590   address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
471591   int i;
472592
473593   // initialize TMPZ84C011 PIO
474594   for (i = 0; i < 5; i++)
475595   {
476      pio_dir[i] = pio_latch[i] = 0;
596      state->pio_dir[i] = state->pio_latch[i] = 0;
477597      tmpz84c011_pio_w(space, i, 0);
478598   }
479599}
r10613r10614
497617};
498618
499619
500static MACHINE_CONFIG_START( csplayh5, driver_device )
620static MACHINE_CONFIG_START( csplayh5, csplayh5_state )
501621
502622   /* basic machine hardware */
503623   MCFG_CPU_ADD("maincpu",M68000,16000000) /* TMP68301-16 */
src/mame/drivers/hornet.c
r10613r10614
10511051   MCFG_SCREEN_REFRESH_RATE(60)
10521052   MCFG_SCREEN_SIZE(512, 384)
10531053   MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
1054   MCFG_SCREEN_UPDATE(hornet_2board)   
1054   MCFG_SCREEN_UPDATE(hornet_2board)
10551055
10561056   MCFG_SCREEN_ADD("rscreen", RASTER)
10571057   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
10581058   MCFG_SCREEN_REFRESH_RATE(60)
10591059   MCFG_SCREEN_SIZE(512, 384)
10601060   MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
1061   MCFG_SCREEN_UPDATE(hornet_2board)   
1061   MCFG_SCREEN_UPDATE(hornet_2board)
10621062MACHINE_CONFIG_END
10631063
10641064static MACHINE_CONFIG_DERIVED( terabrst, hornet_2board )
src/mame/drivers/ddragon3.c
r10613r10614
640640
641641   MCFG_CPU_MODIFY("audiocpu")
642642   MCFG_CPU_PROGRAM_MAP(ctribe_sound_map)
643   
643
644644   MCFG_SCREEN_MODIFY("screen")
645645   MCFG_SCREEN_UPDATE(ctribe)
646646
src/mame/drivers/seta2.c
r10613r10614
66
77
88CPU    :    TMP68301*
9            ColdFire & H8/3007 (for FUNCUBE)
9            ColdFire + H8/3007 + PIC12C508 (for FUNCUBE)
1010
11Custom :    X1-010              Sound: 8 Bit PCM
12            DX-101              Sprites
11Video  :    DX-101
1312            DX-102 x3
1413
15OSC:    50.00000MHz
16        32.53047MHz
14Sound  :    X1-010
1715
16OSC    :    50.00000MHz
17            32.53047MHz
18
1819*   The Toshiba TMP68301 is a 68HC000 + serial I/O, parallel I/O,
1920    3 timers, address decoder, wait generator, interrupt controller,
2021    all integrated in a single chip.
r10613r10614
3536B0-006B                 2001    Funcube 4                               Namco
3637B0-010A                 2001    Wing Shooting Championship              Sammy
3738B0-010A                 2002    Trophy Hunting - Bear & Moose           Sammy
39-                       ????    Reel'N Quake                            <unknown>
3840-------------------------------------------------------------------------------------------
3941
4042TODO:
r10613r10614
4244- Proper emulation of the TMP68301 CPU, in a core file.
4345- Proper emulation of the ColdFire CPU, in a core file.
4446- Flip screen / Zooming support.
45- Fix some graphics imperfections (e.g. color depth selection,
46  "tilemap" sprites) [all done? - NS]
47- Fix some graphics imperfections (e.g. color depth selection, "tilemap" sprites) [all done? - NS]
4748- I added a kludge involving a -0x10 yoffset, this fixes the lifeline in myangel.
4849  I didn't find a better way to do it without breaking pzlbowl's title screen.
4950
r10613r10614
5758  that's how the palette is preinitialized by MAME, but the game never sets up those
5859  palette entries. The game selects color depth "1", whose meaning is uncertain, and
5960  color code 0 so I see no way to point to a different section of palette RAM.
60
6161- there are glitches in the bg horizontal scroll in the wedding sequence at the end of
6262  the game. It looks like "scrollx" should be delayed one frame wrt "xoffs".
63- there's a 4 pixel gap at the top of the title screen since clipping was reimplemented.
6364
6465myangel2:
6566- before each level, the background image is shown with completely wrong colors. It
r10613r10614
6869grdians:
6970- the map screen after the character selection needs zooming. There is a global
7071  zoom register that should affect the background map and the level picture but
71  not the frontmost frame. This latter should use color 7ff (the last one)
72  and ignore the individual color codes in the tiles data. Zooming is also
73  used briefly in pengbros.
72  not the frontmost frame. This latter should use color 7ff (the last one) and
73  ignore the individual color codes in the tiles data. Note: the frontmost frame
74  has the shadow bit set, and has become invisible after implementing it.
7475
76pengbros:
77- Zooming is used briefly.
78
7579deerhunt,wschamp:
76- offset tilemap sprite during demo
80- offset tilemap sprite during demo. In deerhunt intro, the hunter should zoom
81  in to the deer. In wschamp intro the GPS unit should zoom to the high scores.
7782
7883trophyh:
7984- mame hangs for around 15 seconds every now and then, at scene changes.
r10613r10614
8489- Hacked to run, as they use a ColdFire CPU.
8590- Pay-out key causes "unknown error".
8691
87***************************************************************************/
92reelquak:
93- Needs an x offset for tilemap sprites.
94- There are one frame glitches in the reels scroll.
8895
89/***************************************************************************
90
91MS Gundam Ex Revue
92Banpresto, 1994
93
94This game runs on Seta/Allumer hardware
95
96PCB Layout
97----------
98
99PO-113A   BP949KA
100|----------------------------------|
101|  X1-010  6264  U28               |
102|                     581001   U19 |
103|     U3  U5  U2  U4  581001   U17 |
104|      62256   62256           U15 |
105|J                             U20 |
106|A    U77  68301               U18 |
107|M                     *       U16 |
108|M    93C46                    U23 |
109|A                             U22 |
110|                              U21 |
111|  DSW1            50MHz           |
112|  DSW2       PAL  32.5304MHz      |
113|       20MHz PAL                  |
114|----------------------------------|
115
116Notes:
117      *: unknown QFP208 (has large heatsink on it). Should be similar to other known
118         graphics chips used on Seta hardware of this era.
119      68301 clock: 16.000MHz (?? From what OSC + divider??)
120      VSync: 60Hz
121
12296***************************************************************************/
12397
124/***************************************************************************
125
126Guardians
127Banpresto, 1995
128
129This hardware is not common Banpresto hardware. Possibly licensed
130to them from another manufacturer? Or an early design that they decided
131not to use for future games? Either way, this game is _extremely_ rare :-)
132
133PCB Layout
134----------
135
136P-FG01-1
137------------------------------------------------------
138|        X1-010 6264          U32 CXK581000          |
139|                                 CXK581000      U16 |
140|                                                    |
141|                                                U20 |
142|    U3 U5 U2 U4 62256 CXK58257                      |
143|                62256 CXK58257                  U15 |
144|                                                    |
145|J                                               U19 |
146|A    TMP68301AF-16                                  |
147|M                                               U18 |
148|M                           NEC                     |
149|A          NEC              DX-101              U22 |
150|           DX-102                                   |
151|                                                U17 |
152|                   PAL   50MHz                      |
153|                                                U21 |
154|           DSW1(8)                                  |
155|           DSW2(8)                   CXK58257 NEC   |
156|                                     CXK58257 DX-102|
157------------------------------------------------------
158
159Notes:
160      HSync: 15.23kHz
161      VSync: 58.5Hz
162
163***************************************************************************/
164
165/***************************************************************************
166
167                            Penguin Brothers (Japan)
168
169(c)2000 Subsino
170
171   CPU: Toshiba TMP68301AF-16 (100 Pin PQFP)
172 Video: NEC DX-101 (240 Pin PQFP)
173        NEC DX-102 (52 Pin PQFP x3)
174 Sound: X1-010 (Mitsubishi M60016 Gate Array, 80 Pin PQFP)
175   OSC: 50MHz, 32.53047MHz & 28MHz
176 Other: 8 Position Dipswitch x 2
177        Lattice ispLSI2032
178
179PCB Number: P0-142A
180+-----------------------------------------------------------+
181|                VOL                       +------+         |
182|                                          |Seta  |     M1  |
183|   +---+ +---+                            |X1-010|         |
184|   |   | |   |   M   M                    |      |  +---+  |
185+-+ | U | | U |   1   1                    +------+  |   |  |
186  | | 0 | | 0 |                    74HC00            |   |  |
187+-+ | 7 | | 6 |   M   M                              | U |  |
188|   |   | |   |   1   1                              | 1 |  |
189|   +---+ +---+                                      | 8 |  |
190|                                          Lattice   |   |  |
191|J  D D  +---+                            ispLSI2032 |   |  |
192|A  S S  |DX |                  +-------+            +---+  |
193|M  W W  |102|                  |Toshiba|     CN2           |
194|M  1 2  +---+      BAT1*       |  TMP  |                   |
195|A                              | 68301 |  U50*             |
196|                               +-------+                   |
197|C                                                          |
198|o                 50MHz        +----------+     28MHz      |
199|n    +---+                     |          |                |
200|n    |DX |     SW1             |   NEC    |    M   M       |
201|e    |102|                     |  DX-101  |    2   2       |
202|c    +---+         M  M        |          |                |
203|t                  1  1        |          |                |
204|e                              +----------+                |
205|r                                                          |
206|                             +---+      +---++---++---+    |
207|                             |   |      |   ||   ||   |    |
208|     +---+                   |   |      |   ||   ||   |    |
209+-+   |DX |                   | U |      | U || U || U |    |
210  |   |102|     32.53047MHz   | 4 |      | 4 || 3 || 3 |    |
211+-+   +---+                   | 0 |      | 1 || 8 || 9 |    |
212|                             |   |      |   ||   ||   |    |
213|                             |   |      |   ||   ||   |    |
214|                             +---+      +---++---++---+    |
215+-----------------------------------------------------------+
216
217Notes:  pzlbowl PCB with these extra parts:
218        28MHz OSC
219        2x 62256 SRAM
220        74HC00
221
222U50*  Unpopulated 93LC46BX EEPROM
223BAT1* Unpopulated CR2032 3Volt battery
224
225Ram M1 are NEC D43001GU-70LL
226Ram M2 are LGS GM76C8128ALLFW70
227
228***************************************************************************/
229
230/***************************************************************************
231
232                            Puzzle De Bowling (Japan)
233
234(c)1999 Nihon System / Moss
235
236   CPU: Toshiba TMP68301AF-16 (100 Pin PQFP)
237 Video: NEC DX-101 (240 Pin PQFP)
238        NEC DX-102 (52 Pin PQFP x3)
239 Sound: X1-010 (Mitsubishi M60016 Gate Array, 80 Pin PQFP)
240   OSC: 50MHz & 32.53047MHz
241 Other: 8 Position Dipswitch x 2
242        Lattice ispLSI2032 - stamped "KUDEC"
243
244PCB Number: P0-142A
245+-----------------------------------------------------------+
246|                VOL                       +------+         |
247|                                          |Seta  |     M1  |
248|   +---+ +---+                            |X1-010|         |
249|   |   | |   |  U4*  M                    |      |  +---+  |
250+-+ | U | | U |       1                    +------+  | K |  |
251  | | 0 | | 0 |                     U30*             | U |  |
252+-+ | 7 | | 6 |  U5*  M                              | S |  |
253|   |   | |   |       1                              |   |  |
254|   +---+ +---+                                      | U |  |
255|                                          Lattice   | 1 |  |
256|J  D D  +---+                            ispLSI2032 | 8 |  |
257|A  S S  |DX |                  +-------+            +---+  |
258|M  W W  |102|                  |Toshiba|     CN2           |
259|M  1 2  +---+      BAT1*       |  TMP  |                   |
260|A                              | 68301 |  U50*             |
261|                               +-------+                   |
262|C                                                          |
263|o                 50MHz        +----------+     XM2*       |
264|n    +---+                     |          |                |
265|n    |DX |     SW1             |   NEC    |    M   M       |
266|e    |102|                     |  DX-101  |    2   2       |
267|c    +---+         M  M        |          |                |
268|t                  1  1        |          |                |
269|e                              +----------+                |
270|r                                                          |
271|                             +---+      +---++---++---+    |
272|                             | K |      | K || K || K |    |
273|     +---+                   | U |      | U || U || U |    |
274+-+   |DX |                   | C |      | C || C || C |    |
275  |   |102|     32.53047MHz   |   |      |   ||   ||   |    |
276+-+   +---+                   | U |      | U || U || U |    |
277|                             | 4 |      | 4 || 3 || 3 |    |
278|                             | 0 |      | 1 || 8 || 9 |    |
279|                             +---+      +---++---++---+    |
280+-----------------------------------------------------------+
281
282* Unpopulated:
283  U4 & U5 RAM HM62256 equivalent
284  U50 93LC46BX EEPROM
285  U30 74HC00
286  BAT1 CR2032 3Volt battery
287  XM2 OSC
288
289Ram M1 are NEC D43001GU-70LL
290Ram M2 are LGS GM76C8128ALLFW70
291
292KUP-U06-I03 U06 Program rom ST27C4001 (even)
293KUP-U07-I03 U07 Program rom ST27C4001 (odd)
294
295KUS-U18-I00 U18 Mask rom (Samples 23C32000 32Mbit)
296
297KUC-U38-I00 U38 Mask rom (Graphics 23C32000 32Mbit)
298KUC-U39-I00 U39 Mask rom (Graphics 23C32000 32Mbit)
299KUC-U40-I00 U40 Mask rom (Graphics 23C32000 32Mbit)
300KUC-U41-I00 U41 Mask rom (Graphics 23C32000 32Mbit)
301
302***************************************************************************/
303
304/***************************************************************************
305
306Sammy USA Outdoor Shooting Series PCB
307
308PCB B0-003A (or B0-003B):
309   Deer Hunting USA (c) 2000 Sammy USA
310   Turkey Hunting USA (c) 2001 Sammy USA
311
312PCB B0-010A:
313   Wing Shooting Championship (c) 2001 Sammy USA
314   Trophy Hunting - Bear & Moose (c) 2002 Sammy USA
315
316
317   CPU: Toshiba TMP68301AF-16 (100 Pin PQFP)
318 Video: NEC DX-101 (240 Pin PQFP)
319        NEC DX-102 (52 Pin PQFP x3)
320 Sound: X1-010 (Mitsubishi M60016 Gate Array, 80 Pin PQFP)
321EEPROM: 93LC46BX (1K Low-power 64 x 16-bit organization serial EEPROM)
322   OSC: 50MHz & 28MHz
323 Other: 8 Position Dipswitch x 2
324        Lattice ispLSI2032 - stamped "KW001"
325        Lattice isp1016E - stamped "GUN" (2 for PCB B0-010A, used for light gun input)
326        BAT1 - CR2032 3Volt
327
328PCB Number: B0-003A (or B0-003B)
329+-----------------------------------------------------------+
330|             VOL                          +------+         |
331|                                          |X1-010|     M1  |
332|   +---+ +---+                            |M60016|         |
333|   |   | |   |  M    M                    |CALRUA|  +---+  |
334+-+ | U | | U |  2    1                    +------+  |   |  |
335  | | 0 | | 0 |                                      |   |  |
336+-+ | 7 | | 6 |  M    M                              | U |  |
337|   |   | |   |  2    1                              | 1 |  |
338|   +---+ +---+                                      | 8 |  |
339|                                          Lattice   |   |  |
340|J  D +---+  C                            ispLSI2032 |   |  |
341|A  S |DX |  N   BAT1           +-------+            +---+  |
342|M  W |102|  5                  |Toshiba|  D                |
343|M  1 +---+                     |  TMP  |  S EEPROM       C |
344|A           C                  | 68301 |  W              N |
345|            N  Lattice         +-------+  2              2 |
346|C           6  isp1016E                                    |
347|o                              +----------+    50MHz       |
348|n    +---+                     |          |                |
349|n    |DX |  SW1                |   NEC    |    M   M       |
350|e    |102|                     |  DX-101  |    3   3       |
351|c    +---+         M  M        |          |                |
352|t                  1  1        |          |                |
353|e                              +----------+                |
354|r                                                          |
355|                             +---+      +---++---++---+    |
356|                  28MHz      |   |      |   ||   ||   |    |
357|     +---+                   |   |      |   ||   ||   |    |
358+-+   |DX |                   | U |      | U || U || U |    |
359  |   |102|                   | 4 |      | 4 || 3 || 3 |    |
360+-+   +---+                   | 0 |      | 1 || 8 || 9 |    |
361|                             |   |      |   ||   ||   |    |
362|                             |   |      |   ||   ||   |    |
363|                             +---+      +---++---++---+    |
364+-----------------------------------------------------------+
365
366PCB Number: B0-010A - This PCB is slightly revised for 2 player play
367+-----------------------------------------------------------+
368|             VOL                          +------+         |
369|                                          |X1-010|     M1  |
370|   +---+ +---+                            |M60016|         |
371|   |   | |   |  M    M                    |CALRUA|  +---+  |
372+-+ | U | | U |  2    1                    +------+  |   |  |
373  | | 0 | | 0 |                                      |   |  |
374+-+ | 7 | | 6 |  M    M                              | U |  |
375|   |   | |   |  2    1                              | 1 |  |
376|   +---+ +---+                                      | 8 |  |
377|                                          Lattice   |   |  |
378|J  D +---+  C                            ispLSI2032 |   |  |
379|A  S |DX |  N   BAT1           +-------+            +---+  |
380|M  W |102|  5                  |Toshiba|  D                |
381|M  1 +---+                     |  TMP  |  S EEPROM       C |
382|A           C                  | 68301 |  W              N |
383|            N  Lattice         +-------+  2              2 |
384|C           6  isp1016E                                    |
385|o                              +----------+    50MHz       |
386|n    +---+                     |          |                |
387|n    |DX |  SW1                |   NEC    |    M   M       |
388|e    |102|                     |  DX-101  |    3   3       |
389|c    +---+         M  M        |          |                |
390|t                  1  1        |          |                |
391|e                              +----------+                |
392|r                                                          |
393|                             +---+      +---++---++---+    |
394|                  28MHz      |   |      |   ||   ||   |    |
395|     +---+              C    |   |      |   ||   ||   |    |
396+-+   |DX |              N    | U |      | U || U || U |    |
397  |   |102|              7    | 4 |      | 4 || 3 || 3 |    |
398+-+   +---+                   | 0 |      | 1 || 8 || 9 |    |
399|             Lattice    C    |   |      |   ||   ||   |    |
400|             isp1016E   N    |   |      |   ||   ||   |    |
401|                        8    +---+      +---++---++---+    |
402+-----------------------------------------------------------+
403
404Ram M1 are Toshiba TC55257DFL-70L
405Ram M2 are NEC D43001GU-70L
406Ram M3 are ISSI IS62C1024L-70Q
407
408U06 Program rom ST27C801 (even)
409U07 Program rom ST27C801 (odd)
410
411U18 Mask rom (Samples 23C32000 32Mbit (read as 27C322))
412
413U38 - U40 Mask roms (Graphics 23c64020 64Mbit) - 23C64020 read as 27C322 with pin11 +5v & 27C322 with pin11 GND
414
415--------------------------------------------------------------------------
416
417From the WSC upgrade instruction sheet:
418
419 Wing Shooting Championship
420      Game Echancement
421          1/23/02
422
423New Program chip Ver. 2.00 For Wing Shooting Championship
424We are announcing NEW GAME FEATURES to enhance game play. Please refer below.
425
426NEW FEATURES
427------------
428
429 * Easier play for the first 3 hunting spots in every state with the addition of more birds.
430 * The "BEGINNER" weapon has been changed to the 5-shot PUMP SHOTGUN plus the "hit area"
431    for each shot has been increased. Same as the 3-shot SEMI-AUTO SHOTGUN.
432 * Player can now advance through all result screens faster by pulling gun trigger.
433 * The Auto Select bird is now GOOSE (easiest target) if player fails to choose bird at start of game.
434
435***************************************************************************/
436
437/***************************************************************************
438
439               FUNCUBE (BET) Series, includes 2 through 5?
440
441PCB Number: B0-006B (also known as EVA3_A system and is non-JAMMA)
442+------------------------------------------------+
443|+--+ S +---+ +---+                CN5           |
444||  | W |   | |   |                          CN6?|
445||  | 4 | U | | U |                              |
446||  |   | 4 | | 4 |     +---+                CN2?|
447||  |   | 2 | | 3 |     |DX |                    |
448||  |   |   | |   |     |102|                    |
449||C |   |   | |   |     +---+                    |
450||N |   +---+ +---+                              |
451||4 |                                            |
452||  |      +----------+   M1                     |
453||  |  M3  |          |                        C |
454||  |      |   NEC    |   M1                   N |
455||  |  M3  |  DX-101  |                        3 |
456||  |      |          |                          |
457||  |      |          |   50MHz                  |
458|+--+      +----------+                          |
459| PIC  25.447MHz         +-----------+           |
460|  CN7                   |    U47    |           |
461|                        +-----------+           |
462|          +-----------+  +---+ +---+       D    |
463|          |     U3    |  |OKI| |DX |       S    |
464|    M2    +-----------+  |   | |102|       W    |
465|                         +---+ +---+       1    |
466|                 ispLSI2032                     |
467|    M1                      +---+               |
468|          +----------+      |IDT|           +--+|
469|          |          |  C   |   |           |  ||
470| C        | ColdFire |  N   +---+           |  ||
471| N  M2    | XCF5206E |  8                   |  ||
472| 1        |          |        +---+         |C ||
473|          |          |        |H8 |         |N ||
474|    M1    +----------+        +---+      D  |9 ||
475|                         14.7456MHz      S  |  ||
476|                            +-----------+W  |  ||
477|            SW1      BAT1   |    U49    |2  +--+|
478|                            +-----------+       |
479+------------------------------------------------+
480
481   CPU: ColdFire XCF5206EFT54 (160 Pin PQFP)
482        Hitachi H8/3007 (64130007F20) used for touch screen I/O
483 Video: NEC DX-101 (240 Pin PQFP)
484        NEC DX-102 (52 Pin PQFP x2)
485 Sound: OKI MSM9810B 8-Channel Mixing ADPCM Type Voice Synthesis LSI
486   OSC: 50MHz, 25.447MHz & 14.7456MHz
487 Other: Lattice ispLSI2032 - stamped "EVA3A"
488        BAT1 - CR2032 3Volt
489
490ColdFire XCF5206EFT54:
491  68K/ColdFire V2 core family
492  8K internal SRAM
493  54MHz (max) Bus Frequency
494  32bit External Bus Width
495  2 UART Serial Interfaces
496  2 Timer Channels
497
498PIC - PIC12C508 MCU used for security
499       Labeled FC21A for Funcube 2
500       Labeled FC41A for Funcube 4
501
502Ram M1 are Toshiba TC55257DFL-70L
503Ram M2 are NEC D43001GU-70L
504Ram M3 are ISSI IS62C1024L-70Q
505IDT - IDT 7130 64-pin TQFP High-speed 1K x 8 Dual-Port Static RAM
506
507CN1 - Unused 64 pin double row connecter
508CN2?  2x2 connecter
509CN3 - Unused 50 pin double row connecter
510CN4 - 96 pin triple row connecter
511CN5 - 2x3 pin connecter
512CN6?  3x3 connecter
513CN7 - Unused 20 pin connecter
514CN8 - 8 pin single row connecter
515CN9 - 40 pin double row connecter
516
517DSW1 - 8 position dipswitch
518DSW2 - 2 position dipswitch
519SW1  - Pushbutton
520SW4  - Single position slider switch
521
522U3  - Is a 27C4002 EPROM
523U49 - Is a 27C1001 EPROM
524U42, U43 & U47 are MASK ROMs read as 27C322
525
526The same H8/3007 code "FC21 IOPR-0" at U49 is used for FUNCUBE 2,3,4 & 5
527
528***************************************************************************/
529
53098#include "emu.h"
53199#include "memconv.h"
532100#include "deprecat.h"
101#include "includes/seta2.h"
533102#include "cpu/m68000/m68000.h"
534103#include "machine/tmp68301.h"
535104#include "cpu/h83002/h8.h"
105#include "sound/okim9810.h"
106#include "sound/x1_010.h"
536107#include "machine/eeprom.h"
537#include "sound/x1_010.h"
538#include "sound/okim9810.h"
539#include "includes/seta2.h"
540108#include "machine/nvram.h"
109#include "machine/ticket.h"
541110
542111/***************************************************************************
543112
r10613r10614
818387
819388
820389/***************************************************************************
390                              Reel'N Quake
391***************************************************************************/
392
393static WRITE16_HANDLER( reelquak_leds_w )
394{
395   if (ACCESSING_BITS_0_7)
396   {
397      set_led_status( space->machine, 0, data & 0x0001 );   // start
398      set_led_status( space->machine, 1, data & 0x0002 );   // small
399      set_led_status( space->machine, 2, data & 0x0004 );   // bet
400      set_led_status( space->machine, 3, data & 0x0008 );   // big
401      set_led_status( space->machine, 4, data & 0x0010 );   // double up
402      set_led_status( space->machine, 5, data & 0x0020 );   // collect
403      set_led_status( space->machine, 6, data & 0x0040 );   // bet cancel
404   }
405   if (ACCESSING_BITS_8_15)
406   {
407      ticket_dispenser_w(space->machine->device("ticket"), 0, (data & 0x0100) >> 1);   // ticket dispenser
408   }
409
410//  popmessage("LED %04X", data);
411}
412
413static WRITE16_HANDLER( reelquak_coin_w )
414{
415   if (ACCESSING_BITS_0_7)
416   {
417      coin_counter_w(space->machine, 0, data & 0x01);   // coin in
418      coin_counter_w(space->machine, 1, data & 0x02);   // coin in
419      coin_counter_w(space->machine, 2, data & 0x04);   // pay out
420      coin_counter_w(space->machine, 3, data & 0x08);   // key in
421      //                                data & 0x10); // Sound IRQ Ack.? 1->0
422      //                                data & 0x20); // Vblank IRQ.? 1
423   }
424//  popmessage("COIN %04X", data & 0xffff);
425}
426
427static ADDRESS_MAP_START( reelquak_map, ADDRESS_SPACE_PROGRAM, 16 )
428   AM_RANGE(0x000000, 0x0fffff) AM_ROM                        // ROM
429   AM_RANGE(0x200000, 0x20ffff) AM_RAM                        // RAM
430   AM_RANGE(0x300000, 0x303fff) AM_RAM AM_SHARE("nvram")         // NVRAM (Battery Backed)
431   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
432   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("TICKET")            // Tickets
433   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("SYSTEM")            // Coins
434   AM_RANGE(0x400006, 0x400007) AM_READ(watchdog_reset16_r)      // Watchdog
435   AM_RANGE(0x400200, 0x400201) AM_WRITE(reelquak_coin_w)         // Coin Counters / IRQ Ack
436   AM_RANGE(0x400300, 0x400301) AM_READ_PORT("DSW1")            // DSW 1
437   AM_RANGE(0x400302, 0x400303) AM_READ_PORT("DSW2")            // DSW 2
438   AM_RANGE(0x400300, 0x40030f) AM_WRITE(seta2_sound_bank_w)      // Samples Banks
439   AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("x1snd", seta_sound_word_r,seta_sound_word_w)   // Sound
440   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_BASE_SIZE_MEMBER(seta2_state, spriteram, spriteram_size)      // Sprites
441   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE_GENERIC(paletteram)   // Palette
442   AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_BASE_MEMBER(seta2_state, vregs)            // Video Registers
443   AM_RANGE(0xfffd0a, 0xfffd0b) AM_WRITE( reelquak_leds_w )      // parallel data register (leds)
444   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE(tmp68301_regs_r, tmp68301_regs_w)      // TMP68301 Registers
445ADDRESS_MAP_END
446
447
448/***************************************************************************
821449                            Sammy Outdoor Shooting
822450***************************************************************************/
823451
r10613r10614
18461474
18471475
18481476/***************************************************************************
1477                              Reel'N Quake
1478***************************************************************************/
1479
1480static INPUT_PORTS_START( reelquak )
1481   PORT_START("DSW1")   // $400300.w
1482   PORT_DIPNAME( 0x0001, 0x0001, "Game Style" )
1483   PORT_DIPSETTING(      0x0001, DEF_STR( Standard ) )
1484   PORT_DIPSETTING(      0x0000, "Redemption" )
1485   PORT_DIPNAME( 0x000e, 0x000e, "Key-In Credits" )
1486   PORT_DIPSETTING(      0x000c, "1 Turn / 2 Credits" )
1487   PORT_DIPSETTING(      0x000a, "1 Turn / 3 Credits" )
1488   PORT_DIPSETTING(      0x0008, "1 Turn / 5 Credits" )
1489   PORT_DIPSETTING(      0x000e, "1 Turn / 10 Credits" )
1490   PORT_DIPSETTING(      0x0006, "1 Turn / 20 Credits" )
1491   PORT_DIPSETTING(      0x0004, "1 Turn / 25 Credits" )
1492   PORT_DIPSETTING(      0x0002, "1 Turn / 50 Credits" )
1493   PORT_DIPSETTING(      0x0000, "1 Turn / 100 Credits" )
1494   PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coin_A ) )
1495   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_1C ) )
1496   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_2C ) )
1497   PORT_DIPSETTING(      0x0010, DEF_STR( 1C_5C ) )
1498   PORT_DIPSETTING(      0x0000, "1 Coin/10 Credits" )
1499   PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Coin_B ) )   // bit 7 tested according to game style
1500   PORT_DIPSETTING(      0x00c0, DEF_STR( 1C_1C ) )
1501   PORT_DIPSETTING(      0x0080, DEF_STR( 1C_2C ) )
1502   PORT_DIPSETTING(      0x0040, DEF_STR( 1C_5C ) )
1503   PORT_DIPSETTING(      0x0000, "1 Coin/10 Credits" )
1504
1505   PORT_START("DSW2")   // $400302.w
1506   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )   // used
1507   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
1508   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1509   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
1510   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
1511   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1512   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
1513   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
1514   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1515   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
1516   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
1517   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1518   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
1519   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
1520   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1521   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
1522   PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
1523   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1524   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
1525   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
1526   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1527   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
1528   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
1529   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1530
1531   PORT_START("P1")   // $400001.b
1532   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_POKER_CANCEL  )   // bet cancel
1533   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE   )   // collect
1534   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP   )   // double up
1535   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH   )   // big
1536   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_POKER_BET     )   // bet
1537   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_GAMBLE_LOW    )   // small
1538   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL   )   // start
1539   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN       )
1540
1541   PORT_START("TICKET")   // $400003.b
1542   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SPECIAL       ) PORT_READ_LINE_DEVICE("ticket", ticket_dispenser_line_r)   // ticket sensor
1543   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN       )
1544   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN       )
1545   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )                     // knock down
1546   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE2      ) PORT_NAME("Ticket Clear")   // ticket clear
1547   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE3      ) PORT_NAME("Ticket Resume")   // ticket resume
1548   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN  )                     // key in
1549   PORT_SERVICE_NO_TOGGLE(0x0080, IP_ACTIVE_LOW       )                     // test mode
1550
1551   PORT_START("SYSTEM")   // $400005.b
1552   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1         ) PORT_IMPULSE(5)   // coin a
1553   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2         ) PORT_IMPULSE(5)   // coin b
1554   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1      )               // service
1555   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK   )               // diagnostic
1556   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN       )
1557   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN       )
1558   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN       )
1559   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN       )
1560INPUT_PORTS_END
1561
1562
1563/***************************************************************************
18491564                            Sammy Outdoor Shooting
18501565***************************************************************************/
18511566
r10613r10614
21791894/*  Tiles are 8bpp, but the hardware is additionally able to discard
21801895    some bitplanes and use the low 4 bits only, or the high 4 bits only */
21811896static GFXDECODE_START( seta2 )
2182   GFXDECODE_ENTRY( "gfx1", 0, layout_4bpp_lo, 0, 0x8000/16 )
2183   GFXDECODE_ENTRY( "gfx1", 0, layout_4bpp_hi, 0, 0x8000/16 )
2184   GFXDECODE_ENTRY( "gfx1", 0, layout_6bpp,    0, 0x8000/16 )   /* 6bpp, but 4bpp granularity */
2185   GFXDECODE_ENTRY( "gfx1", 0, layout_8bpp,    0, 0x8000/16 )   /* 8bpp, but 4bpp granularity */
2186   GFXDECODE_ENTRY( "gfx1", 0, layout_3bpp_lo, 0, 0x8000/16 )   /* 3bpp, but 4bpp granularity */
2187   GFXDECODE_ENTRY( "gfx1", 0, layout_2bpp_hi, 0, 0x8000/16 )   /* ??? */
1897   GFXDECODE_ENTRY( "sprites", 0, layout_4bpp_lo, 0, 0x8000/16 )
1898   GFXDECODE_ENTRY( "sprites", 0, layout_4bpp_hi, 0, 0x8000/16 )
1899   GFXDECODE_ENTRY( "sprites", 0, layout_6bpp,    0, 0x8000/16 )   // 6bpp, but 4bpp color granularity
1900   GFXDECODE_ENTRY( "sprites", 0, layout_8bpp,    0, 0x8000/16 )   // 8bpp, but 4bpp color granularity
1901   GFXDECODE_ENTRY( "sprites", 0, layout_3bpp_lo, 0, 0x8000/16 )   // 3bpp, but 4bpp color granularity
1902   GFXDECODE_ENTRY( "sprites", 0, layout_2bpp_hi, 0, 0x8000/16 )   // 2bpp, but 4bpp color granularity
21881903GFXDECODE_END
21891904
21901905/***************************************************************************
r10613r10614
22601975/*  Tiles are 8bpp, but the hardware is additionally able to discard
22611976    some bitplanes and use the low 4 bits only, or the high 4 bits only */
22621977static GFXDECODE_START( funcube )
2263   GFXDECODE_ENTRY( "gfx1", 0, funcube_layout_4bpp_lo, 0, 0x8000/16 )
2264   GFXDECODE_ENTRY( "gfx1", 0, funcube_layout_4bpp_hi, 0, 0x8000/16 )
2265   GFXDECODE_ENTRY( "gfx1", 0, funcube_layout_6bpp,    0, 0x8000/16 )   // 6bpp, but 4bpp granularity
2266   GFXDECODE_ENTRY( "gfx1", 0, funcube_layout_8bpp,    0, 0x8000/16 )   // 8bpp, but 4bpp granularity
2267   GFXDECODE_ENTRY( "gfx1", 0, funcube_layout_3bpp_lo, 0, 0x8000/16 )   // 3bpp, but 4bpp granularity
2268   GFXDECODE_ENTRY( "gfx1", 0, funcube_layout_2bpp_hi, 0, 0x8000/16 )   // ???
1978   GFXDECODE_ENTRY( "sprites", 0, funcube_layout_4bpp_lo, 0, 0x8000/16 )
1979   GFXDECODE_ENTRY( "sprites", 0, funcube_layout_4bpp_hi, 0, 0x8000/16 )
1980   GFXDECODE_ENTRY( "sprites", 0, funcube_layout_6bpp,    0, 0x8000/16 )   // 6bpp, but 4bpp color granularity
1981   GFXDECODE_ENTRY( "sprites", 0, funcube_layout_8bpp,    0, 0x8000/16 )   // 8bpp, but 4bpp color granularity
1982   GFXDECODE_ENTRY( "sprites", 0, funcube_layout_3bpp_lo, 0, 0x8000/16 )   // 3bpp, but 4bpp color granularity
1983   GFXDECODE_ENTRY( "sprites", 0, funcube_layout_2bpp_hi, 0, 0x8000/16 )   // 2bpp, but 4bpp color granularity
22691984GFXDECODE_END
22701985
22711986
r10613r10614
23042019   0x0000,      /* address */
23052020};
23062021
2307
2308static MACHINE_CONFIG_START( mj4simai, seta2_state )
2309
2310   /* basic machine hardware */
2311   MCFG_CPU_ADD("maincpu",M68000,50000000/3)         /* !! TMP68301 @ 16.666666MHz !! */
2022static MACHINE_CONFIG_START( seta2, seta2_state )
2023   MCFG_CPU_ADD("maincpu", M68000, XTAL_50MHz/3)   // !! TMP68301 !!
23122024   MCFG_CPU_PROGRAM_MAP(mj4simai_map)
23132025   MCFG_CPU_VBLANK_INT("screen", seta2_interrupt)
23142026
23152027   MCFG_MACHINE_START( tmp68301 )
23162028   MCFG_MACHINE_RESET( tmp68301 )
23172029
2318   /* video hardware */
2030   // video hardware
23192031   MCFG_SCREEN_ADD("screen", RASTER)
23202032   MCFG_SCREEN_REFRESH_RATE(60)
23212033   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
r10613r10614
23262038   MCFG_SCREEN_EOF(seta2)
23272039
23282040   MCFG_GFXDECODE(seta2)
2329   MCFG_PALETTE_LENGTH(0x8000+0xf0)   /* extra 0xf0 because we might draw 256-color object with 16-color granularity */
2041   MCFG_PALETTE_LENGTH(0x8000+0xf0)   // extra 0xf0 because we might draw 256-color object with 16-color granularity
23302042
23312043   MCFG_VIDEO_START(seta2)
23322044
2333   /* sound hardware */
2045   // sound hardware
23342046   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
23352047
2336   MCFG_SOUND_ADD("x1snd", X1_010, 50000000/3)
2048   MCFG_SOUND_ADD("x1snd", X1_010, XTAL_50MHz/3)   // clock?
23372049   MCFG_SOUND_CONFIG(x1_010_sound_intf)
23382050   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
23392051   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
23402052MACHINE_CONFIG_END
23412053
2342static MACHINE_CONFIG_DERIVED( gundamex, mj4simai )
23432054
2344   /* basic machine hardware */
2055static MACHINE_CONFIG_DERIVED( mj4simai, seta2 )
23452056   MCFG_CPU_MODIFY("maincpu")
2057   MCFG_CPU_PROGRAM_MAP(mj4simai_map)
2058
2059   // video hardware
2060   MCFG_SCREEN_MODIFY("screen")
2061   MCFG_SCREEN_VISIBLE_AREA(0x40, 0x1c0-1, 0x80, 0x170-1)
2062MACHINE_CONFIG_END
2063
2064
2065static MACHINE_CONFIG_DERIVED( gundamex, seta2 )
2066   MCFG_CPU_MODIFY("maincpu")
23462067   MCFG_CPU_PROGRAM_MAP(gundamex_map)
23472068
23482069   MCFG_EEPROM_93C46_ADD("eeprom")
23492070
2350   /* video hardware */
2071   // video hardware
23512072   MCFG_SCREEN_MODIFY("screen")
23522073   MCFG_SCREEN_VISIBLE_AREA(0x00, 0x180-1, 0x100, 0x1e0-1)
23532074MACHINE_CONFIG_END
23542075
2355static MACHINE_CONFIG_DERIVED( grdians, mj4simai )
2076
2077static MACHINE_CONFIG_DERIVED( grdians, seta2 )
23562078   MCFG_CPU_MODIFY("maincpu")
23572079   MCFG_CPU_PROGRAM_MAP(grdians_map)
23582080
2359   /* video hardware */
2081   // video hardware
23602082   MCFG_SCREEN_MODIFY("screen")
23612083   MCFG_SCREEN_VISIBLE_AREA(0x80, 0x80 + 0x130 -1, 0x80, 0x80 + 0xe8 -1)
23622084MACHINE_CONFIG_END
23632085
23642086
2365static MACHINE_CONFIG_DERIVED( myangel, mj4simai )
2366
2367   /* basic machine hardware */
2087static MACHINE_CONFIG_DERIVED( myangel, seta2 )
23682088   MCFG_CPU_MODIFY("maincpu")
23692089   MCFG_CPU_PROGRAM_MAP(myangel_map)
23702090
2371   /* video hardware */
2091   // video hardware
23722092   MCFG_SCREEN_MODIFY("screen")
23732093   MCFG_SCREEN_VISIBLE_AREA(0, 0x178-1, 0x00, 0xf0-1)
23742094
2375   MCFG_VIDEO_START(seta2_offset)
2095   MCFG_VIDEO_START(seta2_yoffset)
23762096MACHINE_CONFIG_END
23772097
23782098
2379static MACHINE_CONFIG_DERIVED( myangel2, mj4simai )
2380
2381   /* basic machine hardware */
2099static MACHINE_CONFIG_DERIVED( myangel2, seta2 )
23822100   MCFG_CPU_MODIFY("maincpu")
23832101   MCFG_CPU_PROGRAM_MAP(myangel2_map)
23842102
2385   /* video hardware */
2103   // video hardware
23862104   MCFG_SCREEN_MODIFY("screen")
23872105   MCFG_SCREEN_VISIBLE_AREA(0, 0x178-1, 0x00, 0xf0-1)
23882106
2389   MCFG_VIDEO_START(seta2_offset)
2107   MCFG_VIDEO_START(seta2_yoffset)
23902108MACHINE_CONFIG_END
23912109
23922110
2393static MACHINE_CONFIG_DERIVED( pzlbowl, mj4simai )
2394
2395   /* basic machine hardware */
2111static MACHINE_CONFIG_DERIVED( pzlbowl, seta2 )
23962112   MCFG_CPU_MODIFY("maincpu")
23972113   MCFG_CPU_PROGRAM_MAP(pzlbowl_map)
23982114
2399   /* video hardware */
2115   // video hardware
24002116   MCFG_SCREEN_MODIFY("screen")
24012117   MCFG_SCREEN_VISIBLE_AREA(0x10, 0x190-1, 0x100, 0x1f0-1)
24022118MACHINE_CONFIG_END
24032119
24042120
2405static MACHINE_CONFIG_DERIVED( penbros, mj4simai )
2406
2407   /* basic machine hardware */
2121static MACHINE_CONFIG_DERIVED( penbros, seta2 )
24082122   MCFG_CPU_MODIFY("maincpu")
24092123   MCFG_CPU_PROGRAM_MAP(penbros_map)
24102124
2411   /* video hardware */
2125   // video hardware
24122126   MCFG_SCREEN_MODIFY("screen")
24132127   MCFG_SCREEN_VISIBLE_AREA(0, 0x140-1, 0x80, 0x160-1)
24142128MACHINE_CONFIG_END
24152129
2416static MACHINE_CONFIG_DERIVED( samshoot, mj4simai )
24172130
2418   /* basic machine hardware */
2131static MACHINE_CONFIG_DERIVED( reelquak, seta2 )
24192132   MCFG_CPU_MODIFY("maincpu")
2133   MCFG_CPU_PROGRAM_MAP(reelquak_map)
2134
2135   MCFG_NVRAM_ADD_0FILL("nvram")
2136   MCFG_TICKET_DISPENSER_ADD("ticket", 200, TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
2137
2138   // video hardware
2139   MCFG_SCREEN_MODIFY("screen")
2140   MCFG_SCREEN_VISIBLE_AREA(0x40, 0x180-1, 0x80, 0x170-1)
2141
2142   MCFG_VIDEO_START(seta2_xoffset)
2143MACHINE_CONFIG_END
2144
2145
2146static MACHINE_CONFIG_DERIVED( samshoot, seta2 )
2147   MCFG_CPU_MODIFY("maincpu")
24202148   MCFG_CPU_PROGRAM_MAP(samshoot_map)
24212149   MCFG_CPU_VBLANK_INT_HACK(samshoot_interrupt,2)
24222150
24232151   MCFG_NVRAM_ADD_0FILL("nvram")
24242152
2425   /* video hardware */
2153   // video hardware
24262154   MCFG_SCREEN_MODIFY("screen")
24272155   MCFG_SCREEN_VISIBLE_AREA(0x40, 0x180-1, 0x40, 0x130-1)
24282156MACHINE_CONFIG_END
r10613r10614
24932221
24942222   MCFG_MACHINE_RESET( funcube )
24952223
2496   /* video hardware */
2224   // video hardware
24972225   MCFG_SCREEN_ADD("screen", RASTER)
24982226   MCFG_SCREEN_REFRESH_RATE(60)
24992227   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))   // not accurate
r10613r10614
25042232   MCFG_SCREEN_EOF(seta2)
25052233
25062234   MCFG_GFXDECODE(funcube)
2507   MCFG_PALETTE_LENGTH(0x8000+0xf0)   /* extra 0xf0 because we might draw 256-color object with 16-color granularity */
2235   MCFG_PALETTE_LENGTH(0x8000+0xf0)   // extra 0xf0 because we might draw 256-color object with 16-color granularity
25082236
25092237   MCFG_VIDEO_START(seta2)
25102238
2511   /* sound hardware */
2239   // sound hardware
25122240   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
25132241
25142242   MCFG_OKIM9810_ADD("oki", XTAL_4_096MHz)
2515   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.80)
2516   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.80)
2243   MCFG_SOUND_ROUTE(0, "lspeaker", 0.80)
2244   MCFG_SOUND_ROUTE(1, "rspeaker", 0.80)
25172245MACHINE_CONFIG_END
25182246
25192247
r10613r10614
25232251
25242252***************************************************************************/
25252253
2526ROM_START( gundamex )
2527   ROM_REGION( 0x600000, "maincpu", 0 )      /* TMP68301 Code */
2528   ROM_LOAD16_BYTE(     "ka002002.u2",  0x000000, 0x080000, CRC(e850f6d8) SHA1(026325e305676b1f8d3d9e7573920f8b70d7bccb) )
2529   ROM_LOAD16_BYTE(     "ka002004.u3",  0x000001, 0x080000, CRC(c0fb1208) SHA1(84b25e4c73cb8e023ee5dbf69f588be98700b43f) )
2530   ROM_LOAD16_BYTE(     "ka002001.u4",  0x100000, 0x080000, CRC(553ebe6b) SHA1(7fb8a159513d31a1d60520ff14e4c4d133fd3e19) )
2531   ROM_LOAD16_BYTE(     "ka002003.u5",  0x100001, 0x080000, CRC(946185aa) SHA1(524911c4c510d6c3e17a7ab42c7077c2fffbf06b) )
2532   ROM_LOAD16_WORD_SWAP( "ka001005.u77", 0x500000, 0x080000, CRC(f01d3d00) SHA1(ff12834e99a76261d619f10d186f4b329fb9cb7a) )
2254/***************************************************************************
25332255
2534   ROM_REGION( 0x2000000, "gfx1", ROMREGION_ERASE)   /* Sprites */
2535   ROM_LOAD( "ka001009.u16",  0x0000000, 0x200000, CRC(997d8d93) SHA1(4cb4cdb7e8208af4b14483610d9d6aa5e13acd89) )
2536   ROM_LOAD( "ka001010.u18",  0x0200000, 0x200000, CRC(811b67ca) SHA1(c8cfae6f54c76d63bd625ff011c872ffb75fd2e2) )
2537   ROM_LOAD( "ka001011.u20",  0x0400000, 0x200000, CRC(08a72700) SHA1(fb8003aa02dd249c30a757cb43b516260b41c1bf) )
2538   ROM_LOAD( "ka001012.u15",  0x0800000, 0x200000, CRC(b789e4a8) SHA1(400b773f24d677a9d47466fdbbe68cb6efc1ad37) )
2539   ROM_LOAD( "ka001013.u17",  0x0a00000, 0x200000, CRC(d8a0201f) SHA1(fe8a2407c872adde8aec8e9340b00be4f00a2872) )
2540   ROM_LOAD( "ka001014.u19",  0x0c00000, 0x200000, CRC(7635e026) SHA1(116a3daab14a17faca85c4a956b356aaf0fc2276) )
2541   ROM_LOAD( "ka001006.u21",  0x1000000, 0x200000, CRC(6aac2f2f) SHA1(fac5478ca2941a93c57f670a058ff626e537bcde) )
2542   ROM_LOAD( "ka001007.u22",  0x1200000, 0x200000, CRC(588f9d63) SHA1(ed5148d09d02e3bc12c50c39c5c86e6356b2dd7a) )
2543   ROM_LOAD( "ka001008.u23",  0x1400000, 0x200000, CRC(db55a60a) SHA1(03d118c7284ca86219891c473e2a89489710ea27) )
2544   ROM_FILL(                  0x1800000, 0x600000, 0 )   /* 6bpp instead of 8bpp */
2256               FUNCUBE (BET) Series, includes 2 through 5?
25452257
2546   ROM_REGION( 0x300000, "x1snd", 0 )   /* Samples */
2547   /* Leave 1MB empty (addressable by the chip) */
2548   ROM_LOAD( "ka001015.u28", 0x100000, 0x200000, CRC(ada2843b) SHA1(09d06026031bc7558da511c3c0e29187ea0a0099) )
2258PCB Number: B0-006B (also known as EVA3_A system and is non-JAMMA)
2259+------------------------------------------------+
2260|+--+ S +---+ +---+                CN5           |
2261||  | W |   | |   |                          CN6?|
2262||  | 4 | U | | U |                              |
2263||  |   | 4 | | 4 |     +---+                CN2?|
2264||  |   | 2 | | 3 |     |DX |                    |
2265||  |   |   | |   |     |102|                    |
2266||C |   |   | |   |     +---+                    |
2267||N |   +---+ +---+                              |
2268||4 |                                            |
2269||  |      +----------+   M1                     |
2270||  |  M3  |          |                        C |
2271||  |      |   NEC    |   M1                   N |
2272||  |  M3  |  DX-101  |                        3 |
2273||  |      |          |                          |
2274||  |      |          |   50MHz                  |
2275|+--+      +----------+                          |
2276| PIC  25.447MHz         +-----------+           |
2277|  CN7                   |    U47    |           |
2278|                        +-----------+           |
2279|          +-----------+  +---+ +---+       D    |
2280|          |     U3    |  |OKI| |DX |       S    |
2281|    M2    +-----------+  |   | |102|       W    |
2282|                         +---+ +---+       1    |
2283|                 ispLSI2032                     |
2284|    M1                      +---+               |
2285|          +----------+      |IDT|           +--+|
2286|          |          |  C   |   |           |  ||
2287| C        | ColdFire |  N   +---+           |  ||
2288| N  M2    | XCF5206E |  8                   |  ||
2289| 1        |          |        +---+         |C ||
2290|          |          |        |H8 |         |N ||
2291|    M1    +----------+        +---+      D  |9 ||
2292|                         14.7456MHz      S  |  ||
2293|                            +-----------+W  |  ||
2294|            SW1      BAT1   |    U49    |2  +--+|
2295|                            +-----------+       |
2296+------------------------------------------------+
25492297
2550   ROM_REGION16_BE( 0x80, "eeprom", 0 )
2551   ROM_LOAD( "eeprom.bin", 0x0000, 0x0080, CRC(80f8e248) SHA1(1a9787811e56d95f7acbedfb00225b6e7df265eb) )
2298   CPU: ColdFire XCF5206EFT54 (160 Pin PQFP)
2299        Hitachi H8/3007 (64130007F20) used for touch screen I/O
2300 Video: NEC DX-101 (240 Pin PQFP)
2301        NEC DX-102 (52 Pin PQFP x2)
2302 Sound: OKI MSM9810B 8-Channel Mixing ADPCM Type Voice Synthesis LSI
2303   OSC: 50MHz, 25.447MHz & 14.7456MHz
2304 Other: Lattice ispLSI2032 - stamped "EVA3A"
2305        BAT1 - CR2032 3Volt
2306
2307ColdFire XCF5206EFT54:
2308  68K/ColdFire V2 core family
2309  8K internal SRAM
2310  54MHz (max) Bus Frequency
2311  32bit External Bus Width
2312  2 UART Serial Interfaces
2313  2 Timer Channels
2314
2315PIC - PIC12C508 MCU used for security
2316       Labeled FC21A for Funcube 2
2317       Labeled FC41A for Funcube 4
2318
2319Ram M1 are Toshiba TC55257DFL-70L
2320Ram M2 are NEC D43001GU-70L
2321Ram M3 are ISSI IS62C1024L-70Q
2322IDT - IDT 7130 64-pin TQFP High-speed 1K x 8 Dual-Port Static RAM
2323
2324CN1 - Unused 64 pin double row connecter
2325CN2?  2x2 connecter
2326CN3 - Unused 50 pin double row connecter
2327CN4 - 96 pin triple row connecter
2328CN5 - 2x3 pin connecter
2329CN6?  3x3 connecter
2330CN7 - Unused 20 pin connecter
2331CN8 - 8 pin single row connecter
2332CN9 - 40 pin double row connecter
2333
2334DSW1 - 8 position dipswitch
2335DSW2 - 2 position dipswitch
2336SW1  - Pushbutton
2337SW4  - Single position slider switch
2338
2339U3  - Is a 27C4002 EPROM
2340U49 - Is a 27C1001 EPROM
2341U42, U43 & U47 are MASK ROMs read as 27C322
2342
2343The same H8/3007 code "FC21 IOPR-0" at U49 is used for FUNCUBE 2,3,4 & 5
2344
2345***************************************************************************/
2346
2347ROM_START( funcube2 )
2348   ROM_REGION( 0x80000, "maincpu", 0 ) // XCF5206 Code
2349   ROM_LOAD( "fc21_prg-0b.u3", 0x00000, 0x80000, CRC(add1c8a6) SHA1(bf91518da659098a4bad4e756533525fcc910570) )
2350
2351   ROM_REGION( 0x20000, "sub", 0 )      // H8/3007 Code
2352   ROM_LOAD( "fc21_iopr-0.u49", 0x00000, 0x20000, CRC(314555ef) SHA1(b17e3926c8ef7f599856c198c330d2051aae13ad) )
2353
2354   ROM_REGION( 0x300, "pic", 0 )      // PIC12C508? Code
2355   ROM_LOAD( "fc21a", 0x000, 0x300, NO_DUMP )
2356
2357   ROM_REGION( 0x800000, "sprites", 0 )
2358   ROM_LOAD32_WORD( "fc21_obj-0.u43", 0x000000, 0x400000, CRC(08cfe6d9) SHA1(d10f362dcde01f7a9855d8f76af3084b5dd1573a) )
2359   ROM_LOAD32_WORD( "fc21_obj-1.u42", 0x000002, 0x400000, CRC(4c1fbc20) SHA1(ff83691c19ce3600b31c494eaec26d2ac79e0028) )
2360
2361   ROM_REGION( 0x1000000, "oki", 0 )
2362   ROM_LOAD( "fc21_voi0.u47", 0x000000, 0x400000, CRC(25b5fc3f) SHA1(18b16a14e9ee62f3fea382e9d3fdcd43bdb165f5) )
25522363ROM_END
25532364
2365ROM_START( funcube4 )
2366   ROM_REGION( 0x80000, "maincpu", 0 ) // XCF5206 Code
2367   ROM_LOAD( "fc41_prg-0.u3", 0x00000, 0x80000, CRC(ef870874) SHA1(dcb8dc3f780ca135df55e4b4f3c95620597ad28f) )
2368
2369   ROM_REGION( 0x20000, "sub", 0 )      // H8/3007 Code
2370   ROM_LOAD( "fc21_iopr-0.u49", 0x00000, 0x20000, CRC(314555ef) SHA1(b17e3926c8ef7f599856c198c330d2051aae13ad) )
2371
2372   ROM_REGION( 0x300, "pic", 0 )      // PIC12C508? Code
2373   ROM_LOAD( "fc41a", 0x000, 0x300, NO_DUMP )
2374
2375   ROM_REGION( 0x800000, "sprites", 0 )
2376   ROM_LOAD32_WORD( "fc41_obj-0.u43", 0x000000, 0x400000, CRC(9ff029d5) SHA1(e057f4929aa745ecaf9d4ff7e39974c82e440146) )
2377   ROM_LOAD32_WORD( "fc41_obj-1.u42", 0x000002, 0x400000, CRC(5ab7b087) SHA1(c600158b2358cdf947357170044dda2deacd4f37) )
2378
2379   ROM_REGION( 0x1000000, "oki", 0 )
2380   ROM_LOAD( "fc41_snd0.u47", 0x000000, 0x400000, CRC(48337257) SHA1(d1755024b824100070b489f48f6ae921765329e8) )
2381ROM_END
2382
2383static DRIVER_INIT( funcube2 )
2384{
2385   UINT32 *main_cpu = (UINT32 *) machine->region("maincpu")->base();
2386   UINT16 *sub_cpu  = (UINT16 *) machine->region("sub")->base();
2387
2388   main_cpu[0x810/4] = 0xe0214e71;
2389   main_cpu[0x814/4] = 0x4e71203c;
2390
2391   main_cpu[0x81c/4] = 0x4e714e71;
2392
2393   main_cpu[0xa5c/4] = 0x4e713e3c;
2394   main_cpu[0xa74/4] = 0x4e713e3c;
2395   main_cpu[0xa8c/4] = 0x4e7141f9;
2396
2397   // Sub CPU
2398   sub_cpu[0x4d4/2] = 0x5470;   // rte -> rts
2399
2400    // Audio
2401    // The first half of the rom appears to be a dupe of the second half with 0xffs destructively interleaved
2402   UINT8* oki = (UINT8*) machine->region("oki")->base();
2403    for (int i = 0; i < 0x200000; i++)
2404    {
2405        oki[i] = oki[i+0x200000];
2406    }
2407}
2408
2409// Note: same as funcube2
2410static DRIVER_INIT( funcube4 )
2411{
2412   UINT32 *main_cpu = (UINT32 *) machine->region("maincpu")->base();
2413   UINT16 *sub_cpu  = (UINT16 *) machine->region("sub")->base();
2414
2415   main_cpu[0x810/4] = 0xe0214e71;
2416   main_cpu[0x814/4] = 0x4e71203c;
2417
2418   main_cpu[0x81c/4] = 0x4e714e71;
2419
2420   main_cpu[0xa5c/4] = 0x4e713e3c;
2421   main_cpu[0xa74/4] = 0x4e713e3c;
2422   main_cpu[0xa8c/4] = 0x4e7141f9;
2423
2424   // Sub CPU
2425   sub_cpu[0x4d4/2] = 0x5470;   // rte -> rts
2426
2427    // Audio
2428    // The first half of the rom appears to be a dupe of the second half with 0xffs destructively interleaved
2429   UINT8* oki = (UINT8*) machine->region("oki")->base();
2430    for (int i = 0; i < 0x200000; i++)
2431    {
2432        oki[i] = oki[i+0x200000];
2433    }
2434}
2435
2436/***************************************************************************
2437
2438Guardians
2439Banpresto, 1995
2440
2441This hardware is not common Banpresto hardware. Possibly licensed
2442to them from another manufacturer? Or an early design that they decided
2443not to use for future games? Either way, this game is _extremely_ rare :-)
2444
2445PCB Layout
2446----------
2447
2448P-FG01-1
2449------------------------------------------------------
2450|        X1-010 6264          U32 CXK581000          |
2451|                                 CXK581000      U16 |
2452|                                                    |
2453|                                                U20 |
2454|    U3 U5 U2 U4 62256 CXK58257                      |
2455|                62256 CXK58257                  U15 |
2456|                                                    |
2457|J                                               U19 |
2458|A    TMP68301AF-16                                  |
2459|M                                               U18 |
2460|M                           NEC                     |
2461|A          NEC              DX-101              U22 |
2462|           DX-102                                   |
2463|                                                U17 |
2464|                   PAL   50MHz                      |
2465|                                                U21 |
2466|           DSW1(8)                                  |
2467|           DSW2(8)                   CXK58257 NEC   |
2468|                                     CXK58257 DX-102|
2469------------------------------------------------------
2470
2471Notes:
2472      HSync: 15.23kHz
2473      VSync: 58.5Hz
2474
2475***************************************************************************/
2476
25542477ROM_START( grdians )
2555   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
2478   ROM_REGION( 0x200000, "maincpu", 0 )   // TMP68301 Code
25562479   ROM_LOAD16_BYTE( "u2.bin", 0x000000, 0x080000, CRC(36adc6f2) SHA1(544e87f88179fe1342e7a06a8948ac1828e85108) )
25572480   ROM_LOAD16_BYTE( "u3.bin", 0x000001, 0x080000, CRC(2704f416) SHA1(9081a12cbb9927d36e1c50b52aa2c6003810ee42) )
25582481   ROM_LOAD16_BYTE( "u4.bin", 0x100000, 0x080000, CRC(bb52447b) SHA1(61433f683210ab2bc2cf1cc4b5b7a39cc5b6493d) )
25592482   ROM_LOAD16_BYTE( "u5.bin", 0x100001, 0x080000, CRC(9c164a3b) SHA1(6d688c7af9e7e8e8d54b2e4dfbf41f59c79242eb) )
25602483
2561   ROM_REGION( 0x2000000, "gfx1", ROMREGION_ERASE)   /* Sprites */
2484   ROM_REGION( 0x2000000, "sprites", ROMREGION_ERASE)   // Sprites
25622485   ROM_LOAD( "u16.bin",  0x0000000, 0x400000, CRC(6a65f265) SHA1(6cad11f718f8bbcff464d41eb4717460769237ed) )
25632486   ROM_LOAD( "u20.bin",  0x0600000, 0x200000, CRC(a7226ab7) SHA1(408580dd35c568ffef1ebbd87359e3ec1f867020) )
25642487   ROM_CONTINUE(         0x0400000, 0x200000 )
r10613r10614
25752498   ROM_LOAD( "u21.bin",  0x1e00000, 0x200000, CRC(6f95e466) SHA1(28482fad16a3ac9302f152d81552e6f84a44f3e4) )
25762499   ROM_CONTINUE(         0x1c00000, 0x200000 )
25772500
2578   ROM_REGION( 0x200000, "x1snd", 0 )   /* Samples */
2579   /* Leave 1MB empty (addressable by the chip) */
2501   ROM_REGION( 0x200000, "x1snd", 0 )   // Samples
2502   // Leave 1MB empty (addressable by the chip)
25802503   ROM_LOAD( "u32.bin", 0x100000, 0x100000, CRC(cf0f3017) SHA1(8376d3a674f71aec72f52c72758fbc53d9feb1a1) )
25812504ROM_END
25822505
2506/***************************************************************************
2507
2508MS Gundam Ex Revue
2509Banpresto, 1994
2510
2511This game runs on Seta/Allumer hardware
2512
2513PCB Layout
2514----------
2515
2516PO-113A   BP949KA
2517|----------------------------------|
2518|  X1-010  6264  U28               |
2519|                     581001   U19 |
2520|     U3  U5  U2  U4  581001   U17 |
2521|      62256   62256           U15 |
2522|J                             U20 |
2523|A    U77  68301               U18 |
2524|M                     *       U16 |
2525|M    93C46                    U23 |
2526|A                             U22 |
2527|                              U21 |
2528|  DSW1            50MHz           |
2529|  DSW2       PAL  32.5304MHz      |
2530|       20MHz PAL                  |
2531|----------------------------------|
2532
2533Notes:
2534      *: unknown QFP208 (has large heatsink on it). Should be similar to other known
2535         graphics chips used on Seta hardware of this era.
2536      68301 clock: 16.000MHz (?? From what OSC + divider??)
2537      VSync: 60Hz
2538
2539***************************************************************************/
2540
2541ROM_START( gundamex )
2542   ROM_REGION( 0x600000, "maincpu", 0 )   // TMP68301 Code
2543   ROM_LOAD16_BYTE(     "ka002002.u2",  0x000000, 0x080000, CRC(e850f6d8) SHA1(026325e305676b1f8d3d9e7573920f8b70d7bccb) )
2544   ROM_LOAD16_BYTE(     "ka002004.u3",  0x000001, 0x080000, CRC(c0fb1208) SHA1(84b25e4c73cb8e023ee5dbf69f588be98700b43f) )
2545   ROM_LOAD16_BYTE(     "ka002001.u4",  0x100000, 0x080000, CRC(553ebe6b) SHA1(7fb8a159513d31a1d60520ff14e4c4d133fd3e19) )
2546   ROM_LOAD16_BYTE(     "ka002003.u5",  0x100001, 0x080000, CRC(946185aa) SHA1(524911c4c510d6c3e17a7ab42c7077c2fffbf06b) )
2547   ROM_LOAD16_WORD_SWAP( "ka001005.u77", 0x500000, 0x080000, CRC(f01d3d00) SHA1(ff12834e99a76261d619f10d186f4b329fb9cb7a) )
2548
2549   ROM_REGION( 0x2000000, "sprites", ROMREGION_ERASE)   // Sprites
2550   ROM_LOAD( "ka001009.u16",  0x0000000, 0x200000, CRC(997d8d93) SHA1(4cb4cdb7e8208af4b14483610d9d6aa5e13acd89) )
2551   ROM_LOAD( "ka001010.u18",  0x0200000, 0x200000, CRC(811b67ca) SHA1(c8cfae6f54c76d63bd625ff011c872ffb75fd2e2) )
2552   ROM_LOAD( "ka001011.u20",  0x0400000, 0x200000, CRC(08a72700) SHA1(fb8003aa02dd249c30a757cb43b516260b41c1bf) )
2553   ROM_LOAD( "ka001012.u15",  0x0800000, 0x200000, CRC(b789e4a8) SHA1(400b773f24d677a9d47466fdbbe68cb6efc1ad37) )
2554   ROM_LOAD( "ka001013.u17",  0x0a00000, 0x200000, CRC(d8a0201f) SHA1(fe8a2407c872adde8aec8e9340b00be4f00a2872) )
2555   ROM_LOAD( "ka001014.u19",  0x0c00000, 0x200000, CRC(7635e026) SHA1(116a3daab14a17faca85c4a956b356aaf0fc2276) )
2556   ROM_LOAD( "ka001006.u21",  0x1000000, 0x200000, CRC(6aac2f2f) SHA1(fac5478ca2941a93c57f670a058ff626e537bcde) )
2557   ROM_LOAD( "ka001007.u22",  0x1200000, 0x200000, CRC(588f9d63) SHA1(ed5148d09d02e3bc12c50c39c5c86e6356b2dd7a) )
2558   ROM_LOAD( "ka001008.u23",  0x1400000, 0x200000, CRC(db55a60a) SHA1(03d118c7284ca86219891c473e2a89489710ea27) )
2559   ROM_FILL(                  0x1800000, 0x600000, 0 )   // 6bpp instead of 8bpp
2560
2561   ROM_REGION( 0x300000, "x1snd", 0 )   // Samples
2562   // Leave 1MB empty (addressable by the chip)
2563   ROM_LOAD( "ka001015.u28", 0x100000, 0x200000, CRC(ada2843b) SHA1(09d06026031bc7558da511c3c0e29187ea0a0099) )
2564
2565   ROM_REGION16_BE( 0x80, "eeprom", 0 )
2566   ROM_LOAD( "eeprom.bin", 0x0000, 0x0080, CRC(80f8e248) SHA1(1a9787811e56d95f7acbedfb00225b6e7df265eb) )
2567ROM_END
2568
2569/***************************************************************************
2570
2571Wakakusamonogatari Mahjong Yonshimai (JPN Ver.)
2572(c)1996 Maboroshi Ware
2573
2574Board:  P0-123A
2575
2576CPU:    TMP68301 (68000 core)
2577OSC:    50.0000MHz
2578        32.5304MHz
2579
2580Sound:  X1-010
2581
2582***************************************************************************/
2583
25832584ROM_START( mj4simai )
2584   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
2585   ROM_REGION( 0x200000, "maincpu", 0 )   // TMP68301 Code
25852586   ROM_LOAD16_BYTE( "ll.u2",       0x000000, 0x080000, CRC(7be9c781) SHA1(d29e579706d98909933f6bed2ee292c88ed10d2c) )
25862587   ROM_LOAD16_BYTE( "lh1.u3",      0x000001, 0x080000, CRC(82aa3f72) SHA1(a93d5dc7cdf12f852a692759d91f6f2951b6b5b5) )
25872588   ROM_LOAD16_BYTE( "hl.u4",       0x100000, 0x080000, CRC(226063b7) SHA1(1737baffc16ff7261f887911187ece96925fa6ff) )
25882589   ROM_LOAD16_BYTE( "hh.u5",       0x100001, 0x080000, CRC(23aaf8df) SHA1(b3d678afce4ddef32e48d690c6d07b723dd0c28f) )
25892590
2590   ROM_REGION( 0x2000000, "gfx1", 0 )   /* Sprites */
2591   ROM_REGION( 0x2000000, "sprites", 0 )   // Sprites
25912592   ROM_LOAD( "cha-03.u16",  0x0000000, 0x400000, CRC(d367429a) SHA1(b32c215ef85c3d0a4c5550cef4f5c4c0e7030b7c) )
25922593   ROM_LOAD( "cha-04.u18",  0x0400000, 0x400000, CRC(7f2008c3) SHA1(e45d863540eb2381f5d7660d64cdfef87c890768) )
25932594   ROM_LOAD( "cha-05.u15",  0x0800000, 0x400000, CRC(e94ec40a) SHA1(2685dbc5680b5f76688c6b4fbe40ae682c525bfe) )
25942595   ROM_LOAD( "cha-06.u17",  0x0c00000, 0x400000, CRC(5cb0b3a9) SHA1(92fb82d45b4c46326d5796981f812e20a8ddb4f2) )
25952596   ROM_LOAD( "cha-01.u21",  0x1000000, 0x400000, CRC(35f47b37) SHA1(4a8eb088890272f2a069e2c3f00fadf6421f7b0e) )
25962597   ROM_LOAD( "cha-02.u22",  0x1400000, 0x400000, CRC(f6346860) SHA1(4eebd3fa315b97964fa39b88224f9de7622ba881) )
2597   ROM_FILL(                0x1800000, 0x800000, 0 )   /* 6bpp instead of 8bpp */
2598   ROM_FILL(                0x1800000, 0x800000, 0 )   // 6bpp instead of 8bpp
25982599
2599   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2600   /* Leave 1MB empty (addressable by the chip) */
2600   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
2601   // Leave 1MB empty (addressable by the chip)
26012602   ROM_LOAD( "cha-07.u32",  0x100000, 0x400000, CRC(817519ee) SHA1(ed09740cdbf61a328f7b50eb569cf498fb749416) )
26022603ROM_END
26032604
2605/***************************************************************************
2606
2607Kosodate Quiz My Angel (JPN Ver.)
2608(c)1996 Namco
2609
2610Board:  KE (Namco) ; P0-125A (Seta)
2611
2612CPU:    TMP68301 (68000 core)
2613OSC:    50.0000MHz
2614        32.5304MHz
2615
2616Sound:  X1-010
2617
2618***************************************************************************/
2619
26042620ROM_START( myangel )
2605   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
2621   ROM_REGION( 0x200000, "maincpu", 0 )      // TMP68301 Code
26062622   ROM_LOAD16_BYTE( "kq1-prge.u2", 0x000000, 0x080000, CRC(6137d4c0) SHA1(762341e11b56e4a7787a0662833b702b78aee0a9) )
26072623   ROM_LOAD16_BYTE( "kq1-prgo.u3", 0x000001, 0x080000, CRC(4aad10d8) SHA1(a08e1c4f57c64be829e0807ae2791da947fd60aa) )
26082624   ROM_LOAD16_BYTE( "kq1-tble.u4", 0x100000, 0x080000, CRC(e332a514) SHA1(dfd255239c80c48c9865e70681b9ddd175b8bf55) )
26092625   ROM_LOAD16_BYTE( "kq1-tblo.u5", 0x100001, 0x080000, CRC(760cab15) SHA1(fa7ea85ec2ebfaab3111b8631ea6ea3d794d449c) )
26102626
2611   ROM_REGION( 0x1000000, "gfx1", 0 )   /* Sprites */
2627   ROM_REGION( 0x1000000, "sprites", 0 )   // Sprites
26122628   ROM_LOAD( "kq1-cg2.u20", 0x000000, 0x200000, CRC(80b4e8de) SHA1(c8685c4f4e3c0415ce0ec88e0288835e504cab00) )
26132629   ROM_LOAD( "kq1-cg0.u16", 0x200000, 0x200000, CRC(f8ae9a05) SHA1(4f3b41386a48a1608aa96b911e6b74ca775260fb) )
26142630   ROM_LOAD( "kq1-cg3.u19", 0x400000, 0x200000, CRC(9bdc35c9) SHA1(fd0a1eb3dd10705bce5462263667353632558b58) )
r10613r10614
26182634   ROM_LOAD( "kq1-cg7.u21", 0xc00000, 0x200000, CRC(9f48382c) SHA1(80dfc33a55123b5d3cdb3ed97b43a527f0254d61) )
26192635   ROM_LOAD( "kq1-cg5.u17", 0xe00000, 0x200000, CRC(a4bc4516) SHA1(0eb11fa54d16bba1b96f9dd943a68949a3bb9a2f) )
26202636
2621   ROM_REGION( 0x300000, "x1snd", 0 )   /* Samples */
2622   /* Leave 1MB empty (addressable by the chip) */
2637   ROM_REGION( 0x300000, "x1snd", 0 )   // Samples
2638   // Leave 1MB empty (addressable by the chip)
26232639   ROM_LOAD( "kq1-snd.u32", 0x100000, 0x200000, CRC(8ca1b449) SHA1(f54096fb5400843af4879135c96760485b6cb319) )
26242640ROM_END
26252641
2642/***************************************************************************
2643
2644Kosodate Quiz My Angel 2 (JPN Ver.)
2645(c)1997 Namco
2646
2647Board:  KL (Namco) ; P0-136A (Seta)
2648
2649CPU:    TMP68301 (68000 core)
2650OSC:    50.0000MHz
2651        32.5304MHz
2652
2653Sound:  X1-010
2654
2655***************************************************************************/
2656
26262657ROM_START( myangel2 )
2627   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
2658   ROM_REGION( 0x200000, "maincpu", 0 )   // TMP68301 Code
26282659   ROM_LOAD16_BYTE( "kqs1ezpr.u2", 0x000000, 0x080000, CRC(2469aac2) SHA1(7dade2de31252e305d24c659c4801dd4687ad1f6) )
26292660   ROM_LOAD16_BYTE( "kqs1ozpr.u3", 0x000001, 0x080000, CRC(6336375c) SHA1(72089f77e94832e74e0512944acadeccd0dec8b0) )
26302661   ROM_LOAD16_BYTE( "kqs1e-tb.u4", 0x100000, 0x080000, CRC(e759b4cc) SHA1(4f806a144a47935b2710f8af800ec0d771f12a18) )
26312662   ROM_LOAD16_BYTE( "kqs1o-tb.u5", 0x100001, 0x080000, CRC(b6168737) SHA1(4c3de877c0c1dca1c43ac737a0bf231335237d3a) )
26322663
2633   ROM_REGION( 0x1800000, "gfx1", 0 )   /* Sprites */
2664   ROM_REGION( 0x1800000, "sprites", 0 )   // Sprites
26342665   ROM_LOAD( "kqs1-cg4.u20", 0x0000000, 0x200000, CRC(d1802241) SHA1(52c45a13d46f7ee8043e85b99d07b1765ca93dcc) )
26352666   ROM_LOAD( "kqs1-cg0.u16", 0x0200000, 0x400000, CRC(c21a33a7) SHA1(bc6f479a8f4c716ba79a725f160ddeb95fdedbcb) )
26362667   ROM_LOAD( "kqs1-cg5.u19", 0x0600000, 0x200000, CRC(d86cf19c) SHA1(da5a5b576ce107433605b24d8b9dcd0abd46bcde) )
r10613r10614
26402671   ROM_LOAD( "kqs1-cg7.u21", 0x1200000, 0x200000, CRC(2c977904) SHA1(2589447f2471cdc414266b34aff552044c680d93) )
26412672   ROM_LOAD( "kqs1-cg3.u17", 0x1400000, 0x400000, CRC(de3b2191) SHA1(d7d6ea07b665cfd834747d3c0776b968ce03bc6a) )
26422673
2643   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2644   /* Leave 1MB empty (addressable by the chip) */
2674   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
2675   // Leave 1MB empty (addressable by the chip)
26452676   ROM_LOAD( "kqs1-snd.u32", 0x100000, 0x400000, CRC(792a6b49) SHA1(341b4e8f248b5032217733bada32e353c67e3888) )
26462677ROM_END
26472678
2679/***************************************************************************
2680
2681                            Puzzle De Bowling (Japan)
2682
2683(c)1999 Nihon System / Moss
2684
2685   CPU: Toshiba TMP68301AF-16 (100 Pin PQFP)
2686 Video: NEC DX-101 (240 Pin PQFP)
2687        NEC DX-102 (52 Pin PQFP x3)
2688 Sound: X1-010 (Mitsubishi M60016 Gate Array, 80 Pin PQFP)
2689   OSC: 50MHz & 32.53047MHz
2690 Other: 8 Position Dipswitch x 2
2691        Lattice ispLSI2032 - stamped "KUDEC"
2692
2693PCB Number: P0-142A
2694+-----------------------------------------------------------+
2695|                VOL                       +------+         |
2696|                                          |Seta  |     M1  |
2697|   +---+ +---+                            |X1-010|         |
2698|   |   | |   |  U4*  M                    |      |  +---+  |
2699+-+ | U | | U |       1                    +------+  | K |  |
2700  | | 0 | | 0 |                     U30*             | U |  |
2701+-+ | 7 | | 6 |  U5*  M                              | S |  |
2702|   |   | |   |       1                              |   |  |
2703|   +---+ +---+                                      | U |  |
2704|                                          Lattice   | 1 |  |
2705|J  D D  +---+                            ispLSI2032 | 8 |  |
2706|A  S S  |DX |                  +-------+            +---+  |
2707|M  W W  |102|                  |Toshiba|     CN2           |
2708|M  1 2  +---+      BAT1*       |  TMP  |                   |
2709|A                              | 68301 |  U50*             |
2710|                               +-------+                   |
2711|C                                                          |
2712|o                 50MHz        +----------+     XM2*       |
2713|n    +---+                     |          |                |
2714|n    |DX |     SW1             |   NEC    |    M   M       |
2715|e    |102|                     |  DX-101  |    2   2       |
2716|c    +---+         M  M        |          |                |
2717|t                  1  1        |          |                |
2718|e                              +----------+                |
2719|r                                                          |
2720|                             +---+      +---++---++---+    |
2721|                             | K |      | K || K || K |    |
2722|     +---+                   | U |      | U || U || U |    |
2723+-+   |DX |                   | C |      | C || C || C |    |
2724  |   |102|     32.53047MHz   |   |      |   ||   ||   |    |
2725+-+   +---+                   | U |      | U || U || U |    |
2726|                             | 4 |      | 4 || 3 || 3 |    |
2727|                             | 0 |      | 1 || 8 || 9 |    |
2728|                             +---+      +---++---++---+    |
2729+-----------------------------------------------------------+
2730
2731* Unpopulated:
2732  U4 & U5 RAM HM62256 equivalent
2733  U50 93LC46BX EEPROM
2734  U30 74HC00
2735  BAT1 CR2032 3Volt battery
2736  XM2 OSC
2737
2738Ram M1 are NEC D43001GU-70LL
2739Ram M2 are LGS GM76C8128ALLFW70
2740
2741KUP-U06-I03 U06 Program rom ST27C4001 (even)
2742KUP-U07-I03 U07 Program rom ST27C4001 (odd)
2743
2744KUS-U18-I00 U18 Mask rom (Samples 23C32000 32Mbit)
2745
2746KUC-U38-I00 U38 Mask rom (Graphics 23C32000 32Mbit)
2747KUC-U39-I00 U39 Mask rom (Graphics 23C32000 32Mbit)
2748KUC-U40-I00 U40 Mask rom (Graphics 23C32000 32Mbit)
2749KUC-U41-I00 U41 Mask rom (Graphics 23C32000 32Mbit)
2750
2751***************************************************************************/
2752
26482753ROM_START( pzlbowl )
2649   ROM_REGION( 0x100000, "maincpu", 0 )      /* TMP68301 Code */
2754   ROM_REGION( 0x100000, "maincpu", 0 )   // TMP68301 Code
26502755   ROM_LOAD16_BYTE( "kup-u06.i03", 0x000000, 0x080000, CRC(314e03ac) SHA1(999398e55161dd75570d418f4c9899e3bf311cc8) )
26512756   ROM_LOAD16_BYTE( "kup-u07.i03", 0x000001, 0x080000, CRC(a0423a04) SHA1(9539023c5c2f2bf72ee3fb6105443ffd3d61e2f8) )
26522757
2653   ROM_REGION( 0x1000000, "gfx1", 0 )   /* Sprites */
2758   ROM_REGION( 0x1000000, "sprites", 0 )   // Sprites
26542759   ROM_LOAD( "kuc-u38.i00", 0x000000, 0x400000, CRC(3db24172) SHA1(89c39963e15c53b799994185d0c8b2e795478939) )
26552760   ROM_LOAD( "kuc-u39.i00", 0x400000, 0x400000, CRC(9b26619b) SHA1(ea7a0bf46641d15353217b01e761d1a148bee4e7) )
26562761   ROM_LOAD( "kuc-u40.i00", 0x800000, 0x400000, CRC(7e49a2cf) SHA1(d24683addbc54515c33fb620ac500e6702bd9e17) )
26572762   ROM_LOAD( "kuc-u41.i00", 0xc00000, 0x400000, CRC(2febf19b) SHA1(8081ac590c0463529777b5e4817305a1a6f6ea41) )
26582763
2659   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2660   /* Leave 1MB empty (addressable by the chip) */
2764   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
2765   // Leave 1MB empty (addressable by the chip)
26612766   ROM_LOAD( "kus-u18.i00", 0x100000, 0x400000, CRC(e2b1dfcf) SHA1(fb0b8be119531a1a27efa46ed7b86b05a37ed585) )
26622767ROM_END
26632768
2769/***************************************************************************
2770
2771Penguin Brothers (Japan)
2772(c)2000 Subsino
2773
2774   CPU: Toshiba TMP68301AF-16 (100 Pin PQFP)
2775 Video: NEC DX-101 (240 Pin PQFP)
2776        NEC DX-102 (52 Pin PQFP x3)
2777 Sound: X1-010 (Mitsubishi M60016 Gate Array, 80 Pin PQFP)
2778   OSC: 50MHz, 32.53047MHz & 28MHz
2779 Other: 8 Position Dipswitch x 2
2780        Lattice ispLSI2032
2781
2782PCB Number: P0-142A
2783+-----------------------------------------------------------+
2784|                VOL                       +------+         |
2785|                                          |Seta  |     M1  |
2786|   +---+ +---+                            |X1-010|         |
2787|   |   | |   |   M   M                    |      |  +---+  |
2788+-+ | U | | U |   1   1                    +------+  |   |  |
2789  | | 0 | | 0 |                    74HC00            |   |  |
2790+-+ | 7 | | 6 |   M   M                              | U |  |
2791|   |   | |   |   1   1                              | 1 |  |
2792|   +---+ +---+                                      | 8 |  |
2793|                                          Lattice   |   |  |
2794|J  D D  +---+                            ispLSI2032 |   |  |
2795|A  S S  |DX |                  +-------+            +---+  |
2796|M  W W  |102|                  |Toshiba|     CN2           |
2797|M  1 2  +---+      BAT1*       |  TMP  |                   |
2798|A                              | 68301 |  U50*             |
2799|                               +-------+                   |
2800|C                                                          |
2801|o                 50MHz        +----------+     28MHz      |
2802|n    +---+                     |          |                |
2803|n    |DX |     SW1             |   NEC    |    M   M       |
2804|e    |102|                     |  DX-101  |    2   2       |
2805|c    +---+         M  M        |          |                |
2806|t                  1  1        |          |                |
2807|e                              +----------+                |
2808|r                                                          |
2809|                             +---+      +---++---++---+    |
2810|                             |   |      |   ||   ||   |    |
2811|     +---+                   |   |      |   ||   ||   |    |
2812+-+   |DX |                   | U |      | U || U || U |    |
2813  |   |102|     32.53047MHz   | 4 |      | 4 || 3 || 3 |    |
2814+-+   +---+                   | 0 |      | 1 || 8 || 9 |    |
2815|                             |   |      |   ||   ||   |    |
2816|                             |   |      |   ||   ||   |    |
2817|                             +---+      +---++---++---+    |
2818+-----------------------------------------------------------+
2819
2820Notes:  pzlbowl PCB with these extra parts:
2821        28MHz OSC
2822        2x 62256 SRAM
2823        74HC00
2824
2825U50*  Unpopulated 93LC46BX EEPROM
2826BAT1* Unpopulated CR2032 3Volt battery
2827
2828Ram M1 are NEC D43001GU-70LL
2829Ram M2 are LGS GM76C8128ALLFW70
2830
2831***************************************************************************/
2832
26642833ROM_START( penbros )
2665   ROM_REGION( 0x100000, "maincpu", 0 )      /* TMP68301 Code */
2834   ROM_REGION( 0x100000, "maincpu", 0 )   // TMP68301 Code
26662835   ROM_LOAD16_BYTE( "u06.bin", 0x000000, 0x080000, CRC(7bbdffac) SHA1(d5766cb171b8d2e4c04a6bae37181fa5ada9d797) )
26672836   ROM_LOAD16_BYTE( "u07.bin", 0x000001, 0x080000, CRC(d50cda5f) SHA1(fc66f55f2070b447c5db85c948ce40adc37512f7) )
26682837
2669   ROM_REGION( 0x1000000, "gfx1", 0 )   /* Sprites */
2838   ROM_REGION( 0x1000000, "sprites", 0 )   // Sprites
26702839   ROM_LOAD( "u38.bin", 0x000000, 0x400000, CRC(4247b39e) SHA1(f273931293beced312e02c870bf35e9cf0c91a8b) )
26712840   ROM_LOAD( "u39.bin", 0x400000, 0x400000, CRC(f9f07faf) SHA1(66fc4a9ad422fb384d2c775e43619137226898fc) )
26722841   ROM_LOAD( "u40.bin", 0x800000, 0x400000, CRC(dc9e0a96) SHA1(c2c8ccf9039ee0e179b08fdd2d37f29899349cda) )
2673   ROM_FILL(            0xc00000, 0x400000, 0 )   /* 6bpp instead of 8bpp */
2842   ROM_FILL(            0xc00000, 0x400000, 0 )   // 6bpp instead of 8bpp
26742843
2675   ROM_REGION( 0x300000, "x1snd", 0 )   /* Samples */
2676   /* Leave 1MB empty (addressable by the chip) */
2844   ROM_REGION( 0x300000, "x1snd", 0 )   // Samples
2845   // Leave 1MB empty (addressable by the chip)
26772846   ROM_LOAD( "u18.bin", 0x100000, 0x200000, CRC(de4e65e2) SHA1(82d4e590c714b3e9bf0ffaf1500deb24fd315595) )
26782847ROM_END
26792848
2849/***************************************************************************
2850
2851Reel'N Quake!
2852
2853Board:
2854  0594 (Sticker)
2855
2856CPU:
2857  TMP68301AF-16 CPU
2858  50MHz Osc.
2859
2860Video:
2861  NEC DX-101? 9546KK002 (@ U10)
2862  3 x NEC DX-102? (@ U28, U30 & U45)
2863  28MHz Osc.
2864
2865Sound:
2866  Seta X1-010 (@ U32)
2867  Volume Trimmer
2868
2869Other:
2870  Push Button (@ SW1)
2871  2 x DSW8 (@ DSW1 & DSW2)
2872  3.6V Battery (@ BT1)
2873  MAX232CPE (@ U60)
2874
2875ROMs:
2876  2 x 27C4001 (@ U2-3)
2877  5 x 23C32000 (@ U15-18, U32)
2878  GAL 16V8? (@ U38)
2879
2880Note:
2881
2882  The PCB is silkscreened with 23C32000 which would be equal to the 27C322.
2883  The graphics roms dumped that way have the first half as a bad mirror
2884  of the second half (even <- odd, odd <- FF). They seem OK dumped as 27C160.
2885
2886***************************************************************************/
2887
2888ROM_START( reelquak )
2889   ROM_REGION( 0x100000, "maincpu", 0 )   // TMP68301 Code
2890   ROM_LOAD16_BYTE( "rq_ver1.05.u2", 0x00000, 0x80000, CRC(7740d7a4) SHA1(21c28db5d4d7eea5a2506cb51b58533eba28c2cb) )
2891   ROM_LOAD16_BYTE( "rq_ver1.05.u3", 0x00001, 0x80000, CRC(8c78889e) SHA1(584ba123e9caafdbddc96a4d9b2b6f6994fa84b0) )
2892
2893   ROM_REGION( 0x800000, "sprites", 0 )   // Sprites
2894   ROM_LOAD( "kf-001-005_t42.u16", 0x000000, 0x200000, CRC(25e07d5c) SHA1(dd0818611f39be25dc6f0c737da4e79c6c0f9659) )
2895   ROM_LOAD( "kf-001-006_t43.u15", 0x200000, 0x200000, CRC(67e2ecc4) SHA1(35cdaf7fcd29e0229da104baced41fa7620dba3d) )
2896   ROM_LOAD( "kf-001-007_t44.u18", 0x400000, 0x200000, CRC(9daec83d) SHA1(07de144898deac5058d05466f29682d7840323b7) )
2897   ROM_LOAD( "kf-001-008_t45.u17", 0x600000, 0x200000, CRC(f6ef6e41) SHA1(c3e838dd4dc340f44abdf45ec0b90de24f50dda9) )
2898
2899   ROM_REGION( 0x300000, "x1snd", 0 )   // Samples
2900   // Leave 1MB empty (addressable by the chip)
2901   ROM_LOAD( "kf-001-009_t46.u32", 0x100000, 0x200000, CRC(2a9641f9) SHA1(efb9df78f1877eddf29c4dae2461546adb9cea8f) )
2902
2903    ROM_REGION( 0x117, "plds", 0 )
2904    ROM_LOAD( "gal16v8_kf-001.u38", 0x000, 0x117, NO_DUMP )
2905ROM_END
2906
2907/***************************************************************************
2908
2909Sammy USA Outdoor Shooting Series PCB
2910
2911PCB B0-003A (or B0-003B):
2912   Deer Hunting USA (c) 2000 Sammy USA
2913   Turkey Hunting USA (c) 2001 Sammy USA
2914
2915PCB B0-010A:
2916   Wing Shooting Championship (c) 2001 Sammy USA
2917   Trophy Hunting - Bear & Moose (c) 2002 Sammy USA
2918
2919
2920   CPU: Toshiba TMP68301AF-16 (100 Pin PQFP)
2921 Video: NEC DX-101 (240 Pin PQFP)
2922        NEC DX-102 (52 Pin PQFP x3)
2923 Sound: X1-010 (Mitsubishi M60016 Gate Array, 80 Pin PQFP)
2924EEPROM: 93LC46BX (1K Low-power 64 x 16-bit organization serial EEPROM)
2925   OSC: 50MHz & 28MHz
2926 Other: 8 Position Dipswitch x 2
2927        Lattice ispLSI2032 - stamped "KW001"
2928        Lattice isp1016E - stamped "GUN" (2 for PCB B0-010A, used for light gun input)
2929        BAT1 - CR2032 3Volt
2930
2931PCB Number: B0-003A (or B0-003B)
2932+-----------------------------------------------------------+
2933|             VOL                          +------+         |
2934|                                          |X1-010|     M1  |
2935|   +---+ +---+                            |M60016|         |
2936|   |   | |   |  M    M                    |CALRUA|  +---+  |
2937+-+ | U | | U |  2    1                    +------+  |   |  |
2938  | | 0 | | 0 |                                      |   |  |
2939+-+ | 7 | | 6 |  M    M                              | U |  |
2940|   |   | |   |  2    1                              | 1 |  |
2941|   +---+ +---+                                      | 8 |  |
2942|                                          Lattice   |   |  |
2943|J  D +---+  C                            ispLSI2032 |   |  |
2944|A  S |DX |  N   BAT1           +-------+            +---+  |
2945|M  W |102|  5                  |Toshiba|  D                |
2946|M  1 +---+                     |  TMP  |  S EEPROM       C |
2947|A           C                  | 68301 |  W              N |
2948|            N  Lattice         +-------+  2              2 |
2949|C           6  isp1016E                                    |
2950|o                              +----------+    50MHz       |
2951|n    +---+                     |          |                |
2952|n    |DX |  SW1                |   NEC    |    M   M       |
2953|e    |102|                     |  DX-101  |    3   3       |
2954|c    +---+         M  M        |          |                |
2955|t                  1  1        |          |                |
2956|e                              +----------+                |
2957|r                                                          |
2958|                             +---+      +---++---++---+    |
2959|                  28MHz      |   |      |   ||   ||   |    |
2960|     +---+                   |   |      |   ||   ||   |    |
2961+-+   |DX |                   | U |      | U || U || U |    |
2962  |   |102|                   | 4 |      | 4 || 3 || 3 |    |
2963+-+   +---+                   | 0 |      | 1 || 8 || 9 |    |
2964|                             |   |      |   ||   ||   |    |
2965|                             |   |      |   ||   ||   |    |
2966|                             +---+      +---++---++---+    |
2967+-----------------------------------------------------------+
2968
2969PCB Number: B0-010A - This PCB is slightly revised for 2 player play
2970+-----------------------------------------------------------+
2971|             VOL                          +------+         |
2972|                                          |X1-010|     M1  |
2973|   +---+ +---+                            |M60016|         |
2974|   |   | |   |  M    M                    |CALRUA|  +---+  |
2975+-+ | U | | U |  2    1                    +------+  |   |  |
2976  | | 0 | | 0 |                                      |   |  |
2977+-+ | 7 | | 6 |  M    M                              | U |  |
2978|   |   | |   |  2    1                              | 1 |  |
2979|   +---+ +---+                                      | 8 |  |
2980|                                          Lattice   |   |  |
2981|J  D +---+  C                            ispLSI2032 |   |  |
2982|A  S |DX |  N   BAT1           +-------+            +---+  |
2983|M  W |102|  5                  |Toshiba|  D                |
2984|M  1 +---+                     |  TMP  |  S EEPROM       C |
2985|A           C                  | 68301 |  W              N |
2986|            N  Lattice         +-------+  2              2 |
2987|C           6  isp1016E                                    |
2988|o                              +----------+    50MHz       |
2989|n    +---+                     |          |                |
2990|n    |DX |  SW1                |   NEC    |    M   M       |
2991|e    |102|                     |  DX-101  |    3   3       |
2992|c    +---+         M  M        |          |                |
2993|t                  1  1        |          |                |
2994|e                              +----------+                |
2995|r                                                          |
2996|                             +---+      +---++---++---+    |
2997|                  28MHz      |   |      |   ||   ||   |    |
2998|     +---+              C    |   |      |   ||   ||   |    |
2999+-+   |DX |              N    | U |      | U || U || U |    |
3000  |   |102|              7    | 4 |      | 4 || 3 || 3 |    |
3001+-+   +---+                   | 0 |      | 1 || 8 || 9 |    |
3002|             Lattice    C    |   |      |   ||   ||   |    |
3003|             isp1016E   N    |   |      |   ||   ||   |    |
3004|                        8    +---+      +---++---++---+    |
3005+-----------------------------------------------------------+
3006
3007Ram M1 are Toshiba TC55257DFL-70L
3008Ram M2 are NEC D43001GU-70L
3009Ram M3 are ISSI IS62C1024L-70Q
3010
3011U06 Program rom ST27C801 (even)
3012U07 Program rom ST27C801 (odd)
3013
3014U18 Mask rom (Samples 23C32000 32Mbit (read as 27C322))
3015
3016U38 - U40 Mask roms (Graphics 23c64020 64Mbit) - 23C64020 read as 27C322 with pin11 +5v & 27C322 with pin11 GND
3017
3018--------------------------------------------------------------------------
3019
3020From the WSC upgrade instruction sheet:
3021
3022 Wing Shooting Championship
3023      Game Echancement
3024          1/23/02
3025
3026New Program chip Ver. 2.00 For Wing Shooting Championship
3027We are announcing NEW GAME FEATURES to enhance game play. Please refer below.
3028
3029NEW FEATURES
3030------------
3031
3032 * Easier play for the first 3 hunting spots in every state with the addition of more birds.
3033 * The "BEGINNER" weapon has been changed to the 5-shot PUMP SHOTGUN plus the "hit area"
3034    for each shot has been increased. Same as the 3-shot SEMI-AUTO SHOTGUN.
3035 * Player can now advance through all result screens faster by pulling gun trigger.
3036 * The Auto Select bird is now GOOSE (easiest target) if player fails to choose bird at start of game.
3037
3038***************************************************************************/
3039
26803040ROM_START( deerhunt ) /* Deer Hunting USA V4.3 (11/1/2000) - The "E05" breaks version label conventions but is correct & verified */
2681   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
3041   ROM_REGION( 0x200000, "maincpu", 0 )   // TMP68301 Code
26823042   ROM_LOAD16_BYTE( "as0906e05.u06", 0x000000, 0x100000, CRC(20c81f17) SHA1(d41d93d6ee88738cec55f7bf3ce6be1dbec68e09) ) /* checksum 694E printed on label */
26833043   ROM_LOAD16_BYTE( "as0907e05.u07", 0x000001, 0x100000, CRC(1731aa2a) SHA1(cffae7a99a7f960a62ef0c4454884df17a93c1a6) ) /* checksum 5D89 printed on label */
26843044
2685   ROM_REGION( 0x2000000, "gfx1", 0 )   /* Sprites */
3045   ROM_REGION( 0x2000000, "sprites", 0 )   // Sprites
26863046   ROM_LOAD( "as0901m01.u38", 0x0000000, 0x800000, CRC(1d6acf8f) SHA1(6f61fe21bebb7c87e8e6c3ef3ba73b8cf327dde9) )
26873047   ROM_LOAD( "as0902m01.u39", 0x0800000, 0x800000, CRC(c7ca2128) SHA1(86be3a3ec2f86f61acfa3d4d261faea3c27dc378) )
26883048   ROM_LOAD( "as0903m01.u40", 0x1000000, 0x800000, CRC(e8ef81b3) SHA1(97666942ca6cca5b8ea6451314a2aaabad9e06ba) )
26893049   ROM_LOAD( "as0904m01.u41", 0x1800000, 0x800000, CRC(d0f97fdc) SHA1(776c9d42d03a9f61155521212305e1ed696eaf47) )
26903050
2691   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2692   /* Leave 1MB empty (addressable by the chip) */
3051   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
3052   // Leave 1MB empty (addressable by the chip)
26933053   ROM_LOAD( "as0905m01.u18", 0x100000, 0x400000, CRC(8d8165bb) SHA1(aca7051613d260734ee787b4c3db552c336bd600) )
26943054ROM_END
26953055
26963056ROM_START( deerhunta ) /* Deer Hunting USA V4.2 (xx/x/2000) */
2697   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
3057   ROM_REGION( 0x200000, "maincpu", 0 )   // TMP68301 Code
26983058   ROM_LOAD16_BYTE( "as0906e04-v4_2.u06", 0x000000, 0x100000, CRC(bb3af36f) SHA1(f04071347e8ad361bf666fcb6c0136e522f19d47) ) /* checksum 6640 printed on label */
26993059   ROM_LOAD16_BYTE( "as0907e04-v4_2.u07", 0x000001, 0x100000, CRC(83f02117) SHA1(70fc2291bc93af3902aae88688be6a8078f7a07e) ) /* checksum 595A printed on label */
27003060
2701   ROM_REGION( 0x2000000, "gfx1", 0 )   /* Sprites */
3061   ROM_REGION( 0x2000000, "sprites", 0 )   // Sprites
27023062   ROM_LOAD( "as0901m01.u38", 0x0000000, 0x800000, CRC(1d6acf8f) SHA1(6f61fe21bebb7c87e8e6c3ef3ba73b8cf327dde9) )
27033063   ROM_LOAD( "as0902m01.u39", 0x0800000, 0x800000, CRC(c7ca2128) SHA1(86be3a3ec2f86f61acfa3d4d261faea3c27dc378) )
27043064   ROM_LOAD( "as0903m01.u40", 0x1000000, 0x800000, CRC(e8ef81b3) SHA1(97666942ca6cca5b8ea6451314a2aaabad9e06ba) )
27053065   ROM_LOAD( "as0904m01.u41", 0x1800000, 0x800000, CRC(d0f97fdc) SHA1(776c9d42d03a9f61155521212305e1ed696eaf47) )
27063066
2707   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2708   /* Leave 1MB empty (addressable by the chip) */
3067   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
3068   // Leave 1MB empty (addressable by the chip)
27093069   ROM_LOAD( "as0905m01.u18", 0x100000, 0x400000, CRC(8d8165bb) SHA1(aca7051613d260734ee787b4c3db552c336bd600) )
27103070ROM_END
27113071
27123072ROM_START( deerhuntb ) /* Deer Hunting USA V4.0 (6/15/2000) */
2713   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
3073   ROM_REGION( 0x200000, "maincpu", 0 )      // TMP68301 Code
27143074   ROM_LOAD16_BYTE( "as0906e04.u06", 0x000000, 0x100000, CRC(07d9b64a) SHA1(f9aac644aab920bbac84b14836ee589ccd51f6db) ) /* checksum 7BBB printed on label */
27153075   ROM_LOAD16_BYTE( "as0907e04.u07", 0x000001, 0x100000, CRC(19973d08) SHA1(da1cc02ce480a62ccaf94d0af1246a340f054b43) ) /* checksum 4C78 printed on label */
27163076
2717   ROM_REGION( 0x2000000, "gfx1", 0 )   /* Sprites */
3077   ROM_REGION( 0x2000000, "sprites", 0 )   // Sprites
27183078   ROM_LOAD( "as0901m01.u38", 0x0000000, 0x800000, CRC(1d6acf8f) SHA1(6f61fe21bebb7c87e8e6c3ef3ba73b8cf327dde9) )
27193079   ROM_LOAD( "as0902m01.u39", 0x0800000, 0x800000, CRC(c7ca2128) SHA1(86be3a3ec2f86f61acfa3d4d261faea3c27dc378) )
27203080   ROM_LOAD( "as0903m01.u40", 0x1000000, 0x800000, CRC(e8ef81b3) SHA1(97666942ca6cca5b8ea6451314a2aaabad9e06ba) )
27213081   ROM_LOAD( "as0904m01.u41", 0x1800000, 0x800000, CRC(d0f97fdc) SHA1(776c9d42d03a9f61155521212305e1ed696eaf47) )
27223082
2723   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2724   /* Leave 1MB empty (addressable by the chip) */
3083   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
3084   // Leave 1MB empty (addressable by the chip)
27253085   ROM_LOAD( "as0905m01.u18", 0x100000, 0x400000, CRC(8d8165bb) SHA1(aca7051613d260734ee787b4c3db552c336bd600) )
27263086ROM_END
27273087
27283088   /* There are known versions 3.x of Deer Hunting USA.... just none are currently dumped.  roms should be "AS0906 E03 U06" & "AS0907 E03 U07" */
27293089
27303090ROM_START( deerhuntc ) /* Deer Hunting USA V2.x - No version number is printed to screen but "E02" in EPROM label signifies V2 */
2731   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
3091   ROM_REGION( 0x200000, "maincpu", 0 )   // TMP68301 Code
27323092   ROM_LOAD16_BYTE( "as0906e02.u06", 0x000000, 0x100000, CRC(190cca42) SHA1(aef63f5e8c71ed0156b8b0104c5d23872c119167) ) /* Version in program code is listed as 0.00 */
27333093   ROM_LOAD16_BYTE( "as0907e02.u07", 0x000001, 0x100000, CRC(9de2b901) SHA1(d271bc54c41e30c0d9962eedd22f3ef2b7b8c9e5) ) /* Verified with two different sets of chips */
27343094
2735   ROM_REGION( 0x2000000, "gfx1", 0 )   /* Sprites */
3095   ROM_REGION( 0x2000000, "sprites", 0 )   // Sprites
27363096   ROM_LOAD( "as0901m01.u38", 0x0000000, 0x800000, CRC(1d6acf8f) SHA1(6f61fe21bebb7c87e8e6c3ef3ba73b8cf327dde9) )
27373097   ROM_LOAD( "as0902m01.u39", 0x0800000, 0x800000, CRC(c7ca2128) SHA1(86be3a3ec2f86f61acfa3d4d261faea3c27dc378) )
27383098   ROM_LOAD( "as0903m01.u40", 0x1000000, 0x800000, CRC(e8ef81b3) SHA1(97666942ca6cca5b8ea6451314a2aaabad9e06ba) )
27393099   ROM_LOAD( "as0904m01.u41", 0x1800000, 0x800000, CRC(d0f97fdc) SHA1(776c9d42d03a9f61155521212305e1ed696eaf47) )
27403100
2741   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2742   /* Leave 1MB empty (addressable by the chip) */
3101   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
3102   // Leave 1MB empty (addressable by the chip)
27433103   ROM_LOAD( "as0905m01.u18", 0x100000, 0x400000, CRC(8d8165bb) SHA1(aca7051613d260734ee787b4c3db552c336bd600) )
27443104ROM_END
27453105
27463106ROM_START( turkhunt ) /* V1.0 is currently the only known version */
2747   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
3107   ROM_REGION( 0x200000, "maincpu", 0 )   // TMP68301 Code
27483108   ROM_LOAD16_BYTE( "asx906e01.u06", 0x000000, 0x100000, CRC(c96266e1) SHA1(0ca462b3b0f27198e36384eee6ea5c5d4e7e1293) ) /* checksum E510 printed on label */
27493109   ROM_LOAD16_BYTE( "asx907e01.u07", 0x000001, 0x100000, CRC(7c67b502) SHA1(6a0e8883a115dac4095d86897e7eca2a007a1c71) ) /* checksum AB40 printed on label */
27503110
2751   ROM_REGION( 0x2000000, "gfx1", 0 )   /* Sprites */
3111   ROM_REGION( 0x2000000, "sprites", 0 )   // Sprites
27523112   ROM_LOAD( "asx901m01.u38", 0x0000000, 0x800000, CRC(eabd3f44) SHA1(5a1ac986d11a8b019e18761cf4ea0a6f49fbdbfc) )
27533113   ROM_LOAD( "asx902m01.u39", 0x0800000, 0x800000, CRC(c32130c8) SHA1(70d56ebed1f51657aaee02f95ac51589733e6eb7) )
27543114   ROM_LOAD( "asx903m01.u40", 0x1000000, 0x800000, CRC(5f86c322) SHA1(5a72adb99eea176199f172384cb051e2b045ab94) )
27553115   ROM_LOAD( "asx904m01.u41", 0x1800000, 0x800000, CRC(c77e0b66) SHA1(0eba30e62e4bd38c198fa6cb69fb94d002ded77a) )
27563116
2757   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2758   /* Leave 1MB empty (addressable by the chip) */
3117   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
3118   // Leave 1MB empty (addressable by the chip)
27593119   ROM_LOAD( "asx905m01.u18", 0x100000, 0x400000, CRC(8d9dd9a9) SHA1(1fc2f3688d2c24c720dca7357bca6bf5f4016c53) )
27603120ROM_END
27613121
27623122ROM_START( wschamp ) /* Wing Shootiong Championship V2.00 (01/23/2002) */
2763   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
3123   ROM_REGION( 0x200000, "maincpu", 0 )   // TMP68301 Code
27643124   ROM_LOAD16_BYTE( "as1006e03.u06", 0x000000, 0x100000, CRC(0ad01677) SHA1(63e09b9f7cc8b781af1756f86caa0cc0962ae584) ) /* checksum 421E printed on label */
27653125   ROM_LOAD16_BYTE( "as1007e03.u07", 0x000001, 0x100000, CRC(572624f0) SHA1(0c2f67daa22f4edd66a2be990dc6cd999faff0fa) ) /* checksum A48F printed on label */
27663126
2767   ROM_REGION( 0x2000000, "gfx1", 0 )   /* Sprites */
3127   ROM_REGION( 0x2000000, "sprites", 0 )   // Sprites
27683128   ROM_LOAD( "as1001m01.u38", 0x0000000, 0x800000, CRC(92595579) SHA1(75a7131aedb18b7103677340c3cca7c91aaca2bf) )
27693129   ROM_LOAD( "as1002m01.u39", 0x0800000, 0x800000, CRC(16c2bb08) SHA1(63926464c8bd8db7d05905a953765e645942beb4) )
27703130   ROM_LOAD( "as1003m01.u40", 0x1000000, 0x800000, CRC(89618858) SHA1(a8bd07f233482e8f5a256af7ff9577648eb58ef4) )
27713131   ROM_LOAD( "as1004m01.u41", 0x1800000, 0x800000, CRC(500c0909) SHA1(73ff27d46b9285f34a50a81c21c54437f21e1939) )
27723132
2773   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2774   /* Leave 1MB empty (addressable by the chip) */
3133   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
3134   // Leave 1MB empty (addressable by the chip)
27753135   ROM_LOAD( "as1005m01.u18", 0x100000, 0x400000, CRC(e4b137b8) SHA1(4d8d15073c51f7d383282cc5755ae5b2eab6226c) )
27763136ROM_END
27773137
27783138ROM_START( wschampa ) /* Wing Shootiong Championship V1.01 */
2779   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
3139   ROM_REGION( 0x200000, "maincpu", 0 )   // TMP68301 Code
27803140   ROM_LOAD16_BYTE( "as1006e02.u06", 0x000000, 0x100000, CRC(d3d3b2b5) SHA1(2d036d795b40a4ed78bb9f7751f875cfc76276a9) ) /* checksum 31EF printed on label */
27813141   ROM_LOAD16_BYTE( "as1007e02.u07", 0x000001, 0x100000, CRC(78ede6d9) SHA1(e6d10f52cd4c6bf97288df44911f23bb64fc012c) ) /* checksum 615E printed on label */
27823142
2783   ROM_REGION( 0x2000000, "gfx1", 0 )   /* Sprites */
3143   ROM_REGION( 0x2000000, "sprites", 0 )   // Sprites
27843144   ROM_LOAD( "as1001m01.u38", 0x0000000, 0x800000, CRC(92595579) SHA1(75a7131aedb18b7103677340c3cca7c91aaca2bf) )
27853145   ROM_LOAD( "as1002m01.u39", 0x0800000, 0x800000, CRC(16c2bb08) SHA1(63926464c8bd8db7d05905a953765e645942beb4) )
27863146   ROM_LOAD( "as1003m01.u40", 0x1000000, 0x800000, CRC(89618858) SHA1(a8bd07f233482e8f5a256af7ff9577648eb58ef4) )
27873147   ROM_LOAD( "as1004m01.u41", 0x1800000, 0x800000, CRC(500c0909) SHA1(73ff27d46b9285f34a50a81c21c54437f21e1939) )
27883148
2789   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2790   /* Leave 1MB empty (addressable by the chip) */
3149   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
3150   // Leave 1MB empty (addressable by the chip)
27913151   ROM_LOAD( "as1005m01.u18", 0x100000, 0x400000, CRC(e4b137b8) SHA1(4d8d15073c51f7d383282cc5755ae5b2eab6226c) )
27923152ROM_END
27933153
27943154ROM_START( trophyh ) /* V1.0 is currently the only known version */
2795   ROM_REGION( 0x200000, "maincpu", 0 )      /* TMP68301 Code */
3155   ROM_REGION( 0x200000, "maincpu", 0 )   // TMP68301 Code
27963156   ROM_LOAD16_BYTE( "as1106e01.u06", 0x000000, 0x100000, CRC(b4950882) SHA1(2749f7ffc5b543c9f39815f0913a1d1e385b63f4) ) /* checksum D8DA printed on label */
27973157   ROM_LOAD16_BYTE( "as1107e01.u07", 0x000001, 0x100000, CRC(19ee67cb) SHA1(e75ce66d3ff5aad46ba997c09d6514260e617f55) ) /* checksum CEEF printed on label */
27983158
2799   ROM_REGION( 0x2000000, "gfx1", 0 )   /* Sprites */
3159   ROM_REGION( 0x2000000, "sprites", 0 )   // Sprites
28003160   ROM_LOAD( "as1101m01.u38", 0x0000000, 0x800000, CRC(855ed675) SHA1(84ce229a9feb6331413253a5aed10b362e8102e5) )
28013161   ROM_LOAD( "as1102m01.u39", 0x0800000, 0x800000, CRC(d186d271) SHA1(3c54438b35adfab8be91df0a633270d6db49beef) )
28023162   ROM_LOAD( "as1103m01.u40", 0x1000000, 0x800000, CRC(adf8a54e) SHA1(bb28bf219d18082246f7964851a5c49b9c0ba7f5) )
28033163   ROM_LOAD( "as1104m01.u41", 0x1800000, 0x800000, CRC(387882e9) SHA1(0fdd0c77dabd1066c6f3bd64e357236a76f524ab) )
28043164
2805   ROM_REGION( 0x500000, "x1snd", 0 )   /* Samples */
2806   /* Leave 1MB empty (addressable by the chip) */
3165   ROM_REGION( 0x500000, "x1snd", 0 )   // Samples
3166   // Leave 1MB empty (addressable by the chip)
28073167   ROM_LOAD( "as1105m01.u18", 0x100000, 0x400000, CRC(633d0df8) SHA1(3401c424f5c207ef438a9269e0c0e7d482771fed) )
28083168ROM_END
28093169
2810ROM_START( funcube2 )
2811   ROM_REGION( 0x80000, "maincpu", 0 ) /* XCF5206 Code */
2812   ROM_LOAD( "fc21_prg-0b.u3", 0x00000, 0x80000, CRC(add1c8a6) SHA1(bf91518da659098a4bad4e756533525fcc910570) )
28133170
2814   ROM_REGION( 0x20000, "sub", 0 ) /* H8/3007 Code */
2815   ROM_LOAD( "fc21_iopr-0.u49", 0x00000, 0x20000, CRC(314555ef) SHA1(b17e3926c8ef7f599856c198c330d2051aae13ad) )
2816
2817   ROM_REGION( 0x300, "pic", 0 ) /* PIC12C508? Code */
2818   ROM_LOAD( "fc21a", 0x000, 0x300, NO_DUMP )
2819
2820   ROM_REGION( 0x800000, "gfx1", 0 )
2821   ROM_LOAD32_WORD( "fc21_obj-0.u43", 0x000000, 0x400000, CRC(08cfe6d9) SHA1(d10f362dcde01f7a9855d8f76af3084b5dd1573a) )
2822   ROM_LOAD32_WORD( "fc21_obj-1.u42", 0x000002, 0x400000, CRC(4c1fbc20) SHA1(ff83691c19ce3600b31c494eaec26d2ac79e0028) )
2823
2824   ROM_REGION( 0x1000000, "oki", 0 )
2825   ROM_LOAD( "fc21_voi0.u47", 0x000000, 0x400000, CRC(25b5fc3f) SHA1(18b16a14e9ee62f3fea382e9d3fdcd43bdb165f5) )
2826ROM_END
2827
2828ROM_START( funcube4 )
2829   ROM_REGION( 0x80000, "maincpu", 0 ) /* XCF5206 Code */
2830   ROM_LOAD( "fc41_prg-0.u3", 0x00000, 0x80000, CRC(ef870874) SHA1(dcb8dc3f780ca135df55e4b4f3c95620597ad28f) )
2831
2832   ROM_REGION( 0x20000, "sub", 0 ) /* H8/3007 Code */
2833   ROM_LOAD( "fc21_iopr-0.u49", 0x00000, 0x20000, CRC(314555ef) SHA1(b17e3926c8ef7f599856c198c330d2051aae13ad) )
2834
2835   ROM_REGION( 0x300, "pic", 0 ) /* PIC12C508? Code */
2836   ROM_LOAD( "fc41a", 0x000, 0x300, NO_DUMP )
2837
2838   ROM_REGION( 0x800000, "gfx1", 0 )
2839   ROM_LOAD32_WORD( "fc41_obj-0.u43", 0x000000, 0x400000, CRC(9ff029d5) SHA1(e057f4929aa745ecaf9d4ff7e39974c82e440146) )
2840   ROM_LOAD32_WORD( "fc41_obj-1.u42", 0x000002, 0x400000, CRC(5ab7b087) SHA1(c600158b2358cdf947357170044dda2deacd4f37) )
2841
2842   ROM_REGION( 0x1000000, "oki", 0 )
2843   ROM_LOAD( "fc41_snd0.u47", 0x000000, 0x400000, CRC(48337257) SHA1(d1755024b824100070b489f48f6ae921765329e8) )
2844ROM_END
2845
2846static DRIVER_INIT( funcube2 )
2847{
2848   UINT32 *main_cpu = (UINT32 *) machine->region("maincpu")->base();
2849   UINT16 *sub_cpu  = (UINT16 *) machine->region("sub")->base();
2850
2851   main_cpu[0x810/4] = 0xe0214e71;
2852   main_cpu[0x814/4] = 0x4e71203c;
2853
2854   main_cpu[0x81c/4] = 0x4e714e71;
2855
2856   main_cpu[0xa5c/4] = 0x4e713e3c;
2857   main_cpu[0xa74/4] = 0x4e713e3c;
2858   main_cpu[0xa8c/4] = 0x4e7141f9;
2859
2860   // Sub CPU
2861   sub_cpu[0x4d4/2] = 0x5470;   // rte -> rts
2862
2863    // Audio
2864    // The first half of the rom appears to be a dupe of the second half with 0xffs destructively interleaved
2865   UINT8* oki = (UINT8*) machine->region("oki")->base();
2866    for (int i = 0; i < 0x200000; i++)
2867    {
2868        oki[i] = oki[i+0x200000];
2869    }
2870}
2871
2872// Note: same as funcube2
2873static DRIVER_INIT( funcube4 )
2874{
2875   UINT32 *main_cpu = (UINT32 *) machine->region("maincpu")->base();
2876   UINT16 *sub_cpu  = (UINT16 *) machine->region("sub")->base();
2877
2878   main_cpu[0x810/4] = 0xe0214e71;
2879   main_cpu[0x814/4] = 0x4e71203c;
2880
2881   main_cpu[0x81c/4] = 0x4e714e71;
2882
2883   main_cpu[0xa5c/4] = 0x4e713e3c;
2884   main_cpu[0xa74/4] = 0x4e713e3c;
2885   main_cpu[0xa8c/4] = 0x4e7141f9;
2886
2887   // Sub CPU
2888   sub_cpu[0x4d4/2] = 0x5470;   // rte -> rts
2889   
2890    // Audio
2891    // The first half of the rom appears to be a dupe of the second half with 0xffs destructively interleaved
2892   UINT8* oki = (UINT8*) machine->region("oki")->base();
2893    for (int i = 0; i < 0x200000; i++)
2894    {
2895        oki[i] = oki[i+0x200000];
2896    }
2897}
2898
28993171GAME( 1994, gundamex, 0,        gundamex, gundamex, 0,        ROT0, "Banpresto",             "Mobile Suit Gundam EX Revue",                  0 )
29003172GAME( 1995, grdians,  0,        grdians,  grdians,  0,        ROT0, "Banpresto",             "Guardians / Denjin Makai II",                  GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS )   // Displays (c) Winky Soft at game's end.
29013173GAME( 1996, mj4simai, 0,        mj4simai, mj4simai, 0,        ROT0, "Maboroshi Ware",        "Wakakusamonogatari Mahjong Yonshimai (Japan)", GAME_NO_COCKTAIL )
r10613r10614
29113183GAME( 2001, wschamp,  0,        samshoot, wschamp,  0,        ROT0, "Sammy USA Corporation", "Wing Shooting Championship V2.00",             GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS )
29123184GAME( 2001, wschampa, wschamp,  samshoot, wschamp,  0,        ROT0, "Sammy USA Corporation", "Wing Shooting Championship V1.01",             GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS )
29133185GAME( 2002, trophyh,  0,        samshoot, trophyh,  0,        ROT0, "Sammy USA Corporation", "Trophy Hunting - Bear & Moose V1.0",           GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS )
2914GAME( 2001, funcube2, 0,        funcube,  funcube,  funcube2, ROT0, "Namco",                 "Funcube 2 (v1.1)",                             GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND )
2915GAME( 2001, funcube4, 0,        funcube,  funcube4, funcube4, ROT0, "Namco",                 "Funcube 4 (v1.0)",                             GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND )
3186GAME( 2001, funcube2, 0,        funcube,  funcube,  funcube2, ROT0, "Namco",                 "Funcube 2 (v1.1)",                             GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS )
3187GAME( 2001, funcube4, 0,        funcube,  funcube4, funcube4, ROT0, "Namco",                 "Funcube 4 (v1.0)",                             GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS )
3188GAME( ????, reelquak, 0,        reelquak, reelquak, 0,        ROT0, "<unknown>",             "Reel'N Quake! (Ver. 1.05)",                    GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/terracre.c
r10613r10614
8989#include "sound/3526intf.h"
9090#include "includes/terracre.h"
9191
92static const UINT16 *mpProtData;
93static UINT8 mAmazonProtCmd;
94static UINT8 mAmazonProtReg[6];
9592
9693static const UINT16 mAmazonProtData[] =
9794{
r10613r10614
161158
162159static READ16_HANDLER( amazon_protection_r )
163160{
164   offset = mAmazonProtReg[2];
161   terracre_state *state = space->machine->driver_data<terracre_state>();
162   offset = state->mAmazonProtReg[2];
165163   if( offset<=0x56 )
166164   {
167165      UINT16 data;
168      data = mpProtData[offset/2];
166      data = state->mpProtData[offset/2];
169167      if( offset&1 ) return data&0xff;
170168      return data>>8;
171169   }
r10613r10614
174172
175173static WRITE16_HANDLER( amazon_protection_w )
176174{
175   terracre_state *state = space->machine->driver_data<terracre_state>();
177176   if( ACCESSING_BITS_0_7 )
178177   {
179178      if( offset==1 )
180179      {
181         mAmazonProtCmd = data;
180         state->mAmazonProtCmd = data;
182181      }
183182      else
184183      {
185         if( mAmazonProtCmd>=32 && mAmazonProtCmd<=0x37 )
184         if( state->mAmazonProtCmd>=32 && state->mAmazonProtCmd<=0x37 )
186185         {
187            mAmazonProtReg[mAmazonProtCmd-0x32] = data;
186            state->mAmazonProtReg[state->mAmazonProtCmd-0x32] = data;
188187         }
189188      }
190189   }
r10613r10614
192191
193192static MACHINE_START( amazon )
194193{
194   terracre_state *state = machine->driver_data<terracre_state>();
195195   /* set up for save */
196   state_save_register_global(machine, mAmazonProtCmd);
197   state_save_register_global_array(machine, mAmazonProtReg);
196   state_save_register_global(machine, state->mAmazonProtCmd);
197   state_save_register_global_array(machine, state->mAmazonProtReg);
198198}
199199
200200static ADDRESS_MAP_START( terracre_map, ADDRESS_SPACE_PROGRAM, 16 )
201201   AM_RANGE(0x000000, 0x01ffff) AM_ROM
202202   AM_RANGE(0x020000, 0x0201ff) AM_RAM AM_BASE_GENERIC(spriteram)
203203   AM_RANGE(0x020200, 0x021fff) AM_RAM
204   AM_RANGE(0x022000, 0x022fff) AM_WRITE(amazon_background_w) AM_BASE(&amazon_videoram)
204   AM_RANGE(0x022000, 0x022fff) AM_WRITE(amazon_background_w) AM_BASE_MEMBER(terracre_state, amazon_videoram)
205205   AM_RANGE(0x023000, 0x023fff) AM_RAM
206206   AM_RANGE(0x024000, 0x024001) AM_READ_PORT("P1")
207207   AM_RANGE(0x024002, 0x024003) AM_READ_PORT("P2")
r10613r10614
218218   AM_RANGE(0x000000, 0x01ffff) AM_ROM
219219   AM_RANGE(0x040000, 0x0401ff) AM_RAM AM_BASE_GENERIC(spriteram)
220220   AM_RANGE(0x040200, 0x040fff) AM_RAM
221   AM_RANGE(0x042000, 0x042fff) AM_WRITE(amazon_background_w) AM_BASE(&amazon_videoram)
221   AM_RANGE(0x042000, 0x042fff) AM_WRITE(amazon_background_w) AM_BASE_MEMBER(terracre_state, amazon_videoram)
222222   AM_RANGE(0x044000, 0x044001) AM_READ_PORT("IN0")
223223   AM_RANGE(0x044002, 0x044003) AM_READ_PORT("IN1")
224224   AM_RANGE(0x044004, 0x044005) AM_READ_PORT("IN2")
r10613r10614
978978
979979static DRIVER_INIT( amazon )
980980{
981   mpProtData = mAmazonProtData;
981   terracre_state *state = machine->driver_data<terracre_state>();
982   state->mpProtData = mAmazonProtData;
982983}
983984
984985static DRIVER_INIT( amatelas )
985986{
986   mpProtData = mAmatelasProtData;
987   terracre_state *state = machine->driver_data<terracre_state>();
988   state->mpProtData = mAmatelasProtData;
987989}
988990
989991static DRIVER_INIT( horekid )
990992{
991   mpProtData = mHoreKidProtData;
993   terracre_state *state = machine->driver_data<terracre_state>();
994   state->mpProtData = mHoreKidProtData;
992995   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x44004, 0x44005, 0, 0, horekid_IN2_r);
993996}
994997
src/mame/drivers/xtheball.c
r10613r10614
334334
335335   /* video hardware */
336336   MCFG_TLC34076_ADD("tlc34076", TLC34076_6_BIT)
337   
337
338338   MCFG_SCREEN_ADD("screen", RASTER)
339339   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
340340   MCFG_SCREEN_RAW_PARAMS(10000000, 640, 114, 626, 257, 24, 248)
src/mame/drivers/punchout.c
r10613r10614
148148      cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_RESET, CLEAR_LINE);
149149}
150150
151static int rp5c01_mode_sel; /* Mode selector */
152static int rp5c01_mem[16*4];
153151
154152static READ8_HANDLER( spunchout_rp5c01_r )
155153{
154   punchout_state *state = space->machine->driver_data<punchout_state>();
156155   logerror("%04x: prot_r %x\n", cpu_get_previouspc(space->cpu), offset);
157156
158157   if (offset <= 0x0c)
159158   {
160      switch (rp5c01_mode_sel & 3)
159      switch (state->rp5c01_mode_sel & 3)
161160      {
162161         case 0:   // time
163162            switch ( offset )
164163            {
165164               case 0x00:   // 1-second counter
166                  return rp5c01_mem[0x00];
165                  return state->rp5c01_mem[0x00];
167166
168167               case 0x01:   // 10-second counter
169                  return rp5c01_mem[0x01] & 0x7;
168                  return state->rp5c01_mem[0x01] & 0x7;
170169
171170               case 0x02:   // 1-minute counter
172                  return rp5c01_mem[0x02];
171                  return state->rp5c01_mem[0x02];
173172
174173               case 0x03:   // 10-minute counter
175                  return rp5c01_mem[0x03] & 0x07;
174                  return state->rp5c01_mem[0x03] & 0x07;
176175
177176               case 0x04:   // 1-hour counter
178                  return rp5c01_mem[0x04];
177                  return state->rp5c01_mem[0x04];
179178
180179               case 0x05:   // 10-hour counter
181                  return rp5c01_mem[0x05] & 0x03;
180                  return state->rp5c01_mem[0x05] & 0x03;
182181
183182               case 0x06:   // day-of-the-week counter
184                  return rp5c01_mem[0x06] & 0x07;
183                  return state->rp5c01_mem[0x06] & 0x07;
185184
186185               case 0x07:   // 1-day counter
187                  return rp5c01_mem[0x07];
186                  return state->rp5c01_mem[0x07];
188187
189188               case 0x08:   // 10-day counter
190                  return rp5c01_mem[0x08] & 0x03;
189                  return state->rp5c01_mem[0x08] & 0x03;
191190
192191               case 0x09:   // 1-month counter
193                  return rp5c01_mem[0x09];
192                  return state->rp5c01_mem[0x09];
194193
195194               case 0x0a:   // 10-month counter
196                  return rp5c01_mem[0x0a] & 0x01;
195                  return state->rp5c01_mem[0x0a] & 0x01;
197196
198197               case 0x0b:   // 1-year counter
199                  return rp5c01_mem[0x0b];
198                  return state->rp5c01_mem[0x0b];
200199
201200               case 0x0c:   // 10-year counter
202                  return rp5c01_mem[0x0c];
201                  return state->rp5c01_mem[0x0c];
203202            }
204203            break;
205204
r10613r10614
213212                  return 0x00;
214213
215214               case 0x02:   // 1-minute alarm register
216                  return rp5c01_mem[0x12];
215                  return state->rp5c01_mem[0x12];
217216
218217               case 0x03:   // 10-minute alarm register
219                  return rp5c01_mem[0x13] & 0x07;
218                  return state->rp5c01_mem[0x13] & 0x07;
220219
221220               case 0x04:   // 1-hour alarm register
222                  return rp5c01_mem[0x14];
221                  return state->rp5c01_mem[0x14];
223222
224223               case 0x05:   // 10-hour alarm register
225                  return rp5c01_mem[0x15] & 0x03;
224                  return state->rp5c01_mem[0x15] & 0x03;
226225
227226               case 0x06:   // day-of-the-week alarm register
228                  return rp5c01_mem[0x16] & 0x07;
227                  return state->rp5c01_mem[0x16] & 0x07;
229228
230229               case 0x07:   // 1-day alarm register
231                  return rp5c01_mem[0x17];
230                  return state->rp5c01_mem[0x17];
232231
233232               case 0x08:   // 10-day alarm register
234                  return rp5c01_mem[0x18] & 0x03;
233                  return state->rp5c01_mem[0x18] & 0x03;
235234
236235               case 0x09:   // n/a
237236                  return 0x00;
238237
239238               case 0x0a:   // /12/24 select register
240                  return rp5c01_mem[0x1a] & 0x01;
239                  return state->rp5c01_mem[0x1a] & 0x01;
241240
242241               case 0x0b:   // leap year count
243                  return rp5c01_mem[0x1b] & 0x03;
242                  return state->rp5c01_mem[0x1b] & 0x03;
244243
245244               case 0x0c:   // n/a
246245                  return 0x00;
r10613r10614
249248
250249         case 2:   // RAM BLOCK 10
251250         case 3:   // RAM BLOCK 11
252            return rp5c01_mem[0x10 * (rp5c01_mode_sel & 3) + offset];
251            return state->rp5c01_mem[0x10 * (state->rp5c01_mode_sel & 3) + offset];
253252      }
254253   }
255254   else if (offset == 0x0d)
256255   {
257      return rp5c01_mode_sel;
256      return state->rp5c01_mode_sel;
258257   }
259258
260   logerror("Read from unknown protection? port %02x ( selector = %02x )\n", offset, rp5c01_mode_sel );
259   logerror("Read from unknown protection? port %02x ( selector = %02x )\n", offset, state->rp5c01_mode_sel );
261260   return 0;
262261}
263262
264263static WRITE8_HANDLER( spunchout_rp5c01_w )
265264{
265   punchout_state *state = space->machine->driver_data<punchout_state>();
266266   data &= 0x0f;
267267
268268   logerror("%04x: prot_w %x = %02x\n",cpu_get_previouspc(space->cpu),offset,data);
269269
270270   if (offset <= 0x0c)
271271   {
272      rp5c01_mem[0x10 * (rp5c01_mode_sel & 3) + offset] = data;
272      state->rp5c01_mem[0x10 * (state->rp5c01_mode_sel & 3) + offset] = data;
273273   }
274274   else if (offset == 0x0d)
275275   {
276      rp5c01_mode_sel = data;
276      state->rp5c01_mode_sel = data;
277277      logerror("MODE: Timer EN = %d  Alarm EN = %d  MODE %d\n",BIT(data,3),BIT(data,2),data&3);
278278   }
279279   else if (offset == 0x0e)
r10613r10614
317317   AM_RANGE(0x0000, 0xbfff) AM_ROM
318318   AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_SHARE("nvram")
319319   AM_RANGE(0xd000, 0xd7ff) AM_RAM
320   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(punchout_bg_top_videoram_w) AM_BASE(&punchout_bg_top_videoram)
321   AM_RANGE(0xdff0, 0xdff7) AM_BASE(&punchout_spr1_ctrlram)
322   AM_RANGE(0xdff8, 0xdffc) AM_BASE(&punchout_spr2_ctrlram)
323   AM_RANGE(0xdffd, 0xdffd) AM_BASE(&punchout_palettebank)
324   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(punchout_spr1_videoram_w) AM_BASE(&punchout_spr1_videoram)
325   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(punchout_spr2_videoram_w) AM_BASE(&punchout_spr2_videoram)
326   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(punchout_bg_bot_videoram_w) AM_BASE(&punchout_bg_bot_videoram)   // also contains scroll RAM
320   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(punchout_bg_top_videoram_w) AM_BASE_MEMBER(punchout_state, bg_top_videoram)
321   AM_RANGE(0xdff0, 0xdff7) AM_BASE_MEMBER(punchout_state, spr1_ctrlram)
322   AM_RANGE(0xdff8, 0xdffc) AM_BASE_MEMBER(punchout_state, spr2_ctrlram)
323   AM_RANGE(0xdffd, 0xdffd) AM_BASE_MEMBER(punchout_state, palettebank)
324   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(punchout_spr1_videoram_w) AM_BASE_MEMBER(punchout_state, spr1_videoram)
325   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(punchout_spr2_videoram_w) AM_BASE_MEMBER(punchout_state, spr2_videoram)
326   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(punchout_bg_bot_videoram_w) AM_BASE_MEMBER(punchout_state, bg_bot_videoram)   // also contains scroll RAM
327327ADDRESS_MAP_END
328328
329329
r10613r10614
331331   AM_RANGE(0x0000, 0xbfff) AM_ROM
332332   AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_SHARE("nvram")
333333   AM_RANGE(0xd000, 0xd7ff) AM_RAM
334   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(armwrest_fg_videoram_w) AM_BASE(&armwrest_fg_videoram)
335   AM_RANGE(0xdff0, 0xdff7) AM_BASE(&punchout_spr1_ctrlram)
336   AM_RANGE(0xdff8, 0xdffc) AM_BASE(&punchout_spr2_ctrlram)
337   AM_RANGE(0xdffd, 0xdffd) AM_BASE(&punchout_palettebank)
338   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(punchout_spr1_videoram_w) AM_BASE(&punchout_spr1_videoram)
339   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(punchout_spr2_videoram_w) AM_BASE(&punchout_spr2_videoram)
340   AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(punchout_bg_bot_videoram_w) AM_BASE(&punchout_bg_bot_videoram)
341   AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(punchout_bg_top_videoram_w) AM_BASE(&punchout_bg_top_videoram)
334   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(armwrest_fg_videoram_w) AM_BASE_MEMBER(punchout_state, armwrest_fg_videoram)
335   AM_RANGE(0xdff0, 0xdff7) AM_BASE_MEMBER(punchout_state, spr1_ctrlram)
336   AM_RANGE(0xdff8, 0xdffc) AM_BASE_MEMBER(punchout_state, spr2_ctrlram)
337   AM_RANGE(0xdffd, 0xdffd) AM_BASE_MEMBER(punchout_state, palettebank)
338   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(punchout_spr1_videoram_w) AM_BASE_MEMBER(punchout_state, spr1_videoram)
339   AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(punchout_spr2_videoram_w) AM_BASE_MEMBER(punchout_state, spr2_videoram)
340   AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(punchout_bg_bot_videoram_w) AM_BASE_MEMBER(punchout_state, bg_bot_videoram)
341   AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(punchout_bg_top_videoram_w) AM_BASE_MEMBER(punchout_state, bg_top_videoram)
342342ADDRESS_MAP_END
343343
344344
r10613r10614
918918
919919static MACHINE_RESET( punchout )
920920{
921   rp5c01_mode_sel = 0;
922   memset(rp5c01_mem, 0, sizeof(rp5c01_mem));
921   punchout_state *state = machine->driver_data<punchout_state>();
922   state->rp5c01_mode_sel = 0;
923   memset(state->rp5c01_mem, 0, sizeof(state->rp5c01_mem));
923924}
924925
925926
926static MACHINE_CONFIG_START( punchout, driver_device )
927static MACHINE_CONFIG_START( punchout, punchout_state )
927928
928929   /* basic machine hardware */
929930   MCFG_CPU_ADD("maincpu", Z80, 8000000/2)   /* 4 MHz */
src/mame/drivers/kaneko16.c
r10613r10614
18241824
18251825   MCFG_PALETTE_INIT(berlwall)
18261826   MCFG_VIDEO_START(berlwall)
1827   
1827
18281828   /* sound hardware */
18291829   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
18301830
src/mame/drivers/namcos10.c
r10613r10614
3131*NFL Classic Football                            (C) Namco, 2003
3232*Panicuru Panekuru (PPA1 Ver.A)                  (C) Namco, 2001
3333*Photo Battole                                   (C) Namco, 2001
34Point Blank 3 / Gunbalina (GNN2 Ver. A)         (C) Namco, 2000
34Point Blank 3 / Gunbalina (GNN2 Ver. A)         (C) Namco, 2000
3535*Ren-ai Quiz High School Angel                   (C) Namco, 2002
3636*Seishun Quiz Colorful High School               (C) Namco, 2002
3737Star Trigon (STT1 Ver.A)                         (C) Namco, 2002
r10613r10614
628628   ROM_FILL( 0x0000000, 0x400000, 0x55 )
629629
630630   ROM_REGION( 0x2100000, "user2", 0 ) /* main prg */
631   ROM_LOAD( "0.8e",         0x0000000, 0x1080000, CRC(31b39221) SHA1(7fcb14aaa26c531928a6cd704e746d0e3ae3e031) )
632   ROM_LOAD( "1.8d",         0x1080000, 0x1080000, CRC(82d2cfb5) SHA1(4b5e713a55e74a7b32b1b9b5811892df2df86256) )
631   ROM_LOAD( "0.8e",         0x0000000, 0x1080000, CRC(31b39221) SHA1(7fcb14aaa26c531928a6cd704e746d0e3ae3e031) )
632   ROM_LOAD( "1.8d",         0x1080000, 0x1080000, CRC(82d2cfb5) SHA1(4b5e713a55e74a7b32b1b9b5811892df2df86256) )
633633ROM_END
634634
635635ROM_START( chocovdr )
r10613r10614
637637   ROM_FILL( 0x0000000, 0x400000, 0x55 )
638638
639639   ROM_REGION( 0x5280000, "user2", 0 ) /* main prg */
640   ROM_LOAD( "0.8e",         0x0000000, 0x1080000, CRC(f265b1b6) SHA1(f327e7bac0bc1bd31aa3362e36233130a6b240ea) )
641   ROM_LOAD( "1.8d",         0x1080000, 0x1080000, CRC(05d01cd2) SHA1(e9947ebea24d618e8b9a69f582ef0b9d97bb4cad) )
642   ROM_LOAD( "2.7e",         0x2100000, 0x1080000, CRC(2e308d20) SHA1(4ff072f0d488b12f77ef7d119822f89b5b5a6712) )
643   ROM_LOAD( "3.7d",         0x3180000, 0x1080000, CRC(126c9e6f) SHA1(32de87f01fd1c8c26a68bf42a062f5f44bcc5a3b) )
644   ROM_LOAD( "4.6e",         0x4200000, 0x1080000, CRC(6c18678d) SHA1(410a282397e4a4b5763467811080172b462bfcef) )
640   ROM_LOAD( "0.8e",         0x0000000, 0x1080000, CRC(f265b1b6) SHA1(f327e7bac0bc1bd31aa3362e36233130a6b240ea) )
641   ROM_LOAD( "1.8d",         0x1080000, 0x1080000, CRC(05d01cd2) SHA1(e9947ebea24d618e8b9a69f582ef0b9d97bb4cad) )
642   ROM_LOAD( "2.7e",         0x2100000, 0x1080000, CRC(2e308d20) SHA1(4ff072f0d488b12f77ef7d119822f89b5b5a6712) )
643   ROM_LOAD( "3.7d",         0x3180000, 0x1080000, CRC(126c9e6f) SHA1(32de87f01fd1c8c26a68bf42a062f5f44bcc5a3b) )
644   ROM_LOAD( "4.6e",         0x4200000, 0x1080000, CRC(6c18678d) SHA1(410a282397e4a4b5763467811080172b462bfcef) )
645645ROM_END
646646
647647GAME( 2000, mrdrilr2,  0,        namcos10, namcos10, mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (Japan, DR21 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND )
src/mame/drivers/mpu4.c
r10613r10614
237237#include "mpu4ext.lh"
238238#define MPU4_MASTER_CLOCK (6880000)
239239
240/* local vars */
241static int mod_number;
242static int mmtr_data;
243static int alpha_data_line;
244static int alpha_clock;
245static int ay8913_address;
246static int serial_data;
247static int signal_50hz;
248static int ic4_input_b;
249static int aux1_input;
250static int aux2_input;
251static int IC23G1;
252static int IC23G2A;
253static int IC23G2B;
254static int IC23GC;
255static int IC23GB;
256static int IC23GA;
257static int prot_col;
258static int lamp_col;
259static int reel_flag;
260static int ic23_active;
261static int led_lamp;
262static int link7a_connected;
263static emu_timer *ic24_timer;
264240static TIMER_CALLBACK( ic24_timeout );
265241
266static int expansion_latch;// OKI MOD 4 and above only (PIA on Gamecard)
267static int global_volume;// OKI MOD 4 and above only (PIA on Gamecard)
268242/* 32 multiplexed inputs - but a further 8 possible per AUX.
269243Two connectors 'orange' (sampled every 8ms) and 'black' (sampled every 16ms)
270244Each connector carries two banks of eight inputs and two enable signals */
271static int     input_strobe;     /* IC23 74LS138 A = CA2 IC7, B = CA2 IC4, C = CA2 IC8 */
272static UINT8  lamp_strobe,lamp_strobe2;
273static UINT8  lamp_data;
274static UINT8  ay_data;
275245
276static UINT8 Lamps[224];      /* 128 multiplexed lamps + 96 extension */
277static int optic_pattern;
278static int active_reel;
279static int remote_meter;
280246
281static UINT8 reel_mux_table[8]= {0,4,2,6,1,5,3,7};//include 7, although I don't think it's used
282static UINT8 reel_mux_table7[8]= {3,1,5,6,4,2,0,7};
247static const UINT8 reel_mux_table[8]= {0,4,2,6,1,5,3,7};//include 7, although I don't think it's used
248static const UINT8 reel_mux_table7[8]= {3,1,5,6,4,2,0,7};
283249
284static int reel_mux;      /* added support for up to 8 reels */
285250#define STANDARD_REEL  0   /* As originally designed 3/4 reels*/
286251#define FIVE_REEL_5TO8 1   /* Interfaces to meter port, allows some mechanical metering, but there is significant 'bounce' in the extra reel*/
287252#define FIVE_REEL_8TO5 2   /* Mounted backwards for space reasons, but different board*/
r10613r10614
290255#define SIX_REEL_5TO8  5   /* Like FIVE_REEL_5TO8, but with an extra reel elsewhere*/
291256#define SEVEN_REEL     6   /* Mainly club machines, significant reworking of reel hardware*/
292257
293static int lamp_extender;/* Plug in boards that add additional lamps and leds via the AUX ports. */
294static int last_b7;
295static int last_latch;
296258#define NO_EXTENDER         0   /* As originally designed */
297259#define SMALL_CARD         1
298260#define LARGE_CARD_A      2 //96 Lamps
299261#define LARGE_CARD_B      3 // 96 Lamps, 16 LEDs - as used by BwB
300262#define LARGE_CARD_C      4 //Identical to B, no built in LED support
301263
302static int lamp_sense;
303static int card_live;
304264
305static int led_extender;   /* Plug in boards that add leds via the AUX ports. */
306265#define CARD_A         1
307266#define CARD_B         2
308267#define CARD_C         3
309268
310static int hopper =0;
311269#define TUBES            0
312270#define HOPPER_DUART_A      1
313271#define HOPPER_DUART_B      2
r10613r10614
322280   UINT8 response;
323281};
324282
325static const mpu4_chr_table* mpu4_current_chr_table;
283struct ef9369_t
284{
285   UINT32 addr;
286   UINT16 clut[16];   /* 13-bits - a marking bit and a 444 color */
287};
326288
289struct bt471_t
290{
291   UINT8 address;
292   UINT8 addr_cnt;
293   UINT8 pixmask;
294   UINT8 command;
295   rgb_t color;
296};
297
298
299class mpu4_state : public driver_device
300{
301public:
302   mpu4_state(running_machine &machine, const driver_device_config_base &config)
303      : driver_device(machine, config) { }
304
305   int mod_number;
306   int mmtr_data;
307   int alpha_data_line;
308   int alpha_clock;
309   int ay8913_address;
310   int serial_data;
311   int signal_50hz;
312   int ic4_input_b;
313   int aux1_input;
314   int aux2_input;
315   int IC23G1;
316   int IC23G2A;
317   int IC23G2B;
318   int IC23GC;
319   int IC23GB;
320   int IC23GA;
321   int prot_col;
322   int lamp_col;
323   int reel_flag;
324   int ic23_active;
325   int led_lamp;
326   int link7a_connected;
327   emu_timer *ic24_timer;
328   int expansion_latch;
329   int global_volume;
330   int input_strobe;
331   UINT8 lamp_strobe;
332   UINT8 lamp_strobe2;
333   UINT8 lamp_data;
334   UINT8 ay_data;
335   UINT8 Lamps[224];
336   int optic_pattern;
337   int active_reel;
338   int remote_meter;
339   int reel_mux;
340   int lamp_extender;
341   int last_b7;
342   int last_latch;
343   int lamp_sense;
344   int card_live;
345   int led_extender;
346   int hopper;
347   const mpu4_chr_table* current_chr_table;
348   UINT8 led_segs[40];
349
350   UINT8 m6840_irq_state;
351   UINT8 m6850_irq_state;
352   UINT8 scn2674_irq_state;
353   UINT8 m68k_m6809_line;
354   UINT8 m6809_m68k_line;
355   UINT8 m68k_acia_cts;
356   UINT8 m6809_acia_cts;
357   UINT8 m6809_acia_rts;
358   UINT8 m6809_acia_dcd;
359   int gfx_index;
360   UINT16 * vid_vidram;
361   UINT16 * vid_mainram;
362   UINT8 scn2674_IR[16];
363   UINT8 scn2675_IR_pointer;
364   UINT8 scn2674_screen1_l;
365   UINT8 scn2674_screen1_h;
366   UINT8 scn2674_cursor_l;
367   UINT8 scn2674_cursor_h;
368   UINT8 scn2674_screen2_l;
369   UINT8 scn2674_screen2_h;
370   UINT8 scn2674_irq_register;
371   UINT8 scn2674_status_register;
372   UINT8 scn2674_irq_mask;
373   UINT8 scn2674_gfx_enabled;
374   UINT8 scn2674_display_enabled;
375   UINT8 scn2674_cursor_enabled;
376   UINT8 IR0_scn2674_double_ht_wd;
377   UINT8 IR0_scn2674_scanline_per_char_row;
378   UINT8 IR0_scn2674_sync_select;
379   UINT8 IR0_scn2674_buffer_mode_select;
380   UINT8 IR1_scn2674_interlace_enable;
381   UINT8 IR1_scn2674_equalizing_constant;
382   UINT8 IR2_scn2674_row_table;
383   UINT8 IR2_scn2674_horz_sync_width;
384   UINT8 IR2_scn2674_horz_back_porch;
385   UINT8 IR3_scn2674_vert_front_porch;
386   UINT8 IR3_scn2674_vert_back_porch;
387   UINT8 IR4_scn2674_rows_per_screen;
388   UINT8 IR4_scn2674_character_blink_rate;
389   UINT8 IR5_scn2674_character_per_row;
390   UINT8 IR8_scn2674_display_buffer_first_address_LSB;
391   UINT8 IR9_scn2674_display_buffer_first_address_MSB;
392   UINT8 IR9_scn2674_display_buffer_last_address;
393   UINT8 IR10_scn2674_display_pointer_address_lower;
394   UINT8 IR11_scn2674_display_pointer_address_upper;
395   UINT8 IR12_scn2674_scroll_start;
396   UINT8 IR12_scn2674_split_register_1;
397   UINT8 IR13_scn2674_scroll_end;
398   UINT8 IR13_scn2674_split_register_2;
399   INT8 cur[2];
400   UINT8 *dealem_videoram;
401   int rowcounter;
402   int linecounter;
403   struct ef9369_t pal;
404   struct bt471_t bt471;
405};
406
327407/*
328408LED Segments related to pins (5 is not connected):
329409Unlike the controllers emulated in the layout code, each
r10613r10614
3434238 display enables (pins 10 - 17)
344424*/
345425
346static UINT8 led_segs[40];//8 regular, up to 32 on extender cards
347426
348427
349428/* Process lamp and LED data for output system */
r10613r10614
353432}
354433
355434
356static void draw_lamps(void)
435static void draw_lamps(mpu4_state *state)
357436{
358437   int i,j;
359438
360439   for (i = 0; i < 8; i++)
361440   {
362      output_set_lamp_value((8*input_strobe)+i, (Lamps[(8*input_strobe)+i]));
363      output_set_lamp_value((8*input_strobe)+i+64, (Lamps[(8*input_strobe)+i+64]));
441      output_set_lamp_value((8*state->input_strobe)+i, (state->Lamps[(8*state->input_strobe)+i]));
442      output_set_lamp_value((8*state->input_strobe)+i+64, (state->Lamps[(8*state->input_strobe)+i+64]));
364443   }
365   if (lamp_extender)
444   if (state->lamp_extender)
366445   {
367446      for (j = 0; j < 6; j++)
368447      {
369         output_set_lamp_value((6*input_strobe)+128+j, (Lamps[(6*input_strobe)+128+j]));
370         output_set_lamp_value((6*input_strobe)+176+j, (Lamps[(6*input_strobe)+176+j]));
448         output_set_lamp_value((6*state->input_strobe)+128+j, (state->Lamps[(6*state->input_strobe)+128+j]));
449         output_set_lamp_value((6*state->input_strobe)+176+j, (state->Lamps[(6*state->input_strobe)+176+j]));
371450      }
372451   }
373452}
374453
375static void update_lamps(void)
454static void update_lamps(mpu4_state *state)
376455{
377456   int i,j;
378457
379458   for (i = 0; i < 8; i++)
380459   {
381      Lamps[(8*input_strobe)+i]    = (lamp_strobe  & (1 << i)) != 0;
382      Lamps[(8*input_strobe)+i+64] = (lamp_strobe2 & (1 << i)) != 0;
460      state->Lamps[(8*state->input_strobe)+i]    = (state->lamp_strobe  & (1 << i)) != 0;
461      state->Lamps[(8*state->input_strobe)+i+64] = (state->lamp_strobe2 & (1 << i)) != 0;
383462   }
384463
385   if (led_lamp)
464   if (state->led_lamp)
386465   {
387466      /* Some games (like Connect 4) use 'programmable' LED displays, built from light display lines. */
388467      UINT8 pled_segs[2] = {0,0};
r10613r10614
400479      mpu4_draw_led(9, pled_segs[1]);
401480   }
402481
403   draw_lamps();
404   mpu4_draw_led(input_strobe, led_segs[input_strobe]);
405   if (led_extender)
482   draw_lamps(state);
483   mpu4_draw_led(state->input_strobe, state->led_segs[state->input_strobe]);
484   if (state->led_extender)
406485   {
407486      for (j = 0; j < 5; j++)
408487      {
409         mpu4_draw_led(((8*input_strobe)+8+j), led_segs[((8*input_strobe)+8+j)]);
488         mpu4_draw_led(((8*state->input_strobe)+8+j), state->led_segs[((8*state->input_strobe)+8+j)]);
410489      }
411490   }
412491}
413492
414static void lamp_extend_small(int data)
493static void lamp_extend_small(mpu4_state *state, int data)
415494{
416495   int lamp_strobe_ext,column,i;
417496   column = data & 0x07;
r10613r10614
421500   {
422501      for (i = 0; i < 5; i++)
423502      {
424         Lamps[(5*column)+i+128]    = (lamp_strobe_ext  & (1 << i)) != 0;
503         state->Lamps[(5*column)+i+128]    = (lamp_strobe_ext  & (1 << i)) != 0;
425504      }
426505    }
427506}
428507
429static void lamp_extend_largea(int data,int column,int active)
508static void lamp_extend_largea(mpu4_state *state, int data,int column,int active)
430509{
431510   int lampbase,i,byte7;
432511
433   lamp_sense = 0;
512   state->lamp_sense = 0;
434513   byte7 = data & 0x80;
435   if ( byte7 != last_b7 )
514   if ( byte7 != state->last_b7 )
436515   {
437516      if ( byte7 )
438517      {
r10613r10614
444523      }
445524      if ( data & 0x3f )
446525      {
447           lamp_sense = 1;
526         state->lamp_sense = 1;
448527      }
449528      if ( active )
450529      {
451530         for (i = 0; i < 6; i++)
452531         {
453            Lamps[(lampbase)+i]    = (data  & (1 << i)) != 0;
532            state->Lamps[(lampbase)+i]    = (data  & (1 << i)) != 0;
454533         }
455534      }
456535    }
457    last_b7 = byte7;
536    state->last_b7 = byte7;
458537}
459538
460static void lamp_extend_largebc(int data,int column,int active)
539static void lamp_extend_largebc(mpu4_state *state, int data,int column,int active)
461540{
462541   int lampbase,i,byte7;
463542
464   lamp_sense = 0;
543   state->lamp_sense = 0;
465544   byte7 = data & 0x80;
466   if ( byte7 != last_b7 )
545   if ( byte7 != state->last_b7 )
467546   {
468      card_live = 1;
469       if ( byte7 )
547      state->card_live = 1;
548      if ( byte7 )
470549      {
471550         lampbase = 128 + column * 8;
472551      }
r10613r10614
476555      }
477556      if ( data & 0x3f )
478557      {
479         lamp_sense = 1;
558         state->lamp_sense = 1;
480559      }
481       if ( active )
560      if ( active )
482561      {
483562         for (i = 0; i < 6; i++)
484563         {
485            Lamps[(lampbase)+i]    = (data  & (1 << i)) != 0;
564            state->Lamps[(lampbase)+i]    = (data  & (1 << i)) != 0;
486565         }
487566      }
488   last_b7 = byte7;
567   state->last_b7 = byte7;
489568   }
490569   else
491570   {
492      card_live = 0;
571      state->card_live = 0;
493572   }
494573}
495574
496static void led_write_latch(int latch, int data, int column)
575static void led_write_latch(mpu4_state *state, int latch, int data, int column)
497576{
498577   int diff;
499578
500   diff = (latch ^ last_latch) & latch;
579   diff = (latch ^ state->last_latch) & latch;
501580   column = 7 - column;
502581   data = ~data;//inverted?
503582
504583   if ( diff & 1 )
505584   {
506      led_segs[column] = data;
507    }
585      state->led_segs[column] = data;
586   }
508587   if ( diff & 2 )
509588   {
510      led_segs[8+column] = data;
589      state->led_segs[8+column] = data;
511590   }
512591   if ( diff & 4 )
513592   {
514      led_segs[16+column] = data;
593      state->led_segs[16+column] = data;
515594   }
516595   if ( diff & 8 )
517596   {
518      led_segs[24+column] = data;
597      state->led_segs[24+column] = data;
519598   }
520599   if ( diff & 16 )
521600   {
522      led_segs[32+column] = data;
601      state->led_segs[32+column] = data;
523602   }
524   last_latch = diff;
603   state->last_latch = diff;
525604}
526605
527606
528static void update_meters(void)
607static void update_meters(mpu4_state *state)
529608{
530609   int meter;
531   int data = ((mmtr_data & 0x7f) | remote_meter);
532   switch (reel_mux)
610   int data = ((state->mmtr_data & 0x7f) | state->remote_meter);
611   switch (state->reel_mux)
533612   {
534613      case STANDARD_REEL:
535614      // Change nothing
r10613r10614
573652   {
574653      MechMtr_update(meter, (data & (1 << meter)));
575654   }
576   if (reel_mux == STANDARD_REEL)
655   if (state->reel_mux == STANDARD_REEL)
577656   {
578657      for (meter = 4; meter < 7; meter ++)
579658      {
r10613r10614
583662}
584663
585664/* called if board is reset */
586static void mpu4_stepper_reset(void)
665static void mpu4_stepper_reset(mpu4_state *state)
587666{
588667   int pattern = 0,reel;
589668   for (reel = 0; reel < 6; reel++)
r10613r10614
591670      stepper_reset_position(reel);
592671      if (stepper_optic_state(reel)) pattern |= 1<<reel;
593672   }
594   optic_pattern = pattern;
673   state->optic_pattern = pattern;
595674}
596675
597676
598677static MACHINE_RESET( mpu4 )
599678{
679   mpu4_state *state = machine->driver_data<mpu4_state>();
600680   ROC10937_reset(0);   /* reset display1 */
601681
602   mpu4_stepper_reset();
682   mpu4_stepper_reset(state);
603683
604   lamp_strobe    = 0;
605   lamp_strobe2   = 0;
606   lamp_data      = 0;
684   state->lamp_strobe    = 0;
685   state->lamp_strobe2   = 0;
686   state->lamp_data      = 0;
607687
608   IC23GC    = 0;
609   IC23GB    = 0;
610   IC23GA    = 0;
611   IC23G1    = 1;
612   IC23G2A   = 0;
613   IC23G2B   = 0;
688   state->IC23GC    = 0;
689   state->IC23GB    = 0;
690   state->IC23GA    = 0;
691   state->IC23G1    = 1;
692   state->IC23G2A   = 0;
693   state->IC23G2B   = 0;
614694
615   prot_col  = 0;
695   state->prot_col  = 0;
616696
617697/* init rom bank, some games don't set this */
618698   {
r10613r10614
630710/* 6809 IRQ handler */
631711static WRITE_LINE_DEVICE_HANDLER( cpu0_irq )
632712{
713   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
633714   device_t *pia3 = device->machine->device("pia_ic3");
634715   device_t *pia4 = device->machine->device("pia_ic4");
635716   device_t *pia5 = device->machine->device("pia_ic5");
r10613r10614
647728                   pia6821_get_irq_a(pia8) | pia6821_get_irq_b(pia8) |
648729                   ptm6840_get_irq(ptm2);
649730
650   if (!link7a_connected) //7B = IRQ, 7A = FIRQ, both = NMI
731   if (!drvstate->link7a_connected) //7B = IRQ, 7A = FIRQ, both = NMI
651732   {
652733      cputag_set_input_line(device->machine, "maincpu", M6809_IRQ_LINE, combined_state ? ASSERT_LINE : CLEAR_LINE);
653734      LOG(("6809 int%d \n", combined_state));
r10613r10614
717798/* IC3, lamp data lines + alpha numeric display */
718799static WRITE8_DEVICE_HANDLER( pia_ic3_porta_w )
719800{
801   mpu4_state *state = device->machine->driver_data<mpu4_state>();
720802   LOG_IC3(("%s: IC3 PIA Port A Set to %2x (lamp strobes 1 - 9)\n", device->machine->describe_context(),data));
721803
722   if(ic23_active)
804   if(state->ic23_active)
723805   {
724      lamp_strobe = data;
806      state->lamp_strobe = data;
725807   }
726808}
727809
728810
729811static WRITE8_DEVICE_HANDLER( pia_ic3_portb_w )
730812{
813   mpu4_state *state = device->machine->driver_data<mpu4_state>();
731814   LOG_IC3(("%s: IC3 PIA Port B Set to %2x  (lamp strobes 10 - 17)\n", device->machine->describe_context(),data));
732815
733   if(ic23_active)
816   if(state->ic23_active)
734817   {
735      lamp_strobe2 = data;
818      state->lamp_strobe2 = data;
736819   }
737820}
738821
739822
740823static WRITE_LINE_DEVICE_HANDLER( pia_ic3_ca2_w )
741824{
825   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
742826   LOG_IC3(("%s: IC3 PIA Write CA2 (alpha data), %02X\n", device->machine->describe_context(),state));
743827
744   alpha_data_line = state;
828   drvstate->alpha_data_line = state;
745829   ROC10937_draw_16seg(0);
746830}
747831
r10613r10614
779863
780864It is used as a multiplexer for the LEDs, lamp selects and inputs.*/
781865
782static void ic23_update(void)
866static void ic23_update(mpu4_state *state)
783867{
784   if (!IC23G2A)
868   if (!state->IC23G2A)
785869   {
786      if (!IC23G2B)
870      if (!state->IC23G2B)
787871      {
788         if (IC23G1)
872         if (state->IC23G1)
789873         {
790            if ( IC23GA ) input_strobe |= 0x01;
791            else          input_strobe &= ~0x01;
874            if ( state->IC23GA ) state->input_strobe |= 0x01;
875            else          state->input_strobe &= ~0x01;
792876
793            if ( IC23GB ) input_strobe |= 0x02;
794            else          input_strobe &= ~0x02;
877            if ( state->IC23GB ) state->input_strobe |= 0x02;
878            else          state->input_strobe &= ~0x02;
795879
796            if ( IC23GC ) input_strobe |= 0x04;
797            else          input_strobe &= ~0x04;
880            if ( state->IC23GC ) state->input_strobe |= 0x04;
881            else          state->input_strobe &= ~0x04;
798882         }
799883      }
800884   }
801885   else
802   if ((IC23G2A)||(IC23G2B))
886   if ((state->IC23G2A)||(state->IC23G2B))
803887   {
804      input_strobe = 0x00;
888      state->input_strobe = 0x00;
805889   }
806890}
807891
r10613r10614
814898CLEAR and B2 are tied high and A1 and A2 tied low, meaning any pulse
815899on B1 will give a low pulse on the output pin.
816900*/
817static void ic24_output(int data)
901static void ic24_output(mpu4_state *state, int data)
818902{
819   IC23G2A = data;
820   ic23_update();
903   state->IC23G2A = data;
904   ic23_update(state);
821905}
822906
823907
824static void ic24_setup(void)
908static void ic24_setup(mpu4_state *state)
825909{
826   if (IC23GA)
910   if (state->IC23GA)
827911   {
828912      double duration = TIME_OF_74LS123((220*1000),(0.1*0.000001));
829913      {
830         ic23_active=1;
831         ic24_output(0);
832         ic24_timer->adjust(attotime::from_double(duration));
914         state->ic23_active=1;
915         ic24_output(state, 0);
916         state->ic24_timer->adjust(attotime::from_double(duration));
833917      }
834918   }
835919}
r10613r10614
837921
838922static TIMER_CALLBACK( ic24_timeout )
839923{
840   ic23_active=0;
841   ic24_output(1);
924   mpu4_state *state = machine->driver_data<mpu4_state>();
925   state->ic23_active=0;
926   ic24_output(state, 1);
842927}
843928
844929
845930/* IC4, 7 seg leds, 50Hz timer reel sensors, current sensors */
846931static WRITE8_DEVICE_HANDLER( pia_ic4_porta_w )
847932{
848   if(ic23_active)
933   mpu4_state *state = device->machine->driver_data<mpu4_state>();
934   if(state->ic23_active)
849935   {
850      if (((lamp_extender == NO_EXTENDER)||(lamp_extender == SMALL_CARD)||(lamp_extender == LARGE_CARD_C))&& (led_extender == NO_EXTENDER))
851      led_segs[input_strobe] = data;
936      if (((state->lamp_extender == NO_EXTENDER)||(state->lamp_extender == SMALL_CARD)||(state->lamp_extender == LARGE_CARD_C))&& (state->led_extender == NO_EXTENDER))
937      state->led_segs[state->input_strobe] = data;
852938   }
853939}
854940
855941static WRITE8_DEVICE_HANDLER( pia_ic4_portb_w )
856942{
857   if (reel_mux)
943   mpu4_state *state = device->machine->driver_data<mpu4_state>();
944   if (state->reel_mux)
858945   {
859946      /* A write here connects one reel (and only one)
860947        to the optic test circuit. This allows 8 reels
861948        to be supported instead of 4. */
862      if (reel_mux == SEVEN_REEL)
949      if (state->reel_mux == SEVEN_REEL)
863950      {
864         active_reel= reel_mux_table7[(data >> 4) & 0x07];
951         state->active_reel= reel_mux_table7[(data >> 4) & 0x07];
865952      }
866953      else
867      active_reel= reel_mux_table[(data >> 4) & 0x07];
954      state->active_reel= reel_mux_table[(data >> 4) & 0x07];
868955   }
869956}
870957
871958
872959static READ8_DEVICE_HANDLER( pia_ic4_portb_r )
873960{
874   if ( serial_data )
961   mpu4_state *state = device->machine->driver_data<mpu4_state>();
962   if ( state->serial_data )
875963   {
876      ic4_input_b |=  0x80;
964      state->ic4_input_b |=  0x80;
877965      pia6821_cb1_w(device, 1);
878966   }
879967   else
880968   {
881      ic4_input_b &= ~0x80;
969      state->ic4_input_b &= ~0x80;
882970      pia6821_cb1_w(device, 0);
883971   }
884972
885   if (!reel_mux)
973   if (!state->reel_mux)
886974   {
887      if ( optic_pattern & 0x01 ) ic4_input_b |=  0x40; /* reel A tab */
888      else                        ic4_input_b &= ~0x40;
975      if ( state->optic_pattern & 0x01 ) state->ic4_input_b |=  0x40; /* reel A tab */
976      else                        state->ic4_input_b &= ~0x40;
889977
890      if ( optic_pattern & 0x02 ) ic4_input_b |=  0x20; /* reel B tab */
891      else                        ic4_input_b &= ~0x20;
978      if ( state->optic_pattern & 0x02 ) state->ic4_input_b |=  0x20; /* reel B tab */
979      else                        state->ic4_input_b &= ~0x20;
892980
893      if ( optic_pattern & 0x04 ) ic4_input_b |=  0x10; /* reel C tab */
894      else                        ic4_input_b &= ~0x10;
981      if ( state->optic_pattern & 0x04 ) state->ic4_input_b |=  0x10; /* reel C tab */
982      else                        state->ic4_input_b &= ~0x10;
895983
896      if ( optic_pattern & 0x08 ) ic4_input_b |=  0x08; /* reel D tab */
897      else                        ic4_input_b &= ~0x08;
984      if ( state->optic_pattern & 0x08 ) state->ic4_input_b |=  0x08; /* reel D tab */
985      else                        state->ic4_input_b &= ~0x08;
898986
899987   }
900988   else
901989   {
902      if (stepper_optic_state(active_reel))
990      if (stepper_optic_state(state->active_reel))
903991      {
904         ic4_input_b |=  0x08;
992         state->ic4_input_b |=  0x08;
905993      }
906994      else
907995      {
908         ic4_input_b &= ~0x08;
996         state->ic4_input_b &= ~0x08;
909997      }
910998   }
911   if ( signal_50hz )         ic4_input_b |=  0x04; /* 50 Hz */
912   else                       ic4_input_b &= ~0x04;
999   if ( state->signal_50hz )         state->ic4_input_b |=  0x04; /* 50 Hz */
1000   else                       state->ic4_input_b &= ~0x04;
9131001
914   if (ic4_input_b & 0x02)
1002   if (state->ic4_input_b & 0x02)
9151003   {
916      ic4_input_b &= ~0x02;
1004      state->ic4_input_b &= ~0x02;
9171005   }
9181006   else
9191007   {
920      ic4_input_b |= 0x02; //Pulse the overcurrent line with every read to show the CPU each lamp has lit
1008      state->ic4_input_b |= 0x02; //Pulse the overcurrent line with every read to show the CPU each lamp has lit
9211009   }
9221010   #ifdef UNUSED_FUNCTION
923   if ( lamp_undercurrent ) ic4_input_b |= 0x01;
1011   if ( lamp_undercurrent ) state->ic4_input_b |= 0x01;
9241012   #endif
9251013
926   LOG_IC3(("%s: IC4 PIA Read of Port B %x\n",device->machine->describe_context(),ic4_input_b));
927   return ic4_input_b;
1014   LOG_IC3(("%s: IC4 PIA Read of Port B %x\n",device->machine->describe_context(),state->ic4_input_b));
1015   return state->ic4_input_b;
9281016}
9291017
9301018
9311019static WRITE_LINE_DEVICE_HANDLER( pia_ic4_ca2_w )
9321020{
1021   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
9331022   LOG_IC3(("%s: IC4 PIA Write CA (input MUX strobe /LED B), %02X\n", device->machine->describe_context(),state));
9341023
935   IC23GB = state;
936   ic23_update();
1024   drvstate->IC23GB = state;
1025   ic23_update(drvstate);
9371026}
9381027
9391028static WRITE_LINE_DEVICE_HANDLER( pia_ic4_cb2_w )
9401029{
1030   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
9411031   LOG_IC3(("%s: IC4 PIA Write CA (input MUX strobe /LED B), %02X\n", device->machine->describe_context(),state));
942   reel_flag=state;
1032   drvstate->reel_flag=state;
9431033}
9441034static const pia6821_interface pia_ic4_intf =
9451035{
r10613r10614
9601050/* IC5, AUX ports, coin lockouts and AY sound chip select (MODs below 4 only) */
9611051static READ8_DEVICE_HANDLER( pia_ic5_porta_r )
9621052{
963   if (lamp_extender == LARGE_CARD_A)
1053   mpu4_state *state = device->machine->driver_data<mpu4_state>();
1054   if (state->lamp_extender == LARGE_CARD_A)
9641055   {
965      if (lamp_sense && ic23_active)
1056      if (state->lamp_sense && state->ic23_active)
9661057      {
967         aux1_input |= 0x40;
1058         state->aux1_input |= 0x40;
9681059      }
9691060      else
9701061      {
971         aux1_input &= ~0x40; //Pulse the overcurrent line with every read to show the CPU each lamp has lit
1062         state->aux1_input &= ~0x40; //Pulse the overcurrent line with every read to show the CPU each lamp has lit
9721063      }
9731064   }
974   if (hopper == HOPPER_NONDUART_A)
1065   if (state->hopper == HOPPER_NONDUART_A)
9751066   {
9761067/*      if (hopper1_active)
9771068        {
978            aux1_input |= 0x04;
1069            state->aux1_input |= 0x04;
9791070        }
9801071        else
9811072        {
982            aux1_input &= ~0x04;
1073            state->aux1_input &= ~0x04;
9831074        }*/
9841075   }
9851076   LOG(("%s: IC5 PIA Read of Port A (AUX1)\n",device->machine->describe_context()));
9861077
987   return input_port_read(device->machine, "AUX1")|aux1_input;
1078   return input_port_read(device->machine, "AUX1")|state->aux1_input;
9881079}
9891080
9901081static WRITE8_DEVICE_HANDLER( pia_ic5_porta_w )
9911082{
1083   mpu4_state *state = device->machine->driver_data<mpu4_state>();
9921084   device_t *pia_ic4 = device->machine->device("pia_ic5");
993   if (hopper == HOPPER_NONDUART_A)
1085   if (state->hopper == HOPPER_NONDUART_A)
9941086   {
9951087      //hopper1_drive_sensor(data&0x10);
9961088   }
997   switch (lamp_extender)
1089   switch (state->lamp_extender)
9981090   {
9991091   case NO_EXTENDER:
1000      if (led_extender == CARD_B)
1092      if (state->led_extender == CARD_B)
10011093      {
1002         led_write_latch(data & 0x1f, pia6821_get_output_a(pia_ic4),input_strobe);
1094         led_write_latch(state, data & 0x1f, pia6821_get_output_a(pia_ic4),state->input_strobe);
10031095      }
1004      else if ((led_extender != CARD_A)||(led_extender != NO_EXTENDER))
1096      else if ((state->led_extender != CARD_A)||(state->led_extender != NO_EXTENDER))
10051097      {
1006         led_segs[(input_strobe+8)] = data;
1098         state->led_segs[(state->input_strobe+8)] = data;
10071099      }
10081100      break;
10091101   case SMALL_CARD:
1010      if(ic23_active)
1102      if(state->ic23_active)
10111103      {
1012         lamp_extend_small(data);
1104         lamp_extend_small(state, data);
10131105      }
10141106      break;
10151107   case LARGE_CARD_A:
1016      lamp_extend_largea(data,input_strobe,ic23_active);
1108      lamp_extend_largea(state,data,state->input_strobe,state->ic23_active);
10171109      break;
10181110   case LARGE_CARD_B:
1019      lamp_extend_largebc(data,input_strobe,ic23_active);
1020      if ((ic23_active) && card_live)
1111      lamp_extend_largebc(state,data,state->input_strobe,state->ic23_active);
1112      if ((state->ic23_active) && state->card_live)
10211113      {
1022         led_segs[(8*(last_b7 >>7))+input_strobe] = (~data);
1114         state->led_segs[(8*(state->last_b7 >>7))+state->input_strobe] = (~data);
10231115      }
10241116      break;
10251117   case LARGE_CARD_C:
1026      lamp_extend_largebc(data,input_strobe,ic23_active);
1118      lamp_extend_largebc(state,data,state->input_strobe,state->ic23_active);
10271119      break;
10281120   }
1029   if (reel_mux == SIX_REEL_5TO8)
1121   if (state->reel_mux == SIX_REEL_5TO8)
10301122   {
10311123      stepper_update(4, data&0x0F);
10321124      stepper_update(5, (data >> 4)&0x0F);
r10613r10614
10341126      awp_draw_reel(5);
10351127   }
10361128   else
1037   if (reel_mux == SEVEN_REEL)
1129   if (state->reel_mux == SEVEN_REEL)
10381130   {
10391131      stepper_update(1, data&0x0F);
10401132      stepper_update(2, (data >> 4)&0x0F);
r10613r10614
10461138
10471139static WRITE8_DEVICE_HANDLER( pia_ic5_portb_w )
10481140{
1049   if (hopper == HOPPER_NONDUART_B)
1141   mpu4_state *state = device->machine->driver_data<mpu4_state>();
1142   if (state->hopper == HOPPER_NONDUART_B)
10501143   {
10511144      //hopper1_drive_motor(data &0x01)
10521145      //hopper1_drive_sensor(data &0x08)
10531146   }
1054   if (led_extender == CARD_A)
1147   if (state->led_extender == CARD_A)
10551148   {
1056      // led_write_latch(data & 0x07, pia_get_output_a(pia_ic4),input_strobe)
1149      // led_write_latch(state, data & 0x07, pia_get_output_a(pia_ic4),state->input_strobe)
10571150   }
10581151}
10591152static READ8_DEVICE_HANDLER( pia_ic5_portb_r )
10601153{
1154   mpu4_state *state = device->machine->driver_data<mpu4_state>();
10611155   device_t *pia_ic5 = device->machine->device("pia_ic5");
1062   if (hopper == HOPPER_NONDUART_B)
1156   if (state->hopper == HOPPER_NONDUART_B)
10631157   {/*
10641158        if (hopper1_active)
10651159        {
1066            aux2_input |= 0x08;
1160            state->aux2_input |= 0x08;
10671161        }
10681162        else
10691163        {
1070            aux2_input &= ~0x08;
1164            state->aux2_input &= ~0x08;
10711165        }*/
10721166   }
10731167
r10613r10614
10761170   coin_lockout_w(device->machine, 1, (pia6821_get_output_b(pia_ic5) & 0x02) );
10771171   coin_lockout_w(device->machine, 2, (pia6821_get_output_b(pia_ic5) & 0x04) );
10781172   coin_lockout_w(device->machine, 3, (pia6821_get_output_b(pia_ic5) & 0x08) );
1079   return input_port_read(device->machine, "AUX2") | aux2_input;
1173   return input_port_read(device->machine, "AUX2") | state->aux2_input;
10801174}
10811175
10821176
10831177static WRITE_LINE_DEVICE_HANDLER( pia_ic5_ca2_w )
10841178{
1179   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
10851180   LOG(("%s: IC5 PIA Write CA2 (Serial Tx) %2x\n",device->machine->describe_context(),state));
1086   serial_data = state;
1181   drvstate->serial_data = state;
10871182}
10881183
10891184
r10613r10614
11121207/* PSG function selected */
11131208static void update_ay(device_t *device)
11141209{
1210   mpu4_state *state = device->machine->driver_data<mpu4_state>();
11151211   if (!pia6821_get_output_cb2(device))
11161212   {
1117      switch (ay8913_address)
1213      switch (state->ay8913_address)
11181214      {
11191215         case 0x00:
11201216         {
11211217            /* Inactive */
11221218            break;
1123          }
1219         }
11241220         case 0x01:
11251221         {   /* CA2 = 1 CB2 = 0? : Read from selected PSG register and make the register data available to Port A */
11261222            device_t *pia_ic6 = device->machine->device("pia_ic6");
r10613r10614
11791275/* IC6, Reel A and B and AY registers (MODs below 4 only) */
11801276static WRITE8_DEVICE_HANDLER( pia_ic6_portb_w )
11811277{
1278   mpu4_state *state = device->machine->driver_data<mpu4_state>();
11821279   LOG(("%s: IC6 PIA Port B Set to %2x (Reel A and B)\n", device->machine->describe_context(),data));
11831280
1184   if (reel_mux == SEVEN_REEL)
1281   if (state->reel_mux == SEVEN_REEL)
11851282   {
11861283      stepper_update(3, data&0x0F);
11871284      stepper_update(4, (data >> 4)&0x0F);
r10613r10614
11961293      awp_draw_reel(1);
11971294   }
11981295
1199   if (reel_flag && (reel_mux == STANDARD_REEL))
1296   if (state->reel_flag && (state->reel_mux == STANDARD_REEL))
12001297   {
1201      if ( stepper_optic_state(0) ) optic_pattern |=  0x01;
1202      else                          optic_pattern &= ~0x01;
1298      if ( stepper_optic_state(0) ) state->optic_pattern |=  0x01;
1299      else                          state->optic_pattern &= ~0x01;
12031300
1204      if ( stepper_optic_state(1) ) optic_pattern |=  0x02;
1205      else                          optic_pattern &= ~0x02;
1301      if ( stepper_optic_state(1) ) state->optic_pattern |=  0x02;
1302      else                          state->optic_pattern &= ~0x02;
12061303   }
12071304}
12081305
12091306
12101307static WRITE8_DEVICE_HANDLER( pia_ic6_porta_w )
12111308{
1309   mpu4_state *state = device->machine->driver_data<mpu4_state>();
12121310   LOG(("%s: IC6 PIA Write A %2x\n", device->machine->describe_context(),data));
1213   if (mod_number <4)
1311   if (state->mod_number <4)
12141312   {
1215      ay_data = data;
1216       update_ay(device);
1313      state->ay_data = data;
1314      update_ay(device);
12171315   }
12181316}
12191317
12201318
12211319static WRITE_LINE_DEVICE_HANDLER( pia_ic6_ca2_w )
12221320{
1321   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
12231322   LOG(("%s: IC6 PIA write CA2 %2x (AY8913 BC1)\n", device->machine->describe_context(),state));
1224   if (mod_number <4)
1323   if (drvstate->mod_number <4)
12251324   {
1226      if ( state ) ay8913_address |=  0x01;
1227      else         ay8913_address &= ~0x01;
1325      if ( state ) drvstate->ay8913_address |=  0x01;
1326      else         drvstate->ay8913_address &= ~0x01;
12281327      update_ay(device);
12291328   }
12301329}
r10613r10614
12321331
12331332static WRITE_LINE_DEVICE_HANDLER( pia_ic6_cb2_w )
12341333{
1334   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
12351335   LOG(("%s: IC6 PIA write CB2 %2x (AY8913 BCDIR)\n", device->machine->describe_context(),state));
1236   if (mod_number <4)
1336   if (drvstate->mod_number <4)
12371337   {
1238      if ( state ) ay8913_address |=  0x02;
1239      else         ay8913_address &= ~0x02;
1338      if ( state ) drvstate->ay8913_address |=  0x02;
1339      else         drvstate->ay8913_address &= ~0x02;
12401340      update_ay(device);
12411341   }
12421342}
r10613r10614
12621362/* IC7 Reel C and D, mechanical meters/Reel E and F, input strobe bit A */
12631363static WRITE8_DEVICE_HANDLER( pia_ic7_porta_w )
12641364{
1365   mpu4_state *state = device->machine->driver_data<mpu4_state>();
12651366   LOG(("%s: IC7 PIA Port A Set to %2x (Reel C and D)\n", device->machine->describe_context(),data));
1266   if (reel_mux == SEVEN_REEL)
1367   if (state->reel_mux == SEVEN_REEL)
12671368   {
12681369      stepper_update(5, data&0x0F);
12691370      stepper_update(6, (data >> 4)&0x0F);
r10613r10614
12781379      awp_draw_reel(3);
12791380   }
12801381
1281   if (reel_flag && (reel_mux == STANDARD_REEL))
1382   if (state->reel_flag && (state->reel_mux == STANDARD_REEL))
12821383   {
1283      if ( stepper_optic_state(2) ) optic_pattern |=  0x04;
1284      else                          optic_pattern &= ~0x04;
1285      if ( stepper_optic_state(3) ) optic_pattern |=  0x08;
1286      else                          optic_pattern &= ~0x08;
1384      if ( stepper_optic_state(2) ) state->optic_pattern |=  0x04;
1385      else                          state->optic_pattern &= ~0x04;
1386      if ( stepper_optic_state(3) ) state->optic_pattern |=  0x08;
1387      else                          state->optic_pattern &= ~0x08;
12871388   }
12881389}
12891390
12901391static WRITE8_DEVICE_HANDLER( pia_ic7_portb_w )
12911392{
1292   if (hopper == HOPPER_DUART_A)
1393   mpu4_state *state = device->machine->driver_data<mpu4_state>();
1394   if (state->hopper == HOPPER_DUART_A)
12931395   {
12941396      //duart write data
12951397   }
1296   else if (hopper == HOPPER_NONDUART_A)
1398   else if (state->hopper == HOPPER_NONDUART_A)
12971399   {
12981400      //hoppr1_drive_motor(data & 0x10);
12991401   }
13001402
1301    mmtr_data = data;
1403    state->mmtr_data = data;
13021404}
13031405
13041406static READ8_DEVICE_HANDLER( pia_ic7_portb_r )
r10613r10614
13381440
13391441static WRITE_LINE_DEVICE_HANDLER( pia_ic7_ca2_w )
13401442{
1443   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
13411444   LOG(("%s: IC7 PIA write CA2 %2x (input strobe bit 0 / LED A)\n", device->machine->describe_context(),state));
13421445
1343   IC23GA = state;
1344   ic24_setup();
1345   ic23_update();
1446   drvstate->IC23GA = state;
1447   ic24_setup(drvstate);
1448   ic23_update(drvstate);
13461449}
13471450
13481451static WRITE_LINE_DEVICE_HANDLER( pia_ic7_cb2_w )
13491452{
1350   remote_meter = state?0x80:0x00;
1453   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
1454   drvstate->remote_meter = state?0x80:0x00;
13511455}
13521456
13531457static const pia6821_interface pia_ic7_intf =
r10613r10614
13701474/* IC8, Inputs, TRIACS, alpha clock */
13711475static READ8_DEVICE_HANDLER( pia_ic8_porta_r )
13721476{
1477   mpu4_state *state = device->machine->driver_data<mpu4_state>();
13731478   static const char *const portnames[] = { "ORANGE1", "ORANGE2", "BLACK1", "BLACK2", "ORANGE1", "ORANGE2", "DIL1", "DIL2" };
13741479   device_t *pia_ic5 = device->machine->device("pia_ic5");
13751480
r10613r10614
13781483   This is achieved via connecting every input line to an AND gate, thus allowing two strobes
13791484   to represent each orange input bank (strobes are active low). */
13801485   pia6821_cb1_w(pia_ic5, (input_port_read(device->machine, "AUX2") & 0x80));
1381   return input_port_read(device->machine, portnames[input_strobe]);
1486   return input_port_read(device->machine, portnames[state->input_strobe]);
13821487}
13831488
13841489
13851490static WRITE8_DEVICE_HANDLER( pia_ic8_portb_w )
13861491{
1387   if (hopper == HOPPER_DUART_B)
1492   mpu4_state *state = device->machine->driver_data<mpu4_state>();
1493   if (state->hopper == HOPPER_DUART_B)
13881494   {
13891495//      duart.drive_sensor(data & 0x04, data & 0x01, 0, 0);
13901496   }
1391   else if (hopper == HOPPER_DUART_C)
1497   else if (state->hopper == HOPPER_DUART_C)
13921498   {
13931499//      duart.drive_sensor(data & 0x04, data & 0x01, data & 0x04, data & 0x02);
13941500   }
r10613r10614
14021508
14031509static WRITE_LINE_DEVICE_HANDLER( pia_ic8_ca2_w )
14041510{
1405   LOG_IC8(("%s: IC8 PIA write CA2 (input_strobe bit 2 / LED C) %02X\n", device->machine->describe_context(), state & 0xFF));
1511   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
1512   LOG_IC8(("%s: IC8 PIA write CA2 (drvstate->input_strobe bit 2 / LED C) %02X\n", device->machine->describe_context(), state & 0xFF));
14061513
1407   IC23GC = state;
1408   ic23_update();
1514   drvstate->IC23GC = state;
1515   ic23_update(drvstate);
14091516}
14101517
14111518
14121519static WRITE_LINE_DEVICE_HANDLER( pia_ic8_cb2_w )
14131520{
1521   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
14141522   LOG_IC8(("%s: IC8 PIA write CB2 (alpha clock) %02X\n", device->machine->describe_context(), state & 0xFF));
14151523
1416   if ( !alpha_clock && (state) )
1524   if ( !drvstate->alpha_clock && (state) )
14171525   {
1418      ROC10937_shift_data(0, alpha_data_line&0x01?0:1);
1526      ROC10937_shift_data(0, drvstate->alpha_data_line&0x01?0:1);
14191527   }
1420   alpha_clock = state;
1528   drvstate->alpha_clock = state;
14211529   ROC10937_draw_16seg(0);
14221530}
14231531
r10613r10614
14491557
14501558static WRITE8_DEVICE_HANDLER( pia_gb_portb_w )
14511559{
1452   int changed = expansion_latch^data;
1560   mpu4_state *state = device->machine->driver_data<mpu4_state>();
1561   int changed = state->expansion_latch^data;
14531562
14541563   LOG_SS(("%s: GAMEBOARD: PIA Port A Set to %2x\n", device->machine->describe_context(),data));
14551564
1456   expansion_latch = data;
1565   state->expansion_latch = data;
14571566
14581567   if ( changed & 0x20)
14591568   { // digital volume clock line changed
r10613r10614
14611570      { // changed from high to low,
14621571         if ( !(data & 0x10) )
14631572         {
1464            if ( global_volume < 31 ) global_volume++; //steps unknown
1573            if ( state->global_volume < 31 ) state->global_volume++; //steps unknown
14651574         }
14661575         else
14671576         {
1468            if ( global_volume > 0  ) global_volume--;
1577            if ( state->global_volume > 0  ) state->global_volume--;
14691578         }
14701579
14711580         {
1472//              float percent = (32-global_volume)/32.0; //volume_override?1.0:(32-global_volume)/32.0;
1581//              float percent = (32-state->global_volume)/32.0; //volume_override?1.0:(32-state->global_volume)/32.0;
14731582//              LOG(("GAMEBOARD: OKI volume %f \n",percent));
14741583         }
14751584      }
r10613r10614
19222031/* Common configurations */
19232032static void mpu4_config_common(running_machine *machine)
19242033{
1925   ic24_timer = machine->scheduler().timer_alloc(FUNC(ic24_timeout));
2034   mpu4_state *state = machine->driver_data<mpu4_state>();
2035   state->ic24_timer = machine->scheduler().timer_alloc(FUNC(ic24_timeout));
19262036}
19272037
19282038static void mpu4_config_common_reels(running_machine *machine,int reels)
r10613r10614
19382048
19392049static MACHINE_START( mpu4mod2 )
19402050{
2051   mpu4_state *state = machine->driver_data<mpu4_state>();
19412052   mpu4_config_common(machine);
19422053
1943   link7a_connected=0;
1944   mod_number=2;
2054   state->link7a_connected=0;
2055   state->mod_number=2;
19452056
19462057   /* setup 8 mechanical meters */
19472058   MechMtr_config(machine,8);
r10613r10614
19522063
19532064static MACHINE_START( mpu4dutch )
19542065{
2066   mpu4_state *state = machine->driver_data<mpu4_state>();
19552067   mpu4_config_common(machine);
19562068
1957   link7a_connected=0;
2069   state->link7a_connected=0;
19582070
19592071// setup 8 mechanical meters ////////////////////////////////////////////
19602072   MechMtr_config(machine,8);
r10613r10614
19652077
19662078static MACHINE_START( mpu4mod4 )
19672079{
2080   mpu4_state *state = machine->driver_data<mpu4_state>();
19682081   mpu4_config_common(machine);
19692082
1970   link7a_connected=0;
1971   mod_number=4;
2083   state->link7a_connected=0;
2084   state->mod_number=4;
19722085
19732086// setup 8 mechanical meters ////////////////////////////////////////////
19742087   MechMtr_config(machine,8);
r10613r10614
20032116
20042117static WRITE8_HANDLER( characteriser_w )
20052118{
2119   mpu4_state *state = space->machine->driver_data<mpu4_state>();
20062120   int x;
20072121   int call=data;
20082122   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", cpu_get_previouspc(space->cpu),offset,data));
2009   if (!mpu4_current_chr_table)
2123   if (!state->current_chr_table)
20102124      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(space->cpu));
20112125
20122126   if (offset == 0)
r10613r10614
20142128      {
20152129         if (call == 0)
20162130         {
2017            prot_col = 0;
2131            state->prot_col = 0;
20182132         }
20192133         else
20202134         {
2021            for (x = prot_col; x < 64; x++)
2135            for (x = state->prot_col; x < 64; x++)
20222136            {
2023               if   (mpu4_current_chr_table[(x)].call == call)
2137               if   (state->current_chr_table[(x)].call == call)
20242138               {
2025                  prot_col = x;
2026                  LOG_CHR(("Characteriser find column %02X\n",prot_col));
2139                  state->prot_col = x;
2140                  LOG_CHR(("Characteriser find column %02X\n",state->prot_col));
20272141                  break;
20282142               }
20292143            }
r10613r10614
20372151      // Rather than the search strategy, we can map the calls directly here. Note that they are hex versions of the square number series
20382152      {
20392153         case 0x00:
2040         lamp_col = 0;
2154         state->lamp_col = 0;
20412155         break;
20422156         case 0x01:
2043         lamp_col = 1;
2157         state->lamp_col = 1;
20442158         break;
20452159         case 0x04:
2046         lamp_col = 2;
2160         state->lamp_col = 2;
20472161         break;
20482162         case 0x09:
2049         lamp_col = 3;
2163         state->lamp_col = 3;
20502164         break;
20512165         case 0x10:
2052         lamp_col = 4;
2166         state->lamp_col = 4;
20532167         break;
20542168         case 0x19:
2055         lamp_col = 5;
2169         state->lamp_col = 5;
20562170         break;
20572171         case 0x24:
2058         lamp_col = 6;
2172         state->lamp_col = 6;
20592173         break;
20602174         case 0x31:
2061         lamp_col = 7;
2175         state->lamp_col = 7;
20622176         break;
20632177      }
2064      LOG_CHR(("Characteriser find 2 column %02X\n",lamp_col));
2178      LOG_CHR(("Characteriser find 2 column %02X\n",state->lamp_col));
20652179   }
20662180}
20672181
20682182
20692183static READ8_HANDLER( characteriser_r )
20702184{
2071   if (!mpu4_current_chr_table)
2185   mpu4_state *state = space->machine->driver_data<mpu4_state>();
2186   if (!state->current_chr_table)
20722187      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(space->cpu));
20732188
20742189   LOG_CHR(("Characteriser read offset %02X \n",offset));
20752190   if (offset == 0)
20762191   {
2077      LOG_CHR(("Characteriser read data %02X \n",mpu4_current_chr_table[prot_col].response));
2078      return mpu4_current_chr_table[prot_col].response;
2192      LOG_CHR(("Characteriser read data %02X \n",state->current_chr_table[state->prot_col].response));
2193      return state->current_chr_table[state->prot_col].response;
20792194   }
20802195   if (offset == 3)
20812196   {
2082      LOG_CHR(("Characteriser read data off 3 %02X \n",mpu4_current_chr_table[lamp_col+64].response));
2083      return mpu4_current_chr_table[lamp_col+64].response;
2197      LOG_CHR(("Characteriser read data off 3 %02X \n",state->current_chr_table[state->lamp_col+64].response));
2198      return state->current_chr_table[state->lamp_col+64].response;
20842199   }
20852200   return 0;
20862201}
r10613r10614
21352250
21362251static DRIVER_INIT (m_oldtmr)
21372252{
2138   reel_mux=SIX_REEL_1TO8;
2253   mpu4_state *state = machine->driver_data<mpu4_state>();
2254   state->reel_mux=SIX_REEL_1TO8;
21392255
21402256   stepper_config(machine, 0, &barcrest_opto1_interface);
21412257   stepper_config(machine, 1, &barcrest_opto1_interface);
r10613r10614
21452261   stepper_config(machine, 5, &barcrest_opto1_interface);
21462262
21472263   awp_reel_setup();
2148   mpu4_current_chr_table = oldtmr_data;
2264   state->current_chr_table = oldtmr_data;
21492265}
21502266
21512267static DRIVER_INIT (m_ccelbr)
21522268{
2153   reel_mux=STANDARD_REEL;
2269   mpu4_state *state = machine->driver_data<mpu4_state>();
2270   state->reel_mux=STANDARD_REEL;
21542271   // setup 4 default 96 half step reels ///////////////////////////////////
21552272   mpu4_config_common_reels(machine,4);
21562273
2157   mpu4_current_chr_table = ccelbr_data;
2274   state->current_chr_table = ccelbr_data;
21582275}
21592276
21602277static DRIVER_INIT (m_gmball)
21612278{
2162   reel_mux=STANDARD_REEL;
2279   mpu4_state *state = machine->driver_data<mpu4_state>();
2280   state->reel_mux=STANDARD_REEL;
21632281   // setup 4 default 96 half step reels ///////////////////////////////////
21642282   mpu4_config_common_reels(machine,4);
21652283
2166   mpu4_current_chr_table = gmball_data;
2284   state->current_chr_table = gmball_data;
21672285}
21682286
21692287static DRIVER_INIT (m_grtecp)
21702288{
2171   reel_mux=FIVE_REEL_5TO8;
2172   lamp_extender=SMALL_CARD;
2289   mpu4_state *state = machine->driver_data<mpu4_state>();
2290   state->reel_mux=FIVE_REEL_5TO8;
2291   state->lamp_extender=SMALL_CARD;
21732292   // setup 5 default 96 half step reels with the mux board
21742293   mpu4_config_common_reels(machine,5);
2175   mpu4_current_chr_table = grtecp_data;
2294   state->current_chr_table = grtecp_data;
21762295}
21772296
21782297static DRIVER_INIT (mpu4tst2)
21792298{
2180   reel_mux=STANDARD_REEL;
2299   mpu4_state *state = machine->driver_data<mpu4_state>();
2300   state->reel_mux=STANDARD_REEL;
21812301   // setup 5 default 96 half step reels with the mux board
21822302   mpu4_config_common_reels(machine,4);
21832303
r10613r10614
21852305
21862306static DRIVER_INIT (mpu4utst)
21872307{
2188   reel_mux=STANDARD_REEL;
2308   mpu4_state *state = machine->driver_data<mpu4_state>();
2309   state->reel_mux=STANDARD_REEL;
21892310   // setup 4 default 96 half step reels ///////////////////////////////////
21902311   mpu4_config_common_reels(machine,4);
21912312}
21922313
21932314static DRIVER_INIT (connect4)
21942315{
2195   led_lamp=1;
2316   mpu4_state *state = machine->driver_data<mpu4_state>();
2317   state->led_lamp=1;
21962318}
21972319
21982320/* generate a 50 Hz signal (based on an RC time) */
21992321static TIMER_DEVICE_CALLBACK( gen_50hz )
22002322{
2323   mpu4_state *state = timer.machine->driver_data<mpu4_state>();
22012324   /* Although reported as a '50Hz' signal, the fact that both rising and
22022325    falling edges of the pulse are used means the timer actually gives a 100Hz
22032326    oscillating signal.*/
2204   signal_50hz = signal_50hz?0:1;
2205   update_lamps();
2206   pia6821_ca1_w(timer.machine->device("pia_ic4"), signal_50hz);   /* signal is connected to IC4 CA1 */
2327   state->signal_50hz = state->signal_50hz?0:1;
2328   update_lamps(state);
2329   pia6821_ca1_w(timer.machine->device("pia_ic4"), state->signal_50hz);   /* signal is connected to IC4 CA1 */
22072330
2208   if (signal_50hz)
2331   if (state->signal_50hz)
22092332   {
2210      update_meters();
2333      update_meters(state);
22112334   }
22122335
22132336}
r10613r10614
23192442
23202443
23212444/* machine driver for MOD 2 board */
2322static MACHINE_CONFIG_START( mpu4mod2, driver_device )
2445static MACHINE_CONFIG_START( mpu4mod2, mpu4_state )
23232446
23242447   MCFG_MACHINE_START(mpu4mod2)
23252448   MCFG_MACHINE_RESET(mpu4)
src/mame/drivers/btime.c
r10613r10614
15451545   /* video hardware */
15461546   MCFG_GFXDECODE(cookrace)
15471547   MCFG_PALETTE_LENGTH(16)
1548   
1548
15491549   MCFG_SCREEN_MODIFY("screen")
15501550   MCFG_SCREEN_UPDATE(cookrace)
15511551MACHINE_CONFIG_END
src/mame/drivers/de_3.c
r10613r10614
975975   ROM_RELOAD(0x200000 + 0x80000, 0x80000)
976976ROM_END
977977 
978/*-------------------------------------------------------------------
979/ Wack-A-Doodle-Doo (Redemption)
980/-------------------------------------------------------------------*/
981ROM_START(wackadoo)
982   ROM_REGION(0x80000, "user1", 0)
983   ROM_LOAD("wackcpu.100", 0x00000, 0x20000, CRC(995e0219) SHA1(57b2352a5a96e71ff48f838fde87a158afbf3701))
984   ROM_RELOAD(0x20000, 0x20000)
985   ROM_RELOAD(0x40000, 0x20000)
986   ROM_RELOAD(0x60000, 0x20000)
987   ROM_REGION(0x10000, "maincpu", 0)
988   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
989   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
990   ROM_REGION(0x80000, "gfx3", 0)
991   ROM_LOAD("wackdisp.bin", 0x00000, 0x80000, CRC(8b46f074) SHA1(38a98fff56186d1a152e2c2e321496fd24e9ad56))
992   ROM_REGION(0x010000, "cpu2", 0)
993   ROM_LOAD("wacku7.bin", 0x0000, 0x10000, CRC(99df3022) SHA1(5a38cf0816b95ea399d659d724b3259fadb42a62))
994   ROM_REGION(0x200000, "sound1", 0)
995   ROM_LOAD("wacku17.bin", 0x000000, 0x80000, CRC(1876e659) SHA1(1ff3a6d7a7b2582d0482eae024efa078d0a61dbe))
996   ROM_RELOAD(0x000000 + 0x80000, 0x80000)
997   ROM_LOAD("wacku21.bin", 0x100000, 0x80000, CRC(a3207296) SHA1(19af8ebab298a353fe42fc297b61182d8f772347))
998   ROM_RELOAD(0x100000 + 0x80000, 0x80000)
999ROM_END
1000 
1001/*-------------------------------------------------------------------
1002/ Titanic (Coin dropper)
1003/-------------------------------------------------------------------*/
1004ROM_START(titanic)
1005   ROM_REGION(0x80000, "user1", 0)
1006   ROM_LOAD("titacpu.101", 0x00000, 0x20000, CRC(4217becf) SHA1(8b7aacbe75717f13623f6ceaa4ba2de61b1b732a))
1007   ROM_RELOAD(0x20000, 0x20000)
1008   ROM_RELOAD(0x40000, 0x20000)
1009   ROM_RELOAD(0x60000, 0x20000)
1010   ROM_REGION(0x10000, "maincpu", 0)
1011   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1012   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1013   ROM_REGION(0x80000, "gfx3", 0)
1014   ROM_LOAD("titadspa.101", 0x00000, 0x80000, CRC(5b4300b6) SHA1(c2b2de20f6c74b71d2a9ac43c17694eadd795586))
1015   ROM_REGION(0x010000, "cpu2", 0)
1016   ROM_LOAD("titau7.101", 0x0000, 0x10000, CRC(544fe1ac) SHA1(5c62eef6a42660b13e626d1a6bb8cd09b77b0cc1))
1017   ROM_REGION(0x200000, "sound1", 0)
1018   ROM_LOAD("titau17.100", 0x000000, 0x80000, CRC(ab919e99) SHA1(8735b632a62d9cd3db26b3c832785c48552ba231))
1019   ROM_RELOAD(0x000000 + 0x80000, 0x80000)
1020   ROM_LOAD("titau21.100", 0x100000, 0x80000, CRC(76ca05f8) SHA1(3e1c56fe37393c345111665fd8ab730d53cb6970))
1021   ROM_RELOAD(0x100000 + 0x80000, 0x80000)
1022ROM_END
1023 
1024/*-------------------------------------------------------------------
1025/ Monopoly (Coin dropper)
1026/-------------------------------------------------------------------*/
1027ROM_START(monopred)
1028   ROM_REGION(0x80000, "user1", 0)
1029   ROM_LOAD("monopcpu.401", 0x00000, 0x20000, CRC(2d0ff130) SHA1(c0b7baa6973db8743186a950b0a1ad3383db5c98))
1030   ROM_RELOAD(0x20000, 0x20000)
1031   ROM_RELOAD(0x40000, 0x20000)
1032   ROM_RELOAD(0x60000, 0x20000)
1033   ROM_REGION(0x10000, "maincpu", 0)
1034   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1035   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1036   ROM_REGION(0x80000, "gfx3", 0)
1037   ROM_LOAD("monopdsp.400", 0x00000, 0x80000, CRC(0105572b) SHA1(fd9e1dfa4f396b953f82ccde11b54ee638382bee))
1038   ROM_REGION(0x010000, "cpu2", 0)
1039   ROM_LOAD("monopred.u7", 0x0000, 0x10000, CRC(1ca0cf63) SHA1(c4ce78718e3e3f1a8451b134f2869dd6410fee30))
1040   ROM_REGION(0x200000, "sound1", 0)
1041   ROM_LOAD("monopred.u17", 0x000000, 0x100000, CRC(467dca62) SHA1(c727748b6b0b39ead19ce98bddd89fd05fb62d00))
1042ROM_END
1043 
1044978GAME(1983,   rab_320,      0,         de_3,   de_3,   de_3,   ROT0,   "Data East",   "Adventures of Rocky and Bullwinkle and Friends (3.20)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1045979GAME(1993,   rab_130,      rab_320,   de_3,   de_3,   de_3,   ROT0,   "Data East",   "Adventures of Rocky and Bullwinkle and Friends (1.30)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1046980GAME(1993,   rab_103,      rab_320,   de_3,   de_3,   de_3,   ROT0,   "Data East",   "Adventures of Rocky and Bullwinkle and Friends (1.03 Spain)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
r10613r10614
10911025GAME(1994,   tomy_h30,      tomy_400,   de_3,   de_3,   de_3,   ROT0,   "Data East",   "The Who's Tommy Pinball Wizard (3.00 Holland)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
10921026GAME(1994,   wwfr_106,      0,         de_3,   de_3,   de_3,   ROT0,   "Data East",   "WWF Royal Rumble (1.06)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
10931027GAME(1994,   wwfr_103,      wwfr_106,   de_3,   de_3,   de_3,   ROT0,   "Data East",   "WWF Royal Rumble (1.03)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1094GAME(1998,   titanic,      0,         de_3,   de_3,   de_3,   ROT0,   "Sega",         "Titanic (Coin dropper)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1095GAME(2002,   monopred,      0,         de_3,   de_3,   de_3,   ROT0,   "Stern",      "Monopoly (Coin dropper)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1096GAME(1998,   wackadoo,      0,         de_3,   de_3,   de_3,   ROT0,   "Sega",         "Wack-A-Doodle-Doo (Redemption)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
src/mame/drivers/cosmic.c
r10613r10614
11381138
11391139   MCFG_PALETTE_LENGTH(16)
11401140
1141   MCFG_PALETTE_INIT(cosmicg)   
1141   MCFG_PALETTE_INIT(cosmicg)
11421142
11431143   /* sound hardware */
11441144   MCFG_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/wiping.c
r10613r10614
3939#include "includes/wiping.h"
4040
4141
42static UINT8 *sharedram1,*sharedram2;
43
4442static READ8_HANDLER( shared1_r )
4543{
46   return sharedram1[offset];
44   wiping_state *state = space->machine->driver_data<wiping_state>();
45   return state->sharedram1[offset];
4746}
4847
4948static READ8_HANDLER( shared2_r )
5049{
51   return sharedram2[offset];
50   wiping_state *state = space->machine->driver_data<wiping_state>();
51   return state->sharedram2[offset];
5252}
5353
5454static WRITE8_HANDLER( shared1_w )
5555{
56   sharedram1[offset] = data;
56   wiping_state *state = space->machine->driver_data<wiping_state>();
57   state->sharedram1[offset] = data;
5758}
5859
5960static WRITE8_HANDLER( shared2_w )
6061{
61   sharedram2[offset] = data;
62   wiping_state *state = space->machine->driver_data<wiping_state>();
63   state->sharedram2[offset] = data;
6264}
6365
6466
r10613r10614
8688
8789static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
8890   AM_RANGE(0x0000, 0x5fff) AM_ROM
89   AM_RANGE(0x8000, 0x83ff) AM_BASE(&wiping_videoram)
90   AM_RANGE(0x8400, 0x87ff) AM_BASE(&wiping_colorram)
91   AM_RANGE(0x8000, 0x83ff) AM_BASE_MEMBER(wiping_state, videoram)
92   AM_RANGE(0x8400, 0x87ff) AM_BASE_MEMBER(wiping_state, colorram)
9193   AM_RANGE(0x8800, 0x88ff) AM_BASE_SIZE_GENERIC(spriteram)
9294   AM_RANGE(0x8000, 0x8bff) AM_RAM
93   AM_RANGE(0x9000, 0x93ff) AM_READWRITE(shared1_r,shared1_w) AM_BASE(&sharedram1)
94   AM_RANGE(0x9800, 0x9bff) AM_READWRITE(shared2_r,shared2_w) AM_BASE(&sharedram2)
95   AM_RANGE(0x9000, 0x93ff) AM_READWRITE(shared1_r,shared1_w) AM_BASE_MEMBER(wiping_state, sharedram1)
96   AM_RANGE(0x9800, 0x9bff) AM_READWRITE(shared2_r,shared2_w) AM_BASE_MEMBER(wiping_state, sharedram2)
9597   AM_RANGE(0xa000, 0xa000) AM_WRITE(interrupt_enable_w)
9698   AM_RANGE(0xa002, 0xa002) AM_WRITE(wiping_flipscreen_w)
9799   AM_RANGE(0xa003, 0xa003) AM_WRITE(subcpu_reset_w)
r10613r10614
279281
280282
281283
282static MACHINE_CONFIG_START( wiping, driver_device )
284static MACHINE_CONFIG_START( wiping, wiping_state )
283285
284286   /* basic machine hardware */
285287   MCFG_CPU_ADD("maincpu", Z80,18432000/6)   /* 3.072 MHz */
src/mame/drivers/popeye.c
r10613r10614
3131
3232/* the protection device simply returns the last two values written shifted left */
3333/* by a variable amount. */
34static UINT8 prot0,prot1,prot_shift;
3534
3635static READ8_HANDLER( protection_r )
3736{
37   popeye_state *state = space->machine->driver_data<popeye_state>();
3838   if (offset == 0)
3939   {
40      return ((prot1 << prot_shift) | (prot0 >> (8-prot_shift))) & 0xff;
40      return ((state->prot1 << state->prot_shift) | (state->prot0 >> (8-state->prot_shift))) & 0xff;
4141   }
4242   else   /* offset == 1 */
4343   {
r10613r10614
4848
4949static WRITE8_HANDLER( protection_w )
5050{
51   popeye_state *state = space->machine->driver_data<popeye_state>();
5152   if (offset == 0)
5253   {
5354      /* this is the same as the level number (1-3) */
54      prot_shift = data & 0x07;
55      state->prot_shift = data & 0x07;
5556   }
5657   else   /* offset == 1 */
5758   {
58      prot0 = prot1;
59      prot1 = data;
59      state->prot0 = state->prot1;
60      state->prot1 = data;
6061   }
6162}
6263
r10613r10614
6667static ADDRESS_MAP_START( skyskipr_map, ADDRESS_SPACE_PROGRAM, 8 )
6768   AM_RANGE(0x0000, 0x7fff) AM_ROM
6869   AM_RANGE(0x8000, 0x87ff) AM_RAM
69   AM_RANGE(0x8c00, 0x8c02) AM_RAM AM_BASE(&popeye_background_pos)
70   AM_RANGE(0x8c03, 0x8c03) AM_RAM AM_BASE(&popeye_palettebank)
70   AM_RANGE(0x8c00, 0x8c02) AM_RAM AM_BASE_MEMBER(popeye_state, background_pos)
71   AM_RANGE(0x8c03, 0x8c03) AM_RAM AM_BASE_MEMBER(popeye_state, palettebank)
7172   AM_RANGE(0x8c04, 0x8e7f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
7273   AM_RANGE(0x8e80, 0x8fff) AM_RAM
73   AM_RANGE(0xa000, 0xa3ff) AM_WRITE(popeye_videoram_w) AM_BASE(&popeye_videoram)
74   AM_RANGE(0xa400, 0xa7ff) AM_WRITE(popeye_colorram_w) AM_BASE(&popeye_colorram)
74   AM_RANGE(0xa000, 0xa3ff) AM_WRITE(popeye_videoram_w) AM_BASE_MEMBER(popeye_state, videoram)
75   AM_RANGE(0xa400, 0xa7ff) AM_WRITE(popeye_colorram_w) AM_BASE_MEMBER(popeye_state, colorram)
7576   AM_RANGE(0xc000, 0xcfff) AM_WRITE(skyskipr_bitmap_w)
7677   AM_RANGE(0xe000, 0xe001) AM_READWRITE(protection_r,protection_w)
7778ADDRESS_MAP_END
r10613r10614
8081   AM_RANGE(0x0000, 0x7fff) AM_ROM
8182   AM_RANGE(0x8000, 0x87ff) AM_RAM
8283   AM_RANGE(0x8800, 0x8bff) AM_RAM
83   AM_RANGE(0x8c00, 0x8c02) AM_RAM AM_BASE(&popeye_background_pos)
84   AM_RANGE(0x8c03, 0x8c03) AM_RAM AM_BASE(&popeye_palettebank)
84   AM_RANGE(0x8c00, 0x8c02) AM_RAM AM_BASE_MEMBER(popeye_state, background_pos)
85   AM_RANGE(0x8c03, 0x8c03) AM_RAM AM_BASE_MEMBER(popeye_state, palettebank)
8586   AM_RANGE(0x8c04, 0x8e7f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
8687   AM_RANGE(0x8e80, 0x8fff) AM_RAM
87   AM_RANGE(0xa000, 0xa3ff) AM_WRITE(popeye_videoram_w) AM_BASE(&popeye_videoram)
88   AM_RANGE(0xa400, 0xa7ff) AM_WRITE(popeye_colorram_w) AM_BASE(&popeye_colorram)
88   AM_RANGE(0xa000, 0xa3ff) AM_WRITE(popeye_videoram_w) AM_BASE_MEMBER(popeye_state, videoram)
89   AM_RANGE(0xa400, 0xa7ff) AM_WRITE(popeye_colorram_w) AM_BASE_MEMBER(popeye_state, colorram)
8990   AM_RANGE(0xc000, 0xdfff) AM_WRITE(popeye_bitmap_w)
9091   AM_RANGE(0xe000, 0xe001) AM_READWRITE(protection_r,protection_w)
9192ADDRESS_MAP_END
r10613r10614
9394static ADDRESS_MAP_START( popeyebl_map, ADDRESS_SPACE_PROGRAM, 8 )
9495   AM_RANGE(0x0000, 0x7fff) AM_ROM
9596   AM_RANGE(0x8000, 0x87ff) AM_RAM
96   AM_RANGE(0x8c00, 0x8c02) AM_RAM AM_BASE(&popeye_background_pos)
97   AM_RANGE(0x8c03, 0x8c03) AM_RAM AM_BASE(&popeye_palettebank)
97   AM_RANGE(0x8c00, 0x8c02) AM_RAM AM_BASE_MEMBER(popeye_state, background_pos)
98   AM_RANGE(0x8c03, 0x8c03) AM_RAM AM_BASE_MEMBER(popeye_state, palettebank)
9899   AM_RANGE(0x8c04, 0x8e7f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
99100   AM_RANGE(0x8e80, 0x8fff) AM_RAM
100   AM_RANGE(0xa000, 0xa3ff) AM_WRITE(popeye_videoram_w) AM_BASE(&popeye_videoram)
101   AM_RANGE(0xa400, 0xa7ff) AM_WRITE(popeye_colorram_w) AM_BASE(&popeye_colorram)
101   AM_RANGE(0xa000, 0xa3ff) AM_WRITE(popeye_videoram_w) AM_BASE_MEMBER(popeye_state, videoram)
102   AM_RANGE(0xa400, 0xa7ff) AM_WRITE(popeye_colorram_w) AM_BASE_MEMBER(popeye_state, colorram)
102103   AM_RANGE(0xc000, 0xcfff) AM_WRITE(skyskipr_bitmap_w)
103104   AM_RANGE(0xe000, 0xe01f) AM_ROM
104105ADDRESS_MAP_END
r10613r10614
391392
392393
393394
394static int dswbit;
395395
396396static WRITE8_DEVICE_HANDLER( popeye_portB_w )
397397{
398   popeye_state *state = device->machine->driver_data<popeye_state>();
398399   /* bit 0 flips screen */
399400   flip_screen_set(device->machine, data & 1);
400401
401402   /* bits 1-3 select DSW1 bit to read */
402   dswbit = (data & 0x0e) >> 1;
403   state->dswbit = (data & 0x0e) >> 1;
403404}
404405
405406static READ8_DEVICE_HANDLER( popeye_portA_r )
406407{
408   popeye_state *state = device->machine->driver_data<popeye_state>();
407409   int res;
408410
409411
410412   res = input_port_read(device->machine, "DSW0");
411   res |= (input_port_read(device->machine, "DSW1") << (7-dswbit)) & 0x80;
413   res |= (input_port_read(device->machine, "DSW1") << (7-state->dswbit)) & 0x80;
412414
413415   return res;
414416}
r10613r10614
425427
426428
427429
428static MACHINE_CONFIG_START( skyskipr, driver_device )
430static MACHINE_CONFIG_START( skyskipr, popeye_state )
429431   /* basic machine hardware */
430432   MCFG_CPU_ADD("maincpu", Z80, XTAL_8MHz/2)   /* 4 MHz */
431433   MCFG_CPU_PROGRAM_MAP(skyskipr_map)
r10613r10614
619621
620622static DRIVER_INIT( skyskipr )
621623{
624   popeye_state *state = machine->driver_data<popeye_state>();
622625   UINT8 *buffer;
623626   UINT8 *rom = machine->region("maincpu")->base();
624627   int len = 0x10000;
r10613r10614
633636      auto_free(machine, buffer);
634637   }
635638
636    state_save_register_global(machine, prot0);
637    state_save_register_global(machine, prot1);
638    state_save_register_global(machine, prot_shift);
639    state_save_register_global(machine, state->prot0);
640    state_save_register_global(machine, state->prot1);
641    state_save_register_global(machine, state->prot_shift);
639642}
640643
641644static DRIVER_INIT( popeye )
642645{
646   popeye_state *state = machine->driver_data<popeye_state>();
643647   UINT8 *buffer;
644648   UINT8 *rom = machine->region("maincpu")->base();
645649   int len = 0x10000;
r10613r10614
654658      auto_free(machine, buffer);
655659   }
656660
657    state_save_register_global(machine, prot0);
658    state_save_register_global(machine, prot1);
659    state_save_register_global(machine, prot_shift);
661    state_save_register_global(machine, state->prot0);
662    state_save_register_global(machine, state->prot1);
663    state_save_register_global(machine, state->prot_shift);
660664}
661665
662666
src/mame/drivers/compgolf.c
r10613r10614
272272   MCFG_GFXDECODE(compgolf)
273273
274274   MCFG_VIDEO_START(compgolf)
275   
275
276276   MCFG_SPEAKER_STANDARD_MONO("mono")
277277
278278   MCFG_SOUND_ADD("ymsnd", YM2203, 1500000)
src/mame/drivers/monzagp.c
r10613r10614
163163
164164static WRITE8_HANDLER(port0_w)
165165{
166   printf("P0 %x = %x\n",cpu_get_pc(space->cpu),data);
166//  printf("P0 %x = %x\n",cpu_get_pc(space->cpu),data);
167167}
168168
169169static WRITE8_HANDLER(port1_w)
170170{
171   printf("P1 %x = %x\n",cpu_get_pc(space->cpu),data);
171//  printf("P1 %x = %x\n",cpu_get_pc(space->cpu),data);
172172}
173173
174174static WRITE8_HANDLER(port2_w)
175175{
176   printf("P2 %x = %x\n",cpu_get_pc(space->cpu),data);
176//  printf("P2 %x = %x\n",cpu_get_pc(space->cpu),data);
177177   coordy=data;
178178}
179179
src/mame/drivers/de_3b.c
r10613r10614
370370   ROM_RELOAD(0x100000 + 0x80000, 0x80000)
371371ROM_END
372372 
373ROM_START(mav_400)
374   ROM_REGION(0x10000, "maincpu", 0)
375   ROM_LOAD("mavgc5.400", 0x0000, 0x10000, CRC(e2d0a88b) SHA1(d1571edba47aecc871ac0cfdaabca31774f70fa1))
376   ROM_REGION(0x01000000, "cpu3", 0)
377   ROM_LOAD16_BYTE("mavdisp0.400", 0x00000001, 0x00080000, CRC(b6069484) SHA1(2878d9a0151194bd4a0e12e2f75b02a5d7316b68))
378   ROM_LOAD16_BYTE("mavdisp3.400", 0x00000000, 0x00080000, CRC(149f871f) SHA1(e29a8bf149b77bccaeed202786cf76d9a4fd51df))
379   ROM_REGION(0x010000, "cpu2", 0)
380   ROM_LOAD("mavu7.dat", 0x0000, 0x10000, CRC(427e6ab9) SHA1(6ad9295097f3d498383c91adf4ca667f797f29b1))
381   ROM_REGION(0x200000, "sound1", 0)
382   ROM_LOAD("mavu17.dat", 0x000000, 0x80000, CRC(cba377b8) SHA1(b7551b6cb64357cdacf1a96cedfccbabf4bd070a))
383   ROM_RELOAD(0x000000 + 0x80000, 0x80000)
384   ROM_LOAD("mavu21.dat", 0x100000, 0x80000, CRC(be0c6a6f) SHA1(4fee912d9f0d4b196dbfacf06a4202b2fa3037b1))
385   ROM_RELOAD(0x100000 + 0x80000, 0x80000)
386ROM_END
387 
373388ROM_START(mav_100)
374389   ROM_REGION(0x10000, "maincpu", 0)
375390   ROM_LOAD("mavcpu.100", 0x0000, 0x10000, CRC(13fdc959) SHA1(f8155f0fe5d4c3fe55000ab3b57f298fd9229fef))
r10613r10614
386401ROM_END
387402 
388403/*-------------------------------------------------------------
404/ Cut The Cheese (Redemption, Data East hardware)
405/------------------------------------------------------------*/
406ROM_START(ctcheese)
407   ROM_REGION(0x10000, "maincpu", 0)
408   ROM_LOAD("ctcc5.bin", 0x0000, 0x10000, CRC(465d41de) SHA1(0e30b527d5b47f8823cbe6f196052b090e69e907))
409   ROM_REGION(0x01000000, "cpu3", 0)
410   ROM_LOAD16_BYTE("ctcdsp0.bin", 0x00000001, 0x00080000, CRC(6885734d) SHA1(9ac82c9c8bf4e66d2999fbfd08617ef6c266dfe8))
411   ROM_LOAD16_BYTE("ctcdsp3.bin", 0x00000000, 0x00080000, CRC(0c2b3f3c) SHA1(cb730cc6fdd2a2786d25b46b1c45466ee56132d1))
412   ROM_REGION(0x010000, "cpu2", 0)
413   ROM_LOAD("ctcu7.bin", 0x0000, 0x10000, CRC(406b9b9e) SHA1(f3f86c368c92ee0cb47323e6e0ca0fa05b6122bd))
414   ROM_REGION(0x200000, "sound1", 0)
415   ROM_LOAD("ctcu17.bin", 0x000000, 0x80000, NO_DUMP)
416   ROM_RELOAD(0x000000 + 0x80000, 0x80000)
417   ROM_LOAD("ctcu21.bin", 0x100000, 0x80000, NO_DUMP)
418   ROM_RELOAD(0x100000 + 0x80000, 0x80000)
419ROM_END
420 
421/*-------------------------------------------------------------
389422/ Roach Racers
390423/------------------------------------------------------------*/
391424 
r10613r10614
419452GAME(1995,   frankstg,   frankst,      de_3b,   de_3b,   de_3b,   ROT0,   "Sega",            "Mary Shelley's Frankenstein (Germany)",GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
420453GAME(1994,   mav_402,   0,            de_3b,   de_3b,   de_3b,   ROT0,   "Sega",            "Maverick (Display Rev. 4.02)",         GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
421454GAME(1994,   mav_401,   mav_402,      de_3b,   de_3b,   de_3b,   ROT0,   "Sega",            "Maverick (Display Rev. 4.01)",         GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
455GAME(1994,   mav_400,   mav_402,      de_3b,   de_3b,   de_3b,   ROT0,   "Sega",            "Maverick (Display Rev. 4.00)",         GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
422456GAME(1994,   mav_100,   mav_402,      de_3b,   de_3b,   de_3b,   ROT0,   "Sega",            "Maverick (1.00)",                  GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
423457GAME(1998,   detest,      0,            de_3b,   de_3b,   de_3b,   ROT0,   "Data East",      "Data East Test Chip",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
458GAME(1996,   ctcheese,   0,            de_3b,   de_3b,   de_3b,   ROT0,   "Sega",            "Cut The Cheese (Redemption)",         GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
src/mame/drivers/by17.c
r10613r10614
115115ROM_START(nightrdr)
116116   ROM_REGION(0x10000, "maincpu", 0)
117117   ROM_LOAD( "721-21_1.716", 0x1000, 0x0800, CRC(237c4060) SHA1(4ce3dba9189fe7666fc76a2c8ee7fff9b12d4c00))
118   ROM_LOAD( "720-20_6.716", 0x1800, 0x0800, CRC(f394e357) SHA1(73444f848825a398515153d18de027792b57bcc7))
119   ROM_RELOAD( 0xf800, 0x0800)
120ROM_END
121 
122ROM_START(nightr20)
123   ROM_REGION(0x10000, "maincpu", 0)
124   ROM_LOAD( "721-21_1.716", 0x1000, 0x0800, CRC(237c4060) SHA1(4ce3dba9189fe7666fc76a2c8ee7fff9b12d4c00))
118125   ROM_LOAD( "720-20_6.716", 0x1800, 0x0800, CRC(0c17aa4d) SHA1(729e61a29691857112579efcdb96a35e8e5b1279))
119126   ROM_RELOAD( 0xf800, 0x0800)
120127ROM_END
r10613r10614
149156GAME( 1977, evelknie, 0,      by17, by17, by17, ROT0, "Bally","Evel Knievel", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
150157GAME( 1977, freedom,  0,      by17, by17, by17, ROT0, "Bally","Freedom", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
151158GAME( 1978, matahari, 0,      by17, by17, by17, ROT0, "Bally","Mata Hari", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
152GAME( 1977, nightrdr, 0,      by17, by17, by17, ROT0, "Bally","Night Rider", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
159GAME( 1977, nightrdr, 0,      by17, by17, by17, ROT0, "Bally","Night Rider (rev. 21)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
160GAME( 1977, nightr20, nightrdr,   by17, by17, by17, ROT0, "Bally","Night Rider (rev. 20)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
153161GAME( 1978, pwerplay, 0,      by17, by17, by17, ROT0, "Bally","Power Play (Pinball)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
154162GAME( 1978, stk_sprs, 0,      by17, by17, by17, ROT0, "Bally","Strikes and Spares", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
src/mame/drivers/pgm.c
r10613r10614
32443244   ROM_LOAD( "m1200.rom",    0x800000, 0x800000, CRC(b0d88720) SHA1(44ab137e3f8e15b7cb5697ffbd9b1143d8210c4f) )
32453245ROM_END
32463246
3247ROM_START( kov2101 )
3248   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
3249   PGM_68K_BIOS
3250   ROM_LOAD16_WORD_SWAP( "u18.101",    0x100000, 0x400000, CRC(c9926f35) SHA1(a9c72d0c5d239164107894c7d3fffe4af29ed201) )
3251
3252   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
3253   ROM_LOAD( "kov2_v100_hongkong.asic", 0x000000, 0x04000,  CRC(e0d7679f) SHA1(e1c2d127eba4ddbeb8ad173c55b90ac1467e1ca8) )
3254
3255   ROM_REGION32_LE( 0x400000, "user1", 0 ) /* Protection Data (encrypted external ARM data) */
3256   ROM_LOAD( "u19.101", 0x000000, 0x200000, CRC(8c35f2fe) SHA1(d4858f97fcfad0f342fccbc9cf1590276cc3c69c) )
3257
3258   ROM_REGION( 0xc00000, "tiles", 0 ) /* 8x8 Text Tiles + 32x32 BG Tiles */
3259   PGM_VIDEO_BIOS
3260   ROM_LOAD( "t1200.rom",    0x180000, 0x800000, CRC(d7e26609) SHA1(bdad810f82fcf1d50a8791bdc495374ec5a309c6) )
3261
3262   ROM_REGION( 0x2800000, "sprcol", 0 ) /* Sprite Colour Data */
3263   ROM_LOAD( "a1200.rom",    0x0000000, 0x0800000, CRC(ceeb81d8) SHA1(5476729443fc1bc9593ae10fbf7cbc5d7290b017) )
3264   ROM_LOAD( "a1201.rom",    0x0800000, 0x0800000, CRC(82f0a878) SHA1(ddd13e404252a71de1b2b3b974b910f899f51c38) )
3265   ROM_LOAD( "a1202.rom",    0x1000000, 0x0800000, CRC(4bb92fae) SHA1(f0b6d72ed425de1c69dc8f8d5795ea760a4a59b0) )
3266   ROM_LOAD( "a1203.rom",    0x1800000, 0x0800000, CRC(e73cb627) SHA1(4c6e48b845a5d1e8f9899010fbf273d54c2b8899) )
3267   ROM_LOAD( "a1204.rom",    0x2000000, 0x0800000, CRC(27527099) SHA1(e23cf366bdeaca1e009a5cec6b13164310a34384) )
3268
3269   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
3270   ROM_LOAD( "b1200.rom",   0x0000000, 0x0800000,  CRC(bed7d994) SHA1(019dfba8154256d64cd249eb0fa4c451edce34b8) )
3271   ROM_LOAD( "b1201.rom",   0x0800000, 0x0800000,  CRC(f251eb57) SHA1(56a5fc14ab7822f83379cecb26638e5bb266349a) )
3272
3273   ROM_REGION( 0x1000000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
3274   PGM_AUDIO_BIOS
3275   ROM_LOAD( "m1200.rom",    0x800000, 0x800000, CRC(b0d88720) SHA1(44ab137e3f8e15b7cb5697ffbd9b1143d8210c4f) )
3276ROM_END
3277
32473278ROM_START( kov2100 )
32483279   ROM_REGION( 0x600000, "maincpu", 0 ) /* 68000 Code */
32493280   PGM_68K_BIOS
r10613r10614
41714202
41724203   ROM_REGION( 0x1c00000, "sprcol", 0 ) /* Sprite Colour Data */
41734204   ROM_LOAD( "a04401w064.u7",  0x0000000, 0x0800000, CRC(ed229794) SHA1(1cf1863495a18c7c7d277a9be43ec116b00960b0) ) //image-1
4174   ROM_LOAD( "a04402w064.u8",  0x0800000, 0x0800000, BAD_DUMP CRC(f7816273) SHA1(dfa76e29cfe4fc03a9c0e1d932b244581f3bb9c4) ) //image-2 - bad dump: checksum does not match rom label
4205   ROM_LOAD( "a04402w064.u8",  0x0800000, 0x0800000, CRC(752167b0) SHA1(c33c3398dd8e479c9d5bd348924958a6aecbf0fc) ) //image-2
41754206
41764207   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
4177   ROM_LOAD( "b04401w064.u1",  0x0000000, 0x0800000, BAD_DUMP CRC(830aab7d) SHA1(1829197457b401b203360a76ee345108df9c4b24) ) //bitmap-1 - bad dump: checksum does not match rom label
4208   ROM_LOAD( "b04401w064.u1",  0x0000000, 0x0800000, CRC(8cbff066) SHA1(eef1cd566bc70ebf45f047e56026803d5c1dac43) ) //bitmap-1
41784209
41794210   ROM_REGION( 0x1000000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
41804211   ROM_LOAD( "pgm_m01s.rom", 0x000000, 0x200000, CRC(45ae7159) SHA1(d3ed3ff3464557fd0df6b069b2e431528b0ebfa8) ) // same as standard PGM bios
4181   ROM_LOAD( "m04401b032.u17",  0x400000, 0x400000, BAD_DUMP CRC(a118560c) SHA1(3e99bb2adbc9d464d79aa8723f0d40305ea821ca) ) //music-1 - bad dump: checksum does not match rom label
4212   ROM_LOAD( "m04401b032.u17",  0x400000, 0x400000, CRC(5a0dbd76) SHA1(06ab202f6bd5ebfb35b9d8cc7a8fb83ec8840659) ) //music-1
41824213
41834214   ROM_REGION( 0x20000, "sram", 0 ) /* default settings */
41844215   ROM_LOAD( "ddp3_defaults.nv",  0x0000000, 0x020000, CRC(571e96c0) SHA1(348940c77ca348213331b85b9b1d3aabb96a528a) )
r10613r10614
42024233
42034234   ROM_REGION( 0x1c00000, "sprcol", 0 ) /* Sprite Colour Data */
42044235   ROM_LOAD( "a04401w064.u7",  0x0000000, 0x0800000, CRC(ed229794) SHA1(1cf1863495a18c7c7d277a9be43ec116b00960b0) ) //image-1
4205   ROM_LOAD( "a04402w064.u8",  0x0800000, 0x0800000, BAD_DUMP CRC(f7816273) SHA1(dfa76e29cfe4fc03a9c0e1d932b244581f3bb9c4) ) //image-2 - bad dump: checksum does not match rom label
4236   ROM_LOAD( "a04402w064.u8",  0x0800000, 0x0800000, CRC(752167b0) SHA1(c33c3398dd8e479c9d5bd348924958a6aecbf0fc) ) //image-2
42064237
42074238   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
4208   ROM_LOAD( "b04401w064.u1",  0x0000000, 0x0800000, BAD_DUMP CRC(830aab7d) SHA1(1829197457b401b203360a76ee345108df9c4b24) ) //bitmap-1 - bad dump: checksum does not match rom label
4239   ROM_LOAD( "b04401w064.u1",  0x0000000, 0x0800000, CRC(8cbff066) SHA1(eef1cd566bc70ebf45f047e56026803d5c1dac43) ) //bitmap-1
42094240
42104241   ROM_REGION( 0x1000000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
42114242   ROM_LOAD( "pgm_m01s.rom", 0x000000, 0x200000, CRC(45ae7159) SHA1(d3ed3ff3464557fd0df6b069b2e431528b0ebfa8) ) // same as standard PGM bios
4212   ROM_LOAD( "m04401b032.u17",  0x400000, 0x400000, BAD_DUMP CRC(a118560c) SHA1(3e99bb2adbc9d464d79aa8723f0d40305ea821ca) ) //music-1 - bad dump: checksum does not match rom label
4243   ROM_LOAD( "m04401b032.u17",  0x400000, 0x400000, CRC(5a0dbd76) SHA1(06ab202f6bd5ebfb35b9d8cc7a8fb83ec8840659) ) //music-1
42134244
42144245   ROM_REGION( 0x20000, "sram", 0 ) /* default settings */
42154246   ROM_LOAD( "ddp3_defaults.nv",  0x0000000, 0x020000, CRC(571e96c0) SHA1(348940c77ca348213331b85b9b1d3aabb96a528a) )
r10613r10614
42324263
42334264   ROM_REGION( 0x1c00000, "sprcol", 0 ) /* Sprite Colour Data */
42344265   ROM_LOAD( "a04401w064.u7",  0x0000000, 0x0800000, CRC(ed229794) SHA1(1cf1863495a18c7c7d277a9be43ec116b00960b0) ) //image-1
4235   ROM_LOAD( "a04402w064.u8",  0x0800000, 0x0800000, BAD_DUMP CRC(f7816273) SHA1(dfa76e29cfe4fc03a9c0e1d932b244581f3bb9c4) ) //image-2 - bad dump: checksum does not match rom label
4266   ROM_LOAD( "a04402w064.u8",  0x0800000, 0x0800000, CRC(752167b0) SHA1(c33c3398dd8e479c9d5bd348924958a6aecbf0fc) ) //image-2
42364267
42374268   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
4238   ROM_LOAD( "b04401w064.u1",  0x0000000, 0x0800000, BAD_DUMP CRC(830aab7d) SHA1(1829197457b401b203360a76ee345108df9c4b24) ) //bitmap-1 - bad dump: checksum does not match rom label
4269   ROM_LOAD( "b04401w064.u1",  0x0000000, 0x0800000, CRC(8cbff066) SHA1(eef1cd566bc70ebf45f047e56026803d5c1dac43) ) //bitmap-1
42394270
42404271   ROM_REGION( 0x1000000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
42414272   ROM_LOAD( "pgm_m01s.rom", 0x000000, 0x200000, CRC(45ae7159) SHA1(d3ed3ff3464557fd0df6b069b2e431528b0ebfa8) ) // same as standard PGM bios
4242   ROM_LOAD( "m04401b032.u17",  0x400000, 0x400000, BAD_DUMP CRC(a118560c) SHA1(3e99bb2adbc9d464d79aa8723f0d40305ea821ca) ) //music-1 - bad dump: checksum does not match rom label
4273   ROM_LOAD( "m04401b032.u17",  0x400000, 0x400000, CRC(5a0dbd76) SHA1(06ab202f6bd5ebfb35b9d8cc7a8fb83ec8840659) ) //music-1
42434274
42444275   ROM_REGION( 0x20000, "sram", 0 ) /* default settings */
42454276   ROM_LOAD( "ddp3_defaults.nv",  0x0000000, 0x020000, CRC(571e96c0) SHA1(348940c77ca348213331b85b9b1d3aabb96a528a) )
r10613r10614
42634294
42644295   ROM_REGION( 0x1c00000, "sprcol", 0 ) /* Sprite Colour Data */
42654296   ROM_LOAD( "a04401w064.u7",  0x0000000, 0x0800000, CRC(ed229794) SHA1(1cf1863495a18c7c7d277a9be43ec116b00960b0) ) //image-1
4266   ROM_LOAD( "a04402w064.u8",  0x0800000, 0x0800000, BAD_DUMP CRC(f7816273) SHA1(dfa76e29cfe4fc03a9c0e1d932b244581f3bb9c4) ) //image-2 - bad dump: checksum does not match rom label
4297   ROM_LOAD( "a04402w064.u8",  0x0800000, 0x0800000, CRC(752167b0) SHA1(c33c3398dd8e479c9d5bd348924958a6aecbf0fc) ) //image-2
42674298
42684299   ROM_REGION( 0x1000000, "sprmask", 0 ) /* Sprite Masks + Colour Indexes */
4269   ROM_LOAD( "b04401w064.u1",  0x0000000, 0x0800000, BAD_DUMP CRC(830aab7d) SHA1(1829197457b401b203360a76ee345108df9c4b24) ) //bitmap-1 - bad dump: checksum does not match rom label
4300   ROM_LOAD( "b04401w064.u1",  0x0000000, 0x0800000, CRC(8cbff066) SHA1(eef1cd566bc70ebf45f047e56026803d5c1dac43) ) //bitmap-1
42704301
42714302   ROM_REGION( 0x1000000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */
42724303   ROM_LOAD( "pgm_m01s.rom", 0x000000, 0x200000, CRC(45ae7159) SHA1(d3ed3ff3464557fd0df6b069b2e431528b0ebfa8) ) // same as standard PGM bios
4273   ROM_LOAD( "m04401b032.u17",  0x400000, 0x400000, BAD_DUMP CRC(a118560c) SHA1(3e99bb2adbc9d464d79aa8723f0d40305ea821ca) ) //music-1 - bad dump: checksum does not match rom label
4304   ROM_LOAD( "m04401b032.u17",  0x400000, 0x400000, CRC(5a0dbd76) SHA1(06ab202f6bd5ebfb35b9d8cc7a8fb83ec8840659) ) //music-1
42744305
42754306   ROM_REGION( 0x20000, "sram", 0 ) /* NVRAM with factory programmed values - needed to boot */
42764307   ROM_LOAD( "ddp3blk_defaults.nv",  0x0000000, 0x020000, CRC(a1651904) SHA1(5b80d3c4c764895c40953a66161d4dd84f742604) )
42774308ROM_END
42784309
42794310/* this is on PGM2, the main board contains 2 custom ASICs, no roms or other kind of bios, I don't know how compatible the
4280   hardware is otherwise, but I imagine it's well protected */
4311   hardware is otherwise, but I imagine it's well protected
4312
4313   they appear to have the main program inside a custom ASIC (probably ARM again) as the carts will boot to 'PROGRAM ERROR'
4314   even if you strip them of program roms.
4315
4316   */
42814317ROM_START( orleg2 )
42824318   ROM_REGION( 0x800000, "maincpu", 0 ) /* 68000 Code */
42834319   ROM_LOAD16_WORD_SWAP( "xyj2_v104cn.u7",  0x000000, 0x800000, CRC(7c24a4f5) SHA1(3cd9f9264ef2aad0869afdf096e88eb8d74b2570) )
r10613r10614
53045340
53055341   pgm_basic_init(machine);
53065342   kovsh_latch_init(machine);
5307   pgm_dw2001_decrypt(machine);
5343   pgm_mm_decrypt(machine); // encryption is the same as martial masters
53085344
53095345   mem16[0x11e90c / 2] = 0x4e71;
53105346   mem16[0x11e90e / 2] = 0x4e71;
r10613r10614
58315867GAME( 2000, kov2106,      kov2,      kov2,    sango,    kov2,       ROT0,   "IGS", "Knights of Valour 2 / Sangoku Senki 2 (ver. 106, 102, 100KH)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 02/27/01 13:26:46 V106 (Ext. Arm V102, Int. Arm V100HK)
58325868GAME( 2000, kov2103,      kov2,      kov2,    sango,    kov2,       ROT0,   "IGS", "Knights of Valour 2 / Sangoku Senki 2 (ver. 103, 101, 100HK)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 12/28/00 15:09:31 V103 (Ext. Arm V101, Int. Arm V100HK)
58335869GAME( 2000, kov2102,      kov2,      kov2,    sango,    kov2,       ROT0,   "IGS", "Knights of Valour 2 / Sangoku Senki 2 (ver. 102, 101, 100HK)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 12/14/00 10:33:36 V102 (Ext. Arm V101, Int. Arm V100HK)
5870GAME( 2000, kov2101,      kov2,      kov2,    sango,    kov2,       ROT0,   "IGS", "Knights of Valour 2 / Sangoku Senki 2 (ver. 101, 101, 100HK)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 11/29/00 11:03:08 V100 (Ext. Arm V100, Int. Arm V100HK)
58345871GAME( 2000, kov2100,      kov2,      kov2,    sango,    kov2,       ROT0,   "IGS", "Knights of Valour 2 / Sangoku Senki 2 (ver. 100, 100, 100HK)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 11/29/00 11:03:08 V100 (Ext. Arm V100, Int. Arm V100HK)
58355872
58365873GAME( 2001, martmast,     pgm,       kov2,    sango,    martmast,   ROT0,   "IGS", "Martial Masters (ver. 104, 102, 102US)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // 68k V104, Ext Arm 102, Int Arm 102US
src/mame/drivers/snesb.c
r10613r10614
142142#include "includes/snes.h"
143143#include "audio/snes_snd.h"
144144
145static INT8 *shared_ram;
146static UINT8 ffight2b_coins;
147145
146class snesb_state : public snes_state
147{
148public:
149   snesb_state(running_machine &machine, const driver_device_config_base &config)
150      : snes_state(machine, config) { }
151
152   INT8 *shared_ram;
153   UINT8 ffight2b_coins;
154   INT32 oldinput;
155   INT32 oldcoin;
156   UINT8 cnt;
157};
158
159
160
148161static READ8_HANDLER(sharedram_r)
149162{
150   static INT32 oldinput=0;
163   snesb_state *state = space->machine->driver_data<snesb_state>();
151164   INT32 coincnt;
152165   INT32 input = input_port_read(space->machine, "COIN");
153166
154167   if(input&3)
155168   {
156      if( ((input&1)==1)&&((oldinput&1)==0))   {shared_ram[0]++;}
169      if( ((input&1)==1)&&((state->oldinput&1)==0))   {state->shared_ram[0]++;}
157170
158      coincnt=shared_ram[0];
171      coincnt=state->shared_ram[0];
159172
160173      if(coincnt>99){coincnt=99;}
161174
162      shared_ram[0xb]=(coincnt/10)+'0';
163      shared_ram[0xa]=(coincnt%10)+'0';
175      state->shared_ram[0xb]=(coincnt/10)+'0';
176      state->shared_ram[0xa]=(coincnt%10)+'0';
164177   }
165   oldinput=input;
166   return shared_ram[offset];
178   state->oldinput=input;
179   return state->shared_ram[offset];
167180}
168181
169182static WRITE8_HANDLER(sharedram_w)
170183{
171   shared_ram[offset]=data;
184   snesb_state *state = space->machine->driver_data<snesb_state>();
185   state->shared_ram[offset]=data;
172186}
173187
174188static READ8_HANDLER(ffight2b_coin_r)
175189{
176   static INT32 oldinput=0;
190   snesb_state *state = space->machine->driver_data<snesb_state>();
177191   INT32 input = input_port_read(space->machine, "COIN");
178192
179   if( ((input&1)==1)&&((oldinput&1)==0))
193   if( ((input&1)==1)&&((state->oldcoin&1)==0))
180194   {
181      INT32 coin_cnt=(ffight2b_coins&0xf)+10*(ffight2b_coins>>4);
195      INT32 coin_cnt=(state->ffight2b_coins&0xf)+10*(state->ffight2b_coins>>4);
182196      if(++coin_cnt>99) coin_cnt=99;
183      ffight2b_coins=(coin_cnt%10)|((coin_cnt/10)<<4);
197      state->ffight2b_coins=(coin_cnt%10)|((coin_cnt/10)<<4);
184198   }
185   oldinput=input;
186   return ffight2b_coins;
199   state->oldcoin=input;
200   return state->ffight2b_coins;
187201}
188202
189203/* Sonic blast man 2 turbo */
190204
191205static READ8_HANDLER(sb2b_75bd37_r)
192206{
207   snesb_state *state = space->machine->driver_data<snesb_state>();
193208   /* protection check */
194   static UINT8 cnt=0;
195   return ++cnt;
209   return ++state->cnt;
196210}
197211
198212static READ8_HANDLER(sb2b_6a6xxx_r)
r10613r10614
497511INPUT_PORTS_END
498512
499513
500static MACHINE_CONFIG_START( kinstb, snes_state )
514static MACHINE_CONFIG_START( kinstb, snesb_state )
501515
502516   /* basic machine hardware */
503517   MCFG_CPU_ADD("maincpu", _5A22, 3580000*6)   /* 2.68Mhz, also 3.58Mhz */
r10613r10614
529543
530544static DRIVER_INIT(kinstb)
531545{
546   snesb_state *state = machine->driver_data<snesb_state>();
532547   INT32 i;
533548   UINT8 *rom = machine->region("user3")->base();
534549
r10613r10614
537552      rom[i] = BITSWAP8(rom[i], 5, 0, 6, 1, 7, 4, 3, 2);
538553   }
539554
540   shared_ram = auto_alloc_array(machine, INT8, 0x100);
555   state->shared_ram = auto_alloc_array(machine, INT8, 0x100);
541556   memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x781000, 0x7810ff, 0, 0, sharedram_r, sharedram_w);
542557
543558   DRIVER_INIT_CALL(snes_hirom);
r10613r10614
545560
546561static DRIVER_INIT( ffight2b )
547562{
563   snesb_state *state = machine->driver_data<snesb_state>();
548564   INT32 i;
549565   UINT8 *rom = machine->region("user3")->base();
550566
r10613r10614
578594   rom[0x7ffd] = 0x89;
579595   rom[0x7ffc] = 0x54;
580596
581   ffight2b_coins = 0;
597   state->ffight2b_coins = 0;
582598   memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x7eadce, 0x7eadce, 0, 0, ffight2b_coin_r);
583599
584600   DRIVER_INIT_CALL(snes);
src/mame/drivers/cinemat.c
r10613r10614
190190   if ((gearval & 0x0f) != 0x0f)
191191        state->gear = gearval & 0x0f;
192192
193   /* add the start key into the mix -- note that it overlaps 4th state->gear */
193   /* add the start key into the mix -- note that it overlaps 4th gear */
194194   if (!(input_port_read(space->machine, "INPUTS") & 0x80))
195195        state->gear &= ~0x08;
196196
src/mame/drivers/roul.c
r10613r10614
66TO DO:
77- check palette
88- check blitter command 0x00
9- screen orientation is wrong (should clearly be ROT90 or 270 with blitter mods)
910
1011Has 36 pin Cherry master looking edge connector
1112
src/mame/drivers/by35.c
r10613r10614
181181   ROM_LOAD("838-10_5.532", 0xf000, 0x1000, CRC(9c63925d) SHA1(abd1fa6308d3569e16ee10bfabce269a124d8f26))
182182ROM_END
183183 
184ROM_START(eballd14)
185   ROM_REGION(0x10000, "maincpu", 0)
186   ROM_LOAD( "838-14_2.732", 0x1000, 0x0800, CRC(27eeabde) SHA1(a8f81dbb70202bdad1c9734d629e8a5c27f2a835))
187   ROM_CONTINUE( 0x5000, 0x0800)
188   ROM_LOAD( "720-52_6.732", 0x1800, 0x0800, CRC(2a43d9fb) SHA1(9ff903c32b80780383578a9abaa3ef9d3bcecbc7) )
189   ROM_CONTINUE( 0x5800, 0x0800)
190   ROM_RELOAD( 0xf000, 0x1000)
191   ROM_REGION(0x10000, "cpu2", 0)
192   ROM_LOAD("838-08_3.532", 0xd000, 0x1000, CRC(c39478d7) SHA1(8148aca7c4113921ab882da32d6d88e66abb22cc))
193   ROM_LOAD("838-09_4.716", 0xe000, 0x0800, CRC(518ea89e) SHA1(a387274ef530bb57f31819733b35615a39260126))
194   ROM_RELOAD(0xe800, 0x0800)
195   ROM_LOAD("838-10_5.532", 0xf000, 0x1000, CRC(9c63925d) SHA1(abd1fa6308d3569e16ee10bfabce269a124d8f26))
196ROM_END
197 
184198/*--------------------------------
185199/ Elektra
186200/-------------------------------*/
r10613r10614
12691283GAME( 1985, cosflash, flashgdn, by35, by35, by35, ROT0, "Bell Games","Cosmic Flash", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
12701284GAME( 1985, cybrnaut, 0,      by35, by35, by35, ROT0, "Bally","Cybernaut", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
12711285GAME( 1979, dollyptn, 0,      by35, by35, by35, ROT0, "Bally","Dolly Parton", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1272GAME( 1981, eballdlx, 0,      by35, by35, by35, ROT0, "Bally","Eight Ball Deluxe", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1286GAME( 1981, eballdlx, 0,      by35, by35, by35, ROT0, "Bally","Eight Ball Deluxe (rev. 15)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1287GAME( 1981, eballd14, eballdlx, by35, by35, by35, ROT0, "Bally","Eight Ball Deluxe (rev. 14)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
12731288GAME( 1981, elektra,  0,      by35, by35, by35, ROT0, "Bally","Elektra", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
12741289GAME( 1981, embryon,  0,      by35, by35, by35, ROT0, "Bally","Embryon", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
12751290GAME( 1981, fathom,   0,      by35, by35, by35, ROT0, "Bally","Fathom", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
src/mame/drivers/cischeat.c
r10613r10614
186186
187187**************************************************************************/
188188
189static READ16_HANDLER( sharedram1_r )  {
190   cischeat_state *state = space->machine->driver_data<cischeat_state>();return state->sharedram1[offset];}
191static READ16_HANDLER( sharedram2_r )  {
192   cischeat_state *state = space->machine->driver_data<cischeat_state>();return state->sharedram2[offset];}
189static READ16_HANDLER( sharedram1_r )
190{
191   cischeat_state *state = space->machine->driver_data<cischeat_state>();
192   return state->sharedram1[offset];
193}
193194
194static WRITE16_HANDLER( sharedram1_w ) {
195   cischeat_state *state = space->machine->driver_data<cischeat_state>();COMBINE_DATA(&state->sharedram1[offset]);}
196static WRITE16_HANDLER( sharedram2_w ) {
197   cischeat_state *state = space->machine->driver_data<cischeat_state>();COMBINE_DATA(&state->sharedram2[offset]);}
195static READ16_HANDLER( sharedram2_r )
196{
197   cischeat_state *state = space->machine->driver_data<cischeat_state>();
198   return state->sharedram2[offset];
199}
198200
199static READ16_HANDLER( rom_1_r ) {
200   cischeat_state *state = space->machine->driver_data<cischeat_state>();return state->rom_1[offset];}
201static READ16_HANDLER( rom_2_r ) {
202   cischeat_state *state = space->machine->driver_data<cischeat_state>();return state->rom_2[offset];}
203static READ16_HANDLER( rom_3_r ) {
204   cischeat_state *state = space->machine->driver_data<cischeat_state>();return state->rom_3[offset];}
201static WRITE16_HANDLER( sharedram1_w )
202{
203   cischeat_state *state = space->machine->driver_data<cischeat_state>();
204   COMBINE_DATA(&state->sharedram1[offset]);
205}
205206
207static WRITE16_HANDLER( sharedram2_w )
208{
209   cischeat_state *state = space->machine->driver_data<cischeat_state>();
210   COMBINE_DATA(&state->sharedram2[offset]);
211}
206212
213static READ16_HANDLER( rom_1_r )
214{
215   cischeat_state *state = space->machine->driver_data<cischeat_state>();
216   return state->rom_1[offset];
217}
218
219static READ16_HANDLER( rom_2_r )
220{
221   cischeat_state *state = space->machine->driver_data<cischeat_state>();
222   return state->rom_2[offset];
223}
224
225static READ16_HANDLER( rom_3_r )
226{
227   cischeat_state *state = space->machine->driver_data<cischeat_state>();
228   return state->rom_3[offset];
229}
230
231
207232/**************************************************************************
208233                                Big Run
209234**************************************************************************/
src/mame/drivers/spacefb.c
r10613r10614
123123 *
124124 *************************************/
125125
126static emu_timer *interrupt_timer;
127126
128
129127static TIMER_CALLBACK( interrupt_callback )
130128{
129   spacefb_state *state = machine->driver_data<spacefb_state>();
131130   int next_vpos;
132131
133132   /* compute vector and set the interrupt line */
r10613r10614
141140   else
142141      next_vpos = SPACEFB_INT_TRIGGER_COUNT_1;
143142
144   interrupt_timer->adjust(machine->primary_screen->time_until_pos(next_vpos));
143   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(next_vpos));
145144}
146145
147146
148147static void create_interrupt_timer(running_machine *machine)
149148{
150   interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
149   spacefb_state *state = machine->driver_data<spacefb_state>();
150   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(interrupt_callback));
151151}
152152
153153
154154static void start_interrupt_timer(running_machine *machine)
155155{
156   interrupt_timer->adjust(machine->primary_screen->time_until_pos(SPACEFB_INT_TRIGGER_COUNT_1));
156   spacefb_state *state = machine->driver_data<spacefb_state>();
157   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(SPACEFB_INT_TRIGGER_COUNT_1));
157158}
158159
159160
r10613r10614
199200static ADDRESS_MAP_START( spacefb_main_map, ADDRESS_SPACE_PROGRAM, 8 )
200201   AM_RANGE(0x0000, 0x3fff) AM_ROM
201202   AM_RANGE(0x4000, 0x7fff) AM_NOP
202   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x3c00) AM_RAM AM_BASE(&spacefb_videoram) AM_SIZE(&spacefb_videoram_size)
203   AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x3c00) AM_RAM AM_BASE_MEMBER(spacefb_state, videoram) AM_SIZE_MEMBER(spacefb_state, videoram_size)
203204   AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x3000) AM_RAM
204205   AM_RANGE(0xc800, 0xcfff) AM_MIRROR(0x3000) AM_NOP
205206ADDRESS_MAP_END
r10613r10614
333334 *
334335 *************************************/
335336
336static MACHINE_CONFIG_START( spacefb, driver_device )
337static MACHINE_CONFIG_START( spacefb, spacefb_state )
337338
338339   /* basic machine hardware */
339340   MCFG_CPU_ADD("maincpu", Z80, SPACEFB_MAIN_CPU_CLOCK)
src/mame/drivers/warpwarp.c
r10613r10614
123123
124124TODO:
125125- I arbitrarily assigned a uniform blue overlay to sos. I don't know how it's
126  supposed to be. navarone and kaitei are missing the overlay too.
126  supposed to be. kaitei is missing the overlay too.
127127
128128***************************************************************************/
129129
130130#include "emu.h"
131131#include "cpu/i8085/i8085.h"
132132#include "includes/warpwarp.h"
133
133134#include "geebee.lh"
135#include "navarone.lh"
134136#include "sos.lh"
135137
136138#define MASTER_CLOCK      XTAL_18_432MHz
137139
138140
139/*******************************************************
140 *
141 * Gee Bee overlay
142 *
143 *******************************************************/
144141
145142static int handle_joystick;
146143
r10613r10614
923920{
924921   handle_joystick = 0;
925922
926   // turn off overlay in cocktail mode; this assumes that the cabinet dip switch
927   // is bit 0 of input port 2
928   geebee_handleoverlay = 1;
929
930923   warpwarp_ball_pen = 1;
931924   warpwarp_ball_sizex = 4;
932925   warpwarp_ball_sizey = 4;
r10613r10614
935928static DRIVER_INIT( navarone )
936929{
937930   handle_joystick = 1;
938   geebee_handleoverlay = 0;
939931
940932   warpwarp_ball_pen = 1;
941933   warpwarp_ball_sizex = 4;
r10613r10614
945937static DRIVER_INIT( kaitein )
946938{
947939   handle_joystick = 1;
948   geebee_handleoverlay = 0;
949940
950941   warpwarp_ball_pen = 1;
951942   warpwarp_ball_sizex = 1;
r10613r10614
955946static DRIVER_INIT( kaitei )
956947{
957948   handle_joystick = 0;
958   geebee_handleoverlay = 0;
959949
960950   warpwarp_ball_pen = 1;
961951   warpwarp_ball_sizex = 1;
r10613r10614
966956{
967957   handle_joystick = 1;
968958
969   geebee_handleoverlay = 0;
970
971959   warpwarp_ball_pen = 0;
972960   warpwarp_ball_sizex = 4;
973961   warpwarp_ball_sizey = 2;
r10613r10614
976964static DRIVER_INIT( bombbee )
977965{
978966   handle_joystick = 0;
979   geebee_handleoverlay = 0;
980967
981968   warpwarp_ball_pen = 0x200;
982969   warpwarp_ball_sizex = 4;
r10613r10614
986973static DRIVER_INIT( warpwarp )
987974{
988975   handle_joystick = 1;
989   geebee_handleoverlay = 0;
990976
991977   warpwarp_ball_pen = 0x200;
992978   warpwarp_ball_sizex = 4;
r10613r10614
999985GAMEL(1978, geebeeb,  geebee,   geebee,   geebeeb,  geebee,   ROT90, "Namco (F.lli Bertolino license)", "Gee Bee (Europe)", 0, layout_geebee ) // Fratelli Bertolino
1000986GAMEL(1978, geebeeg,  geebee,   geebee,   geebee,   geebee,   ROT90, "Namco (Gremlin license)", "Gee Bee (US)", 0, layout_geebee )
1001987
1002GAME( 1980, navarone, 0,        navarone, navarone, navarone, ROT90, "Namco", "Navarone", GAME_IMPERFECT_SOUND )
988GAMEL(1980, navarone, 0,        navarone, navarone, navarone, ROT90, "Namco", "Navarone", GAME_IMPERFECT_SOUND, layout_navarone )
1003989GAME( 1980, kaitein,  kaitei,   navarone, kaitein,  kaitein,  ROT90, "K.K. Tokki (Namco license)", "Kaitei Takara Sagashi (Namco license)", 0 )
1004990GAME( 1980, kaitei,   0,        navarone, kaitei,   kaitei,   ROT90, "K.K. Tokki", "Kaitei Takara Sagashi", 0 )
1005GAMEL(1980, sos,      0,        navarone, sos,      sos,      ROT90, "Namco", "SOS", GAME_IMPERFECT_SOUND, layout_sos )
991GAMEL(1980, sos,      0,        navarone, sos,      sos,      ROT90, "Namco", "SOS", GAME_IMPERFECT_SOUND, layout_sos ) // developed by Shoei?
1006992
1007993/* Color games */
1008994GAME( 1979, bombbee,    0,        bombbee,  bombbee,  bombbee,  ROT90, "Namco", "Bomb Bee", 0 )
src/mame/drivers/nbmj8891.c
r10613r10614
26062606
26072607
26082608
2609static MACHINE_CONFIG_START( gionbana, driver_device )
2609static MACHINE_CONFIG_START( gionbana, nbmj8891_state )
26102610
26112611   /* basic machine hardware */
26122612   MCFG_CPU_ADD("maincpu", Z80, 20000000/4)   /* 5.00 MHz ? */
src/mame/drivers/naomi.c
r10613r10614
3636
3737- all games that uses YUV just updates one frame then dies, why?
3838
39- all or almost all games seems to have issues with the sound loops, for example sfz3ugd keeps to say "This-This-This ..." at start-up
40  instead of completing the phrase;
39- SH to ARM sound streaming doesn't work (used by ADX compression system)
4140
42- suchie3: used to boot (at least go over the I/O test), it doesn't now, might be protection related.
43
4441- ngdup23a, ngdup23c: missing DIMM emulation, hence they can't possibly work, emulate the DIMM means to add an extra SH-4 ...
4542
46- totd: emulation exits at some point during attract mode without any output.
47
48- spkrbtl: ARM CPU crashes sometimes? Also, it crashes when entering into the gameplay.
49
5043---------------------------------------------------------------------------------------------------------------------------------------------------
5144
5245Guru's Readme
r10613r10614
932925Atomis Wave (system overview)
933926Sammy/SEGA, 2002
934927
935This is one of the latest arcade systems so far, basically just a Dreamcast using ROM carts.
928The Atomiswave System is basically just a Sega Dreamcast using ROM carts.
936929
937930PCB Layout
938931----------
r10613r10614
10331026The bottom of the PCB contains nothing significant except some connectors. One for the game cart, one for special controls
10341027or I/O, one for a communication module, one for a cooling fan and one for the serial connection daughterboard.
10351028
1036---------------------------------------------------------------------------------------------------------------------------------------------------
1029---------------------------------------------------------------------------------------------------------------------------------
10371030
10381031
10391032
1040Atomiswave cart PCB layout and game usage (revision 0.4 13/9/2010 6:12pm)
1033Atomiswave cart PCB layout and game usage (revision 1.0 26/2/2011 5:59pm)
10411034-----------------------------------------
10421035
10431036Type 1 ROM Board:
r10613r10614
10751068               Dolphin Blue                          AX0401F01
10761069               Maximum Speed                         AX0501F01
10771070               Demolish Fist                         AX0601F01
1071               Guilty Gear X Ver. 1.5                AX0801F01
10781072               Guilt Gear Isuka                      AX1201F01
10791073               Knights Of Valour Seven Spirits       AX1301F01
10801074               Salaryman Kintaro                     AX1401F01
r10613r10614
10901084               The name in the archive has been devised purely for convenience.
10911085               This ROM holds the main program.
10921086
1093IC10 to IC17 - Custom-badged 128M TSOP48 mask ROMs. I suspect they are Macronix
1094               ROMs because the ROM on the main board is also a custom Macronix
1095               ROM and they have a history of producing custom ROMs for other
1096               companies that hide their ROM types like Nintendo etc. May as well
1097               be MX23L12810 or MR27V12800J, which have the same pinout.
1098
1087IC10 to IC17 - Custom-badged 128M TSOP48 mask ROMs.
10991088               IC10 - Not Populated for 7 ROMs or less (ROM 01 if 8 ROMs are populated)
11001089               IC11 - ROM 01 (or ROM 02 if 8 ROMs are populated)
11011090               IC12 - ROM 02 (or ROM 03 if 8 ROMs are populated)
r10613r10614
11141103               Dolphin Blue                          AX0401M01 to AX0405M01    5
11151104               Maximum Speed                         AX0501M01 to AX0505M01    5
11161105               Demolish Fist                         AX0601M01 to AX0607M01    7
1106               Guilty Gear X Ver. 1.5                AX0801M01 to AX0807M01    7
11171107               Guilty Gear Isuka                     AX1201M01 to AX1208M01    8
11181108               Knights Of Valour Seven Spirits       AX1301M01 to AX1307M01    7
11191109               Salaryman Kintaro                     AX1401M01 to AX1407M01    7
r10613r10614
11581148               Game (sorted by code)                 Code
11591149               -----------------------------------------------
11601150               Samurai Spirits Tenkaichi Kenkakuden  AX2901F01
1151               Metal Slug 6                          AX3001F01
11611152               The King Of Fighters XI               AX3201F01
11621153               Neogeo Battle Coliseum                AX3301F01
11631154               Rumble Fish 2                         AX3401F01
r10613r10614
11691160               is a TSOP48, using the middle pins. The other 2 pins on each side of the ROM
11701161               are not connected to anything.
11711162
1172       MROM* - Custom-badged SSOP70 mask ROMs. These may be OKI MR26V25605 or MR26V25655 (256M)
1173               or possibly 26V51253 (512M) or something else similar.
1163       MROM* - Custom-badged 256M SSOP70 mask ROMs
11741164
11751165               ROM Codes
11761166               ---------
r10613r10614
11781168               Game (sorted by code)                 Code                      of ROMs
11791169               -----------------------------------------------------------------------
11801170               Samurai Spirits Tenkaichi Kenkakuden  AX2901M01 to AX2907M01    7
1171               Metal Slug 6                          AX3001M01 to AX3004M01    4
11811172               The King Of Fighters XI               AX3201M01 to AX3207M01    7
11821173               Neogeo Battle Coliseum                AX3301M01 to AX3307M01    7
11831174               Rumble Fish 2                         AX3401M01 to AX3405M01    5
r10613r10614
11901181171-8355A
11911182PC BD A/W 128M FLASH
11921183837-14608 (sticker for Extreme Hunting 2 Tournament Edition)
1184837-14695 (sticker for Dirty Pigskin Football)
11931185|----------------------------|
11941186| XC9536*         U16   U2*  |
11951187|                            |
r10613r10614
12151207               Game                                  Part#      Sticker
12161208               ---------------------------------------------------------
12171209               Extreme Hunting 2 Tournament Edition  315-6428P  315-6248
1210               Dirty Pigskin Football                ?          ?
12181211
12191212          U* - Fujitsu MBM29PL12LM-10PCN 128M MirrorFlash TSOP56 flash ROM.
12201213               (configured as 16Mbytes x8bit or 8Mwords x16bit)
12211214               This ROM has no additional custom markings. The name in the archive has been devised
1222               purely for convenience. The number of ROMs may vary between games. So far all 8
1223               positions have been seen populated. It's also possible all positions are present
1224               when manufactured, each board is programmed to requirements and depending on the total
1225               data length, some ROMs may be empty.
1215               purely for convenience using the Sega 837- sticker number. The number of ROMs may vary
1216               between games. So far all 8 positions have been seen populated. It's also possible all
1217               positions are present when manufactured, each board is programmed to requirements and
1218               depending on the total data length, some ROMs may be empty.
12261219
12271220
1228               Other games not dumped (some may have been cancelled, * = known to be released)
1229               ----------------------
1230               Chase 1929
1231               Dirty Pigskin
1232               Force Five
1233               Guilty Gear X Version 1.5 *
1234               Kenju
1235               Metal Slug 6 *
1236               Premier Eleven
1237               Sushi Bar
1238           The King Of Fighters XI *
1239               Sega Clay Challenge *
1240               Sega Bass Fishing Challenge *
12411221
1242
12431222Network Board
12441223-------------
12451224
1246This board is required for Extreme Hunting 2 Tournament Edition, although it doesn't need to be connected
1247to a network or another Atomiswave unit to boot up. However it must be plugged into the PCB in the
1248communication slot or the game will not go in-game. It will boot but then displays NETWORK BOARD ERROR
1249if not present. Externally there's a hole for an RJ45 network cable and a slot for a PIC16C621/PIC16C622
1250PIC enclosed in a black plastic housing. This is the same type as used in NAOMI etc. This board probably acts
1251like the NAOMI network DIMM board minus the on-board DIMM RAM storage.
1225This board is required for Extreme Hunting 2 Tournament Edition (and possibly some other Sega-made Atomiswave carts)
1226although it doesn't need to be connected to a network or another Atomiswave unit to boot up. However it must be
1227plugged into the PCB in the communication slot or the game will not go in-game. It will boot but then displays
1228NETWORK BOARD ERROR if not present. Externally there's a hole for an RJ45 network cable and a slot for a
1229PIC16C621/PIC16C622 PIC enclosed in a black plastic housing. This is the same type as used in NAOMI etc. This
1230board probably acts like the NAOMI network DIMM board minus the on-board DIMM RAM storage.
12521231
12531232837-14508R
12541233171-8324C
r10613r10614
12861265                           ---------------------------------------------------
12871266                           Extreme Hunting 2 Tournament Edition   317-0445-COM
12881267
1268
12891269AW-NET Network Board
12901270--------------------
12911271
r10613r10614
13341314      CN3 - Gun connection for player 2 pump switch
13351315      CN4 - Gun connection for player 1 trigger and optical
13361316      CN5 - Gun connection for player 1 pump switch
1317
1318
1319Other games not dumped (some may have been cancelled)
1320----------------------
1321Chase 1929
1322Force Five
1323Kenju
1324Premier Eleven
1325Sushi Bar
1326Sega Clay Challenge
1327Sega Bass Fishing Challenge
1328
13371329*/
13381330
13391331#include "emu.h"
r10613r10614
26522644   // on-cart X76F100 eeprom contents
26532645   ROM_REGION( 0x84, "naomibd_eeprom", 0 )
26542646   ROM_LOAD( "841-0003.sf",  0x000000, 0x000084, CRC(3a119a17) SHA1(d37a092cca7c9cfc5f2637b355af90a65d04013e) )
2655
2656   // trojaned protection data (filename is word offset)
2657   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
2658        ROM_LOAD( "00000500.bin", 0x000000, 0x020000, CRC(3751d50e) SHA1(08d56e7befd3e1bc2c29217c60dee0c862af65ed) )
2659        ROM_LOAD( "00020504.bin", 0x020000, 0x020000, CRC(6b4ab9f6) SHA1(205c355a5a55659f35645d3e66dc1dcff703727c) )
2660        ROM_LOAD( "00040508.bin", 0x040000, 0x020000, CRC(dae5d37d) SHA1(63d0cde73b86e77ea7b5e1d71643566c500f9933) )
2661        ROM_LOAD( "0006050c.bin", 0x060000, 0x020000, CRC(c2b7ea51) SHA1(59f1cb01b140e7fdea7d945acad464e08e3adf44) )
2662        ROM_LOAD( "00080510.bin", 0x080000, 0x020000, CRC(7b84acb4) SHA1(e48448795c058c0fc3a9e9108de18a3181db5417) )
2663        ROM_LOAD( "000a0514.bin", 0x0a0000, 0x020000, CRC(f954ffcd) SHA1(3015dfc298de1e16db07406e9ecb5fc0e2aae0a8) )
2664        ROM_LOAD( "000c0518.bin", 0x0c0000, 0x020000, CRC(28fce8ad) SHA1(180ae2dc9181bbe4215093e4e933c9e78d3af7a8) )
2665        ROM_LOAD( "000e051c.bin", 0x0e0000, 0x020000, CRC(a7f7a5c1) SHA1(6b39aa8f8a762ffe61b07f77713cca5c95a8dfcf) )
2666        ROM_LOAD( "00100520.bin", 0x100000, 0x020000, CRC(85417674) SHA1(0d35aa0f3d5f451bbf4daad343b9ad1ebd9d9551) )
2667        ROM_LOAD( "00118a3a.bin", 0x120000, 0x020000, CRC(72e58444) SHA1(09ae85c131f7b4a0638efd1dff0807cc20b59637) )
2668        ROM_LOAD( "0012c0d8.bin", 0x140000, 0x020000, CRC(84e8e517) SHA1(f1e81913181b9c6276a430988fefc00597e33e89) )
2669        ROM_LOAD( "00147e22.bin", 0x160000, 0x020000, CRC(66efd53e) SHA1(40cfc20df93f9ec1f260fc3f56bb5ac0be775cc6) )
2670        ROM_LOAD( "001645ce.bin", 0x180000, 0x020000, CRC(adc73d19) SHA1(4df4bd7db6bf2f9af06d9d3ec9466970bec7833c) )
2671        ROM_LOAD( "0017c6b2.bin", 0x1a0000, 0x020000, CRC(717f2e91) SHA1(e03d778a1c39cf01827f79a1b10c03a4a6047962) )
2672        ROM_LOAD( "0019902e.bin", 0x1c0000, 0x020000, CRC(f4882ea8) SHA1(a27e52062780e095675f749191e0ea22755152eb) )
2673        ROM_LOAD( "001b562a.bin", 0x1e0000, 0x013e00, CRC(01ae0721) SHA1(b9f24e0bb8609b8cb1a45e7c1e1dc1f271bbdcaf) )
26742647ROM_END
26752648
26762649/*
r10613r10614
27412714   // on-cart X76F100 eeprom contents
27422715   ROM_REGION( 0x84, "naomibd_eeprom", 0 )
27432716   ROM_LOAD( "841-0003.sf",  0x000000, 0x000084, CRC(3a119a17) SHA1(d37a092cca7c9cfc5f2637b355af90a65d04013e) )
2744
2745   // trojaned protection data (filename is word offset)
2746   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
2747        ROM_LOAD( "00000500.bin", 0x000000, 0x020000, CRC(a42f0337) SHA1(0aaeff753a4e2f9b5d287cd80952533f0ced430c) )
2748        ROM_LOAD( "00020504.bin", 0x020000, 0x020000, CRC(3d3bfbe4) SHA1(4748ca4c14a31da623ebd3a1acff93635c039888) )
2749        ROM_LOAD( "00040508.bin", 0x040000, 0x020000, CRC(d0c3699c) SHA1(11a4e8b47cb6ae827307cd44689477ebfe23d690) )
2750        ROM_LOAD( "0006050c.bin", 0x060000, 0x020000, CRC(bc2e8e71) SHA1(253561a58caf15607d87d932d9b98d6ffa779669) )
2751        ROM_LOAD( "00080510.bin", 0x080000, 0x020000, CRC(a26a6159) SHA1(8e4f0a2091b5b2eb825bb9220c5e4dfe9ab935fe) )
2752        ROM_LOAD( "000a0514.bin", 0x0a0000, 0x020000, CRC(83138b3b) SHA1(6b69e43b6e6c4b75278045a883337cb7abcf9501) )
2753        ROM_LOAD( "000c0518.bin", 0x0c0000, 0x020000, CRC(9f246058) SHA1(bc54f3bdc23a278b14867e096c3f644447b9c0a6) )
2754        ROM_LOAD( "000e051c.bin", 0x0e0000, 0x020000, CRC(7cfd53d5) SHA1(d77ff8d3edbc2d41334d6416d17339ea2c764887) )
2755        ROM_LOAD( "00100520.bin", 0x100000, 0x020000, CRC(8dd856d3) SHA1(9952fdf9017bdb8c50b413de5817a746c24901e9) )
2756        ROM_LOAD( "0011a5b4.bin", 0x120000, 0x020000, CRC(484c511d) SHA1(02c8c1b46ce8a27b85652d3f032f4f42be5341ba) )
2757        ROM_LOAD( "0012e7c4.bin", 0x140000, 0x020000, CRC(ceffdd4b) SHA1(36dfa9fd4857429cf9b505d04d7a82d3bc161b90) )
2758        ROM_LOAD( "001471f6.bin", 0x160000, 0x020000, CRC(263d0706) SHA1(194e259b78d3006372ad007a7e3b9456f607b922) )
2759        ROM_LOAD( "001640c4.bin", 0x180000, 0x020000, CRC(3addb31e) SHA1(97794166b0811ff9535b3a3f598e0cb3da9fc7b3) )
2760        ROM_LOAD( "001806ca.bin", 0x1a0000, 0x020000, CRC(dbfddad2) SHA1(72696b5ed942fe3ef0bc271f6d66d5f089221192) )
2761        ROM_LOAD( "00199df4.bin", 0x1c0000, 0x020000, CRC(2ab0d0c3) SHA1(10642e9d8c9c24f366359fbe7890a0f1347a7a1a) )
2762        ROM_LOAD( "001b5d0a.bin", 0x1e0000, 0x017e00, CRC(c9c3bbd5) SHA1(6f3853e3e1614993b5d658ebec6bf5183577ab36) )
27632717ROM_END
27642718
27652719/*
r10613r10614
34243378   ROM_LOAD("mpr-23353.ic12", 0x6000000, 0x0800000, CRC(daa0ca24) SHA1(afce14e213e79add7fded838e71bb4447425906a) )
34253379   ROM_LOAD("mpr-23354.ic13", 0x6800000, 0x0800000, CRC(cea127f7) SHA1(11f12472ebfc93eb72b764c780e30afd4812dbe9) )
34263380   ROM_LOAD("mpr-23355.ic14", 0x7000000, 0x0800000, CRC(e809685f) SHA1(dc052b4eb4fdcfdc22c4807316ce34ee7a0d58a6) )
3427
3428   // trojaned protection data
3429   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
3430        ROM_LOAD( "a0100000.bin", 0x000000, 0x010000, CRC(cbe5a37a) SHA1(63f40758ef94d02a53ad860b2bed9c41e20a8263) )
3431        ROM_LOAD( "a010b268.bin", 0x010000, 0x010000, CRC(7f0ba37e) SHA1(2d33703c9ec08800c3fae23991859f713f8c944b) )
3432        ROM_LOAD( "a0115558.bin", 0x020000, 0x010000, CRC(882c945f) SHA1(60bf8fe3dcf079464f660c7c210d2a379b2ef04f) )
3433        ROM_LOAD( "a0120b28.bin", 0x030000, 0x010000, CRC(024952c0) SHA1(98e4ce87b5ac1169b5ab1ba9cc7553069e09cbbe) )
3434        ROM_LOAD( "a012987a.bin", 0x040000, 0x010000, CRC(50ea6621) SHA1(ea4e5e0b9563c5e49794a634c08be8d2e81fb773) )
3435        ROM_LOAD( "a012e320.bin", 0x050000, 0x010000, CRC(e445906e) SHA1(cd585100b78253bdd16f3895fdb37ff1e08690f6) )
3436        ROM_LOAD( "a0133cf6.bin", 0x060000, 0x00f014, CRC(5763d154) SHA1(645b0a10fd196f53ff7f656b8db798c8e753c4ed) )
3437        ROM_LOAD( "a0170000.bin", 0x070000, 0x010000, CRC(e153030a) SHA1(e1738ec558f0e3d5a796e34618c533cfcd6928ed) )
3438        ROM_LOAD( "a017cf18.bin", 0x080000, 0x010000, CRC(def783cf) SHA1(911e6b99f8ce498ddd5048ea655b76cad33f47c0) )
3439        ROM_LOAD( "a018a45a.bin", 0x090000, 0x010000, CRC(408cd99b) SHA1(110f9922cded7ffc5108ed964b82ac39beb6ce6b) )
3440        ROM_LOAD( "a0197852.bin", 0x0a0000, 0x010000, CRC(09d10a60) SHA1(04bfdba2ea9a45cb10a60fe95d7d2e0997012b4f) )
3441        ROM_LOAD( "a01a4916.bin", 0x0b0000, 0x010000, CRC(3895730e) SHA1(b2c0a839e330916e598c8f27f2a4873bbaaddbde) )
3442        ROM_LOAD( "a01b1c3e.bin", 0x0c0000, 0x010000, CRC(eecb6a13) SHA1(0203c54b98aaf203e7d1b3646102efe63c550115) )
3443        ROM_LOAD( "a01bef38.bin", 0x0d0000, 0x010000, CRC(7d9a497c) SHA1(680a49389e7774aa03ebe6fc844dea53b430796f) )
3444        ROM_LOAD( "a01cbb10.bin", 0x0e0000, 0x010000, CRC(69b770bd) SHA1(aac5801d9a8a48ef77e932195cd7c30ae562bc38) )
3445        ROM_LOAD( "a01d7500.bin", 0x0f0000, 0x010000, CRC(a1119fca) SHA1(1acda8f73a5b1fb180985245b8b0eb9453db0cea) )
3446        ROM_LOAD( "a0200000.bin", 0x100000, 0x010000, CRC(21662b41) SHA1(4dab25dcc92d1a7418d308542499bdec6c3b3b2b) )
3447        ROM_LOAD( "a0210004.bin", 0x110000, 0x010000, CRC(07166890) SHA1(529c28bf925243468fc00b0ad5ea57429d4de907) )
3448        ROM_LOAD( "a0220008.bin", 0x120000, 0x008000, CRC(09cd1354) SHA1(83f6b36aec4e7c5aa1b8bc21dc6fabf8f283ed55) )
3449        ROM_LOAD( "a0228000.bin", 0x130000, 0x008000, CRC(628a4917) SHA1(cf36bc2413cb63fb511936ab4b5f11b7c8cbb057) )
34503381ROM_END
34513382
34523383/*
r10613r10614
36403571   ROM_LOAD("mpr-23061.ic30",  0x7000000, 0x0800000, CRC(fb1844c4) SHA1(1d1571516a6dbed0c4ded3b80efde9cc9281f66f) )
36413572   ROM_LOAD("mpr-23083.ic31",  0x7800000, 0x0400000, CRC(c61d2dfe) SHA1(a05fb979ed7c8040de91716fc8814e6bd995efa2) )
36423573   ROM_LOAD("mpr-23084.ic32",  0x8000000, 0x0400000, CRC(e228cdfd) SHA1(d02a2e3557bd24cf34c5ddb42d41ca15e78ae885) )
3643
3644
3645
3646   // DMA protection data
3647   ROM_LOAD("88000000.bin", 0x8800000, 0x025f00, CRC(77d79823) SHA1(2545d28eee47114e8ffb9bc6d7a910e90fc48420) )
3648   ROM_LOAD("88026440.bin", 0x8830000, 0x016520, CRC(dad9ebbd) SHA1(39c0697caa2b5ee11d99e75726e92ed86a23f10b) )
3649   ROM_LOAD("8803bda0.bin", 0x8850000, 0x01e5e0, CRC(9e0b8202) SHA1(729bed557c1a00da13c990603bbadab38d90285e) )
3650   ROM_LOAD("8805a560.bin", 0x8870000, 0x0017a0, CRC(7bc27482) SHA1(6ce6074cf47989f42af02deb7aac52883912784a) )
3651   ROM_LOAD("8805b720.bin", 0x8880000, 0x02b5a0, CRC(485d0aef) SHA1(853f4b49b489cc512c906edcaf3cd8b5bf4c64c0) )
3652   ROM_LOAD("8808b7e0.bin", 0x88a0000, 0x013ec0, CRC(0fc8f363) SHA1(dad30d43cef89d01ce80301b1d796aabad755de6) )
36533574ROM_END
36543575
36553576/* toy fighter - 1999 sega */
r10613r10614
37443665        ROM_LOAD( "mpr-22182.ic19s", 0x9800000, 0x800000, CRC(c5606c42) SHA1(5871104ff1c7acde0493e13b9a4d0abdf8a40728) )
37453666        ROM_LOAD( "mpr-22183.ic20s", 0xa000000, 0x800000, CRC(776af308) SHA1(7d29cb4dce75d34c622549fea7e102868d0da60a) )
37463667
3747   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
3748        ROM_LOAD( "00800000.bin", 0x000000, 0x002000, CRC(7fc42084) SHA1(7c7b9e7e0b8885e690f3edd25e6d26201c899f2f) )
3749
37503668   // JVS I/O board 837-13844, code is for a Z80 of unknown type (it's inside the big Sega ASIC)
37513669   ROM_REGION( 0x20000, "jvsio", ROMREGION_ERASEFF)
37523670        ROM_LOAD( "epr-21868.ic7", 0x000000, 0x010000, CRC(c306a51f) SHA1(7833b73dc34c4c62401a30637968f46b949ceac0) )
r10613r10614
38033721        ROM_LOAD( "mpr-22913.ic4", 0x2000000, 0x800000, CRC(1fbdc41a) SHA1(eb8b9577b7677b9e9aec05ae950dee516ae15bf5) )
38043722        ROM_LOAD( "mpr-22914.ic5", 0x2800000, 0x800000, CRC(77844b60) SHA1(65d71febb8a160d00778ac7b53e082253cad9834) )
38053723        ROM_LOAD( "mpr-22915.ic6", 0x3000000, 0x800000, CRC(e48148ac) SHA1(c1273353eeaf9bb6b185f133281d7d04271bc895) )
3806
3807   // trojaned protection data (filename is address read from)
3808   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
3809        ROM_LOAD( "a0cad0c0.bin", 0x000000, 0x0101b2, CRC(0db80e6d) SHA1(74f8e817e3e69c64391b2eff2c8c504dcad9f84f) )
38103724ROM_END
38113725
38123726/*
r10613r10614
41024016   ROM_LOAD32_WORD("mpr-23226.ic32", 0x8000002, 0x0800000, CRC(cd5da506) SHA1(2e76c8892c1d389b0f12a0046213f43d2ab07d78) ) //ic 17
41034017
41044018   ROM_COPY( "user1", 0x1400000, 0x0800000, 0x0800000 ) // mirror data for IC1 (no test on this game, but layout is the same as gram2000)
4105
4106   // trojaned protection data (must be in the "user1" region because it's accessed via DMA)
4107   ROM_LOAD( "81452000_dma.bin", 0x9000000, 0x000120, CRC(96049488) SHA1(e2b98e8986f8cbf026db50a652300081a8e470b0) )
41084019ROM_END
41094020
41104021/*
r10613r10614
46954606        ROM_LOAD32_WORD( "mpr-22322.32",   0x7800002, 0x800000, CRC(21bf1caf) SHA1(bc1828db2f5f71ef87153a81b49b2ba72ba176e1) )
46964607        ROM_LOAD32_WORD( "mpr-22323.33s",  0x8800000, 0x800000, CRC(0bd632ab) SHA1(21acab5336dd0ba317839176f2557df95917729e) )
46974608        ROM_LOAD32_WORD( "mpr-22324.34",   0x8800002, 0x800000, CRC(ff2571d4) SHA1(c2cbb2345163bbf1973e63cefb9a952e5a52a6cf) )
4698
4699   ROM_REGION( 0x200000, "naomibd_prot", ROMREGION_ERASE00 )
4700        ROM_LOAD( "01f169c0.bin", 0x000000, 0x000100, CRC(b0a330f4) SHA1(10c7a7f4d6c7f265a32887beaca73686c4cb1e03) )
47014609ROM_END
47024610
47034611ROM_START( kick4csh )
r10613r10614
61376045   ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF)
61386046   //PIC16C622A (317-0345-JPN)
61396047   //(sticker 253-5508-0345J)
6140   ROM_LOAD( "317-0345-jpn.pic", 0x000000, 0x004000, CRC(56e1274a) SHA1(735a6071226f3297de64bc0a38be741e87f5d023) )
6048   ROM_LOAD( "317-0345-jpn.pic", 0x000000, 0x004000, CRC(56e1274a) SHA1(735a6071226f3297de64bc0a38be741e87f5d023) )
61416049ROM_END
61426050
61436051ROM_START( initdv2jo )
6144   NAOMI2_BIOS
6052   NAOMIGD_BIOS
61456053   NAOMI_DEFAULT_EEPROM
61466054
61476055   DISK_REGION( "gdrom" )
r10613r10614
61636071
61646072   ROM_REGION( 0x4000, "pic", ROMREGION_ERASEFF)
61656073   //PIC16C622A (317-0357-EXP)
6166   ROM_LOAD( "317-0357-exp.pic", 0x000000, 0x004000, CRC(38f84b4d) SHA1(03c12d8580da1a4b3a554e62fd8b1f3447b7ebbd) )
6074   ROM_LOAD( "317-0357-exp.pic", 0x000000, 0x004000, CRC(38f84b4d) SHA1(03c12d8580da1a4b3a554e62fd8b1f3447b7ebbd) )
61676075ROM_END
61686076
61696077ROM_START( initdv3j )
r10613r10614
61816089ROM_END
61826090
61836091ROM_START( initdv3jb )
6184   NAOMI2_BIOS
6092   NAOMIGD_BIOS
61856093   NAOMI_DEFAULT_EEPROM
61866094
61876095   DISK_REGION( "gdrom" )
r10613r10614
69236831static const UINT32 mslug6_key   = 0x53627;
69246832static const UINT32 samsptk_key  = 0xe935f;
69256833static const UINT32 ggx15_key    = 0x91257;
6834static const UINT32 rumblef2_key = 0xd674a;
69266835
69276836static DRIVER_INIT( atomiswave )
69286837{
r10613r10614
69756884AW_DRIVER_INIT(mslug6)
69766885AW_DRIVER_INIT(samsptk)
69776886AW_DRIVER_INIT(ggx15)
6887AW_DRIVER_INIT(rumblef2)
69786888
69796889ROM_START( fotns )
69806890   ROM_REGION( 0x200000, "awflash", 0)
r10613r10614
72877197   AW_BIOS
72887198
72897199   ROM_REGION( 0x8000000, "user1", ROMREGION_ERASE)
7290        ROM_LOAD( "ax0801p01.ic18", 0x0000000, 0x0800000, CRC(d920c6bb) SHA1(ab34bbef3c71396447bc5322d8e8786041fc832a) )
7291        ROM_LOAD( "ax0801m01.ic11", 0x1000000, 0x1000000, CRC(61879b2d) SHA1(9592fbd979cef9d8f465cd92d0f00b9c13ecf7ba) )
7292        ROM_LOAD( "ax0802m01.ic12", 0x2000000, 0x1000000, CRC(c0ff124d) SHA1(dd403d10de2f097fbaa6b93bc311e2b9e893828d) )
7293        ROM_LOAD( "ax0803m01.ic13", 0x3000000, 0x1000000, CRC(4400c89a) SHA1(4e13536c01103ecfbfc9e3e33746ceae7a91a520) )
7294        ROM_LOAD( "ax0804m01.ic14", 0x4000000, 0x1000000, CRC(70f58ab4) SHA1(cd2def19bbad945c87567f8d28f3a2a179a7f7f6) )
7295        ROM_LOAD( "ax0805m01.ic15", 0x5000000, 0x1000000, CRC(72740e45) SHA1(646eded89f10008c9176cd6772a8ac9d1bf4271a) )
7296        ROM_LOAD( "ax0806m01.ic16", 0x6000000, 0x1000000, CRC(3bf8ecba) SHA1(43e7fbf21d8ee60bab72ce558640730fd9c3e3b8) )
7297        ROM_LOAD( "ax0807m01.ic17", 0x7000000, 0x1000000, CRC(e397dd79) SHA1(5fec32dc19dd71ef0d451f8058186f998015723b) )
7200        ROM_LOAD( "ax0801p01.ic18", 0x0000000, 0x0800000, CRC(d920c6bb) SHA1(ab34bbef3c71396447bc5322d8e8786041fc832a) )
7201        ROM_LOAD( "ax0801m01.ic11", 0x1000000, 0x1000000, CRC(61879b2d) SHA1(9592fbd979cef9d8f465cd92d0f00b9c13ecf7ba) )
7202        ROM_LOAD( "ax0802m01.ic12", 0x2000000, 0x1000000, CRC(c0ff124d) SHA1(dd403d10de2f097fbaa6b93bc311e2b9e893828d) )
7203        ROM_LOAD( "ax0803m01.ic13", 0x3000000, 0x1000000, CRC(4400c89a) SHA1(4e13536c01103ecfbfc9e3e33746ceae7a91a520) )
7204        ROM_LOAD( "ax0804m01.ic14", 0x4000000, 0x1000000, CRC(70f58ab4) SHA1(cd2def19bbad945c87567f8d28f3a2a179a7f7f6) )
7205        ROM_LOAD( "ax0805m01.ic15", 0x5000000, 0x1000000, CRC(72740e45) SHA1(646eded89f10008c9176cd6772a8ac9d1bf4271a) )
7206        ROM_LOAD( "ax0806m01.ic16", 0x6000000, 0x1000000, CRC(3bf8ecba) SHA1(43e7fbf21d8ee60bab72ce558640730fd9c3e3b8) )
7207        ROM_LOAD( "ax0807m01.ic17", 0x7000000, 0x1000000, CRC(e397dd79) SHA1(5fec32dc19dd71ef0d451f8058186f998015723b) )
72987208ROM_END
72997209
7210ROM_START( rumblef2 )
7211   ROM_REGION( 0x200000, "awflash", 0)
7212   AW_BIOS
7213
7214   ROM_REGION( 0x10000000, "user1", ROMREGION_ERASE)
7215   ROM_LOAD( "ax3401p01.fmem1", 0x0000000, 0x0800000, CRC(a33601cf) SHA1(2dd60a9c3a2517f2257ab69288fa95645de133fa) )
7216   ROM_LOAD( "ax3401m01.mrom1", 0x1000000, 0x2000000, CRC(60894d4c) SHA1(5b21af3c7c82d4d64bfd8498c26283111ada1298) )
7217   ROM_LOAD( "ax3402m01.mrom2", 0x3000000, 0x2000000, CRC(e4224cc9) SHA1(dcab06fcf48cda286f93d2b37f03a83abf3230cb) )
7218   ROM_LOAD( "ax3403m01.mrom3", 0x5000000, 0x2000000, CRC(081c0edb) SHA1(63a3f1b5f9d7ca4367868c492236406f23996cc3) )
7219   ROM_LOAD( "ax3404m01.mrom4", 0x7000000, 0x2000000, CRC(a426b443) SHA1(617aab42e432a80b0663281fb7faa6c14ef4f149) )
7220   ROM_LOAD( "ax3405m01.mrom5", 0x9000000, 0x2000000, CRC(4766ce56) SHA1(349b82013a75905ae5520b14a87702c9038a5def) )
7221   ROM_COPY( "user1", 0x9000000, 0xb000000, 0x2000000)
7222ROM_END
7223
73007224/* Atomiswave */
73017225GAME( 2001, awbios,   0,        aw,    aw,    atomiswave, ROT0, "Sammy",                           "Atomiswave Bios", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
73027226
r10613r10614
73137237GAME( 2004, ftspeed,  awbios,   aw,    aw,    ftspeed,  ROT0, "Sammy",             "Faster Than Speed", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
73147238GAME( 2004, kov7sprt, awbios,   aw,    aw,    kov7sprt, ROT0, "Sammy / IGS",          "Knights of Valour - The Seven Spirits", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
73157239GAME( 2005, vfurlong, awbios,   aw,    aw,    vfurlong, ROT0, "Sammy",                  "Net Select Keiba Victory Furlong", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
7240GAME( 2004, rumblef2, awbios,   aw,    aw,    rumblef2, ROT0, "Sammy / Dimps",                   "The Rumble Fish 2", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
73167241GAME( 2005, ngbc,     awbios,   aw,    aw,    ngbc,     ROT0, "Sammy / SNK Playmore",            "Neo-Geo Battle Coliseum", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
73177242GAME( 2005, samsptk,  awbios,   aw,    aw,    samsptk,  ROT0, "Sammy / SNK Playmore",            "Samurai Spirits Tenkaichi Kenkakuden", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
73187243GAME( 2005, kofxi,    awbios,   aw,    aw,    kofxi,    ROT0, "Sammy / SNK Playmore",            "The King of Fighters XI", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
src/mame/drivers/megatech.c
r10613r10614
504504   MCFG_SCREEN_SIZE(342,262)
505505   MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 224-1)
506506   MCFG_SCREEN_UPDATE(mtnew)
507
508   MCFG_SCREEN_MODIFY("megadriv")
509   MCFG_SCREEN_UPDATE(mtnew)
507510   MCFG_SCREEN_EOF(mtnew)
508511
509512   /* sound hardware */
src/mame/drivers/fromanc2.c
r10613r10614
651651   MCFG_SCREEN_UPDATE(fromanc2)
652652
653653   MCFG_VIDEO_START(fromancr)
654   
654
655655   /* sound hardware */
656656   MCFG_SPEAKER_STANDARD_MONO("mono")
657657
src/mame/drivers/nbmj8688.c
r10613r10614
29172917
29182918
29192919
2920static MACHINE_CONFIG_START( NBMJDRV_4096, driver_device )
2920static MACHINE_CONFIG_START( NBMJDRV_4096, nbmj8688_state )
29212921
29222922   /* basic machine hardware */
29232923   MCFG_CPU_ADD("maincpu", Z80, 5000000)   /* 5.00 MHz */
r10613r10614
30393039MACHINE_CONFIG_END
30403040
30413041
3042static MACHINE_CONFIG_START( mbmj_p16bit_LCD, driver_device )
3042static MACHINE_CONFIG_START( mbmj_p16bit_LCD, nbmj8688_state )
30433043
30443044   /* basic machine hardware */
30453045   MCFG_CPU_ADD("maincpu", Z80, 5000000)   /* 5.00 MHz */
src/mame/drivers/vsnes.c
r10613r10614
148148
149149/******************************************************************************/
150150
151/* local stuff */
152static UINT8 *work_ram, *work_ram_1;
153static int coin;
154151
155152static WRITE8_HANDLER( sprite_dma_0_w )
156153{
r10613r10614
166163
167164static WRITE8_HANDLER( vsnes_coin_counter_w )
168165{
166   vsnes_state *state = space->machine->driver_data<vsnes_state>();
169167   coin_counter_w( space->machine, 0, data & 0x01 );
170   coin = data;
168   state->coin = data;
171169
172170    //"bnglngby" and "cluclu"
173171   if( data & 0xfe )
r10613r10614
178176
179177static READ8_HANDLER( vsnes_coin_counter_r )
180178{
179   vsnes_state *state = space->machine->driver_data<vsnes_state>();
181180   //only for platoon
182   return coin;
181   return state->coin;
183182}
184183
185184static WRITE8_HANDLER( vsnes_coin_counter_1_w )
r10613r10614
210209}
211210
212211static ADDRESS_MAP_START( vsnes_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
213   AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_BASE(&work_ram)
212   AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_BASE_MEMBER(vsnes_state, work_ram)
214213   AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu1", ppu2c0x_r, ppu2c0x_w)
215214   AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac1", dac_w)
216215   AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes1", nes_psg_r, nes_psg_w)
r10613r10614
224223ADDRESS_MAP_END
225224
226225static ADDRESS_MAP_START( vsnes_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
227   AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_BASE(&work_ram_1)
226   AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x1800) AM_RAM AM_BASE_MEMBER(vsnes_state, work_ram_1)
228227   AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu2", ppu2c0x_r, ppu2c0x_w)
229228   AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac2", dac_w)
230229   AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes2", nes_psg_r, nes_psg_w)
r10613r10614
16411640   "sub"
16421641};
16431642
1644static MACHINE_CONFIG_START( vsnes, driver_device )
1643static MACHINE_CONFIG_START( vsnes, vsnes_state )
16451644
16461645   /* basic machine hardware */
16471646   MCFG_CPU_ADD("maincpu", N2A03,N2A03_DEFAULTCLOCK)
r10613r10614
17001699   MCFG_PPU2C05_04_ADD("ppu1", vsnes_ppu_interface_1)
17011700MACHINE_CONFIG_END
17021701
1703static MACHINE_CONFIG_START( vsdual, driver_device )
1702static MACHINE_CONFIG_START( vsdual, vsnes_state )
17041703
17051704   /* basic machine hardware */
17061705   MCFG_CPU_ADD("maincpu", N2A03,N2A03_DEFAULTCLOCK)
src/mame/drivers/victory.c
r10613r10614
129129   AM_RANGE(0xc000, 0xc0ff) AM_READ(victory_video_control_r)
130130   AM_RANGE(0xc100, 0xc1ff) AM_WRITE(victory_video_control_w)
131131   AM_RANGE(0xc200, 0xc3ff) AM_WRITE(victory_paletteram_w)
132   AM_RANGE(0xc400, 0xc7ff) AM_RAM AM_BASE(&victory_videoram)
133   AM_RANGE(0xc800, 0xdfff) AM_RAM AM_BASE(&victory_charram)
132   AM_RANGE(0xc400, 0xc7ff) AM_RAM AM_BASE_MEMBER(victory_state, videoram)
133   AM_RANGE(0xc800, 0xdfff) AM_RAM AM_BASE_MEMBER(victory_state, charram)
134134   AM_RANGE(0xe000, 0xefff) AM_RAM
135135   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("nvram")
136136   AM_RANGE(0xf800, 0xf800) AM_MIRROR(0x07fc) AM_DEVREADWRITE("custom", victory_sound_response_r, victory_sound_command_w)
r10613r10614
208208 *
209209 *************************************/
210210
211static MACHINE_CONFIG_START( victory, driver_device )
211static MACHINE_CONFIG_START( victory, victory_state )
212212
213213   /* basic machine hardware */
214214   MCFG_CPU_ADD("maincpu", Z80, VICTORY_MAIN_CPU_CLOCK)
src/mame/drivers/nbmj8991.c
r10613r10614
14751475};
14761476
14771477
1478static MACHINE_CONFIG_START( nbmjdrv1, driver_device )   // galkoku
1478static MACHINE_CONFIG_START( nbmjdrv1, nbmj8991_state )   // galkoku
14791479
14801480   /* basic machine hardware */
14811481   MCFG_CPU_ADD("maincpu", Z80, 25000000/5)      /* 5.00 MHz ? */
r10613r10614
15081508MACHINE_CONFIG_END
15091509
15101510
1511static MACHINE_CONFIG_START( nbmjdrv2, driver_device )   // pstadium
1511static MACHINE_CONFIG_START( nbmjdrv2, nbmj8991_state )   // pstadium
15121512
15131513   /* basic machine hardware */
15141514   MCFG_CPU_ADD("maincpu", Z80, 6000000/2)   /* 3.00 MHz */
src/mame/drivers/exidy440.c
r10613r10614
242242#define MAIN_CPU_CLOCK      (EXIDY440_MASTER_CLOCK / 8)
243243
244244
245/* local variables */
246static UINT8 exidy440_bank;
247
248static const UINT8 *showdown_bank_data[2];
249static INT8 showdown_bank_select;
250static UINT8 showdown_bank_offset;
251
252245static READ8_HANDLER( showdown_bank0_r );
253246
254247
r10613r10614
276269
277270static CUSTOM_INPUT( firq_beam_r )
278271{
279   return exidy440_firq_beam;
272   exidy440_state *state = field->port->machine->driver_data<exidy440_state>();
273   return state->firq_beam;
280274}
281275
282276
283277static CUSTOM_INPUT( firq_vblank_r )
284278{
285   return exidy440_firq_vblank;
279   exidy440_state *state = field->port->machine->driver_data<exidy440_state>();
280   return state->firq_vblank;
286281}
287282
288283
r10613r10614
303298
304299void exidy440_bank_select(running_machine *machine, UINT8 bank)
305300{
301   exidy440_state *state = machine->driver_data<exidy440_state>();
306302   /* for the showdown case, bank 0 is a PLD */
307   if (showdown_bank_data[0] != NULL)
303   if (state->showdown_bank_data[0] != NULL)
308304   {
309      if (bank == 0 && exidy440_bank != 0)
305      if (bank == 0 && state->bank != 0)
310306         memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, showdown_bank0_r);
311      else if (bank != 0 && exidy440_bank == 0)
307      else if (bank != 0 && state->bank == 0)
312308         memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, "bank1");
313309   }
314310
315311   /* select the bank and update the bank pointer */
316   exidy440_bank = bank;
317   memory_set_bankptr(machine, "bank1", &machine->region("maincpu")->base()[0x10000 + exidy440_bank * 0x4000]);
312   state->bank = bank;
313   memory_set_bankptr(machine, "bank1", &machine->region("maincpu")->base()[0x10000 + state->bank * 0x4000]);
318314}
319315
320316
321317static WRITE8_HANDLER( bankram_w )
322318{
319   exidy440_state *state = space->machine->driver_data<exidy440_state>();
323320   /* EEROM lives in the upper 8k of bank 15 */
324   if (exidy440_bank == 15 && offset >= 0x2000)
321   if (state->bank == 15 && offset >= 0x2000)
325322   {
326323      space->machine->region("maincpu")->base()[0x10000 + 15 * 0x4000 + offset] = data;
327324      logerror("W EEROM[%04X] = %02X\n", offset - 0x2000, data);
r10613r10614
398395
399396static READ8_HANDLER( showdown_bank0_r )
400397{
398   exidy440_state *state = space->machine->driver_data<exidy440_state>();
401399   /* showdown relies on different values from different memory locations */
402400   /* yukon relies on multiple reads from the same location returning different values */
403401   UINT8 result = 0xff;
404402
405403   /* fetch the special data if a bank is selected */
406   if (showdown_bank_select >= 0)
404   if (state->showdown_bank_select >= 0)
407405   {
408      result = showdown_bank_data[showdown_bank_select][showdown_bank_offset++];
406      result = state->showdown_bank_data[state->showdown_bank_select][state->showdown_bank_offset++];
409407
410408      /* after 24 bytes, stop and revert back to the beginning */
411      if (showdown_bank_offset == 0x18)
412         showdown_bank_offset = 0;
409      if (state->showdown_bank_offset == 0x18)
410         state->showdown_bank_offset = 0;
413411   }
414412
415413   /* look for special offsets to adjust our behavior */
416414   if (offset == 0x0055)
417      showdown_bank_select = -1;
418   else if (showdown_bank_select == -1)
415      state->showdown_bank_select = -1;
416   else if (state->showdown_bank_select == -1)
419417   {
420      showdown_bank_select = (offset == 0x00ed) ? 0 : (offset == 0x1243) ? 1 : 0;
421      showdown_bank_offset = 0;
418      state->showdown_bank_select = (offset == 0x00ed) ? 0 : (offset == 0x1243) ? 1 : 0;
419      state->showdown_bank_offset = 0;
422420   }
423421
424422   return result;
r10613r10614
439437
440438static WRITE8_HANDLER( topsecex_yscroll_w )
441439{
442   *topsecex_yscroll = data;
440   exidy440_state *state = space->machine->driver_data<exidy440_state>();
441   *state->topsecex_yscroll = data;
443442}
444443
445444
r10613r10614
459458
460459static MACHINE_RESET( exidy440 )
461460{
462   exidy440_bank = 0xff;
461   exidy440_state *state = machine->driver_data<exidy440_state>();
462   state->bank = 0xff;
463463   exidy440_bank_select(machine, 0);
464464}
465465
r10613r10614
472472 *************************************/
473473
474474static ADDRESS_MAP_START( exidy440_map, ADDRESS_SPACE_PROGRAM, 8 )
475   AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE(&exidy440_imageram)
475   AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE_MEMBER(exidy440_state, imageram)
476476   AM_RANGE(0x2000, 0x209f) AM_RAM_WRITE(exidy440_spriteram_w) AM_BASE_GENERIC(spriteram)
477477   AM_RANGE(0x20a0, 0x29ff) AM_RAM
478478   AM_RANGE(0x2a00, 0x2aff) AM_READWRITE(exidy440_videoram_r, exidy440_videoram_w)
479479   AM_RANGE(0x2b00, 0x2b00) AM_READ(exidy440_vertical_pos_r)
480480   AM_RANGE(0x2b01, 0x2b01) AM_READWRITE(exidy440_horizontal_pos_r, exidy440_interrupt_clear_w)
481   AM_RANGE(0x2b02, 0x2b02) AM_RAM AM_BASE(&exidy440_scanline)
481   AM_RANGE(0x2b02, 0x2b02) AM_RAM AM_BASE_MEMBER(exidy440_state, scanline)
482482   AM_RANGE(0x2b03, 0x2b03) AM_READ_PORT("IN0") AM_WRITE(exidy440_control_w)
483483   AM_RANGE(0x2c00, 0x2dff) AM_READWRITE(exidy440_paletteram_r, exidy440_paletteram_w)
484484   AM_RANGE(0x2e00, 0x2e1f) AM_RAM_WRITE(sound_command_w)
r10613r10614
10011001 *
10021002 *************************************/
10031003
1004static MACHINE_CONFIG_START( exidy440, driver_device )
1004static MACHINE_CONFIG_START( exidy440, exidy440_state )
10051005
10061006   /* basic machine hardware */
10071007   MCFG_CPU_ADD("maincpu", M6809, MAIN_CPU_CLOCK)
r10613r10614
19331933
19341934static DRIVER_INIT( exidy440 )
19351935{
1936   showdown_bank_data[0] = showdown_bank_data[1] = NULL;
1936   exidy440_state *state = machine->driver_data<exidy440_state>();
1937   state->showdown_bank_data[0] = state->showdown_bank_data[1] = NULL;
19371938}
19381939
19391940
r10613r10614
19471948
19481949static DRIVER_INIT( topsecex )
19491950{
1951   exidy440_state *state = machine->driver_data<exidy440_state>();
19501952   DRIVER_INIT_CALL(exidy440);
19511953
19521954   /* extra input ports and scrolling */
r10613r10614
19541956   memory_install_read_port(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x2ec6, 0x2ec6, 0, 0, "AN0");
19551957   memory_install_read_port(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x2ec7, 0x2ec7, 0, 0, "IN4");
19561958
1957   topsecex_yscroll = memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x2ec1, 0x2ec1, 0, 0, topsecex_yscroll_w);
1959   state->topsecex_yscroll = memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x2ec1, 0x2ec1, 0, 0, topsecex_yscroll_w);
19581960}
19591961
19601962
19611963static DRIVER_INIT( showdown )
19621964{
1965   exidy440_state *state = machine->driver_data<exidy440_state>();
19631966   static const UINT8 bankdata0[0x18] =
19641967   {
19651968      0x15,0x40,0xc1,0x8d,0x4c,0x84,0x0e,0xce,
r10613r10614
19761979   DRIVER_INIT_CALL(exidy440);
19771980
19781981   /* set up the fake PLD */
1979   showdown_bank_data[0] = bankdata0;
1980   showdown_bank_data[1] = bankdata1;
1982   state->showdown_bank_data[0] = bankdata0;
1983   state->showdown_bank_data[1] = bankdata1;
19811984}
19821985
19831986
19841987static DRIVER_INIT( yukon )
19851988{
1989   exidy440_state *state = machine->driver_data<exidy440_state>();
19861990   static const UINT8 bankdata0[0x18] =
19871991   {
19881992      0x31,0x40,0xc1,0x95,0x54,0x90,0x16,0xd6,
r10613r10614
19992003   DRIVER_INIT_CALL(exidy440);
20002004
20012005   /* set up the fake PLD */
2002   showdown_bank_data[0] = bankdata0;
2003   showdown_bank_data[1] = bankdata1;
2006   state->showdown_bank_data[0] = bankdata0;
2007   state->showdown_bank_data[1] = bankdata1;
20042008}
20052009
20062010
src/mame/drivers/mastboy.c
r10613r10614
439439#include "sound/msm5205.h"
440440#include "machine/nvram.h"
441441
442/* RAM areas */
443static UINT8* mastboy_tileram;
444static UINT8* mastboy_vram;
445static UINT8* mastboy_colram;
446static UINT8* mastboy_workram;
447442
448/* Bank Control */
449static UINT8 mastboy_bank;
450
451/* General */
452static int mastboy_irq0_ack;
453static int mastboy_backupram_enabled;
454
455/* MSM5205 */
456static int mastboy_m5205_next;
457static int mastboy_m5205_part;
458static int mastboy_m5205_sambit0, mastboy_m5205_sambit1;
459
460443class mastboy_state : public driver_device
461444{
462445public:
r10613r10614
465448        m_nvram(*this, "nvram") { }
466449
467450   required_shared_ptr<UINT8>   m_nvram;
451   UINT8* tileram;
452   UINT8* vram;
453   UINT8* colram;
454   UINT8* workram;
455   UINT8 bank;
456   int irq0_ack;
457   int backupram_enabled;
458   int m5205_next;
459   int m5205_part;
460   int m5205_sambit0;
461   int m5205_sambit1;
468462};
469463
470464
r10613r10614
472466
473467static VIDEO_START(mastboy)
474468{
475   gfx_element_set_source(machine->gfx[0], mastboy_vram);
469   mastboy_state *state = machine->driver_data<mastboy_state>();
470   gfx_element_set_source(machine->gfx[0], state->vram);
476471}
477472
478473static SCREEN_UPDATE(mastboy)
479474{
475   mastboy_state *state = screen->machine->driver_data<mastboy_state>();
480476   int y,x,i;
481477   int count = 0x000;
482478
483479   for (i=0;i<0x200;i+=2)
484480   {
485      int coldat = mastboy_colram[i+1] |  (mastboy_colram[i+0]<<8);
481      int coldat = state->colram[i+1] |  (state->colram[i+0]<<8);
486482
487483      palette_set_color_rgb(screen->machine,i/2,pal4bit(coldat>>8),pal4bit(coldat>>12),pal4bit(coldat>>4));
488484   }
r10613r10614
492488      for (x=0;x<32;x++)
493489      {
494490         /* bytes 0 and 3 seem to be unused for rendering , they appear to contain data the game uses internally */
495         int tileno = (mastboy_tileram[count+1]|(mastboy_tileram[count+2]<<8))&0xfff;
496         int attr = (mastboy_tileram[count+2]&0xf0)>>4;
491         int tileno = (state->tileram[count+1]|(state->tileram[count+2]<<8))&0xfff;
492         int attr = (state->tileram[count+2]&0xf0)>>4;
497493         gfx_element *gfx;
498494
499495         if (tileno&0x800)
r10613r10614
523519
524520static READ8_HANDLER(banked_ram_r)
525521{
526   if ((mastboy_bank&0x80) == 0x00)
522   mastboy_state *state = space->machine->driver_data<mastboy_state>();
523   if ((state->bank&0x80) == 0x00)
527524   {
528525      int bank;
529      bank = mastboy_bank & 0x07;
530      //if (mastboy_bank&0xf8) printf("invalid bank bits in vram/vrom read\n");
526      bank = state->bank & 0x07;
527      //if (state->bank&0xf8) printf("invalid bank bits in vram/vrom read\n");
531528
532529      if (bank>0x3) // ROM access
533530      {
r10613r10614
539536      {
540537         bank &=0x3;
541538         /* we have to invert the data for the GFX decode */
542         return mastboy_vram[offset+(bank*0x4000)]^0xff;
539         return state->vram[offset+(bank*0x4000)]^0xff;
543540      }
544541   }
545542   else
546543   {
547544      UINT8 *src;
548545      int bank;
549      bank = mastboy_bank & 0x7f;
546      bank = state->bank & 0x7f;
550547      src = space->machine->region       ( "user1" )->base() + bank * 0x4000;
551548      return src[offset];
552549   }
r10613r10614
554551
555552static WRITE8_HANDLER( banked_ram_w )
556553{
557   if ((mastboy_bank&0x80) == 0x00)
554   mastboy_state *state = space->machine->driver_data<mastboy_state>();
555   if ((state->bank&0x80) == 0x00)
558556   {
559557      int bank;
560      bank = mastboy_bank & 0x07;
558      bank = state->bank & 0x07;
561559      //if (data&0xf8) printf("invalid bank bits in vram/vrom write\n");
562560
563561      if (bank>0x3) // ROM access
r10613r10614
573571         offs = offset+(bank*0x4000);
574572
575573         /* we have to invert the data for the GFX decode */
576         mastboy_vram[offs] = data^0xff;
574         state->vram[offs] = data^0xff;
577575
578576         /* Decode the new tile */
579577         gfx_element_mark_dirty(space->machine->gfx[0], offs/32);
r10613r10614
587585
588586static WRITE8_HANDLER( mastboy_bank_w )
589587{
588   mastboy_state *state = space->machine->driver_data<mastboy_state>();
590589   // controls access to banked ram / rom
591   mastboy_bank = data;
590   state->bank = data;
592591}
593592
594593/* Backup RAM access */
r10613r10614
602601static WRITE8_HANDLER( mastboy_backupram_w )
603602{
604603   mastboy_state *state = space->machine->driver_data<mastboy_state>();
605//  if (mastboy_backupram_enabled)
604//  if (state->backupram_enabled)
606605//  {
607606      state->m_nvram[offset] = data;
608607//  }
r10613r10614
614613
615614static WRITE8_HANDLER( backupram_enable_w )
616615{
616   mastboy_state *state = space->machine->driver_data<mastboy_state>();
617617   /* This is some kind of enable / disable control for backup ram (see Charles's notes) but I'm not
618618       sure how it works in practice, if we use it then it writes a lot of data with it disabled */
619   mastboy_backupram_enabled = data&1;
619   state->backupram_enabled = data&1;
620620}
621621
622622/* MSM5205 Related */
623623
624624static WRITE8_HANDLER( msm5205_mastboy_m5205_sambit0_w )
625625{
626   mastboy_state *state = space->machine->driver_data<mastboy_state>();
626627   device_t *adpcm = space->machine->device("msm");
627628
628   mastboy_m5205_sambit0 = data & 1;
629   msm5205_playmode_w(adpcm,  (1 << 2) | (mastboy_m5205_sambit1 << 1) | (mastboy_m5205_sambit0) );
629   state->m5205_sambit0 = data & 1;
630   msm5205_playmode_w(adpcm,  (1 << 2) | (state->m5205_sambit1 << 1) | (state->m5205_sambit0) );
630631
631632   logerror("msm5205 samplerate bit 0, set to %02x\n",data);
632633}
633634
634635static WRITE8_HANDLER( msm5205_mastboy_m5205_sambit1_w )
635636{
637   mastboy_state *state = space->machine->driver_data<mastboy_state>();
636638   device_t *adpcm = space->machine->device("msm");
637639
638   mastboy_m5205_sambit1 = data & 1;
640   state->m5205_sambit1 = data & 1;
639641
640   msm5205_playmode_w(adpcm,  (1 << 2) | (mastboy_m5205_sambit1 << 1) | (mastboy_m5205_sambit0) );
642   msm5205_playmode_w(adpcm,  (1 << 2) | (state->m5205_sambit1 << 1) | (state->m5205_sambit0) );
641643
642644   logerror("msm5205 samplerate bit 0, set to %02x\n",data);
643645}
644646
645647static WRITE8_DEVICE_HANDLER( mastboy_msm5205_reset_w )
646648{
647   mastboy_m5205_part = 0;
649   mastboy_state *state = device->machine->driver_data<mastboy_state>();
650   state->m5205_part = 0;
648651   msm5205_reset_w(device,data&1);
649652}
650653
651654static WRITE8_HANDLER( mastboy_msm5205_data_w )
652655{
653   mastboy_m5205_next = data;
656   mastboy_state *state = space->machine->driver_data<mastboy_state>();
657   state->m5205_next = data;
654658}
655659
656660static void mastboy_adpcm_int(device_t *device)
657661{
658   msm5205_data_w(device, mastboy_m5205_next);
659   mastboy_m5205_next >>= 4;
662   mastboy_state *state = device->machine->driver_data<mastboy_state>();
663   msm5205_data_w(device, state->m5205_next);
664   state->m5205_next >>= 4;
660665
661   mastboy_m5205_part ^= 1;
662   if(!mastboy_m5205_part)
666   state->m5205_part ^= 1;
667   if(!state->m5205_part)
663668      cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
664669}
665670
r10613r10614
674679
675680static WRITE8_HANDLER( mastboy_irq0_ack_w )
676681{
677   mastboy_irq0_ack = data;
682   mastboy_state *state = space->machine->driver_data<mastboy_state>();
683   state->irq0_ack = data;
678684   if ((data & 1) == 1)
679685      cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
680686}
681687
682688static INTERRUPT_GEN( mastboy_interrupt )
683689{
684   if ((mastboy_irq0_ack & 1) == 1)
690   mastboy_state *state = device->machine->driver_data<mastboy_state>();
691   if ((state->irq0_ack & 1) == 1)
685692   {
686693      cpu_set_input_line(device, 0, ASSERT_LINE);
687694   }
r10613r10614
693700   AM_RANGE(0x0000, 0x3fff) AM_ROM // Internal ROM
694701   AM_RANGE(0x4000, 0x7fff) AM_ROM // External ROM
695702
696   AM_RANGE(0x8000, 0x8fff) AM_RAM AM_BASE(&mastboy_workram)// work ram
697   AM_RANGE(0x9000, 0x9fff) AM_RAM AM_BASE(&mastboy_tileram)// tilemap ram
698   AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_BASE(&mastboy_colram) AM_MIRROR(0x0e00)  // colour ram
703   AM_RANGE(0x8000, 0x8fff) AM_RAM AM_BASE_MEMBER(mastboy_state, workram)// work ram
704   AM_RANGE(0x9000, 0x9fff) AM_RAM AM_BASE_MEMBER(mastboy_state, tileram)// tilemap ram
705   AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_BASE_MEMBER(mastboy_state, colram) AM_MIRROR(0x0e00)  // colour ram
699706
700707   AM_RANGE(0xc000, 0xffff) AM_READWRITE(banked_ram_r,banked_ram_w) // mastboy bank area read / write
701708
r10613r10614
856863
857864static MACHINE_RESET( mastboy )
858865{
866   mastboy_state *state = machine->driver_data<mastboy_state>();
859867   /* clear some ram */
860   memset( mastboy_workram,   0x00, 0x01000);
861   memset( mastboy_tileram,   0x00, 0x01000);
862   memset( mastboy_colram,    0x00, 0x00200);
863   memset( mastboy_vram, 0x00, 0x10000);
868   memset( state->workram,   0x00, 0x01000);
869   memset( state->tileram,   0x00, 0x01000);
870   memset( state->colram,    0x00, 0x00200);
871   memset( state->vram, 0x00, 0x10000);
864872
865   mastboy_m5205_part = 0;
873   state->m5205_part = 0;
866874   msm5205_reset_w(machine->device("msm"),1);
867   mastboy_irq0_ack = 0;
875   state->irq0_ack = 0;
868876}
869877
870878
r10613r10614
984992
985993static DRIVER_INIT( mastboy )
986994{
987   mastboy_vram = machine->region( "gfx1" )->base(); // makes decoding the RAM based tiles easier this way
995   mastboy_state *state = machine->driver_data<mastboy_state>();
996   state->vram = machine->region( "gfx1" )->base(); // makes decoding the RAM based tiles easier this way
988997}
989998
990999GAME( 1991, mastboy,  0,          mastboy, mastboy, mastboy, ROT0, "Gaelco", "Master Boy (Spanish, PCB Rev A)", 0 )
src/mame/drivers/fantland.c
r10613r10614
674674   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
675675   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
676676
677//   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
677//  PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
678678
679679   PORT_START( "Controls" )   /* IN7 - 53003 */
680680   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Controls ) )      PORT_DIPLOCATION("DSW2:1,2")
681//   PORT_DIPSETTING(    0x01, "Lightgun" )
681//  PORT_DIPSETTING(    0x01, "Lightgun" )
682682   PORT_DIPSETTING(    0x03, "Lightgun" )
683683   PORT_DIPSETTING(    0x00, DEF_STR( Trackball ) )
684684   PORT_DIPSETTING(    0x02, DEF_STR( Joystick ) )
685685   PORT_DIPNAME( 0x04, 0x04, "Sound Test" )      PORT_DIPLOCATION("DSW2:3")
686686   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
687687   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
688   PORT_DIPNAME( 0x08, 0x08, "Free Bullets" )      PORT_DIPLOCATION("DSW2:4")   
688   PORT_DIPNAME( 0x08, 0x08, "Free Bullets" )      PORT_DIPLOCATION("DSW2:4")
689689   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
690690   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
691691   PORT_DIPUNUSED_DIPLOC( 0x10, 0x0010, "DSW2:5" )
src/mame/drivers/cd32.c
r10613r10614
1/*
2   Commodore Amiga CD-32 and related hardware
3   (Cubo CD32 for arcades)
1/*
2    Commodore Amiga CD-32 and related hardware
3    (Cubo CD32 for arcades)
44
55   Driver by Mariusz Wojcieszek
66   CD-ROM controller by Ernesto Corvi
r10613r10614
854854/*
855855
856856   Cubo CD32 (additional hardware and games by CD Express, Milan, Italy)
857   
857
858858   The CuboCD32 is a stock retail CD32 unit with additional hardware to adapt it
859859   for JAMMA use
860860
src/mame/drivers/m90.c
r10613r10614
3535#include "sound/2151intf.h"
3636#include "includes/m90.h"
3737
38static UINT32 bankaddress;
3938
4039/***************************************************************************/
4140
4241static void set_m90_bank(running_machine *machine)
4342{
43   m90_state *state = machine->driver_data<m90_state>();
4444   UINT8 *rom = machine->region("user1")->base();
4545
4646   if (!rom)
4747      popmessage("bankswitch with no banked ROM!");
4848   else
49      memory_set_bankptr(machine, "bank1",rom + bankaddress);
49      memory_set_bankptr(machine, "bank1",rom + state->bankaddress);
5050}
5151
5252/***************************************************************************/
r10613r10614
6464
6565static WRITE16_HANDLER( quizf1_bankswitch_w )
6666{
67   m90_state *state = space->machine->driver_data<m90_state>();
6768   if (ACCESSING_BITS_0_7)
6869   {
69      bankaddress = 0x10000 * (data & 0x0f);
70      state->bankaddress = 0x10000 * (data & 0x0f);
7071      set_m90_bank(space->machine);
7172   }
7273}
r10613r10614
8485   AM_RANGE(0x00000, 0x7ffff) AM_ROM
8586   AM_RANGE(0x80000, 0x8ffff) AM_ROMBANK("bank1")   /* Quiz F1 only */
8687   AM_RANGE(0xa0000, 0xa3fff) AM_RAM
87   AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(&m90_video_data)
88   AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE_MEMBER(m90_state, video_data)
8889   AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
8990   AM_RANGE(0xffff0, 0xfffff) AM_ROM
9091ADDRESS_MAP_END
r10613r10614
9394   AM_RANGE(0x00000, 0x3ffff) AM_ROM
9495   AM_RANGE(0x6000e, 0x60fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
9596   AM_RANGE(0xa0000, 0xa3fff) AM_RAM
96   AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(&m90_video_data)
97   AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE_MEMBER(m90_state, video_data)
9798   AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
9899   AM_RANGE(0xffff0, 0xfffff) AM_ROM
99100ADDRESS_MAP_END
r10613r10614
102103   AM_RANGE(0x00000, 0x7ffff) AM_ROM
103104   AM_RANGE(0xa0000, 0xa3fff) AM_RAM
104105   AM_RANGE(0xc000e, 0xc0fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
105   AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE(&m90_video_data)
106   AM_RANGE(0xd0000, 0xdffff) AM_RAM_WRITE(m90_video_w) AM_BASE_MEMBER(m90_state, video_data)
106107   AM_RANGE(0xe0000, 0xe03ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
107108   AM_RANGE(0xffff0, 0xfffff) AM_ROM
108109ADDRESS_MAP_END
r10613r10614
695696
696697
697698/* Basic hardware -- no decryption table is setup for CPU */
698static MACHINE_CONFIG_START( m90, driver_device )
699static MACHINE_CONFIG_START( m90, m90_state )
699700   /* basic machine hardware */
700701   MCFG_CPU_ADD("maincpu", V35,XTAL_32MHz/2)
701702   MCFG_CPU_PROGRAM_MAP(m90_main_cpu_map)
r10613r10614
11441145
11451146static DRIVER_INIT( quizf1 )
11461147{
1147   bankaddress = 0;
1148   m90_state *state = machine->driver_data<m90_state>();
1149   state->bankaddress = 0;
11481150   set_m90_bank(machine);
11491151
1150   state_save_register_global(machine, bankaddress);
1152   state_save_register_global(machine, state->bankaddress);
11511153   machine->state().register_postload(quizf1_postload, NULL);
11521154}
11531155
src/mame/drivers/halleys.c
r10613r10614
204204#define CLIP_H              (VIS_MAXY - VIS_MINY + 1)
205205#define CLIP_BYTEW          (CLIP_W << 1)
206206
207static UINT16 *render_layer[MAX_LAYERS];
208static UINT8 sound_fifo[MAX_SOUNDS];
209static UINT8 *gfx_plane02, *gfx_plane13, *collision_list;
210static UINT8 *scrolly0, *scrollx0, *scrolly1, *scrollx1;
211static UINT32 *internal_palette, *alpha_table;
212207
213static UINT8 *cpu1_base, *gfx1_base, *blitter_ram, *io_ram;
214static size_t blitter_ramsize, io_ramsize;
208class halleys_state : public driver_device
209{
210public:
211   halleys_state(running_machine &machine, const driver_device_config_base &config)
212      : driver_device(machine, config) { }
215213
216static int game_id, blitter_busy, collision_count, stars_enabled, bgcolor, ffcount, ffhead, fftail;
217static int mVectorType, sndnmi_mask, firq_level;
218static emu_timer *blitter_reset_timer;
214   UINT16 *render_layer[MAX_LAYERS];
215   UINT8 sound_fifo[MAX_SOUNDS];
216   UINT8 *gfx_plane02;
217   UINT8 *gfx_plane13;
218   UINT8 *collision_list;
219   UINT8 *scrolly0;
220   UINT8 *scrollx0;
221   UINT8 *scrolly1;
222   UINT8 *scrollx1;
223   UINT32 *internal_palette;
224   UINT32 *alpha_table;
225   UINT8 *cpu1_base;
226   UINT8 *gfx1_base;
227   UINT8 *blitter_ram;
228   UINT8 *io_ram;
229   size_t blitter_ramsize;
230   size_t io_ramsize;
231   int game_id;
232   int blitter_busy;
233   int collision_count;
234   int stars_enabled;
235   int bgcolor;
236   int ffcount;
237   int ffhead;
238   int fftail;
239   int mVectorType;
240   int sndnmi_mask;
241   int firq_level;
242   emu_timer *blitter_reset_timer;
243   offs_t collision_detection;
244   int latch_delay;
245};
219246
220static offs_t halleys_collision_detection;
221247
222248
223249//**************************************************************************
224250// MB1551x Blitter Functions
225251
226static void blit(int offset)
252static void blit(halleys_state *state, int offset)
227253{
228254/*
229255    The render layers can be converted to standard MAME bitmaps but
r10613r10614
307333   UINT16 ax; UINT8 al, ah;      // partial regs
308334
309335
310   param = blitter_ram + offset;
336   param = state->blitter_ram + offset;
311337
312338
313339#if HALLEYS_DEBUG
r10613r10614
329355   // update sprite status
330356   layer = (code>>3 & 2) | (code>>7 & 1);
331357   offset >>= 4;
332   status = (stptr) ? cpu1_base[stptr] : ACTIVE;
358   status = (stptr) ? state->cpu1_base[stptr] : ACTIVE;
333359   flags = mode;
334360   group = mode & GROUP;
335361   command = code & COMMAND;
336   if (game_id == GAME_HALLEYS)
362   if (state->game_id == GAME_HALLEYS)
337363   {
338364      if (!layer) flags |= PPCD_ON;
339365      if (offset >= HALLEYS_SPLIT) flags |= AD_HIGH; else
r10613r10614
361387   src1 &= 0x3fff;
362388   src2 &= 0x3fff;
363389   bank = ((code & BANKBIT0) | (color & BANKBIT1)) << 8;
364   pal_ptr = internal_palette;
390   pal_ptr = state->internal_palette;
365391
366392
367393   // the crossroad of fate
r10613r10614
408434
409435
410436   // calculate entry points and loop constants
411   src1_ptr = gfx_plane02 + ((bank + src1)<<3) + eax;
412   src2_ptr = gfx_plane13 + ((bank + src2)<<3) + eax;
437   src1_ptr = state->gfx_plane02 + ((bank + src1)<<3) + eax;
438   src2_ptr = state->gfx_plane13 + ((bank + src2)<<3) + eax;
413439
414440   if (!(flags & (S1_IDLE | S2_IDLE)))
415441   {
r10613r10614
419445   }
420446   else src_dy = src_dx = 0;
421447
422   dst_ptr = render_layer[layer] + dst_skip;
448   dst_ptr = state->render_layer[layer] + dst_skip;
423449
424450
425451   // look up pen values and set rendering flags
r10613r10614
529555      // update collision list if object collided with the other group
530556      if (status & ACTIVE && ax & SP_COLLD)
531557      {
532         collision_list[collision_count & (MAX_SPRITES-1)] = offset;
533         collision_count++;
558         state->collision_list[state->collision_count & (MAX_SPRITES-1)] = offset;
559         state->collision_count++;
534560
535561         #if HALLEYS_DEBUG
536            popmessage("ID:%02x CC:%3d", offset, collision_count);
562            popmessage("ID:%02x CC:%3d", offset, state->collision_count);
537563         #endif
538564      }
539565
r10613r10614
678704   if (flags & S1_IDLE) src_dx = 0; else src_dx = 1;
679705   if (flags & S1_REV ) src_dx = -src_dx;
680706
681   src_base = gfx1_base + bank;
707   src_base = state->gfx1_base + bank;
682708
683709   if (command == STARPASS1 || command == STARPASS2) layer = (layer & 1) + 4;
684   dst_base = render_layer[layer];
710   dst_base = state->render_layer[layer];
685711
686712
687713//--------------------------------------------------------------------------
r10613r10614
705731      if (!command && y == 0xff && h == 1)
706732      {
707733         y = 0; h = SCREEN_HEIGHT;
708         dst_base = render_layer[(layer&1)+4];
734         dst_base = state->render_layer[(layer&1)+4];
709735         WARP_WIPE_COMMON
710736
711         stars_enabled = ~layer & 1;
737         state->stars_enabled = ~layer & 1;
712738      }
713739
714740      // wipe background and chain-wipe corresponding sprite layer when the command is zero
715741      else
716742      {
717743         WARP_WIPE_COMMON
718         if (!command) { dst_base = render_layer[layer&1]; WARP_WIPE_COMMON }
744         if (!command) { dst_base = state->render_layer[layer&1]; WARP_WIPE_COMMON }
719745      }
720746
721747   } else
r10613r10614
767793         }
768794      }
769795
770      stars_enabled = layer & 1;
796      state->stars_enabled = layer & 1;
771797
772798      #undef RORB
773799      #undef C2S
r10613r10614
835861      if (flags & IGNORE_0) { w=8; h=8; WARP_WIPE_COMMON }
836862
837863      src1_ptr = src_base + src1;
838      dst_ptr = render_layer[2] + (y << SCREEN_WIDTH_L2);
864      dst_ptr = state->render_layer[2] + (y << SCREEN_WIDTH_L2);
839865
840866      src1_ptr += 8;
841867      edx = -8;
r10613r10614
949975// draws Ben Bero Beh's color backdrop(verification required)
950976static WRITE8_HANDLER( bgtile_w )
951977{
978   halleys_state *state = space->machine->driver_data<halleys_state>();
952979   int yskip, xskip, ecx;
953980   UINT16 *edi;
954981   UINT16 ax;
955982
956   cpu1_base[0x1f00+offset] = data;
983   state->cpu1_base[0x1f00+offset] = data;
957984   offset -= 0x18;
958985
959986   if (offset >= 191) return;
r10613r10614
964991   yskip = yskip * 48 + 24;
965992   xskip = xskip * 5 + 2;
966993
967   edi = render_layer[2] + (yskip<<SCREEN_WIDTH_L2) + xskip + (48<<SCREEN_WIDTH_L2);
994   edi = state->render_layer[2] + (yskip<<SCREEN_WIDTH_L2) + xskip + (48<<SCREEN_WIDTH_L2);
968995   ecx = -(48<<SCREEN_WIDTH_L2);
969996   ax = (UINT16)data | BG_RGB;
970997
r10613r10614
9741001
9751002static READ8_HANDLER( blitter_status_r )
9761003{
977   if (game_id==GAME_HALLEYS && cpu_get_pc(space->cpu)==0x8017) return(0x55); // HACK: trick SRAM test on startup
1004   halleys_state *state = space->machine->driver_data<halleys_state>();
1005   if (state->game_id==GAME_HALLEYS && cpu_get_pc(space->cpu)==0x8017) return(0x55); // HACK: trick SRAM test on startup
9781006
9791007   return(0);
9801008}
r10613r10614
9821010
9831011static READ8_HANDLER( blitter_r )
9841012{
1013   halleys_state *state = space->machine->driver_data<halleys_state>();
9851014   int i = offset & 0xf;
9861015
9871016   if (i==0 || i==4) return(1);
9881017
989   return(blitter_ram[offset]);
1018   return(state->blitter_ram[offset]);
9901019}
9911020
9921021
9931022static TIMER_CALLBACK( blitter_reset )
9941023{
995   blitter_busy = 0;
1024   halleys_state *state = machine->driver_data<halleys_state>();
1025   state->blitter_busy = 0;
9961026}
9971027
9981028
9991029static WRITE8_HANDLER( blitter_w )
10001030{
1031   halleys_state *state = space->machine->driver_data<halleys_state>();
10011032   int i = offset & 0xf;
10021033
1003   blitter_ram[offset] = data;
1034   state->blitter_ram[offset] = data;
10041035
1005   if (i==0) blit(offset);
1036   if (i==0) blit(state, offset);
10061037
1007   if (game_id == GAME_BENBEROB)
1038   if (state->game_id == GAME_BENBEROB)
10081039   {
10091040      if (i==0 || (i==4 && !data))
10101041      {
1011         blitter_busy = 0;
1012         if (firq_level) cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE); // make up delayed FIRQ's
1042         state->blitter_busy = 0;
1043         if (state->firq_level) cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE); // make up delayed FIRQ's
10131044      }
10141045      else
10151046      {
1016         blitter_busy = 1;
1017         blitter_reset_timer->adjust(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(100)); // free blitter if no updates in 100 cycles
1047         state->blitter_busy = 1;
1048         state->blitter_reset_timer->adjust(downcast<cpu_device *>(space->cpu)->cycles_to_attotime(100)); // free blitter if no updates in 100 cycles
10181049      }
10191050   }
10201051}
r10613r10614
10221053
10231054static READ8_HANDLER( collision_id_r )
10241055{
1056   halleys_state *state = space->machine->driver_data<halleys_state>();
10251057/*
10261058    Collision detection abstract:
10271059
r10613r10614
10441076    UPDATE: re-implemented pixel collision to accompany the hack method.
10451077*/
10461078
1047   if (game_id==GAME_HALLEYS && cpu_get_pc(space->cpu)==halleys_collision_detection) // HACK: collision detection bypass
1079   if (state->game_id==GAME_HALLEYS && cpu_get_pc(space->cpu)==state->collision_detection) // HACK: collision detection bypass
10481080   {
1049      if (collision_count) { collision_count--; return(collision_list[collision_count]); }
1081      if (state->collision_count) { state->collision_count--; return(state->collision_list[state->collision_count]); }
10501082
10511083      return(0);
10521084   }
10531085
1054   return(io_ram[0x66]);
1086   return(state->io_ram[0x66]);
10551087}
10561088
10571089
r10613r10614
10601092
10611093static PALETTE_INIT( halleys )
10621094{
1095   halleys_state *state = machine->driver_data<halleys_state>();
10631096   UINT32 d, r, g, b, i, j, count;
1064   UINT32 *pal_ptr = internal_palette;
1097   UINT32 *pal_ptr = state->internal_palette;
10651098
10661099   for (count=0; count<1024; count++)
10671100   {
r10613r10614
11531186
11541187static WRITE8_HANDLER( halleys_paletteram_IIRRGGBB_w )
11551188{
1189   halleys_state *state = space->machine->driver_data<halleys_state>();
11561190   UINT32 d, r, g, b, i, j;
1157   UINT32 *pal_ptr = internal_palette;
1191   UINT32 *pal_ptr = state->internal_palette;
11581192
11591193   space->machine->generic.paletteram.u8[offset] = data;
11601194   d = (UINT32)data;
r10613r10614
11821216
11831217static VIDEO_START( halleys )
11841218{
1219   halleys_state *state = machine->driver_data<halleys_state>();
11851220#define HALLEYS_Y0  0x8e
11861221#define HALLEYS_X0  0x9a
11871222#define HALLEYS_Y1  0xa2
r10613r10614
11901225   int dst, src, c;
11911226
11921227   // create short cuts to scroll registers
1193   scrolly0 = io_ram + HALLEYS_Y0;
1194   scrollx0 = io_ram + HALLEYS_X0;
1195   scrolly1 = io_ram + HALLEYS_Y1;
1196   scrollx1 = io_ram + HALLEYS_X1;
1228   state->scrolly0 = state->io_ram + HALLEYS_Y0;
1229   state->scrollx0 = state->io_ram + HALLEYS_X0;
1230   state->scrolly1 = state->io_ram + HALLEYS_Y1;
1231   state->scrollx1 = state->io_ram + HALLEYS_X1;
11971232
11981233   // fill alpha table
11991234   for (src=0; src<256; src++)
r10613r10614
12041239      c += (((src&0x0c)+(dst&0x0c))>>1) & 0x0c;
12051240      c += (((src&0x03)+(dst&0x03))>>1) & 0x03;
12061241
1207      alpha_table[(src<<8)+dst] = c | BG_RGB;
1242      state->alpha_table[(src<<8)+dst] = c | BG_RGB;
12081243   }
12091244}
12101245
r10613r10614
13881423}
13891424
13901425
1391static void filter_bitmap(bitmap_t *bitmap, int mask)
1426static void filter_bitmap(running_machine *machine, bitmap_t *bitmap, int mask)
13921427{
1428   halleys_state *state = machine->driver_data<halleys_state>();
13931429   int dst_pitch;
13941430
13951431   UINT32 *pal_ptr, *edi;
13961432   int esi, eax, ebx, ecx, edx;
13971433
1398   pal_ptr = internal_palette;
1434   pal_ptr = state->internal_palette;
13991435   esi = mask | 0xffffff00;
14001436   edi = (UINT32*)BITMAP_ADDR16(bitmap, VIS_MINY, VIS_MINX + CLIP_W);
14011437   dst_pitch = bitmap->rowpixels >> 1;
r10613r10614
14301466
14311467static SCREEN_UPDATE( halleys )
14321468{
1469   halleys_state *state = screen->machine->driver_data<halleys_state>();
14331470   int i, j;
14341471
1435   if (stars_enabled)
1472   if (state->stars_enabled)
14361473   {
1437      copy_scroll_op(bitmap, render_layer[5], *scrollx0, *scrolly0);
1438      copy_scroll_xp(bitmap, render_layer[4], *scrollx1, *scrolly1);
1474      copy_scroll_op(bitmap, state->render_layer[5], *state->scrollx0, *state->scrolly0);
1475      copy_scroll_xp(bitmap, state->render_layer[4], *state->scrollx1, *state->scrolly1);
14391476   }
14401477   else
1441      bitmap_fill(bitmap, cliprect, bgcolor);
1478      bitmap_fill(bitmap, cliprect, state->bgcolor);
14421479
14431480#ifdef MAME_DEBUG
1444   if (input_port_read(screen->machine, "DEBUG")) copy_scroll_xp(bitmap, render_layer[3], *scrollx0, *scrolly0); // not used???
1481   if (input_port_read(screen->machine, "DEBUG")) copy_scroll_xp(bitmap, state->render_layer[3], *state->scrollx0, *state->scrolly0); // not used???
14451482#endif
14461483
1447   copy_scroll_xp(bitmap, render_layer[2], *scrollx1, *scrolly1);
1448   copy_fixed_2b (bitmap, render_layer[1]);
1449   copy_fixed_xp (bitmap, render_layer[0]);
1484   copy_scroll_xp(bitmap, state->render_layer[2], *state->scrollx1, *state->scrolly1);
1485   copy_fixed_2b (bitmap, state->render_layer[1]);
1486   copy_fixed_xp (bitmap, state->render_layer[0]);
14501487
14511488   // HALF-HACK: apply RGB filter when the following conditions are met
1452   i = io_ram[0xa0];
1453   j = io_ram[0xa1];
1454   if (io_ram[0x2b] && (i>0xc6 && i<0xfe) && (j==0xc0 || j==0xed)) filter_bitmap(bitmap, i);
1489   i = state->io_ram[0xa0];
1490   j = state->io_ram[0xa1];
1491   if (state->io_ram[0x2b] && (i>0xc6 && i<0xfe) && (j==0xc0 || j==0xed)) filter_bitmap(screen->machine, bitmap, i);
14551492   return 0;
14561493}
14571494
14581495
14591496static SCREEN_UPDATE( benberob )
14601497{
1461   if (io_ram[0xa0] & 0x80)
1462      copy_scroll_op(bitmap, render_layer[2], *scrollx1, *scrolly1);
1498   halleys_state *state = screen->machine->driver_data<halleys_state>();
1499   if (state->io_ram[0xa0] & 0x80)
1500      copy_scroll_op(bitmap, state->render_layer[2], *state->scrollx1, *state->scrolly1);
14631501   else
1464      bitmap_fill(bitmap, cliprect, bgcolor);
1502      bitmap_fill(bitmap, cliprect, state->bgcolor);
14651503
1466   copy_fixed_xp (bitmap, render_layer[1]);
1467   copy_fixed_xp (bitmap, render_layer[0]);
1504   copy_fixed_xp (bitmap, state->render_layer[1]);
1505   copy_fixed_xp (bitmap, state->render_layer[0]);
14681506   return 0;
14691507}
14701508
r10613r10614
14761514
14771515static READ8_HANDLER( zero_r ) { return(0); }
14781516
1479static READ8_HANDLER( debug_r ) { return(io_ram[offset]); }
1517static READ8_HANDLER( debug_r )
1518{
1519   halleys_state *state = space->machine->driver_data<halleys_state>();
1520   return(state->io_ram[offset]);
1521}
14801522
14811523#endif
14821524
r10613r10614
14861528
14871529static INTERRUPT_GEN( halleys_interrupt )
14881530{
1489   static int latch_delay = 0;
1531   halleys_state *state = device->machine->driver_data<halleys_state>();
14901532   UINT8 latch_data;
14911533
14921534   switch (cpu_getiloops(device))
r10613r10614
15051547
15061548                Current implementation is quite safe although not 100% foul-proof.
15071549            */
1508         if (latch_delay) latch_delay--; else
1509         if (ffcount)
1550         if (state->latch_delay) state->latch_delay--; else
1551         if (state->ffcount)
15101552         {
1511            ffcount--;
1512            latch_data = sound_fifo[fftail];
1513            fftail = (fftail + 1) & (MAX_SOUNDS - 1);
1514            latch_delay = (latch_data) ? 0 : 4;
1553            state->ffcount--;
1554            latch_data = state->sound_fifo[state->fftail];
1555            state->fftail = (state->fftail + 1) & (MAX_SOUNDS - 1);
1556            state->latch_delay = (latch_data) ? 0 : 4;
15151557            soundlatch_w( cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0, latch_data);
15161558            cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
15171559         }
15181560
15191561         // clear collision list of this frame unconditionally
1520         collision_count = 0;
1562         state->collision_count = 0;
15211563      break;
15221564
15231565      // In Halley's Comet, NMI is used exclusively to handle coin input
r10613r10614
15271569
15281570      // FIRQ drives gameplay; we need both types of NMI each frame.
15291571      case 2:
1530         mVectorType = 1; cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE);
1572         state->mVectorType = 1; cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE);
15311573      break;
15321574
15331575      case 3:
1534         mVectorType = 0; cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE);
1576         state->mVectorType = 0; cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE);
15351577      break;
15361578   }
15371579}
r10613r10614
15391581
15401582static INTERRUPT_GEN( benberob_interrupt )
15411583{
1542   static int latch_delay = 0;
1584   halleys_state *state = device->machine->driver_data<halleys_state>();
15431585   UINT8 latch_data;
15441586
15451587   switch (cpu_getiloops(device))
15461588   {
15471589      case 0:
1548         if (latch_delay) latch_delay--; else
1549         if (ffcount)
1590         if (state->latch_delay) state->latch_delay--; else
1591         if (state->ffcount)
15501592         {
1551            ffcount--;
1552            latch_data = sound_fifo[fftail];
1553            fftail = (fftail + 1) & (MAX_SOUNDS - 1);
1554            latch_delay = (latch_data) ? 0 : 4;
1593            state->ffcount--;
1594            latch_data = state->sound_fifo[state->fftail];
1595            state->fftail = (state->fftail + 1) & (MAX_SOUNDS - 1);
1596            state->latch_delay = (latch_data) ? 0 : 4;
15551597            soundlatch_w(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), 0, latch_data);
15561598            cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
15571599         }
r10613r10614
15641606      case 2:
15651607      case 3:
15661608         // FIRQ must not happen when the blitter is being updated or it'll cause serious screen artifacts
1567         if (!blitter_busy) cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE); else firq_level++;
1609         if (!state->blitter_busy) cpu_set_input_line(device, M6809_FIRQ_LINE, ASSERT_LINE); else state->firq_level++;
15681610      break;
15691611   }
15701612}
r10613r10614
15721614
15731615static READ8_HANDLER( vector_r )
15741616{
1575   return(cpu1_base[0xffe0 + (offset^(mVectorType<<4))]);
1617   halleys_state *state = space->machine->driver_data<halleys_state>();
1618   return(state->cpu1_base[0xffe0 + (offset^(state->mVectorType<<4))]);
15761619}
15771620
15781621
15791622static WRITE8_HANDLER( firq_ack_w )
15801623{
1581   io_ram[0x9c] = data;
1624   halleys_state *state = space->machine->driver_data<halleys_state>();
1625   state->io_ram[0x9c] = data;
15821626
1583   if (firq_level) firq_level--;
1627   if (state->firq_level) state->firq_level--;
15841628   cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, CLEAR_LINE);
15851629}
15861630
15871631
15881632static WRITE8_DEVICE_HANDLER( sndnmi_msk_w )
15891633{
1590   sndnmi_mask = data & 1;
1634   halleys_state *state = device->machine->driver_data<halleys_state>();
1635   state->sndnmi_mask = data & 1;
15911636}
15921637
15931638
15941639static WRITE8_HANDLER( soundcommand_w )
15951640{
1596   if (ffcount < MAX_SOUNDS)
1641   halleys_state *state = space->machine->driver_data<halleys_state>();
1642   if (state->ffcount < MAX_SOUNDS)
15971643   {
1598      ffcount++;
1599      sound_fifo[ffhead] = io_ram[0x8a] = data;
1600      ffhead = (ffhead + 1) & (MAX_SOUNDS - 1);
1644      state->ffcount++;
1645      state->sound_fifo[state->ffhead] = state->io_ram[0x8a] = data;
1646      state->ffhead = (state->ffhead + 1) & (MAX_SOUNDS - 1);
16011647   }
16021648}
16031649
r10613r10614
16311677// Memory Maps
16321678
16331679static ADDRESS_MAP_START( halleys_map, ADDRESS_SPACE_PROGRAM, 8 )
1634   AM_RANGE(0x0000, 0x0fff) AM_READWRITE(blitter_r, blitter_w) AM_BASE(&blitter_ram) AM_SIZE(&blitter_ramsize)
1680   AM_RANGE(0x0000, 0x0fff) AM_READWRITE(blitter_r, blitter_w) AM_BASE_MEMBER(halleys_state, blitter_ram) AM_SIZE_MEMBER(halleys_state, blitter_ramsize)
16351681   AM_RANGE(0x1f00, 0x1fff) AM_WRITE(bgtile_w)      // background tiles?(Ben Bero Beh only)
16361682   AM_RANGE(0x1000, 0xefff) AM_ROM
16371683   AM_RANGE(0xf000, 0xfeff) AM_RAM               // work ram
r10613r10614
16491695   AM_RANGE(0xff96, 0xff96) AM_READ_PORT("DSW2")   // dipswitch 3
16501696   AM_RANGE(0xff97, 0xff97) AM_READ_PORT("DSW3")   // dipswitch 2
16511697   AM_RANGE(0xff9c, 0xff9c) AM_WRITE(firq_ack_w)
1652   AM_RANGE(0xff00, 0xffbf) AM_RAM AM_BASE(&io_ram) AM_SIZE(&io_ramsize)   // I/O write fall-through
1698   AM_RANGE(0xff00, 0xffbf) AM_RAM AM_BASE_MEMBER(halleys_state, io_ram) AM_SIZE_MEMBER(halleys_state, io_ramsize)   // I/O write fall-through
16531699
16541700   AM_RANGE(0xffc0, 0xffdf) AM_RAM_WRITE(halleys_paletteram_IIRRGGBB_w) AM_BASE_GENERIC(paletteram)
16551701   AM_RANGE(0xffe0, 0xffff) AM_READ(vector_r)
r10613r10614
19091955
19101956static MACHINE_RESET( halleys )
19111957{
1912   mVectorType     = 0;
1913   firq_level      = 0;
1914   blitter_busy    = 0;
1915   collision_count = 0;
1916   stars_enabled   = 0;
1917   bgcolor         = get_black_pen(machine);
1918   fftail = ffhead = ffcount = 0;
1958   halleys_state *state = machine->driver_data<halleys_state>();
1959   state->mVectorType     = 0;
1960   state->firq_level      = 0;
1961   state->blitter_busy    = 0;
1962   state->collision_count = 0;
1963   state->stars_enabled   = 0;
1964   state->bgcolor         = get_black_pen(machine);
1965   state->fftail = state->ffhead = state->ffcount = 0;
19191966
1920   memset(io_ram, 0xff, io_ramsize);
1921   memset(render_layer[0], 0, SCREEN_BYTESIZE * MAX_LAYERS);
1967   memset(state->io_ram, 0xff, state->io_ramsize);
1968   memset(state->render_layer[0], 0, SCREEN_BYTESIZE * MAX_LAYERS);
19221969}
19231970
19241971
r10613r10614
19331980};
19341981
19351982
1936static MACHINE_CONFIG_START( halleys, driver_device )
1983static MACHINE_CONFIG_START( halleys, halleys_state )
19371984   MCFG_CPU_ADD("maincpu", M6809, XTAL_19_968MHz/12) /* verified on pcb */
19381985   MCFG_CPU_PROGRAM_MAP(halleys_map)
19391986   MCFG_CPU_VBLANK_INT_HACK(halleys_interrupt, 4)
r10613r10614
19812028   MCFG_CPU_MODIFY("maincpu")
19822029   MCFG_CPU_CLOCK(XTAL_19_968MHz/12) /* not verified but pcb identical to halley's comet */
19832030   MCFG_CPU_VBLANK_INT_HACK(benberob_interrupt, 4)
1984   
2031
19852032   MCFG_SCREEN_MODIFY("screen")
19862033   MCFG_SCREEN_UPDATE(benberob)
19872034MACHINE_CONFIG_END
r10613r10614
21332180
21342181static void init_common(running_machine *machine)
21352182{
2183   halleys_state *state = machine->driver_data<halleys_state>();
21362184   UINT8 *buf, *rom;
21372185   int addr, i;
21382186   UINT8 al, ah, dl, dh;
r10613r10614
21402188
21412189   // allocate memory for unpacked graphics
21422190   buf = auto_alloc_array(machine, UINT8, 0x100000);
2143   gfx_plane02 = buf;
2144   gfx_plane13 = buf + 0x80000;
2191   state->gfx_plane02 = buf;
2192   state->gfx_plane13 = buf + 0x80000;
21452193
21462194
21472195   // allocate memory for render layers
21482196   buf = auto_alloc_array(machine, UINT8, SCREEN_BYTESIZE * MAX_LAYERS);
2149   for (i=0; i<MAX_LAYERS; buf+=SCREEN_BYTESIZE, i++) render_layer[i] = (UINT16*)buf;
2197   for (i=0; i<MAX_LAYERS; buf+=SCREEN_BYTESIZE, i++) state->render_layer[i] = (UINT16*)buf;
21502198
21512199
21522200   // allocate memory for pre-processed ROMs
2153   gfx1_base = auto_alloc_array(machine, UINT8, 0x20000);
2201   state->gfx1_base = auto_alloc_array(machine, UINT8, 0x20000);
21542202
21552203
21562204   // allocate memory for alpha table
2157   alpha_table = auto_alloc_array(machine, UINT32, 0x10000);
2205   state->alpha_table = auto_alloc_array(machine, UINT32, 0x10000);
21582206
21592207
21602208   // allocate memory for internal palette
2161   internal_palette = auto_alloc_array(machine, UINT32, PALETTE_SIZE);
2209   state->internal_palette = auto_alloc_array(machine, UINT32, PALETTE_SIZE);
21622210
21632211
21642212   // allocate memory for hardware collision list
2165   collision_list = auto_alloc_array(machine, UINT8, MAX_SPRITES);
2213   state->collision_list = auto_alloc_array(machine, UINT8, MAX_SPRITES);
21662214
21672215
21682216   // decrypt main program ROM
2169   rom = cpu1_base = machine->region("maincpu")->base();
2170   buf = gfx1_base;
2217   rom = state->cpu1_base = machine->region("maincpu")->base();
2218   buf = state->gfx1_base;
21712219
21722220   for (i=0; i<0x10000; i++)
21732221   {
r10613r10614
21802228
21812229   // swap graphics ROM addresses and unpack each pixel
21822230   rom = machine->region("gfx1")->base();
2183   buf = gfx_plane02;
2231   buf = state->gfx_plane02;
21842232
21852233   for (i=0xffff; i>=0; i--)
21862234   {
21872235      al = rom[i];
21882236      ah = rom[i+0x10000];
2189      gfx1_base[0xffff-i] = al;
2190      gfx1_base[0x1ffff-i] = ah;
2237      state->gfx1_base[0xffff-i] = al;
2238      state->gfx1_base[0x1ffff-i] = ah;
21912239
21922240      buf[0] = dl = (al    & 1) | (ah<<2 & 4);  dl <<= 1;
21932241      buf[1] = dh = (al>>1 & 1) | (ah<<1 & 4);  dh <<= 1;
r10613r10614
22132261
22142262static DRIVER_INIT( benberob )
22152263{
2216   game_id = GAME_BENBEROB;
2264   halleys_state *state = machine->driver_data<halleys_state>();
2265   state->game_id = GAME_BENBEROB;
22172266
22182267   init_common(machine);
22192268
2220   blitter_reset_timer = machine->scheduler().timer_alloc(FUNC(blitter_reset));
2269   state->blitter_reset_timer = machine->scheduler().timer_alloc(FUNC(blitter_reset));
22212270}
22222271
22232272
22242273static DRIVER_INIT( halleys )
22252274{
2226   game_id = GAME_HALLEYS;
2227   halleys_collision_detection = 0xb114;
2275   halleys_state *state = machine->driver_data<halleys_state>();
2276   state->game_id = GAME_HALLEYS;
2277   state->collision_detection = 0xb114;
22282278
22292279   init_common(machine);
22302280}
22312281
22322282static DRIVER_INIT( halley87 )
22332283{
2234   game_id = GAME_HALLEYS;
2235   halleys_collision_detection = 0xb10d;
2284   halleys_state *state = machine->driver_data<halleys_state>();
2285   state->game_id = GAME_HALLEYS;
2286   state->collision_detection = 0xb10d;
22362287
22372288   init_common(machine);
22382289}
src/mame/drivers/taito_f2.c
r10613r10614
38613861
38623862   /* video hardware */
38633863   MCFG_VIDEO_START(taitof2_qzchikyu)
3864   MCFG_SCREEN_MODIFY("screen")   
3864   MCFG_SCREEN_MODIFY("screen")
38653865   MCFG_SCREEN_EOF(taitof2_partial_buffer_delayed_qzchikyu)
38663866
38673867   MCFG_TC0100SCN_ADD("tc0100scn", qzchikyu_tc0100scn_intf)
src/mame/drivers/gottlieb.c
r10613r10614
438438   gottlieb_state *state = machine->driver_data<gottlieb_state>();
439439   int newcode = laserdisc_get_field_code(state->laserdisc, (param == 17) ? LASERDISC_CODE_LINE17 : LASERDISC_CODE_LINE18, TRUE);
440440
441   /* the PR8210 sends line 17/18 data on each frame; the state->laserdisc interface
441   /* the PR8210 sends line 17/18 data on each frame; the laserdisc interface
442442       board receives notification and latches the most recent frame number */
443443
444444   /* the logic detects a valid code when the top 4 bits are all 1s */
src/mame/drivers/goldnpkr.c
r10613r10614
6363    * Royale (set 1).                           198?, Unknown.
6464    * Royale (set 2).                           198?, Unknown.
6565    * Maverik.                                  198?, Unknown.
66    * Brasil'89.                                1989, Unknown.
66    * Brasil 86.                                1986, Unknown.
67    * Brasil 87.                                1987, Unknown.
68    * Brasil 89 (set 1).                        1989, Unknown.
69    * Brasil 89 (set 2).                        1989, Unknown.
70    * Brasil 93.                                1993, Unknown.
6771    * Poker 91.                                 1991, Unknown.
6872    * Genie.                                    198?, Video Fun Games Ltd.
6973    * Silver Game.                              1983, Unknown.
r10613r10614
42154219   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
42164220ROM_END
42174221
4222/*****************************
4223
4224  Brasil XX sets...
4225
4226 ****************************/
4227ROM_START( brasil86 )
4228   ROM_REGION( 0x10000, "maincpu", 0 )   /* brasil86.128: Brasil 86, BS clone. */
4229   ROM_LOAD( "brasil86.128",   0x4000, 0x4000, CRC(0e88b434) SHA1(80f921c277f4253c29ee80e9cfb046ade1f66300) )
4230
4231   ROM_REGION( 0x3000, "gfx1", 0 )
4232   ROM_FILL(         0x0000, 0x2000, 0 ) /* filling the R-G bitplanes */
4233   ROM_LOAD( "4s.bin",   0x2000, 0x1000, CRC(0ac197eb) SHA1(fdf2b134c662f3c4d4a19d93a82d130ba643ace8) )    /* text layer */
4234
4235   ROM_REGION( 0x3000, "gfx2", 0 )
4236   ROM_LOAD( "7.bin",   0x0000, 0x1000, CRC(28ecfaea) SHA1(19d73ed0fdb5a873447b46e250ad6e71abe257cd) )    /* cards deck gfx, bitplane1 */
4237   ROM_LOAD( "6.bin",   0x1000, 0x1000, CRC(eeec8862) SHA1(ae03aba1bd43c3ffd140f76770fc1c8cf89ea115) )    /* cards deck gfx, bitplane2 */
4238   ROM_LOAD( "5.bin",   0x2000, 0x1000, CRC(2712f297) SHA1(d3cc1469d07c3febbbe4a645cd6bdb57e09cf504) )    /* cards deck gfx, bitplane3 */
4239
4240   ROM_REGION( 0x0100, "proms", 0 )
4241   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
4242ROM_END
4243
4244ROM_START( brasil87 )
4245   ROM_REGION( 0x10000, "maincpu", 0 )   /* brasil87.128: Brasil 87, BS clone. */
4246   ROM_LOAD( "brasil87.128",   0x4000, 0x4000, CRC(6cfdaea9) SHA1(0704e61c1c573e99e130c22787b529ac5544c631) )
4247
4248   ROM_REGION( 0x3000, "gfx1", 0 )
4249   ROM_FILL(         0x0000, 0x2000, 0 ) /* filling the R-G bitplanes */
4250   ROM_LOAD( "4s.bin",   0x2000, 0x1000, CRC(0ac197eb) SHA1(fdf2b134c662f3c4d4a19d93a82d130ba643ace8) )    /* text layer */
4251
4252   ROM_REGION( 0x3000, "gfx2", 0 )
4253   ROM_LOAD( "7.bin",   0x0000, 0x1000, CRC(28ecfaea) SHA1(19d73ed0fdb5a873447b46e250ad6e71abe257cd) )    /* cards deck gfx, bitplane1 */
4254   ROM_LOAD( "6.bin",   0x1000, 0x1000, CRC(eeec8862) SHA1(ae03aba1bd43c3ffd140f76770fc1c8cf89ea115) )    /* cards deck gfx, bitplane2 */
4255   ROM_LOAD( "5.bin",   0x2000, 0x1000, CRC(2712f297) SHA1(d3cc1469d07c3febbbe4a645cd6bdb57e09cf504) )    /* cards deck gfx, bitplane3 */
4256
4257   ROM_REGION( 0x0100, "proms", 0 )
4258   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
4259ROM_END
4260
42184261ROM_START( brasil89 )
42194262   ROM_REGION( 0x10000, "maincpu", 0 )   /* brasil89.128: Brasil 89, BS clone. */
42204263   ROM_LOAD( "brasil89.128",   0x4000, 0x4000, CRC(9030e0db) SHA1(d073ed0ddd3e5df6a3387e10e05ca34bc491eb35) )
r10613r10614
42324275   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
42334276ROM_END
42344277
4278ROM_START( brasil89a )
4279   ROM_REGION( 0x10000, "maincpu", 0 )   /* brasil89a.128: Brasil 89a, BS clone. */
4280   ROM_LOAD( "brasil89a.128",   0x4000, 0x4000, CRC(41a93a99) SHA1(70eeaddbdd9d3a587d1330b81d21d881ab0a8c91) )
4281
4282   ROM_REGION( 0x3000, "gfx1", 0 )
4283   ROM_FILL(         0x0000, 0x2000, 0 ) /* filling the R-G bitplanes */
4284   ROM_LOAD( "4s.bin",   0x2000, 0x1000, CRC(0ac197eb) SHA1(fdf2b134c662f3c4d4a19d93a82d130ba643ace8) )    /* text layer */
4285
4286   ROM_REGION( 0x3000, "gfx2", 0 )
4287   ROM_LOAD( "7.bin",   0x0000, 0x1000, CRC(28ecfaea) SHA1(19d73ed0fdb5a873447b46e250ad6e71abe257cd) )    /* cards deck gfx, bitplane1 */
4288   ROM_LOAD( "6.bin",   0x1000, 0x1000, CRC(eeec8862) SHA1(ae03aba1bd43c3ffd140f76770fc1c8cf89ea115) )    /* cards deck gfx, bitplane2 */
4289   ROM_LOAD( "5.bin",   0x2000, 0x1000, CRC(2712f297) SHA1(d3cc1469d07c3febbbe4a645cd6bdb57e09cf504) )    /* cards deck gfx, bitplane3 */
4290
4291   ROM_REGION( 0x0100, "proms", 0 )
4292   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
4293ROM_END
4294
4295ROM_START( brasil93 )
4296   ROM_REGION( 0x10000, "maincpu", 0 )   /* brasil93.128: Brasil 93, BS clone. No lights */
4297   ROM_LOAD( "brasil93.128",   0x4000, 0x4000, CRC(cc25909f) SHA1(635184022bcb8936c396cb9fcfa6367fcae906fb) )
4298
4299   ROM_REGION( 0x3000, "gfx1", 0 )
4300   ROM_FILL(         0x0000, 0x2000, 0 ) /* filling the R-G bitplanes */
4301   ROM_LOAD( "4s.bin",   0x2000, 0x1000, CRC(0ac197eb) SHA1(fdf2b134c662f3c4d4a19d93a82d130ba643ace8) )    /* text layer */
4302
4303   ROM_REGION( 0x3000, "gfx2", 0 )
4304   ROM_LOAD( "7.bin",   0x0000, 0x1000, CRC(28ecfaea) SHA1(19d73ed0fdb5a873447b46e250ad6e71abe257cd) )    /* cards deck gfx, bitplane1 */
4305   ROM_LOAD( "6.bin",   0x1000, 0x1000, CRC(eeec8862) SHA1(ae03aba1bd43c3ffd140f76770fc1c8cf89ea115) )    /* cards deck gfx, bitplane2 */
4306   ROM_LOAD( "5.bin",   0x2000, 0x1000, CRC(2712f297) SHA1(d3cc1469d07c3febbbe4a645cd6bdb57e09cf504) )    /* cards deck gfx, bitplane3 */
4307
4308   ROM_REGION( 0x0100, "proms", 0 )
4309   ROM_LOAD( "82s129.9c",      0x0000, 0x0100, CRC(7f31066b) SHA1(15420780ec6b2870fc4539ec3afe4f0c58eedf12) ) /* PROM dump needed */
4310ROM_END
4311
42354312ROM_START( poker91 )
42364313   ROM_REGION( 0x10000, "maincpu", 0 )   /* bs_pok91.bin: Poker 91. Based on witchcrd */
42374314   ROM_LOAD( "bs_pok91.bin",   0x0000, 0x8000, CRC(90c88b45) SHA1(9b5842075ece5f96a6869d7a8c874dee2b2abde2) )
r10613r10614
47494826GAME(  1993, sloco93,  0,        witchcrd, sloco93,  0,        ROT0,   "<unknown>",                "Super Loco 93 (Spanish, set 1)",          0 )
47504827GAME(  1993, sloco93a, sloco93,  witchcrd, sloco93,  0,        ROT0,   "<unknown>",                "Super Loco 93 (Spanish, set 2)",          0 )
47514828GAME(  198?, maverik,  0,        witchcrd, bsuerte,  0,        ROT0,   "<unknown>",                "Maverik",                                 0 )
4752GAMEL( 1989, brasil89, 0,        witchcrd, bsuerte,  0,        ROT0,   "<unknown>",                "Brasil 89",                               0,                layout_goldnpkr )
4829GAMEL( 1986, brasil86, 0,        witchcrd, bsuerte,  0,        ROT0,   "<unknown>",                "Brasil 86",                               0,                layout_goldnpkr )
4830GAMEL( 1987, brasil87, 0,        witchcrd, bsuerte,  0,        ROT0,   "<unknown>",                "Brasil 87",                               0,                layout_goldnpkr )
4831GAMEL( 1989, brasil89, 0,        witchcrd, bsuerte,  0,        ROT0,   "<unknown>",                "Brasil 89 (set 1)",                       0,                layout_goldnpkr )
4832GAMEL( 1989, brasil89a,brasil89, witchcrd, bsuerte,  0,        ROT0,   "<unknown>",                "Brasil 89 (set 2)",                       0,                layout_goldnpkr )
4833GAME(  1993, brasil93, 0,        witchcrd, bsuerte,  0,        ROT0,   "<unknown>",                "Brasil 93",                               0 )            // no lamps
47534834GAME(  1991, poker91,  0,        witchcrd, poker91,  0,        ROT0,   "<unknown>",                "Poker 91",                                0 )
47544835GAME(  198?, genie,    0,        genie,    genie,    0,        ROT0,   "Video Fun Games Ltd.",     "Genie",                                   0 )
47554836
src/mame/drivers/hyhoo.c
r10613r10614
6363   AM_RANGE(0x90, 0x97) AM_WRITE(hyhoo_blitter_w)
6464   AM_RANGE(0xa0, 0xa0) AM_READWRITE(nb1413m3_inputport1_r, nb1413m3_inputportsel_w)
6565   AM_RANGE(0xb0, 0xb0) AM_READWRITE(nb1413m3_inputport2_r, nb1413m3_sndrombank1_w)
66   AM_RANGE(0xc0, 0xcf) AM_WRITEONLY AM_BASE(&hyhoo_clut)
66   AM_RANGE(0xc0, 0xcf) AM_WRITEONLY AM_BASE_MEMBER(hyhoo_state, clut)
6767   AM_RANGE(0xd0, 0xd0) AM_READNOP AM_DEVWRITE("dac", DAC_WRITE)      // unknown read
6868   AM_RANGE(0xe0, 0xe0) AM_WRITE(hyhoo_romsel_w)
6969   AM_RANGE(0xe0, 0xe1) AM_READ(nb1413m3_gfxrom_r)
r10613r10614
245245};
246246
247247
248static MACHINE_CONFIG_START( hyhoo, driver_device )
248static MACHINE_CONFIG_START( hyhoo, hyhoo_state )
249249
250250   /* basic machine hardware */
251251   MCFG_CPU_ADD("maincpu", Z80, 5000000)   /* 5.00 MHz ?? */
src/mame/drivers/tickee.c
r10613r10614
790790   MCFG_TLC34076_ADD("tlc34076", TLC34076_6_BIT)
791791
792792   MCFG_VIDEO_START(tickee)
793   
793
794794   MCFG_SCREEN_ADD("screen", RASTER)
795795   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
796796   MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK/2, 444, 0, 320, 233, 0, 200)
src/mame/drivers/destroyr.c
r10613r10614
189189static WRITE8_HANDLER( destroyr_output_w )
190190{
191191   if (offset & 8) destroyr_misc_w(space, 8, data);
192   
192
193193   else switch (offset & 7)
194194   {
195195   case 0:
src/mame/drivers/multigam.c
r10613r10614
7171#include "sound/nes_apu.h"
7272#include "video/ppu2c0x.h"
7373
74
75class multigam_state : public driver_device
76{
77public:
78   multigam_state(running_machine &machine, const driver_device_config_base &config)
79      : driver_device(machine, config) { }
80
81   UINT8* nt_ram;
82   UINT8* vram;
83   UINT8* nt_page[4];
84   UINT32 in_0;
85   UINT32 in_1;
86   UINT32 in_0_shift;
87   UINT32 in_1_shift;
88   UINT32 in_dsw;
89   UINT32 in_dsw_shift;
90   int game_gfx_bank;
91   int multigam3_mmc3_scanline_counter;
92   int multigam3_mmc3_scanline_latch;
93   int multigam3_mmc3_banks[2];
94   int multigam3_mmc3_4screen;
95   int multigam3_mmc3_last_bank;
96   UINT8* multigmc_mmc3_6000_ram;
97   UINT8* multigam3_mmc3_prg_base;
98   int multigam3_mmc3_prg_size;
99   int multigam3_mmc3_chr_bank_base;
100   int multigam3_mmc3_command;
101   UINT8* mapper02_prg_base;
102   int mapper02_prg_size;
103   int mmc1_shiftreg;
104   int mmc1_shiftcount;
105   int mmc1_rom_mask;
106   UINT8* mmc1_prg_base;
107   int mmc1_prg_size;
108   int mmc1_chr_bank_base;
109   int mmc1_reg_write_enable;
110   int size16k;
111   int switchlow;
112   int vrom4k;
113   UINT8 supergm3_prg_bank;
114   UINT8 supergm3_chr_bank;
115};
116
117
74118/******************************************************
75119
76120   PPU external bus interface
77121
78122*******************************************************/
79123
80static UINT8* nt_ram;
81static UINT8* vram;
82static UINT8* nt_page[4];
83124
84static void set_mirroring(int mirroring)
125static void set_mirroring(multigam_state *state, int mirroring)
85126{
86127   switch(mirroring)
87128   {
88129   case PPU_MIRROR_LOW:
89      nt_page[0] = nt_page[1] = nt_page[2] = nt_page[3] = nt_ram;
130      state->nt_page[0] = state->nt_page[1] = state->nt_page[2] = state->nt_page[3] = state->nt_ram;
90131      break;
91132   case PPU_MIRROR_HIGH:
92      nt_page[0] = nt_page[1] = nt_page[2] = nt_page[3] = nt_ram + 0x400;
133      state->nt_page[0] = state->nt_page[1] = state->nt_page[2] = state->nt_page[3] = state->nt_ram + 0x400;
93134      break;
94135   case PPU_MIRROR_HORZ:
95      nt_page[0] = nt_ram;
96      nt_page[1] = nt_ram;
97      nt_page[2] = nt_ram + 0x400;
98      nt_page[3] = nt_ram + 0x400;
136      state->nt_page[0] = state->nt_ram;
137      state->nt_page[1] = state->nt_ram;
138      state->nt_page[2] = state->nt_ram + 0x400;
139      state->nt_page[3] = state->nt_ram + 0x400;
99140      break;
100141   case PPU_MIRROR_VERT:
101      nt_page[0] = nt_ram;
102      nt_page[1] = nt_ram + 0x400;
103      nt_page[2] = nt_ram;
104      nt_page[3] = nt_ram + 0x400;
142      state->nt_page[0] = state->nt_ram;
143      state->nt_page[1] = state->nt_ram + 0x400;
144      state->nt_page[2] = state->nt_ram;
145      state->nt_page[3] = state->nt_ram + 0x400;
105146      break;
106147   case PPU_MIRROR_NONE:
107148   default:
108      nt_page[0] = nt_ram;
109      nt_page[1] = nt_ram + 0x400;
110      nt_page[2] = nt_ram + 0x800;
111      nt_page[3] = nt_ram + 0xc00;
149      state->nt_page[0] = state->nt_ram;
150      state->nt_page[1] = state->nt_ram + 0x400;
151      state->nt_page[2] = state->nt_ram + 0x800;
152      state->nt_page[3] = state->nt_ram + 0xc00;
112153      break;
113154   }
114155}
115156
116157static WRITE8_HANDLER (multigam_nt_w)
117158{
159   multigam_state *state = space->machine->driver_data<multigam_state>();
118160   int page = ((offset & 0xc00) >> 10);
119   nt_page[page][offset & 0x3ff] = data;
161   state->nt_page[page][offset & 0x3ff] = data;
120162}
121163
122164
123165static READ8_HANDLER (multigam_nt_r)
124166{
167   multigam_state *state = space->machine->driver_data<multigam_state>();
125168   int page = ((offset & 0xc00) >> 10);
126   return nt_page[page][offset & 0x3ff];
169   return state->nt_page[page][offset & 0x3ff];
127170}
128171
129172static const char * const banknames[] = { "bank2", "bank3", "bank4", "bank5", "bank6", "bank7", "bank8", "bank9" };
r10613r10614
142185
143186static void set_videoram_bank(running_machine* machine, int start, int count, int bank, int bank_size_in_kb)
144187{
188   multigam_state *state = machine->driver_data<multigam_state>();
145189   int i;
146190   int offset = bank * (bank_size_in_kb * 0x400);
147191   /* bank_size_in_kb is used to determine how large the "bank" parameter is */
148192   /* count determines the size of the area mapped in KB */
149193   for (i = 0; i < count; i++, offset += 0x400)
150194   {
151      memory_set_bankptr(machine, banknames[i + start], vram + offset);
195      memory_set_bankptr(machine, banknames[i + start], state->vram + offset);
152196   }
153197}
154198
r10613r10614
185229
186230*******************************************************/
187231
188static UINT32 in_0;
189static UINT32 in_1;
190static UINT32 in_0_shift;
191static UINT32 in_1_shift;
192static UINT32 multigam_in_dsw;
193static UINT32 multigam_in_dsw_shift;
194232
195233static READ8_HANDLER( multigam_IN0_r )
196234{
197   return ((in_0 >> in_0_shift++) & 0x01) | 0x40;
235   multigam_state *state = space->machine->driver_data<multigam_state>();
236   return ((state->in_0 >> state->in_0_shift++) & 0x01) | 0x40;
198237}
199238
200239static WRITE8_HANDLER( multigam_IN0_w )
201240{
241   multigam_state *state = space->machine->driver_data<multigam_state>();
202242   if (data & 0x01)
203243   {
204244      return;
205245   }
206246
207   in_0_shift = 0;
208   in_1_shift = 0;
247   state->in_0_shift = 0;
248   state->in_1_shift = 0;
209249
210   in_0 = input_port_read(space->machine, "P1");
211   in_1 = input_port_read(space->machine, "P2");
250   state->in_0 = input_port_read(space->machine, "P1");
251   state->in_1 = input_port_read(space->machine, "P2");
212252
213   multigam_in_dsw_shift = 0;
214   multigam_in_dsw = input_port_read_safe(space->machine, "DSW", 0);
253   state->in_dsw_shift = 0;
254   state->in_dsw = input_port_read_safe(space->machine, "DSW", 0);
215255}
216256
217257static READ8_HANDLER( multigam_IN1_r )
218258{
219   return ((in_1 >> in_1_shift++) & 0x01) | 0x40;
259   multigam_state *state = space->machine->driver_data<multigam_state>();
260   return ((state->in_1 >> state->in_1_shift++) & 0x01) | 0x40;
220261}
221262
222263static CUSTOM_INPUT( multigam_inputs_r )
223264{
265   multigam_state *state = field->port->machine->driver_data<multigam_state>();
224266   /* bit 0: serial input (dsw)
225267       bit 1: coin */
226   return (multigam_in_dsw >> multigam_in_dsw_shift++) & 0x01;
268   return (state->in_dsw >> state->in_dsw_shift++) & 0x01;
227269}
228270
229271
r10613r10614
233275
234276*******************************************************/
235277
236static int multigam_game_gfx_bank = 0;
237278
238279static WRITE8_HANDLER(multigam_switch_prg_rom)
239280{
r10613r10614
258299
259300static WRITE8_HANDLER(multigam_switch_gfx_rom)
260301{
302   multigam_state *state = space->machine->driver_data<multigam_state>();
261303   memory_set_bankptr(space->machine, "bank1", space->machine->region("gfx1")->base() + (0x2000 * (data & 0x3f)));
262   set_mirroring(data & 0x40 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
263   multigam_game_gfx_bank = data;
304   set_mirroring(state, data & 0x40 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
305   state->game_gfx_bank = data;
264306};
265307
266308
267309static WRITE8_HANDLER(multigam_mapper2_w)
268310{
269   if (multigam_game_gfx_bank & 0x80)
311   multigam_state *state = space->machine->driver_data<multigam_state>();
312   if (state->game_gfx_bank & 0x80)
270313   {
271      memory_set_bankptr(space->machine, "bank1", space->machine->region("gfx1")->base() + (0x2000 * ((data & 0x3) + (multigam_game_gfx_bank & 0x3c))));
314      memory_set_bankptr(space->machine, "bank1", space->machine->region("gfx1")->base() + (0x2000 * ((data & 0x3) + (state->game_gfx_bank & 0x3c))));
272315   }
273316   else
274317   {
r10613r10614
324367
325368*******************************************************/
326369
327static int multigam3_mmc3_scanline_counter;
328static int multigam3_mmc3_scanline_latch;
329static int multigam3_mmc3_banks[2];
330static int multigam3_mmc3_4screen;
331static int multigam3_mmc3_last_bank;
332static UINT8* multigmc_mmc3_6000_ram;
333static UINT8* multigam3_mmc3_prg_base;
334static int multigam3_mmc3_prg_size;
335static int multigam3_mmc3_chr_bank_base;
336370
337371static void multigam3_mmc3_scanline_cb( device_t *device, int scanline, int vblank, int blanked )
338372{
373   multigam_state *state = device->machine->driver_data<multigam_state>();
339374   if (!vblank && !blanked)
340375   {
341      if (--multigam3_mmc3_scanline_counter == -1)
376      if (--state->multigam3_mmc3_scanline_counter == -1)
342377      {
343         multigam3_mmc3_scanline_counter = multigam3_mmc3_scanline_latch;
378         state->multigam3_mmc3_scanline_counter = state->multigam3_mmc3_scanline_latch;
344379         generic_pulse_irq_line(device->machine->device("maincpu"), 0);
345380      }
346381   }
r10613r10614
348383
349384static WRITE8_HANDLER( multigam3_mmc3_rom_switch_w )
350385{
386   multigam_state *state = space->machine->driver_data<multigam_state>();
351387   device_t *ppu = space->machine->device("ppu");
352388
353389   /* basically, a MMC3 mapper from the nes */
354   static int multigam3_mmc3_command;
355   int bankmask = multigam3_mmc3_prg_size == 0x40000 ? 0x1f : 0x0f;
390   int bankmask = state->multigam3_mmc3_prg_size == 0x40000 ? 0x1f : 0x0f;
356391
357392   switch(offset & 0x7001)
358393   {
359394      case 0x0000:
360         multigam3_mmc3_command = data;
395         state->multigam3_mmc3_command = data;
361396
362         if (multigam3_mmc3_last_bank != (data & 0xc0))
397         if (state->multigam3_mmc3_last_bank != (data & 0xc0))
363398         {
364399            int bank;
365400            UINT8 *prg = space->machine->region("maincpu")->base();
366401
367402            /* reset the banks */
368            if (multigam3_mmc3_command & 0x40)
403            if (state->multigam3_mmc3_command & 0x40)
369404            {
370405               /* high bank */
371               bank = (multigam3_mmc3_banks[0] & bankmask) * 0x2000;
406               bank = (state->multigam3_mmc3_banks[0] & bankmask) * 0x2000;
372407
373               memcpy(&prg[0x0c000], &multigam3_mmc3_prg_base[bank], 0x2000);
374               memcpy(&prg[0x08000], &multigam3_mmc3_prg_base[multigam3_mmc3_prg_size - 0x4000], 0x2000);
408               memcpy(&prg[0x0c000], &state->multigam3_mmc3_prg_base[bank], 0x2000);
409               memcpy(&prg[0x08000], &state->multigam3_mmc3_prg_base[state->multigam3_mmc3_prg_size - 0x4000], 0x2000);
375410            }
376411            else
377412            {
378413               /* low bank */
379               bank = (multigam3_mmc3_banks[0] & bankmask) * 0x2000;
414               bank = (state->multigam3_mmc3_banks[0] & bankmask) * 0x2000;
380415
381               memcpy(&prg[0x08000], &multigam3_mmc3_prg_base[bank], 0x2000);
382               memcpy(&prg[0x0c000], &multigam3_mmc3_prg_base[multigam3_mmc3_prg_size - 0x4000], 0x2000);
416               memcpy(&prg[0x08000], &state->multigam3_mmc3_prg_base[bank], 0x2000);
417               memcpy(&prg[0x0c000], &state->multigam3_mmc3_prg_base[state->multigam3_mmc3_prg_size - 0x4000], 0x2000);
383418            }
384419
385420            /* mid bank */
386            bank = (multigam3_mmc3_banks[1] & bankmask) * 0x2000;
387            memcpy(&prg[0x0a000], &multigam3_mmc3_prg_base[bank], 0x2000);
421            bank = (state->multigam3_mmc3_banks[1] & bankmask) * 0x2000;
422            memcpy(&prg[0x0a000], &state->multigam3_mmc3_prg_base[bank], 0x2000);
388423
389            multigam3_mmc3_last_bank = data & 0xc0;
424            state->multigam3_mmc3_last_bank = data & 0xc0;
390425         }
391426      break;
392427
393428      case 0x0001:
394429         {
395            UINT8 cmd = multigam3_mmc3_command & 0x07;
396            int page = (multigam3_mmc3_command & 0x80) >> 5;
430            UINT8 cmd = state->multigam3_mmc3_command & 0x07;
431            int page = (state->multigam3_mmc3_command & 0x80) >> 5;
397432            int bank;
398433
399434            switch (cmd)
r10613r10614
402437               case 1: /* char banking */
403438                  data &= 0xfe;
404439                  page ^= (cmd << 1);
405                  set_videorom_bank(space->machine, page, 2, multigam3_mmc3_chr_bank_base + data, 1);
440                  set_videorom_bank(space->machine, page, 2, state->multigam3_mmc3_chr_bank_base + data, 1);
406441               break;
407442
408443               case 2: /* char banking */
r10613r10614
410445               case 4: /* char banking */
411446               case 5: /* char banking */
412447                  page ^= cmd + 2;
413                  set_videorom_bank(space->machine, page, 1, multigam3_mmc3_chr_bank_base + data, 1);
448                  set_videorom_bank(space->machine, page, 1, state->multigam3_mmc3_chr_bank_base + data, 1);
414449               break;
415450
416451               case 6: /* program banking */
417452               {
418453                  UINT8 *prg = space->machine->region("maincpu")->base();
419                  if (multigam3_mmc3_command & 0x40)
454                  if (state->multigam3_mmc3_command & 0x40)
420455                  {
421456                     /* high bank */
422                     multigam3_mmc3_banks[0] = data & bankmask;
423                     bank = (multigam3_mmc3_banks[0]) * 0x2000;
457                     state->multigam3_mmc3_banks[0] = data & bankmask;
458                     bank = (state->multigam3_mmc3_banks[0]) * 0x2000;
424459
425                     memcpy(&prg[0x0c000], &multigam3_mmc3_prg_base[bank], 0x2000);
426                     memcpy(&prg[0x08000], &multigam3_mmc3_prg_base[multigam3_mmc3_prg_size - 0x4000], 0x2000);
460                     memcpy(&prg[0x0c000], &state->multigam3_mmc3_prg_base[bank], 0x2000);
461                     memcpy(&prg[0x08000], &state->multigam3_mmc3_prg_base[state->multigam3_mmc3_prg_size - 0x4000], 0x2000);
427462                  }
428463                  else
429464                  {
430465                     /* low bank */
431                     multigam3_mmc3_banks[0] = data & bankmask;
432                     bank = (multigam3_mmc3_banks[0]) * 0x2000;
466                     state->multigam3_mmc3_banks[0] = data & bankmask;
467                     bank = (state->multigam3_mmc3_banks[0]) * 0x2000;
433468
434                     memcpy(&prg[0x08000], &multigam3_mmc3_prg_base[bank], 0x2000);
435                     memcpy(&prg[0x0c000], &multigam3_mmc3_prg_base[multigam3_mmc3_prg_size - 0x4000], 0x2000);
469                     memcpy(&prg[0x08000], &state->multigam3_mmc3_prg_base[bank], 0x2000);
470                     memcpy(&prg[0x0c000], &state->multigam3_mmc3_prg_base[state->multigam3_mmc3_prg_size - 0x4000], 0x2000);
436471                  }
437472               }
438473               break;
r10613r10614
442477                     /* mid bank */
443478                     UINT8 *prg = space->machine->region("maincpu")->base();
444479
445                     multigam3_mmc3_banks[1] = data & bankmask;
446                     bank = multigam3_mmc3_banks[1] * 0x2000;
480                     state->multigam3_mmc3_banks[1] = data & bankmask;
481                     bank = state->multigam3_mmc3_banks[1] * 0x2000;
447482
448                     memcpy(&prg[0x0a000], &multigam3_mmc3_prg_base[bank], 0x2000);
483                     memcpy(&prg[0x0a000], &state->multigam3_mmc3_prg_base[bank], 0x2000);
449484                  }
450485               break;
451486            }
r10613r10614
453488      break;
454489
455490      case 0x2000: /* mirroring */
456         if (!multigam3_mmc3_4screen)
491         if (!state->multigam3_mmc3_4screen)
457492         {
458493            if (data & 0x40)
459               set_mirroring(PPU_MIRROR_HIGH);
494               set_mirroring(state, PPU_MIRROR_HIGH);
460495            else
461               set_mirroring((data & 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
496               set_mirroring(state, (data & 1) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
462497         }
463498      break;
464499
465500      case 0x2001: /* enable ram at $6000 */
466501         if (data & 0x80)
467502         {
468            memory_set_bankptr(space->machine, "bank10", multigmc_mmc3_6000_ram);
503            memory_set_bankptr(space->machine, "bank10", state->multigmc_mmc3_6000_ram);
469504         }
470505         else
471506         {
r10613r10614
478513      break;
479514
480515      case 0x4000: /* scanline counter */
481         multigam3_mmc3_scanline_counter = data;
516         state->multigam3_mmc3_scanline_counter = data;
482517      break;
483518
484519      case 0x4001: /* scanline latch */
485         multigam3_mmc3_scanline_latch = data;
520         state->multigam3_mmc3_scanline_latch = data;
486521      break;
487522
488523      case 0x6000: /* disable irqs */
r10613r10614
497532
498533static void multigam_init_mmc3(running_machine *machine, UINT8 *prg_base, int prg_size, int chr_bank_base)
499534{
535   multigam_state *state = machine->driver_data<multigam_state>();
500536   UINT8* dst = machine->region("maincpu")->base();
501537
502538   // Tom & Jerry in Super Game III enables 6000 ram, but does not read/write it
503539   // however, it expects ROM from 6000 there (code jumps to $6xxx)
504   memcpy(multigmc_mmc3_6000_ram, dst + 0x6000, 0x2000);
540   memcpy(state->multigmc_mmc3_6000_ram, dst + 0x6000, 0x2000);
505541
506542   memcpy(&dst[0x8000], prg_base + (prg_size - 0x4000), 0x4000);
507543   memcpy(&dst[0xc000], prg_base + (prg_size - 0x4000), 0x4000);
508544
509545   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, multigam3_mmc3_rom_switch_w );
510546
511   multigam3_mmc3_banks[0] = 0x1e;
512   multigam3_mmc3_banks[1] = 0x1f;
513   multigam3_mmc3_scanline_counter = 0;
514   multigam3_mmc3_scanline_latch = 0;
515   multigam3_mmc3_4screen = 0;
516   multigam3_mmc3_last_bank = 0xff;
517   multigam3_mmc3_prg_base = prg_base;
518   multigam3_mmc3_chr_bank_base = chr_bank_base;
519   multigam3_mmc3_prg_size = prg_size;
547   state->multigam3_mmc3_banks[0] = 0x1e;
548   state->multigam3_mmc3_banks[1] = 0x1f;
549   state->multigam3_mmc3_scanline_counter = 0;
550   state->multigam3_mmc3_scanline_latch = 0;
551   state->multigam3_mmc3_4screen = 0;
552   state->multigam3_mmc3_last_bank = 0xff;
553   state->multigam3_mmc3_prg_base = prg_base;
554   state->multigam3_mmc3_chr_bank_base = chr_bank_base;
555   state->multigam3_mmc3_prg_size = prg_size;
520556};
521557
522558static WRITE8_HANDLER(multigm3_mapper2_w)
523559{
524   if (multigam_game_gfx_bank & 0x80)
560   multigam_state *state = space->machine->driver_data<multigam_state>();
561   if (state->game_gfx_bank & 0x80)
525562   {
526      set_videorom_bank(space->machine, 0, 8, (multigam_game_gfx_bank & 0x3c)  + (data & 0x3), 8);
563      set_videorom_bank(space->machine, 0, 8, (state->game_gfx_bank & 0x3c)  + (data & 0x3), 8);
527564   }
528565   else
529566   {
r10613r10614
533570
534571static WRITE8_HANDLER(multigm3_switch_gfx_rom)
535572{
573   multigam_state *state = space->machine->driver_data<multigam_state>();
536574   set_videorom_bank(space->machine, 0, 8, data & 0x3f, 8);
537   set_mirroring(data & 0x40 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
538   multigam_game_gfx_bank = data;
575   set_mirroring(state, data & 0x40 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
576   state->game_gfx_bank = data;
539577};
540578
541579static WRITE8_HANDLER(multigm3_switch_prg_rom)
r10613r10614
601639
602640*******************************************************/
603641
604static UINT8* multigam_mapper02_prg_base;
605static int multigam_mapper02_prg_size;
606642
607643static WRITE8_HANDLER(multigam3_mapper02_rom_switch_w)
608644{
645   multigam_state *state = space->machine->driver_data<multigam_state>();
609646   UINT8* mem = space->machine->region("maincpu")->base();
610   int bankmask = (multigam_mapper02_prg_size/0x4000) - 1;
611   memcpy(mem + 0x8000, multigam_mapper02_prg_base + 0x4000*(data & bankmask), 0x4000);
647   int bankmask = (state->mapper02_prg_size/0x4000) - 1;
648   memcpy(mem + 0x8000, state->mapper02_prg_base + 0x4000*(data & bankmask), 0x4000);
612649}
613650
614651static void multigam_init_mapper02(running_machine *machine, UINT8* prg_base, int prg_size)
615652{
653   multigam_state *state = machine->driver_data<multigam_state>();
616654   UINT8* mem = machine->region("maincpu")->base();
617655   memcpy(mem + 0x8000, prg_base + prg_size - 0x8000, 0x8000);
618656   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, multigam3_mapper02_rom_switch_w );
619657
620   multigam_mapper02_prg_base = prg_base;
621   multigam_mapper02_prg_size = prg_size;
658   state->mapper02_prg_base = prg_base;
659   state->mapper02_prg_size = prg_size;
622660
623661   ppu2c0x_set_scanline_callback(machine->device("ppu"), 0);
624662}
r10613r10614
629667
630668*******************************************************/
631669
632static int mmc1_shiftreg;
633static int mmc1_shiftcount;
634static int mmc1_rom_mask;
635static UINT8* multigam_mmc1_prg_base;
636static int multigam_mmc1_prg_size;
637static int multigam_mmc1_chr_bank_base;
638static int multigam_mmc1_reg_write_enable;
639670
640671static TIMER_CALLBACK( mmc1_resync_callback )
641672{
642   multigam_mmc1_reg_write_enable = 1;
673   multigam_state *state = machine->driver_data<multigam_state>();
674   state->mmc1_reg_write_enable = 1;
643675}
644676
645677static WRITE8_HANDLER( mmc1_rom_switch_w )
646678{
679   multigam_state *state = space->machine->driver_data<multigam_state>();
647680   /* basically, a MMC1 mapper from the nes */
648   static int size16k, switchlow, vrom4k;
649681
650   if ( multigam_mmc1_reg_write_enable == 0 )
682   if ( state->mmc1_reg_write_enable == 0 )
651683   {
652684      return;
653685   }
654686   else
655687   {
656      multigam_mmc1_reg_write_enable = 0;
688      state->mmc1_reg_write_enable = 0;
657689      space->machine->scheduler().synchronize(FUNC(mmc1_resync_callback));
658690   }
659691
r10613r10614
662694   /* reset mapper */
663695   if (data & 0x80)
664696   {
665      mmc1_shiftreg = mmc1_shiftcount = 0;
697      state->mmc1_shiftreg = state->mmc1_shiftcount = 0;
666698
667      size16k = 1;
668      switchlow = 1;
669      vrom4k = 0;
699      state->size16k = 1;
700      state->switchlow = 1;
701      state->vrom4k = 0;
670702
671703      return;
672704   }
673705
674706   /* see if we need to clock in data */
675   if (mmc1_shiftcount < 5)
707   if (state->mmc1_shiftcount < 5)
676708   {
677      mmc1_shiftreg >>= 1;
678      mmc1_shiftreg |= (data & 1) << 4;
679      mmc1_shiftcount++;
709      state->mmc1_shiftreg >>= 1;
710      state->mmc1_shiftreg |= (data & 1) << 4;
711      state->mmc1_shiftcount++;
680712   }
681713
682714   /* are we done shifting? */
683   if (mmc1_shiftcount == 5)
715   if (state->mmc1_shiftcount == 5)
684716   {
685717      /* reset count */
686      mmc1_shiftcount = 0;
718      state->mmc1_shiftcount = 0;
687719
688720      /* apply data to registers */
689721      switch (reg)
r10613r10614
692724            {
693725               int _mirroring;
694726
695               vrom4k = mmc1_shiftreg & 0x10;
696               size16k = mmc1_shiftreg & 0x08;
697               switchlow = mmc1_shiftreg & 0x04;
727               state->vrom4k = state->mmc1_shiftreg & 0x10;
728               state->size16k = state->mmc1_shiftreg & 0x08;
729               state->switchlow = state->mmc1_shiftreg & 0x04;
698730
699               switch (mmc1_shiftreg & 3)
731               switch (state->mmc1_shiftreg & 3)
700732               {
701733                  case 0:
702734                     _mirroring = PPU_MIRROR_LOW;
r10613r10614
717749               }
718750
719751               /* apply mirroring */
720               set_mirroring(_mirroring);
752               set_mirroring(state, _mirroring);
721753            }
722754         break;
723755
724756         case 1:   /* video rom banking - bank 0 - 4k or 8k */
725            if (multigam_mmc1_chr_bank_base == 0)
726               set_videoram_bank(space->machine, 0, (vrom4k) ? 4 : 8, (mmc1_shiftreg & 0x1f), 4);
757            if (state->mmc1_chr_bank_base == 0)
758               set_videoram_bank(space->machine, 0, (state->vrom4k) ? 4 : 8, (state->mmc1_shiftreg & 0x1f), 4);
727759            else
728               set_videorom_bank(space->machine, 0, (vrom4k) ? 4 : 8, multigam_mmc1_chr_bank_base + (mmc1_shiftreg & 0x1f), 4);
760               set_videorom_bank(space->machine, 0, (state->vrom4k) ? 4 : 8, state->mmc1_chr_bank_base + (state->mmc1_shiftreg & 0x1f), 4);
729761         break;
730762
731763         case 2: /* video rom banking - bank 1 - 4k only */
732            if (vrom4k)
764            if (state->vrom4k)
733765            {
734               if (multigam_mmc1_chr_bank_base == 0)
735                  set_videoram_bank(space->machine, 0, (vrom4k) ? 4 : 8, (mmc1_shiftreg & 0x1f), 4);
766               if (state->mmc1_chr_bank_base == 0)
767                  set_videoram_bank(space->machine, 0, (state->vrom4k) ? 4 : 8, (state->mmc1_shiftreg & 0x1f), 4);
736768               else
737                  set_videorom_bank(space->machine, 4, 4, multigam_mmc1_chr_bank_base + (mmc1_shiftreg & 0x1f), 4);
769                  set_videorom_bank(space->machine, 4, 4, state->mmc1_chr_bank_base + (state->mmc1_shiftreg & 0x1f), 4);
738770            }
739771         break;
740772
741773         case 3:   /* program banking */
742774            {
743               int bank = (mmc1_shiftreg & mmc1_rom_mask) * 0x4000;
775               int bank = (state->mmc1_shiftreg & state->mmc1_rom_mask) * 0x4000;
744776               UINT8 *prg = space->machine->region("maincpu")->base();
745777
746               if (!size16k)
778               if (!state->size16k)
747779               {
748                  bank = ((mmc1_shiftreg >> 1) & mmc1_rom_mask) * 0x4000;
780                  bank = ((state->mmc1_shiftreg >> 1) & state->mmc1_rom_mask) * 0x4000;
749781                  /* switch 32k */
750                  memcpy(&prg[0x08000], multigam_mmc1_prg_base + bank, 0x8000);
782                  memcpy(&prg[0x08000], state->mmc1_prg_base + bank, 0x8000);
751783               }
752784               else
753785               {
754786                  /* switch 16k */
755                  if (switchlow)
787                  if (state->switchlow)
756788                  {
757789                     /* low */
758                     memcpy(&prg[0x08000], multigam_mmc1_prg_base + bank, 0x4000);
759                     memcpy(&prg[0x0c000], multigam_mmc1_prg_base + (0x0f & mmc1_rom_mask) * 0x4000, 0x4000);
790                     memcpy(&prg[0x08000], state->mmc1_prg_base + bank, 0x4000);
791                     memcpy(&prg[0x0c000], state->mmc1_prg_base + (0x0f & state->mmc1_rom_mask) * 0x4000, 0x4000);
760792                  }
761793                  else
762794                  {
763795                     /* high */
764                     memcpy(&prg[0x08000], multigam_mmc1_prg_base + (0x00 & mmc1_rom_mask) * 0x4000, 0x4000);
765                     memcpy(&prg[0x0c000], multigam_mmc1_prg_base + bank, 0x4000);
796                     memcpy(&prg[0x08000], state->mmc1_prg_base + (0x00 & state->mmc1_rom_mask) * 0x4000, 0x4000);
797                     memcpy(&prg[0x0c000], state->mmc1_prg_base + bank, 0x4000);
766798                  }
767799               }
768800            }
r10613r10614
773805
774806static void multigam_init_mmc1(running_machine *machine, UINT8 *prg_base, int prg_size, int chr_bank_base)
775807{
808   multigam_state *state = machine->driver_data<multigam_state>();
776809   UINT8* dst = machine->region("maincpu")->base();
777810
778811   memcpy(&dst[0x8000], prg_base + (prg_size - 0x8000), 0x8000);
779812
780813   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xffff, 0, 0, mmc1_rom_switch_w );
781814
782   multigam_mmc1_reg_write_enable = 1;
783   mmc1_rom_mask = (prg_size / 0x4000) - 1;
784   multigam_mmc1_prg_base = prg_base;
785   multigam_mmc1_prg_size = prg_size;
786   multigam_mmc1_chr_bank_base = chr_bank_base;
815   state->mmc1_reg_write_enable = 1;
816   state->mmc1_rom_mask = (prg_size / 0x4000) - 1;
817   state->mmc1_prg_base = prg_base;
818   state->mmc1_prg_size = prg_size;
819   state->mmc1_chr_bank_base = chr_bank_base;
787820
788821   ppu2c0x_set_scanline_callback(machine->device("ppu"), 0);
789822
r10613r10614
811844          xxxx  CHR rom bank, each bank has 0x8000 bytes (32KB)
812845*/
813846
814static UINT8 supergm3_prg_bank;
815static UINT8 supergm3_chr_bank;
816847
817848static void supergm3_set_bank(running_machine *machine)
818849{
850   multigam_state *state = machine->driver_data<multigam_state>();
819851   device_t *ppu = machine->device("ppu");
820852   UINT8* mem = machine->region("maincpu")->base();
821853
822854   // video bank
823   if (supergm3_chr_bank == 0x10 ||
824      supergm3_chr_bank == 0x40 )
855   if (state->supergm3_chr_bank == 0x10 ||
856      state->supergm3_chr_bank == 0x40 )
825857   {
826858      // VRAM
827859      memory_install_read_bank(cpu_get_address_space(ppu, ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, "bank1");
828860      memory_install_write_bank(cpu_get_address_space(ppu, ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, "bank1");
829      memory_set_bankptr(machine, "bank1", vram);
861      memory_set_bankptr(machine, "bank1", state->vram);
830862
831      if (supergm3_chr_bank == 0x40)
832         set_mirroring(PPU_MIRROR_VERT);
863      if (state->supergm3_chr_bank == 0x40)
864         set_mirroring(state, PPU_MIRROR_VERT);
833865   }
834866   else
835867   {
r10613r10614
847879   }
848880
849881   // prg bank
850   if ((supergm3_prg_bank & 0x80) == 0)
882   if ((state->supergm3_prg_bank & 0x80) == 0)
851883   {
852884      // title screen
853885      memcpy(mem + 0x8000, mem + 0x18000, 0x8000);
854886      memory_set_bankptr(machine, "bank10", mem + 0x6000);
855887      ppu2c0x_set_scanline_callback(ppu, 0);
856888   }
857   else if ((supergm3_prg_bank & 0x40) == 0)
889   else if ((state->supergm3_prg_bank & 0x40) == 0)
858890   {
859891      // mapper 02
860892      multigam_init_mapper02(machine,
861         machine->region("user1")->base() + (supergm3_prg_bank & 0x1f)*0x20000,
893         machine->region("user1")->base() + (state->supergm3_prg_bank & 0x1f)*0x20000,
862894         0x20000);
863895   }
864   else if (supergm3_chr_bank & 0x10)
896   else if (state->supergm3_chr_bank & 0x10)
865897   {
866898      // MMC3
867899      multigam_init_mmc3(machine,
868         machine->region("user1")->base() + (supergm3_prg_bank & 0x1f)*0x20000,
869         (supergm3_prg_bank & 0x20) ? 0x20000 : 0x40000,
870         (supergm3_chr_bank & 0x0f)*0x80);
900         machine->region("user1")->base() + (state->supergm3_prg_bank & 0x1f)*0x20000,
901         (state->supergm3_prg_bank & 0x20) ? 0x20000 : 0x40000,
902         (state->supergm3_chr_bank & 0x0f)*0x80);
871903   }
872904   else
873905   {
874906      //MMC1
875907      multigam_init_mmc1(machine,
876         machine->region("user1")->base() + (supergm3_prg_bank & 0x1f)*0x20000,
908         machine->region("user1")->base() + (state->supergm3_prg_bank & 0x1f)*0x20000,
877909         0x20000,
878         (supergm3_chr_bank & 0x0f)*0x80/4 );
910         (state->supergm3_chr_bank & 0x0f)*0x80/4 );
879911   }
880912}
881913
882914static WRITE8_HANDLER(supergm3_prg_bank_w)
883915{
884   supergm3_prg_bank = data;
916   multigam_state *state = space->machine->driver_data<multigam_state>();
917   state->supergm3_prg_bank = data;
885918}
886919
887920static WRITE8_HANDLER(supergm3_chr_bank_w)
888921{
889   supergm3_chr_bank = data;
922   multigam_state *state = space->machine->driver_data<multigam_state>();
923   state->supergm3_chr_bank = data;
890924   supergm3_set_bank(space->machine);
891925}
892926
r10613r10614
10861120
10871121static MACHINE_START( multigam )
10881122{
1089   nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
1090   nt_page[0] = nt_ram;
1091   nt_page[1] = nt_ram + 0x400;
1092   nt_page[2] = nt_ram + 0x800;
1093   nt_page[3] = nt_ram + 0xc00;
1123   multigam_state *state = machine->driver_data<multigam_state>();
1124   state->nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
1125   state->nt_page[0] = state->nt_ram;
1126   state->nt_page[1] = state->nt_ram + 0x400;
1127   state->nt_page[2] = state->nt_ram + 0x800;
1128   state->nt_page[3] = state->nt_ram + 0xc00;
10941129
10951130   memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, multigam_nt_r, multigam_nt_w);
10961131   memory_install_read_bank(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0x0000, 0x1fff, 0, 0, "bank1");
r10613r10614
10991134
11001135static MACHINE_START( multigm3 )
11011136{
1102   nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
1103   nt_page[0] = nt_ram;
1104   nt_page[1] = nt_ram + 0x400;
1105   nt_page[2] = nt_ram + 0x800;
1106   nt_page[3] = nt_ram + 0xc00;
1137   multigam_state *state = machine->driver_data<multigam_state>();
1138   state->nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
1139   state->nt_page[0] = state->nt_ram;
1140   state->nt_page[1] = state->nt_ram + 0x400;
1141   state->nt_page[2] = state->nt_ram + 0x800;
1142   state->nt_page[3] = state->nt_ram + 0xc00;
11071143
11081144   memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, multigam_nt_r, multigam_nt_w);
11091145
r10613r10614
11211157
11221158static MACHINE_START( supergm3 )
11231159{
1124   nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
1125   nt_page[0] = nt_ram;
1126   nt_page[1] = nt_ram + 0x400;
1127   nt_page[2] = nt_ram + 0x800;
1128   nt_page[3] = nt_ram + 0xc00;
1160   multigam_state *state = machine->driver_data<multigam_state>();
1161   state->nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
1162   state->nt_page[0] = state->nt_ram;
1163   state->nt_page[1] = state->nt_ram + 0x400;
1164   state->nt_page[2] = state->nt_ram + 0x800;
1165   state->nt_page[3] = state->nt_ram + 0xc00;
11291166
11301167   memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, multigam_nt_r, multigam_nt_w);
11311168
1132   vram = auto_alloc_array(machine, UINT8, 0x2000);
1133   multigmc_mmc3_6000_ram = auto_alloc_array(machine, UINT8, 0x2000);
1169   state->vram = auto_alloc_array(machine, UINT8, 0x2000);
1170   state->multigmc_mmc3_6000_ram = auto_alloc_array(machine, UINT8, 0x2000);
11341171}
11351172
1136static MACHINE_CONFIG_START( multigam, driver_device )
1173static MACHINE_CONFIG_START( multigam, multigam_state )
11371174   /* basic machine hardware */
11381175   MCFG_CPU_ADD("maincpu", N2A03, N2A03_DEFAULTCLOCK)
11391176   MCFG_CPU_PROGRAM_MAP(multigam_map)
r10613r10614
13211358
13221359static DRIVER_INIT(multigm3)
13231360{
1361   multigam_state *state = machine->driver_data<multigam_state>();
13241362   address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
13251363
13261364   const UINT8 decode[16]  = { 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a };
r10613r10614
13281366   multigm3_decrypt(machine->region("maincpu")->base(), machine->region("maincpu")->bytes(), decode );
13291367   multigm3_decrypt(machine->region("user1")->base(), machine->region("user1")->bytes(), decode );
13301368
1331   multigmc_mmc3_6000_ram = auto_alloc_array(machine, UINT8, 0x2000);
1369   state->multigmc_mmc3_6000_ram = auto_alloc_array(machine, UINT8, 0x2000);
13321370
13331371   multigam_switch_prg_rom(space, 0x0, 0x01);
13341372}
src/mame/drivers/vcombat.c
r10613r10614
584584   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
585585   MCFG_SCREEN_RAW_PARAMS(XTAL_12MHz / 2, 400, 0, 256, 291, 0, 208)
586586   MCFG_SCREEN_UPDATE(vcombat)
587   
587
588588   MCFG_SCREEN_ADD("aux", RASTER)
589589   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
590590   MCFG_SCREEN_RAW_PARAMS(XTAL_12MHz / 2, 400, 0, 256, 291, 0, 208)
src/mame/drivers/gunpey.c
r10613r10614
156156      }
157157
158158
159      printf("%02x %02x %02x %02x|%02x %02x %02x %02x|%02x %02x %02x %02x|%02x %02x %02x %02x\n"
160      ,blit_ram[0],blit_ram[1],blit_ram[2],blit_ram[3]
161      ,blit_ram[4],blit_ram[5],blit_ram[6],blit_ram[7]
162      ,blit_ram[8],blit_ram[9],blit_ram[0xa],blit_ram[0xb]
163      ,blit_ram[0xc],blit_ram[0xd],blit_ram[0xe],blit_ram[0xf]);
159//      printf("%02x %02x %02x %02x|%02x %02x %02x %02x|%02x %02x %02x %02x|%02x %02x %02x %02x\n"
160//      ,blit_ram[0],blit_ram[1],blit_ram[2],blit_ram[3]
161//      ,blit_ram[4],blit_ram[5],blit_ram[6],blit_ram[7]
162//      ,blit_ram[8],blit_ram[9],blit_ram[0xa],blit_ram[0xb]
163//      ,blit_ram[0xc],blit_ram[0xd],blit_ram[0xe],blit_ram[0xf]);
164164   }
165165}
166166
src/mame/drivers/cyclemb.c
r10613r10614
7474#include "sound/ay8910.h"
7575#include "machine/tait8741.h"
7676
77static UINT8 *cyclemb_vram,*cyclemb_cram;
78static UINT8 *cyclemb_obj1_ram,*cyclemb_obj2_ram,*cyclemb_obj3_ram;
7977
78class cyclemb_state : public driver_device
79{
80public:
81   cyclemb_state(running_machine &machine, const driver_device_config_base &config)
82      : driver_device(machine, config) { }
83
84   UINT8 *vram;
85   UINT8 *cram;
86   UINT8 *obj1_ram;
87   UINT8 *obj2_ram;
88   UINT8 *obj3_ram;
89};
90
91
92
8093static PALETTE_INIT( cyclemb )
8194{
8295   int i,r,g,b,val;
r10613r10614
110123
111124static SCREEN_UPDATE( cyclemb )
112125{
126   cyclemb_state *state = screen->machine->driver_data<cyclemb_state>();
113127   int x,y,count;
114128   const gfx_element *gfx = screen->machine->gfx[0];
115129   UINT8 flip_screen = flip_screen_get(screen->machine);
r10613r10614
120134   {
121135      for (x=0;x<64;x++)
122136      {
123         int attr = cyclemb_cram[count];
124         int tile = (cyclemb_vram[count]) | ((attr & 3)<<8);
137         int attr = state->cram[count];
138         int tile = (state->vram[count]) | ((attr & 3)<<8);
125139         int color = ((attr & 0xf8) >> 3) ^ 0x1f;
126140         int odd_line = y & 1 ? 0x40 : 0x00;
127141//          int sx_offs = flip_screen ? 512 : 0
128         int scrollx = ((cyclemb_vram[(y/2)+odd_line]) + (cyclemb_cram[(y/2)+odd_line]<<8) + 48) & 0x1ff;
142         int scrollx = ((state->vram[(y/2)+odd_line]) + (state->cram[(y/2)+odd_line]<<8) + 48) & 0x1ff;
129143
130144         if(flip_screen)
131145         {
r10613r10614
170184
171185      for(i=0;i<0x40;i+=2)
172186      {
173         y = 0xf1 - cyclemb_obj2_ram[i];
174         x = cyclemb_obj2_ram[i+1] - 56;
175         spr_offs = (cyclemb_obj1_ram[i+0]);
176         col = (cyclemb_obj1_ram[i+1] & 0x3f);
177         region = ((cyclemb_obj3_ram[i] & 0x10) >> 4) + 1;
187         y = 0xf1 - state->obj2_ram[i];
188         x = state->obj2_ram[i+1] - 56;
189         spr_offs = (state->obj1_ram[i+0]);
190         col = (state->obj1_ram[i+1] & 0x3f);
191         region = ((state->obj3_ram[i] & 0x10) >> 4) + 1;
178192         if(region == 2)
179193         {
180194            spr_offs >>= 2;
181            spr_offs += ((cyclemb_obj3_ram[i+0] & 3) << 5);
195            spr_offs += ((state->obj3_ram[i+0] & 3) << 5);
182196            y-=16;
183197         }
184198
185         if(cyclemb_obj3_ram[i+1] & 1)
199         if(state->obj3_ram[i+1] & 1)
186200            x+=256;
187         //if(cyclemb_obj3_ram[i+1] & 2)
201         //if(state->obj3_ram[i+1] & 2)
188202//              x-=256;
189         fx = (cyclemb_obj3_ram[i+0] & 4) >> 2;
190         fy = (cyclemb_obj3_ram[i+0] & 8) >> 3;
203         fx = (state->obj3_ram[i+0] & 4) >> 2;
204         fy = (state->obj3_ram[i+0] & 8) >> 3;
191205
192206         if(flip_screen)
193207         {
r10613r10614
238252static ADDRESS_MAP_START( cyclemb_map, ADDRESS_SPACE_PROGRAM, 8 )
239253   AM_RANGE(0x0000, 0x7fff) AM_ROM
240254   AM_RANGE(0x8000, 0x8fff) AM_ROMBANK("bank1")
241   AM_RANGE(0x9000, 0x97ff) AM_RAM AM_BASE(&cyclemb_vram)
242   AM_RANGE(0x9800, 0x9fff) AM_RAM AM_BASE(&cyclemb_cram)
243   AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE(&cyclemb_obj1_ram) //ORAM1 (only a000-a3ff tested)
244   AM_RANGE(0xa800, 0xafff) AM_RAM AM_BASE(&cyclemb_obj2_ram) //ORAM2 (only a800-abff tested)
245   AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_BASE(&cyclemb_obj3_ram) //ORAM3 (only b000-b3ff tested)
255   AM_RANGE(0x9000, 0x97ff) AM_RAM AM_BASE_MEMBER(cyclemb_state, vram)
256   AM_RANGE(0x9800, 0x9fff) AM_RAM AM_BASE_MEMBER(cyclemb_state, cram)
257   AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE_MEMBER(cyclemb_state, obj1_ram) //ORAM1 (only a000-a3ff tested)
258   AM_RANGE(0xa800, 0xafff) AM_RAM AM_BASE_MEMBER(cyclemb_state, obj2_ram) //ORAM2 (only a800-abff tested)
259   AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_BASE_MEMBER(cyclemb_state, obj3_ram) //ORAM3 (only b000-b3ff tested)
246260   AM_RANGE(0xb800, 0xbfff) AM_RAM //WRAM
247261ADDRESS_MAP_END
248262
r10613r10614
512526   GFXDECODE_ENTRY( "sprite_data_2", 0, spritelayout_32x32,    0x00, 0x40 )
513527GFXDECODE_END
514528
515static MACHINE_CONFIG_START( cyclemb, driver_device )
529static MACHINE_CONFIG_START( cyclemb, cyclemb_state )
516530   /* basic machine hardware */
517531   MCFG_CPU_ADD("maincpu",Z80,18000000/4)
518532   MCFG_CPU_PROGRAM_MAP(cyclemb_map)
src/mame/drivers/clshroad.c
r10613r10614
4646   AM_RANGE(0xa001, 0xa001) AM_WRITENOP   // ? Interrupt related
4747   AM_RANGE(0xa004, 0xa004) AM_WRITE(clshroad_flipscreen_w)
4848   AM_RANGE(0xa100, 0xa107) AM_READ(clshroad_input_r)
49   AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(clshroad_vram_1_w) AM_BASE(&clshroad_vram_1)   // Layer 1
50   AM_RANGE(0xb000, 0xb003) AM_WRITEONLY AM_BASE(&clshroad_vregs)   // Scroll
51   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(clshroad_vram_0_w) AM_BASE(&clshroad_vram_0)   // Layer 0
49   AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(clshroad_vram_1_w) AM_BASE_MEMBER(clshroad_state, vram_1)   // Layer 1
50   AM_RANGE(0xb000, 0xb003) AM_WRITEONLY AM_BASE_MEMBER(clshroad_state, vregs)   // Scroll
51   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(clshroad_vram_0_w) AM_BASE_MEMBER(clshroad_state, vram_0)   // Layer 0
5252ADDRESS_MAP_END
5353
5454static ADDRESS_MAP_START( clshroad_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
r10613r10614
226226
227227
228228
229static MACHINE_CONFIG_START( firebatl, driver_device )
229static MACHINE_CONFIG_START( firebatl, clshroad_state )
230230
231231   /* basic machine hardware */
232232   MCFG_CPU_ADD("maincpu", Z80, 3000000)   /* ? */
r10613r10614
261261   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
262262MACHINE_CONFIG_END
263263
264static MACHINE_CONFIG_START( clshroad, driver_device )
264static MACHINE_CONFIG_START( clshroad, clshroad_state )
265265
266266   /* basic machine hardware */
267267   MCFG_CPU_ADD("maincpu", Z80, XTAL_18_432MHz/4)   /* ? real speed unknown. 3MHz is too low and causes problems */
src/mame/drivers/dooyong.c
r10613r10614
4242  treat it as 1 8bpp layer and ignore the 2nd set of registers.
4343- some unknown reads / writes
4444
4518.02.2011. Tomasz Slanina
4518.02.2011. Tomasz Slanina
4646--------------------------
4747Few notes about the 2xYM2203 games:
4848
49Interrupts are generated by both YM chips. Sound CPU checks interrupt source
50(tests timer flag in 1st YM) and restarts appropriate timer
49Interrupts are generated by both YM chips. Sound CPU checks interrupt source
50(tests timer flag in 1st YM) and restarts appropriate timer
5151(and clears int line) then process sfx or music data.
5252
53Due to bad timing/incorrect int line handling  - interrupt is skipped if
54fires when another one is being processed and int line is still asserted
55(and not cleared). This situation results in missing or incomplete audio,
53Due to bad timing/incorrect int line handling  - interrupt is skipped if
54fires when another one is being processed and int line is still asserted
55(and not cleared). This situation results in missing or incomplete audio,
5656becasue one of interrupt sources is _dead_ (timer never restarts).
5757
5858Music tempo and audio pitch depends on (unknown) YM clocks.
r10613r10614
6464until we find real PCB and verify clocks and trace int lines.
6565
6666Pollux:
67Many (all? at least pollux, primella and flying tiger) use some kind of
67Many (all? at least pollux, primella and flying tiger) use some kind of
6868banked palette ram. Bit 1 at address 0xf008 controls banking (both palettes
6969are almost identical, except for much darker BG layer colors).
7070There's also significant gfx problem on title screen - gfx over left pilot's
7171shoulder (right part of the screen) should be - according to pics from flyer -
7272blue with orange/red flame (palette 2 instead palette 1). Also some explosions
73and stars should be red instead blue (also pal 2 instead pal 1). I have no
74idea how to fix it without breaking other parts of game. Title screen should
73and stars should be red instead blue (also pal 2 instead pal 1). I have no
74idea how to fix it without breaking other parts of game. Title screen should
7575be verified on real PCB.
7676
7777***************************************************************************/
src/mame/drivers/cham24.c
r10613r10614
6060#include "sound/nes_apu.h"
6161#include "video/ppu2c0x.h"
6262
63static UINT8* nt_ram;
64static UINT8* nt_page[4];
6563
66static void cham24_set_mirroring( int mirroring )
64class cham24_state : public driver_device
6765{
66public:
67   cham24_state(running_machine &machine, const driver_device_config_base &config)
68      : driver_device(machine, config) { }
69
70   UINT8* nt_ram;
71   UINT8* nt_page[4];
72   UINT32 in_0;
73   UINT32 in_1;
74   UINT32 in_0_shift;
75   UINT32 in_1_shift;
76};
77
78
79
80static void cham24_set_mirroring( running_machine *machine, int mirroring )
81{
82   cham24_state *state = machine->driver_data<cham24_state>();
6883   switch(mirroring)
6984   {
7085   case PPU_MIRROR_LOW:
71      nt_page[0] = nt_page[1] = nt_page[2] = nt_page[3] = nt_ram;
86      state->nt_page[0] = state->nt_page[1] = state->nt_page[2] = state->nt_page[3] = state->nt_ram;
7287      break;
7388   case PPU_MIRROR_HIGH:
74      nt_page[0] = nt_page[1] = nt_page[2] = nt_page[3] = nt_ram + 0x400;
89      state->nt_page[0] = state->nt_page[1] = state->nt_page[2] = state->nt_page[3] = state->nt_ram + 0x400;
7590      break;
7691   case PPU_MIRROR_HORZ:
77      nt_page[0] = nt_ram;
78      nt_page[1] = nt_ram;
79      nt_page[2] = nt_ram + 0x400;
80      nt_page[3] = nt_ram + 0x400;
92      state->nt_page[0] = state->nt_ram;
93      state->nt_page[1] = state->nt_ram;
94      state->nt_page[2] = state->nt_ram + 0x400;
95      state->nt_page[3] = state->nt_ram + 0x400;
8196      break;
8297   case PPU_MIRROR_VERT:
83      nt_page[0] = nt_ram;
84      nt_page[1] = nt_ram + 0x400;
85      nt_page[2] = nt_ram;
86      nt_page[3] = nt_ram + 0x400;
98      state->nt_page[0] = state->nt_ram;
99      state->nt_page[1] = state->nt_ram + 0x400;
100      state->nt_page[2] = state->nt_ram;
101      state->nt_page[3] = state->nt_ram + 0x400;
87102      break;
88103   case PPU_MIRROR_NONE:
89104   default:
90      nt_page[0] = nt_ram;
91      nt_page[1] = nt_ram + 0x400;
92      nt_page[2] = nt_ram + 0x800;
93      nt_page[3] = nt_ram + 0xc00;
105      state->nt_page[0] = state->nt_ram;
106      state->nt_page[1] = state->nt_ram + 0x400;
107      state->nt_page[2] = state->nt_ram + 0x800;
108      state->nt_page[3] = state->nt_ram + 0xc00;
94109      break;
95110   }
96111}
97112
98113static WRITE8_HANDLER( nt_w )
99114{
115   cham24_state *state = space->machine->driver_data<cham24_state>();
100116   int page = ((offset & 0xc00) >> 10);
101   nt_page[page][offset & 0x3ff] = data;
117   state->nt_page[page][offset & 0x3ff] = data;
102118}
103119
104120static READ8_HANDLER( nt_r )
105121{
122   cham24_state *state = space->machine->driver_data<cham24_state>();
106123   int page = ((offset & 0xc00) >> 10);
107   return nt_page[page][offset & 0x3ff];
124   return state->nt_page[page][offset & 0x3ff];
108125
109126}
110127
r10613r10614
129146   nes_psg_w(device,0x17, data);
130147}
131148
132static UINT32 in_0;
133static UINT32 in_1;
134static UINT32 in_0_shift;
135static UINT32 in_1_shift;
136149
137150static READ8_HANDLER( cham24_IN0_r )
138151{
139   return ((in_0 >> in_0_shift++) & 0x01) | 0x40;
152   cham24_state *state = space->machine->driver_data<cham24_state>();
153   return ((state->in_0 >> state->in_0_shift++) & 0x01) | 0x40;
140154}
141155
142156static WRITE8_HANDLER( cham24_IN0_w )
143157{
158   cham24_state *state = space->machine->driver_data<cham24_state>();
144159   if (data & 0xfe)
145160   {
146161      //logerror("Unhandled cham24_IN0_w write: data = %02X\n", data);
r10613r10614
151166      return;
152167   }
153168
154   in_0_shift = 0;
155   in_1_shift = 0;
169   state->in_0_shift = 0;
170   state->in_1_shift = 0;
156171
157   in_0 = input_port_read(space->machine, "P1");
158   in_1 = input_port_read(space->machine, "P2");
172   state->in_0 = input_port_read(space->machine, "P1");
173   state->in_1 = input_port_read(space->machine, "P2");
159174
160175}
161176
162177static READ8_HANDLER( cham24_IN1_r )
163178{
164   return ((in_1 >> in_1_shift++) & 0x01) | 0x40;
179   cham24_state *state = space->machine->driver_data<cham24_state>();
180   return ((state->in_1 >> state->in_1_shift++) & 0x01) | 0x40;
165181}
166182
167183static WRITE8_HANDLER( cham24_mapper_w )
r10613r10614
179195   memory_set_bankptr(space->machine, "bank1", space->machine->region("gfx1")->base() + (0x2000 * gfx_bank));
180196
181197   // set gfx mirroring
182   cham24_set_mirroring(gfx_mirroring != 0 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
198   cham24_set_mirroring(space->machine, gfx_mirroring != 0 ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
183199
184200   // switch PRG bank
185201   if (prg_bank_page_size == 0)
r10613r10614
279295
280296static MACHINE_START( cham24 )
281297{
298   cham24_state *state = machine->driver_data<cham24_state>();
282299   /* switch PRG rom */
283300   UINT8* dst = machine->region("maincpu")->base();
284301   UINT8* src = machine->region("user1")->base();
r10613r10614
291308   memory_set_bankptr(machine, "bank1", machine->region("gfx1")->base());
292309
293310   /* need nametable ram, though. I doubt this uses more than 2k, but it starts up configured for 4 */
294   nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
295   nt_page[0] = nt_ram;
296   nt_page[1] = nt_ram + 0x400;
297   nt_page[2] = nt_ram + 0x800;
298   nt_page[3] = nt_ram + 0xc00;
311   state->nt_ram = auto_alloc_array(machine, UINT8, 0x1000);
312   state->nt_page[0] = state->nt_ram;
313   state->nt_page[1] = state->nt_ram + 0x400;
314   state->nt_page[2] = state->nt_ram + 0x800;
315   state->nt_page[3] = state->nt_ram + 0xc00;
299316
300317   /* and read/write handlers */
301318   memory_install_readwrite8_handler(cpu_get_address_space(machine->device("ppu"), ADDRESS_SPACE_PROGRAM), 0x2000, 0x3eff, 0, 0, nt_r, nt_w);
r10613r10614
309326   /* none, the ppu generates one */
310327GFXDECODE_END
311328
312static MACHINE_CONFIG_START( cham24, driver_device )
329static MACHINE_CONFIG_START( cham24, cham24_state )
313330   /* basic machine hardware */
314331   MCFG_CPU_ADD("maincpu", N2A03, N2A03_DEFAULTCLOCK)
315332   MCFG_CPU_PROGRAM_MAP(cham24_map)
src/mame/drivers/sfbonus.c
r10613r10614
12671267   MCFG_SCREEN_SIZE(128*8, 64*8)
12681268   MCFG_SCREEN_VISIBLE_AREA(0*8, 512-1, 0*8, 288-1)
12691269   MCFG_SCREEN_UPDATE(sfbonus)
1270   
1270
12711271   MCFG_PALETTE_LENGTH(0x100*2) // *2 for priority workaraound / custom drawing
12721272
12731273   MCFG_VIDEO_START(sfbonus)
src/mame/drivers/lgp.c
r10613r10614
6868#include "render.h"
6969#include "machine/laserdsc.h"
7070
71
72class lgp_state : public driver_device
73{
74public:
75   lgp_state(running_machine &machine, const driver_device_config_base &config)
76      : driver_device(machine, config) { }
77
78   device_t *laserdisc;
79   UINT8 *tile_ram;
80   UINT8 *tile_control_ram;
81   emu_timer *irq_timer;
82};
83
84
7185/* From italiandoh's notes */
7286#define CPU_PCB_CLOCK (8000000)
7387#define SOUND_PCB_CLOCK (6000000)
7488
75/* Misc variables */
76static device_t *laserdisc;
7789
78static UINT8 *tile_ram;
79static UINT8 *tile_control_ram;
80
81static emu_timer *irq_timer;
82
83
8490/* VIDEO GOODS */
8591static SCREEN_UPDATE( lgp )
8692{
93   lgp_state *state = screen->machine->driver_data<lgp_state>();
8794   int charx, chary;
8895
8996   /* make color 0 transparent */
r10613r10614
102109         /* Somewhere there's a flag that offsets the tilemap by 0x100*x */
103110         /* Palette is likely set somewhere as well (tile_control_ram?) */
104111         drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[0],
105               tile_ram[current_screen_character],
112               state->tile_ram[current_screen_character],
106113               0,
107114               0, 0, charx*8, chary*8, 0);
108115      }
r10613r10614
116123/* Main Z80 R/W */
117124static READ8_HANDLER(ldp_read)
118125{
119   return laserdisc_data_r(laserdisc);
126   lgp_state *state = space->machine->driver_data<lgp_state>();
127   return laserdisc_data_r(state->laserdisc);
120128}
121129
122130static WRITE8_HANDLER(ldp_write)
123131{
124   laserdisc_data_w(laserdisc,data);
132   lgp_state *state = space->machine->driver_data<lgp_state>();
133   laserdisc_data_w(state->laserdisc,data);
125134}
126135
127136
r10613r10614
131140/* PROGRAM MAPS */
132141static ADDRESS_MAP_START( main_program_map, ADDRESS_SPACE_PROGRAM, 8 )
133142   AM_RANGE(0x0000,0x7fff) AM_ROM
134   AM_RANGE(0xe000,0xe3ff) AM_RAM AM_BASE(&tile_ram)
135   AM_RANGE(0xe400,0xe7ff) AM_RAM AM_BASE(&tile_control_ram)
143   AM_RANGE(0xe000,0xe3ff) AM_RAM AM_BASE_MEMBER(lgp_state, tile_ram)
144   AM_RANGE(0xe400,0xe7ff) AM_RAM AM_BASE_MEMBER(lgp_state, tile_control_ram)
136145
137146//  AM_RANGE(0xef00,0xef00) AM_READ_PORT("IN_TEST")
138147   AM_RANGE(0xef80,0xef80) AM_READWRITE(ldp_read,ldp_write)
r10613r10614
324333
325334static INTERRUPT_GEN( vblank_callback_lgp )
326335{
336   lgp_state *state = device->machine->driver_data<lgp_state>();
327337   // NMI
328338   //cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
329339
330340   // IRQ
331341   cpu_set_input_line(device, 0, ASSERT_LINE);
332   irq_timer->adjust(attotime::from_usec(50));
342   state->irq_timer->adjust(attotime::from_usec(50));
333343}
334344
335345
336346static MACHINE_START( lgp )
337347{
338   laserdisc = machine->device("laserdisc");
339    irq_timer = machine->scheduler().timer_alloc(FUNC(irq_stop));
348   lgp_state *state = machine->driver_data<lgp_state>();
349   state->laserdisc = machine->device("laserdisc");
350   state->irq_timer = machine->scheduler().timer_alloc(FUNC(irq_stop));
340351}
341352
342353
343354/* DRIVER */
344static MACHINE_CONFIG_START( lgp, driver_device )
355static MACHINE_CONFIG_START( lgp, lgp_state )
345356   /* main cpu */
346357   MCFG_CPU_ADD("maincpu", Z80, CPU_PCB_CLOCK)
347358   MCFG_CPU_PROGRAM_MAP(main_program_map)
src/mame/drivers/niyanpai.c
r10613r10614
5353#endif
5454
5555
56
57static int musobana_inputport;
58static int musobana_outcoin_flag;
59
60
6156static void niyanpai_soundbank_w(running_machine *machine, int data)
6257{
6358   UINT8 *SNDROM = machine->region("audiocpu")->base();
r10613r10614
8277
8378
8479/* TMPZ84C011 PIO emulation */
85static UINT8 pio_dir[5], pio_latch[5];
8680
8781static READ8_HANDLER( tmpz84c011_pio_r )
8882{
r10613r10614
141135}
142136
143137/* CPU interface */
144static READ8_HANDLER( tmpz84c011_0_pa_r )   { return (tmpz84c011_pio_r(space,0) & ~pio_dir[0]) | (pio_latch[0] & pio_dir[0]); }
145static READ8_HANDLER( tmpz84c011_0_pb_r )   { return (tmpz84c011_pio_r(space,1) & ~pio_dir[1]) | (pio_latch[1] & pio_dir[1]); }
146static READ8_HANDLER( tmpz84c011_0_pc_r )   { return (tmpz84c011_pio_r(space,2) & ~pio_dir[2]) | (pio_latch[2] & pio_dir[2]); }
147static READ8_HANDLER( tmpz84c011_0_pd_r )   { return (tmpz84c011_pio_r(space,3) & ~pio_dir[3]) | (pio_latch[3] & pio_dir[3]); }
148static READ8_HANDLER( tmpz84c011_0_pe_r )   { return (tmpz84c011_pio_r(space,4) & ~pio_dir[4]) | (pio_latch[4] & pio_dir[4]); }
138static READ8_HANDLER( tmpz84c011_0_pa_r )
139{
140   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
141   return (tmpz84c011_pio_r(space,0) & ~state->pio_dir[0]) | (state->pio_latch[0] & state->pio_dir[0]);
142}
149143
150static WRITE8_HANDLER( tmpz84c011_0_pa_w )   { pio_latch[0] = data; tmpz84c011_pio_w(space, 0, data); }
151static WRITE8_HANDLER( tmpz84c011_0_pb_w )   { pio_latch[1] = data; tmpz84c011_pio_w(space, 1, data); }
152static WRITE8_HANDLER( tmpz84c011_0_pc_w )   { pio_latch[2] = data; tmpz84c011_pio_w(space, 2, data); }
153static WRITE8_HANDLER( tmpz84c011_0_pd_w )   { pio_latch[3] = data; tmpz84c011_pio_w(space, 3, data); }
154static WRITE8_HANDLER( tmpz84c011_0_pe_w )   { pio_latch[4] = data; tmpz84c011_pio_w(space, 4, data); }
144static READ8_HANDLER( tmpz84c011_0_pb_r )
145{
146   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
147   return (tmpz84c011_pio_r(space,1) & ~state->pio_dir[1]) | (state->pio_latch[1] & state->pio_dir[1]);
148}
155149
156static READ8_HANDLER( tmpz84c011_0_dir_pa_r )   { return pio_dir[0]; }
157static READ8_HANDLER( tmpz84c011_0_dir_pb_r )   { return pio_dir[1]; }
158static READ8_HANDLER( tmpz84c011_0_dir_pc_r )   { return pio_dir[2]; }
159static READ8_HANDLER( tmpz84c011_0_dir_pd_r )   { return pio_dir[3]; }
160static READ8_HANDLER( tmpz84c011_0_dir_pe_r )   { return pio_dir[4]; }
150static READ8_HANDLER( tmpz84c011_0_pc_r )
151{
152   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
153   return (tmpz84c011_pio_r(space,2) & ~state->pio_dir[2]) | (state->pio_latch[2] & state->pio_dir[2]);
154}
161155
162static WRITE8_HANDLER( tmpz84c011_0_dir_pa_w )   { pio_dir[0] = data; }
163static WRITE8_HANDLER( tmpz84c011_0_dir_pb_w )   { pio_dir[1] = data; }
164static WRITE8_HANDLER( tmpz84c011_0_dir_pc_w )   { pio_dir[2] = data; }
165static WRITE8_HANDLER( tmpz84c011_0_dir_pd_w )   { pio_dir[3] = data; }
166static WRITE8_HANDLER( tmpz84c011_0_dir_pe_w )   { pio_dir[4] = data; }
156static READ8_HANDLER( tmpz84c011_0_pd_r )
157{
158   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
159   return (tmpz84c011_pio_r(space,3) & ~state->pio_dir[3]) | (state->pio_latch[3] & state->pio_dir[3]);
160}
167161
162static READ8_HANDLER( tmpz84c011_0_pe_r )
163{
164   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
165   return (tmpz84c011_pio_r(space,4) & ~state->pio_dir[4]) | (state->pio_latch[4] & state->pio_dir[4]);
166}
168167
168static WRITE8_HANDLER( tmpz84c011_0_pa_w )
169{
170   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
171   state->pio_latch[0] = data;
172   tmpz84c011_pio_w(space, 0, data);
173}
174
175static WRITE8_HANDLER( tmpz84c011_0_pb_w )
176{
177   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
178   state->pio_latch[1] = data;
179   tmpz84c011_pio_w(space, 1, data);
180}
181static WRITE8_HANDLER( tmpz84c011_0_pc_w )
182{
183   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
184   state->pio_latch[2] = data;
185   tmpz84c011_pio_w(space, 2, data);
186}
187
188static WRITE8_HANDLER( tmpz84c011_0_pd_w )
189{
190   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
191   state->pio_latch[3] = data;
192   tmpz84c011_pio_w(space, 3, data);
193}
194
195static WRITE8_HANDLER( tmpz84c011_0_pe_w )
196{
197   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
198   state->pio_latch[4] = data;
199   tmpz84c011_pio_w(space, 4, data);
200}
201
202static READ8_HANDLER( tmpz84c011_0_dir_pa_r )
203{
204   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
205   return state->pio_dir[0];
206}
207
208static READ8_HANDLER( tmpz84c011_0_dir_pb_r )
209{
210   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
211   return state->pio_dir[1];
212}
213
214static READ8_HANDLER( tmpz84c011_0_dir_pc_r )
215{
216   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
217   return state->pio_dir[2];
218}
219
220static READ8_HANDLER( tmpz84c011_0_dir_pd_r )
221{
222   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
223   return state->pio_dir[3];
224}
225
226static READ8_HANDLER( tmpz84c011_0_dir_pe_r )
227{
228   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
229   return state->pio_dir[4];
230}
231
232static WRITE8_HANDLER( tmpz84c011_0_dir_pa_w )
233{
234   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
235   state->pio_dir[0] = data;
236}
237
238static WRITE8_HANDLER( tmpz84c011_0_dir_pb_w )
239{
240   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
241   state->pio_dir[1] = data;
242}
243
244static WRITE8_HANDLER( tmpz84c011_0_dir_pc_w )
245{
246   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
247   state->pio_dir[2] = data;
248}
249
250static WRITE8_HANDLER( tmpz84c011_0_dir_pd_w )
251{
252   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
253   state->pio_dir[3] = data;
254}
255
256static WRITE8_HANDLER( tmpz84c011_0_dir_pe_w )
257{
258   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
259   state->pio_dir[4] = data;
260}
261
262
169263static Z80CTC_INTERFACE( ctc_intf )
170264{
171265   0,                     /* timer disables */
r10613r10614
177271
178272static MACHINE_RESET( niyanpai )
179273{
274   niyanpai_state *state = machine->driver_data<niyanpai_state>();
180275   address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
181276   int i;
182277
183278   // initialize TMPZ84C011 PIO
184279   for (i = 0; i < 5; i++)
185280   {
186      pio_dir[i] = pio_latch[i] = 0;
281      state->pio_dir[i] = state->pio_latch[i] = 0;
187282      tmpz84c011_pio_w(space, i, 0);
188283   }
189284}
190285
191286static DRIVER_INIT( niyanpai )
192287{
288   niyanpai_state *state = machine->driver_data<niyanpai_state>();
193289   UINT8 *SNDROM = machine->region("audiocpu")->base();
194290
195291   // sound program patch
r10613r10614
199295   niyanpai_soundbank_w(machine, 0);
200296
201297   // initialize out coin flag (musobana)
202   musobana_outcoin_flag = 1;
298   state->musobana_outcoin_flag = 1;
203299}
204300
205301
r10613r10614
222318
223319static READ16_HANDLER( musobana_inputport_0_r )
224320{
321   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
225322   int portdata;
226323
227   switch ((musobana_inputport ^ 0xff00) >> 8)
324   switch ((state->musobana_inputport ^ 0xff00) >> 8)
228325   {
229326      case 0x01:   portdata = input_port_read(space->machine, "KEY0"); break;
230327      case 0x02:   portdata = input_port_read(space->machine, "KEY1"); break;
r10613r10614
240337
241338static CUSTOM_INPUT( musobana_outcoin_flag_r )
242339{
340   niyanpai_state *state = field->port->machine->driver_data<niyanpai_state>();
243341   address_space *space = cputag_get_address_space(field->port->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
244342   // tmp68301_parallel_interface[0x05]
245343   //  bit 0   coin counter
246344   //  bit 2   motor on
247345   //  bit 3   coin lock
248346
249   if (tmp68301_parallel_interface_r(space, 0x0005, 0x00ff) & 0x0004) musobana_outcoin_flag ^= 1;
250   else musobana_outcoin_flag = 1;
347   if (tmp68301_parallel_interface_r(space, 0x0005, 0x00ff) & 0x0004) state->musobana_outcoin_flag ^= 1;
348   else state->musobana_outcoin_flag = 1;
251349
252   return musobana_outcoin_flag & 0x01;
350   return state->musobana_outcoin_flag & 0x01;
253351}
254352
255353static WRITE16_HANDLER ( musobana_inputport_w )
256354{
257   musobana_inputport = data;
355   niyanpai_state *state = space->machine->driver_data<niyanpai_state>();
356   state->musobana_inputport = data;
258357}
259358
260359static ADDRESS_MAP_START( tmp68301_regs, ADDRESS_SPACE_PROGRAM, 16 )
r10613r10614
765864};
766865
767866
768static MACHINE_CONFIG_START( niyanpai, driver_device )
867static MACHINE_CONFIG_START( niyanpai, niyanpai_state )
769868
770869   /* basic machine hardware */
771870   MCFG_CPU_ADD("maincpu", M68000, 12288000/2)   /* TMP68301, 6.144 MHz */
src/mame/drivers/suprnova.c
r10613r10614
3333
3434video:   Sprite positions still kludged slightly (see skns_sprite_kludge)
3535
36general: bios is still being skipped, gets stuck at last bios screen if we run it (see #define BIOS_SKIP)   
36general: bios is still being skipped, gets stuck at last bios screen if we run it (see #define BIOS_SKIP)
3737
3838------------------
3939
src/mame/drivers/dynax.c
r10613r10614
49584958   MCFG_SCREEN_SIZE(512, 256)
49594959   MCFG_SCREEN_VISIBLE_AREA(4, 512-1, 4, 255-8-4)   // hide first 4 horizontal pixels (see scroll of gal 4 in test mode)
49604960   MCFG_SCREEN_UPDATE(hnoridur)
4961   
4961
49624962   MCFG_PALETTE_LENGTH(16*256)
49634963
49644964   MCFG_VIDEO_START(mjelctrn)
r10613r10614
50275027   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
50285028   MCFG_SCREEN_SIZE(256, 256)
50295029   MCFG_SCREEN_VISIBLE_AREA(2, 256-1, 16, 256-1)
5030   MCFG_SCREEN_UPDATE(mjdialq2)   
5030   MCFG_SCREEN_UPDATE(mjdialq2)
50315031
50325032   MCFG_PALETTE_LENGTH(512)
50335033   MCFG_PALETTE_INIT(sprtmtch)         // static palette
src/mame/drivers/sigmab98.c
r10613r10614
7070
7171To Do:
7272
73- KL5C80 emulation is needed to consolidate the sammymdl games in one memory map and to run the BIOS
7374- Remove ROM patches from gegege
7475- gegege checks the EEPROM output after reset, and wants a timed 0->1 transition or locks up while
7576  saving setting in service mode. Using a reset_delay of 7 works, unless when "play style" is set
7677  to "coin" (it probably changes the number of reads from port $C0).
7778  I guess the reset_delay mechanism should be implemented with a timer in eeprom.c.
79- animalc needs a green backgound during part of the intro (floating animals in and out of the screen).
80  This can be achieved using either pen 0 or ff as background color, but messes up the other games.
81- pyenaget intro: when the theater scrolls out to the left, the train should scroll in from the right,
82  with no visible gaps. It currently leaves the screen empty instead, for several seconds.
7883
7984Notes:
8085
r10613r10614
347352static void show_outputs()
348353{
349354#ifdef MAME_DEBUG
350//   popmessage("0: %02X  4: %02X  6: %02X  8: %02X",c0,c4,c6,c8);
355//  popmessage("0: %02X  4: %02X  6: %02X  8: %02X",c0,c4,c6,c8);
351356#endif
352357}
353358
r10613r10614
600605static void show_3_outputs()
601606{
602607#ifdef MAME_DEBUG
603//   popmessage("COIN: %02X  LED: %02X  HOP: %02X", out[0], out[1], out[2]);
608//  popmessage("COIN: %02X  LED: %02X  HOP: %02X", out[0], out[1], out[2]);
604609#endif
605610}
606611// Port 31
r10613r10614
610615   coin_counter_w(space->machine, 1,   data  & 0x02 );   // coin2 in
611616   coin_counter_w(space->machine, 2,   data  & 0x04 );   // medal in
612617
613//   coin_lockout_w(space->machine, 1, (~data) & 0x08 );   // coin2 lockout?
614//   coin_lockout_w(space->machine, 0, (~data) & 0x10 );   // coin1 lockout
615//   coin_lockout_w(space->machine, 2, (~data) & 0x20 );   // medal lockout?
618//  coin_lockout_w(space->machine, 1, (~data) & 0x08 ); // coin2 lockout?
619//  coin_lockout_w(space->machine, 0, (~data) & 0x10 ); // coin1 lockout
620//  coin_lockout_w(space->machine, 2, (~data) & 0x20 ); // medal lockout?
616621
617622   out[0] = data;
618623   show_3_outputs();
r10613r10614
648653   return ret;
649654}
650655
651// Sound
652static WRITE8_DEVICE_HANDLER( sammymdl_sound_w )
653{
654   if (offset)
655      downcast<okim9810_device *>(device)->write_TMP_register(data);
656    else
657      downcast<okim9810_device *>(device)->write_command(data);
658}
659static READ8_DEVICE_HANDLER( sammymdl_sound_r )
660{
661   // Needed for haekaka (Oki read status is not implemented yet)
662   return device->machine->rand();
663}
664
665656static UINT8 *nvram;
666657static ADDRESS_MAP_START( animalc_map, ADDRESS_SPACE_PROGRAM, 8 )
667658   AM_RANGE( 0x0000, 0x3fff ) AM_ROM
r10613r10614
692683   AM_RANGE( 0x31, 0x31 ) AM_WRITE( sammymdl_coin_w )
693684   AM_RANGE( 0x32, 0x32 ) AM_WRITE( sammymdl_leds_w )
694685   AM_RANGE( 0x34, 0x34 ) AM_READ( unk_34_r )
695   AM_RANGE( 0x90, 0x91 ) AM_DEVWRITE("oki", sammymdl_sound_w )
696   AM_RANGE( 0x92, 0x92 ) AM_DEVWRITE("oki", sammymdl_sound_r )
686   AM_RANGE( 0x90, 0x90 ) AM_DEVWRITE_MODERN("oki", okim9810_device, write )
687   AM_RANGE( 0x91, 0x91 ) AM_DEVWRITE_MODERN("oki", okim9810_device, write_TMP_register )
688   AM_RANGE( 0x92, 0x92 ) AM_DEVREAD_MODERN("oki", okim9810_device, read )
697689   AM_RANGE( 0xb0, 0xb0 ) AM_WRITE( sammymdl_hopper_w )
698690   AM_RANGE( 0xc0, 0xc0 ) AM_WRITE( watchdog_reset_w )   // 1
699691ADDRESS_MAP_END
r10613r10614
836828      case 0x65:   // SPRITERAM
837829         if (offset < 0x1000)
838830            return space->machine->generic.spriteram.u8[offset];
839         
831
840832      case 0x67:   // PALETTERAM + TABLE? + REGS
841833         if (offset < 0x200)
842834            return space->machine->generic.paletteram.u8[offset];
r10613r10614
860852            return;
861853         }
862854         break;
863         
855
864856      case 0x67:   // PALETTERAM + TABLE? + REGS
865857         if (offset < 0x200)
866858         {
867859            paletteram_xRRRRRGGGGGBBBBB_be_w(space, offset, data);
868//            space->machine->generic.paletteram.u8[offset] = data;
860//              space->machine->generic.paletteram.u8[offset] = data;
869861            return;
870862         }
871863         else if ((offset >= 0x800) && (offset < 0x880))
r10613r10614
898890static WRITE8_HANDLER( haekaka_coin_w )
899891{
900892   coin_counter_w(space->machine, 0,   data & 0x01 );   // medal out
901//                              data & 0x02 ?
902//                              data & 0x04 ?
903//                              data & 0x10 ?
893//                                      data & 0x02 ?
894//                                      data & 0x04 ?
895//                                      data & 0x10 ?
904896
905897   out[0] = data;
906898   show_3_outputs();
r10613r10614
923915   AM_RANGE( 0x30, 0x30 ) AM_READ_PORT( "BUTTON" )
924916   AM_RANGE( 0x31, 0x31 ) AM_WRITE( haekaka_coin_w )
925917   AM_RANGE( 0x32, 0x32 ) AM_WRITE( haekaka_leds_w )
926   AM_RANGE( 0x90, 0x91 ) AM_DEVWRITE("oki", sammymdl_sound_w )
927   AM_RANGE( 0x92, 0x92 ) AM_DEVWRITE("oki", sammymdl_sound_r )
918   AM_RANGE( 0x90, 0x90 ) AM_DEVWRITE_MODERN("oki", okim9810_device, write )
919   AM_RANGE( 0x91, 0x91 ) AM_DEVWRITE_MODERN("oki", okim9810_device, write_TMP_register )
920   AM_RANGE( 0x92, 0x92 ) AM_DEVREAD_MODERN("oki", okim9810_device, read )
928921   AM_RANGE( 0xb0, 0xb0 ) AM_WRITE( sammymdl_hopper_w )
929922   AM_RANGE( 0xc0, 0xc0 ) AM_WRITE( watchdog_reset_w )   // 1
930923ADDRESS_MAP_END
r10613r10614
11601153   AM_RANGE( 0x30, 0x30 ) AM_READ_PORT( "BUTTON" )
11611154   AM_RANGE( 0x31, 0x31 ) AM_WRITE( sammymdl_coin_w )
11621155   AM_RANGE( 0x32, 0x32 ) AM_WRITE( sammymdl_leds_w )
1163   AM_RANGE( 0x90, 0x91 ) AM_DEVWRITE("oki", sammymdl_sound_w )
1164   AM_RANGE( 0x92, 0x92 ) AM_DEVWRITE("oki", sammymdl_sound_r )
1156   AM_RANGE( 0x90, 0x90 ) AM_DEVWRITE_MODERN("oki", okim9810_device, write )
1157   AM_RANGE( 0x91, 0x91 ) AM_DEVWRITE_MODERN("oki", okim9810_device, write_TMP_register )
1158   AM_RANGE( 0x92, 0x92 ) AM_DEVREAD_MODERN("oki", okim9810_device, read )
11651159   AM_RANGE( 0xb0, 0xb0 ) AM_WRITE( sammymdl_hopper_w )
11661160   AM_RANGE( 0xc0, 0xc0 ) AM_WRITE( watchdog_reset_w )   // 1
11671161ADDRESS_MAP_END
r10613r10614
13371331            return;
13381332         }
13391333         break;
1340         
1334
13411335      case 0x66:   // PALETTERAM + TABLE?
13421336         if (offset < 0x200)
13431337         {
13441338            paletteram_xRRRRRGGGGGBBBBB_be_w(space, offset, data);
1345//            space->machine->generic.paletteram.u8[offset] = data;
1339//              space->machine->generic.paletteram.u8[offset] = data;
13461340            return;
13471341         }
13481342         else if ((offset >= 0x800) && (offset < 0x880))
r10613r10614
13731367   AM_RANGE( 0x30, 0x30 ) AM_READ_PORT( "BUTTON" )
13741368   AM_RANGE( 0x31, 0x31 ) AM_WRITE( sammymdl_coin_w )
13751369   AM_RANGE( 0x32, 0x32 ) AM_WRITE( sammymdl_leds_w )
1376   AM_RANGE( 0x90, 0x91 ) AM_DEVWRITE("oki", sammymdl_sound_w )
1377   AM_RANGE( 0x92, 0x92 ) AM_DEVWRITE("oki", sammymdl_sound_r )
1370   AM_RANGE( 0x90, 0x90 ) AM_DEVWRITE_MODERN("oki", okim9810_device, write )
1371   AM_RANGE( 0x91, 0x91 ) AM_DEVWRITE_MODERN("oki", okim9810_device, write_TMP_register )
1372   AM_RANGE( 0x92, 0x92 ) AM_DEVREAD_MODERN("oki", okim9810_device, read )
13781373   AM_RANGE( 0xb0, 0xb0 ) AM_WRITE( sammymdl_hopper_w )
13791374   AM_RANGE( 0xc0, 0xc0 ) AM_WRITE( watchdog_reset_w )   // 1
13801375ADDRESS_MAP_END
r10613r10614
15911586
15921587static MACHINE_CONFIG_START( sammymdl, driver_device )
15931588   MCFG_CPU_ADD("maincpu", Z80, XTAL_20MHz / 2)   // !! KL5C80A120FP @ 10MHz? (actually 4 times faster than Z80) !!
1589   MCFG_CPU_PROGRAM_MAP( animalc_map )
1590   MCFG_CPU_IO_MAP( animalc_io )
15941591
15951592   MCFG_MACHINE_RESET( sammymdl )
15961593
r10613r10614
16151612   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
16161613
16171614   MCFG_OKIM9810_ADD("oki", XTAL_4_096MHz)
1618   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.80)
1619   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.80)
1615   MCFG_SOUND_ROUTE(0, "lspeaker", 0.80)
1616   MCFG_SOUND_ROUTE(1, "rspeaker", 0.80)
16201617MACHINE_CONFIG_END
16211618
16221619
r10613r10614
18611858
18621859***************************************************************************/
18631860
1861#define SAMMYMDL_BIOS                                                                        \
1862   ROM_REGION( 0x80000, "mainbios", 0 )                                                         \
1863   ROM_SYSTEM_BIOS( 0, "v5", "IPL Ver. 5.0" )                                                      \
1864   ROM_LOAD( "vm1211l01.u2", 0x000000, 0x080000, CRC(c3c74dc5) SHA1(07352e6dba7514214e778ba39e1ca773e4698858) )
18641865
1866ROM_START( sammymdl )
1867   SAMMYMDL_BIOS
1868
1869   ROM_REGION( 0x1000000, "oki", ROMREGION_ERASEFF )
1870
1871   ROM_REGION( 0x40000, "maincpu", ROMREGION_ERASEFF )
1872
1873   ROM_REGION( 0x200000, "sprites", ROMREGION_ERASEFF )
1874ROM_END
1875
18651876/***************************************************************************
18661877
18671878  Animal Catch ( VX2002L02 ANIMALCAT 200011211536 SAMMY CORP. AM )
r10613r10614
18731884***************************************************************************/
18741885
18751886ROM_START( animalc )
1887   SAMMYMDL_BIOS
1888
18761889   ROM_REGION( 0x1000000, "oki", 0 )
18771890   ROM_LOAD( "vx2302l01.u021", 0x00000, 0x200000, CRC(84cf123b) SHA1(d8b425c93ff1a560e3f92c70d7eb93a05c3581af) )
18781891
r10613r10614
19081921***************************************************************************/
19091922
19101923ROM_START( itazuram )
1924   SAMMYMDL_BIOS
1925
19111926   ROM_REGION( 0x1000000, "oki", 0 )
19121927   ROM_LOAD( "vx2002l01.u021", 0x00000, 0x200000, CRC(ddbdd2f3) SHA1(91f67a938929be0261442e066e3d2c03b5e9f06a) )
19131928
r10613r10614
19631978***************************************************************************/
19641979
19651980ROM_START( tdoboon )
1981   SAMMYMDL_BIOS
1982
19661983   ROM_REGION( 0x1000000, "oki", 0 )
19671984   ROM_LOAD( "em4210l01.u021.bin", 0x00000, 0x200000, CRC(3523e314) SHA1(d07c5d17d3f285be4cde810547f427e84f98968f) )
19681985
r10613r10614
19832000***************************************************************************/
19842001
19852002ROM_START( pyenaget )
2003   SAMMYMDL_BIOS
2004
19862005   ROM_REGION( 0x1000000, "oki", 0 )
19872006   ROM_LOAD( "vx1802l01.u021", 0x00000, 0x200000, CRC(7a22a657) SHA1(2a98085862fd958209253c5401e41eae4f7c06ea) )
19882007
r10613r10614
20172036***************************************************************************/
20182037
20192038ROM_START( haekaka )
2039   SAMMYMDL_BIOS
2040
20202041   ROM_REGION( 0x1000000, "oki", 0 )
20212042   ROM_LOAD( "em4208l01.u021.bin", 0x00000, 0x200000, CRC(d23bb748) SHA1(38d5b6c4b2cd470b3a68574aeca3f9fa9032245e) )
20222043
r10613r10614
20482069
20492070***************************************************************************/
20502071
2051GAME( 1997, gegege,   0, gegege,   gegege,   gegege,   ROT0, "Banpresto / Sigma", "GeGeGe no Kitarou Youkai Slot", 0                    )
2072GAME( 1997, gegege,   0,        gegege,   gegege,   gegege,   ROT0, "Banpresto / Sigma", "GeGeGe no Kitarou Youkai Slot", 0 )
20522073// Sammy Medal Games:
2053GAME( 2000, animalc,  0, animalc,  sammymdl, animalc,  ROT0, "Sammy",             "Animal Catch",                  GAME_IMPERFECT_SOUND )
2054GAME( 2000, itazuram, 0, itazuram, sammymdl, itazuram, ROT0, "Sammy",             "Itazura Monkey",                GAME_IMPERFECT_SOUND )
2055GAME( 2000, pyenaget, 0, pyenaget, sammymdl, haekaka,  ROT0, "Sammy",             "Pye-nage Taikai",               GAME_IMPERFECT_SOUND )
2056GAME( 2000, tdoboon,  0, tdoboon,  haekaka,  haekaka,  ROT0, "Sammy",             "Taihou de Doboon",              GAME_IMPERFECT_SOUND )
2057GAME( 2001, haekaka,  0, haekaka,  haekaka,  haekaka,  ROT0, "Sammy",             "Hae Hae Ka Ka Ka",              GAME_IMPERFECT_SOUND )
2074GAME( 2000, sammymdl, 0,        sammymdl, sammymdl, 0,        ROT0, "Sammy",             "Sammy Medal Game System Bios",  GAME_IS_BIOS_ROOT )
2075GAME( 2000, animalc,  sammymdl, animalc,  sammymdl, animalc,  ROT0, "Sammy",             "Animal Catch",                  0 )
2076GAME( 2000, itazuram, sammymdl, itazuram, sammymdl, itazuram, ROT0, "Sammy",             "Itazura Monkey",                0 )
2077GAME( 2000, pyenaget, sammymdl, pyenaget, sammymdl, haekaka,  ROT0, "Sammy",             "Pye-nage Taikai",               0 )
2078GAME( 2000, tdoboon,  sammymdl, tdoboon,  haekaka,  haekaka,  ROT0, "Sammy",             "Taihou de Doboon",              0 )
2079GAME( 2001, haekaka,  sammymdl, haekaka,  haekaka,  haekaka,  ROT0, "Sammy",             "Hae Hae Ka Ka Ka",              0 )
src/mame/drivers/galpanic.c
r10613r10614
924924   /* video hardware */
925925   MCFG_SCREEN_MODIFY("screen")
926926   MCFG_SCREEN_UPDATE(comad)
927   MCFG_SCREEN_EOF(0)
927928MACHINE_CONFIG_END
928929
929930static MACHINE_CONFIG_DERIVED( supmodel, comad )
r10613r10614
937938   /* video hardware */
938939   MCFG_SCREEN_MODIFY("screen")
939940   MCFG_SCREEN_UPDATE(comad)
941   MCFG_SCREEN_EOF(0)
940942
941943   /* sound hardware */
942944   MCFG_OKIM6295_REPLACE("oki", 1584000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
r10613r10614
954956   /* video hardware */
955957   MCFG_SCREEN_MODIFY("screen")
956958   MCFG_SCREEN_UPDATE(comad)
959   MCFG_SCREEN_EOF(0)
957960MACHINE_CONFIG_END
958961
959962static MACHINE_CONFIG_DERIVED( galhustl, comad )
r10613r10614
967970   /* video hardware */
968971   MCFG_SCREEN_MODIFY("screen")
969972   MCFG_SCREEN_UPDATE(comad)
973   MCFG_SCREEN_EOF(0)
970974
971975   /* sound hardware */
972976   MCFG_OKIM6295_REPLACE("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
src/mame/drivers/armedf.c
r10613r10614
10471047   MCFG_SCREEN_VISIBLE_AREA(14*8, (64-14)*8-1, 2*8, 30*8-1 )
10481048   MCFG_SCREEN_UPDATE(armedf)
10491049   MCFG_SCREEN_EOF(armedf)
1050   
1050
10511051   MCFG_GFXDECODE(armedf)
10521052   MCFG_PALETTE_LENGTH(2048)
10531053
src/mame/drivers/pcat_dyn.c
r10613r10614
1818
1919#include "emu.h"
2020#include "cpu/i386/i386.h"
21#include "memconv.h"
22#include "devconv.h"
23#include "machine/8237dma.h"
2421#include "machine/pic8259.h"
2522#include "machine/pit8253.h"
2623#include "machine/mc146818.h"
27#include "machine/pcshare.h"
28#include "machine/pci.h"
2924#include "machine/8042kbdc.h"
30#include "machine/pckeybrd.h"
31#include "machine/idectrl.h"
32#include "sound/beep.h"
25#include "machine/pcshare.h"
26#include "video/pc_vga.h"
27#include "video/pc_video.h"
3328
34static UINT32 *vga_vram;
35static UINT8 vga_regs[0x19];
36
37#define SET_VISIBLE_AREA(_x_,_y_) \
38   { \
39   rectangle visarea; \
40   visarea.min_x = 0; \
41   visarea.max_x = _x_-1; \
42   visarea.min_y = 0; \
43   visarea.max_y = _y_-1; \
44   machine->primary_screen->configure(_x_, _y_, visarea, machine->primary_screen->frame_period().attoseconds ); \
45   } \
46
47#define RES_320x200 0
48#define RES_640x200 1
49
50static VIDEO_START(pcat_dyn)
51{
52}
53
54
55
56static void cga_alphanumeric_tilemap(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,UINT16 size,UINT32 map_offs,UINT8 gfx_num)
57{
58   static UINT32 offs,x,y,max_x,max_y;
59   int tile,color;
60
61   /*define the visible area*/
62   switch(size)
63   {
64      case RES_320x200:
65         SET_VISIBLE_AREA(320,200);
66         max_x = 40;
67         max_y = 25;
68         break;
69      case RES_640x200:
70         SET_VISIBLE_AREA(640,200);
71         max_x = 80;
72         max_y = 25;
73         break;
74   }
75
76   offs = map_offs;
77
78   for(y=0;y<max_y;y++)
79      for(x=0;x<max_x;x+=2)
80      {
81         tile =  (vga_vram[offs] & 0x00ff0000)>>16;
82         color = (vga_vram[offs] & 0xff000000)>>24;
83
84         drawgfx_opaque(bitmap,cliprect,machine->gfx[gfx_num],
85               tile,
86               color,
87               0,0,
88               (x+1)*8,y*8);
89
90
91         tile =  (vga_vram[offs] & 0x000000ff);
92         color = (vga_vram[offs] & 0x0000ff00)>>8;
93
94         drawgfx_opaque(bitmap,cliprect,machine->gfx[gfx_num],
95               tile,
96               color,
97               0,0,
98               (x+0)*8,y*8);
99
100         offs++;
101      }
102}
103
104static SCREEN_UPDATE(pcat_dyn)
105{
106   cga_alphanumeric_tilemap(screen->machine,bitmap,cliprect,RES_640x200,0x10000/4,0);
107
108   return 0;
109}
110
111static struct {
112   device_t   *pit8253;
113   device_t   *pic8259_1;
114   device_t   *pic8259_2;
115   device_t   *dma8237_1;
116   device_t   *dma8237_2;
117} pcat_dyn_devices;
118
119/******************
120DMA8237 Controller
121******************/
122
123static int dma_channel;
124static UINT8 dma_offset[2][4];
125static UINT8 at_pages[0x10];
126
127
128static READ8_HANDLER(dma_page_select_r)
129{
130   UINT8 data = at_pages[offset % 0x10];
131
132   switch(offset % 8)
133   {
134   case 1:
135      data = dma_offset[(offset / 8) & 1][2];
136      break;
137   case 2:
138      data = dma_offset[(offset / 8) & 1][3];
139      break;
140   case 3:
141      data = dma_offset[(offset / 8) & 1][1];
142      break;
143   case 7:
144      data = dma_offset[(offset / 8) & 1][0];
145      break;
146   }
147   return data;
148}
149
150
151static WRITE8_HANDLER(dma_page_select_w)
152{
153   at_pages[offset % 0x10] = data;
154
155   switch(offset % 8)
156   {
157   case 1:
158      dma_offset[(offset / 8) & 1][2] = data;
159      break;
160   case 2:
161      dma_offset[(offset / 8) & 1][3] = data;
162      break;
163   case 3:
164      dma_offset[(offset / 8) & 1][1] = data;
165      break;
166   case 7:
167      dma_offset[(offset / 8) & 1][0] = data;
168      break;
169   }
170}
171
172
173static WRITE_LINE_DEVICE_HANDLER( pc_dma_hrq_changed )
174{
175   cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
176
177   /* Assert HLDA */
178   i8237_hlda_w( device, state );
179}
180
181
182static READ8_HANDLER( pc_dma_read_byte )
183{
184   offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
185      & 0xFF0000;
186
187   return space->read_byte(page_offset + offset);
188}
189
190
191static WRITE8_HANDLER( pc_dma_write_byte )
192{
193   offs_t page_offset = (((offs_t) dma_offset[0][dma_channel]) << 16)
194      & 0xFF0000;
195
196   space->write_byte(page_offset + offset, data);
197}
198
199static void set_dma_channel(device_t *device, int channel, int state)
200{
201   if (!state) dma_channel = channel;
202}
203
204static WRITE_LINE_DEVICE_HANDLER( pc_dack0_w ) { set_dma_channel(device, 0, state); }
205static WRITE_LINE_DEVICE_HANDLER( pc_dack1_w ) { set_dma_channel(device, 1, state); }
206static WRITE_LINE_DEVICE_HANDLER( pc_dack2_w ) { set_dma_channel(device, 2, state); }
207static WRITE_LINE_DEVICE_HANDLER( pc_dack3_w ) { set_dma_channel(device, 3, state); }
208
209static I8237_INTERFACE( dma8237_1_config )
210{
211   DEVCB_LINE(pc_dma_hrq_changed),
212   DEVCB_NULL,
213   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_read_byte),
214   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, pc_dma_write_byte),
215   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
216   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
217   { DEVCB_LINE(pc_dack0_w), DEVCB_LINE(pc_dack1_w), DEVCB_LINE(pc_dack2_w), DEVCB_LINE(pc_dack3_w) }
218};
219
220static I8237_INTERFACE( dma8237_2_config )
221{
222   DEVCB_NULL,
223   DEVCB_NULL,
224   DEVCB_NULL,
225   DEVCB_NULL,
226   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
227   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
228   { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }
229};
230
231
232/******************
2338259 IRQ controller
234******************/
235
236static WRITE_LINE_DEVICE_HANDLER( pic8259_1_set_int_line )
237{
238   cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE);
239}
240
241static const struct pic8259_interface pic8259_1_config =
242{
243   DEVCB_LINE(pic8259_1_set_int_line)
244};
245
246static const struct pic8259_interface pic8259_2_config =
247{
248   DEVCB_DEVICE_LINE("pic8259_1", pic8259_ir2_w)
249};
250
251static IRQ_CALLBACK(irq_callback)
252{
253   int r = 0;
254   r = pic8259_acknowledge(pcat_dyn_devices.pic8259_2);
255   if (r==0)
256   {
257      r = pic8259_acknowledge(pcat_dyn_devices.pic8259_1);
258   }
259   return r;
260}
261
262static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out0_changed )
263{
264   if ( pcat_dyn_devices.pic8259_1 )
265   {
266      pic8259_ir0_w(pcat_dyn_devices.pic8259_1, state);
267   }
268}
269
270
271static WRITE_LINE_DEVICE_HANDLER( at_pit8254_out2_changed )
272{
273   //at_speaker_set_input( state ? 1 : 0 );
274}
275
276
277static const struct pit8253_config at_pit8254_config =
278{
279   {
280      {
281         4772720/4,            /* heartbeat IRQ */
282         DEVCB_NULL,
283         DEVCB_LINE(at_pit8254_out0_changed)
284      }, {
285         4772720/4,            /* dram refresh */
286         DEVCB_NULL,
287         DEVCB_NULL
288      }, {
289         4772720/4,            /* pio port c pin 4, and speaker polling enough */
290         DEVCB_NULL,
291         DEVCB_LINE(at_pit8254_out2_changed)
292      }
293   }
294};
295
29629//ce9b8
29730/* TODO: understand the proper ROM loading.*/
29831static ADDRESS_MAP_START( pcat_map, ADDRESS_SPACE_PROGRAM, 32 )
29932   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
300   AM_RANGE(0x000a0000, 0x000bffff) AM_RAM AM_BASE(&vga_vram)
301   AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0)
33   AM_RANGE(0x000a0000, 0x000bffff) AM_RAM
34   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0)
30235   AM_RANGE(0x000c8000, 0x000cffff) AM_RAM
30336//  AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM AM_REGION("disk_bios", 0)
30437//  AM_RANGE(0x000d8000, 0x000dffff) AM_RAM AM_REGION("disk_bios", 0)
30538//  AM_RANGE(0x000e0000, 0x000effff) AM_ROM AM_REGION("game_prg", 0)
30639   AM_RANGE(0x000f0000, 0x000fffff) AM_ROM AM_REGION("bios", 0 )
30740   AM_RANGE(0x00100000, 0x001fffff) AM_RAM //AM_REGION("game_prg", 0)
308   AM_RANGE(0x00200000, 0x00ffffff) AM_RAM
309   AM_RANGE(0x01000000, 0x01ffffff) AM_RAM
41//  AM_RANGE(0x00200000, 0x00ffffff) AM_RAM
42   //AM_RANGE(0x01000000, 0x01ffffff) AM_RAM
31043   AM_RANGE(0xffff0000, 0xffffffff) AM_ROM AM_REGION("bios", 0 )
31144ADDRESS_MAP_END
31245
313
314static READ32_HANDLER( kludge_r )
315{
316   return space->machine->rand();
317}
318
319/* 3c8-3c9 -> ramdac*/
320static WRITE32_HANDLER( vga_ramdac_w )
321{
322   static int pal_offs,r,g,b,internal_pal_offs;
323
324   if (ACCESSING_BITS_0_7)
325   {
326      //printf("%02x X\n",data);
327      pal_offs = internal_pal_offs = data;
328   }
329   if (ACCESSING_BITS_8_15)
330   {
331      //printf("%02x\n",data);
332      data>>=8;
333      switch(internal_pal_offs)
334      {
335         case 0:
336            r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
337            internal_pal_offs++;
338            break;
339         case 1:
340            g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
341            internal_pal_offs++;
342            break;
343         case 2:
344            b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
345            palette_set_color(space->machine, 0x200+pal_offs, MAKE_RGB(r, g, b));
346            internal_pal_offs = 0;
347            pal_offs++;
348            break;
349      }
350   }
351}
352
353static WRITE32_HANDLER( vga_regs_w )
354{
355   static UINT8 vga_address;
356
357   if (ACCESSING_BITS_0_7)
358      vga_address = data;
359   if (ACCESSING_BITS_8_15)
360   {
361      if(vga_address < 0x19)
362      {
363         vga_regs[vga_address] = data>>8;
364         logerror("VGA reg %02x with data %02x\n",vga_address,vga_regs[vga_address]);
365      }
366      else
367         logerror("Warning: used undefined VGA reg %02x with data %02x\n",vga_address,data>>8);
368   }
369}
370
37146static ADDRESS_MAP_START( pcat_io, ADDRESS_SPACE_IO, 32 )
372   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_r, i8237_w, 0xffffffff)
373   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
374   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8253_r, pit8253_w, 0xffffffff)
375   AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r,         kbdc8042_32le_w)
47   AM_IMPORT_FROM(pcat32_io_common)
37648   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
377   AM_RANGE(0x0080, 0x009f) AM_READWRITE8(dma_page_select_r,dma_page_select_w, 0xffffffff)
378   AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
379   AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8("dma8237_2", i8237_r, i8237_w, 0xffff)
380   AM_RANGE(0x0220, 0x022f) AM_RAM //Sound card, according to ROMs
381   AM_RANGE(0x0278, 0x027f) AM_RAM //parallel port 2
382   AM_RANGE(0x0378, 0x037f) AM_RAM //parallel port
383   AM_RANGE(0x03c0, 0x03c3) AM_RAM
384   AM_RANGE(0x03cc, 0x03cf) AM_RAM
385   AM_RANGE(0x03b4, 0x03b7) AM_WRITE(vga_regs_w)
386   AM_RANGE(0x03c4, 0x03c7) AM_RAM //vga regs
387   AM_RANGE(0x03c8, 0x03cb) AM_WRITE(vga_ramdac_w)
388   AM_RANGE(0x03b8, 0x03bb) AM_READ(kludge_r) //hv_retrace
389   AM_RANGE(0x03c8, 0x03cb) AM_READ(kludge_r) //hv_retrace
390   AM_RANGE(0x03d4, 0x03d7) AM_WRITE(vga_regs_w)
391   AM_RANGE(0x03d8, 0x03db) AM_READ(kludge_r)
392   AM_RANGE(0x03bc, 0x03bf) AM_RAM //parallel port 3
39349ADDRESS_MAP_END
39450
39551#define AT_KEYB_HELPER(bit, text, key1) \
r10613r10614
42682   PORT_START("pc_keyboard_7")
42783INPUT_PORTS_END
42884
429static const rgb_t defcolors[]=
85static void pcat_dyn_set_keyb_int(running_machine *machine, int state)
43086{
431   MAKE_RGB(0x00,0x00,0x00),
432   MAKE_RGB(0x00,0x00,0xaa),
433   MAKE_RGB(0x00,0xaa,0x00),
434   MAKE_RGB(0x00,0xaa,0xaa),
435   MAKE_RGB(0xaa,0x00,0x00),
436   MAKE_RGB(0xaa,0x00,0xaa),
437   MAKE_RGB(0xaa,0xaa,0x00),
438   MAKE_RGB(0xaa,0xaa,0xaa),
439   MAKE_RGB(0x55,0x55,0x55),
440   MAKE_RGB(0x55,0x55,0xff),
441   MAKE_RGB(0x55,0xff,0x55),
442   MAKE_RGB(0x55,0xff,0xff),
443   MAKE_RGB(0xff,0x55,0x55),
444   MAKE_RGB(0xff,0x55,0xff),
445   MAKE_RGB(0xff,0xff,0x55),
446   MAKE_RGB(0xff,0xff,0xff)
447};
87   pic8259_ir1_w(machine->device("pic8259_1"), state);
88}
44889
449static PALETTE_INIT(pcat_286)
90static const struct pc_vga_interface vga_interface =
45091{
451   /*Note:palette colors are 6bpp...
452    xxxx xx--
453    */
454   int ix,iy;
92   NULL,
93   NULL,
94   NULL,
95   ADDRESS_SPACE_IO,
96   0x0000
97};
45598
456   for(ix=0;ix<0x300;ix++)
457      palette_set_color(machine, ix,MAKE_RGB(0x00,0x00,0x00));
458
459   //regular colors
460   for(iy=0;iy<0x10;iy++)
461   {
462      for(ix=0;ix<0x10;ix++)
463      {
464         palette_set_color(machine,(ix*2)+1+(iy*0x20),defcolors[ix]);
465         palette_set_color(machine,(ix*2)+0+(iy*0x20),defcolors[iy]);
466      }
467   }
468
469   //bitmap mode
470   for(ix=0;ix<0x10;ix++)
471      palette_set_color(machine, 0x200+ix,defcolors[ix]);
472   //todo: 256 colors
99static void set_gate_a20(running_machine *machine, int a20)
100{
101   cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, a20);
473102}
474103
475static void pcat_dyn_set_keyb_int(running_machine *machine, int state)
104static void keyboard_interrupt(running_machine *machine, int state)
476105{
477   pic8259_ir1_w(pcat_dyn_devices.pic8259_1, state);
106   pic8259_ir1_w(machine->device("pic8259_1"), state);
478107}
479108
109static int pcat_dyn_get_out2(running_machine *machine) {
110   return pit8253_get_output(machine->device("pit8254"), 2 );
111}
480112
113
114static const struct kbdc8042_interface at8042 =
115{
116   KBDC8042_AT386, set_gate_a20, keyboard_interrupt, pcat_dyn_get_out2
117};
118
481119static MACHINE_START( pcat_dyn )
482120{
483//  bank = -1;
484//  lastvalue = -1;
485//  hv_blank = 0;
486   cpu_set_irq_callback(machine->device("maincpu"), irq_callback);
487   pcat_dyn_devices.pit8253 = machine->device( "pit8254" );
488   pcat_dyn_devices.pic8259_1 = machine->device( "pic8259_1" );
489   pcat_dyn_devices.pic8259_2 = machine->device( "pic8259_2" );
490   pcat_dyn_devices.dma8237_1 = machine->device( "dma8237_1" );
491   pcat_dyn_devices.dma8237_2 = machine->device( "dma8237_2" );
492121
122   cpu_set_irq_callback(machine->device("maincpu"), pcat_irq_callback);
493123   init_pc_common(machine, PCCOMMON_KEYBOARD_AT, pcat_dyn_set_keyb_int);
124   kbdc8042_init(machine, &at8042);
494125}
495126
496static const gfx_layout CGA_charlayout =
497{
498   8,8,
499    256,
500    1,
501    { 0 },
502    { 0,1,2,3,4,5,6,7 },
503   { 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8 },
504    8*8
505};
506
507static GFXDECODE_START( pcat_dyn )
508   GFXDECODE_ENTRY( "video_bios", 0x09cb*8, CGA_charlayout,              0, 256 )
509   // there's a 8x16 charset just after the 8x8 one
510GFXDECODE_END
511
512127static MACHINE_CONFIG_START( pcat_dyn, driver_device )
513128   /* basic machine hardware */
514129   MCFG_CPU_ADD("maincpu", I486, 40000000)   /* Am486 DX-40 */
r10613r10614
516131   MCFG_CPU_IO_MAP(pcat_io)
517132
518133   /* video hardware */
519   MCFG_SCREEN_ADD("screen", RASTER)
520   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
134   MCFG_FRAGMENT_ADD( pcvideo_vga )
135   MCFG_SCREEN_MODIFY("screen")
521136   MCFG_SCREEN_REFRESH_RATE(60)
522   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
523   MCFG_SCREEN_SIZE(64*8, 32*8)
524   MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
525   MCFG_SCREEN_UPDATE(pcat_dyn)
526   MCFG_GFXDECODE( pcat_dyn )
527
137   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
528138   MCFG_MACHINE_START(pcat_dyn)
529139   MCFG_MC146818_ADD( "rtc", MC146818_STANDARD )
530140
531//  MCFG_FRAGMENT_ADD( at_kbdc8042 )
532   MCFG_PIC8259_ADD( "pic8259_1", pic8259_1_config )
533   MCFG_PIC8259_ADD( "pic8259_2", pic8259_2_config )
534   MCFG_I8237_ADD( "dma8237_1", XTAL_14_31818MHz/3, dma8237_1_config )
535   MCFG_I8237_ADD( "dma8237_2", XTAL_14_31818MHz/3, dma8237_2_config )
536   MCFG_PIT8254_ADD( "pit8254", at_pit8254_config )
537
538   MCFG_PALETTE_INIT(pcat_286)
539
540   MCFG_PALETTE_LENGTH(0x300)
541
542   MCFG_VIDEO_START(pcat_dyn)
141   MCFG_FRAGMENT_ADD( pcat_common )
543142MACHINE_CONFIG_END
544143
545144/***************************************
r10613r10614
581180   ROM_LOAD("prom.7", 0xe0000, 0x02000, CRC(154c8092) SHA1(4439ee82f36d5d5c334494ba7bb4848e839213a7))
582181ROM_END
583182
584GAME( 1995, toursol,  0,       pcat_dyn, pcat_dyn, 0, ROT0, "Dynamo", "Tournament Solitaire (V1.06, 08/03/95)", GAME_NOT_WORKING|GAME_NO_SOUND )
585GAME( 1995, toursol1, toursol, pcat_dyn, pcat_dyn, 0, ROT0, "Dynamo", "Tournament Solitaire (V1.04, 06/22/95)", GAME_NOT_WORKING|GAME_NO_SOUND )
183static DRIVER_INIT(pcat_dyn)
184{
185   pc_vga_init(machine, &vga_interface, NULL);
186}
586187
188GAME( 1995, toursol,  0,       pcat_dyn, pcat_dyn, pcat_dyn, ROT0, "Dynamo", "Tournament Solitaire (V1.06, 08/03/95)", GAME_NOT_WORKING|GAME_NO_SOUND )
189GAME( 1995, toursol1, toursol, pcat_dyn, pcat_dyn, pcat_dyn, ROT0, "Dynamo", "Tournament Solitaire (V1.04, 06/22/95)", GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/whitestar.c
r10613r10614
6666ROM_END
6767 
6868/*-------------------------------------------------------------------
69/ Austin Powers
69/ Austin Powers (3.01)
7070/-------------------------------------------------------------------*/
71ROM_START(austin)
71ROM_START(aust301)
7272   ROM_REGION(0x80000, "user1", 0)
73   ROM_LOAD("apcpu.302", 0x00000, 0x20000, CRC(2920b59b) SHA1(280cebbb39980fbcfd91fc1cf87a40ad926ffecb)) // ver 3.02
74   //ROM_LOAD("apcpu.300", 0x00000, 0x20000, CRC(a06b2b03) SHA1(4c36212b43fdc497773425e586f64c3064e7000c)) // ver 3.00
75   //ROM_LOAD("apcpu.201", 0x00000, 0x20000, CRC(a4ddcdca) SHA1(c1eb1ae3b9c9b10410d107165f3bddaa514c2113)) // ver 2.01
73   ROM_LOAD("apcpu.301", 0x00000, 0x20000, CRC(868d1f38) SHA1(df08b48437f88e66c4caa80602c28a2223f180b9))
7674   ROM_RELOAD(0x20000, 0x20000)
7775   ROM_RELOAD(0x40000, 0x20000)
7876   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
8179   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
8280   ROM_REGION(0x80000, "gfx3", 0)
8381   ROM_LOAD("apdsp-a.300", 0x00000, 0x80000, CRC(ecf2c3bb) SHA1(952a7873067b8c70043a38a39a8f65089103336b)) // ver 3.00
84   //ROM_LOAD("apdsp-a.200", 0x00000, 0x80000, CRC(f3ca7fca) SHA1(b6b702ad7af75b3010a280adb99e4ee484a03242)) // ver 2.00
8582   ROM_REGION(0x010000, "cpu2", 0)
8683   ROM_LOAD("apsndu7.100",0x0000,0x10000,CRC(d0e79d59) SHA1(7c3f1fa79ff193a976986339a551e3d03208550f))
8784   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
9087   ROM_LOAD("apsndu36.100", 0x200000, 0x100000, CRC(f70f2828) SHA1(9efbed4f68c22eb26e9100afaca5ebe85a97b605))
9188   ROM_LOAD("apsndu37.100", 0x300000, 0x100000, CRC(ddf0144b) SHA1(c2a56703a41ee31841993d63385491259d5a13f8))
9289ROM_END
90 
91/*-------------------------------------------------------------------
92/ Austin Powers (3.00)
93/-------------------------------------------------------------------*/
94ROM_START(aust300)
95   ROM_REGION(0x80000, "user1", 0)
96   ROM_LOAD("apcpu.300", 0x00000, 0x20000, CRC(a06b2b03) SHA1(4c36212b43fdc497773425e586f64c3064e7000c))
97   ROM_RELOAD(0x20000, 0x20000)
98   ROM_RELOAD(0x40000, 0x20000)
99   ROM_RELOAD(0x60000, 0x20000)
100   ROM_REGION(0x10000, "maincpu", 0)
101   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
102   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
103   ROM_REGION(0x80000, "gfx3", 0)
104   ROM_LOAD("apdsp-a.300", 0x00000, 0x80000, CRC(ecf2c3bb) SHA1(952a7873067b8c70043a38a39a8f65089103336b))
105   ROM_REGION(0x010000, "cpu2", 0)
106   ROM_LOAD("apsndu7.100",0x0000,0x10000,CRC(d0e79d59) SHA1(7c3f1fa79ff193a976986339a551e3d03208550f))
107   ROM_REGION(0x400000, "sound1", 0)
108   ROM_LOAD("apsndu17.100", 0x000000, 0x100000, CRC(c1e33fee) SHA1(5a3581584cc1a841d884de4628f7b65d8670f96a))
109   ROM_LOAD("apsndu21.100", 0x100000, 0x100000, CRC(07c3e077) SHA1(d48020f7da400c3682035d537289ce9a30732d74))
110   ROM_LOAD("apsndu36.100", 0x200000, 0x100000, CRC(f70f2828) SHA1(9efbed4f68c22eb26e9100afaca5ebe85a97b605))
111   ROM_LOAD("apsndu37.100", 0x300000, 0x100000, CRC(ddf0144b) SHA1(c2a56703a41ee31841993d63385491259d5a13f8))
112ROM_END
113 
114/*-------------------------------------------------------------------
115/ Austin Powers (2.01)
116/-------------------------------------------------------------------*/
117ROM_START(aust201)
118   ROM_REGION(0x80000, "user1", 0)
119   ROM_LOAD("apcpu.201", 0x00000, 0x20000, CRC(a4ddcdca) SHA1(c1eb1ae3b9c9b10410d107165f3bddaa514c2113))
120   ROM_RELOAD(0x20000, 0x20000)
121   ROM_RELOAD(0x40000, 0x20000)
122   ROM_RELOAD(0x60000, 0x20000)
123   ROM_REGION(0x10000, "maincpu", 0)
124   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
125   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
126   ROM_REGION(0x80000, "gfx3", 0)
127   ROM_LOAD("apdsp-a.200", 0x00000, 0x80000, CRC(f3ca7fca) SHA1(b6b702ad7af75b3010a280adb99e4ee484a03242))
128   ROM_REGION(0x010000, "cpu2", 0)
129   ROM_LOAD("apsndu7.100",0x0000,0x10000,CRC(d0e79d59) SHA1(7c3f1fa79ff193a976986339a551e3d03208550f))
130   ROM_REGION(0x400000, "sound1", 0)
131   ROM_LOAD("apsndu17.100", 0x000000, 0x100000, CRC(c1e33fee) SHA1(5a3581584cc1a841d884de4628f7b65d8670f96a))
132   ROM_LOAD("apsndu21.100", 0x100000, 0x100000, CRC(07c3e077) SHA1(d48020f7da400c3682035d537289ce9a30732d74))
133   ROM_LOAD("apsndu36.100", 0x200000, 0x100000, CRC(f70f2828) SHA1(9efbed4f68c22eb26e9100afaca5ebe85a97b605))
134   ROM_LOAD("apsndu37.100", 0x300000, 0x100000, CRC(ddf0144b) SHA1(c2a56703a41ee31841993d63385491259d5a13f8))
135ROM_END
136 
137/*-------------------------------------------------------------------
138/ Austin Powers (3.02)
139/-------------------------------------------------------------------*/
140ROM_START(austin)
141   ROM_REGION(0x80000, "user1", 0)
142   ROM_LOAD("apcpu.302", 0x00000, 0x20000, CRC(2920b59b) SHA1(280cebbb39980fbcfd91fc1cf87a40ad926ffecb))
143   ROM_RELOAD(0x20000, 0x20000)
144   ROM_RELOAD(0x40000, 0x20000)
145   ROM_RELOAD(0x60000, 0x20000)
146   ROM_REGION(0x10000, "maincpu", 0)
147   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
148   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
149   ROM_REGION(0x80000, "gfx3", 0)
150   ROM_LOAD("apdsp-a.300", 0x00000, 0x80000, CRC(ecf2c3bb) SHA1(952a7873067b8c70043a38a39a8f65089103336b))
151   ROM_REGION(0x010000, "cpu2", 0)
152   ROM_LOAD("apsndu7.100",0x0000,0x10000,CRC(d0e79d59) SHA1(7c3f1fa79ff193a976986339a551e3d03208550f))
153   ROM_REGION(0x400000, "sound1", 0)
154   ROM_LOAD("apsndu17.100", 0x000000, 0x100000, CRC(c1e33fee) SHA1(5a3581584cc1a841d884de4628f7b65d8670f96a))
155   ROM_LOAD("apsndu21.100", 0x100000, 0x100000, CRC(07c3e077) SHA1(d48020f7da400c3682035d537289ce9a30732d74))
156   ROM_LOAD("apsndu36.100", 0x200000, 0x100000, CRC(f70f2828) SHA1(9efbed4f68c22eb26e9100afaca5ebe85a97b605))
157   ROM_LOAD("apsndu37.100", 0x300000, 0x100000, CRC(ddf0144b) SHA1(c2a56703a41ee31841993d63385491259d5a13f8))
158ROM_END
93159ROM_START(austnew)
94160   ROM_REGION(0x80000, "user1", 0)
95161   ROM_LOAD("apcpu.302", 0x00000, 0x20000, CRC(2920b59b) SHA1(280cebbb39980fbcfd91fc1cf87a40ad926ffecb))
r10613r10614
769835/-------------------------------------------------------------------*/
770836 
771837/*-------------------------------------------------------------------
772/ Monopoly
838/ Monopoly (3.20)
773839/-------------------------------------------------------------------*/
774840ROM_START(monopolp)
775841   ROM_REGION(0x80000, "user1", 0)
776   ROM_LOAD("moncpu.320", 0x00000, 0x20000, CRC(6c107c8b) SHA1(236d85b971c70a30e663787d643e6d589591d582)) // ver 3.20
777   //ROM_LOAD("moncpu.301", 0x00000, 0x20000, CRC(24978872) SHA1(48ef94fd720cdafc61f8de5efd5c6b6731237b18)) // ver 3.01
778    //ROM_LOAD("moncpu.233", 0x00000, 0x20000, CRC(f20a5ca6) SHA1(12ae56bd149aa6635c19f4dd73580db550b26963)) // ver 2.33
842   ROM_LOAD("moncpu.320", 0x00000, 0x20000, CRC(6c107c8b) SHA1(236d85b971c70a30e663787d643e6d589591d582))
779843   ROM_RELOAD(0x20000, 0x20000)
780844   ROM_RELOAD(0x40000, 0x20000)
781845   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
783847   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
784848   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
785849   ROM_REGION(0x80000, "gfx3", 0)
786   ROM_LOAD("mondsp-a.301", 0x00000, 0x80000, CRC(c4e2e032) SHA1(691f7b6ed0616338683f7e3f316d64a70db58dd4))  // ver 3.01
787   //ROM_LOAD("mondsp-a.206", 0x00000, 0x80000, CRC(6df6e158) SHA1(d3a9be2dc189b44b9e4b9f77f5011ed931df5634))  // ver 2.06
850   ROM_LOAD("mondsp-a.301", 0x00000, 0x80000, CRC(c4e2e032) SHA1(691f7b6ed0616338683f7e3f316d64a70db58dd4))
788851   ROM_REGION(0x010000, "cpu2", 0)
789852   ROM_LOAD("mnsndu7.100",0x0000,0x10000,CRC(400442e7) SHA1(d6c075dc439d5366b7ae71b5a523b86543b1ecd6))
790853   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
793856   ROM_LOAD("mnsndu36.100", 0x200000, 0x100000, CRC(c845aa97) SHA1(2632aa8c5576b7afcb96693fa524c7d0350ac9a8))
794857ROM_END
795858 
796ROM_START(monopole)
859/*-------------------------------------------------------------------
860/ Monopoly (3.03)
861/-------------------------------------------------------------------*/
862ROM_START(monop303)
797863   ROM_REGION(0x80000, "user1", 0)
798864   ROM_LOAD("moncpu.303", 0x00000, 0x20000, CRC(4a66c9e4) SHA1(a368b0ced32f1017e781a59108670b979b50c9d7))
799865   ROM_RELOAD(0x20000, 0x20000)
r10613r10614
811877   ROM_LOAD("mnsndu21.100", 0x100000, 0x100000, CRC(e0727e1f) SHA1(2093dba6e2f59cd1d1fc49c8d995b603ea0913ba))
812878   ROM_LOAD("mnsndu36.100", 0x200000, 0x100000, CRC(c845aa97) SHA1(2632aa8c5576b7afcb96693fa524c7d0350ac9a8))
813879ROM_END
880 
881/*-------------------------------------------------------------------
882/ Monopoly (3.01)
883/-------------------------------------------------------------------*/
884ROM_START(monop301)
885   ROM_REGION(0x80000, "user1", 0)
886   ROM_LOAD("moncpu.301", 0x00000, 0x20000, CRC(24978872) SHA1(48ef94fd720cdafc61f8de5efd5c6b6731237b18))
887   ROM_RELOAD(0x20000, 0x20000)
888   ROM_RELOAD(0x40000, 0x20000)
889   ROM_RELOAD(0x60000, 0x20000)
890   ROM_REGION(0x10000, "maincpu", 0)
891   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
892   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
893   ROM_REGION(0x80000, "gfx3", 0)
894   ROM_LOAD("mondsp-a.301", 0x00000, 0x80000, CRC(c4e2e032) SHA1(691f7b6ed0616338683f7e3f316d64a70db58dd4))
895   ROM_REGION(0x010000, "cpu2", 0)
896   ROM_LOAD("mnsndu7.100",0x0000,0x10000,CRC(400442e7) SHA1(d6c075dc439d5366b7ae71b5a523b86543b1ecd6))
897   ROM_REGION(0x400000, "sound1", 0)
898   ROM_LOAD("mnsndu17.100", 0x000000, 0x100000, CRC(f9bc55e8) SHA1(7dc41521305021961927ebde4dcf22611e3d622d))
899   ROM_LOAD("mnsndu21.100", 0x100000, 0x100000, CRC(e0727e1f) SHA1(2093dba6e2f59cd1d1fc49c8d995b603ea0913ba))
900   ROM_LOAD("mnsndu36.100", 0x200000, 0x100000, CRC(c845aa97) SHA1(2632aa8c5576b7afcb96693fa524c7d0350ac9a8))
901ROM_END
902 
903/*-------------------------------------------------------------------
904/ Monopoly (2.51)
905/-------------------------------------------------------------------*/
906ROM_START(monop251)
907   ROM_REGION(0x80000, "user1", 0)
908   ROM_LOAD("moncpu.251", 0x00000, 0x20000, CRC(0645cfae) SHA1(d979234150b7fb62718debbeeeca1466a6c0344f))
909   ROM_RELOAD(0x20000, 0x20000)
910   ROM_RELOAD(0x40000, 0x20000)
911   ROM_RELOAD(0x60000, 0x20000)
912   ROM_REGION(0x10000, "maincpu", 0)
913   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
914   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
915   ROM_REGION(0x80000, "gfx3", 0)
916   ROM_LOAD("mondsp-a.206", 0x00000, 0x80000, CRC(6df6e158) SHA1(d3a9be2dc189b44b9e4b9f77f5011ed931df5634))
917   ROM_REGION(0x010000, "cpu2", 0)
918   ROM_LOAD("mnsndu7.100",0x0000,0x10000,CRC(400442e7) SHA1(d6c075dc439d5366b7ae71b5a523b86543b1ecd6))
919   ROM_REGION(0x400000, "sound1", 0)
920   ROM_LOAD("mnsndu17.100", 0x000000, 0x100000, CRC(f9bc55e8) SHA1(7dc41521305021961927ebde4dcf22611e3d622d))
921   ROM_LOAD("mnsndu21.100", 0x100000, 0x100000, CRC(e0727e1f) SHA1(2093dba6e2f59cd1d1fc49c8d995b603ea0913ba))
922   ROM_LOAD("mnsndu36.100", 0x200000, 0x100000, CRC(c845aa97) SHA1(2632aa8c5576b7afcb96693fa524c7d0350ac9a8))
923ROM_END
924 
925/*-------------------------------------------------------------------
926/ Monopoly (2.33)
927/-------------------------------------------------------------------*/
928ROM_START(monop233)
929   ROM_REGION(0x80000, "user1", 0)
930   ROM_LOAD("moncpu.233", 0x00000, 0x20000, CRC(f20a5ca6) SHA1(12ae56bd149aa6635c19f4dd73580db550b26963))
931   ROM_RELOAD(0x20000, 0x20000)
932   ROM_RELOAD(0x40000, 0x20000)
933   ROM_RELOAD(0x60000, 0x20000)
934   ROM_REGION(0x10000, "maincpu", 0)
935   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
936   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
937   ROM_REGION(0x80000, "gfx3", 0)
938   ROM_LOAD("mondsp-a.203", 0x00000, 0x80000, CRC(6e4678fb) SHA1(c0f41f01e9e20e741f1b13d3bd6e824486ba9a0a))
939   ROM_REGION(0x010000, "cpu2", 0)
940   ROM_LOAD("mnsndu7.100",0x0000,0x10000,CRC(400442e7) SHA1(d6c075dc439d5366b7ae71b5a523b86543b1ecd6))
941   ROM_REGION(0x400000, "sound1", 0)
942   ROM_LOAD("mnsndu17.100", 0x000000, 0x100000, CRC(f9bc55e8) SHA1(7dc41521305021961927ebde4dcf22611e3d622d))
943   ROM_LOAD("mnsndu21.100", 0x100000, 0x100000, CRC(e0727e1f) SHA1(2093dba6e2f59cd1d1fc49c8d995b603ea0913ba))
944   ROM_LOAD("mnsndu36.100", 0x200000, 0x100000, CRC(c845aa97) SHA1(2632aa8c5576b7afcb96693fa524c7d0350ac9a8))
945ROM_END
946 
947/*-------------------------------------------------------------------
948/ Monopoly (3.20) (ARM7 Sound Board)
949/-------------------------------------------------------------------*/
814950ROM_START(mononew)
815951   ROM_REGION(0x80000, "user1", 0)
816952   ROM_LOAD("moncpu.320", 0x00000, 0x20000, CRC(6c107c8b) SHA1(236d85b971c70a30e663787d643e6d589591d582))
r10613r10614
832968   ROM_LOAD("mnsndu21.100", 0x100000, 0x100000, CRC(e0727e1f) SHA1(2093dba6e2f59cd1d1fc49c8d995b603ea0913ba))
833969   ROM_LOAD("mnsndu36.100", 0x200000, 0x100000, CRC(c845aa97) SHA1(2632aa8c5576b7afcb96693fa524c7d0350ac9a8))
834970ROM_END
971 
972/*-------------------------------------------------------------------
973/ Monopoly (France)
974/-------------------------------------------------------------------*/
835975ROM_START(monopolf)
836976   ROM_REGION(0x80000, "user1", 0)
837977   ROM_LOAD("moncpu.320", 0x00000, 0x20000, CRC(6c107c8b) SHA1(236d85b971c70a30e663787d643e6d589591d582))
r10613r10614
850990   ROM_LOAD("mnsndu21.100", 0x100000, 0x100000, CRC(e0727e1f) SHA1(2093dba6e2f59cd1d1fc49c8d995b603ea0913ba))
851991   ROM_LOAD("mnsndu36.100", 0x200000, 0x100000, CRC(c845aa97) SHA1(2632aa8c5576b7afcb96693fa524c7d0350ac9a8))
852992ROM_END
993 
994/*-------------------------------------------------------------------
995/ Monopoly (France)
996/-------------------------------------------------------------------*/
853997ROM_START(monopolg)
854998   ROM_REGION(0x80000, "user1", 0)
855999   ROM_LOAD("moncpu.320", 0x00000, 0x20000, CRC(6c107c8b) SHA1(236d85b971c70a30e663787d643e6d589591d582))
r10613r10614
8681012   ROM_LOAD("mnsndu21.100", 0x100000, 0x100000, CRC(e0727e1f) SHA1(2093dba6e2f59cd1d1fc49c8d995b603ea0913ba))
8691013   ROM_LOAD("mnsndu36.100", 0x200000, 0x100000, CRC(c845aa97) SHA1(2632aa8c5576b7afcb96693fa524c7d0350ac9a8))
8701014ROM_END
1015 
1016/*-------------------------------------------------------------------
1017/ Monopoly (Italy)
1018/-------------------------------------------------------------------*/
8711019ROM_START(monopoli)
8721020   ROM_REGION(0x80000, "user1", 0)
8731021   ROM_LOAD("moncpu.320", 0x00000, 0x20000, CRC(6c107c8b) SHA1(236d85b971c70a30e663787d643e6d589591d582))
r10613r10614
8861034   ROM_LOAD("mnsndu21.100", 0x100000, 0x100000, CRC(e0727e1f) SHA1(2093dba6e2f59cd1d1fc49c8d995b603ea0913ba))
8871035   ROM_LOAD("mnsndu36.100", 0x200000, 0x100000, CRC(c845aa97) SHA1(2632aa8c5576b7afcb96693fa524c7d0350ac9a8))
8881036ROM_END
1037 
1038/*-------------------------------------------------------------------
1039/ Monopoly (Spain)
1040/-------------------------------------------------------------------*/
8891041ROM_START(monopoll)
8901042   ROM_REGION(0x80000, "user1", 0)
8911043   ROM_LOAD("moncpu.320", 0x00000, 0x20000, CRC(6c107c8b) SHA1(236d85b971c70a30e663787d643e6d589591d582))
r10613r10614
9341086/-------------------------------------------------------------------*/
9351087ROM_START(playboys)
9361088   ROM_REGION(0x80000, "user1", 0)
937   ROM_LOAD("pbcpu.500", 0x00000, 0x20000, CRC(e4d924ae) SHA1(2aab64eee57e9569c3cc1bde28cda69ff4cacc69)) // ver 5.00
938   //ROM_LOAD("pbcpu.303", 0x00000, 0x20000, CRC(6a6f6aab) SHA1(cac5d68d699db4016244ffd56355e2834be3da1f)) // ver 3.03
939   //ROM_LOAD("pbcpu.300", 0x00000, 0x20000, CRC(d7e5bada) SHA1(e4d5bc015751a559eb95acb6da04246b7418eaf5)) // ver 3.00
1089   ROM_LOAD("pbcpu.500", 0x00000, 0x20000, CRC(e4d924ae) SHA1(2aab64eee57e9569c3cc1bde28cda69ff4cacc69))
9401090   ROM_RELOAD(0x20000, 0x20000)
9411091   ROM_RELOAD(0x40000, 0x20000)
9421092   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
9441094   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
9451095   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
9461096   ROM_REGION(0x80000, "gfx3", 0)
947   ROM_LOAD("pbdispa.500", 0x00000, 0x80000, CRC(40450165) SHA1(80295466838cb08fe1499b19a98bf759fb7a306e)) // ver 5.00
948    //ROM_LOAD("pbdispa.300", 0x00000, 0x80000, CRC(2dbb372a) SHA1(b694ae06f380ea9f9730ea6bbfab7f9f7ec7342b)) // ver 3.00
1097   ROM_LOAD("pbdispa.500", 0x00000, 0x80000, CRC(40450165) SHA1(80295466838cb08fe1499b19a98bf759fb7a306e))
9491098   ROM_REGION(0x010000, "cpu2", 0)
9501099   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
9511100   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
9541103   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
9551104   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
9561105ROM_END
1106ROM_START(playboys_303)
1107   ROM_REGION(0x80000, "user1", 0)
1108   ROM_LOAD("pbcpu.303", 0x00000, 0x20000, CRC(6a6f6aab) SHA1(cac5d68d699db4016244ffd56355e2834be3da1f))
1109   ROM_RELOAD(0x20000, 0x20000)
1110   ROM_RELOAD(0x40000, 0x20000)
1111   ROM_RELOAD(0x60000, 0x20000)
1112   ROM_REGION(0x10000, "maincpu", 0)
1113   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1114   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1115   ROM_REGION(0x80000, "gfx3", 0)
1116    ROM_LOAD("pbdispa.300", 0x00000, 0x80000, CRC(2dbb372a) SHA1(b694ae06f380ea9f9730ea6bbfab7f9f7ec7342b))
1117   ROM_REGION(0x010000, "cpu2", 0)
1118   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
1119   ROM_REGION(0x400000, "sound1", 0)
1120   ROM_LOAD("pbsndu17.100", 0x000000, 0x100000, CRC(f5502fec) SHA1(c8edd56e0c4365dd6b4bef0f1c7cc83ea5fd73d6))
1121   ROM_LOAD("pbsndu21.100", 0x100000, 0x100000, CRC(7869d34f) SHA1(48a051045523c14ca06a7227b34ed9e3818828d0))
1122   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
1123   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
1124ROM_END
1125ROM_START(playboys_300)
1126   ROM_REGION(0x80000, "user1", 0)
1127   ROM_LOAD("pbcpu.300", 0x00000, 0x20000, CRC(d7e5bada) SHA1(e4d5bc015751a559eb95acb6da04246b7418eaf5))
1128   ROM_RELOAD(0x20000, 0x20000)
1129   ROM_RELOAD(0x40000, 0x20000)
1130   ROM_RELOAD(0x60000, 0x20000)
1131   ROM_REGION(0x10000, "maincpu", 0)
1132   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1133   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1134   ROM_REGION(0x80000, "gfx3", 0)
1135    ROM_LOAD("pbdispa.300", 0x00000, 0x80000, CRC(2dbb372a) SHA1(b694ae06f380ea9f9730ea6bbfab7f9f7ec7342b))
1136   ROM_REGION(0x010000, "cpu2", 0)
1137   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
1138   ROM_REGION(0x400000, "sound1", 0)
1139   ROM_LOAD("pbsndu17.100", 0x000000, 0x100000, CRC(f5502fec) SHA1(c8edd56e0c4365dd6b4bef0f1c7cc83ea5fd73d6))
1140   ROM_LOAD("pbsndu21.100", 0x100000, 0x100000, CRC(7869d34f) SHA1(48a051045523c14ca06a7227b34ed9e3818828d0))
1141   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
1142   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
1143ROM_END
9571144ROM_START(playnew)
9581145   ROM_REGION(0x80000, "user1", 0)
9591146   ROM_LOAD("pbcpu.500", 0x00000, 0x20000, CRC(e4d924ae) SHA1(2aab64eee57e9569c3cc1bde28cda69ff4cacc69))
r10613r10614
9861173   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
9871174   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
9881175   ROM_REGION(0x80000, "gfx3", 0)
989   ROM_LOAD("pbdispf.500", 0x00000, 0x80000, CRC(aedc6c32) SHA1(c930ae1b1308ae641553de34f8249b17f408be56)) // ver 5.00
990   //ROM_LOAD("pbdispf.300", 0x00000, 0x80000, CRC(69ab3bb2) SHA1(59d7ad5eca701d1216200cd489d2d07825a0856e)) // ver 3.00
1176   ROM_LOAD("pbdispf.500", 0x00000, 0x80000, CRC(aedc6c32) SHA1(c930ae1b1308ae641553de34f8249b17f408be56))
9911177   ROM_REGION(0x010000, "cpu2", 0)
9921178   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
9931179   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
9961182   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
9971183   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
9981184ROM_END
1185ROM_START(playboyf_303)
1186   ROM_REGION(0x80000, "user1", 0)
1187   ROM_LOAD("pbcpu.303", 0x00000, 0x20000, CRC(6a6f6aab) SHA1(cac5d68d699db4016244ffd56355e2834be3da1f))
1188   ROM_RELOAD(0x20000, 0x20000)
1189   ROM_RELOAD(0x40000, 0x20000)
1190   ROM_RELOAD(0x60000, 0x20000)
1191   ROM_REGION(0x10000, "maincpu", 0)
1192   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1193   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1194   ROM_REGION(0x80000, "gfx3", 0)
1195   ROM_LOAD("pbdispf.300", 0x00000, 0x80000, CRC(69ab3bb2) SHA1(59d7ad5eca701d1216200cd489d2d07825a0856e))
1196   ROM_REGION(0x010000, "cpu2", 0)
1197   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
1198   ROM_REGION(0x400000, "sound1", 0)
1199   ROM_LOAD("pbsndu17.100", 0x000000, 0x100000, CRC(f5502fec) SHA1(c8edd56e0c4365dd6b4bef0f1c7cc83ea5fd73d6))
1200   ROM_LOAD("pbsndu21.100", 0x100000, 0x100000, CRC(7869d34f) SHA1(48a051045523c14ca06a7227b34ed9e3818828d0))
1201   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
1202   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
1203ROM_END
1204ROM_START(playboyf_300)
1205   ROM_REGION(0x80000, "user1", 0)
1206   ROM_LOAD("pbcpu.300", 0x00000, 0x20000, CRC(d7e5bada) SHA1(e4d5bc015751a559eb95acb6da04246b7418eaf5))
1207   ROM_RELOAD(0x20000, 0x20000)
1208   ROM_RELOAD(0x40000, 0x20000)
1209   ROM_RELOAD(0x60000, 0x20000)
1210   ROM_REGION(0x10000, "maincpu", 0)
1211   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1212   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1213   ROM_REGION(0x80000, "gfx3", 0)
1214   ROM_LOAD("pbdispf.300", 0x00000, 0x80000, CRC(69ab3bb2) SHA1(59d7ad5eca701d1216200cd489d2d07825a0856e))
1215   ROM_REGION(0x010000, "cpu2", 0)
1216   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
1217   ROM_REGION(0x400000, "sound1", 0)
1218   ROM_LOAD("pbsndu17.100", 0x000000, 0x100000, CRC(f5502fec) SHA1(c8edd56e0c4365dd6b4bef0f1c7cc83ea5fd73d6))
1219   ROM_LOAD("pbsndu21.100", 0x100000, 0x100000, CRC(7869d34f) SHA1(48a051045523c14ca06a7227b34ed9e3818828d0))
1220   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
1221   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
1222ROM_END
9991223ROM_START(playboyg)
10001224   ROM_REGION(0x80000, "user1", 0)
10011225   ROM_LOAD("pbcpu.500", 0x00000, 0x20000, CRC(e4d924ae) SHA1(2aab64eee57e9569c3cc1bde28cda69ff4cacc69))
r10613r10614
10061230   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
10071231   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
10081232   ROM_REGION(0x80000, "gfx3", 0)
1009   ROM_LOAD("pbdispg.500", 0x00000, 0x80000, CRC(681392fe) SHA1(23011d538282da144b8ff9cbb7c5655567017e5e)) // ver 5.00
1010   //ROM_LOAD("pbdispg.300", 0x00000, 0x80000, CRC(ed7b7c62) SHA1(28b0ab490f8abd5f29e8cb0996da9e7200918157)) // ver 3.00
1233   ROM_LOAD("pbdispg.500", 0x00000, 0x80000, CRC(681392fe) SHA1(23011d538282da144b8ff9cbb7c5655567017e5e))
10111234   ROM_REGION(0x010000, "cpu2", 0)
10121235   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
10131236   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
10161239   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
10171240   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
10181241ROM_END
1242ROM_START(playboyg_303)
1243   ROM_REGION(0x80000, "user1", 0)
1244   ROM_LOAD("pbcpu.303", 0x00000, 0x20000, CRC(6a6f6aab) SHA1(cac5d68d699db4016244ffd56355e2834be3da1f))
1245   ROM_RELOAD(0x20000, 0x20000)
1246   ROM_RELOAD(0x40000, 0x20000)
1247   ROM_RELOAD(0x60000, 0x20000)
1248   ROM_REGION(0x10000, "maincpu", 0)
1249   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1250   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1251   ROM_REGION(0x80000, "gfx3", 0)
1252   ROM_LOAD("pbdispg.300", 0x00000, 0x80000, CRC(ed7b7c62) SHA1(28b0ab490f8abd5f29e8cb0996da9e7200918157))
1253   ROM_REGION(0x010000, "cpu2", 0)
1254   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
1255   ROM_REGION(0x400000, "sound1", 0)
1256   ROM_LOAD("pbsndu17.100", 0x000000, 0x100000, CRC(f5502fec) SHA1(c8edd56e0c4365dd6b4bef0f1c7cc83ea5fd73d6))
1257   ROM_LOAD("pbsndu21.100", 0x100000, 0x100000, CRC(7869d34f) SHA1(48a051045523c14ca06a7227b34ed9e3818828d0))
1258   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
1259   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
1260ROM_END
1261ROM_START(playboyg_300)
1262   ROM_REGION(0x80000, "user1", 0)
1263   ROM_LOAD("pbcpu.300", 0x00000, 0x20000, CRC(d7e5bada) SHA1(e4d5bc015751a559eb95acb6da04246b7418eaf5))
1264   ROM_RELOAD(0x20000, 0x20000)
1265   ROM_RELOAD(0x40000, 0x20000)
1266   ROM_RELOAD(0x60000, 0x20000)
1267   ROM_REGION(0x10000, "maincpu", 0)
1268   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1269   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1270   ROM_REGION(0x80000, "gfx3", 0)
1271   ROM_LOAD("pbdispg.300", 0x00000, 0x80000, CRC(ed7b7c62) SHA1(28b0ab490f8abd5f29e8cb0996da9e7200918157))
1272   ROM_REGION(0x010000, "cpu2", 0)
1273   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
1274   ROM_REGION(0x400000, "sound1", 0)
1275   ROM_LOAD("pbsndu17.100", 0x000000, 0x100000, CRC(f5502fec) SHA1(c8edd56e0c4365dd6b4bef0f1c7cc83ea5fd73d6))
1276   ROM_LOAD("pbsndu21.100", 0x100000, 0x100000, CRC(7869d34f) SHA1(48a051045523c14ca06a7227b34ed9e3818828d0))
1277   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
1278   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
1279ROM_END
10191280ROM_START(playboyi)
10201281   ROM_REGION(0x80000, "user1", 0)
10211282   ROM_LOAD("pbcpu.500", 0x00000, 0x20000, CRC(e4d924ae) SHA1(2aab64eee57e9569c3cc1bde28cda69ff4cacc69))
r10613r10614
10261287   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
10271288   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
10281289   ROM_REGION(0x80000, "gfx3", 0)
1029   ROM_LOAD("pbdispi.500", 0x00000, 0x80000, CRC(d90d7ec6) SHA1(7442160f403a8ccabfc9dc8dc53f8b44f5df26bc)) // ver 5.00
1030   //ROM_LOAD("pbdispi.300", 0x00000, 0x80000, CRC(74c8cedf) SHA1(474ad1939ea0a58852003e549ed85478e239a67c)) // ver 3.00
1290   ROM_LOAD("pbdispi.500", 0x00000, 0x80000, CRC(d90d7ec6) SHA1(7442160f403a8ccabfc9dc8dc53f8b44f5df26bc))
10311291   ROM_REGION(0x010000, "cpu2", 0)
10321292   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
10331293   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
10361296   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
10371297   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
10381298ROM_END
1299ROM_START(playboyi_303)
1300   ROM_REGION(0x80000, "user1", 0)
1301   ROM_LOAD("pbcpu.303", 0x00000, 0x20000, CRC(6a6f6aab) SHA1(cac5d68d699db4016244ffd56355e2834be3da1f))
1302   ROM_RELOAD(0x20000, 0x20000)
1303   ROM_RELOAD(0x40000, 0x20000)
1304   ROM_RELOAD(0x60000, 0x20000)
1305   ROM_REGION(0x10000, "maincpu", 0)
1306   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1307   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1308   ROM_REGION(0x80000, "gfx3", 0)
1309   ROM_LOAD("pbdispi.300", 0x00000, 0x80000, CRC(74c8cedf) SHA1(474ad1939ea0a58852003e549ed85478e239a67c))
1310   ROM_REGION(0x010000, "cpu2", 0)
1311   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
1312   ROM_REGION(0x400000, "sound1", 0)
1313   ROM_LOAD("pbsndu17.100", 0x000000, 0x100000, CRC(f5502fec) SHA1(c8edd56e0c4365dd6b4bef0f1c7cc83ea5fd73d6))
1314   ROM_LOAD("pbsndu21.100", 0x100000, 0x100000, CRC(7869d34f) SHA1(48a051045523c14ca06a7227b34ed9e3818828d0))
1315   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
1316   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
1317ROM_END
1318ROM_START(playboyi_300)
1319   ROM_REGION(0x80000, "user1", 0)
1320   ROM_LOAD("pbcpu.300", 0x00000, 0x20000, CRC(d7e5bada) SHA1(e4d5bc015751a559eb95acb6da04246b7418eaf5))
1321   ROM_RELOAD(0x20000, 0x20000)
1322   ROM_RELOAD(0x40000, 0x20000)
1323   ROM_RELOAD(0x60000, 0x20000)
1324   ROM_REGION(0x10000, "maincpu", 0)
1325   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1326   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1327   ROM_REGION(0x80000, "gfx3", 0)
1328   ROM_LOAD("pbdispi.300", 0x00000, 0x80000, CRC(74c8cedf) SHA1(474ad1939ea0a58852003e549ed85478e239a67c))
1329   ROM_REGION(0x010000, "cpu2", 0)
1330   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
1331   ROM_REGION(0x400000, "sound1", 0)
1332   ROM_LOAD("pbsndu17.100", 0x000000, 0x100000, CRC(f5502fec) SHA1(c8edd56e0c4365dd6b4bef0f1c7cc83ea5fd73d6))
1333   ROM_LOAD("pbsndu21.100", 0x100000, 0x100000, CRC(7869d34f) SHA1(48a051045523c14ca06a7227b34ed9e3818828d0))
1334   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
1335   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
1336ROM_END
10391337ROM_START(playboyl)
10401338   ROM_REGION(0x80000, "user1", 0)
10411339   ROM_LOAD("pbcpu.500", 0x00000, 0x20000, CRC(e4d924ae) SHA1(2aab64eee57e9569c3cc1bde28cda69ff4cacc69))
r10613r10614
10461344   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
10471345   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
10481346   ROM_REGION(0x80000, "gfx3", 0)
1049   ROM_LOAD("pbdispl.500", 0x00000, 0x80000, CRC(b019f0f6) SHA1(184a9905cd3af9d272577e43666aed5e5a8a5281)) // ver 5.00
1050   //ROM_LOAD("pbdispl.300", 0x00000, 0x80000, CRC(e7697fc3) SHA1(7a9796e7b99af0d3d2079876a8054209a3067e64)) // ver 3.00
1347   ROM_LOAD("pbdispl.500", 0x00000, 0x80000, CRC(b019f0f6) SHA1(184a9905cd3af9d272577e43666aed5e5a8a5281))
10511348   ROM_REGION(0x010000, "cpu2", 0)
10521349   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
10531350   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
10561353   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
10571354   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
10581355ROM_END
1059 
1356ROM_START(playboyl_303)
1357   ROM_REGION(0x80000, "user1", 0)
1358   ROM_LOAD("pbcpu.303", 0x00000, 0x20000, CRC(6a6f6aab) SHA1(cac5d68d699db4016244ffd56355e2834be3da1f))
1359   ROM_RELOAD(0x20000, 0x20000)
1360   ROM_RELOAD(0x40000, 0x20000)
1361   ROM_RELOAD(0x60000, 0x20000)
1362   ROM_REGION(0x10000, "maincpu", 0)
1363   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1364   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1365   ROM_REGION(0x80000, "gfx3", 0)
1366   ROM_LOAD("pbdispl.300", 0x00000, 0x80000, CRC(e7697fc3) SHA1(7a9796e7b99af0d3d2079876a8054209a3067e64))
1367   ROM_REGION(0x010000, "cpu2", 0)
1368   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
1369   ROM_REGION(0x400000, "sound1", 0)
1370   ROM_LOAD("pbsndu17.100", 0x000000, 0x100000, CRC(f5502fec) SHA1(c8edd56e0c4365dd6b4bef0f1c7cc83ea5fd73d6))
1371   ROM_LOAD("pbsndu21.100", 0x100000, 0x100000, CRC(7869d34f) SHA1(48a051045523c14ca06a7227b34ed9e3818828d0))
1372   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
1373   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
1374ROM_END
1375ROM_START(playboyl_300)
1376   ROM_REGION(0x80000, "user1", 0)
1377   ROM_LOAD("pbcpu.300", 0x00000, 0x20000, CRC(d7e5bada) SHA1(e4d5bc015751a559eb95acb6da04246b7418eaf5))
1378   ROM_RELOAD(0x20000, 0x20000)
1379   ROM_RELOAD(0x40000, 0x20000)
1380   ROM_RELOAD(0x60000, 0x20000)
1381   ROM_REGION(0x10000, "maincpu", 0)
1382   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1383   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1384   ROM_REGION(0x80000, "gfx3", 0)
1385   ROM_LOAD("pbdispl.300", 0x00000, 0x80000, CRC(e7697fc3) SHA1(7a9796e7b99af0d3d2079876a8054209a3067e64))
1386   ROM_REGION(0x010000, "cpu2", 0)
1387   ROM_LOAD("pbsndu7.102",0x0000,0x10000,CRC(12a68f34) SHA1(f2cd42918dec353883bc465f6302c2d94dcd6b87))
1388   ROM_REGION(0x400000, "sound1", 0)
1389   ROM_LOAD("pbsndu17.100", 0x000000, 0x100000, CRC(f5502fec) SHA1(c8edd56e0c4365dd6b4bef0f1c7cc83ea5fd73d6))
1390   ROM_LOAD("pbsndu21.100", 0x100000, 0x100000, CRC(7869d34f) SHA1(48a051045523c14ca06a7227b34ed9e3818828d0))
1391   ROM_LOAD("pbsndu36.100", 0x200000, 0x100000, CRC(d10f14a3) SHA1(972b480c23d484b627ecdce0322c08fe760a127f))
1392   ROM_LOAD("pbsndu37.100", 0x300000, 0x100000, CRC(6642524a) SHA1(9d0c0be5887cf4510c11243ee47b11c08cbae17c))
1393ROM_END
10601394/*-------------------------------------------------------------------
10611395/ Roller Coaster Tycoon
10621396/-------------------------------------------------------------------*/
10631397ROM_START(rctycn)
10641398   ROM_REGION(0x80000, "user1", 0)
1065   ROM_LOAD("rctcpu.702", 0x00000, 0x20000, CRC(5736a816) SHA1(fcfd06eeca74df0bca2c0bc57aeaa00400e4ab55)) // ver 7.02
1066   //ROM_LOAD("rctcpu.400", 0x00000, 0x20000, CRC(4691de23) SHA1(f47fc03f9b030cb7a1201d015bbec5a426176338)) // ver 4.00
1067//ROM_LOAD( "rctcpu.701",    0x0000, 0x20000, CRC(e1fe89f6) SHA1(9a76a5c267e055fcf0418394762bcea758da02d6))
1068//ROM_LOAD( "rctdispa.700",  0x0000, 0x80000, CRC(6a8925d7) SHA1(82a6c069f1e8f8e053fec708f56c8ffe56d70fc8))
1069//ROM_LOAD( "rctdispf.700",  0x0000, 0x80000, CRC(2de0eec8) SHA1(5b48eabddc1fb735866767ae008baf58205954db))
1070//ROM_LOAD( "rctdispg.700",  0x0000, 0x80000, CRC(0babf1ed) SHA1(db683aa392968d255d355d4a1b0c9d8d4fb9e799))
1071//ROM_LOAD( "rctdispi.700",  0x0000, 0x80000, CRC(0d07d8f2) SHA1(3ffd8ad7183ba20844c1e5d1933c8002ca4707aa))
1072//ROM_LOAD( "rctdisps.700",  0x0000, 0x80000, CRC(6921d8cc) SHA1(1ada415af8e949829ceac75da507982ea2091f4d))
1073 
1399   ROM_LOAD("rctcpu.702", 0x00000, 0x20000, CRC(5736a816) SHA1(fcfd06eeca74df0bca2c0bc57aeaa00400e4ab55))
10741400   ROM_RELOAD(0x20000, 0x20000)
10751401   ROM_RELOAD(0x40000, 0x20000)
10761402   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
10781404   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
10791405   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
10801406   ROM_REGION(0x80000, "gfx3", 0)
1081   ROM_LOAD("rctdispa.701", 0x00000, 0x80000, CRC(0d527f13) SHA1(954116a79578b2a7679c401a2bb99b5bbfb603f2)) // ver 7.01
1082   //ROM_LOAD("rctdispa.400", 0x00000, 0x80000, CRC(d128a8fa) SHA1(8fece3df33d21da020ba06d14d588384d90dd89f)) // ver 4.00
1407   ROM_LOAD("rctdispa.701", 0x00000, 0x80000, CRC(0d527f13) SHA1(954116a79578b2a7679c401a2bb99b5bbfb603f2))
10831408   ROM_REGION(0x010000, "cpu2", 0)
10841409   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
10851410   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
10871412   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
10881413   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
10891414ROM_END
1415ROM_START(rctycn_701)
1416   ROM_REGION(0x80000, "user1", 0)
1417    ROM_LOAD("rctcpu.701",    0x0000, 0x20000, CRC(e1fe89f6) SHA1(9a76a5c267e055fcf0418394762bcea758da02d6))
1418   ROM_RELOAD(0x20000, 0x20000)
1419   ROM_RELOAD(0x40000, 0x20000)
1420   ROM_RELOAD(0x60000, 0x20000)
1421   ROM_REGION(0x10000, "maincpu", 0)
1422   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1423   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1424   ROM_REGION(0x80000, "gfx3", 0)
1425   ROM_LOAD("rctdispa.700",  0x0000, 0x80000, CRC(6a8925d7) SHA1(82a6c069f1e8f8e053fec708f56c8ffe56d70fc8))
1426   ROM_REGION(0x010000, "cpu2", 0)
1427   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
1428   ROM_REGION(0x400000, "sound1", 0)
1429   ROM_LOAD("rcsndu17.100", 0x000000, 0x100000, CRC(18ba20ec) SHA1(c6e7a8a5fd6029b8e884a6eeb779a10d819e8c7c))
1430   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
1431   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
1432ROM_END
1433ROM_START(rctycn_400)
1434   ROM_REGION(0x80000, "user1", 0)
1435   ROM_LOAD("rctcpu.400", 0x00000, 0x20000, CRC(4691de23) SHA1(f47fc03f9b030cb7a1201d015bbec5a426176338))
1436   ROM_RELOAD(0x20000, 0x20000)
1437   ROM_RELOAD(0x40000, 0x20000)
1438   ROM_RELOAD(0x60000, 0x20000)
1439   ROM_REGION(0x10000, "maincpu", 0)
1440   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1441   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1442   ROM_REGION(0x80000, "gfx3", 0)
1443   ROM_LOAD("rctdispa.400", 0x00000, 0x80000, CRC(d128a8fa) SHA1(8fece3df33d21da020ba06d14d588384d90dd89f))
1444   ROM_REGION(0x010000, "cpu2", 0)
1445   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
1446   ROM_REGION(0x400000, "sound1", 0)
1447   ROM_LOAD("rcsndu17.100", 0x000000, 0x100000, CRC(18ba20ec) SHA1(c6e7a8a5fd6029b8e884a6eeb779a10d819e8c7c))
1448   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
1449   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
1450ROM_END
10901451ROM_START(rctnew)
10911452   ROM_REGION(0x80000, "user1", 0)
10921453   ROM_LOAD("rctcpu.702", 0x00000, 0x20000, CRC(5736a816) SHA1(fcfd06eeca74df0bca2c0bc57aeaa00400e4ab55))
r10613r10614
11181479   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
11191480   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
11201481   ROM_REGION(0x80000, "gfx3", 0)
1121   ROM_LOAD("rctdispg.701", 0x00000, 0x80000, CRC(6c70ab29) SHA1(fa3b713b79c0d724b918fa318795681308a4fce3)) // ver 7.01
1122   //ROM_LOAD("rctdispg.400", 0x00000, 0x80000, CRC(c88dc915) SHA1(894c3bb7f5d200448740f021b5b9421f6ee74c5f)) // ver 4.00
1482   ROM_LOAD("rctdispg.701", 0x00000, 0x80000, CRC(6c70ab29) SHA1(fa3b713b79c0d724b918fa318795681308a4fce3))
11231483   ROM_REGION(0x010000, "cpu2", 0)
11241484   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
11251485   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
11271487   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
11281488   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
11291489ROM_END
1490ROM_START(rctycng_701)
1491   ROM_REGION(0x80000, "user1", 0)
1492    ROM_LOAD("rctcpu.701", 0x00000, 0x20000, CRC(e1fe89f6) SHA1(9a76a5c267e055fcf0418394762bcea758da02d6))
1493   ROM_RELOAD(0x20000, 0x20000)
1494   ROM_RELOAD(0x40000, 0x20000)
1495   ROM_RELOAD(0x60000, 0x20000)
1496   ROM_REGION(0x10000, "maincpu", 0)
1497   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1498   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1499   ROM_REGION(0x80000, "gfx3", 0)
1500   ROM_LOAD("rctdispg.700", 0x00000, 0x80000, CRC(0babf1ed) SHA1(db683aa392968d255d355d4a1b0c9d8d4fb9e799))
1501   ROM_REGION(0x010000, "cpu2", 0)
1502   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
1503   ROM_REGION(0x400000, "sound1", 0)
1504   ROM_LOAD("rcsndu17.100", 0x000000, 0x100000, CRC(18ba20ec) SHA1(c6e7a8a5fd6029b8e884a6eeb779a10d819e8c7c))
1505   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
1506   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
1507ROM_END
1508ROM_START(rctycng_400)
1509   ROM_REGION(0x80000, "user1", 0)
1510   ROM_LOAD("rctcpu.400", 0x00000, 0x20000, CRC(4691de23) SHA1(f47fc03f9b030cb7a1201d015bbec5a426176338))
1511   ROM_RELOAD(0x20000, 0x20000)
1512   ROM_RELOAD(0x40000, 0x20000)
1513   ROM_RELOAD(0x60000, 0x20000)
1514   ROM_REGION(0x10000, "maincpu", 0)
1515   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1516   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1517   ROM_REGION(0x80000, "gfx3", 0)
1518   ROM_LOAD("rctdispg.400", 0x00000, 0x80000, CRC(c88dc915) SHA1(894c3bb7f5d200448740f021b5b9421f6ee74c5f))
1519   ROM_REGION(0x010000, "cpu2", 0)
1520   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
1521   ROM_REGION(0x400000, "sound1", 0)
1522   ROM_LOAD("rcsndu17.100", 0x000000, 0x100000, CRC(18ba20ec) SHA1(c6e7a8a5fd6029b8e884a6eeb779a10d819e8c7c))
1523   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
1524   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
1525ROM_END
11301526ROM_START(rctycnf)
11311527   ROM_REGION(0x80000, "user1", 0)
11321528   ROM_LOAD("rctcpu.702", 0x00000, 0x20000, CRC(5736a816) SHA1(fcfd06eeca74df0bca2c0bc57aeaa00400e4ab55))
r10613r10614
11371533   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
11381534   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
11391535   ROM_REGION(0x80000, "gfx3", 0)
1140   ROM_LOAD("rctdispf.701", 0x00000, 0x80000, CRC(4a3bb40c) SHA1(053f494765ac7708401a7816af7186e71083fe8d)) // ver 7.01
1141   //ROM_LOAD("rctdispf.400", 0x00000, 0x80000, CRC(5b41893b) SHA1(66930d0f5d6542b41f22995df55447ba0e435576)) // ver 4.00
1536   ROM_LOAD("rctdispf.701", 0x00000, 0x80000, CRC(4a3bb40c) SHA1(053f494765ac7708401a7816af7186e71083fe8d))
11421537   ROM_REGION(0x010000, "cpu2", 0)
11431538   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
11441539   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
11461541   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
11471542   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
11481543ROM_END
1544ROM_START(rctycnf_701)
1545   ROM_REGION(0x80000, "user1", 0)
1546    ROM_LOAD("rctcpu.701", 0x00000, 0x20000, CRC(e1fe89f6) SHA1(9a76a5c267e055fcf0418394762bcea758da02d6))
1547   ROM_RELOAD(0x20000, 0x20000)
1548   ROM_RELOAD(0x40000, 0x20000)
1549   ROM_RELOAD(0x60000, 0x20000)
1550   ROM_REGION(0x10000, "maincpu", 0)
1551   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1552   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1553   ROM_REGION(0x80000, "gfx3", 0)
1554   ROM_LOAD("rctdispf.700", 0x00000, 0x80000, CRC(2de0eec8) SHA1(5b48eabddc1fb735866767ae008baf58205954db))
1555   ROM_REGION(0x010000, "cpu2", 0)
1556   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
1557   ROM_REGION(0x400000, "sound1", 0)
1558   ROM_LOAD("rcsndu17.100", 0x000000, 0x100000, CRC(18ba20ec) SHA1(c6e7a8a5fd6029b8e884a6eeb779a10d819e8c7c))
1559   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
1560   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
1561ROM_END
1562ROM_START(rctycnf_400)
1563   ROM_REGION(0x80000, "user1", 0)
1564   ROM_LOAD("rctcpu.400", 0x00000, 0x20000, CRC(4691de23) SHA1(f47fc03f9b030cb7a1201d015bbec5a426176338))
1565   ROM_RELOAD(0x20000, 0x20000)
1566   ROM_RELOAD(0x40000, 0x20000)
1567   ROM_RELOAD(0x60000, 0x20000)
1568   ROM_REGION(0x10000, "maincpu", 0)
1569   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1570   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1571   ROM_REGION(0x80000, "gfx3", 0)
1572   ROM_LOAD("rctdispf.400", 0x00000, 0x80000, CRC(5b41893b) SHA1(66930d0f5d6542b41f22995df55447ba0e435576))
1573   ROM_REGION(0x010000, "cpu2", 0)
1574   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
1575   ROM_REGION(0x400000, "sound1", 0)
1576   ROM_LOAD("rcsndu17.100", 0x000000, 0x100000, CRC(18ba20ec) SHA1(c6e7a8a5fd6029b8e884a6eeb779a10d819e8c7c))
1577   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
1578   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
1579ROM_END
11491580ROM_START(rctycni)
11501581   ROM_REGION(0x80000, "user1", 0)
11511582   ROM_LOAD("rctcpu.702", 0x00000, 0x20000, CRC(5736a816) SHA1(fcfd06eeca74df0bca2c0bc57aeaa00400e4ab55))
r10613r10614
11561587   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
11571588   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
11581589   ROM_REGION(0x80000, "gfx3", 0)
1159   ROM_LOAD("rctdispi.701", 0x00000, 0x80000, CRC(6adc8236) SHA1(bb908c88e47987777c921f2948dfb802ee29c868)) // ver 7.01
1160   //ROM_LOAD("rctdispi.400", 0x00000, 0x80000, CRC(7c1c0adb) SHA1(c9321a64ee4af8d475b441ae2385120bba66ccf9)) // ver 4.00
1590   ROM_LOAD("rctdispi.701", 0x00000, 0x80000, CRC(6adc8236) SHA1(bb908c88e47987777c921f2948dfb802ee29c868))
11611591   ROM_REGION(0x010000, "cpu2", 0)
11621592   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
11631593   ROM_REGION(0x400000, "sound1", 0)
r10613r10614
11651595   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
11661596   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
11671597ROM_END
1598ROM_START(rctycni_701)
1599   ROM_REGION(0x80000, "user1", 0)
1600    ROM_LOAD("rctcpu.701", 0x00000, 0x20000, CRC(e1fe89f6) SHA1(9a76a5c267e055fcf0418394762bcea758da02d6))
1601   ROM_RELOAD(0x20000, 0x20000)
1602   ROM_RELOAD(0x40000, 0x20000)
1603   ROM_RELOAD(0x60000, 0x20000)
1604   ROM_REGION(0x10000, "maincpu", 0)
1605   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1606   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1607   ROM_REGION(0x80000, "gfx3", 0)
1608   ROM_LOAD("rctdispi.700", 0x00000, 0x80000, CRC(0d07d8f2) SHA1(3ffd8ad7183ba20844c1e5d1933c8002ca4707aa))
1609   ROM_REGION(0x010000, "cpu2", 0)
1610   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
1611   ROM_REGION(0x400000, "sound1", 0)
1612   ROM_LOAD("rcsndu17.100", 0x000000, 0x100000, CRC(18ba20ec) SHA1(c6e7a8a5fd6029b8e884a6eeb779a10d819e8c7c))
1613   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
1614   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
1615ROM_END
1616ROM_START(rctycni_400)
1617   ROM_REGION(0x80000, "user1", 0)
1618   ROM_LOAD("rctcpu.400", 0x00000, 0x20000, CRC(4691de23) SHA1(f47fc03f9b030cb7a1201d015bbec5a426176338))
1619   ROM_RELOAD(0x20000, 0x20000)
1620   ROM_RELOAD(0x40000, 0x20000)
1621   ROM_RELOAD(0x60000, 0x20000)
1622   ROM_REGION(0x10000, "maincpu", 0)
1623   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1624   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1625   ROM_REGION(0x80000, "gfx3", 0)
1626   ROM_LOAD("rctdispi.400", 0x00000, 0x80000, CRC(7c1c0adb) SHA1(c9321a64ee4af8d475b441ae2385120bba66ccf9))
1627   ROM_REGION(0x010000, "cpu2", 0)
1628   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
1629   ROM_REGION(0x400000, "sound1", 0)
1630   ROM_LOAD("rcsndu17.100", 0x000000, 0x100000, CRC(18ba20ec) SHA1(c6e7a8a5fd6029b8e884a6eeb779a10d819e8c7c))
1631   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
1632   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
1633ROM_END
11681634ROM_START(rctycnl)
11691635   ROM_REGION(0x80000, "user1", 0)
11701636   ROM_LOAD("rctcpu.702", 0x00000, 0x20000, CRC(5736a816) SHA1(fcfd06eeca74df0bca2c0bc57aeaa00400e4ab55))
1637   //ROM_LOAD("rctcpu.400", 0x00000, 0x20000, CRC(4691de23) SHA1(f47fc03f9b030cb7a1201d015bbec5a426176338))
1638    //ROM_LOAD("rctcpu.701", 0x00000, 0x20000, CRC(e1fe89f6) SHA1(9a76a5c267e055fcf0418394762bcea758da02d6))
11711639   ROM_RELOAD(0x20000, 0x20000)
11721640   ROM_RELOAD(0x40000, 0x20000)
11731641   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
11761644   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
11771645   ROM_REGION(0x80000, "gfx3", 0)
11781646   ROM_LOAD("rctdisps.701", 0x00000, 0x80000, CRC(0efa8208) SHA1(6706ea3e31b478970fc65a8cf9db749db9c0fa39)) // ver 7.01
1647   //ROM_LOAD("rctdisps.700", 0x00000, 0x80000, CRC(6921d8cc) SHA1(1ada415af8e949829ceac75da507982ea2091f4d))
11791648   //ROM_LOAD("rctdisps.400", 0x00000, 0x80000, CRC(c06e6669) SHA1(af389ba74e62d7065b3bc7d5f771a3461704cbe3)) // ver 4.00
11801649   ROM_REGION(0x010000, "cpu2", 0)
11811650   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
r10613r10614
11841653   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
11851654   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
11861655ROM_END
1187 
1656ROM_START(rctycnl_701)
1657   ROM_REGION(0x80000, "user1", 0)
1658    ROM_LOAD("rctcpu.701", 0x00000, 0x20000, CRC(e1fe89f6) SHA1(9a76a5c267e055fcf0418394762bcea758da02d6))
1659   ROM_RELOAD(0x20000, 0x20000)
1660   ROM_RELOAD(0x40000, 0x20000)
1661   ROM_RELOAD(0x60000, 0x20000)
1662   ROM_REGION(0x10000, "maincpu", 0)
1663   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1664   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1665   ROM_REGION(0x80000, "gfx3", 0)
1666   ROM_LOAD("rctdisps.700", 0x00000, 0x80000, CRC(6921d8cc) SHA1(1ada415af8e949829ceac75da507982ea2091f4d))
1667   ROM_REGION(0x010000, "cpu2", 0)
1668   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
1669   ROM_REGION(0x400000, "sound1", 0)
1670   ROM_LOAD("rcsndu17.100", 0x000000, 0x100000, CRC(18ba20ec) SHA1(c6e7a8a5fd6029b8e884a6eeb779a10d819e8c7c))
1671   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
1672   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
1673ROM_END
1674ROM_START(rctycnl_400)
1675   ROM_REGION(0x80000, "user1", 0)
1676   ROM_LOAD("rctcpu.400", 0x00000, 0x20000, CRC(4691de23) SHA1(f47fc03f9b030cb7a1201d015bbec5a426176338))
1677   ROM_RELOAD(0x20000, 0x20000)
1678   ROM_RELOAD(0x40000, 0x20000)
1679   ROM_RELOAD(0x60000, 0x20000)
1680   ROM_REGION(0x10000, "maincpu", 0)
1681   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1682   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1683   ROM_REGION(0x80000, "gfx3", 0)
1684   ROM_LOAD("rctdisps.400", 0x00000, 0x80000, CRC(c06e6669) SHA1(af389ba74e62d7065b3bc7d5f771a3461704cbe3))
1685   ROM_REGION(0x010000, "cpu2", 0)
1686   ROM_LOAD("rcsndu7.100",0x0000,0x10000,CRC(e6cde9b1) SHA1(cbaadafd18ad9c0338bf2cce94b2c2a89e734778))
1687   ROM_REGION(0x400000, "sound1", 0)
1688   ROM_LOAD("rcsndu17.100", 0x000000, 0x100000, CRC(18ba20ec) SHA1(c6e7a8a5fd6029b8e884a6eeb779a10d819e8c7c))
1689   ROM_LOAD("rcsndu21.100", 0x100000, 0x100000, CRC(64b19c11) SHA1(9ac714d372437cf1d8c4e01512c0647f13e40ddb))
1690   ROM_LOAD("rcsndu36.100", 0x200000, 0x100000, CRC(05c8bac9) SHA1(0771a393d5361c9a35d42a18b6c6a105b7752e03))
1691ROM_END
11881692/*-------------------------------------------------------------------
11891693/ Sharkey's Shootout
11901694/-------------------------------------------------------------------*/
11911695ROM_START(shrkysht)
11921696   ROM_REGION(0x80000, "user1", 0)
1193   ROM_LOAD("sscpu.211", 0x00000, 0x20000, CRC(66a0e5ce) SHA1(d33615081cd8cdf8a17a44b389c6d9746e093510)) // ver 2.11
1194   //ROM_LOAD("sscpu.207", 0x00000, 0x20000, CRC(7355d65d) SHA1(d501cf1ff8b4be01970d47997f71f539df57b702)) // ver 2.07
1697   ROM_LOAD("sscpu.211", 0x00000, 0x20000, CRC(66a0e5ce) SHA1(d33615081cd8cdf8a17a44b389c6d9746e093510))
11951698   ROM_RELOAD(0x20000, 0x20000)
11961699   ROM_RELOAD(0x40000, 0x20000)
11971700   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
12281731   ROM_LOAD("sssndu21.100", 0x100000, 0x100000, CRC(e1fa3f2a) SHA1(08731fd53ef81453a8f20602e76d435c6771bbb9))
12291732   ROM_LOAD("sssndu36.100", 0x200000, 0x100000, CRC(d22fcfa3) SHA1(3fa407f72ecc64f9d00b92122c4e4d85022e4202))
12301733ROM_END
1231ROM_START(shrky_gr)
1734ROM_START(shrkygr)
12321735   ROM_REGION(0x80000, "user1", 0)
12331736   ROM_LOAD("sscpu.211", 0x00000, 0x20000, CRC(66a0e5ce) SHA1(d33615081cd8cdf8a17a44b389c6d9746e093510))
12341737   ROM_RELOAD(0x20000, 0x20000)
r10613r10614
12461749   ROM_LOAD("sssndu21.100", 0x100000, 0x100000, CRC(e1fa3f2a) SHA1(08731fd53ef81453a8f20602e76d435c6771bbb9))
12471750   ROM_LOAD("sssndu36.100", 0x200000, 0x100000, CRC(d22fcfa3) SHA1(3fa407f72ecc64f9d00b92122c4e4d85022e4202))
12481751ROM_END
1249ROM_START(shrky_fr)
1752ROM_START(shrkyfr)
12501753   ROM_REGION(0x80000, "user1", 0)
12511754   ROM_LOAD("sscpu.211", 0x00000, 0x20000, CRC(66a0e5ce) SHA1(d33615081cd8cdf8a17a44b389c6d9746e093510))
12521755   ROM_RELOAD(0x20000, 0x20000)
r10613r10614
12641767   ROM_LOAD("sssndu21.100", 0x100000, 0x100000, CRC(e1fa3f2a) SHA1(08731fd53ef81453a8f20602e76d435c6771bbb9))
12651768   ROM_LOAD("sssndu36.100", 0x200000, 0x100000, CRC(d22fcfa3) SHA1(3fa407f72ecc64f9d00b92122c4e4d85022e4202))
12661769ROM_END
1267ROM_START(shrky_it)
1770ROM_START(shrkyit)
12681771   ROM_REGION(0x80000, "user1", 0)
12691772   ROM_LOAD("sscpu.211", 0x00000, 0x20000, CRC(66a0e5ce) SHA1(d33615081cd8cdf8a17a44b389c6d9746e093510))
12701773   ROM_RELOAD(0x20000, 0x20000)
r10613r10614
12831786   ROM_LOAD("sssndu36.100", 0x200000, 0x100000, CRC(d22fcfa3) SHA1(3fa407f72ecc64f9d00b92122c4e4d85022e4202))
12841787ROM_END
12851788 
1789ROM_START(shrky_207)
1790   ROM_REGION(0x80000, "user1", 0)
1791   ROM_LOAD("sscpu.207", 0x00000, 0x20000, CRC(7355d65d) SHA1(d501cf1ff8b4be01970d47997f71f539df57b702))
1792   ROM_RELOAD(0x20000, 0x20000)
1793   ROM_RELOAD(0x40000, 0x20000)
1794   ROM_RELOAD(0x60000, 0x20000)
1795   ROM_REGION(0x10000, "maincpu", 0)
1796   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1797   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1798   ROM_REGION(0x80000, "gfx3", 0)
1799   ROM_LOAD("ssdispa.201", 0x00000, 0x80000, CRC(3360300b) SHA1(3169651a49bb7168fc04b2ae678b696ec6a21c85))
1800   ROM_REGION(0x010000, "cpu2", 0)
1801   ROM_LOAD("sssndu7.101",0x0000,0x10000,CRC(fbc6267b) SHA1(e6e70662031e5209385f8b9c59296d7423cc03b4))
1802   ROM_REGION(0x400000, "sound1", 0)
1803   ROM_LOAD("sssndu17.100", 0x000000, 0x100000, CRC(dae78d8d) SHA1(a0e1722a19505e7d08266c490d27f772357722d3))
1804   ROM_LOAD("sssndu21.100", 0x100000, 0x100000, CRC(e1fa3f2a) SHA1(08731fd53ef81453a8f20602e76d435c6771bbb9))
1805   ROM_LOAD("sssndu36.100", 0x200000, 0x100000, CRC(d22fcfa3) SHA1(3fa407f72ecc64f9d00b92122c4e4d85022e4202))
1806ROM_END
1807ROM_START(shrkygr_207)
1808   ROM_REGION(0x80000, "user1", 0)
1809   ROM_LOAD("sscpu.207", 0x00000, 0x20000, CRC(7355d65d) SHA1(d501cf1ff8b4be01970d47997f71f539df57b702))
1810   ROM_RELOAD(0x20000, 0x20000)
1811   ROM_RELOAD(0x40000, 0x20000)
1812   ROM_RELOAD(0x60000, 0x20000)
1813   ROM_REGION(0x10000, "maincpu", 0)
1814   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1815   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1816   ROM_REGION(0x80000, "gfx3", 0)
1817   ROM_LOAD("ssdispg.201", 0x00000, 0x80000, CRC(1ad88b75) SHA1(f82ae59b59e545e2023879aad7e99862d9d339c5))
1818   ROM_REGION(0x010000, "cpu2", 0)
1819   ROM_LOAD("sssndu7.101",0x0000,0x10000,CRC(fbc6267b) SHA1(e6e70662031e5209385f8b9c59296d7423cc03b4))
1820   ROM_REGION(0x400000, "sound1", 0)
1821   ROM_LOAD("sssndu17.100", 0x000000, 0x100000, CRC(dae78d8d) SHA1(a0e1722a19505e7d08266c490d27f772357722d3))
1822   ROM_LOAD("sssndu21.100", 0x100000, 0x100000, CRC(e1fa3f2a) SHA1(08731fd53ef81453a8f20602e76d435c6771bbb9))
1823   ROM_LOAD("sssndu36.100", 0x200000, 0x100000, CRC(d22fcfa3) SHA1(3fa407f72ecc64f9d00b92122c4e4d85022e4202))
1824ROM_END
1825ROM_START(shrkyfr_207)
1826   ROM_REGION(0x80000, "user1", 0)
1827   ROM_LOAD("sscpu.207", 0x00000, 0x20000, CRC(7355d65d) SHA1(d501cf1ff8b4be01970d47997f71f539df57b702))
1828   ROM_RELOAD(0x20000, 0x20000)
1829   ROM_RELOAD(0x40000, 0x20000)
1830   ROM_RELOAD(0x60000, 0x20000)
1831   ROM_REGION(0x10000, "maincpu", 0)
1832   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1833   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1834   ROM_REGION(0x80000, "gfx3", 0)
1835   ROM_LOAD("ssdispf.201", 0x00000, 0x80000, CRC(89eaaebf) SHA1(0945a11a8f632cea3b9e9982cc4aed54f12ec55a))
1836   ROM_REGION(0x010000, "cpu2", 0)
1837   ROM_LOAD("sssndu7.101",0x0000,0x10000,CRC(fbc6267b) SHA1(e6e70662031e5209385f8b9c59296d7423cc03b4))
1838   ROM_REGION(0x400000, "sound1", 0)
1839   ROM_LOAD("sssndu17.100", 0x000000, 0x100000, CRC(dae78d8d) SHA1(a0e1722a19505e7d08266c490d27f772357722d3))
1840   ROM_LOAD("sssndu21.100", 0x100000, 0x100000, CRC(e1fa3f2a) SHA1(08731fd53ef81453a8f20602e76d435c6771bbb9))
1841   ROM_LOAD("sssndu36.100", 0x200000, 0x100000, CRC(d22fcfa3) SHA1(3fa407f72ecc64f9d00b92122c4e4d85022e4202))
1842ROM_END
1843ROM_START(shrkyit_207)
1844   ROM_REGION(0x80000, "user1", 0)
1845   ROM_LOAD("sscpu.207", 0x00000, 0x20000, CRC(7355d65d) SHA1(d501cf1ff8b4be01970d47997f71f539df57b702))
1846   ROM_RELOAD(0x20000, 0x20000)
1847   ROM_RELOAD(0x40000, 0x20000)
1848   ROM_RELOAD(0x60000, 0x20000)
1849   ROM_REGION(0x10000, "maincpu", 0)
1850   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1851   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1852   ROM_REGION(0x80000, "gfx3", 0)
1853   ROM_LOAD("ssdispi.201", 0x00000, 0x80000, CRC(fb70641d) SHA1(d152838eeacacc5dfe6fc3bc3f26b4d3e9e4c9cc))
1854   ROM_REGION(0x010000, "cpu2", 0)
1855   ROM_LOAD("sssndu7.101",0x0000,0x10000,CRC(fbc6267b) SHA1(e6e70662031e5209385f8b9c59296d7423cc03b4))
1856   ROM_REGION(0x400000, "sound1", 0)
1857   ROM_LOAD("sssndu17.100", 0x000000, 0x100000, CRC(dae78d8d) SHA1(a0e1722a19505e7d08266c490d27f772357722d3))
1858   ROM_LOAD("sssndu21.100", 0x100000, 0x100000, CRC(e1fa3f2a) SHA1(08731fd53ef81453a8f20602e76d435c6771bbb9))
1859   ROM_LOAD("sssndu36.100", 0x200000, 0x100000, CRC(d22fcfa3) SHA1(3fa407f72ecc64f9d00b92122c4e4d85022e4202))
1860ROM_END
1861 
12861862/*-------------------------------------------------------------------
12871863/ South Park
12881864/-------------------------------------------------------------------*/
r10613r10614
16262202ROM_START(term3)
16272203   ROM_REGION(0x80000, "user1", 0)
16282204   ROM_LOAD("t3cpu.400", 0x00000, 0x20000, CRC(872f9351) SHA1(8fa8b503d8c3dbac66df1cb0ba400dbd58ee28ee))
1629//ROM_LOAD( "t3cpu.205",     0x0000, 0x20000, CRC(219d8155) SHA1(dac3c390d238872703a0ec65cb3dddc89630359c))
1630//ROM_LOAD( "t3dispa.201",   0x0000, 0x80000, CRC(a314acd1) SHA1(4d5072e65f8041d24c1bab2985ef5b30e1895bf3))
1631//ROM_LOAD( "t3dispf.201",   0x0000, 0x80000, CRC(ced87154) SHA1(893c071bb2427429ca45f4d2088b015c5f638207))
1632//ROM_LOAD( "t3dispi.201",   0x0000, 0x80000, CRC(c1f3604f) SHA1(8a391e6471ced52662aa69261ac29a279c7b8a7d))
1633//ROM_LOAD( "t3displ.201",   0x0000, 0x80000, CRC(180b55a2) SHA1(1d8161fc806804e0712ee8a07a2cac0561949f0c))
1634 
16352205   ROM_RELOAD(0x20000, 0x20000)
16362206   ROM_RELOAD(0x40000, 0x20000)
16372207   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
16482218   ROM_LOAD("t3100.u36", 0x200000, 0x100000, CRC(9eb512e9) SHA1(fa2fecf6cb0c1af3c6db244f9d94ba53d13e10fc))
16492219   ROM_LOAD("t3100.u37", 0x300000, 0x100000, CRC(3efb0c19) SHA1(6894295eef05891d64c7274512ba27f2b63ca3ec))
16502220ROM_END
2221ROM_START(term3_205)
2222   ROM_REGION(0x80000, "user1", 0)
2223   ROM_LOAD( "t3cpu.205",     0x0000, 0x20000, CRC(219d8155) SHA1(dac3c390d238872703a0ec65cb3dddc89630359c))
2224   ROM_RELOAD(0x20000, 0x20000)
2225   ROM_RELOAD(0x40000, 0x20000)
2226   ROM_RELOAD(0x60000, 0x20000)
2227   ROM_REGION(0x10000, "maincpu", 0)
2228   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
2229   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
2230   ROM_REGION(0x80000, "gfx3", 0)
2231   ROM_LOAD( "t3dispa.201",   0x0000, 0x80000, CRC(a314acd1) SHA1(4d5072e65f8041d24c1bab2985ef5b30e1895bf3))
2232   ROM_REGION(0x010000, "cpu2", 0)
2233   ROM_LOAD("t3100.u7",0x0000,0x10000,CRC(7f99e3af) SHA1(4916c074e2a4c947d1a658300f9f9629da1a8bb8))
2234   ROM_REGION(0x400000, "sound1", 0)
2235   ROM_LOAD("t3100.u17", 0x000000, 0x100000, CRC(f0c71b5d) SHA1(e9f726a232fbd4f34b8b07069f337dbb3daf394a))
2236   ROM_LOAD("t3100.u21", 0x100000, 0x100000, CRC(694331f7) SHA1(e9ae8c5db2e59c0f9df923c98f6e75896e150807))
2237   ROM_LOAD("t3100.u36", 0x200000, 0x100000, CRC(9eb512e9) SHA1(fa2fecf6cb0c1af3c6db244f9d94ba53d13e10fc))
2238   ROM_LOAD("t3100.u37", 0x300000, 0x100000, CRC(3efb0c19) SHA1(6894295eef05891d64c7274512ba27f2b63ca3ec))
2239ROM_END
16512240ROM_START(t3new)
16522241   ROM_REGION(0x80000, "user1", 0)
16532242   ROM_LOAD("t3cpu.400", 0x00000, 0x20000, CRC(872f9351) SHA1(8fa8b503d8c3dbac66df1cb0ba400dbd58ee28ee))
r10613r10614
17082297   ROM_LOAD("t3100.u36", 0x200000, 0x100000, CRC(9eb512e9) SHA1(fa2fecf6cb0c1af3c6db244f9d94ba53d13e10fc))
17092298   ROM_LOAD("t3100.u37", 0x300000, 0x100000, CRC(3efb0c19) SHA1(6894295eef05891d64c7274512ba27f2b63ca3ec))
17102299ROM_END
2300ROM_START(term3l_205)
2301   ROM_REGION(0x80000, "user1", 0)
2302   ROM_LOAD( "t3cpu.205",     0x0000, 0x20000, CRC(219d8155) SHA1(dac3c390d238872703a0ec65cb3dddc89630359c))
2303   ROM_RELOAD(0x20000, 0x20000)
2304   ROM_RELOAD(0x40000, 0x20000)
2305   ROM_RELOAD(0x60000, 0x20000)
2306   ROM_REGION(0x10000, "maincpu", 0)
2307   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
2308   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
2309   ROM_REGION(0x80000, "gfx3", 0)
2310   ROM_LOAD( "t3displ.201",   0x0000, 0x80000, CRC(180b55a2) SHA1(1d8161fc806804e0712ee8a07a2cac0561949f0c))
2311   ROM_REGION(0x010000, "cpu2", 0)
2312   ROM_LOAD("t3100.u7",0x0000,0x10000,CRC(7f99e3af) SHA1(4916c074e2a4c947d1a658300f9f9629da1a8bb8))
2313   ROM_REGION(0x400000, "sound1", 0)
2314   ROM_LOAD("t3100.u17", 0x000000, 0x100000, CRC(f0c71b5d) SHA1(e9f726a232fbd4f34b8b07069f337dbb3daf394a))
2315   ROM_LOAD("t3100.u21", 0x100000, 0x100000, CRC(694331f7) SHA1(e9ae8c5db2e59c0f9df923c98f6e75896e150807))
2316   ROM_LOAD("t3100.u36", 0x200000, 0x100000, CRC(9eb512e9) SHA1(fa2fecf6cb0c1af3c6db244f9d94ba53d13e10fc))
2317   ROM_LOAD("t3100.u37", 0x300000, 0x100000, CRC(3efb0c19) SHA1(6894295eef05891d64c7274512ba27f2b63ca3ec))
2318ROM_END
17112319ROM_START(term3f)
17122320   ROM_REGION(0x80000, "user1", 0)
17132321   ROM_LOAD("t3cpu.400", 0x00000, 0x20000, CRC(872f9351) SHA1(8fa8b503d8c3dbac66df1cb0ba400dbd58ee28ee))
r10613r10614
17272335   ROM_LOAD("t3100.u36", 0x200000, 0x100000, CRC(9eb512e9) SHA1(fa2fecf6cb0c1af3c6db244f9d94ba53d13e10fc))
17282336   ROM_LOAD("t3100.u37", 0x300000, 0x100000, CRC(3efb0c19) SHA1(6894295eef05891d64c7274512ba27f2b63ca3ec))
17292337ROM_END
2338ROM_START(term3f_205)
2339   ROM_REGION(0x80000, "user1", 0)
2340   ROM_LOAD( "t3cpu.205",     0x0000, 0x20000, CRC(219d8155) SHA1(dac3c390d238872703a0ec65cb3dddc89630359c))
2341   ROM_RELOAD(0x20000, 0x20000)
2342   ROM_RELOAD(0x40000, 0x20000)
2343   ROM_RELOAD(0x60000, 0x20000)
2344   ROM_REGION(0x10000, "maincpu", 0)
2345   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
2346   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
2347   ROM_REGION(0x80000, "gfx3", 0)
2348   ROM_LOAD( "t3dispf.201",   0x0000, 0x80000, CRC(ced87154) SHA1(893c071bb2427429ca45f4d2088b015c5f638207))
2349   ROM_REGION(0x010000, "cpu2", 0)
2350   ROM_LOAD("t3100.u7",0x0000,0x10000,CRC(7f99e3af) SHA1(4916c074e2a4c947d1a658300f9f9629da1a8bb8))
2351   ROM_REGION(0x400000, "sound1", 0)
2352   ROM_LOAD("t3100.u17", 0x000000, 0x100000, CRC(f0c71b5d) SHA1(e9f726a232fbd4f34b8b07069f337dbb3daf394a))
2353   ROM_LOAD("t3100.u21", 0x100000, 0x100000, CRC(694331f7) SHA1(e9ae8c5db2e59c0f9df923c98f6e75896e150807))
2354   ROM_LOAD("t3100.u36", 0x200000, 0x100000, CRC(9eb512e9) SHA1(fa2fecf6cb0c1af3c6db244f9d94ba53d13e10fc))
2355   ROM_LOAD("t3100.u37", 0x300000, 0x100000, CRC(3efb0c19) SHA1(6894295eef05891d64c7274512ba27f2b63ca3ec))
2356ROM_END
17302357ROM_START(term3i)
17312358   ROM_REGION(0x80000, "user1", 0)
17322359   ROM_LOAD("t3cpu.400", 0x00000, 0x20000, CRC(872f9351) SHA1(8fa8b503d8c3dbac66df1cb0ba400dbd58ee28ee))
r10613r10614
17472374   ROM_LOAD("t3100.u37", 0x300000, 0x100000, CRC(3efb0c19) SHA1(6894295eef05891d64c7274512ba27f2b63ca3ec))
17482375ROM_END
17492376 
2377ROM_START(term3i_205)
2378   ROM_REGION(0x80000, "user1", 0)
2379   ROM_LOAD( "t3cpu.205",     0x0000, 0x20000, CRC(219d8155) SHA1(dac3c390d238872703a0ec65cb3dddc89630359c))
2380   ROM_RELOAD(0x20000, 0x20000)
2381   ROM_RELOAD(0x40000, 0x20000)
2382   ROM_RELOAD(0x60000, 0x20000)
2383   ROM_REGION(0x10000, "maincpu", 0)
2384   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
2385   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
2386   ROM_REGION(0x80000, "gfx3", 0)
2387   ROM_LOAD( "t3dispi.201",   0x0000, 0x80000, CRC(c1f3604f) SHA1(8a391e6471ced52662aa69261ac29a279c7b8a7d))
2388   ROM_REGION(0x010000, "cpu2", 0)
2389   ROM_LOAD("t3100.u7",0x0000,0x10000,CRC(7f99e3af) SHA1(4916c074e2a4c947d1a658300f9f9629da1a8bb8))
2390   ROM_REGION(0x400000, "sound1", 0)
2391   ROM_LOAD("t3100.u17", 0x000000, 0x100000, CRC(f0c71b5d) SHA1(e9f726a232fbd4f34b8b07069f337dbb3daf394a))
2392   ROM_LOAD("t3100.u21", 0x100000, 0x100000, CRC(694331f7) SHA1(e9ae8c5db2e59c0f9df923c98f6e75896e150807))
2393   ROM_LOAD("t3100.u36", 0x200000, 0x100000, CRC(9eb512e9) SHA1(fa2fecf6cb0c1af3c6db244f9d94ba53d13e10fc))
2394   ROM_LOAD("t3100.u37", 0x300000, 0x100000, CRC(3efb0c19) SHA1(6894295eef05891d64c7274512ba27f2b63ca3ec))
2395ROM_END
2396 
17502397/*-------------------------------------------------------------------
17512398/ The Brain
17522399/-------------------------------------------------------------------*/
r10613r10614
17992446ROM_START(simpprty)
18002447   ROM_REGION(0x80000, "user1", 0)
18012448   ROM_LOAD("spp-cpu.500", 0x00000, 0x20000, CRC(215ce09c) SHA1(f3baaaa1b9f12a98109da55746031eb9f5f8790c)) // ver 5.00
1802   //ROM_LOAD("spp-cpu.204", 0x00000, 0x20000, CRC(5bc155f7) SHA1(78d793cecbc6561a891ff8007f33c63ec5515e9f)) // ver 2.04
2449//ROM_LOAD( "spp-cpu.400",   0x0000, 0x20000, CRC(530b9782) SHA1(573b20cac205b7989cdefceb2c31cb7d88c2951a))
2450//ROM_LOAD( "sppdspa.400",   0x0000, 0x80000, CRC(cd5eaab7) SHA1(a06bef6fc0e7f3c0616439cb0e0431a3d52cdfa1))
2451//ROM_LOAD("spp-cpu.204", 0x00000, 0x20000, CRC(5bc155f7) SHA1(78d793cecbc6561a891ff8007f33c63ec5515e9f)) // ver 2.04
18032452//ROM_LOAD( "sppdspf.400",   0x0000, 0x80000, CRC(6cc306e2) SHA1(bfe6ef0cd5d0cb5e3b29d85ade1700005e22d81b))
18042453//ROM_LOAD( "sppdspg.400",   0x0000, 0x80000, CRC(3b408fe2) SHA1(ce8d7f0d58b5f8fb4df0b9811449e4dc0e1e6580))
18052454//ROM_LOAD( "sppdspi.400",   0x0000, 0x80000, CRC(ebe45dee) SHA1(4cdf0f01b1df1fa35df67f19c67b82a39d887be8))
18062455//ROM_LOAD( "sppdspl.400",   0x0000, 0x80000, CRC(a0bf567e) SHA1(ce6eb65da6bff15aeb787fd2cdac7cf6b4300108))
1807//ROM_LOAD( "spp-cpu.400",   0x0000, 0x20000, CRC(530b9782) SHA1(573b20cac205b7989cdefceb2c31cb7d88c2951a))
1808//ROM_LOAD( "sppdspa.400",   0x0000, 0x80000, CRC(cd5eaab7) SHA1(a06bef6fc0e7f3c0616439cb0e0431a3d52cdfa1))
18092456 
18102457   ROM_RELOAD(0x20000, 0x20000)
18112458   ROM_RELOAD(0x40000, 0x20000)
r10613r10614
20572704   ROM_RELOAD(0x300000 + 0x80000, 0x80000)
20582705ROM_END
20592706 
2707/*-------------------------------------------------------------
2708/ Cut The Cheese Deluxe (Redemption, Whitestar hardware)
2709/------------------------------------------------------------*/
2710ROM_START(ctchzdlx)
2711   ROM_REGION(0x80000, "user1", 0)
2712   ROM_LOAD("ctcdxcpu.100", 0x00000, 0x20000, CRC(faad6656) SHA1(4d868bc31f35e848424e3bb66cb87efe0cf24eca))
2713   ROM_RELOAD(0x20000, 0x20000)
2714   ROM_RELOAD(0x40000, 0x20000)
2715   ROM_RELOAD(0x60000, 0x20000)
2716   ROM_REGION(0x10000, "maincpu", 0)
2717   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
2718   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
2719   ROM_REGION(0x80000, "gfx3", 0)
2720   ROM_LOAD("ctcdxdsp.100", 0x00000, 0x80000, CRC(de61b12e) SHA1(2ef8f02ca995e67d1feebd33306f92e885077101))
2721   ROM_REGION(0x010000, "cpu2", 0)
2722   ROM_LOAD("ctcu7d.bin", 0x0000, 0x10000, CRC(92bfe454) SHA1(8182f7ac84addf8bdb7976a85c801edf3424d16b))
2723   ROM_REGION(0x200000, "sound1", 0)
2724   ROM_LOAD("ctcu17.bin", 0x000000, 0x80000, NO_DUMP)
2725   ROM_RELOAD(0x000000 + 0x80000, 0x80000)
2726   ROM_LOAD("ctcu21.bin", 0x100000, 0x80000, NO_DUMP)
2727   ROM_RELOAD(0x100000 + 0x80000, 0x80000)
2728ROM_END
2729 
2730/*-------------------------------------------------------------------
2731/ Wack-A-Doodle-Doo (Redemption)
2732/-------------------------------------------------------------------*/
2733ROM_START(wackadoo)
2734   ROM_REGION(0x80000, "user1", 0)
2735   ROM_LOAD("wackcpu.100", 0x00000, 0x20000, CRC(995e0219) SHA1(57b2352a5a96e71ff48f838fde87a158afbf3701))
2736   ROM_RELOAD(0x20000, 0x20000)
2737   ROM_RELOAD(0x40000, 0x20000)
2738   ROM_RELOAD(0x60000, 0x20000)
2739   ROM_REGION(0x10000, "maincpu", 0)
2740   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
2741   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
2742   ROM_REGION(0x80000, "gfx3", 0)
2743   ROM_LOAD("wackdisp.bin", 0x00000, 0x80000, CRC(8b46f074) SHA1(38a98fff56186d1a152e2c2e321496fd24e9ad56))
2744   ROM_REGION(0x010000, "cpu2", 0)
2745   ROM_LOAD("wacku7.bin", 0x0000, 0x10000, CRC(99df3022) SHA1(5a38cf0816b95ea399d659d724b3259fadb42a62))
2746   ROM_REGION(0x200000, "sound1", 0)
2747   ROM_LOAD("wacku17.bin", 0x000000, 0x80000, CRC(1876e659) SHA1(1ff3a6d7a7b2582d0482eae024efa078d0a61dbe))
2748   ROM_RELOAD(0x000000 + 0x80000, 0x80000)
2749   ROM_LOAD("wacku21.bin", 0x100000, 0x80000, CRC(a3207296) SHA1(19af8ebab298a353fe42fc297b61182d8f772347))
2750   ROM_RELOAD(0x100000 + 0x80000, 0x80000)
2751ROM_END
2752 
2753/*-------------------------------------------------------------------
2754/ Titanic (Coin dropper)
2755/-------------------------------------------------------------------*/
2756ROM_START(titanic)
2757   ROM_REGION(0x80000, "user1", 0)
2758   ROM_LOAD("titacpu.101", 0x00000, 0x20000, CRC(4217becf) SHA1(8b7aacbe75717f13623f6ceaa4ba2de61b1b732a))
2759   ROM_RELOAD(0x20000, 0x20000)
2760   ROM_RELOAD(0x40000, 0x20000)
2761   ROM_RELOAD(0x60000, 0x20000)
2762   ROM_REGION(0x10000, "maincpu", 0)
2763   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
2764   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
2765   ROM_REGION(0x80000, "gfx3", 0)
2766   ROM_LOAD("titadspa.101", 0x00000, 0x80000, CRC(5b4300b6) SHA1(c2b2de20f6c74b71d2a9ac43c17694eadd795586))
2767   ROM_REGION(0x010000, "cpu2", 0)
2768   ROM_LOAD("titau7.101", 0x0000, 0x10000, CRC(544fe1ac) SHA1(5c62eef6a42660b13e626d1a6bb8cd09b77b0cc1))
2769   ROM_REGION(0x200000, "sound1", 0)
2770   ROM_LOAD("titau17.100", 0x000000, 0x80000, CRC(ab919e99) SHA1(8735b632a62d9cd3db26b3c832785c48552ba231))
2771   ROM_RELOAD(0x000000 + 0x80000, 0x80000)
2772   ROM_LOAD("titau21.100", 0x100000, 0x80000, CRC(76ca05f8) SHA1(3e1c56fe37393c345111665fd8ab730d53cb6970))
2773   ROM_RELOAD(0x100000 + 0x80000, 0x80000)
2774ROM_END
2775 
2776/*-------------------------------------------------------------------
2777/ Monopoly (Coin dropper)
2778/-------------------------------------------------------------------*/
2779ROM_START(monopred)
2780   ROM_REGION(0x80000, "user1", 0)
2781   ROM_LOAD("monopcpu.401", 0x00000, 0x20000, CRC(2d0ff130) SHA1(c0b7baa6973db8743186a950b0a1ad3383db5c98))
2782   ROM_RELOAD(0x20000, 0x20000)
2783   ROM_RELOAD(0x40000, 0x20000)
2784   ROM_RELOAD(0x60000, 0x20000)
2785   ROM_REGION(0x10000, "maincpu", 0)
2786   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
2787   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
2788   ROM_REGION(0x80000, "gfx3", 0)
2789   ROM_LOAD("monopdsp.400", 0x00000, 0x80000, CRC(0105572b) SHA1(fd9e1dfa4f396b953f82ccde11b54ee638382bee))
2790   ROM_REGION(0x010000, "cpu2", 0)
2791   ROM_LOAD("monopred.u7", 0x0000, 0x10000, CRC(1ca0cf63) SHA1(c4ce78718e3e3f1a8451b134f2869dd6410fee30))
2792   ROM_REGION(0x200000, "sound1", 0)
2793   ROM_LOAD("monopred.u17", 0x000000, 0x100000, CRC(467dca62) SHA1(c727748b6b0b39ead19ce98bddd89fd05fb62d00))
2794ROM_END
2795 
20602796GAME(1995,   apollo13,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Apollo 13",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
20612797GAME(2001,   austin,      0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Austin Powers (3.02)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2798GAME(2001,   aust301,   austin,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Austin Powers (3.01)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2799GAME(2001,   aust300,   austin,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Austin Powers (3.00)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2800GAME(2001,   aust201,   austin,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Austin Powers (2.01)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
20622801GAME(2001,   austnew,   austin,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Austin Powers (ARM7 Sound Board)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
20632802GAME(2001,   austinf,   austin,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Austin Powers (France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
20642803GAME(2001,   austing,   austin,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Austin Powers (Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
r10613r10614
20922831GAME(1996,   id4,      0,         whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Independence Day",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
20932832GAME(1998,   lostspc,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Lost in Space",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
20942833GAME(2001,   monopolp,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (3.20)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2095GAME(2002,   monopole,   monopolp,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (3.03)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2834GAME(2002,   monop303,   monopolp,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (3.03)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2835GAME(2002,   monop301,   monopolp,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (3.01)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2836GAME(2002,   monop251,   monopolp,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (2.51)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2837GAME(2002,   monop233,   monopolp,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (2.33)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
20962838GAME(2002,   monopolf,   monopolp,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
20972839GAME(2002,   monopolg,   monopolp,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
20982840GAME(2002,   monopoli,   monopolp,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
r10613r10614
21002842GAME(2002,   mononew,   monopolp,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (ARM7 Sound Board)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21012843GAME(2001,   nfl,      0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "NFL",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21022844GAME(2002,   playboys,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (5.00)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2845GAME(2002,   playboys_303,playboys,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (3.03)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2846GAME(2002,   playboys_300,playboys,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (3.00)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21032847GAME(2002,   playnew,   playboys,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (ARM7 Sound Board)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2104GAME(2002,   playboyf,   playboys,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2105GAME(2002,   playboyg,   playboys,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2106GAME(2002,   playboyi,   playboys,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2107GAME(2002,   playboyl,   playboys,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2848GAME(2002,   playboyf,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (5.00 France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2849GAME(2002,   playboyf_303,playboyf,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (3.03 France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2850GAME(2002,   playboyf_300,playboyf,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (3.00 France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2851GAME(2002,   playboyg,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (5.00 Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2852GAME(2002,   playboyg_303,playboyg,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (3.03 Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2853GAME(2002,   playboyg_300,playboyg,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (3.00 Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2854GAME(2002,   playboyi,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (5.00 Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2855GAME(2002,   playboyi_303,playboyi,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (3.03 Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2856GAME(2002,   playboyi_300,playboyi,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (3.00 Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2857GAME(2002,   playboyl,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (5.00 Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2858GAME(2002,   playboyl_303,playboyl,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (3.03 Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2859GAME(2002,   playboyl_300,playboyl,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Playboy (3.00 Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21082860GAME(2002,   rctycn,      0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (7.02)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2861GAME(2002,   rctycn_701,   rctycn,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (7.01)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2862GAME(2002,   rctycn_400, rctycn,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (4.00)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21092863GAME(2002,   rctnew,      rctycn,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (ARM7 Sound Board)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2110GAME(2002,   rctycng,   rctycn,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2111GAME(2002,   rctycnf,   rctycn,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2112GAME(2002,   rctycni,   rctycn,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2113GAME(2002,   rctycnl,   rctycn,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2864GAME(2002,   rctycng,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (7.02 Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2865GAME(2002,   rctycng_701,rctycng,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (7.01 Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2866GAME(2002,   rctycng_400,rctycng,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (4.00 Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2867GAME(2002,   rctycnf,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (7.02 France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2868GAME(2002,   rctycnf_701,rctycnf,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (7.01 France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2869GAME(2002,   rctycnf_400,rctycnf,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (4.00 France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2870GAME(2002,   rctycni,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (7.02 Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2871GAME(2002,   rctycni_701,rctycni,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (7.01 Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2872GAME(2002,   rctycni_400,rctycni,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (4.00 Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2873GAME(2002,   rctycnl,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (7.02 Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2874GAME(2002,   rctycnl_701,rctycnl,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (7.01 Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2875GAME(2002,   rctycnl_400,rctycnl,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Roller Coaster Tycoon (4.00 Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21142876GAME(2000,   shrkysht,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (2.11)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2877GAME(2000,   shrky_207,   shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (2.07)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21152878GAME(2001,   shrknew,   shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (ARM7 Sound Board)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2116GAME(2001,   shrky_gr,   shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2117GAME(2001,   shrky_fr,   shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2118GAME(2001,   shrky_it,   shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2879GAME(2001,   shrkygr,   shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (2.11 Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2880GAME(2001,   shrkygr_207,shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (2.07 Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2881GAME(2001,   shrkyfr,   shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (2.11 France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2882GAME(2001,   shrkyfr_207,shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (2.07 France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2883GAME(2001,   shrkyit,   shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (2.11 Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2884GAME(2001,   shrkyit_207,shrkysht,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Sharkey's Shootout (2.07 Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21192885GAME(1999,   sprk_103,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "South Park (1.03)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21202886GAME(1999,   sprk_090,   sprk_103,   whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "South Park (0.90)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21212887GAME(1997,   spacejam,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Space Jam",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
r10613r10614
21332899GAME(1999,   strxt_it,   strikext,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Striker Xtreme (Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21342900GAME(1999,   strxt_sp,   strikext,   whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Striker Xtreme (Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21352901GAME(2003,   term3,      0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (4.00)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2136GAME(2003,   t3new,      term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2137GAME(2003,   term3g,      term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (ARM7 Sound Board)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2138GAME(2003,   term3l,      term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2139GAME(2003,   term3f,      term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2140GAME(2003,   term3i,      term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2902GAME(2003,   term3_205,   term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (2.05)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2903GAME(2003,   t3new,      term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (ARM7 Sound Board)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2904GAME(2003,   term3g,      term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (4.00 Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2905GAME(2003,   term3l,      term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (4.00 Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2906GAME(2003,   term3l_205,   term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (2.05 Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2907GAME(2003,   term3f,      term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (4.00 France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2908GAME(2003,   term3f_205,   term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (2.05 France)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2909GAME(2003,   term3i,      term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (4.00 Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2910GAME(2003,   term3i_205,   term3,      whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Terminator 3: Rise of the Machines (2.05 Italy)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21412911GAME(1997,   jplstw22,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Lost World: Jurassic Park, The (2.02)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21422912GAME(1997,   jplstw20,   jplstw22,   whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Lost World: Jurassic Park, The (2.00)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21432913GAME(2003,   simpprty,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Simpsons Pinball Party, The (5.00)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
r10613r10614
21522922GAME(1996,   twst_404,   twst_405,   whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Twister (4.04)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21532923GAME(1996,   twst_300,   twst_405,   whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Twister (3.00)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
21542924GAME(1998,   viprsega,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Viper Night Drivin'",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2925GAME(1998,   ctchzdlx,   ctcheese,   whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Cut The Cheese Deluxe (Redemption)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2926GAME(1998,   titanic,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Titanic (Coin dropper)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2927GAME(2002,   monopred,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Stern",   "Monopoly (Coin dropper)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
2928GAME(1998,   wackadoo,   0,         whitestar,   whitestar,   whitestar,   ROT0,   "Sega",      "Wack-A-Doodle-Doo (Redemption)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
src/mame/drivers/polepos.c
r10613r10614
350350
351351static CUSTOM_INPUT( high_port_r ) { return input_port_read(field->port->machine, (const char *)param) >> 4; }
352352static CUSTOM_INPUT( low_port_r ) { return input_port_read(field->port->machine, (const char *)param) & 0x0f; }
353static CUSTOM_INPUT( auto_start_r ) {
354   polepos_state *state = field->port->machine->driver_data<polepos_state>(); return state->auto_start_mask; }
353static CUSTOM_INPUT( auto_start_r )
354{
355   polepos_state *state = field->port->machine->driver_data<polepos_state>();
356   return state->auto_start_mask;
357}
355358
356359static WRITE8_DEVICE_HANDLER( out_0 )
357360{
src/mame/drivers/bartop52.c
r10613r10614
126126   MCFG_PALETTE_INIT(atari)
127127
128128   MCFG_VIDEO_START(atari)
129   
129
130130   /* sound hardware */
131131   MCFG_SPEAKER_STANDARD_MONO("mono")
132132   MCFG_SOUND_ADD("pokey", POKEY, FREQ_17_EXACT)
src/mame/drivers/atetris.c
r10613r10614
400400   MCFG_SCREEN_UPDATE(atetris)
401401
402402   MCFG_VIDEO_START(atetris)
403   
403
404404   /* sound hardware */
405405   MCFG_SPEAKER_STANDARD_MONO("mono")
406406
src/mame/drivers/blockade.c
r10613r10614
593593GAMEL(1976, blockade,  0,        blockade, blockade, 0, ROT0, "Gremlin", "Blockade", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE, layout_blockade )
594594GAMEL(1976, comotion,  0,        blockade, comotion, 0, ROT0, "Gremlin", "Comotion", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE, layout_blockade )
595595GAME( 1978, blasto,    0,        blasto,   blasto,   0, ROT0, "Gremlin", "Blasto", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // b/w, no overlay
596GAMEL(1977, hustle,    0,        blasto,   hustle,   0, ROT0, "Gremlin", "Hustle", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE, layout_blockade ) // also seen with a yellow overlay, but much less common than green
596GAMEL(1977, hustle,    0,        blasto,   hustle,   0, ROT0, "Gremlin", "Hustle", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE, layout_blockade )
597597GAME( 1977, mineswpr,  0,        blasto,   mineswpr, 0, ROT0, "Amutech", "Minesweeper", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
598598GAME( 1977, mineswpr4, mineswpr, blasto,   mineswpr4,0, ROT0, "Amutech", "Minesweeper (4-Player)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
src/mame/drivers/toaplan1.c
r10613r10614
18201820   MCFG_PALETTE_LENGTH((64*16)+(64*16))
18211821
18221822   MCFG_VIDEO_START(toaplan1)
1823   
1823
18241824   /* sound hardware */
18251825   MCFG_SPEAKER_STANDARD_MONO("mono")
18261826
src/mame/drivers/subsino.c
r10613r10614
11071107   AM_RANGE( 0xfc00, 0xfdff ) AM_RAM_WRITE(subsino_reel3_ram_w) AM_BASE(&reel3_ram)
11081108ADDRESS_MAP_END
11091109
1110
1111/***************************************************************************
1112                        Magic Train (Clear NVRAM ROM?)
1113***************************************************************************/
1114
1115static ADDRESS_MAP_START( mtrainnv_map, ADDRESS_SPACE_PROGRAM, 8 )
1116   AM_RANGE( 0x00000, 0x0bfff ) AM_ROM
1117
1118   AM_RANGE( 0x0c000, 0x0cfff ) AM_RAM
1119
1120   AM_RANGE( 0x0d000, 0x0d000 ) AM_READ_PORT( "SW1" )
1121   AM_RANGE( 0x0d001, 0x0d001 ) AM_READ_PORT( "SW2" )
1122   AM_RANGE( 0x0d002, 0x0d002 ) AM_READ_PORT( "SW3" )
1123
1124   AM_RANGE( 0x0d004, 0x0d004 ) AM_READ_PORT( "SW4" )
1125   AM_RANGE( 0x0d005, 0x0d005 ) AM_READ_PORT( "INB" )
1126   AM_RANGE( 0x0d006, 0x0d006 ) AM_READ_PORT( "INA" )
1127//  AM_RANGE( 0x0d008, 0x0d008 ) AM_READWRITE
1128//  AM_RANGE( 0x0d009, 0x0d009 ) AM_WRITE
1129//  AM_RANGE( 0x0d00a, 0x0d00a ) AM_WRITE
1130//  AM_RANGE( 0x0d00b, 0x0d00b ) AM_WRITE
1131   AM_RANGE( 0x0d00c, 0x0d00c ) AM_READ_PORT( "INC" )
1132
1133   AM_RANGE( 0x0d010, 0x0d013 ) AM_WRITE(colordac_w)
1134
1135//  AM_RANGE( 0x0d012, 0x0d012 ) AM_WRITE
1136
1137   AM_RANGE( 0x0d016, 0x0d017 ) AM_DEVWRITE( "ymsnd", ym3812_w )
1138
1139//  AM_RANGE( 0x0d018, 0x0d018 ) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write)
1140
1141   AM_RANGE( 0x0e000, 0x0e7ff ) AM_RAM_WRITE( subsino_colorram_w ) AM_BASE( &colorram )
1142   AM_RANGE( 0x0e800, 0x0efff ) AM_RAM_WRITE( subsino_videoram_w ) AM_BASE( &videoram )
1143
1144   AM_RANGE( 0xf000, 0xf7ff ) AM_READWRITE(reel_scrollattr_r, reel_scrollattr_w)
1145
1146   AM_RANGE( 0xf800, 0xf9ff ) AM_RAM_WRITE(subsino_reel1_ram_w) AM_BASE(&reel1_ram)
1147   AM_RANGE( 0xfa00, 0xfbff ) AM_RAM_WRITE(subsino_reel2_ram_w) AM_BASE(&reel2_ram)
1148   AM_RANGE( 0xfc00, 0xfdff ) AM_RAM_WRITE(subsino_reel3_ram_w) AM_BASE(&reel3_ram)
1149ADDRESS_MAP_END
1150
1151
11101152static ADDRESS_MAP_START( subsino_iomap, ADDRESS_SPACE_IO, 8 )
11111153   AM_RANGE( 0x0000, 0x003f ) AM_RAM // internal regs
11121154ADDRESS_MAP_END
r10613r10614
26262668   MCFG_PALETTE_INIT(subsino_3proms)
26272669
26282670   MCFG_VIDEO_START(subsino)
2629   
2671
26302672   /* sound hardware */
26312673   MCFG_SPEAKER_STANDARD_MONO("mono")
26322674
r10613r10614
27032745   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
27042746MACHINE_CONFIG_END
27052747
2748static MACHINE_CONFIG_DERIVED( mtrainnv, stisub )
27062749
2750   /* basic machine hardware */
2751   MCFG_CPU_MODIFY("maincpu")
2752   MCFG_CPU_PROGRAM_MAP(mtrainnv_map)
2753MACHINE_CONFIG_END
2754
2755
27072756/***************************************************************************
27082757*                               ROMs Loading                               *
27092758***************************************************************************/
r10613r10614
33563405
33573406
33583407/***************************************************************************
3408
3409  This is allegedly Magic Train - Clear NVRAM ROM:
3410
3411  Subsino sold a "Settings/Clear ROM" for some released titles.
3412  These devices are *extremely* expensive (and ultra rare, only sold
3413  to big casino corporations), and should be placed in the empty socket
3414  to fix a dead board due to NVRAM corruption.
3415
3416  A version of Magic Train running on subsino.c (unlike mtrain, which is
3417  subsino2.c) is needed to match this program ROM.
3418
3419***************************************************************************/
3420
3421ROM_START( mtrainnv )
3422   ROM_REGION( 0x10000, "maincpu", 0 )
3423   ROM_LOAD( "mtrain_settings.bin", 0x00000, 0x10000, CRC(584af1b5) SHA1(91d966d282823dddfdc455bb03728fcdf3713dd7) )
3424
3425   ROM_REGION( 0x10000, "tilemap", 0 )
3426   ROM_COPY( "maincpu", 0x0000, 0x00000, 0x10000 )   // just to show something
3427
3428   ROM_REGION( 0x10000, "reels", 0 )
3429   ROM_COPY( "maincpu", 0x0000, 0x00000, 0x10000 )   // just to show something
3430ROM_END
3431
3432
3433/***************************************************************************
33593434*                        Driver Init / Decryption                          *
33603435***************************************************************************/
33613436
r10613r10614
35293604   reel1_attr = auto_alloc_array(machine, UINT8, 0x200);
35303605   reel2_attr = auto_alloc_array(machine, UINT8, 0x200);
35313606   reel3_attr = auto_alloc_array(machine, UINT8, 0x200);
3607}
35323608
3609static DRIVER_INIT( mtrainnv )
3610{
3611   stisub_colorram = auto_alloc_array(machine, UINT8, 256*3);
3612
3613   reel1_scroll = auto_alloc_array(machine, UINT8, 0x40);
3614   reel2_scroll = auto_alloc_array(machine, UINT8, 0x40);
3615   reel3_scroll = auto_alloc_array(machine, UINT8, 0x40);
3616
3617   reel1_attr = auto_alloc_array(machine, UINT8, 0x200);
3618   reel2_attr = auto_alloc_array(machine, UINT8, 0x200);
3619   reel3_attr = auto_alloc_array(machine, UINT8, 0x200);
35333620}
35343621
35353622
r10613r10614
35373624*                               Game Drivers                               *
35383625***************************************************************************/
35393626
3540/*     YEAR  NAME      PARENT    MACHINE   INPUT     INIT      ROT    COMPANY            FULLNAME                               FLAGS   LAYOUT      */
3541GAMEL( 1990, victor21, 0,        victor21, victor21, victor21, ROT0, "Subsino / Buffy", "Victor 21",                            0,      layout_victor21 )
3542GAMEL( 1991, victor5,  0,        victor5,  victor5,  victor5,  ROT0, "Subsino",         "G.E.A.",                               0,      layout_victor5 )   // PCB black-box was marked 'victor 5' - in-game says G.E.A with no manufacturer info?
3543GAMEL( 1992, tisub,    0,        tisub,    tisub,    tisub,    ROT0, "Subsino",         "Treasure Island (Subsino, set 1)",     0,      layout_tisub )
3544GAMEL( 1992, tisuba,   tisub,    tisub,    tisub,    tisuba,   ROT0, "Subsino",         "Treasure Island (Subsino, set 2)",     0,      layout_tisub )
3545GAMEL( 1991, crsbingo, 0,        crsbingo, crsbingo, crsbingo, ROT0, "Subsino",         "Poker Carnival",                       0,      layout_crsbingo )
3546GAMEL( 1995, stisub,   0,        stisub,   stisub,   stisub,   ROT0, "American Alpha",  "Treasure Bonus (Subsino)",           0,      layout_stisub )      // board CPU module marked 'Super Treasure Island' (alt title?)
3547GAMEL( 1996, sharkpy,  0,        sharkpy,  sharkpy,  sharkpy,  ROT0, "Subsino",         "Shark Party (Italy, v1.3)",            0,      layout_sharkpy )   // missing POST messages?
3548GAMEL( 1996, sharkpya, sharkpy,  sharkpy,  sharkpy,  sharkpy,  ROT0, "Subsino",         "Shark Party (Italy, v1.6)",            0,      layout_sharkpy )   // missing POST messages?
3549GAMEL( 1995, sharkpye, sharkpy,  sharkpy,  sharkpye, sharkpye, ROT0, "American Alpha",  "Shark Party (English, Alpha license)", 0,      layout_sharkpye )   // PCB black-box was marked 'victor 6'
3550GAMEL( 1995, victor6,  0,        sharkpy,  victor6,  sharkpye, ROT0, "American Alpha",  "Victor 6 (v2.3N)",                     0,      layout_sharkpye )   // ^^
3551GAMEL( 1995, victor6a, victor6,  sharkpy,  victor6a, sharkpye, ROT0, "American Alpha",  "Victor 6 (v2.3)",                      0,      layout_sharkpye )   // ^^
3552GAMEL( 1995, victor6b, victor6,  sharkpy,  victor6b, sharkpye, ROT0, "American Alpha",  "Victor 6 (v1.2)",                      0,      layout_sharkpye )   // ^^ Version # according to label, not displayed
3553GAMEL( 1996, smoto20,  0,        srider,   smoto20,  smoto20,  ROT0, "Subsino",         "Super Rider (Italy, v2.0)",            0,      layout_smoto )
3554GAMEL( 1996, smoto16,  smoto20,  srider,   smoto16,  smoto16,  ROT0, "Subsino",         "Super Moto (Italy, v1.6)",             0,      layout_smoto )
3627//     YEAR  NAME      PARENT    MACHINE   INPUT     INIT      ROT    COMPANY            FULLNAME                                FLAGS            LAYOUT
3628GAMEL( 1990, victor21,  0,        victor21, victor21, victor21, ROT0, "Subsino / Buffy", "Victor 21",                            0,               layout_victor21 )
3629GAMEL( 1991, victor5,   0,        victor5,  victor5,  victor5,  ROT0, "Subsino",         "G.E.A.",                               0,               layout_victor5  )   // PCB black-box was marked 'victor 5' - in-game says G.E.A with no manufacturer info?
3630GAMEL( 1992, tisub,     0,        tisub,    tisub,    tisub,    ROT0, "Subsino",         "Treasure Island (Subsino, set 1)",     0,               layout_tisub    )
3631GAMEL( 1992, tisuba,    tisub,    tisub,    tisub,    tisuba,   ROT0, "Subsino",         "Treasure Island (Subsino, set 2)",     0,               layout_tisub    )
3632GAMEL( 1991, crsbingo,  0,        crsbingo, crsbingo, crsbingo, ROT0, "Subsino",         "Poker Carnival",                       0,               layout_crsbingo )
3633GAMEL( 1995, stisub,    0,        stisub,   stisub,   stisub,   ROT0, "American Alpha",  "Treasure Bonus (Subsino)",             0,               layout_stisub   )   // board CPU module marked 'Super Treasure Island' (alt title?)
3634GAMEL( 1996, sharkpy,   0,        sharkpy,  sharkpy,  sharkpy,  ROT0, "Subsino",         "Shark Party (Italy, v1.3)",            0,               layout_sharkpy  )   // missing POST messages?
3635GAMEL( 1996, sharkpya,  sharkpy,  sharkpy,  sharkpy,  sharkpy,  ROT0, "Subsino",         "Shark Party (Italy, v1.6)",            0,               layout_sharkpy  )   // missing POST messages?
3636GAMEL( 1995, sharkpye,  sharkpy,  sharkpy,  sharkpye, sharkpye, ROT0, "American Alpha",  "Shark Party (English, Alpha license)", 0,               layout_sharkpye )   // PCB black-box was marked 'victor 6'
3637GAMEL( 1995, victor6,   0,        sharkpy,  victor6,  sharkpye, ROT0, "American Alpha",  "Victor 6 (v2.3N)",                     0,               layout_sharkpye )   // ^^
3638GAMEL( 1995, victor6a,  victor6,  sharkpy,  victor6a, sharkpye, ROT0, "American Alpha",  "Victor 6 (v2.3)",                      0,               layout_sharkpye )   // ^^
3639GAMEL( 1995, victor6b,  victor6,  sharkpy,  victor6b, sharkpye, ROT0, "American Alpha",  "Victor 6 (v1.2)",                      0,               layout_sharkpye )   // ^^ Version # according to label, not displayed
3640GAMEL( 1996, smoto20,   0,        srider,   smoto20,  smoto20,  ROT0, "Subsino",         "Super Rider (Italy, v2.0)",            0,               layout_smoto    )
3641GAMEL( 1996, smoto16,   smoto20,  srider,   smoto16,  smoto16,  ROT0, "Subsino",         "Super Moto (Italy, v1.6)",             0,               layout_smoto    )
3642GAME ( 1996, mtrainnv,  mtrain,   mtrainnv, stisub,   mtrainnv, ROT0, "Subsino",         "Magic Train (Clear NVRAM ROM?)",       GAME_NOT_WORKING )
src/mame/drivers/jchan.c
r10613r10614
689689   MCFG_PALETTE_LENGTH(0x10000)
690690
691691   MCFG_VIDEO_START(jchan)
692   
692
693693   MCFG_NVRAM_ADD_0FILL("nvram")
694694
695695   /* sound hardware */
r10613r10614
792792
793793
794794   memset(state->mcu_com, 0, 4 * sizeof( UINT16 ) );
795   
795
796796   machine->device<nvram_device>("nvram")->set_base(state->nvram_data, sizeof(state->nvram_data));
797797}
798798
src/mame/drivers/mlanding.c
r10613r10614
2727#include "sound/2151intf.h"
2828#include "sound/msm5205.h"
2929
30static UINT16 * ml_tileram;
31static UINT16 *g_ram;
32static UINT16 * ml_dotram;
33static UINT16 *dma_ram;
34static UINT32 adpcm_pos,adpcm_end;
35static int adpcm_data;
36static UINT8 adpcm_idle;
37static UINT8 pal_fg_bank;
38static int dma_active;
39static UINT16 dsp_HOLD_signal;
40static UINT8 *mecha_ram;
4130
31class mlanding_state : public driver_device
32{
33public:
34   mlanding_state(running_machine &machine, const driver_device_config_base &config)
35      : driver_device(machine, config) { }
36
37   UINT16 * ml_tileram;
38   UINT16 *g_ram;
39   UINT16 * ml_dotram;
40   UINT16 *dma_ram;
41   UINT32 adpcm_pos;
42   UINT32 adpcm_end;
43   int adpcm_data;
44   UINT8 adpcm_idle;
45   UINT8 pal_fg_bank;
46   int dma_active;
47   UINT16 dsp_HOLD_signal;
48   UINT8 *mecha_ram;
49   UINT8 trigger;
50};
51
52
53
4254static VIDEO_START(mlanding)
4355{
4456}
r10613r10614
4961// 768: plane landing sequence
5062static SCREEN_UPDATE(mlanding)
5163{
64   mlanding_state *state = screen->machine->driver_data<mlanding_state>();
5265   int x, y;
5366
5467   for (y = cliprect->min_y; y <= cliprect->max_y; ++y)
5568   {
56      UINT16 *src = &g_ram[y * 512/2 + cliprect->min_x];
69      UINT16 *src = &state->g_ram[y * 512/2 + cliprect->min_x];
5770      UINT16 *dst = BITMAP_ADDR16(bitmap, y, cliprect->min_x);
5871
5972      for (x = cliprect->min_x; x <= cliprect->max_x; x += 2)
6073      {
6174         UINT16 srcpix = *src++;
6275
63         *dst++ = screen->machine->pens[256+(srcpix & 0xff) + (pal_fg_bank & 1 ? 0x100 : 0x000)];
64         *dst++ = screen->machine->pens[256+(srcpix >> 8) + (pal_fg_bank & 1 ? 0x100 : 0x000)];
76         *dst++ = screen->machine->pens[256+(srcpix & 0xff) + (state->pal_fg_bank & 1 ? 0x100 : 0x000)];
77         *dst++ = screen->machine->pens[256+(srcpix >> 8) + (state->pal_fg_bank & 1 ? 0x100 : 0x000)];
6578      }
6679   }
6780
r10613r10614
6982}
7083
7184/* Return the number of pixels processed for timing purposes? */
72static int start_dma(void)
85static int start_dma(running_machine *machine)
7386{
87   mlanding_state *state = machine->driver_data<mlanding_state>();
7488   /* Traverse the DMA RAM list */
7589   int offs;
7690
r10613r10614
8599
86100      int j, k;
87101
88      UINT16 attr = dma_ram[offs];
102      UINT16 attr = state->dma_ram[offs];
89103
90104      if (attr == 0)
91105         continue;
92106
93      x = dma_ram[offs + 1];
94      y = dma_ram[offs + 2];
95      colour = dma_ram[offs + 3];
107      x = state->dma_ram[offs + 1];
108      y = state->dma_ram[offs + 2];
109      colour = state->dma_ram[offs + 3];
96110
97111      dx = x >> 11;
98112      dy = y >> 11;
r10613r10614
127141               // Draw the 8x8 chunk
128142               for (y1 = 0; y1 < 8; ++y1)
129143               {
130                  UINT16 *src = &ml_tileram[(code * 2 * 8) + y1*2];
131                  UINT16 *dst = &g_ram[(y + k*8+y1)*512/2 + (j*8+x)/2];
144                  UINT16 *src = &state->ml_tileram[(code * 2 * 8) + y1*2];
145                  UINT16 *dst = &state->g_ram[(y + k*8+y1)*512/2 + (j*8+x)/2];
132146
133147                  UINT8 p2 = *src & 0xff;
134148                  UINT8 p1 = *src++ >> 8;
r10613r10614
175189         for(y1 = 0; y1 < dy*8; y1++)
176190         {
177191            int x1;
178            UINT16 *dst = &g_ram[((y + y1) * 512/2) + x/2];
192            UINT16 *dst = &state->g_ram[((y + y1) * 512/2) + x/2];
179193
180194            for(x1 = 0; x1 < dx*8; x1+=2)
181195            {
r10613r10614
189203
190204static WRITE16_HANDLER(ml_tileram_w)
191205{
192   COMBINE_DATA(&ml_tileram[offset]);
206   mlanding_state *state = space->machine->driver_data<mlanding_state>();
207   COMBINE_DATA(&state->ml_tileram[offset]);
193208}
194209
195210static READ16_HANDLER(ml_tileram_r)
196211{
197   return ml_tileram[offset];
212   mlanding_state *state = space->machine->driver_data<mlanding_state>();
213   return state->ml_tileram[offset];
198214}
199215
200216
201217static READ16_HANDLER( io1_r ) //240006
202218{
219   mlanding_state *state = space->machine->driver_data<mlanding_state>();
203220   /*
204221    fedcba9876543210
205222                   x  - mecha driver status
r10613r10614
211228    */
212229// multiplexed? or just overriden?
213230
214   int retval = (dma_active << 15) | (input_port_read(space->machine, "DSW") & 0x7fff);
231   int retval = (state->dma_active << 15) | (input_port_read(space->machine, "DSW") & 0x7fff);
215232   return retval;
216233}
217234
218235/* output */
219236static WRITE16_HANDLER(ml_output_w)
220237{
238   mlanding_state *state = space->machine->driver_data<mlanding_state>();
221239   /*
222240    x--- ---- palette fg bankswitch
223241    ---x ---- coin lockout?
r10613r10614
226244    */
227245//  popmessage("%04x",data);
228246
229   pal_fg_bank = (data & 0x80)>>7;
247   state->pal_fg_bank = (data & 0x80)>>7;
230248}
231249
232250static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
r10613r10614
237255
238256static void ml_msm5205_vck(device_t *device)
239257{
240   static UINT8 trigger;
258   mlanding_state *state = device->machine->driver_data<mlanding_state>();
241259
242//  popmessage("%08x",adpcm_pos);
260//  popmessage("%08x",state->adpcm_pos);
243261
244   if (adpcm_pos >= 0x50000  || adpcm_idle)
262   if (state->adpcm_pos >= 0x50000  || state->adpcm_idle)
245263   {
246      //adpcm_idle = 1;
264      //state->adpcm_idle = 1;
247265      msm5205_reset_w(device,1);
248      trigger = 0;
266      state->trigger = 0;
249267   }
250268   else
251269   {
252270      UINT8 *ROM = device->machine->region("adpcm")->base();
253271
254      adpcm_data = ((trigger ? (ROM[adpcm_pos] & 0x0f) : (ROM[adpcm_pos] & 0xf0)>>4) );
255      msm5205_data_w(device,adpcm_data & 0xf);
256      trigger^=1;
257      if(trigger == 0)
272      state->adpcm_data = ((state->trigger ? (ROM[state->adpcm_pos] & 0x0f) : (ROM[state->adpcm_pos] & 0xf0)>>4) );
273      msm5205_data_w(device,state->adpcm_data & 0xf);
274      state->trigger^=1;
275      if(state->trigger == 0)
258276      {
259         adpcm_pos++;
277         state->adpcm_pos++;
260278         //cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
261279         /*TODO: simplify this */
262         if(ROM[adpcm_pos] == 0x00 && ROM[adpcm_pos+1] == 0x00 && ROM[adpcm_pos+2] == 0x00 && ROM[adpcm_pos+3] == 0x00
263             && ROM[adpcm_pos+4] == 0x00 && ROM[adpcm_pos+5] == 0x00 && ROM[adpcm_pos+6] == 0x00 && ROM[adpcm_pos+7] == 0x00
264             && ROM[adpcm_pos+8] == 0x00 && ROM[adpcm_pos+9] == 0x00 && ROM[adpcm_pos+10] == 0x00 && ROM[adpcm_pos+11] == 0x00
265             && ROM[adpcm_pos+12] == 0x00 && ROM[adpcm_pos+13] == 0x00 && ROM[adpcm_pos+14] == 0x00 && ROM[adpcm_pos+15] == 0x00)
266            adpcm_idle = 1;
280         if(ROM[state->adpcm_pos] == 0x00 && ROM[state->adpcm_pos+1] == 0x00 && ROM[state->adpcm_pos+2] == 0x00 && ROM[state->adpcm_pos+3] == 0x00
281             && ROM[state->adpcm_pos+4] == 0x00 && ROM[state->adpcm_pos+5] == 0x00 && ROM[state->adpcm_pos+6] == 0x00 && ROM[state->adpcm_pos+7] == 0x00
282             && ROM[state->adpcm_pos+8] == 0x00 && ROM[state->adpcm_pos+9] == 0x00 && ROM[state->adpcm_pos+10] == 0x00 && ROM[state->adpcm_pos+11] == 0x00
283             && ROM[state->adpcm_pos+12] == 0x00 && ROM[state->adpcm_pos+13] == 0x00 && ROM[state->adpcm_pos+14] == 0x00 && ROM[state->adpcm_pos+15] == 0x00)
284            state->adpcm_idle = 1;
267285      }
268286   }
269287}
270288
271289static TIMER_CALLBACK( dma_complete )
272290{
273   dma_active = 0;
291   mlanding_state *state = machine->driver_data<mlanding_state>();
292   state->dma_active = 0;
274293}
275294
276295/* TODO: this uses many bits */
277296static WRITE16_HANDLER( ml_sub_reset_w )
278297{
298   mlanding_state *state = space->machine->driver_data<mlanding_state>();
279299   int pixels;
280300
281301   // Return the number of pixels drawn?
282   pixels = start_dma();
302   pixels = start_dma(space->machine);
283303
284304   if (pixels)
285305   {
286      dma_active = 1;
306      state->dma_active = 1;
287307      space->machine->scheduler().timer_set(attotime::from_msec(20), FUNC(dma_complete));
288308   }
289309
r10613r10614
295315   if(!(data & 0x80)) // unknown line used
296316   {
297317      cputag_set_input_line(space->machine, "dsp", INPUT_LINE_RESET, CLEAR_LINE);
298      dsp_HOLD_signal = data & 0x80;
318      state->dsp_HOLD_signal = data & 0x80;
299319   }
300320}
301321
r10613r10614
366386
367387static READ16_HANDLER( ml_analog2_msb_r )
368388{
369   static UINT8 res;
370   static UINT16 y_adc,x_adc;
389   UINT8 res;
390   UINT16 y_adc,x_adc;
371391
372392   y_adc = input_port_read(space->machine, "STICKY");
373393   x_adc = input_port_read(space->machine, "STICKZ");
r10613r10614
391411
392412static READ16_HANDLER( ml_analog3_msb_r )
393413{
394   static UINT8 z_adc,res;
395   static UINT16 x_adc;
414   UINT8 z_adc,res;
415   UINT16 x_adc;
396416
397417   z_adc = input_port_read(space->machine, "STICKX");
398418   x_adc = input_port_read(space->machine, "STICKZ");
r10613r10614
419439
420440static READ16_HANDLER( ml_mecha_ram_r )
421441{
422   return (mecha_ram[offset*2]<<8)|mecha_ram[offset*2+1];
442   mlanding_state *state = space->machine->driver_data<mlanding_state>();
443   return (state->mecha_ram[offset*2]<<8)|state->mecha_ram[offset*2+1];
423444}
424445
425446static WRITE16_HANDLER( ml_mecha_ram_w )
426447{
427   COMBINE_DATA(mecha_ram+offset*2+1);
448   mlanding_state *state = space->machine->driver_data<mlanding_state>();
449   COMBINE_DATA(state->mecha_ram+offset*2+1);
428450   data >>= 8;
429451   mem_mask >>= 8;
430   COMBINE_DATA(mecha_ram+offset*2);
452   COMBINE_DATA(state->mecha_ram+offset*2);
431453}
432454
433455static ADDRESS_MAP_START( mlanding_mem, ADDRESS_SPACE_PROGRAM, 16 )
434456   AM_RANGE(0x000000, 0x05ffff) AM_ROM
435457   AM_RANGE(0x080000, 0x08ffff) AM_RAM
436458
437   AM_RANGE(0x100000, 0x17ffff) AM_RAM AM_BASE(&g_ram)// 512kB G RAM - enough here for double buffered 512x400x8 frame
438   AM_RANGE(0x180000, 0x1bffff) AM_READWRITE(ml_tileram_r, ml_tileram_w) AM_BASE(&ml_tileram)
439   AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM AM_SHARE("share2") AM_BASE(&dma_ram)
459   AM_RANGE(0x100000, 0x17ffff) AM_RAM AM_BASE_MEMBER(mlanding_state, g_ram)// 512kB G RAM - enough here for double buffered 512x400x8 frame
460   AM_RANGE(0x180000, 0x1bffff) AM_READWRITE(ml_tileram_r, ml_tileram_w) AM_BASE_MEMBER(mlanding_state, ml_tileram)
461   AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM AM_SHARE("share2") AM_BASE_MEMBER(mlanding_state, dma_ram)
440462   AM_RANGE(0x1c4000, 0x1cffff) AM_RAM AM_SHARE("share1")
441463
442464   AM_RANGE(0x1d0000, 0x1d0001) AM_WRITE(ml_sub_reset_w)
r10613r10614
474496   AM_RANGE(0x050000, 0x0503ff) AM_RAM AM_SHARE("share3")
475497   AM_RANGE(0x1c0000, 0x1c3fff) AM_RAM AM_SHARE("share2")
476498   AM_RANGE(0x1c4000, 0x1cffff) AM_RAM AM_SHARE("share1")
477   AM_RANGE(0x200000, 0x203fff) AM_RAM AM_BASE(&ml_dotram)
499   AM_RANGE(0x200000, 0x203fff) AM_RAM AM_BASE_MEMBER(mlanding_state, ml_dotram)
478500ADDRESS_MAP_END
479501
480502static WRITE8_DEVICE_HANDLER( ml_msm_start_lsb_w )
481503{
482   adpcm_pos = (adpcm_pos & 0x0f0000) | ((data & 0xff)<<8) | 0x20;
483   adpcm_idle = 0;
504   mlanding_state *state = device->machine->driver_data<mlanding_state>();
505   state->adpcm_pos = (state->adpcm_pos & 0x0f0000) | ((data & 0xff)<<8) | 0x20;
506   state->adpcm_idle = 0;
484507   msm5205_reset_w(device,0);
485   adpcm_end = (adpcm_pos+0x800);
508   state->adpcm_end = (state->adpcm_pos+0x800);
486509}
487510
488511static WRITE8_HANDLER( ml_msm_start_msb_w )
489512{
490   adpcm_pos = (adpcm_pos & 0x00ff00) | ((data & 0x0f)<<16) | 0x20;
513   mlanding_state *state = space->machine->driver_data<mlanding_state>();
514   state->adpcm_pos = (state->adpcm_pos & 0x00ff00) | ((data & 0x0f)<<16) | 0x20;
491515}
492516
493517static ADDRESS_MAP_START( mlanding_z80_mem, ADDRESS_SPACE_PROGRAM, 8 )
r10613r10614
508532
509533static READ16_HANDLER( ml_dotram_r )
510534{
511   return ml_dotram[offset];
535   mlanding_state *state = space->machine->driver_data<mlanding_state>();
536   return state->ml_dotram[offset];
512537}
513538
514539static WRITE16_HANDLER( ml_dotram_w )
515540{
516   ml_dotram[offset] = data;
541   mlanding_state *state = space->machine->driver_data<mlanding_state>();
542   state->ml_dotram[offset] = data;
517543}
518544
519545static READ16_HANDLER( dsp_HOLD_signal_r )
520546{
521   return dsp_HOLD_signal;
547   mlanding_state *state = space->machine->driver_data<mlanding_state>();
548   return state->dsp_HOLD_signal;
522549}
523550
524551
r10613r10614
530557//mecha driver ?
531558static ADDRESS_MAP_START( mlanding_z80_sub_mem, ADDRESS_SPACE_PROGRAM, 8 )
532559   AM_RANGE(0x0000, 0x7fff) AM_ROM
533   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&mecha_ram)
560   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE_MEMBER(mlanding_state, mecha_ram)
534561   AM_RANGE(0x8800, 0x8fff) AM_RAM
535562
536563   AM_RANGE(0x9000, 0x9001) AM_READ(test_r)
r10613r10614
708735
709736static MACHINE_RESET( mlanding )
710737{
738   mlanding_state *state = machine->driver_data<mlanding_state>();
711739   cputag_set_input_line(machine, "sub", INPUT_LINE_RESET, ASSERT_LINE);
712740   cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
713741   cputag_set_input_line(machine, "dsp", INPUT_LINE_RESET, ASSERT_LINE);
714   adpcm_pos = 0;
715   adpcm_data = -1;
716   adpcm_idle = 1;
717   dsp_HOLD_signal = 0;
742   state->adpcm_pos = 0;
743   state->adpcm_data = -1;
744   state->adpcm_idle = 1;
745   state->dsp_HOLD_signal = 0;
718746}
719747
720static MACHINE_CONFIG_START( mlanding, driver_device )
748static MACHINE_CONFIG_START( mlanding, mlanding_state )
721749
722750   /* basic machine hardware */
723751   MCFG_CPU_ADD("maincpu", M68000, 12000000 )      /* 12 MHz ??? (guess) */
src/mame/drivers/pastelg.c
r10613r10614
4747{
4848   UINT8 *ROM = space->machine->region("voice")->base();
4949
50   return ROM[pastelg_blitter_src_addr_r() & 0x7fff];
50   return ROM[pastelg_blitter_src_addr_r(space) & 0x7fff];
5151}
5252
5353static ADDRESS_MAP_START( pastelg_map, ADDRESS_SPACE_PROGRAM, 8 )
r10613r10614
7777   AM_RANGE(0xe0, 0xe0) AM_READ_PORT("DSWC")
7878ADDRESS_MAP_END
7979
80static UINT8 mux_data;
8180
8281static READ8_HANDLER( threeds_inputport1_r )
8382{
84   switch(mux_data)
83   pastelg_state *state = space->machine->driver_data<pastelg_state>();
84   switch(state->mux_data)
8585   {
8686      case 0x01: return input_port_read(space->machine,"KEY0_PL1");
8787      case 0x02: return input_port_read(space->machine,"KEY1_PL1");
r10613r10614
9595
9696static READ8_HANDLER( threeds_inputport2_r )
9797{
98   switch(mux_data)
98   pastelg_state *state = space->machine->driver_data<pastelg_state>();
99   switch(state->mux_data)
99100   {
100101      case 0x01: return input_port_read(space->machine,"KEY0_PL2");
101102      case 0x02: return input_port_read(space->machine,"KEY1_PL2");
r10613r10614
109110
110111static WRITE8_HANDLER( threeds_inputportsel_w )
111112{
112   mux_data = ~data;
113   pastelg_state *state = space->machine->driver_data<pastelg_state>();
114   state->mux_data = ~data;
113115}
114116
115117static ADDRESS_MAP_START( threeds_io_map, ADDRESS_SPACE_IO, 8 )
r10613r10614
405407};
406408
407409
408static MACHINE_CONFIG_START( pastelg, driver_device )
410static MACHINE_CONFIG_START( pastelg, pastelg_state )
409411
410412   /* basic machine hardware */
411413   MCFG_CPU_ADD("maincpu", Z80, 19968000/4)   /* unknown divider, galds definitely relies on this for correct voice pitch */
r10613r10614
465467
466468*/
467469
468static MACHINE_CONFIG_START( threeds, driver_device )
470static MACHINE_CONFIG_START( threeds, pastelg_state )
469471
470472   /* basic machine hardware */
471473   MCFG_CPU_ADD("maincpu", Z80, 19968000/4)   /* unknown divider, galds definitely relies on this for correct voice pitch */
src/mame/drivers/atarig42.c
r10613r10614
291291
292292static void guardians_sloop_tweak(atarig42_state *state, int offset)
293293{
294   static UINT32 last_accesses[8];
294   UINT32 *last_accesses = state->last_accesses;
295295
296296   if (offset >= 0x7f7c0/2)
297297   {
src/mame/drivers/mpu4drvr.c
r10613r10614
197197
198198#define VIDEO_MASTER_CLOCK         XTAL_10MHz
199199
200/* IRQ states for 68k */
201static UINT8 m6840_irq_state;
202static UINT8 m6850_irq_state;
203static UINT8 scn2674_irq_state;
204200
205/* UART source/sinks */
206static UINT8 m68k_m6809_line;
207static UINT8 m6809_m68k_line;
208static UINT8 m68k_acia_cts;
209static UINT8 m6809_acia_cts;
210static UINT8 m6809_acia_rts;
211static UINT8 m6809_acia_dcd;
212
213/* SCN2674 AVDC stuff */
214static int mpu4_gfx_index;
215static UINT16 * mpu4_vid_vidram;
216static UINT16 * mpu4_vid_mainram;
217
218static UINT8 scn2674_IR[16];
219static UINT8 scn2675_IR_pointer;
220static UINT8 scn2674_screen1_l;
221static UINT8 scn2674_screen1_h;
222static UINT8 scn2674_cursor_l;
223static UINT8 scn2674_cursor_h;
224static UINT8 scn2674_screen2_l;
225static UINT8 scn2674_screen2_h;
226
227static UINT8 scn2674_irq_register = 0;
228static UINT8 scn2674_status_register = 0;
229static UINT8 scn2674_irq_mask = 0;
230static UINT8 scn2674_gfx_enabled;
231static UINT8 scn2674_display_enabled;
232static UINT8 scn2674_cursor_enabled;
233
234201static READ16_HANDLER( characteriser16_r );
235202static WRITE16_HANDLER( characteriser16_w );
236203
r10613r10614
258225
259226static void update_mpu68_interrupts(running_machine *machine)
260227{
261   cputag_set_input_line(machine, "video", 1, m6840_irq_state ? ASSERT_LINE : CLEAR_LINE);
262   cputag_set_input_line(machine, "video", 2, m6850_irq_state ? CLEAR_LINE : ASSERT_LINE);
263   cputag_set_input_line(machine, "video", 3, scn2674_irq_state ? ASSERT_LINE : CLEAR_LINE);
228   mpu4_state *state = machine->driver_data<mpu4_state>();
229   cputag_set_input_line(machine, "video", 1, state->m6840_irq_state ? ASSERT_LINE : CLEAR_LINE);
230   cputag_set_input_line(machine, "video", 2, state->m6850_irq_state ? CLEAR_LINE : ASSERT_LINE);
231   cputag_set_input_line(machine, "video", 3, state->scn2674_irq_state ? ASSERT_LINE : CLEAR_LINE);
264232}
265233
266234/* Communications with 6809 board */
r10613r10614
268236
269237static READ_LINE_DEVICE_HANDLER( m6809_acia_rx_r )
270238{
271   return m68k_m6809_line;
239   mpu4_state *state = device->machine->driver_data<mpu4_state>();
240   return state->m68k_m6809_line;
272241}
273242
274243static WRITE_LINE_DEVICE_HANDLER( m6809_acia_tx_w )
275244{
276   m6809_m68k_line = state;
245   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
246   drvstate->m6809_m68k_line = state;
277247}
278248
279249static READ_LINE_DEVICE_HANDLER( m6809_acia_cts_r )
280250{
281   return m6809_acia_cts;
251   mpu4_state *state = device->machine->driver_data<mpu4_state>();
252   return state->m6809_acia_cts;
282253}
283254
284255static WRITE_LINE_DEVICE_HANDLER( m6809_acia_rts_w )
285256{
286   m6809_acia_rts = state;
257   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
258   drvstate->m6809_acia_rts = state;
287259}
288260
289261static READ_LINE_DEVICE_HANDLER( m6809_acia_dcd_r )
290262{
291   return m6809_acia_dcd;
263   mpu4_state *state = device->machine->driver_data<mpu4_state>();
264   return state->m6809_acia_dcd;
292265}
293266
294267static WRITE_LINE_DEVICE_HANDLER( m6809_acia_irq )
295268{
296   m68k_acia_cts = !state;
269   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
270   drvstate->m68k_acia_cts = !state;
297271   cputag_set_input_line(device->machine, "maincpu", M6809_IRQ_LINE, state ? CLEAR_LINE : ASSERT_LINE);
298272}
299273
r10613r10614
311285
312286static READ_LINE_DEVICE_HANDLER( m68k_acia_rx_r )
313287{
314   return m6809_m68k_line;
288   mpu4_state *state = device->machine->driver_data<mpu4_state>();
289   return state->m6809_m68k_line;
315290}
316291
317292static WRITE_LINE_DEVICE_HANDLER( m68k_acia_tx_w )
318293{
319   m68k_m6809_line = state;
294   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
295   drvstate->m68k_m6809_line = state;
320296}
321297
322298static READ_LINE_DEVICE_HANDLER( m68k_acia_cts_r )
323299{
324   return m68k_acia_cts;
300   mpu4_state *state = device->machine->driver_data<mpu4_state>();
301   return state->m68k_acia_cts;
325302}
326303
327304static WRITE_LINE_DEVICE_HANDLER( m68k_acia_rts_w )
328305{
329   m6809_acia_dcd = state;
306   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
307   drvstate->m6809_acia_dcd = state;
330308}
331309
332310static READ_LINE_DEVICE_HANDLER( m68k_acia_dcd_r )
333311{
334   return m6809_acia_rts;
312   mpu4_state *state = device->machine->driver_data<mpu4_state>();
313   return state->m6809_acia_rts;
335314}
336315
337316static WRITE_LINE_DEVICE_HANDLER( m68k_acia_irq )
338317{
339   m6809_acia_cts = !state;
340   m6850_irq_state = state;
318   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
319   drvstate->m6809_acia_cts = !state;
320   drvstate->m6850_irq_state = state;
341321   update_mpu68_interrupts(device->machine);
342322}
343323
r10613r10614
356336
357337static WRITE_LINE_DEVICE_HANDLER( cpu1_ptm_irq )
358338{
359   m6840_irq_state = state;
339   mpu4_state *drvstate = device->machine->driver_data<mpu4_state>();
340   drvstate->m6840_irq_state = state;
360341   update_mpu68_interrupts(device->machine);
361342}
362343
r10613r10614
460441};
461442
462443
463static UINT8 IR0_scn2674_double_ht_wd;
464static UINT8 IR0_scn2674_scanline_per_char_row;
465static UINT8 IR0_scn2674_sync_select;
466static UINT8 IR0_scn2674_buffer_mode_select;
467static UINT8 IR1_scn2674_interlace_enable;
468static UINT8 IR1_scn2674_equalizing_constant;
469static UINT8 IR2_scn2674_row_table;
470static UINT8 IR2_scn2674_horz_sync_width;
471static UINT8 IR2_scn2674_horz_back_porch;
472static UINT8 IR3_scn2674_vert_front_porch;
473static UINT8 IR3_scn2674_vert_back_porch;
474static UINT8 IR4_scn2674_rows_per_screen;
475static UINT8 IR4_scn2674_character_blink_rate;
476static UINT8 IR5_scn2674_character_per_row;
477static UINT8 IR8_scn2674_display_buffer_first_address_LSB;
478static UINT8 IR9_scn2674_display_buffer_first_address_MSB;
479static UINT8 IR9_scn2674_display_buffer_last_address;
480static UINT8 IR10_scn2674_display_pointer_address_lower;
481static UINT8 IR11_scn2674_display_pointer_address_upper;
482static UINT8 IR12_scn2674_scroll_start;
483static UINT8 IR12_scn2674_split_register_1;
484static UINT8 IR13_scn2674_scroll_end;
485static UINT8 IR13_scn2674_split_register_2;
486444
487445
488446static SCREEN_UPDATE( mpu4_vid )
489447{
448   mpu4_state *state = screen->machine->driver_data<mpu4_state>();
490449   int x, y/*, count = 0*/;
491450
492451   bitmap_fill(bitmap,cliprect,0);
r10613r10614
495454   /* count = 0x0018b6/2; - crmaze count = 0x004950/2; - turnover */
496455
497456   /* we're in row table mode...thats why */
498   for(y = 0; y <= IR4_scn2674_rows_per_screen; y++)
457   for(y = 0; y <= state->IR4_scn2674_rows_per_screen; y++)
499458   {
500      int screen2_base = (scn2674_screen2_h << 8) | scn2674_screen2_l;
459      int screen2_base = (state->scn2674_screen2_h << 8) | state->scn2674_screen2_l;
501460
502      UINT16 rowbase = (mpu4_vid_mainram[1+screen2_base+(y*2)]<<8)|mpu4_vid_mainram[screen2_base+(y*2)];
461      UINT16 rowbase = (state->vid_mainram[1+screen2_base+(y*2)]<<8)|state->vid_mainram[screen2_base+(y*2)];
503462      int dbl_size;
504463      int gfxregion = 0;
505464
r10613r10614
507466
508467      if (dbl_size&2) gfxregion = 1;
509468
510      for(x = 0; x <= IR5_scn2674_character_per_row; x++)
469      for(x = 0; x <= state->IR5_scn2674_character_per_row; x++)
511470      {
512471         UINT16 tiledat;
513472         UINT16 attr;
514473
515         tiledat = mpu4_vid_mainram[(rowbase+x)&0x7fff];
474         tiledat = state->vid_mainram[(rowbase+x)&0x7fff];
516475         attr = tiledat >>12;
517476
518477         if (attr)
r10613r10614
531490
532491static READ16_HANDLER( mpu4_vid_vidram_r )
533492{
534   return mpu4_vid_vidram[offset];
493   mpu4_state *state = space->machine->driver_data<mpu4_state>();
494   return state->vid_vidram[offset];
535495}
536496
537497
538498static WRITE16_HANDLER( mpu4_vid_vidram_w )
539499{
540   COMBINE_DATA(&mpu4_vid_vidram[offset]);
500   mpu4_state *state = space->machine->driver_data<mpu4_state>();
501   COMBINE_DATA(&state->vid_vidram[offset]);
541502   offset <<= 1;
542   gfx_element_mark_dirty(space->machine->gfx[mpu4_gfx_index+0], offset/0x20);
543   gfx_element_mark_dirty(space->machine->gfx[mpu4_gfx_index+1], offset/0x20);
544   gfx_element_mark_dirty(space->machine->gfx[mpu4_gfx_index+2], offset/0x20);
545   gfx_element_mark_dirty(space->machine->gfx[mpu4_gfx_index+3], offset/0x20);
503   gfx_element_mark_dirty(space->machine->gfx[state->gfx_index+0], offset/0x20);
504   gfx_element_mark_dirty(space->machine->gfx[state->gfx_index+1], offset/0x20);
505   gfx_element_mark_dirty(space->machine->gfx[state->gfx_index+2], offset/0x20);
506   gfx_element_mark_dirty(space->machine->gfx[state->gfx_index+3], offset/0x20);
546507}
547508
548509
r10613r10614
571532*/
572533
573534
574static void scn2674_write_init_regs(UINT8 data)
535static void scn2674_write_init_regs(mpu4_state *state, UINT8 data)
575536{
576   LOGSTUFF(("scn2674_write_init_regs %02x %02x\n",scn2675_IR_pointer,data));
537   LOGSTUFF(("scn2674_write_init_regs %02x %02x\n",state->scn2675_IR_pointer,data));
577538
578   scn2674_IR[scn2675_IR_pointer]=data;
539   state->scn2674_IR[state->scn2675_IR_pointer]=data;
579540
580541
581   switch ( scn2675_IR_pointer) /* display some debug info, set mame specific variables */
542   switch ( state->scn2675_IR_pointer) /* display some debug info, set mame specific variables */
582543   {
583544      case 0:
584         IR0_scn2674_double_ht_wd = (data & 0x80)>>7;
585         IR0_scn2674_scanline_per_char_row = (data & 0x78)>>3;
586         IR0_scn2674_sync_select = (data&0x04)>>2;
587         IR0_scn2674_buffer_mode_select = (data&0x03);
545         state->IR0_scn2674_double_ht_wd = (data & 0x80)>>7;
546         state->IR0_scn2674_scanline_per_char_row = (data & 0x78)>>3;
547         state->IR0_scn2674_sync_select = (data&0x04)>>2;
548         state->IR0_scn2674_buffer_mode_select = (data&0x03);
588549
589         LOGSTUFF(("IR0 - Double Ht Wd %02x\n",IR0_scn2674_double_ht_wd));
590         LOGSTUFF(("IR0 - Scanlines per Character Row %02x\n",IR0_scn2674_scanline_per_char_row));
591         LOGSTUFF(("IR0 - Sync Select %02x\n",IR0_scn2674_sync_select));
592         LOGSTUFF(("IR0 - Buffer Mode Select %02x\n",IR0_scn2674_buffer_mode_select));
550         LOGSTUFF(("IR0 - Double Ht Wd %02x\n",state->IR0_scn2674_double_ht_wd));
551         LOGSTUFF(("IR0 - Scanlines per Character Row %02x\n",state->IR0_scn2674_scanline_per_char_row));
552         LOGSTUFF(("IR0 - Sync Select %02x\n",state->IR0_scn2674_sync_select));
553         LOGSTUFF(("IR0 - Buffer Mode Select %02x\n",state->IR0_scn2674_buffer_mode_select));
593554         break;
594555
595556      case 1:
596         IR1_scn2674_interlace_enable = (data&0x80)>>7;
597         IR1_scn2674_equalizing_constant = (data&0x7f);
557         state->IR1_scn2674_interlace_enable = (data&0x80)>>7;
558         state->IR1_scn2674_equalizing_constant = (data&0x7f);
598559
599         LOGSTUFF(("IR1 - Interlace Enable %02x\n",IR1_scn2674_interlace_enable));
600         LOGSTUFF(("IR1 - Equalizing Constant %02x\n",IR1_scn2674_equalizing_constant));
560         LOGSTUFF(("IR1 - Interlace Enable %02x\n",state->IR1_scn2674_interlace_enable));
561         LOGSTUFF(("IR1 - Equalizing Constant %02x\n",state->IR1_scn2674_equalizing_constant));
601562         break;
602563
603564      case 2:
604         IR2_scn2674_row_table = (data&0x80)>>7;
605         IR2_scn2674_horz_sync_width = (data&0x78)>>3;
606         IR2_scn2674_horz_back_porch = (data&0x07);
565         state->IR2_scn2674_row_table = (data&0x80)>>7;
566         state->IR2_scn2674_horz_sync_width = (data&0x78)>>3;
567         state->IR2_scn2674_horz_back_porch = (data&0x07);
607568
608         LOGSTUFF(("IR2 - Row Table %02x\n",IR2_scn2674_row_table));
609         LOGSTUFF(("IR2 - Horizontal Sync Width %02x\n",IR2_scn2674_horz_sync_width));
610         LOGSTUFF(("IR2 - Horizontal Back Porch %02x\n",IR2_scn2674_horz_back_porch));
569         LOGSTUFF(("IR2 - Row Table %02x\n",state->IR2_scn2674_row_table));
570         LOGSTUFF(("IR2 - Horizontal Sync Width %02x\n",state->IR2_scn2674_horz_sync_width));
571         LOGSTUFF(("IR2 - Horizontal Back Porch %02x\n",state->IR2_scn2674_horz_back_porch));
611572         break;
612573
613574      case 3:
614         IR3_scn2674_vert_front_porch = (data&0xe0)>>5;
615         IR3_scn2674_vert_back_porch = (data&0x1f)>>0;
575         state->IR3_scn2674_vert_front_porch = (data&0xe0)>>5;
576         state->IR3_scn2674_vert_back_porch = (data&0x1f)>>0;
616577
617         LOGSTUFF(("IR3 - Vertical Front Porch %02x\n",IR3_scn2674_vert_front_porch));
618         LOGSTUFF(("IR3 - Vertical Back Porch %02x\n",IR3_scn2674_vert_back_porch));
578         LOGSTUFF(("IR3 - Vertical Front Porch %02x\n",state->IR3_scn2674_vert_front_porch));
579         LOGSTUFF(("IR3 - Vertical Back Porch %02x\n",state->IR3_scn2674_vert_back_porch));
619580         break;
620581
621582      case 4:
622         IR4_scn2674_rows_per_screen = data&0x7f;
623         IR4_scn2674_character_blink_rate = (data & 0x80)>>7;
583         state->IR4_scn2674_rows_per_screen = data&0x7f;
584         state->IR4_scn2674_character_blink_rate = (data & 0x80)>>7;
624585
625         LOGSTUFF(("IR4 - Rows Per Screen %02x\n",IR4_scn2674_rows_per_screen));
626         LOGSTUFF(("IR4 - Character Blink Rate %02x\n",IR4_scn2674_character_blink_rate));
586         LOGSTUFF(("IR4 - Rows Per Screen %02x\n",state->IR4_scn2674_rows_per_screen));
587         LOGSTUFF(("IR4 - Character Blink Rate %02x\n",state->IR4_scn2674_character_blink_rate));
627588         break;
628589
629590      case 5:
630591         /* IR5 - Active Characters Per Row
631592             cccc cccc
632593             c = Characters Per Row */
633         IR5_scn2674_character_per_row = data;
634         LOGSTUFF(("IR5 - Active Characters Per Row %02x\n",IR5_scn2674_character_per_row));
594         state->IR5_scn2674_character_per_row = data;
595         LOGSTUFF(("IR5 - Active Characters Per Row %02x\n",state->IR5_scn2674_character_per_row));
635596         break;
636597
637598      case 6:
r10613r10614
641602         break;
642603
643604      case 8:
644         IR8_scn2674_display_buffer_first_address_LSB = data;
645         LOGSTUFF(("IR8 - Display Buffer First Address LSB %02x\n",IR8_scn2674_display_buffer_first_address_LSB));
605         state->IR8_scn2674_display_buffer_first_address_LSB = data;
606         LOGSTUFF(("IR8 - Display Buffer First Address LSB %02x\n",state->IR8_scn2674_display_buffer_first_address_LSB));
646607         break;
647608
648609      case 9:
649         IR9_scn2674_display_buffer_first_address_MSB = data & 0x0f;
650         IR9_scn2674_display_buffer_last_address = (data & 0xf0)>>4;
651         LOGSTUFF(("IR9 - Display Buffer First Address MSB %02x\n",IR9_scn2674_display_buffer_first_address_MSB));
652         LOGSTUFF(("IR9 - Display Buffer Last Address %02x\n",IR9_scn2674_display_buffer_last_address));
610         state->IR9_scn2674_display_buffer_first_address_MSB = data & 0x0f;
611         state->IR9_scn2674_display_buffer_last_address = (data & 0xf0)>>4;
612         LOGSTUFF(("IR9 - Display Buffer First Address MSB %02x\n",state->IR9_scn2674_display_buffer_first_address_MSB));
613         LOGSTUFF(("IR9 - Display Buffer Last Address %02x\n",state->IR9_scn2674_display_buffer_last_address));
653614         break;
654615
655616      case 10:
656         IR10_scn2674_display_pointer_address_lower = data;
657         LOGSTUFF(("IR10 - Display Pointer Address Lower %02x\n",IR10_scn2674_display_pointer_address_lower));
617         state->IR10_scn2674_display_pointer_address_lower = data;
618         LOGSTUFF(("IR10 - Display Pointer Address Lower %02x\n",state->IR10_scn2674_display_pointer_address_lower));
658619         break;
659620
660621      case 11:
661         IR11_scn2674_display_pointer_address_upper= data&0x3f;
662         LOGSTUFF(("IR11 - Display Pointer Address Lower %02x\n",IR11_scn2674_display_pointer_address_upper));
622         state->IR11_scn2674_display_pointer_address_upper= data&0x3f;
623         LOGSTUFF(("IR11 - Display Pointer Address Lower %02x\n",state->IR11_scn2674_display_pointer_address_upper));
663624         break;
664625
665626      case 12:
666         IR12_scn2674_scroll_start = (data & 0x80)>>7;
667         IR12_scn2674_split_register_1 = (data & 0x7f);
668         LOGSTUFF(("IR12 - Scroll Start %02x\n",IR12_scn2674_scroll_start));
669         LOGSTUFF(("IR12 - Split Register 1 %02x\n",IR12_scn2674_split_register_1));
627         state->IR12_scn2674_scroll_start = (data & 0x80)>>7;
628         state->IR12_scn2674_split_register_1 = (data & 0x7f);
629         LOGSTUFF(("IR12 - Scroll Start %02x\n",state->IR12_scn2674_scroll_start));
630         LOGSTUFF(("IR12 - Split Register 1 %02x\n",state->IR12_scn2674_split_register_1));
670631         break;
671632
672633      case 13:
673         IR13_scn2674_scroll_end = (data & 0x80)>>7;
674         IR13_scn2674_split_register_2 = (data & 0x7f);
675         LOGSTUFF(("IR13 - Scroll End %02x\n",IR13_scn2674_scroll_end));
676         LOGSTUFF(("IR13 - Split Register 2 %02x\n",IR13_scn2674_split_register_2));
634         state->IR13_scn2674_scroll_end = (data & 0x80)>>7;
635         state->IR13_scn2674_split_register_2 = (data & 0x7f);
636         LOGSTUFF(("IR13 - Scroll End %02x\n",state->IR13_scn2674_scroll_end));
637         LOGSTUFF(("IR13 - Split Register 2 %02x\n",state->IR13_scn2674_split_register_2));
677638         break;
678639
679640      case 14:
r10613r10614
684645
685646   }
686647
687   scn2675_IR_pointer++;
688   if (scn2675_IR_pointer>14)scn2675_IR_pointer=14;
648   state->scn2675_IR_pointer++;
649   if (state->scn2675_IR_pointer>14)state->scn2675_IR_pointer=14;
689650}
690651
691652static void scn2674_write_command(running_machine *machine, UINT8 data)
692653{
654   mpu4_state *state = machine->driver_data<mpu4_state>();
693655   UINT8 oprand;
694656   int i;
695657
r10613r10614
699661   {
700662      /* master reset, configures registers */
701663      LOGSTUFF(("master reset\n"));
702      scn2675_IR_pointer=0;
703      scn2674_irq_register = 0x20;
704      scn2674_status_register = 0x20;
705      scn2674_irq_mask = 0x20;
706      scn2674_gfx_enabled = 0;
707      scn2674_display_enabled = 0;
708      scn2674_cursor_enabled = 0;
709      IR2_scn2674_row_table = 0;
664      state->scn2675_IR_pointer=0;
665      state->scn2674_irq_register = 0x20;
666      state->scn2674_status_register = 0x20;
667      state->scn2674_irq_mask = 0x20;
668      state->scn2674_gfx_enabled = 0;
669      state->scn2674_display_enabled = 0;
670      state->scn2674_cursor_enabled = 0;
671      state->IR2_scn2674_row_table = 0;
710672   }
711673
712674   if ((data&0xf0)==0x10)
r10613r10614
715677      LOGSTUFF(("set IR pointer %02x\n",data));
716678
717679      oprand = data & 0x0f;
718      scn2675_IR_pointer=oprand;
680      state->scn2675_IR_pointer=oprand;
719681
720682   }
721683
r10613r10614
725687   {
726688      /* Disable GFX */
727689      LOGSTUFF(("disable GFX %02x\n",data));
728      scn2674_gfx_enabled = 0;
690      state->scn2674_gfx_enabled = 0;
729691   }
730692
731693   if ((data&0xe3)==0x23)
732694   {
733695      /* Enable GFX */
734696      LOGSTUFF(("enable GFX %02x\n",data));
735      scn2674_gfx_enabled = 1;
697      state->scn2674_gfx_enabled = 1;
736698   }
737699
738700   if ((data&0xe9)==0x28)
r10613r10614
740702      /* Display off */
741703      oprand = data & 0x04;
742704
743      scn2674_display_enabled = 0;
705      state->scn2674_display_enabled = 0;
744706
745707      if (oprand)
746708         LOGSTUFF(("display OFF - float DADD bus %02x\n",data));
r10613r10614
753715      /* Display on */
754716      oprand = data & 0x04;
755717
756      scn2674_display_enabled = 1;
718      state->scn2674_display_enabled = 1;
757719
758720      if (oprand)
759721         LOGSTUFF(("display ON - next field %02x\n",data));
r10613r10614
765727   {
766728      /* Cursor Off */
767729      LOGSTUFF(("cursor off %02x\n",data));
768      scn2674_cursor_enabled = 0;
730      state->scn2674_cursor_enabled = 0;
769731   }
770732
771733   if ((data&0xf1)==0x31)
772734   {
773735      /* Cursor On */
774736      LOGSTUFF(("cursor on %02x\n",data));
775      scn2674_cursor_enabled = 1;
737      state->scn2674_cursor_enabled = 1;
776738   }
777739
778740   /* END */
r10613r10614
789751      LOGSTUFF(("Line Zero IRQ: %d Reset\n",(data>>3)&1));
790752      LOGSTUFF(("V-Blank   IRQ: %d Reset\n",(data>>4)&1));
791753
792      scn2674_irq_register &= ((data & 0x1f)^0x1f);
793      scn2674_status_register &= ((data & 0x1f)^0x1f);
754      state->scn2674_irq_register &= ((data & 0x1f)^0x1f);
755      state->scn2674_status_register &= ((data & 0x1f)^0x1f);
794756
795      scn2674_irq_state = 0;
796      if (scn2674_irq_register)
757      state->scn2674_irq_state = 0;
758      if (state->scn2674_irq_register)
797759      {
798         scn2674_irq_state = 1;
760         state->scn2674_irq_state = 1;
799761      }
800762      update_mpu68_interrupts(machine);
801763   }
r10613r10614
810772      LOGSTUFF(("Line Zero IRQ: %d Disabled\n",(data>>3)&1));
811773      LOGSTUFF(("V-Blank   IRQ: %d Disabled\n",(data>>4)&1));
812774
813/*      scn2674_irq_mask &= ((data & 0x1f)^0x1f); disables.. doesn't enable? */
775/*      state->scn2674_irq_mask &= ((data & 0x1f)^0x1f); disables.. doesn't enable? */
814776
815      scn2674_irq_mask &= ~(data & 0x1f);
777      state->scn2674_irq_mask &= ~(data & 0x1f);
816778
817      scn2674_irq_state = 0;
779      state->scn2674_irq_state = 0;
818780
819781      for (i = 0; i < 5; i++)
820782      {
821         if ((scn2674_irq_register>>i&1)&(scn2674_irq_mask>>i&1))
783         if ((state->scn2674_irq_register>>i&1)&(state->scn2674_irq_mask>>i&1))
822784         {
823            scn2674_irq_state = 1;
785            state->scn2674_irq_state = 1;
824786         }
825787      }
826788      update_mpu68_interrupts(machine);
r10613r10614
837799      LOGSTUFF(("Line Zero IRQ: %d Enabled\n",(data>>3)&1));
838800      LOGSTUFF(("V-Blank   IRQ: %d Enabled\n",(data>>4)&1));
839801
840      scn2674_irq_mask |= (data & 0x1f);  /* enables .. doesn't disable? */
802      state->scn2674_irq_mask |= (data & 0x1f);  /* enables .. doesn't disable? */
841803
842      scn2674_irq_state = 0;
804      state->scn2674_irq_state = 0;
843805
844806      for (i = 0; i < 5; i++)
845807      {
846         if ((scn2674_irq_register>>i&1)&(scn2674_irq_mask>>i&1))
808         if ((state->scn2674_irq_register>>i&1)&(state->scn2674_irq_mask>>i&1))
847809         {
848            scn2674_irq_state = 1;
810            state->scn2674_irq_state = 1;
849811         }
850812      }
851813      update_mpu68_interrupts(machine);
r10613r10614
911873
912874static READ16_HANDLER( mpu4_vid_scn2674_r )
913875{
876   mpu4_state *state = space->machine->driver_data<mpu4_state>();
914877   /*
915878    Offset:  Purpose
916879     0       Interrupt Register
r10613r10614
941904
942905      case 0:
943906         LOGSTUFF(("Read Irq Register %06x\n",cpu_get_pc(space->cpu)));
944         return scn2674_irq_register;
907         return state->scn2674_irq_register;
945908
946909      case 1:
947910         LOGSTUFF(("Read Status Register %06x\n",cpu_get_pc(space->cpu)));
948         return scn2674_status_register;
911         return state->scn2674_status_register;
949912
950      case 2: LOGSTUFF(("Read Screen1_l Register %06x\n",cpu_get_pc(space->cpu)));return scn2674_screen1_l;
951      case 3: LOGSTUFF(("Read Screen1_h Register %06x\n",cpu_get_pc(space->cpu)));return scn2674_screen1_h;
952      case 4: LOGSTUFF(("Read Cursor_l Register %06x\n",cpu_get_pc(space->cpu)));return scn2674_cursor_l;
953      case 5: LOGSTUFF(("Read Cursor_h Register %06x\n",cpu_get_pc(space->cpu)));return scn2674_cursor_h;
954      case 6:   LOGSTUFF(("Read Screen2_l Register %06x\n",cpu_get_pc(space->cpu)));return scn2674_screen2_l;
955      case 7: LOGSTUFF(("Read Screen2_h Register %06x\n",cpu_get_pc(space->cpu)));return scn2674_screen2_h;
913      case 2: LOGSTUFF(("Read Screen1_l Register %06x\n",cpu_get_pc(space->cpu)));return state->scn2674_screen1_l;
914      case 3: LOGSTUFF(("Read Screen1_h Register %06x\n",cpu_get_pc(space->cpu)));return state->scn2674_screen1_h;
915      case 4: LOGSTUFF(("Read Cursor_l Register %06x\n",cpu_get_pc(space->cpu)));return state->scn2674_cursor_l;
916      case 5: LOGSTUFF(("Read Cursor_h Register %06x\n",cpu_get_pc(space->cpu)));return state->scn2674_cursor_h;
917      case 6:   LOGSTUFF(("Read Screen2_l Register %06x\n",cpu_get_pc(space->cpu)));return state->scn2674_screen2_l;
918      case 7: LOGSTUFF(("Read Screen2_h Register %06x\n",cpu_get_pc(space->cpu)));return state->scn2674_screen2_h;
956919   }
957920
958921   return 0xffff;
r10613r10614
961924
962925static WRITE16_HANDLER( mpu4_vid_scn2674_w )
963926{
927   mpu4_state *state = space->machine->driver_data<mpu4_state>();
964928   /*
965929    Offset:  Purpose
966930     0       Initialization Registers
r10613r10614
978942   switch (offset)
979943   {
980944      case 0:
981         scn2674_write_init_regs(data);
945         scn2674_write_init_regs(state, data);
982946         break;
983947
984948      case 1:
985949         scn2674_write_command(space->machine, data);
986950         break;
987951
988      case 2: scn2674_screen1_l = data; break;
989      case 3: scn2674_screen1_h = data; break;
990      case 4: scn2674_cursor_l  = data; break;
991      case 5: scn2674_cursor_h  = data; break;
992      case 6:   scn2674_screen2_l = data; break;
993      case 7: scn2674_screen2_h = data; break;
952      case 2: state->scn2674_screen1_l = data; break;
953      case 3: state->scn2674_screen1_h = data; break;
954      case 4: state->scn2674_cursor_l  = data; break;
955      case 5: state->scn2674_cursor_h  = data; break;
956      case 6:   state->scn2674_screen2_l = data; break;
957      case 7: state->scn2674_screen2_h = data; break;
994958   }
995959}
996960
997961
998962static VIDEO_START( mpu4_vid )
999963{
964   mpu4_state *state = machine->driver_data<mpu4_state>();
1000965   /* if anything uses tile sizes other than 8x8 we can't really do it this way.. we'll have to draw tiles by hand.
1001966      maybe we will anyway, but for now we don't need to */
1002967
1003   mpu4_vid_vidram = auto_alloc_array(machine, UINT16, 0x20000/2);
968   state->vid_vidram = auto_alloc_array(machine, UINT16, 0x20000/2);
1004969
1005   memset(mpu4_vid_vidram,0,0x20000);
970   memset(state->vid_vidram,0,0x20000);
1006971
1007972   /* find first empty slot to decode gfx */
1008   for (mpu4_gfx_index = 0; mpu4_gfx_index < MAX_GFX_ELEMENTS; mpu4_gfx_index++)
1009      if (machine->gfx[mpu4_gfx_index] == 0)
973   for (state->gfx_index = 0; state->gfx_index < MAX_GFX_ELEMENTS; state->gfx_index++)
974      if (machine->gfx[state->gfx_index] == 0)
1010975         break;
1011976
1012   assert(mpu4_gfx_index != MAX_GFX_ELEMENTS);
977   assert(state->gfx_index != MAX_GFX_ELEMENTS);
1013978
1014979   /* create the char set (gfx will then be updated dynamically from RAM) */
1015   machine->gfx[mpu4_gfx_index+0] = gfx_element_alloc(machine, &mpu4_vid_char_8x8_layout, (UINT8 *)mpu4_vid_vidram, machine->total_colors() / 16, 0);
1016   machine->gfx[mpu4_gfx_index+1] = gfx_element_alloc(machine, &mpu4_vid_char_8x16_layout, (UINT8 *)mpu4_vid_vidram, machine->total_colors() / 16, 0);
1017   machine->gfx[mpu4_gfx_index+2] = gfx_element_alloc(machine, &mpu4_vid_char_16x8_layout, (UINT8 *)mpu4_vid_vidram, machine->total_colors() / 16, 0);
1018   machine->gfx[mpu4_gfx_index+3] = gfx_element_alloc(machine, &mpu4_vid_char_16x16_layout, (UINT8 *)mpu4_vid_vidram, machine->total_colors() / 16, 0);
980   machine->gfx[state->gfx_index+0] = gfx_element_alloc(machine, &mpu4_vid_char_8x8_layout, (UINT8 *)state->vid_vidram, machine->total_colors() / 16, 0);
981   machine->gfx[state->gfx_index+1] = gfx_element_alloc(machine, &mpu4_vid_char_8x16_layout, (UINT8 *)state->vid_vidram, machine->total_colors() / 16, 0);
982   machine->gfx[state->gfx_index+2] = gfx_element_alloc(machine, &mpu4_vid_char_16x8_layout, (UINT8 *)state->vid_vidram, machine->total_colors() / 16, 0);
983   machine->gfx[state->gfx_index+3] = gfx_element_alloc(machine, &mpu4_vid_char_16x16_layout, (UINT8 *)state->vid_vidram, machine->total_colors() / 16, 0);
1019984
1020   scn2675_IR_pointer = 0;
985   state->scn2675_IR_pointer = 0;
1021986}
1022987
1023988
r10613r10614
1028993 *  (16 colors from 4096)
1029994 ****************************/
1030995
1031static struct ef9369
1032{
1033   UINT32 addr;
1034   UINT16 clut[16];   /* 13-bits - a marking bit and a 444 color */
1035} pal;
1036
1037
1038996/* Non-multiplexed mode */
1039997
1040998static WRITE16_HANDLER( ef9369_w )
1041999{
1000   mpu4_state *state = space->machine->driver_data<mpu4_state>();
1001   struct ef9369_t &pal = state->pal;
10421002   data &= 0x00ff;
10431003
10441004   /* Address register */
r10613r10614
10791039
10801040static READ16_HANDLER( ef9369_r )
10811041{
1042   mpu4_state *state = space->machine->driver_data<mpu4_state>();
1043   struct ef9369_t &pal = state->pal;
10821044   if ((offset & 1) == 0)
10831045   {
10841046      UINT16 col = pal.clut[pal.addr >> 1];
r10613r10614
11021064 *  Impact, may not be 100% (that has a 477)
11031065 ******************************************/
11041066
1105static struct
1106{
1107   UINT8 address;
1108   UINT8 addr_cnt;
1109   UINT8 pixmask;
1110   UINT8 command;
1111   rgb_t color;
1112} bt471;
1113
1114
11151067/*
11161068 *  0 0 0    Address register (RAM write mode)
11171069 *  0 0 1    Color palette RAMs
r10613r10614
11241076
11251077WRITE16_HANDLER( bt471_w )
11261078{
1079   mpu4_state *state = space->machine->driver_data<mpu4_state>();
1080   struct bt471_t &bt471 = state->bt471;
11271081   UINT8 val = data & 0xff;
11281082      {
11291083         popmessage("Bt477: Unhandled write access (offset:%x, data:%x)", offset, val);
r10613r10614
11821136
11831137static READ8_DEVICE_HANDLER( pia_ic5_porta_track_r )
11841138{
1139   mpu4_state *state = device->machine->driver_data<mpu4_state>();
11851140   /* The SWP trackball interface connects a standard trackball to the AUX1 port on the MPU4
11861141    mainboard. As per usual, they've taken the cheap route here, reading and processing the
11871142    raw quadrature signal from the encoder wheels for a 4 bit interface, rather than use any
r10613r10614
11931148
11941149   LOG(("%s: IC5 PIA Read of Port A (AUX1)\n",device->machine->describe_context()));
11951150
1196   static INT8 cur[2];
11971151
11981152   UINT8 data = input_port_read(device->machine, "AUX1");
11991153
12001154   INT8 dx = input_port_read(device->machine, "TRACKX");
12011155   INT8 dy = input_port_read(device->machine, "TRACKY");
12021156
1203   cur[0] = dy + dx;
1204   cur[1] = dy - dx;
1157   state->cur[0] = dy + dx;
1158   state->cur[1] = dy - dx;
12051159
12061160   UINT8 xa, xb, ya, yb;
12071161
12081162   /* generate pulses for the input port (A and B are 1 unit out of phase for direction sensing)*/
1209   xa = ((cur[0] + 1) & 3) <= 1;
1210   xb = (cur[0] & 3) <= 1;
1211   ya = ((cur[1] + 1) & 3) <= 1;
1212   yb = (cur[1] & 3) <= 1;
1163   xa = ((state->cur[0] + 1) & 3) <= 1;
1164   xb = (state->cur[0] & 3) <= 1;
1165   ya = ((state->cur[1] + 1) & 3) <= 1;
1166   yb = (state->cur[1] & 3) <= 1;
12131167
12141168   data |= (xa << 4); // XA
12151169   data |= (ya << 5); // YA
r10613r10614
19651919/* machine start (called only once) */
19661920static MACHINE_START( mpu4_vid )
19671921{
1922   mpu4_state *state = machine->driver_data<mpu4_state>();
19681923   mpu4_config_common(machine);
19691924
1970   mod_number=4; //No AY chip
1925   state->mod_number=4; //No AY chip
19711926   /* setup communications */
1972   link7a_connected = 1;
1927   state->link7a_connected = 1;
19731928
19741929   /* setup 8 mechanical meters */
19751930   MechMtr_config(machine,8);
r10613r10614
19831938
19841939static MACHINE_RESET( mpu4_vid )
19851940{
1941   mpu4_state *state = machine->driver_data<mpu4_state>();
19861942   ROC10937_reset(0);
19871943
1988   mpu4_stepper_reset();
1944   mpu4_stepper_reset(state);
19891945
1990   lamp_strobe    = 0;
1991   lamp_strobe2   = 0;
1992   lamp_data      = 0;
1946   state->lamp_strobe    = 0;
1947   state->lamp_strobe2   = 0;
1948   state->lamp_data      = 0;
19931949
1994   IC23GC    = 0;
1995   IC23GB    = 0;
1996   IC23GA    = 0;
1997   IC23G1    = 1;
1998   IC23G2A   = 0;
1999   IC23G2B   = 0;
1950   state->IC23GC    = 0;
1951   state->IC23GB    = 0;
1952   state->IC23GA    = 0;
1953   state->IC23G1    = 1;
1954   state->IC23G2A   = 0;
1955   state->IC23G2B   = 0;
20001956
2001   prot_col  = 0;
1957   state->prot_col  = 0;
20021958}
20031959
20041960static ADDRESS_MAP_START( mpu4_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
20051961   AM_RANGE(0x000000, 0x7fffff) AM_ROM
2006   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram)
1962   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_MEMBER(mpu4_state, vid_mainram)
20071963   AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_data_w, 0x00ff)
20081964   AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_control_w, 0x00ff)
20091965   AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w)
r10613r10614
20361992
20371993static ADDRESS_MAP_START( vp_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
20381994   AM_RANGE(0x000000, 0x7fffff) AM_ROM
2039   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram)
1995   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_MEMBER(mpu4_state, vid_mainram)
20401996   AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */
20411997   AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_data_w, 0x00ff)
20421998   AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_control_w, 0x00ff)
r10613r10614
20702026
20712027static ADDRESS_MAP_START( bwbvid_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
20722028   AM_RANGE(0x000000, 0x7fffff) AM_ROM
2073   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram)
2029   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_MEMBER(mpu4_state, vid_mainram)
20742030   AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */
20752031   AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_data_w, 0x00ff)
20762032   AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_control_w, 0x00ff)
r10613r10614
20862042
20872043static ADDRESS_MAP_START( bwbvid5_68k_map, ADDRESS_SPACE_PROGRAM, 16 )
20882044   AM_RANGE(0x000000, 0x7fffff) AM_ROM
2089   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE(&mpu4_vid_mainram)
2045   AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_BASE_MEMBER(mpu4_state, vid_mainram)
20902046   AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */
20912047   AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_data_w, 0x00ff)
20922048   AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_control_w, 0x00ff)
r10613r10614
21272083GFXDECODE_END
21282084
21292085
2130static UINT8 *dealem_videoram;
21312086
21322087/***************************************************************************
21332088
r10613r10614
21902145
21912146static SCREEN_UPDATE(dealem)
21922147{
2148   mpu4_state *state = screen->machine->driver_data<mpu4_state>();
21932149   int x,y;
21942150   int count = 0;
21952151
r10613r10614
21972153   {
21982154      for (x = 0; x < 40; x++)
21992155      {
2200         int tile = dealem_videoram[count + 0x1000] | (dealem_videoram[count] << 8);
2156         int tile = state->dealem_videoram[count + 0x1000] | (state->dealem_videoram[count] << 8);
22012157         count++;
22022158         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,0,0,0,x * 8,y * 8);
22032159      }
r10613r10614
22512207   AM_RANGE(0x0e00, 0x0e03) AM_DEVREADWRITE("pia_ic7", pia6821_r, pia6821_w)      /* PIA6821 IC7 */
22522208   AM_RANGE(0x0f00, 0x0f03) AM_DEVREADWRITE("pia_ic8", pia6821_r, pia6821_w)      /* PIA6821 IC8 */
22532209
2254   AM_RANGE(0x1000, 0x2fff) AM_RAM AM_BASE(&dealem_videoram)
2210   AM_RANGE(0x1000, 0x2fff) AM_RAM AM_BASE_MEMBER(mpu4_state, dealem_videoram)
22552211   AM_RANGE(0x8000, 0xffff) AM_ROM   AM_WRITENOP/* 64k  paged ROM (4 pages) */
22562212ADDRESS_MAP_END
22572213
2258static int rowcounter = 0;
2259static int linecounter = 0;
22602214
22612215
22622216static TIMER_DEVICE_CALLBACK( scanline_timer_callback )
22632217{
2218   mpu4_state *state = timer.machine->driver_data<mpu4_state>();
22642219   int current_scanline=param;
22652220   timer.machine->scheduler().synchronize();
22662221
r10613r10614
22692224   {
22702225      // these will be used to track which row / line we're on eventually
22712226      // and used by the renderer to render the correct data
2272      rowcounter = 0; linecounter = 0;
2227      state->rowcounter = 0; state->linecounter = 0;
22732228
2274   //  scn2674_status_register &= ~0x10; // clear vblank
2229   //  state->scn2674_status_register &= ~0x10; // clear vblank
22752230
2276      scn2674_status_register |= 0x02;
2231      state->scn2674_status_register |= 0x02;
22772232      /* Ready - this triggers for the first scanline of the screen */
2278      if (scn2674_irq_mask&0x02)
2233      if (state->scn2674_irq_mask&0x02)
22792234      {
22802235         LOGSTUFF(("SCN2674 Ready\n"));
2281         scn2674_irq_state = 1;
2282         scn2674_irq_register |= 0x02;
2236         state->scn2674_irq_state = 1;
2237         state->scn2674_irq_register |= 0x02;
22832238         update_mpu68_interrupts(timer.machine);
22842239      }
22852240   }
r10613r10614
22872242   // should be triggered at the start of each ROW (line zero for that row)
22882243   if ((current_scanline%8 == 7) && (current_scanline<296))
22892244   {
2290      scn2674_status_register |= 0x08;
2291      if (scn2674_irq_mask&0x08)
2245      state->scn2674_status_register |= 0x08;
2246      if (state->scn2674_irq_mask&0x08)
22922247      {
22932248         LOGSTUFF(("SCN2674 Line Zero\n"));
2294         scn2674_irq_state = 1;
2295         scn2674_irq_register |= 0x08;
2249         state->scn2674_irq_state = 1;
2250         state->scn2674_irq_register |= 0x08;
22962251         update_mpu68_interrupts(timer.machine);
22972252      }
22982253   }
22992254
23002255   // this is ROWS not scanlines!!
2301   if (current_scanline == IR12_scn2674_split_register_1*8)
2256   if (current_scanline == state->IR12_scn2674_split_register_1*8)
23022257   /* Split Screen 1 */
23032258   {
2304      if (scn2674_screen2_h & 0x40)
2259      if (state->scn2674_screen2_h & 0x40)
23052260      {
23062261         popmessage("Split screen 1 address shift required, contact MAMEDEV");
23072262      }
2308      scn2674_status_register |= 0x04;
2309      if (scn2674_irq_mask&0x04)
2263      state->scn2674_status_register |= 0x04;
2264      if (state->scn2674_irq_mask&0x04)
23102265      {
23112266         LOGSTUFF(("SCN2674 Split Screen 1\n"));
2312         scn2674_irq_state = 1;
2267         state->scn2674_irq_state = 1;
23132268         update_mpu68_interrupts(timer.machine);
23142269         timer.machine->primary_screen->update_partial(timer.machine->primary_screen->vpos());
23152270
2316         scn2674_irq_register |= 0x04;
2271         state->scn2674_irq_register |= 0x04;
23172272      }
23182273   }
23192274
23202275   // this is in ROWS not scanlines!!!
2321   if (current_scanline == IR13_scn2674_split_register_2*8)
2276   if (current_scanline == state->IR13_scn2674_split_register_2*8)
23222277   /* Split Screen 2 */
23232278   {
2324      if (scn2674_screen2_h & 0x80)
2279      if (state->scn2674_screen2_h & 0x80)
23252280      {
23262281         popmessage("Split screen 2 address shift required, contact MAMEDEV");
23272282      }
2328      scn2674_status_register |= 0x01;
2329      if (scn2674_irq_mask&0x01)
2283      state->scn2674_status_register |= 0x01;
2284      if (state->scn2674_irq_mask&0x01)
23302285      {
23312286         LOGSTUFF(("SCN2674 Split Screen 2 irq\n"));
2332         scn2674_irq_state = 1;
2333         scn2674_irq_register |= 0x01;
2287         state->scn2674_irq_state = 1;
2288         state->scn2674_irq_register |= 0x01;
23342289         update_mpu68_interrupts(timer.machine);
23352290         timer.machine->primary_screen->update_partial(timer.machine->primary_screen->vpos());
23362291
r10613r10614
23402295   // vblank?
23412296   if (current_scanline == 300)
23422297   {
2343   /*  if (scn2674_display_enabled) ? */
2298   /*  if (state->scn2674_display_enabled) ? */
23442299      {
2345         if (scn2674_irq_mask&0x10)
2300         if (state->scn2674_irq_mask&0x10)
23462301         {
23472302            LOGSTUFF(("vblank irq\n"));
2348            scn2674_irq_state = 1;
2303            state->scn2674_irq_state = 1;
23492304            update_mpu68_interrupts(timer.machine);
23502305
2351            scn2674_irq_register |= 0x10;
2306            state->scn2674_irq_register |= 0x10;
23522307         }
23532308      }
2354      scn2674_status_register |= 0x10;
2309      state->scn2674_status_register |= 0x10;
23552310   }
23562311
23572312//  printf("scanline %d\n",current_scanline);
23582313}
23592314
23602315
2361static MACHINE_CONFIG_START( mpu4_vid, driver_device )
2316static MACHINE_CONFIG_START( mpu4_vid, mpu4_state )
23622317   MCFG_CPU_ADD("maincpu", M6809, MPU4_MASTER_CLOCK/4 )
23632318   MCFG_CPU_PROGRAM_MAP(mpu4_6809_map)
23642319   MCFG_TIMER_ADD_PERIODIC("50hz",gen_50hz, attotime::from_hz(100))
r10613r10614
24232378   MCFG_CPU_PROGRAM_MAP(vp_68k_map)
24242379MACHINE_CONFIG_END
24252380
2426static MACHINE_CONFIG_START( bwbvid, driver_device )
2381static MACHINE_CONFIG_START( bwbvid, mpu4_state )
24272382   MCFG_CPU_ADD("maincpu", M6809, MPU4_MASTER_CLOCK/4 )
24282383   MCFG_CPU_PROGRAM_MAP(bwbvid_6809_map)
24292384   MCFG_TIMER_ADD_PERIODIC("50hz",gen_50hz, attotime::from_hz(100))
r10613r10614
24882443MACHINE_CONFIG_END
24892444
24902445/* machine driver for Zenitone Deal 'Em board */
2491static MACHINE_CONFIG_START( dealem, driver_device )
2446static MACHINE_CONFIG_START( dealem, mpu4_state )
24922447   MCFG_MACHINE_START(mpu4mod2)                     /* main mpu4 board initialisation */
24932448   MCFG_MACHINE_RESET(mpu4_vid)
24942449   MCFG_CPU_ADD("maincpu", M6809, MPU4_MASTER_CLOCK/4)
r10613r10614
25482503
25492504static WRITE16_HANDLER( characteriser16_w )
25502505{
2506   mpu4_state *state = space->machine->driver_data<mpu4_state>();
25512507   int x;
25522508   int call=data;
25532509   LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", cpu_get_previouspc(space->cpu),offset,data));
25542510
2555   if (!mpu4_current_chr_table)
2511   if (!state->current_chr_table)
25562512      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(space->cpu));
25572513
2558   for (x = prot_col; x < 64; x++)
2514   for (x = state->prot_col; x < 64; x++)
25592515   {
25602516      if (call == 0)
25612517      {
2562         prot_col = 0;
2518         state->prot_col = 0;
25632519      }
25642520      else
25652521      {
2566         if   (mpu4_current_chr_table[(x)].call == call)
2522         if   (state->current_chr_table[(x)].call == call)
25672523         {
2568            prot_col = x;
2569            LOG_CHR(("Characteriser find column %02X\n",prot_col));
2524            state->prot_col = x;
2525            LOG_CHR(("Characteriser find column %02X\n",state->prot_col));
25702526            break;
25712527         }
25722528      }
r10613r10614
25762532
25772533static READ16_HANDLER( characteriser16_r )
25782534{
2579   LOG_CHR_FULL(("%04x Characteriser read offset %02X,data %02X", cpu_get_previouspc(space->cpu),offset,mpu4_current_chr_table[prot_col].response));
2535   mpu4_state *state = space->machine->driver_data<mpu4_state>();
2536   LOG_CHR_FULL(("%04x Characteriser read offset %02X,data %02X", cpu_get_previouspc(space->cpu),offset,state->current_chr_table[state->prot_col].response));
25802537   LOG_CHR(("Characteriser read offset %02X \n",offset));
2581   LOG_CHR(("Characteriser read data %02X \n",mpu4_current_chr_table[prot_col].response));
2538   LOG_CHR(("Characteriser read data %02X \n",state->current_chr_table[state->prot_col].response));
25822539
2583   if (!mpu4_current_chr_table)
2540   if (!state->current_chr_table)
25842541      fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(space->cpu));
25852542
25862543
r10613r10614
25902547      return 0x00;
25912548   }
25922549
2593   return mpu4_current_chr_table[prot_col].response;
2550   return state->current_chr_table[state->prot_col].response;
25942551}
25952552
25962553
r10613r10614
27392696
27402697static DRIVER_INIT (adders)
27412698{
2742   mpu4_current_chr_table = adders_data;
2699   mpu4_state *state = machine->driver_data<mpu4_state>();
2700   state->current_chr_table = adders_data;
27432701}
27442702
27452703static DRIVER_INIT (crmaze)
27462704{
2747   mpu4_current_chr_table = crmaze_data;
2705   mpu4_state *state = machine->driver_data<mpu4_state>();
2706   state->current_chr_table = crmaze_data;
27482707}
27492708
27502709static DRIVER_INIT (crmazea)
27512710{
2752   mpu4_current_chr_table = crmazea_data;
2711   mpu4_state *state = machine->driver_data<mpu4_state>();
2712   state->current_chr_table = crmazea_data;
27532713}
27542714
27552715static DRIVER_INIT (crmaze2)
27562716{
2757   mpu4_current_chr_table = crmaze2_data;
2717   mpu4_state *state = machine->driver_data<mpu4_state>();
2718   state->current_chr_table = crmaze2_data;
27582719}
27592720
27602721static DRIVER_INIT (crmaze3)
27612722{
2762   mpu4_current_chr_table = crmaze3_data;
2723   mpu4_state *state = machine->driver_data<mpu4_state>();
2724   state->current_chr_table = crmaze3_data;
27632725}
27642726
27652727static DRIVER_INIT (crmaze3a)
27662728{
2767   mpu4_current_chr_table = crmaze3a_data;
2729   mpu4_state *state = machine->driver_data<mpu4_state>();
2730   state->current_chr_table = crmaze3a_data;
27682731}
27692732
27702733static DRIVER_INIT (mating)
27712734{
2735   mpu4_state *state = machine->driver_data<mpu4_state>();
27722736   address_space *space = cputag_get_address_space(machine, "video", ADDRESS_SPACE_PROGRAM);
27732737   device_t *device = machine->device("oki");
27742738
r10613r10614
27782742   /* There is also an OKIM6376 present on the program card */
27792743   memory_install_readwrite16_device_handler(space, device, 0xffa040, 0xffa0ff, 0, 0, oki_r, oki_w );
27802744
2781   mpu4_current_chr_table = mating_data;
2745   state->current_chr_table = mating_data;
27822746}
27832747
27842748
27852749static DRIVER_INIT (skiltrek)
27862750{
2787   mpu4_current_chr_table = skiltrek_data;
2751   mpu4_state *state = machine->driver_data<mpu4_state>();
2752   state->current_chr_table = skiltrek_data;
27882753}
27892754
27902755static DRIVER_INIT (timemchn)
27912756{
2792   mpu4_current_chr_table = timemchn_data;
2757   mpu4_state *state = machine->driver_data<mpu4_state>();
2758   state->current_chr_table = timemchn_data;
27932759}
27942760
27952761static DRIVER_INIT (strikeit)
27962762{
2797   mpu4_current_chr_table = strikeit_data;
2763   mpu4_state *state = machine->driver_data<mpu4_state>();
2764   state->current_chr_table = strikeit_data;
27982765}
27992766
28002767static DRIVER_INIT (turnover)
28012768{
2802   mpu4_current_chr_table = turnover_data;
2769   mpu4_state *state = machine->driver_data<mpu4_state>();
2770   state->current_chr_table = turnover_data;
28032771}
28042772
28052773static DRIVER_INIT (eyesdown)
28062774{
2807   mpu4_current_chr_table = eyesdown_data;
2775   mpu4_state *state = machine->driver_data<mpu4_state>();
2776   state->current_chr_table = eyesdown_data;
28082777}
28092778
28102779static DRIVER_INIT (quidgrid)
28112780{
2812   mpu4_current_chr_table = quidgrid_data;
2781   mpu4_state *state = machine->driver_data<mpu4_state>();
2782   state->current_chr_table = quidgrid_data;
28132783}
28142784
28152785
src/mame/drivers/pangofun.c
r10613r10614
9191
9292#include "emu.h"
9393#include "cpu/i386/i386.h"
94#include "machine/pic8259.h"
95#include "machine/pit8253.h"
96#include "machine/mc146818.h"
97#include "machine/8042kbdc.h"
98#include "machine/pcshare.h"
99#include "video/pc_vga.h"
100#include "video/pc_video.h"
94101
95static VIDEO_START(pangofun)
102static ADDRESS_MAP_START( pcat_map, ADDRESS_SPACE_PROGRAM, 32 )
103   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
104   AM_RANGE(0x000a0000, 0x000bffff) AM_RAM
105   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0)
106   AM_RANGE(0x000f0000, 0x000fffff) AM_ROM AM_REGION("bios", 0 )
107   AM_RANGE(0x00100000, 0x001fffff) AM_RAM
108   AM_RANGE(0xffff0000, 0xffffffff) AM_ROM AM_REGION("bios", 0 )
109ADDRESS_MAP_END
110
111static ADDRESS_MAP_START( pcat_io, ADDRESS_SPACE_IO, 32 )
112   AM_IMPORT_FROM(pcat32_io_common)
113   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
114ADDRESS_MAP_END
115
116#define AT_KEYB_HELPER(bit, text, key1) \
117   PORT_BIT( bit, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(text) PORT_CODE(key1)
118
119static INPUT_PORTS_START( pangofun )
120   PORT_START("pc_keyboard_0")
121   PORT_BIT ( 0x0001, 0x0000, IPT_UNUSED )    /* unused scancode 0 */
122   AT_KEYB_HELPER( 0x0002, "Esc",          KEYCODE_Q           ) /* Esc                         01  81 */
123
124   PORT_START("pc_keyboard_1")
125   AT_KEYB_HELPER( 0x0020, "Y",            KEYCODE_Y           ) /* Y                           15  95 */
126   AT_KEYB_HELPER( 0x1000, "Enter",        KEYCODE_ENTER       ) /* Enter                       1C  9C */
127
128   PORT_START("pc_keyboard_2")
129
130   PORT_START("pc_keyboard_3")
131   AT_KEYB_HELPER( 0x0002, "N",            KEYCODE_N           ) /* N                           31  B1 */
132   AT_KEYB_HELPER( 0x0800, "F1",           KEYCODE_S           ) /* F1                          3B  BB */
133
134   PORT_START("pc_keyboard_4")
135
136   PORT_START("pc_keyboard_5")
137
138   PORT_START("pc_keyboard_6")
139   AT_KEYB_HELPER( 0x0040, "(MF2)Cursor Up",      KEYCODE_UP          ) /* Up                          67  e7 */
140   AT_KEYB_HELPER( 0x0080, "(MF2)Page Up",         KEYCODE_PGUP        ) /* Page Up                     68  e8 */
141   AT_KEYB_HELPER( 0x0100, "(MF2)Cursor Left",      KEYCODE_LEFT        ) /* Left                        69  e9 */
142   AT_KEYB_HELPER( 0x0200, "(MF2)Cursor Right",   KEYCODE_RIGHT       ) /* Right                       6a  ea */
143   AT_KEYB_HELPER( 0x0800, "(MF2)Cursor Down",      KEYCODE_DOWN        ) /* Down                        6c  ec */
144   AT_KEYB_HELPER( 0x1000, "(MF2)Page Down",      KEYCODE_PGDN        ) /* Page Down                   6d  ed */
145   AT_KEYB_HELPER( 0x4000, "Del",                KEYCODE_A           ) /* Delete                      6f  ef */
146
147   PORT_START("pc_keyboard_7")
148INPUT_PORTS_END
149
150static void pangofun_set_keyb_int(running_machine *machine, int state)
96151{
152   pic8259_ir1_w(machine->device("pic8259_1"), state);
97153}
98154
99static SCREEN_UPDATE(pangofun)
155static const struct pc_vga_interface vga_interface ={
156   NULL,
157   NULL,
158   NULL,
159   ADDRESS_SPACE_IO,
160   0x0000
161};
162
163static void set_gate_a20(running_machine *machine, int a20)
100164{
101   return 0;
165   cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, a20);
102166}
103167
104static ADDRESS_MAP_START( pangofun_map, ADDRESS_SPACE_PROGRAM, 32 )
105   AM_RANGE(0x00000000, 0x0001ffff) AM_ROM
106ADDRESS_MAP_END
168static void keyboard_interrupt(running_machine *machine, int state)
169{
170   pic8259_ir1_w(machine->device("pic8259_1"), state);
171}
107172
173static int pcat_dyn_get_out2(running_machine *machine) {
174   return pit8253_get_output(machine->device("pit8254"), 2 );
175}
108176
109static INPUT_PORTS_START( pangofun )
110INPUT_PORTS_END
111177
178static const struct kbdc8042_interface at8042 =
179{
180   KBDC8042_AT386, set_gate_a20, keyboard_interrupt, pcat_dyn_get_out2
181};
112182
183static MACHINE_START( pangofun )
184{
185   cpu_set_irq_callback(machine->device("maincpu"), pcat_irq_callback);
186   init_pc_common(machine, PCCOMMON_KEYBOARD_AT, pangofun_set_keyb_int);
187   kbdc8042_init(machine, &at8042);
188}
189
190
113191static MACHINE_CONFIG_START( pangofun, driver_device )
114192   /* basic machine hardware */
115   MCFG_CPU_ADD("maincpu", I486, 14318180*2)   /* I486 ?? Mhz */
116   MCFG_CPU_PROGRAM_MAP(pangofun_map)
193   MCFG_CPU_ADD("maincpu", I486, 40000000 )   /* I486 ?? Mhz */
194   MCFG_CPU_PROGRAM_MAP(pcat_map)
195   MCFG_CPU_IO_MAP(pcat_io)
117196
118197   /* video hardware */
119   MCFG_SCREEN_ADD("screen", RASTER)
120   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
198   MCFG_FRAGMENT_ADD( pcvideo_vga )
199   MCFG_SCREEN_MODIFY("screen")
121200   MCFG_SCREEN_REFRESH_RATE(60)
122   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
123   MCFG_SCREEN_SIZE(64*8, 32*8)
124   MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
125   MCFG_SCREEN_UPDATE(pangofun)
201   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
126202
127   MCFG_PALETTE_LENGTH(0x100)
128
129   MCFG_VIDEO_START(pangofun)
203   MCFG_MACHINE_START(pangofun)
204   MCFG_MC146818_ADD( "rtc", MC146818_STANDARD )
205   MCFG_FRAGMENT_ADD( pcat_common )
130206MACHINE_CONFIG_END
131207
132208
133209ROM_START(pangofun)
134   ROM_REGION32_LE(0x20000, "maincpu", 0)   /* motherboard bios */
210   ROM_REGION32_LE(0x20000, "bios", 0)   /* motherboard bios */
135211   ROM_LOAD("bios.bin", 0x000000, 0x10000, CRC(e70168ff) SHA1(4a0d985c218209b7db2b2d33f606068aae539020) )
136212
137   ROM_REGION32_LE(0x20000, "user1", 0)   /* gfx card bios */
138   ROM_LOAD("vgabios.bin", 0x000000, 0x20000, NO_DUMP ) // 1x maskrom (28pin)
213//  ROM_REGION32_LE(0x20000, "video_bios", 0)   /* gfx card bios */
214//  ROM_LOAD("vgabios.bin", 0x000000, 0x20000, NO_DUMP ) // 1x maskrom (28pin)
215   ROM_REGION(0x20000, "video_bios", 0)   /* Trident TVGA9000 BIOS */
216   ROM_LOAD16_BYTE("prom.vid", 0x00000, 0x04000, CRC(ad7eadaf) SHA1(ab379187914a832284944e81e7652046c7d938cc) )
217   ROM_CONTINUE(            0x00001, 0x04000 )
139218
140219   /* this is what was on the rom board, mapping unknown */
141   ROM_REGION32_LE(0xa00000, "user2", 0)   /* rom board */
220   ROM_REGION32_LE(0xa00000, "game_prg", 0)   /* rom board */
142221   ROM_LOAD32_WORD("bank0.u11", 0x000000, 0x80000, CRC(6ce951d7) SHA1(1dd09491c651920a8a507bdc6584400367e5a292) )
143222   ROM_LOAD32_WORD("bank0.u31", 0x000002, 0x80000, CRC(b6c06baf) SHA1(79074b086d24737d629272d98f17de6e1e650485) )
144223   ROM_LOAD32_WORD("bank1.u12", 0x100000, 0x80000, CRC(5adc1f2e) SHA1(17abde7a2836d042a698661339eefe242dd9af0d) )
r10613r10614
159238   ROM_LOAD32_WORD("bank8.u39", 0x900002, 0x20000, CRC(72422c66) SHA1(40b8cca3f99925cf019053921165f6a4a30d784d) )
160239ROM_END
161240
241static DRIVER_INIT(pangofun)
242{
243   pc_vga_init(machine, &vga_interface, NULL);
244}
162245
163GAME( 1995, pangofun,  0,   pangofun, pangofun, 0, ROT0, "InfoCube", "Pango Fun (Italy)", GAME_NOT_WORKING|GAME_NO_SOUND )
246GAME( 1995, pangofun,  0,   pangofun, pangofun, pangofun, ROT0, "InfoCube", "Pango Fun (Italy)", GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/ghosteo.c
r10613r10614
5959#include "machine/i2cmem.h"
6060
6161
62enum nand_mode_t
63{
64   NAND_M_INIT,      // initial state
65   NAND_M_READ,      // read page data
66};
67
68struct nand_t
69{
70   nand_mode_t mode;
71   int page_addr;
72   int byte_addr;
73   int addr_load_ptr;
74};
75
76
6277class ghosteo_state : public driver_device
6378{
6479public:
r10613r10614
6984   UINT32 *steppingstone;
7085   int security_count;
7186   UINT32 bballoon_port[20];
87   struct nand_t nand;
7288};
7389
7490
r10613r10614
98114static const UINT8 security_data[] = { 0x01, 0xC4, 0xFF, 0x22 };
99115
100116
101enum nand_mode_t
102{
103   NAND_M_INIT,      // initial state
104   NAND_M_READ,      // read page data
105};
106
107struct nand_t
108{
109   nand_mode_t mode;
110   int page_addr;
111   int byte_addr;
112   int addr_load_ptr;
113};
114
115static struct nand_t nand;
116
117117static UINT32 s3c2410_gpio_port_r( device_t *device, int port)
118118{
119119   ghosteo_state *state = device->machine->driver_data<ghosteo_state>();
r10613r10614
167167
168168static WRITE8_DEVICE_HANDLER( s3c2410_nand_command_w )
169169{
170   ghosteo_state *state = device->machine->driver_data<ghosteo_state>();
171   struct nand_t &nand = state->nand;
170172//  device_t *nand = device->machine->device( "nand");
171173   logerror( "s3c2410_nand_command_w %02X\n", data);
172174   switch (data)
r10613r10614
189191
190192static WRITE8_DEVICE_HANDLER( s3c2410_nand_address_w )
191193{
194   ghosteo_state *state = device->machine->driver_data<ghosteo_state>();
195   struct nand_t &nand = state->nand;
192196//  device_t *nand = device->machine->device( "nand");
193197   logerror( "s3c2410_nand_address_w %02X\n", data);
194198   switch (nand.mode)
r10613r10614
221225
222226static READ8_DEVICE_HANDLER( s3c2410_nand_data_r )
223227{
228   ghosteo_state *state = device->machine->driver_data<ghosteo_state>();
229   struct nand_t &nand = state->nand;
224230//  device_t *nand = device->machine->device( "nand");
225231   UINT8 data = 0;
226232   switch (nand.mode)
src/mame/drivers/deco_ld.c
r10613r10614
242242}
243243#endif
244244
245static INTERRUPT_GEN ( sound_interrupt ) {
246   deco_ld_state *state = device->machine->driver_data<deco_ld_state>(); if (!state->nmimask) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); }
245static INTERRUPT_GEN ( sound_interrupt )
246{
247   deco_ld_state *state = device->machine->driver_data<deco_ld_state>();
248   if (!state->nmimask) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
249}
247250
248251
249252static ADDRESS_MAP_START( rblaster_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
src/mame/drivers/magmax.c
r10613r10614
3030#include "includes/magmax.h"
3131
3232
33static UINT8 sound_latch = 0;
34static UINT8 LS74_clr = 0;
35static UINT8 LS74_q   = 0;
36static UINT8 gain_control = 0;
37
38static emu_timer *interrupt_timer;
39
4033static WRITE16_HANDLER( magmax_sound_w )
4134{
35   magmax_state *state = space->machine->driver_data<magmax_state>();
4236   if (ACCESSING_BITS_0_7)
4337   {
44      sound_latch = (data & 0xff) << 1;
38      state->sound_latch = (data & 0xff) << 1;
4539      cputag_set_input_line(space->machine, "audiocpu", 0, ASSERT_LINE);
4640   }
4741}
r10613r10614
5448
5549static READ8_HANDLER( magmax_sound_r )
5650{
57   return (sound_latch | LS74_q);
51   magmax_state *state = space->machine->driver_data<magmax_state>();
52   return (state->sound_latch | state->LS74_q);
5853}
5954
6055static WRITE8_DEVICE_HANDLER( ay8910_portB_0_w )
6156{
57   magmax_state *state = device->machine->driver_data<magmax_state>();
6258   /*bit 0 is input to CLR line of the LS74*/
63   LS74_clr = data & 1;
64   if (LS74_clr == 0)
65      LS74_q = 0;
59   state->LS74_clr = data & 1;
60   if (state->LS74_clr == 0)
61      state->LS74_q = 0;
6662}
6763
6864static TIMER_CALLBACK( scanline_callback )
6965{
66   magmax_state *state = machine->driver_data<magmax_state>();
7067   int scanline = param;
7168
7269   /* bit 0 goes hi whenever line V6 from video part goes lo->hi */
7370   /* that is when scanline is 64 and 192 accordingly */
74   if (LS74_clr != 0)
75      LS74_q = 1;
71   if (state->LS74_clr != 0)
72      state->LS74_q = 1;
7673
7774   scanline += 128;
7875   scanline &= 255;
7976
80   interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
77   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
8178}
8279
8380static MACHINE_START( magmax )
8481{
82   magmax_state *state = machine->driver_data<magmax_state>();
8583   /* Create interrupt timer */
86   interrupt_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
84   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(scanline_callback));
8785
8886   /* Set up save state */
89   state_save_register_global(machine, sound_latch);
90   state_save_register_global(machine, LS74_clr);
91   state_save_register_global(machine, LS74_q);
92   state_save_register_global(machine, gain_control);
87   state_save_register_global(machine, state->sound_latch);
88   state_save_register_global(machine, state->LS74_clr);
89   state_save_register_global(machine, state->LS74_q);
90   state_save_register_global(machine, state->gain_control);
9391}
9492
9593static MACHINE_RESET( magmax )
9694{
97   interrupt_timer->adjust(machine->primary_screen->time_until_pos(64), 64);
95   magmax_state *state = machine->driver_data<magmax_state>();
96   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(64), 64);
9897
9998#if 0
10099   {
r10613r10614
109108
110109static WRITE8_DEVICE_HANDLER( ay8910_portA_0_w )
111110{
111   magmax_state *state = device->machine->driver_data<magmax_state>();
112112ay8910_device *ay1 = device->machine->device<ay8910_device>("ay1");
113113ay8910_device *ay2 = device->machine->device<ay8910_device>("ay2");
114114ay8910_device *ay3 = device->machine->device<ay8910_device>("ay3");
r10613r10614
158158bit3 - SOUND Chan#8 name=AY-3-8910 #2 Ch C
159159*/
160160
161   if (gain_control == (data & 0x0f))
161   if (state->gain_control == (data & 0x0f))
162162      return;
163163
164   gain_control = data & 0x0f;
164   state->gain_control = data & 0x0f;
165165
166166   /*popmessage("gain_ctrl = %2x",data&0x0f);*/
167167
168   percent = (gain_control & 1) ? 1.0 : 0.50;
168   percent = (state->gain_control & 1) ? 1.0 : 0.50;
169169   ay1->set_output_gain(0, percent);
170170//fixme:    set_RC_filter(0,10000,100000000,0,10000);   /* 10K, 10000pF = 0.010uF */
171171
172   percent = (gain_control & 2) ? 0.45 : 0.23;
172   percent = (state->gain_control & 2) ? 0.45 : 0.23;
173173   ay1->set_output_gain(1, percent);
174174   ay1->set_output_gain(2, percent);
175175   ay2->set_output_gain(0, percent);
r10613r10614
179179//fixme:    set_RC_filter(3,4700,100000000,0,4700); /*  4.7K, 4700pF = 0.0047uF */
180180//fixme:    set_RC_filter(4,4700,100000000,0,4700); /*  4.7K, 4700pF = 0.0047uF */
181181
182   percent = (gain_control & 4) ? 0.45 : 0.23;
182   percent = (state->gain_control & 4) ? 0.45 : 0.23;
183183   ay2->set_output_gain(2, percent);
184184   ay3->set_output_gain(0, percent);
185185
186   percent = (gain_control & 8) ? 0.45 : 0.23;
186   percent = (state->gain_control & 8) ? 0.45 : 0.23;
187187   ay3->set_output_gain(1, percent);
188188   ay3->set_output_gain(2, percent);
189189}
190190
191191static WRITE16_HANDLER( magmax_vreg_w )
192192{
193   magmax_state *state = space->machine->driver_data<magmax_state>();
193194   /* VRAM CONTROL REGISTER */
194195   /* bit0 - coin counter 1    */
195196   /* bit1 - coin counter 2    */
r10613r10614
198199   /* bit4 - sprite bank LSB (DP0) */
199200   /* bit5 - sprite bank MSB (DP1) */
200201   /* bit6 - BG display enable (BE)*/
201   COMBINE_DATA(magmax_vreg);
202   COMBINE_DATA(state->vreg);
202203}
203204
204205
r10613r10614
212213   AM_RANGE(0x030002, 0x030003) AM_READ_PORT("P2")
213214   AM_RANGE(0x030004, 0x030005) AM_READ_PORT("SYSTEM")
214215   AM_RANGE(0x030006, 0x030007) AM_READ_PORT("DSW")
215   AM_RANGE(0x030010, 0x030011) AM_WRITE(magmax_vreg_w) AM_BASE(&magmax_vreg)
216   AM_RANGE(0x030012, 0x030013) AM_WRITEONLY AM_BASE(&magmax_scroll_x)
217   AM_RANGE(0x030014, 0x030015) AM_WRITEONLY AM_BASE(&magmax_scroll_y)
216   AM_RANGE(0x030010, 0x030011) AM_WRITE(magmax_vreg_w) AM_BASE_MEMBER(magmax_state, vreg)
217   AM_RANGE(0x030012, 0x030013) AM_WRITEONLY AM_BASE_MEMBER(magmax_state, scroll_x)
218   AM_RANGE(0x030014, 0x030015) AM_WRITEONLY AM_BASE_MEMBER(magmax_state, scroll_y)
218219   AM_RANGE(0x03001c, 0x03001d) AM_WRITE(magmax_sound_w)
219220   AM_RANGE(0x03001e, 0x03001f) AM_WRITENOP   /* IRQ ack */
220221ADDRESS_MAP_END
src/mame/drivers/ace.c
r10613r10614
123123
124124static PALETTE_INIT( ace )
125125{
126   palette_set_color(machine, 0, MAKE_RGB(0x10,0x20,0xd0)); /* light bluish */
126   palette_set_color(machine, 0, MAKE_RGB(0x00,0x00,0x00)); /* black */
127127   palette_set_color(machine, 1, MAKE_RGB(0xff,0xff,0xff)); /* white */
128128}
129129
r10613r10614
212212
213213static INPUT_PORTS_START( ace )
214214   PORT_START("c008")   /* player thrust */
215   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("P1 Thrust")
215   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_2WAY PORT_PLAYER(1) PORT_NAME("P1 Thrust")
216216
217217   PORT_START("c009")   /* player slowdown */
218   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Slowdown")
218   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_2WAY PORT_PLAYER(1) PORT_NAME("P1 Slowdown")
219219
220220   PORT_START("c00a")   /* player left */
221   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
221   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
222222
223223   PORT_START("c00b")   /* player right */
224   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
224   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
225225
226226   PORT_START("c00c")   /* player fire */
227227   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Fire")
228228
229229   PORT_START("c00d")   /* enemy thrust */
230   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_NAME("P2 Thrust")
230   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_2WAY PORT_PLAYER(2) PORT_NAME("P2 Thrust")
231231
232232   PORT_START("c00e")   /* enemy slowdown */
233   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Slowdown")
233   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_2WAY PORT_PLAYER(2) PORT_NAME("P2 Slowdown")
234234
235235   PORT_START("c00f")   /* enemy left  */
236   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
236   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(2)
237237
238238   PORT_START("c010")   /* enemy right */
239   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
239   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(2)
240240
241241   PORT_START("c011")   /* enemy fire */
242242   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Fire")
r10613r10614
390390
391391ROM_END
392392
393GAME( 1976, ace, 0, ace, ace, 0, ROT0, "Allied Leisure", "Ace", GAME_SUPPORTS_SAVE | GAME_NO_SOUND | GAME_IMPERFECT_COLORS )
393GAME( 1976, ace, 0, ace, ace, 0, ROT0, "Allied Leisure", "Ace", GAME_SUPPORTS_SAVE | GAME_NO_SOUND )
src/mame/drivers/astrocde.c
r10613r10614
13031303
13041304   MCFG_PALETTE_INIT(profpac)
13051305   MCFG_VIDEO_START(profpac)
1306   
1306
13071307   MCFG_SCREEN_MODIFY("screen")
13081308   MCFG_SCREEN_UPDATE(profpac)
13091309MACHINE_CONFIG_END
src/mame/drivers/nss.c
r10613r10614
297297#include "cpu/z80/z80.h"
298298#include "includes/snes.h"
299299
300
301class nss_state : public snes_state
302{
303public:
304   nss_state(running_machine &machine, const driver_device_config_base &config)
305      : snes_state(machine, config) { }
306
307   UINT8 m50458_rom_bank;
308   UINT8 vblank_bit;
309};
310
311
300312static ADDRESS_MAP_START( snes_map, ADDRESS_SPACE_PROGRAM, 8)
301313   AM_RANGE(0x000000, 0x2fffff) AM_READWRITE(snes_r_bank1, snes_w_bank1)   /* I/O and ROM (repeats for each bank) */
302314   AM_RANGE(0x300000, 0x3fffff) AM_READWRITE(snes_r_bank2, snes_w_bank2)   /* I/O and ROM (repeats for each bank) */
r10613r10614
366378//  printf("EEPROM write %02x\n",data);
367379}
368380
369static UINT8 m50458_rom_bank;
370381
371382static READ8_HANDLER( m50458_r )
372383{
373   if(m50458_rom_bank)
384   nss_state *state = space->machine->driver_data<nss_state>();
385   if(state->m50458_rom_bank)
374386   {
375387      UINT8 *gfx_rom = space->machine->region("m50458_gfx")->base();
376388
r10613r10614
388400
389401static WRITE8_HANDLER( m50458_w )
390402{
391   if(m50458_rom_bank)
403   nss_state *state = space->machine->driver_data<nss_state>();
404   if(state->m50458_rom_bank)
392405      logerror("Warning: write to M50458 GFX ROM!\n");
393406   else
394407   {
r10613r10614
411424
412425static READ8_HANDLER( port00_r )
413426{
427   nss_state *state = space->machine->driver_data<nss_state>();
414428   /*
415429    -x-- ---- almost certainly tied to the vblank signal
416430    */
417431
418   static UINT8 vblank_bit;
419432
420   vblank_bit^=0x40;
433   state->vblank_bit^=0x40;
421434
422   return vblank_bit | 0xbf;
435   return state->vblank_bit | 0xbf;
423436}
424437
425438
r10613r10614
451464
452465static WRITE8_HANDLER( port80_w )
453466{
467   nss_state *state = space->machine->driver_data<nss_state>();
454468   /*
455469    ---- -x-- written when 0x9000-0x9fff is read, probably a bankswitch
456470    ---- --x- see port 0x02 note
r10613r10614
458472    */
459473
460474   memory_set_bank(space->machine, "bank1", data & 1);
461   m50458_rom_bank = data & 4;
475   state->m50458_rom_bank = data & 4;
462476}
463477
464478static WRITE8_HANDLER( port82_w ) // EEPROM2?
r10613r10614
485499
486500static MACHINE_START( nss )
487501{
502   nss_state *state = machine->driver_data<nss_state>();
488503   UINT8 *ROM = machine->region("bios")->base();
489504
490505   memory_configure_bank(machine, "bank1", 0, 2, &ROM[0x10000], 0x8000);
491506   memory_set_bank(machine, "bank1", 0);
492507
493   m50458_rom_bank = 0;
508   state->m50458_rom_bank = 0;
494509
495510   MACHINE_START_CALL(snes);
496511}
r10613r10614
639654   GFXDECODE_ENTRY( "m50458_gfx",   0x00000, nss_char_layout_16x16,    0, 1 )
640655GFXDECODE_END
641656
642static MACHINE_CONFIG_START( snes, snes_state )
657static MACHINE_CONFIG_START( snes, nss_state )
643658
644659   /* basic machine hardware */
645660   MCFG_CPU_ADD("maincpu", _5A22, 3580000*6)   /* 2.68Mhz, also 3.58Mhz */
src/mame/drivers/white_mod.c
r10613r10614
4646ROM_START(elvisp)
4747   ROM_REGION(0x80000, "user1", 0)
4848   ROM_LOAD("elvscpua.500", 0x00000, 0x20000, CRC(aae9d65d) SHA1(d6e789f7257448e97697c406561c14a0abc45187))
49/*
50ROM_LOAD( "elvscpua.302",  0x0000, 0x20000, CRC(52fd7068) SHA1(548568aeb30a17541b07489dfecde9d4d63bf82b))
51ROM_LOAD( "elvscpuf.302",  0x0000, 0x20000, CRC(893a5ac6) SHA1(4be45cf036cdd643f10ecbb4d0b1778d25cf778a))
52ROM_LOAD( "elvscpug.302",  0x0000, 0x20000, CRC(9d907782) SHA1(3bad8d0429029b0055d09e50af16bca4da724e0f))
53ROM_LOAD( "elvscpui.302",  0x0000, 0x20000, CRC(a2c15460) SHA1(dcd4d4b61745ab2ccba662f9d72f56774a830ea0))
54ROM_LOAD( "elvscpul.302",  0x0000, 0x20000, CRC(0c6f1897) SHA1(ac71f833d4227c2d2d665a169eb0d12c73aeab04))
55ROM_LOAD( "elvscpua.400",  0x0000, 0x20000, CRC(385be9ed) SHA1(c25b54a9b52bece17de9c394c019a4d2649bcf47))
56ROM_LOAD( "elvsdspa.401",  0x0000, 0x80000, CRC(fb08d5c3) SHA1(03f9886381d32bfd012a2663d2b7331a76c8c1c0))
57ROM_LOAD( "elvscpuf.400",  0x0000, 0x20000, CRC(9ae4f3c4) SHA1(5ec1590ca54f36565953467226a85491a96d2d3c))
58ROM_LOAD( "elvsdspf.401",  0x0000, 0x80000, CRC(1ddd1823) SHA1(86c2bacb596265a28a4b6dce3cd47ed5a2cf74d7))
59ROM_LOAD( "elvscpug.400",  0x0000, 0x20000, CRC(c5992b96) SHA1(0e8c285b76374daad17017994cd9d8e68a98ba42))
60ROM_LOAD( "elvsdspg.401",  0x0000, 0x80000, CRC(a694f642) SHA1(a44febcc08445f53aa96b0c791a636d541cebb97))
61ROM_LOAD( "elvscpui.400",  0x0000, 0x20000, CRC(dd2876fc) SHA1(3b860ad176e3fda58be1f165fc2f9965f36259ef))
62ROM_LOAD( "elvsdspi.401",  0x0000, 0x80000, CRC(51f92cec) SHA1(a678dcb29f867b07641f39f5e0a9bf0e5daf9dc3))
63ROM_LOAD( "elvscpul.400",  0x0000, 0x20000, CRC(536d4e3c) SHA1(3470ffdc32dbce9142dab82c25915d617e1429e6))
64ROM_LOAD( "elvsdspl.401",  0x0000, 0x80000, CRC(57fc6ed2) SHA1(3349a56ce38ab4ffdf1469bac8dbc9d08c077f6e))
65ROM_LOAD( "elvscpua.303",  0x0000, 0x20000, CRC(a0dd77d8) SHA1(2882eed805c2eb3cabadcfe51997a534ddac9050))
66ROM_LOAD( "elvsdspa.302",  0x0000, 0x80000, CRC(892da6d2) SHA1(66a2f9faab9c7b925a90455ce7e1d31e19fce99e))
67ROM_LOAD( "elvscpuf.303",  0x0000, 0x20000, CRC(bc5cc2b9) SHA1(f434164384153a3cca358af55ed82c7757e74fd9))
68ROM_LOAD( "elvsdspf.302",  0x0000, 0x80000, CRC(410b6ae5) SHA1(ea29e1c81695df25ad61deedd84e6c3159976797))
69ROM_LOAD( "elvscpug.303",  0x0000, 0x20000, CRC(66b50538) SHA1(2612c0618c1d438632ff56b3b779214cf6534ff8))
70ROM_LOAD( "elvsdspg.302",  0x0000, 0x80000, CRC(6340bb11) SHA1(d510f1a913cd3fb9593ef88c5652e03a5d3c3ebb))
71ROM_LOAD( "elvscpui.303",  0x0000, 0x20000, CRC(11f47b7a) SHA1(4fbe64ed49719408b77ebf6871bb2211e03de394))
72ROM_LOAD( "elvsdspi.302",  0x0000, 0x80000, CRC(217c7d17) SHA1(bfd67e876ea85847212c936f9f8477aba8a7b573))
73ROM_LOAD( "elvscpul.303",  0x0000, 0x20000, CRC(691b9882) SHA1(fd8ceef9dbae6c788964d417ad1c61a4bb8e0d9b))
74ROM_LOAD( "elvsdspl.302",  0x0000, 0x80000, CRC(f75ea4cb) SHA1(aa351bb0912fd9dc93e9c95f96af2d31aaf03777))
75    */
7649   ROM_RELOAD(0x20000, 0x20000)
7750   ROM_RELOAD(0x40000, 0x20000)
7851   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
9265   ROM_LOAD("elvis.u36", 0x200000, 0x100000, CRC(e98f0dc9) SHA1(6dbab09435e993fef97d6a80a73675723bea7c1d))
9366   ROM_LOAD("elvis.u37", 0x300000, 0x100000, CRC(88ba0966) SHA1(43ea198c9fcdc1c396d4180308042c6c08311829))
9467ROM_END
68ROM_START(elvisp4)
69   ROM_REGION(0x80000, "user1", 0)
70   ROM_LOAD( "elvscpua.400",  0x0000, 0x20000, CRC(385be9ed) SHA1(c25b54a9b52bece17de9c394c019a4d2649bcf47))
71   ROM_RELOAD(0x20000, 0x20000)
72   ROM_RELOAD(0x40000, 0x20000)
73   ROM_RELOAD(0x60000, 0x20000)
74   ROM_REGION(0x10000, "maincpu", 0)
75   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
76   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
77   ROM_REGION(0x80000, "gfx3", 0)
78   ROM_LOAD( "elvsdspa.401",  0x0000, 0x80000, CRC(fb08d5c3) SHA1(03f9886381d32bfd012a2663d2b7331a76c8c1c0))
79   ROM_REGION32_LE(0x600000, "cpu2", 0)
80   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
81   ROM_RELOAD(0x0,0x20000)
82   ROM_REGION(0x10000, "sound1", 0)
83   ROM_LOAD("elvis.u7",0x0000,0x10000,CRC(1df6c1b5) SHA1(7a9ebfc555e54ce92ad140ac6fcb82d9848ad8a6))
84   ROM_REGION(0x400000, "sound2", 0)
85   ROM_LOAD("elvis.u17", 0x000000, 0x100000, CRC(ff032897) SHA1(bf347c26a450bc07cdc94fc582dedf3a0cdc2a1b))
86   ROM_LOAD("elvis.u21", 0x100000, 0x100000, CRC(c3c19a40) SHA1(97f7f36eed62ca389c770bf5d746721724e17250))
87   ROM_LOAD("elvis.u36", 0x200000, 0x100000, CRC(e98f0dc9) SHA1(6dbab09435e993fef97d6a80a73675723bea7c1d))
88   ROM_LOAD("elvis.u37", 0x300000, 0x100000, CRC(88ba0966) SHA1(43ea198c9fcdc1c396d4180308042c6c08311829))
89ROM_END
90ROM_START(elvisp303)
91   ROM_REGION(0x80000, "user1", 0)
92   ROM_LOAD( "elvscpua.303",  0x0000, 0x20000, CRC(a0dd77d8) SHA1(2882eed805c2eb3cabadcfe51997a534ddac9050))
93   ROM_RELOAD(0x20000, 0x20000)
94   ROM_RELOAD(0x40000, 0x20000)
95   ROM_RELOAD(0x60000, 0x20000)
96   ROM_REGION(0x10000, "maincpu", 0)
97   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
98   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
99   ROM_REGION(0x80000, "gfx3", 0)
100   ROM_LOAD( "elvsdspa.302",  0x0000, 0x80000, CRC(892da6d2) SHA1(66a2f9faab9c7b925a90455ce7e1d31e19fce99e))
101   ROM_REGION32_LE(0x600000, "cpu2", 0)
102   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
103   ROM_RELOAD(0x0,0x20000)
104   ROM_REGION(0x10000, "sound1", 0)
105   ROM_LOAD("elvis.u7",0x0000,0x10000,CRC(1df6c1b5) SHA1(7a9ebfc555e54ce92ad140ac6fcb82d9848ad8a6))
106   ROM_REGION(0x400000, "sound2", 0)
107   ROM_LOAD("elvis.u17", 0x000000, 0x100000, CRC(ff032897) SHA1(bf347c26a450bc07cdc94fc582dedf3a0cdc2a1b))
108   ROM_LOAD("elvis.u21", 0x100000, 0x100000, CRC(c3c19a40) SHA1(97f7f36eed62ca389c770bf5d746721724e17250))
109   ROM_LOAD("elvis.u36", 0x200000, 0x100000, CRC(e98f0dc9) SHA1(6dbab09435e993fef97d6a80a73675723bea7c1d))
110   ROM_LOAD("elvis.u37", 0x300000, 0x100000, CRC(88ba0966) SHA1(43ea198c9fcdc1c396d4180308042c6c08311829))
111ROM_END
112ROM_START(elvisp302)
113   ROM_REGION(0x80000, "user1", 0)
114   ROM_LOAD( "elvscpua.302",  0x0000, 0x20000, CRC(52fd7068) SHA1(548568aeb30a17541b07489dfecde9d4d63bf82b))
115   ROM_RELOAD(0x20000, 0x20000)
116   ROM_RELOAD(0x40000, 0x20000)
117   ROM_RELOAD(0x60000, 0x20000)
118   ROM_REGION(0x10000, "maincpu", 0)
119   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
120   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
121   ROM_REGION(0x80000, "gfx3", 0)
122   ROM_LOAD( "elvsdspa.302",  0x0000, 0x80000, CRC(892da6d2) SHA1(66a2f9faab9c7b925a90455ce7e1d31e19fce99e))
123   ROM_REGION32_LE(0x600000, "cpu2", 0)
124   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
125   ROM_RELOAD(0x0,0x20000)
126   ROM_REGION(0x10000, "sound1", 0)
127   ROM_LOAD("elvis.u7",0x0000,0x10000,CRC(1df6c1b5) SHA1(7a9ebfc555e54ce92ad140ac6fcb82d9848ad8a6))
128   ROM_REGION(0x400000, "sound2", 0)
129   ROM_LOAD("elvis.u17", 0x000000, 0x100000, CRC(ff032897) SHA1(bf347c26a450bc07cdc94fc582dedf3a0cdc2a1b))
130   ROM_LOAD("elvis.u21", 0x100000, 0x100000, CRC(c3c19a40) SHA1(97f7f36eed62ca389c770bf5d746721724e17250))
131   ROM_LOAD("elvis.u36", 0x200000, 0x100000, CRC(e98f0dc9) SHA1(6dbab09435e993fef97d6a80a73675723bea7c1d))
132   ROM_LOAD("elvis.u37", 0x300000, 0x100000, CRC(88ba0966) SHA1(43ea198c9fcdc1c396d4180308042c6c08311829))
133ROM_END
95134 
96135ROM_START(elvisl)
97136   ROM_REGION(0x80000, "user1", 0)
r10613r10614
115154   ROM_LOAD("elvisl.u36", 0x200000, 0x100000, CRC(01ebbdbe) SHA1(286fa471b20b6ffcb0114d66239ab6aebe9bca9d))
116155   ROM_LOAD("elvisl.u37", 0x300000, 0x100000, CRC(bed26746) SHA1(385cb77ec7599b12a4b021c53b42b8e9b9fb08a8))
117156ROM_END
157ROM_START(elvisl4)
158   ROM_REGION(0x80000, "user1", 0)
159   ROM_LOAD( "elvscpul.400",  0x0000, 0x20000, CRC(536d4e3c) SHA1(3470ffdc32dbce9142dab82c25915d617e1429e6))
160   ROM_RELOAD(0x20000, 0x20000)
161   ROM_RELOAD(0x40000, 0x20000)
162   ROM_RELOAD(0x60000, 0x20000)
163   ROM_REGION(0x10000, "maincpu", 0)
164   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
165   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
166   ROM_REGION(0x80000, "gfx3", 0)
167   ROM_LOAD( "elvsdspl.401",  0x0000, 0x80000, CRC(57fc6ed2) SHA1(3349a56ce38ab4ffdf1469bac8dbc9d08c077f6e))
168   ROM_REGION32_LE(0x600000, "cpu2", 0)
169   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
170   ROM_RELOAD(0x0,0x20000)
171   ROM_REGION(0x10000, "sound1", 0)
172   ROM_LOAD("elvisl.u7",0x0000,0x10000,CRC(f0d70ee6) SHA1(9fa2c9d7b3690ec0c17645be066496d6833da5d1))
173   ROM_REGION(0x400000, "sound2", 0)
174   ROM_LOAD("elvisl.u17", 0x000000, 0x100000, CRC(2f86bcda) SHA1(73972fd30e84a2f97478f076cc8771c501440be5))
175   ROM_LOAD("elvisl.u21", 0x100000, 0x100000, CRC(400c7174) SHA1(a4fa0d51b7c11e70f6b93068a6bf859cdf3359c3))
176   ROM_LOAD("elvisl.u36", 0x200000, 0x100000, CRC(01ebbdbe) SHA1(286fa471b20b6ffcb0114d66239ab6aebe9bca9d))
177   ROM_LOAD("elvisl.u37", 0x300000, 0x100000, CRC(bed26746) SHA1(385cb77ec7599b12a4b021c53b42b8e9b9fb08a8))
178ROM_END
179ROM_START(elvisl303)
180   ROM_REGION(0x80000, "user1", 0)
181   ROM_LOAD( "elvscpul.303",  0x0000, 0x20000, CRC(691b9882) SHA1(fd8ceef9dbae6c788964d417ad1c61a4bb8e0d9b))
182   ROM_RELOAD(0x20000, 0x20000)
183   ROM_RELOAD(0x40000, 0x20000)
184   ROM_RELOAD(0x60000, 0x20000)
185   ROM_REGION(0x10000, "maincpu", 0)
186   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
187   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
188   ROM_REGION(0x80000, "gfx3", 0)
189   ROM_LOAD( "elvsdspl.302",  0x0000, 0x80000, CRC(f75ea4cb) SHA1(aa351bb0912fd9dc93e9c95f96af2d31aaf03777))
190   ROM_REGION32_LE(0x600000, "cpu2", 0)
191   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
192   ROM_RELOAD(0x0,0x20000)
193   ROM_REGION(0x10000, "sound1", 0)
194   ROM_LOAD("elvisl.u7",0x0000,0x10000,CRC(f0d70ee6) SHA1(9fa2c9d7b3690ec0c17645be066496d6833da5d1))
195   ROM_REGION(0x400000, "sound2", 0)
196   ROM_LOAD("elvisl.u17", 0x000000, 0x100000, CRC(2f86bcda) SHA1(73972fd30e84a2f97478f076cc8771c501440be5))
197   ROM_LOAD("elvisl.u21", 0x100000, 0x100000, CRC(400c7174) SHA1(a4fa0d51b7c11e70f6b93068a6bf859cdf3359c3))
198   ROM_LOAD("elvisl.u36", 0x200000, 0x100000, CRC(01ebbdbe) SHA1(286fa471b20b6ffcb0114d66239ab6aebe9bca9d))
199   ROM_LOAD("elvisl.u37", 0x300000, 0x100000, CRC(bed26746) SHA1(385cb77ec7599b12a4b021c53b42b8e9b9fb08a8))
200ROM_END
201ROM_START(elvisl302)
202   ROM_REGION(0x80000, "user1", 0)
203   ROM_LOAD( "elvscpul.302",  0x0000, 0x20000, CRC(0c6f1897) SHA1(ac71f833d4227c2d2d665a169eb0d12c73aeab04))
204   ROM_RELOAD(0x20000, 0x20000)
205   ROM_RELOAD(0x40000, 0x20000)
206   ROM_RELOAD(0x60000, 0x20000)
207   ROM_REGION(0x10000, "maincpu", 0)
208   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
209   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
210   ROM_REGION(0x80000, "gfx3", 0)
211   ROM_LOAD( "elvsdspl.302",  0x0000, 0x80000, CRC(f75ea4cb) SHA1(aa351bb0912fd9dc93e9c95f96af2d31aaf03777))
212   ROM_REGION32_LE(0x600000, "cpu2", 0)
213   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
214   ROM_RELOAD(0x0,0x20000)
215   ROM_REGION(0x10000, "sound1", 0)
216   ROM_LOAD("elvisl.u7",0x0000,0x10000,CRC(f0d70ee6) SHA1(9fa2c9d7b3690ec0c17645be066496d6833da5d1))
217   ROM_REGION(0x400000, "sound2", 0)
218   ROM_LOAD("elvisl.u17", 0x000000, 0x100000, CRC(2f86bcda) SHA1(73972fd30e84a2f97478f076cc8771c501440be5))
219   ROM_LOAD("elvisl.u21", 0x100000, 0x100000, CRC(400c7174) SHA1(a4fa0d51b7c11e70f6b93068a6bf859cdf3359c3))
220   ROM_LOAD("elvisl.u36", 0x200000, 0x100000, CRC(01ebbdbe) SHA1(286fa471b20b6ffcb0114d66239ab6aebe9bca9d))
221   ROM_LOAD("elvisl.u37", 0x300000, 0x100000, CRC(bed26746) SHA1(385cb77ec7599b12a4b021c53b42b8e9b9fb08a8))
222ROM_END
118223 
119224ROM_START(elvisg)
120225   ROM_REGION(0x80000, "user1", 0)
r10613r10614
138243   ROM_LOAD("elvisg.u36", 0x200000, 0x100000, CRC(25ba1ad4) SHA1(1e1a846af4ff43bb47f081b0cc179cd732c0bbea))
139244   ROM_LOAD("elvisg.u37", 0x300000, 0x100000, CRC(f6d7a2a0) SHA1(54c160a298c7ead1fe0404bce51bc16211da82cf))
140245ROM_END
246ROM_START(elvisg4)
247   ROM_REGION(0x80000, "user1", 0)
248   ROM_LOAD( "elvscpug.400",  0x0000, 0x20000, CRC(c5992b96) SHA1(0e8c285b76374daad17017994cd9d8e68a98ba42))
249   ROM_RELOAD(0x20000, 0x20000)
250   ROM_RELOAD(0x40000, 0x20000)
251   ROM_RELOAD(0x60000, 0x20000)
252   ROM_REGION(0x10000, "maincpu", 0)
253   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
254   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
255   ROM_REGION(0x80000, "gfx3", 0)
256   ROM_LOAD( "elvsdspg.401",  0x0000, 0x80000, CRC(a694f642) SHA1(a44febcc08445f53aa96b0c791a636d541cebb97))
257   ROM_REGION32_LE(0x600000, "cpu2", 0)
258   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
259   ROM_RELOAD(0x0,0x20000)
260   ROM_REGION(0x10000, "sound1", 0)
261   ROM_LOAD("elvisg.u7",0x0000,0x10000,CRC(1085bd7c) SHA1(2c34ee7d7c44906b0894c0c01b0fad74cb0d2a32))
262   ROM_REGION(0x400000, "sound2", 0)
263   ROM_LOAD("elvisg.u17", 0x000000, 0x100000, CRC(8b888d75) SHA1(b8c654d0fb558c205c338be2b458cbf931b23bac))
264   ROM_LOAD("elvisg.u21", 0x100000, 0x100000, CRC(79955b60) SHA1(36ad9e487408c9fd26641d484490b1b3bc8e1194))
265   ROM_LOAD("elvisg.u36", 0x200000, 0x100000, CRC(25ba1ad4) SHA1(1e1a846af4ff43bb47f081b0cc179cd732c0bbea))
266   ROM_LOAD("elvisg.u37", 0x300000, 0x100000, CRC(f6d7a2a0) SHA1(54c160a298c7ead1fe0404bce51bc16211da82cf))
267ROM_END
268ROM_START(elvisg303)
269   ROM_REGION(0x80000, "user1", 0)
270   ROM_LOAD( "elvscpug.303",  0x0000, 0x20000, CRC(66b50538) SHA1(2612c0618c1d438632ff56b3b779214cf6534ff8))
271   ROM_RELOAD(0x20000, 0x20000)
272   ROM_RELOAD(0x40000, 0x20000)
273   ROM_RELOAD(0x60000, 0x20000)
274   ROM_REGION(0x10000, "maincpu", 0)
275   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
276   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
277   ROM_REGION(0x80000, "gfx3", 0)
278   ROM_LOAD( "elvsdspg.302",  0x0000, 0x80000, CRC(6340bb11) SHA1(d510f1a913cd3fb9593ef88c5652e03a5d3c3ebb))
279   ROM_REGION32_LE(0x600000, "cpu2", 0)
280   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
281   ROM_RELOAD(0x0,0x20000)
282   ROM_REGION(0x10000, "sound1", 0)
283   ROM_LOAD("elvisg.u7",0x0000,0x10000,CRC(1085bd7c) SHA1(2c34ee7d7c44906b0894c0c01b0fad74cb0d2a32))
284   ROM_REGION(0x400000, "sound2", 0)
285   ROM_LOAD("elvisg.u17", 0x000000, 0x100000, CRC(8b888d75) SHA1(b8c654d0fb558c205c338be2b458cbf931b23bac))
286   ROM_LOAD("elvisg.u21", 0x100000, 0x100000, CRC(79955b60) SHA1(36ad9e487408c9fd26641d484490b1b3bc8e1194))
287   ROM_LOAD("elvisg.u36", 0x200000, 0x100000, CRC(25ba1ad4) SHA1(1e1a846af4ff43bb47f081b0cc179cd732c0bbea))
288   ROM_LOAD("elvisg.u37", 0x300000, 0x100000, CRC(f6d7a2a0) SHA1(54c160a298c7ead1fe0404bce51bc16211da82cf))
289ROM_END
290ROM_START(elvisg302)
291   ROM_REGION(0x80000, "user1", 0)
292   ROM_LOAD( "elvscpug.302",  0x0000, 0x20000, CRC(9d907782) SHA1(3bad8d0429029b0055d09e50af16bca4da724e0f))
293   ROM_RELOAD(0x20000, 0x20000)
294   ROM_RELOAD(0x40000, 0x20000)
295   ROM_RELOAD(0x60000, 0x20000)
296   ROM_REGION(0x10000, "maincpu", 0)
297   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
298   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
299   ROM_REGION(0x80000, "gfx3", 0)
300   ROM_LOAD( "elvsdspg.302",  0x0000, 0x80000, CRC(6340bb11) SHA1(d510f1a913cd3fb9593ef88c5652e03a5d3c3ebb))
301   ROM_REGION32_LE(0x600000, "cpu2", 0)
302   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
303   ROM_RELOAD(0x0,0x20000)
304   ROM_REGION(0x10000, "sound1", 0)
305   ROM_LOAD("elvisg.u7",0x0000,0x10000,CRC(1085bd7c) SHA1(2c34ee7d7c44906b0894c0c01b0fad74cb0d2a32))
306   ROM_REGION(0x400000, "sound2", 0)
307   ROM_LOAD("elvisg.u17", 0x000000, 0x100000, CRC(8b888d75) SHA1(b8c654d0fb558c205c338be2b458cbf931b23bac))
308   ROM_LOAD("elvisg.u21", 0x100000, 0x100000, CRC(79955b60) SHA1(36ad9e487408c9fd26641d484490b1b3bc8e1194))
309   ROM_LOAD("elvisg.u36", 0x200000, 0x100000, CRC(25ba1ad4) SHA1(1e1a846af4ff43bb47f081b0cc179cd732c0bbea))
310   ROM_LOAD("elvisg.u37", 0x300000, 0x100000, CRC(f6d7a2a0) SHA1(54c160a298c7ead1fe0404bce51bc16211da82cf))
311ROM_END
141312 
142313ROM_START(elvisf)
143314   ROM_REGION(0x80000, "user1", 0)
r10613r10614
161332   ROM_LOAD("elvisf.u36", 0x200000, 0x100000, CRC(03ee0c04) SHA1(45a994589e3d9e6fe971db8722848b5f7432b675))
162333   ROM_LOAD("elvisf.u37", 0x300000, 0x100000, CRC(aa265440) SHA1(36b13ef0be4203936d9816e521098e72d6b4e4c1))
163334ROM_END
335ROM_START(elvisf4)
336   ROM_REGION(0x80000, "user1", 0)
337   ROM_LOAD( "elvscpuf.400",  0x0000, 0x20000, CRC(9ae4f3c4) SHA1(5ec1590ca54f36565953467226a85491a96d2d3c))
338   ROM_RELOAD(0x20000, 0x20000)
339   ROM_RELOAD(0x40000, 0x20000)
340   ROM_RELOAD(0x60000, 0x20000)
341   ROM_REGION(0x10000, "maincpu", 0)
342   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
343   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
344   ROM_REGION(0x80000, "gfx3", 0)
345   ROM_LOAD( "elvsdspf.401",  0x0000, 0x80000, CRC(1ddd1823) SHA1(86c2bacb596265a28a4b6dce3cd47ed5a2cf74d7))
346   ROM_REGION32_LE(0x600000, "cpu2", 0)
347   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
348   ROM_RELOAD(0x0,0x20000)
349   ROM_REGION(0x10000, "sound1", 0)
350   ROM_LOAD("elvisf.u7",0x0000,0x10000,CRC(84a057cd) SHA1(70e626f13a164df184dc5b0c79e8d320eeafb13b))
351   ROM_REGION(0x400000, "sound2", 0)
352   ROM_LOAD("elvisf.u17", 0x000000, 0x100000, CRC(9b13e40d) SHA1(7e7eac1be5cbc7bde4296d168a1cc0716bcb293a))
353   ROM_LOAD("elvisf.u21", 0x100000, 0x100000, CRC(5b668b6d) SHA1(9b104af5df5cc21c2504760b119f3e6584a1871b))
354   ROM_LOAD("elvisf.u36", 0x200000, 0x100000, CRC(03ee0c04) SHA1(45a994589e3d9e6fe971db8722848b5f7432b675))
355   ROM_LOAD("elvisf.u37", 0x300000, 0x100000, CRC(aa265440) SHA1(36b13ef0be4203936d9816e521098e72d6b4e4c1))
356ROM_END
357ROM_START(elvisf303)
358   ROM_REGION(0x80000, "user1", 0)
359   ROM_LOAD( "elvscpuf.303",  0x0000, 0x20000, CRC(bc5cc2b9) SHA1(f434164384153a3cca358af55ed82c7757e74fd9))
360   ROM_RELOAD(0x20000, 0x20000)
361   ROM_RELOAD(0x40000, 0x20000)
362   ROM_RELOAD(0x60000, 0x20000)
363   ROM_REGION(0x10000, "maincpu", 0)
364   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
365   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
366   ROM_REGION(0x80000, "gfx3", 0)
367   ROM_LOAD( "elvsdspf.302",  0x0000, 0x80000, CRC(410b6ae5) SHA1(ea29e1c81695df25ad61deedd84e6c3159976797))
368   ROM_REGION32_LE(0x600000, "cpu2", 0)
369   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
370   ROM_RELOAD(0x0,0x20000)
371   ROM_REGION(0x10000, "sound1", 0)
372   ROM_LOAD("elvisf.u7",0x0000,0x10000,CRC(84a057cd) SHA1(70e626f13a164df184dc5b0c79e8d320eeafb13b))
373   ROM_REGION(0x400000, "sound2", 0)
374   ROM_LOAD("elvisf.u17", 0x000000, 0x100000, CRC(9b13e40d) SHA1(7e7eac1be5cbc7bde4296d168a1cc0716bcb293a))
375   ROM_LOAD("elvisf.u21", 0x100000, 0x100000, CRC(5b668b6d) SHA1(9b104af5df5cc21c2504760b119f3e6584a1871b))
376   ROM_LOAD("elvisf.u36", 0x200000, 0x100000, CRC(03ee0c04) SHA1(45a994589e3d9e6fe971db8722848b5f7432b675))
377   ROM_LOAD("elvisf.u37", 0x300000, 0x100000, CRC(aa265440) SHA1(36b13ef0be4203936d9816e521098e72d6b4e4c1))
378ROM_END
379ROM_START(elvisf302)
380   ROM_REGION(0x80000, "user1", 0)
381   ROM_LOAD( "elvscpuf.302",  0x0000, 0x20000, CRC(893a5ac6) SHA1(4be45cf036cdd643f10ecbb4d0b1778d25cf778a))
382   ROM_RELOAD(0x20000, 0x20000)
383   ROM_RELOAD(0x40000, 0x20000)
384   ROM_RELOAD(0x60000, 0x20000)
385   ROM_REGION(0x10000, "maincpu", 0)
386   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
387   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
388   ROM_REGION(0x80000, "gfx3", 0)
389   ROM_LOAD( "elvsdspf.302",  0x0000, 0x80000, CRC(410b6ae5) SHA1(ea29e1c81695df25ad61deedd84e6c3159976797))
390   ROM_REGION32_LE(0x600000, "cpu2", 0)
391   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
392   ROM_RELOAD(0x0,0x20000)
393   ROM_REGION(0x10000, "sound1", 0)
394   ROM_LOAD("elvisf.u7",0x0000,0x10000,CRC(84a057cd) SHA1(70e626f13a164df184dc5b0c79e8d320eeafb13b))
395   ROM_REGION(0x400000, "sound2", 0)
396   ROM_LOAD("elvisf.u17", 0x000000, 0x100000, CRC(9b13e40d) SHA1(7e7eac1be5cbc7bde4296d168a1cc0716bcb293a))
397   ROM_LOAD("elvisf.u21", 0x100000, 0x100000, CRC(5b668b6d) SHA1(9b104af5df5cc21c2504760b119f3e6584a1871b))
398   ROM_LOAD("elvisf.u36", 0x200000, 0x100000, CRC(03ee0c04) SHA1(45a994589e3d9e6fe971db8722848b5f7432b675))
399   ROM_LOAD("elvisf.u37", 0x300000, 0x100000, CRC(aa265440) SHA1(36b13ef0be4203936d9816e521098e72d6b4e4c1))
400ROM_END
164401 
165402ROM_START(elvisi)
166403   ROM_REGION(0x80000, "user1", 0)
r10613r10614
184421   ROM_LOAD("elvisi.u36", 0x200000, 0x100000, CRC(df6772d7) SHA1(96e98ff4e93fc0c6fb2d9924da99b97f0c436c44))
185422   ROM_LOAD("elvisi.u37", 0x300000, 0x100000, CRC(990fd624) SHA1(d5e104485dc8dd7386d8f3e7d99dc6cf7bf91568))
186423ROM_END
424ROM_START(elvisi4)
425   ROM_REGION(0x80000, "user1", 0)
426   ROM_LOAD( "elvscpui.400",  0x0000, 0x20000, CRC(dd2876fc) SHA1(3b860ad176e3fda58be1f165fc2f9965f36259ef))
427   ROM_RELOAD(0x20000, 0x20000)
428   ROM_RELOAD(0x40000, 0x20000)
429   ROM_RELOAD(0x60000, 0x20000)
430   ROM_REGION(0x10000, "maincpu", 0)
431   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
432   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
433   ROM_REGION(0x80000, "gfx3", 0)
434   ROM_LOAD( "elvsdspi.401",  0x0000, 0x80000, CRC(51f92cec) SHA1(a678dcb29f867b07641f39f5e0a9bf0e5daf9dc3))
435   ROM_REGION32_LE(0x600000, "cpu2", 0)
436   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
437   ROM_RELOAD(0x0,0x20000)
438   ROM_REGION(0x10000, "sound1", 0)
439   ROM_LOAD("elvisi.u7",0x0000,0x10000,CRC(8c270da4) SHA1(6a21332fdd1f2714aa78a1730e0f90159022ad1c))
440   ROM_REGION(0x400000, "sound2", 0)
441   ROM_LOAD("elvisi.u17", 0x000000, 0x100000, CRC(bd2e6580) SHA1(dc8c974860498d5766dbb0881cc9d6866c9a98a1))
442   ROM_LOAD("elvisi.u21", 0x100000, 0x100000, CRC(1932a22b) SHA1(864d6bc2c60e763431fd19511dc1a946cf131d63))
443   ROM_LOAD("elvisi.u36", 0x200000, 0x100000, CRC(df6772d7) SHA1(96e98ff4e93fc0c6fb2d9924da99b97f0c436c44))
444   ROM_LOAD("elvisi.u37", 0x300000, 0x100000, CRC(990fd624) SHA1(d5e104485dc8dd7386d8f3e7d99dc6cf7bf91568))
445ROM_END
446ROM_START(elvisi303)
447   ROM_REGION(0x80000, "user1", 0)
448   ROM_LOAD( "elvscpui.303",  0x0000, 0x20000, CRC(11f47b7a) SHA1(4fbe64ed49719408b77ebf6871bb2211e03de394))
449   ROM_RELOAD(0x20000, 0x20000)
450   ROM_RELOAD(0x40000, 0x20000)
451   ROM_RELOAD(0x60000, 0x20000)
452   ROM_REGION(0x10000, "maincpu", 0)
453   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
454   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
455   ROM_REGION(0x80000, "gfx3", 0)
456   ROM_LOAD( "elvsdspi.302",  0x0000, 0x80000, CRC(217c7d17) SHA1(bfd67e876ea85847212c936f9f8477aba8a7b573))
457   ROM_REGION32_LE(0x600000, "cpu2", 0)
458   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
459   ROM_RELOAD(0x0,0x20000)
460   ROM_REGION(0x10000, "sound1", 0)
461   ROM_LOAD("elvisi.u7",0x0000,0x10000,CRC(8c270da4) SHA1(6a21332fdd1f2714aa78a1730e0f90159022ad1c))
462   ROM_REGION(0x400000, "sound2", 0)
463   ROM_LOAD("elvisi.u17", 0x000000, 0x100000, CRC(bd2e6580) SHA1(dc8c974860498d5766dbb0881cc9d6866c9a98a1))
464   ROM_LOAD("elvisi.u21", 0x100000, 0x100000, CRC(1932a22b) SHA1(864d6bc2c60e763431fd19511dc1a946cf131d63))
465   ROM_LOAD("elvisi.u36", 0x200000, 0x100000, CRC(df6772d7) SHA1(96e98ff4e93fc0c6fb2d9924da99b97f0c436c44))
466   ROM_LOAD("elvisi.u37", 0x300000, 0x100000, CRC(990fd624) SHA1(d5e104485dc8dd7386d8f3e7d99dc6cf7bf91568))
467ROM_END
468ROM_START(elvisi302)
469   ROM_REGION(0x80000, "user1", 0)
470   ROM_LOAD( "elvscpui.302",  0x0000, 0x20000, CRC(a2c15460) SHA1(dcd4d4b61745ab2ccba662f9d72f56774a830ea0))
471   ROM_RELOAD(0x20000, 0x20000)
472   ROM_RELOAD(0x40000, 0x20000)
473   ROM_RELOAD(0x60000, 0x20000)
474   ROM_REGION(0x10000, "maincpu", 0)
475   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
476   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
477   ROM_REGION(0x80000, "gfx3", 0)
478   ROM_LOAD( "elvsdspi.302",  0x0000, 0x80000, CRC(217c7d17) SHA1(bfd67e876ea85847212c936f9f8477aba8a7b573))
479   ROM_REGION32_LE(0x600000, "cpu2", 0)
480   ROM_LOAD("bios1a.u8", 0x400000, 0x20000, CRC(e2e3fc18) SHA1(5ce564828c1d814b680788f20ba8b134249ccfb9))
481   ROM_RELOAD(0x0,0x20000)
482   ROM_REGION(0x10000, "sound1", 0)
483   ROM_LOAD("elvisi.u7",0x0000,0x10000,CRC(8c270da4) SHA1(6a21332fdd1f2714aa78a1730e0f90159022ad1c))
484   ROM_REGION(0x400000, "sound2", 0)
485   ROM_LOAD("elvisi.u17", 0x000000, 0x100000, CRC(bd2e6580) SHA1(dc8c974860498d5766dbb0881cc9d6866c9a98a1))
486   ROM_LOAD("elvisi.u21", 0x100000, 0x100000, CRC(1932a22b) SHA1(864d6bc2c60e763431fd19511dc1a946cf131d63))
487   ROM_LOAD("elvisi.u36", 0x200000, 0x100000, CRC(df6772d7) SHA1(96e98ff4e93fc0c6fb2d9924da99b97f0c436c44))
488   ROM_LOAD("elvisi.u37", 0x300000, 0x100000, CRC(990fd624) SHA1(d5e104485dc8dd7386d8f3e7d99dc6cf7bf91568))
489ROM_END
187490 
188491/*-------------------------------------------------------------------
189492/ Grand Prix
r10613r10614
395698ROM_START(ripleys)
396699   ROM_REGION(0x80000, "user1", 0)
397700   ROM_LOAD("ripcpu.320", 0x00000, 0x20000, CRC(aa997826) SHA1(2f9701370e64dd55a9bafe0c65e7eb4b9c5dbdd2))
398   //ROM_LOAD( "ripcpu.300",    0x0000, 0x20000, CRC(8c4bf2a9) SHA1(260dd5a99a36de541b5f852047ae4166afc621cc))
399   //ROM_LOAD( "ripcpu.310",    0x0000, 0x20000, CRC(669f87cc) SHA1(0e07bbcf337bf7c289a9093d3db805da617cbfef))
400   //ROM_LOAD( "ripcpu.302",    0x0000, 0x20000, CRC(ee79d9eb) SHA1(79b45ceac00ebd414a9fb1d97c05252d9f953872))
701   ROM_RELOAD(0x20000, 0x20000)
702   ROM_RELOAD(0x40000, 0x20000)
703   ROM_RELOAD(0x60000, 0x20000)
704   ROM_REGION(0x10000, "maincpu", 0)
705   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
706   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
707   ROM_REGION(0x80000, "gfx3", 0)
708   ROM_LOAD("ripdispa.300", 0x00000, 0x80000, CRC(016907c9) SHA1(d37f1ca5ebe089fca879339cdaffc3fabf09c15c))
709   ROM_REGION32_LE(0x600000, "cpu2", 0)
710   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
711   ROM_RELOAD(0x0,0x200000)
712   ROM_REGION(0x10000, "sound1", 0)
713   ROM_LOAD("ripsnd.u7",0x0000,0x10000,CRC(4573a759) SHA1(189c1a2eaf9d92c40a1bc145f59ac428c74a7318))
714   ROM_REGION(0x400000, "sound2", 0)
715   ROM_LOAD("ripsnd.u17", 0x000000, 0x100000, CRC(d518f2da) SHA1(e7d75c6b7b45571ae6d39ed7405b1457e475b52a))
716   ROM_LOAD("ripsnd.u21", 0x100000, 0x100000, CRC(3d8680d7) SHA1(1368965106094d78be6540eb87a478f853ba774f))
717   ROM_LOAD("ripsnd.u36", 0x200000, 0x100000, CRC(b697b5cb) SHA1(b5cb426201287a6d1c40db8c81a58e2c656d1d81))
718   ROM_LOAD("ripsnd.u37", 0x300000, 0x100000, CRC(01b9f20e) SHA1(cffb6a0136d7d17ab4450b3bfd97632d8b669d39))
719ROM_END
401720 
402//ROM_LOAD( "ripdispf.300",  0x0000, 0x80000, CRC(b9901941) SHA1(653997ff5d63e7ee0270db08cad952ac8293a8cd))
403//ROM_LOAD( "ripsnd.u7",     0x0000, 0x10000, CRC(e5c7edea) SHA1(c0075fb35c746afe54808d4901ddb61ba396f36d))
404//ROM_LOAD( "ripsndf.u7",    0x0000, 0x10000, CRC(00fc94de) SHA1(207ceea5ccd39a99c5b5ed1f945dce3f1fc076d7))
405//ROM_LOAD( "ripsndg.u7",    0x0000, 0x10000, CRC(ff7b6b55) SHA1(e2e0e1f6cfae0fbcb5151bf2cb17fbb52f2d9f23))
406//ROM_LOAD( "ripsndi.u7",    0x0000, 0x10000, CRC(b966a2c1) SHA1(1aa83dc5b87fc16fc4281f577e61eb2661cfad09))
407//ROM_LOAD( "ripsndl.u7",    0x0000, 0x10000, CRC(66bfcb7c) SHA1(8bdfaf01f367de8ccf15da59000ecff5268e0a4f))
408//ROM_LOAD( "ripdispl.300",  0x0000, 0x80000, CRC(d2f496bb) SHA1(48622e25171030b83d8d1736735e97a13c5f47c6))
721ROM_START(rip310)
722   ROM_REGION(0x80000, "user1", 0)
723   ROM_LOAD( "ripcpu.310",    0x0000, 0x20000, CRC(669f87cc) SHA1(0e07bbcf337bf7c289a9093d3db805da617cbfef))
724   ROM_RELOAD(0x20000, 0x20000)
725   ROM_RELOAD(0x40000, 0x20000)
726   ROM_RELOAD(0x60000, 0x20000)
727   ROM_REGION(0x10000, "maincpu", 0)
728   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
729   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
730   ROM_REGION(0x80000, "gfx3", 0)
731   ROM_LOAD("ripdispa.300", 0x00000, 0x80000, CRC(016907c9) SHA1(d37f1ca5ebe089fca879339cdaffc3fabf09c15c))
732   ROM_REGION32_LE(0x600000, "cpu2", 0)
733   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
734   ROM_RELOAD(0x0,0x200000)
735   ROM_REGION(0x10000, "sound1", 0)
736   ROM_LOAD("ripsnd.u7",0x0000,0x10000,CRC(4573a759) SHA1(189c1a2eaf9d92c40a1bc145f59ac428c74a7318))
737   ROM_REGION(0x400000, "sound2", 0)
738   ROM_LOAD("ripsnd.u17", 0x000000, 0x100000, CRC(d518f2da) SHA1(e7d75c6b7b45571ae6d39ed7405b1457e475b52a))
739   ROM_LOAD("ripsnd.u21", 0x100000, 0x100000, CRC(3d8680d7) SHA1(1368965106094d78be6540eb87a478f853ba774f))
740   ROM_LOAD("ripsnd.u36", 0x200000, 0x100000, CRC(b697b5cb) SHA1(b5cb426201287a6d1c40db8c81a58e2c656d1d81))
741   ROM_LOAD("ripsnd.u37", 0x300000, 0x100000, CRC(01b9f20e) SHA1(cffb6a0136d7d17ab4450b3bfd97632d8b669d39))
742ROM_END
409743 
744ROM_START(rip302)
745   ROM_REGION(0x80000, "user1", 0)
746   ROM_LOAD( "ripcpu.302",    0x0000, 0x20000, CRC(ee79d9eb) SHA1(79b45ceac00ebd414a9fb1d97c05252d9f953872))
410747   ROM_RELOAD(0x20000, 0x20000)
411748   ROM_RELOAD(0x40000, 0x20000)
412749   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
427764   ROM_LOAD("ripsnd.u37", 0x300000, 0x100000, CRC(01b9f20e) SHA1(cffb6a0136d7d17ab4450b3bfd97632d8b669d39))
428765ROM_END
429766 
767ROM_START(rip300)
768   ROM_REGION(0x80000, "user1", 0)
769   ROM_LOAD( "ripcpu.300",    0x0000, 0x20000, CRC(8c4bf2a9) SHA1(260dd5a99a36de541b5f852047ae4166afc621cc))
770   ROM_RELOAD(0x20000, 0x20000)
771   ROM_RELOAD(0x40000, 0x20000)
772   ROM_RELOAD(0x60000, 0x20000)
773   ROM_REGION(0x10000, "maincpu", 0)
774   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
775   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
776   ROM_REGION(0x80000, "gfx3", 0)
777   ROM_LOAD("ripdispa.300", 0x00000, 0x80000, CRC(016907c9) SHA1(d37f1ca5ebe089fca879339cdaffc3fabf09c15c))
778   ROM_REGION32_LE(0x600000, "cpu2", 0)
779   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
780   ROM_RELOAD(0x0,0x200000)
781   ROM_REGION(0x10000, "sound1", 0)
782   ROM_LOAD( "ripsnd-30.u7",  0x0000, 0x10000, CRC(e5c7edea) SHA1(c0075fb35c746afe54808d4901ddb61ba396f36d))
783   ROM_REGION(0x400000, "sound2", 0)
784   ROM_LOAD("ripsnd.u17", 0x000000, 0x100000, CRC(d518f2da) SHA1(e7d75c6b7b45571ae6d39ed7405b1457e475b52a))
785   ROM_LOAD("ripsnd.u21", 0x100000, 0x100000, CRC(3d8680d7) SHA1(1368965106094d78be6540eb87a478f853ba774f))
786   ROM_LOAD("ripsnd.u36", 0x200000, 0x100000, CRC(b697b5cb) SHA1(b5cb426201287a6d1c40db8c81a58e2c656d1d81))
787   ROM_LOAD("ripsnd.u37", 0x300000, 0x100000, CRC(01b9f20e) SHA1(cffb6a0136d7d17ab4450b3bfd97632d8b669d39))
788ROM_END
430789ROM_START(ripleysf)
431790   ROM_REGION(0x80000, "user1", 0)
432791   ROM_LOAD("ripcpu.320", 0x00000, 0x20000, CRC(aa997826) SHA1(2f9701370e64dd55a9bafe0c65e7eb4b9c5dbdd2))
r10613r10614
449808   ROM_LOAD("ripsndf.u36", 0x200000, 0x100000, CRC(0a57f2fd) SHA1(9dd057888294ee8abeb582e8f6650fd6e32cc9ff))
450809   ROM_LOAD("ripsndf.u37", 0x300000, 0x100000, CRC(5c858958) SHA1(f4a9833b8aee033ed381e3bdf9f801b935d6186a))
451810ROM_END
811ROM_START(ripf310)
812   ROM_REGION(0x80000, "user1", 0)
813   ROM_LOAD( "ripcpu.310",    0x0000, 0x20000, CRC(669f87cc) SHA1(0e07bbcf337bf7c289a9093d3db805da617cbfef))
814   ROM_RELOAD(0x20000, 0x20000)
815   ROM_RELOAD(0x40000, 0x20000)
816   ROM_RELOAD(0x60000, 0x20000)
817   ROM_REGION(0x10000, "maincpu", 0)
818   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
819   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
820   ROM_REGION(0x80000, "gfx3", 0)
821   ROM_LOAD("ripdispf.301", 0x00000, 0x80000, CRC(e5ae9d99) SHA1(74929b324b457d08a925c641430e6a7036c7039d))
822   ROM_REGION32_LE(0x600000, "cpu2", 0)
823   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
824   ROM_RELOAD(0x0,0x200000)
825   ROM_REGION(0x10000, "sound1", 0)
826   ROM_LOAD("ripsndf.u7",0x0000,0x10000,CRC(5808e3fc) SHA1(0c83399e8dc846607c469b7dd95878f3c2b9cb82))
827   ROM_REGION(0x400000, "sound2", 0)
828   ROM_LOAD("ripsndf.u17", 0x000000, 0x100000, CRC(a6793b85) SHA1(96058777346be6e9ea7b1340d9aaf945ac3c853a))
829   ROM_LOAD("ripsndf.u21", 0x100000, 0x100000, CRC(60c02170) SHA1(900d9de3ccb541019e5f1528e01c57ad96dac262))
830   ROM_LOAD("ripsndf.u36", 0x200000, 0x100000, CRC(0a57f2fd) SHA1(9dd057888294ee8abeb582e8f6650fd6e32cc9ff))
831   ROM_LOAD("ripsndf.u37", 0x300000, 0x100000, CRC(5c858958) SHA1(f4a9833b8aee033ed381e3bdf9f801b935d6186a))
832ROM_END
833ROM_START(ripf302)
834   ROM_REGION(0x80000, "user1", 0)
835   ROM_LOAD( "ripcpu.302",    0x0000, 0x20000, CRC(ee79d9eb) SHA1(79b45ceac00ebd414a9fb1d97c05252d9f953872))
836   ROM_RELOAD(0x20000, 0x20000)
837   ROM_RELOAD(0x40000, 0x20000)
838   ROM_RELOAD(0x60000, 0x20000)
839   ROM_REGION(0x10000, "maincpu", 0)
840   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
841   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
842   ROM_REGION(0x80000, "gfx3", 0)
843   ROM_LOAD("ripdispf.301", 0x00000, 0x80000, CRC(e5ae9d99) SHA1(74929b324b457d08a925c641430e6a7036c7039d))
844   ROM_REGION32_LE(0x600000, "cpu2", 0)
845   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
846   ROM_RELOAD(0x0,0x200000)
847   ROM_REGION(0x10000, "sound1", 0)
848   ROM_LOAD("ripsndf.u7",0x0000,0x10000,CRC(5808e3fc) SHA1(0c83399e8dc846607c469b7dd95878f3c2b9cb82))
849   ROM_REGION(0x400000, "sound2", 0)
850   ROM_LOAD("ripsndf.u17", 0x000000, 0x100000, CRC(a6793b85) SHA1(96058777346be6e9ea7b1340d9aaf945ac3c853a))
851   ROM_LOAD("ripsndf.u21", 0x100000, 0x100000, CRC(60c02170) SHA1(900d9de3ccb541019e5f1528e01c57ad96dac262))
852   ROM_LOAD("ripsndf.u36", 0x200000, 0x100000, CRC(0a57f2fd) SHA1(9dd057888294ee8abeb582e8f6650fd6e32cc9ff))
853   ROM_LOAD("ripsndf.u37", 0x300000, 0x100000, CRC(5c858958) SHA1(f4a9833b8aee033ed381e3bdf9f801b935d6186a))
854ROM_END
855ROM_START(ripf300)
856   ROM_REGION(0x80000, "user1", 0)
857   ROM_LOAD( "ripcpu.300",    0x0000, 0x20000, CRC(8c4bf2a9) SHA1(260dd5a99a36de541b5f852047ae4166afc621cc))
858   ROM_RELOAD(0x20000, 0x20000)
859   ROM_RELOAD(0x40000, 0x20000)
860   ROM_RELOAD(0x60000, 0x20000)
861   ROM_REGION(0x10000, "maincpu", 0)
862   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
863   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
864   ROM_REGION(0x80000, "gfx3", 0)
865   ROM_LOAD( "ripdispf.300",  0x0000, 0x80000, CRC(b9901941) SHA1(653997ff5d63e7ee0270db08cad952ac8293a8cd))
866   ROM_REGION32_LE(0x600000, "cpu2", 0)
867   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
868   ROM_RELOAD(0x0,0x200000)
869   ROM_REGION(0x10000, "sound1", 0)
870   ROM_LOAD( "ripsndf-30.u7",    0x0000, 0x10000, CRC(00fc94de) SHA1(207ceea5ccd39a99c5b5ed1f945dce3f1fc076d7))
871   ROM_REGION(0x400000, "sound2", 0)
872   ROM_LOAD("ripsndf.u17", 0x000000, 0x100000, CRC(a6793b85) SHA1(96058777346be6e9ea7b1340d9aaf945ac3c853a))
873   ROM_LOAD("ripsndf.u21", 0x100000, 0x100000, CRC(60c02170) SHA1(900d9de3ccb541019e5f1528e01c57ad96dac262))
874   ROM_LOAD("ripsndf.u36", 0x200000, 0x100000, CRC(0a57f2fd) SHA1(9dd057888294ee8abeb582e8f6650fd6e32cc9ff))
875   ROM_LOAD("ripsndf.u37", 0x300000, 0x100000, CRC(5c858958) SHA1(f4a9833b8aee033ed381e3bdf9f801b935d6186a))
876ROM_END
452877 
453878ROM_START(ripleysg)
454879   ROM_REGION(0x80000, "user1", 0)
r10613r10614
473898   ROM_LOAD("ripsndg.u37", 0x300000, 0x100000, CRC(2167617b) SHA1(62b55a39e2677eec9d56b10e8cc3e5d7c0d3bea5))
474899ROM_END
475900 
901ROM_START(ripg310)
902   ROM_REGION(0x80000, "user1", 0)
903   ROM_LOAD( "ripcpu.310",    0x0000, 0x20000, CRC(669f87cc) SHA1(0e07bbcf337bf7c289a9093d3db805da617cbfef))
904   ROM_RELOAD(0x20000, 0x20000)
905   ROM_RELOAD(0x40000, 0x20000)
906   ROM_RELOAD(0x60000, 0x20000)
907   ROM_REGION(0x10000, "maincpu", 0)
908   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
909   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
910   ROM_REGION(0x80000, "gfx3", 0)
911   ROM_LOAD("ripdispg.300", 0x00000, 0x80000, CRC(1a75883b) SHA1(0ef2f4af72e435e5be9d3d8a6b69c66ae18271a1))
912   ROM_REGION32_LE(0x600000, "cpu2", 0)
913   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
914   ROM_RELOAD(0x0,0x200000)
915   ROM_REGION(0x10000, "sound1", 0)
916   ROM_LOAD("ripsndg.u7",0x0000,0x10000,CRC(400b8a45) SHA1(62101995e632264df3c014b746cc4b2ae72676d4))
917   ROM_REGION(0x400000, "sound2", 0)
918   ROM_LOAD("ripsndg.u17", 0x000000, 0x100000, CRC(c387dcf0) SHA1(d4ef65d3f33ab82b63bf2782f335858ab4ad210a))
919   ROM_LOAD("ripsndg.u21", 0x100000, 0x100000, CRC(6388ae8d) SHA1(a39c7977194daabf3f5b10d0269dcd4118a939bc))
920   ROM_LOAD("ripsndg.u36", 0x200000, 0x100000, CRC(3143f9d3) SHA1(bd4ce64b245b5fcb9b9694bd8f71a9cd98303cae))
921   ROM_LOAD("ripsndg.u37", 0x300000, 0x100000, CRC(2167617b) SHA1(62b55a39e2677eec9d56b10e8cc3e5d7c0d3bea5))
922ROM_END
923 
924ROM_START(ripg302)
925   ROM_REGION(0x80000, "user1", 0)
926   ROM_LOAD( "ripcpu.302",    0x0000, 0x20000, CRC(ee79d9eb) SHA1(79b45ceac00ebd414a9fb1d97c05252d9f953872))
927   ROM_RELOAD(0x20000, 0x20000)
928   ROM_RELOAD(0x40000, 0x20000)
929   ROM_RELOAD(0x60000, 0x20000)
930   ROM_REGION(0x10000, "maincpu", 0)
931   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
932   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
933   ROM_REGION(0x80000, "gfx3", 0)
934   ROM_LOAD("ripdispg.300", 0x00000, 0x80000, CRC(1a75883b) SHA1(0ef2f4af72e435e5be9d3d8a6b69c66ae18271a1))
935   ROM_REGION32_LE(0x600000, "cpu2", 0)
936   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
937   ROM_RELOAD(0x0,0x200000)
938   ROM_REGION(0x10000, "sound1", 0)
939   ROM_LOAD("ripsndg.u7",0x0000,0x10000,CRC(400b8a45) SHA1(62101995e632264df3c014b746cc4b2ae72676d4))
940   ROM_REGION(0x400000, "sound2", 0)
941   ROM_LOAD("ripsndg.u17", 0x000000, 0x100000, CRC(c387dcf0) SHA1(d4ef65d3f33ab82b63bf2782f335858ab4ad210a))
942   ROM_LOAD("ripsndg.u21", 0x100000, 0x100000, CRC(6388ae8d) SHA1(a39c7977194daabf3f5b10d0269dcd4118a939bc))
943   ROM_LOAD("ripsndg.u36", 0x200000, 0x100000, CRC(3143f9d3) SHA1(bd4ce64b245b5fcb9b9694bd8f71a9cd98303cae))
944   ROM_LOAD("ripsndg.u37", 0x300000, 0x100000, CRC(2167617b) SHA1(62b55a39e2677eec9d56b10e8cc3e5d7c0d3bea5))
945ROM_END
946 
947ROM_START(ripg300)
948   ROM_REGION(0x80000, "user1", 0)
949   ROM_LOAD( "ripcpu.300",    0x0000, 0x20000, CRC(8c4bf2a9) SHA1(260dd5a99a36de541b5f852047ae4166afc621cc))
950   ROM_RELOAD(0x20000, 0x20000)
951   ROM_RELOAD(0x40000, 0x20000)
952   ROM_RELOAD(0x60000, 0x20000)
953   ROM_REGION(0x10000, "maincpu", 0)
954   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
955   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
956   ROM_REGION(0x80000, "gfx3", 0)
957   ROM_LOAD("ripdispg.300", 0x00000, 0x80000, CRC(1a75883b) SHA1(0ef2f4af72e435e5be9d3d8a6b69c66ae18271a1))
958   ROM_REGION32_LE(0x600000, "cpu2", 0)
959   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
960   ROM_RELOAD(0x0,0x200000)
961   ROM_REGION(0x10000, "sound1", 0)
962   ROM_LOAD( "ripsndg-30.u7",    0x0000, 0x10000, CRC(ff7b6b55) SHA1(e2e0e1f6cfae0fbcb5151bf2cb17fbb52f2d9f23))
963   ROM_REGION(0x400000, "sound2", 0)
964   ROM_LOAD("ripsndg.u17", 0x000000, 0x100000, CRC(c387dcf0) SHA1(d4ef65d3f33ab82b63bf2782f335858ab4ad210a))
965   ROM_LOAD("ripsndg.u21", 0x100000, 0x100000, CRC(6388ae8d) SHA1(a39c7977194daabf3f5b10d0269dcd4118a939bc))
966   ROM_LOAD("ripsndg.u36", 0x200000, 0x100000, CRC(3143f9d3) SHA1(bd4ce64b245b5fcb9b9694bd8f71a9cd98303cae))
967   ROM_LOAD("ripsndg.u37", 0x300000, 0x100000, CRC(2167617b) SHA1(62b55a39e2677eec9d56b10e8cc3e5d7c0d3bea5))
968ROM_END
969 
476970ROM_START(ripleysi)
477971   ROM_REGION(0x80000, "user1", 0)
478972   ROM_LOAD("ripcpu.320", 0x00000, 0x20000, CRC(aa997826) SHA1(2f9701370e64dd55a9bafe0c65e7eb4b9c5dbdd2))
r10613r10614
495989   ROM_LOAD("ripsndi.u36", 0x200000, 0x100000, CRC(6a124fa6) SHA1(752c3d227b9a98dd859e4778ddd527edaa3cf512))
496990   ROM_LOAD("ripsndi.u37", 0x300000, 0x100000, CRC(7933c102) SHA1(f736ee86d7c67dab82c634d125d73a2453249706))
497991ROM_END
992ROM_START(ripi310)
993   ROM_REGION(0x80000, "user1", 0)
994   ROM_LOAD( "ripcpu.310",    0x0000, 0x20000, CRC(669f87cc) SHA1(0e07bbcf337bf7c289a9093d3db805da617cbfef))
995   ROM_RELOAD(0x20000, 0x20000)
996   ROM_RELOAD(0x40000, 0x20000)
997   ROM_RELOAD(0x60000, 0x20000)
998   ROM_REGION(0x10000, "maincpu", 0)
999   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1000   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1001   ROM_REGION(0x80000, "gfx3", 0)
1002   ROM_LOAD("ripdispi.300", 0x00000, 0x80000, CRC(c3541c04) SHA1(26256e8dee77bcfa96326d2e3f67b6fd3696c0c7))
1003   ROM_REGION32_LE(0x600000, "cpu2", 0)
1004   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1005   ROM_RELOAD(0x0,0x200000)
1006   ROM_REGION(0x10000, "sound1", 0)
1007   ROM_LOAD("ripsndi.u7",0x0000,0x10000,CRC(86b1b2b2) SHA1(9e2cf7368b31531998d546a1be2af274a9cbbd2f))
1008   ROM_REGION(0x400000, "sound2", 0)
1009   ROM_LOAD("ripsndi.u17", 0x000000, 0x100000, CRC(a2911df4) SHA1(acb7956a6a30142c8da905b04778a074cb335807))
1010   ROM_LOAD("ripsndi.u21", 0x100000, 0x100000, CRC(1467eaff) SHA1(c6c4ea2abdad4334efbe3a084693e9e4d0dd0fd2))
1011   ROM_LOAD("ripsndi.u36", 0x200000, 0x100000, CRC(6a124fa6) SHA1(752c3d227b9a98dd859e4778ddd527edaa3cf512))
1012   ROM_LOAD("ripsndi.u37", 0x300000, 0x100000, CRC(7933c102) SHA1(f736ee86d7c67dab82c634d125d73a2453249706))
1013ROM_END
1014ROM_START(ripi302)
1015   ROM_REGION(0x80000, "user1", 0)
1016   ROM_LOAD( "ripcpu.302",    0x0000, 0x20000, CRC(ee79d9eb) SHA1(79b45ceac00ebd414a9fb1d97c05252d9f953872))
1017   ROM_RELOAD(0x20000, 0x20000)
1018   ROM_RELOAD(0x40000, 0x20000)
1019   ROM_RELOAD(0x60000, 0x20000)
1020   ROM_REGION(0x10000, "maincpu", 0)
1021   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1022   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1023   ROM_REGION(0x80000, "gfx3", 0)
1024   ROM_LOAD("ripdispi.300", 0x00000, 0x80000, CRC(c3541c04) SHA1(26256e8dee77bcfa96326d2e3f67b6fd3696c0c7))
1025   ROM_REGION32_LE(0x600000, "cpu2", 0)
1026   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1027   ROM_RELOAD(0x0,0x200000)
1028   ROM_REGION(0x10000, "sound1", 0)
1029   ROM_LOAD("ripsndi.u7",0x0000,0x10000,CRC(86b1b2b2) SHA1(9e2cf7368b31531998d546a1be2af274a9cbbd2f))
1030   ROM_REGION(0x400000, "sound2", 0)
1031   ROM_LOAD("ripsndi.u17", 0x000000, 0x100000, CRC(a2911df4) SHA1(acb7956a6a30142c8da905b04778a074cb335807))
1032   ROM_LOAD("ripsndi.u21", 0x100000, 0x100000, CRC(1467eaff) SHA1(c6c4ea2abdad4334efbe3a084693e9e4d0dd0fd2))
1033   ROM_LOAD("ripsndi.u36", 0x200000, 0x100000, CRC(6a124fa6) SHA1(752c3d227b9a98dd859e4778ddd527edaa3cf512))
1034   ROM_LOAD("ripsndi.u37", 0x300000, 0x100000, CRC(7933c102) SHA1(f736ee86d7c67dab82c634d125d73a2453249706))
1035ROM_END
1036ROM_START(ripi300)
1037   ROM_REGION(0x80000, "user1", 0)
1038   ROM_LOAD( "ripcpu.300",    0x0000, 0x20000, CRC(8c4bf2a9) SHA1(260dd5a99a36de541b5f852047ae4166afc621cc))
1039   ROM_RELOAD(0x20000, 0x20000)
1040   ROM_RELOAD(0x40000, 0x20000)
1041   ROM_RELOAD(0x60000, 0x20000)
1042   ROM_REGION(0x10000, "maincpu", 0)
1043   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1044   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1045   ROM_REGION(0x80000, "gfx3", 0)
1046   ROM_LOAD("ripdispi.300", 0x00000, 0x80000, CRC(c3541c04) SHA1(26256e8dee77bcfa96326d2e3f67b6fd3696c0c7))
1047   ROM_REGION32_LE(0x600000, "cpu2", 0)
1048   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1049   ROM_RELOAD(0x0,0x200000)
1050   ROM_REGION(0x10000, "sound1", 0)
1051   ROM_LOAD( "ripsndi-30.u7",    0x0000, 0x10000, CRC(b966a2c1) SHA1(1aa83dc5b87fc16fc4281f577e61eb2661cfad09))
1052   ROM_REGION(0x400000, "sound2", 0)
1053   ROM_LOAD("ripsndi.u17", 0x000000, 0x100000, CRC(a2911df4) SHA1(acb7956a6a30142c8da905b04778a074cb335807))
1054   ROM_LOAD("ripsndi.u21", 0x100000, 0x100000, CRC(1467eaff) SHA1(c6c4ea2abdad4334efbe3a084693e9e4d0dd0fd2))
1055   ROM_LOAD("ripsndi.u36", 0x200000, 0x100000, CRC(6a124fa6) SHA1(752c3d227b9a98dd859e4778ddd527edaa3cf512))
1056   ROM_LOAD("ripsndi.u37", 0x300000, 0x100000, CRC(7933c102) SHA1(f736ee86d7c67dab82c634d125d73a2453249706))
1057ROM_END
4981058 
4991059ROM_START(ripleysl)
5001060   ROM_REGION(0x80000, "user1", 0)
r10613r10614
5181078   ROM_LOAD("ripsndl.u36", 0x200000, 0x100000, CRC(c5461b63) SHA1(fc574d44ad88ce1db590ea371225092c03fc6f80))
5191079   ROM_LOAD("ripsndl.u37", 0x300000, 0x100000, CRC(2a58f491) SHA1(1c33f419420b3165ef18598560007ef612b24814))
5201080ROM_END
1081ROM_START(ripl310)
1082   ROM_REGION(0x80000, "user1", 0)
1083   ROM_LOAD( "ripcpu.310",    0x0000, 0x20000, CRC(669f87cc) SHA1(0e07bbcf337bf7c289a9093d3db805da617cbfef))
1084   ROM_RELOAD(0x20000, 0x20000)
1085   ROM_RELOAD(0x40000, 0x20000)
1086   ROM_RELOAD(0x60000, 0x20000)
1087   ROM_REGION(0x10000, "maincpu", 0)
1088   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1089   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1090   ROM_REGION(0x80000, "gfx3", 0)
1091   ROM_LOAD("ripdispl.301", 0x00000, 0x80000, CRC(47c87ad4) SHA1(eb372b9f17b28d0781c49a28cb850916ccec323d))
1092   ROM_REGION32_LE(0x600000, "cpu2", 0)
1093   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1094   ROM_RELOAD(0x0,0x200000)
1095   ROM_REGION(0x10000, "sound1", 0)
1096   ROM_LOAD("ripsndl.u7",0x0000,0x10000,CRC(25fb729a) SHA1(46b9ca8fd5fb5a692adbdb7495af34a1db89dc37))
1097   ROM_REGION(0x400000, "sound2", 0)
1098   ROM_LOAD("ripsndl.u17", 0x000000, 0x100000, CRC(a98f4514) SHA1(e87ee8f5a87a8ae9ec996473bf9bc745105ea334))
1099   ROM_LOAD("ripsndl.u21", 0x100000, 0x100000, CRC(141f2b77) SHA1(15bab623beda8ae7ed9908f492ff2baab0a7954e))
1100   ROM_LOAD("ripsndl.u36", 0x200000, 0x100000, CRC(c5461b63) SHA1(fc574d44ad88ce1db590ea371225092c03fc6f80))
1101   ROM_LOAD("ripsndl.u37", 0x300000, 0x100000, CRC(2a58f491) SHA1(1c33f419420b3165ef18598560007ef612b24814))
1102ROM_END
1103ROM_START(ripl302)
1104   ROM_REGION(0x80000, "user1", 0)
1105   ROM_LOAD( "ripcpu.302",    0x0000, 0x20000, CRC(ee79d9eb) SHA1(79b45ceac00ebd414a9fb1d97c05252d9f953872))
1106   ROM_RELOAD(0x20000, 0x20000)
1107   ROM_RELOAD(0x40000, 0x20000)
1108   ROM_RELOAD(0x60000, 0x20000)
1109   ROM_REGION(0x10000, "maincpu", 0)
1110   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1111   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1112   ROM_REGION(0x80000, "gfx3", 0)
1113   ROM_LOAD("ripdispl.301", 0x00000, 0x80000, CRC(47c87ad4) SHA1(eb372b9f17b28d0781c49a28cb850916ccec323d))
1114   ROM_REGION32_LE(0x600000, "cpu2", 0)
1115   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1116   ROM_RELOAD(0x0,0x200000)
1117   ROM_REGION(0x10000, "sound1", 0)
1118   ROM_LOAD("ripsndl.u7",0x0000,0x10000,CRC(25fb729a) SHA1(46b9ca8fd5fb5a692adbdb7495af34a1db89dc37))
1119   ROM_REGION(0x400000, "sound2", 0)
1120   ROM_LOAD("ripsndl.u17", 0x000000, 0x100000, CRC(a98f4514) SHA1(e87ee8f5a87a8ae9ec996473bf9bc745105ea334))
1121   ROM_LOAD("ripsndl.u21", 0x100000, 0x100000, CRC(141f2b77) SHA1(15bab623beda8ae7ed9908f492ff2baab0a7954e))
1122   ROM_LOAD("ripsndl.u36", 0x200000, 0x100000, CRC(c5461b63) SHA1(fc574d44ad88ce1db590ea371225092c03fc6f80))
1123   ROM_LOAD("ripsndl.u37", 0x300000, 0x100000, CRC(2a58f491) SHA1(1c33f419420b3165ef18598560007ef612b24814))
1124ROM_END
1125ROM_START(ripl300)
1126   ROM_REGION(0x80000, "user1", 0)
1127   ROM_LOAD( "ripcpu.300",    0x0000, 0x20000, CRC(8c4bf2a9) SHA1(260dd5a99a36de541b5f852047ae4166afc621cc))
1128   ROM_RELOAD(0x20000, 0x20000)
1129   ROM_RELOAD(0x40000, 0x20000)
1130   ROM_RELOAD(0x60000, 0x20000)
1131   ROM_REGION(0x10000, "maincpu", 0)
1132   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1133   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1134   ROM_REGION(0x80000, "gfx3", 0)
1135   ROM_LOAD( "ripdispl.300",  0x0000, 0x80000, CRC(d2f496bb) SHA1(48622e25171030b83d8d1736735e97a13c5f47c6))
1136   ROM_REGION32_LE(0x600000, "cpu2", 0)
1137   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1138   ROM_RELOAD(0x0,0x200000)
1139   ROM_REGION(0x10000, "sound1", 0)
1140   ROM_LOAD( "ripsndl-30.u7",    0x0000, 0x10000, CRC(66bfcb7c) SHA1(8bdfaf01f367de8ccf15da59000ecff5268e0a4f))
1141   ROM_REGION(0x400000, "sound2", 0)
1142   ROM_LOAD("ripsndl.u17", 0x000000, 0x100000, CRC(a98f4514) SHA1(e87ee8f5a87a8ae9ec996473bf9bc745105ea334))
1143   ROM_LOAD("ripsndl.u21", 0x100000, 0x100000, CRC(141f2b77) SHA1(15bab623beda8ae7ed9908f492ff2baab0a7954e))
1144   ROM_LOAD("ripsndl.u36", 0x200000, 0x100000, CRC(c5461b63) SHA1(fc574d44ad88ce1db590ea371225092c03fc6f80))
1145   ROM_LOAD("ripsndl.u37", 0x300000, 0x100000, CRC(2a58f491) SHA1(1c33f419420b3165ef18598560007ef612b24814))
1146ROM_END
5211147 
1148 
5221149/*-------------------------------------------------------------------
5231150/ The Lord Of The Rings
5241151/-------------------------------------------------------------------*/
5251152ROM_START(lotr)
5261153   ROM_REGION(0x80000, "user1", 0)
527   ROM_LOAD("lotrcpua.a00", 0x00000, 0x20000, CRC(00e43b70) SHA1(7100da644a1b166051915870d01cfa6baaf87293)) // ver 10.00
528   //ROM_LOAD("lotrcpu.401",   0x0000, 0x20000, CRC(b69cdecc) SHA1(40f7c2d25a1028255be8fe25e3aa6d11976edd25)) // ver 4.01
529   //ROM_LOAD("lotrcpu.700",   0x0000, 0x20000, CRC(208a4653) SHA1(570f3070c6b0f128d451f3dea01e41a9944081f2)) // ver 7.00
530   //ROM_LOAD("lotrcpu.800",   0x0000, 0x20000, CRC(655e5b3c) SHA1(bd6fd25e17cee40d6bb842367b1ce922bbd46003)) // ver 8.00
531   //ROM_LOAD("lotrcpu.900",   0x0000, 0x20000, CRC(eff1ab83) SHA1(cd9cfa3fa150224e44078602db7d8bbfe223b926)) // ver 9.00
1154   ROM_LOAD("lotrcpua.a00", 0x00000, 0x20000, CRC(00e43b70) SHA1(7100da644a1b166051915870d01cfa6baaf87293))
5321155   ROM_RELOAD(0x20000, 0x20000)
5331156   ROM_RELOAD(0x40000, 0x20000)
5341157   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
5371160   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
5381161   ROM_REGION(0x80000, "gfx3", 0)
5391162   ROM_LOAD("lotrdspa.a00", 0x00000, 0x80000, CRC(99634603) SHA1(c40d1480e5df10a491bcd471c6a3a118a9120bcb))
540   //ROM_LOAD( "lotrdspa.403",  0x0000, 0x80000, CRC(2630cef1) SHA1(1dfd929e7eb57983f2fd9184d471f2e919359de0)) // ver 4.03
541   //ROM_LOAD( "lotrdspa.700",  0x0000, 0x80000, CRC(233ef0ad) SHA1(1564ae806639dac49add0c464f4499f46b5589ab)) // ver 7.00
542   //ROM_LOAD( "lotrdspa.800",  0x0000, 0x80000, CRC(2aa1f00d) SHA1(e9df5b61b467c307aacdb5a6980a78af26492e6a)) // ver 8.00
543   //ROM_LOAD( "lotrdspa.900",  0x0000, 0x80000, CRC(2b1debd3) SHA1(eab1ffa7b5111bf224c47688bb6c0f40ee6e12fb)) // ver 9.00
5441163   ROM_REGION32_LE(0x600000, "cpu2", 0)
5451164   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
5461165   ROM_RELOAD(0x0,0x200000)
r10613r10614
5521171   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
5531172   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
5541173ROM_END
1174ROM_START(lotr9)
1175   ROM_REGION(0x80000, "user1", 0)
1176   ROM_LOAD("lotrcpu.900",   0x0000, 0x20000, CRC(eff1ab83) SHA1(cd9cfa3fa150224e44078602db7d8bbfe223b926))
1177   ROM_RELOAD(0x20000, 0x20000)
1178   ROM_RELOAD(0x40000, 0x20000)
1179   ROM_RELOAD(0x60000, 0x20000)
1180   ROM_REGION(0x10000, "maincpu", 0)
1181   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1182   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1183   ROM_REGION(0x80000, "gfx3", 0)
1184   ROM_LOAD( "lotrdspa.900",  0x0000, 0x80000, CRC(2b1debd3) SHA1(eab1ffa7b5111bf224c47688bb6c0f40ee6e12fb))
1185   ROM_REGION32_LE(0x600000, "cpu2", 0)
1186   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1187   ROM_RELOAD(0x0,0x200000)
1188   ROM_REGION(0x10000, "sound1", 0)
1189   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1190   ROM_REGION(0x400000, "sound2", 0)
1191   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1192   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1193   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1194   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1195ROM_END
1196ROM_START(lotr8)
1197   ROM_REGION(0x80000, "user1", 0)
1198   ROM_LOAD("lotrcpu.800",   0x0000, 0x20000, CRC(655e5b3c) SHA1(bd6fd25e17cee40d6bb842367b1ce922bbd46003))
1199   ROM_RELOAD(0x20000, 0x20000)
1200   ROM_RELOAD(0x40000, 0x20000)
1201   ROM_RELOAD(0x60000, 0x20000)
1202   ROM_REGION(0x10000, "maincpu", 0)
1203   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1204   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1205   ROM_REGION(0x80000, "gfx3", 0)
1206   ROM_LOAD( "lotrdspa.800",  0x0000, 0x80000, CRC(2aa1f00d) SHA1(e9df5b61b467c307aacdb5a6980a78af26492e6a))
1207   ROM_REGION32_LE(0x600000, "cpu2", 0)
1208   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1209   ROM_RELOAD(0x0,0x200000)
1210   ROM_REGION(0x10000, "sound1", 0)
1211   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1212   ROM_REGION(0x400000, "sound2", 0)
1213   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1214   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1215   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1216   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1217ROM_END
1218ROM_START(lotr7)
1219   ROM_REGION(0x80000, "user1", 0)
1220   ROM_LOAD("lotrcpu.700",   0x0000, 0x20000, CRC(208a4653) SHA1(570f3070c6b0f128d451f3dea01e41a9944081f2))
1221   ROM_RELOAD(0x20000, 0x20000)
1222   ROM_RELOAD(0x40000, 0x20000)
1223   ROM_RELOAD(0x60000, 0x20000)
1224   ROM_REGION(0x10000, "maincpu", 0)
1225   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1226   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1227   ROM_REGION(0x80000, "gfx3", 0)
1228   ROM_LOAD( "lotrdspa.700",  0x0000, 0x80000, CRC(233ef0ad) SHA1(1564ae806639dac49add0c464f4499f46b5589ab)) // ver 7.00
1229   ROM_REGION32_LE(0x600000, "cpu2", 0)
1230   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1231   ROM_RELOAD(0x0,0x200000)
1232   ROM_REGION(0x10000, "sound1", 0)
1233   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1234   ROM_REGION(0x400000, "sound2", 0)
1235   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1236   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1237   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1238   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1239ROM_END
1240ROM_START(lotr401)
1241   ROM_REGION(0x80000, "user1", 0)
1242   ROM_LOAD("lotrcpu.401",   0x0000, 0x20000, CRC(b69cdecc) SHA1(40f7c2d25a1028255be8fe25e3aa6d11976edd25))
1243   ROM_RELOAD(0x20000, 0x20000)
1244   ROM_RELOAD(0x40000, 0x20000)
1245   ROM_RELOAD(0x60000, 0x20000)
1246   ROM_REGION(0x10000, "maincpu", 0)
1247   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1248   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1249   ROM_REGION(0x80000, "gfx3", 0)
1250   ROM_LOAD( "lotrdspa.403",  0x0000, 0x80000, CRC(2630cef1) SHA1(1dfd929e7eb57983f2fd9184d471f2e919359de0))
1251   ROM_REGION32_LE(0x600000, "cpu2", 0)
1252   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1253   ROM_RELOAD(0x0,0x200000)
1254   ROM_REGION(0x10000, "sound1", 0)
1255   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1256   ROM_REGION(0x400000, "sound2", 0)
1257   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1258   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1259   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1260   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1261ROM_END
5551262 
5561263ROM_START(lotr_sp)
5571264   ROM_REGION(0x80000, "user1", 0)
5581265   ROM_LOAD("lotrcpul.a00", 0x00000, 0x20000, CRC(c62aba47) SHA1(2fef599313e5cd9bded3ab00b933631586e2a1e7))
559   //ROM_LOAD( "lotrcpul.401",  0x0000, 0x20000, CRC(a9571728) SHA1(f21dd77003f42fafd9293fab3a077c5abf6d572a)) // ver 4.01
560   //ROM_LOAD( "lotrcpul.700",  0x0000, 0x20000, CRC(58d8611b) SHA1(ff1e1668993c7c31f04efc22f04ae53112219a1d)) // ver 7.00
561   //ROM_LOAD( "lotrcpul.800",  0x0000, 0x20000, CRC(38e83068) SHA1(603b1236bf195c72d32e5a1088a2806e77176436)) // ver 8.00
562   //ROM_LOAD( "lotrcpul.900",  0x0000, 0x20000, CRC(155b5d5b) SHA1(c032e3828ed256240a5155ec4c7820d615a2cbe1)) // ver 9.00
5631266   ROM_RELOAD(0x20000, 0x20000)
5641267   ROM_RELOAD(0x40000, 0x20000)
5651268   ROM_RELOAD(0x60000, 0x20000)
r10613r10614
5681271   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
5691272   ROM_REGION(0x80000, "gfx3", 0)
5701273   ROM_LOAD("lotrdspl.a00", 0x00000, 0x80000, CRC(2494a5ee) SHA1(5b95711858d88eeb445503cac8b9b754cf8e9960))
571//ROM_LOAD( "lotrdspl.403",  0x0000, 0x80000, CRC(6d4075c9) SHA1(7944ba597cb476c33060cead4feaf6dcad4f4b16)) // ver 4.03
572//ROM_LOAD( "lotrdspl.700",  0x0000, 0x80000, CRC(3be0283d) SHA1(e019c69cd452b67d6427ddda12b5c3f341afb414)) // ver 7.00
573//ROM_LOAD( "lotrdspl.800",  0x0000, 0x80000, CRC(137c1255) SHA1(43d9ffec18ab2aa80f30b195ca5270d4574d7b8d)) // ver 8.00
574//ROM_LOAD( "lotrdspl.900",  0x0000, 0x80000, CRC(00f98242) SHA1(9a0e7e572e209b20691392a694a524192daa0d2a)) // ver 9.00
5751274   ROM_REGION32_LE(0x600000, "cpu2", 0)
5761275   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
5771276   ROM_RELOAD(0x0,0x200000)
r10613r10614
5831282   ROM_LOAD("lotrlu36.100", 0x200000, 0x100000, CRC(502c3d93) SHA1(4ee42d70bccb9253fe1f8f441de6b5018257f107))
5841283   ROM_LOAD("lotrlu37.100", 0x300000, 0x100000, CRC(61f21c6d) SHA1(3e9781b4981bd18cdb8c59c55b9942de6ae286db))
5851284ROM_END
1285ROM_START(lotr_sp9)
1286   ROM_REGION(0x80000, "user1", 0)
1287   ROM_LOAD( "lotrcpul.900",  0x0000, 0x20000, CRC(155b5d5b) SHA1(c032e3828ed256240a5155ec4c7820d615a2cbe1))
1288   ROM_RELOAD(0x20000, 0x20000)
1289   ROM_RELOAD(0x40000, 0x20000)
1290   ROM_RELOAD(0x60000, 0x20000)
1291   ROM_REGION(0x10000, "maincpu", 0)
1292   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1293   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1294   ROM_REGION(0x80000, "gfx3", 0)
1295   ROM_LOAD( "lotrdspl.900",  0x0000, 0x80000, CRC(00f98242) SHA1(9a0e7e572e209b20691392a694a524192daa0d2a))
1296   ROM_REGION32_LE(0x600000, "cpu2", 0)
1297   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1298   ROM_RELOAD(0x0,0x200000)
1299   ROM_REGION(0x10000, "sound1", 0)
1300   ROM_LOAD("lotrlu7.100",0x0000,0x10000,CRC(980d970a) SHA1(cf70deddcc146ef9eaa64baec74ae800bebf8715))
1301   ROM_REGION(0x400000, "sound2", 0)
1302   ROM_LOAD("lotrlu17.100", 0x000000, 0x100000, CRC(c16d3e20) SHA1(43d9f186db361abb3aa119a7252f1bb13bbbbe39))
1303   ROM_LOAD("lotrlu21.100", 0x100000, 0x100000, CRC(f956a1be) SHA1(2980e85463704a154ed81d3241f866442d1ea2e6))
1304   ROM_LOAD("lotrlu36.100", 0x200000, 0x100000, CRC(502c3d93) SHA1(4ee42d70bccb9253fe1f8f441de6b5018257f107))
1305   ROM_LOAD("lotrlu37.100", 0x300000, 0x100000, CRC(61f21c6d) SHA1(3e9781b4981bd18cdb8c59c55b9942de6ae286db))
1306ROM_END
5861307 
1308ROM_START(lotr_sp8)
1309   ROM_REGION(0x80000, "user1", 0)
1310   ROM_LOAD( "lotrcpul.800",  0x0000, 0x20000, CRC(38e83068) SHA1(603b1236bf195c72d32e5a1088a2806e77176436))
1311   ROM_RELOAD(0x20000, 0x20000)
1312   ROM_RELOAD(0x40000, 0x20000)
1313   ROM_RELOAD(0x60000, 0x20000)
1314   ROM_REGION(0x10000, "maincpu", 0)
1315   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1316   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1317   ROM_REGION(0x80000, "gfx3", 0)
1318   ROM_LOAD( "lotrdspl.800",  0x0000, 0x80000, CRC(137c1255) SHA1(43d9ffec18ab2aa80f30b195ca5270d4574d7b8d))
1319   ROM_REGION32_LE(0x600000, "cpu2", 0)
1320   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1321   ROM_RELOAD(0x0,0x200000)
1322   ROM_REGION(0x10000, "sound1", 0)
1323   ROM_LOAD("lotrlu7.100",0x0000,0x10000,CRC(980d970a) SHA1(cf70deddcc146ef9eaa64baec74ae800bebf8715))
1324   ROM_REGION(0x400000, "sound2", 0)
1325   ROM_LOAD("lotrlu17.100", 0x000000, 0x100000, CRC(c16d3e20) SHA1(43d9f186db361abb3aa119a7252f1bb13bbbbe39))
1326   ROM_LOAD("lotrlu21.100", 0x100000, 0x100000, CRC(f956a1be) SHA1(2980e85463704a154ed81d3241f866442d1ea2e6))
1327   ROM_LOAD("lotrlu36.100", 0x200000, 0x100000, CRC(502c3d93) SHA1(4ee42d70bccb9253fe1f8f441de6b5018257f107))
1328   ROM_LOAD("lotrlu37.100", 0x300000, 0x100000, CRC(61f21c6d) SHA1(3e9781b4981bd18cdb8c59c55b9942de6ae286db))
1329ROM_END
1330ROM_START(lotr_sp7)
1331   ROM_REGION(0x80000, "user1", 0)
1332   ROM_LOAD( "lotrcpul.700",  0x0000, 0x20000, CRC(58d8611b) SHA1(ff1e1668993c7c31f04efc22f04ae53112219a1d))
1333   ROM_RELOAD(0x20000, 0x20000)
1334   ROM_RELOAD(0x40000, 0x20000)
1335   ROM_RELOAD(0x60000, 0x20000)
1336   ROM_REGION(0x10000, "maincpu", 0)
1337   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1338   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1339   ROM_REGION(0x80000, "gfx3", 0)
1340   ROM_LOAD( "lotrdspl.700",  0x0000, 0x80000, CRC(3be0283d) SHA1(e019c69cd452b67d6427ddda12b5c3f341afb414))
1341   ROM_REGION32_LE(0x600000, "cpu2", 0)
1342   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1343   ROM_RELOAD(0x0,0x200000)
1344   ROM_REGION(0x10000, "sound1", 0)
1345   ROM_LOAD("lotrlu7.100",0x0000,0x10000,CRC(980d970a) SHA1(cf70deddcc146ef9eaa64baec74ae800bebf8715))
1346   ROM_REGION(0x400000, "sound2", 0)
1347   ROM_LOAD("lotrlu17.100", 0x000000, 0x100000, CRC(c16d3e20) SHA1(43d9f186db361abb3aa119a7252f1bb13bbbbe39))
1348   ROM_LOAD("lotrlu21.100", 0x100000, 0x100000, CRC(f956a1be) SHA1(2980e85463704a154ed81d3241f866442d1ea2e6))
1349   ROM_LOAD("lotrlu36.100", 0x200000, 0x100000, CRC(502c3d93) SHA1(4ee42d70bccb9253fe1f8f441de6b5018257f107))
1350   ROM_LOAD("lotrlu37.100", 0x300000, 0x100000, CRC(61f21c6d) SHA1(3e9781b4981bd18cdb8c59c55b9942de6ae286db))
1351ROM_END
1352ROM_START(lotr_sp401)
1353   ROM_REGION(0x80000, "user1", 0)
1354   ROM_LOAD( "lotrcpul.401",  0x0000, 0x20000, CRC(a9571728) SHA1(f21dd77003f42fafd9293fab3a077c5abf6d572a))
1355   ROM_RELOAD(0x20000, 0x20000)
1356   ROM_RELOAD(0x40000, 0x20000)
1357   ROM_RELOAD(0x60000, 0x20000)
1358   ROM_REGION(0x10000, "maincpu", 0)
1359   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1360   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1361   ROM_REGION(0x80000, "gfx3", 0)
1362   ROM_LOAD( "lotrdspl.403",  0x0000, 0x80000, CRC(6d4075c9) SHA1(7944ba597cb476c33060cead4feaf6dcad4f4b16))
1363   ROM_REGION32_LE(0x600000, "cpu2", 0)
1364   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1365   ROM_RELOAD(0x0,0x200000)
1366   ROM_REGION(0x10000, "sound1", 0)
1367   ROM_LOAD("lotrlu7.100",0x0000,0x10000,CRC(980d970a) SHA1(cf70deddcc146ef9eaa64baec74ae800bebf8715))
1368   ROM_REGION(0x400000, "sound2", 0)
1369   ROM_LOAD("lotrlu17.100", 0x000000, 0x100000, CRC(c16d3e20) SHA1(43d9f186db361abb3aa119a7252f1bb13bbbbe39))
1370   ROM_LOAD("lotrlu21.100", 0x100000, 0x100000, CRC(f956a1be) SHA1(2980e85463704a154ed81d3241f866442d1ea2e6))
1371   ROM_LOAD("lotrlu36.100", 0x200000, 0x100000, CRC(502c3d93) SHA1(4ee42d70bccb9253fe1f8f441de6b5018257f107))
1372   ROM_LOAD("lotrlu37.100", 0x300000, 0x100000, CRC(61f21c6d) SHA1(3e9781b4981bd18cdb8c59c55b9942de6ae286db))
1373ROM_END
1374 
1375 
5871376ROM_START(lotr_gr)
5881377   ROM_REGION(0x80000, "user1", 0)
5891378   ROM_LOAD("lotrcpua.a00", 0x00000, 0x20000, CRC(00e43b70) SHA1(7100da644a1b166051915870d01cfa6baaf87293))
r10613r10614
5951384   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
5961385   ROM_REGION(0x80000, "gfx3", 0)
5971386   ROM_LOAD("lotrdspg.a00", 0x00000, 0x80000, CRC(6743a910) SHA1(977773515f00af3937aa59426917e8111ec855ab))
598//ROM_LOAD( "lotrdspg.403",  0x0000, 0x80000, CRC(74e925cb) SHA1(2edc8666d53f212a053b7a356d2bf6e3180d7bfb)) // ver 4.03
599//ROM_LOAD( "lotrdspg.700",  0x0000, 0x80000, CRC(137f223c) SHA1(bb06a6f587bf86555aea85bc1c0402e2137e1c76)) // ver 7.00
600//ROM_LOAD( "lotrdspg.800",  0x0000, 0x80000, CRC(55765c23) SHA1(690a72e8cb1099a6873eb3214e72bb0fea54fa22)) // ver 8.00
601//ROM_LOAD( "lotrdspg.900",  0x0000, 0x80000, CRC(f5fdd2c2) SHA1(0c5f1b1efe3d38063e2327e2ccfe40936f3988b8)) // ver 9.00
6021387   ROM_REGION32_LE(0x600000, "cpu2", 0)
6031388   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
6041389   ROM_RELOAD(0x0,0x200000)
r10613r10614
6101395   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
6111396   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
6121397ROM_END
1398ROM_START(lotr_gr9)
1399   ROM_REGION(0x80000, "user1", 0)
1400   ROM_LOAD("lotrcpu.900",   0x0000, 0x20000, CRC(eff1ab83) SHA1(cd9cfa3fa150224e44078602db7d8bbfe223b926))
1401   ROM_RELOAD(0x20000, 0x20000)
1402   ROM_RELOAD(0x40000, 0x20000)
1403   ROM_RELOAD(0x60000, 0x20000)
1404   ROM_REGION(0x10000, "maincpu", 0)
1405   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1406   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1407   ROM_REGION(0x80000, "gfx3", 0)
1408   ROM_LOAD( "lotrdspg.900",  0x0000, 0x80000, CRC(f5fdd2c2) SHA1(0c5f1b1efe3d38063e2327e2ccfe40936f3988b8))
1409   ROM_REGION32_LE(0x600000, "cpu2", 0)
1410   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1411   ROM_RELOAD(0x0,0x200000)
1412   ROM_REGION(0x10000, "sound1", 0)
1413   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1414   ROM_REGION(0x400000, "sound2", 0)
1415   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1416   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1417   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1418   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1419ROM_END
1420ROM_START(lotr_gr8)
1421   ROM_REGION(0x80000, "user1", 0)
1422   ROM_LOAD("lotrcpu.800",   0x0000, 0x20000, CRC(655e5b3c) SHA1(bd6fd25e17cee40d6bb842367b1ce922bbd46003))
1423   ROM_RELOAD(0x20000, 0x20000)
1424   ROM_RELOAD(0x40000, 0x20000)
1425   ROM_RELOAD(0x60000, 0x20000)
1426   ROM_REGION(0x10000, "maincpu", 0)
1427   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1428   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1429   ROM_REGION(0x80000, "gfx3", 0)
1430   ROM_LOAD( "lotrdspg.800",  0x0000, 0x80000, CRC(55765c23) SHA1(690a72e8cb1099a6873eb3214e72bb0fea54fa22))
1431   ROM_REGION32_LE(0x600000, "cpu2", 0)
1432   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1433   ROM_RELOAD(0x0,0x200000)
1434   ROM_REGION(0x10000, "sound1", 0)
1435   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1436   ROM_REGION(0x400000, "sound2", 0)
1437   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1438   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1439   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1440   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1441ROM_END
1442ROM_START(lotr_gr7)
1443   ROM_REGION(0x80000, "user1", 0)
1444   ROM_LOAD("lotrcpu.700",   0x0000, 0x20000, CRC(208a4653) SHA1(570f3070c6b0f128d451f3dea01e41a9944081f2))
1445   ROM_RELOAD(0x20000, 0x20000)
1446   ROM_RELOAD(0x40000, 0x20000)
1447   ROM_RELOAD(0x60000, 0x20000)
1448   ROM_REGION(0x10000, "maincpu", 0)
1449   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1450   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1451   ROM_REGION(0x80000, "gfx3", 0)
1452   ROM_LOAD( "lotrdspg.700",  0x0000, 0x80000, CRC(137f223c) SHA1(bb06a6f587bf86555aea85bc1c0402e2137e1c76))
1453   ROM_REGION32_LE(0x600000, "cpu2", 0)
1454   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1455   ROM_RELOAD(0x0,0x200000)
1456   ROM_REGION(0x10000, "sound1", 0)
1457   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1458   ROM_REGION(0x400000, "sound2", 0)
1459   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1460   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1461   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1462   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1463ROM_END
1464ROM_START(lotr_gr401)
1465   ROM_REGION(0x80000, "user1", 0)
1466   ROM_LOAD("lotrcpu.401",   0x0000, 0x20000, CRC(b69cdecc) SHA1(40f7c2d25a1028255be8fe25e3aa6d11976edd25))
1467   ROM_RELOAD(0x20000, 0x20000)
1468   ROM_RELOAD(0x40000, 0x20000)
1469   ROM_RELOAD(0x60000, 0x20000)
1470   ROM_REGION(0x10000, "maincpu", 0)
1471   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1472   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1473   ROM_REGION(0x80000, "gfx3", 0)
1474   ROM_LOAD( "lotrdspg.403",  0x0000, 0x80000, CRC(74e925cb) SHA1(2edc8666d53f212a053b7a356d2bf6e3180d7bfb))
1475   ROM_REGION32_LE(0x600000, "cpu2", 0)
1476   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1477   ROM_RELOAD(0x0,0x200000)
1478   ROM_REGION(0x10000, "sound1", 0)
1479   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1480   ROM_REGION(0x400000, "sound2", 0)
1481   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1482   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1483   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1484   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1485ROM_END
6131486 
6141487ROM_START(lotr_fr)
6151488   ROM_REGION(0x80000, "user1", 0)
r10613r10614
6221495   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
6231496   ROM_REGION(0x80000, "gfx3", 0)
6241497   ROM_LOAD("lotrdspf.a00", 0x00000, 0x80000, CRC(15c26c2d) SHA1(c8e4b442d717aa5881f3d92f044c44d29a14126c))
625//ROM_LOAD( "lotrdspf.403",  0x0000, 0x80000, CRC(d02a77cf) SHA1(8cf4312a04ad486714de5c0041cacb1eb475478f)) // ver 4.03
626//ROM_LOAD( "lotrdspf.700",  0x0000, 0x80000, CRC(c98aeb30) SHA1(16b0ae41db8b4083121cc5ebf2706320d554dd08)) // ver 7.00
627//ROM_LOAD( "lotrdspf.800",  0x0000, 0x80000, CRC(e1ccc04b) SHA1(1d5c7ea06f0cb2e1965c968ed01330867aae8e2b)) // ver 8.00
628//ROM_LOAD( "lotrdspf.900",  0x0000, 0x80000, CRC(f2d8296e) SHA1(3eb6e1e6ba299b720816bf165b1e20e02f6c0c1e)) // ver 9.00
6291498   ROM_REGION32_LE(0x600000, "cpu2", 0)
6301499   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
6311500   ROM_RELOAD(0x0,0x200000)
r10613r10614
6371506   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
6381507   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
6391508ROM_END
1509ROM_START(lotr_fr9)
1510   ROM_REGION(0x80000, "user1", 0)
1511   ROM_LOAD("lotrcpu.900",   0x0000, 0x20000, CRC(eff1ab83) SHA1(cd9cfa3fa150224e44078602db7d8bbfe223b926))
1512   ROM_RELOAD(0x20000, 0x20000)
1513   ROM_RELOAD(0x40000, 0x20000)
1514   ROM_RELOAD(0x60000, 0x20000)
1515   ROM_REGION(0x10000, "maincpu", 0)
1516   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1517   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1518   ROM_REGION(0x80000, "gfx3", 0)
1519   ROM_LOAD( "lotrdspf.900",  0x0000, 0x80000, CRC(f2d8296e) SHA1(3eb6e1e6ba299b720816bf165b1e20e02f6c0c1e))
1520   ROM_REGION32_LE(0x600000, "cpu2", 0)
1521   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1522   ROM_RELOAD(0x0,0x200000)
1523   ROM_REGION(0x10000, "sound1", 0)
1524   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1525   ROM_REGION(0x400000, "sound2", 0)
1526   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1527   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1528   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1529   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1530ROM_END
1531ROM_START(lotr_fr8)
1532   ROM_REGION(0x80000, "user1", 0)
1533   ROM_LOAD("lotrcpu.800",   0x0000, 0x20000, CRC(655e5b3c) SHA1(bd6fd25e17cee40d6bb842367b1ce922bbd46003))
1534   ROM_RELOAD(0x20000, 0x20000)
1535   ROM_RELOAD(0x40000, 0x20000)
1536   ROM_RELOAD(0x60000, 0x20000)
1537   ROM_REGION(0x10000, "maincpu", 0)
1538   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1539   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1540   ROM_REGION(0x80000, "gfx3", 0)
1541   ROM_LOAD( "lotrdspf.800",  0x0000, 0x80000, CRC(e1ccc04b) SHA1(1d5c7ea06f0cb2e1965c968ed01330867aae8e2b))
1542   ROM_REGION32_LE(0x600000, "cpu2", 0)
1543   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1544   ROM_RELOAD(0x0,0x200000)
1545   ROM_REGION(0x10000, "sound1", 0)
1546   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1547   ROM_REGION(0x400000, "sound2", 0)
1548   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1549   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1550   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1551   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1552ROM_END
1553ROM_START(lotr_fr7)
1554   ROM_REGION(0x80000, "user1", 0)
1555   ROM_LOAD("lotrcpu.700",   0x0000, 0x20000, CRC(208a4653) SHA1(570f3070c6b0f128d451f3dea01e41a9944081f2))
1556   ROM_RELOAD(0x20000, 0x20000)
1557   ROM_RELOAD(0x40000, 0x20000)
1558   ROM_RELOAD(0x60000, 0x20000)
1559   ROM_REGION(0x10000, "maincpu", 0)
1560   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1561   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1562   ROM_REGION(0x80000, "gfx3", 0)
1563   ROM_LOAD( "lotrdspf.700",  0x0000, 0x80000, CRC(c98aeb30) SHA1(16b0ae41db8b4083121cc5ebf2706320d554dd08))
1564   ROM_REGION32_LE(0x600000, "cpu2", 0)
1565   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1566   ROM_RELOAD(0x0,0x200000)
1567   ROM_REGION(0x10000, "sound1", 0)
1568   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1569   ROM_REGION(0x400000, "sound2", 0)
1570   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1571   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1572   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1573   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1574ROM_END
1575ROM_START(lotr_fr401)
1576   ROM_REGION(0x80000, "user1", 0)
1577   ROM_LOAD("lotrcpu.401",   0x0000, 0x20000, CRC(b69cdecc) SHA1(40f7c2d25a1028255be8fe25e3aa6d11976edd25))
1578   ROM_RELOAD(0x20000, 0x20000)
1579   ROM_RELOAD(0x40000, 0x20000)
1580   ROM_RELOAD(0x60000, 0x20000)
1581   ROM_REGION(0x10000, "maincpu", 0)
1582   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1583   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1584   ROM_REGION(0x80000, "gfx3", 0)
1585   ROM_LOAD( "lotrdspf.403",  0x0000, 0x80000, CRC(d02a77cf) SHA1(8cf4312a04ad486714de5c0041cacb1eb475478f))
1586   ROM_REGION32_LE(0x600000, "cpu2", 0)
1587   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1588   ROM_RELOAD(0x0,0x200000)
1589   ROM_REGION(0x10000, "sound1", 0)
1590   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1591   ROM_REGION(0x400000, "sound2", 0)
1592   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1593   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1594   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1595   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1596ROM_END
6401597 
6411598ROM_START(lotr_it)
6421599   ROM_REGION(0x80000, "user1", 0)
r10613r10614
6491606   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
6501607   ROM_REGION(0x80000, "gfx3", 0)
6511608   ROM_LOAD("lotrdspi.a00", 0x00000, 0x80000, CRC(6c88f395) SHA1(365d5c6908f5861816b73f287194c85d2300635d))
652//ROM_LOAD( "lotrdspi.403",  0x0000, 0x80000, CRC(5922ce10) SHA1(c57f2de4e3344f16056405d71510c0c0b60ef86d)) // ver 4.03
653//ROM_LOAD( "lotrdspi.700",  0x0000, 0x80000, CRC(6a0d2a6d) SHA1(2b3ca8b26d79919b7102c60515972ab142d1cbf1)) // ver 7.00
654//ROM_LOAD( "lotrdspi.800",  0x0000, 0x80000, CRC(b80730d7) SHA1(552c0bfac1c7a6b246829378a30d58769e695f7e)) // ver 8.00
655//ROM_LOAD( "lotrdspi.900",  0x0000, 0x80000, CRC(a09407d7) SHA1(2cdb70ee0bae7f67f4bf12b0dd3e6cf574087e3d)) // ver 9.00
6561609   ROM_REGION32_LE(0x600000, "cpu2", 0)
6571610   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
6581611   ROM_RELOAD(0x0,0x200000)
r10613r10614
6641617   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
6651618   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
6661619ROM_END
1620ROM_START(lotr_it9)
1621   ROM_REGION(0x80000, "user1", 0)
1622   ROM_LOAD("lotrcpu.900",   0x0000, 0x20000, CRC(eff1ab83) SHA1(cd9cfa3fa150224e44078602db7d8bbfe223b926))
1623   ROM_RELOAD(0x20000, 0x20000)
1624   ROM_RELOAD(0x40000, 0x20000)
1625   ROM_RELOAD(0x60000, 0x20000)
1626   ROM_REGION(0x10000, "maincpu", 0)
1627   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1628   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1629   ROM_REGION(0x80000, "gfx3", 0)
1630   ROM_LOAD( "lotrdspi.900",  0x0000, 0x80000, CRC(a09407d7) SHA1(2cdb70ee0bae7f67f4bf12b0dd3e6cf574087e3d))
1631   ROM_REGION32_LE(0x600000, "cpu2", 0)
1632   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1633   ROM_RELOAD(0x0,0x200000)
1634   ROM_REGION(0x10000, "sound1", 0)
1635   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1636   ROM_REGION(0x400000, "sound2", 0)
1637   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1638   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1639   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1640   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1641ROM_END
1642ROM_START(lotr_it8)
1643   ROM_REGION(0x80000, "user1", 0)
1644   ROM_LOAD("lotrcpu.800",   0x0000, 0x20000, CRC(655e5b3c) SHA1(bd6fd25e17cee40d6bb842367b1ce922bbd46003))
1645   ROM_RELOAD(0x20000, 0x20000)
1646   ROM_RELOAD(0x40000, 0x20000)
1647   ROM_RELOAD(0x60000, 0x20000)
1648   ROM_REGION(0x10000, "maincpu", 0)
1649   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1650   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1651   ROM_REGION(0x80000, "gfx3", 0)
1652   ROM_LOAD( "lotrdspi.800",  0x0000, 0x80000, CRC(b80730d7) SHA1(552c0bfac1c7a6b246829378a30d58769e695f7e))
1653   ROM_REGION32_LE(0x600000, "cpu2", 0)
1654   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1655   ROM_RELOAD(0x0,0x200000)
1656   ROM_REGION(0x10000, "sound1", 0)
1657   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1658   ROM_REGION(0x400000, "sound2", 0)
1659   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1660   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1661   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1662   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1663ROM_END
1664ROM_START(lotr_it7)
1665   ROM_REGION(0x80000, "user1", 0)
1666   ROM_LOAD("lotrcpu.700",   0x0000, 0x20000, CRC(208a4653) SHA1(570f3070c6b0f128d451f3dea01e41a9944081f2))
1667   ROM_RELOAD(0x20000, 0x20000)
1668   ROM_RELOAD(0x40000, 0x20000)
1669   ROM_RELOAD(0x60000, 0x20000)
1670   ROM_REGION(0x10000, "maincpu", 0)
1671   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1672   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1673   ROM_REGION(0x80000, "gfx3", 0)
1674   ROM_LOAD( "lotrdspi.700",  0x0000, 0x80000, CRC(6a0d2a6d) SHA1(2b3ca8b26d79919b7102c60515972ab142d1cbf1))
1675   ROM_REGION32_LE(0x600000, "cpu2", 0)
1676   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1677   ROM_RELOAD(0x0,0x200000)
1678   ROM_REGION(0x10000, "sound1", 0)
1679   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1680   ROM_REGION(0x400000, "sound2", 0)
1681   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1682   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1683   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1684   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1685ROM_END
1686ROM_START(lotr_it401)
1687   ROM_REGION(0x80000, "user1", 0)
1688   ROM_LOAD("lotrcpu.401",   0x0000, 0x20000, CRC(b69cdecc) SHA1(40f7c2d25a1028255be8fe25e3aa6d11976edd25))
1689   ROM_RELOAD(0x20000, 0x20000)
1690   ROM_RELOAD(0x40000, 0x20000)
1691   ROM_RELOAD(0x60000, 0x20000)
1692   ROM_REGION(0x10000, "maincpu", 0)
1693   ROM_COPY( "user1", 0x18000, 0x8000, 0x8000)
1694   ROM_REGION(0x10000, "cpu3", ROMREGION_ERASEFF)
1695   ROM_REGION(0x80000, "gfx3", 0)
1696   ROM_LOAD( "lotrdspi.403",  0x0000, 0x80000, CRC(5922ce10) SHA1(c57f2de4e3344f16056405d71510c0c0b60ef86d)) // ver 4.03
1697   ROM_REGION32_LE(0x600000, "cpu2", 0)
1698   ROM_LOAD("bios.u8", 0x400000, 0x200000, CRC(c049bf99) SHA1(89e76760e8010fe642ed4312732de81c8a25f548))
1699   ROM_RELOAD(0x0,0x200000)
1700   ROM_REGION(0x10000, "sound1", 0)
1701   ROM_LOAD("lotr-u7.101",0x0000,0x10000,CRC(ba018c5c) SHA1(67e4b9729f086de5e8d56a6ac29fce1c7082e470))
1702   ROM_REGION(0x400000, "sound2", 0)
1703   ROM_LOAD("lotr-u17.100", 0x000000, 0x100000, CRC(d503969d) SHA1(65a4313ca1b93391260c65fef6f878d264f9c8ab))
1704   ROM_LOAD("lotr-u21.100", 0x100000, 0x100000, CRC(8b3f41af) SHA1(9b2d04144edeb499b4ae68a97c65ccb8ef4d26c0))
1705   ROM_LOAD("lotr-u36.100", 0x200000, 0x100000, CRC(9575981e) SHA1(38083fd923c4a168a94d998ec3c4db42c1e2a2da))
1706   ROM_LOAD("lotr-u37.100", 0x300000, 0x100000, CRC(8e637a6f) SHA1(8087744ce36fc143381d49a312c98cf38b2f9854))
1707ROM_END
6671708 
1709 
6681710ROM_START(lotr_le)
6691711   ROM_REGION(0x80000, "user1", 0)
6701712   ROM_LOAD("lotrcpua.a02", 0x00000, 0x20000, CRC(f732aeb1) SHA1(8c28e91d37525b3e356bddf2cf1be42ea44f3629))
r10613r10614
8541896ROM_END
8551897 
8561898GAME(2004,   elvisp,      0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (5.00)",                  GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
857GAME(2004,   elvisl,      elvisp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (Spain)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
858GAME(2004,   elvisg,      elvisp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (Germany)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
859GAME(2004,   elvisf,      elvisp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (France)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
860GAME(2004,   elvisi,      elvisp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (Italy)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1899GAME(2004,   elvisp4,   elvisp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (4.00)",                  GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1900GAME(2004,   elvisp303,   elvisp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (3.03)",                  GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1901GAME(2004,   elvisp302,   elvisp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (3.02)",                  GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1902GAME(2004,   elvisl,      0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (5.00 Spain)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1903GAME(2004,   elvisl4,   elvisl,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (4.00 Spain)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1904GAME(2004,   elvisl303,   elvisl,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (3.03 Spain)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1905GAME(2004,   elvisl302,   elvisl,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (3.02 Spain)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1906GAME(2004,   elvisg,      0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (5.00 Germany)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1907GAME(2004,   elvisg4,   elvisg,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (4.00 Germany)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1908GAME(2004,   elvisg303,   elvisg,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (3.03 Germany)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1909GAME(2004,   elvisg302,   elvisg,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (3.02 Germany)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1910GAME(2004,   elvisf,      0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (5.00 France)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1911GAME(2004,   elvisf4,   elvisf,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (4.00 France)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1912GAME(2004,   elvisf303,   elvisf,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (3.03 France)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1913GAME(2004,   elvisf302,   elvisf,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (3.02 France)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1914GAME(2004,   elvisi,      0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (5.00 Italy)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1915GAME(2004,   elvisi4,   elvisi,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (4.00 Italy)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1916GAME(2004,   elvisi303,   elvisi,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (3.03 Italy)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1917GAME(2004,   elvisi302,   elvisi,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Elvis (3.02 Italy)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
8611918GAME(2005,   gprix,      0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Grand Prix (4.50)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
8621919GAME(2005,   gprixg,      gprix,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Grand Prix (Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
8631920GAME(2005,   gprixl,      gprix,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Grand Prix (Spain)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
r10613r10614
8661923GAME(2005,   nascar,      0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Nascar (4.50)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
8671924GAME(2005,   nascarl,   nascar,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Nascar (Spain)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
8681925GAME(2004,   ripleys,   0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.20)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
869GAME(2004,   ripleysf,   ripleys,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (France)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
870GAME(2004,   ripleysg,   ripleys,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (Germany)",GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
871GAME(2004,   ripleysi,   ripleys,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (Italy)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
872GAME(2004,   ripleysl,   ripleys,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (Spain)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1926GAME(2004,   rip310,      ripleys,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.10)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1927GAME(2004,   rip302,      ripleys,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.02)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1928GAME(2004,   rip300,      ripleys,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.00)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1929GAME(2004,   ripleysf,   0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.20 France)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1930GAME(2004,   ripf310,   ripleysf,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.10 France)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1931GAME(2004,   ripf302,   ripleysf,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.02 France)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1932GAME(2004,   ripf300,   ripleysf,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.00 France)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1933GAME(2004,   ripleysg,   0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.20 Germany)",GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1934GAME(2004,   ripg310,   ripleysg,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.10 Germany)",GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1935GAME(2004,   ripg302,   ripleysg,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.02 Germany)",GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1936GAME(2004,   ripg300,   ripleysg,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.00 Germany)",GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1937GAME(2004,   ripleysi,   0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.20 Italy)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1938GAME(2004,   ripi310,   ripleysi,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.10 Italy)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1939GAME(2004,   ripi302,   ripleysi,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.02 Italy)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1940GAME(2004,   ripi300,   ripleysi,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.00 Italy)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1941GAME(2004,   ripleysl,   0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.20 Spain)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1942GAME(2004,   ripl310,   ripleysl,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.10 Spain)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1943GAME(2004,   ripl302,   ripleysl,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.02 Spain)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1944GAME(2004,   ripl300,   ripleysl,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Ripley's Believe It or Not! (3.00 Spain)",   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
8731945GAME(2003,   lotr,      0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (10.00)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
8741946GAME(2003,   lotr_le,   lotr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (10.02 Limited Edition)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
875GAME(2003,   lotr_sp,   lotr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (Spain)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
876GAME(2003,   lotr_gr,   lotr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (Germany)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
877GAME(2003,   lotr_fr,   lotr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (France)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
878GAME(2003,   lotr_it,   lotr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (Italy)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1947GAME(2003,   lotr9,      lotr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (9.00)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1948GAME(2003,   lotr8,      lotr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (8.00)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1949GAME(2003,   lotr7,      lotr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (7.00)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1950GAME(2003,   lotr401,   lotr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (4.01)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1951GAME(2003,   lotr_sp,   0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (10.00 Spain)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1952GAME(2003,   lotr_sp9,   lotr_sp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (9.0 Spain)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1953GAME(2003,   lotr_sp8,   lotr_sp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (8.0 Spain)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1954GAME(2003,   lotr_sp7,   lotr_sp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (7.0 Spain)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1955GAME(2003,   lotr_sp401,   lotr_sp,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (4.01 Spain)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1956GAME(2003,   lotr_gr,   0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (10.00 Germany)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1957GAME(2003,   lotr_gr9,   lotr_gr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (9.0 Germany)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1958GAME(2003,   lotr_gr8,   lotr_gr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (8.0 Germany)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1959GAME(2003,   lotr_gr7,   lotr_gr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (7.0 Germany)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1960GAME(2003,   lotr_gr401,   lotr_gr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (4.01 Germany)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1961GAME(2003,   lotr_fr,   0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (10.00 France)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1962GAME(2003,   lotr_fr9,   lotr_fr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (9.0 France)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1963GAME(2003,   lotr_fr8,   lotr_fr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (8.0 France)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1964GAME(2003,   lotr_fr7,   lotr_fr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (7.0 France)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1965GAME(2003,   lotr_fr401,   lotr_fr,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (4.01 France)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1966GAME(2003,   lotr_it,   0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (10.00 Italy)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1967GAME(2003,   lotr_it9,   lotr_it,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (9.0 Italy)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1968GAME(2003,   lotr_it8,   lotr_it,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (8.0 Italy)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1969GAME(2003,   lotr_it7,   lotr_it,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (7.0 Italy)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1970GAME(2003,   lotr_it401,   lotr_it,      whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Lord Of The Rings, The (4.01 Italy)",      GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
8791971GAME(2005,   sopranos,   0,         whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Sopranos, The (5.00)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
8801972GAME(2005,   soprano3,   sopranos,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Sopranos, The (3.00)",               GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
8811973GAME(2005,   sopranog,   sopranos,   whitestar_mod,   whitestar_mod,   whitestar_mod,   ROT0,   "Stern",   "Sopranos, The (Germany)",            GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
src/mame/drivers/pingpong.c
r10613r10614
1111#include "machine/nvram.h"
1212#include "includes/pingpong.h"
1313
14static int intenable;
1514
16static int question_addr_high = 0;
1715
1816static WRITE8_HANDLER( cashquiz_question_bank_high_w )
1917{
18   pingpong_state *state = space->machine->driver_data<pingpong_state>();
2019   if( data != 0xff )
2120   {
2221      switch( ~data & 0xff )
2322      {
2423      case 0x01:
25         question_addr_high = 0;
24         state->question_addr_high = 0;
2625         break;
2726      case 0x02:
28         question_addr_high = 0x8000;
27         state->question_addr_high = 0x8000;
2928         break;
3029      case 0x04:
31         question_addr_high = 0x10000;
30         state->question_addr_high = 0x10000;
3231         break;
3332      case 0x08:
34         question_addr_high = 0x18000;
33         state->question_addr_high = 0x18000;
3534         break;
3635      case 0x10:
37         question_addr_high = 0x20000;
36         state->question_addr_high = 0x20000;
3837         break;
3938      case 0x20:
40         question_addr_high = 0x28000;
39         state->question_addr_high = 0x28000;
4140         break;
4241      case 0x40:
43         question_addr_high = 0x30000;
42         state->question_addr_high = 0x30000;
4443         break;
4544      case 0x80:
46         question_addr_high = 0x38000;
45         state->question_addr_high = 0x38000;
4746         break;
4847      }
4948   }
r10613r10614
5150
5251static WRITE8_HANDLER( cashquiz_question_bank_low_w )
5352{
53   pingpong_state *state = space->machine->driver_data<pingpong_state>();
5454   if(data >= 0x60 && data <= 0xdf)
5555   {
5656      static const char * const bankname[] = { "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7", "bank8" };
5757      const char *bank = bankname[data & 7];
58      int bankaddr = question_addr_high | ((data - 0x60) * 0x100);
58      int bankaddr = state->question_addr_high | ((data - 0x60) * 0x100);
5959      UINT8 *questions = space->machine->region("user1")->base() + bankaddr;
6060      memory_set_bankptr(space->machine, bank,questions);
6161
r10613r10614
6565
6666static WRITE8_HANDLER( coin_w )
6767{
68   pingpong_state *state = space->machine->driver_data<pingpong_state>();
6869   /* bit 2 = irq enable, bit 3 = nmi enable */
69   intenable = data & 0x0c;
70   state->intenable = data & 0x0c;
7071
7172   /* bit 0/1 = coin counters */
7273   coin_counter_w(space->machine, 0,data & 1);
r10613r10614
7778
7879static INTERRUPT_GEN( pingpong_interrupt )
7980{
81   pingpong_state *state = device->machine->driver_data<pingpong_state>();
8082   if (cpu_getiloops(device) == 0)
8183   {
82      if (intenable & 0x04) cpu_set_input_line(device, 0, HOLD_LINE);
84      if (state->intenable & 0x04) cpu_set_input_line(device, 0, HOLD_LINE);
8385   }
8486   else if (cpu_getiloops(device) % 2)
8587   {
86      if (intenable & 0x08) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
88      if (state->intenable & 0x08) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
8789   }
8890}
8991
9092static ADDRESS_MAP_START( pingpong_map, ADDRESS_SPACE_PROGRAM, 8 )
9193   AM_RANGE(0x0000, 0x7fff) AM_ROM
92   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pingpong_colorram_w) AM_BASE(&pingpong_colorram)
93   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pingpong_videoram_w) AM_BASE(&pingpong_videoram)
94   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pingpong_colorram_w) AM_BASE_MEMBER(pingpong_state, colorram)
95   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pingpong_videoram_w) AM_BASE_MEMBER(pingpong_state, videoram)
9496   AM_RANGE(0x9000, 0x9002) AM_RAM
9597   AM_RANGE(0x9003, 0x9052) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
9698   AM_RANGE(0x9053, 0x97ff) AM_RAM
r10613r10614
110112   AM_RANGE(0x5400, 0x57ff) AM_RAM
111113   AM_RANGE(0x6000, 0x6007) AM_WRITENOP /* solenoid writes */
112114   AM_RANGE(0x7000, 0x7000) AM_READ_PORT("IN4")
113   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pingpong_colorram_w) AM_BASE(&pingpong_colorram)
114   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pingpong_videoram_w) AM_BASE(&pingpong_videoram)
115   AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pingpong_colorram_w) AM_BASE_MEMBER(pingpong_state, colorram)
116   AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pingpong_videoram_w) AM_BASE_MEMBER(pingpong_state, videoram)
115117   AM_RANGE(0x9000, 0x9002) AM_RAM
116118   AM_RANGE(0x9003, 0x9052) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
117119   AM_RANGE(0x9053, 0x97ff) AM_RAM
r10613r10614
449451
450452
451453
452static MACHINE_CONFIG_START( pingpong, driver_device )
454static MACHINE_CONFIG_START( pingpong, pingpong_state )
453455
454456   /* basic machine hardware */
455457   MCFG_CPU_ADD("maincpu",Z80,18432000/6)      /* 3.072 MHz (probably) */
src/mame/drivers/srmp2.c
r10613r10614
334334static WRITE8_HANDLER( iox_command_w )
335335{
336336   /*
337   bit wise command port apparently
338   0x01: selects both sides
339   0x02: selects p1 side
340   0x04: selects p2 side
341   */
337    bit wise command port apparently
338    0x01: selects both sides
339    0x02: selects p1 side
340    0x04: selects p2 side
341    */
342342
343343   iox_mux = data;
344344   iox_ff = 0; // this also set flip flop back to 0
r10613r10614
15421542
15431543
15441544
1545GAME( 1987, srmp1,     0,        srmp2,    srmp2,    0,       ROT0, "Seta",              "Super Real Mahjong Part 1 (Japan)",  0 )
1546GAME( 1987, srmp2,     0,        srmp2,    srmp2,    0,       ROT0, "Seta",              "Super Real Mahjong Part 2 (Japan)",  0 )
1547GAME( 1988, srmp3,     0,        srmp3,    srmp3,    0,       ROT0, "Seta",              "Super Real Mahjong Part 3 (Japan)",  0 )
1545GAME( 1987, srmp1,     0,        srmp2,    srmp2,    0,       ROT0, "Seta",             "Super Real Mahjong Part 1 (Japan)",  0 )
1546GAME( 1987, srmp2,     0,        srmp2,    srmp2,    0,       ROT0, "Seta",             "Super Real Mahjong Part 2 (Japan)",  0 )
1547GAME( 1988, srmp3,     0,        srmp3,    srmp3,    0,       ROT0, "Seta",             "Super Real Mahjong Part 3 (Japan)",  0 )
15481548GAME( 1988, rmgoldyh,  srmp3,    rmgoldyh, rmgoldyh, 0,       ROT0, "Seta (Alba license)",   "Real Mahjong Gold Yumehai / Super Real Mahjong GOLD part.2 [BET] (Japan)",  0 )
1549GAME( 1990, mjyuugi,   0,        mjyuugi,  mjyuugi,  0,       ROT0, "Visco",             "Mahjong Yuugi (Japan set 1)",        0 )
1550GAME( 1990, mjyuugia,  mjyuugi,  mjyuugi,  mjyuugi,  0,       ROT0, "Visco",             "Mahjong Yuugi (Japan set 2)",        0 )
1551GAME( 1991, ponchin,   0,        mjyuugi,  ponchin,  0,       ROT0, "Visco",             "Mahjong Pon Chin Kan (Japan set 1)", 0 )
1552GAME( 1991, ponchina,  ponchin,  mjyuugi,  ponchin,  0,       ROT0, "Visco",             "Mahjong Pon Chin Kan (Japan set 2)", 0 )
1549GAME( 1990, mjyuugi,   0,        mjyuugi,  mjyuugi,  0,       ROT0, "Visco",            "Mahjong Yuugi (Japan set 1)",        0 )
1550GAME( 1990, mjyuugia,  mjyuugi,  mjyuugi,  mjyuugi,  0,       ROT0, "Visco",            "Mahjong Yuugi (Japan set 2)",        0 )
1551GAME( 1991, ponchin,   0,        mjyuugi,  ponchin,  0,       ROT0, "Visco",            "Mahjong Pon Chin Kan (Japan set 1)", 0 )
1552GAME( 1991, ponchina,  ponchin,  mjyuugi,  ponchin,  0,       ROT0, "Visco",            "Mahjong Pon Chin Kan (Japan set 2)", 0 )
15531553
15541554
src/mame/drivers/ksys573.c
r10613r10614
28812881
28822882      if( s[ 0 ] != 0 )
28832883      {
2884//         popmessage( "%s", s );
2884//          popmessage( "%s", s );
28852885      }
28862886
28872887      break;
r10613r10614
46724672   ROM_LOAD( "gq918eaa.u1",  0x000000, 0x000224, CRC(f3342ff5) SHA1(d3d6ecc22396f74b99ad7aab7908cd542c518977) )
46734673
46744674   ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */
4675   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
4675   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
46764676   ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */
4677   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
4677   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
46784678
46794679   ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */
46804680   ROM_LOAD( "gq918eaa.u6",  0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) )
r10613r10614
46904690   ROM_LOAD( "gq918aaa.u1",  0x000000, 0x000224, CRC(1a2c5d53) SHA1(ab7e44a83e8cd271e2bf8580881a3050d35641df) )
46914691
46924692   ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */
4693   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
4693   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
46944694   ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */
4695   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
4695   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
46964696
46974697   ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */
46984698   ROM_LOAD( "gq918aaa.u6",  0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) )
r10613r10614
47084708   ROM_LOAD( "gq918kaa.u1",  0x000000, 0x000224, CRC(cf32990b) SHA1(bf49b8560f008696b45a3f7f03fa7b3395635b0f) )
47094709
47104710   ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */
4711   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
4711   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
47124712   ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */
4713   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
4713   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
47144714
47154715   ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */
47164716   ROM_LOAD( "gq918kaa.u6",  0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) )
r10613r10614
47264726   ROM_LOAD( "gq918uaa.u1",  0x000000, 0x000224, CRC(e1b7e9ef) SHA1(5767f47cb9a689601fb92c6a494563c5ffdde04c) )
47274727
47284728   ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */
4729   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
4729   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
47304730   ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */
4731   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
4731   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
47324732
47334733   ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */
47344734   ROM_LOAD( "gq918uaa.u6",  0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) )
r10613r10614
52165216   ROM_LOAD( "gq918jaa.u1",  0x000000, 0x000224, BAD_DUMP CRC(e4769787) SHA1(d60c6598c7c58b5cd8f86350ebf7f3f32c1ebe9b) )
52175217
52185218   ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */
5219   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
5219   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
52205220   ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */
5221   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
5221   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
52225222
52235223   ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */
52245224   ROM_LOAD( "gq918jaa.u6",  0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) )
r10613r10614
52315231   SYS573_BIOS_A
52325232
52335233   ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */
5234   ROM_LOAD( "gq918jab.u1",  0x000000, 0x000224, BAD_DUMP CRC(e4769787) SHA1(d60c6598c7c58b5cd8f86350ebf7f3f32c1ebe9b) )
5234   ROM_LOAD( "gq918jab.u1",  0x000000, 0x000224, BAD_DUMP CRC(e4769787) SHA1(d60c6598c7c58b5cd8f86350ebf7f3f32c1ebe9b) )
52355235
52365236   ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */
5237   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
5237   ROM_LOAD( "gq918xxb.31m", 0x000000, 0x200000, CRC(3653b5d7) SHA1(1deb44335b7a38506fb30da40e0ca61b96aea7bb) )
52385238   ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */
5239   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
5239   ROM_LOAD( "gq918xxb.27m", 0x000000, 0x200000, CRC(27d48c97) SHA1(c140d4bdfa869fbcae1133bbfe73a346e6f46cb8) )
52405240
52415241   ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */
52425242   ROM_LOAD( "gq918jab.u6",  0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) )
r10613r10614
52495249   SYS573_BIOS_A
52505250
52515251   ROM_REGION( 0x0000224, "install_eeprom", 0 ) /* security cart eeprom */
5252   ROM_LOAD( "gqa09ja.u1",   0x000000, 0x000224, BAD_DUMP CRC(e1e4108f) SHA1(0605e2c7a7dcb2f4928350e96d2ffcc2ede4a762) )
5252   ROM_LOAD( "gqa09ja.u1",   0x000000, 0x000224, BAD_DUMP CRC(e1e4108f) SHA1(0605e2c7a7dcb2f4928350e96d2ffcc2ede4a762) )
52535253
52545254   ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */
5255   ROM_LOAD( "gqa09ja.31m",  0x000000, 0x200000, CRC(b1043a91) SHA1(b474439c1a7da7855d9b6d2162d4a522f499d6ab) )
5255   ROM_LOAD( "gqa09ja.31m",  0x000000, 0x200000, CRC(b1043a91) SHA1(b474439c1a7da7855d9b6d2162d4a522f499d6ab) )
52565256   ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */
5257   ROM_LOAD( "gqa09ja.27m",  0x000000, 0x200000, CRC(09b1a70b) SHA1(0f3bcad879e05faaf8130133d774a2071031ee74) )
5257   ROM_LOAD( "gqa09ja.27m",  0x000000, 0x200000, CRC(09b1a70b) SHA1(0f3bcad879e05faaf8130133d774a2071031ee74) )
52585258
52595259   ROM_REGION( 0x000008, "install_id", 0 ) /* security cart id */
52605260   ROM_LOAD( "gqa09ja.u6",   0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) )
src/mame/drivers/mcr68.c
r10613r10614
996996   MCFG_PALETTE_LENGTH(4096)
997997
998998   MCFG_VIDEO_START(zwackery)
999   
999
10001000   /* sound hardware */
10011001   MCFG_FRAGMENT_ADD(chip_squeak_deluxe)
10021002MACHINE_CONFIG_END
src/mame/drivers/nbmj8900.c
r10613r10614
316316
317317
318318
319static MACHINE_CONFIG_START( ohpaipee, driver_device )
319static MACHINE_CONFIG_START( ohpaipee, nbmj8900_state )
320320
321321   /* basic machine hardware */
322322   MCFG_CPU_ADD("maincpu", Z80, 20000000/4)   /* 5.00 MHz ? */
src/mame/drivers/atarifb.c
r10613r10614
622622   MCFG_SCREEN_MODIFY("screen")
623623   MCFG_SCREEN_VISIBLE_AREA(0*8, 38*8-1, 2*8, 32*8-1)
624624   MCFG_SCREEN_UPDATE(soccer)
625   MCFG_GFXDECODE(soccer)   
625   MCFG_GFXDECODE(soccer)
626626MACHINE_CONFIG_END
627627
628628
src/mame/drivers/playch10.c
r10613r10614
306306
307307/******************************************************************************/
308308
309/* local stuff */
310static UINT8 *ram_8w, *work_ram;
311static int up_8w;
312309
313310static WRITE8_HANDLER( up8w_w )
314311{
315   up_8w = data & 1;
312   playch10_state *state = space->machine->driver_data<playch10_state>();
313   state->up_8w = data & 1;
316314}
317315
318316static READ8_HANDLER( ram_8w_r )
319317{
320   if ( offset >= 0x400 && up_8w )
321      return ram_8w[offset];
318   playch10_state *state = space->machine->driver_data<playch10_state>();
319   if ( offset >= 0x400 && state->up_8w )
320      return state->ram_8w[offset];
322321
323   return ram_8w[offset & 0x3ff];
322   return state->ram_8w[offset & 0x3ff];
324323}
325324
326325static WRITE8_HANDLER( ram_8w_w )
327326{
328   if ( offset >= 0x400 && up_8w )
329      ram_8w[offset] = data;
327   playch10_state *state = space->machine->driver_data<playch10_state>();
328   if ( offset >= 0x400 && state->up_8w )
329      state->ram_8w[offset] = data;
330330   else
331      ram_8w[offset & 0x3ff] = data;
331      state->ram_8w[offset & 0x3ff] = data;
332332}
333333
334334static WRITE8_HANDLER( sprite_dma_w )
r10613r10614
338338}
339339
340340/* Only used in single monitor bios */
341static UINT8 *timedata;
342341
343342static WRITE8_HANDLER( time_w )
344343{
344   playch10_state *state = space->machine->driver_data<playch10_state>();
345345   if(data == 0xf)
346346      data = 0;
347347
348   timedata[offset] = data;
348   state->timedata[offset] = data;
349349
350   popmessage("Time: %d%d%d%d",timedata[3],timedata[2],timedata[1],timedata[0]);
350   popmessage("Time: %d%d%d%d",state->timedata[3],state->timedata[2],state->timedata[1],state->timedata[0]);
351351}
352352
353353static READ8_DEVICE_HANDLER( psg_4015_r )
r10613r10614
371371static ADDRESS_MAP_START( bios_map, ADDRESS_SPACE_PROGRAM, 8 )
372372   AM_RANGE(0x0000, 0x3fff) AM_ROM
373373   AM_RANGE(0x8000, 0x87ff) AM_RAM   // 8V
374   AM_RANGE(0x8800, 0x8fff) AM_READWRITE(ram_8w_r, ram_8w_w) AM_BASE(&ram_8w)   // 8W
374   AM_RANGE(0x8800, 0x8fff) AM_READWRITE(ram_8w_r, ram_8w_w) AM_BASE_MEMBER(playch10_state, ram_8w)   // 8W
375375   AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(playch10_videoram_w) AM_BASE_MEMBER(playch10_state, videoram)
376376   AM_RANGE(0xc000, 0xdfff) AM_ROM
377377   AM_RANGE(0xe000, 0xffff) AM_READWRITE(pc10_prot_r, pc10_prot_w)
r10613r10614
391391   AM_RANGE(0x0a, 0x0a) AM_WRITE(pc10_PPURES_w)
392392   AM_RANGE(0x0b, 0x0e) AM_WRITE(pc10_CARTSEL_w)
393393   AM_RANGE(0x0f, 0x0f) AM_WRITE(up8w_w)
394   AM_RANGE(0x10, 0x13) AM_WRITE(time_w) AM_BASE(&timedata)
394   AM_RANGE(0x10, 0x13) AM_WRITE(time_w) AM_BASE_MEMBER(playch10_state, timedata)
395395ADDRESS_MAP_END
396396
397397static ADDRESS_MAP_START( cart_map, ADDRESS_SPACE_PROGRAM, 8 )
398   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_MIRROR(0x1800) AM_BASE(&work_ram)
398   AM_RANGE(0x0000, 0x07ff) AM_RAM AM_MIRROR(0x1800) AM_BASE_MEMBER(playch10_state, work_ram)
399399   AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE("ppu", ppu2c0x_r, ppu2c0x_w)
400400   AM_RANGE(0x4011, 0x4011) AM_DEVWRITE("dac", dac_w)
401401   AM_RANGE(0x4000, 0x4013) AM_DEVREADWRITE("nes", nes_psg_r, nes_psg_w)
r10613r10614
657657GFXDECODE_END
658658
659659static INTERRUPT_GEN( playch10_interrupt ) {
660   playch10_state *state = device->machine->driver_data<playch10_state>();
660661
661662   /* LS161A, Sheet 1 - bottom left of Z80 */
662   if ( !pc10_dog_di && !pc10_nmi_enable ) {
663   if ( !state->pc10_dog_di && !state->pc10_nmi_enable ) {
663664      cpu_set_input_line(device, INPUT_LINE_RESET, PULSE_LINE );
664665   }
665666
666   else if ( pc10_nmi_enable )
667   else if ( state->pc10_nmi_enable )
667668      cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
668669}
669670
src/mame/drivers/upscope.c
r10613r10614
3737      : amiga_state(machine, config) { }
3838
3939   UINT8   m_nvram[0x100];
40   UINT8 prev_cia1_porta;
41   UINT8 parallel_data;
42   UINT8 nvram_address_latch;
43   UINT8 nvram_data_latch;
4044};
4145
4246
r10613r10614
5256
5357/*************************************
5458 *
55 *  Globals
56 *
57 *************************************/
58
59static UINT8 prev_cia1_porta;
60static UINT8 parallel_data;
61static UINT8 nvram_address_latch;
62static UINT8 nvram_data_latch;
63
64
65
66/*************************************
67 *
6859 *  Reset state
6960 *
7061 *************************************/
7162
7263static void upscope_reset(running_machine *machine)
7364{
74   prev_cia1_porta = 0xff;
65   upscope_state *state = machine->driver_data<upscope_state>();
66   state->prev_cia1_porta = 0xff;
7567}
7668
7769
r10613r10614
125117
126118static WRITE8_DEVICE_HANDLER( upscope_cia_0_portb_w )
127119{
128   parallel_data = data;
120   upscope_state *state = device->machine->driver_data<upscope_state>();
121   state->parallel_data = data;
129122}
130123
131124static READ8_DEVICE_HANDLER( upscope_cia_0_portb_r )
132125{
133   return nvram_data_latch;
126   upscope_state *state = device->machine->driver_data<upscope_state>();
127   return state->nvram_data_latch;
134128}
135129
136130
r10613r10614
152146
153147static READ8_DEVICE_HANDLER( upscope_cia_1_porta_r )
154148{
155   return 0xf8 | (prev_cia1_porta & 0x07);
149   upscope_state *state = device->machine->driver_data<upscope_state>();
150   return 0xf8 | (state->prev_cia1_porta & 0x07);
156151}
157152
158153static WRITE8_DEVICE_HANDLER( upscope_cia_1_porta_w )
159154{
155   upscope_state *state = device->machine->driver_data<upscope_state>();
160156   /* on a low transition of POUT, we latch stuff for the NVRAM */
161   if ((prev_cia1_porta & 2) && !(data & 2))
157   if ((state->prev_cia1_porta & 2) && !(data & 2))
162158   {
163159      /* if SEL == 1 && BUSY == 0, we latch an address */
164160      if ((data & 5) == 4)
165161      {
166         if (LOG_IO) logerror("Latch address: %02X\n", parallel_data);
167         nvram_address_latch = parallel_data;
162         if (LOG_IO) logerror("Latch address: %02X\n", state->parallel_data);
163         state->nvram_address_latch = state->parallel_data;
168164      }
169165
170166      /* if SEL == 1 && BUSY == 1, we write data to internal registers */
171167      else if ((data & 5) == 5)
172168      {
173         switch (nvram_address_latch)
169         switch (state->nvram_address_latch)
174170         {
175171            case 0x01:
176172               /* lamps:
r10613r10614
195191               break;
196192
197193            default:
198               logerror("Internal register (%d) = %02X\n", nvram_address_latch, parallel_data);
194               logerror("Internal register (%d) = %02X\n", state->nvram_address_latch, state->parallel_data);
199195               break;
200196         }
201197      }
r10613r10614
203199      /* if SEL == 0 && BUSY == 1, we write data to NVRAM */
204200      else if ((data & 5) == 1)
205201      {
206         upscope_state *state = device->machine->driver_data<upscope_state>();
207         if (LOG_IO) logerror("NVRAM data write @ %02X = %02X\n", nvram_address_latch, parallel_data);
208         state->m_nvram[nvram_address_latch] = parallel_data;
202         if (LOG_IO) logerror("NVRAM data write @ %02X = %02X\n", state->nvram_address_latch, state->parallel_data);
203         state->m_nvram[state->nvram_address_latch] = state->parallel_data;
209204      }
210205
211206      /* if SEL == 0 && BUSY == 0, who knows? */
r10613r10614
216211   }
217212
218213   /* on a low transition of BUSY, we latch stuff for reading */
219   else if ((prev_cia1_porta & 1) && !(data & 1))
214   else if ((state->prev_cia1_porta & 1) && !(data & 1))
220215   {
221216      /* if SEL == 1, we read internal data registers */
222217      if (data & 4)
223218      {
224         if (LOG_IO) logerror("Internal register (%d) read\n", nvram_address_latch);
225         nvram_data_latch = (nvram_address_latch == 0) ? input_port_read(device->machine, "IO0") : 0xff;
219         if (LOG_IO) logerror("Internal register (%d) read\n", state->nvram_address_latch);
220         state->nvram_data_latch = (state->nvram_address_latch == 0) ? input_port_read(device->machine, "IO0") : 0xff;
226221      }
227222
228223      /* if SEL == 0, we read NVRAM */
229224      else
230225      {
231         upscope_state *state = device->machine->driver_data<upscope_state>();
232         nvram_data_latch = state->m_nvram[nvram_address_latch];
233         if (LOG_IO) logerror("NVRAM data read @ %02X = %02X\n", nvram_address_latch, nvram_data_latch);
226         state->nvram_data_latch = state->m_nvram[state->nvram_address_latch];
227         if (LOG_IO) logerror("NVRAM data read @ %02X = %02X\n", state->nvram_address_latch, state->nvram_data_latch);
234228      }
235229   }
236230
237231   /* remember the previous value */
238   prev_cia1_porta = data;
232   state->prev_cia1_porta = data;
239233}
240234
241235
src/mame/drivers/jollyjgr.c
r10613r10614
672672
673673   MCFG_CPU_MODIFY("maincpu")
674674   MCFG_CPU_PROGRAM_MAP(fspider_map)
675   
675
676676   MCFG_SCREEN_MODIFY("screen")
677677   MCFG_SCREEN_UPDATE(fspider)
678678
src/mame/drivers/gomoku.c
r10613r10614
4141static ADDRESS_MAP_START( gomoku_map, ADDRESS_SPACE_PROGRAM, 8 )
4242   AM_RANGE(0x0000, 0x47ff) AM_ROM
4343   AM_RANGE(0x4800, 0x4fff) AM_RAM
44   AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(gomoku_videoram_w) AM_BASE(&gomoku_videoram)
45   AM_RANGE(0x5400, 0x57ff) AM_RAM_WRITE(gomoku_colorram_w) AM_BASE(&gomoku_colorram)
46   AM_RANGE(0x5800, 0x58ff) AM_RAM_WRITE(gomoku_bgram_w) AM_BASE(&gomoku_bgram)
44   AM_RANGE(0x5000, 0x53ff) AM_RAM_WRITE(gomoku_videoram_w) AM_BASE_MEMBER(gomoku_state, videoram)
45   AM_RANGE(0x5400, 0x57ff) AM_RAM_WRITE(gomoku_colorram_w) AM_BASE_MEMBER(gomoku_state, colorram)
46   AM_RANGE(0x5800, 0x58ff) AM_RAM_WRITE(gomoku_bgram_w) AM_BASE_MEMBER(gomoku_state, bgram)
4747   AM_RANGE(0x6000, 0x601f) AM_DEVWRITE("gomoku", gomoku_sound1_w)
4848   AM_RANGE(0x6800, 0x681f) AM_DEVWRITE("gomoku", gomoku_sound2_w)
4949   AM_RANGE(0x7000, 0x7000) AM_WRITENOP
r10613r10614
117117GFXDECODE_END
118118
119119
120static MACHINE_CONFIG_START( gomoku, driver_device )
120static MACHINE_CONFIG_START( gomoku, gomoku_state )
121121   /* basic machine hardware */
122122   MCFG_CPU_ADD("maincpu", Z80, XTAL_18_432MHz/12)       /* 1.536 MHz ? */
123123   MCFG_CPU_PROGRAM_MAP(gomoku_map)
src/mame/drivers/ssfindo.c
r10613r10614
11/************************************************************************
2
3 'RISC PC' hardware
4
25 See See Find Out [Icarus 1999]
36 Pang Pang Car [Icarus 1999]
7 Tetris Fighters [Sego Entertainment 2001]
48
59 driver by
610  Tomasz Slanina  analog[at]op.pl
r10613r10614
307311      PS7500timer1->adjust( attotime::never);
308312}
309313
314typedef void (*ssfindo_speedup_func)(address_space *space);
315ssfindo_speedup_func ssfindo_speedup;
316
317static void ssfindo_speedups(address_space* space)
318{
319   if (cpu_get_pc(space->cpu)==0x2d6c8) // ssfindo
320      cpu_spinuntil_time(space->cpu, attotime::from_usec(20));
321   else if (cpu_get_pc(space->cpu)==0x2d6bc) // ssfindo
322      cpu_spinuntil_time(space->cpu, attotime::from_usec(20));
323}
324
325static void ppcar_speedups(address_space* space)
326{
327   if (cpu_get_pc(space->cpu)==0x000bc8) // ppcar
328      cpu_spinuntil_time(space->cpu, attotime::from_usec(20));
329   else if (cpu_get_pc(space->cpu)==0x000bbc) // ppcar
330      cpu_spinuntil_time(space->cpu, attotime::from_usec(20));
331}
332
333
310334static READ32_HANDLER(PS7500_IO_r)
311335{
312336
r10613r10614
332356         return (PS7500_IO[IRQSTA] & PS7500_IO[IRQMSKA]) | 0x80;
333357
334358      case IOCR: //TODO: nINT1, OD[n] p.81
359         if (ssfindo_speedup) ssfindo_speedup(space);
360         //printf("IOCR %08x\n",cpu_get_pc(space->cpu));
335361         return (input_port_read(space->machine, "PS7500") & 0x80) | 0x34 | 3;
336362
337363      case VIDCR:
r10613r10614
519545   AM_RANGE(0x10000000, 0x10ffffff) AM_RAM AM_BASE (&vram)
520546ADDRESS_MAP_END
521547
548static ADDRESS_MAP_START( tetfight_map, ADDRESS_SPACE_PROGRAM, 32 )
549   AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_REGION("user1", 0)
550   AM_RANGE(0x03200000, 0x032001ff) AM_READWRITE(PS7500_IO_r,PS7500_IO_w)
551   AM_RANGE(0x033c0000, 0x033c0003) AM_READ(io_r) AM_WRITE(io_w)
552   AM_RANGE(0x03400000, 0x03400003) AM_WRITE(FIFO_w)
553   AM_RANGE(0x10000000, 0x10ffffff) AM_RAM AM_BASE (&vram)
554ADDRESS_MAP_END
522555
523556static MACHINE_RESET( ssfindo )
524557{
r10613r10614
614647   MCFG_PALETTE_LENGTH(256)
615648MACHINE_CONFIG_END
616649
617static MACHINE_CONFIG_START( ppcar, driver_device )
650static MACHINE_CONFIG_DERIVED( ppcar, ssfindo )
618651
619652   /* basic machine hardware */
620   MCFG_CPU_ADD("maincpu", ARM7, 54000000) // guess...
653   MCFG_CPU_MODIFY("maincpu")
621654   MCFG_CPU_PROGRAM_MAP(ppcar_map)
655MACHINE_CONFIG_END
622656
623   MCFG_CPU_VBLANK_INT("screen", ssfindo_interrupt)
624   MCFG_MACHINE_RESET(ssfindo)
657static MACHINE_CONFIG_DERIVED( tetfight, ssfindo )
625658
626
627   MCFG_SCREEN_ADD("screen", RASTER)
628   MCFG_SCREEN_REFRESH_RATE(60)
629   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
630   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
631   MCFG_SCREEN_SIZE(320, 256)
632   MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
633   MCFG_SCREEN_UPDATE(ssfindo)
634
635   MCFG_PALETTE_LENGTH(256)
659   /* basic machine hardware */
660   MCFG_CPU_MODIFY("maincpu")
661   MCFG_CPU_PROGRAM_MAP(tetfight_map)
636662MACHINE_CONFIG_END
637663
638
639664ROM_START( ssfindo )
640665   ROM_REGION(0x100000, "user1", 0 ) /* ARM 32 bit code */
641666   ROM_LOAD16_BYTE( "a.u28",   0x000000, 0x80000, CRC(c93edbd3) SHA1(9c703cfef49b59ccd5d68bab9bd59344bd18d67e) )
r10613r10614
660685   ROM_REGION(0x100000, "user6", 0 ) /* samples - same internal structure as qdsp samples  */
661686   ROM_LOAD( "c.u12",      0x000000, 0x80000, CRC(d24b5e56) SHA1(d89983cf4b0a6e0e4137f3799bdbcfd72c7bebe4) )
662687   ROM_LOAD( "d.u11",      0x080000, 0x80000, CRC(c0fdd82a) SHA1(a633045e0f5c144b4e24e04fb9446522fdb222f4) )
663
664688ROM_END
665689
666690ROM_START( ppcar )
r10613r10614
685709   /* none */
686710ROM_END
687711
712ROM_START( tetfight )
713   ROM_REGION(0x200000, "user1", 0 ) /* ARM 32 bit code */
714   ROM_LOAD( "u42",      0x000000, 0x200000, CRC(9101c4d2) SHA1(39da953de734e687ebbf976c821bf1017830f36c) )
688715
689static DRIVER_INIT(ssfindo)
716   ROM_REGION(0x1000000, "user2", ROMREGION_ERASEFF ) /* flash roms */
717   /* nothing? */
718
719   ROM_REGION(0x100, "user3", 0 ) /* eeprom */
720   ROM_LOAD( "u1",      0x00, 0x100, CRC(dd207b40) SHA1(6689d9dfa980bdfbd4e4e6cef7973e22ebbfe22e) )
721
722   ROM_REGION(0x10000, "user4", 0 ) /* qdsp code */
723   ROM_LOAD( "u12",      0x000000, 0x10000, CRC(49976f7b) SHA1(eba5b97b81736f3c184ae0c19f1b10c5ae250d51) ) // = e.u14 on ssfindo
724
725   ROM_REGION(0x100000, "user5", ROMREGION_ERASE00 )/*  qdsp samples */
726   // probably the same, but wasn't dumped
727   //ROM_LOAD( "1008s-1.u16",  0x000000, 0x100000, CRC(9aef9545) SHA1(f23ef72c3e3667923768dfdd0c5b4951b23dcbcf) )
728
729   ROM_REGION(0x100000, "user6", 0 ) /* samples - same internal structure as qdsp samples  */
730   ROM_LOAD( "u11",      0x000000, 0x80000, CRC(073050f6) SHA1(07f362f3ba468bde2341a99e6b26931d11459a92) )
731   ROM_LOAD( "u15",      0x080000, 0x80000, CRC(477f8089) SHA1(8084facb254d60da7983d628d5945d27b9494e65) )
732ROM_END
733
734static DRIVER_INIT(common)
690735{
691   flashType=0;
736   ssfindo_speedup = 0;
692737   PS7500timer0 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer0_callback));
693738   PS7500timer1 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer1_callback));
739
694740}
695741
742static DRIVER_INIT(ssfindo)
743{
744   DRIVER_INIT_CALL(common);
745   flashType=0;
746   ssfindo_speedup = ssfindo_speedups;
747}
748
696749static DRIVER_INIT(ppcar)
697750{
751   DRIVER_INIT_CALL(common);
698752   flashType=1;
699   PS7500timer0 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer0_callback));
700   PS7500timer1 = machine->scheduler().timer_alloc(FUNC(PS7500_Timer1_callback));
753   ssfindo_speedup = ppcar_speedups;
701754}
702755
756static DRIVER_INIT(tetfight)
757{
758   DRIVER_INIT_CALL(common);
759   flashType=0; //?
760}
761
703762GAME( 1999, ssfindo, 0,        ssfindo,  ssfindo,  ssfindo,   ROT0, "Icarus", "See See Find Out", GAME_NO_SOUND )
704763GAME( 1999, ppcar,   0,        ppcar,    ppcar,    ppcar,   ROT0, "Icarus", "Pang Pang Car", GAME_NO_SOUND )
764GAME( 2001, tetfight,0,        tetfight, ssfindo,  tetfight,ROT0, "Sego", "Tetris Fighters", GAME_NO_SOUND|GAME_NOT_WORKING )
src/mame/drivers/firetrk.c
r10613r10614
951951   /* video hardware */
952952   MCFG_SCREEN_MODIFY("screen")
953953   MCFG_SCREEN_UPDATE(montecar)
954   
954
955955   MCFG_VIDEO_START(montecar)
956956   MCFG_GFXDECODE(montecar)
957957
r10613r10614
10421042
10431043
10441044GAME( 1977, superbug, 0, superbug, superbug, 0, ROT270, "Atari", "Super Bug", 0 )
1045GAME( 1978, firetrk,  0, firetrk,  firetrk,  0, ROT270, "Atari", "Fire Truck", 0 )
1045GAME( 1978, firetrk,  0, firetrk,  firetrk,  0, ROT270, "Atari", "Fire Truck / Smokey Joe", 0 )
10461046GAME( 1979, montecar, 0, montecar, montecar, 0, ROT270, "Atari", "Monte Carlo", 0 )
src/mame/drivers/segac2.c
r10613r10614
228228   megadrive_vdp_palette_lookup_shadow[offset] = (tmpb) | (tmpg << 5) | (tmpr << 10);
229229
230230   // how is it calculated on c2?
231   tmpr = tmpr | 0x10;   
232   tmpg = tmpg | 0x10;   
231   tmpr = tmpr | 0x10;
232   tmpg = tmpg | 0x10;
233233   tmpb = tmpb | 0x10;
234234   megadrive_vdp_palette_lookup_highlight[offset] = (tmpb) | (tmpg << 5) | (tmpr << 10);
235235}
src/mame/drivers/tubep.c
r10613r10614
104104#include "cpu/m6805/m6805.h"
105105#include "sound/ay8910.h"
106106#include "sound/msm5205.h"
107
108107#include "includes/tubep.h"
109108
110/* Global variables */
111static UINT8 sound_latch;
112static UINT8 ls74 = 0;
113static UINT8 ls377 = 0;
114109
115static emu_timer *interrupt_timer;
116
117
118static int curr_scanline=0;
119
120
121
122
123110/*************************************
124111 *
125112 *  Main CPU on main PCB
r10613r10614
160147static ADDRESS_MAP_START( tubep_main_map, ADDRESS_SPACE_PROGRAM, 8 )
161148   AM_RANGE(0x0000, 0x7fff) AM_ROM
162149   AM_RANGE(0xa000, 0xa7ff) AM_RAM
163   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(tubep_textram_w) AM_BASE(&tubep_textram)   /* RAM on GFX PCB @B13 */
150   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(tubep_textram_w) AM_BASE_MEMBER(tubep_state, textram)   /* RAM on GFX PCB @B13 */
164151   AM_RANGE(0xe000, 0xe7ff) AM_WRITEONLY AM_SHARE("share1")
165152   AM_RANGE(0xe800, 0xebff) AM_WRITEONLY AM_SHARE("share4")            /* row of 8 x 2147 RAMs on main PCB */
166153ADDRESS_MAP_END
r10613r10614
168155
169156static WRITE8_HANDLER( main_cpu_irq_line_clear_w )
170157{
158   tubep_state *state = space->machine->driver_data<tubep_state>();
171159   cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
172   logerror("CPU#0 VBLANK int clear at scanline=%3i\n", curr_scanline);
160   logerror("CPU#0 VBLANK int clear at scanline=%3i\n", state->curr_scanline);
173161   return;
174162}
175163
176164
177165static WRITE8_HANDLER( tubep_soundlatch_w )
178166{
179   sound_latch = (data&0x7f) | 0x80;
167   tubep_state *state = space->machine->driver_data<tubep_state>();
168   state->sound_latch = (data&0x7f) | 0x80;
180169}
181170
182171static ADDRESS_MAP_START( tubep_main_portmap, ADDRESS_SPACE_IO, 8 )
r10613r10614
204193
205194static WRITE8_HANDLER( second_cpu_irq_line_clear_w )
206195{
196   tubep_state *state = space->machine->driver_data<tubep_state>();
207197   cputag_set_input_line(space->machine, "slave", 0, CLEAR_LINE);
208   logerror("CPU#1 VBLANK int clear at scanline=%3i\n", curr_scanline);
198   logerror("CPU#1 VBLANK int clear at scanline=%3i\n", state->curr_scanline);
209199   return;
210200}
211201
r10613r10614
215205   AM_RANGE(0xa000, 0xa000) AM_WRITE(tubep_background_a000_w)
216206   AM_RANGE(0xc000, 0xc000) AM_WRITE(tubep_background_c000_w)
217207   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("share1")                        /* 6116 #1 */
218   AM_RANGE(0xe800, 0xebff) AM_WRITEONLY AM_SHARE("share4") AM_BASE(&tubep_backgroundram)   /* row of 8 x 2147 RAMs on main PCB */
208   AM_RANGE(0xe800, 0xebff) AM_WRITEONLY AM_SHARE("share4") AM_BASE_MEMBER(tubep_state, backgroundram)   /* row of 8 x 2147 RAMs on main PCB */
219209   AM_RANGE(0xf000, 0xf3ff) AM_WRITEONLY AM_SHARE("share3")                  /* sprites color lookup table */
220210   AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("share2")                           /* program copies here part of shared ram ?? */
221211ADDRESS_MAP_END
r10613r10614
229219
230220static READ8_HANDLER( tubep_soundlatch_r )
231221{
222   tubep_state *state = space->machine->driver_data<tubep_state>();
232223   int res;
233224
234   res = sound_latch;
235   sound_latch = 0; /* "=0" ????  or "&= 0x7f" ?????  works either way */
225   res = state->sound_latch;
226   state->sound_latch = 0; /* "=0" ????  or "&= 0x7f" ?????  works either way */
236227
237228   return res;
238229}
r10613r10614
269260
270261static TIMER_CALLBACK( tubep_scanline_callback )
271262{
263   tubep_state *state = machine->driver_data<tubep_state>();
272264   int scanline = param;
273265
274   curr_scanline = scanline;//for debugging
266   state->curr_scanline = scanline;//for debugging
275267
276268   /* CPU #0 interrupt */
277269   /* activates at the start of VBLANK signal which happens at the beginning of scaline number 240 */
r10613r10614
296288   if (scanline == 16)
297289   {
298290      logerror("/nmi CPU#3\n");
299      tubep_vblank_end(); /* switch buffered sprite RAM page */
291      tubep_vblank_end(machine); /* switch buffered sprite RAM state->page */
300292      cputag_set_input_line(machine, "mcu", INPUT_LINE_NMI, ASSERT_LINE);
301293   }
302294   /* CPU #3 MS2010-A NMI */
r10613r10614
325317   if (scanline >= 264)
326318      scanline = 0;
327319
328   interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
320   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
329321}
330322
331323
r10613r10614
338330
339331static void tubep_setup_save_state(running_machine *machine)
340332{
333   tubep_state *state = machine->driver_data<tubep_state>();
341334   /* Set up save state */
342   state_save_register_global(machine, sound_latch);
343   state_save_register_global(machine, ls74);
344   state_save_register_global(machine, ls377);
335   state_save_register_global(machine, state->sound_latch);
336   state_save_register_global(machine, state->ls74);
337   state_save_register_global(machine, state->ls377);
345338}
346339
347340
348341
349342static MACHINE_START( tubep )
350343{
344   tubep_state *state = machine->driver_data<tubep_state>();
351345   /* Create interrupt timer */
352   interrupt_timer = machine->scheduler().timer_alloc(FUNC(tubep_scanline_callback));
346   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(tubep_scanline_callback));
353347
354348   tubep_setup_save_state(machine);
355349}
r10613r10614
357351
358352static MACHINE_RESET( tubep )
359353{
360   interrupt_timer->adjust(machine->primary_screen->time_until_pos(0));
354   tubep_state *state = machine->driver_data<tubep_state>();
355   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(0));
361356}
362357
363358
r10613r10614
370365
371366/* MS2010-A CPU (equivalent to NSC8105 with one new opcode: 0xec) on graphics PCB */
372367static ADDRESS_MAP_START( nsc_map, ADDRESS_SPACE_PROGRAM, 8 )
373   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE("share3") AM_BASE(&tubep_sprite_colorsharedram)
368   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE("share3") AM_BASE_MEMBER(tubep_state, sprite_colorsharedram)
374369   AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE("share2")
375370   AM_RANGE(0x2000, 0x2009) AM_WRITE(tubep_sprite_control_w)
376371   AM_RANGE(0x200a, 0x200b) AM_WRITENOP /* not used by the games - perhaps designed for debugging */
r10613r10614
404399
405400static WRITE8_HANDLER( rjammer_soundlatch_w )
406401{
407   sound_latch = data;
402   tubep_state *state = space->machine->driver_data<tubep_state>();
403   state->sound_latch = data;
408404   cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
409405}
410406
r10613r10614
412408static ADDRESS_MAP_START( rjammer_main_map, ADDRESS_SPACE_PROGRAM, 8 )
413409   AM_RANGE(0x0000, 0x9fff) AM_ROM
414410   AM_RANGE(0xa000, 0xa7ff) AM_RAM                           /* MB8416 SRAM on daughterboard on main PCB (there are two SRAMs, this is the one on the left) */
415   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(tubep_textram_w) AM_BASE(&tubep_textram)/* RAM on GFX PCB @B13 */
411   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(tubep_textram_w) AM_BASE_MEMBER(tubep_state, textram)/* RAM on GFX PCB @B13 */
416412   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("share1")                  /* MB8416 SRAM on daughterboard (the one on the right) */
417413ADDRESS_MAP_END
418414
r10613r10614
436432   AM_RANGE(0x0000, 0x7fff) AM_ROM
437433   AM_RANGE(0xa000, 0xa7ff) AM_RAM                     /* M5M5117P @21G */
438434   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("share1")            /* MB8416 on daughterboard (the one on the right) */
439   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(&rjammer_backgroundram)/* M5M5117P @19B (background) */
435   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE_MEMBER(tubep_state, rjammer_backgroundram)/* M5M5117P @19B (background) */
440436   AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE("share2")
441437ADDRESS_MAP_END
442438
r10613r10614
450446
451447static TIMER_CALLBACK( rjammer_scanline_callback )
452448{
449   tubep_state *state = machine->driver_data<tubep_state>();
453450   int scanline = param;
454451
455   curr_scanline = scanline;//for debugging
452   state->curr_scanline = scanline;//for debugging
456453
457454   /* CPU #0 interrupt */
458455   /* activates at the start of VBLANK signal which happens at the beginning of scaline number 240 */
r10613r10614
477474   if (scanline == 16)
478475   {
479476      logerror("/nmi CPU#3\n");
480      tubep_vblank_end(); /* switch buffered sprite RAM page */
477      tubep_vblank_end(machine); /* switch buffered sprite RAM state->page */
481478      cputag_set_input_line(machine, "mcu", INPUT_LINE_NMI, ASSERT_LINE);
482479   }
483480   /* CPU #3 MS2010-A NMI */
r10613r10614
505502   if (scanline >= 264)
506503      scanline = 0;
507504
508   interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
505   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(scanline), scanline);
509506}
510507
511508
512509static MACHINE_START( rjammer )
513510{
511   tubep_state *state = machine->driver_data<tubep_state>();
514512   /* Create interrupt timer */
515   interrupt_timer = machine->scheduler().timer_alloc(FUNC(rjammer_scanline_callback));
513   state->interrupt_timer = machine->scheduler().timer_alloc(FUNC(rjammer_scanline_callback));
516514
517515   tubep_setup_save_state(machine);
518516}
519517
520518static MACHINE_RESET( rjammer )
521519{
522   interrupt_timer->adjust(machine->primary_screen->time_until_pos(0));
520   tubep_state *state = machine->driver_data<tubep_state>();
521   state->interrupt_timer->adjust(machine->primary_screen->time_until_pos(0));
523522}
524523
525524
r10613r10614
532531
533532static READ8_HANDLER( rjammer_soundlatch_r )
534533{
535   int res = sound_latch;
534   tubep_state *state = space->machine->driver_data<tubep_state>();
535   int res = state->sound_latch;
536536   return res;
537537}
538538
r10613r10614
562562
563563static void rjammer_adpcm_vck (device_t *device)
564564{
565   ls74 = (ls74 + 1) & 1;
565   tubep_state *state = device->machine->driver_data<tubep_state>();
566   state->ls74 = (state->ls74 + 1) & 1;
566567
567   if (ls74 == 1)
568   if (state->ls74 == 1)
568569   {
569      msm5205_data_w(device, (ls377 >> 0) & 15 );
570      msm5205_data_w(device, (state->ls377 >> 0) & 15 );
570571      cputag_set_input_line(device->machine, "soundcpu", 0, ASSERT_LINE );
571572   }
572573   else
573574   {
574      msm5205_data_w(device, (ls377 >> 4) & 15 );
575      msm5205_data_w(device, (state->ls377 >> 4) & 15 );
575576   }
576577
577578}
r10613r10614
579580
580581static WRITE8_HANDLER( rjammer_voice_input_w )
581582{
583   tubep_state *state = space->machine->driver_data<tubep_state>();
582584   /* 8 bits of adpcm data for MSM5205 */
583585   /* need to buffer the data, and switch two nibbles on two following interrupts*/
584586
585   ls377 = data;
587   state->ls377 = data;
586588
587589
588590   /* NOTE: game resets interrupt line on ANY access to ANY I/O port.
r10613r10614
892894 *
893895 *************************************/
894896
895static MACHINE_CONFIG_START( tubep, driver_device )
897static MACHINE_CONFIG_START( tubep, tubep_state )
896898
897899   /* basic machine hardware */
898900   MCFG_CPU_ADD("maincpu",Z80,16000000 / 4)   /* 4 MHz */
r10613r10614
954956MACHINE_CONFIG_END
955957
956958
957static MACHINE_CONFIG_START( rjammer, driver_device )
959static MACHINE_CONFIG_START( rjammer, tubep_state )
958960
959961   /* basic machine hardware */
960962   MCFG_CPU_ADD("maincpu",Z80,16000000 / 4)   /* 4 MHz */
src/mame/drivers/exidy.c
r10613r10614
150150#include "includes/exidy.h"
151151
152152
153static UINT8 last_dial;
154
155
156
157153/*************************************
158154 *
159155 *  Special Teeter Torture input
r10613r10614
162158
163159static CUSTOM_INPUT( teetert_input_r )
164160{
161   exidy_state *state = field->port->machine->driver_data<exidy_state>();
165162   UINT8 dial = input_port_read(field->port->machine, "DIAL");
166163   int result = 0;
167164
168   result = (dial != last_dial) << 4;
165   result = (dial != state->last_dial) << 4;
169166   if (result != 0)
170167   {
171      if (((dial - last_dial) & 0xff) < 0x80)
168      if (((dial - state->last_dial) & 0xff) < 0x80)
172169      {
173170         result |= 1;
174         last_dial++;
171         state->last_dial++;
175172      }
176173      else
177         last_dial--;
174         state->last_dial--;
178175   }
179176
180177   return result;
r10613r10614
207204
208205static ADDRESS_MAP_START( exidy_map, ADDRESS_SPACE_PROGRAM, 8 )
209206   AM_RANGE(0x0000, 0x03ff) AM_RAM
210   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0400) AM_RAM AM_BASE(&exidy_videoram)
211   AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE(&exidy_sprite1_xpos)
212   AM_RANGE(0x5040, 0x5040) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE(&exidy_sprite1_ypos)
213   AM_RANGE(0x5080, 0x5080) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE(&exidy_sprite2_xpos)
214   AM_RANGE(0x50c0, 0x50c0) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE(&exidy_sprite2_ypos)
207   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0400) AM_RAM AM_BASE_MEMBER(exidy_state, videoram)
208   AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite1_xpos)
209   AM_RANGE(0x5040, 0x5040) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite1_ypos)
210   AM_RANGE(0x5080, 0x5080) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite2_xpos)
211   AM_RANGE(0x50c0, 0x50c0) AM_MIRROR(0x003f) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite2_ypos)
215212   AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_READ_PORT("DSW")
216   AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE(&exidy_spriteno)
213   AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, spriteno)
217214   AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_READ_PORT("IN0")
218   AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE(&exidy_sprite_enable)
215   AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite_enable)
219216   AM_RANGE(0x5103, 0x5103) AM_MIRROR(0x00fc) AM_READ(exidy_interrupt_r)
220   AM_RANGE(0x5210, 0x5212) AM_WRITEONLY AM_BASE(&exidy_color_latch)
217   AM_RANGE(0x5210, 0x5212) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, color_latch)
221218   AM_RANGE(0x5213, 0x5213) AM_READ_PORT("IN2")
222219ADDRESS_MAP_END
223220
224221
225222static ADDRESS_MAP_START( sidetrac_map, ADDRESS_SPACE_PROGRAM, 8 )
226223   AM_RANGE(0x0800, 0x3fff) AM_ROM
227   AM_RANGE(0x4800, 0x4fff) AM_ROM AM_BASE(&exidy_characterram)
224   AM_RANGE(0x4800, 0x4fff) AM_ROM AM_BASE_MEMBER(exidy_state, characterram)
228225   AM_RANGE(0x5200, 0x5200) AM_WRITE(targ_audio_1_w)
229226   AM_RANGE(0x5201, 0x5201) AM_WRITE(spectar_audio_2_w)
230227   AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0x3f00)
r10613r10614
234231
235232static ADDRESS_MAP_START( targ_map, ADDRESS_SPACE_PROGRAM, 8 )
236233   AM_RANGE(0x0800, 0x3fff) AM_ROM
237   AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE(&exidy_characterram)
234   AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
238235   AM_RANGE(0x5200, 0x5200) AM_WRITE(targ_audio_1_w)
239236   AM_RANGE(0x5201, 0x5201) AM_WRITE(targ_audio_2_w)
240237   AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0x3f00)
r10613r10614
244241
245242static ADDRESS_MAP_START( spectar_map, ADDRESS_SPACE_PROGRAM, 8 )
246243   AM_RANGE(0x0800, 0x3fff) AM_ROM
247   AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE(&exidy_characterram)
244   AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
248245   AM_RANGE(0x5200, 0x5200) AM_WRITE(targ_audio_1_w)
249246   AM_RANGE(0x5201, 0x5201) AM_WRITE(spectar_audio_2_w)
250247   AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0x3f00)
r10613r10614
255252static ADDRESS_MAP_START( rallys_map, ADDRESS_SPACE_PROGRAM, 8 )
256253   AM_RANGE(0x0000, 0x03ff) AM_RAM
257254   AM_RANGE(0x0800, 0x3fff) AM_ROM
258   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0400) AM_RAM AM_BASE(&exidy_videoram)
259   AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE(&exidy_characterram)
260   AM_RANGE(0x5000, 0x5000) AM_WRITEONLY AM_BASE(&exidy_sprite1_xpos)
261   AM_RANGE(0x5001, 0x5001) AM_WRITEONLY AM_BASE(&exidy_sprite1_ypos)
255   AM_RANGE(0x4000, 0x43ff) AM_MIRROR(0x0400) AM_RAM AM_BASE_MEMBER(exidy_state, videoram)
256   AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
257   AM_RANGE(0x5000, 0x5000) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite1_xpos)
258   AM_RANGE(0x5001, 0x5001) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite1_ypos)
262259   AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_READ_PORT("DSW")
263   AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE(&exidy_spriteno)
260   AM_RANGE(0x5100, 0x5100) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, spriteno)
264261   AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_READ_PORT("IN0")
265   AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE(&exidy_sprite_enable)
262   AM_RANGE(0x5101, 0x5101) AM_MIRROR(0x00fc) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite_enable)
266263   AM_RANGE(0x5103, 0x5103) AM_MIRROR(0x00fc) AM_READ(exidy_interrupt_r)
267264   AM_RANGE(0x5200, 0x5200) AM_WRITE(targ_audio_1_w)
268265   AM_RANGE(0x5201, 0x5201) AM_WRITE(spectar_audio_2_w)
269   AM_RANGE(0x5210, 0x5212) AM_WRITEONLY AM_BASE(&exidy_color_latch)
266   AM_RANGE(0x5210, 0x5212) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, color_latch)
270267   AM_RANGE(0x5213, 0x5213) AM_READ_PORT("IN2")
271   AM_RANGE(0x5300, 0x5300) AM_WRITEONLY AM_BASE(&exidy_sprite2_xpos)
272   AM_RANGE(0x5301, 0x5301) AM_WRITEONLY AM_BASE(&exidy_sprite2_ypos)
268   AM_RANGE(0x5300, 0x5300) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite2_xpos)
269   AM_RANGE(0x5301, 0x5301) AM_WRITEONLY AM_BASE_MEMBER(exidy_state, sprite2_ypos)
273270   AM_RANGE(0xff00, 0xffff) AM_ROM AM_REGION("maincpu", 0x3f00)
274271ADDRESS_MAP_END
275272
276273
277274static ADDRESS_MAP_START( venture_map, ADDRESS_SPACE_PROGRAM, 8 )
278   AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE(&exidy_characterram)
275   AM_RANGE(0x4800, 0x4fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
279276   AM_RANGE(0x5200, 0x520f) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w)
280277   AM_RANGE(0x8000, 0xffff) AM_ROM
281278   AM_IMPORT_FROM(exidy_map)
r10613r10614
285282static ADDRESS_MAP_START( pepper2_map, ADDRESS_SPACE_PROGRAM, 8 )
286283   AM_RANGE(0x4800, 0x4fff) AM_NOP
287284   AM_RANGE(0x5200, 0x520f) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w)
288   AM_RANGE(0x6000, 0x6fff) AM_RAM AM_BASE(&exidy_characterram)
285   AM_RANGE(0x6000, 0x6fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
289286   AM_RANGE(0x8000, 0xffff) AM_ROM
290287   AM_IMPORT_FROM(exidy_map)
291288ADDRESS_MAP_END
r10613r10614
299296   AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank1")
300297   AM_RANGE(0x5200, 0x520f) AM_DEVREADWRITE("pia0", pia6821_r, pia6821_w)
301298   AM_RANGE(0x5213, 0x5217) AM_WRITENOP      /* empty control lines on color/sound board */
302   AM_RANGE(0x6000, 0x6fff) AM_RAM AM_BASE(&exidy_characterram)
299   AM_RANGE(0x6000, 0x6fff) AM_RAM AM_BASE_MEMBER(exidy_state, characterram)
303300   AM_RANGE(0x8000, 0xffff) AM_ROM
304301   AM_IMPORT_FROM(exidy_map)
305302ADDRESS_MAP_END
r10613r10614
798795
799796static MACHINE_START( teetert )
800797{
801    state_save_register_global(machine, last_dial);
798   exidy_state *state = machine->driver_data<exidy_state>();
799   state_save_register_global(machine, state->last_dial);
802800}
803801
804802/*************************************
r10613r10614
807805 *
808806 *************************************/
809807
810static MACHINE_CONFIG_START( base, driver_device )
808static MACHINE_CONFIG_START( base, exidy_state )
811809
812810   /* basic machine hardware */
813811   MCFG_CPU_ADD("maincpu", M6502, EXIDY_CPU_CLOCK)
r10613r10614
13861384
13871385static DRIVER_INIT( sidetrac )
13881386{
1389   exidy_video_config(0x00, 0x00, FALSE);
1387   exidy_state *state = machine->driver_data<exidy_state>();
1388   exidy_video_config(machine, 0x00, 0x00, FALSE);
13901389
13911390   /* hard-coded palette controlled via 8x3 DIP switches on the board */
1392   exidy_color_latch[2] = 0xf8;
1393   exidy_color_latch[1] = 0xdc;
1394   exidy_color_latch[0] = 0xb8;
1391   state->color_latch[2] = 0xf8;
1392   state->color_latch[1] = 0xdc;
1393   state->color_latch[0] = 0xb8;
13951394}
13961395
13971396
13981397static DRIVER_INIT( targ )
13991398{
1400   exidy_video_config(0x00, 0x00, FALSE);
1399   exidy_state *state = machine->driver_data<exidy_state>();
1400   exidy_video_config(machine, 0x00, 0x00, FALSE);
14011401
14021402   /* hard-coded palette controlled via 8x3 DIP switches on the board */
1403   exidy_color_latch[2] = 0x5c;
1404   exidy_color_latch[1] = 0xee;
1405   exidy_color_latch[0] = 0x6b;
1403   state->color_latch[2] = 0x5c;
1404   state->color_latch[1] = 0xee;
1405   state->color_latch[0] = 0x6b;
14061406}
14071407
14081408
14091409static DRIVER_INIT( spectar )
14101410{
1411   exidy_video_config(0x00, 0x00, FALSE);
1411   exidy_state *state = machine->driver_data<exidy_state>();
1412   exidy_video_config(machine, 0x00, 0x00, FALSE);
14121413
14131414   /* hard-coded palette controlled via 8x3 DIP switches on the board */
1414   exidy_color_latch[2] = 0x58;
1415   exidy_color_latch[1] = 0xee;
1416   exidy_color_latch[0] = 0x09;
1415   state->color_latch[2] = 0x58;
1416   state->color_latch[1] = 0xee;
1417   state->color_latch[0] = 0x09;
14171418}
14181419
14191420static DRIVER_INIT( rallys )
14201421{
1421   exidy_video_config(0x00, 0x00, FALSE);
1422   exidy_state *state = machine->driver_data<exidy_state>();
1423   exidy_video_config(machine, 0x00, 0x00, FALSE);
14221424
14231425   /* hard-coded palette controlled via 8x3 DIP switches on the board */
1424   exidy_color_latch[2] = 0x58;
1425   exidy_color_latch[1] = 0xee;
1426   exidy_color_latch[0] = 0x09;
1426   state->color_latch[2] = 0x58;
1427   state->color_latch[1] = 0xee;
1428   state->color_latch[0] = 0x09;
14271429}
14281430
14291431static DRIVER_INIT( phantoma )
14301432{
1431   exidy_video_config(0x00, 0x00, FALSE);
1433   exidy_state *state = machine->driver_data<exidy_state>();
1434   exidy_video_config(machine, 0x00, 0x00, FALSE);
14321435
14331436   /* hard-coded palette controlled via 8x3 DIP switches on the board */
1434   exidy_color_latch[2] = 0x58;
1435   exidy_color_latch[1] = 0xee;
1436   exidy_color_latch[0] = 0x09;
1437   state->color_latch[2] = 0x58;
1438   state->color_latch[1] = 0xee;
1439   state->color_latch[0] = 0x09;
14371440
14381441   /* the ROM is actually mapped high */
14391442   memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf800, 0xffff, 0, 0, "bank1");
r10613r10614
14431446
14441447static DRIVER_INIT( mtrap )
14451448{
1446   exidy_video_config(0x14, 0x00, FALSE);
1449   exidy_video_config(machine, 0x14, 0x00, FALSE);
14471450}
14481451
14491452
14501453static DRIVER_INIT( venture )
14511454{
1452   exidy_video_config(0x04, 0x04, FALSE);
1455   exidy_video_config(machine, 0x04, 0x04, FALSE);
14531456}
14541457
14551458
14561459static DRIVER_INIT( teetert )
14571460{
1458   exidy_video_config(0x0c, 0x0c, FALSE);
1461   exidy_video_config(machine, 0x0c, 0x0c, FALSE);
14591462}
14601463
14611464
14621465static DRIVER_INIT( pepper2 )
14631466{
1464   exidy_video_config(0x14, 0x04, TRUE);
1467   exidy_video_config(machine, 0x14, 0x04, TRUE);
14651468}
14661469
14671470
r10613r10614
14691472{
14701473   address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
14711474
1472   exidy_video_config(0x04, 0x04, TRUE);
1475   exidy_video_config(machine, 0x04, 0x04, TRUE);
14731476
14741477   /* reset the ROM bank */
14751478   fax_bank_select_w(space,0,0);
src/mame/drivers/circus.c
r10613r10614
3030C000      Option Switches
3131D000      Paddle Position and Interrupt Reset (where applicable)
3232
33   NOTES:
34   - Circus: Taito licensed and releasd the game as "Acrobat TV"
33    NOTES:
34    - Circus: Taito licensed and releasd the game as "Acrobat TV"
3535
36   TODO:
37   - generic video timing (vsync, vblank, # of scanlines)
38   - circus/ripcord collision detection:
39     * is accurate?
40     * move away from video update (fails with frameskipping)
41   - crash: irq timing
42   - improve discrete sound
36    TODO:
37    - generic video timing (vsync, vblank, # of scanlines)
38    - circus/ripcord collision detection:
39      * is accurate?
40      * move away from video update (fails with frameskipping)
41    - crash: irq timing
42    - improve discrete sound
4343
4444***************************************************************************/
4545
r10613r10614
8888   PORT_DIPSETTING(   0x02, "7" )
8989   PORT_DIPSETTING(   0x03, "9" )
9090   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("14A:4,5")
91//   PORT_DIPSETTING(   0x08, DEF_STR( 2C_1C ) )
91//  PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
9292   PORT_DIPSETTING(   0x0c, DEF_STR( 2C_1C ) )
9393   PORT_DIPSETTING(   0x04, DEF_STR( 1C_1C ) )
9494   PORT_DIPSETTING(   0x00, DEF_STR( 1C_2C ) )
r10613r10614
127127   PORT_DIPSETTING(   0x10, DEF_STR( 2C_1C ) )
128128   PORT_DIPSETTING(   0x08, DEF_STR( 1C_1C ) )
129129   PORT_DIPSETTING(   0x00, DEF_STR( 1C_2C ) )
130//   PORT_DIPSETTING(   0x18, DEF_STR( 1C_2C ) )
130//  PORT_DIPSETTING(    0x18, DEF_STR( 1C_2C ) )
131131   PORT_DIPNAME( 0x60, 0x00, "Bowl Timer" ) PORT_DIPLOCATION("14A:1,2")
132132   PORT_DIPSETTING(   0x00, "3 seconds" )
133133   PORT_DIPSETTING(   0x20, "5 seconds" )
r10613r10614
158158   PORT_DIPSETTING(   0x02, "4" )
159159   PORT_DIPSETTING(   0x03, "5" )
160160   PORT_DIPNAME( 0x0C, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("14A:4,5")
161//   PORT_DIPSETTING(   0x0c, DEF_STR( 2C_1C ) )
161//  PORT_DIPSETTING(    0x0c, DEF_STR( 2C_1C ) )
162162   PORT_DIPSETTING(   0x08, DEF_STR( 2C_1C ) )
163163   PORT_DIPSETTING(   0x04, DEF_STR( 1C_1C ) )
164164   PORT_DIPSETTING(   0x00, DEF_STR( 1C_2C ) )
r10613r10614
198198   PORT_DIPSETTING(   0x02, "7" )
199199   PORT_DIPSETTING(   0x03, "9" )
200200   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coinage ) ) PORT_DIPLOCATION("14A:4,5")
201//   PORT_DIPSETTING(   0x0c, DEF_STR( 2C_1C ) )
201//  PORT_DIPSETTING(    0x0c, DEF_STR( 2C_1C ) )
202202   PORT_DIPSETTING(   0x08, DEF_STR( 2C_1C ) )
203203   PORT_DIPSETTING(   0x04, DEF_STR( 1C_1C ) )
204204   PORT_DIPSETTING(   0x00, DEF_STR( 1C_2C ) )
src/mame/drivers/igs011.c
r10613r10614
7070#include "machine/nvram.h"
7171
7272
73struct blitter_t
74{
75
76   UINT16   x, y, w, h,
77         gfx_lo, gfx_hi,
78         depth,
79         pen,
80         flags;
81
82};
83
7384class igs011_state : public driver_device
7485{
7586public:
r10613r10614
93104   UINT16 igs003_reg[2];
94105   UINT16 lhb_irq_enable;
95106   UINT16 *vbowl_trackball;
107   blitter_t blitter;
96108};
97109
98110
r10613r10614
277289
278290***************************************************************************/
279291
280static struct
292
293static WRITE16_HANDLER( igs011_blit_x_w )
281294{
295   igs011_state *state = space->machine->driver_data<igs011_state>();
296   struct blitter_t &blitter = state->blitter;
297   COMBINE_DATA(&blitter.x);
298}
282299
283   UINT16   x, y, w, h,
284         gfx_lo, gfx_hi,
285         depth,
286         pen,
287         flags;
300static WRITE16_HANDLER( igs011_blit_y_w )
301{
302   igs011_state *state = space->machine->driver_data<igs011_state>();
303   struct blitter_t &blitter = state->blitter;
304   COMBINE_DATA(&blitter.y);
305}
288306
289}   blitter;
307static WRITE16_HANDLER( igs011_blit_gfx_lo_w )
308{
309   igs011_state *state = space->machine->driver_data<igs011_state>();
310   struct blitter_t &blitter = state->blitter;
311   COMBINE_DATA(&blitter.gfx_lo);
312}
290313
314static WRITE16_HANDLER( igs011_blit_gfx_hi_w )
315{
316   igs011_state *state = space->machine->driver_data<igs011_state>();
317   struct blitter_t &blitter = state->blitter;
318   COMBINE_DATA(&blitter.gfx_hi);
319}
291320
292static WRITE16_HANDLER( igs011_blit_x_w )      {   COMBINE_DATA(&blitter.x);      }
293static WRITE16_HANDLER( igs011_blit_y_w )      {   COMBINE_DATA(&blitter.y);      }
294static WRITE16_HANDLER( igs011_blit_gfx_lo_w )   {   COMBINE_DATA(&blitter.gfx_lo);   }
295static WRITE16_HANDLER( igs011_blit_gfx_hi_w )   {   COMBINE_DATA(&blitter.gfx_hi);   }
296static WRITE16_HANDLER( igs011_blit_w_w )      {   COMBINE_DATA(&blitter.w);      }
297static WRITE16_HANDLER( igs011_blit_h_w )      {   COMBINE_DATA(&blitter.h);      }
298static WRITE16_HANDLER( igs011_blit_depth_w )   {   COMBINE_DATA(&blitter.depth);   }
299static WRITE16_HANDLER( igs011_blit_pen_w )      {   COMBINE_DATA(&blitter.pen);      }
321static WRITE16_HANDLER( igs011_blit_w_w )
322{
323   igs011_state *state = space->machine->driver_data<igs011_state>();
324   struct blitter_t &blitter = state->blitter;
325   COMBINE_DATA(&blitter.w);
326}
300327
328static WRITE16_HANDLER( igs011_blit_h_w )
329{
330   igs011_state *state = space->machine->driver_data<igs011_state>();
331   struct blitter_t &blitter = state->blitter;
332   COMBINE_DATA(&blitter.h);
333}
301334
335static WRITE16_HANDLER( igs011_blit_depth_w )
336{
337   igs011_state *state = space->machine->driver_data<igs011_state>();
338   struct blitter_t &blitter = state->blitter;
339   COMBINE_DATA(&blitter.depth);
340}
341
342static WRITE16_HANDLER( igs011_blit_pen_w )
343{
344   igs011_state *state = space->machine->driver_data<igs011_state>();
345   struct blitter_t &blitter = state->blitter;
346   COMBINE_DATA(&blitter.pen);
347}
348
349
302350static WRITE16_HANDLER( igs011_blit_flags_w )
303351{
304352   igs011_state *state = space->machine->driver_data<igs011_state>();
353   struct blitter_t &blitter = state->blitter;
305354   int x, xstart, xend, xinc, flipx;
306355   int y, ystart, yend, yinc, flipy;
307356   int depth4, clear, opaque, z;
r10613r10614
929978/*
930979static READ16_HANDLER( igs011_prot_fake_r )
931980{
932   igs011_state *state = space->machine->driver_data<igs011_state>();
981    igs011_state *state = space->machine->driver_data<igs011_state>();
933982    switch (offset)
934983    {
935984        case 0: return state->prot1;
r10613r10614
11551204/*
11561205static READ16_HANDLER( igs012_prot_fake_r )
11571206{
1158   igs011_state *state = space->machine->driver_data<igs011_state>();
1207    igs011_state *state = space->machine->driver_data<igs011_state>();
11591208    switch (offset)
11601209    {
11611210        case 0: return state->igs012_prot;
src/mame/drivers/bwing.c
r10613r10614
450450   MCFG_PALETTE_LENGTH(64)
451451
452452   MCFG_VIDEO_START(bwing)
453   
453
454454   // sound hardware
455455   MCFG_SPEAKER_STANDARD_MONO("mono")
456456
src/mame/drivers/williams.c
r10613r10614
515515 *************************************/
516516
517517static ADDRESS_MAP_START( defender_map, ADDRESS_SPACE_PROGRAM, 8 )
518   AM_RANGE(0x0000, 0xbfff) AM_RAM AM_BASE(&williams_videoram)
518   AM_RANGE(0x0000, 0xbfff) AM_RAM AM_BASE_MEMBER(williams_state, videoram)
519519   /* range from 0xc000-0xcfff is mapped programmatically below */
520520   AM_RANGE(0xc000, 0xc00f) AM_BASE_GENERIC(paletteram)
521521   AM_RANGE(0xc400, 0xc4ff) AM_SHARE("nvram")
r10613r10614
552552 *************************************/
553553
554554static ADDRESS_MAP_START( williams_map, ADDRESS_SPACE_PROGRAM, 8 )
555   AM_RANGE(0x0000, 0x8fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE(&williams_videoram)
555   AM_RANGE(0x0000, 0x8fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE_MEMBER(williams_state, videoram)
556556   AM_RANGE(0x9000, 0xbfff) AM_RAM
557557   AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITEONLY AM_BASE_GENERIC(paletteram)
558558   AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pia_0", pia6821_r, pia6821_w)
r10613r10614
567567
568568
569569static ADDRESS_MAP_START( williams_extra_ram_map, ADDRESS_SPACE_PROGRAM, 8 )
570   AM_RANGE(0x0000, 0x8fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE(&williams_videoram)
570   AM_RANGE(0x0000, 0x8fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE_MEMBER(williams_state, videoram)
571571   AM_RANGE(0x9000, 0xbfff) AM_RAM
572572   AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITEONLY AM_BASE_GENERIC(paletteram)
573573   AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pia_0", pia6821_r, pia6821_w)
r10613r10614
590590 *************************************/
591591
592592static ADDRESS_MAP_START( blaster_map, ADDRESS_SPACE_PROGRAM, 8 )
593   AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE(&williams_videoram)
593   AM_RANGE(0x0000, 0x3fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE_MEMBER(williams_state, videoram)
594594   AM_RANGE(0x4000, 0x8fff) AM_READ_BANK("bank2") AM_WRITEONLY
595   AM_RANGE(0xbb00, 0xbbff) AM_WRITEONLY AM_BASE(&blaster_palette_0)
596   AM_RANGE(0xbc00, 0xbcff) AM_WRITEONLY AM_BASE(&blaster_scanline_control)
595   AM_RANGE(0xbb00, 0xbbff) AM_WRITEONLY AM_BASE_MEMBER(williams_state, blaster_palette_0)
596   AM_RANGE(0xbc00, 0xbcff) AM_WRITEONLY AM_BASE_MEMBER(williams_state, blaster_scanline_control)
597597   AM_RANGE(0x9000, 0xbfff) AM_RAM
598598   AM_RANGE(0xc000, 0xc00f) AM_MIRROR(0x03f0) AM_WRITEONLY AM_BASE_GENERIC(paletteram)
599599   AM_RANGE(0xc804, 0xc807) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pia_0", pia6821_r, pia6821_w)
r10613r10614
618618 *************************************/
619619
620620static ADDRESS_MAP_START( williams2_map, ADDRESS_SPACE_PROGRAM, 8 )
621   AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE(&williams_videoram)
621   AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE_MEMBER(williams_state, videoram)
622622   AM_RANGE(0x8000, 0xbfff) AM_RAM
623   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(williams2_tileram_w) AM_BASE(&williams2_tileram)
623   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(williams2_tileram_w) AM_BASE_MEMBER(williams_state, williams2_tileram)
624624   AM_RANGE(0xc800, 0xc87f) AM_WRITE(williams2_bank_select_w)
625625   AM_RANGE(0xc880, 0xc887) AM_MIRROR(0x0078) AM_WRITE(williams_blitter_w)
626626   AM_RANGE(0xc900, 0xc97f) AM_WRITE(williams2_watchdog_reset_w)
r10613r10614
640640
641641
642642static ADDRESS_MAP_START( williams2_extra_ram_map, ADDRESS_SPACE_PROGRAM, 8 )
643   AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE(&williams_videoram)
643   AM_RANGE(0x0000, 0x7fff) AM_READ_BANK("bank1") AM_WRITEONLY AM_BASE_MEMBER(williams_state, videoram)
644644   AM_RANGE(0x8000, 0xbfff) AM_RAM
645   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(williams2_tileram_w) AM_BASE(&williams2_tileram)
645   AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(williams2_tileram_w) AM_BASE_MEMBER(williams_state, williams2_tileram)
646646   AM_RANGE(0xc800, 0xc87f) AM_WRITE(williams2_bank_select_w)
647647   AM_RANGE(0xc880, 0xc887) AM_MIRROR(0x0078) AM_WRITE(williams_blitter_w)
648648   AM_RANGE(0xc900, 0xc97f) AM_WRITE(williams2_watchdog_reset_w)
r10613r10614
26882688 *************************************/
26892689
26902690#define CONFIGURE_BLITTER(x,c) \
2691   williams_blitter_config = x; \
2692   williams_blitter_clip_address = c
2691   state->blitter_config = x; \
2692   state->blitter_clip_address = c
26932693
26942694#define CONFIGURE_TILEMAP(x) \
2695   williams2_tilemap_config = x
2695   state->williams2_tilemap_config = x
26962696
26972697
26982698
r10613r10614
27042704
27052705static DRIVER_INIT( defender )
27062706{
2707   williams_state *state = machine->driver_data<williams_state>();
27072708   CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000);
27082709}
27092710
27102711
27112712static DRIVER_INIT( defndjeu )
27122713{
2714   williams_state *state = machine->driver_data<williams_state>();
27132715   UINT8 *rom = machine->region("maincpu")->base();
27142716   int i;
27152717
r10613r10614
27232725
27242726static DRIVER_INIT( mayday )
27252727{
2728   williams_state *state = machine->driver_data<williams_state>();
27262729   CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000);
27272730
27282731   /* install a handler to catch protection checks */
2729   mayday_protection = memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa190, 0xa191, 0, 0, mayday_protection_r);
2732   state->mayday_protection = memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xa190, 0xa191, 0, 0, mayday_protection_r);
27302733}
27312734
27322735
r10613r10614
27392742
27402743static DRIVER_INIT( stargate )
27412744{
2745   williams_state *state = machine->driver_data<williams_state>();
27422746   CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000);
27432747}
27442748
27452749
27462750static DRIVER_INIT( robotron )
27472751{
2752   williams_state *state = machine->driver_data<williams_state>();
27482753   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
27492754}
27502755
27512756
27522757static DRIVER_INIT( joust )
27532758{
2759   williams_state *state = machine->driver_data<williams_state>();
27542760   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
27552761}
27562762
27572763
27582764static DRIVER_INIT( bubbles )
27592765{
2766   williams_state *state = machine->driver_data<williams_state>();
27602767   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
27612768
27622769   /* bubbles has a full 8-bit-wide CMOS */
r10613r10614
27662773
27672774static DRIVER_INIT( splat )
27682775{
2776   williams_state *state = machine->driver_data<williams_state>();
27692777   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0xc000);
27702778}
27712779
27722780
27732781static DRIVER_INIT( sinistar )
27742782{
2783   williams_state *state = machine->driver_data<williams_state>();
27752784   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0x7400);
27762785}
27772786
27782787
27792788static DRIVER_INIT( playball )
27802789{
2790   williams_state *state = machine->driver_data<williams_state>();
27812791   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
27822792}
27832793
27842794
27852795static DRIVER_INIT( blaster )
27862796{
2797   williams_state *state = machine->driver_data<williams_state>();
27872798   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9700);
27882799}
27892800
27902801
27912802static DRIVER_INIT( blastkit )
27922803{
2804   williams_state *state = machine->driver_data<williams_state>();
27932805   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9700);
27942806}
27952807
27962808
27972809static DRIVER_INIT( spdball )
27982810{
2811   williams_state *state = machine->driver_data<williams_state>();
27992812   device_t *pia_3 = machine->device("pia_3");
28002813
28012814   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
r10613r10614
28132826
28142827static DRIVER_INIT( alienar )
28152828{
2829   williams_state *state = machine->driver_data<williams_state>();
28162830   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
28172831   memory_nop_write(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0);
28182832}
r10613r10614
28202834
28212835static DRIVER_INIT( alienaru )
28222836{
2837   williams_state *state = machine->driver_data<williams_state>();
28232838   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
28242839   memory_nop_write(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xcbff, 0xcbff, 0, 0);
28252840}
r10613r10614
28272842
28282843static DRIVER_INIT( lottofun )
28292844{
2845   williams_state *state = machine->driver_data<williams_state>();
28302846   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC01, 0xc000);
28312847}
28322848
r10613r10614
28402856
28412857static DRIVER_INIT( mysticm )
28422858{
2859   williams_state *state = machine->driver_data<williams_state>();
28432860   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000);
28442861   CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_MYSTICM);
28452862}
r10613r10614
28472864
28482865static DRIVER_INIT( tshoot )
28492866{
2867   williams_state *state = machine->driver_data<williams_state>();
28502868   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000);
28512869   CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_TSHOOT);
28522870}
r10613r10614
28542872
28552873static DRIVER_INIT( inferno )
28562874{
2875   williams_state *state = machine->driver_data<williams_state>();
28572876   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000);
28582877   CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_TSHOOT);
28592878}
r10613r10614
28612880
28622881static DRIVER_INIT( joust2 )
28632882{
2883   williams_state *state = machine->driver_data<williams_state>();
28642884   CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC02, 0x9000);
28652885   CONFIGURE_TILEMAP(WILLIAMS_TILEMAP_JOUST2);
28662886}
src/mame/drivers/triplhnt.c
r10613r10614
1515#include "machine/nvram.h"
1616#include "includes/triplhnt.h"
1717
18static UINT8 triplhnt_cmos[16];
19static UINT8 triplhnt_da_latch;
20static UINT8 triplhnt_misc_flags;
21static UINT8 triplhnt_cmos_latch;
22static UINT8 triplhnt_hit_code;
2318
2419
2520static DRIVER_INIT( triplhnt )
2621{
27   machine->device<nvram_device>("nvram")->set_base(triplhnt_cmos, sizeof(triplhnt_cmos));
22   triplhnt_state *state = machine->driver_data<triplhnt_state>();
23   machine->device<nvram_device>("nvram")->set_base(state->cmos, sizeof(state->cmos));
2824}
2925
3026
3127void triplhnt_set_collision(running_machine *machine, int code)
3228{
33   triplhnt_hit_code = code;
29   triplhnt_state *state = machine->driver_data<triplhnt_state>();
30   state->hit_code = code;
3431
3532   cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
3633}
r10613r10614
3835
3936static void triplhnt_update_misc(running_machine *machine, int offset)
4037{
38   triplhnt_state *state = machine->driver_data<triplhnt_state>();
4139   device_t *samples = machine->device("samples");
4240   device_t *discrete = machine->device("discrete");
4341   UINT8 is_witch_hunt;
r10613r10614
5452
5553   if (offset & 1)
5654   {
57      triplhnt_misc_flags |= 1 << bit;
55      state->misc_flags |= 1 << bit;
5856
5957      if (bit == 5)
6058      {
61         triplhnt_cmos[triplhnt_cmos_latch] = triplhnt_da_latch;
59         state->cmos[state->cmos_latch] = state->da_latch;
6260      }
6361   }
6462   else
6563   {
66      triplhnt_misc_flags &= ~(1 << bit);
64      state->misc_flags &= ~(1 << bit);
6765   }
6866
69   triplhnt_sprite_zoom = (triplhnt_misc_flags >> 4) & 1;
70   triplhnt_sprite_bank = (triplhnt_misc_flags >> 7) & 1;
67   state->sprite_zoom = (state->misc_flags >> 4) & 1;
68   state->sprite_bank = (state->misc_flags >> 7) & 1;
7169
72   set_led_status(machine, 0, triplhnt_misc_flags & 0x02);
70   set_led_status(machine, 0, state->misc_flags & 0x02);
7371
74   coin_lockout_w(machine, 0, !(triplhnt_misc_flags & 0x08));
75   coin_lockout_w(machine, 1, !(triplhnt_misc_flags & 0x08));
72   coin_lockout_w(machine, 0, !(state->misc_flags & 0x08));
73   coin_lockout_w(machine, 1, !(state->misc_flags & 0x08));
7674
77   discrete_sound_w(discrete, TRIPLHNT_SCREECH_EN, triplhnt_misc_flags & 0x04);   // screech
78   discrete_sound_w(discrete, TRIPLHNT_LAMP_EN, triplhnt_misc_flags & 0x02);   // Lamp is used to reset noise
79   discrete_sound_w(discrete, TRIPLHNT_BEAR_EN, triplhnt_misc_flags & 0x80);   // bear
75   discrete_sound_w(discrete, TRIPLHNT_SCREECH_EN, state->misc_flags & 0x04);   // screech
76   discrete_sound_w(discrete, TRIPLHNT_LAMP_EN, state->misc_flags & 0x02);   // Lamp is used to reset noise
77   discrete_sound_w(discrete, TRIPLHNT_BEAR_EN, state->misc_flags & 0x80);   // bear
8078
8179   is_witch_hunt = input_port_read(machine, "0C09") == 0x40;
82   bit = ~triplhnt_misc_flags & 0x40;
80   bit = ~state->misc_flags & 0x40;
8381
8482   /* if we're not playing the sample yet, start it */
8583   if (!sample_playing(samples, 0))
r10613r10614
10199
102100static READ8_HANDLER( triplhnt_cmos_r )
103101{
104   triplhnt_cmos_latch = offset;
102   triplhnt_state *state = space->machine->driver_data<triplhnt_state>();
103   state->cmos_latch = offset;
105104
106   return triplhnt_cmos[triplhnt_cmos_latch] ^ 15;
105   return state->cmos[state->cmos_latch] ^ 15;
107106}
108107
109108
r10613r10614
116115
117116static READ8_HANDLER( triplhnt_misc_r )
118117{
118   triplhnt_state *state = space->machine->driver_data<triplhnt_state>();
119119   triplhnt_update_misc(space->machine, offset);
120   return input_port_read(space->machine, "VBLANK") | triplhnt_hit_code;
120   return input_port_read(space->machine, "VBLANK") | state->hit_code;
121121}
122122
123123
124124static READ8_HANDLER( triplhnt_da_latch_r )
125125{
126   triplhnt_state *state = space->machine->driver_data<triplhnt_state>();
126127   int cross_x = input_port_read(space->machine, "STICKX");
127128   int cross_y = input_port_read(space->machine, "STICKY");
128129
129   triplhnt_da_latch = offset;
130   state->da_latch = offset;
130131
131132   /* the following is a slight simplification */
132133
r10613r10614
137138static ADDRESS_MAP_START( triplhnt_map, ADDRESS_SPACE_PROGRAM, 8 )
138139   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
139140   AM_RANGE(0x0000, 0x00ff) AM_RAM AM_MIRROR(0x300)
140   AM_RANGE(0x0400, 0x04ff) AM_WRITEONLY AM_BASE(&triplhnt_playfield_ram)
141   AM_RANGE(0x0800, 0x080f) AM_WRITEONLY AM_BASE(&triplhnt_vpos_ram)
142   AM_RANGE(0x0810, 0x081f) AM_WRITEONLY AM_BASE(&triplhnt_hpos_ram)
143   AM_RANGE(0x0820, 0x082f) AM_WRITEONLY AM_BASE(&triplhnt_orga_ram)
144   AM_RANGE(0x0830, 0x083f) AM_WRITEONLY AM_BASE(&triplhnt_code_ram)
141   AM_RANGE(0x0400, 0x04ff) AM_WRITEONLY AM_BASE_MEMBER(triplhnt_state, playfield_ram)
142   AM_RANGE(0x0800, 0x080f) AM_WRITEONLY AM_BASE_MEMBER(triplhnt_state, vpos_ram)
143   AM_RANGE(0x0810, 0x081f) AM_WRITEONLY AM_BASE_MEMBER(triplhnt_state, hpos_ram)
144   AM_RANGE(0x0820, 0x082f) AM_WRITEONLY AM_BASE_MEMBER(triplhnt_state, orga_ram)
145   AM_RANGE(0x0830, 0x083f) AM_WRITEONLY AM_BASE_MEMBER(triplhnt_state, code_ram)
145146   AM_RANGE(0x0c00, 0x0c00) AM_READ_PORT("0C00")
146147   AM_RANGE(0x0c08, 0x0c08) AM_READ_PORT("0C08")
147148   AM_RANGE(0x0c09, 0x0c09) AM_READ_PORT("0C09")
r10613r10614
309310}
310311
311312
312static MACHINE_CONFIG_START( triplhnt, driver_device )
313static MACHINE_CONFIG_START( triplhnt, triplhnt_state )
313314
314315/* basic machine hardware */
315316   MCFG_CPU_ADD("maincpu", M6800, 800000)
src/mame/drivers/pirates.c
r10613r10614
168168   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("INPUTS")
169169   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("SYSTEM")
170170//  AM_RANGE(0x500000, 0x5007ff) AM_RAM
171   AM_RANGE(0x500000, 0x5007ff) AM_WRITEONLY AM_BASE(&pirates_spriteram)
171   AM_RANGE(0x500000, 0x5007ff) AM_WRITEONLY AM_BASE_MEMBER(pirates_state, spriteram)
172172//  AM_RANGE(0x500800, 0x50080f) AM_WRITENOP
173173   AM_RANGE(0x600000, 0x600001) AM_WRITE(pirates_out_w)
174   AM_RANGE(0x700000, 0x700001) AM_WRITEONLY AM_BASE(&pirates_scroll)   // scroll reg
174   AM_RANGE(0x700000, 0x700001) AM_WRITEONLY AM_BASE_MEMBER(pirates_state, scroll)   // scroll reg
175175   AM_RANGE(0x800000, 0x803fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE_GENERIC(paletteram)
176176   AM_RANGE(0x900000, 0x90017f) AM_RAM  // more of tilemaps ?
177   AM_RANGE(0x900180, 0x90137f) AM_RAM_WRITE(pirates_tx_tileram_w) AM_BASE(&pirates_tx_tileram)
178   AM_RANGE(0x901380, 0x902a7f) AM_RAM_WRITE(pirates_fg_tileram_w) AM_BASE(&pirates_fg_tileram)
177   AM_RANGE(0x900180, 0x90137f) AM_RAM_WRITE(pirates_tx_tileram_w) AM_BASE_MEMBER(pirates_state, tx_tileram)
178   AM_RANGE(0x901380, 0x902a7f) AM_RAM_WRITE(pirates_fg_tileram_w) AM_BASE_MEMBER(pirates_state, fg_tileram)
179179//  AM_RANGE(0x902580, 0x902a7f) AM_RAM  // more of tilemaps ?
180   AM_RANGE(0x902a80, 0x904187) AM_RAM_WRITE(pirates_bg_tileram_w) AM_BASE(&pirates_bg_tileram)
180   AM_RANGE(0x902a80, 0x904187) AM_RAM_WRITE(pirates_bg_tileram_w) AM_BASE_MEMBER(pirates_state, bg_tileram)
181181//  AM_RANGE(0x903c80, 0x904187) AM_RAM  // more of tilemaps ?
182182   AM_RANGE(0xa00000, 0xa00001) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff)
183183ADDRESS_MAP_END
r10613r10614
260260
261261/* Machine Driver + Related bits */
262262
263static MACHINE_CONFIG_START( pirates, driver_device )
263static MACHINE_CONFIG_START( pirates, pirates_state )
264264   MCFG_CPU_ADD("maincpu", M68000, 16000000) /* 16mhz */
265265   MCFG_CPU_PROGRAM_MAP(pirates_map)
266266   MCFG_CPU_VBLANK_INT("screen", irq1_line_hold)
src/tools/chdcd.c
r10613r10614
329329      return CHDERR_FILE_NOT_FOUND;
330330   }
331331
332//   printf("NER5 detected, chain offset: %x\n", chain_offs);
332//  printf("NER5 detected, chain offset: %x\n", chain_offs);
333333
334334   while (!done)
335335   {
r10613r10614
342342
343343      chunk_size = (buffer[7] | buffer[6]<<8 | buffer[5]<<16 | buffer[4]<<24);
344344
345//      printf("Chunk type: %c%c%c%c, size %x\n", buffer[0], buffer[1], buffer[2], buffer[3], chunk_size);
345//      printf("Chunk type: %c%c%c%c, size %x\n", buffer[0], buffer[1], buffer[2], buffer[3], chunk_size);
346346
347347      // we want the DAOX chunk, which has the TOC information
348348      if (!memcmp(buffer, "DAOX", 4))
r10613r10614
354354         fread(&start, 1, 1, infile);
355355         fread(&end, 1, 1, infile);
356356
357//         printf("TOC type: %08x.  Start track %d  End track: %d\n", toc_type, start, end);
357//          printf("TOC type: %08x.  Start track %d  End track: %d\n", toc_type, start, end);
358358
359359         outtoc->numtrks = (end-start) + 1;
360360
r10613r10614
371371            index1 = read_uint64(infile);
372372            index2 = read_uint64(infile);
373373
374//            printf("Track %d: sector size %d mode %x index0 %llx index1 %llx index2 %llx (pregap %d sectors, length %d sectors)\n", track, size, mode, index0, index1, index2, (UINT32)(index1-index0)/size, (UINT32)(index2-index1)/size);
374//              printf("Track %d: sector size %d mode %x index0 %llx index1 %llx index2 %llx (pregap %d sectors, length %d sectors)\n", track, size, mode, index0, index1, index2, (UINT32)(index1-index0)/size, (UINT32)(index2-index1)/size);
375375
376376            strcpy(outinfo->fname[track-1], tocfname);
377377            outinfo->offset[track-1] = offset + (UINT32)(index1-index0);
src/osd/sdl/drawsdl.c
r10613r10614
8989#if (!SDL_VERSION_ATLEAST(1,3,0))
9090   int            extra_flags;      /* Texture/surface flags */
9191#else
92   //SDL_ScaleMode   sdl_scale_mode;      /* sdl 1.3 scale mode    */
92   //SDL_ScaleMode sdl_scale_mode;     /* sdl 1.3 scale mode    */
9393   int            sdl_scale_mode;      /* got removed recently - trying to get it in again */
9494#endif
9595   int            pixel_format;      /* Pixel/Overlay format  */
src/osd/sdl/drawogl.c
r10613r10614
20912091     *
20922092     * Shape the lut texture to achieve texture max size compliance and equal 2D partitioning
20932093     */
2094   
2094
20952095   if ( texture->format == SDL_TEXFORMAT_PALETTE16 )
20962096   {
20972097      lut_texture_width  = sqrt((double)(texture->lut_table_width));
20982098      lut_texture_width  = get_valid_pow2_value (lut_texture_width, 1);
2099     
2099
21002100      texture->lut_table_height = texture->lut_table_width / lut_texture_width;
2101     
2101
21022102      if ( lut_texture_width*texture->lut_table_height < texture->lut_table_width )
21032103      {
21042104         texture->lut_table_height  += 1;
21052105      }
2106     
2106
21072107      texture->lut_table_width   = lut_texture_width;
2108   }
2108   }
21092109   else
21102110   {
21112111      lut_texture_width = texture->lut_table_width;
src/osd/sdl/window.h
r10613r10614
9696#if (SDL_VERSION_ATLEAST(1,3,0))
9797   // Needs to be here as well so we can identify window
9898   SDL_Window         *sdl_window;
99   SDL_Renderer       *sdl_renderer;
99   SDL_Renderer      *sdl_renderer;
100100   // These are used in combine resizing events ... #if SDL13_COMBINE_RESIZE
101101   int             resize_width;
102102   int               resize_height;
src/emu/cpu/m68000/m68kfpu.c
r10613r10614
13181318         m68k->remaining_cycles -= 109;
13191319         break;
13201320      }
1321//      case 0x0e:      // FSIN
1322//      {
1323//         // TODO
1324//         break;
1325//      }
1321//      case 0x0e:      // FSIN
1322//      {
1323//          // TODO
1324//          break;
1325//      }
13261326      case 0x18:      // FABS
13271327      {
13281328         REG_FP[dst] = source;
src/emu/cpu/m68000/m68k_in.c
r10613r10614
67016701                  m68k->cacr = REG_DA[(word2 >> 12) & 15] & 0x0f;
67026702               }
67036703
6704//               logerror("movec to cacr=%04x\n", m68k->cacr);
6704//                  logerror("movec to cacr=%04x\n", m68k->cacr);
67056705               if (m68k->cacr & (M68K_CACR_CI | M68K_CACR_CEI))
67066706               {
67076707                  m68ki_ic_clear(m68k);
src/emu/cpu/i386/i386priv.h
r10613r10614
892892
893893
894894/***********************************************************************************
895   I/O ACCESS
895    I/O ACCESS
896896***********************************************************************************/
897897
898898INLINE UINT8 READPORT8(i386_state *cpustate, offs_t port)
src/emu/video/generic.c
r10613r10614
445445
446446void flip_screen_set(running_machine *machine, int on)
447447{
448   flip_screen_x_set(machine, on);
449   flip_screen_y_set(machine, on);
448   generic_video_private *state = machine->generic_video_data;
449   if (on) on = ~0;
450   if (state->flip_screen_x != on || state->flip_screen_y != on)
451   {
452      if (!on) updateflip(machine); // flip visarea back
453      state->flip_screen_x = state->flip_screen_y = on;
454      updateflip(machine);
455   }
450456}
451457
452458
r10613r10614
463469     * bypass update_flip
464470     */
465471   generic_video_private *state = machine->generic_video_data;
472   if (on) on = ~0;
466473   state->flip_screen_x = on;
467474}
468475
src/emu/video.c
r10613r10614
458458         filerr = m_mngfile->open(name);
459459      else
460460         filerr = open_next(*m_mngfile, "mng");
461         
461
462462      if (filerr == FILERR_NONE)
463463      {
464464         // start the capture
r10613r10614
10961096
10971097//-------------------------------------------------
10981098//  open_next - open the next non-existing file of
1099//  type filetype according to our numbering
1099//  type filetype according to our numbering
11001100//  scheme
11011101//-------------------------------------------------
11021102
src/emu/inptport.c
r10613r10614
10031003      if (config->input_ports()!=NULL) {
10041004         input_port_list_init(machine->m_portlist, config->input_ports(), errorbuf, sizeof(errorbuf), TRUE, config);
10051005         if (errorbuf[0] != 0)
1006            mame_printf_error("Input port errors:\n%s", errorbuf);         
1006            mame_printf_error("Input port errors:\n%s", errorbuf);
10071007      }
10081008   }
10091009
r10613r10614
29372937               field_config_insert(curfield, &maskbits, errorbuf, errorbuflen);
29382938            maskbits = 0;
29392939
2940            string = TOKEN_GET_STRING(ipt);                       
2940            string = TOKEN_GET_STRING(ipt);
29412941            if (owner!=NULL) {
29422942               fulltag = core_strdup(owner->subtag(tempstring, string));
29432943            } else {
src/emu/rendlay.h
r10613r10614
152152      astring            m_string;      // string for text components
153153      bitmap_t *         m_bitmap;      // source bitmap for images
154154      astring            m_dirname;      // directory name of image file (for lazy loading)
155      emu_file *          m_file;         // file object for reading image/alpha files
155      emu_file *         m_file;         // file object for reading image/alpha files
156156      astring            m_imagefile;   // name of the image file (for lazy loading)
157157      astring            m_alphafile;   // name of the alpha file (for lazy loading)
158158      bool            m_hasalpha;      // is there any alpha component present?
src/emu/sound/rf5c68.c
r10613r10614
169169   chip->stream->update();
170170   shift = (offset & 1) ? 11 + 8 : 11;
171171
172//   printf("%08x\n",(chip->chan[(offset & 0x0e) >> 1].addr));
172//  printf("%08x\n",(chip->chan[(offset & 0x0e) >> 1].addr));
173173
174174   return (chip->chan[(offset & 0x0e) >> 1].addr) >> (shift);
175175}
src/emu/sound/okim9810.c
r10613r10614
1818const device_type OKIM9810 = okim9810_device_config::static_alloc_device_config;
1919
2020
21// volume lookup table. The manual lists a full 16 steps, 2dB per step.
21// volume lookup table. The manual lists a full 16 steps, 2dB per step.
2222// Given the dB values, that seems to map to a 7-bit volume control.
2323const UINT8 okim9810_device::okim_voice::s_volume_table[16] =
2424{
r10613r10614
4141};
4242
4343// sampling frequency lookup table.
44const UINT32 okim9810_device::s_sampling_freq_table[16] =
44const UINT32 okim9810_device::s_sampling_freq_table[16] =
4545{
4646    4000,
4747    8000,
r10613r10614
150150
151151   // create the stream
152152   //int divisor = m_config.m_pin7 ? 132 : 165;
153   m_stream = m_machine.sound().stream_alloc(*this, 0, 1, clock());
153   m_stream = m_machine.sound().stream_alloc(*this, 0, 2, clock());
154154
155155    // save state stuff
156156    // m_TMP_register
r10613r10614
196196
197197void okim9810_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
198198{
199   // reset the output stream
199   // reset the output streams
200200   memset(outputs[0], 0, samples * sizeof(*outputs[0]));
201   
201   memset(outputs[1], 0, samples * sizeof(*outputs[1]));
202
202203   // iterate over voices and accumulate sample data
203204   for (int voicenum = 0; voicenum < OKIM9810_VOICES; voicenum++)
204      m_voice[voicenum].generate_audio(*m_direct, outputs[0], samples, m_global_volume);
205      m_voice[voicenum].generate_audio(*m_direct, outputs, samples, m_global_volume, clock(), m_filter_type);
205206}
206207
207208
r10613r10614
212213UINT8 okim9810_device::read_status()
213214{
214215    UINT8 result = 0x00;
216    UINT8 channelMask = 0x01;
217    for (int i = 0; i < OKIM9810_VOICES; i++, channelMask <<= 1)
218    {
219        if (!m_voice[i].m_playing)
220            result |= channelMask;
221    }
215222   return result;
216223}
217224
218225
219226//-------------------------------------------------
220//  read - memory interface for read
227//  read - memory interface for reading the active status
221228//-------------------------------------------------
222229
223230READ8_MEMBER( okim9810_device::read )
r10613r10614
235242{
236243    const UINT8 cmd = (data & 0xf8) >> 3;
237244    const UINT8 channel = (data & 0x07);
238   
245
239246    switch(cmd)
240247    {
241248        case 0x00:  // START
242249        {
243            mame_printf_verbose("START channel mask %02x\n", m_TMP_register);
250            mame_printf_debug("START channel mask %02x\n", m_TMP_register);
244251            UINT8 channelMask = 0x01;
245252            for (int i = 0; i < OKIM9810_VOICES; i++, channelMask <<= 1)
246253            {
247254                if (channelMask & m_TMP_register)
248255                {
249256                    m_voice[i].m_playing = true;
250                    mame_printf_verbose("\t\tPlaying channel %d: encoder type %d @ %dhz (volume = %d %d).  From %08x for %d samples (looping=%d).\n",
257                    mame_printf_debug("\t\tPlaying channel %d: encoder type %d @ %dhz (volume = %d %d).  From %08x for %d samples (looping=%d).\n",
251258                                        i,
252259                                        m_voice[i].m_playbackAlgo,
253260                                        m_voice[i].m_samplingFreq,
r10613r10614
262269        }
263270        case 0x01:  // STOP
264271        {
265            mame_printf_verbose("STOP  channel mask %02x\n", m_TMP_register);
272            mame_printf_debug("STOP  channel mask %02x\n", m_TMP_register);
266273            UINT8 channelMask = 0x01;
267274            for (int i = 0; i < OKIM9810_VOICES; i++, channelMask <<= 1)
268275            {
269276                if (channelMask & m_TMP_register)
270277                {
271278                    m_voice[i].m_playing = false;
272                    mame_printf_verbose("\tChannel %d stopping.\n", i);
279                    mame_printf_debug("\tChannel %d stopping.\n", i);
273280                }
274281            }
275282            break;
276283        }
277284        case 0x02:  // LOOP
278        {
279            mame_printf_verbose("LOOP  channel mask %02x\n", m_TMP_register);
285        {
286            mame_printf_debug("LOOP  channel mask %02x\n", m_TMP_register);
280287            UINT8 channelMask = 0x01;
281288            for (int i = 0; i < OKIM9810_VOICES; i++, channelMask <<= 1)
282289            {
283290                if (channelMask & m_TMP_register)
284291                {
285292                    m_voice[i].m_looping = true;
286                    mame_printf_verbose("\tChannel %d looping.\n", i);
293                    mame_printf_debug("\tChannel %d looping.\n", i);
287294                }
288295                else
289296                {
290297                    m_voice[i].m_looping = false;
291                    mame_printf_verbose("\tChannel %d done looping.\n", i);
298                    mame_printf_debug("\tChannel %d done looping.\n", i);
292299                }
293300            }
294301            break;
295302        }
296303        case 0x03:  // OPT (options)
297304        {
298            mame_printf_verbose("OPT   complex data %02x\n", m_TMP_register);
305            mame_printf_debug("OPT   complex data %02x\n", m_TMP_register);
299306            m_global_volume = (m_TMP_register & 0x18) >> 3;
300307            m_filter_type =   (m_TMP_register & 0x06) >> 1;
301308            m_output_level =  (m_TMP_register & 0x01);
302            mame_printf_verbose("\tOPT setting main volume scale to Vdd/%d\n", m_global_volume+1);
303            mame_printf_verbose("\tOPT setting output filter type to %d\n", m_filter_type);
304            mame_printf_verbose("\tOPT setting output amp level to %d\n", m_output_level);
309            mame_printf_debug("\tOPT setting main volume scale to Vdd/%d\n", m_global_volume+1);
310            mame_printf_debug("\tOPT setting output filter type to %d\n", m_filter_type);
311            mame_printf_debug("\tOPT setting output amp level to %d\n", m_output_level);
305312            break;
306313        }
307314        case 0x04:  // MUON (silence)
308315        {
309            mame_printf_warning("MUON  channel %d length %02x\n", channel, m_TMP_register);
316            mame_printf_warning("MUON  channel %d length %02x\n", channel, m_TMP_register);
310317            mame_printf_warning("MSM9810: UNIMPLEMENTED COMMAND!\n");
311318            break;
312319        }
313       
320
314321        case 0x05:  // FADR (phrase address)
315322        {
316323            const offs_t base = m_TMP_register * 8;
317324
318325            offs_t startAddr;
319            const UINT8 startFlags = m_direct->read_raw_byte(base + 0);
326            UINT8 startFlags = m_direct->read_raw_byte(base + 0);
320327            startAddr  = m_direct->read_raw_byte(base + 1) << 16;
321328            startAddr |= m_direct->read_raw_byte(base + 2) << 8;
322329            startAddr |= m_direct->read_raw_byte(base + 3) << 0;
323330
324331            offs_t endAddr;
325            const UINT8 endFlags = m_direct->read_raw_byte(base + 4);
332            UINT8 endFlags = m_direct->read_raw_byte(base + 4);
326333            endAddr  = m_direct->read_raw_byte(base + 5) << 16;
327334            endAddr |= m_direct->read_raw_byte(base + 6) << 8;
328335            endAddr |= m_direct->read_raw_byte(base + 7) << 0;
r10613r10614
330337            // Sub-table
331338            if (startFlags & 0x80)
332339            {
333                offs_t oldStart = startAddr;
334                // TODO: What does byte (oldStart + 0) refer to?
335                startAddr  = m_direct->read_raw_byte(oldStart + 1) << 16;
336                startAddr |= m_direct->read_raw_byte(oldStart + 2) << 8;
337                startAddr |= m_direct->read_raw_byte(oldStart + 3) << 0;
338               
339                // TODO: What does byte (oldStart + 4) refer to?
340                endAddr  = m_direct->read_raw_byte(oldStart + 5) << 16;
341                endAddr |= m_direct->read_raw_byte(oldStart + 6) << 8;
342                endAddr |= m_direct->read_raw_byte(oldStart + 7) << 0;
340                offs_t subTable = startAddr;
341                // TODO: New startFlags &= 0x80.  Are there further subtables?
342                startFlags = m_direct->read_raw_byte(subTable + 0);
343                startAddr  = m_direct->read_raw_byte(subTable + 1) << 16;
344                startAddr |= m_direct->read_raw_byte(subTable + 2) << 8;
345                startAddr |= m_direct->read_raw_byte(subTable + 3) << 0;
346
347                // TODO: What does byte (subTable + 4) refer to?
348                endAddr  = m_direct->read_raw_byte(subTable + 5) << 16;
349                endAddr |= m_direct->read_raw_byte(subTable + 6) << 8;
350                endAddr |= m_direct->read_raw_byte(subTable + 7) << 0;
343351            }
344352
345353            m_voice[channel].m_sample = 0;
354            m_voice[channel].m_interpSampleNum = 0;
346355            m_voice[channel].m_startFlags = startFlags;
347356            m_voice[channel].m_base_offset = startAddr;
348357            m_voice[channel].m_endFlags = endFlags;
349            m_voice[channel].m_count = (endAddr-startAddr) + 1;             // Is there yet another extra byte at the end?
358            m_voice[channel].m_count = (endAddr-startAddr) + 1;     // Is there yet another extra byte at the end?
350359
351            m_voice[channel].m_playbackAlgo = (startFlags & 0x30) >> 4;     // Guess
360            m_voice[channel].m_playbackAlgo = (startFlags & 0x30) >> 4;
352361            m_voice[channel].m_samplingFreq = s_sampling_freq_table[startFlags & 0x0f];
353            if (m_voice[channel].m_playbackAlgo == OKIM9810_ADPCM_PLAYBACK ||
362            if (m_voice[channel].m_playbackAlgo == OKIM9810_ADPCM_PLAYBACK ||
354363                m_voice[channel].m_playbackAlgo == OKIM9810_ADPCM2_PLAYBACK)
355364                m_voice[channel].m_count *= 2;
356365            else
357                mame_printf_warning("UNIMPLEMENTED PLAYBACK METHOD %d\n", m_voice[channel].m_playbackAlgo);
366                mame_printf_warning("MSM9810: UNIMPLEMENTED PLAYBACK METHOD %d\n", m_voice[channel].m_playbackAlgo);
358367
359            mame_printf_verbose("FADR  channel %d phrase offset %02x => ", channel, m_TMP_register);
360            mame_printf_verbose("startFlags(%02x) startAddr(%06x) endFlags(%02x) endAddr(%06x) bytes(%d)\n", startFlags, startAddr, endFlags, endAddr, endAddr-startAddr);
368            mame_printf_debug("FADR  channel %d phrase offset %02x => ", channel, m_TMP_register);
369            mame_printf_debug("startFlags(%02x) startAddr(%06x) endFlags(%02x) endAddr(%06x) bytes(%d)\n", startFlags, startAddr, endFlags, endAddr, endAddr-startAddr);
361370            break;
362371        }
363372
r10613r10614
369378        }
370379        case 0x07:  // CVOL (channel volume)
371380        {
372            mame_printf_verbose("CVOL  channel %d data %02x\n", channel, m_TMP_register);
373            mame_printf_verbose("\tChannel %d -> volume index %d.\n", channel, m_TMP_register & 0x0f);
381            mame_printf_debug("CVOL  channel %d data %02x\n", channel, m_TMP_register);
382            mame_printf_debug("\tChannel %d -> volume index %d.\n", channel, m_TMP_register & 0x0f);
374383
375384            m_voice[channel].m_channel_volume = m_TMP_register & 0x0f;
376385            break;
r10613r10614
379388        {
380389            const UINT8 leftVolIndex = (m_TMP_register & 0xf0) >> 4;
381390            const UINT8 rightVolIndex = m_TMP_register & 0x0f;
382            mame_printf_verbose("PAN   channel %d left index: %02x right index: %02x (%02x)\n", channel, leftVolIndex, rightVolIndex, m_TMP_register);
383            mame_printf_verbose("\tChannel %d left -> %d right -> %d\n", channel, leftVolIndex, rightVolIndex);
391            mame_printf_debug("PAN   channel %d left index: %02x right index: %02x (%02x)\n", channel, leftVolIndex, rightVolIndex, m_TMP_register);
392            mame_printf_debug("\tChannel %d left -> %d right -> %d\n", channel, leftVolIndex, rightVolIndex);
384393            m_voice[channel].m_pan_volume_left = leftVolIndex;
385394            m_voice[channel].m_pan_volume_right = rightVolIndex;
386395            break;
387396        }
388        default:
397        default:
389398        {
390399            mame_printf_warning("MSM9810: UNKNOWN COMMAND!\n");
391400            break;
r10613r10614
435444     m_sample(0),
436445      m_channel_volume(0x00),
437446     m_pan_volume_left(0x00),
438      m_pan_volume_right(0x00)
447      m_pan_volume_right(0x00),
448      m_startSample(0),
449      m_endSample(0),
450      m_interpSampleNum(0)
439451{
440452}
441453
r10613r10614
444456//  add them to an output stream
445457//-------------------------------------------------
446458
447void okim9810_device::okim_voice::generate_audio(direct_read_data &direct,
448                                       stream_sample_t *buffer,
459void okim9810_device::okim_voice::generate_audio(direct_read_data &direct,
460                                       stream_sample_t **buffers,
449461                                       int samples,
450                                       const UINT8 global_volume)
462                                       const UINT8 global_volume,
463                                                 const UINT32 clock,
464                                                 const UINT8 filter_type)
451465{
452466   // skip if not active
453467   if (!m_playing)
454468      return;
455469
456    // TODO: Stereo (it's only mono now [left channel])
470   // seperate out left and right channels
471   stream_sample_t *outL = buffers[0];
472    stream_sample_t *outR = buffers[1];
473
474    // get left and right volumes
457475   UINT8 volume_scale_left = volume_scale(global_volume, m_channel_volume, m_pan_volume_left);
476   UINT8 volume_scale_right = volume_scale(global_volume, m_channel_volume, m_pan_volume_right);
458477
478    // total samples per byte
479    UINT32 totalInterpSamples = clock / m_samplingFreq;
480
459481   // loop while we still have samples to generate
460482   while (samples-- != 0)
461483   {
462      // fetch the next sample nibble
463      int nibble = direct.read_raw_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4);
464
465      // output to the buffer, scaling by the volume
466      // signal in range -2048..2047, volume in range 2..128 => signal * volume / 8 in range -32768..32767
467        switch (m_playbackAlgo)
484        // If interpSampleNum == 0, we are at the beginning of a new interp chunk, gather data
485        if (m_interpSampleNum == 0)
468486        {
469            case OKIM9810_ADPCM_PLAYBACK:
487            // If m_sample == 0, we have begun to play a new voice.  Get both the first nibble & the second.
488            if (m_sample == 0)
470489            {
471                INT32 volSample = (INT32)m_adpcm.clock(nibble);
472                volSample = (volSample * (INT32)volume_scale_left) / 8;
473              *buffer++ += volSample;
474                break;
490                // fetch the first sample nibble
491              int nibble0 = direct.read_raw_byte(m_base_offset + m_sample / 2) >> (((m_sample & 1) << 2) ^ 4);
492                switch (m_playbackAlgo)
493                {
494                    case OKIM9810_ADPCM_PLAYBACK:
495                    {
496                        m_adpcm.reset();
497                        m_startSample = (INT32)m_adpcm.clock(nibble0);
498                        break;
499                    }
500                    case OKIM9810_ADPCM2_PLAYBACK:
501                    {
502                        m_adpcm2.reset();
503                        m_startSample = (INT32)m_adpcm2.clock(nibble0);
504                        break;
505                    }
506                    default:
507                        break;
508                }
475509            }
476            case OKIM9810_ADPCM2_PLAYBACK:
510            else
477511            {
478                INT32 volSample = (INT32)m_adpcm2.clock(nibble);
479                volSample = (volSample * (INT32)volume_scale_left) / 8;
480              *buffer++ += volSample;
481                break;
512                // Otherwise just move the second nibble back to the first spot.
513                m_startSample = m_endSample;
482514            }
483            default:
484                break;
515
516            // And fetch the second sample nibble
517            int nibble1 = direct.read_raw_byte(m_base_offset + (m_sample+1) / 2) >> ((((m_sample+1) & 1) << 2) ^ 4);
518            switch (m_playbackAlgo)
519            {
520                case OKIM9810_ADPCM_PLAYBACK:
521                {
522                    m_endSample = (INT32)m_adpcm.clock(nibble1);
523                    break;
524                }
525                case OKIM9810_ADPCM2_PLAYBACK:
526                {
527                    m_endSample = (INT32)m_adpcm2.clock(nibble1);
528                    break;
529                }
530                default:
531                    break;
532            }
485533        }
486                   
487      // next!
488      if (++m_sample >= m_count)
534
535        // TODO: Interpolate using proper numeric types.
536        float progress = (float)m_interpSampleNum / (float)totalInterpSamples;
537        INT32 interpValue = (INT32)((float)m_startSample + (((float)m_endSample-(float)m_startSample) * progress));
538
539        // if filtering is unwanted
540        if (filter_type != OKIM9810_SECONDARY_FILTER && filter_type != OKIM9810_PRIMARY_FILTER)
541            interpValue = m_startSample;
542
543      // output to the stereo buffers, scaling by the volume
544      // signal in range -2048..2047, volume in range 2..128 => signal * volume / 8 in range -32768..32767
545        INT32 interpValueL = (interpValue * (INT32)volume_scale_left) / 8;
546        *outL++ += interpValueL;
547
548        INT32 interpValueR = (interpValue * (INT32)volume_scale_right) / 8;
549        *outR++ += interpValueR;
550
551      // if the interpsample has reached its end, move on to the next sample
552        m_interpSampleNum++;
553        if (m_interpSampleNum >= totalInterpSamples)
554        {
555            m_interpSampleNum = 0;
556            m_sample++;
557        }
558
559        // the end of the stream has been reached
560      if (m_sample >= m_count)
489561      {
490562            if (!m_looping)
563            {
491564             m_playing = false;
565                break;
566            }
492567            else
568            {
493569                m_sample = 0;
494         break;
570            }
495571      }
496572   }
497573}
498574
499575
500576//-------------------------------------------------
501//  volume_scale - computes the volume equation as
502//                 seen on page 29 of the docs. 
577//  volume_scale - computes the volume equation as
578//                 seen on page 29 of the docs.
503579//  Returns a value from the volume lookup table.
504580//-------------------------------------------------
505581
506UINT8 okim9810_device::okim_voice::volume_scale(const UINT8 global_volume,
507                                            const UINT8 channel_volume,
508                                                const UINT8 pan_volume) const
582UINT8 okim9810_device::okim_voice::volume_scale(const UINT8 global_volume_index,
583                                            const UINT8 channel_volume_index,
584                                                const UINT8 pan_volume_index) const
509585{
510    const UINT8& V = channel_volume;
511    const UINT8& L = pan_volume;
512    const UINT8& O = global_volume;
586    const UINT8& V = channel_volume_index;
587    const UINT8& L = pan_volume_index;
588    const UINT8& O = global_volume_index;
513589    UINT32 index = (V+L) + (O*3);
514   
590
515591    if (index > 15)
516592        index = 15;
517   
593
518594    return s_volume_table[index];
519595}
src/emu/sound/okim9810.h
r10613r10614
44
55    OKI MSM9810 ADCPM(2) sound chip.
66
7   Notes:
8   The master clock frequency for this chip can range from 3.5MHz to 4.5Mhz.
7    Notes:
8    The master clock frequency for this chip can range from 3.5MHz to 4.5Mhz.
99      The typical oscillator is a 4.096Mhz crystal.
1010
1111***************************************************************************/
r10613r10614
2424
2525enum
2626{
27   OKIM9810_SERIAL_PIN_LOW = 0,
28   OKIM9810_SERIAL_PIN_HIGH = 1,
29    // etc
30};
31
32enum
33{
3427   OKIM9810_ADPCM_PLAYBACK = 0,
3528   OKIM9810_ADPCM2_PLAYBACK = 1,
3629   OKIM9810_STRAIGHT8_PLAYBACK = 2,
r10613r10614
131124   {
132125   public:
133126      okim_voice();
134      void generate_audio(direct_read_data &direct,
135                         stream_sample_t *buffer,
127      void generate_audio(direct_read_data &direct,
128                         stream_sample_t **buffers,
136129                         int samples,
137                         const UINT8 global_volume);
130                         const UINT8 global_volume,
131                            const UINT32 clock,
132                            const UINT8 filter_type);
138133
139134        // computes volume scale from 3 volume numbers
140135      UINT8 volume_scale(const UINT8 global_volume,
141136                     const UINT8 channel_volume,
142137                         const UINT8 pan_volume) const;
143138
144      oki_adpcm_state m_adpcm;      // current ADPCM state
145      oki_adpcm2_state m_adpcm2;      // current ADPCM2 state
146      UINT8      m_playbackAlgo;      // current playback method
147      bool      m_looping;
148      UINT8      m_startFlags;
149      UINT8      m_endFlags;
150      offs_t      m_base_offset;      // pointer to the base memory location
151      UINT32      m_count;         // total samples to play
152      UINT32      m_samplingFreq;      // voice sampling frequency
139      oki_adpcm_state m_adpcm;   // current ADPCM state
140      oki_adpcm2_state m_adpcm2;   // current ADPCM2 state
141      UINT8   m_playbackAlgo;      // current playback method
142      bool   m_looping;
143      UINT8   m_startFlags;
144      UINT8   m_endFlags;
145      offs_t   m_base_offset;      // pointer to the base memory location
146      UINT32   m_count;         // total samples to play
147      UINT32   m_samplingFreq;      // voice sampling frequency
153148
154      bool      m_playing;         // playback state
155      UINT32      m_sample;         // current sample number
149      bool   m_playing;         // playback state
150      UINT32   m_sample;         // current sample number
156151
157      UINT8      m_channel_volume;   // volume set with the CVOL command
158      UINT8      m_pan_volume_left;  // volume set with the PAN command
159      UINT8      m_pan_volume_right; // volume set with the PAN command
152      UINT8   m_channel_volume;   // volume index set with the CVOL command
153      UINT8   m_pan_volume_left;  // volume index set with the PAN command
154      UINT8   m_pan_volume_right; // volume index set with the PAN command
160155
156        INT32   m_startSample;      // interpolation state - sample to interpolate from
157        INT32   m_endSample;      // interpolation state - sample to interpolate to
158        UINT32   m_interpSampleNum;   // interpolation state - fraction between start & end
159
161160      static const UINT8 s_volume_table[16];
162161   };
163162
r10613r10614
169168   direct_read_data* m_direct;
170169
171170    UINT8 m_TMP_register;
172   
173   UINT8 m_global_volume;      // volume set with the OPT command
174    UINT8 m_filter_type;
175   UINT8 m_output_level;
176171
172   UINT8 m_global_volume;      // volume index set with the OPT command
173    UINT8 m_filter_type;      // interpolation filter type set with the OPT command
174   UINT8 m_output_level;      // flag stating if a voltage follower is connected
175
177176   static const int OKIM9810_VOICES = 8;
178177   okim_voice m_voice[OKIM9810_VOICES];
179178
src/emu/sound/aica.c
r10613r10614
135135#define MIFULL(aica)      ((aica->udata.data[4]>>0x0)&0x0200)
136136#define MIEMPTY(aica)      ((aica->udata.data[4]>>0x0)&0x0100)
137137
138#define AFSEL(aica)      ((aica->udata.data[6]>>0x0)&0x4000)
139#define MSLC(aica)      ((aica->udata.data[6]>>0x8)&0x3F)
138#define AFSEL(aica)      ((aica->udata.data[0xc/2]>>0x0)&0x4000)
139#define MSLC(aica)      ((aica->udata.data[0xc/2]>>0x8)&0x3F)
140140
141141#define SCILV0(aica)       ((aica->udata.data[0xa8/2]>>0x0)&0xff)
142142#define SCILV1(aica)       ((aica->udata.data[0xac/2]>>0x0)&0xff)
143143#define SCILV2(aica)       ((aica->udata.data[0xb0/2]>>0x0)&0xff)
144144
145#define MCIEB(aica)    ((aica->udata.data[0xb4/2]>>0x0)&0xff)
146#define MCIPD(aica)    ((aica->udata.data[0xb8/2]>>0x0)&0xff)
147#define MCIRE(aica)    ((aica->udata.data[0xbc/2]>>0x0)&0xff)
148
145149#define SCIEX0   0
146150#define SCIEX1   1
147151#define SCIEX2   2
r10613r10614
802806            AICA->IrqMidi=DecodeSCI(AICA,SCIMID);
803807         }
804808         break;
809
810      case 0xb4:
811      case 0xb5:
812      case 0xb6:
813      case 0xb7:
814         if (MCIEB(AICA) & 0x20)
815         {
816            logerror("AICA: Interrupt requested on SH-4!\n");
817         }
818         break;
805819   }
806820}
807821
r10613r10614
833847      case 0x10:   // LP check
834848      case 0x11:
835849         {
836            int MSLC = (AICA->udata.data[0xc/2]>>8) & 0x3f;   // which slot are we monitoring?
850            int slotnum = MSLC(AICA);
851            struct _SLOT *slot=AICA->Slots + slotnum;
852            UINT16 LP = 0;
837853            if (!(AFSEL(AICA)))
838854            {
839               struct _SLOT *slot=AICA->Slots + MSLC;
840               UINT16 LP;
841855               UINT16 SGC;
842856               int EG;
843857
r10613r10614
851865
852866               AICA->udata.data[0x10/2] = (EG & 0x1FF8) | SGC | LP;
853867            }
868            else
869            {
870               LP = slot->lpend ? 0x8000 : 0x0000;
871               AICA->udata.data[0x10/2] = LP;
872            }
854873         }
855874         break;
856875
857876      case 0x14:   // CA (slot address)
858877      case 0x15:
859878         {
860            int MSLC = (AICA->udata.data[0xc/2]>>8) & 0x3f;   // which slot are we monitoring?
861            unsigned int CA = AICA->Slots[MSLC].cur_addr>>(SHIFT+12);
879            int slotnum = MSLC(AICA);
880            struct _SLOT *slot=AICA->Slots+slotnum;
881            unsigned int CA = 0;
862882
883            if (PCMS(slot) == 0)   // 16-bit samples
884            {
885               CA = (slot->cur_addr>>(SHIFT-1))&AICA->RAM_MASK16;
886            }
887            else   // 8-bit PCM and 4-bit ADPCM
888            {
889               CA = (slot->cur_addr>>SHIFT)&AICA->RAM_MASK;
890            }
891
863892            AICA->udata.data[0x14/2] = CA;
864893         }
865894         break;
src/emu/sound/sn76496.c
r10613r10614
104104  frequency register, while the others have 0x400 as before. Should fix a bug
105105  or two on sega games, particularly Vigilante on Sega Master System. Verified
106106  on SMS hardware.
107 
107
108108  TODO: * Implement the TMS9919 - any difference to sn94624?
109109        * Implement the T6W28; has registers in a weird order, needs writes
110110          to be 'sanitized' first. Also is stereo, similar to game gear.
src/emu/sound/spu_tables.c
r10613r10614
455455         0x0334, 0x01B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
456456         0x0000, 0x0000, 0x01B4, 0x0136, 0x00B8, 0x005C, 0x8000, 0x8000
457457      },
458      { // made up from studio small      [used by BOF3]
458      { // made up from studio small      [used by BOF3]
459459         -0.3112f,
460460         0.7832f,
461461
r10613r10614
476476         0x031C, 0x025D, 0x025C, 0x018E, 0x022F, 0x0135, 0x01D2, 0x00B7,
477477         0x018F, 0x00B5, 0x00B4, 0x0080, 0x004C, 0x0026, 0x8000, 0x8000
478478      },
479      { // made up from studio large      [used by Fighters Impact]
479      { // made up from studio large      [used by Fighters Impact]
480480         -0.3112f,
481481         0.7832f,
482482
src/emu/sound/spu.c
r10613r10614
11/*
2
2
33    Sony PlayStation SPU (CXD2922BQ/CXD2925Q) emulator
44    by pSXAuthor
55    MAME adaptation by R. Belmont
6
6
77*/
88
99#include "emu.h"
r10613r10614
2323//#define show_xa_debug
2424
2525//#ifndef _FINAL
26//   #define show_cache_update
26//  #define show_cache_update
2727//#endif
2828
2929#ifdef show_xa_debug
r10613r10614
3232   #define debug_xa if (0)
3333#endif
3434
35//                                   
3635//
3736//
37//
3838INLINE unsigned int min(unsigned int a, unsigned int b)
3939{
4040   return (a > b) ? b : a;
r10613r10614
125125};
126126
127127static const unsigned int sound_buffer_size=65536*4,
128                                        xa_sector_size=(18*28*8)<<1,
129                                        xa_buffer_sectors=16,
130                                        cdda_sector_size=2352,
131                                        cdda_buffer_sectors=16,
128                                       xa_sector_size=(18*28*8)<<1,
129                                       xa_buffer_sectors=16,
130                                       cdda_sector_size=2352,
131                                       cdda_buffer_sectors=16,
132132                                       num_loop_cache_packets=4,
133133                                       num_loop_cache_samples=num_loop_cache_packets*28,
134134                                       spu_ram_size=512*1024,
r10613r10614
341341   static unsigned int cache_size;
342342
343343   sample_cache()
344      :    invalid_start(0xffffffff),
344      :   invalid_start(0xffffffff),
345345         invalid_end(0),
346346         last_update_end(0xffffffff),
347347         data(NULL),
r10613r10614
527527public:
528528   stream_buffer(const unsigned int _sector_size,
529529                        const unsigned int _num_sectors)
530      :    head(0),
530      :   head(0),
531531         tail(0),
532532         in(0),
533533         sector_size(_sector_size),
534534         num_sectors(_num_sectors),
535         marker_head(NULL),
535         marker_head(NULL),
536536         marker_tail(NULL)
537537   {
538538      buffer_size=sector_size*num_sectors;
r10613r10614
575575
576576      while ((marker_tail) && (marker_tail->sector>=sector))
577577      {
578//         debug_xa("flushing: %d\n", marker_tail->sector);
578//          debug_xa("flushing: %d\n", marker_tail->sector);
579579
580580         stream_marker *xam=marker_tail;
581581         head=xam->offset;
r10613r10614
622622         bool passed=(((olddist==0) && (dist!=0)) || (dist>olddist));
623623         if (! passed) break;
624624
625//         debug_xa("passed: %d\n",marker_head->sector);
625//          debug_xa("passed: %d\n",marker_head->sector);
626626
627627         stream_marker *xam=marker_head;
628628         marker_head=xam->next;
r10613r10614
896896{
897897   if ((cache) && (! cache->valid))
898898   {
899/*      log(log_spu,"cache_pointer::update: block %08x-%08x invalidated %08x-%08x\n",
900                        cache->start,
901                        cache->end,
902                        cache->invalid_start,
903                        cache->invalid_end);*/
899/*      log(log_spu,"cache_pointer::update: block %08x-%08x invalidated %08x-%08x\n",
900                                cache->start,
901                                cache->end,
902                                cache->invalid_start,
903                                cache->invalid_end);*/
904904
905905      if (! cache->try_update(spu))
906906      {
r10613r10614
13351335               case 3: printf("exp dec: phase=%d val=%02x\n",(newval>>12)&1,newval&0x7f); break;
13361336            }
13371337            #endif
1338         }
1338         }
13391339         else
13401340         {
13411341            voice[v].vol[ch]=((int)newval<<17)>>17;
r10613r10614
13971397   for (unsigned int a=sc->start; a<sc->end; a+=16)
13981398      cache[a>>4]=NULL;
13991399
1400/*   log_static(log_spu,"cache_invalidate: %08x->%08x\n",
1401                               sc->start,
1402                               sc->end);*/
1400/*  log_static(log_spu,"cache_invalidate: %08x->%08x\n",
1401                                         sc->start,
1402                                         sc->end);*/
14031403
14041404   sc->invalid_start=min(sc->invalid_start,istart);
14051405   sc->invalid_end=max(sc->invalid_end,iend);
r10613r10614
14131413
14141414void spu_device::invalidate_cache(const unsigned int st, const unsigned int en)
14151415{
1416    for (unsigned int a=st; a<en; a+=16)
1417       if (cache[a>>4]) flush_cache(cache[a>>4],st,en);
1416   for (unsigned int a=st; a<en; a+=16)
1417      if (cache[a>>4]) flush_cache(cache[a>>4],st,en);
14181418}
14191419
14201420//
r10613r10614
14231423
14241424spu_device::sample_cache *spu_device::get_sample_cache(const unsigned int addr)
14251425{
1426//   log_static(log_spu,"get_sample_cache: %08x\n",addr);
1426//  log_static(log_spu,"get_sample_cache: %08x\n",addr);
14271427
14281428   assert(addr<spu_ram_size);
14291429   sample_cache *sc=cache[addr>>4];
r10613r10614
14661466   sc->dend=dp;
14671467   sc->add_ref();
14681468
1469/*   log_static(log_spu,"cache_add: %08x->%08x\n",
1470                               sc->start,
1471                               sc->end);*/
1469/*  log_static(log_spu,"cache_add: %08x->%08x\n",
1470                                         sc->start,
1471                                         sc->end);*/
14721472
14731473   return sc;
14741474}
r10613r10614
16421642
16431643void spu_device::update_voice_loop(const unsigned int v)
16441644{
1645//   voicereg *vr=&spureg.voice[v];
1645//  voicereg *vr=&spureg.voice[v];
16461646   voiceinfo *vi=&voice[v];
16471647   unsigned int ra = 0;
16481648
r10613r10614
17231723//
17241724// Process voice state and build output segments
17251725//
1726//   Input:   const unsigned int v      Voice number
1727//               const unsigned int sz      Amount of time to process (in output samples)
1728//          unsigned int *tleft         Returned number of output samples remaining
1726//  Input:  const unsigned int v        Voice number
1727//                  const unsigned int sz       Amount of time to process (in output samples)
1728//          unsigned int *tleft         Returned number of output samples remaining
17291729//
1730//   Output:   bool                              true if voice is still playing
1730//  Output: bool                                        true if voice is still playing
17311731//
17321732
17331733bool spu_device::process_voice(const unsigned int v,
r10613r10614
17611761
17621762      unsigned int ntoplay=fm?1:num,
17631763                         nextevent=min(vi->samplestoend,
1764                                              min(vi->samplestoirq,vi->envsamples));
1764                                              min(vi->samplestoirq,vi->envsamples));
17651765      ntoplay=min(ntoplay,nextevent);
17661766
17671767      if (ntoplay)
r10613r10614
19311931//
19321932// Generate voice output samples
19331933//
1934//   Inputs:   const unsigned int v      Voice number
1935//            void *ptr                        Output buffer (if no reverb)
1936//          const unsigned int sz      Number of samples to output
1934//  Inputs: const unsigned int v        Voice number
1935//            void *ptr                             Output buffer (if no reverb)
1936//          const unsigned int sz       Number of samples to output
19371937//
19381938
19391939void spu_device::generate_voice(const unsigned int v,
r10613r10614
19771977
19781978   vi->env_level+=(n*vi->env_delta);
19791979
1980   if (noiseptr)       
1980   if (noiseptr)
19811981   {
19821982      INT64 dptr=((INT64)n*vi->pitch)+vi->dptr;
19831983      unsigned int d=(unsigned int)(dptr>>12);
r10613r10614
20872087               sp+=(dptr>>12);
20882088               dptr&=0xfff;
20892089            }
2090         }
2090         }
20912091         else
20922092         {
20932093            while (n--)
r10613r10614
21262126
21272127            if (! nsp)
21282128            {
2129                update_voice_loop(v);
2129               update_voice_loop(v);
21302130               if (vi->loop) nsp=vi->loop_cache->data;
21312131            }
21322132
r10613r10614
21432143
21442144                  v+=((nv-v)*(int)dptr)>>12;
21452145
2146                  int l=(v*env_l)>>15,
2146                  int l=(v*env_l)>>15,
21472147                        r=(v*env_r)>>15;
21482148                  env_l+=envdelta_l;
21492149                  env_r+=envdelta_r;
r10613r10614
21722172
21732173                  v+=((nv-v)*(int)dptr)>>12;
21742174
2175                  int l=(v*env_l)>>15,
2175                  int l=(v*env_l)>>15,
21762176                        r=(v*env_r)>>15;
21772177                  env_l+=envdelta_l;
21782178                  env_r+=envdelta_r;
r10613r10614
22872287
22882288         case 3: // sustain end
22892289            voice[v].envsamples=infinity;
2290             voice[v].env_delta=0.0f;
2290            voice[v].env_delta=0.0f;
22912291            if (voice[v].env_sr<=0.0f)
22922292            {
22932293               voice[v].env_level=0.0f;
r10613r10614
23292329{
23302330   voice[v].loop.reset();
23312331
2332//   printf("key_on: %d @ %x (pitch %x)\n", v, spureg.voice[v].addr<<3, spureg.voice[v].pitch);
2332//  printf("key_on: %d @ %x (pitch %x)\n", v, spureg.voice[v].addr<<3, spureg.voice[v].pitch);
23332333
23342334   translate_sample_addr(spureg.voice[v].addr<<3,&voice[v].play);
23352335   assert(voice[v].play.ptr<voice[v].play.cache->dend);
r10613r10614
23442344   voice[v].forceloop=false;
23452345
23462346   // Note: ChronoCross has note hang problems if this is 0 immediately
2347   //          after key on
2347   //          after key on
23482348   spureg.voice[v].curvol=1;
23492349
23502350   for (unsigned int ch=0; ch<2; ch++)
r10613r10614
23922392      }
23932393   } else
23942394   {
2395       voice[v].env_sr=get_linear_rate((spureg.voice[v].srrr&srrr_sr_mask)>>srrr_sr_shift);
2395      voice[v].env_sr=get_linear_rate((spureg.voice[v].srrr&srrr_sr_mask)>>srrr_sr_shift);
23962396      if (spureg.voice[v].srrr&srrr_sd)
23972397         voice[v].env_sr=-voice[v].env_sr;
23982398   }
r10613r10614
24332433   {
24342434      // Don't start playing until 8 frames worth of data are in
24352435
2436     if ((! xa_playing) && (xa_buffer->get_bytes_in()<(xa_spf<<3)))
2436   if ((! xa_playing) && (xa_buffer->get_bytes_in()<(xa_spf<<3)))
24372437      {
2438//         debug_xa("waiting...\n");
2439        return;
2438//          debug_xa("waiting...\n");
2439      return;
24402440      }
24412441
24422442      xa_playing=true;
r10613r10614
25872587
25882588void spu_device::key_off(const int v)
25892589{
2590//   printf("key_off: %d\n", v);
2590//  printf("key_off: %d\n", v);
25912591
25922592   if (voice[v].env_state<=3)
25932593   {
r10613r10614
26082608
26092609      if (cur_reverb_preset==NULL)
26102610      {
2611//         printf("spu: reverb=unknown (reg 1c0 = %x)\n", reg[0x1c0]);
2611//          printf("spu: reverb=unknown (reg 1c0 = %x)\n", reg[0x1c0]);
26122612      } else
26132613      {
2614//         printf("spu: reverb=%s\n",cur_reverb_preset->name);
2614//          printf("spu: reverb=%s\n",cur_reverb_preset->name);
26152615         spu_reverb_cfg=&cur_reverb_preset->cfg;
26162616
26172617         if ((mame_stricmp("reverb off",cur_reverb_preset->name)) && (spu_reverb_cfg->band_gain<=0.0f))
26182618         {
2619//            printf("spu: no reverb config for %s\n",cur_reverb_preset->name);
2619//              printf("spu: no reverb config for %s\n",cur_reverb_preset->name);
26202620         }
26212621      }
26222622
r10613r10614
29702970         for (int i=0; i<28; i++)
29712971         {
29722972            short d=xa[16+(i<<2)+s],
2973                      d0=(d&0xf)<<12,
2974                      d1=(d>>4)<<12;
2973                     d0=(d&0xf)<<12,
2974                     d1=(d>>4)<<12;
29752975            d0=clamp((int)(d0>>shift0)+(((l0*f0)+(l1*f1)+32)>>6));
29762976            *dp++=d0;
29772977            l1=l0;
r10613r10614
30003000/*
30013001enum
30023002{
3003   xaencoding_stereo_mask=3,
3004   xaencoding_freq_shift=2,
3005   xaencoding_freq_mask=3<<xaencoding_freq_shift,
3006   xaencoding_bps_shift=4,
3007   xaencoding_bps_mask=3<<xaencoding_bps_shift,
3008   xaencoding_emphasis=(1<<6)
3003    xaencoding_stereo_mask=3,
3004    xaencoding_freq_shift=2,
3005    xaencoding_freq_mask=3<<xaencoding_freq_shift,
3006    xaencoding_bps_shift=4,
3007    xaencoding_bps_mask=3<<xaencoding_bps_shift,
3008    xaencoding_emphasis=(1<<6)
30093009};
30103010*/
30113011
r10613r10614
30153015
30163016   if (xa_buffer->get_bytes_free()<xa_sector_size) return false;
30173017
3018//   debug_xa("play_xa: %d\n",sector);
3018//  debug_xa("play_xa: %d\n",sector);
30193019
30203020   // Get XA format from sector header
30213021
r10613r10614
30773077
30783078void spu_device::flush_xa(const unsigned int sector)
30793079{
3080//   debug_xa("flush_xa: %d\n",sector);
3080//  debug_xa("flush_xa: %d\n",sector);
30813081
30823082   if (xa_playing)
30833083   {
r10613r10614
31073107
31083108void spu_device::flush_cdda(const unsigned int sector)
31093109{
3110//   debug_xa("flush_cdda: %d\n",sector);
3110//  debug_xa("flush_cdda: %d\n",sector);
31113111
31123112   if (cdda_playing)
31133113   {
r10613r10614
31343134   spu_device *spu = machine->device<spu_device>("spu");
31353135   UINT8 *psxram = (UINT8 *)memory_get_shared(*machine, "share1");
31363136
3137//   printf("SPU DMA write from %x, size %x\n", n_address, n_size);
3137//  printf("SPU DMA write from %x, size %x\n", n_address, n_size);
31383138
31393139   spu->start_dma(psxram + n_address, true, n_size*4);
31403140}
src/emu/sound/spu.h
r10613r10614
4848
4949class stream_buffer;
5050
51class spu_device : public device_t, public device_sound_interface
51class spu_device : public device_t, public device_sound_interface
5252{
5353   friend class spu_device_config;
5454
src/emu/sound/bsmt2000.c
r10613r10614
111111     device_config_sound_interface(mconfig, *this),
112112     device_config_memory_interface(mconfig, *this),
113113     m_space_config("samples", ENDIANNESS_LITTLE, 8, 32, 0, NULL, *ADDRESS_MAP_NAME(bsmt2000)),
114     m_ready_callback(NULL)     
114     m_ready_callback(NULL)
115115{
116116   m_shortname = "bsmt2000";
117117}
src/emu/sound/spureverb.c
r10613r10614
306306//
307307
308308void reverb::process(signed short *output,
309                              signed short *reverb_input,
310                              const reverb_params *rp,
311                              const int wetvol_l,
312                              const int wetvol_r,
309                            signed short *reverb_input,
310                            const reverb_params *rp,
311                            const int wetvol_l,
312                            const int wetvol_r,
313313                               const unsigned int sz)
314314{
315315   signed short *sp=(signed short *)reverb_input,
src/emu/sound/spureverb.h
r10613r10614
3434                                 const int wetvol_r,
3535                                 const unsigned int _sz);
3636      void comb_allpass4(signed short *sp,
37                                   signed short *dp,
38                                   const comb_param &comb_delay,
39                                   const int comb_gain,
40                                   const int allpass_delay,
41                                   const int allpass_gain,
42                                   const int *rvol,
43                                   const unsigned int sz);
37                                  signed short *dp,
38                                  const comb_param &comb_delay,
39                                  const int comb_gain,
40                                  const int allpass_delay,
41                                  const int allpass_gain,
42                                  const int *rvol,
43                                  const unsigned int sz);
4444      void comb_allpass1(signed short *sp,
45                                   signed short *dp,
46                                   const comb_param &comb_delay,
47                                   const int comb_gain,
48                                   const int allpass_delay,
49                                   const int allpass_gain,
50                                   const int *rvol,
51                                   const unsigned int sz);
45                                  signed short *dp,
46                                  const comb_param &comb_delay,
47                                  const int comb_gain,
48                                  const int allpass_delay,
49                                  const int allpass_gain,
50                                  const int *rvol,
51                                  const unsigned int sz);
5252      void bandpass(signed short *sp,
53                            const reverb_params *rp,
54                            const unsigned int sz);
53                           const reverb_params *rp,
54                           const unsigned int sz);
5555
5656   public:
5757      reverb(const int hz, const int maxdelay=65536);
src/emu/sound/okiadpcm.c
r10613r10614
176176      // compute the step value
177177        int stepval = floor(floatstep * 1.08f);
178178        floatstep = floatstep * 1.08f;
179       
179
180180      // loop over all nibbles and compute the difference
181181      for (int nib = 0; nib < 16; nib++)
182182      {
src/emu/sound/okiadpcm.h
r10613r10614
3838// ======================> oki_adpcm2_state
3939
4040// Internal ADPCM2 state, used by external ADPCM generators with compatible specs to the OKI MSM9810.
41// TODO: not thoroughly tested: is the output 15 bit?
4142class oki_adpcm2_state
4243{
4344public:
src/emu/romload.c
r10613r10614
461461   romdata->errorstring.catprintf("    EXPECTED: %s\n", hashes.macro_string(tempstr));
462462   romdata->errorstring.catprintf("       FOUND: %s\n", acthashes.macro_string(tempstr));
463463
464   // warn about any ill-formed hashes   
464   // warn about any ill-formed hashes
465465   for (hash_base *hash = hashes.first(); hash != NULL; hash = hash->next())
466466      if (hash->parse_error())
467467      {
src/emu/imagedev/multcart.c
r10613r10614
195195   {
196196      hash_collection actual_hashes;
197197      actual_hashes.compute((const UINT8 *)resource->ptr, resource->length, hash_collection::HASH_TYPES_CRC_SHA1);
198     
198
199199      hash_collection expected_hashes;
200200      expected_hashes.add_from_string(hash_collection::HASH_SHA1, sha1, strlen(sha1));
201201
src/emu/softlist.c
r10613r10614
293293
294294   /* First allocate the new entry */
295295   new_entry = (feature_list *)pool_malloc_lib(swlist->pool, sizeof(feature_list) );
296   
296
297297   if ( new_entry )
298298   {
299299      new_entry->next = NULL;
r10613r10614
455455                  elem->other_info->name = NULL;
456456                  elem->other_info->value = NULL;
457457               }
458               
458
459459               /* Handle the supported flag */
460460               elem->supported = SOFTWARE_SUPPORTED_YES;
461461               if ( supported && ! strcmp( supported, "partial" ) )
r10613r10614
502502         {
503503            const char *str_feature_name = NULL;
504504            const char *str_feature_value = NULL;
505           
505
506506            for ( ; attributes[0]; attributes += 2 )
507507            {
508508               if ( !strcmp( attributes[0], "name" ) )
509509                  str_feature_name = attributes[1];
510               
510
511511               if ( !strcmp( attributes[0], "value" ) )
512512                  str_feature_value = attributes[1];
513513            }
514           
514
515515            /* Prepare for adding feature to feature list */
516516            if ( str_feature_name && swlist->softinfo )
517517            {
518518               char *name = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_feature_name ) + 1 ) * sizeof(char) );
519519               char *value = NULL;
520               
520
521521               if ( !name )
522522                  return;
523               
523
524524               strcpy( name, str_feature_name );
525               
525
526526               if ( str_feature_value )
527527               {
528528                  value = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_feature_value ) + 1 ) * sizeof(char) );
529                 
529
530530                  if ( !value )
531531                     return;
532                 
532
533533                  strcpy( value, str_feature_value );
534534               }
535               
535
536536               add_info( swlist, name, value );
537537            }
538538         }
r10613r10614
862862         if ( swlist->softinfo && swlist->softinfo->other_info )
863863         {
864864            feature_list *list = swlist->softinfo->other_info;
865           
865
866866            while( list->next )
867867            {
868868               add_feature( swlist, list->next->name, list->next->value );
src/emu/hash.c
r10613r10614
5959   // construction/destruction
6060    hash_crc();
6161
62   // operators   
62   // operators
6363    operator UINT32() const { return (m_buffer[0] << 24) | (m_buffer[1] << 16) | (m_buffer[2] << 8) | m_buffer[3]; }
6464
6565   // creation
r10613r10614
153153
154154int hash_base::fromhex(char c)
155155{
156   if (c >= '0' && c <= '9')
156   if (c >= '0' && c <= '9')
157157      return c - '0';
158   else if (c >= 'A' && c <= 'F')
158   else if (c >= 'A' && c <= 'F')
159159      return c - 'A' + 10;
160   else if (c >= 'a' && c <= 'f')
160   else if (c >= 'a' && c <= 'f')
161161      return (c - 'a' + 10);
162162   else
163163      return -1;
r10613r10614
194194
195195//-------------------------------------------------
196196//  from_string - parse a string into the current
197//   hash
197//  hash
198198//-------------------------------------------------
199199
200200bool hash_base::from_string(const char *&string, int length)
201201{
202   // reset the error and our buffer
203   m_parse_error = false;
204   memset(m_bufptr, 0, m_length);
205
206   // special case for idiom HASH(1) to map to a dummy (0) hash
207   if (string[0] == '1' && fromhex(string[1]) == -1)
208   {
209      string++;
210      return true;
211   }
212
202213   // fail if we're too short
203214   if (length < 2 * m_length)
204215      return false;
205216
206217   // loop over bytes
207   m_parse_error = false;
208218   for (int index = 0; index < m_length; index++)
209219   {
210220      // parse the upper digit
r10613r10614
212222      if (upper == -1)
213223      {
214224         m_parse_error = true;
215         memset(m_bufptr, 0, m_length);
216225         return false;
217226      }
218     
227
219228      // parse the lower digit
220229      int lower = fromhex(string[1]);
221230      if (lower == -1)
222231      {
223232         m_parse_error = true;
224         memset(m_bufptr, 0, m_length);
225233         return false;
226234      }
227235
228      // set the byte and advance     
236      // set the byte and advance
229237      m_bufptr[index] = (upper << 4) | lower;
230238      string += 2;
231239   }
232240   return true;
233241}
234242
235   
236243
244
237245//**************************************************************************
238246//  HASH CRC
239247//**************************************************************************
r10613r10614
500508
501509
502510//-------------------------------------------------
503//  add_from_buffer - add a new hash, importing
511//  add_from_buffer - add a new hash, importing
504512//  from a buffer
505513//-------------------------------------------------
506514
r10613r10614
515523   hash_base *newhash = alloc_by_id(type);
516524   if (newhash == NULL)
517525      return NULL;
518   
526
519527   // then import
520528   if (!newhash->from_buffer(buffer, bufflen))
521529   {
522530      global_free(newhash);
523531      return NULL;
524532   }
525   
533
526534   // and append to our list
527535   return &m_hashlist.append(*newhash);
528536}
529537
530538
531539//-------------------------------------------------
532//  add_from_string - add a new hash, importing
540//  add_from_string - add a new hash, importing
533541//  from a string
534542//-------------------------------------------------
535543
r10613r10614
544552   hash_base *newhash = alloc_by_id(type);
545553   if (newhash == NULL)
546554      return NULL;
547   
555
548556   // then import
549557   if (!newhash->from_string(buffer, length))
550558   {
551559      global_free(newhash);
552560      return NULL;
553561   }
554   
562
555563   // and append to our list
556564   return &m_hashlist.append(*newhash);
557565}
r10613r10614
570578         m_hashlist.remove(*hash);
571579         return true;
572580      }
573   
581
574582   // didn't find it
575583   return false;
576584}
r10613r10614
605613   buffer[1] = crc >> 16;
606614   buffer[2] = crc >> 8;
607615   buffer[3] = crc >> 0;
608   
616
609617   // add it the standard way
610618   return add_from_buffer(HASH_CRC, buffer, sizeof(buffer));
611619}
612620
613621
614622//-------------------------------------------------
615//  internal_string - convert set of hashes and
616//  flags to a string in our internal compact
623//  internal_string - convert set of hashes and
624//  flags to a string in our internal compact
617625//  format
618626//-------------------------------------------------
619627
620628const char *hash_collection::internal_string(astring &buffer) const
621629{
622630   astring temp;
623   
631
624632   // output hashes first
625633   buffer.reset();
626634   for (hash_base *hash = m_hashlist.first(); hash != NULL; hash = hash->next())
r10613r10614
633641
634642
635643//-------------------------------------------------
636//  macro_string - convert set of hashes and
644//  macro_string - convert set of hashes and
637645//  flags to a string in the macroized format
638646//-------------------------------------------------
639647
r10613r10614
671679   // determine the end of the string
672680   const char *stringend = string + strlen(string);
673681   const char *ptr = string;
674   
682
675683   // loop until we hit it
676684   bool errors = false;
677685   while (ptr < stringend)
678686   {
679687      char c = *ptr++;
680688      char lc = tolower(c);
681     
689
682690      // non-hex alpha values specify a hash type
683691      if (lc >= 'g' && lc <= 'z')
684692      {
r10613r10614
692700         else
693701            errors = true;
694702      }
695     
703
696704      // hex values are ignored, though unexpected
697705      else if ((lc >= '0' && lc <= '9') || (lc >= 'a' && lc <= 'f'))
698706         errors = true;
699     
707
700708      // anything else is a flag
701709      else
702710         m_flags.cat(c);
r10613r10614
718726      m_hashlist.append(*alloc_by_id(HASH_MD5)).begin();
719727      m_hashlist.append(*alloc_by_id(HASH_SHA1)).begin();
720728   }
721   
729
722730   // otherwise, just allocate the ones that are specified
723731   else
724732   {
r10613r10614
728736         hash_base *existing = hash(*scan);
729737         if (existing != NULL)
730738            m_hashlist.remove(*existing);
731         
739
732740         // append a new one
733741         m_hashlist.append(*alloc_by_id(*scan)).begin();
734742      }
r10613r10614
763771
764772
765773//-------------------------------------------------
766//  alloc_by_id - based on the ID character,
774//  alloc_by_id - based on the ID character,
767775//  allocate a new hash
768776//-------------------------------------------------
769777
r10613r10614
780788
781789
782790//-------------------------------------------------
783//  copyfrom - copy everything from another
791//  copyfrom - copy everything from another
784792//  collection
785793//-------------------------------------------------
786794
r10613r10614
788796{
789797   // copy flags directly
790798   m_flags = src.m_flags;
791   
799
792800   // rebuild the hashlist by copying from the source
793801   m_hashlist.reset();
794802   for (hash_base *hash = src.first(); hash != NULL; hash = hash->next())
src/emu/hash.h
r10613r10614
7373public:
7474    // construction/destruction
7575    hash_base(char id, const char *name, UINT8 length, UINT8 *bufptr);
76   
76
7777    // operators
7878    bool operator==(const hash_base &rhs) const { return (m_length == rhs.m_length && memcmp(m_bufptr, rhs.m_bufptr, m_length) == 0); }
7979    bool operator!=(const hash_base &rhs) const { return (m_length != rhs.m_length || memcmp(m_bufptr, rhs.m_bufptr, m_length) != 0); }
80   
80
8181    // getters
8282    hash_base *next() const { return m_next; }
8383    char id() const { return m_id; }
r10613r10614
8686    bool in_progress() const { return m_in_progress; }
8787    bool parse_error() const { return m_parse_error; }
8888    UINT8 byte(int index) const { return (index >= 0 && index < m_length) ? m_bufptr[index] : 0; }
89   
89
9090    // buffer conversion
9191    const UINT8 *buffer() { return m_bufptr; }
9292    bool from_buffer(const UINT8 *buffer, int buflen);
93   
93
9494    // string conversion
9595    const char *string(astring &buffer);
9696    bool from_string(const char *&string,  int length);
97   
97
9898    // creation
9999    virtual void begin() = 0;
100100    virtual void buffer(const UINT8 *data, UINT32 length) = 0;
101101    virtual void end() = 0;
102   
102
103103protected:
104104   // internal helpers
105105    int fromhex(char c);
106   
106
107107    // internal state
108108    hash_base *      m_next;
109109    const char *   m_name;
r10613r10614
125125   static const char HASH_CRC = 'R';
126126   static const char HASH_MD5 = 'M';
127127   static const char HASH_SHA1 = 'S';
128   
128
129129   // common combinations for requests
130130   static const char *HASH_TYPES_CRC;
131131   static const char *HASH_TYPES_CRC_SHA1;
132132   static const char *HASH_TYPES_ALL;
133   
133
134134   // flags are identified by punctuation marks
135135   static const char FLAG_NO_DUMP = '!';
136136   static const char FLAG_BAD_DUMP = '^';
r10613r10614
140140    hash_collection(const char *string);
141141    hash_collection(const hash_collection &src);
142142    ~hash_collection();
143   
143
144144    // operators
145145    hash_collection &operator=(const hash_collection &src);
146146    bool operator==(const hash_collection &rhs) const;
r10613r10614
158158   hash_base *add_from_buffer(char type, const UINT8 *buffer, int bufflen);
159159   hash_base *add_from_string(char type, const char *buffer, int length);
160160   bool remove(char type);
161   
161
162162   // CRC-specific helpers
163163   bool crc(UINT32 &result);
164164   hash_base *add_crc(UINT32 crc);
165165
166   // string conversion   
166   // string conversion
167167    const char *internal_string(astring &buffer) const;
168168    const char *macro_string(astring &buffer) const;
169169    bool from_internal_string(const char *string);
170   
170
171171   // creation
172172    void begin(const char *types = NULL);
173173    void buffer(const UINT8 *data, UINT32 length);
r10613r10614
181181
182182   // internal state
183183   astring               m_flags;
184    simple_list<hash_base>    m_hashlist;
184    simple_list<hash_base>   m_hashlist;
185185};
186186
187187
src/emu/info.c
r10613r10614
456456{
457457   int parent;
458458   const char *merge_name = NULL;
459   
459
460460   for (parent = 0; parent < parents; ++parent)
461461   {
462462      const machine_config *pconfig = &pinfoarray[parent]->mconfig;
r10613r10614
10541054         input_port_list_init(portlist, cfg->input_ports(), NULL, 0, FALSE, cfg);
10551055      }
10561056   }
1057   
1057
10581058   /* print the header and the game name */
10591059   fprintf(out, "\t<" XML_TOP);
10601060   fprintf(out, " name=\"%s\"", xml_normalize_string(game->name) );
src/emu/audit.h
r10613r10614
8383   const char *   name;               /* name of item */
8484   UINT32         explength;            /* expected length of item */
8585   UINT32         length;               /* actual length of item */
86   hash_collection   exphashes;              /* expected hash data */
86   hash_collection   exphashes;            /* expected hash data */
8787   hash_collection   hashes;               /* actual hash information */
8888};
8989
src/emu/machine/x76f100.c
r10613r10614
183183      sdar = shift & 1;
184184      shift >>= 1;
185185      bit++;
186     
186
187187      if(bit == 8) {
188188         bit = 0;
189189         byte++;
r10613r10614
265265         }
266266      }
267267      break;
268     
268
269269   case STATE_READ_DATA:
270270      if(bit < 8) {
271271         if(bit == 0) {
src/emu/machine/secflash.h
r10613r10614
1111public:
1212   device_secure_serial_flash_config(const machine_config &mconfig, device_type type, const char *name, const char *tag, const device_config *owner, UINT32 clock, UINT32 param = 0);
1313};
14   
14
1515class device_secure_serial_flash : public device_t,
1616                           public device_nvram_interface
1717{
src/emu/machine/x76f041.c
r10613r10614
335335                  byte = 0;
336336               break;
337337            }
338               
338
339339            bit = 0;
340340            shift = 0;
341341         }
src/emu/attotime.h
r10613r10614
353353inline attotime max(const attotime &left, const attotime &right)
354354{
355355   if (left.seconds > right.seconds)
356      return left;
357   if (left.seconds < right.seconds)
356358      return right;
357   if (left.seconds < right.seconds)
359   if (left.attoseconds > right.attoseconds)
358360      return left;
359   if (left.attoseconds > right.attoseconds)
360      return right;
361   return left;
361   return right;
362362}
363363
364364
src/emu/screen.h
r10613r10614
164164   const rectangle &visible_area() const { return m_visarea; }
165165   bitmap_format format() const { return m_config.m_format; }
166166   render_container &container() const { assert(m_container != NULL); return *m_container; }
167   bool screen_update(bitmap_t &bitmap, const rectangle &cliprect);   
167   bool screen_update(bitmap_t &bitmap, const rectangle &cliprect);
168168   void screen_eof();
169169
170170   // dynamic configuration
r10613r10614
286286#define SCREEN_EOF(name)            void SCREEN_EOF_NAME(name)(screen_device *screen, running_machine *machine)
287287#define SCREEN_EOF_CALL(name)         SCREEN_EOF_NAME(name)(screen, machine)
288288
289#define screen_eof_0               NULL
290
289291#define MCFG_SCREEN_ADD(_tag, _type) \
290292   MCFG_DEVICE_ADD(_tag, SCREEN, 0) \
291293   MCFG_SCREEN_TYPE(_type) \
src/emu/fileio.c
r10613r10614
118118
119119
120120//-------------------------------------------------
121//  next - return information about the next file
121//  next - return information about the next file
122122//  in the search path
123123//-------------------------------------------------
124124
r10613r10614
213213   for (const char *scan = types; *scan != 0; scan++)
214214      if (m_hashes.hash(*scan) == NULL)
215215         needed.cat(*scan);
216   
216
217217   // if we need nothing, skip it
218218   if (!needed)
219219      return m_hashes;
220   
220
221221   // load the ZIP file if needed
222222   if (m_zipfile != NULL && load_zipped_file() != FILERR_NONE)
223223      return m_hashes;
r10613r10614
323323   // if we're open from a previous attempt, close up now
324324   if (m_file != NULL)
325325      close();
326   
326
327327   // loop over paths
328328   file_error filerr = FILERR_NOT_FOUND;
329329   while (m_iterator.next(m_fullpath))
r10613r10614
351351
352352
353353//-------------------------------------------------
354//  open_ram - open a "file" which is actually
354//  open_ram - open a "file" which is actually
355355//  just an array of data in RAM
356356//-------------------------------------------------
357357
r10613r10614
360360   // set a fake filename and CRC
361361   m_filename = "RAM";
362362   m_crc = 0;
363   
363
364364   // use the core_file's built-in RAM support
365365   return core_fopen_ram(data, length, m_openflags, &m_file);
366366}
r10613r10614
377377   if (m_zipfile != NULL)
378378      zip_file_close(m_zipfile);
379379   m_zipfile = NULL;
380   
380
381381   if (m_file != NULL)
382382      core_fclose(m_file);
383383   m_file = NULL;
384   
384
385385   if (m_zipdata != NULL)
386386      global_free(m_zipdata);
387387   m_zipdata = NULL;
388   
388
389389   if (m_remove_on_close)
390390      osd_rmfile(m_fullpath);
391391   m_remove_on_close = false;
392   
392
393393   // reset our hashes and path as well
394394   m_hashes.reset();
395395   m_fullpath.reset();
src/emu/fileio.h
r10613r10614
9797public:
9898   // construction/destruction
9999   path_iterator(core_options &options, const char *searchpath = "");
100   
100
101101   // getters
102102   bool next(astring &buffer);
103   
103
104104   // reset
105105   void reset() { m_current = m_base; m_index = 0; }
106106
r10613r10614
145145   emu_file(core_options &options, const char *searchpath, UINT32 openflags);
146146   virtual ~emu_file();
147147
148   // getters   
148   // getters
149149   operator core_file *();
150150   bool open() const { return (m_file != NULL); }
151151   const char *filename() const { return m_filename; }
r10613r10614
169169   file_error open_next();
170170   file_error open_ram(const void *data, UINT32 length);
171171   void close();
172   
172
173173   // control
174174   file_error compress(int compress);
175175   int seek(INT64 offset, int whence);
176176   UINT64 tell();
177177   bool eof();
178178   UINT64 size();
179   
179
180180   // reading
181181   UINT32 read(void *buffer, UINT32 length);
182182   int getc();
183183   int ungetc(int c);
184184   char *gets(char *s, int n);
185   
185
186186   // writing
187187   UINT32 write(const void *buffer, UINT32 length);
188188   int puts(const char *s);
189189   int vprintf(const char *fmt, va_list va);
190190   int printf(const char *fmt, ...);
191   
191
192192private:
193193   // internal helpers
194194   file_error attempt_zipped();
195195   file_error load_zipped_file();
196196   bool zip_filename_match(const zip_file_header &header, const astring &filename);
197197   bool zip_header_is_path(const zip_file_header &header);
198   
198
199199   // internal state
200200   astring         m_filename;                  // original filename provided
201201   astring         m_fullpath;                  // full filename
src/lib/util/cdrom.h
r10613r10614
180180}
181181
182182// segacd needs it like this.. investigate
183// Angelo also says PCE tracks often start playing at the
183// Angelo also says PCE tracks often start playing at the
184184// wrong address.. related?
185185INLINE UINT32 lba_to_msf_alt(int lba)
186186{
187187   UINT32 ret = 0;
188   
188
189189   ret |= ((lba / (60 * 75))&0xff)<<16;
190190   ret |= (((lba / 75) % 60)&0xff)<<8;
191191   ret |= ((lba % 75)&0xff)<<0;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team