Previous 15994 Revisions Next

r4185 Friday 23rd January, 2009 at 03:20:23 UTC by Nathan Woods
Updated to MAME 0.129u2 core
[docs]messnew.txt
[src/emu]cpuexec.c devintrf.c devintrf.h mamecore.h memory.c memory.h romload.c romload.h sndintrf.c sndintrf.h sound.c state.c timer.c video.c
[src/emu/cpu]drcfe.c drcfe.h
[src/emu/cpu/i860]i860dec.c
[src/emu/cpu/mips]mips3drc.c mips3fe.c
[src/emu/cpu/powerpc]ppcdrc.c ppcfe.c
[src/emu/cpu/sh2]sh2comn.h sh2drc.c sh2fe.c
[src/emu/cpu/z8000]z8000cpu.h
[src/emu/debug]debugvw.c express.c
[src/emu/drivers]xtal.h
[src/emu/machine]6522via.c 6526cia.c 6532riot.c 6821new.c 6850acia.c 68681.c 74123.c 8237dma.c 8255ppi.c 8257dma.c at28c16.c cdp1852.c f3853.c i8243.c idectrl.c latch8.c ldcore.c msm6242.c pci.c pic8259.c pit8253.c smc91c9x.c timekpr.c x2212.c z80ctc.c z80dma.c z80pio.c z80sio.c
[src/emu/sound]2151intf.c 2203intf.c 2413intf.c 2608intf.c 2610intf.c 2612intf.c 262intf.c 3812intf.c 5110intf.c 5220intf.c aica.c astrocde.c ay8910.c ay8910.h beep.c bsmt2000.c c140.c c352.c c6280.c cdda.c cdp1869.c cem3394.c custom.c dac.c digitalk.c discrete.c dmadac.c es5503.c es5506.c es8712.c flt_rc.c flt_vol.c gaelco.c hc55516.c ics2115.c iremga20.c k005289.c k007232.c k051649.c k053260.c k054539.c msm5205.c msm5232.c multipcm.c n63701x.c namco.c namco52.c nes_apu.c nile.c okim6258.c okim6295.c okim6376.c pokey.c psx.c qsound.c rf5c400.c rf5c68.c s14001a.c saa1099.c samples.c scsp.c segapcm.c sid6581.c sn76477.c sn76496.c snkwave.c sp0250.c sp0256.c speaker.c st0016.c tiaintf.c tms3615.c tms36xx.c upd7759.c vlm5030.c votrax.c vrender0.c wave.c wavwrite.c x1_010.c ymf271.c ymf278b.c ymz280b.c
[src/emu/video]cdp1869.c mc6845.c voodoo.c
[src/mame]mame.mak mamedriv.c
[src/mame/drivers]adp.c cb2001.c cloak.c cps3.c cvs.c dbz.c drw80pkr.c esripsys.c genesis.c goodejan.c gstream.c gticlub.c guab.c hanaroku.c himesiki.c* igspoker.c* jackie.c* jantotsu.c konamigx.c m92.c micro3d.c model2.c model3.c mystwarr.c nemesis.c progolf.c rungun.c segaybd.c seibuspi.c sengokmj.c sothello.c* srmp5.c stepstag.c ultrsprt.c vcombat.c yunsung8.c zr107.c
[src/mame/includes]cvs.h sei_crtc.h*
[src/mame/layout]igspoker.lay* stepstag.lay*
[src/mame/machine]decocass.c decocrpt.c n64.c naomibd.c
[src/mame/video]atari.c cloak.c genesis.c harddriv.c himesiki.c* midzeus.c namcona1.c namcos22.c psx.c segas32.c sei_crtc.c* taito_f3.c
[src/mess]device.c mess.mak
[src/mess/audio]cdp1863.c lmc1992.c mea8000.c
[src/mess/devices]appldriv.c basicdsk.c bitbngr.c cartslot.c cassette.c chd_cd.c coco_vhd.c dsk.c harddriv.c kermit.c mflopimg.c microdrv.c printer.c snapquik.c xmodem.c
[src/mess/drivers]a2600.c apexc.c einstein.c gamepock.c newbrain.c
[src/mess/formats]thom_dsk.c
[src/mess/machine]6525tpi.c 6530miot.c 6551.c 6883sam.c 68901mfp.c 74145.c 8530scc.c 990_tap.c a7800.c abc77.c abc99.c adc080x.c amigafdc.c ap2_lang.c ap2_slot.c applefdc.c at45dbxx.c ay31015.c c64.c cbmdrive.c cdp1871.c conkort.c d88.c ds1315.c e0516.c gamecom.c gb.c hd63450.c hp48.c i8271.c ins8154.c ins8250.c intv.c mc68328.c mc6843.c mc6846.c mc6854.c mm58274c.c mockngbd.c msm8251.c nc.c ncr5380.c nec765.c nes.c oric.c osborne1.c pcf8593.c pdp1.c pokemini.c rp5c15.c serial.c smartmed.c sms.c sst39vfx.c svi318.c tc8521.c thomson.c ti85.c ti99_4x.c tms5501.c tms9901.c tms9902.c tx0.c upd7002.c vc20.c wd17xx.c wswan.c x68k_hdc.c z80dart.c zx8302.c
[src/mess/video]cdp1861.c cdp1862.c cdp1864.c crtc_ega.c dl1416.c i8275.c msm6255.c zx8301.c

src/mame/machine/decocass.c
r4184r4185
21282128   /* fetch the data pointer */
21292129   tape->timer = timer_alloc(device->machine, tape_clock_callback, (void *)device);
21302130   if (device->region == NULL)
2131      return DEVICE_START_OK;
2131      return;
21322132
21332133   /* scan for the first non-empty block in the image */
21342134   for (offs = device->regionbytes - 1; offs >= 0; offs--)
r4184r4185
21612161   state_save_register_device_item(device, 0, tape->speed);
21622162   state_save_register_device_item(device, 0, tape->bitnum);
21632163   state_save_register_device_item(device, 0, tape->clockpos);
2164
2165   return DEVICE_START_OK;
21662164}
21672165
21682166
src/mame/machine/n64.c
r4184r4185
77#include "includes/n64.h"
88#include "sound/dmadac.h"
99
10#ifdef LSB_FIRST
11   #define BYTE_ADDR_XOR      3
12   #define WORD_ADDR_XOR      1
13#else
14   #define BYTE_ADDR_XOR      0
15   #define WORD_ADDR_XOR      0
16#endif
17
1810UINT32 *rdram;
1911UINT32 *rsp_imem;
2012UINT32 *rsp_dmem;
src/mame/machine/naomibd.c
r4184r4185
538538
539539   /* register for save states */
540540   init_save_state(device);
541
542   return DEVICE_START_OK;
543541}
544542
545543
src/mame/machine/decocrpt.c
r4184r4185
605605   UINT16 *buffer = malloc_or_die(len*2);
606606   int i;
607607
608#ifdef LSB_FIRST
609608   /* we work on 16-bit words but data is loaded as 8-bit, so swap bytes on LSB machines */
610   for (i = 0;i < len;i++)
611   {
612      rom[i] = (rom[i] >> 8) | (rom[i] << 8);
613   }
614#endif
609   if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE)
610      for (i = 0;i < len;i++)
611         rom[i] = BIG_ENDIANIZE_INT16(rom[i]);
615612
616613      memcpy(buffer,rom,len*2);
617614
r4184r4185
644641
645642      free(buffer);
646643
647#ifdef LSB_FIRST
648644   /* we work on 16-bit words but data is loaded as 8-bit, so swap bytes on LSB machines */
649   for (i = 0;i < len;i++)
650   {
651      rom[i] = (rom[i] >> 8) | (rom[i] << 8);
652   }
653#endif
645   if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE)
646      for (i = 0;i < len;i++)
647         rom[i] = BIG_ENDIANIZE_INT16(rom[i]);
654648}
655649
656650void deco56_decrypt_gfx(running_machine *machine, const char *tag)
src/mame/mamedriv.c
r4184r4185
39373937   DRIVER( waverunr )   /* 1996 */
39383938   DRIVER( hotd )      /* 1997 */
39393939   DRIVER( overrev )   /* 1997 */
3940   DRIVER( segawski )   /* 1997 */
39403941   DRIVER( topskatr )   /* 1997 */
39413942   DRIVER( topskatu )   /* 1997 */
39423943   DRIVER( bel )      /* 1998 */
r4184r4185
65006501   DRIVER( rdft2a2 )   /* (c) 1997 Seibu Kaihatsu (Dream Island license) */
65016502   DRIVER( rdft2j )   /* (c) 1997 Seibu Kaihatsu */
65026503   DRIVER( rdft2t )   /* (c) 1997 Seibu Kaihatsu */
6504   DRIVER( rdft2u )   /* (c) 1997 Seibu Kaihatsu (Fabtek license) */
65036505   DRIVER( rdft2us )   /* (c) 1997 Seibu Kaihatsu (Fabtek license) */
65046506   DRIVER( rdft22kc )   /* (c) 2000 Seibu Kaihatsu */
65056507
r4184r4185
65796581   DRIVER( teplus2j )   /* (c) 1997 Jaleco */
65806582   DRIVER( nndmseal )   /* (c) 1997 I'Max/Jaleco */
65816583   DRIVER( stepstag )   /* (c) 1999 Jaleco */
6584   DRIVER( step3 )      /* (c) 1999 Jaleco */
65826585   DRIVER( rockn )      /* (c) 1999 Jaleco */
65836586   DRIVER( rockna )   /* (c) 1999 Jaleco */
65846587   DRIVER( rockn2 )   /* (c) 1999 Jaleco */
r4184r4185
72697272   DRIVER( madball )   /* (c) 1998 Yun Sung */
72707273   DRIVER( madballn )   /* (c) 1998 Yun Sung */
72717274   DRIVER( cannball )   /* (c) 1995 Yun Sung / Soft Visio */
7275   DRIVER( cannbalv )   /* (c) 1995 Yun Sung / T&K */
72727276   DRIVER( magix )      /* (c) 1995 Yun Sung */
72737277   DRIVER( rocktris )   /* (c) 1994? Yun Sung */
72747278   DRIVER( magicbub )   /* (c) Yun Sung */
r4184r4185
74557459    DRIVER( cpokert )   /* (c) 1993? Tuning */
74567460   DRIVER( csk227it )   /* (c) 198? IGS */
74577461   DRIVER( csk234it )   /* (c) 198? IGS */
7462   DRIVER( igs_ncs )   /* (c) 198? IGS */
7463   DRIVER( igs_ncs2 )   /* (c) 2000 IGS */
74587464   DRIVER( jackie )   /* (c) 199? IGS */
74597465   DRIVER( stellecu )   /* (c) 1998 */
74607466   DRIVER( iqblock )   /* (c) 1993 */
r4184r4185
74937499   DRIVER( slqz2 )      /* (c) 1998 */
74947500   DRIVER( sdmg2 )      /* (c) 1997 */
74957501
7496   DRIVER( igs_ncs )   /* (c) 2000 */
7497
74987502   DRIVER( bigd2 )      /* (c) 2000 */
74997503   DRIVER( sdwx )      /* (c) 2002 */
75007504   DRIVER( sddz )      /* (c) 200? */
r4184r4185
80528056   DRIVER( fredmemc )   /* (c) 1994 Coastal Amusements */
80538057   DRIVER( fredmesp )   /* (c) 1994 Coastal Amusements */
80548058   DRIVER( cecmatch )   /* (c) 1993 Coastal Amusements */
8055   DRIVER( f15se )      /* (c) 1991 Microprose */
8056   DRIVER( f15se21 )   /* (c) 1991 Microprose */
8057   DRIVER( botss )      /* (c) 1992 Microprose */
8058   DRIVER( stankatk )   /* (c) 1992 Microprose */
8059   DRIVER( f15se )      /* (c) 1991 Microprose Games Inc. */
8060   DRIVER( f15se21 )   /* (c) 1991 Microprose Games Inc. */
8061   DRIVER( botss )      /* (c) 1992 Microprose Games Inc. */
8062   DRIVER( stankatk )   /* (c) 1992 Microprose Games Inc. */
80598063   DRIVER( dynadice )   /* ? */
80608064   DRIVER( ssingles )   /* Yachiyo? */
80618065   DRIVER( tcl )      /* (c) 1995 Uniwang */
8066   DRIVER( sothello )   /* (c) 1986 Success / Fujiwara */
80628067
80638068   /* Multi Amenity Cassette System */
80648069   DRIVER( macsbios )
r4184r4185
84368441   DRIVER( blazlaz )   /* (c) 1989 Hudson Soft */
84378442   DRIVER( paranoia )   /* (c) 1990 Naxat Soft */
84388443   DRIVER( vcombat )   /* (c) 1993 VR8 Inc. */
8439   DRIVER( shadfgtr )   /* (c) 1989 DUTECH Inc. */
8444   DRIVER( shadfgtr )   /* (c) 1993 DUTECH Inc. */
84408445   DRIVER( blackt96 )   /* (c) 1996 D.G.R.M. of Korea */
84418446   DRIVER( magictg )   /* (c) 199? Acclaim */
84428447   DRIVER( magictga )   /* (c) 199? Acclaim */
r4184r4185
85488553   DRIVER( buster )   /* (c) 1987 Marian Electronics Ltd. */
85498554   DRIVER( spielbud )   /* (c) 1985 ADP */
85508555
8556   /* Hi-Soft */
8557   DRIVER( himesiki )   /* (c) 1989 Hi-Soft */
8558
85518559#endif   /* DRIVER_RECURSIVE */
src/mame/includes/cvs.h
r4184r4185
1515extern UINT8 *cvs_video_ram;
1616extern UINT8 *cvs_bullet_ram;
1717extern UINT8 *cvs_palette_ram;
18extern UINT8 *cvs_character_ram;
1918extern UINT8 *cvs_s2636_0_ram;
2019extern UINT8 *cvs_s2636_1_ram;
2120extern UINT8 *cvs_s2636_2_ram;
src/mame/includes/sei_crtc.h
r0r4185
1/*----------- defined in video -----------*/
2
3extern UINT16 *seibucrtc_sc0vram,*seibucrtc_sc1vram,*seibucrtc_sc2vram,*seibucrtc_sc3vram;
4extern UINT16 *seibucrtc_vregs;
5extern UINT16 seibucrtc_sc0bank;
6
7/*----------- defined in drivers -----------*/
8
9WRITE16_HANDLER( seibucrtc_sc0vram_w );
10WRITE16_HANDLER( seibucrtc_sc1vram_w );
11WRITE16_HANDLER( seibucrtc_sc2vram_w );
12WRITE16_HANDLER( seibucrtc_sc3vram_w );
13WRITE16_HANDLER( seibucrtc_vregs_w );
14void seibucrtc_sc0bank_w(UINT16 data);
15VIDEO_START( seibu_crtc );
16VIDEO_UPDATE( seibu_crtc );
src/mame/mame.mak
r4184r4185
750750   $(DRIVERS)/getrivia.o \
751751
752752$(MAMEOBJ)/igs.a: \
753   $(DRIVERS)/csk.o $(VIDEO)/csk.o \
754753   $(DRIVERS)/ddz.o \
755754   $(DRIVERS)/dunhuang.o \
756755   $(DRIVERS)/goldstar.o $(VIDEO)/goldstar.o \
756   $(DRIVERS)/jackie.o \
757   $(DRIVERS)/igspoker.o \
757758   $(DRIVERS)/igs009.o \
758759   $(DRIVERS)/igs_blit.o \
759760   $(DRIVERS)/igs017.o \
760761   $(DRIVERS)/igs_m027.o \
761762   $(DRIVERS)/igs_m68.o \
762   $(DRIVERS)/igs_ncs.o \
763763   $(DRIVERS)/iqblock.o $(VIDEO)/iqblock.o \
764764   $(DRIVERS)/lordgun.o $(VIDEO)/lordgun.o \
765765   $(DRIVERS)/pgm.o $(VIDEO)/pgm.o \
r4184r4185
12221222   $(DRIVERS)/dcon.o $(VIDEO)/dcon.o \
12231223   $(DRIVERS)/deadang.o $(VIDEO)/deadang.o \
12241224   $(DRIVERS)/dynduke.o $(VIDEO)/dynduke.o \
1225   $(DRIVERS)/goodejan.o $(VIDEO)/goodejan.o \
12261225   $(DRIVERS)/kncljoe.o $(VIDEO)/kncljoe.o \
12271226   $(DRIVERS)/mustache.o $(VIDEO)/mustache.o \
12281227   $(DRIVERS)/panicr.o \
12291228   $(DRIVERS)/raiden.o $(VIDEO)/raiden.o \
12301229   $(DRIVERS)/raiden2.o $(MACHINE)/r2crypt.o \
12311230   $(DRIVERS)/seibuspi.o $(MACHINE)/seibuspi.o $(VIDEO)/seibuspi.o \
1232   $(DRIVERS)/sengokmj.o $(VIDEO)/sengokmj.o \
1231   $(VIDEO)/sei_crtc.o \
1232   $(DRIVERS)/sengokmj.o \
1233   $(DRIVERS)/goodejan.o \
12331234   $(DRIVERS)/stfight.o $(MACHINE)/stfight.o $(VIDEO)/stfight.o \
12341235   $(DRIVERS)/wiz.o $(VIDEO)/wiz.o \
12351236   $(MACHINE)/spisprit.o \
r4184r4185
15781579   $(DRIVERS)/gunpey.o \
15791580   $(DRIVERS)/hexa.o $(VIDEO)/hexa.o \
15801581   $(DRIVERS)/highvdeo.o \
1582   $(DRIVERS)/himesiki.o $(VIDEO)/himesiki.o \
15811583   $(DRIVERS)/homedata.o $(VIDEO)/homedata.o \
15821584   $(DRIVERS)/hotblock.o \
15831585   $(DRIVERS)/ilpag.o \
r4184r4185
16441646   $(DRIVERS)/slotcarn.o \
16451647   $(DRIVERS)/sms.o \
16461648   $(DRIVERS)/snookr10.o $(VIDEO)/snookr10.o \
1649   $(DRIVERS)/sothello.o \
16471650   $(DRIVERS)/spool99.o \
16481651   $(DRIVERS)/sprcros2.o $(VIDEO)/sprcros2.o \
16491652   $(DRIVERS)/ssfindo.o \
r4184r4185
17381741$(DRIVERS)/goldnpkr.o:   $(LAYOUT)/goldnpkr.lh \
17391742                  $(LAYOUT)/pmpoker.lh \
17401743
1744$(DRIVERS)/igspoker.o:   $(LAYOUT)/igspoker.lh
1745
17411746$(DRIVERS)/lazercmd.o:   $(LAYOUT)/lazercmd.lh
17421747
17431748$(DRIVERS)/lucky74.o:   $(LAYOUT)/lucky74.lh
r4184r4185
17951800
17961801$(DRIVERS)/tetrisp2.o:   $(LAYOUT)/rocknms.lh
17971802
1803$(DRIVERS)/stepstag.o:   $(LAYOUT)/stepstag.lh
1804
17981805$(DRIVERS)/thayers.o:   $(LAYOUT)/dlair.lh
17991806
18001807$(DRIVERS)/turbo.o:      $(LAYOUT)/turbo.lh \
src/mame/video/midzeus.c
r4184r4185
322322      {
323323         UINT16 *dest = (UINT16 *)bitmap->base + y * bitmap->rowpixels;
324324         for (x = cliprect->min_x; x <= cliprect->max_x; x++)
325            dest[x] = WAVERAM_READPIX(base, y, x - xoffs);
325            dest[x] = WAVERAM_READPIX(base, y, x - xoffs) & 0x7fff;
326326      }
327327   }
328328
src/mame/video/cloak.c
r4184r4185
140140      case 0x03: bitmap_videoram_address_x = data; break;
141141      case 0x07: bitmap_videoram_address_y = data; break;
142142      default:
143         current_bitmap_videoram_accessed[(bitmap_videoram_address_y << 8) | bitmap_videoram_address_x] = data & 0x07;
143         current_bitmap_videoram_accessed[(bitmap_videoram_address_y << 8) | bitmap_videoram_address_x] = data & 0x0f;
144144
145145         adjust_xy(offset);
146146         break;
r4184r4185
196196   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
197197      for (x = cliprect->min_x; x <= cliprect->max_x; x++)
198198      {
199         pen_t pen = current_bitmap_videoram_displayed[(y << 8) | x];
199         pen_t pen = current_bitmap_videoram_displayed[(y << 8) | x] & 0x07;
200200
201201         if (pen)
202202            *BITMAP_ADDR16(bitmap, y, (x - 6) & 0xff) = 0x10 | ((x & 0x80) >> 4) | pen;
src/mame/video/namcona1.c
r4184r4185
3535   int tilemap_color,
3636   int use_4bpp_gfx )
3737{
38#ifdef LSB_FIRST
3938   UINT16 *source;
4039   static UINT8 mask_data[8];
41#endif
4240
4341   int data = tilemap_videoram[tile_index];
4442   int tile = data&0xfff;
r4184r4185
6260   else
6361   {
6462      SET_TILE_INFO( gfx,tile,tilemap_color,0 );
65#ifdef LSB_FIRST
66      source = shaperam+4*tile;
67      mask_data[0] = source[0]>>8;
68      mask_data[1] = source[0]&0xff;
69      mask_data[2] = source[1]>>8;
70      mask_data[3] = source[1]&0xff;
71      mask_data[4] = source[2]>>8;
72      mask_data[5] = source[2]&0xff;
73      mask_data[6] = source[3]>>8;
74      mask_data[7] = source[3]&0xff;
75      tileinfo->mask_data = mask_data;
76#else
77      tileinfo->mask_data = (UINT8 *)(shaperam+4*tile);
78#endif
63      if (ENDIANNESS_NATIVE == ENDIANNESS_BIG)
64         tileinfo->mask_data = (UINT8 *)(shaperam+4*tile);
65      else
66      {
67         source = shaperam+4*tile;
68         mask_data[0] = source[0]>>8;
69         mask_data[1] = source[0]&0xff;
70         mask_data[2] = source[1]>>8;
71         mask_data[3] = source[1]&0xff;
72         mask_data[4] = source[2]>>8;
73         mask_data[5] = source[2]&0xff;
74         mask_data[6] = source[3]>>8;
75         mask_data[7] = source[3]&0xff;
76         tileinfo->mask_data = mask_data;
77      }
7978   }
8079} /* tilemap_get_info */
8180
r4184r4185
105104   }
106105   else
107106   {
108#ifdef LSB_FIRST
109      UINT16 *source;
110      static UINT8 mask_data[8];
111      source = shaperam+4*tile;
112      mask_data[0] = source[0]>>8;
113      mask_data[1] = source[0]&0xff;
114      mask_data[2] = source[1]>>8;
115      mask_data[3] = source[1]&0xff;
116      mask_data[4] = source[2]>>8;
117      mask_data[5] = source[2]&0xff;
118      mask_data[6] = source[3]>>8;
119      mask_data[7] = source[3]&0xff;
120#else
121107      UINT8 *mask_data = (UINT8 *)(shaperam+4*tile);
122#endif
108
109      if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE)
110      {
111         UINT16 *source = (UINT16 *)mask_data;
112         static UINT8 conv_data[9];
113         conv_data[0] = source[0]>>8;
114         conv_data[1] = source[0]&0xff;
115         conv_data[2] = source[1]>>8;
116         conv_data[3] = source[1]&0xff;
117         conv_data[4] = source[2]>>8;
118         conv_data[5] = source[2]&0xff;
119         conv_data[6] = source[3]>>8;
120         conv_data[7] = source[3]&0xff;
121         mask_data = conv_data;
122      }
123123      SET_TILE_INFO( gfx,tile,tilemap_color,0 );
124124      tileinfo->mask_data = mask_data;
125125   }
src/mame/video/psx.c
r4184r4185
33793379         }
33803380         break;
33813381      case 0x58:
3382      case 0x5a:
33823383      case 0x5c:
33833384      case 0x5e:
33843385         if( m_n_gpu_buffer_offset < 5 &&
src/mame/video/himesiki.c
r0r4185
1/******************************************************************************
2
3Himeshikibu (C) 1989 Hi-Soft
4
5Video hardware
6    driver by Uki
7
8******************************************************************************/
9
10#include "driver.h"
11#include "video/generic.h"
12
13UINT8 *himesiki_bg_ram;
14static tilemap *himesiki_bg_tilemap;
15
16static int himesiki_scrollx[1];
17static int himesiki_flip;
18
19
20static TILE_GET_INFO( get_bg_tile_info )
21{
22   int code = himesiki_bg_ram[tile_index*2] + himesiki_bg_ram[tile_index*2+1]*0x100 ;
23   int col = code >> 12;
24
25   code &= 0xfff;
26
27   SET_TILE_INFO(0, code, col, 0);
28}
29
30VIDEO_START( himesiki )
31{
32   himesiki_bg_ram = auto_malloc(0x1000);
33   himesiki_bg_tilemap = tilemap_create( machine, get_bg_tile_info,tilemap_scan_rows,8,8,64,32 );
34}
35
36WRITE8_HANDLER( himesiki_bg_ram_w )
37{
38   himesiki_bg_ram[offset] = data;
39   tilemap_mark_tile_dirty( himesiki_bg_tilemap, offset / 2 );
40}
41
42WRITE8_HANDLER( himesiki_scrollx_w )
43{
44   himesiki_scrollx[offset] = data;
45}
46
47WRITE8_HANDLER( himesiki_flip_w )
48{
49   himesiki_flip = data & 0xc0;
50   flip_screen_set(space->machine, himesiki_flip);
51
52   if (data & 0x3f)
53      logerror("p08_w %02x\n",data);
54}
55
56static void himesiki_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
57{
58   int offs;
59
60   for (offs = 0x100; offs<0x160; offs+=4)
61   {
62      int attr = spriteram[offs + 1];
63      int code = spriteram[offs + 0] | (attr & 3) << 8;
64      int x = spriteram[offs + 3] | (attr & 8) << 5;
65      int y = spriteram[offs + 2];
66
67      int col = (attr & 0xf0) >> 4;
68      int fx = attr & 4;
69      int fy = 0;
70
71      if (x > 0x1e0)
72         x -= 0x200;
73
74      if (himesiki_flip)
75      {
76         y = (y + 33) & 0xff;
77         x = 224-x;
78         fx ^= 4;
79         fy = 1;
80      }
81      else
82      {
83         y = 257-y;
84         if (y > 0xc0)
85            y -= 0x100;
86      }
87
88      drawgfx(bitmap,machine->gfx[1],code,col,fx,fy,x,y,cliprect,TRANSPARENCY_PEN,15);
89   }
90
91   for (offs = 0; offs<0x100; offs+=4)
92   {
93      int attr = spriteram[offs + 1];
94      int code = spriteram[offs + 0] | (attr & 7) << 8;
95      int x = spriteram[offs + 3] | (attr & 8) << 5;
96      int y = spriteram[offs + 2];
97
98      int col = (attr & 0xf0) >> 4;
99      int f = 0;
100
101      if (x > 0x1e0)
102         x -= 0x200;
103
104      if (himesiki_flip)
105      {
106         y += 49;
107         x = 240-x;
108         f = 1;
109      }
110      else
111         y = 257-y;
112
113      y &= 0xff;
114      if (y > 0xf0)
115         y -= 0x100;
116
117      drawgfx(bitmap,machine->gfx[2],code,col,f,f,x,y,cliprect,TRANSPARENCY_PEN,15);
118   }
119}
120
121VIDEO_UPDATE( himesiki )
122{
123   int x = -(himesiki_scrollx[0] << 8 | himesiki_scrollx[1]) & 0x1ff;
124   tilemap_set_scrolldx( himesiki_bg_tilemap, x, x);
125
126   tilemap_draw(bitmap, cliprect, himesiki_bg_tilemap, TILEMAP_DRAW_OPAQUE, 0);
127   himesiki_draw_sprites(screen->machine, bitmap, cliprect);
128
129   return 0;
130}
src/mame/video/namcos22.c
r4184r4185
612612   int x,y;
613613   if( mbSuperSystem22 )
614614   { /* super system 22 */
615#ifdef LSB_FIRST
616#define XORPAT 0x3
617#else
618#define XORPAT 0x0
619#endif
615#define XORPAT NATIVE_ENDIAN_VALUE_LE_BE(3,0)
620616      const UINT8 *rlut = (const UINT8 *)&namcos22_gamma[0x100/4];
621617      const UINT8 *glut = (const UINT8 *)&namcos22_gamma[0x200/4];
622618      const UINT8 *blut = (const UINT8 *)&namcos22_gamma[0x300/4];
src/mame/video/sei_crtc.c
r0r4185
1/******************************************************************************************
2
3Seibu Custom "CRT Controller" emulation
4
5by Angelo Salese,based off the old D-Con video HW part by Bryan McPhail
6
7The (likely) custom Seibu CRTC is used at least in the following games:
8Raiden (probably the first game to use it)
9*Sengoku Mahjong
10*Good e Jong
11*Tottemo de Jong
12Blood Bros.
13Sky Smasher
14D-Con
15SD Gundam Psycho Salamander no Kyoui
16(all games in legionna.c)
17(all games in raiden2.c)
18
19The name "Seibu CRTC" is actually an agglomerate of all the Seibu Customs that are on the
20single boards, most if not all of them are shared video chips in the aforementioned games.
21
22TODO:
23- Dynamic Resolution Change (xx10 register?)
24- Dynamic Paging register probably incorrect,needs further investigation;
25- Merge the aforementioned games and clean-up the code in these drivers;
26- Merge the gfxdecode too?
27- Fully understand remaining video registers;
28- Are the xx80/xxc0 in some games (D-Con/Sengoku Mahjong) another bunch of registers?
29- Investigate about the real name(s) of this Seibu "CRT Controller",and if it is really
30  custom.
31
32===========================================================================================
33
34List of default vregs (title screen):
35
36*Sengoku Mahjong:
378000:  000F 0013 009F 00BF 00FA 000F 00FA 00FF
388010:  007D 0006 0000 0002 0000 0000 0000 0000
398020:  0000 0000 0004 0000 0000 0000 0040 01FF
408030:  003E 01FF 003F 01FF 0040 0001 0034 0035
418040:  0000 A8A8 0003 1C37 0001 0000 0000 0000
42
43*Tottemo de Jong
448000:  000F 000F 009F 00BF 00FA 000F 00FA 00FF
458010:  0076 0006 0000 0002 0000 0002 0006 0000
468020:  0000 0000 0000 0000 0000 0000 01C0 01FF
478030:  003E 01FF 003F 01FF 00C0 01FF 0034 003F
488040:  0000 A8A8 0003 1830 0001 0000 0000 0000
49
50*Good e Jong
518040:  000F 000F 009F 00BF 00FA 000F 00FA 00FF
528050:  0076 0006 0000 0002 0000 0002 0006 0000
538060:  0000 00FA 0000 0000 0000 0000 01C0 01FF
548070:  003E 01FF 003F 01FF 00C0 01FF 0034 003F
558080:  0000 0000 0000 0000 0000 0000 0000 0000
56
57*******************************************************************************************/
58
59#include "driver.h"
60#include "includes/sei_crtc.h"
61
62static tilemap *sc0_tilemap,*sc2_tilemap,*sc1_tilemap,*sc3_tilemap_0,*sc3_tilemap_1;
63UINT16 *seibucrtc_sc0vram,*seibucrtc_sc1vram,*seibucrtc_sc2vram,*seibucrtc_sc3vram;
64UINT16 *seibucrtc_vregs;
65UINT16 seibucrtc_sc0bank;
66
67/*******************************
68*
69* Macros for the video registers
70*
71*******************************/
72
73/*******************************
74* 0x1a - Layer Dynamic Paging?
75*******************************/
76#define SEIBU_CRTC_DYN_PAGING    (seibucrtc_vregs[0x001a/2])
77#define SEIBU_CRTC_SC3_PAGE_SEL (SEIBU_CRTC_DYN_PAGING & 0x0002)
78
79/*******************************
80* 0x1c - Layer Enable
81*******************************/
82#define SEIBU_CRTC_LAYER_EN    (seibucrtc_vregs[0x001c/2])
83#define SEIBU_CRTC_ENABLE_SC0   (!(SEIBU_CRTC_LAYER_EN & 0x0001))
84#define SEIBU_CRTC_ENABLE_SC2   (!(SEIBU_CRTC_LAYER_EN & 0x0002))
85#define SEIBU_CRTC_ENABLE_SC1   (!(SEIBU_CRTC_LAYER_EN & 0x0004))
86#define SEIBU_CRTC_ENABLE_SC3   (!(SEIBU_CRTC_LAYER_EN & 0x0008))
87#define SEIBU_CRTC_ENABLE_SPR   (!(SEIBU_CRTC_LAYER_EN & 0x0010))
88
89/************************************
90* 0x20 - Screen 0 (BG) scroll x
91************************************/
92#define SEIBU_CRTC_SC0_SX    (seibucrtc_vregs[0x0020/2])
93
94/************************************
95* 0x22 - Screen 0 (BG) scroll y
96************************************/
97#define SEIBU_CRTC_SC0_SY    (seibucrtc_vregs[0x0022/2])
98
99/************************************
100* 0x24 - Screen 1 (FG) scroll x
101************************************/
102#define SEIBU_CRTC_SC1_SX    (seibucrtc_vregs[0x0024/2])
103
104/************************************
105* 0x26 - Screen 1 (FG) scroll y
106************************************/
107#define SEIBU_CRTC_SC1_SY    (seibucrtc_vregs[0x0026/2])
108
109/************************************
110* 0x28 - Screen 2 (MD) scroll x
111************************************/
112#define SEIBU_CRTC_SC2_SX    (seibucrtc_vregs[0x0028/2])
113
114/************************************
115* 0x2a - Screen 2 (MD) scroll y
116************************************/
117#define SEIBU_CRTC_SC2_SY    (seibucrtc_vregs[0x002a/2])
118
119/************************************
120* 0x2c - Fix screen scroll x (global)
121************************************/
122#define SEIBU_CRTC_FIX_SX    (seibucrtc_vregs[0x002c/2])
123
124/************************************
125* 0x2e - Fix screen scroll y (global)
126************************************/
127#define SEIBU_CRTC_FIX_SY    (seibucrtc_vregs[0x002e/2])
128
129
130/*******************************
131*
132* Write RAM accesses
133*
134*******************************/
135
136WRITE16_HANDLER( seibucrtc_sc0vram_w )
137{
138   COMBINE_DATA(&seibucrtc_sc0vram[offset]);
139   tilemap_mark_tile_dirty(sc0_tilemap,offset);
140}
141
142WRITE16_HANDLER( seibucrtc_sc2vram_w )
143{
144   COMBINE_DATA(&seibucrtc_sc2vram[offset]);
145   tilemap_mark_tile_dirty(sc2_tilemap,offset);
146}
147
148WRITE16_HANDLER( seibucrtc_sc1vram_w )
149{
150   COMBINE_DATA(&seibucrtc_sc1vram[offset]);
151   tilemap_mark_tile_dirty(sc1_tilemap,offset);
152}
153
154WRITE16_HANDLER( seibucrtc_sc3vram_w )
155{
156   COMBINE_DATA(&seibucrtc_sc3vram[offset]);
157   tilemap_mark_tile_dirty(sc3_tilemap_0,offset);
158   tilemap_mark_tile_dirty(sc3_tilemap_1,offset);
159}
160
161WRITE16_HANDLER( seibucrtc_vregs_w )
162{
163   COMBINE_DATA(&seibucrtc_vregs[offset]);
164}
165
166/* Actually external from the CRTC */
167void seibucrtc_sc0bank_w(UINT16 data)
168{
169   seibucrtc_sc0bank = data & 1;
170   tilemap_mark_all_tiles_dirty(sc0_tilemap);
171}
172
173
174/*******************************
175*
176* Tilemap info accesses
177*
178*******************************/
179
180static TILE_GET_INFO( seibucrtc_sc0_tile_info )
181{
182   int tile = seibucrtc_sc0vram[tile_index] & 0xfff;
183   int color = (seibucrtc_sc0vram[tile_index] >> 12) & 0x0f;
184   tile+=(seibucrtc_sc0bank<<12);
185   SET_TILE_INFO(1, tile, color, 0);
186}
187
188static TILE_GET_INFO( seibucrtc_sc2_tile_info )
189{
190   int tile = seibucrtc_sc2vram[tile_index] & 0xfff;
191   int color = (seibucrtc_sc2vram[tile_index] >> 12) & 0x0f;
192   SET_TILE_INFO(2, tile, color, 0);
193}
194
195static TILE_GET_INFO( seibucrtc_sc1_tile_info )
196{
197   int tile = seibucrtc_sc1vram[tile_index] & 0xfff;
198   int color = (seibucrtc_sc1vram[tile_index] >> 12) & 0x0f;
199   SET_TILE_INFO(3, tile, color, 0);
200}
201
202static TILE_GET_INFO( seibucrtc_sc3_tile_info )
203{
204   int tile = seibucrtc_sc3vram[tile_index] & 0xfff;
205   int color = (seibucrtc_sc3vram[tile_index] >> 12) & 0x0f;
206   SET_TILE_INFO(4, tile, color, 0);
207}
208
209static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri)
210{
211   int offs,fx,fy,x,y,color,sprite;
212   int dx,dy,ax,ay;
213
214   for (offs = 0x400-4;offs >= 0;offs -= 4)
215   {
216      if ((spriteram16[offs+0]&0x8000)!=0x8000) continue;
217      sprite = spriteram16[offs+1];
218      if ((sprite>>14)!=pri) continue;
219      sprite &= 0x1fff;
220
221      y = spriteram16[offs+3];
222      x = spriteram16[offs+2];
223
224      if (x&0x8000) x=0-(0x200-(x&0x1ff));
225      else x&=0x1ff;
226      if (y&0x8000) y=0-(0x200-(y&0x1ff));
227      else y&=0x1ff;
228
229      color = spriteram16[offs+0]&0x3f;
230      fx = spriteram16[offs+0]&0x4000;
231      fy = spriteram16[offs+0]&0x2000;
232      dy=((spriteram16[offs+0]&0x0380)>>7)+1;
233      dx=((spriteram16[offs+0]&0x1c00)>>10)+1;
234
235      for (ax=0; ax<dx; ax++)
236         for (ay=0; ay<dy; ay++) {
237            if (!fx)
238               drawgfx(bitmap,machine->gfx[0],
239                  sprite++,
240                  color,fx,fy,x+ax*16,y+ay*16,
241                  cliprect,TRANSPARENCY_PEN,15);
242            else
243               drawgfx(bitmap,machine->gfx[0],
244                  sprite++,
245                  color,fx,fy,x+(dx-1-ax)*16,y+ay*16,
246                  cliprect,TRANSPARENCY_PEN,15);
247         }
248   }
249}
250
251/***********************************
252*
253* VIDEO_START/VIDEO_UPDATE functions
254*
255***********************************/
256
257VIDEO_START( seibu_crtc )
258{
259   sc0_tilemap = tilemap_create(machine, seibucrtc_sc0_tile_info,tilemap_scan_rows,16,16,32,32);
260   sc2_tilemap = tilemap_create(machine, seibucrtc_sc2_tile_info,tilemap_scan_rows,16,16,32,32);
261   sc1_tilemap = tilemap_create(machine, seibucrtc_sc1_tile_info,tilemap_scan_rows,16,16,32,32);
262   sc3_tilemap_0 = tilemap_create(machine, seibucrtc_sc3_tile_info,tilemap_scan_rows, 8, 8,32,32);
263   sc3_tilemap_1 = tilemap_create(machine, seibucrtc_sc3_tile_info,tilemap_scan_rows, 8, 8,64,32);
264
265   tilemap_set_transparent_pen(sc2_tilemap,15);
266   tilemap_set_transparent_pen(sc1_tilemap,15);
267   tilemap_set_transparent_pen(sc3_tilemap_0,15);
268   tilemap_set_transparent_pen(sc3_tilemap_1,15);
269
270   seibucrtc_sc0bank = 0;
271}
272
273VIDEO_UPDATE( seibu_crtc )
274{
275   bitmap_fill(bitmap, cliprect, screen->machine->pens[0x7ff]); //black pen
276
277   tilemap_set_scrollx( sc0_tilemap,0, (SEIBU_CRTC_SC0_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
278   tilemap_set_scrolly( sc0_tilemap,0, (SEIBU_CRTC_SC0_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
279   tilemap_set_scrollx( sc2_tilemap,0, (SEIBU_CRTC_SC2_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
280   tilemap_set_scrolly( sc2_tilemap,0, (SEIBU_CRTC_SC2_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
281   tilemap_set_scrollx( sc1_tilemap,0, (SEIBU_CRTC_SC1_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
282   tilemap_set_scrolly( sc1_tilemap,0, (SEIBU_CRTC_SC1_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
283   tilemap_set_scrollx( SEIBU_CRTC_SC3_PAGE_SEL ? sc3_tilemap_0 : sc3_tilemap_1,0, (SEIBU_CRTC_FIX_SX+64) & 0x1ff );
284   tilemap_set_scrolly( SEIBU_CRTC_SC3_PAGE_SEL ? sc3_tilemap_0 : sc3_tilemap_1,0, (SEIBU_CRTC_FIX_SY+1) & 0x1ff );
285
286   if(SEIBU_CRTC_ENABLE_SC0) { tilemap_draw(bitmap,cliprect,sc0_tilemap,0,0); }
287   if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen->machine, bitmap,cliprect, 2); }
288   if(SEIBU_CRTC_ENABLE_SC2) { tilemap_draw(bitmap,cliprect,sc2_tilemap,0,0); }
289   if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen->machine, bitmap,cliprect, 1); }
290   if(SEIBU_CRTC_ENABLE_SC1) { tilemap_draw(bitmap,cliprect,sc1_tilemap,0,0); }
291   if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen->machine, bitmap,cliprect, 0); }
292   if(SEIBU_CRTC_ENABLE_SC3) { tilemap_draw(bitmap,cliprect,SEIBU_CRTC_SC3_PAGE_SEL ? sc3_tilemap_0 : sc3_tilemap_1,0,0); }
293   if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen->machine, bitmap,cliprect, 3); }
294
295   return 0;
296}
src/mame/video/harddriv.c
r4184r4185
1818
1919#define DISPLAY_SPEEDUPS         0
2020
21#ifdef LSB_FIRST
22#define MASK(n)         (0x000000ffUL << ((n) * 8))
23#else
24#define MASK(n)         (0xff000000UL >> (((n) ^ 1) * 8))
25#endif
21#define MASK(n)         NATIVE_ENDIAN_VALUE_LE_BE(0x000000ffUL << ((n) * 8), 0xff000000UL >> (((n) ^ 1) * 8))
2622
2723
24
2825/*************************************
2926 *
3027 *  External definitions
src/mame/video/atari.c
r4184r4185
1010#include "includes/atari.h"
1111#include "video/gtia.h"
1212
13#ifdef   LSB_FIRST
14#define BYTE_XOR(n) (n)
15#else
16#define BYTE_XOR(n) ((n)^1)
17#endif
18
1913#define VERBOSE 0
2014
2115#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
r4184r4185
990984   if ( (antic.cmd & ANTIC_HSCR) == 0  || (antic.pfwidth == 48) || (antic.pfwidth == 32))
991985   {
992986      /* no hscroll */
993      dst[3] = antic.color_lookup[src[BYTE_XOR(0)]] | antic.color_lookup[src[BYTE_XOR(1)]] << 16;
987      dst[3] = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
994988      src += 2;
995989      dst += 4;
996990      for( x = 1; x < HCHARS-1; x++ )
997991      {
998         *dst++ = antic.color_lookup[src[BYTE_XOR(0)]] | antic.color_lookup[src[BYTE_XOR(1)]] << 16;
999         *dst++ = antic.color_lookup[src[BYTE_XOR(2)]] | antic.color_lookup[src[BYTE_XOR(3)]] << 16;
992         *dst++ = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
993         *dst++ = antic.color_lookup[src[BYTE_XOR_LE(2)]] | antic.color_lookup[src[BYTE_XOR_LE(3)]] << 16;
1000994         src += 4;
1001995      }
1002      dst[0] = antic.color_lookup[src[BYTE_XOR(0)]] | antic.color_lookup[src[BYTE_XOR(1)]] << 16;
996      dst[0] = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
1003997   }
1004998   else
1005999   {
r4184r4185
10321026                  }
10331027                  else
10341028                  {
1035                     *dst++ = antic.color_lookup[src[BYTE_XOR(0)]] | antic.color_lookup[src[BYTE_XOR(1)]] << 16;
1029                     *dst++ = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
10361030                  }
1037                  *dst++ = antic.color_lookup[src[BYTE_XOR(2)]] | antic.color_lookup[src[BYTE_XOR(3)]] << 16;
1031                  *dst++ = antic.color_lookup[src[BYTE_XOR_LE(2)]] | antic.color_lookup[src[BYTE_XOR_LE(3)]] << 16;
10381032                  src += 4;
10391033               }
10401034               for ( ; x < HCHARS-1; x++ )
src/mame/video/segas32.c
r4184r4185
189189 *
190190 *************************************/
191191
192#ifdef LSB_FIRST
193#define SWAP_HALVES(x)         (x)
194#else
195#define SWAP_HALVES(x)         (((x) >> 16) | ((x) << 16))
196#endif
192#define SWAP_HALVES(x)         NATIVE_ENDIAN_VALUE_LE_BE(x, ((x) >> 16) | ((x) << 16))
197193
198194
199195
src/mame/video/taito_f3.c
r4184r4185
937937
938938/*============================================================================*/
939939
940#ifdef LSB_FIRST
941#define COLOR1 0
942#define COLOR2 1
943#define COLOR3 2
944#else
945#define COLOR1 3
946#define COLOR2 2
947#define COLOR3 1
948#endif
940#define COLOR1 BYTE4_XOR_LE(0)
941#define COLOR2 BYTE4_XOR_LE(1)
942#define COLOR3 BYTE4_XOR_LE(2)
949943
950944
951945
src/mame/video/genesis.c
r4184r4185
3636#define VDP_VRAM_WORD(x)   ((VDP_VRAM_BYTE(x) << 8) | VDP_VRAM_BYTE((x) + 1))
3737#define VDP_VSRAM_WORD(x)   ((VDP_VSRAM_BYTE(x) << 8) | VDP_VSRAM_BYTE((x) + 1))
3838
39#ifdef LSB_FIRST
40#define EXTRACT_PIXEL(x,i)   (((x) >> (((i) ^ 1) * 4)) & 0x0f)
41#else
42#define EXTRACT_PIXEL(x,i)   (((x) >> (((i) ^ 7) * 4)) & 0x0f)
43#endif
39#define EXTRACT_PIXEL(x,i)   (((x) >> (((i) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,7)) * 4)) & 0x0f)
4440
4541
4642
src/mame/layout/igspoker.lay
r0r4185
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="L1" defstate="1">
4      <rect state="1">
5         <color red="0.0" green="1.0" blue="0.0" />
6      </rect>
7      <rect state="0">
8         <color red="0.0" green="0.2" blue="0.0" />
9      </rect>
10      <text string="HOLD1">
11         <color red="0.0" green="0.0" blue="0.0" />
12         <bounds x="0" y="0.1" width="1" height="0.8" />
13      </text>
14   </element>
15
16   <element name="L2" defstate="1">
17      <rect state="1">
18         <color red="0.0" green="1.0" blue="0.0" />
19      </rect>
20      <rect state="0">
21         <color red="0.0" green="0.2" blue="0.0" />
22      </rect>
23      <text string="HOLD2">
24         <color red="0.0" green="0.0" blue="0.0" />
25         <bounds x="0" y="0.1" width="1" height="0.8" />
26      </text>
27   </element>
28
29   <element name="L3" defstate="1">
30      <rect state="1">
31         <color red="0.0" green="1.0" blue="0.0" />
32      </rect>
33      <rect state="0">
34         <color red="0.0" green="0.2" blue="0.0" />
35      </rect>
36      <text string="HOLD3">
37         <color red="0.0" green="0.0" blue="0.0" />
38         <bounds x="0" y="0.1" width="1" height="0.8" />
39      </text>
40   </element>
41
42   <element name="L4" defstate="1">
43      <rect state="1">
44         <color red="0.0" green="1.0" blue="0.0" />
45      </rect>
46      <rect state="0">
47         <color red="0.0" green="0.2" blue="0.0" />
48      </rect>
49      <text string="HOLD4">
50         <color red="0.0" green="0.0" blue="0.0" />
51         <bounds x="0" y="0.1" width="1" height="0.8" />
52      </text>
53   </element>
54
55   <element name="L5" defstate="1">
56      <rect state="1">
57         <color red="0.0" green="1.0" blue="0.0" />
58      </rect>
59      <rect state="0">
60         <color red="0.0" green="0.2" blue="0.0" />
61      </rect>
62      <text string="HOLD5">
63         <color red="0.0" green="0.0" blue="0.0" />
64         <bounds x="0" y="0.1" width="1" height="0.8" />
65      </text>
66   </element>
67
68   <element name="L6" defstate="1">
69      <rect state="1">
70         <color red="1.0" green="0.0" blue="0.0" />
71      </rect>
72      <rect state="0">
73         <color red="0.3" green="0.0" blue="0.0" />
74      </rect>
75      <text string="START">
76         <color red="0.0" green="0.0" blue="0.0" />
77         <bounds x="0" y="0.1" width="1" height="0.8" />
78      </text>
79   </element>
80
81
82   <view name="Button Lamps">
83      <screen index="0">
84         <bounds left="0" top="0" right="4" bottom="3" />
85      </screen>
86      <bezel name="lamp1" element="L1">
87         <bounds x="0.5" y="3.13" width="0.40" height="0.24" />
88      </bezel>
89      <bezel name="lamp2" element="L2">
90         <bounds x="1.0" y="3.13" width="0.40" height="0.24" />
91      </bezel>
92      <bezel name="lamp3" element="L3">
93         <bounds x="1.5" y="3.13" width="0.40" height="0.24" />
94      </bezel>
95      <bezel name="lamp4" element="L4">
96         <bounds x="2.0" y="3.13" width="0.40" height="0.24" />
97      </bezel>
98      <bezel name="lamp5" element="L5">
99         <bounds x="2.5" y="3.13" width="0.40" height="0.24" />
100      </bezel>
101      <bezel name="lamp6" element="L6">
102         <bounds x="3.0" y="3.13" width="0.40" height="0.24" />
103      </bezel>
104   </view>
105</mamelayout>
src/mame/layout/stepstag.lay
r0r4185
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <view name="Screen 0 Standard (3:4)">
4      <screen index="0">
5         <bounds left="0" top="0" right="3" bottom="4" />
6         <orientation rotate="270" />
7      </screen>
8   </view>
9
10   <view name="Screen 1 Standard (4:3)">
11      <screen index="1">
12         <bounds left="0" top="0" right="4" bottom="3" />
13      </screen>
14   </view>
15
16   <view name="Screen 2 Standard (3:4)">
17      <screen index="2">
18         <bounds left="0" top="0" right="3" bottom="4" />
19         <orientation rotate="270" />
20      </screen>
21   </view>
22
23   <view name="Screen 0 Pixel Aspect (~scr0nativeyaspect~:~scr0nativexaspect~)">
24      <screen index="0">
25         <bounds left="0" top="0" right="~scr0height~" bottom="~scr0width~" />
26         <orientation rotate="270" />
27      </screen>
28   </view>
29
30   <view name="Screen 1 Pixel Aspect (~scr1nativexaspect~:~scr1nativeyaspect~)">
31      <screen index="1">
32         <bounds left="0" top="0" right="~scr1width~" bottom="~scr1height~" />
33      </screen>
34   </view>
35
36   <view name="Screen 2 Pixel Aspect (~scr2nativeyaspect~:~scr2nativexaspect~)">
37      <screen index="2">
38         <bounds left="0" top="0" right="~scr2height~" bottom="~scr2width~" />
39         <orientation rotate="270" />
40      </screen>
41   </view>
42
43   <view name="Stepping Stage Custom">
44      <screen index="0">
45         <bounds x="0" y="0" width="9" height="12" />
46         <orientation rotate="270" />
47      </screen>
48      <screen index="1">
49         <bounds x="9" y="0" width="16" height="12" />
50      </screen>
51      <screen index="2">
52         <bounds x="28.36" y="0" width="9" height="12" />
53         <orientation rotate="270" />
54      </screen>
55   </view>
56
57</mamelayout>
src/mame/drivers/rungun.c
r4184r4185
446446   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
447447INPUT_PORTS_END
448448
449#define ROM_LOAD64_WORD(name,offset,length,crc)      ROMX_LOAD(name, offset, length, crc, ROM_GROUPWORD | ROM_SKIP(6))
450449
451450ROM_START( rungun )
452451   /* main program Europe Version AA  1993, 10.8 */
src/mame/drivers/ultrsprt.c
r4184r4185
8686
8787   /* configure fast RAM regions for DRC */
8888   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
89   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
90   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x0007ffff);
89   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x80000000);
90   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x8007ffff);
9191   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, vram);
9292   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
9393
9494   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 1);
95   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x7f000000);
96   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x7f01ffff);
95   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0xff000000);
96   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0xff01ffff);
9797   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, workram);
9898   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
9999}
r4184r4185
110110   AM_RANGE(0x700000e0, 0x700000e3) AM_WRITE(int_ack_w)
111111   AM_RANGE(0x7f000000, 0x7f01ffff) AM_RAM AM_BASE(&workram)
112112   AM_RANGE(0x7f700000, 0x7f703fff) AM_RAM_WRITE(palette_w) AM_BASE(&paletteram32)
113   AM_RANGE(0x7fa00000, 0x7fbfffff) AM_ROM AM_SHARE(1)
114   AM_RANGE(0x7fc00000, 0x7fdfffff) AM_ROM AM_SHARE(1)
115   AM_RANGE(0x7fe00000, 0x7fffffff) AM_ROM AM_REGION("user1", 0) AM_SHARE(1)
113   AM_RANGE(0x7f800000, 0x7f9fffff) AM_MIRROR(0x00600000) AM_ROM AM_REGION("user1", 0)
116114ADDRESS_MAP_END
117115
118116
r4184r4185
167165}
168166
169167static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 )
170   AM_RANGE(0x00000000, 0x0001ffff) AM_READ(SMH_ROM)
168   AM_RANGE(0x00000000, 0x0001ffff) AM_ROM
171169   AM_RANGE(0x00100000, 0x00101fff) AM_RAM
172170   AM_RANGE(0x00200000, 0x00200007) AM_WRITE(K056800_68k_w)
173171   AM_RANGE(0x00200008, 0x0020000f) AM_READ(K056800_68k_r)
src/mame/drivers/seibuspi.c
r4184r4185
27202720   ROM_LOAD("sound1.u0222", 0x200000, 0x080000, CRC(b7bd3703) SHA1(6427a7e6de10d6743d6e64b984a1d1c647f5643a) )
27212721ROM_END
27222722
2723ROM_START(rdft2u) /* SPI Cart, USA */
2724   ROM_REGION32_LE(0x200000, "user1", 0)   /* i386 program */
2725   ROM_LOAD32_BYTE("1.bin", 0x000000, 0x80000, CRC(b7d6c866) SHA1(eefe63dfc641c3904dd150a10ffeb68137068725) )
2726   ROM_LOAD32_BYTE("2.bin", 0x000001, 0x80000, CRC(ff7747c5) SHA1(7481d0484001ff7367af56e8ea99f985cce405f2) )
2727   ROM_LOAD32_BYTE("3.bin", 0x000002, 0x80000, CRC(86e3d1a8) SHA1(2757cfda57c82dd0f66427caf54eb1f40e85740d) )
2728   ROM_LOAD32_BYTE("4.bin", 0x000003, 0x80000, CRC(2e409a76) SHA1(cf90aa14a07b5aa861f6f7cc9b1968171e532557) )
2729
2730   ROM_REGION( 0x30000, "gfx1", 0)
2731   ROM_LOAD24_BYTE("fix0.u0524", 0x000001, 0x10000, CRC(6fdf4cf6) SHA1(7e9d4a49e829dfdc373c0f5acfbe8c7a91ac115b) )
2732   ROM_LOAD24_BYTE("fix1.u0518", 0x000000, 0x10000, CRC(69b7899b) SHA1(d3cacd4ef4d2c95d803403101beb9d4be75fae61) )
2733   ROM_LOAD24_BYTE("fixp.u0514", 0x000002, 0x10000, CRC(99a5fece) SHA1(44ae95d650ed6e00202d3438f5f91a5e52e319cb) )
2734
2735   ROM_REGION( 0xc00000, "gfx2", 0)   /* background layer roms */
2736   ROM_LOAD24_WORD("bg-1d.u0535", 0x000000, 0x400000, CRC(6143f576) SHA1(c034923d0663d9ef24357a03098b8cb81dbab9f8) )
2737   ROM_LOAD24_BYTE("bg-1p.u0537", 0x000002, 0x200000, CRC(55e64ef7) SHA1(aae991268948d07342ee8ba1b3761bd180aab8ec) )
2738   ROM_LOAD24_WORD("bg-2d.u0536", 0x600000, 0x400000, CRC(c607a444) SHA1(dc1aa96a42e9394ca6036359670a4ec6f830c96d) )
2739   ROM_LOAD24_BYTE("bg-2p.u0538", 0x600002, 0x200000, CRC(f0830248) SHA1(6075df96b49e70d2243fef691e096119e7a4d044) )
2740
2741   ROM_REGION( 0x1200000, "gfx3", 0)   /* sprites */
2742   ROM_LOAD("obj3.u0434",  0x0000000, 0x400000, CRC(e08f42dc) SHA1(5188d71d4355eaf43ea8893b4cfc4fe80cc24f41) )
2743   ROM_LOAD("obj3b.u0433", 0x0400000, 0x200000, CRC(1b6a523c) SHA1(99a420dbc8e22e7832ccda7cec9fa661a2a2687a) )
2744   ROM_LOAD("obj2.u0431",  0x0600000, 0x400000, CRC(7aeadd8e) SHA1(47103c0579240c5b1add4d0b164eaf76f5fa97f0) )
2745   ROM_LOAD("obj2b.u0432", 0x0a00000, 0x200000, CRC(5d790a5d) SHA1(1ed5d4ad4c9a7e505ce35dcc90d184c26ce891dc) )
2746   ROM_LOAD("obj1.u0429",  0x0c00000, 0x400000, CRC(c2c50f02) SHA1(b81397b5800c6d49f58b7ac7ff6eac56da3c5257) )
2747   ROM_LOAD("obj1b.u0430", 0x1000000, 0x200000, CRC(5259321f) SHA1(3c70c1147e49f81371d0f60f7108d9718d56faf4) )
2748
2749   ROM_REGION(0x200000, "ymf", ROMREGION_ERASE00)
2750
2751   ROM_REGION(0x280000, "user2", ROMREGION_ERASE00)   /* sound roms */
2752   ROM_LOAD("pcm.u0217",    0x000000, 0x200000, CRC(2edc30b5) SHA1(c25d690d633657fc3687636b9070f36bd305ae06) )
2753   ROM_LOAD("sound1.u0222", 0x200000, 0x080000, CRC(b7bd3703) SHA1(6427a7e6de10d6743d6e64b984a1d1c647f5643a) )
2754ROM_END
2755
27232756ROM_START(rdft2j) /* SPI Cart, Japan */
27242757   ROM_REGION32_LE(0x200000, "user1", 0)   /* i386 program */
27252758   ROM_LOAD32_BYTE("prg0.sei", 0x000000, 0x80000, CRC(a60c4e7c) SHA1(7789b029d0ac084c7e5e662a7168edaed8f11633) )
r4184r4185
31563189GAME( 1997, rdft2a,    rdft2,   spi,      spi_2button, rdft2,  ROT270, "Seibu Kaihatsu (Metrotainment license)", "Raiden Fighters 2 (Asia, Metrotainment license, SPI)",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
31573190GAME( 1997, rdft2j,    rdft2,   spi,      spi_2button, rdft2,  ROT270, "Seibu Kaihatsu", "Raiden Fighters 2 (Japan, SPI)",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
31583191GAME( 1997, rdft2t,    rdft2,   spi,      spi_2button, rdft2,  ROT270, "Seibu Kaihatsu", "Raiden Fighters 2 (Taiwan, SPI)",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
3192GAME( 1997, rdft2u,    rdft2,   spi,      spi_2button, rdft2,  ROT270, "Seibu Kaihatsu (Fabtek license)", "Raiden Fighters 2 (USA, SPI)",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
31593193
31603194GAME( 1998, rfjet,     0,       spi,      spi_2button, rfjet,    ROT270, "Seibu Kaihatsu (Tuning license)", "Raiden Fighters Jet",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
31613195GAME( 1998, rfjetu,    rfjet,   spi,      spi_2button, rfjet,    ROT270, "Seibu Kaihatsu (Fabtek license)", "Raiden Fighters Jet (US)",  GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
src/mame/drivers/drw80pkr.c
r4184r4185
3030#include "sound/ay8910.h"
3131#include "cpu/mcs48/mcs48.h"
3232
33#define CPU_CLOCK XTAL_7_8643MHz
34
3335static tilemap *bg_tilemap;
3436
3537static UINT8 p1, p2, prog, bus;
3638
37static UINT8 *pkr_cmos_ram;
39static UINT8 *pkr_io_ram;
40static UINT8 active_bank = 0;
3841
42static UINT16 video_ram[0x0400];
43static UINT8 color_ram[0x0400];
3944
45
4046/*****************
4147* Write Handlers *
4248******************/
r4184r4185
5359
5460static WRITE8_HANDLER( prog_w )
5561{
56   /* this is written via an out to port 4, but unless there is an 8243 port expander,
57       it is more likely that the port 4 output is used to toggle the PROG line; see
58       videopkr */
5962   prog = data;
63
64   // Bankswitch Program Memory
65   if (prog == 0x01)
66   {
67      active_bank++;
68      if (active_bank == 2)
69         active_bank = 0;
70
71      memory_set_bank(space->machine, 1, active_bank);
72   }
6073}
6174
6275static WRITE8_HANDLER( bus_w )
r4184r4185
6477   bus = data;
6578}
6679
67static WRITE8_HANDLER( drw80pkr_cmos_w )
80static WRITE8_HANDLER( drw80pkr_io_w )
6881{
69    //if (p2 == 0xc7) CRTC Register
70    //if (p2 == 0xd7) CRTC Address
71    pkr_cmos_ram[offset] = data;
82   static UINT16 n_offs;
83   static UINT16 n_data;
84   static UINT16 add;
85
86
87   if (p2 == 0x3f) // write cg address
88   {
89      if (p1 == 0xbf || p1 == 0x3f)
90      {
91         n_data = data;
92      }
93      if (p1 == 0x7f && data != 0x0f)
94      {
95         n_data = data + 0x100;
96      }
97
98      add = ((p1 & 0xc0) << 2);
99      if (p1 == 0x3f && offset >= 0xf0)
100      {
101         add = 0x200;
102      }
103      n_offs = (add) + (0xff-offset);
104
105      video_ram[n_offs] = n_data;
106
107      tilemap_mark_tile_dirty(bg_tilemap, n_offs);
108   }
109
110   if (p2 == 0x7f) // write palette
111   {
112      n_offs = ((p1 & 0xc0) << 2 ) + (0xff-offset);
113
114      color_ram[n_offs] = 0;//data & 0x0f;
115
116      if (data < 0x10)
117         video_ram[n_offs] = video_ram[n_offs] + 0x100;
118
119      tilemap_mark_tile_dirty(bg_tilemap, n_offs);
120   }
121
122   // ay8910_control_port_0_w
123   if (p1 == 0xfc && p2 == 0xff && offset == 0x00)
124      ay8910_control_port_0_w(space, 0, data);
125
126   // ay8910_write_port_0_w
127   if (p1 == 0xfe && p2 == 0xff && offset == 0x00)
128      ay8910_write_port_0_w(space, 1, data);
129
130   // CRTC Register
131   // R0 = 0x1f(31)    Horizontal Total
132   // R1 = 0x18(24)    Horizontal Displayed
133   // R2 = 0x1a(26)    Horizontal Sync Position
134   // R3 = 0x34(52)    HSYNC/VSYNC Widths
135   // R4 = 0x1f(31)    Vertical Total
136   // R5 = 0x01(01)    Vertical Total Adjust
137   // R6 = 0x1b(27)    Vertical Displayed
138   // R7 = 0x1c(28)    Vertical Sync Position
139   // R8 = 0x10        Mode Control
140   //                  Non-interlace
141   //                  Straight Binary - Ram Addressing
142   //                  Shared Memory - Ram Access
143   //                  Delay Display Enable one character time
144   //                  No Delay Cursor Skew
145   // R9 = 0x07(07)    Scan Line
146   // R10 = 0x00       Cursor Start
147   // R11 = 0x00       Cursor End
148   // R12 = 0x00       Display Start Address (High)
149   // R13 = 0x00       Display Start Address (Low)
150    //if (p1 == 0xff && p2 == 0xc7)
151
152   // CRTC Address
153    //if (p1 == 0xff && p2 == 0xd7)
154
155   pkr_io_ram[offset] = data;
72156}
73157
74158/****************
r4184r4185
90174    return bus;
91175}
92176
93static READ8_HANDLER( drw80pkr_cmos_r )
177static READ8_HANDLER( drw80pkr_io_r )
94178{
95    return pkr_cmos_ram[offset];
179    return pkr_io_ram[offset];
96180}
97181
182
98183/****************************
99184* Video/Character functions *
100185****************************/
101186
102187static TILE_GET_INFO( get_bg_tile_info )
103188{
104    int vr = 0;
105   int code = vr;
106   int color = 0;
189   int color = color_ram[tile_index];
190   int code = video_ram[tile_index];
107191
108192   SET_TILE_INFO(0, code, color, 0);
109193}
110194
111195static VIDEO_START( drw80pkr )
112196{
113   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 40, 25);
197   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 24, 27);
114198}
115199
116200static VIDEO_UPDATE( drw80pkr )
r4184r4185
164248static const gfx_layout charlayout =
165249{
166250   8,8,    /* 8x8 characters */
167   0x200, /* 512 characters */
251   RGN_FRAC(1,2), /* 512 characters */
168252   2,  /* 2 bitplanes */
169   { 0x200*8*8*1, 0x200*8*8*0 }, /* bitplane offsets */
170   { 0, 1, 2, 3, 4, 5, 6, 7 },
171   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
253   { RGN_FRAC(1,2), 0 },
254   { STEP8(0,1) },
255   { STEP8(0,8) },
172256   8*8
173257};
174258
r4184r4185
188272
189273static DRIVER_INIT( drw80pkr )
190274{
191
275   memory_configure_bank(machine, 1, 0, 2, memory_region(machine, "main"), 0x1000);
192276}
193277
194278
r4184r4185
197281*************************/
198282
199283static ADDRESS_MAP_START( drw80pkr_map, ADDRESS_SPACE_PROGRAM, 8 )
200   AM_RANGE(0x0000, 0x1fff) AM_READWRITE(SMH_ROM, SMH_ROM)
284   AM_RANGE(0x0000, 0x1fff) AM_ROMBANK(1)
201285ADDRESS_MAP_END
202286
203287static ADDRESS_MAP_START( drw80pkr_io_map, ADDRESS_SPACE_IO, 8 )
204   AM_RANGE(0x00, 0xff) AM_READWRITE(drw80pkr_cmos_r, drw80pkr_cmos_w) AM_BASE(&pkr_cmos_ram)
288   AM_RANGE(0x00, 0xff) AM_READWRITE(drw80pkr_io_r, drw80pkr_io_w) AM_BASE(&pkr_io_ram)
205289   AM_RANGE(MCS48_PORT_T1,   MCS48_PORT_T1) AM_RAM
206290   AM_RANGE(MCS48_PORT_P1,   MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w)
207291   AM_RANGE(MCS48_PORT_P2,   MCS48_PORT_P2) AM_READWRITE(p2_r, p2_w)
r4184r4185
223307
224308static MACHINE_DRIVER_START( drw80pkr )
225309   // basic machine hardware
226   MDRV_CPU_ADD("main", I8039, 7864300)
310   MDRV_CPU_ADD("main", I8039, CPU_CLOCK)
227311   MDRV_CPU_PROGRAM_MAP(drw80pkr_map, 0)
228312    MDRV_CPU_IO_MAP(drw80pkr_io_map, 0)
229313   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
r4184r4185
257341ROM_START( drw80pkr )
258342   ROM_REGION( 0x2000, "main", 0 )
259343   ROM_LOAD( "pm0.u81",   0x0000, 0x1000, CRC(0f3e97d2) SHA1(aa9e4015246284f32435d7320de667e075412e5b) )
260    ROM_LOAD( "pm1.u82",   0x1000, 0x1000, CRC(5a6ad467) SHA1(0128bd70b65244a0f68031d5f451bf115eeb7609) )
344   ROM_LOAD( "pm1.u82",   0x1000, 0x1000, CRC(5a6ad467) SHA1(0128bd70b65244a0f68031d5f451bf115eeb7609) )
261345
262   ROM_REGION( 0x100000, "gfx1", ROMREGION_DISPOSE )
346
347   ROM_REGION( 0x002000, "gfx1", ROMREGION_DISPOSE )
263348   ROM_LOAD( "cg0-a.u74",    0x0000, 0x1000, CRC(97f5eb92) SHA1(f6c7bb42ccef8a78e8d56104ad942ae5b8e5b0df) )
264349   ROM_LOAD( "cg1-a.u76",    0x1000, 0x1000, CRC(2a3a750d) SHA1(db6183d11b2865b011c3748dc472cf5858dde78f) )
265350
src/mame/drivers/goodejan.c
r4184r4185
5252
5353#include "driver.h"
5454#include "cpu/nec/nec.h"
55#include "deprecat.h"
5655#include "audio/seibu.h"
5756#include "sound/3812intf.h"
57#include "includes/sei_crtc.h"
5858
5959#define GOODEJAN_MHZ1 7159090
6060#define GOODEJAN_MHZ2 16000000
6161#define GOODEJAN_MHZ3 12000000
6262
63extern UINT16 *goodejan_bgvram, *goodejan_txvram;
63extern UINT16 *seibucrtc_sc0vram,*seibucrtc_sc1vram,*seibucrtc_sc2vram,*seibucrtc_sc3vram;
64extern UINT16 *seibucrtc_vregs;
65extern UINT16 seibucrtc_sc0bank;
6466static UINT16 goodejan_mux_data;
6567
66WRITE16_HANDLER( goodejan_bgvram_w );
67WRITE16_HANDLER( goodejan_txvram_w );
68WRITE16_HANDLER( goodejan_bg_scrollx_w );
69WRITE16_HANDLER( goodejan_bg_scrolly_w );
70WRITE16_HANDLER( goodejan_layer_en_w );
71WRITE16_HANDLER( goodejan_gfxbank_w );
68WRITE16_HANDLER( goodejan_gfxbank_w )
69{
70   seibucrtc_sc0bank_w((data & 0x100)>>8);// = (data & 0x100)>>8;
71}
7272
73VIDEO_START( goodejan );
74VIDEO_UPDATE( goodejan );
75
7673/* Multiplexer device for the mahjong panel */
7774static READ16_HANDLER( mahjong_panel_r )
7875{
r4184r4185
9895
9996static ADDRESS_MAP_START( goodejan_map, ADDRESS_SPACE_PROGRAM, 16 )
10097   AM_RANGE(0x00000, 0x0afff) AM_RAM
101   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(goodejan_bgvram_w) AM_BASE(&goodejan_bgvram)
98   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(seibucrtc_sc0vram_w) AM_BASE(&seibucrtc_sc0vram)
99   AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(seibucrtc_sc3vram_w) AM_BASE(&seibucrtc_sc3vram)
102100   AM_RANGE(0x0d000, 0x0dfff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
103   AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(goodejan_txvram_w) AM_BASE(&goodejan_txvram)
101   /*Guess: these two aren't used/initialized at all.*/
102   AM_RANGE(0x0e000, 0x0e7ff) AM_RAM_WRITE(seibucrtc_sc1vram_w) AM_BASE(&seibucrtc_sc1vram)
103   AM_RANGE(0x0e800, 0x0efff) AM_RAM_WRITE(seibucrtc_sc2vram_w) AM_BASE(&seibucrtc_sc2vram)
104104   AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_BASE(&spriteram16)
105105   AM_RANGE(0xc0000, 0xfffff) AM_ROM
106106ADDRESS_MAP_END
r4184r4185
108108/*totmejan CRT is at 8000-804f,goodejan is at 8040-807f(808f but not tested)*/
109109static ADDRESS_MAP_START( common_io_map, ADDRESS_SPACE_IO, 16 )
110110   AM_RANGE(0x9000, 0x9001) AM_WRITE(goodejan_gfxbank_w)
111   AM_RANGE(0x8020, 0x8023) AM_WRITENOP
112111   AM_RANGE(0xb000, 0xb003) AM_WRITENOP
113112   AM_RANGE(0xb004, 0xb005) AM_WRITE(mahjong_panel_w)
114113
115114   AM_RANGE(0xc000, 0xc001) AM_READ_PORT("DSW1")
116115   AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r)
117   AM_RANGE(0xc004, 0xc005) AM_READ_PORT("DSW2") // maybe it's a seibu_main_word mirror?
116   AM_RANGE(0xc004, 0xc005) AM_READ_PORT("DSW2") // switches
118117   AM_RANGE(0xd000, 0xd00f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
119118ADDRESS_MAP_END
120119
121120static ADDRESS_MAP_START( totmejan_io_map, ADDRESS_SPACE_IO, 16 )
122   AM_RANGE(0x801c, 0x801d) AM_WRITE(goodejan_layer_en_w )
121   AM_RANGE(0x8000, 0x804f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_BASE(&seibucrtc_vregs)
123122ADDRESS_MAP_END
124123
125124static ADDRESS_MAP_START( goodejan_io_map, ADDRESS_SPACE_IO, 16 )
126   AM_RANGE(0x805c, 0x805d) AM_WRITE(goodejan_layer_en_w )
127   AM_RANGE(0x8060, 0x8061) AM_WRITE(goodejan_bg_scrollx_w )
128   AM_RANGE(0x8062, 0x8063) AM_WRITE(goodejan_bg_scrolly_w )
125   AM_RANGE(0x8040, 0x807f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_BASE(&seibucrtc_vregs)
129126ADDRESS_MAP_END
130127
131128static INPUT_PORTS_START( goodejan )
r4184r4185
313310};
314311
315312static GFXDECODE_START( goodejan )
316   GFXDECODE_ENTRY( "gfx3", 0, tilelayout, 0x200, 0x40 ) /* Sprites */
317   GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0x000, 0x30 ) /* Tiles */
318   GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0x100, 0x10 ) /* Text */
313   GFXDECODE_ENTRY( "spr_gfx", 0,tilelayout, 0x200, 0x40 ) /* Sprites */
314   GFXDECODE_ENTRY( "bg_gfx", 0, tilelayout, 0x000, 0x30 ) /* Tiles */
315   GFXDECODE_ENTRY( "md_gfx", 0, tilelayout, 0x300, 0x10 ) /* Text */
316   GFXDECODE_ENTRY( "fg_gfx", 0, tilelayout, 0x600, 0x10 ) /* Tiles */
317   GFXDECODE_ENTRY( "tx_gfx", 0, charlayout, 0x100, 0x10 ) /* Text */
319318GFXDECODE_END
320319
321static INTERRUPT_GEN( goodejan_interrupt )
320static INTERRUPT_GEN( goodejan_irq )
322321{
323   if (cpu_getiloops(device))
324      cpu_set_input_line_and_vector(device,0,HOLD_LINE,0x208/4);
325   else
326      cpu_set_input_line_and_vector(device,0,HOLD_LINE,0x00c/4);
322   cpu_set_input_line_and_vector(device,0,HOLD_LINE,0x208/4);
323/* vector 0x00c is just a reti */
327324}
328325
329326static MACHINE_DRIVER_START( goodejan )
r4184r4185
332329   MDRV_CPU_ADD("main", V30, GOODEJAN_MHZ2/2)
333330   MDRV_CPU_PROGRAM_MAP(goodejan_map,0)
334331   MDRV_CPU_IO_MAP(common_io_map,goodejan_io_map)
335   MDRV_CPU_VBLANK_INT_HACK(goodejan_interrupt,2)
332   MDRV_CPU_VBLANK_INT("main",goodejan_irq)
336333
337334   SEIBU_SOUND_SYSTEM_CPU(GOODEJAN_MHZ1/2)
338335
r4184r4185
344341   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
345342   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
346343   MDRV_SCREEN_SIZE(32*8, 32*8)
347   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
344   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) //TODO: dynamic resolution
348345
349346   MDRV_GFXDECODE(goodejan)
350347   MDRV_PALETTE_LENGTH(0x1000)
351348
352   MDRV_VIDEO_START(goodejan)
353   MDRV_VIDEO_UPDATE(goodejan)
349   MDRV_VIDEO_START(seibu_crtc)
350   MDRV_VIDEO_UPDATE(seibu_crtc)
354351
355352   /* sound hardware */
356353   SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(GOODEJAN_MHZ1/2,GOODEJAN_MHZ2/16)
r4184r4185
372369   ROM_CONTINUE(             0x010000, 0x08000 )
373370   ROM_COPY( "audio", 0, 0x018000, 0x08000 )
374371
375   ROM_REGION( 0x20000, "gfx1", ROMREGION_ERASEFF | ROMREGION_DISPOSE )
376   ROM_LOAD16_BYTE( "3.063",  0x00000, 0x10000, CRC(61b5ae88) SHA1(16105a4e97765454079deda8eaa456d60d44e906) )
377   ROM_LOAD16_BYTE( "4.061",  0x00001, 0x10000, CRC(29fb6ad2) SHA1(8a9c4625472daefca7fb73a9ef3717e86c3d632f) )
372   ROM_REGION( 0x080000, "spr_gfx", ROMREGION_DISPOSE )
373   ROM_LOAD( "e-jan.078", 0x000000, 0x080000, CRC(ff9ee9d8) SHA1(5e49e9a666630ca9867ee96b9d2b8d6f503b25df) )
378374
379   ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE )
375   ROM_REGION( 0x100000, "bg_gfx", ROMREGION_DISPOSE )
380376   ROM_LOAD( "e-jan.064", 0x000000, 0x100000, CRC(5f6185ee) SHA1(599e4a574672cd1571032e879b3032d06b70e4e2) )
381377
382   ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE )
383   ROM_LOAD( "e-jan.078", 0x000000, 0x080000, CRC(ff9ee9d8) SHA1(5e49e9a666630ca9867ee96b9d2b8d6f503b25df) )
378   ROM_REGION( 0x20000, "md_gfx", ROMREGION_DISPOSE )
379   /*Empty*/
380   ROM_REGION( 0x20000, "fg_gfx", ROMREGION_DISPOSE )
381   /*Empty*/
384382
383   ROM_REGION( 0x20000, "tx_gfx", ROMREGION_ERASEFF | ROMREGION_DISPOSE )
384   ROM_LOAD16_BYTE( "3.063",  0x00000, 0x10000, CRC(61b5ae88) SHA1(16105a4e97765454079deda8eaa456d60d44e906) )
385   ROM_LOAD16_BYTE( "4.061",  0x00001, 0x10000, CRC(29fb6ad2) SHA1(8a9c4625472daefca7fb73a9ef3717e86c3d632f) )
386
385387   ROM_REGION( 0x80000, "oki", 0 )    /* ADPCM samples */
386388   ROM_LOAD( "e-jan.0911", 0x00000, 0x80000, CRC(a7fb93c2) SHA1(c2e1300f142032c087c96e1a785af28a6d678947) )
387389
r4184r4185
399401   ROM_CONTINUE(             0x010000, 0x08000 )
400402   ROM_COPY( "audio", 0, 0x018000, 0x08000 )
401403
402   ROM_REGION( 0x20000, "gfx1", ROMREGION_ERASEFF | ROMREGION_DISPOSE )
403   ROM_LOAD16_BYTE( "3.063",  0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) )
404   ROM_LOAD16_BYTE( "4.061",  0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) )
404   ROM_REGION( 0x080000, "spr_gfx", ROMREGION_DISPOSE )
405   ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) )
405406
406   ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE )
407   ROM_REGION( 0x100000, "bg_gfx", ROMREGION_DISPOSE )
407408   ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) )
408409
409   ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE )
410   ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) )
410   ROM_REGION( 0x20000, "md_gfx", ROMREGION_DISPOSE )
411   /*Empty*/
412   ROM_REGION( 0x20000, "fg_gfx", ROMREGION_DISPOSE )
413   /*Empty*/
411414
415   ROM_REGION( 0x20000, "tx_gfx", ROMREGION_ERASEFF | ROMREGION_DISPOSE )
416   ROM_LOAD16_BYTE( "3.063",  0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) )
417   ROM_LOAD16_BYTE( "4.061",  0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) )
418
412419   ROM_REGION( 0x80000, "oki", 0 )    /* ADPCM samples */
413420   ROM_LOAD( "e-jan.911", 0x00000, 0x80000, CRC(6d2cbc35) SHA1(61f47e2a94b8877906224f46d8301a26a0b9e55f) )
414421
r4184r4185
426433   ROM_CONTINUE(             0x010000, 0x08000 )
427434   ROM_COPY( "audio", 0, 0x018000, 0x08000 )
428435
429   ROM_REGION( 0x20000, "gfx1", ROMREGION_ERASEFF | ROMREGION_DISPOSE )
430   ROM_LOAD16_BYTE( "3.063",  0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) )
431   ROM_LOAD16_BYTE( "4.061",  0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) )
436   ROM_REGION( 0x080000, "spr_gfx", ROMREGION_DISPOSE )
437   ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) )
432438
433   ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE )
439   ROM_REGION( 0x100000, "bg_gfx", ROMREGION_DISPOSE )
434440   ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) )
435441
436   ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE )
437   ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) )
442   ROM_REGION( 0x20000, "md_gfx", ROMREGION_DISPOSE )
443   /*Empty*/
444   ROM_REGION( 0x20000, "fg_gfx", ROMREGION_DISPOSE )
445   /*Empty*/
438446
447   ROM_REGION( 0x20000, "tx_gfx", ROMREGION_ERASEFF | ROMREGION_DISPOSE )
448   ROM_LOAD16_BYTE( "3.063",  0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) )
449   ROM_LOAD16_BYTE( "4.061",  0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) )
450
439451   ROM_REGION( 0x80000, "oki", 0 )    /* ADPCM samples */
440452   ROM_LOAD( "e-jan.911", 0x00000, 0x80000, CRC(6d2cbc35) SHA1(61f47e2a94b8877906224f46d8301a26a0b9e55f) )
441453
src/mame/drivers/segaybd.c
r4184r4185
22
33    Sega Y-board hardware
44
5Games supported:
6
7    G-LOC Air Battle
8    G-LOC R360
9    Galaxy Force 2
10    Power Drift
11    Rail Chase
12    Strike Fighter
13
14Known games currently not dumped:
15
16    Galaxy Force
17
518****************************************************************************
619
720    Known bugs:
r4184r4185
10071020/**************************************************************************************************************************
10081021 **************************************************************************************************************************
10091022 **************************************************************************************************************************
1023    Galaxy Force, Sega Y-board
1024    Sega Game ID: 831-6614 (two PCB board stack)
1025
1026    NOTE: An original PCB is very hard to locate intact.  Most of these boards were upgraded to Galaxy Force 2 through a
1027          chip swap upgrade.
1028
1029*/
1030
1031/**************************************************************************************************************************
1032 **************************************************************************************************************************
1033 **************************************************************************************************************************
10101034    Galaxy Force 2, Sega Y-board
10111035    CPU: 68000 (317-????)
10121036*/
src/mame/drivers/igspoker.c
r0r4185
1/*****************************************************************************
2
3Champion Poker by IGS   (documented by Mirko Buffoni)
4---
5
6Memory Layout (refers to CSK227IT.  Others may have different addresses)
7
8ROM:        0000-efff
9RAM:        f000-ffff
10
11---
12
13I/O Ports
14
15Palette:    2000-27ff   (low byte)
16            2800-2fff   (high byte)
17VideoRAM:   7000-77ff
18ColorRAM:   7800-7fff
19DSW1-5:     4000-4004   (see input ports section below)
20InputPorts: 50a0        (unused in this game)
21            5081-5082   (Coins and Keyboard)
22            5091        (Keyboard)
23Expansion:  8000-ffff   (R)     Used to read from an expansion rom
24
25Unknown:    5080        (RW)    (possibly related to ticket/hopper)
26            5090-5091   (RW)    (possibly related to eprom counters)
27            50b0-50b1   (W)     (OPL2 compatible chip)
28            5083        (W)     (used only at reset, maybe)
29            1000-10ff   (W) ???
30            6000-67ff   (W) ???
31            6800-6fff   (W)     Expansion video layer (used with ability)
32
33---
34
35Timing:
36
37Game is synchronized with VBLANK. It uses IRQ & NMI interrupts.
38During a frame, there must be 4 IRQs and 4 NMIs in order to play
39to the correct speed.
40
41---
42
43Notes about palette:
44Charset is 6 bit depth (thus 64 colors of granularity)
45Colortable is made up of 2 entries of 64 bytes for each palette,
46splitted, and colorinfo is stored to form the following word:
47
48xBBBBBGGGGGRRRRR    (Bit 15 is never used)
49
50---
51
52FIX:  csk227it has video issues, as after Ability game, bg_tilemap is not reset
53    so there must be some bg_enable command which I couldn't find, or rom is
54    from a beta version which has transparency issues.  This doesn't happen with
55    csk234it or New Champion Skill.
56    Insert credits with Key-In and press Pay-out to play ability game, and wait
57    for attract-mode to show cubes (not cards), which are transparent and reveal
58    background tilemap.
59
60*****************************************************************************/
61
62
63#include "driver.h"
64#include "deprecat.h"
65#include "cpu/z80/z80.h"
66#include "sound/2413intf.h"
67#include "igspoker.lh"
68
69
70
71
72
73static int nmi_enable, bg_enable, hopper;
74
75static MACHINE_RESET( igs )
76{
77   nmi_enable   =   0;
78   hopper      =   0;
79   bg_enable   =   1;
80}
81
82static INTERRUPT_GEN( igs_interrupt )
83{
84   if (cpu_getiloops(device) % 2) {
85      cpu_set_input_line(device, 0, HOLD_LINE);
86   } else {
87      if (nmi_enable)
88      cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
89   }
90}
91
92static READ8_HANDLER( igs_irqack_r )
93{
94   return 0;
95}
96
97static WRITE8_HANDLER( igs_irqack_w )
98{
99//  cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
100}
101
102
103
104static UINT8   *fg_tile_ram, *fg_color_ram, *bg_tile_ram;
105static tilemap *fg_tilemap, *bg_tilemap;
106
107static TILE_GET_INFO( get_bg_tile_info )
108{
109   int code = bg_tile_ram[tile_index];
110   SET_TILE_INFO(1 + (tile_index & 3), code, 0, 0);
111}
112
113static TILE_GET_INFO( get_fg_tile_info )
114{
115   int code = fg_tile_ram[tile_index] | (fg_color_ram[tile_index] << 8);
116   int tile = code & 0x1fff;
117   SET_TILE_INFO(0, code, tile != 0x1fff ? ((code >> 12) & 0xe) + 1 : 0, 0);
118}
119
120static WRITE8_HANDLER( bg_tile_w )
121{
122   bg_tile_ram[offset] = data;
123   tilemap_mark_tile_dirty(bg_tilemap,offset);
124}
125
126static WRITE8_HANDLER( fg_tile_w )
127{
128   fg_tile_ram[offset] = data;
129   tilemap_mark_tile_dirty(fg_tilemap,offset);
130}
131
132static WRITE8_HANDLER( fg_color_w )
133{
134   fg_color_ram[offset] = data;
135   tilemap_mark_tile_dirty(fg_tilemap,offset);
136}
137
138static VIDEO_START(igs_video)
139{
140   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,   8,  32,   64, 8);
141   fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,   8,  8,   64, 32);
142   tilemap_set_transparent_pen(fg_tilemap, 0);
143}
144
145static VIDEO_UPDATE(igs_video)
146{
147   bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
148
149   // FIX: CSK227IT must have some way to disable background, or wrong gfx?
150   if (bg_enable) tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
151
152   tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
153
154   return 0;
155}
156
157static UINT8 out[3];
158
159static void show_out(void)
160{
161#ifdef MAME_DEBUG
162   popmessage("%02x %02x", out[0], out[1]);
163#endif
164}
165
166static WRITE8_HANDLER( igs_nmi_and_coins_w )
167{
168   coin_counter_w(0,      data & 0x01);   // coin_a
169   coin_counter_w(1,      data & 0x04);   // coin_c
170   coin_counter_w(2,      data & 0x08);   // key in
171   coin_counter_w(3,      data & 0x10);   // coin out mech
172
173   set_led_status(6,      data & 0x20);   // led for coin out / hopper active
174
175   nmi_enable = data & 0x80;     // nmi enable?
176
177   out[0] = data;
178   show_out();
179}
180
181static WRITE8_HANDLER( igs_lamps_w )
182{
183/*
184    - Lbits -
185    7654 3210
186    =========
187    ---- --x-  Hold1 lamp.
188    --x- ----  Hold2 lamp.
189    ---x ----  Hold3 lamp.
190    ---- x---  Hold4 lamp.
191    ---- -x--  Hold5 lamp.
192    ---- ---x  Start lamp.
193*/
194   output_set_lamp_value(1, (data >> 1) & 1);      /* Lamp 1 - HOLD 1 */
195   output_set_lamp_value(2, (data >> 5) & 1);      /* Lamp 2 - HOLD 2  */
196   output_set_lamp_value(3, (data >> 4) & 1);      /* Lamp 3 - HOLD 3 */
197   output_set_lamp_value(4, (data >> 3) & 1);      /* Lamp 4 - HOLD 4 */
198   output_set_lamp_value(5, (data >> 2) & 1);      /* Lamp 5 - HOLD 5 */
199   output_set_lamp_value(6, (data & 1));         /* Lamp 6 - START */
200
201   hopper         =   (~data)& 0x80;
202
203   out[1] = data;
204   show_out();
205}
206
207
208static size_t protection_res = 0;
209
210static READ8_HANDLER( custom_io_r )
211{
212   return protection_res;
213}
214
215static WRITE8_HANDLER( custom_io_w )
216{
217   switch (data)
218   {
219      case 0x00: protection_res = input_port_read(space->machine, "BUTTONS1"); break;
220      case 0x20: protection_res = 0x49; break;
221      case 0x21: protection_res = 0x47; break;
222      case 0x22: protection_res = 0x53; break;
223      case 0x24: protection_res = 0x41; break;
224      case 0x25: protection_res = 0x41; break;
225      case 0x26: protection_res = 0x7f; break;
226      case 0x27: protection_res = 0x41; break;
227      case 0x28: protection_res = 0x41; break;
228      case 0x2a: protection_res = 0x3e; break;
229      case 0x2b: protection_res = 0x41; break;
230      case 0x2c: protection_res = 0x49; break;
231      case 0x2d: protection_res = 0xf9; break;
232      case 0x2e: protection_res = 0x0a; break;
233      case 0x30: protection_res = 0x26; break;
234      case 0x31: protection_res = 0x49; break;
235      case 0x32: protection_res = 0x49; break;
236      case 0x33: protection_res = 0x49; break;
237      case 0x34: protection_res = 0x32; break;
238      default:
239         protection_res = data;
240   }
241}
242
243static CUSTOM_INPUT( hopper_r )
244{
245   if (hopper) return !(video_screen_get_frame_number(field->port->machine->primary_screen)%10);
246   return input_code_pressed(KEYCODE_H);
247}
248
249static ADDRESS_MAP_START( igspoker_prg_map, ADDRESS_SPACE_PROGRAM, 8 )
250   AM_RANGE(0x0000, 0xefff) AM_ROM
251   AM_RANGE(0xf000, 0xffff) AM_RAM AM_REGION("main", 0xf000)
252ADDRESS_MAP_END
253
254static ADDRESS_MAP_START( igspoker_io_map, ADDRESS_SPACE_IO, 8 )
255   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_BASE( &paletteram )
256   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_BASE( &paletteram_2 )
257   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW1")         /* DSW1 */
258   AM_RANGE(0x4001, 0x4001) AM_READ_PORT("DSW2")         /* DSW2 */
259   AM_RANGE(0x4002, 0x4002) AM_READ_PORT("DSW3")         /* DSW3 */
260   AM_RANGE(0x4003, 0x4003) AM_READ_PORT("DSW4")         /* DSW4 */
261   AM_RANGE(0x4004, 0x4004) AM_READ_PORT("DSW5")         /* DSW5 */
262   AM_RANGE(0x5080, 0x5080) AM_WRITE(igs_nmi_and_coins_w)
263   AM_RANGE(0x5081, 0x5081) AM_READ_PORT("SERVICE")         /* Services */
264   AM_RANGE(0x5082, 0x5082) AM_READ_PORT("COINS")         /* Coing & Kbd */
265   AM_RANGE(0x5090, 0x5090) AM_WRITE(custom_io_w)
266   AM_RANGE(0x5091, 0x5091) AM_READ(custom_io_r) AM_WRITE( igs_lamps_w )         /* Keyboard */
267   AM_RANGE(0x50a0, 0x50a0) AM_READ_PORT("BUTTONS2")         /* Not connected */
268   AM_RANGE(0x50b0, 0x50b0) AM_WRITE(ym2413_register_port_0_w)
269   AM_RANGE(0x50b1, 0x50b1) AM_WRITE(ym2413_data_port_0_w)
270   AM_RANGE(0x50c0, 0x50c0) AM_READ(igs_irqack_r) AM_WRITE(igs_irqack_w)
271   AM_RANGE(0x6800, 0x6fff) AM_RAM_WRITE( bg_tile_w )  AM_BASE( &bg_tile_ram )
272   AM_RANGE(0x7000, 0x77ff) AM_RAM_WRITE( fg_tile_w )  AM_BASE( &fg_tile_ram )
273   AM_RANGE(0x7800, 0x7fff) AM_RAM_WRITE( fg_color_w ) AM_BASE( &fg_color_ram )
274   AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("gfx3", 0)
275ADDRESS_MAP_END
276
277
278/* MB: 05 Jun 99  Input ports and Dip switches are all verified! */
279
280static INPUT_PORTS_START( cpoker )
281
282   PORT_START("DSW1")
283   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:8")
284   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
285   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
286   PORT_DIPNAME( 0x06, 0x06, "Min Bet to Start" ) PORT_DIPLOCATION("SWA:7,6")
287   PORT_DIPSETTING(    0x06, "1" )
288   PORT_DIPSETTING(    0x04, "3" )
289   PORT_DIPSETTING(    0x02, "5" )
290   PORT_DIPSETTING(    0x00, "10" )
291   PORT_DIPNAME( 0x18, 0x10, "Max Bet" ) PORT_DIPLOCATION("SWA:5,4")
292   PORT_DIPSETTING(    0x18, "3" )
293   PORT_DIPSETTING(    0x10, "5" )
294   PORT_DIPSETTING(    0x08, "20" )
295   PORT_DIPSETTING(    0x00, "40" )
296   PORT_DIPNAME( 0x60, 0x60, "Min Bet to play Fever" ) PORT_DIPLOCATION("SWA:3,2")
297   PORT_DIPSETTING(    0x60, "1" )
298   PORT_DIPSETTING(    0x40, "5" )
299   PORT_DIPSETTING(    0x20, "10" )
300   PORT_DIPSETTING(    0x00, "20" )
301   PORT_DIPNAME( 0x80, 0x00, "Credit Limit" ) PORT_DIPLOCATION("SWA:1")
302   PORT_DIPSETTING(    0x80, "5000" )
303   PORT_DIPSETTING(    0x00, "10000" )
304
305   PORT_START("DSW2")
306   PORT_DIPNAME( 0x07, 0x07, "Coin In Rate" ) PORT_DIPLOCATION("SWB:8,7,6")
307   PORT_DIPSETTING(    0x07, "1" )
308   PORT_DIPSETTING(    0x06, "2" )
309   PORT_DIPSETTING(    0x05, "5" )
310   PORT_DIPSETTING(    0x04, "10" )
311   PORT_DIPSETTING(    0x03, "20" )
312   PORT_DIPSETTING(    0x02, "40" )
313   PORT_DIPSETTING(    0x01, "50" )
314   PORT_DIPSETTING(    0x00, "100" )
315   PORT_DIPNAME( 0x18, 0x18, "Key In Rate" ) PORT_DIPLOCATION("SWB:5,4")
316   PORT_DIPSETTING(    0x18, "10" )
317   PORT_DIPSETTING(    0x10, "20" )
318   PORT_DIPSETTING(    0x08, "50" )
319   PORT_DIPSETTING(    0x00, "100" )
320   PORT_DIPNAME( 0x60, 0x60, "Key Out Rate" ) PORT_DIPLOCATION("SWB:3,2")
321   PORT_DIPSETTING(    0x60, "1:1" )
322   PORT_DIPSETTING(    0x40, "10:1" )
323   PORT_DIPSETTING(    0x20, "100:1" )
324   PORT_DIPSETTING(    0x00, "100:1" )
325   PORT_DIPNAME( 0x80, 0x80, "Payout" ) PORT_DIPLOCATION("SWB:1")
326   PORT_DIPSETTING(    0x80, "Manual" )
327   PORT_DIPSETTING(    0x00, "Auto" )
328
329   PORT_START("DSW3")
330   PORT_DIPNAME( 0x01, 0x01, "W-UP Bonus Target" ) PORT_DIPLOCATION("SWC:8")
331   PORT_DIPSETTING(    0x01, "3000" )
332   PORT_DIPSETTING(    0x00, "5000" )
333   PORT_DIPNAME( 0x02, 0x02, "W-UP Bonus Rate" ) PORT_DIPLOCATION("SWC:7")
334   PORT_DIPSETTING(    0x02, "300" )
335   PORT_DIPSETTING(    0x00, "500" )
336   PORT_DIPNAME( 0x0c, 0x0c, "W-UP Chance" ) PORT_DIPLOCATION("SWC:6,5")
337   PORT_DIPSETTING(    0x0c, "94%" )
338   PORT_DIPSETTING(    0x08, "96%" )
339   PORT_DIPSETTING(    0x04, "98%" )
340   PORT_DIPSETTING(    0x00, "100%" )
341   PORT_DIPNAME( 0x30, 0x20, "W-UP Type" ) PORT_DIPLOCATION("SWC:4,3")
342   PORT_DIPSETTING(    0x30, DEF_STR( None ) )
343   PORT_DIPSETTING(    0x20, "High-Low" )
344   PORT_DIPSETTING(    0x10, "Red-Black" )      /* Bit 4 is equal for ON/OFF */
345   PORT_DIPNAME( 0x40, 0x00, "Strip Girl" ) PORT_DIPLOCATION("SWC:2")
346   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
347   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
348   PORT_DIPNAME( 0x80, 0x00, "Anytime Key-in" ) PORT_DIPLOCATION("SWC:1")
349   PORT_DIPSETTING(    0x80, DEF_STR( No ) )
350   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
351
352   PORT_START("DSW4")
353   PORT_DIPNAME( 0x0f, 0x07, "Main Game Chance" ) PORT_DIPLOCATION("SWD:8,7,6,5")
354   PORT_DIPSETTING(    0x0f, "69%" )
355   PORT_DIPSETTING(    0x0e, "72%" )
356   PORT_DIPSETTING(    0x0d, "75%" )
357   PORT_DIPSETTING(    0x0c, "78%" )
358   PORT_DIPSETTING(    0x0b, "81%" )
359   PORT_DIPSETTING(    0x0a, "83%" )
360   PORT_DIPSETTING(    0x09, "85%" )
361   PORT_DIPSETTING(    0x08, "87%" )
362   PORT_DIPSETTING(    0x07, "89%" )
363   PORT_DIPSETTING(    0x06, "91%" )
364   PORT_DIPSETTING(    0x05, "93%" )
365   PORT_DIPSETTING(    0x04, "95%" )
366   PORT_DIPSETTING(    0x03, "97%" )
367   PORT_DIPSETTING(    0x02, "99%" )
368   PORT_DIPSETTING(    0x01, "101%" )
369   PORT_DIPSETTING(    0x00, "103%" )
370   PORT_DIPNAME( 0x10, 0x00, "Five Jokers" ) PORT_DIPLOCATION("SWD:4")
371   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
372   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
373   PORT_DIPNAME( 0x20, 0x00, "Royal Flush" ) PORT_DIPLOCATION("SWD:3")
374   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
375   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
376   PORT_DIPNAME( 0x40, 0x00, "Auto Hold" ) PORT_DIPLOCATION("SWD:2")
377   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
378   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
379   PORT_DIPNAME( 0x80, 0x00, "Hopper" ) PORT_DIPLOCATION("SWD:1")
380   PORT_DIPSETTING(    0x80, DEF_STR( No ) )
381   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
382
383   PORT_START("DSW5")
384   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
385
386   PORT_START("SERVICE")
387   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
388   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4) PORT_NAME("Payout")
389   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
390   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F1) PORT_NAME("Statistics")
391
392   PORT_START("COINS")
393   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
394   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
395   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
396   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In")
397   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Down")
398   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
399
400   PORT_START("BUTTONS1")
401   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
402
403   PORT_START("BUTTONS2")
404   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_START1 )
405   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold1/High/Low")
406   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold5/Bet")
407   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold4/Take")
408   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold3/W-Up")
409   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold2/Red/Black")
410   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
411
412INPUT_PORTS_END
413
414static INPUT_PORTS_START( csk227 )
415
416   PORT_START("DSW1")
417   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:8")
418   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
419   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
420   PORT_DIPNAME( 0x06, 0x06, "Min Bet to Start" ) PORT_DIPLOCATION("SWA:6,7")
421   PORT_DIPSETTING(    0x06, "1" )
422   PORT_DIPSETTING(    0x04, "3" )
423   PORT_DIPSETTING(    0x02, "5" )
424   PORT_DIPSETTING(    0x00, "10" )
425   PORT_DIPNAME( 0x18, 0x18, "Max Bet" ) PORT_DIPLOCATION("SWA:4,5")
426   PORT_DIPSETTING(    0x18, "10" )
427   PORT_DIPSETTING(    0x10, "20" )
428   PORT_DIPSETTING(    0x08, "50" )
429   PORT_DIPSETTING(    0x00, "100" )
430   PORT_DIPNAME( 0x60, 0x60, "Min Bet to play Fever" ) PORT_DIPLOCATION("SWA:2,3")
431   PORT_DIPSETTING(    0x60, "1" )
432   PORT_DIPSETTING(    0x40, "5" )
433   PORT_DIPSETTING(    0x20, "10" )
434   PORT_DIPSETTING(    0x00, "20" )
435   PORT_DIPNAME( 0x80, 0x00, "Credit Limit" ) PORT_DIPLOCATION("SWA:1")
436   PORT_DIPSETTING(    0x80, "100000" )
437   PORT_DIPSETTING(    0x00, "Unlimited" )
438
439   PORT_START("DSW2")
440   PORT_DIPNAME( 0x07, 0x07, "Coin In Rate" ) PORT_DIPLOCATION("SWB:8,7,6")
441   PORT_DIPSETTING(    0x07, "1" )
442   PORT_DIPSETTING(    0x06, "2" )
443   PORT_DIPSETTING(    0x05, "5" )
444   PORT_DIPSETTING(    0x04, "10" )
445   PORT_DIPSETTING(    0x03, "20" )
446   PORT_DIPSETTING(    0x02, "40" )
447   PORT_DIPSETTING(    0x01, "50" )
448   PORT_DIPSETTING(    0x00, "100" )
449   PORT_DIPNAME( 0x18, 0x18, "Key In Rate" ) PORT_DIPLOCATION("SWB:5,4")
450   PORT_DIPSETTING(    0x18, "10" )
451   PORT_DIPSETTING(    0x10, "20" )
452   PORT_DIPSETTING(    0x08, "50" )
453   PORT_DIPSETTING(    0x00, "100" )
454   PORT_DIPNAME( 0x60, 0x60, "W-UP Bonus Target" ) PORT_DIPLOCATION("SWB:3,2")
455   PORT_DIPSETTING(    0x60, "1500" )
456   PORT_DIPSETTING(    0x40, "3000" )
457   PORT_DIPSETTING(    0x20, "5000" )
458   PORT_DIPSETTING(    0x00, "7500" )
459   PORT_DIPNAME( 0x80, 0x80, "Payout" ) PORT_DIPLOCATION("SWB:1")
460   PORT_DIPSETTING(    0x80, "Manual" )
461   PORT_DIPSETTING(    0x00, "Auto" )
462
463   PORT_START("DSW3")
464   PORT_DIPNAME( 0x03, 0x03, "W-UP Bonus Rate" ) PORT_DIPLOCATION("SWC:8,7")
465   PORT_DIPSETTING(    0x03, "200" )
466   PORT_DIPSETTING(    0x02, "300" )
467   PORT_DIPSETTING(    0x01, "500" )
468   PORT_DIPSETTING(    0x00, "800" )
469   PORT_DIPNAME( 0x0c, 0x0c, "W-UP Chance" ) PORT_DIPLOCATION("SWC:6,5")
470   PORT_DIPSETTING(    0x0c, "94%" )
471   PORT_DIPSETTING(    0x08, "96%" )
472   PORT_DIPSETTING(    0x04, "98%" )
473   PORT_DIPSETTING(    0x00, "100%" )
474   PORT_DIPNAME( 0x30, 0x20, "W-UP Type" ) PORT_DIPLOCATION("SWC:4,3")
475   PORT_DIPSETTING(    0x30, DEF_STR( None ) )
476   PORT_DIPSETTING(    0x20, "High-Low" )
477   PORT_DIPSETTING(    0x10, "Red-Black" )      /* Bit 4 is equal for ON/OFF */
478   PORT_DIPNAME( 0x40, 0x00, "Strip Girl" ) PORT_DIPLOCATION("SWC:2")
479   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
480   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
481   PORT_DIPNAME( 0x80, 0x00, "Ability" ) PORT_DIPLOCATION("SWC:1")
482   PORT_DIPSETTING(    0x80, DEF_STR( No ) )
483   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
484
485   PORT_START("DSW4")
486   PORT_DIPNAME( 0x0f, 0x07, "Main Game Chance" ) PORT_DIPLOCATION("SWD:8,7,6,5")
487   PORT_DIPSETTING(    0x0f, "69%" )
488   PORT_DIPSETTING(    0x0e, "72%" )
489   PORT_DIPSETTING(    0x0d, "75%" )
490   PORT_DIPSETTING(    0x0c, "78%" )
491   PORT_DIPSETTING(    0x0b, "81%" )
492   PORT_DIPSETTING(    0x0a, "83%" )
493   PORT_DIPSETTING(    0x09, "85%" )
494   PORT_DIPSETTING(    0x08, "87%" )
495   PORT_DIPSETTING(    0x07, "89%" )
496   PORT_DIPSETTING(    0x06, "91%" )
497   PORT_DIPSETTING(    0x05, "93%" )
498   PORT_DIPSETTING(    0x04, "95%" )
499   PORT_DIPSETTING(    0x03, "97%" )
500   PORT_DIPSETTING(    0x02, "99%" )
501   PORT_DIPSETTING(    0x01, "101%" )
502   PORT_DIPSETTING(    0x00, "103%" )
503   PORT_DIPNAME( 0x10, 0x00, "Five Jokers" ) PORT_DIPLOCATION("SWD:4")
504   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
505   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
506   PORT_DIPNAME( 0x20, 0x00, "Royal Flush" ) PORT_DIPLOCATION("SWD:3")
507   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
508   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
509   PORT_DIPNAME( 0x40, 0x00, "Auto Hold" ) PORT_DIPLOCATION("SWD:2")
510   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
511   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
512   PORT_DIPNAME( 0x80, 0x80, "Payout Select" ) PORT_DIPLOCATION("SWD:1")
513   PORT_DIPSETTING(    0x80, "Ticket" )
514   PORT_DIPSETTING(    0x00, "Hopper" )
515
516   PORT_START("DSW5")
517   PORT_DIPNAME( 0x07, 0x07, "Key Out Rate" ) PORT_DIPLOCATION("SWE:8,7,6")
518   PORT_DIPSETTING(    0x07, "1:1" )
519   PORT_DIPSETTING(    0x06, "10:1" )
520   PORT_DIPSETTING(    0x05, "20:1" )
521   PORT_DIPSETTING(    0x04, "50:1" )
522   PORT_DIPSETTING(    0x03, "100:1" )      /* Bits 1-0 are all equivalents */
523   PORT_DIPNAME( 0x08, 0x00, "Card Select" ) PORT_DIPLOCATION("SWE:5")
524   PORT_DIPSETTING(    0x08, "Poker" )
525   PORT_DIPSETTING(    0x00, "Tetris" )
526   PORT_DIPNAME( 0x70, 0x70, "Ticket Rate" ) PORT_DIPLOCATION("SWE:4,3,2")
527   PORT_DIPSETTING(    0x70, "1:1" )
528   PORT_DIPSETTING(    0x60, "5:1" )
529   PORT_DIPSETTING(    0x50, "10:1" )
530   PORT_DIPSETTING(    0x40, "20:1" )
531   PORT_DIPSETTING(    0x30, "25:1" )
532   PORT_DIPSETTING(    0x20, "50:1" )
533   PORT_DIPSETTING(    0x10, "100:1" )
534   PORT_DIPSETTING(    0x00, "200:1" )
535   PORT_DIPNAME( 0x80, 0x80, "Win Table" ) PORT_DIPLOCATION("SWE:1")
536   PORT_DIPSETTING(    0x80, "Change" )
537   PORT_DIPSETTING(    0x00, "Fixed" )
538
539   PORT_START("SERVICE")
540   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
541   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
542   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
543   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
544   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4) PORT_NAME("Payout")
545   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
546   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F1) PORT_NAME("Statistics")
547   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold5/Bet")
548
549   PORT_START("COINS")
550   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1     )
551   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
552   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2     )
553   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE  ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In")
554   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_SERVICE  ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Down")
555   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
556   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold4/Take")
557   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold3/W-Up")
558
559   PORT_START("BUTTONS1")
560   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
561   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
562   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
563   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
564   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
565   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START1)
566   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold1/High/Low")
567   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold2/Red/Black")
568
569   PORT_START("BUTTONS2")
570   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
571
572INPUT_PORTS_END
573
574
575static INPUT_PORTS_START( csk234 )
576
577   PORT_START("DSW1")
578   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:8")
579   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
580   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
581   PORT_DIPNAME( 0x06, 0x06, "Min Bet to Start" ) PORT_DIPLOCATION("SWA:7,6")
582   PORT_DIPSETTING(    0x06, "1" )
583   PORT_DIPSETTING(    0x04, "3" )
584   PORT_DIPSETTING(    0x02, "5" )
585   PORT_DIPSETTING(    0x00, "10" )
586   PORT_DIPNAME( 0x18, 0x10, "Max Bet" ) PORT_DIPLOCATION("SWA:5,4")
587   PORT_DIPSETTING(    0x18, "3" )
588   PORT_DIPSETTING(    0x10, "5" )
589   PORT_DIPSETTING(    0x08, "20" )
590   PORT_DIPSETTING(    0x00, "40" )
591   PORT_DIPNAME( 0x60, 0x60, "Min Bet to play Fever" ) PORT_DIPLOCATION("SWA:3,2")
592   PORT_DIPSETTING(    0x60, "1" )
593   PORT_DIPSETTING(    0x40, "5" )
594   PORT_DIPSETTING(    0x20, "10" )
595   PORT_DIPSETTING(    0x00, "20" )
596   PORT_DIPNAME( 0x80, 0x00, "Credit Limit" ) PORT_DIPLOCATION("SWA:1")
597   PORT_DIPSETTING(    0x80, "5000" )
598   PORT_DIPSETTING(    0x00, "10000" )
599
600   PORT_START("DSW2")
601   PORT_DIPNAME( 0x07, 0x07, "Coin In Rate" ) PORT_DIPLOCATION("SWB:8,7,6")
602   PORT_DIPSETTING(    0x07, "1" )
603   PORT_DIPSETTING(    0x06, "2" )
604   PORT_DIPSETTING(    0x05, "5" )
605   PORT_DIPSETTING(    0x04, "10" )
606   PORT_DIPSETTING(    0x03, "20" )
607   PORT_DIPSETTING(    0x02, "40" )
608   PORT_DIPSETTING(    0x01, "50" )
609   PORT_DIPSETTING(    0x00, "100" )
610   PORT_DIPNAME( 0x18, 0x18, "Key In Rate" ) PORT_DIPLOCATION("SWB:5,4")
611   PORT_DIPSETTING(    0x18, "10" )
612   PORT_DIPSETTING(    0x10, "20" )
613   PORT_DIPSETTING(    0x08, "50" )
614   PORT_DIPSETTING(    0x00, "100" )
615   PORT_DIPNAME( 0x60, 0x60, "Key Out Rate" ) PORT_DIPLOCATION("SWB:3,2")
616   PORT_DIPSETTING(    0x60, "1:1" )
617   PORT_DIPSETTING(    0x40, "10:1" )
618   PORT_DIPSETTING(    0x20, "100:1" )
619   PORT_DIPSETTING(    0x00, "100:1" )
620   PORT_DIPNAME( 0x80, 0x80, "Payout" ) PORT_DIPLOCATION("SWB:1")
621   PORT_DIPSETTING(    0x80, "Manual" )
622   PORT_DIPSETTING(    0x00, "Auto" )
623
624   PORT_START("DSW3")
625   PORT_DIPNAME( 0x01, 0x01, "W-UP Bonus Target" ) PORT_DIPLOCATION("SWC:8")
626   PORT_DIPSETTING(    0x01, "3000" )
627   PORT_DIPSETTING(    0x00, "5000" )
628   PORT_DIPNAME( 0x02, 0x02, "W-UP Bonus Rate" ) PORT_DIPLOCATION("SWC:7")
629   PORT_DIPSETTING(    0x02, "300" )
630   PORT_DIPSETTING(    0x00, "500" )
631   PORT_DIPNAME( 0x0c, 0x0c, "W-UP Chance" ) PORT_DIPLOCATION("SWC:6,5")
632   PORT_DIPSETTING(    0x0c, "94%" )
633   PORT_DIPSETTING(    0x08, "96%" )
634   PORT_DIPSETTING(    0x04, "98%" )
635   PORT_DIPSETTING(    0x00, "100%" )
636   PORT_DIPNAME( 0x30, 0x20, "W-UP Type" ) PORT_DIPLOCATION("SWC:4,3")
637   PORT_DIPSETTING(    0x30, DEF_STR( None ) )
638   PORT_DIPSETTING(    0x20, "High-Low" )
639   PORT_DIPSETTING(    0x10, "Red-Black" )      /* Bit 4 is equal for ON/OFF */
640   PORT_DIPNAME( 0x40, 0x40, "Card Select" ) PORT_DIPLOCATION("SWC:2")
641   PORT_DIPSETTING(    0x40, "Poker" )
642   PORT_DIPSETTING(    0x00, "Symbols" )
643   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
644
645   PORT_START("DSW4")
646   PORT_DIPNAME( 0x0f, 0x07, "Main Game Chance" ) PORT_DIPLOCATION("SWD:8,7,6,5")
647   PORT_DIPSETTING(    0x0f, "69%" )
648   PORT_DIPSETTING(    0x0e, "72%" )
649   PORT_DIPSETTING(    0x0d, "75%" )
650   PORT_DIPSETTING(    0x0c, "78%" )
651   PORT_DIPSETTING(    0x0b, "81%" )
652   PORT_DIPSETTING(    0x0a, "83%" )
653   PORT_DIPSETTING(    0x09, "85%" )
654   PORT_DIPSETTING(    0x08, "87%" )
655   PORT_DIPSETTING(    0x07, "89%" )
656   PORT_DIPSETTING(    0x06, "91%" )
657   PORT_DIPSETTING(    0x05, "93%" )
658   PORT_DIPSETTING(    0x04, "95%" )
659   PORT_DIPSETTING(    0x03, "97%" )
660   PORT_DIPSETTING(    0x02, "99%" )
661   PORT_DIPSETTING(    0x01, "101%" )
662   PORT_DIPSETTING(    0x00, "103%" )
663   PORT_DIPNAME( 0x10, 0x00, "Auto Hold" ) PORT_DIPLOCATION("SWD:4")
664   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
665   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
666   PORT_DIPNAME( 0x20, 0x00, "Anytime Key-in" ) PORT_DIPLOCATION("SWD:3")
667   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
668   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
669   PORT_BIT( 0xC0, IP_ACTIVE_LOW, IPT_UNUSED )         /* Joker and Royal Flush are always enabled */
670
671   PORT_START("DSW5")
672   PORT_DIPNAME( 0x01, 0x00, "Hopper" ) PORT_DIPLOCATION("SWE:8")
673   PORT_DIPSETTING(    0x01, DEF_STR( No ) )
674   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
675   PORT_DIPNAME( 0x02, 0x00, "Payout Select" ) PORT_DIPLOCATION("SWE:7")
676   PORT_DIPSETTING(    0x02, "Hopper" )
677   PORT_DIPSETTING(    0x00, "Ticket" )
678   PORT_DIPNAME( 0x0c, 0x0c, "Ticket Rate" ) PORT_DIPLOCATION("SWE:6,5")
679   PORT_DIPSETTING(    0x0c, "10:1" )
680   PORT_DIPSETTING(    0x08, "20:1" )
681   PORT_DIPSETTING(    0x04, "50:1" )
682   PORT_DIPSETTING(    0x00, "100:1" )
683   PORT_DIPNAME( 0x10, 0x00, "Ability" ) PORT_DIPLOCATION("SWE:4")
684   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
685   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
686   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
687
688   PORT_START("SERVICE")
689   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
690   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4) PORT_NAME("Payout")
691   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
692   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F1) PORT_NAME("Statistics")
693
694   PORT_START("COINS")
695   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
696   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
697   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
698   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In")
699   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Down")
700   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
701
702   PORT_START("BUTTONS1")
703   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
704
705   PORT_START("BUTTONS2")
706   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_START1 )
707   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold1/High/Low")
708   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold5/Bet")
709   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold4/Take")
710   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold3/W-Up")
711   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold2/Red/Black")
712   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
713
714INPUT_PORTS_END
715
716
717static INPUT_PORTS_START( igs_ncs )
718
719   PORT_START("DSW1")
720   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:8")
721   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
722   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
723   PORT_DIPNAME( 0x06, 0x06, "Min Bet to Start" ) PORT_DIPLOCATION("SWA:7,6")
724   PORT_DIPSETTING(    0x06, "1" )
725   PORT_DIPSETTING(    0x04, "3" )
726   PORT_DIPSETTING(    0x02, "5" )
727   PORT_DIPSETTING(    0x00, "10" )
728   PORT_DIPNAME( 0x18, 0x10, "Max Bet" ) PORT_DIPLOCATION("SWA:5,4")
729   PORT_DIPSETTING(    0x18, "10" )
730   PORT_DIPSETTING(    0x10, "20" )
731   PORT_DIPSETTING(    0x08, "40" )
732   PORT_DIPSETTING(    0x00, "200" )
733   PORT_DIPNAME( 0x60, 0x60, "Min Bet to play Fever" ) PORT_DIPLOCATION("SWA:3,2")
734   PORT_DIPSETTING(    0x60, "1" )
735   PORT_DIPSETTING(    0x40, "5" )
736   PORT_DIPSETTING(    0x20, "10" )
737   PORT_DIPSETTING(    0x00, "20" )
738   PORT_DIPNAME( 0x80, 0x00, "Credit Limit" ) PORT_DIPLOCATION("SWA:1")
739   PORT_DIPSETTING(    0x80, "100000" )
740   PORT_DIPSETTING(    0x00, "Unlimited" )
741
742   PORT_START("DSW2")
743   PORT_DIPNAME( 0x07, 0x07, "Coin In Rate" ) PORT_DIPLOCATION("SWB:8,7,6")
744   PORT_DIPSETTING(    0x07, "1" )
745   PORT_DIPSETTING(    0x06, "2" )
746   PORT_DIPSETTING(    0x05, "5" )
747   PORT_DIPSETTING(    0x04, "10" )
748   PORT_DIPSETTING(    0x03, "20" )
749   PORT_DIPSETTING(    0x02, "40" )
750   PORT_DIPSETTING(    0x01, "50" )
751   PORT_DIPSETTING(    0x00, "100" )
752   PORT_DIPNAME( 0x18, 0x18, "Key In Rate" ) PORT_DIPLOCATION("SWB:5,4")
753   PORT_DIPSETTING(    0x18, "10" )
754   PORT_DIPSETTING(    0x10, "20" )
755   PORT_DIPSETTING(    0x08, "50" )
756   PORT_DIPSETTING(    0x00, "100" )
757   PORT_DIPNAME( 0x60, 0x60, "W-UP Limit" ) PORT_DIPLOCATION("SWB:3,2")
758   PORT_DIPSETTING(    0x60, "1500" )
759   PORT_DIPSETTING(    0x40, "3000" )
760   PORT_DIPSETTING(    0x20, "5000" )
761   PORT_DIPSETTING(    0x00, "7500" )
762   PORT_DIPNAME( 0x80, 0x80, "Payout" ) PORT_DIPLOCATION("SWB:1")
763   PORT_DIPSETTING(    0x80, "Manual" )
764   PORT_DIPSETTING(    0x00, "Auto" )
765
766   PORT_START("DSW3")
767   PORT_DIPNAME( 0x03, 0x03, "W-UP Pool" ) PORT_DIPLOCATION("SWC:8,7")
768   PORT_DIPSETTING(    0x03, "200" )
769   PORT_DIPSETTING(    0x02, "300" )
770   PORT_DIPSETTING(    0x01, "500" )
771   PORT_DIPSETTING(    0x00, "800" )
772   PORT_DIPNAME( 0x0c, 0x0c, "W-UP Chance" ) PORT_DIPLOCATION("SWC:6,5")
773   PORT_DIPSETTING(    0x0c, "94%" )
774   PORT_DIPSETTING(    0x08, "96%" )
775   PORT_DIPSETTING(    0x04, "98%" )
776   PORT_DIPSETTING(    0x00, "100%" )
777   PORT_DIPNAME( 0x30, 0x20, "W-UP Type" ) PORT_DIPLOCATION("SWC:4,3")
778   PORT_DIPSETTING(    0x30, DEF_STR( None ) )
779   PORT_DIPSETTING(    0x20, "High-Low" )
780   PORT_DIPSETTING(    0x10, "Red-Black" )      /* Bit 4 is equal for ON/OFF */
781   PORT_DIPNAME( 0x40, 0x40, "Ability Pay" ) PORT_DIPLOCATION("SWC:2")
782   PORT_DIPSETTING(    0x40, "All" )
783   PORT_DIPSETTING(    0x00, "1/Time" )
784   PORT_DIPNAME( 0x80, 0x80, "Ability" ) PORT_DIPLOCATION("SWC:1")
785   PORT_DIPSETTING(    0x80, DEF_STR( No ) )
786   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
787
788   PORT_START("DSW4")
789   PORT_DIPNAME( 0x0f, 0x07, "Main Game Chance" ) PORT_DIPLOCATION("SWD:8,7,6,5")
790   PORT_DIPSETTING(    0x0f, "69%" )
791   PORT_DIPSETTING(    0x0e, "72%" )
792   PORT_DIPSETTING(    0x0d, "75%" )
793   PORT_DIPSETTING(    0x0c, "78%" )
794   PORT_DIPSETTING(    0x0b, "81%" )
795   PORT_DIPSETTING(    0x0a, "83%" )
796   PORT_DIPSETTING(    0x09, "85%" )
797   PORT_DIPSETTING(    0x08, "87%" )
798   PORT_DIPSETTING(    0x07, "89%" )
799   PORT_DIPSETTING(    0x06, "91%" )
800   PORT_DIPSETTING(    0x05, "93%" )
801   PORT_DIPSETTING(    0x04, "95%" )
802   PORT_DIPSETTING(    0x03, "97%" )
803   PORT_DIPSETTING(    0x02, "99%" )
804   PORT_DIPSETTING(    0x01, "101%" )
805   PORT_DIPSETTING(    0x00, "103%" )
806   PORT_DIPNAME( 0x10, 0x00, "Five Jokers" ) PORT_DIPLOCATION("SWD:4")
807   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
808   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
809   PORT_DIPNAME( 0x20, 0x00, "Royal Flush" ) PORT_DIPLOCATION("SWD:3")
810   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
811   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
812   PORT_DIPNAME( 0x40, 0x00, "Auto Hold" ) PORT_DIPLOCATION("SWD:2")
813   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
814   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
815   PORT_DIPNAME( 0x80, 0x00, "Hopper" ) PORT_DIPLOCATION("SWD:1")
816   PORT_DIPSETTING(    0x80, DEF_STR( No ) )
817   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
818
819   PORT_START("DSW5")
820   PORT_DIPNAME( 0x07, 0x07, "Key Out Rate" ) PORT_DIPLOCATION("SWE:8,7,6")
821   PORT_DIPSETTING(    0x07, "1:1" )
822   PORT_DIPSETTING(    0x06, "10:1" )
823   PORT_DIPSETTING(    0x05, "20:1" )
824   PORT_DIPSETTING(    0x04, "50:1" )
825   PORT_DIPSETTING(    0x03, "100:1" )      /* latest 4 is 100 for ON/OFF */
826   PORT_DIPNAME( 0x08, 0x08, "Card Select" ) PORT_DIPLOCATION("SWE:5")
827   PORT_DIPSETTING(    0x08, "Poker" )
828   PORT_DIPSETTING(    0x00, "Symbols" )
829   PORT_DIPNAME( 0x70, 0x70, "Ticket Rate" ) PORT_DIPLOCATION("SWE:4,3,2")
830   PORT_DIPSETTING(    0x70, "1:1" )
831   PORT_DIPSETTING(    0x60, "5:1" )
832   PORT_DIPSETTING(    0x50, "10:1" )
833   PORT_DIPSETTING(    0x40, "20:1" )
834   PORT_DIPSETTING(    0x30, "25:1" )
835   PORT_DIPSETTING(    0x20, "50:1" )
836   PORT_DIPSETTING(    0x10, "100:1" )
837   PORT_DIPSETTING(    0x00, "200:1" )
838   PORT_DIPNAME( 0x80, 0x00, "Oddstab Fixed" ) PORT_DIPLOCATION("SWE:1")
839   PORT_DIPSETTING(    0x80, DEF_STR( No ) )
840   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
841
842   PORT_START("SERVICE")
843   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
844   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4) PORT_NAME("Payout")
845   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )
846   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F1) PORT_NAME("Statistics")
847
848   PORT_START("COINS")
849   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
850   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
851   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
852   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_Q) PORT_NAME("Key In")
853   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_W) PORT_NAME("Key Down")
854   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
855
856   PORT_START("BUTTONS1")
857   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
858
859   PORT_START("BUTTONS2")
860   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_START1 )
861   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold1/High/Low")
862   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold5/Bet")
863   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold4/Take")
864   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold3/W-Up")
865   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold2/Red/Black")
866   PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
867
868INPUT_PORTS_END
869
870
871
872
873static const gfx_layout charlayout =
874{
875   8, 8,   /* 8*8 characters */
876   RGN_FRAC(1, 3),
877   6,      /* 6 bits per pixel */
878   { RGN_FRAC(0,3)+8,RGN_FRAC(0,3)+0,
879     RGN_FRAC(1,3)+8,RGN_FRAC(1,3)+0,
880     RGN_FRAC(2,3)+8,RGN_FRAC(2,3)+0 },
881   { STEP8(0,1) },
882   { STEP8(0,2*8) },
883   8*8*2   /* every char takes 32 consecutive bytes */
884};
885
886static const gfx_layout charlayout2 =
887{
888   8, 32,   /* 8*32 characters */
889   RGN_FRAC(1, 3),
890   6,      /* 6 bits per pixel */
891   { RGN_FRAC(0,3)+8,RGN_FRAC(0,3)+0,
892     RGN_FRAC(1,3)+8,RGN_FRAC(1,3)+0,
893     RGN_FRAC(2,3)+8,RGN_FRAC(2,3)+0 },
894   { STEP8(0,1) },
895   { STEP32(0,2*8) },
896   8*32*2
897};
898
899static GFXDECODE_START( igspoker )
900   GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout,   0, 16 )
901   GFXDECODE_ENTRY( "gfx2", 0x04000, charlayout2,  0, 16 )
902   GFXDECODE_ENTRY( "gfx2", 0x08000, charlayout2,  0, 16 )
903   GFXDECODE_ENTRY( "gfx2", 0x0c000, charlayout2,  0, 16 )
904   GFXDECODE_ENTRY( "gfx2", 0x00000, charlayout2,  0, 16 )
905GFXDECODE_END
906
907static MACHINE_DRIVER_START( igspoker )
908
909   /* basic machine hardware */
910   MDRV_CPU_ADD("main",Z80, 3579545)
911   MDRV_CPU_PROGRAM_MAP(igspoker_prg_map,0)
912   MDRV_CPU_IO_MAP(igspoker_io_map,0)
913   MDRV_CPU_VBLANK_INT_HACK(igs_interrupt,8)
914
915   MDRV_MACHINE_RESET(igs)
916
917   /* video hardware */
918   MDRV_SCREEN_ADD("main", RASTER)
919   MDRV_SCREEN_REFRESH_RATE(57)
920   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
921   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
922   MDRV_SCREEN_SIZE(64*8, 32*8)
923   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 32*8-1)
924
925   MDRV_GFXDECODE(igspoker)
926   MDRV_PALETTE_LENGTH(2048)
927
928   MDRV_VIDEO_START(igs_video)
929   MDRV_VIDEO_UPDATE(igs_video)
930
931   /* sound hardware */
932   MDRV_SPEAKER_STANDARD_MONO("mono")
933   MDRV_SOUND_ADD("ym", YM2413, 3579545)
934   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
935
936MACHINE_DRIVER_END
937
938static MACHINE_DRIVER_START( csk227it )
939
940   MDRV_IMPORT_FROM(igspoker)
941
942MACHINE_DRIVER_END
943
944static MACHINE_DRIVER_START( csk234it )
945
946   MDRV_IMPORT_FROM(igspoker)
947
948MACHINE_DRIVER_END
949
950static MACHINE_DRIVER_START( igs_ncs )
951
952   MDRV_IMPORT_FROM(igspoker)
953
954MACHINE_DRIVER_END
955
956
957
958/*  ROM Regions definition
959 */
960
961ROM_START( cpoker )
962   ROM_REGION( 0x10000, "main", 0 )
963   ROM_LOAD( "v220i1.bin",  0x0000, 0x8000, CRC(b7cae556) SHA1(bb43ee48634879029ed1a7cd4133d7f12413e2ac) )
964   ROM_LOAD( "v220i2.bin",  0x8000, 0x8000, CRC(8245e42c) SHA1(b7e7b9f643e6dc2f4d5aaf7d50d0a9154ed9a4e7) )
965
966   ROM_REGION( 0x60000, "gfx1", ROMREGION_DISPOSE )
967   ROM_LOAD( "220i1.bin",  0x40000, 0x20000, CRC(9c4c0af1) SHA1(7a9808b3093b23bde7ecc7405689b2a28ae34e61) )
968   ROM_LOAD( "220i2.bin",  0x20000, 0x20000, CRC(331fa4b8) SHA1(ddac57251fa5dfecc0988a2ca01eec016ef47f20) )
969   ROM_LOAD( "220i3.bin",  0x00000, 0x20000, CRC(bd2f797c) SHA1(5ca5adae44490dd109f630213a09a68c12f9bd1a) )
970
971   ROM_REGION( 0x30000, "gfx2", ROMREGION_ERASE00 | ROMREGION_DISPOSE )
972
973   ROM_REGION( 0x10000, "gfx3", 0 )   /* expansion rom - contains backgrounds and pictures charmaps */
974   ROM_LOAD( "220i7.bin",   0x0000, 0x8000, CRC(8a2ff310) SHA1(a415a99dbb1448b4b2b94e17a3973e6347e3be18) )
975ROM_END
976
977ROM_START( csk227it )
978   ROM_REGION( 0x10000, "main", 0 )
979   ROM_LOAD( "v227i.bin",   0x0000, 0x10000, CRC(df1ebf49) SHA1(829c7575d3d3780557405b3a61859901df6dbe4f) )
980
981   ROM_REGION( 0x60000, "gfx1", ROMREGION_DISPOSE )
982   ROM_LOAD( "6.227",  0x00000, 0x20000, CRC(e9aad93b) SHA1(72116759cd8ddd9828f534e8f8a3f9f96ad2e002) )
983   ROM_LOAD( "5.227",  0x20000, 0x20000, CRC(e4c4c8da) SHA1(0442b0de68f3b69e613506348e00c3cf9139edcf) )
984   ROM_LOAD( "4.227",  0x40000, 0x20000, CRC(afb365dd) SHA1(930a4cd516258e703a75afc25ef6b2655b8b696a) )
985
986   ROM_REGION( 0x30000, "gfx2", ROMREGION_DISPOSE )
987   ROM_LOAD( "3.bin",  0x00000, 0x10000, CRC(fcb115ac) SHA1(a9f2b9762413840669cd44f8e54b47a7c4350d11) )
988   ROM_LOAD( "2.bin",  0x10000, 0x10000, CRC(848343a3) SHA1(b12f9bc2feb470d2fa8b085621fa60c0895109d4) )
989   ROM_LOAD( "1.bin",  0x20000, 0x10000, CRC(921ad5de) SHA1(b06ab2e63b31361dcb0367110f47bf2453ecdca6) )
990
991   ROM_REGION( 0x10000, "gfx3", 0 )   /* expansion rom - contains backgrounds and pictures charmaps */
992   ROM_LOAD( "7.227",   0x0000, 0x10000, CRC(a10786ad) SHA1(82f5f81808ca70d67a2710cc66fbbf78588b33b5) )
993ROM_END
994
995ROM_START( csk234it )
996   ROM_REGION( 0x10000, "main", 0 )
997   ROM_LOAD( "v234it.bin",   0x0000, 0x10000, CRC(344b7059)  SHA1(990cb84e35c0c50d3be9fbb76a11395114dc6c9b) )
998
999   ROM_REGION( 0x60000, "gfx1", ROMREGION_DISPOSE )
1000   ROM_LOAD( "6.234",  0x00000, 0x20000, CRC(23b855a4) SHA1(8217bac61ad09483d8789113cf394d0e525ab28a) )
1001   ROM_LOAD( "5.234",  0x20000, 0x20000, CRC(189039d7) SHA1(146fd1ddb23ceaa4192e0382b0ab82f5cfbdabfe) )
1002   ROM_LOAD( "4.234",  0x40000, 0x20000, CRC(c82b0ffc) SHA1(5ebd7da76d402b7111cbe9012cfa3b8a8ff1a86e) )
1003
1004   ROM_REGION( 0x30000, "gfx2", ROMREGION_DISPOSE )
1005   ROM_LOAD( "3.bin",  0x00000, 0x10000, CRC(fcb115ac) SHA1(a9f2b9762413840669cd44f8e54b47a7c4350d11) )
1006   ROM_LOAD( "2.bin",  0x10000, 0x10000, CRC(848343a3) SHA1(b12f9bc2feb470d2fa8b085621fa60c0895109d4) )
1007   ROM_LOAD( "1.bin",  0x20000, 0x10000, CRC(921ad5de) SHA1(b06ab2e63b31361dcb0367110f47bf2453ecdca6) )
1008
1009   ROM_REGION( 0x10000, "gfx3", 0 )   /* expansion rom - contains backgrounds and pictures charmaps */
1010   ROM_LOAD( "7.234",   0x0000, 0x10000, CRC(ae6dd4ad) SHA1(4772d5c150d64d1ef3b68e16214f594eea0b3c1b) )
1011ROM_END
1012
1013
1014/*
1015
1016Stelle e Cubi
1017
1018-- most of the roms on this seem to be the wrong size / missing data
1019   but its appears to be a hack based on Champion Skill
1020
10211x Z84c0006
10221x 12mhz OSC
10231x U6295 sound chip
10241x Actel FPGA (gfx chip)
1025
1026ROMs
1027Note    1x Battery
10285x banks of dipswitch
1029
1030
1031--
1032
1033This doesn't attempt to decode the gfx.
1034
1035*/
1036ROM_START( stellecu )
1037   ROM_REGION( 0x20000, "main", 0 )
1038   /* there is data at 0x18000 which is probably mapped somewhere */
1039   ROM_LOAD( "u35.bin",   0x0000, 0x20000, CRC(914b7c59) SHA1(3275b5016524467199f32d653c757bfe4f9cfc60) )
1040
1041   ROM_REGION( 0x60000, "gfx1", ROMREGION_DISPOSE )
1042   /* seems to be missing half the gfx */
1043   ROM_LOAD( "u23.bin",   0x0000, 0x40000, BAD_DUMP CRC(9d95757d) SHA1(f7f44d684f1f3a5b1e9c0a82f4377c6d79eb4214) )
1044
1045   ROM_REGION( 0x40000, "gfx2", ROMREGION_DISPOSE )
1046   /* seems to be missing half the gfx */
1047   ROM_LOAD( "u25.bin",   0x0000, 0x40000, BAD_DUMP CRC(63094010) SHA1(a781f1c529167dd0ab411c66b72105fc19e32f02) )
1048
1049   ROM_REGION( 0x10000, "gfx3", ROMREGION_ERASE00 )
1050
1051   ROM_REGION( 0x40000, "oki", 0 ) /* Oki Samples */
1052   /* missing sample tables at start of rom */
1053   ROM_LOAD( "u15.bin",   0x0000, 0x40000, BAD_DUMP CRC(72e3e9c1) SHA1(6a8fb93059bee5a4e4b4deb9fee4b5869e53983b) )
1054ROM_END
1055
1056/*  Decode a simple PAL encryption
1057 */
1058
1059static DRIVER_INIT( cpoker )
1060{
1061   int A;
1062   UINT8 *rom = memory_region(machine, "main");
1063
1064
1065   for (A = 0;A < 0x10000;A++)
1066   {
1067      rom[A] ^= 0x21;
1068      if ((A & 0x0030) == 0x0010) rom[A] ^= 0x20;
1069      if ((A & 0x0282) == 0x0282) rom[A] ^= 0x01;
1070      if ((A & 0x0940) == 0x0940) rom[A] ^= 0x02;
1071   }
1072}
1073
1074static DRIVER_INIT( cpokert )
1075{
1076   UINT8 *rom = memory_region(machine, "main");
1077   int i;
1078
1079   /* decrypt the program ROM */
1080   for (i = 0;i < 0x10000;i++)
1081   {
1082      if((i & 0x200) && (i & 0x80))
1083      {
1084         rom[i] ^= ((~i & 2) >> 1);
1085      }
1086      else
1087      {
1088         rom[i] ^= 0x01;
1089      }
1090
1091      if((i & 0x30) != 0x10)
1092      {
1093         rom[i] ^= 0x20;
1094      }
1095
1096      if((i & 0x900) == 0x900 && ((i & 0xc0) == 0x40 || (i & 0xc0) == 0xc0))
1097      {
1098         rom[i] ^= 0x02;
1099      }
1100   }
1101}
1102
1103static DRIVER_INIT( cska )
1104{
1105   int A;
1106   UINT8 *rom = memory_region(machine, "main");
1107
1108
1109   for (A = 0;A < 0x10000;A++)
1110   {
1111      if ((A & 0x0020) == 0x0000) rom[A] ^= 0x01;
1112      if ((A & 0x0020) == 0x0020) rom[A] ^= 0x21;
1113      if ((A & 0x0282) == 0x0282) rom[A] ^= 0x01;
1114      if ((A & 0x0028) == 0x0028) rom[A] ^= 0x20;
1115      if ((A & 0x0940) == 0x0940) rom[A] ^= 0x02;
1116   }
1117}
1118
1119
1120static DRIVER_INIT( igs_ncs )
1121{
1122   int A;
1123   UINT8 *rom = memory_region(machine, "main");
1124
1125
1126   for (A = 0;A < 0x10000;A++)
1127   {
1128      rom[A] ^= 0x21;
1129      if ((A & 0x0282) == 0x0282) rom[A] ^= 0x01;
1130      if ((A & 0x0140) == 0x0100) rom[A] ^= 0x20;
1131      if ((A & 0x0940) == 0x0940) rom[A] ^= 0x02;
1132   }
1133}
1134
1135
1136/*
1137
11381x ZILOG Z0840006PSC-Z80CPU (main)
11391x YM2413 (sound)
11401x NEC D8255AC (label: ORIGINAL BY IGS 102986)
11411x oscillator 12.000MHz (main)
11421x oscillator 3.579545MHz (sound)
1143
11441x custom QFP80 label AMT001
11451x custom QFP80 label IGS002
11461x custom DIP40 label IGS003 (under chip label 8255)
1147
1148ROMs
1149
11503x MX27C1000DC (4,5,6)
11511x NM27C256Q (7)
11521x 27C512 (200)
11532x PEEL18CV8P (8,9)
11541x PAL16L8ACN (31)
11552x PEEL18CV8P (12,14) <-> UNREADABLE, protected!
1156
1157Note
1158
11591x 10x2 edge connector (con1) (looks like a coin payout)
11601x 36x2 edge connector (con2)
11611x pushbutton (sw6)
11625x 8 switches dips (sw1-5)
11631x trimmer (volume)
1164----------------------
1165IGS PCB NO-T0039-8
1166
1167*/
1168
1169ROM_START( cpokert )
1170   ROM_REGION( 0x10000, "main", 0 )
1171   ROM_LOAD( "champingv-200g.u23", 0x00000, 0x10000, CRC(696cb684) SHA1(ce9e5bed83d0bd3b115f556cc89e3293ac6b69c3) )
1172
1173   ROM_REGION( 0x60000, "gfx1", ROMREGION_DISPOSE )
1174   ROM_LOAD( "cpoker6.u6", 0x00000, 0x20000, CRC(f3e61b24) SHA1(b18998defb6e51daef4ac5a5865674565ffb9029) )
1175   ROM_LOAD( "cpoker5.u5", 0x20000, 0x20000, CRC(a68b305f) SHA1(f872d2bf7ab194145dffe6b254ae0ad66aa6a497) )
1176   ROM_LOAD( "cpoker4.u4", 0x40000, 0x20000, CRC(860be7c9) SHA1(41bc58713076276aeefc44c7ea903549692b0224) )
1177
1178   //copy?
1179   ROM_REGION( 0x60000, "gfx2", ROMREGION_DISPOSE )
1180   ROM_COPY( "gfx1", 0, 0, 0x60000 )
1181
1182   ROM_REGION( 0x10000, "gfx3", 0 )   /* expansion rom - contains backgrounds and pictures charmaps */
1183   ROM_LOAD( "cpoker7.u22", 0x0000, 0x8000, CRC(dae3ecda) SHA1(c881e143ec600c5a931f26cd097da6353e1da7c3) )
1184
1185   // convert them to the pld format
1186   ROM_REGION( 0x2000, "plds", ROMREGION_DISPOSE )
1187   ROM_LOAD( "ag-u31.u31", 0x00000, 0x000b60, CRC(fd36baf2) SHA1(caac8bf47bc958395f97b6191569196efe3b3eaa) )
1188   ROM_LOAD( "ag-u8.u8",   0x00000, 0x0015e2, CRC(c0308c63) SHA1(16819a5c147fef38a235675fa4442da9fa8a6618) )
1189   ROM_LOAD( "ag-u9.u9",   0x00000, 0x0015e2, CRC(2e8039a3) SHA1(e39635ee9485a5ccd28526f1af7ec2e3294b0aec) )
1190ROM_END
1191
1192
1193ROM_START( igs_ncs )
1194   ROM_REGION( 0x10000, "main", 0 )
1195   ROM_LOAD( "v.bin",   0x0000, 0x10000, CRC(8077724b)  SHA1(1f6e01d5838e6ec4f91b07637c281a3f59631a51) )
1196
1197   ROM_REGION( 0x60000, "gfx1", ROMREGION_DISPOSE )
1198   ROM_LOAD( "6.bin",  0x00000, 0x20000, CRC(d8e88148) SHA1(5f5c06d947027ef76026e8834f2090b96652006c) )
1199   ROM_LOAD( "5.bin",  0x20000, 0x20000, CRC(96c8a71c) SHA1(202d04850df9dfbd405c4b5372ef1b39850ac7f7) )
1200   ROM_LOAD( "4.bin",  0x40000, 0x20000, CRC(5480eae8) SHA1(93e35e8ba7d282cb93d51498420341a4e95acf78) )
1201
1202   ROM_REGION( 0x30000, "gfx2", ROMREGION_DISPOSE )
1203   ROM_LOAD( "3.bin",  0x00000, 0x10000, CRC(fcb115ac) SHA1(a9f2b9762413840669cd44f8e54b47a7c4350d11) )
1204   ROM_LOAD( "2.bin",  0x10000, 0x10000, CRC(848343a3) SHA1(b12f9bc2feb470d2fa8b085621fa60c0895109d4) )
1205   ROM_LOAD( "1.bin",  0x20000, 0x10000, CRC(921ad5de) SHA1(b06ab2e63b31361dcb0367110f47bf2453ecdca6) )
1206
1207   ROM_REGION( 0x10000, "gfx3", 0 )   /* expansion rom - contains backgrounds and pictures charmaps */
1208   ROM_LOAD( "7.bin",   0x0000, 0x10000, CRC(678e412c) SHA1(dba031d3576d098d314d6589dd1aeda44d17c650) )
1209ROM_END
1210
1211
1212/* New Champion Skill by IGS
1213 -- the dump MAY be incomplete, there were 3 empty positions on the PCB near
1214    the gfx roms
1215
1216Chips of Note
1217
1218IGS 003C (near chip with TEST OK E0069281 label)
1219IGS 002
1220IGA 001A
1221
1222
1223'file'
1224KC8255A
12259941
1226(near CPU roms)
1227
1228UM3567 9946
1229
12305x 8 switch dips
1231
1232Clocks
12333.579545Mhz (near sound)
123412Mhz
1235
1236
1237--- what is the CPU, it looks like either Z80 or Z180 based
1238 -- CPU rom is lightly encrypted (usual IGS style, some xors)
1239
1240*/
1241
1242DRIVER_INIT( igs_ncs2 )
1243{
1244   UINT8 *src = (UINT8 *) (memory_region(machine, "main"));
1245   int i;
1246
1247   for(i = 0; i < 0x10000; i++)
1248   {
1249      /* bit 0 xor layer */
1250      if(i & 0x200)
1251      {
1252         if(i & 0x80)
1253         {
1254            if(~i & 0x02)
1255            {
1256               src[i] ^= 0x01;
1257            }
1258         }
1259         else
1260         {
1261            src[i] ^= 0x01;
1262         }
1263      }
1264      else
1265      {
1266         src[i] ^= 0x01;
1267      }
1268
1269      /* bit 1 xor layer */
1270      if(i & 0x800)
1271      {
1272         if(i & 0x100)
1273         {
1274            if(i & 0x40)
1275            {
1276               src[i] ^= 0x02;
1277            }
1278         }
1279      }
1280
1281      /* bit 5 xor layer */
1282      if(i & 0x100)
1283      {
1284         if(i & 0x40)
1285         {
1286            src[i] ^= 0x20;
1287         }
1288      }
1289      else
1290      {
1291         src[i] ^= 0x20;
1292      }
1293   }
1294
1295}
1296
1297ROM_START( igs_ncs2 )
1298   ROM_REGION( 0x10000, "main", 0 )
1299   ROM_LOAD( "ncs_v100n.u20", 0x00000, 0x10000, CRC(2bb91de5) SHA1(b0b7b3b9cee1ce4da10cf78ef1c8079f3d9cafbf) )
1300
1301   ROM_REGION( 0xc0000, "gfx1", ROMREGION_DISPOSE )
1302   ROM_LOAD( "ncs_v100n.u50", 0x00000, 0x40000, CRC(ff2bb3dc) SHA1(364c948504003b4230fbdac74227842c802d4c12) )
1303   ROM_LOAD( "ncs_v100n.u51", 0x40000, 0x40000, CRC(f8530313) SHA1(b21d6de7d5d4b902008ceea7e1227545e0d1701b) )
1304   ROM_LOAD( "ncs_v100n.u52", 0x80000, 0x40000, CRC(2fa5b6df) SHA1(5bfc651297440f73692079f1806b1e40b457b7b8) )
1305
1306   ROM_REGION( 0x30000, "gfx2", ROMREGION_ERASEFF | ROMREGION_DISPOSE )
1307   // looks like these are needed for pre-game screens, sockets were empty
1308   ROM_LOAD( "ncs_v100n.u55", 0x00000, 0x10000, NO_DUMP )
1309   ROM_LOAD( "ncs_v100n.u56", 0x10000, 0x10000, NO_DUMP )
1310   ROM_LOAD( "ncs_v100n.u57", 0x20000, 0x10000, NO_DUMP )
1311
1312   ROM_REGION( 0x10000, "gfx3", 0 )
1313   ROM_LOAD( "ncs_v100n.u21", 0x00000, 0x10000, CRC(678e412c) SHA1(dba031d3576d098d314d6589dd1aeda44d17c650) )
1314ROM_END
1315
1316
1317
1318GAMEL( 1993?, cpoker,   0,        igspoker, cpoker,  cpoker,  ROT0, "IGS",    "Champion Poker (v220I)",                    0, layout_igspoker )
1319GAMEL( 1993?, cpokert,  cpoker,   igspoker, cpoker,  cpokert, ROT0, "Tuning", "Champion Poker (v200G)",                    0,   layout_igspoker )
1320GAMEL( 198?,  csk227it, 0,        csk227it, csk227,  cska,    ROT0, "IGS",    "Champion Skill (with Ability)",             0,   layout_igspoker ) /* SU 062 */
1321GAMEL( 198?,  csk234it, csk227it, csk234it, csk234,  cska,    ROT0, "IGS",    "Champion Skill (Ability, Poker & Symbols)", 0,   layout_igspoker ) /* SU 062 */
1322GAMEL( 198?,  igs_ncs,  0,        igs_ncs,  igs_ncs, igs_ncs, ROT0, "IGS",    "New Champion Skill (v100n)",                0,   layout_igspoker ) /* SU 062 */
1323
1324GAMEL( 2000, igs_ncs2,  0,        igs_ncs,  igs_ncs, igs_ncs2, ROT0, "IGS",   "New Champion Skill (v100n 2000)",           GAME_IMPERFECT_GRAPHICS, layout_igspoker )
1325
1326GAMEL( 1998, stellecu,  0,        csk234it, csk234, 0,       ROT0, "Sure",   "Stelle e Cubi (Italy)",                     GAME_NOT_WORKING,   layout_igspoker )
1327
1328
1329
1330
src/mame/drivers/gticlub.c
r4184r4185
10141014
10151015/*************************************************************************/
10161016
1017#define ROM_LOAD64_WORD(name,offset,length,hash)      ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6))
1018
10191017ROM_START(gticlub)
10201018   ROM_REGION(0x200000, "user1", 0)   /* PowerPC program roms */
10211019      ROM_LOAD32_BYTE("688aaa01.21u", 0x000003, 0x80000, CRC(06a56474) SHA1(3a457b885a35e3ee030fd51d847bcf75fce46208))
src/mame/drivers/cloak.c
r4184r4185
9898    2008-07
9999    Dip locations and suggested settings verified with manual.
100100
101    Note: The master CPU prints a 'SLAVE COM BAD' message on startup
102    before it actually tests the slave CPU. The message only remains
103    visible if the slave CPU fails to respond.
104
101105****************************************************************************/
102106
103107/*
104108
105109    TODO:
106110
107    - slave com bad at startup
108111    - is bitmap drawing in service mode correct?
109112    - real cpu speeds
110113    - custom write
r4184r4185
330333static MACHINE_DRIVER_START( cloak )
331334
332335   /* basic machine hardware */
333   MDRV_CPU_ADD("main", M6502,1000000)      /* 1 MHz ???? */
334   MDRV_CPU_PROGRAM_MAP(master_map,0)
335   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
336   MDRV_CPU_ADD("main", M6502, 1000000)      /* 1 MHz ???? */
337   MDRV_CPU_PROGRAM_MAP(master_map, 0)
338   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 4)
336339
337   MDRV_CPU_ADD("slave", M6502,1250000)      /* 1.25 MHz ???? */
338   MDRV_CPU_PROGRAM_MAP(slave_map,0)
339   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
340   MDRV_CPU_ADD("slave", M6502, 1250000)      /* 1.25 MHz ???? */
341   MDRV_CPU_PROGRAM_MAP(slave_map, 0)
342   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 2)
340343
341   MDRV_QUANTUM_TIME(HZ(300))
344   MDRV_QUANTUM_TIME(HZ(1000))
342345
343346   MDRV_NVRAM_HANDLER(generic_0fill)
344347
src/mame/drivers/hanaroku.c
r4184r4185
162162   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start")
163163
164164   PORT_START("IN1")   /* 0xe001 */
165   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Card 1")
166   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Card 2")
167   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Card 3")
168   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Card 4")
169   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Card 5")
170   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Card 6")
165   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Card 1") PORT_CODE(KEYCODE_1_PAD)
166   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Card 2") PORT_CODE(KEYCODE_2_PAD)
167   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Card 3") PORT_CODE(KEYCODE_3_PAD)
168   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Card 4") PORT_CODE(KEYCODE_4_PAD)
169   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Card 5") PORT_CODE(KEYCODE_5_PAD)
170   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Card 6") PORT_CODE(KEYCODE_6_PAD)
171171   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME(DEF_STR( Yes )) PORT_CODE(KEYCODE_Y)
172172   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME(DEF_STR( No  )) PORT_CODE(KEYCODE_N)
173173
src/mame/drivers/dbz.c
r4184r4185
380380
381381/**********************************************************************************/
382382
383#define ROM_LOAD64_WORD(name,offset,length,crc)      ROMX_LOAD(name, offset, length, crc, ROM_GROUPWORD | ROM_SKIP(6))
384
385383ROM_START( dbz )
386384   /* main program */
387385   ROM_REGION( 0x400000, "main", 0)
src/mame/drivers/jantotsu.c
r4184r4185
55driver by David Haywood and Angelo Salese
66
77Notes:
8-The 1-2 Player tiles on hand are actually shown on different screen sides.The Service Mode
9 is for adjusting these screens (to not let the human opponent to read your tiles).
8-The 1st/2nd Player tiles on hand are actually shown on different screen sides.The Service
9 Mode is for adjusting these screens (to not let the human opponent to read your tiles).
1010
1111TODO:
12-MSM5205 samples are wrongly played i.e. plays chi when it's clearly a pon.ADPCM index issue;
13-MSM5205 sample stop is wrong;
1214-Video buffering? If you coin up,you can see the "credit 1" msg that gets build into the
1315 video bitmaps...
1416-According to the flyer,color bitplanes might be wrong on the A-N mahjong charset,might be a
1517 BTANB however...
1618-I need schematics / pcb photos (component + solder sides) to understand if the background
1719 color is hard-wired to the DIP-Switches or there's something else wrong.
18-Missing MSM5205 samples;
1920
2021============================================================================================
2122Debug cheats:
2223
2324c01b-c028 player-1 tiles
24c02b-c038 right computer tiles
25c03b-c048 up computer tiles / player-2 tiles
26c04b-c058 left computer tiles
25c02b-c038 "right" computer tiles
26c03b-c048 "up" computer tiles / player-2 tiles
27c04b-c058 "left" computer tiles
2728
2829============================================================================================
2930
r4184r4185
6465#include "driver.h"
6566#include "cpu/z80/z80.h"
6667#include "sound/sn76496.h"
68#include "sound/msm5205.h"
6769
6870static UINT8 *jan_bitmap_1,*jan_bitmap_2,*jan_bitmap_3,*jan_bitmap_4;
6971static UINT8 vram_bank,col_bank;
r4184r4185
210212   return (input_port_read(space->machine, "DSW2") & 0x3f) | 0x80;
211213}
212214
215static UINT32 adpcm_pos;
216static UINT8 adpcm_idle;
217static int adpcm_data;
218
219static WRITE8_HANDLER( jan_adpcm_w )
220{
221   switch (offset)
222   {
223      case 0:
224         adpcm_pos = (data & 0xff) * 0x80;
225         adpcm_idle = 0;
226         msm5205_reset_w(0,0);
227//          printf("%02x 0\n",data);
228         break;
229      /*same write as port 2?*/
230      case 1:
231//          adpcm_idle = 1;
232//          msm5205_reset_w(0,1);
233//          printf("%02x 1\n",data);
234         break;
235   }
236}
237
238static void jan_adpcm_int(const device_config *device)
239{
240   static UINT8 trigger;
241
242   if (adpcm_pos >= 0x8000 || adpcm_idle)
243   {
244      //adpcm_idle = 1;
245      msm5205_reset_w(0,1);
246      trigger = 0;
247   }
248   else
249   {
250      UINT8 *ROM = memory_region(device->machine, "adpcm");
251
252      adpcm_data = ((trigger ? (ROM[adpcm_pos] & 0x0f) : (ROM[adpcm_pos] & 0xf0)>>4) );
253      msm5205_data_w(0,adpcm_data & 0xf);
254      trigger^=1;
255      if(trigger == 0)
256      {
257         adpcm_pos++;
258         if((ROM[adpcm_pos] & 0xff) == 0xff)
259            adpcm_idle = 1;
260      }
261   }
262}
263
264
213265static ADDRESS_MAP_START( jantotsu_map, ADDRESS_SPACE_PROGRAM, 8 )
214266   AM_RANGE(0x0000, 0xbfff) AM_ROM
215267   AM_RANGE(0xc000, 0xc7ff) AM_RAM
r4184r4185
220272   ADDRESS_MAP_GLOBAL_MASK(0xff)
221273   AM_RANGE(0x00, 0x00) AM_READ_PORT("DSW1") AM_WRITE(sn76496_0_w)
222274   AM_RANGE(0x01, 0x01) AM_READ(jantotsu_dsw2_r) AM_WRITE(sn76496_1_w)
223   //02-03 MSM samples
275   AM_RANGE(0x02, 0x03) AM_WRITE(jan_adpcm_w)
224276   AM_RANGE(0x04, 0x04) AM_READWRITE(jantotsu_mux_r,jantotsu_mux_w)
225277   AM_RANGE(0x07, 0x07) AM_WRITE(bankaddr_w)
226278ADDRESS_MAP_END
r4184r4185
336388   mux_data = 0;
337389   /*Load hard-wired background color.*/
338390   col_bank = (input_port_read(machine, "DSW2") & 0xc0)>>3;
391   adpcm_pos = 0;
392   adpcm_idle = 1;
339393}
340394
395static const msm5205_interface msm5205_config =
396{
397   jan_adpcm_int,   /* interrupt function */
398   MSM5205_S48_4B   /* 8kHz */
399};
400
341401static MACHINE_DRIVER_START( jantotsu )
342402   /* basic machine hardware */
343403   MDRV_CPU_ADD("main", Z80,18432000/4)
r4184r4185
368428
369429   MDRV_SOUND_ADD("sn2", SN76489A, 18432000/4)
370430   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
431
432   MDRV_SOUND_ADD("adpcm", MSM5205, 288000)
433   MDRV_SOUND_CONFIG(msm5205_config)
434   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
371435MACHINE_DRIVER_END
372436
373437
r4184r4185
381445   ROM_LOAD( "jat-04.3e", 0x08000, 0x02000, CRC(734e029f) SHA1(75aa13397847b4db32c41aaa6ff2ac82f16bd7a2) )
382446   ROM_LOAD( "jat-05.4e", 0x0a000, 0x02000, CRC(1a725e1a) SHA1(1d39d607850f47b9389f41147d4570da8814f639) )
383447
384   ROM_REGION( 0x8000, "gfx1", 0 )
448   ROM_REGION( 0x8000, "adpcm", 0 )
385449   ROM_LOAD( "jat-40.6b", 0x00000, 0x02000, CRC(2275253e) SHA1(64e9415faf2775c6b9ab497dce7fda8c4775192e) )
386450   ROM_LOAD( "jat-41.7b", 0x02000, 0x02000, CRC(ce08ed71) SHA1(8554e5e7ec178f57bed5fbdd5937e3a35f72c454) )
387451   ROM_LOAD( "jat-42.8b", 0x04000, 0x02000, CRC(3ac3efbf) SHA1(846faea7c7c01fb7500aa33a70d4b54e878c0e41) )
src/mame/drivers/model2.c
r4184r4185
29442944   ROM_LOAD( "mpr-19505.34", 0x400000, 0x400000, CRC(eba7f41d) SHA1(f6e521bedf298808a768f6fdcb0b60b320a66d04) )
29452945ROM_END
29462946
2947ROM_START( segawski ) /* Sega Water Ski Revision A, Model 2C */
2948   ROM_REGION( 0x200000, "main", 0 ) // i960 program
2949   ROM_LOAD32_WORD("epr-19963a.15", 0x000000, 0x080000, CRC(89c9cb0d) SHA1(7f1f600222447effb28cf2d56193ea9f45fd0646) )
2950   ROM_LOAD32_WORD("epr-19964a.16", 0x000002, 0x080000, CRC(c382cefe) SHA1(c0ccee4eb19d9626dee0f77f08060f1d9708b39d) )
2951
2952   ROM_REGION32_LE( 0x2000000, "user1", 0 ) // Data
2953   ROM_LOAD32_WORD("mpr-19980.11", 0x0000000, 0x400000, CRC(709804f2) SHA1(6633eeb2bc0ddd5eb5994cb7cc39ed4ab2094a7e) )
2954   ROM_LOAD32_WORD("mpr-19981.12", 0x0000002, 0x400000, CRC(a1e8ec09) SHA1(53abaf71e85f874d28a79c8775b1f0ac919fbe22) )
2955   ROM_LOAD32_WORD("mpr-19982.9",  0x0800000, 0x400000, CRC(41c398bb) SHA1(e6652111a494165c93d5e9dc7d1c3df46f1a8961) )
2956   ROM_LOAD32_WORD("mpr-19983.10", 0x0800002, 0x400000, CRC(e210dea2) SHA1(a32010648046738f64cbc7e1a074b9443bbde865) )
2957   ROM_LOAD32_WORD("mpr-19984.7",  0x1000000, 0x400000, CRC(14b967d1) SHA1(8e0fd13f5838218224ce162a55558b75dcda4cbf) )
2958   ROM_LOAD32_WORD("mpr-19985.8",  0x1000002, 0x400000, CRC(57827677) SHA1(0d764ec9e136e4d027aefb10e9f025aa2e081573) )
2959   ROM_LOAD32_WORD("epr-19961.5",  0x1800000, 0x080000, CRC(cc34ecaf) SHA1(8e540a429826d40acef5a34a0b6b1b89e059961b) )
2960   ROM_LOAD32_WORD("epr-19962.6",  0x1800002, 0x080000, CRC(e8a30e5e) SHA1(2d7290186aaca28f3aaf6656b090e1cbe509aa48) )
2961
2962   ROM_REGION( 0x800000, "cpu2", 0 ) // TGPx4 program
2963   ROM_LOAD32_WORD("mpr-19986.29", 0x0000000, 0x400000, CRC(4b8e26f8) SHA1(859e3788c75599295a8b57ed7852f2cbb6a2a738) )
2964   ROM_LOAD32_WORD("mpr-19987.30", 0x0000002, 0x400000, CRC(8d5b9d38) SHA1(35f41c474af3754152aecefe81e912120823e0ff) )
2965
2966   ROM_REGION( 0x2000000, "user2", 0 ) // Models
2967   ROM_LOAD32_WORD("mpr-19972.17", 0x0000000, 0x400000, CRC(493c0f8f) SHA1(c68f662d53fbcec3d2dbd9ebdfd37cbf1ff46408) )
2968   ROM_LOAD32_WORD("mpr-19497.21", 0x0000002, 0x400000, CRC(01b6f8e1) SHA1(be1f1017ff5f43218de2d99090e4e7db64f7a483) )
2969   ROM_LOAD32_WORD("mpr-19974.18", 0x0800000, 0x400000, CRC(2bd947d3) SHA1(7f16e668db5a4673cd909bdfa1b9dc665827b392) )
2970   ROM_LOAD32_WORD("mpr-19499.22", 0x0800002, 0x400000, CRC(07e6b699) SHA1(35bbea4cd42ab39f976cd2ec964c32d5d3982c4a) )
2971   ROM_LOAD32_WORD("mpr-19976.19", 0x1000000, 0x400000, CRC(f9496566) SHA1(e6dee764301c0ed34e5134a5232898bb42563c20) )
2972   ROM_LOAD32_WORD("mpr-19977.23", 0x1000002, 0x400000, CRC(b3dbf54b) SHA1(d61448394b7b2036e27bdbf7a062d63f076db9da) )
2973   ROM_LOAD32_WORD("mpr-19978.20", 0x1800000, 0x400000, CRC(c80f4ed7) SHA1(e7ea6dfb57ab1fe924a80c244b8acfe4aad2b76d) )
2974   ROM_LOAD32_WORD("mpr-19979.24", 0x1800002, 0x400000, CRC(1c0db4d2) SHA1(65a81f4503c6b9c26650befd183db821545c53e2) )
2975
2976   ROM_REGION( 0x1000000, "user3", 0 ) // Textures
2977   ROM_LOAD32_WORD("mpr-19969.27", 0x0000000, 0x400000, CRC(c0c33d39) SHA1(f61a6266556d5687cd03031065baa2dd73112666) )
2978   ROM_LOAD32_WORD("mpr-19968.25", 0x0000002, 0x400000, CRC(b8d2f04f) SHA1(f0f4d2dd06cdf745ed07fe428eaa3e3ad030bff6) )
2979   ROM_LOAD32_WORD("mpr-19971.28", 0x0800000, 0x400000, CRC(c8708096) SHA1(c27e0a90dc1183b0cf7f32e324afa6c126f61d37) )
2980   ROM_LOAD32_WORD("mpr-19970.26", 0x0800002, 0x400000, CRC(c59d8d36) SHA1(24232390f0cac5ffbb17a0093a602363c686fbf8) )
2981
2982   ROM_REGION( 0x100000, "audio", 0 ) // Sound program
2983   ROM_LOAD16_WORD_SWAP("epr-19967.31", 0x000000, 0x080000, BAD_DUMP CRC(99c7817f) SHA1(a1c76f0e9da32b49e8d15cc31542c9619b9a265b) )
2984
2985   ROM_REGION( 0x800000, "scsp", 0 ) // Samples
2986   ROM_LOAD("mpr-19988.32", 0x000000, 0x400000, CRC(303732fb) SHA1(63efbd9f67b38fddeeed25de660514867e03486a) )
2987   ROM_LOAD("mpr-19989.34", 0x400000, 0x400000, CRC(8074a4b3) SHA1(98dc1d122ffb9b5c52994dea2b5d8c4f004a5f8e) )
2988ROM_END
2989
29472990ROM_START( hotd ) /* House of the Dead, Model 2C */
29482991   ROM_REGION( 0x200000, "main", 0 ) // i960 program
29492992   ROM_LOAD32_WORD("epr-19696.15", 0x000000, 0x080000, CRC(03da5623) SHA1(be0bd34a9216375c7204445f084f6c74c4d3b0c8) )
r4184r4185
44454488GAME( 1996, waverunr,        0, model2c, model2, 0, ROT0, "Sega", "Wave Runner (Japan, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
44464489GAME( 1997, hotd,            0, model2c, model2, 0, ROT0, "Sega", "House of the Dead", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
44474490GAME( 1997, overrev,         0, model2c, model2, 0, ROT0, "Jaleco", "Over Rev (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
4491GAME( 1997, segawski,        0, model2c, model2, 0, ROT0, "Sega", "Sega Water Ski (Japan, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
44484492GAME( 1997, topskatr,        0, model2c, model2, 0, ROT0, "Sega", "Top Skater (Export, Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
44494493GAME( 1997, topskatu, topskatr, model2c, model2, 0, ROT0, "Sega", "Top Skater (USA)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
44504494GAME( 1998, bel,             0, model2c, bel,    0, ROT0, "Sega/EPL Productions", "Behind Enemy Lines", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/gstream.c
r4184r4185
516516{
517517   if (cpu_get_pc(space->cpu)==0xc0001592)
518518   {
519      cpu_spinuntil_int(space->cpu);
519      cpu_eat_cycles(space->cpu, 50);
520520   }
521521
522522   return gstream_workram[0xd1ee0/4];
src/mame/drivers/model3.c
r4184r4185
18061806INPUT_PORTS_END
18071807
18081808
1809#define ROM_LOAD64_WORD(name,offset,length,hash)      ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6))
1810#define ROM_LOAD64_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE| ROM_SKIP(6))
18111809#define ROM_LOAD_VROM(name, offset, length, hash)     ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(14) )
1812//#define ROM_REGION64_BE(length,rclass,rtag,flags)       ROM_REGION(length, rclass, rtype, (flags) | ROMREGION_64BIT | ROMREGION_BE)
18131810
18141811ROM_START( lemans24 )   /* step 1.5 */
18151812   ROM_REGION64_BE( 0x4800000, "user1", 0 ) /* program + data ROMs */
src/mame/drivers/cb2001.c
r4184r4185
4646const UINT8 cb2001_decryption_table[256] = {
4747   0xe8,xxxx,xxxx,xxxx,xxxx,0x61,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, /* 00 */
4848//  pppp                     ????
49   xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, 0x32,xxxx,xxxx,xxxx,0x3a,xxxx,xxxx,0x1f, /* 10 */
50//                                           pppp                pppp           ????
49   xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, 0x32,xxxx,0xa0,xxxx,0x3a,xxxx,xxxx,0x1f, /* 10 */
50//                                           pppp     ????       pppp           ????
5151   xxxx,0x8e,xxxx,0x0f,xxxx,0x49,0xbc,xxxx, xxxx,xxxx,xxxx,0x75,xxxx,xxxx,xxxx,xxxx, /* 20 */
5252//       !!!!      ????      ???? ????                      pppp
5353   0x9d,xxxx,xxxx,xxxx,xxxx,xxxx,0xbe,xxxx, xxxx,xxxx,0x74,xxxx,xxxx,0xa6,0xbf,xxxx, /* 30 */
5454//  ????                          pppp                 ????           ???? ????
55   xxxx,0xea,xxxx,xxxx,xxxx,0xb0,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, /* 40 */
56//       !!!!                gggg
55   xxxx,0xea,xxxx,xxxx,xxxx,0xb0,xxxx,xxxx, xxxx,0xa2,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, /* 40 */
56//       !!!!                gggg                 ????
5757   xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,0x42,xxxx, xxxx,xxxx,xxxx,xxxx,0xeb,xxxx,xxxx,xxxx, /* 50 */
5858//                                ????                           ????
5959   xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, xxxx,0xa5,xxxx,xxxx,xxxx,xxxx,0xba,xxxx, /* 60 */
src/mame/drivers/himesiki.c
r0r4185
1/*****************************************************************************
2
3Himeshikibu (C) 1989 Hi-Soft
4
5    Driver by Uki
6
7*****************************************************************************/
8
9#include "driver.h"
10#include "deprecat.h"
11#include "cpu/z80/z80.h"
12#include "sound/2203intf.h"
13
14#define MCLK   XTAL_12MHz
15
16VIDEO_START( himesiki );
17VIDEO_UPDATE( himesiki );
18
19WRITE8_HANDLER( himesiki_bg_ram_w );
20WRITE8_HANDLER( himesiki_scrollx_w );
21WRITE8_HANDLER( himesiki_flip_w );
22
23extern UINT8 *himesiki_bg_ram;
24
25static WRITE8_HANDLER( himesiki_rombank_w )
26{
27   UINT8 *ROM = memory_region(space->machine, "main");
28   memory_set_bankptr(space->machine, 1, &ROM[0x10000+0x800*(data & 8)]);
29
30   if (data & 0xf7)
31      logerror("p06_w %02x\n",data);
32}
33
34static WRITE8_HANDLER( himesiki_sound_w )
35{
36   soundlatch_w(space, offset, data);
37   cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
38}
39
40/****************************************************************************/
41
42static ADDRESS_MAP_START( himesiki_prm0, ADDRESS_SPACE_PROGRAM, 8 )
43   AM_RANGE(0x0000, 0x7fff) AM_ROM
44   AM_RANGE(0x8000, 0x9fff) AM_RAM
45   AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
46   AM_RANGE(0xa800, 0xafff) AM_RAM AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_BASE(&paletteram)
47   AM_RANGE(0xb000, 0xbfff) AM_RAM AM_WRITE(himesiki_bg_ram_w) AM_BASE(&himesiki_bg_ram)
48   AM_RANGE(0xc000, 0xffff) AM_ROMBANK(1)
49ADDRESS_MAP_END
50
51static ADDRESS_MAP_START( himesiki_iom0, ADDRESS_SPACE_IO, 8 )
52   ADDRESS_MAP_GLOBAL_MASK(0xff)
53   AM_RANGE(0x00, 0x00) AM_READ(input_port_2_r)
54   AM_RANGE(0x01, 0x01) AM_READ(input_port_3_r)
55   AM_RANGE(0x02, 0x02) AM_READ(input_port_4_r)
56   AM_RANGE(0x03, 0x03) AM_WRITENOP // 8255 cw
57   AM_RANGE(0x04, 0x04) AM_READ(input_port_0_r)
58   AM_RANGE(0x05, 0x05) AM_READ(input_port_1_r)
59   AM_RANGE(0x06, 0x06) AM_WRITE(himesiki_rombank_w)
60   AM_RANGE(0x07, 0x07) AM_WRITENOP // 8255 cw
61   AM_RANGE(0x08, 0x08) AM_WRITE(himesiki_flip_w)
62   AM_RANGE(0x09, 0x0a) AM_WRITE(himesiki_scrollx_w)
63   AM_RANGE(0x0b, 0x0b) AM_WRITE(himesiki_sound_w)
64ADDRESS_MAP_END
65
66static ADDRESS_MAP_START( himesiki_prm1, ADDRESS_SPACE_PROGRAM, 8 )
67   AM_RANGE(0x0000, 0x7fff) AM_ROM
68   AM_RANGE(0xf800, 0xffff) AM_RAM
69ADDRESS_MAP_END
70
71static ADDRESS_MAP_START( himesiki_iom1, ADDRESS_SPACE_IO, 8 )
72   ADDRESS_MAP_GLOBAL_MASK(0xff)
73   AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r,ym2203_control_port_0_w)
74   AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r,ym2203_write_port_0_w)
75   AM_RANGE(0x04, 0x04) AM_READ(soundlatch_r)
76ADDRESS_MAP_END
77
78/****************************************************************************/
79
80INPUT_PORTS_START( himesiki )
81   PORT_START("DSW1")   /* DSW1 (0) */
82   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW1:1")
83   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
84   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
85   PORT_DIPNAME( 0x02, 0x02, "1-2" )               PORT_DIPLOCATION("SW1:2")
86   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
87   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
88   PORT_DIPNAME( 0x04, 0x04, "1-3" )               PORT_DIPLOCATION("SW1:3")
89   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
90   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
91   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Cabinet ) )      PORT_DIPLOCATION("SW1:4")
92   PORT_DIPSETTING(    0x08, DEF_STR( Upright ) )
93   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
94   PORT_DIPNAME( 0x10, 0x10, "1-5" )               PORT_DIPLOCATION("SW1:5")
95   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
96   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
97   PORT_DIPNAME( 0x20, 0x20, "1-6" )               PORT_DIPLOCATION("SW1:6")
98   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
99   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
100   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION("SW1:7")
101   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
102   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
103   PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_LOW, "SW1:8" )
104
105   PORT_START("DSW2")   /* DSW2 (1) */
106   PORT_DIPNAME( 0x01, 0x01, "2-1" )               PORT_DIPLOCATION("SW2:1")
107   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
108   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
109   PORT_DIPNAME( 0x02, 0x02, "2-2" )               PORT_DIPLOCATION("SW2:2")
110   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
111   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
112   PORT_DIPNAME( 0x04, 0x04, "2-3" )               PORT_DIPLOCATION("SW2:3")
113   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
114   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
115   PORT_DIPNAME( 0x08, 0x08, "2-4" )               PORT_DIPLOCATION("SW2:4")
116   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
117   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
118   PORT_DIPNAME( 0x10, 0x10, "2-5" )               PORT_DIPLOCATION("SW2:5")
119   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
120   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
121   PORT_DIPNAME( 0x20, 0x20, "2-6" )               PORT_DIPLOCATION("SW2:6")
122   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
123   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
124   PORT_DIPNAME( 0x40, 0x40, "2-7" )               PORT_DIPLOCATION("SW2:7")
125   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
126   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
127   PORT_DIPNAME( 0x80, 0x80, "2-8" )               PORT_DIPLOCATION("SW2:8")
128   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
129   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
130
131   PORT_START("1P")  /* 1P (2) */
132   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
133   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
134   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
135   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
136   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
137   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
138   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
139   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
140
141   PORT_START("2P")   /* 2P (3) */
142   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )   PORT_PLAYER(2)
143   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )   PORT_PLAYER(2)
144   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )   PORT_PLAYER(2)
145   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
146   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )      PORT_PLAYER(2)
147   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )      PORT_PLAYER(2)
148   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )      PORT_PLAYER(2)
149   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
150
151   PORT_START("OTHERS")   /* OTHERS (4) */
152   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_COIN1 )
153   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
154   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
155   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) // coin?
156   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN2 ) // service?
157   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START1 )
158   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_START2 )
159   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
160INPUT_PORTS_END
161
162/****************************************************************************/
163
164static const gfx_layout layout1 =
165{
166   8,8,
167   RGN_FRAC(1,1),
168   4,
169   { 0,1,2,3 },
170   { 4,0,12,8,20,16,28,24 },
171   { STEP8(0,32) },
172   8*8*4
173};
174
175static const gfx_layout layout2 =
176{
177   32,32,
178   RGN_FRAC(1,1),
179   4,
180   { 0,1,2,3 },
181   { 4,0,12,8,20,16,28,24,36,32,44,40,52,48,60,56, 68,64,76,72,84,80,92,88,100,96,108,104,116,112,124,120 },
182   { STEP32(0,128) },
183   32*32*4
184};
185
186static const gfx_layout layout3 =
187{
188   16,16,
189   RGN_FRAC(1,1),
190   4,
191   { 0,1,2,3 },
192   { 4,0,12,8,20,16,28,24,36,32,44,40,52,48,60,56 },
193   { STEP16(0,64) },
194   16*16*4
195};
196
197static GFXDECODE_START( himesiki )
198   GFXDECODE_ENTRY( "bg",        0, layout1, 0x000, 16 )
199   GFXDECODE_ENTRY( "sprites_1", 0, layout2, 0x200, 16 )
200   GFXDECODE_ENTRY( "sprites_2", 0, layout3, 0x200, 16 )
201GFXDECODE_END
202
203
204static MACHINE_DRIVER_START( himesiki )
205
206   /* basic machine hardware */
207   MDRV_CPU_ADD("main", Z80, MCLK/2) /* 6.000 MHz */
208   MDRV_CPU_PROGRAM_MAP(himesiki_prm0,0)
209   MDRV_CPU_IO_MAP(himesiki_iom0,0)
210   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
211
212   MDRV_CPU_ADD("sub", Z80, MCLK/3) /* 4.000 MHz */
213   MDRV_CPU_PROGRAM_MAP(himesiki_prm1,0)
214   MDRV_CPU_IO_MAP(himesiki_iom1,0)
215
216   /* video hardware */
217   MDRV_SCREEN_ADD("main", RASTER)
218   MDRV_SCREEN_REFRESH_RATE(60)
219   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
220   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
221   MDRV_SCREEN_SIZE(32*8, 32*8)
222   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 24*8-1)
223   MDRV_GFXDECODE(himesiki)
224   MDRV_PALETTE_LENGTH(1024)
225
226   MDRV_VIDEO_START(himesiki)
227   MDRV_VIDEO_UPDATE(himesiki)
228
229   /* sound hardware */
230   MDRV_SPEAKER_STANDARD_MONO("mono")
231   MDRV_SOUND_ADD("ym2203", YM2203, MCLK/4)
232   MDRV_SOUND_ROUTE(0, "mono", 0.10)
233   MDRV_SOUND_ROUTE(1, "mono", 0.10)
234   MDRV_SOUND_ROUTE(2, "mono", 0.10)
235   MDRV_SOUND_ROUTE(3, "mono", 0.50)
236
237MACHINE_DRIVER_END
238
239/****************************************************************************/
240
241ROM_START( himesiki )
242   ROM_REGION( 0x018000, "main", 0 ) /* z80 */
243   ROM_LOAD( "1.1k",  0x00000,  0x08000, CRC(fb4604b3) SHA1(e8155bbafb881125e1bf9a04808d6a6546887e90) )
244   ROM_LOAD( "2.1g",  0x10000,  0x08000, CRC(0c30ded1) SHA1(0ad67115fa15d0b6261a278a946a6d46c06430ef) )
245
246   ROM_REGION( 0x010000, "sub", 0 ) /* z80 */
247   ROM_LOAD( "5.6n",  0x00000,  0x08000, CRC(b1214ac7) SHA1(ee5459c28d9c3c2eb3467261716b1259ec486534) )
248
249   ROM_REGION( 0x020000, "bg", ROMREGION_DISPOSE ) /* bg */
250   ROM_LOAD( "3.5f",  0x000000,  0x010000, CRC(73843e60) SHA1(0d8a397d8798e15f3fa7bf7a83e4c2ee44f6fa86) )
251   ROM_LOAD( "4.5d",  0x010000,  0x010000, CRC(443a3164) SHA1(08aa002214251a870581a01d775f497dd390957c) )
252
253   ROM_REGION( 0x060000, "sprites_1", ROMREGION_DISPOSE ) /* sprites */
254   ROM_LOAD16_BYTE( "6.1a",  0x000000,  0x010000, CRC(14989c22) SHA1(fe0c31df10237294ea8ef0ab8965ba5bb25113a2) )
255   ROM_LOAD16_BYTE( "7.1c",  0x000001,  0x010000, CRC(cec56e16) SHA1(836ff413301044313fdf7af5d304c145137b898a) )
256   ROM_LOAD16_BYTE( "8.2a",  0x020000,  0x010000, CRC(44ba127e) SHA1(d756b6c3075d75287f9c8be662c1eab02f4245a3) )
257   ROM_LOAD16_BYTE( "9.2c",  0x020001,  0x010000, CRC(0dda724a) SHA1(2b064b1d657f896e8385f17def9e4ffc0802bf97) )
258   ROM_LOAD16_BYTE( "10.4a", 0x040000,  0x010000, CRC(0adda8d1) SHA1(dfee2c7921fdc972b4e95fdf89520f74a4e8b4ee) )
259   ROM_LOAD16_BYTE( "11.4c", 0x040001,  0x010000, CRC(aa032946) SHA1(bd8900e4a22580e3bfe33b8164909db19bb07a8f) )
260
261   ROM_REGION( 0x040000, "sprites_2", ROMREGION_DISPOSE ) /* sprites */
262   ROM_LOAD16_BYTE( "13.9e", 0x000000,  0x010000, CRC(43102682) SHA1(0d4bde8bece0cbc6c06071aa8ad210a0636d862f) )
263   ROM_LOAD16_BYTE( "12.9c", 0x000001,  0x010000, CRC(19c8f9f4) SHA1(b14c8a6b94fd474be375e7a6a03d7f4517da2247) )
264   ROM_LOAD16_BYTE( "15.8e", 0x020000,  0x010000, CRC(2630d394) SHA1(b2e9e836b1f053fce3212912c53d3cdca3372439) )
265   ROM_LOAD16_BYTE( "14.8c", 0x020001,  0x010000, CRC(8103a207) SHA1(0dde8a0aaf2618d9c1589f35841db210439d0388) )
266ROM_END
267
268GAME( 1989, himesiki, 0, himesiki, himesiki, 0, ROT90, "Hi-Soft", "Himeshikibu (Japan)", 0 )
src/mame/drivers/adp.c
r4184r4185
151151#include "machine/68681.h"
152152
153153static UINT8 register_active;
154static UINT8 mux_data;
155
154156static struct
155157{
156158   const device_config *duart68681;
r4184r4185
193195static MACHINE_RESET( skattv )
194196{
195197   skattv_devices.duart68681 = device_list_find_by_tag( machine->config->devicelist, DUART68681, "duart68681" );
198   mux_data = 0;
196199}
197200
198201static const duart68681_config skattv_duart68681_config =
r4184r4185
250253   int x,y,b;
251254
252255   b = ((HD63484_reg[0xcc/2] & 0x000f) << 16) + HD63484_reg[0xce/2];
253
254   if (input_code_pressed(KEYCODE_M)) b = 0;
255   if (input_code_pressed(KEYCODE_Q)) b += 0x060 * 280 * 1;
256   if (input_code_pressed(KEYCODE_W)) b += 0x060 * 280 * 2;
257   if (input_code_pressed(KEYCODE_E)) b += 0x060 * 280 * 3;
258   if (input_code_pressed(KEYCODE_R)) b += 0x060 * 280 * 4;
259   if (input_code_pressed(KEYCODE_T)) b += 0x060 * 280 * 5;
260   if (input_code_pressed(KEYCODE_Y)) b += 0x060 * 280 * 6;
261   if (input_code_pressed(KEYCODE_U)) b += 0x060 * 280 * 7;
262   if (input_code_pressed(KEYCODE_I)) b += 0x060 * 280 * 8;
263   if (input_code_pressed(KEYCODE_A)) b += 0x060 * 280 * 9;
264   if (input_code_pressed(KEYCODE_S)) b += 0x060 * 280 * 10;
265   if (input_code_pressed(KEYCODE_D)) b += 0x060 * 280 * 11;
266   if (input_code_pressed(KEYCODE_F)) b += 0x060 * 280 * 12;
267   if (input_code_pressed(KEYCODE_G)) b += 0x060 * 280 * 13;
268   if (input_code_pressed(KEYCODE_H)) b += 0x060 * 280 * 14;
269   if (input_code_pressed(KEYCODE_J)) b += 0x060 * 280 * 15;
270   if (input_code_pressed(KEYCODE_K)) b += 0x060 * 280 * 16;
271   if (input_code_pressed(KEYCODE_Z)) b += 0x060 * 280 * 17;
272   if (input_code_pressed(KEYCODE_X)) b += 0x060 * 280 * 18;
273   if (input_code_pressed(KEYCODE_C)) b += 0x060 * 280 * 19;
274   if (input_code_pressed(KEYCODE_V)) b += 0x060 * 280 * 20;
275   if (input_code_pressed(KEYCODE_B)) b += 0x060 * 280 * 21;
276   if (input_code_pressed(KEYCODE_N)) b += 0x060 * 280 * 22;
277
256/*
257    if (input_code_pressed(KEYCODE_M)) b = 0;
258    if (input_code_pressed(KEYCODE_Q)) b += 0x060 * 280 * 1;
259    if (input_code_pressed(KEYCODE_W)) b += 0x060 * 280 * 2;
260    if (input_code_pressed(KEYCODE_E)) b += 0x060 * 280 * 3;
261    if (input_code_pressed(KEYCODE_R)) b += 0x060 * 280 * 4;
262    if (input_code_pressed(KEYCODE_T)) b += 0x060 * 280 * 5;
263    if (input_code_pressed(KEYCODE_Y)) b += 0x060 * 280 * 6;
264    if (input_code_pressed(KEYCODE_U)) b += 0x060 * 280 * 7;
265    if (input_code_pressed(KEYCODE_I)) b += 0x060 * 280 * 8;
266    if (input_code_pressed(KEYCODE_A)) b += 0x060 * 280 * 9;
267    if (input_code_pressed(KEYCODE_S)) b += 0x060 * 280 * 10;
268    if (input_code_pressed(KEYCODE_D)) b += 0x060 * 280 * 11;
269    if (input_code_pressed(KEYCODE_F)) b += 0x060 * 280 * 12;
270    if (input_code_pressed(KEYCODE_G)) b += 0x060 * 280 * 13;
271    if (input_code_pressed(KEYCODE_H)) b += 0x060 * 280 * 14;
272    if (input_code_pressed(KEYCODE_J)) b += 0x060 * 280 * 15;
273    if (input_code_pressed(KEYCODE_K)) b += 0x060 * 280 * 16;
274    if (input_code_pressed(KEYCODE_Z)) b += 0x060 * 280 * 17;
275    if (input_code_pressed(KEYCODE_X)) b += 0x060 * 280 * 18;
276    if (input_code_pressed(KEYCODE_C)) b += 0x060 * 280 * 19;
277    if (input_code_pressed(KEYCODE_V)) b += 0x060 * 280 * 20;
278    if (input_code_pressed(KEYCODE_B)) b += 0x060 * 280 * 21;
279    if (input_code_pressed(KEYCODE_N)) b += 0x060 * 280 * 22;
280*/
278281   for (y = 0;y < 280;y++)
279282   {
280283      for (x = 0 ; x < (HD63484_reg[0xca/2] & 0x0fff) * 4 ; x += 4)
r4184r4185
320323
321324static READ16_HANDLER(test_r)
322325{
323// printf("ra=%04x ",register_active);
324if (register_active == 0x0000) {
325   if (input_code_pressed(KEYCODE_1)) return 0x0001 ^ 0xffff;
326   if (input_code_pressed(KEYCODE_2)) return 0x0002 ^ 0xffff;
327   if (input_code_pressed(KEYCODE_3)) return 0x0004 ^ 0xffff;
328   if (input_code_pressed(KEYCODE_4)) return 0x0008 ^ 0xffff;
329   if (input_code_pressed(KEYCODE_5)) return 0x0010 ^ 0xffff;
330   if (input_code_pressed(KEYCODE_6)) return 0x0020 ^ 0xffff;
331   if (input_code_pressed(KEYCODE_7)) return 0x0040 ^ 0xffff;
332   if (input_code_pressed(KEYCODE_8)) return 0x0080 ^ 0xffff;
333   if (input_code_pressed(KEYCODE_A)) return 0x0100 ^ 0xffff;
334   if (input_code_pressed(KEYCODE_S)) return 0x0200 ^ 0xffff;
335   if (input_code_pressed(KEYCODE_D)) return 0x0400 ^ 0xffff;
336   if (input_code_pressed(KEYCODE_F)) return 0x0800 ^ 0xffff;
337   if (input_code_pressed(KEYCODE_G)) return 0x1000 ^ 0xffff;
338   if (input_code_pressed(KEYCODE_H)) return 0x2000 ^ 0xffff;
339   if (input_code_pressed(KEYCODE_J)) return 0x4000 ^ 0xffff;
340   if (input_code_pressed(KEYCODE_K)) return 0x8000 ^ 0xffff;
341return 0x4;
342}
343   if (input_code_pressed(KEYCODE_1)) return 0x0001 ^ 0xffff;
344   if (input_code_pressed(KEYCODE_2)) return 0x0002 ^ 0xffff;
345   if (input_code_pressed(KEYCODE_3)) return 0x0004 ^ 0xffff;
346   if (input_code_pressed(KEYCODE_4)) return 0x0008 ^ 0xffff;
347   if (input_code_pressed(KEYCODE_5)) return 0x0010 ^ 0xffff;
348   if (input_code_pressed(KEYCODE_6)) return 0x0020 ^ 0xffff;
349   if (input_code_pressed(KEYCODE_7)) return 0x0040 ^ 0xffff;
350   if (input_code_pressed(KEYCODE_8)) return 0x0080 ^ 0xffff;
326   int value = 0xffff;
351327
352   return 0x0004 ^ 0xffff; // 0x0004
353
354   // FIXME: this code is never executed
355   switch (mame_rand(space->machine) & 3)
328   switch(mux_data)
356329   {
357      case 0:
358         return 0;
359      case 1:
360         return 0xffff;
361      default:
362         return mame_rand(space->machine) & 0xffff;
330      case 0x00: value = input_port_read(space->machine, "x0"); break;
331      case 0x01: value = input_port_read(space->machine, "x1"); break;
332      case 0x02: value = input_port_read(space->machine, "x2"); break;
333      case 0x03: value = input_port_read(space->machine, "1P_UP"); break;
334      case 0x04: value = input_port_read(space->machine, "1P_B1"); break;
335      case 0x05: value = input_port_read(space->machine, "x5"); break;
336      case 0x06: value = input_port_read(space->machine, "1P_RIGHT"); break;
337      case 0x07: value = input_port_read(space->machine, "1P_DOWN"); break;
338      case 0x08: value = input_port_read(space->machine, "1P_LEFT"); break;
339      case 0x09: value = input_port_read(space->machine, "x9"); break;
340      case 0x0a: value = input_port_read(space->machine, "x10"); break;
341      case 0x0b: value = input_port_read(space->machine, "x11"); break;
342      case 0x0c: value = input_port_read(space->machine, "x12"); break;
343      case 0x0d: value = input_port_read(space->machine, "x13"); break;
344      case 0x0e: value = input_port_read(space->machine, "x14"); break;
345      case 0x0f: value = input_port_read(space->machine, "x15"); break;
363346   }
364}
347   mux_data++;
348   mux_data&=0xf;
365349
366/*
367static READ16_HANDLER(test1_r)
368{
369    if (input_code_pressed(KEYCODE_Q)) return 0x0001;
370    if (input_code_pressed(KEYCODE_W)) return 0x0002;
371    if (input_code_pressed(KEYCODE_E)) return 0x0004;
372    if (input_code_pressed(KEYCODE_R)) return 0x0008;
373    if (input_code_pressed(KEYCODE_T)) return 0x0010;
374    if (input_code_pressed(KEYCODE_Y)) return 0x0020;
375    if (input_code_pressed(KEYCODE_U)) return 0x0040;
376    if (input_code_pressed(KEYCODE_I)) return 0x0080;
377    if (input_code_pressed(KEYCODE_A)) return 0x0100;
378    if (input_code_pressed(KEYCODE_S)) return 0x0200;
379    if (input_code_pressed(KEYCODE_D)) return 0x0400;
380    if (input_code_pressed(KEYCODE_F)) return 0x0800;
381    if (input_code_pressed(KEYCODE_G)) return 0x1000;
382    if (input_code_pressed(KEYCODE_H)) return 0x2000;
383    if (input_code_pressed(KEYCODE_J)) return 0x4000;
384    if (input_code_pressed(KEYCODE_K)) return 0x8000;
385
386    switch (mame_rand(space->machine) & 3)
387    {
388        case 0:
389            return 0;
390        case 1:
391            return 0xffff;
392        default:
393            return mame_rand(space->machine) % 0xffff;
394    }
350   return value;
395351}
396*/
397/*
398static READ16_HANDLER(rh1_r)
399{
400// printf("ra=%04x ",register_active);
401352
402    if ((register_active == 0x0e) || (register_active == 0x0e) || (register_active == 0x0e))
403        {
404    if (input_code_pressed(KEYCODE_1)) return 0x0001 ^ 0xffff;
405    if (input_code_pressed(KEYCODE_2)) return 0x0002 ^ 0xffff;
406    if (input_code_pressed(KEYCODE_3)) return 0x0004 ^ 0xffff;
407    if (input_code_pressed(KEYCODE_4)) return 0x0008 ^ 0xffff;
408    if (input_code_pressed(KEYCODE_5)) return 0x0010 ^ 0xffff;
409    if (input_code_pressed(KEYCODE_6)) return 0x0020 ^ 0xffff;
410    if (input_code_pressed(KEYCODE_7)) return 0x0040 ^ 0xffff;
411    if (input_code_pressed(KEYCODE_8)) return 0x0080 ^ 0xffff;
412    if (input_code_pressed(KEYCODE_A)) return 0x0100 ^ 0xffff;
413    if (input_code_pressed(KEYCODE_S)) return 0x0200 ^ 0xffff;
414    if (input_code_pressed(KEYCODE_D)) return 0x0400 ^ 0xffff;
415    if (input_code_pressed(KEYCODE_F)) return 0x0800 ^ 0xffff;
416    if (input_code_pressed(KEYCODE_G)) return 0x1000 ^ 0xffff;
417    if (input_code_pressed(KEYCODE_H)) return 0x2000 ^ 0xffff;
418    if (input_code_pressed(KEYCODE_J)) return 0x4000 ^ 0xffff;
419    if (input_code_pressed(KEYCODE_K)) return 0x8000 ^ 0xffff;
420
421        }
422
423    switch (mame_rand(space->machine) & 3)
424    {
425        case 0:
426            return 0;
427        case 1:
428            return 0xffff;
429        default:
430            return mame_rand(space->machine) % 0xffff;
431    }
432}
433*/
434/*
435static WRITE16_HANDLER(wh1_w)
436{
437    // register_active = data;
438}
439*/
440
353/*???*/
441354static WRITE16_HANDLER(wh2_w)
442355{
443356   register_active = data;
r4184r4185
450363 vblank ^=0x40;
451364 hblank ^=0x20;
452365
453    if (input_code_pressed(KEYCODE_1)) return 0x0001 ^ 0xffff;
454    if (input_code_pressed(KEYCODE_2)) return 0x0002 ^ 0xffff;
455    if (input_code_pressed(KEYCODE_3)) return 0x0004 ^ 0xffff;
456    if (input_code_pressed(KEYCODE_4)) return 0x0008 ^ 0xffff;
457    if (input_code_pressed(KEYCODE_5)) return 0x0010 ^ 0xffff;
458    if (input_code_pressed(KEYCODE_6)) return 0x0020 ^ 0xffff;
459    if (input_code_pressed(KEYCODE_7)) return 0x0040 ^ 0xffff;
460    if (input_code_pressed(KEYCODE_8)) return 0x0080 ^ 0xffff;
461    if (input_code_pressed(KEYCODE_A)) return 0x0100 ^ 0xffff;
462    if (input_code_pressed(KEYCODE_S)) return 0x0200 ^ 0xffff;
463    if (input_code_pressed(KEYCODE_D)) return 0x0400 ^ 0xffff;
464    if (input_code_pressed(KEYCODE_F)) return 0x0800 ^ 0xffff;
465    if (input_code_pressed(KEYCODE_G)) return 0x1000 ^ 0xffff;
466    if (input_code_pressed(KEYCODE_H)) return 0x2000 ^ 0xffff;
467    if (input_code_pressed(KEYCODE_J)) return 0x4000 ^ 0xffff;
468    if (input_code_pressed(KEYCODE_K)) return 0x8000 ^ 0xffff;
469// return mame_rand(space->machine) & 0x00f0;
366return mame_rand(space->machine) & 0x00f0;
470367
471 popmessage("%08x",cpu_get_pc(space->cpu));
368// popmessage("%08x",cpu_get_pc(space->cpu));
472369// return 0x0000;
473370 return 0xff9f | vblank | hblank;
474371}
r4184r4185
504401   AM_RANGE(0x800084, 0xffbfff) AM_RAM // used?
505402ADDRESS_MAP_END
506403
404static ADDRESS_MAP_START( funland_mem, ADDRESS_SPACE_PROGRAM, 16 )
405   AM_RANGE(0x000000, 0x0fffff) AM_ROM
406   //400000-40001f?
407   AM_RANGE(0x800080, 0x800081) AM_READWRITE(HD63484_status_r, HD63484_address_w)
408   AM_RANGE(0x800082, 0x800083) AM_READWRITE(HD63484_data_r, HD63484_data_w)
409//  AM_RANGE(0x800100, 0x8001ff) AM_READ(test_r) //18b too
410   AM_RANGE(0x800140, 0x800141) AM_READWRITE(t2_r,ay8910_control_port_0_lsb_w) //18b too
411   AM_RANGE(0x800142, 0x800143) AM_READWRITE(ay8910_read_port_0_lsb_r,ay8910_write_port_0_lsb_w) //18b too
412   AM_RANGE(0x800180, 0x80019f) AM_DEVREADWRITE8( DUART68681, "duart68681", duart68681_r, duart68681_w, 0xff )
413   AM_RANGE(0xfc0000, 0xffffff) AM_RAM
414ADDRESS_MAP_END
415
416
507417static INPUT_PORTS_START( adp )
508418
509419INPUT_PORTS_END
r4184r4185
516426   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_COIN6    )
517427   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_BILL1    )
518428   PORT_BIT( 0x0008, IP_ACTIVE_LOW,  IPT_UNKNOWN  )
519   PORT_SERVICE_NO_TOGGLE( 0x10, IP_ACTIVE_LOW )
429   PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
520430   PORT_BIT( 0x0020, IP_ACTIVE_LOW,  IPT_UNKNOWN  )
521431   PORT_BIT( 0x0040, IP_ACTIVE_LOW,  IPT_UNKNOWN  )
522432   PORT_BIT( 0x0080, IP_ACTIVE_LOW,  IPT_UNKNOWN  )
433
434   PORT_START("x0") //vblank status?
435   PORT_DIPNAME( 0x0004,0x0004, "SW0" )
436   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
437   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
438   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
439
440   PORT_START("x1")
441   PORT_DIPNAME( 0x0004,0x0004, "SW1" ) //another up button
442   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
443   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
444   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
445
446   PORT_START("x2")
447   PORT_DIPNAME( 0x0004,0x0004, "SW2" )
448   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
449   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
450   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
451   PORT_START("1P_UP")
452   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
453   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
454   PORT_START("1P_B1")
455   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 )
456   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
457   PORT_START("x5")
458   PORT_DIPNAME( 0x0004,0x0004, "SW5" )
459   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
460   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
461   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
462   PORT_START("1P_RIGHT")
463   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
464   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
465   PORT_START("1P_DOWN")
466   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
467   PORT_BIT( 0xfffb, IP_ACTIVE_LOW, IPT_UNUSED  )
468   PORT_START("1P_LEFT")
469   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
470   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
471   PORT_START("x9")
472   PORT_DIPNAME( 0x0004,0x0004, "SW9" )
473   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
474   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
475   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
476   PORT_START("x10") //button 2
477   PORT_DIPNAME( 0x0004,0x0004, "SW10" )
478   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
479   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
480   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
481   PORT_START("x11")
482   PORT_DIPNAME( 0x0004,0x0004, "SW11" )
483   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
484   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
485   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
486   PORT_START("x12") //button 3
487   PORT_DIPNAME( 0x0004,0x0004, "SW12" )
488   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
489   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
490   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
491   PORT_START("x13")
492   PORT_DIPNAME( 0x0004,0x0004, "SW13" )
493   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
494   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
495   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
496   PORT_START("x14") //button 4
497   PORT_DIPNAME( 0x0004,0x0004, "SW14" )
498   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
499   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
500   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
501   PORT_START("x15")
502   PORT_DIPNAME( 0x0004,0x0004, "SW15" )
503   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
504   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
505   PORT_BIT( 0xfffb, IP_ACTIVE_LOW,  IPT_UNUSED  )
523506INPUT_PORTS_END
524507
525508/*
r4184r4185
607590
608591MACHINE_DRIVER_END
609592
593static MACHINE_DRIVER_START( funland )
594   MDRV_IMPORT_FROM( skattv )
595   MDRV_CPU_MODIFY("main")
596   MDRV_CPU_PROGRAM_MAP(funland_mem, 0)
597MACHINE_DRIVER_END
598
610599ROM_START( quickjac )
611600   ROM_REGION( 0x100000, "main", 0 )
612601   ROM_LOAD16_BYTE( "quick_jack_index_a.1.u2.bin", 0x00000, 0x10000, CRC(c2fba6fe) SHA1(f79e5913f9ded1e370cc54dd55860263b9c51d61) )
r4184r4185
677666GAME( 1994, skattv,          0, skattv,      skattv,    0, ROT0,  "ADP", "Skat TV", GAME_NOT_WORKING )
678667GAME( 1995, skattva,    skattv, skattv,      skattv,    0, ROT0,  "ADP", "Skat TV (version TS3)", GAME_NOT_WORKING )
679668GAME( 1997, fashiong,        0, skattv,      skattv,    0, ROT0,  "ADP", "Fashion Gambler", GAME_NOT_WORKING )
680GAME( 1999, funlddlx,        0, skattv,      skattv,    0, ROT0,  "Stella", "Funny Land de Luxe", GAME_NOT_WORKING )
669GAME( 1999, funlddlx,        0, funland,     skattv,    0, ROT0,  "Stella", "Funny Land de Luxe", GAME_NOT_WORKING )
670
src/mame/drivers/cps3.c
r4184r4185
330330#define LOAD_CD_CONTENT 1
331331#define DEBUG_PRINTF 0
332332
333#ifdef LSB_FIRST
334   #define DMA_XOR(a)   ((a) ^ 1)
335#else
336   #define DMA_XOR(a)   ((a) ^ 2)
337#endif
333#define DMA_XOR(a)      ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,2))
338334
339335
340336static UINT32* decrypted_bios;
r4184r4185
665661   { "jojobane", { 0x23323ee3, 0x03021972 },0 },
666662   { "sfiii",    { 0xb5fe053e, 0xfc03925a },0 },
667663   { "sfiiiu",   { 0xb5fe053e, 0xfc03925a },0 },
664   { "sfiiij",   { 0xb5fe053e, 0xfc03925a },0 },
668665   { "sfiiin",   { 0xb5fe053e, 0xfc03925a },0 },
669666   { "sfiii2",   { 0x00000000, 0x00000000 },1 },
670667   { "sfiii2u",  { 0x00000000, 0x00000000 },1 },
668   { "sfiii2j",  { 0x00000000, 0x00000000 },1 },
671669   { "sfiii2n",  { 0x00000000, 0x00000000 },1 },
672670   { "sfiii3",   { 0xa55432b4, 0x0c129981 },0 },
673671   { "sfiii3n",  { 0xa55432b4, 0x0c129981 },0 },
src/mame/drivers/yunsung8.c
r4184r4185
5656static MACHINE_RESET( yunsung8 )
5757{
5858   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
59   UINT8 *RAM = memory_region(machine, "main") + 0x24000;
59   UINT8* yunsung8_videoram = auto_malloc(0x4000);
6060
61   yunsung8_videoram_0 = RAM + 0x0000;   // Ram is banked
62   yunsung8_videoram_1 = RAM + 0x2000;
61   yunsung8_videoram_0 = yunsung8_videoram + 0x0000;   // Ram is banked
62   yunsung8_videoram_1 = yunsung8_videoram + 0x2000;
6363   yunsung8_videobank_w(space,0,0);
6464}
6565
r4184r4185
345345   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
346346INPUT_PORTS_END
347347
348static INPUT_PORTS_START( cannbalv )
349   PORT_INCLUDE(cannball)
350   PORT_MODIFY("SYSTEM")
351   PORT_BIT(  0x40, IP_ACTIVE_HIGH, IPT_SPECIAL  ) // always activated, otherwise the game resets. a simple check for horizontal / vertical version of the game?
352INPUT_PORTS_END
353
348354/***************************************************************************
349355                                    Rock Tris
350356***************************************************************************/
r4184r4185
533539   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.0)
534540   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0)
535541
536   MDRV_SOUND_ADD("msm", MSM5205, 384000)
542   MDRV_SOUND_ADD("msm", MSM5205, XTAL_400kHz) /* verified on pcb */
537543   MDRV_SOUND_CONFIG(yunsung8_msm5205_interface)
538544   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.80)
539545   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.80)
r4184r4185
561567
562568ROM_START( magix )
563569
564   ROM_REGION( 0x24000+0x4000, "main", 0 )      /* Main Z80 Code */
570   ROM_REGION( 0x24000, "main", 0 )      /* Main Z80 Code */
565571   ROM_LOAD( "yunsung8.07", 0x00000, 0x0c000, CRC(d4d0b68b) SHA1(d7e1fb57a14f8b822791b98cecc6d5a053a89e0f) )
566572   ROM_CONTINUE(         0x10000, 0x14000             )
567   /* $2000 bytes for bank 0 of video ram (text) */
568   /* $2000 bytes for bank 1 of video ram (background) */
569573
570574   ROM_REGION( 0x24000, "audio", 0 )      /* Sound Z80 Code */
571575   ROM_LOAD( "yunsung8.08", 0x00000, 0x0c000, CRC(6fd60be9) SHA1(87622dc2967842629e90a02b415bec86cc26cbc7) )
r4184r4185
601605
602606ROM_START( cannball )
603607
604   ROM_REGION( 0x24000+0x4000, "main", 0 )      /* Main Z80 Code */
608   ROM_REGION( 0x24000, "main", 0 )      /* Main Z80 Code */
605609   ROM_LOAD( "cannball.07", 0x00000, 0x0c000, CRC(17db56b4) SHA1(032e3dbde0b0e315dcb5f2b31f57e75e78818f2d) )
606610   ROM_CONTINUE(            0x10000, 0x14000             )
607   /* $2000 bytes for bank 0 of video ram (text) */
608   /* $2000 bytes for bank 1 of video ram (background) */
609611
610612   ROM_REGION( 0x24000, "audio", 0 )      /* Sound Z80 Code */
611613   ROM_LOAD( "cannball.08", 0x00000, 0x0c000, CRC(11403875) SHA1(9f583bc4f08e7aef3fd0f3fe3f31cce1d226641a) )
r4184r4185
623625
624626ROM_END
625627
628
629ROM_START( cannbalv )
630
631   ROM_REGION( 0x24000, "main", 0 )      /* Main Z80 Code */
632   ROM_LOAD( "yunsung1", 0x00000, 0x0c000, CRC(f7398b0d) SHA1(f2cdb9c4662cd325376d25ae9611f689605042db) )
633   ROM_CONTINUE(            0x10000, 0x14000             )
634
635   ROM_REGION( 0x24000, "audio", 0 )      /* Sound Z80 Code */
636   ROM_LOAD( "yunsung8", 0x00000, 0x0c000, CRC(11403875) SHA1(9f583bc4f08e7aef3fd0f3fe3f31cce1d226641a) )
637   ROM_CONTINUE(            0x10000, 0x14000             )
638
639   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )   /* Background */
640   ROM_LOAD( "yunsung7",  0x000000, 0x80000, CRC(a5f1a648) SHA1(7a5bf5bc0ad257ccb12104512e98dfb3525babfc) )
641   ROM_LOAD( "yunsung6",  0x080000, 0x80000, CRC(8baa686e) SHA1(831c3e2864d262bf5429dca6653c83dc976e610e) )
642   ROM_LOAD( "yunsung5",  0x100000, 0x80000, CRC(a7f2ce51) SHA1(81632aca067f2c8c45488266c4489d9af24fb552) )
643   ROM_LOAD( "yunsung4",  0x180000, 0x80000, CRC(74bef793) SHA1(6208580ce747cec3d410ce3c71e07aa570b9121d) )
644
645   ROM_REGION( 0x40000, "gfx2", ROMREGION_DISPOSE )   /* Text */
646   ROM_LOAD( "yunsung3", 0x00000, 0x20000, CRC(8217abbe) SHA1(1a459a816a1aa5b68858e39c4a21bd78ee78dcab) )
647   ROM_LOAD( "yunsung2", 0x20000, 0x20000, CRC(76de1045) SHA1(a3845ee1874e6ec0ce26e6e73e4643243779e70d) )
648
649ROM_END
650
651
626652/***************************************************************************
627653
628654Rock Tris by Yunsung
r4184r4185
645671
646672ROM_START( rocktris )
647673
648   ROM_REGION( 0x24000+0x4000, "main", 0 )      /* Main Z80 Code */
674   ROM_REGION( 0x24000, "main", 0 )      /* Main Z80 Code */
649675   ROM_LOAD( "cpu.bin",     0x00000, 0x0c000, CRC(46e3b79c) SHA1(81a587b9f986c4e39b1888ec6ed6b86d1469b9a0) )
650676   ROM_CONTINUE(         0x10000, 0x14000             )
651   /* $2000 bytes for bank 0 of video ram (text) */
652   /* $2000 bytes for bank 1 of video ram (background) */
653677
654678   ROM_REGION( 0x24000, "audio", 0 )      /* Sound Z80 Code */
655679   ROM_LOAD( "cpu2.bin",    0x00000, 0x0c000, CRC(3a78a4cf) SHA1(f643c7a217cbb71f3a03f1f4a16545c546332819) )
r4184r4185
679703
680704***************************************************************************/
681705
682GAME( 1995,  cannball, 0, yunsung8, cannball, 0, ROT0, "Yun Sung / Soft Vision", "Cannon Ball (Yun Sung)",  GAME_IMPERFECT_SOUND )
683GAME( 1995,  magix,    0, yunsung8, magix,    0, ROT0, "Yun Sung",               "Magix / Rock", GAME_IMPERFECT_SOUND ) // Title: DSW
684GAME( 1994?, rocktris, 0, yunsung8, rocktris, 0, ROT0, "Yun Sung",               "Rock Tris",    GAME_IMPERFECT_SOUND )
706GAME( 1995,  cannball, 0,        yunsung8, cannball, 0, ROT0,   "Yun Sung / Soft Vision", "Cannon Ball (Yun Sung) (horizontal)",  GAME_IMPERFECT_SOUND )
707GAME( 1995,  cannbalv, cannball, yunsung8, cannbalv, 0, ROT270, "Yun Sung / T&K",         "Cannon Ball (Yun Sung) (vertical)",  GAME_IMPERFECT_SOUND )
708GAME( 1995,  magix,    0,        yunsung8, magix,    0, ROT0,   "Yun Sung",               "Magix / Rock", GAME_IMPERFECT_SOUND ) // Title: DSW
709GAME( 1994?, rocktris, 0,        yunsung8, rocktris, 0, ROT0,   "Yun Sung",               "Rock Tris",    GAME_IMPERFECT_SOUND )
src/mame/drivers/cvs.c
r4184r4185
121121UINT8 *cvs_video_ram;
122122UINT8 *cvs_bullet_ram;
123123UINT8 *cvs_palette_ram;
124UINT8 *cvs_character_ram;
124static UINT8 *cvs_character_ram;
125125UINT8 *cvs_s2636_0_ram;
126126UINT8 *cvs_s2636_1_ram;
127127UINT8 *cvs_s2636_2_ram;
r4184r4185
198198   {
199199      offset |= (0 * 0x800) | 0x400 | character_ram_page_start;
200200      cvs_character_ram[offset] = data;
201      gfx_element_mark_dirty(space->machine->gfx[1], offset/8);
201      gfx_element_mark_dirty(space->machine->gfx[1], (offset/8) % 256);
202202   }
203203   else
204204      cvs_s2636_0_ram[offset] = data;
r4184r4185
219219   {
220220      offset |= (1 * 0x800) | 0x400 | character_ram_page_start;
221221      cvs_character_ram[offset] = data;
222      gfx_element_mark_dirty(space->machine->gfx[1], offset/8);
222      gfx_element_mark_dirty(space->machine->gfx[1], (offset/8) % 256);
223223   }
224224   else
225225      cvs_s2636_1_ram[offset] = data;
r4184r4185
240240   {
241241      offset |= (2 * 0x800) | 0x400 | character_ram_page_start;
242242      cvs_character_ram[offset] = data;
243      gfx_element_mark_dirty(space->machine->gfx[1], offset/8);
243      gfx_element_mark_dirty(space->machine->gfx[1], (offset/8) % 256);
244244   }
245245   else
246246      cvs_s2636_2_ram[offset] = data;
src/mame/drivers/nemesis.c
r4184r4185
19091909
19101910/******************************************************************************/
19111911
1912#ifdef LSB_FIRST
1913#define XOR(x) ((x)^8)
1914#else
1915#define XOR(x) (x)
1916#endif
1912#define XOR(x) ((x)^NATIVE_ENDIAN_VALUE_LE_BE(8,0))
19171913
19181914static const gfx_layout charlayout =
19191915{
src/mame/drivers/progolf.c
r4184r4185
4848   AM_RANGE(0x0000, 0x0fff) AM_RAM
4949   AM_RANGE(0x1000, 0x1fff) AM_RAM //AM_WRITE(deco_charram_w) AM_BASE(&deco_charram)
5050   AM_RANGE(0x2000, 0x7fff) AM_RAM AM_BASE(&deco_charram) //AM_WRITE(deco_charram_w)
51   AM_RANGE(0x9000, 0x9000) AM_WRITENOP
51   AM_RANGE(0x9000, 0x9000) AM_WRITENOP //video control?
5252   AM_RANGE(0x9000, 0x9000) AM_READNOP
5353   AM_RANGE(0x9200, 0x9200) AM_WRITENOP
5454   AM_RANGE(0x9400, 0x9400) AM_WRITENOP
5555   AM_RANGE(0x9600, 0x9600) AM_WRITENOP
5656   AM_RANGE(0x9600, 0x9600) AM_READ_PORT("IN0")     /* VBLANK */
5757   AM_RANGE(0x9800, 0x9800) AM_READNOP
58   AM_RANGE(0x9800, 0x9801) AM_WRITENOP
58   AM_RANGE(0x9800, 0x9801) AM_WRITENOP // mc6845 regs
5959   AM_RANGE(0x9a00, 0x9a00) AM_WRITENOP
6060   AM_RANGE(0x9a00, 0x9a00) AM_READNOP
6161   AM_RANGE(0x9e00, 0x9e00) AM_WRITENOP
62   AM_RANGE(0x8000, 0x83ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
63   AM_RANGE(0x8400, 0x87ff) AM_RAM AM_BASE(&colorram)
62   AM_RANGE(0x8000, 0x83ff) AM_RAM AM_BASE(&btime_videoram) AM_SIZE(&btime_videoram_size)
63   AM_RANGE(0x8400, 0x87ff) AM_RAM AM_BASE(&btime_colorram)
6464   AM_RANGE(0x8800, 0x881f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
6565   AM_RANGE(0x8820, 0x8fff) AM_RAM
6666   AM_RANGE(0xb000, 0xffff) AM_ROM
6767ADDRESS_MAP_END
6868
69#if 0
70static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
71   AM_RANGE(0x0000, 0x03ff) AM_READ(SMH_RAM)
72   AM_RANGE(0xa000, 0xafff) AM_READ(soundlatch_r)
73   AM_RANGE(0xf000, 0xffff) AM_READ(SMH_ROM)
69static ADDRESS_MAP_START( sound_cpu, ADDRESS_SPACE_PROGRAM, 8 )
70   AM_RANGE(0x0000, 0x0fff) AM_RAM
71   AM_RANGE(0x4000, 0x4fff) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
72   AM_RANGE(0x5000, 0x5fff) AM_WRITE(ay8910_control_port_0_w)
73   AM_RANGE(0x6000, 0x6fff) AM_READWRITE(ay8910_read_port_1_r,ay8910_write_port_1_w)
74   AM_RANGE(0x7000, 0x7fff) AM_WRITE(ay8910_control_port_1_w)
75//  AM_RANGE(0x8000, 0x8fff) AM_WRITE(interrupt_enable_w) //???
76   AM_RANGE(0x9000, 0xafff) AM_READ(soundlatch_r)
77   AM_RANGE(0xf000, 0xffff) AM_ROM
7478ADDRESS_MAP_END
7579
76static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
77   AM_RANGE(0x0000, 0x03ff) AM_WRITE(SMH_RAM)
78   AM_RANGE(0x2000, 0x2fff) AM_WRITE(ay8910_write_port_0_w)
79   AM_RANGE(0x4000, 0x4fff) AM_WRITE(ay8910_control_port_0_w)
80   AM_RANGE(0x6000, 0x6fff) AM_WRITE(ay8910_write_port_1_w)
81   AM_RANGE(0x8000, 0x8fff) AM_WRITE(ay8910_control_port_1_w)
82   AM_RANGE(0xc000, 0xcfff) AM_WRITE(interrupt_enable_w)
83   AM_RANGE(0xf000, 0xffff) AM_WRITE(SMH_ROM)
84ADDRESS_MAP_END
85#endif
86
8780static INPUT_PORTS_START( progolf )
8881   PORT_START("IN0")
8982   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
r4184r4185
193186   MDRV_CPU_PROGRAM_MAP(main_cpu,0)
194187//  MDRV_CPU_VBLANK_INT("main", progolf_interrupt)
195188
196//  MDRV_CPU_ADD("audio", M6502, 500000)
197//  MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
198//  MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16)
189     MDRV_CPU_ADD("audio", M6502, 500000)
190   MDRV_CPU_PROGRAM_MAP(sound_cpu,0)
191//  MDRV_CPU_VBLANK_INT("main",nmi_line_pulse)
199192
200193   /* video hardware */
201194   MDRV_SCREEN_ADD("main", RASTER)
r4184r4185
232225   ROM_LOAD( "g1-m.8a",      0xe000, 0x1000, CRC(749032eb) SHA1(daa356b2c70bcd8cdd0c4df4268b6158bc8aae8e) )
233226   ROM_LOAD( "g0-m.9a",      0xf000, 0x1000, CRC(8f8b1e8e) SHA1(fc877a8f2b26ea48c5ba2324678d6077f3432a79) )
234227
235   ROM_REGION( 0x10000, "cpu1", 0 )
228   ROM_REGION( 0x10000, "audio", 0 )
236229   ROM_LOAD( "g6-m.1b",      0xf000, 0x1000, CRC(0c6fadf5) SHA1(9af2c2152b339cadab7aff0b0164d4431d2558bd) )
237230
238231   ROM_REGION( 0x3000, "gfx1", ROMREGION_DISPOSE )
r4184r4185
254247   ROM_LOAD( "g1-m.a8",      0xe000, 0x1000, CRC(749032eb) SHA1(daa356b2c70bcd8cdd0c4df4268b6158bc8aae8e) )
255248   ROM_LOAD( "g0-m.a9",      0xf000, 0x1000, CRC(a03c533f) SHA1(2e0006be40e32b64b1490bd339d9fc9302eee7c4) )
256249
257   ROM_REGION( 0x10000, "cpu1", 0 )
250   ROM_REGION( 0x10000, "audio", 0 )
258251   ROM_LOAD( "g5-m.b1",      0xf000, 0x1000, CRC(0c6fadf5) SHA1(9af2c2152b339cadab7aff0b0164d4431d2558bd) )
259252
260253   ROM_REGION( 0x3000, "gfx1", ROMREGION_DISPOSE )
r4184r4185
283276      decrypted[A] = BITSWAP8(rom[A],7,5,6,4,3,2,1,0);
284277}
285278
286GAME( 1981, progolf,  0,       progolf, progolf, progolf, ROT270, "Data East Corporation", "Pro Golf (set 1)", GAME_NOT_WORKING )
287GAME( 1981, progolfa, progolf, progolf, progolf, progolf, ROT270, "Data East Corporation", "Pro Golf (set 2)", GAME_NOT_WORKING ) // doesn't display anything
279/*Maybe progolf is a bootleg and progolfa is the original (with Deco C10707 as CPU)?*/
280GAME( 1981, progolf,  0,       progolf, progolf, progolf, ROT270, "Data East Corporation", "18 Holes Pro Golf (set 1)", GAME_NOT_WORKING )
281GAME( 1981, progolfa, progolf, progolf, progolf, progolf, ROT270, "Data East Corporation", "18 Holes Pro Golf (set 2)", GAME_NOT_WORKING ) // doesn't display anything
src/mame/drivers/jackie.c
r0r4185
1#include "driver.h"
2#include "deprecat.h"
3#include "cpu/z80/z80.h"
4#include "sound/2413intf.h"
5
6
7
8static UINT8   *fg_tile_ram, *fg_color_ram;
9static tilemap *fg_tilemap;
10
11static TILE_GET_INFO( get_fg_tile_info )
12{
13   int code = fg_tile_ram[tile_index] | (fg_color_ram[tile_index] << 8);
14   int tile = code & 0x1fff;
15   SET_TILE_INFO(1, code, tile != 0x1fff ? ((code >> 12) & 0xe) + 1 : 0, 0);
16}
17
18static WRITE8_HANDLER( fg_tile_w )
19{
20   fg_tile_ram[offset] = data;
21   tilemap_mark_tile_dirty(fg_tilemap,offset);
22}
23
24static WRITE8_HANDLER( fg_color_w )
25{
26   fg_color_ram[offset] = data;
27   tilemap_mark_tile_dirty(fg_tilemap,offset);
28}
29
30static VIDEO_START(jackie)
31{
32   fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,   8,  8,   64, 32);
33   tilemap_set_transparent_pen(fg_tilemap, 0);
34}
35
36static VIDEO_UPDATE(jackie)
37{
38   bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
39
40   tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
41
42   return 0;
43}
44
45
46static int irq_enable, nmi_enable, bg_enable, hopper;
47
48static MACHINE_RESET( jackie )
49{
50   irq_enable   =   1;
51   nmi_enable   =   0;
52   hopper      =   0;
53   bg_enable   =   1;
54}
55
56static INTERRUPT_GEN( jackie_interrupt )
57{
58   if (cpu_getiloops(device) % 2) {
59      if (irq_enable)
60      cpu_set_input_line(device, 0, HOLD_LINE);
61   } else {
62      if (nmi_enable)
63      cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
64   }
65}
66
67static UINT8 out[3];
68
69static void show_out(void)
70{
71#ifdef MAME_DEBUG
72   popmessage("%02x %02x %02x", out[0], out[1], out[2]);
73#endif
74}
75
76static WRITE8_HANDLER( jackie_nmi_and_coins_w )
77{
78   coin_counter_w(0,      data & 0x01);   // coin_a
79   coin_counter_w(1,      data & 0x04);   // coin_c
80   coin_counter_w(2,      data & 0x08);   // key in
81   coin_counter_w(3,      data & 0x10);   // coin out mech
82
83   set_led_status(6,      data & 0x20);   // led for coin out / hopper active
84
85   nmi_enable = data & 0x80;     // nmi enable?
86
87   out[0] = data;
88   show_out();
89}
90
91static WRITE8_HANDLER( jackie_lamps_w )
92{
93/*
94    - Lbits -
95    7654 3210
96    =========
97    ---- --x-  Hold1 lamp.
98    --x- ----  Hold2 lamp.
99    ---x ----  Hold3 lamp.
100    ---- x---  Hold4 lamp.
101    ---- -x--  Hold5 lamp.
102    ---- ---x  Start lamp.
103*/
104   output_set_lamp_value(1, (data >> 1) & 1);      /* Lamp 1 - HOLD 1 */
105   output_set_lamp_value(2, (data >> 5) & 1);      /* Lamp 2 - HOLD 2  */
106   output_set_lamp_value(3, (data >> 4) & 1);      /* Lamp 3 - HOLD 3 */
107   output_set_lamp_value(4, (data >> 3) & 1);      /* Lamp 4 - HOLD 4 */
108   output_set_lamp_value(5, (data >> 2) & 1);      /* Lamp 5 - HOLD 5 */
109   output_set_lamp_value(6, (data & 1));         /* Lamp 6 - START */
110
111   hopper         =   (~data)& 0x80;
112
113   out[1] = data;
114   show_out();
115}
116
117static READ8_HANDLER( igs_irqack_r )
118{
119   irq_enable = 1;
120   return 0;
121}
122
123static WRITE8_HANDLER( igs_irqack_w )
124{
125//  cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
126   out[2] = data;
127   show_out();
128}
129
130UINT8 *main_ram;
131
132static WRITE8_HANDLER( ram_w )
133{
134   main_ram[offset] = data;
135//  logerror("PC %06X: %04x = %02x\n",cpu_get_pc(space->cpu),offset+0xf000,data);
136}
137
138
139static ADDRESS_MAP_START( jackie_prg_map, ADDRESS_SPACE_PROGRAM, 8 )
140   AM_RANGE(0x0000, 0xefff) AM_ROM
141   AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE( ram_w ) AM_BASE( &main_ram )
142ADDRESS_MAP_END
143
144static ADDRESS_MAP_START( jackie_io_map, ADDRESS_SPACE_IO, 8 )
145   AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_BASE( &paletteram )
146   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_BASE( &paletteram_2 )
147   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("DSW1")         /* DSW1 */
148   AM_RANGE(0x4001, 0x4001) AM_READ_PORT("DSW2")         /* DSW2 */
149   AM_RANGE(0x4002, 0x4002) AM_READ_PORT("DSW3")         /* DSW3 */
150   AM_RANGE(0x4003, 0x4003) AM_READ_PORT("DSW4")         /* DSW4 */
151   AM_RANGE(0x4004, 0x4004) AM_READ_PORT("DSW5")         /* DSW5 */
152   AM_RANGE(0x5080, 0x5080) AM_WRITE(jackie_nmi_and_coins_w)
153   AM_RANGE(0x5081, 0x5081) AM_READ_PORT("SERVICE")
154   AM_RANGE(0x5082, 0x5082) AM_READ_PORT("COINS")
155   AM_RANGE(0x5090, 0x5090) AM_READ_PORT("BUTTONS1")
156   AM_RANGE(0x5091, 0x5091) AM_WRITE( jackie_lamps_w )
157   AM_RANGE(0x50a0, 0x50a0) AM_READ_PORT("BUTTONS2")
158   AM_RANGE(0x50b0, 0x50b0) AM_WRITE(ym2413_register_port_0_w)
159   AM_RANGE(0x50b1, 0x50b1) AM_WRITE(ym2413_data_port_0_w)
160   AM_RANGE(0x50c0, 0x50c0) AM_READ(igs_irqack_r) AM_WRITE(igs_irqack_w)
161   AM_RANGE(0x7000, 0x77ff) AM_RAM_WRITE( fg_tile_w )  AM_BASE( &fg_tile_ram )
162   AM_RANGE(0x7800, 0x7fff) AM_RAM_WRITE( fg_color_w ) AM_BASE( &fg_color_ram )
163   AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("gfx3", 0)
164ADDRESS_MAP_END
165
166static CUSTOM_INPUT( hopper_r )
167{
168   if (hopper) return !(video_screen_get_frame_number(field->port->machine->primary_screen)%10);
169   return input_code_pressed(KEYCODE_H);
170}
171
172static INPUT_PORTS_START( jackie )
173
174   PORT_START("DSW1")
175   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWA:8")
176   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
177   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
178   PORT_DIPUNKNOWN( 0x02, 0x02 )
179   PORT_DIPUNKNOWN( 0x04, 0x04 )
180   PORT_DIPUNKNOWN( 0x08, 0x08 )
181   PORT_DIPUNKNOWN( 0x10, 0x10 )
182   PORT_DIPUNKNOWN( 0x20, 0x20 )
183   PORT_DIPUNKNOWN( 0x40, 0x40 )
184   PORT_DIPUNKNOWN( 0x80, 0x80 )
185
186   PORT_START("DSW2")
187   PORT_DIPNAME( 0x0f, 0x07, "Main Game Chance" ) PORT_DIPLOCATION("SWB:8,7,6,5")
188   PORT_DIPSETTING(    0x0f, "45%" )
189   PORT_DIPSETTING(    0x0e, "50%" )
190   PORT_DIPSETTING(    0x0d, "55%" )
191   PORT_DIPSETTING(    0x0c, "60%" )
192   PORT_DIPSETTING(    0x0b, "65%" )
193   PORT_DIPSETTING(    0x0a, "70%" )
194   PORT_DIPSETTING(    0x09, "75%" )
195   PORT_DIPSETTING(    0x08, "80%" )
196   PORT_DIPSETTING(    0x07, "83%" )
197   PORT_DIPSETTING(    0x06, "85%" )
198   PORT_DIPSETTING(    0x05, "88%" )
199   PORT_DIPSETTING(    0x04, "90%" )
200   PORT_DIPSETTING(    0x03, "92%" )
201   PORT_DIPSETTING(    0x02, "94%" )
202   PORT_DIPSETTING(    0x01, "96%" )
203   PORT_DIPSETTING(    0x00, "98%" )
204   PORT_DIPUNKNOWN( 0x10, 0x10 )
205   PORT_DIPNAME( 0x20, 0x00, "Double Up Rate" ) PORT_DIPLOCATION("SWB:3")
206   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
207   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
208   PORT_DIPUNKNOWN( 0x40, 0x40 )
209   PORT_DIPUNKNOWN( 0x80, 0x80 )
210
211   PORT_START("DSW3")
212   PORT_DIPUNKNOWN( 0x01, 0x01 )
213   PORT_DIPUNKNOWN( 0x02, 0x02 )
214   PORT_DIPUNKNOWN( 0x04, 0x04 )
215   PORT_DIPUNKNOWN( 0x08, 0x08 )
216   PORT_DIPUNKNOWN( 0x10, 0x10 )
217   PORT_DIPUNKNOWN( 0x20, 0x20 )
218   PORT_DIPNAME( 0xC0, 0x00, "Max Bet" ) PORT_DIPLOCATION("SWC:2,1")
219   PORT_DIPSETTING(    0xC0, "1" )
220   PORT_DIPSETTING(    0x80, "8" )
221   PORT_DIPSETTING(    0x40, "16" )
222   PORT_DIPSETTING(    0x00, "32" )
223
224   PORT_START("DSW4")
225   PORT_DIPUNKNOWN( 0x01, 0x01 )
226   PORT_DIPUNKNOWN( 0x02, 0x02 )
227   PORT_DIPUNKNOWN( 0x04, 0x04 )
228   PORT_DIPUNKNOWN( 0x08, 0x08 )
229   PORT_DIPUNKNOWN( 0x10, 0x10 )
230   PORT_DIPUNKNOWN( 0x20, 0x20 )
231   PORT_DIPUNKNOWN( 0x40, 0x40 )
232   PORT_DIPUNKNOWN( 0x80, 0x80 )
233
234   PORT_START("DSW5")
235   PORT_DIPUNKNOWN( 0x01, 0x01 )
236   PORT_DIPUNKNOWN( 0x02, 0x02 )
237   PORT_DIPUNKNOWN( 0x04, 0x04 )
238   PORT_DIPUNKNOWN( 0x08, 0x08 )
239   PORT_DIPUNKNOWN( 0x10, 0x10 )
240   PORT_DIPUNKNOWN( 0x20, 0x20 )
241   PORT_DIPUNKNOWN( 0x40, 0x40 )
242   PORT_DIPUNKNOWN( 0x80, 0x80 )
243
244
245   PORT_START("SERVICE")
246   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_0) PORT_NAME("Attendent")
247   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL  ) PORT_CUSTOM( hopper_r, (void *)0 ) PORT_NAME("HPSW")   // hopper sensor
248   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4) PORT_NAME("Payout")
249   PORT_SERVICE_NO_TOGGLE( 0x20, IP_ACTIVE_LOW )   // test (press during boot)
250   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F1) PORT_NAME("Statistics")
251
252   PORT_START("COINS")
253   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
254   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
255   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
256   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3  ) PORT_NAME("Key In")
257   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN4  ) PORT_NAME("Clear")   // pays out
258   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER  ) PORT_CODE(KEYCODE_T) PORT_NAME("Togglemode")   // Used
259   PORT_BIT( 0xC0, IP_ACTIVE_HIGH, IPT_UNUSED )
260
261   PORT_START("BUTTONS1")
262   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_A) PORT_NAME("Stop 1")
263   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_S) PORT_NAME("Stop 2")
264   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_D) PORT_NAME("Stop 3")
265   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_F) PORT_NAME("Stop")
266   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
267   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
268   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
269   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
270
271   PORT_START("BUTTONS2")   // OK
272   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
273   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_C)   PORT_NAME("Small/Right Hammer")
274   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_B)   PORT_NAME("Bet")
275   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_Z)   PORT_NAME("Take/Left Hammer")
276   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_V)   PORT_NAME("W-Up")
277   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_X)   PORT_NAME("Big/Center Hammer")
278   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
279
280INPUT_PORTS_END
281
282
283static const gfx_layout layout_8x8x6 =
284{
285   8, 8,
286   RGN_FRAC(1, 3),
287   6,
288   { RGN_FRAC(0,3)+8,RGN_FRAC(0,3)+0,
289     RGN_FRAC(1,3)+8,RGN_FRAC(1,3)+0,
290     RGN_FRAC(2,3)+8,RGN_FRAC(2,3)+0 },
291   { STEP8(0,1) },
292   { STEP8(0,2*8) },
293   8*8*2
294};
295
296static const gfx_layout layout_8x32x6 =
297{
298   8, 32,
299   RGN_FRAC(1, 3),
300   6,
301   { RGN_FRAC(0,3)+8,RGN_FRAC(0,3)+0,
302     RGN_FRAC(1,3)+8,RGN_FRAC(1,3)+0,
303     RGN_FRAC(2,3)+8,RGN_FRAC(2,3)+0 },
304   { STEP8(0,1) },
305   { STEP32(0,2*8) },
306   8*32*2
307};
308
309static GFXDECODE_START( jackie )
310   GFXDECODE_ENTRY( "gfx2", 0, layout_8x32x6, 0, 16 )
311   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x6,  0, 16 )
312GFXDECODE_END
313
314
315
316static MACHINE_DRIVER_START( jackie )
317
318   /* basic machine hardware */
319   MDRV_CPU_ADD("main", Z80, 12000000/2/2)
320   MDRV_CPU_PROGRAM_MAP(jackie_prg_map,0)
321   MDRV_CPU_IO_MAP(jackie_io_map,0)
322   MDRV_CPU_VBLANK_INT_HACK(jackie_interrupt,8)
323
324   MDRV_MACHINE_RESET(jackie)
325
326   /* video hardware */
327   MDRV_SCREEN_ADD("main", RASTER)
328   MDRV_SCREEN_REFRESH_RATE(57)
329   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
330   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
331   MDRV_SCREEN_SIZE(64*8, 32*8)
332   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 32*8-1)
333
334   MDRV_GFXDECODE(jackie)
335   MDRV_PALETTE_LENGTH(2048)
336
337   MDRV_VIDEO_START(jackie)
338   MDRV_VIDEO_UPDATE(jackie)
339
340   /* sound hardware */
341   MDRV_SPEAKER_STANDARD_MONO("mono")
342   MDRV_SOUND_ADD("ym", YM2413, 3579545)
343   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
344
345MACHINE_DRIVER_END
346
347
348/*
349
350Anno    199x
351Produttore  IGS
352N.revisione
353
354CPU
355
3561x Z0840006PSC (main)
3572x D8255AC
3581x unknown AMT001
3591x unknown IGS002
3601x UM3567 (sound)
3611x oscillator 12.000MHz
3621x oscillator 3.579645
363
364ROMs
365
3662x D27128A (1,3)
3671x MBM27128 (2)
3683x 27C010 (4,5,6)
3691x D27512 (7sv)
3701x MBM27C512 (v110)
3711x unknown (DIP20 mil300)(jack3)
3723x PEEL18CV8PC (read protected)
3731x TIBPAL16L8 (read protected)
374
375Note
376
3771x 36x2 edge connector
3781x 10x2 edge connector (payout system)
3791x trimmer (volume)
3801x pushbutton
3811x battery
3825x 8x2 switches dip
383
384*/
385ROM_START( jackie )
386   ROM_REGION( 0x10000, "main", 0 )
387   ROM_LOAD( "jackiev110.u23",   0x0000, 0x10000, CRC(1b78a619) SHA1(a6eb6b6e544efa55225f2e947483614afb6ece3b) )
388
389   ROM_REGION( 0x60000, "gfx1", ROMREGION_DISPOSE )
390   ROM_LOAD( "6.u6",  0x00000, 0x20000, CRC(d2ed60a9) SHA1(40e2280384aa5c9e72e87a3b9e673172ff695676) )
391   ROM_LOAD( "5.u5",  0x20000, 0x20000, CRC(dc01fe7c) SHA1(683834ce2f13a923c0467209b93fef693d9c3e38) )
392   ROM_LOAD( "4.u4",  0x40000, 0x20000, CRC(38a42dcd) SHA1(8cc08ff4143281d9022210d6577146d725df9044) )
393
394   ROM_REGION( 0x30000, "gfx2", ROMREGION_DISPOSE )
395   ROM_LOAD( "3.u3",  0x00000, 0x4000, CRC(c69e962b) SHA1(492427ad1ac959cdf22d23439e0eb5932b60ec88) )
396   ROM_LOAD( "2.u2",  0x10000, 0x4000, CRC(8900ffba) SHA1(065cf1810ec9738718e4c94613f726e85ba4314d) )
397   ROM_LOAD( "1.u1",  0x20000, 0x4000, CRC(071d20f0) SHA1(77c87486803dccaa63732ff959c223b1313820e3) )
398
399   ROM_REGION( 0x10000, "gfx3", 0 )
400   ROM_LOAD( "jackie7sv.u22",   0x0000, 0x10000, CRC(8b4eb6da) SHA1(480784917dfaf9a0343c1d56eb590b32bf5e94fd) )
401
402   ROM_REGION( 0x10000, "misc", 0 )
403   ROM_LOAD( "16l8.u31",   0x0000, 0x104, BAD_DUMP CRC(e9cd78fb) SHA1(557d3e7ef3b25c1338b24722cac91bca788c02b8) )
404   ROM_LOAD( "18cv8.u14",  0x0000, 0x155, BAD_DUMP CRC(996e8f59) SHA1(630d9b91f6e8eda781061e2a8ff6fb0fecaf034c) )
405   ROM_LOAD( "18cv8.u8",   0x0000, 0x155, BAD_DUMP CRC(996e8f59) SHA1(630d9b91f6e8eda781061e2a8ff6fb0fecaf034c) )
406   ROM_LOAD( "18cv8.u9",   0x0000, 0x155, BAD_DUMP CRC(996e8f59) SHA1(630d9b91f6e8eda781061e2a8ff6fb0fecaf034c) )
407ROM_END
408
409static DRIVER_INIT( jackie )
410{
411
412   int A;
413   UINT8 *rom = memory_region(machine, "main");
414
415   for (A = 0;A < 0xf000;A++)
416   {
417      rom[A] = rom[A] ^ 0x21;
418
419      if (((A & 0x0080) == 0x0000) && ((A & 0x0008) == 0x0000)) rom[A] = rom[A] ^ 0x20;
420      if ((A & 0x0282) == 0x0282) rom[A] ^= 0x01;
421      if ((A & 0x0940) == 0x0940) rom[A] ^= 0x02;
422   }
423   memset( &rom[0xf000], 0, 0x1000);
424}
425
426GAME( 199?,  jackie,   0,        jackie,   jackie, jackie,  ROT0, "IGS",    "Happy Jackie (v110U)",       GAME_NOT_WORKING )
src/mame/drivers/esripsys.c
r4184r4185
1717        * Hold '*' during the game to access the operator menu.
1818
1919    To do:
20        * TMS5220 speech. The game is sending speech play commands to
21        the sound CPU but any speech code greater than 2 is ignored (see $EC26).
22        I think most of the speech data is stored in the upper half of the
23        banked sound data ROMs but I don't know how or when the ROM
24        bank is switched :/
25
2620        * Confirm that occasional line drop outs do occur on real hardware.
2721        14 sprites seems to be the maximum number that the RIP CPU can safely
2822        process per line.
r4184r4185
145139static WRITE8_HANDLER( g_status_w )
146140{
147141   int bankaddress;
148   UINT8* const ROM = memory_region(space->machine, "game_cpu");
142   UINT8 *rom = memory_region(space->machine, "game_cpu");
149143
150144   g_status = data;
151145
152146   bankaddress = 0x10000 + (data & 0x03) * 0x10000;
153   memory_set_bankptr(space->machine, 1, &ROM[bankaddress]);
147   memory_set_bankptr(space->machine, 1, &rom[bankaddress]);
154148
155149   cpu_set_input_line(space->machine->cpu[ESRIPSYS_FRAME_CPU], M6809_FIRQ_LINE, data & 0x10 ? CLEAR_LINE : ASSERT_LINE);
156150   cpu_set_input_line(space->machine->cpu[ESRIPSYS_FRAME_CPU], INPUT_LINE_NMI,  data & 0x80 ? CLEAR_LINE : ASSERT_LINE);
r4184r4185
528522
529523static WRITE8_HANDLER( s_200f_w )
530524{
525   UINT8 *rom = memory_region(space->machine, "sound_data");
526   int rombank = data & 0x20 ? 0x2000 : 0;
527
531528   /* Bit 6 -> Reset latch U56A */
532529   /* Bit 7 -> Clock latch U56B */
533530   if (s_to_g_latch2 & 0x40)
r4184r4185
539536   if (!(s_to_g_latch2 & 0x80) && (data & 0x80))
540537      u56b = 1;
541538
539   /* Speech data resides in the upper 8kB of the ROMs */
540   memory_set_bankptr(space->machine, 2, &rom[0x0000 + rombank]);
541   memory_set_bankptr(space->machine, 3, &rom[0x4000 + rombank]);
542   memory_set_bankptr(space->machine, 4, &rom[0x8000 + rombank]);
543
542544   s_to_g_latch2 = data;
543545}
544546
r4184r4185
554556      /* TMS5220 core returns status bits in D7-D6 */
555557      UINT8 status = tms5220_status_r(space, 0);
556558
557      status = (status & 0x80 >> 5) | (status & 0x40 >> 5) | (status & 0x20 >> 5);
559      status = ((status & 0x80) >> 5) | ((status & 0x40) >> 5) | ((status & 0x20) >> 5);
558560      return (!tms5220_ready_r() << 7) | (!tms5220_int_r() << 6) | status;
559561   }
560562
r4184r4185
566568{
567569   if (offset == 0)
568570   {
569      if (tms5220_ready_r())
570         tms5220_status_r(space, 0);
571
572571      tms_data = data;
572      tms5220_data_w(0, 0, tms_data);
573573   }
574#if 0
574575   if (offset == 1)
575576   {
576      if (tms5220_ready_r())
577         tms5220_data_w(0, 0, tms_data);
577      tms5220_data_w(0, 0, tms_data);
578578   }
579#endif
579580}
580581
581582/* Not used in later revisions */
r4184r4185
671672
672673static DRIVER_INIT( esripsys )
673674{
674   UINT8* const ROM = memory_region(machine, "sound_data");
675   UINT8 *rom = memory_region(machine, "sound_data");
675676
676677   fdt_a = auto_malloc(FDT_RAM_SIZE);
677678   fdt_b = auto_malloc(FDT_RAM_SIZE);
r4184r4185
679680
680681   ptm6840_config(machine, 0, &ptm_intf);
681682
682   memory_set_bankptr(machine, 2, &ROM[0x0000]);
683   memory_set_bankptr(machine, 3, &ROM[0x4000]);
684   memory_set_bankptr(machine, 4, &ROM[0x8000]);
683   memory_set_bankptr(machine, 2, &rom[0x0000]);
684   memory_set_bankptr(machine, 3, &rom[0x4000]);
685   memory_set_bankptr(machine, 4, &rom[0x8000]);
685686
686687   /* Register stuff for state saving */
687688   state_save_register_global_pointer(machine, fdt_a, FDT_RAM_SIZE);
r4184r4185
760761   /* Sound hardware */
761762   MDRV_SPEAKER_STANDARD_MONO("mono")
762763
763   MDRV_SOUND_ADD("tms5220nl", TMS5220, 640000)
764   MDRV_SOUND_ADD("dac", DAC, 0)
764765   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
765766
766   MDRV_SOUND_ADD("dac", DAC, 0)
767   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
767   MDRV_SOUND_ADD("tms5220nl", TMS5220, 640000)
768   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
768769MACHINE_DRIVER_END
769770
770771
r4184r4185
10131014 *
10141015 *************************************/
10151016
1016GAME( 1985, turbosub, 0,        esripsys, turbosub, esripsys, ROT0, "Entertainment Sciences", "Turbo Sub (prototype rev. TSCA)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND )
1017GAME( 1985, turbosba, turbosub, esripsys, turbosub, esripsys, ROT0, "Entertainment Sciences", "Turbo Sub (prototype rev. TSC6)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND )
1017GAME( 1985, turbosub, 0,        esripsys, turbosub, esripsys, ROT0, "Entertainment Sciences", "Turbo Sub (prototype rev. TSCA)", GAME_SUPPORTS_SAVE )
1018GAME( 1985, turbosba, turbosub, esripsys, turbosub, esripsys, ROT0, "Entertainment Sciences", "Turbo Sub (prototype rev. TSC6)", GAME_SUPPORTS_SAVE )
src/mame/drivers/zr107.c
r4184r4185
858858
859859/*****************************************************************************/
860860
861#define ROM_LOAD64_WORD(name,offset,length,hash)      ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6))
862
863861ROM_START(midnrun)
864862   ROM_REGION(0x200000, "user1", 0)   /* PowerPC program roms */
865863   ROM_LOAD32_BYTE("midnight.20u", 0x000003, 0x80000, CRC(ea70edf2) SHA1(51c882383a150ba118ccd39eb869525fcf5eee3c) )
src/mame/drivers/sothello.c
r0r4185
1/*
2 Super Othello (c)1986 Fujiwara/Success
3
4    driver by Tomasz Slanina
5
6         1    2    3    4     5     6     7      8      9     10     11    12
7+---------------------------------------------------------------------------------+
8|                                                                                 |
9+-+    LA460  LA6324  M5205  X3   Z80A    1      2    5816P  74374  74138         |  A
10  |                                                                               |
11  |                                                                               |
12+-+        74367 Y3014 74174 74174       7404   7474  74138  7404   7432          |  B
13|                                                                                 |
14|                                                                                 |
15|            74367 DSW1 YM2203    Z80A    3      4      5           6264          |  C
16| J                                                                               |
17| A                                                                               |
18| M   C1663 74367  DSW2           7408 74125   7404  74138   74139  74174  7408   |  D
19| M           X2       7414  7474                                                 |
20| A                                                                               |
21|     C1663 V9938 41464 41464       X1   7474  74139  7432   74157  74244  7432   |  E
22|                                                                                 |
23|                                                                                 |
24+-+   C1663       41464 41464     6809B   6     6264   6264  6264   74244  74245  |  F
25  |                                                                               |
26  |                                                                               |
27+-+   C1663                                                                       |  H
28|                                                                                 |
29+---------------------------------------------------------------------------------+
30
31CPU  : Z80A(x2) 68B09
32Sound: YM2203?(surface scrached) + M5205
33OSC  : 8.0000MHz(X1)   21.477 MHz(X2)   384kHz(X3)
34
35*/
36
37#include "driver.h"
38#include "cpu/z80/z80.h"
39#include "cpu/m6809/m6809.h"
40#include "sound/2203intf.h"
41#include "sound/msm5205.h"
42#include "video/v9938.h"
43#include "deprecat.h"
44
45#define VDP_MEM             0x40000
46
47#define MAINCPU_CLOCK       (XTAL_21_477MHz/6)
48#define SOUNDCPU_CLOCK      (XTAL_21_477MHz/6)
49#define YM_CLOCK            (XTAL_21_477MHz/12)
50#define MSM_CLOCK           (XTAL_384kHz)
51#define SUBCPU_CLOCK        (XTAL_8MHz/4)
52
53
54static int subcpu_status=0;
55static int soundcpu_busy=0;
56static int msm_data = 0;
57
58/* main Z80 */
59
60static WRITE8_HANDLER(bank_w)
61{
62    UINT8 *RAM = memory_region(space->machine, "main");
63    int bank=0;
64    switch(data^0xff)
65    {
66        case 1: bank=0; break;
67        case 2: bank=1; break;
68        case 4: bank=2; break;
69        case 8: bank=3; break;
70    }
71    memory_set_bankptr(space->machine,1,&RAM[bank*0x4000+0x10000]);
72}
73
74static TIMER_CALLBACK( subcpu_suspend )
75{
76    cpu_suspend(machine->cpu[2],SUSPEND_REASON_HALT,1);
77}
78
79static TIMER_CALLBACK( subcpu_resume )
80{
81    cpu_resume(machine->cpu[2],SUSPEND_REASON_HALT);
82    cpu_set_input_line(machine->cpu[2], INPUT_LINE_NMI, PULSE_LINE);
83}
84
85static READ8_HANDLER( subcpu_halt_set )
86{
87    timer_call_after_resynch(space->machine, NULL, 0, subcpu_suspend);
88    subcpu_status|=2;
89    return 0;
90}
91
92static READ8_HANDLER( subcpu_halt_clear )
93{
94    timer_call_after_resynch(space->machine,NULL, 0, subcpu_resume);
95    subcpu_status&=~1;
96    subcpu_status&=~2;
97    return 0;
98}
99
100static READ8_HANDLER(subcpu_comm_status )
101{
102    return subcpu_status;
103}
104
105static READ8_HANDLER( soundcpu_status_r )
106{
107    return soundcpu_busy;
108}
109
110static ADDRESS_MAP_START( maincpu_mem_map, ADDRESS_SPACE_PROGRAM, 8 )
111    AM_RANGE(0x0000, 0x7fff) AM_ROM
112    AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)
113    AM_RANGE(0xc000, 0xdfff) AM_RAM AM_MIRROR(0x1800) AM_SHARE(1)
114    AM_RANGE(0xe000, 0xffff) AM_RAM
115ADDRESS_MAP_END
116
117static ADDRESS_MAP_START( maincpu_io_map, ADDRESS_SPACE_IO, 8 )
118    ADDRESS_MAP_GLOBAL_MASK(0xff)
119    AM_RANGE( 0x00, 0x0f) AM_READ_PORT("INPUT1")
120    AM_RANGE( 0x10, 0x1f) AM_READ_PORT("INPUT2")
121    AM_RANGE( 0x20, 0x2f) AM_READ_PORT("SYSTEM")
122    AM_RANGE( 0x30, 0x30) AM_READ(subcpu_halt_set)
123    AM_RANGE( 0x31, 0x31) AM_READ(subcpu_halt_clear)
124    AM_RANGE( 0x32, 0x32) AM_READ(subcpu_comm_status)
125    AM_RANGE( 0x33, 0x33) AM_READ(soundcpu_status_r)
126    AM_RANGE( 0x40, 0x4f) AM_WRITE(soundlatch_w)
127    AM_RANGE( 0x50, 0x50) AM_WRITE(bank_w)
128    AM_RANGE( 0x60, 0x60) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w)
129    AM_RANGE( 0x61, 0x61) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w)
130    AM_RANGE( 0x62, 0x62) AM_READ(ym2203_status_port_0_r) /* not sure, but the A1 line is ignored, code @ $8b8 */
131    AM_RANGE( 0x70, 0x70) AM_WRITE( v9938_0_vram_w ) AM_READ( v9938_0_vram_r )
132    AM_RANGE( 0x71, 0x71) AM_WRITE( v9938_0_command_w ) AM_READ( v9938_0_status_r )
133    AM_RANGE( 0x72, 0x72) AM_WRITE( v9938_0_palette_w )
134    AM_RANGE( 0x73, 0x73) AM_WRITE( v9938_0_register_w )
135ADDRESS_MAP_END
136
137/* sound Z80 */
138
139static WRITE8_HANDLER(msm_cfg_w)
140{
141/*
142     bit 0 = RESET
143     bit 1 = 4B/3B 0
144     bit 2 = S2    1
145     bit 3 = S1    2
146*/
147    msm5205_playmode_w(0, BITSWAP8((data>>1), 7,6,5,4,3,0,1,2)); /* or maybe 7,6,5,4,3,0,2,1 ??? */
148    msm5205_reset_w(0,data&1);
149}
150
151static WRITE8_HANDLER( msm_data_w )
152{
153    msm_data = data;
154
155}
156
157static WRITE8_HANDLER(soundcpu_busyflag_set_w)
158{
159    soundcpu_busy=1;
160}
161
162static WRITE8_HANDLER(soundcpu_busyflag_reset_w)
163{
164    soundcpu_busy=0;
165}
166
167static WRITE8_HANDLER(soundcpu_int_clear_w)
168{
169    cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE );
170}
171
172static ADDRESS_MAP_START( soundcpu_mem_map, ADDRESS_SPACE_PROGRAM, 8 )
173    AM_RANGE(0x0000, 0xdfff) AM_ROM
174    AM_RANGE(0xf800, 0xffff) AM_RAM
175ADDRESS_MAP_END
176
177static ADDRESS_MAP_START( soundcpu_io_map, ADDRESS_SPACE_IO, 8 )
178    ADDRESS_MAP_GLOBAL_MASK(0xff)
179    AM_RANGE(0x00, 0x00) AM_READ(soundlatch_r)
180    AM_RANGE(0x01, 0x01) AM_WRITE(msm_data_w)
181    AM_RANGE(0x02, 0x02) AM_WRITE(msm_cfg_w)
182    AM_RANGE(0x03, 0x03) AM_WRITE(soundcpu_busyflag_set_w)
183    AM_RANGE(0x04, 0x04) AM_WRITE(soundcpu_busyflag_reset_w)
184    AM_RANGE(0x05, 0x05) AM_WRITE(soundcpu_int_clear_w)
185ADDRESS_MAP_END
186
187/* sub 6809 */
188
189static void unlock_shared_ram(const address_space *space)
190{
191    if(!cpu_is_suspended(space->machine->cpu[2], SUSPEND_REASON_HALT))
192    {
193        subcpu_status|=1;
194    }
195    else
196    {
197        logerror("Sub cpu active! @%x\n",cpu_get_pc(space->cpu));
198    }
199}
200
201static WRITE8_HANDLER(subcpu_status_w)
202{
203    unlock_shared_ram(space);
204}
205
206static READ8_HANDLER(subcpu_status_r)
207{
208    unlock_shared_ram(space);
209    return 0;
210}
211
212static ADDRESS_MAP_START( subcpu_mem_map, ADDRESS_SPACE_PROGRAM, 8 )
213    AM_RANGE(0x0000, 0x1fff) AM_READWRITE(subcpu_status_r,subcpu_status_w)
214    AM_RANGE(0x2000, 0x77ff) AM_RAM
215    AM_RANGE(0x7800, 0x7fff) AM_RAM AM_SHARE(1)  /* upper 0x800 of 6264 is shared  with main cpu */
216    AM_RANGE(0x8000, 0xffff) AM_ROM
217ADDRESS_MAP_END
218
219INPUT_PORTS_START( sothello )
220 PORT_START("INPUT1")
221  PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
222  PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
223  PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
224  PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
225
226  PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
227  PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
228  PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
229  PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
230
231 PORT_START("INPUT2")
232
233  PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
234  PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
235  PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
236  PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
237
238  PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
239  PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
240  PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
241  PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
242
243 PORT_START("SYSTEM")
244  PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
245  PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
246  PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
247
248  PORT_BIT( 0xf2, IP_ACTIVE_LOW, IPT_UNUSED )
249
250 PORT_START("DSWA")
251  PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coinage ) )
252  PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
253  PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
254  PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
255  PORT_DIPSETTING(    0x60, DEF_STR( 2C_1C ) )
256  PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
257  PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
258  PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
259  PORT_DIPSETTING(    0x80, DEF_STR( 1C_4C ) )
260
261  PORT_DIPNAME( 0x1c, 0x10, "Timer" )
262  PORT_DIPSETTING(    0x1c, "15" )
263  PORT_DIPSETTING(    0x18, "20" )
264  PORT_DIPSETTING(    0x14, "25" )
265  PORT_DIPSETTING(    0x10, "30" )
266  PORT_DIPSETTING(    0x0c, "35" )
267  PORT_DIPSETTING(    0x08, "40" )
268  PORT_DIPSETTING(    0x04, "45" )
269  PORT_DIPSETTING(    0x00, "50" )
270
271  PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
272
273 PORT_START("DSWB")
274  PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Difficulty ) )
275  PORT_DIPSETTING(    0xc0, DEF_STR( Easy ) )
276  PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
277  PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
278  PORT_DIPSETTING(    0x00, DEF_STR( Very_Hard ) )
279
280  PORT_DIPNAME( 0x30, 0x10, "Matta" ) /* undo moves */
281  PORT_DIPSETTING(    0x30, "0" )
282  PORT_DIPSETTING(    0x20, "1" )
283  PORT_DIPSETTING(    0x10, "2" )
284  PORT_DIPSETTING(    0x00, "3" )
285
286  PORT_DIPNAME( 0x08, 0x08, "Games for 2 players" )
287  PORT_DIPSETTING(    0x08, "1" )
288  PORT_DIPSETTING(    0x00, "2" )
289
290  PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_UNUSED )
291
292INPUT_PORTS_END
293
294static void irqhandler(running_machine *machine, int irq)
295{
296    cpu_set_input_line(machine->cpu[2],0,irq ? ASSERT_LINE : CLEAR_LINE);
297}
298
299static void sothello_vdp_interrupt(running_machine *machine, int i)
300{
301    cpu_set_input_line (machine->cpu[0], 0, (i ? HOLD_LINE : CLEAR_LINE));
302}
303
304static INTERRUPT_GEN( sothello_interrupt )
305{
306    v9938_interrupt(device->machine, 0);
307}
308
309static void adpcm_int(const device_config *device)
310{
311    /* only 4 bits are used */
312    msm5205_data_w( 0, msm_data & 0x0f );
313    cpu_set_input_line(device->machine->cpu[1], 0, ASSERT_LINE );
314}
315
316
317static msm5205_interface msm_interface =
318{
319    adpcm_int,      /* interrupt function */
320    MSM5205_S48_4B  /* changed on the fly */
321};
322
323VIDEO_START( sothello )
324{
325    VIDEO_START_CALL(generic_bitmapped);
326    v9938_init (machine, 0, machine->primary_screen, tmpbitmap, MODEL_V9938, VDP_MEM, sothello_vdp_interrupt);
327    v9938_reset(0);
328}
329
330static MACHINE_RESET(sothello)
331{
332    v9938_reset(0);
333}
334
335static const ym2203_interface ym2203_config =
336{
337    {
338        AY8910_LEGACY_OUTPUT,
339        AY8910_DEFAULT_LOADS,
340        input_port_3_r,     /* DSW-1 connected to port */
341        input_port_4_r,     /* DSW-2 connected to port  */
342        NULL,
343        NULL,
344    },
345    irqhandler
346};
347
348static MACHINE_DRIVER_START( sothello )
349
350    /* basic machine hardware */
351
352    MDRV_CPU_ADD("main",Z80, MAINCPU_CLOCK)
353    MDRV_CPU_PROGRAM_MAP(maincpu_mem_map,0)
354    MDRV_CPU_IO_MAP(maincpu_io_map,0)
355    MDRV_CPU_VBLANK_INT_HACK(sothello_interrupt,262)
356
357    MDRV_CPU_ADD("sound",Z80, SOUNDCPU_CLOCK)
358    MDRV_CPU_PROGRAM_MAP(soundcpu_mem_map,0)
359    MDRV_CPU_IO_MAP(soundcpu_io_map,0)
360
361    MDRV_CPU_ADD("sub",M6809, SUBCPU_CLOCK)
362    MDRV_CPU_PROGRAM_MAP(subcpu_mem_map,0)
363
364    MDRV_QUANTUM_TIME(HZ(600))
365
366    MDRV_MACHINE_RESET(sothello)
367
368    MDRV_SCREEN_ADD("main", RASTER)
369    MDRV_SCREEN_REFRESH_RATE(60)
370    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
371    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
372    MDRV_SCREEN_SIZE(512 + 32, (212 + 28) * 2)
373    MDRV_SCREEN_VISIBLE_AREA(0, 512 + 32 - 1, 0, (212 + 28) * 2 - 1)
374    MDRV_PALETTE_LENGTH(512)
375    MDRV_PALETTE_INIT( v9938 )
376    MDRV_VIDEO_START(sothello)
377    MDRV_VIDEO_UPDATE(generic_bitmapped)
378
379    /* sound hardware */
380    MDRV_SPEAKER_STANDARD_MONO("mono")
381    MDRV_SOUND_ADD("ym1", YM2203, YM_CLOCK)
382    MDRV_SOUND_CONFIG(ym2203_config)
383    MDRV_SOUND_ROUTE(0, "mono", 0.25)
384    MDRV_SOUND_ROUTE(1, "mono", 0.25)
385    MDRV_SOUND_ROUTE(2, "mono", 0.25)
386    MDRV_SOUND_ROUTE(3, "mono", 0.50)
387
388    MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
389
390    MDRV_SOUND_ADD("msm",MSM5205, MSM_CLOCK)
391    MDRV_SOUND_CONFIG(msm_interface)
392    MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
393
394MACHINE_DRIVER_END
395
396/***************************************************************************
397
398  Game driver(s)
399
400***************************************************************************/
401
402ROM_START( sothello )
403    ROM_REGION( 0x20000, "main", 0 )
404    ROM_LOAD( "3.7c",   0x0000, 0x8000, CRC(47f97bd4) SHA1(52c9638f098fdcf66903fad7dafe3ab171758572) )
405    ROM_LOAD( "4.8c",   0x10000, 0x8000, CRC(a98414e9) SHA1(6d14e1f9c79b95101e0aa101034f398af09d7f32) )
406    ROM_LOAD( "5.9c",   0x18000, 0x8000, CRC(e5b5d61e) SHA1(2e4b3d85f41d0796a4d61eae40dd824769e1db86) )
407
408    ROM_REGION( 0x10000, "sound", 0 )
409    ROM_LOAD( "1.7a",   0x0000, 0x8000, CRC(6951536a) SHA1(64d07a692d6a167334c825dc173630b02584fdf6) )
410    ROM_LOAD( "2.8a",   0x8000, 0x8000, CRC(9c535317) SHA1(b2e69b489e111d6f8105e68fade6e5abefb825f7) )
411
412    ROM_REGION( 0x10000, "sub", 0 )
413    ROM_LOAD( "6.7f",   0x8000, 0x8000, CRC(ee80fc78) SHA1(9a9d7925847d7a36930f0761c70f67a9affc5e7c) )
414ROM_END
415
416GAME( 1986, sothello,  0,       sothello,  sothello,  0, ROT0, "Success/Fujiwara", "Super Othello", 0 )
src/mame/drivers/micro3d.c
r4184r4185
1/*====================================================================*/
2/*                         'micro3d.c'                                */
3/*               Microprose 3D Hardware MAME driver                   */
4/*                     Philip J Bennett 2005                          */
5/*                                                                    */
6/* o F-15 Strike Eagle                                                */
7/* o B.O.T.S.S - Battle of the Solar System                           */
8/* o Super Tank Attack                                                */
9/*                                                                    */
10/* Current issues:                                                    */
11/* o No 3D/Am29000 emulation (communications code patched out)        */
12/* o Analogue controls not hooked up                                  */
13/* o Incomplete/crap/incorrect 68901 and 68681 emulation (eg. timers) */
14/* o Video emulation needs to be checked over                         */
15/* o No sound.                                                        */
16/*                                                                    */
17/* F15SE v2.2 was missing the math & sound boards, so those may need  */
18/* to be redumped!!!                                                  */
19/*                                                                    */
20/* It complains about bad object ROM checksums in the MFR test?       */
21/* BOTSS and STANKATK crash when entering TMS monitor mode ?          */
22/*====================================================================*/
1/***************************************************************************
232
3    Microprose Games 3D hardware
4
5    preliminary driver by Phil Bennett
6
7    Games supported:
8        * F-15 Strike Eagle [2 sets]
9        * B.O.T.S.S. - Battle of the Solar System
10        * Super Tank Attack (prototype)
11
12    TODO:
13        * Write Am29000 CPU core
14        * Implement 3D pipeline
15        * Borrow MC68901 implementation from MESS
16        * Controls
17        * Filtered noise sound sources
18        * Volume control
19        * NVRAM
20
21****************************************************************************/
22
2423#include "driver.h"
2524#include "cpu/m68000/m68000.h"
2625#include "cpu/tms34010/tms34010.h"
2726#include "cpu/mcs51/mcs51.h"
27#include "machine/68681.h"
2828#include "sound/2151intf.h"
2929#include "sound/upd7759.h"
30#include "sound/dac.h"
3130
32#define M68681_CLK 3686400
33#define M68901_CLK 4000000
34#define M68901_XTAL1 4000000
31
32/*************************************
33 *
34 *  Defines
35 *
36 *************************************/
37
38#define M68901_CLK      XTAL_4_MHz
39#define M68901_XTAL1   XTAL_4_MHz
3540#define TIMERA 250
3641#define TIMERB 250
3742#define TIMERC 250
3843#define TIMERD 250
3944#define DEBUG 1
4045
41/*====================================================================*/
42/* Each CPU (bar 80C31) communicates with a computer plugged into the */
43/* corresponding monitor port.                                        */
44/* Status information is reported, and tests can be performed.        */
45/*                                                                    */
46/* We print this useful stuff out to the text prompt.                 */
47/*====================================================================*/
48
4946#ifdef DEBUG
5047#define HOST_MONITOR_DISPLAY 1
5148#define VGB_MONITOR_DISPLAY 0
5249#define DRMATH_MONITOR_DISPLAY 0
5350#endif
5451
55static UINT16 *micro3d_sprite_vram;
56static UINT16 *m68681_base;
57static UINT16 *m68901_base;
58
59static struct {
60    UINT16 MR1A;
61    UINT16 MR2A;
62    UINT16 SRA;
63    UINT16 CSRA;
64    UINT16 CRA;
65    UINT16 RBA;
66    UINT16 TBA;
67    UINT16 IPCR;
68    UINT16 ACR;
69    UINT16 ISR;
70    UINT16 IMR;
71    UINT16 CUR;
72    UINT16 CTUR;
73    UINT16 CLR;
74    UINT16 CTLR;
75    UINT16 MR1B;
76    UINT16 MR2B;
77    UINT16 SRB;
78    UINT16 CSRB;
79    UINT16 CRB;
80    UINT16 RBB;
81    UINT16 TBB;
82    UINT16 IVR;
83    UINT16 IPORT;
84    UINT16 OPCR;
85    UINT16 OPR;
86
87    int MRA_ptr;
88    int MRB_ptr;
89} M68681;
90
91static UINT8 ti_uart[9];
92static int ti_uart_mode_cycle=0;
93static int ti_uart_sync_cycle=0;
94
95static void m68901_int_gen(running_machine *machine, int source);
96
97/* 68901 */
98enum{   TMRB=0,TXERR,TBE,RXERR,RBF,TMRA,GPIP6,GPIP7,     // A Registers
99       GPIP0,GPIP1,GPIP2,GPIP3,TMRD,TMRC,GPIP4,GPIP5    // B Registers
52/* 68901 (nuke me)*/
53enum
54{
55   TMRB=0, TXERR, TBE, RXERR, RBF, TMRA, GPIP6, GPIP7,     // A Registers
56   GPIP0, GPIP1, GPIP2, GPIP3, TMRD, TMRC, GPIP4, GPIP5    // B Registers
10057};
10158
10259/* TI UART */
103enum{   RX=0,TX,STATUS,SYN1,SYN2,DLE,MODE1,MODE2,COMMAND
60enum
61{
62   RX, TX, STATUS, SYN1, SYN2, DLE, MODE1, MODE2, COMMAND
10463};
10564
65/*************************************
66 *
67 *  Statics
68 *
69 *************************************/
10670
107/* Probably wrong and a bit crap */
108static int data_to_i8031(const device_config *device)
109{
110   mame_printf_debug("68k sent data: %x\n",M68681.TBB);
111    M68681.SRB |=0x0400;                   // Data has been sent - TX ready for more.
112    // Write to sound board
113    if(M68681.IMR & 0x1000)
114    {
115       cpu_set_input_line_and_vector(device->machine->cpu[0],3, HOLD_LINE, M68681.IVR);         // Generate an interrupt, if allowed.
116    }
117   return M68681.TBB;
118}
71static UINT16   creg;
72static UINT8   m68681_tx0;
73static UINT8   sound_port_latch[4];
11974
120static void data_from_i8031(const device_config *device, int data)
121{
122   M68681.RBB  = data<<8;                         // Put into receive buffer.
123   M68681.SRB |= 0x0100;                          // Set Receiver B ready.
124   if(M68681.IMR & 0x1000)
125   {
126      cpu_set_input_line_and_vector(device->machine->cpu[0],3, HOLD_LINE, M68681.IVR);    // Generate a receiver interrupt.
127      mame_printf_debug("INTERRUPT!!!\n");
128   }
129   mame_printf_debug("8031 sent data: %x\n",data);
130}
75static UINT16 *micro3d_sprite_vram;
76static UINT16 *m68901_base;
77static const device_config *duart68681;
13178
79static UINT8 ti_uart[9];
80static int ti_uart_mode_cycle=0;
81static int ti_uart_sync_cycle=0;
13282
133static void changecolor_BBBBBRRRRRGGGGGG(running_machine *machine,pen_t color,int data)
134{
135   palette_set_color_rgb(machine,color,pal5bit(data >> 6),pal5bit(data >> 1),pal5bit(data >> 11));
136}
83static void m68901_int_gen(running_machine *machine, int source);
13784
138static WRITE16_HANDLER( paletteram16_BBBBBRRRRRGGGGGG_word_w )
139{
140   COMBINE_DATA(&paletteram16[offset]);
141   changecolor_BBBBBRRRRRGGGGGG(space->machine,offset,paletteram16[offset]);
142}
14385
86/*************************************
87 *
88 *  Video Hardware
89 *
90 *************************************/
14491
14592static void micro3d_scanline_update(const device_config *screen, bitmap_t *bitmap, int scanline, const tms34010_display_params *params)
14693{
r4184r4185
14895   UINT16 *dest = BITMAP_ADDR16(bitmap, scanline, 0);
14996   int coladdr = params->coladdr;
15097   int x;
98   int sd_11_7 = (creg & 0x1f) << 7;
15199
152   /* copy the non-blanked portions of this scanline */
100   /* Copy the non-blanked portions of this scanline */
153101   for (x = params->heblnk; x < params->hsblnk; x += 2)
154102   {
155103      UINT16 pix = src[coladdr++ & 0x1ff];
156104
157105      if (pix & 0x80)
158         dest[x + 0] = (pix & 0x7f) + 0xf00;
106         dest[x + 0] = sd_11_7 | (pix & 0x7f);
159107      else
160108         dest[x + 0] = 0;   /* 3D data */
161109
162110      pix >>= 8;
111
163112      if (pix & 0x80)
164         dest[x + 1] = (pix & 0x7f) + 0xf00;
113         dest[x + 1] = sd_11_7 | (pix & 0x7f);
165114      else
166115         dest[x + 1] = 0;   /* 3D data */
167116   }
168117}
169118
170static MACHINE_RESET( micro3d )
119static WRITE16_HANDLER( paletteram_w )
171120{
172        i8051_set_serial_tx_callback(machine->cpu[2], data_from_i8031);
173        i8051_set_serial_rx_callback(machine->cpu[2], data_to_i8031);
174        ti_uart[STATUS]=1;
175        M68681.SRA=0x0500;
176        M68681.SRB=0x0500;
177}
121   UINT16 word;
178122
179static DRIVER_INIT( stankatk )
180{
181       UINT16 *rom = (UINT16 *)memory_region(machine, "main");
182       rom[0x1F543]=0x4E71;                                       /* 3ea86 - nop */
183       rom[0x1F546]=0x4E71;                                       /* 3ea8c - nop */
184       rom[0x1F596]=0x4E71;
185       rom[0x2182B]=0x6006;      /* Skip AM2k object download */
186       rom[0x21838]=0x4E71;
187       rom[0x1F692]=0x4e71;
188       rom[0x21CA8]=0x4e71;      /* Lie that trig table is intact */
189       rom[0x21C60]=0x4e71;      /* Lie that tree is intact */
190       rom[0x1F581]=0x4e71;
191       rom[0x21905]=0x4E71;
123   COMBINE_DATA(&paletteram16[offset]);
124   word = paletteram16[offset];
125   palette_set_color_rgb(space->machine, offset, pal5bit(word >> 6), pal5bit(word >> 1), pal5bit(word >> 11));
192126}
193127
194static DRIVER_INIT( botss )
128static WRITE16_HANDLER( creg_w )
195129{
196       UINT16 *rom = (UINT16 *)memory_region(machine, "main");
197       rom[0x1FCC0]=0x4E71;         /* Eliminate startup Am29000 timeout */
198       rom[0x1FBF0]=0x4E71;         /* Skip AM29k code version detect */
199       rom[0x1FC88]=0x4E71;
200       rom[0x23146]=0x4E71;
201       rom[0x17F4F]=0x6006;         /* Skip download objects */
202       rom[0x17F5B]=0x4E71;
203
130   // TODO: Clear interrupt?
131   // GSWOP?
132   creg = data;
204133}
205134
206static DRIVER_INIT( f15se )
135static void tms_interrupt(const device_config *device, int state)
207136{
208//       UINT16 *rom = (UINT16 *)memory_region(machine, "main");
137   m68901_int_gen(device->machine, GPIP4);
209138}
210139
211static DRIVER_INIT( f15se21 )
140static INTERRUPT_GEN( micro3d_vblank )
212141{
213#if 1
214       UINT16 *rom = (UINT16 *)memory_region(machine, "main");
215       rom[0x2A8B3]=0x6006;                          //055166: 6606                     bne     5516e -> bra
216       rom[0x2A8BF]=0x4E71;                          //05517E: 6704                     beq     55184 -> nop
217       rom[0x28AD1]=0x4E71;                          //0515A2: 67F8                     beq     5159c -> nop
218       rom[0x28A9E]=0x4E71;
219       rom[0x28ABD]=0x4E71;
220       rom[0x28C3B]=0x4E71;
221#endif
142   m68901_int_gen(device->machine, GPIP7);
222143}
223144
224static INPUT_PORTS_START( stankatk )
225   /* Ports A and B */
226   PORT_START("IN0")
227   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Unused ) )
228   PORT_DIPSETTING(   0x0001, DEF_STR(Off) )
229   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
230//  PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Unused ) )
231//  PORT_DIPSETTING(    0x0002, DEF_STR(Off) )
232//  PORT_DIPSETTING(    0x0000, DEF_STR(On) )
233145
234//  PORT_BITX(0x0002, IP_ACTIVE_LOW, 0, "????ht", KEYCODE_K, IP_JOY_NONE )
146/*************************************
147 *
148 *  68681 DUART Functions
149 *
150 *************************************/
235151
236   PORT_DIPNAME( 0x0004, 0x0000, "Shared Memory Handshake Test")
237   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
238   PORT_DIPSETTING(   0x0004, DEF_STR(On) )
239   PORT_DIPNAME( 0x0008, 0x0000, "Dr. Math Monitor Mode")
240   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
241   PORT_DIPSETTING(   0x0008, DEF_STR(On) )
242   PORT_DIPNAME( 0x0010, 0x0000, "Burn-in Tests")
243   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
244   PORT_DIPSETTING(   0x0010, DEF_STR(On))
245   PORT_DIPNAME( 0x0020, 0x0000, "Manufacturing Tests")
246   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
247   PORT_DIPSETTING(   0x0020, DEF_STR(On) )
248   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Unused ) )
249   PORT_DIPSETTING(   0x0040, DEF_STR(Off) )
250   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
251   PORT_DIPNAME( 0x0080, 0x0000, "Host Monitor Mode")
252   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
253   PORT_DIPSETTING(   0x0080, DEF_STR(On) )
152static void duart_irq_handler(const device_config *device, UINT8 vector)
153{
154   cpu_set_input_line_and_vector(device->machine->cpu[0], 3, HOLD_LINE, vector);
155};
254156
255//  PORT_BITX(0x0100, IP_ACTIVE_LOW, 0, "Blue Lower Right", KEYCODE_A, IP_JOY_NONE )
256//  PORT_BITX(0x0200, IP_ACTIVE_LOW, 0, "Blue Upper Left", KEYCODE_B, IP_JOY_NONE )
257//  PORT_BITX(0x0800, IP_ACTIVE_LOW, 0, "Blue Lower Left", KEYCODE_C, IP_JOY_NONE )
258//  PORT_BITX(0x1000, IP_ACTIVE_LOW, 0, "Yellow Upper Right", KEYCODE_E, IP_JOY_NONE )
259//  PORT_BITX(0x2000, IP_ACTIVE_LOW, 0, "Yellow Lower Right", KEYCODE_F, IP_JOY_NONE )
157static void duart_tx(const device_config *device, int channel, UINT8 data)
158{
159   if (channel == 0)
160   {
161      mame_printf_debug("%c", data);
162   }
163   else
164   {
165      m68681_tx0 = data;
166      cpu_set_input_line(device->machine->cpu[2], MCS51_RX_LINE, HOLD_LINE);
167   }
168};
260169
261//  PORT_BITX(0x000f, IP_ACTIVE_HIGH, 0, "Yeft", KEYCODE_K, IP_JOY_NONE )
262   PORT_SERVICE(0x0400, IP_ACTIVE_LOW)
170static int data_to_i8031(const device_config *device)
171{
172   return m68681_tx0;
173}
263174
175static void data_from_i8031(const device_config *device, int data)
176{
177   duart68681_rx_data(duart68681, 1, data);
178}
264179
265   /* C and D ports */
266   PORT_START("IN1")
267   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN2 )
268   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN1 )
269   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN3 )
270//  PORT_BITX( 0x0800, IP_ACTIVE_LOW, 0, "Unk2", KEYCODE_S, IP_JOY_NONE )
180/*
181 * 0: Monitor port P4
182 * 1: 5V
183 * 2: /AM29000 present
184 * 3: /TMS34010 present
185 * 4: -
186 * 5: -
187 */
188static UINT8 duart_input_r(const device_config *device)
189{
190   return 0x2;
191}
271192
272//  PORT_BITX( 0x0010, IP_ACTIVE_LOW, 0, "Yellow Upper Right", KEYCODE_Y, IP_JOY_NONE )
273//  PORT_BITX( 0x0020, IP_ACTIVE_LOW, 0, "Yellow Lower Right", KEYCODE_X, IP_JOY_NONE )
274//  PORT_BITX( 0x0040, IP_ACTIVE_LOW, 0, "Unk2", KEYCODE_R, IP_JOY_NONE )
275//  PORT_BITX( 0x0080, IP_ACTIVE_LOW, 0, "Unkn3", KEYCODE_T, IP_JOY_NONE )
193/*
194 * 5: /I8051 reset
195 * 7: Status LED
196*/
197static void duart_output_w(const device_config *device, UINT8 data)
198{
199   cpu_set_input_line(device->machine->cpu[2], INPUT_LINE_RESET, data & 0x20 ? CLEAR_LINE : ASSERT_LINE);
200}
276201
277//  PORT_BITX( 0x0001, IP_ACTIVE_HIGH, 0, "Blue Top Right", KEYCODE_Z, IP_JOY_NONE )  // ??
278//  PORT_BITX( 0x0002, IP_ACTIVE_HIGH, 0, "Blue Top Right", KEYCODE_Z, IP_JOY_NONE )
279//  PORT_BITX( 0x0004, IP_ACTIVE_LOW, 0, "Blue Top Right", KEYCODE_D, IP_JOY_NONE )
280//  PORT_BITX( 0x0008, IP_ACTIVE_HIGH, 0, "Blue Top Right", KEYCODE_Z, IP_JOY_NONE )
281202
282//  PORT_BITX( 0x1000, IP_ACTIVE_LOW, 0, "Unk2", KEYCODE_I,Y IP_JOY_NONE )
283//  PORT_BITX( 0x2000, IP_ACTIVE_LOW, 0, "Blue Trigger", KEYCODE_H, IP_JOY_NONE )
284//  PORT_BITX( 0x4000, IP_ACTIVE_LOW, 0, "Unkn3", KEYCODE_J, IP_JOY_NONE )
285//  PORT_BITX( 0x8000, IP_ACTIVE_LOW, 0, "Yellow Trigger", KEYCODE_G, IP_JOY_NONE )
203/*************************************
204 *
205 *  Port Definitions
206 *
207 *************************************/
286208
287
288   PORT_START("VGB")
289   PORT_DIPNAME( 0x0008, 0x0008, "VGB Monitor Mode")
290   PORT_DIPSETTING(   0x0008, DEF_STR(Off) )
291   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
292
293INPUT_PORTS_END
294
295static INPUT_PORTS_START( botss )
296   PORT_START("IN0")
209static INPUT_PORTS_START( f15se )
210   PORT_START("INPUTS_A_B")
297211   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Unused ) )
298   PORT_DIPSETTING(   0x0001, DEF_STR(Off) )
299   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
212   PORT_DIPSETTING(      0x0001, DEF_STR(Off) )
213   PORT_DIPSETTING(      0x0000, DEF_STR(On) )
300214   PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Unused ) )
301   PORT_DIPSETTING(   0x0002, DEF_STR(Off) )
302   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
215   PORT_DIPSETTING(      0x0002, DEF_STR(Off) )
216   PORT_DIPSETTING(      0x0000, DEF_STR(On) )
303217   PORT_DIPNAME( 0x0004, 0x0000, "Shared Memory Handshake Test")
304   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
305   PORT_DIPSETTING(   0x0004, DEF_STR(On) )
218   PORT_DIPSETTING(      0x0000, DEF_STR(Off) )
219   PORT_DIPSETTING(      0x0004, DEF_STR(On) )
306220   PORT_DIPNAME( 0x0008, 0x0000, "Dr. Math Monitor Mode")
307   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
308   PORT_DIPSETTING(   0x0008, DEF_STR(On) )
221   PORT_DIPSETTING(      0x0000, DEF_STR(Off) )
222   PORT_DIPSETTING(      0x0008, DEF_STR(On) )
309223   PORT_DIPNAME( 0x0010, 0x0000, "Burn-in Tests")
310   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
311   PORT_DIPSETTING(   0x0010, DEF_STR(On))
224   PORT_DIPSETTING(      0x0000, DEF_STR(Off) )
225   PORT_DIPSETTING(      0x0010, DEF_STR(On))
312226   PORT_DIPNAME( 0x0020, 0x0000, "Manufacturing Tests")
313   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
314   PORT_DIPSETTING(   0x0020, DEF_STR(On) )
227   PORT_DIPSETTING(      0x0000, DEF_STR(Off) )
228   PORT_DIPSETTING(      0x0020, DEF_STR(On) )
315229   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Unused ) )
316   PORT_DIPSETTING(   0x0040, DEF_STR(Off) )
317   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
230   PORT_DIPSETTING(      0x0040, DEF_STR(Off) )
231   PORT_DIPSETTING(      0x0000, DEF_STR(On) )
318232   PORT_DIPNAME( 0x0080, 0x0000, "Host Monitor Mode")
319   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
320   PORT_DIPSETTING(   0x0080, DEF_STR(On) )
321//  PORT_BITX(0x0100, IP_ACTIVE_LOW, IPT_START1, "Start", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
322//  PORT_BITX(0x0200, IP_ACTIVE_LOW, 0, "Shield", KEYCODE_A, IP_JOY_NONE )
323   PORT_SERVICE(0x0400, IP_ACTIVE_LOW)
324   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
325   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
326   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
327   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
233   PORT_DIPSETTING(      0x0000, DEF_STR(Off) )
234   PORT_DIPSETTING(      0x0080, DEF_STR(On) )
328235
329   /* C and D ports */
330   PORT_START("IN1")
331   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN2 )
332   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN1 )
333   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN3 )
334//  PORT_BITX(0x1000, IP_ACTIVE_LOW, 0, "Trigger", KEYCODE_B, IP_JOY_NONE )
335//  PORT_BITX(0x2000, IP_ACTIVE_LOW, 0, "Blaster", KEYCODE_C, IP_JOY_NONE )
336//  PORT_BITX(0x0002, IP_ACTIVE_LOW, 0, "Throttle Up", KEYCODE_D, IP_JOY_NONE )
337//  PORT_BITX(0x0008, IP_ACTIVE_LOW, 0, "Throttle Down", KEYCODE_F, IP_JOY_NONE )
236   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
237   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 )
238   PORT_SERVICE( 0x0400, IP_ACTIVE_LOW )
239   PORT_BIT( 0xf800, IP_ACTIVE_LOW, IPT_UNUSED ) // TODO
338240
339   PORT_START("VGB")
241   PORT_START("VGB_SW")
340242   PORT_DIPNAME( 0x0008, 0x0008, "VGB Monitor Mode")
341243   PORT_DIPSETTING(   0x0008, DEF_STR(Off) )
342244   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
343245
344INPUT_PORTS_END
246   PORT_START("SOUND_SW")
247   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Sound PCB Test SW") PORT_CODE(KEYCODE_F1)
345248
346
347static INPUT_PORTS_START( f15se )
348   PORT_START("IN0")
349   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Unused ) )
350   PORT_DIPSETTING(   0x0001, DEF_STR(Off) )
351   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
352   PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Unused ) )
353   PORT_DIPSETTING(   0x0002, DEF_STR(Off) )
354   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
355   PORT_DIPNAME( 0x0004, 0x0000, "Shared Memory Handshake Test")
356   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
357   PORT_DIPSETTING(   0x0004, DEF_STR(On) )
358   PORT_DIPNAME( 0x0008, 0x0000, "Dr. Math Monitor Mode")
359   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
360   PORT_DIPSETTING(   0x0008, DEF_STR(On) )
361   PORT_DIPNAME( 0x0010, 0x0000, "Burn-in Tests")
362   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
363   PORT_DIPSETTING(   0x0010, DEF_STR(On))
364   PORT_DIPNAME( 0x0020, 0x0000, "Manufacturing Tests")
365   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
366   PORT_DIPSETTING(   0x0020, DEF_STR(On) )
367   PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Unused ) )
368   PORT_DIPSETTING(   0x0040, DEF_STR(Off) )
369   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
370   PORT_DIPNAME( 0x0080, 0x0000, "Host Monitor Mode")
371   PORT_DIPSETTING(   0x0000, DEF_STR(Off) )
372   PORT_DIPSETTING(   0x0080, DEF_STR(On) )
373   PORT_BIT(0x0100, IP_ACTIVE_LOW, IPT_START1)
374   PORT_BIT(0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 )
375   PORT_SERVICE(0x0400, IP_ACTIVE_LOW)
376
377   /* C and D ports */
378   PORT_START("IN1")
379   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN1 )
249   PORT_START("INPUTS_C_D")
380250   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN2 )
251   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN1 )
381252   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN3 )
382253   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 )
383254   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 )
384255   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON4 )
385256
386   /* Analogue Inputs? */
257   /* Analog Inputs... */
258INPUT_PORTS_END
387259
388   PORT_START("VGB")
389   PORT_DIPNAME( 0x0008, 0x0008, "VGB Monitor Mode")
390   PORT_DIPSETTING(   0x0008, DEF_STR(Off) )
391   PORT_DIPSETTING(   0x0000, DEF_STR(On) )
260static INPUT_PORTS_START( botss )
261   PORT_INCLUDE(f15se)
262   PORT_MODIFY("INPUTS_A_B")
263   PORT_BIT(0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
264   PORT_BIT(0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
265   PORT_BIT(0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
266   PORT_BIT(0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
392267
393   /* Sound PCB test button */
394   PORT_START("SOUND")
395   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Sound PCB Test") PORT_CODE(KEYCODE_F1)
268   PORT_MODIFY("INPUTS_C_D")
269   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 )
270   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 )
271   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 )
272   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 )
396273INPUT_PORTS_END
397274
275static INPUT_PORTS_START( stankatk )
276   PORT_INCLUDE(f15se)
277   PORT_MODIFY("INPUTS_A_B")
278   PORT_BIT(0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 )
279   PORT_BIT(0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 )
280   PORT_BIT(0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 )
281   PORT_BIT(0x1000, IP_ACTIVE_LOW, IPT_BUTTON4 )
282   PORT_BIT(0x2000, IP_ACTIVE_LOW, IPT_BUTTON5 )
398283
399static void tms_interrupt(const device_config *device, int state)
400{
401   m68901_int_gen(device->machine, GPIP4);
402}
284   PORT_MODIFY("INPUTS_C_D")
285   PORT_BIT( 0xf8ff, IP_ACTIVE_HIGH, IPT_UNUSED )
286//  PORT_BITX( 0x0800, IP_ACTIVE_LOW, 0, "Unk2", KEYCODE_S, IP_JOY_NONE )
403287
404static INTERRUPT_GEN( micro3d_vblank )
405{
406   m68901_int_gen(device->machine, GPIP7);
407}
288//  PORT_BITX( 0x0010, IP_ACTIVE_LOW, 0, "Yellow Upper Right", KEYCODE_Y, IP_JOY_NONE )
289//  PORT_BITX( 0x0020, IP_ACTIVE_LOW, 0, "Yellow Lower Right", KEYCODE_X, IP_JOY_NONE )
290//  PORT_BITX( 0x0040, IP_ACTIVE_LOW, 0, "Unk2", KEYCODE_R, IP_JOY_NONE )
291//  PORT_BITX( 0x0080, IP_ACTIVE_LOW, 0, "Unkn3", KEYCODE_T, IP_JOY_NONE )
408292
293//  PORT_BITX( 0x0001, IP_ACTIVE_HIGH, 0, "Blue Top Right", KEYCODE_Z, IP_JOY_NONE )  // ??
294//  PORT_BITX( 0x0002, IP_ACTIVE_HIGH, 0, "Blue Top Right", KEYCODE_Z, IP_JOY_NONE )
295//  PORT_BITX( 0x0004, IP_ACTIVE_LOW, 0, "Blue Top Right", KEYCODE_D, IP_JOY_NONE )
296//  PORT_BITX( 0x0008, IP_ACTIVE_HIGH, 0, "Blue Top Right", KEYCODE_Z, IP_JOY_NONE )
409297
410/* 68901 related gubbins. Re-write me please */
298//  PORT_BITX( 0x1000, IP_ACTIVE_LOW, 0, "Unk2", KEYCODE_I,Y IP_JOY_NONE )
299//  PORT_BITX( 0x2000, IP_ACTIVE_LOW, 0, "Blue Trigger", KEYCODE_H, IP_JOY_NONE )
300//  PORT_BITX( 0x4000, IP_ACTIVE_LOW, 0, "Unkn3", KEYCODE_J, IP_JOY_NONE )
301//  PORT_BITX( 0x8000, IP_ACTIVE_LOW, 0, "Yellow Trigger", KEYCODE_G, IP_JOY_NONE )
302INPUT_PORTS_END
411303
412static TIMER_CALLBACK( timera_int )
413{
414//      timer_set(machine, attotime_mul(ATTOTIME_IN_HZ(M68901_CLK), ((m68901_base[0xf]>>8) & 0xff) * 200),0,timera_int);     // Set the timer again.
415        timer_set(machine, ATTOTIME_IN_USEC(1000), NULL,0,timera_int);     // Set the timer again.
416        m68901_int_gen(machine, TMRA);           // Fire an interrupt.
417}
418304
419#ifdef UNUSED_FUNCTION
420static TIMER_CALLBACK( timerb_int )
421{
422        timer_set(machine, attotime_mul(ATTOTIME_IN_HZ(M68901_CLK), ((m68901_base[0x10]>>8) & 0xff) * 200),0,timera_int);
423        m68901_int_gen(machine, TMRB);           // Fire an interrupt.
424}
305/*************************************
306 *
307 *  Worst 68901 Implementation Ever
308 *
309 *************************************/
425310
426static TIMER_CALLBACK( timerc_int )
311static TIMER_CALLBACK( timera_int )
427312{
428        timer_set(machine, attotime_mul(ATTOTIME_IN_HZ(M68901_CLK), ((m68901_base[0x11]>>8) & 0xff) * 200),0,timera_int);
429        m68901_int_gen(machine, TMRC);           // Fire an interrupt.
313   timer_set(machine, ATTOTIME_IN_USEC(1000), NULL,0,timera_int);
314   m68901_int_gen(machine, TMRA);
430315}
431#endif
432316
433317static TIMER_CALLBACK( timerd_int )
434318{
435        timer_set(machine, ATTOTIME_IN_USEC(250), NULL,0,timerd_int);
436        m68901_int_gen(machine, TMRD);           // Fire an interrupt.
319   timer_set(machine, ATTOTIME_IN_USEC(250), NULL,0,timerd_int);
320   m68901_int_gen(machine, TMRD);           // Fire an interrupt.
437321}
438322
439
440/* Called by anything that generates a MFD interrupt */
441/* Requires: MFD line number */
442
443323static void m68901_int_gen(running_machine *machine, int source)
444324{
445// logerror("M68901 interrupt %d requested.\n",source);
325   /* WTF is all this... */
326   int IEN_REG=3+(int)(source / 8);
327   int IPEND_REG=5+(int)(source / 8);       // Makes things a little clearer.
328   int IMASK_REG=9+(int)(source / 8);
329   int bit = 1 << (source - 8*(int)(source / 8));
446330
447int IEN_REG=3+(int)(source / 8);
448int IPEND_REG=5+(int)(source / 8);       // Makes things a little clearer.
449int IMASK_REG=9+(int)(source / 8);
450int bit=1 << (source-8*(int)(source/8));
331   if (m68901_base[IEN_REG] & (bit << 8))                // If interrupt is enabled by MFD, set interrupt pending bit.
332   {
333      m68901_base[IPEND_REG] = m68901_base[IPEND_REG] | (bit<<8);
334      //  logerror("M68901 interrupt %d now pending (%d) \n",source, IPEND_REG);
335   }
451336
452       if(m68901_base[IEN_REG] & (bit<<8))                // If interrupt is enabled by MFD, set interrupt pending bit.
453       {
454              m68901_base[IPEND_REG] = m68901_base[IPEND_REG] | (bit<<8);
455            //  logerror("M68901 interrupt %d now pending (%d) \n",source, IPEND_REG);
456       }
457
458       if(m68901_base[IMASK_REG] & (bit<<8))              // If interrupt is not masked by MFD, trigger a 68k INT
459       {
460                cpu_set_input_line(machine->cpu[0],4, HOLD_LINE);
461            //    logerror("M68901 interrupt %d serviced.\n",source);
462       }
337   if (m68901_base[IMASK_REG] & (bit << 8))              // If interrupt is not masked by MFD, trigger a 68k INT
338   {
339      cpu_set_input_line(machine->cpu[0], 4, HOLD_LINE);
340      //    logerror("M68901 interrupt %d serviced.\n",source);
341   }
463342}
464343
465344static WRITE16_HANDLER( m68901_w )
466345{
346//  UINT8 value = (data >> 8) & 0xff;
347   m68901_base[offset] = data;
467348
468UINT8 value = (data>>8)& 0xff;
469m68901_base[offset]=data;
349   switch (offset)
350   {
351      case 0x0c:
352      case 0x0d:
353      case 0x0e:
354         break;
470355
471switch(offset)
472{
356      case 0x0f:
357         /* Very dodgy */
358         timer_set(space->machine, ATTOTIME_IN_USEC(1000), NULL, 0, timera_int);
359         break;
473360
474        case 0x0c:    mame_printf_debug("Timer A Control: %x\n",value);
475                      break;
476        case 0x0d:    mame_printf_debug("Timer B Control: %x\n",value);
477                      break;
478        case 0x0e:    mame_printf_debug("Timer C/D Control: %x\n",value);
479                      break;
361      case 0x10:
362      case 0x11:
363         break;
480364
481        case 0x0f:    mame_printf_debug("Timer A Data:%4x\n",value);                                                       // Timer A Data Register
482                     timer_set(space->machine, ATTOTIME_IN_USEC(1000), NULL,0,timera_int);
483                      break;
484
485        case 0x10:    mame_printf_debug("Timer B Data:%4x\n",value);                                                           // Timer B Data Register
486//                    timer_set(space->machine, attotime_mul(ATTOTIME_IN_HZ(M68901_CLK), value * 200),0,timerb_int);
487                      break;
488
489        case 0x11:    mame_printf_debug("Timer C Data:%4x\n",value);                                                        // Timer C Data Register
490//                    timer_set(space->machine, attotime_mul(ATTOTIME_IN_HZ(M68901_CLK), value * 200),0,timerc_int);
491                      break;
492
493        case 0x12:    mame_printf_debug("Timer D Data:%4x\n",value);
494                      timer_set(space->machine, ATTOTIME_IN_USEC(500), NULL,0,timerd_int);                 // Timer D Data Register
495                      break;
496
365      case 0x12:
366         /* Aargh! */
367         timer_set(space->machine, ATTOTIME_IN_USEC(500), NULL, 0, timerd_int);
368         break;
369   }
497370}
498371
499}
500372
501/* I should really re-write all this. */
373/*************************************
374 *
375 *  SCN2651
376 *
377 *************************************/
502378
503static WRITE16_HANDLER( m68681_w )
504{
505
506UINT8 value = (data>>8)& 0xff;
507
508switch(offset)
509{
510      case 0x00:        break;                                // Mode Register A
511
512      case 0x01:        M68681.CSRA = value;
513                        break;
514                                                              // Clock-select register A
515      case 0x02:        M68681.CRA = value;
516                        break;                                // Command Register A
517
518      case 0x03:        M68681.TBA = value;                   // Fill transmit buffer
519                        M68681.SRA |=0x0400;                  // Data has been sent - TX ready for more.
520                        if(M68681.IMR & 1)   cpu_set_input_line_and_vector(space->machine->cpu[0],3, HOLD_LINE, M68681.IVR);         // Generate an interrupt, if allowed.
521
522#if HOST_MONITOR_DISPLAY
523                        mame_printf_debug("%c",value);                    // Port A - Monitor
524#endif
525                        break;
526
527      case 0x04:        break;
528
529      case 0x05:        //mame_printf_debug("IMR=%x\n",M68681.IMR);
530                        M68681.IMR = value;                    // Interrupt Mask Reg
531                        break;
532
533      case 0x06:        break;
534
535      case 0x07:        break;
536
537      case 0x08:        break;
538
539      case 0x09:        break;
540
541      case 0x0a:        break;
542
543      case 0x0b:        M68681.TBB = value;                   //  Fill transmit buffer
544#if 0
545                        M68681.SRB |=0x0400;                   // Data has been sent - TX ready for more.
546                        // Write to sound board
547                        if(M68681.IMR & 0x1000)
548                        {
549                           cpu_set_input_line_and_vector(space->machine->cpu[0],3, HOLD_LINE, M68681.IVR);         // Generate an interrupt, if allowed.
550                        }
551                        cpu_set_input_line(space->machine->cpu[2], MCS51_RX_LINE, ASSERT_LINE);                      // Generate 8031 interrupt
552                        mame_printf_debug("Sound board TX: %4X at PC=%4X\n",value,cpu_get_pc(space->cpu));
553#endif
554                        M68681.SRB &=~0x0400;                   // Data has been sent - TX ready for more.
555                        cpu_set_input_line(space->machine->cpu[2], MCS51_RX_LINE, ASSERT_LINE);                      // Generate 8031 interrupt
556                        mame_printf_debug("Sound board TX: %4X at PC=%4X\n",value,cpu_get_pc(space->cpu));
557                        break;
558
559      case 0x0c:        //mame_printf_debug("IVR: %d",value);
560                        M68681.IVR = value;                   // Interrupt vector register.
561                        break;
562
563      case 0x0d:        break;
564      case 0x0e:
565                        set_led_status(1, data&0x80);         // Host Health LED
566                        if(value & 0x20)
567                        {
568//                              cpunum_set_reset_line(2 CLEAR_LINE);
569                              logerror("8031 running at:%x (val=%x).\n",cpu_get_pc(space->cpu),value);
570                        }
571                        break;
572
573      case 0x0f:        set_led_status(1, ~(data&0x80));      // Host Health LED
574                        if(value & 0x20)
575                        {
576//                              cpunum_set_reset_line(2, ASSERT_LINE);
577                              logerror("8031 reset at:%x (val=%x).\n",cpu_get_pc(space->cpu),value);
578                        }
579                        break;
580
581      default:          m68681_base[offset]=data;
582}
583}
584
585static READ16_HANDLER( m68681_r )
586{
587
588switch(offset)
589{
590//      case 0x00:
591        case 0x01:     return M68681.SRA;                              // Status Register A
592//      case 0x02:     return
593
594        case 0x03:     M68681.SRA^=0x100;
595                       return M68681.RBA;                              // RX A - Monitor Port
596
597        case 0x09:     return M68681.SRB;                              // Status Register B
598
599        case 0x0b:     mame_printf_debug("\nHost received: %x\n",M68681.RBB);
600                    M68681.SRB^=0x0100;                             // No longer have data.
601                    //M68681.SRB &= ~0x0100;                             // No longer have data.
602                       return M68681.RBB;
603                                                                       // RX B - Monitor Port
604}
605
606return 0;
607}
608
609
610379static WRITE16_HANDLER( ti_uart_w )
611380{
612// Need to initalise values to 0 on reset.
613switch(offset)
614{
615        case 0x0: ti_uart[TX] = data;                  // Pointless really - nothing happens to it.
381   // Need to initalise values to 0 on reset.
382   switch (offset)
383   {
384      case 0x0:
385      {
386         ti_uart[TX] = data;
616387#if VGB_MONITOR_DISPLAY
617                  mame_printf_debug("%c",data);
618
388         mame_printf_debug("%c",data);
619389#endif
620                  ti_uart[STATUS]|=1;                  // Transmit regiser empty.
621                  break;
622
623        case 0x1: if(!ti_uart_mode_cycle)
624                  {
625                        ti_uart[MODE1] = data;
626                        ti_uart_mode_cycle=1;
627                  }
628                  else
629                  {
630                        ti_uart[MODE2] = data;
631                        ti_uart_mode_cycle=0;
632                  }
633                  break;
634
635        case 0x2: if(ti_uart_sync_cycle==0)
636                            {
637                                  ti_uart[SYN1] = data;
638                                  ti_uart_mode_cycle=1;
639                            }
640                            else if(ti_uart_sync_cycle==1)
641                            {
642                                  ti_uart[SYN2] = data;
643                                  ti_uart_mode_cycle=2;
644                            }
645                            else
646                            {
647                                 ti_uart[DLE] = data;
648                                 ti_uart_mode_cycle=0;
649                            }
650                            break;
651
652        case 0x3: ti_uart[COMMAND] = data;
653                  ti_uart_mode_cycle = ti_uart_sync_cycle=0;
654                  break;
390         ti_uart[STATUS] |= 1;
391         break;
392      }
393      case 0x1:
394      {
395         if (ti_uart_mode_cycle == 0)
396         {
397            ti_uart[MODE1] = data;
398            ti_uart_mode_cycle = 1;
399         }
400         else
401         {
402            ti_uart[MODE2] = data;
403            ti_uart_mode_cycle = 0;
404         }
405         break;
406      }
407      case 0x2:
408      {
409         if (ti_uart_sync_cycle == 0)
410         {
411            ti_uart[SYN1] = data;
412            ti_uart_mode_cycle = 1;
413         }
414         else if (ti_uart_sync_cycle == 1)
415         {
416            ti_uart[SYN2] = data;
417            ti_uart_mode_cycle = 2;
418         }
419         else
420         {
421            ti_uart[DLE] = data;
422            ti_uart_mode_cycle = 0;
423         }
424         break;
425      }
426      case 0x3:
427      {
428         ti_uart[COMMAND] = data;
429         ti_uart_mode_cycle = ti_uart_sync_cycle = 0;
430         break;
431      }
432   }
655433}
656434
657}
658
659
660435static READ16_HANDLER( ti_uart_r )
661436{
662
663switch(offset)
664{
665        case 0x0: ti_uart[STATUS]^=2;
666                  return ti_uart[RX];
667
668        case 0x1: if(!ti_uart_mode_cycle)
669                            {
670                                  ti_uart_mode_cycle=1;
671                                  return ti_uart[MODE1];
672                            }
673                            else
674                            {
675                                  ti_uart_mode_cycle=0;
676                                  return ti_uart[MODE2];
677                            }
678        case 0x2: return ti_uart[STATUS];
679
680        case 0x3: ti_uart_mode_cycle = ti_uart_sync_cycle=0;
681                  return ti_uart[COMMAND];
682
683        default:  logerror("Unknown TI UART access.\n");
684                  return 0;
437   switch (offset)
438   {
439      case 0x0:
440      {
441         ti_uart[STATUS] ^= 2;
442         return ti_uart[RX];
443      }
444      case 0x1:
445      {
446         if (ti_uart_mode_cycle == 0)
447         {
448            ti_uart_mode_cycle = 1;
449            return ti_uart[MODE1];
450         }
451         else
452         {
453            ti_uart_mode_cycle = 0;
454            return ti_uart[MODE2];
455         }
456      }
457      case 0x2:
458      {
459         return ti_uart[STATUS];
460      }
461      case 0x3:
462      {
463         ti_uart_mode_cycle = ti_uart_sync_cycle = 0;
464         return ti_uart[COMMAND];
465      }
466      default:
467      {
468         logerror("Unknown TI UART access.\n");
469         return 0;
470      }
471   }
685472}
686473
687}
688474
689#ifdef UNUSED_FUNCTION
690static WRITE32_HANDLER( am_uart_w )
475/*************************************
476 *
477 *  TMS34010 Host Interface
478 *
479 *************************************/
480
481static READ16_HANDLER( tms_host_r )
691482{
692       mame_printf_debug("%c",data);
483   return tms34010_host_r(space->machine->cpu[1], offset);
693484}
694485
695static READ32_HANDLER( am_uart_r )
486static WRITE16_HANDLER( tms_host_w )
696487{
697       return 0xff;
488   tms34010_host_w(space->machine->cpu[1], offset, data);
698489}
699490
700491
701static WRITE16_HANDLER( mystery_w )
702{
703       popmessage("Write to 900000: %x",data);
704}
492/*************************************
493 *
494 *  Sound
495 *
496 *************************************/
705497
706static WRITE16_HANDLER( mystery2_w )
707{
708       popmessage("TMS Write to e00000: %x",data);
709}
498/***************************************************************************
710499
711static WRITE16_HANDLER( mystery3_w )
712{
713       popmessage("TMS Write to 2600000: %x",data);
714}
715#endif
500    8031 port mappings:
716501
502    Port 1                          Port 2
503    =======                         ======
504    0: S/H sel A     (O)            0:
505    1: S/H sel B     (O)            1:
506    2: S/H sel C     (O)            2: uPD bank select (O)
507    3: S/H en        (O)            3: /uPD busy       (I)
508    4: DS1267 data   (O)            4: /uPD reset      (O)
509    5: DS1267 clock  (O)            5: Watchdog reset  (O)
510    6: /DS1267 reset (O)            6:
511    7: Test SW       (I)            7:
717512
718static READ16_HANDLER( tms_host_r )
513***************************************************************************/
514
515static WRITE8_HANDLER( sound_io_w )
719516{
720   return tms34010_host_r(space->machine->cpu[1], offset);
517   sound_port_latch[offset] = data;
518
519   switch (offset)
520   {
521      case 0x01:
522      {
523         break;
524      }
525      case 0x03:
526      {
527         upd7759_set_bank_base(0, (data & 0x4) ? 0x20000 : 0);
528         upd7759_0_reset_w(space, 0, (data & 0x10) ? 0 : 1);
529         break;
530      }
531   }
721532}
722533
723static WRITE16_HANDLER( tms_host_w )
534static READ8_HANDLER( sound_io_r )
724535{
725   tms34010_host_w(space->machine->cpu[1], offset, data);
536   switch (offset)
537   {
538      case 0x01:   return (sound_port_latch[offset] & 0x7f) | input_port_read_safe(space->machine, "SOUND_SW", 0);
539      case 0x03:   return (sound_port_latch[offset] & 0xf7) | (upd7759_0_busy_r(space, 0) ? 0x08 : 0);
540      default:   return 0;
541   }
726542}
727543
728#ifdef UNUSED_FUNCTION
729static WRITE16_HANDLER( reset_slave )
544static WRITE8_HANDLER( upd7759_port_start_w )
730545{
731        if(data & 0x0020)
732        {
733//          cpu_set_input_line(1, CLEAR_LINE);
734                logerror("TMS Running\n");
735   }
736   else
737   {
738//                cpu_set_input_line(1, ASSERT_LINE);
739           logerror("TMS Reset\n");
740        }
546   upd7759_0_port_w(space, offset, data);
547   upd7759_0_start_w(space, offset, 0);
548   upd7759_0_start_w(space, offset, 1);
741549}
742#endif
743550
744551
552/*************************************
553 *
554 *  Memory Maps
555 *
556 *************************************/
745557
746/* The DS1215 phantom timer IC is mapped to the lower 32kB SRAM address space */
747/* Serial Read/write operations are conducted via the 0th data bit */
748
749/* Reset peripherals flip-flop MIGHT be 900000 */
750
751558static ADDRESS_MAP_START( hostmem, ADDRESS_SPACE_PROGRAM, 16 )
752   AM_RANGE(0x000000, 0x13ffff) AM_ROM               /* 68000 Code ROM and Dr. Math object data */
559   AM_RANGE(0x000000, 0x13ffff) AM_ROM
753560   AM_RANGE(0x200000, 0x20ffff) AM_RAM               /* Battery-backed SRAM (64kB) & DS1215 */
754561   AM_RANGE(0x800000, 0x83ffff) AM_RAM               /* 68000/AM29000 shared RAM (256kB) */
755   AM_RANGE(0x900000, 0x900001) AM_NOP //WRITE(mystery_w)  /* ??????? 16-bit write here. rset? */
756   AM_RANGE(0x920000, 0x920001) AM_READ_PORT("IN1")   /* User inputs C and D */
757   AM_RANGE(0x940000, 0x940001) AM_READ_PORT("IN0")   /* User inputs A and B */
562   AM_RANGE(0x900000, 0x900001) AM_NOP               /* ??????? 16-bit write here. rset? */
563   AM_RANGE(0x920000, 0x920001) AM_READ_PORT("INPUTS_C_D")
564   AM_RANGE(0x940000, 0x940001) AM_READ_PORT("INPUTS_A_B")
758565   AM_RANGE(0x960000, 0x960001) AM_NOP               /* Lamps */
759566   AM_RANGE(0x980000, 0x980001) AM_RAM               /* ADC0844 */
760   AM_RANGE(0x9a0000, 0x9a0007) AM_READWRITE(tms_host_r, tms_host_w)   /* TMS34010 Interface */
761   AM_RANGE(0x9c0000, 0x9c0001) AM_RAM               /* ????? Write: 80, A0 and 00 (8-bit high byte) */
762   AM_RANGE(0x9e0000, 0x9e00cf) AM_RAM_WRITE(m68901_w) AM_BASE(&m68901_base)   /* 68901 Multifunction Peripheral */
763   AM_RANGE(0xa00000, 0xa000cf) AM_READWRITE(m68681_r, m68681_w) AM_BASE(&m68681_base)   /* 68681 UART */
567   AM_RANGE(0x9a0000, 0x9a0007) AM_READWRITE(tms_host_r, tms_host_w)
568   AM_RANGE(0x9c0000, 0x9c0001) AM_NOP               /* ????? Write: 80, A0 and 00 (8-bit high byte) */
569   AM_RANGE(0x9e0000, 0x9e00cf) AM_RAM_WRITE(m68901_w) AM_BASE(&m68901_base)
570   AM_RANGE(0xa00000, 0xa0003f) AM_DEVREADWRITE8(DUART68681, "duart68681", duart68681_r, duart68681_w, 0xff00)
764571   AM_RANGE(0xa20000, 0xa20001) AM_RAM               /* XY joystick input - sign? */
765572   AM_RANGE(0xa40002, 0xa40003) AM_RAM               /* XY joystick input - actual values */
766573ADDRESS_MAP_END
767574
768575
769// 2600000: Write 1E and 9E?
770576static ADDRESS_MAP_START( vgbmem, ADDRESS_SPACE_PROGRAM, 16 )
771   AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_BASE(&micro3d_sprite_vram)   /* 2 Banks */
772   AM_RANGE(0x00800000, 0x00bfffff) AM_RAM                     /* 512kB Main DRAM */
773   AM_RANGE(0x00c00000, 0x00c0000f) AM_READ_PORT("VGB")         /* TI Monitor Mode switch */
774   AM_RANGE(0x00e00000, 0x00e0000f) AM_RAM //WRITE(mystery2_w)     /* CREGCLK ??? byte write here. */
775   AM_RANGE(0x02000000, 0x0200ffff) AM_RAM_WRITE(paletteram16_BBBBBRRRRRGGGGGG_word_w) AM_BASE(&paletteram16) // AM_RANGE(0x02010000, 0x027fffff) AM_RAM       /* ??????????? Mirror of VRAM??? */
776   AM_RANGE(0x02600000, 0x0260000f) AM_RAM                     /* XFER3dk???? 16-bit write */
777   AM_RANGE(0x02c00000, 0x02c0003f) AM_READ(ti_uart_r)            /* SCN UART */
577   AM_RANGE(0x00000000, 0x007fffff) AM_RAM AM_BASE(&micro3d_sprite_vram)
578   AM_RANGE(0x00800000, 0x00bfffff) AM_RAM
579   AM_RANGE(0x00c00000, 0x00c0000f) AM_READ_PORT("VGB_SW")
580   AM_RANGE(0x00e00000, 0x00e0000f) AM_NOP            /* XFER3dk???? 16-bit write */
581   AM_RANGE(0x02000000, 0x0200ffff) AM_RAM_WRITE(paletteram_w) AM_BASE(&paletteram16)
582   AM_RANGE(0x02600000, 0x0260000f) AM_WRITE(creg_w)
583   AM_RANGE(0x02c00000, 0x02c0003f) AM_READ(ti_uart_r)
778584   AM_RANGE(0x02e00000, 0x02e0003f) AM_WRITE(ti_uart_w)
779   AM_RANGE(0x03800000, 0x03dfffff) AM_ROM AM_REGION("gfx1", 0)      /* 2D Graphics ROMs */
780   AM_RANGE(0x03e00000, 0x03ffffff) AM_ROM AM_REGION("user1", 0)      /* 128kB Program ROM */
585   AM_RANGE(0x03800000, 0x03dfffff) AM_ROM AM_REGION("tms_gfx", 0)
586   AM_RANGE(0x03e00000, 0x03ffffff) AM_ROM AM_REGION("tms34010", 0)
781587   AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE(tms34010_io_register_r, tms34010_io_register_w)
782   AM_RANGE(0xffe00000, 0xffffffff) AM_ROM AM_REGION("user1", 0)      /* 128kB Program ROM (Mirror - for interrupt vectors) */
588   AM_RANGE(0xffe00000, 0xffffffff) AM_ROM AM_REGION("tms34010", 0)
783589ADDRESS_MAP_END
784590
785591
786/*====================================================================*/
787/* The 8031 ports are mapped as follows:                              */
788/*                                                                    */
789/* P1.0 = SHMUX-A  O         P3.0                                     */
790/* P1.1 = SHMUX-B  O         P3.1                                     */
791/* P1.2 = SHMUX-C  O         P3.2 = SPCHBANK O                        */
792/* P1.3 = SHMUX-E  O         P3.3 = SP-BUSY- I                        */
793/* P1.4 = VOLDQ    O         P3.4 = RESET    O                        */
794/* P1.5 = VOLCK    O         P3.5 = WDO      O                        */
795/* P1.6 = VOLRST   O         P3.6                                     */
796/* P1.7 = SELFTEST I         P3.7                                     */
797/*====================================================================*/
798
799static UINT8 port_latch[4];
800static WRITE8_HANDLER(sound_io_w)
801{
802   port_latch[offset] = data;
803   switch(offset)
804   {
805        case 0x01:
806           break;
807        case 0x03:
808           upd7759_set_bank_base(0, (data & 0x4) ? 0x20000 : 0);
809           upd7759_0_reset_w(space,0,(data & 0x10) ? 0 : 1);
810   }
811}
812
813static READ8_HANDLER(sound_io_r)
814{
815   switch(offset)
816   {
817           case 0x01:  return (port_latch[offset] & 0x7f) | input_port_read_safe(space->machine, "SOUND", 0);      /* Test push switch */
818           case 0x03:  return (port_latch[offset] & 0xf7) | (upd7759_0_busy_r(space,0) ? 0x08 : 0);
819           default:    return 0;
820   }
821
822}
823
824static WRITE8_HANDLER( upd7759_port_start_w)
825{
826   upd7759_0_start_w(space, offset, 0);
827   upd7759_0_port_w(space, offset, data);
828   upd7759_0_start_w(space, offset, 1);
829}
830
831592static ADDRESS_MAP_START( soundmem_prg, ADDRESS_SPACE_PROGRAM, 8 )
832   AM_RANGE(0x0000, 0x7fff) AM_ROM                    // 32kB Code EPROM
593   AM_RANGE(0x0000, 0x7fff) AM_ROM
833594ADDRESS_MAP_END
834595
835
836/* FFXX - 00XX    */
837
838596static ADDRESS_MAP_START( soundmem_io, ADDRESS_SPACE_IO, 8 )
839   AM_RANGE(0x0000, 0x07ff) AM_RAM                                  /* 2Kb RAM */
597   AM_RANGE(0x0000, 0x07ff) AM_RAM
840598   AM_RANGE(0xfd00, 0xfd00) AM_WRITE(ym2151_register_port_0_w)
841599   AM_RANGE(0xfd01, 0xfd01) AM_READWRITE(ym2151_status_port_0_r,ym2151_data_port_0_w)
842600   AM_RANGE(0xfe00, 0xfe00) AM_WRITE(upd7759_port_start_w)
843   AM_RANGE(0xff00, 0xff00) AM_WRITE(dac_0_data_w)   /* DAC A - used for S&H, special effects? */
844   AM_RANGE(0xff01, 0xff01) AM_WRITE(dac_1_data_w)   /* DAC B - 'SPEECH' */
845   /* ports */
601   AM_RANGE(0xff00, 0xff00) AM_NOP      /* DAC A */
602   AM_RANGE(0xff01, 0xff01) AM_NOP      /* DAC B */
846603   AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(sound_io_r,sound_io_w)
847604ADDRESS_MAP_END
848605
849606
607/*************************************
608 *
609 *  Device Configuration
610 *
611 *************************************/
612
850613static const tms34010_config vgb_config =
851614{
852   FALSE,                     /* halt on reset ????? - check this */
615   FALSE,                     /* halt on reset */
853616   "main",                     /* the screen operated on */
854   40000000/8,                  /* pixel clock */
617   XTAL_40MHz / 8,               /* pixel clock */
855618   4,                        /* pixels per clock */
856619   micro3d_scanline_update,      /* scanline updater */
857620   tms_interrupt,               /* Generate interrupt */
r4184r4185
859622   NULL
860623};
861624
625static const duart68681_config micro3d_duart68681_config =
626{
627   duart_irq_handler,
628   duart_tx,
629   duart_input_r,
630   duart_output_w
631};
862632
633
634/*************************************
635 *
636 *  Machine drivers
637 *
638 *************************************/
639
640static MACHINE_RESET( micro3d )
641{
642   /* TODO: Check. Also do this for the other CPUs? */
643//  cpu_set_input_line(machine->cpu[2], INPUT_LINE_RESET, ASSERT_LINE);
644
645   creg = 0;
646   ti_uart[STATUS] = 1;
647}
648
863649static MACHINE_DRIVER_START( micro3d )
864   MDRV_CPU_ADD("main", M68000, 12000000 )
865   MDRV_CPU_PROGRAM_MAP(hostmem,0)
650   MDRV_CPU_ADD("main", M68000, XTAL_32MHz / 2)
651   MDRV_CPU_PROGRAM_MAP(hostmem, 0)
866652   MDRV_CPU_VBLANK_INT("main", micro3d_vblank)
867653
868    MDRV_CPU_ADD("vgb", TMS34010, 40000000)
654    MDRV_CPU_ADD("vgb", TMS34010, XTAL_40MHz)
869655   MDRV_CPU_CONFIG(vgb_config)
870   MDRV_CPU_PROGRAM_MAP(vgbmem,0)
656   MDRV_CPU_PROGRAM_MAP(vgbmem, 0)
871657
872   MDRV_CPU_ADD("audio", I8051, 11059000)
873   MDRV_CPU_PROGRAM_MAP(soundmem_prg,0)
874   MDRV_CPU_IO_MAP(soundmem_io,0)
658   MDRV_CPU_ADD("audio", I8051, XTAL_11_0592MHz)
659   MDRV_CPU_PROGRAM_MAP(soundmem_prg, 0)
660   MDRV_CPU_IO_MAP(soundmem_io, 0)
875661
662   MDRV_DUART68681_ADD("duart68681", XTAL_3_6864MHz, micro3d_duart68681_config)
663
876664   MDRV_MACHINE_RESET(micro3d)
877665   MDRV_QUANTUM_TIME(HZ(3000))
878666
879   MDRV_PALETTE_LENGTH(32768)
667   MDRV_PALETTE_LENGTH(4096)
880668
881669   MDRV_SCREEN_ADD("main", RASTER)
882670   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
883   MDRV_SCREEN_RAW_PARAMS(40000000/8*4, 192*4, 0, 144*4, 434, 0, 400)
671   MDRV_SCREEN_RAW_PARAMS(XTAL_40MHz/8*4, 192*4, 0, 144*4, 434, 0, 400)
884672
885673   MDRV_VIDEO_UPDATE(tms340x0)
886674
887675   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
888676
889   MDRV_SOUND_ADD("upd", UPD7759, UPD7759_STANDARD_CLOCK)
677   MDRV_SOUND_ADD("upd7759", UPD7759, XTAL_640kHz)
890678   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.50)
891679   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.50)
892680
893   MDRV_SOUND_ADD("ym", YM2151, 3579545)
681   MDRV_SOUND_ADD("ym2151", YM2151, XTAL_3_579545MHz)
894682   MDRV_SOUND_ROUTE(0, "left", 1.0)
895683   MDRV_SOUND_ROUTE(1, "right", 1.0)
684MACHINE_DRIVER_END
896685
897   MDRV_SOUND_ADD("dac1", DAC, 0)
898   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.0)   /* muted - I don't think it's directly used */
899686
900   MDRV_SOUND_ADD("dac2", DAC, 0)
901   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.15)
902   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.15)
903MACHINE_DRIVER_END
687/*************************************
688 *
689 *  Driver Initialisation
690 *
691 *************************************/
904692
693static DRIVER_INIT( micro3d )
694{
695   i8051_set_serial_tx_callback(machine->cpu[2], data_from_i8031);
696   i8051_set_serial_rx_callback(machine->cpu[2], data_to_i8031);
905697
906ROM_START( botss )
907   /* HOST PCB (MPG DW-00011C-0011-02) */
908   ROM_REGION( 0x140000, "main", 0 ) /* 68000 Code */
909   ROM_LOAD16_BYTE( "300hst.67", 0x000001, 0x20000, CRC(7f74362a) SHA1(41611ba8e6eb5d6b3dfe88e1cede7d9fb5472e40) ) // rev 1.1
910   ROM_LOAD16_BYTE( "301hst.91", 0x000000, 0x20000, CRC(a8100d1e) SHA1(69d3cac6f67563c0796560f7b874d7660720027d) ) // rev 1.1
911   ROM_LOAD16_BYTE( "302hst.68", 0x040001, 0x20000, CRC(af865ee4) SHA1(f00bce49401431bc749208399329d9f92457186b) ) // rev 1.1
912   ROM_LOAD16_BYTE( "303hst.92", 0x040000, 0x20000, CRC(15182619) SHA1(e95dcce11c0651c8e85fc0c658029f48eea35fb8) ) // rev 1.1
913   ROM_LOAD16_BYTE( "104hst.69", 0x080001, 0x20000, CRC(72a607ca) SHA1(1afc85380be12c429808c48f1502736a4c8b98e5) )
914   ROM_LOAD16_BYTE( "105hst.93", 0x080000, 0x20000, CRC(f37680ae) SHA1(51f1ee805b7d1b2b078c612c572e12846de623b9) )
915   ROM_LOAD16_BYTE( "106hst.70", 0x0c0001, 0x20000, CRC(57a1c728) SHA1(2bdc831be739ada0f4f4adec7974da453878db0e) )
916   ROM_LOAD16_BYTE( "107hst.94", 0x0c0000, 0x20000, CRC(4c9e16af) SHA1(1f8acc9bb85fe1bf459b4358b9bf9cf9847e6a36) )
917   ROM_LOAD16_BYTE( "108hst.71", 0x100001, 0x20000, CRC(cfc0333e) SHA1(9f290769129a61189870faef45c3f061eb7b5c07) )
918   ROM_LOAD16_BYTE( "109hst.95", 0x100000, 0x20000, CRC(6c595d1e) SHA1(89fdc30166ba1e9706798547195bdf6875a02e96) )
698   duart68681 = device_list_find_by_tag( machine->config->devicelist, DUART68681, "duart68681" );
699}
919700
920   /* DR MATH PCB (MPG 010-00003-003) */
921   ROM_REGION( 0x40000, "user2", 0 )
922   ROM_LOAD( "014dth.153", 0x000000, 0x20000, CRC(0eee0557) SHA1(8abe52cad31e59cf814fd9f64f4e42ddb4aa8c93) )
923   ROM_LOAD( "015dth.154", 0x020000, 0x20000, CRC(68564122) SHA1(410d2db74e574774b2eadd7fdf891feef5d8a93f) )
924   ROM_LOAD( "016dth.167", 0x000000, 0x20000, CRC(60c6cb26) SHA1(0e2bf65793715e12d8fd7f87fd3336a9d00ee7e6) )
925   ROM_LOAD( "017dth.160", 0x020000, 0x20000, CRC(d8b89379) SHA1(aa08e111c1505a4ad55b14659f8e21fd39cfcb16) )
926   ROM_LOAD( "118dth.135", 0x000000, 0x08000, CRC(2903e682) SHA1(027ed6524e9d4490632f10aeb22150c2fbc4eec2) )
927   ROM_LOAD( "119dth.115", 0x020000, 0x08000, CRC(9c9dbac1) SHA1(4c66971884190598e128684ece2e15a1c80b94ed) )
928   ROM_LOAD( "120dth.108", 0x000000, 0x08000, CRC(dafa173a) SHA1(a19980b92a5e74ebe395be36313701fdb527a46a) )
929   ROM_LOAD( "121dth.127", 0x020000, 0x08000, CRC(198a636b) SHA1(356b8948aafb98cb5e6ee7b5ad6ea9e5998265e5) )
930   ROM_LOAD( "122dth.134", 0x000000, 0x08000, CRC(bf60c487) SHA1(5ce80e89d9a24b627b0e97bf36a4e71c2eff4324) )
931   ROM_LOAD( "123dth.114", 0x020000, 0x08000, CRC(04ba6ed1) SHA1(012be71c6b955beda2bd0ff376dcaab51b226723) )
932   ROM_LOAD( "124dth.107", 0x000000, 0x08000, CRC(220db5d3) SHA1(3bfbe0eb97282c4ce449fd44e8e141de74f08eb0) )
933   ROM_LOAD( "125dth.126", 0x020000, 0x08000, CRC(b0dccf4a) SHA1(e8bfd622c006985b724cdbd3ad14c33e9ed27c6c) )
701static DRIVER_INIT( stankatk )
702{
703   UINT16 *rom = (UINT16 *)memory_region(machine, "main");
934704
935   ROM_REGION16_LE( 0x40000, "user1", 0 )
936   ROM_LOAD16_BYTE( "101vgb.101", 0x000000, 0x20000, CRC(6aada23d) SHA1(85dbf9b20e4f17cb21922637763654d6cae80dfd) )
937   ROM_LOAD16_BYTE( "104vgb.97",  0x000001, 0x20000, CRC(715cac9d) SHA1(2aa0c563dc1fe4d02fa1ecbaed16f720f899fdc4) )
705   rom[0x1f543] = 0x4e71;
706   rom[0x1f546] = 0x4e71;
707   rom[0x1f596] = 0x4e71;
708   rom[0x2182b] = 0x6006; /* Skip AM2k object download */
709   rom[0x21838] = 0x4e71;
710   rom[0x1f692] = 0x4e71;
711   rom[0x21ca8] = 0x4e71; /* Lie that trig table is intact */
712   rom[0x21c60] = 0x4e71; /* Lie that tree is intact */
713   rom[0x1f581] = 0x4e71;
714   rom[0x21905] = 0x4e71;
938715
939   /* VGB - Video Graphics PCB  (MPG DW-010-00002-002) */
940   ROM_REGION16_LE( 0xc0000, "gfx1", 0 )
941   ROM_LOAD16_BYTE( "105vgb.124", 0x000000, 0x20000, CRC(5482e0c4) SHA1(492afac1862f2899cd734d1e57ca978ed6a906d5) )
942   ROM_LOAD16_BYTE( "106vgb.121", 0x000001, 0x20000, CRC(a55e5d19) SHA1(86fbcb425103ae9fff381357339af349848fc3f2) )
716   DRIVER_INIT_CALL(micro3d);
717}
943718
944   ROM_LOAD16_BYTE( "107vgb.130", 0x040000, 0x20000, CRC(006487b6) SHA1(f8bc6abad13df099da1708bd22f239703e407b21) )
945   ROM_LOAD16_BYTE( "108vgb.133", 0x040001, 0x20000, CRC(e4587ba1) SHA1(1323b4be5a526ae182ee38e96fccd263a4cecc37) )
719static DRIVER_INIT( botss )
720{
721   UINT16 *rom = (UINT16 *)memory_region(machine, "main");
946722
947   ROM_LOAD16_BYTE( "103vgb.114", 0x080000, 0x20000, CRC(4e486e70) SHA1(04ee16cfadd43dbe9ed5bd8330c21a718d63a8f4) )
948   ROM_LOAD16_BYTE( "102vgb.108", 0x080001, 0x20000, CRC(441e8490) SHA1(6cfe30cea3fa297b71e881fbddad6d65a96e4386) )
723   rom[0x1fcc0] = 0x4e71; /* Eliminate startup Am29000 timeout */
724   rom[0x1fbf0] = 0x4e71; /* Skip AM29k code version detect */
725   rom[0x1fC88] = 0x4e71;
726   rom[0x23146] = 0x4e71;
727   rom[0x17f4f] = 0x6006; /* Skip download objects */
728   rom[0x17f5b] = 0x4e71;
949729
950   /*SND - Sound PCB           (MPG 010-00018-002) */
951   ROM_REGION( 0x10000, "audio", 0 )
952   ROM_LOAD( "14-001snd.2", 0x000000, 0x08000, CRC(307fcb6d) SHA1(0cf63a39ac8920be6532974311804529d7218545) )
730   DRIVER_INIT_CALL(micro3d);
731}
953732
954   ROM_REGION( 0x40000, "upd", 0 )
955   ROM_LOAD( "13-001snd.17", 0x000000, 0x40000, CRC(015a0b17) SHA1(f229c9aa59f0e6b25b818f9513997a8685e33982) )
956ROM_END
733static DRIVER_INIT( f15se )
734{
735   DRIVER_INIT_CALL(micro3d);
736}
957737
738static DRIVER_INIT( f15se21 )
739{
740   UINT16 *rom = (UINT16 *)memory_region(machine, "main");
958741
959ROM_START( stankatk )
960   ROM_REGION( 0x140000, "main", 0 ) /* 68000 Code */
961   ROM_LOAD16_BYTE( "lo_u67",    0x000001, 0x20000, CRC(97aabac0) SHA1(12a0719d3332a63e912161200b0a942c27c1f5da) )
962   ROM_LOAD16_BYTE( "le_u91",    0x000000, 0x20000, CRC(977f90d9) SHA1(530fa5c32b1f28e2b90d20d98cc453cb290c0ad2) )
963//  ROM_LOAD16_BYTE( "host.u67",  0x000001, 0x20000, CRC(e79d9548) SHA1(84a4c181be81fff7d5e61faa32f6929fce8b62d0) ) // alt (bad?) rom
964//  ROM_LOAD16_BYTE( "host.u91",  0x000000, 0x20000, CRC(ea19d0e1) SHA1(c11e8c6bff4746e3536fc19d3a40c89ab198059f) ) // alt (bad?) rom
965   ROM_LOAD16_BYTE( "ho_u68",    0x040001, 0x20000, CRC(8f76f4ac) SHA1(f6c1d4c933a373b153eee7d9f3016c985acaa281) )
966   ROM_LOAD16_BYTE( "he_u92",    0x040000, 0x20000, CRC(1ea1db7c) SHA1(ecaa1bd3d70489a5ba0d96c6935c2959f57467b2) )
967//  ROM_LOAD16_BYTE( "host.u92",  0x040000, 0x20000, CRC(220e5a39) SHA1(d9de87bc56182c8412c11bff9616164159ced9fb) ) // alt (bad?) rom
968   ROM_LOAD16_BYTE( "b00_o.u69", 0x080001, 0x20000, CRC(393718e5) SHA1(f956f8bd946f53a032af16011dc69f66fb3f095c) )
969   ROM_LOAD16_BYTE( "b00_e.u93", 0x080000, 0x20000, CRC(aedea0ef) SHA1(a81c3518c7a1e21f2fa2ad29c30346f727069257) )
970   ROM_LOAD16_BYTE( "b01_o.u70", 0x0c0001, 0x20000, CRC(e895167d) SHA1(677cbf1be32c1f0c76a0e1527db66eb037d7e9df) )
971   ROM_LOAD16_BYTE( "b01_e.u94", 0x0c0000, 0x20000, CRC(823bba4d) SHA1(6668e972b1435aac43f9b21cc40fc3adec0d285f) )
972   ROM_LOAD16_BYTE( "host.71",   0x100001, 0x20000, CRC(cfc0333e) SHA1(9f290769129a61189870faef45c3f061eb7b5c07) ) // same as botss
973   ROM_LOAD16_BYTE( "host.95",   0x100000, 0x20000, CRC(6c595d1e) SHA1(89fdc30166ba1e9706798547195bdf6875a02e96) ) // same as botss
742   rom[0x2a8b3] = 0x6006;
743   rom[0x2a8bf] = 0x4e71;
744   rom[0x28ad1] = 0x4e71;
745   rom[0x28a9e] = 0x4e71;
746   rom[0x28abd] = 0x4e71;
747   rom[0x28c3b] = 0x4e71;
974748
975   ROM_REGION( 0x40000, "user2", 0 )
976   ROM_LOAD( "pb0o_u.153", 0x000000, 0x20000, CRC(bcd7ddad) SHA1(3982756b6f0821df77918dd0d00807a90dbfb595) )
977   ROM_LOAD( "pb0e_u.154", 0x020000, 0x20000, CRC(d84e7c71) SHA1(2edb13c1f96f35c7934dad380e06035335ccbb48) )
978   ROM_LOAD( "pb1o_u.167", 0x000000, 0x20000, CRC(e4a65313) SHA1(f2df5cc87aa388d3273705562ab2d7c937a0a866) )
979   ROM_LOAD( "pb1e_u.160", 0x020000, 0x20000, CRC(9d9d1395) SHA1(9d937eac8d7e7bea40a69b596ba2c01753b97565) )
749   DRIVER_INIT_CALL(micro3d);
750}
980751
981   ROM_LOAD( "s24o_u.135", 0x000000, 0x08000, CRC(f89bab5f) SHA1(e79e71d0a5e7ba933952c5d41f6afb633da06e8a) )
982   ROM_LOAD( "s08o_u.115", 0x020000, 0x08000, CRC(af1eae4a) SHA1(44f272b472f546ffff7d8f82e29c5d80b472b1c3) )
983   ROM_LOAD( "s00o_u.108", 0x000000, 0x08000, CRC(9cadc977) SHA1(e95f60d9df422511bae6a6c4a20f813d77a894a4) )
984   ROM_LOAD( "s16o_u.127", 0x020000, 0x08000, CRC(53ba1a3f) SHA1(333734fff41b98abfa7b2904692cb128ab1f90a3) )
985   ROM_LOAD( "s24e_u.134", 0x000000, 0x08000, CRC(0a41756b) SHA1(8681aaf8eeda7acdff967a773290c4b2c17cbe30) )
986   ROM_LOAD( "s08e_u.114", 0x020000, 0x08000, CRC(765da5d7) SHA1(d489581bd12d7fca42570ee7a12d922be2528c1e) )
987   ROM_LOAD( "s00e_u.107", 0x000000, 0x08000, CRC(558918cc) SHA1(7e61639ab4af88f888f4aa481dd01db7de3829da) )
988   ROM_LOAD( "s16e_u.126", 0x020000, 0x08000, CRC(d24654cd) SHA1(88d3624f23c669dc902136c822b1f4732104c9c1) )
989752
990   ROM_REGION16_LE( 0x40000, "user1", 0 )
991   ROM_LOAD16_BYTE( "3el_u101", 0x000000, 0x20000, CRC(130e1a18) SHA1(c31af5c5a403da588142ccbea79d3aa253ac6519) )
992   ROM_LOAD16_BYTE( "3eh_u97",  0x000001, 0x20000, CRC(0fdcab16) SHA1(afc21747e1624f3ab87b289b5f4a498141062445) )
753/*************************************
754 *
755 *  ROM definitions
756 *
757 *************************************/
993758
994   ROM_REGION16_LE( 0xC0000, "gfx1", 0 )
995   ROM_LOAD16_BYTE( "38l_u124", 0x000000, 0x20000, CRC(4e084daa) SHA1(f65f51d8d7c6b46aa844b37b212dab11c786d856) )
996   ROM_LOAD16_BYTE( "38h_u121", 0x000001, 0x20000, CRC(3628c8c1) SHA1(760eda076ec46af5b954548036da5230a5c86371) )
759/* TODO: IC locations */
760/* NOTE: Dr. Math and sound PCB ROMs are not dumped and may be different to v2.1 */
761ROM_START( f15se )
762   /* Host PCB (MPG DW-00011C-0011-01) */
763   ROM_REGION( 0x140000, "main", 0 )
764   ROM_LOAD16_BYTE( "host.u67", 0x000001, 0x20000, CRC(8f495ceb) SHA1(90998ad67e76928ed1a6cae56038b98d1aa2e7b0) )
765   ROM_LOAD16_BYTE( "host.u91", 0x000000, 0x20000, CRC(dfae5ec3) SHA1(29306eed5047e39a0a2350e61ab7126a84cb710b) )
766   ROM_LOAD16_BYTE( "host.u68", 0x040001, 0x20000, CRC(685fc355) SHA1(5bfe015a8deccb66e3317154d715f490f00ace74) )
767   ROM_LOAD16_BYTE( "host.u92", 0x040000, 0x20000, CRC(8f7bb2eb) SHA1(1923d55d66da0fbc158b4f90bcc98c88955953ea) )
768   ROM_LOAD16_BYTE( "004.hst",  0x080001, 0x20000, CRC(81671ce1) SHA1(51ff641ccbc9dea640a62944910abe73d796b062) )
769   ROM_LOAD16_BYTE( "005.hst",  0x080000, 0x20000, CRC(bdaa7db5) SHA1(52cd832cdd44e609e8cd269469b806e2cd27d63d) )
770   ROM_LOAD16_BYTE( "host.u70", 0x0c0001, 0x20000, CRC(251e92d2) SHA1(a20279089af1f738ba912f90a4d048d4e58795fe) )
771   ROM_LOAD16_BYTE( "007.hst",  0x0c0000, 0x20000, CRC(36e06cba) SHA1(5ffee5da6f475978be10fa5e1a2c24f00497ea5f) )
772   ROM_LOAD16_BYTE( "008.hst",  0x100001, 0x20000, CRC(d96fd4e2) SHA1(001af758da437e955b4ee914eabeb9739ebc4454) )
773   ROM_LOAD16_BYTE( "009.hst",  0x100000, 0x20000, CRC(33e3b473) SHA1(66deda79ba94f0ed722b399b3fc6062dcdd1a6c9) )
997774
998   ROM_LOAD16_BYTE( "3al_u130", 0x040000, 0x20000, CRC(8a5386e3) SHA1(361f6abdb88cf51d5ec5ce6882986296dd274d3b) )
999   ROM_LOAD16_BYTE( "3ah_u133", 0x040001, 0x20000, CRC(7e674ac1) SHA1(81f1d87e62faf94a44aca7e41a32edf5c7c145ec) )
775   /* Dr Math PCB (MPG 010-00002-001) */
776   ROM_REGION32_LE( 0x80000, "am29000", 0 )
777   ROMX_LOAD( "124.dth", 0x00000, 0x08000, CRC(7be96646) SHA1(a6733f75c0404282d71e8c1a287546ef4d9d42ad), ROM_SKIP(7) )
778   ROMX_LOAD( "123.dth", 0x00001, 0x08000, CRC(54d5544f) SHA1(d039ee39991b947a7483111359ab245fc104e060), ROM_SKIP(7) )
779   ROMX_LOAD( "125.dth", 0x00002, 0x08000, CRC(7718487c) SHA1(609106f55601f84095b64ce2484107779da89149), ROM_SKIP(7) )
780   ROMX_LOAD( "122.dth", 0x00003, 0x08000, CRC(9d2032cf) SHA1(8430816756ea92bbe86b94eaa24a6071bf0ef879), ROM_SKIP(7) )
781   ROMX_LOAD( "120.dth", 0x00004, 0x08000, CRC(5fb9836d) SHA1(d511aa9f02972a7f475c82c6f57d1f3fd4f118fa), ROM_SKIP(7) )
782   ROMX_LOAD( "119.dth", 0x00005, 0x08000, CRC(b1c966e5) SHA1(9703bb1f9bdf6a779b59daebb39df2926727fa76), ROM_SKIP(7) )
783   ROMX_LOAD( "121.dth", 0x00006, 0x08000, CRC(392e5c43) SHA1(455cf3bb3c16217e58d6eea51d8f49a5bed1955e), ROM_SKIP(7) )
784   ROMX_LOAD( "118.dth", 0x00007, 0x08000, CRC(cc895c20) SHA1(140ef47536914fe1441778e759894c2cdd893276), ROM_SKIP(7) )
1000785
1001   ROM_LOAD16_BYTE( "3cl_u114", 0x080000, 0x20000, CRC(bc04b0e6) SHA1(d08fddd52f2c1a565a80f5d4ff8b07f1c5f01a01) )
1002   ROM_LOAD16_BYTE( "3ch_u108", 0x080001, 0x20000, CRC(7cb688af) SHA1(6be495ae0ed74739f62de65386810864c9ffaaee) )
786   ROM_REGION16_LE( 0x80000, "vertex", 0 )
787   ROM_LOAD16_BYTE( "014.dth", 0x00000, 0x20000, CRC(5ca7713f) SHA1(ac7b9629684b99ecfb1945176b06eb6be284ba93) )
788   ROM_LOAD16_BYTE( "015.dth", 0x00001, 0x20000, CRC(beae31bb) SHA1(1ab80a6b99eea6d5bf9b1bce58ecca13042c77a6) )
789   ROM_LOAD16_BYTE( "016.dth", 0x20000, 0x20000, CRC(5db4f677) SHA1(25a6fe4c562e4fa4225aa4687dd41920b614e591) )
790   ROM_LOAD16_BYTE( "017.dth", 0x20001, 0x20000, CRC(47f9a868) SHA1(7c8a9355893e4a3f3846fd05e0237ffd1404ffee) )
1003791
1004   ROM_REGION( 0x08000, "audio", 0 )
1005   ROM_LOAD( "sound.u2", 0x000000, 0x08000, CRC(77190a90) SHA1(a36a5a8457cc1c325e6318b083e5e271e163f7cb) )
792   /* Video Graphics PCB (MPG DW-010-00003-001) */
793   ROM_REGION16_LE( 0x40000, "tms34010", 0 )
794   ROM_LOAD16_BYTE( "vgb_u101.bin", 0x00000, 0x20000, CRC(e99fac71) SHA1(98d1d2134fabc1bad637cbe42cbe9cdc20b32126) )
795   ROM_LOAD16_BYTE( "vgb_u097.bin", 0x00001, 0x20000, CRC(78b9b7c7) SHA1(4bce993dd3aea126e3a9d42ee8c68b8ab47fdba7) )
1006796
1007   ROM_REGION( 0x40000, "upd", 0 )
1008   ROM_LOAD( "sound.u17", 0x000000, 0x40000, CRC(d033ef6c) SHA1(0404473c87b5b52e39ab3824b159a2d98159bbea) )
797   ROM_REGION16_LE( 0xc0000, "tms_gfx", 0 )
798   ROM_LOAD16_BYTE( "005.vgb", 0x00000, 0x20000, CRC(7b1852f0) SHA1(d21525e59b3112313ea9783ac3dd988a4c1d5f87) )
799   ROM_LOAD16_BYTE( "006.vgb", 0x00001, 0x20000, CRC(9d031636) SHA1(b7c7b57d547f2ce2eeb97126e961f3b5f35823f7) )
800   ROM_LOAD16_BYTE( "007.vgb", 0x40000, 0x20000, CRC(15326070) SHA1(ec4484d4515694742d3fd3b944f342f052463988) )
801   ROM_LOAD16_BYTE( "008.vgb", 0x40001, 0x20000, CRC(ca0e86d8) SHA1(a7b4b02d100a7875d5a184cdb76d507e926d1ca3) )
802   ROM_LOAD16_BYTE( "003.vgb", 0x80000, 0x20000, CRC(4d8e8f54) SHA1(d8a23b5fd00ab919dc6d63fc72824d1293073813) )
803   ROM_LOAD16_BYTE( "002.vgb", 0x80001, 0x20000, CRC(f6488e31) SHA1(d2f9304cc59f5523007592ae76ddd56107cc29e8) )
1009804
805   /* Sound PCB  (MPG 010-00018-002) */
806   ROM_REGION( 0x08000, "audio", 0 )
807   ROM_LOAD( "4-001.snd", 0x000000, 0x08000, CRC(705685a9) SHA1(311f7cac126a19e8bd555ebf31ff4ec4680ddfa4) )
808
809   ROM_REGION( 0x40000, "upd7759", 0 )
810   ROM_LOAD( "3-001.snd", 0x000000, 0x40000, CRC(af84b635) SHA1(844e5987a66e9e3ab2d2fe05b93a4da3512776bb) )
1010811ROM_END
1011812
1012ROM_START( f15se21 )   // rev 2.1 02/04/91
1013   /* HST - Host PCB            (MPG DW-00011C-0011-01)    */
1014   ROM_REGION( 0x140000, "main", 0 ) /* 68000 Code */
813ROM_START( f15se21 )
814   /* Host PCB (MPG DW-00011C-0011-01) */
815   ROM_REGION( 0x140000, "main", 0 )
1015816   ROM_LOAD16_BYTE( "500.hst", 0x000001, 0x20000, CRC(6c26806d) SHA1(7cfd2b3b92b0fc6627c92a2013a317ca5abc66a0) )
1016817   ROM_LOAD16_BYTE( "501.hst", 0x000000, 0x20000, CRC(81f02bf7) SHA1(09976746fe4d9c88bd8840f6e7addb09226aa54b) )
1017818   ROM_LOAD16_BYTE( "502.hst", 0x040001, 0x20000, CRC(1eb945e5) SHA1(aba3ff038f2ca0f1200be5710073825ce80e3656) )
1018819   ROM_LOAD16_BYTE( "503.hst", 0x040000, 0x20000, CRC(21fcb974) SHA1(56f78ce652e2bf432fbba8cda8c800f02dad84bb) )
1019
1020820   ROM_LOAD16_BYTE( "004.hst", 0x080001, 0x20000, CRC(81671ce1) SHA1(51ff641ccbc9dea640a62944910abe73d796b062) )
1021821   ROM_LOAD16_BYTE( "005.hst", 0x080000, 0x20000, CRC(bdaa7db5) SHA1(52cd832cdd44e609e8cd269469b806e2cd27d63d) )
1022822   ROM_LOAD16_BYTE( "006.hst", 0x0c0001, 0x20000, CRC(8eedef6d) SHA1(a1b5b53afc9ff092d86e7c7d4e357807fae3ad85) )
r4184r4185
1024824   ROM_LOAD16_BYTE( "008.hst", 0x100001, 0x20000, CRC(d96fd4e2) SHA1(001af758da437e955b4ee914eabeb9739ebc4454) )
1025825   ROM_LOAD16_BYTE( "009.hst", 0x100000, 0x20000, CRC(33e3b473) SHA1(66deda79ba94f0ed722b399b3fc6062dcdd1a6c9) )
1026826
1027   /* Video Graphics PCB  (MPG DW-010-00003-001) */
1028//  ROM_REGION( 0x40000, "vgb", 0 )         /* TMS34010 dummy region */
1029
1030   // TI ROM version 1.0a, 28-November-90
1031   ROM_REGION16_LE( 0x40000, "user1", 0 )
827   /* Video Graphics PCB (MPG DW-010-00003-001) */
828   ROM_REGION16_LE( 0x40000, "tms34010", 0 )
1032829   ROM_LOAD16_BYTE( "001.vgb", 0x000000, 0x20000, CRC(810c142d) SHA1(d37e5ecd716dda65d43cec7bca524c59d3dc9803) )
1033830   ROM_LOAD16_BYTE( "004.vgb", 0x000001, 0x20000, CRC(b69e1260) SHA1(1a2b69ea7c96b0293b24d87ea46bd4b1d4c56a66) )
1034831
1035   ROM_REGION16_LE( 0xC0000, "gfx1", 0 )
832   ROM_REGION16_LE( 0xC0000, "tms_gfx", 0 )
1036833   ROM_LOAD16_BYTE( "005.vgb", 0x000000, 0x20000, CRC(7b1852f0) SHA1(d21525e59b3112313ea9783ac3dd988a4c1d5f87) )
1037834   ROM_LOAD16_BYTE( "006.vgb", 0x000001, 0x20000, CRC(9d031636) SHA1(b7c7b57d547f2ce2eeb97126e961f3b5f35823f7) )
1038835   ROM_LOAD16_BYTE( "007.vgb", 0x040000, 0x20000, CRC(15326070) SHA1(ec4484d4515694742d3fd3b944f342f052463988) )
r4184r4185
1040837   ROM_LOAD16_BYTE( "003.vgb", 0x080000, 0x20000, CRC(4d8e8f54) SHA1(d8a23b5fd00ab919dc6d63fc72824d1293073813) )
1041838   ROM_LOAD16_BYTE( "002.vgb", 0x080001, 0x20000, CRC(f6488e31) SHA1(d2f9304cc59f5523007592ae76ddd56107cc29e8) )
1042839
1043   /*  DTH - Dr Math PCB         (MPG 010-00002-001) */
1044   ROM_REGION32_BE( 0x80000, "user2", 0 )
1045//  ROM_LOAD("drmath.rom", 0x00000, 0x40000, CRC(28dd9107) SHA1(3d571de81109e805cc0b133eefc3ea419e6a337b) )         // Cheat
840   /* Dr Math PCB (MPG 010-00002-001) */
841   ROM_REGION32_LE( 0x80000, "am29000", 0 )
842   ROMX_LOAD( "124.dth", 0x00000, 0x08000, CRC(7be96646) SHA1(a6733f75c0404282d71e8c1a287546ef4d9d42ad), ROM_SKIP(7) )
843   ROMX_LOAD( "123.dth", 0x00001, 0x08000, CRC(54d5544f) SHA1(d039ee39991b947a7483111359ab245fc104e060), ROM_SKIP(7) )
844   ROMX_LOAD( "125.dth", 0x00002, 0x08000, CRC(7718487c) SHA1(609106f55601f84095b64ce2484107779da89149), ROM_SKIP(7) )
845   ROMX_LOAD( "122.dth", 0x00003, 0x08000, CRC(9d2032cf) SHA1(8430816756ea92bbe86b94eaa24a6071bf0ef879), ROM_SKIP(7) )
846   ROMX_LOAD( "120.dth", 0x00004, 0x08000, CRC(5fb9836d) SHA1(d511aa9f02972a7f475c82c6f57d1f3fd4f118fa), ROM_SKIP(7) )
847   ROMX_LOAD( "119.dth", 0x00005, 0x08000, CRC(b1c966e5) SHA1(9703bb1f9bdf6a779b59daebb39df2926727fa76), ROM_SKIP(7) )
848   ROMX_LOAD( "121.dth", 0x00006, 0x08000, CRC(392e5c43) SHA1(455cf3bb3c16217e58d6eea51d8f49a5bed1955e), ROM_SKIP(7) )
849   ROMX_LOAD( "118.dth", 0x00007, 0x08000, CRC(cc895c20) SHA1(140ef47536914fe1441778e759894c2cdd893276), ROM_SKIP(7) )
1046850
1047   ROM_LOAD( "120.dth", 0x000000, 0x08000, CRC(5fb9836d) SHA1(d511aa9f02972a7f475c82c6f57d1f3fd4f118fa) )
1048   ROM_LOAD( "119.dth", 0x008000, 0x08000, CRC(b1c966e5) SHA1(9703bb1f9bdf6a779b59daebb39df2926727fa76) )
1049   ROM_LOAD( "121.dth", 0x000006, 0x08000, CRC(392e5c43) SHA1(455cf3bb3c16217e58d6eea51d8f49a5bed1955e) )
1050   ROM_LOAD( "118.dth", 0x000007, 0x08000, CRC(cc895c20) SHA1(140ef47536914fe1441778e759894c2cdd893276) )
1051   ROM_LOAD( "014.dth", 0x000000, 0x20000, CRC(5ca7713f) SHA1(ac7b9629684b99ecfb1945176b06eb6be284ba93) )
1052   ROM_LOAD( "015.dth", 0x000001, 0x20000, CRC(beae31bb) SHA1(1ab80a6b99eea6d5bf9b1bce58ecca13042c77a6) )
1053   ROM_LOAD( "016.dth", 0x000002, 0x20000, CRC(5db4f677) SHA1(25a6fe4c562e4fa4225aa4687dd41920b614e591) )
1054   ROM_LOAD( "017.dth", 0x000003, 0x20000, CRC(47f9a868) SHA1(7c8a9355893e4a3f3846fd05e0237ffd1404ffee) )
1055   ROM_LOAD( "122.dth", 0x000000, 0x08000, CRC(9d2032cf) SHA1(8430816756ea92bbe86b94eaa24a6071bf0ef879) )
1056   ROM_LOAD( "123.dth", 0x020000, 0x08000, CRC(54d5544f) SHA1(d039ee39991b947a7483111359ab245fc104e060) )
1057   ROM_LOAD( "124.dth", 0x000000, 0x08000, CRC(7be96646) SHA1(a6733f75c0404282d71e8c1a287546ef4d9d42ad) )
1058   ROM_LOAD( "125.dth", 0x020000, 0x08000, CRC(7718487c) SHA1(609106f55601f84095b64ce2484107779da89149) )
851   ROM_REGION16_LE( 0x80000, "vertex", 0 )
852   ROM_LOAD16_BYTE( "014.dth", 0x00000, 0x20000, CRC(5ca7713f) SHA1(ac7b9629684b99ecfb1945176b06eb6be284ba93) )
853   ROM_LOAD16_BYTE( "015.dth", 0x00001, 0x20000, CRC(beae31bb) SHA1(1ab80a6b99eea6d5bf9b1bce58ecca13042c77a6) )
854   ROM_LOAD16_BYTE( "016.dth", 0x20000, 0x20000, CRC(5db4f677) SHA1(25a6fe4c562e4fa4225aa4687dd41920b614e591) )
855   ROM_LOAD16_BYTE( "017.dth", 0x20001, 0x20000, CRC(47f9a868) SHA1(7c8a9355893e4a3f3846fd05e0237ffd1404ffee) )
1059856
1060
1061   /* SND - Sound PCB           (MPG 010-00018-002) */
857   /* Sound PCB (MPG 010-00018-002) */
1062858   ROM_REGION( 0x08000, "audio", 0 )
1063859   ROM_LOAD( "4-001.snd", 0x000000, 0x08000, CRC(705685a9) SHA1(311f7cac126a19e8bd555ebf31ff4ec4680ddfa4) )
1064860
1065   ROM_REGION( 0x40000, "upd", 0 )
861   ROM_REGION( 0x40000, "upd7759", 0 )
1066862   ROM_LOAD( "3-001.snd", 0x000000, 0x40000, CRC(af84b635) SHA1(844e5987a66e9e3ab2d2fe05b93a4da3512776bb) )
1067863ROM_END
1068864
1069ROM_START( f15se )   // rev 2.2 02/25/91
1070   /* HST - Host PCB            (MPG DW-00011C-0011-01)    */
1071   ROM_REGION( 0x140000, "main", 0 ) /* 68000 Code */
1072   ROM_LOAD16_BYTE( "host.u67", 0x000001, 0x20000, CRC(8f495ceb) SHA1(90998ad67e76928ed1a6cae56038b98d1aa2e7b0) )
1073   ROM_LOAD16_BYTE( "host.u91", 0x000000, 0x20000, CRC(dfae5ec3) SHA1(29306eed5047e39a0a2350e61ab7126a84cb710b) )
1074   ROM_LOAD16_BYTE( "host.u68", 0x040001, 0x20000, CRC(685fc355) SHA1(5bfe015a8deccb66e3317154d715f490f00ace74) )
1075   ROM_LOAD16_BYTE( "host.u92", 0x040000, 0x20000, CRC(8f7bb2eb) SHA1(1923d55d66da0fbc158b4f90bcc98c88955953ea) )
865ROM_START( botss )
866   /* Host PCB (MPG DW-00011C-0011-02) */
867   ROM_REGION( 0x140000, "main", 0 )
868   ROM_LOAD16_BYTE( "300hst.67", 0x000001, 0x20000, CRC(7f74362a) SHA1(41611ba8e6eb5d6b3dfe88e1cede7d9fb5472e40) )
869   ROM_LOAD16_BYTE( "301hst.91", 0x000000, 0x20000, CRC(a8100d1e) SHA1(69d3cac6f67563c0796560f7b874d7660720027d) )
870   ROM_LOAD16_BYTE( "302hst.68", 0x040001, 0x20000, CRC(af865ee4) SHA1(f00bce49401431bc749208399329d9f92457186b) )
871   ROM_LOAD16_BYTE( "303hst.92", 0x040000, 0x20000, CRC(15182619) SHA1(e95dcce11c0651c8e85fc0c658029f48eea35fb8) )
872   ROM_LOAD16_BYTE( "104hst.69", 0x080001, 0x20000, CRC(72a607ca) SHA1(1afc85380be12c429808c48f1502736a4c8b98e5) )
873   ROM_LOAD16_BYTE( "105hst.93", 0x080000, 0x20000, CRC(f37680ae) SHA1(51f1ee805b7d1b2b078c612c572e12846de623b9) )
874   ROM_LOAD16_BYTE( "106hst.70", 0x0c0001, 0x20000, CRC(57a1c728) SHA1(2bdc831be739ada0f4f4adec7974da453878db0e) )
875   ROM_LOAD16_BYTE( "107hst.94", 0x0c0000, 0x20000, CRC(4c9e16af) SHA1(1f8acc9bb85fe1bf459b4358b9bf9cf9847e6a36) )
876   ROM_LOAD16_BYTE( "108hst.71", 0x100001, 0x20000, CRC(cfc0333e) SHA1(9f290769129a61189870faef45c3f061eb7b5c07) )
877   ROM_LOAD16_BYTE( "109hst.95", 0x100000, 0x20000, CRC(6c595d1e) SHA1(89fdc30166ba1e9706798547195bdf6875a02e96) )
1076878
1077        ROM_LOAD16_BYTE( "004.hst", 0x080001, 0x20000, CRC(81671ce1) SHA1(51ff641ccbc9dea640a62944910abe73d796b062) )
1078   ROM_LOAD16_BYTE( "005.hst", 0x080000, 0x20000, CRC(bdaa7db5) SHA1(52cd832cdd44e609e8cd269469b806e2cd27d63d) )
1079   ROM_LOAD16_BYTE( "host.u70",0x0c0001, 0x20000, CRC(251e92d2) SHA1(a20279089af1f738ba912f90a4d048d4e58795fe)  )
1080   ROM_LOAD16_BYTE( "007.hst", 0x0c0000, 0x20000, CRC(36e06cba) SHA1(5ffee5da6f475978be10fa5e1a2c24f00497ea5f) )
1081   ROM_LOAD16_BYTE( "008.hst", 0x100001, 0x20000, CRC(d96fd4e2) SHA1(001af758da437e955b4ee914eabeb9739ebc4454) )
1082   ROM_LOAD16_BYTE( "009.hst", 0x100000, 0x20000, CRC(33e3b473) SHA1(66deda79ba94f0ed722b399b3fc6062dcdd1a6c9) )
879   /* Dr Math PCB (MPG 010-00002-001) */
880   ROM_REGION32_LE( 0x80000, "am29000", 0 )
881   ROMX_LOAD( "124dth.107", 0x000000, 0x08000, CRC(220db5d3) SHA1(3bfbe0eb97282c4ce449fd44e8e141de74f08eb0), ROM_SKIP(7) )
882   ROMX_LOAD( "123dth.114", 0x000001, 0x08000, CRC(04ba6ed1) SHA1(012be71c6b955beda2bd0ff376dcaab51b226723), ROM_SKIP(7) )
883   ROMX_LOAD( "125dth.126", 0x000002, 0x08000, CRC(b0dccf4a) SHA1(e8bfd622c006985b724cdbd3ad14c33e9ed27c6c), ROM_SKIP(7) )
884   ROMX_LOAD( "122dth.134", 0x000003, 0x08000, CRC(bf60c487) SHA1(5ce80e89d9a24b627b0e97bf36a4e71c2eff4324), ROM_SKIP(7) )
885   ROMX_LOAD( "120dth.108", 0x000004, 0x08000, CRC(dafa173a) SHA1(a19980b92a5e74ebe395be36313701fdb527a46a), ROM_SKIP(7) )
886   ROMX_LOAD( "119dth.115", 0x000005, 0x08000, CRC(9c9dbac1) SHA1(4c66971884190598e128684ece2e15a1c80b94ed), ROM_SKIP(7) )
887   ROMX_LOAD( "121dth.127", 0x000006, 0x08000, CRC(198a636b) SHA1(356b8948aafb98cb5e6ee7b5ad6ea9e5998265e5), ROM_SKIP(7) )
888   ROMX_LOAD( "118dth.135", 0x000007, 0x08000, CRC(2903e682) SHA1(027ed6524e9d4490632f10aeb22150c2fbc4eec2), ROM_SKIP(7) )
1083889
1084   /* Video Graphics PCB  (MPG DW-010-00003-001) */
1085//  ROM_REGION( 0x40000, "vgb", 0 )         /* TMS34010 dummy region */
890   ROM_REGION16_LE( 0x80000, "vertex", 0 )
891   ROM_LOAD16_BYTE( "014dth.153", 0x00000, 0x20000, CRC(0eee0557) SHA1(8abe52cad31e59cf814fd9f64f4e42ddb4aa8c93) )
892   ROM_LOAD16_BYTE( "015dth.154", 0x00001, 0x20000, CRC(68564122) SHA1(410d2db74e574774b2eadd7fdf891feef5d8a93f) )
893   ROM_LOAD16_BYTE( "016dth.167", 0x40000, 0x20000, CRC(60c6cb26) SHA1(0e2bf65793715e12d8fd7f87fd3336a9d00ee7e6) )
894   ROM_LOAD16_BYTE( "017dth.160", 0x40001, 0x20000, CRC(d8b89379) SHA1(aa08e111c1505a4ad55b14659f8e21fd39cfcb16) )
1086895
1087   // TI ROM version 1.0c, 28-November-90
1088   ROM_REGION16_LE( 0x40000, "user1", 0 )
1089   ROM_LOAD16_BYTE( "vgb_u101.bin", 0x000000, 0x20000, CRC(e99fac71) SHA1(98d1d2134fabc1bad637cbe42cbe9cdc20b32126) )
1090   ROM_LOAD16_BYTE( "vgb_u097.bin", 0x000001, 0x20000, CRC(78b9b7c7) SHA1(4bce993dd3aea126e3a9d42ee8c68b8ab47fdba7) )
896   ROM_REGION16_LE( 0x40000, "tms34010", 0 )
897   ROM_LOAD16_BYTE( "101vgb.101", 0x000000, 0x20000, CRC(6aada23d) SHA1(85dbf9b20e4f17cb21922637763654d6cae80dfd) )
898   ROM_LOAD16_BYTE( "104vgb.97",  0x000001, 0x20000, CRC(715cac9d) SHA1(2aa0c563dc1fe4d02fa1ecbaed16f720f899fdc4) )
1091899
1092   ROM_REGION16_LE( 0xC0000, "gfx1", 0 )
1093   ROM_LOAD16_BYTE( "005.vgb", 0x000000, 0x20000, CRC(7b1852f0) SHA1(d21525e59b3112313ea9783ac3dd988a4c1d5f87) )
1094   ROM_LOAD16_BYTE( "006.vgb", 0x000001, 0x20000, CRC(9d031636) SHA1(b7c7b57d547f2ce2eeb97126e961f3b5f35823f7) )
1095   ROM_LOAD16_BYTE( "007.vgb", 0x040000, 0x20000, CRC(15326070) SHA1(ec4484d4515694742d3fd3b944f342f052463988) )
1096   ROM_LOAD16_BYTE( "008.vgb", 0x040001, 0x20000, CRC(ca0e86d8) SHA1(a7b4b02d100a7875d5a184cdb76d507e926d1ca3) )
1097   ROM_LOAD16_BYTE( "003.vgb", 0x080000, 0x20000, CRC(4d8e8f54) SHA1(d8a23b5fd00ab919dc6d63fc72824d1293073813) )
1098   ROM_LOAD16_BYTE( "002.vgb", 0x080001, 0x20000, CRC(f6488e31) SHA1(d2f9304cc59f5523007592ae76ddd56107cc29e8) )
900   /* Video Graphics PCB (MPG DW-010-00002-002) */
901   ROM_REGION16_LE( 0xc0000, "tms_gfx", 0 )
902   ROM_LOAD16_BYTE( "105vgb.124", 0x000000, 0x20000, CRC(5482e0c4) SHA1(492afac1862f2899cd734d1e57ca978ed6a906d5) )
903   ROM_LOAD16_BYTE( "106vgb.121", 0x000001, 0x20000, CRC(a55e5d19) SHA1(86fbcb425103ae9fff381357339af349848fc3f2) )
904   ROM_LOAD16_BYTE( "107vgb.130", 0x040000, 0x20000, CRC(006487b6) SHA1(f8bc6abad13df099da1708bd22f239703e407b21) )
905   ROM_LOAD16_BYTE( "108vgb.133", 0x040001, 0x20000, CRC(e4587ba1) SHA1(1323b4be5a526ae182ee38e96fccd263a4cecc37) )
906   ROM_LOAD16_BYTE( "103vgb.114", 0x080000, 0x20000, CRC(4e486e70) SHA1(04ee16cfadd43dbe9ed5bd8330c21a718d63a8f4) )
907   ROM_LOAD16_BYTE( "102vgb.108", 0x080001, 0x20000, CRC(441e8490) SHA1(6cfe30cea3fa297b71e881fbddad6d65a96e4386) )
1099908
1100   /*  DTH - Dr Math PCB         (MPG 010-00002-001) */
1101   ROM_REGION32_BE( 0x80000, "user2", 0 )
1102//  ROM_LOAD("drmath.rom", 0x00000, 0x40000, CRC(28dd9107) SHA1(3d571de81109e805cc0b133eefc3ea419e6a337b) )         // Cheat
909   /* Sound PCB (MPG 010-00018-002) */
910   ROM_REGION( 0x10000, "audio", 0 )
911   ROM_LOAD( "14-001snd.2", 0x000000, 0x08000, CRC(307fcb6d) SHA1(0cf63a39ac8920be6532974311804529d7218545) )
1103912
1104   ROM_LOAD( "120.dth", 0x000000, 0x08000, CRC(5fb9836d) SHA1(d511aa9f02972a7f475c82c6f57d1f3fd4f118fa) )
1105   ROM_LOAD( "119.dth", 0x008000, 0x08000, CRC(b1c966e5) SHA1(9703bb1f9bdf6a779b59daebb39df2926727fa76) )
1106   ROM_LOAD( "121.dth", 0x000006, 0x08000, CRC(392e5c43) SHA1(455cf3bb3c16217e58d6eea51d8f49a5bed1955e) )
1107   ROM_LOAD( "118.dth", 0x000007, 0x08000, CRC(cc895c20) SHA1(140ef47536914fe1441778e759894c2cdd893276) )
1108   ROM_LOAD( "014.dth", 0x000000, 0x20000, CRC(5ca7713f) SHA1(ac7b9629684b99ecfb1945176b06eb6be284ba93) )
1109   ROM_LOAD( "015.dth", 0x000001, 0x20000, CRC(beae31bb) SHA1(1ab80a6b99eea6d5bf9b1bce58ecca13042c77a6) )
1110   ROM_LOAD( "016.dth", 0x000002, 0x20000, CRC(5db4f677) SHA1(25a6fe4c562e4fa4225aa4687dd41920b614e591) )
1111   ROM_LOAD( "017.dth", 0x000003, 0x20000, CRC(47f9a868) SHA1(7c8a9355893e4a3f3846fd05e0237ffd1404ffee) )
1112   ROM_LOAD( "122.dth", 0x000000, 0x08000, CRC(9d2032cf) SHA1(8430816756ea92bbe86b94eaa24a6071bf0ef879) )
1113   ROM_LOAD( "123.dth", 0x020000, 0x08000, CRC(54d5544f) SHA1(d039ee39991b947a7483111359ab245fc104e060) )
1114   ROM_LOAD( "124.dth", 0x000000, 0x08000, CRC(7be96646) SHA1(a6733f75c0404282d71e8c1a287546ef4d9d42ad) )
1115   ROM_LOAD( "125.dth", 0x020000, 0x08000, CRC(7718487c) SHA1(609106f55601f84095b64ce2484107779da89149) )
913   ROM_REGION( 0x40000, "upd7759", 0 )
914   ROM_LOAD( "13-001snd.17", 0x000000, 0x40000, CRC(015a0b17) SHA1(f229c9aa59f0e6b25b818f9513997a8685e33982) )
915ROM_END
1116916
917ROM_START( stankatk )
918   ROM_REGION( 0x140000, "main", 0 )
919   ROM_LOAD16_BYTE( "lo_u67",    0x000001, 0x20000, CRC(97aabac0) SHA1(12a0719d3332a63e912161200b0a942c27c1f5da) )
920   ROM_LOAD16_BYTE( "le_u91",    0x000000, 0x20000, CRC(977f90d9) SHA1(530fa5c32b1f28e2b90d20d98cc453cb290c0ad2) )
921//  ROM_LOAD16_BYTE( "host.u67",  0x000001, 0x20000, CRC(e79d9548) SHA1(84a4c181be81fff7d5e61faa32f6929fce8b62d0) ) // alt (bad?) rom
922//  ROM_LOAD16_BYTE( "host.u91",  0x000000, 0x20000, CRC(ea19d0e1) SHA1(c11e8c6bff4746e3536fc19d3a40c89ab198059f) ) // alt (bad?) rom
923   ROM_LOAD16_BYTE( "ho_u68",    0x040001, 0x20000, CRC(8f76f4ac) SHA1(f6c1d4c933a373b153eee7d9f3016c985acaa281) )
924   ROM_LOAD16_BYTE( "he_u92",    0x040000, 0x20000, CRC(1ea1db7c) SHA1(ecaa1bd3d70489a5ba0d96c6935c2959f57467b2) )
925//  ROM_LOAD16_BYTE( "host.u92",  0x040000, 0x20000, CRC(220e5a39) SHA1(d9de87bc56182c8412c11bff9616164159ced9fb) ) // alt (bad?) rom
926   ROM_LOAD16_BYTE( "b00_o.u69", 0x080001, 0x20000, CRC(393718e5) SHA1(f956f8bd946f53a032af16011dc69f66fb3f095c) )
927   ROM_LOAD16_BYTE( "b00_e.u93", 0x080000, 0x20000, CRC(aedea0ef) SHA1(a81c3518c7a1e21f2fa2ad29c30346f727069257) )
928   ROM_LOAD16_BYTE( "b01_o.u70", 0x0c0001, 0x20000, CRC(e895167d) SHA1(677cbf1be32c1f0c76a0e1527db66eb037d7e9df) )
929   ROM_LOAD16_BYTE( "b01_e.u94", 0x0c0000, 0x20000, CRC(823bba4d) SHA1(6668e972b1435aac43f9b21cc40fc3adec0d285f) )
930   ROM_LOAD16_BYTE( "host.71",   0x100001, 0x20000, CRC(cfc0333e) SHA1(9f290769129a61189870faef45c3f061eb7b5c07) ) // same as botss
931   ROM_LOAD16_BYTE( "host.95",   0x100000, 0x20000, CRC(6c595d1e) SHA1(89fdc30166ba1e9706798547195bdf6875a02e96) ) // same as botss
1117932
1118   /* SND - Sound PCB           (MPG 010-00018-002) */
933   ROM_REGION32_LE( 0x80000, "am29000", 0 )
934   ROMX_LOAD( "s00e_u.107", 0x00000, 0x08000, CRC(558918cc) SHA1(7e61639ab4af88f888f4aa481dd01db7de3829da), ROM_SKIP(7) )
935   ROMX_LOAD( "s08e_u.114", 0x00001, 0x08000, CRC(765da5d7) SHA1(d489581bd12d7fca42570ee7a12d922be2528c1e), ROM_SKIP(7) )
936   ROMX_LOAD( "s16e_u.126", 0x00002, 0x08000, CRC(d24654cd) SHA1(88d3624f23c669dc902136c822b1f4732104c9c1), ROM_SKIP(7) )
937   ROMX_LOAD( "s24e_u.134", 0x00003, 0x08000, CRC(0a41756b) SHA1(8681aaf8eeda7acdff967a773290c4b2c17cbe30), ROM_SKIP(7) )
938   ROMX_LOAD( "s00o_u.108", 0x00004, 0x08000, CRC(9cadc977) SHA1(e95f60d9df422511bae6a6c4a20f813d77a894a4), ROM_SKIP(7) )
939   ROMX_LOAD( "s08o_u.115", 0x00005, 0x08000, CRC(af1eae4a) SHA1(44f272b472f546ffff7d8f82e29c5d80b472b1c3), ROM_SKIP(7) )
940   ROMX_LOAD( "s16o_u.127", 0x00006, 0x08000, CRC(53ba1a3f) SHA1(333734fff41b98abfa7b2904692cb128ab1f90a3), ROM_SKIP(7) )
941   ROMX_LOAD( "s24o_u.135", 0x00007, 0x08000, CRC(f89bab5f) SHA1(e79e71d0a5e7ba933952c5d41f6afb633da06e8a), ROM_SKIP(7) )
942
943   ROM_REGION16_LE( 0x80000, "vertex", 0 )
944   ROM_LOAD16_BYTE( "pb0o_u.153", 0x00000, 0x20000, CRC(bcd7ddad) SHA1(3982756b6f0821df77918dd0d00807a90dbfb595) )
945   ROM_LOAD16_BYTE( "pb0e_u.154", 0x00001, 0x20000, CRC(d84e7c71) SHA1(2edb13c1f96f35c7934dad380e06035335ccbb48) )
946   ROM_LOAD16_BYTE( "pb1o_u.167", 0x40000, 0x20000, CRC(e4a65313) SHA1(f2df5cc87aa388d3273705562ab2d7c937a0a866) )
947   ROM_LOAD16_BYTE( "pb1e_u.160", 0x40001, 0x20000, CRC(9d9d1395) SHA1(9d937eac8d7e7bea40a69b596ba2c01753b97565) )
948
949   ROM_REGION16_LE( 0x40000, "tms34010", 0 )
950   ROM_LOAD16_BYTE( "3el_u101", 0x000000, 0x20000, CRC(130e1a18) SHA1(c31af5c5a403da588142ccbea79d3aa253ac6519) )
951   ROM_LOAD16_BYTE( "3eh_u97",  0x000001, 0x20000, CRC(0fdcab16) SHA1(afc21747e1624f3ab87b289b5f4a498141062445) )
952
953   ROM_REGION16_LE( 0xC0000, "tms_gfx", 0 )
954   ROM_LOAD16_BYTE( "38l_u124", 0x000000, 0x20000, CRC(4e084daa) SHA1(f65f51d8d7c6b46aa844b37b212dab11c786d856) )
955   ROM_LOAD16_BYTE( "38h_u121", 0x000001, 0x20000, CRC(3628c8c1) SHA1(760eda076ec46af5b954548036da5230a5c86371) )
956   ROM_LOAD16_BYTE( "3al_u130", 0x040000, 0x20000, CRC(8a5386e3) SHA1(361f6abdb88cf51d5ec5ce6882986296dd274d3b) )
957   ROM_LOAD16_BYTE( "3ah_u133", 0x040001, 0x20000, CRC(7e674ac1) SHA1(81f1d87e62faf94a44aca7e41a32edf5c7c145ec) )
958   ROM_LOAD16_BYTE( "3cl_u114", 0x080000, 0x20000, CRC(bc04b0e6) SHA1(d08fddd52f2c1a565a80f5d4ff8b07f1c5f01a01) )
959   ROM_LOAD16_BYTE( "3ch_u108", 0x080001, 0x20000, CRC(7cb688af) SHA1(6be495ae0ed74739f62de65386810864c9ffaaee) )
960
1119961   ROM_REGION( 0x08000, "audio", 0 )
1120   ROM_LOAD( "4-001.snd", 0x000000, 0x08000, CRC(705685a9) SHA1(311f7cac126a19e8bd555ebf31ff4ec4680ddfa4) )
962   ROM_LOAD( "sound.u2", 0x000000, 0x08000, CRC(77190a90) SHA1(a36a5a8457cc1c325e6318b083e5e271e163f7cb) )
1121963
1122   ROM_REGION( 0x40000, "upd", 0 )
1123   ROM_LOAD( "3-001.snd", 0x000000, 0x40000, CRC(af84b635) SHA1(844e5987a66e9e3ab2d2fe05b93a4da3512776bb) )
964   ROM_REGION( 0x40000, "upd7759", 0 )
965   ROM_LOAD( "sound.u17", 0x000000, 0x40000, CRC(d033ef6c) SHA1(0404473c87b5b52e39ab3824b159a2d98159bbea) )
1124966ROM_END
1125967
1126GAME( 1991, f15se,    0,     micro3d, f15se, f15se, ROT0, "Microprose", "F-15 Strike Eagle (rev. 2.2 02/25/91)", GAME_NOT_WORKING )
1127GAME( 1991, f15se21 , f15se, micro3d, f15se, f15se21, ROT0, "Microprose", "F-15 Strike Eagle (rev. 2.1 02/04/91)", GAME_NOT_WORKING )
1128GAME( 1992, botss,    0, micro3d, botss, botss, ROT0, "Microprose", "Battle of the Solar System (rev. 1.1)", GAME_NOT_WORKING )
1129GAME( 1992, stankatk, 0, micro3d, stankatk, stankatk, ROT0, "Microprose", "Super Tank Attack (prototype rev. 4/21/92 )", GAME_NOT_WORKING )
968
969/*************************************
970 *
971 *  Game drivers
972 *
973 *************************************/
974
975GAME( 1991, f15se,    0,     micro3d, f15se,    f15se,    ROT0, "Microprose Games Inc.", "F-15 Strike Eagle (rev. 2.2 02/25/91)",       GAME_NOT_WORKING )
976GAME( 1991, f15se21 , f15se, micro3d, f15se,    f15se21,  ROT0, "Microprose Games Inc.", "F-15 Strike Eagle (rev. 2.1 02/04/91)",       GAME_NOT_WORKING )
977GAME( 1992, botss,    0,     micro3d, botss,    botss,    ROT0, "Microprose Games Inc.", "Battle of the Solar System (rev. 1.1)",       GAME_NOT_WORKING )
978GAME( 1992, stankatk, 0,     micro3d, stankatk, stankatk, ROT0, "Microprose Games Inc.", "Super Tank Attack (prototype rev. 4/21/92 )", GAME_NOT_WORKING )
src/mame/drivers/mystwarr.c
r4184r4185
14311431
14321432/**********************************************************************************/
14331433
1434#define ROM_LOAD64_WORD(name,offset,length,crc)      ROMX_LOAD(name, offset, length, crc, ROM_GROUPWORD | ROM_SKIP(6))
1435
14361434#define ROM_LOADTILE_WORD(name,offset,length,crc) ROMX_LOAD(name, offset, length, crc, ROM_GROUPWORD | ROM_SKIP(3) | ROM_REVERSE)
14371435#define ROM_LOADTILE_BYTE(name,offset,length,crc) ROMX_LOAD(name, offset, length, crc, ROM_GROUPBYTE | ROM_SKIP(4))
14381436
src/mame/drivers/konamigx.c
r4184r4185
18661866   ROM_LOAD( "321b18.7g", 0x200000, 2*1024*1024, CRC(2c561ad0) SHA1(6265054072ba1c2837dd96e0259b20bc50457160) )
18671867ROM_END
18681868
1869/* Salamander 2 (ver JAA) */
1869/* Salamander 2 version JAA (Japan) */
18701870ROM_START( salmndr2 )
18711871   /* main program */
18721872   ROM_REGION( 0x800000, "main", 0 )
r4184r4185
18971897   ROM_LOAD( "521-a13.7g", 0x200000, 1*1024*1024, CRC(c3322475) SHA1(1774524ff031e0c4a7f3432810e968d37f9c6331) )
18981898ROM_END
18991899
1900/* Salamander 2 (ver AAB) */
1900/* Salamander 2 version AAB (Asia) */
19011901ROM_START( salmnd2a )
19021902   /* main program */
19031903   ROM_REGION( 0x800000, "main", 0 )
19041904   GX_BIOS
1905   ROM_LOAD32_WORD_SWAP( "521aab02.bin", 0x200002, 512*1024, CRC(ac9d151f) SHA1(aabd17a41a42cbbe9b62a9751cdb264e714cac6a) )
1906   ROM_LOAD32_WORD_SWAP( "521aab03.bin", 0x200000, 512*1024, CRC(feecf34d) SHA1(c37959199afedd3deee9d4c248ec83ccccf9a401) )
1905   ROM_LOAD32_WORD_SWAP( "521aab02.31b", 0x200002, 512*1024, CRC(ac9d151f) SHA1(aabd17a41a42cbbe9b62a9751cdb264e714cac6a) )
1906   ROM_LOAD32_WORD_SWAP( "521aab03.27b", 0x200000, 512*1024, CRC(feecf34d) SHA1(c37959199afedd3deee9d4c248ec83ccccf9a401) )
19071907
19081908   /* sound program */
19091909   ROM_REGION( 0x40000, "sound", 0 )
src/mame/drivers/stepstag.c
r4184r4185
99
1010#include "driver.h"
1111#include "cpu/m68000/m68000.h"
12#include "rendlay.h"
13#include "stepstag.lh"
1214
1315static READ16_HANDLER( unknown_read_0xc00000 )
1416{
r4184r4185
129131   MDRV_CPU_PROGRAM_MAP(stepstag_sub_readmem,stepstag_sub_writemem)
130132
131133   /* video hardware */
134   MDRV_SCREEN_ADD("left", RASTER)
135   MDRV_SCREEN_REFRESH_RATE(60)
136   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
137   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
138   MDRV_SCREEN_SIZE(64*8, 32*8)
139   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
140
132141   MDRV_SCREEN_ADD("main", RASTER)
133142   MDRV_SCREEN_REFRESH_RATE(60)
134143   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
r4184r4185
136145   MDRV_SCREEN_SIZE(64*8, 32*8)
137146   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
138147
148   MDRV_SCREEN_ADD("right", RASTER)
149   MDRV_SCREEN_REFRESH_RATE(60)
150   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
151   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
152   MDRV_SCREEN_SIZE(64*8, 32*8)
153   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
154
139155   MDRV_PALETTE_LENGTH(0x200)
140156   MDRV_GFXDECODE(stepstag)
157   MDRV_DEFAULT_LAYOUT(layout_stepstag)
141158
142159   MDRV_VIDEO_START(stepstag)
143160   MDRV_VIDEO_UPDATE(stepstag)
r4184r4185
178195   ROM_REGION( 0x400000, "gfx8", 0 ) /* */
179196   ROM_LOAD( "s.s.s._vj-98348_26_pr99021-01", 0x00000, 0x400000, CRC(fefb3777) SHA1(df624e105ab1dea52317e318ad29caa02b900788) )
180197   ROM_LOAD( "s.s.s._vj-98348_3_pr99021-01", 0x00000, 0x400000, CRC(e0fbc6f1) SHA1(7ca4507702f3f81bb9de3f9b5d270d379e439633) )
198
199   DISK_REGION( "disks" )
200   DISK_IMAGE("stepstag", 0, NO_DUMP)
181201ROM_END
182202
203ROM_START( step3 )
204ROM_REGION( 0x100000, "main", 0 ) /* 68k */
205   ROM_LOAD16_BYTE( "vj98344ver11.1", 0x00001, 0x80000, BAD_DUMP CRC(aedcb225) SHA1(f167c390e79ffbf7c019c326384ae656ae8b7d13) )
206   ROM_LOAD16_BYTE( "vj98344ver11.4", 0x00000, 0x80000, BAD_DUMP CRC(391ca913) SHA1(2cc329aa6419f8a0d7e0fb8a9f4c2b8ca25197b3) )
207   // c'est la programme de stepstag (avoir besoin de modifications, numero de chansons par example)
183208
209   ROM_REGION( 0x100000, "sub", 0 ) /* 68k */
210   ROM_LOAD16_BYTE( "vj98348_step3_11_v1.1", 0x00000, 0x80000, CRC(9c36aef5) SHA1(bbac48c2c7949a6f8a6ec83515e94a343c88d1b6) )
211   ROM_LOAD16_BYTE( "vj98348_step3_14_v1.1", 0x00001, 0x80000, CRC(b86be557) SHA1(49dbd6ef1c50adcf3386d5423da8ae7685649c46) )
212
213   ROM_REGION( 0x1000000, "gfx1", 0 ) /* */
214   ROM_LOAD( "mr9930-01.ic2", 0x000000, 0x400000, CRC(9e3e054e) SHA1(06a4fa76cb83dbe9d565d5ccd0a5ecc5067887c9) )
215
216   ROM_REGION( 0x1000000, "gfx2", 0 ) /* */
217   ROM_LOAD( "mr9930-02.ic3", 0x000000, 0x400000, CRC(b23c29f4) SHA1(a7b10a3a9af43db319baf8633bb3728120960923) )
218
219   ROM_REGION( 0x1000000, "gfx3", 0 ) /* */
220   ROM_LOAD( "mr9930-03.ic4", 0x000000, 0x400000, CRC(9a5d070f) SHA1(b4668b4f299033140a2c56499cc2712ba111cb57) )
221
222   ROM_REGION( 0x1000000, "gfx4", 0 ) /* screen centre */
223   ROM_LOAD( "mr99030-04.ic17", 0x000000, 0x400000, CRC(3eac3591) SHA1(3b294e94af23fd92fdf51d2c9c43f60d2ebd1688) )
224
225   ROM_REGION( 0x1000000, "gfx5", 0 ) /* */
226   ROM_LOAD( "mr99030-05.ic18", 0x000000, 0x400000, CRC(dea7b8d6) SHA1(d7d98675eb3998a8057929f90aa340c1e5f6a617) )
227
228   ROM_REGION( 0x1000000, "gfx6", 0 ) /* */
229   ROM_LOAD( "mr99030-06.ic19", 0x000000, 0x400000, CRC(71489d79) SHA1(0398a354c2588e3974cb76a331e46165db6af06d) )
230
231   ROM_REGION( 0x1000000, "gfx7", 0 ) /* */
232   ROM_LOAD( "mr9930-01.ic30", 0x000000, 0x400000, CRC(9e3e054e) SHA1(06a4fa76cb83dbe9d565d5ccd0a5ecc5067887c9) )
233   ROM_LOAD( "mr9930-02.ic29", 0x400000, 0x400000, CRC(b23c29f4) SHA1(a7b10a3a9af43db319baf8633bb3728120960923) )
234   ROM_LOAD( "mr9930-03.ic28", 0x800000, 0x400000, CRC(9a5d070f) SHA1(b4668b4f299033140a2c56499cc2712ba111cb57) )
235
236   ROM_REGION( 0x1000000, "gfx8", 0 ) /* */
237   ROM_LOAD( "vj98348_step3_4_v1.1", 0x000000, 0x400000, CRC(dec612df) SHA1(acb86bb90c1cc61c7db3e022c69a5ff0611ffbae) )
238   ROM_LOAD( "vj98348_step3_18_v1.1", 0x400000, 0x400000, CRC(bc92f0a0) SHA1(49c08de7a898a27972d4209709ddf447c5dca36a) )
239   ROM_LOAD( "vj98348_step3_25_v1.1", 0x800000, 0x400000, CRC(dec612df) SHA1(acb86bb90c1cc61c7db3e022c69a5ff0611ffbae) )
240
241   DISK_REGION( "disks" )
242   DISK_IMAGE("step3", 0, NO_DUMP)
243ROM_END
244
184245GAME( 1999, stepstag, 0, stepstag, stepstag, 0, ROT0, "Jaleco", "Stepping Stage", GAME_NO_SOUND| GAME_NOT_WORKING)
246GAME( 1999, step3, stepstag,   stepstag, stepstag, 0,   ROT0, "Jaleco", "Stepping 3 Superior", GAME_NO_SOUND| GAME_NOT_WORKING)
src/mame/drivers/srmp5.c
r4184r4185
2626SX008-13.BIN ;  |
2727SX008-14.BIN ; /
2828
29
30Note:
31
32attract sound ON/OFF of DIPSW doesn't work.
33This is not a bug (real machine behaves the same).
2934*/
3035
3136
3237#include "driver.h"
38#include "deprecat.h"
3339#include "cpu/z80/z80.h"
3440#include "cpu/mips/r3000.h"
3541#include "sound/st0016.h"
3642#include "st0016.h"
3743
44#define DEBUG_CHAR
3845extern UINT8 *st0016_charram;
3946static UINT32 databank;
40
41static UINT16 *tileram;
47static UINT32 srmp5_vidregs[0x120 / 4];
48static UINT16 *tileram, *palram;
4249static UINT16 *sprram;
50static UINT8 cmd1 = 0, cmd2 = 0, cmd_stat = 0;
4351
52#ifdef DEBUG_CHAR
53static UINT8 tileduty[0x2000];
54#endif
55
4456#define SPRITE_GLOBAL_X 0
4557#define SPRITE_GLOBAL_Y 1
4658#define SUBLIST_OFFSET   2
r4184r4185
6375
6476static VIDEO_UPDATE( srmp5 )
6577{
66   // sprite/tile flipping is not implemented
67   int x,y,address,xs,ys,height,width,xw,yw,sprite,xb,yb,sizex,sizey;
78   int x,y,address,xs,xs2,ys,ys2,height,width,xw,yw,xb,yb,sizex,sizey;
6879   UINT16 *sprite_list=sprram;
69   UINT16 *sprite_list_end=&sprram[0x1000]; //guess
80   UINT16 *sprite_list_end=&sprram[0x4000]; //guess
7081   UINT8 *pixels=(UINT8 *)tileram;
7182   const rectangle *visarea = video_screen_get_visible_area(screen);
7283
73   bitmap_fill(bitmap,cliprect,0);
84//Table surface seems to be tiles, but display corrupts when switching the scene if always ON.
85//Currently the tiles are OFF.
86#ifdef BG_ENABLE
87   UINT8 tile_width  = (srmp5_vidregs[2] >> 0) & 0xFF;
88   UINT8 tile_height = (srmp5_vidregs[2] >> 8) & 0xFF;
89   if(tile_width && tile_height)
90   {
91      // 16x16 tile
92      UINT16 *map = &sprram[0x2000];
93      for(yw = 0; yw < tile_height; yw++)
94      {
95         for(xw = 0; xw < tile_width; xw++)
96         {
97            UINT16 tile = map[yw * 128 + xw * 2];
98            if(tile >= 0x2000) continue;
7499
100            address = tile * SPRITE_DATA_GRANULARITY;
101            for(y = 0; y < 16; y++)
102            {
103               for(x = 0; x < 16; x++)
104               {
105                  UINT8 pen = pixels[address];
106                  if(pen)
107                  {
108                     UINT16 pixdata=palram[pen];
109                     *BITMAP_ADDR32(bitmap, yw * 16 + y, xw * 16 + x) = ((pixdata&0x7c00)>>7) | ((pixdata&0x3e0)<<6) | ((pixdata&0x1f)<<19);
110                  }
111                  address++;
112               }
113            }
114         }
115      }
116   }
117   else
118#endif
119      bitmap_fill(bitmap,cliprect,0);
120
75121   while((sprite_list[SUBLIST_OFFSET]&SPRITE_LIST_END_MARKER)==0 && sprite_list<sprite_list_end)
76122   {
77123      UINT16 *sprite_sublist=&sprram[sprite_list[SUBLIST_OFFSET]<<SUBLIST_OFFSET_SHIFT];
r4184r4185
84130         global_y=(INT16)sprite_list[SPRITE_GLOBAL_Y];
85131         while(sublist_length)
86132         {
87            sprite=sprite_sublist[SPRITE_TILE];
88133            x=(INT16)sprite_sublist[SPRITE_LOCAL_X]+global_x;
89134            y=(INT16)sprite_sublist[SPRITE_LOCAL_Y]+global_y;
90            width=(sprite_sublist[SPRITE_SIZE]>>4)&0xf;
135            width =(sprite_sublist[SPRITE_SIZE]>> 4)&0xf;
91136            height=(sprite_sublist[SPRITE_SIZE]>>12)&0xf;
92137
93138            sizex=(sprite_sublist[SPRITE_SIZE]>>0)&0xf;
94139            sizey=(sprite_sublist[SPRITE_SIZE]>>8)&0xf;
95140
96            address=sprite*SPRITE_DATA_GRANULARITY;
141            address=(sprite_sublist[SPRITE_TILE] & ~(sprite_sublist[SPRITE_SIZE] >> 11 & 7))*SPRITE_DATA_GRANULARITY;
142            y -= (height + 1) * (sizey + 1)-1;
97143            for(xw=0;xw<=width;xw++)
144            {
145               xb = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (width-xw)*(sizex+1)+x: xw*(sizex+1)+x;
98146               for(yw=0;yw<=height;yw++)
99147               {
100                  xb=x+xw*(sizex+1);
101                  yb=y+yw*(sizey+1);
148                  yb = yw*(sizey+1)+y;
102149                  for(ys=0;ys<=sizey;ys++)
103150                  {
151                     ys2 = (sprite_sublist[SPRITE_PALETTE] & 0x4000) ? ys : (sizey - ys);
104152                      for(xs=0;xs<=sizex;xs++)
105153                      {
106                         UINT32 pen=pixels[address&(0x100000-1)];
107
154                         UINT8 pen=pixels[address&(0x100000-1)];
155                         xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs;
108156                         if(pen)
109157                         {
110                            if(xb+xs<=visarea->max_x && xb+xs>=visarea->min_x && yb+ys<=visarea->max_y && yb+ys>=visarea->min_y )
158                            if(xb+xs2<=visarea->max_x && xb+xs2>=visarea->min_x && yb+ys2<=visarea->max_y && yb+ys2>=visarea->min_y )
111159                            {
112                               UINT32 pixdata=paletteram32[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)];
113                               *BITMAP_ADDR32(bitmap, yb+ys, xb+xs) = ((pixdata&0x7c00)>>7) | ((pixdata&0x3e0)<<6) | ((pixdata&0x1f)<<19);
160                               UINT16 pixdata=palram[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)];
161                               *BITMAP_ADDR32(bitmap, yb+ys2, xb+xs2) = ((pixdata&0x7c00)>>7) | ((pixdata&0x3e0)<<6) | ((pixdata&0x1f)<<19);
114162                            }
115163                         }
116164                         ++address;
117165                      }
118166                   }
119
120167                }
168             }
121169            sprite_sublist+=SPRITE_SUBLIST_ENTRY_LENGTH;
122170            --sublist_length;
123171         }
r4184r4185
125173      sprite_list+=SPRITE_LIST_ENTRY_LENGTH;
126174   }
127175
176#ifdef DEBUG_CHAR
177   {
178      int i;
179      for(i = 0; i < 0x2000; i++)
180      {
181         if(tileduty[i] == 1)
182         {
183            decodechar(screen->machine->gfx[0], i, (UINT8 *)tileram);
184            tileduty[i] = 0;
185         }
186      }
187   }
188#endif
128189   return 0;
129190}
130191
192static READ32_HANDLER(srmp5_palette_r)
193{
194   return palram[offset];
195}
196
197static WRITE32_HANDLER(srmp5_palette_w)
198{
199   COMBINE_DATA(&palram[offset]);
200   palette_set_color(space->machine, offset, MAKE_RGB(data << 3 & 0xFF, data >> 2 & 0xFF, data >> 7 & 0xFF));
201}
131202static WRITE32_HANDLER(bank_w)
132203{
133204   COMBINE_DATA(&databank);
r4184r4185
135206
136207static READ32_HANDLER(tileram_r)
137208{
138   return videoram32[offset];
209   return tileram[offset];
139210}
140211
141212static WRITE32_HANDLER(tileram_w)
142213{
143   COMBINE_DATA(&videoram32[offset]);
144   tileram[offset]=videoram32[offset]&0xffff;
214   tileram[offset] = data & 0xFFFF; //lower 16bit only
215#ifdef DEBUG_CHAR
216   tileduty[offset >> 6] = 1;
217#endif
145218}
146219
147220static READ32_HANDLER(spr_r)
148221{
149   return spriteram32[offset];
222   return sprram[offset];
150223}
151224
152225static WRITE32_HANDLER(spr_w)
153226{
154   COMBINE_DATA(&spriteram32[offset]);
155   sprram[offset]=spriteram32[offset];
227   sprram[offset] = data & 0xFFFF; //lower 16bit only
156228}
157229
158230static READ32_HANDLER(data_r)
r4184r4185
164236   return data|(data<<16);
165237}
166238
239static UINT8 input_select = 0;
240
241static WRITE32_HANDLER(input_select_w)
242{
243   input_select = data & 0x0F;
244}
245
246static READ32_HANDLER(srmp5_inputs_r)
247{
248   UINT32 ret = 0;
249   switch(input_select)
250   {
251   case 0x01:
252      ret = input_port_read(space->machine, "IN0");
253      break;
254   case 0x02:
255      ret = input_port_read(space->machine, "IN1");
256      break;
257   case 0x04:
258      ret = input_port_read(space->machine, "IN2");
259      break;
260   case 0x00:
261   case 0x08:
262      ret = input_port_read(space->machine, "IN3");
263      break;
264   }
265   return ret;
266}
267
268//almost all cmds are sound related
269static WRITE32_HANDLER(cmd1_w)
270{
271   cmd1 = data & 0xFF;
272   logerror("cmd1_w %08X\n", data);
273}
274
275static WRITE32_HANDLER(cmd2_w)
276{
277   cmd2 = data & 0xFF;
278   cmd_stat = 5;
279   logerror("cmd2_w %08X\n", data);
280}
281
282static READ32_HANDLER(cmd_stat32_r)
283{
284   return cmd_stat;
285}
286
287static READ32_HANDLER(srmp5_vidregs_r)
288{
289   logerror("vidregs read  %08X %08X\n", offset << 2, srmp5_vidregs[offset]);
290   return srmp5_vidregs[offset];
291}
292
293static WRITE32_HANDLER(srmp5_vidregs_w)
294{
295   COMBINE_DATA(&srmp5_vidregs[offset]);
296   if(offset != 0x10C / 4)
297      logerror("vidregs write %08X %08X\n", offset << 2, srmp5_vidregs[offset]);
298}
299
167300static ADDRESS_MAP_START( srmp5_mem, ADDRESS_SPACE_PROGRAM, 32 )
168301   AM_RANGE(0x00000000, 0x000fffff) AM_RAM //maybe 0 - 2fffff ?
169302   AM_RANGE(0x002f0000, 0x002f7fff) AM_RAM
170303   AM_RANGE(0x01000000, 0x01000003) AM_WRITE(SMH_RAM)  // 0xaa .. watchdog ?
171   AM_RANGE(0x01800004, 0x01800007) AM_READ_PORT("IN0")
172   AM_RANGE(0x01800008, 0x0180000b) AM_READ_PORT("IN1")
304   AM_RANGE(0x01800000, 0x01800003) AM_RAM //?1
305   AM_RANGE(0x01800004, 0x01800007) AM_READ_PORT("DSW1")
306   AM_RANGE(0x01800008, 0x0180000b) AM_READ_PORT("DSW2")
173307   AM_RANGE(0x0180000c, 0x0180000f) AM_WRITE(bank_w)
174   AM_RANGE(0x01800010, 0x01800013) AM_READ_PORT("IN2") //multiplexed controls (selected by writes to 1c)
175   AM_RANGE(0x01800014, 0x01800017) AM_READ_PORT("IN3")
176   AM_RANGE(0x0180001c, 0x0180001f) AM_WRITE(SMH_RAM)//c1 c2 c4 c8 => mahjong inputs (at $10) - bits 0-3
177   AM_RANGE(0x01800200, 0x0180020f) AM_RAM  //sound related ? only few writes after boot
308   AM_RANGE(0x01800010, 0x01800013) AM_READ(srmp5_inputs_r) //multiplexed controls (selected by writes to 1c)
309   AM_RANGE(0x01800014, 0x01800017) AM_READ_PORT("TEST")
310   AM_RANGE(0x0180001c, 0x0180001f) AM_WRITE(input_select_w)//c1 c2 c4 c8 => mahjong inputs (at $10) - bits 0-3
311   AM_RANGE(0x01800200, 0x01800203) AM_RAM  //sound related ? only few writes after boot
312   AM_RANGE(0x01802000, 0x01802003) AM_WRITE(cmd1_w)
313   AM_RANGE(0x01802004, 0x01802007) AM_WRITE(cmd2_w)
314   AM_RANGE(0x01802008, 0x0180200b) AM_READ(cmd_stat32_r)
178315   AM_RANGE(0x01a00000, 0x01bfffff) AM_READ(data_r)
316   AM_RANGE(0x01c00000, 0x01c00003) AM_READNOP // debug? 'Toru'
179317
180   AM_RANGE(0x0a000000, 0x0a0fffff) AM_READWRITE(spr_r, spr_w) AM_BASE(&spriteram32)
181   AM_RANGE(0x0a100000, 0x0a1fffff) AM_RAM AM_BASE(&paletteram32)
182   AM_RANGE(0x0a200000, 0x0a3fffff) AM_READWRITE(tileram_r, tileram_w) AM_BASE(&videoram32)
318   AM_RANGE(0x0a000000, 0x0a0fffff) AM_READWRITE(spr_r, spr_w)
319   AM_RANGE(0x0a100000, 0x0a17ffff) AM_READWRITE(srmp5_palette_r, srmp5_palette_w)
320   //0?N???A?????????i??????????
321   AM_RANGE(0x0a180000, 0x0a180003) AM_READNOP // write 0x00000400
322   AM_RANGE(0x0a180000, 0x0a18011f) AM_READWRITE(srmp5_vidregs_r, srmp5_vidregs_w)
323   AM_RANGE(0x0a200000, 0x0a3fffff) AM_READWRITE(tileram_r, tileram_w)
183324
184325   AM_RANGE(0x1eff0000, 0x1eff001f) AM_WRITE(SMH_RAM)
185326   AM_RANGE(0x1eff003c, 0x1eff003f) AM_READNOP
r4184r4185
190331static ADDRESS_MAP_START( st0016_mem, ADDRESS_SPACE_PROGRAM, 8 )
191332   AM_RANGE(0x0000, 0x7fff) AM_ROM
192333   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)
193   AM_RANGE(0xc000, 0xcfff) AM_READ(st0016_sprite_ram_r) AM_WRITE(st0016_sprite_ram_w)
194   AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
195   AM_RANGE(0xe000, 0xe7ff) AM_RAM
196   AM_RANGE(0xe800, 0xe87f) AM_RAM
197334   AM_RANGE(0xe900, 0xe9ff) AM_RAM_WRITE(st0016_snd_w) AM_BASE(&st0016_sound_regs)
198   AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
199335   AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
200336   AM_RANGE(0xf000, 0xffff) AM_RAM
201337ADDRESS_MAP_END
202338
203339READ8_HANDLER(st0016_dma_r);
204340
341static READ8_HANDLER(cmd1_r)
342{
343   cmd_stat = 0;
344   return cmd1;
345}
346
347static READ8_HANDLER(cmd2_r)
348{
349   return cmd2;
350}
351
352static READ8_HANDLER(cmd_stat8_r)
353{
354   return cmd_stat;
355}
356
205357static ADDRESS_MAP_START( st0016_io, ADDRESS_SPACE_IO, 8 )
206358   ADDRESS_MAP_GLOBAL_MASK(0xff)
207359   AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w)
208   AM_RANGE(0xc0, 0xc3) AM_NOP // data from other cpu ?
209   AM_RANGE(0xe0, 0xe0) AM_WRITENOP
360   AM_RANGE(0xc0, 0xc0) AM_READ(cmd1_r)
361   AM_RANGE(0xc1, 0xc1) AM_READ(cmd2_r)
362   AM_RANGE(0xc2, 0xc2) AM_READ(cmd_stat8_r)
210363   AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
211   AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
212   AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
213   AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
214   AM_RANGE(0xe6, 0xe6) AM_WRITENOP
215   AM_RANGE(0xe7, 0xe7) AM_WRITENOP
364   AM_RANGE(0xe7, 0xe7) AM_WRITE(st0016_rom_bank_w)
216365   AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
217366ADDRESS_MAP_END
218367
219368
220369static INPUT_PORTS_START( srmp5 )
221   PORT_START("IN0")
222   PORT_DIPNAME( 0x0001, 0x0001, "0-0" )
223   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
224   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
225   PORT_DIPNAME( 0x0002, 0x0002, "0-1" )
226   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
227   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
228   PORT_DIPNAME( 0x0004, 0x0004, "0-2" )
229   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
230   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
231   PORT_DIPNAME( 0x0008, 0x0008, "0-3" )
232   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
233   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
234   PORT_DIPNAME( 0x0010, 0x0010, "0-4" )
235   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
236   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
237   PORT_DIPNAME( 0x0020, 0x0020, "0-5" )
238   PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
239   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
240   PORT_DIPNAME( 0x0040, 0x0040, "0-6" )
241   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
242   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
243   PORT_DIPNAME( 0x0080, 0x0080, "0-7" )
244   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
245   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
246   PORT_DIPNAME( 0x0100, 0x0100, "0-8" )
247   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
248   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
249   PORT_DIPNAME( 0x0200, 0x0200, "0-9" )
250   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
251   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
252   PORT_DIPNAME( 0x0400, 0x0400, "0-a" )
253   PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
254   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
255   PORT_DIPNAME( 0x0800, 0x0800, "0-b" )
256   PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
257   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
258   PORT_DIPNAME( 0x1000, 0x1000, "0-c" )
259   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
260   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
261   PORT_DIPNAME( 0x2000, 0x2000, "0-d" )
262   PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
263   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
264   PORT_DIPNAME( 0x4000, 0x4000, "0-e" )
265   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
266   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
267   PORT_DIPNAME( 0x8000, 0x8000, "0-f" )
268   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
269   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
270   PORT_DIPNAME( 0x00010000, 0x00010000, "0-10" )
271   PORT_DIPSETTING(      0x00010000, DEF_STR( Off ) )
272   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
273   PORT_DIPNAME( 0x00020000, 0x00020000, "0-11" )
274   PORT_DIPSETTING(      0x00020000, DEF_STR( Off ) )
275   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
276   PORT_DIPNAME( 0x00040000, 0x00040000, "0-12" )
277   PORT_DIPSETTING(      0x00040000, DEF_STR( Off ) )
278   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
279   PORT_DIPNAME( 0x00080000, 0x00080000, "0-13" )
280   PORT_DIPSETTING(      0x00080000, DEF_STR( Off ) )
281   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
282   PORT_DIPNAME( 0x00100000, 0x00100000, "0-14" )
283   PORT_DIPSETTING(      0x00100000, DEF_STR( Off ) )
284   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
285   PORT_DIPNAME( 0x00200000, 0x00200000, "0-15" )
286   PORT_DIPSETTING(      0x00200000, DEF_STR( Off ) )
287   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
288   PORT_DIPNAME( 0x00400000, 0x00400000, "0-16" )
289   PORT_DIPSETTING(      0x00400000, DEF_STR( Off ) )
290   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
291   PORT_DIPNAME( 0x00800000, 0x00800000, "0-17" )
292   PORT_DIPSETTING(      0x00800000, DEF_STR( Off ) )
293   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
294   PORT_DIPNAME( 0x01000000, 0x01000000, "0-18" )
295   PORT_DIPSETTING(      0x01000000, DEF_STR( Off ) )
296   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
297   PORT_DIPNAME( 0x02000000, 0x02000000, "0-19" )
298   PORT_DIPSETTING(      0x02000000, DEF_STR( Off ) )
299   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
300   PORT_DIPNAME( 0x04000000, 0x04000000, "0-1a" )
301   PORT_DIPSETTING(      0x04000000, DEF_STR( Off ) )
302   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
303   PORT_DIPNAME( 0x08000000, 0x08000000, "0-1b" )
304   PORT_DIPSETTING(      0x08000000, DEF_STR( Off ) )
305   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
306   PORT_DIPNAME( 0x10000000, 0x10000000, "0-1c" )
307   PORT_DIPSETTING(      0x10000000, DEF_STR( Off ) )
308   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
309   PORT_DIPNAME( 0x20000000, 0x20000000, "0-1d" )
310   PORT_DIPSETTING(      0x20000000, DEF_STR( Off ) )
311   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
312   PORT_DIPNAME( 0x40000000, 0x40000000, "0-1e" )
313   PORT_DIPSETTING(      0x40000000, DEF_STR( Off ) )
314   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
315   PORT_DIPNAME( 0x80000000, 0x80000000, "0-1f" )
316   PORT_DIPSETTING(      0x80000000, DEF_STR( Off ) )
317   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
370   PORT_START("DSW1")
371   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
372   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
373   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
374   PORT_DIPSETTING(      0x0002, DEF_STR( 3C_1C ) )
375   PORT_DIPSETTING(      0x0003, DEF_STR( 2C_1C ) )
376   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
377   PORT_DIPSETTING(      0x0006, DEF_STR( 1C_2C ) )
378   PORT_DIPSETTING(      0x0005, DEF_STR( 1C_3C ) )
379   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_4C ) )
380   PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) )
381   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
382   PORT_DIPSETTING(      0x0008, DEF_STR( 4C_1C ) )
383   PORT_DIPSETTING(      0x0010, DEF_STR( 3C_1C ) )
384   PORT_DIPSETTING(      0x0018, DEF_STR( 2C_1C ) )
385   PORT_DIPSETTING(      0x0038, DEF_STR( 1C_1C ) )
386   PORT_DIPSETTING(      0x0030, DEF_STR( 1C_2C ) )
387   PORT_DIPSETTING(      0x0028, DEF_STR( 1C_3C ) )
388   PORT_DIPSETTING(      0x0020, DEF_STR( 1C_4C ) )
389   PORT_DIPNAME( 0x0040, 0x0040, "PUT" )
390   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
391   PORT_DIPSETTING(      0x0040, DEF_STR( On ) )
392   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
393   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
394   PORT_DIPSETTING(      0x0080, DEF_STR( On ) )
395   PORT_BIT( 0xffffff00, IP_ACTIVE_LOW, IPT_UNUSED )
318396
319   PORT_START("IN1")
320   PORT_DIPNAME( 0x0001, 0x0001, "1-0" )
321   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
322   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
323   PORT_DIPNAME( 0x0002, 0x0002, "1-1" )
324   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
325   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
326   PORT_DIPNAME( 0x0004, 0x0004, "1-2" )
327   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
328   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
329   PORT_DIPNAME( 0x0008, 0x0008, "1-3" )
330   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
331   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
332   PORT_DIPNAME( 0x0010, 0x0010, "1-4" )
333   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
334   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
335   PORT_DIPNAME( 0x0020, 0x0020, "1-5" )
336   PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
337   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
338   PORT_DIPNAME( 0x0040, 0x0040, "1-6" )
397   PORT_START("DSW2")
398   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Difficulty ) )
399   PORT_DIPSETTING(      0x0000, "8" )
400   PORT_DIPSETTING(      0x0001, "7" )
401   PORT_DIPSETTING(      0x0002, "6" )
402   PORT_DIPSETTING(      0x0003, "5" )
403   PORT_DIPSETTING(      0x0007, "4" )
404   PORT_DIPSETTING(      0x0006, "1" )
405   PORT_DIPSETTING(      0x0005, "2" )
406   PORT_DIPSETTING(      0x0004, "3" )
407   PORT_DIPNAME( 0x0008, 0x0008, "Kuitan" )
408   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
409   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
410   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Allow_Continue ) )
411   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
412   PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
413   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )
414   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
415   PORT_DIPSETTING(      0x0020, DEF_STR( On ) )
416   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) )
339417   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
340418   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
341   PORT_DIPNAME( 0x0080, 0x0080, "Test mode" )
419   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Test ) )
342420   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
343421   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
344   PORT_DIPNAME( 0x0100, 0x0100, "1-8" )
345   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
346   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
347   PORT_DIPNAME( 0x0200, 0x0200, "1-9" )
348   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
349   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
350   PORT_DIPNAME( 0x0400, 0x0400, "1-a" )
351   PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
352   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
353   PORT_DIPNAME( 0x0800, 0x0800, "1-b" )
354   PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
355   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
356   PORT_DIPNAME( 0x1000, 0x1000, "1-c" )
357   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
358   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
359   PORT_DIPNAME( 0x2000, 0x2000, "1-d" )
360   PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
361   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
362   PORT_DIPNAME( 0x4000, 0x4000, "1-e" )
363   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
364   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
365   PORT_DIPNAME( 0x8000, 0x8000, "1-f" )
366   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
367   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
422   PORT_BIT ( 0xffffff00, IP_ACTIVE_LOW, IPT_UNUSED )
368423
369   PORT_DIPNAME( 0x00010000, 0x00010000, "1-10" )
370   PORT_DIPSETTING(      0x00010000, DEF_STR( Off ) )
371   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
372   PORT_DIPNAME( 0x00020000, 0x00020000, "1-11" )
373   PORT_DIPSETTING(      0x00020000, DEF_STR( Off ) )
374   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
375   PORT_DIPNAME( 0x00040000, 0x00040000, "1-12" )
376   PORT_DIPSETTING(      0x00040000, DEF_STR( Off ) )
377   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
378   PORT_DIPNAME( 0x00080000, 0x00080000, "1-13" )
379   PORT_DIPSETTING(      0x00080000, DEF_STR( Off ) )
380   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
381   PORT_DIPNAME( 0x00100000, 0x00100000, "1-14" )
382   PORT_DIPSETTING(      0x00100000, DEF_STR( Off ) )
383   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
384   PORT_DIPNAME( 0x00200000, 0x00200000, "1-15" )
385   PORT_DIPSETTING(      0x00200000, DEF_STR( Off ) )
386   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
387   PORT_DIPNAME( 0x00400000, 0x00400000, "1-16" )
388   PORT_DIPSETTING(      0x00400000, DEF_STR( Off ) )
389   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
390   PORT_DIPNAME( 0x00800000, 0x00800000, "1-17" )
391   PORT_DIPSETTING(      0x00800000, DEF_STR( Off ) )
392   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
393   PORT_DIPNAME( 0x01000000, 0x01000000, "1-18" )
394   PORT_DIPSETTING(      0x01000000, DEF_STR( Off ) )
395   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
396   PORT_DIPNAME( 0x02000000, 0x02000000, "1-19" )
397   PORT_DIPSETTING(      0x02000000, DEF_STR( Off ) )
398   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
399   PORT_DIPNAME( 0x04000000, 0x04000000, "1-1a" )
400   PORT_DIPSETTING(      0x04000000, DEF_STR( Off ) )
401   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
402   PORT_DIPNAME( 0x08000000, 0x08000000, "1-1b" )
403   PORT_DIPSETTING(      0x08000000, DEF_STR( Off ) )
404   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
405   PORT_DIPNAME( 0x10000000, 0x10000000, "1-1c" )
406   PORT_DIPSETTING(      0x10000000, DEF_STR( Off ) )
407   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
408   PORT_DIPNAME( 0x20000000, 0x20000000, "1-1d" )
409   PORT_DIPSETTING(      0x20000000, DEF_STR( Off ) )
410   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
411   PORT_DIPNAME( 0x40000000, 0x40000000, "1-1e" )
412   PORT_DIPSETTING(      0x40000000, DEF_STR( Off ) )
413   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
414   PORT_DIPNAME( 0x80000000, 0x80000000, "1-1f" )
415   PORT_DIPSETTING(      0x80000000, DEF_STR( Off ) )
416   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
424   PORT_START("IN0")
425   PORT_BIT ( 0xfffffff0, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
426   PORT_BIT ( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_D )
427   PORT_BIT ( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_H )
428   PORT_BIT ( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_L )
429   PORT_BIT ( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
417430
431   PORT_START("IN1")
432   PORT_BIT ( 0xffffffc0, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
433   PORT_BIT ( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_A )
434   PORT_BIT ( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_E )
435   PORT_BIT ( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_I )
436   PORT_BIT ( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_M )
437   PORT_BIT ( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
438   PORT_BIT ( 0x00000020, IP_ACTIVE_LOW, IPT_START1 )
439
418440   PORT_START("IN2")
419   PORT_DIPNAME( 0x0001, 0x0001, "2-0" )
420   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
421   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
422   PORT_DIPNAME( 0x0002, 0x0002, "2-1" )
423   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
424   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
425   PORT_DIPNAME( 0x0004, 0x0004, "2-2" )
426   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
427   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
428   PORT_DIPNAME( 0x0008, 0x0008, "2-3" )
429   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
430   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
431   PORT_DIPNAME( 0x0010, 0x0010, "2-4" )
432   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
433   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
441   PORT_BIT ( 0xffffffe0, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
442   PORT_BIT ( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_B )
443   PORT_BIT ( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_F )
444   PORT_BIT ( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_J )
445   PORT_BIT ( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_N )
446   PORT_BIT ( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
434447
435   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
436   PORT_DIPNAME( 0x0040, 0x0040, "2-5" )
437   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
438   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
439   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
440   PORT_DIPNAME( 0x0100, 0x0100, "2-8" )
441   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
442   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
443   PORT_DIPNAME( 0x0200, 0x0200, "2-9" )
444   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
445   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
446   PORT_DIPNAME( 0x0400, 0x0400, "2-a" )
447   PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
448   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
449   PORT_DIPNAME( 0x0800, 0x0800, "2-b" )
450   PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
451   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
452   PORT_DIPNAME( 0x1000, 0x1000, "2-c" )
453   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
454   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
455   PORT_DIPNAME( 0x2000, 0x2000, "2-d" )
456   PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
457   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
458   PORT_DIPNAME( 0x4000, 0x4000, "2-e" )
459   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
460   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
461   PORT_DIPNAME( 0x8000, 0x8000, "2-f" )
462   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
463   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
464
465   PORT_DIPNAME( 0x00010000, 0x00010000, "2-10" )
466   PORT_DIPSETTING(      0x00010000, DEF_STR( Off ) )
467   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
468   PORT_DIPNAME( 0x00020000, 0x00020000, "2-11" )
469   PORT_DIPSETTING(      0x00020000, DEF_STR( Off ) )
470   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
471   PORT_DIPNAME( 0x00040000, 0x00040000, "2-12" )
472   PORT_DIPSETTING(      0x00040000, DEF_STR( Off ) )
473   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
474   PORT_DIPNAME( 0x00080000, 0x00080000, "2-13" )
475   PORT_DIPSETTING(      0x00080000, DEF_STR( Off ) )
476   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
477   PORT_DIPNAME( 0x00100000, 0x00100000, "2-14" )
478   PORT_DIPSETTING(      0x00100000, DEF_STR( Off ) )
479   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
480   PORT_DIPNAME( 0x00200000, 0x00200000, "2-15" )
481   PORT_DIPSETTING(      0x00200000, DEF_STR( Off ) )
482   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
483   PORT_DIPNAME( 0x00400000, 0x00400000, "2-16" )
484   PORT_DIPSETTING(      0x00400000, DEF_STR( Off ) )
485   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
486   PORT_DIPNAME( 0x00800000, 0x00800000, "2-17" )
487   PORT_DIPSETTING(      0x00800000, DEF_STR( Off ) )
488   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
489   PORT_DIPNAME( 0x01000000, 0x01000000, "2-18" )
490   PORT_DIPSETTING(      0x01000000, DEF_STR( Off ) )
491   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
492   PORT_DIPNAME( 0x02000000, 0x02000000, "2-19" )
493   PORT_DIPSETTING(      0x02000000, DEF_STR( Off ) )
494   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
495   PORT_DIPNAME( 0x04000000, 0x04000000, "2-1a" )
496   PORT_DIPSETTING(      0x04000000, DEF_STR( Off ) )
497   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
498   PORT_DIPNAME( 0x08000000, 0x08000000, "2-1b" )
499   PORT_DIPSETTING(      0x08000000, DEF_STR( Off ) )
500   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
501   PORT_DIPNAME( 0x10000000, 0x10000000, "2-1c" )
502   PORT_DIPSETTING(      0x10000000, DEF_STR( Off ) )
503   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
504   PORT_DIPNAME( 0x20000000, 0x20000000, "2-1d" )
505   PORT_DIPSETTING(      0x20000000, DEF_STR( Off ) )
506   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
507   PORT_DIPNAME( 0x40000000, 0x40000000, "2-1e" )
508   PORT_DIPSETTING(      0x40000000, DEF_STR( Off ) )
509   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
510   PORT_DIPNAME( 0x80000000, 0x80000000, "2-1f" )
511   PORT_DIPSETTING(      0x80000000, DEF_STR( Off ) )
512   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
513
514448   PORT_START("IN3")
515   PORT_DIPNAME( 0x0001, 0x0001, "3-0" )
516   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
517   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
518   PORT_DIPNAME( 0x0002, 0x0002, "3-1" )
519   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
520   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
521   PORT_DIPNAME( 0x0004, 0x0004, "3-2" )
522   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
523   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
524   PORT_DIPNAME( 0x0008, 0x0008, "3-3" )
525   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
526   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
527   PORT_DIPNAME( 0x0010, 0x0010, "3-4" )
528   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
529   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
530   PORT_DIPNAME( 0x0020, 0x0020, "3-5" )
531   PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
532   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
533   PORT_DIPNAME( 0x0040, 0x0040, "3-6" )
534   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
535   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
536   PORT_DIPNAME( 0x0080, 0x0080, "3-7" )
537   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
538   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
539   PORT_DIPNAME( 0x0100, 0x0100, "3-8" )
540   PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
541   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
542   PORT_DIPNAME( 0x0200, 0x0200, "3-9" )
543   PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
544   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
545   PORT_DIPNAME( 0x0400, 0x0400, "3-a" )
546   PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
547   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
548   PORT_DIPNAME( 0x0800, 0x0800, "3-b" )
549   PORT_DIPSETTING(      0x0800, DEF_STR( Off ) )
550   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
551   PORT_DIPNAME( 0x1000, 0x1000, "3-c" )
552   PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
553   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
554   PORT_DIPNAME( 0x2000, 0x2000, "3-d" )
555   PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
556   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
557   PORT_DIPNAME( 0x4000, 0x4000, "3-e" )
558   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
559   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
560   PORT_DIPNAME( 0x8000, 0x8000, "3-f" )
561   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
562   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
449   PORT_BIT ( 0xffffff60, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
450   PORT_BIT ( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_C )
451   PORT_BIT ( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_G )
452   PORT_BIT ( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_K )
453   PORT_BIT ( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
454   PORT_BIT ( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
455   PORT_BIT ( 0x00000080, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
563456
564   PORT_DIPNAME( 0x00010000, 0x00010000, "3-10" )
565   PORT_DIPSETTING(      0x00010000, DEF_STR( Off ) )
566   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
567   PORT_DIPNAME( 0x00020000, 0x00020000, "3-11" )
568   PORT_DIPSETTING(      0x00020000, DEF_STR( Off ) )
569   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
570   PORT_DIPNAME( 0x00040000, 0x00040000, "3-12" )
571   PORT_DIPSETTING(      0x00040000, DEF_STR( Off ) )
572   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
573   PORT_DIPNAME( 0x00080000, 0x00080000, "3-13" )
574   PORT_DIPSETTING(      0x00080000, DEF_STR( Off ) )
575   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
576   PORT_DIPNAME( 0x00100000, 0x00100000, "3-14" )
577   PORT_DIPSETTING(      0x00100000, DEF_STR( Off ) )
578   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
579   PORT_DIPNAME( 0x00200000, 0x00200000, "3-15" )
580   PORT_DIPSETTING(      0x00200000, DEF_STR( Off ) )
581   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
582   PORT_DIPNAME( 0x00400000, 0x00400000, "3-16" )
583   PORT_DIPSETTING(      0x00400000, DEF_STR( Off ) )
584   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
585   PORT_DIPNAME( 0x00800000, 0x00800000, "3-17" )
586   PORT_DIPSETTING(      0x00800000, DEF_STR( Off ) )
587   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
588   PORT_DIPNAME( 0x01000000, 0x01000000, "3-18" )
589   PORT_DIPSETTING(      0x01000000, DEF_STR( Off ) )
590   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
591   PORT_DIPNAME( 0x02000000, 0x02000000, "3-19" )
592   PORT_DIPSETTING(      0x02000000, DEF_STR( Off ) )
593   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
594   PORT_DIPNAME( 0x04000000, 0x04000000, "3-1a" )
595   PORT_DIPSETTING(      0x04000000, DEF_STR( Off ) )
596   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
597   PORT_DIPNAME( 0x08000000, 0x08000000, "3-1b" )
598   PORT_DIPSETTING(      0x08000000, DEF_STR( Off ) )
599   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
600   PORT_DIPNAME( 0x10000000, 0x10000000, "3-1c" )
601   PORT_DIPSETTING(      0x10000000, DEF_STR( Off ) )
602   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
603   PORT_DIPNAME( 0x20000000, 0x20000000, "3-1d" )
604   PORT_DIPSETTING(      0x20000000, DEF_STR( Off ) )
605   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
606   PORT_DIPNAME( 0x40000000, 0x40000000, "3-1e" )
607   PORT_DIPSETTING(      0x40000000, DEF_STR( Off ) )
608   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
609   PORT_DIPNAME( 0x80000000, 0x80000000, "3-1f" )
610   PORT_DIPSETTING(      0x80000000, DEF_STR( Off ) )
611   PORT_DIPSETTING(      0x00000000, DEF_STR( On ) )
457   PORT_START("TEST")
458   PORT_BIT ( 0x00000080, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F2)
459   PORT_BIT ( 0xffffff7f, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
460
612461INPUT_PORTS_END
613462
614463static const st0016_interface st0016_config =
r4184r4185
616465   &st0016_charram
617466};
618467
619 static INTERRUPT_GEN( irq4_gen )
468//It seems that interrupt flags are never cleared, so I use last line only.
469
470static INTERRUPT_GEN( irq4_gen )
620471{
621   cpu_set_input_line(device, R3000_IRQ4, ASSERT_LINE);
472   if(cpu_getiloops(device) == 0)
473      cpu_set_input_line(device, R3000_IRQ4, ASSERT_LINE);
474   else
475      cpu_set_input_line(device, R3000_IRQ4, CLEAR_LINE);
622476}
623477
624478static const r3000_cpu_core config =
r4184r4185
628482   4096   /* data cache size */
629483};
630484
485static const gfx_layout tile_16x8x8_layout =
486{
487   16,8,
488   RGN_FRAC(1,1),
489   8,
490   { STEP8(0, 1) },
491   { STEP16(0, 8) },
492   { STEP8(0, 8*16) },
493   16*8*8
494};
495
496#if 0
497static const gfx_layout tile_16x16x8_layout =
498{
499   16,16,
500   RGN_FRAC(1,1),
501   8,
502   { STEP8(0, 1) },
503   { STEP16(0, 8) },
504   { STEP16(0, 8*16) },
505   16*16*8
506};
507#endif
508
509static GFXDECODE_START( srmp5 )
510   GFXDECODE_ENTRY( "gfx1", 0, tile_16x8x8_layout,  0x0, 0x800  )
511//  GFXDECODE_ENTRY( "gfx1", 0, tile_16x16x8_layout, 0x0, 0x800  )
512GFXDECODE_END
513
631514static MACHINE_DRIVER_START( srmp5 )
632515   /* basic machine hardware */
633516   MDRV_CPU_ADD("main",Z80,8000000)
r4184r4185
638521   MDRV_CPU_ADD("sub", R3000LE, 25000000)
639522   MDRV_CPU_CONFIG(config)
640523   MDRV_CPU_PROGRAM_MAP(srmp5_mem,0)
641   MDRV_CPU_VBLANK_INT("main", irq4_gen)
524   //256???K??
525   MDRV_CPU_VBLANK_INT_HACK(irq4_gen, 256)
642526
643527   MDRV_QUANTUM_TIME(HZ(6000))
644528
645529   /* video hardware */
646530   MDRV_SCREEN_ADD("main", RASTER)
647531   MDRV_SCREEN_REFRESH_RATE(60)
648   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
649532   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
650   MDRV_SCREEN_SIZE(512, 512)
651   MDRV_SCREEN_VISIBLE_AREA(4, 339, 32, 271)
533   MDRV_SCREEN_SIZE(96*8, 64*8)
534   MDRV_SCREEN_VISIBLE_AREA(0*8, 42*8-1, 2*8, 32*8-1)
652535
653   MDRV_PALETTE_LENGTH(16*16*4+1)
654
536   MDRV_PALETTE_LENGTH(0x1800)
537#ifdef DEBUG_CHAR
538   MDRV_GFXDECODE( srmp5 )
539#endif
655540   MDRV_VIDEO_START(st0016)
656541   MDRV_VIDEO_UPDATE(srmp5)
657542
r4184r4185
683568   ROM_LOAD( "sx008-05.bin",   0x800000, 0x200000,   CRC(0ff5e6f5) SHA1(ab7d021757f341d28db6d7d009c20ec9d7bd83c1) )
684569   ROM_LOAD( "sx008-06.bin",   0xa00000, 0x200000,   CRC(ba6fd7c4) SHA1(f086195c5c647e07e77ce2a23e94d28e6ad9ff4f) )
685570   ROM_LOAD( "sx008-07.bin",   0xc00000, 0x200000,   CRC(3564485d) SHA1(12464de4e2b6c4df1595183996d1987f0ecffb01) )
571#ifdef DEBUG_CHAR
572   ROM_REGION( 0x100000, "gfx1", 0)
573   ROM_FILL( 0, 0x100000, 0x00)
574#endif
686575ROM_END
687576
688577static DRIVER_INIT(srmp5)
689578{
690579   st0016_game=9;
691   tileram=(UINT16*)auto_malloc(0x100000);
692   sprram=(UINT16*)auto_malloc(0x080000);
580   tileram = (UINT16 *)auto_malloc(0x100000);
581   sprram  = (UINT16 *)auto_malloc(0x080000);
582   palram  = (UINT16 *)auto_malloc(0x040000);
583#ifdef DEBUG_CHAR
584   memset(tileduty, 1, 0x2000);
585#endif
693586}
694587
695GAME( 1994, srmp5,   0,     srmp5,    srmp5,    srmp5,    ROT0, "Seta",  "Super Real Mahjong P5", GAME_NOT_WORKING)
588GAME( 1994, srmp5,   0,     srmp5,    srmp5,    srmp5,    ROT0, "Seta",  "Super Real Mahjong P5", GAME_IMPERFECT_GRAPHICS)
src/mame/drivers/m92.c
r4184r4185
765765static INPUT_PORTS_START( psoldier )
766766   PORT_INCLUDE(m92_2player)
767767
768   PORT_MODIFY("P1_P2")
769   IREM_GENERIC_JOYSTICKS_3_BUTTONS(1, 2)
770
768771   PORT_MODIFY("DSW")
769772   /* Dip switch bank 1 */
770773   PORT_DIPNAME( 0x0020, 0x0000, "Any Button to Start" ) PORT_DIPLOCATION("SW1:6")
src/mame/drivers/vcombat.c
r4184r4185
11/*
22Virtual Combat hardware games.
33
4Driver by Jason Eckhardt and Andrew Gardner.
4Driver by Jason Eckhardt, Andrew Gardner and Phil Bennett.
55
66----
77
r4184r4185
1111Virtual Combat (c) VR8 Inc. 1993
1212http://arcade.sonzogni.com/VRCombat/
1313
14Shadow Fighters (German) (c) Sega? 1989?
14Shadow Fighters (German) (c) Dutech 1993
1515
1616----
1717
r4184r4185
6666     - Most of the memory maps and input ports are complete now.
6767       For "main", the only I/O locations that seem to be left
6868       mysterious are:
69         0x600010,
70         0x60000C: Only written; maybe mc6845? Often accessed
71               together, and 16 consecutive words of data are
72               written to 0x60000C, making me think it might be
73               6845-related.  May or may not be important for
74               reasonable emulation.
7569         0x60001C: Only read; might be a latch of some sort.  It is
7670               read each time M0's interrupt service routine syncs
7771               with the i860's to have them update the frame buffer.
r4184r4185
8276         0x600018: ? No info yet.
8377         0x704000: (VC only) Likely analog axis for VR headset
8478         0x703000: (VC only) Likely analog axis for VR headset
85         0x702000: (Shadow only). I think this is another IN port. It
86               is always read at the same time as the other two
87               ports.
8879
89      - Assuming a single framebuffer, as I think we are at the moment,
90        how are all the CPUs writes to the framebuffer prioritized,
91        if at all?  The zero values written by the 68k side erase
92        the i860-generated FB data (i.e., zero maps to black in the
93        pallette).  On the other hand, treating the zero values as
94        transparent doesn't quite look right either.  Could just the
95        i860s each have their own framebuffers?  After
96        all, since each eye of the binocular sees a slightly different
97        picture, the i860's might just maintain their own.  Then maybe
98        the 68k shares with each of the two, since I think it just
99        generates a single picture (not sure about that either).
10080    ----------------------------------------------
10181*/
10282
103#include <stdio.h>
10483#include "driver.h"
84#include "rendlay.h"
10585#include "cpu/m68000/m68000.h"
10686#include "cpu/i860/i860.h"
10787#include "video/generic.h"
10888#include "video/tlc34076.h"
89#include "video/mc6845.h"
90#include "sound/dac.h"
10991
110static UINT16* framebuffer_main;
111static UINT16* framebuffer_secondary;
92
93static UINT16* m68k_framebuffer[2];
94static UINT16* i860_framebuffer[2][2];
95static UINT16* framebuffer_ctrl;
96
11297static UINT16* vid_0_shared_RAM;
11398static UINT16* vid_1_shared_RAM;
11499
100static int crtc_select;
115101
102
116103static VIDEO_UPDATE( vcombat )
117104{
118   int x, y;
119   int count = 0;
120   const rgb_t *pens = tlc34076_get_pens();
105   int y;
106   const rgb_t *const pens = tlc34076_get_pens();
107   const device_config *aux = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "aux");
121108
109   UINT16 *m68k_buf = m68k_framebuffer[(*framebuffer_ctrl & 0x20) ? 1 : 0];
110   UINT16 *i860_buf = i860_framebuffer[(screen == aux) ? 1 : 0][0];
111
122112   /* TODO: It looks like the leftmost chunk of the ground should really be on the right side? */
123113   /*       But the i860 draws the background correctly, so it may be an original game issue. */
124114   /*       There's also some garbage in the upper-left corner. Might be related to this 'wraparound'. */
125115   /*       Or maybe it's related to the 68k's alpha?  It might come from the 68k side of the house.  */
126116
127   /* Main eye */
128   for(y = 0; y < 256; y++)
117   for (y = cliprect->min_y; y <= cliprect->max_y; ++y)
129118   {
130      for(x = 384; x < 640; x++)
119      int x;
120      int src_addr = 256/2 * y;
121      const UINT16 *m68k_src = &m68k_buf[src_addr];
122      const UINT16 *i860_src = &i860_buf[src_addr];
123      UINT32 *dst = BITMAP_ADDR32(bitmap, y, cliprect->min_x);
124
125      for (x = cliprect->min_x; x <= cliprect->max_x; x += 2)
131126      {
132         UINT32 color;
133         if (x % 2) color = (framebuffer_main[count] & 0xff00) >> 8;
134         else      color =  framebuffer_main[count] & 0x00ff;
127         int i;
128         UINT16 m68k_pix = *m68k_src++;
129         UINT16 i860_pix = *i860_src++;
135130
136         /* Vcombat's screen renders 'flopped' - very likely because VR headset displays may reflect off mirrors.
137               Shadfgtr isn't flopped, so it's not a constant feature of the hardware. */
138         if(x < video_screen_get_visible_area(screen)->max_x && y < video_screen_get_visible_area(screen)->max_y)
139            *BITMAP_ADDR32(bitmap, y, x) = pens[color];
131         /* Draw two pixels */
132         for (i = 0; i < 2; ++i)
133         {
134            /* Vcombat's screen renders 'flopped' - very likely because VR headset displays may reflect off mirrors.
135                Shadfgtr isn't flopped, so it's not a constant feature of the hardware. */
140136
141         if (x % 2) count++;
142      }
143   }
137            /* Combine the two layers */
138            if ((m68k_pix & 0xff) == 0)
139               *dst++ = pens[i860_pix & 0xff];
140            else
141               *dst++ = pens[m68k_pix & 0xff];
144142
145   /* Early out for shadow fighters */
146   if (!framebuffer_secondary)
147      return 0;
148
149   /* Secondary eye */
150   count = 0;
151   for(y = 0; y < 256; y++)
152   {
153      for(x = 0; x < 256; x++)
154      {
155         UINT32 color;
156         if (x % 2) color = (framebuffer_secondary[count] & 0xff00) >> 8;
157         else      color =  framebuffer_secondary[count] & 0x00ff;
158
159         /* Vcombat's screen renders 'flopped' - very likely because VR headset displays may reflect off mirrors.
160               Shadfgtr isn't flopped, so it's not a constant feature of the hardware. */
161         if(x < video_screen_get_visible_area(screen)->max_x && y < video_screen_get_visible_area(screen)->max_y)
162            *BITMAP_ADDR32(bitmap, y, x) = pens[color];
163
164         if (x % 2) count++;
143            m68k_pix >>= 8;
144            i860_pix >>= 8;
145         }
165146      }
166147   }
167148
r4184r4185
169150}
170151
171152
172/* Maybe there's a blend chip between the 68k and the framebuffer? */
173153static WRITE16_HANDLER( main_video_write )
174154{
175   /* Doesn't seem to make sense for shadow fighters. Maybe some of that factory rework disables this?  */
176   /* Doesn't always seem to work for vcombat either.  More testing needed.  */
177   if (data != 0x00000000) {
178      framebuffer_main[offset] = data;
155   int fb = (*framebuffer_ctrl & 0x20) ? 0 : 1;
156   UINT16 old_data = m68k_framebuffer[fb][offset];
157
158   /* Transparency mode? */
159   if (*framebuffer_ctrl & 0x40)
160   {
161      if (data == 0x0000)
162         return;
163
164      if ((data & 0x00ff) == 0)
165         data = (data & 0xff00) | (old_data & 0x00ff);
166      if ((data & 0xff00) == 0)
167         data = (data & 0x00ff) | (old_data & 0xff00);
168
169      COMBINE_DATA(&m68k_framebuffer[fb][offset]);
179170   }
171   else
172   {
173      COMBINE_DATA(&m68k_framebuffer[fb][offset]);
174   }
180175}
181176
182177static READ16_HANDLER( control_1_r )
r4184r4185
189184   return (input_port_read(space->machine, "IN1") << 8);
190185}
191186
187static READ16_HANDLER( control_3_r )
188{
189   return (input_port_read(space->machine, "IN2") << 8);
190}
191
192192static void wiggle_i860_common(int n, UINT16 data, const device_config *device)
193193{
194194   int bus_hold = (data & 0x03) == 0x03;
r4184r4185
245245{
246246   /* The frame buffer seems to sit on a 32-bit data bus, while the
247247       i860 uses a 64-bit data bus.  Adjust accordingly.  */
248   char *p = (char *)framebuffer_main;
248   char *p = (char *)(i860_framebuffer[0][0]);
249249   int m = mem_mask;
250250   int o = (offset << 2);
251251   if (m & 0xff000000) {
r4184r4185
268268{
269269   /* The frame buffer seems to sit on a 32-bit data bus, while the
270270       i860 uses a 64-bit data bus.  Adjust accordingly.  */
271   char *p = (char *)framebuffer_secondary;
271   char *p = (char *)(i860_framebuffer[1][0]);
272272   int m = mem_mask;
273273   int o = (offset << 2);
274274   if (m & 0xff000000) {
r4184r4185
285285   }
286286}
287287
288static WRITE16_HANDLER( crtc_w )
289{
290   const device_config *crtc = device_list_find_by_tag(space->machine->config->devicelist, MC6845, "crtc");
288291
292   if (crtc == NULL)
293      return;
294
295   if (crtc_select == 0)
296      mc6845_address_w(crtc, 0, data >> 8);
297   else
298      mc6845_register_w(crtc, 0, data >> 8);
299
300   crtc_select ^= 1;
301}
302
303static WRITE16_HANDLER( dac_w )
304{
305   INT16 newval = ((INT16)data - 0x6000) << 2;
306   dac_signed_data_16_w(0, newval + 0x8000);
307}
308
289309static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
290310   AM_RANGE(0x000000, 0x0fffff) AM_ROM
291   AM_RANGE(0x200000, 0x2fffff) AM_RAM
292   AM_RANGE(0x300000, 0x30ffff) AM_RAM_WRITE(main_video_write)
311   AM_RANGE(0x200000, 0x20ffff) AM_RAM
312   AM_RANGE(0x300000, 0x30ffff) AM_WRITE(main_video_write)
293313
294314   AM_RANGE(0x400000, 0x43ffff) AM_RAM AM_BASE(&vid_0_shared_RAM) AM_SHARE(2)   /* First i860 shared RAM */
295315   AM_RANGE(0x440000, 0x440003) AM_RAM AM_SHARE(6)      /* M0->P0 i860 #1 com 1 */
r4184r4185
304324   AM_RANGE(0x600000, 0x600001) AM_READ(control_1_r)   /* IN0 port */
305325   AM_RANGE(0x600004, 0x600005) AM_RAM AM_SHARE(5)      /* M0<-M1 */
306326   AM_RANGE(0x600008, 0x600009) AM_READ(control_2_r)   /* IN1 port */
307   /* AM_RANGE(0x60000c, 0x60000d)                        See notes at top of driver.  */
308   /* AM_RANGE(0x600010, 0x600011)                        See notes at top of driver.  */
309   AM_RANGE(0x700000, 0x7007ff) AM_RAM               /* TODO: Non-volatile RAM */
327   AM_RANGE(0x60001c, 0x60001d) AM_NOP
328
329   AM_RANGE(0x60000c, 0x60000d) AM_WRITE(crtc_w)
330   AM_RANGE(0x600010, 0x600011) AM_RAM AM_BASE(&framebuffer_ctrl)
331   AM_RANGE(0x700000, 0x7007ff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
310332   AM_RANGE(0x701000, 0x701001) AM_READ(main_irqiack_r)
333   AM_RANGE(0x702000, 0x702001) AM_READ(control_3_r)
311334   AM_RANGE(0x705000, 0x705001) AM_RAM AM_SHARE(4)      /* M1->M0 */
312335
313336   //AM_RANGE(0x703000, 0x703001)      /* Headset rotation axis? */
r4184r4185
342365/* Sound CPU */
343366static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 )
344367   AM_RANGE(0x000000, 0x03ffff) AM_ROM
345   AM_RANGE(0x081000, 0x081fff) AM_RAM
368   AM_RANGE(0x080000, 0x08ffff) AM_RAM
369   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(dac_w)
346370   AM_RANGE(0x140000, 0x140001) AM_READ(sound_resetmain_r)   /* Ping M0's reset line */
347371   AM_RANGE(0x180000, 0x180001) AM_RAM AM_SHARE(4)   /* M1<-M0 */
348   AM_RANGE(0x1C0000, 0x1C0001) AM_RAM AM_SHARE(5)   /* M1->M0 */
372   AM_RANGE(0x1c0000, 0x1c0001) AM_RAM AM_SHARE(5)   /* M1->M0 */
373   AM_RANGE(0x200000, 0x37ffff) AM_ROM AM_REGION("samples", 0)
349374ADDRESS_MAP_END
350375
351376
r4184r4185
356381
357382   i860_set_pin(cputag_get_cpu(machine, "vid_0")->token, DEC_PIN_BUS_HOLD, 1);
358383   i860_set_pin(cputag_get_cpu(machine, "vid_1")->token, DEC_PIN_BUS_HOLD, 1);
384
385   crtc_select = 0;
359386}
360387
361388static MACHINE_RESET( shadfgtr )
r4184r4185
364391   tlc34076_reset(6);
365392
366393   i860_set_pin(cputag_get_cpu(machine, "vid_0")->token, DEC_PIN_BUS_HOLD, 1);
394
395   crtc_select = 0;
367396}
368397
369398
r4184r4185
396425   memory_set_direct_update_handler(cputag_get_address_space(machine, "vid_0", ADDRESS_SPACE_PROGRAM), vid_0_direct_handler);
397426   memory_set_direct_update_handler(cputag_get_address_space(machine, "vid_1", ADDRESS_SPACE_PROGRAM), vid_1_direct_handler);
398427
399   /* Allocate the two framebuffers */
400   framebuffer_main = auto_malloc(0x10000 * sizeof(UINT16));
401   framebuffer_secondary = auto_malloc(0x10000 * sizeof(UINT16));
428   /* Allocate the 68000 framebuffers */
429   m68k_framebuffer[0] = auto_malloc(0x8000 * sizeof(UINT16));
430   m68k_framebuffer[1] = auto_malloc(0x8000 * sizeof(UINT16));
402431
432   /* First i860 */
433   i860_framebuffer[0][0] = auto_malloc(0x8000 * sizeof(UINT16));
434   i860_framebuffer[0][1] = auto_malloc(0x8000 * sizeof(UINT16));
435
436   /* Second i860 */
437   i860_framebuffer[1][0] = auto_malloc(0x8000 * sizeof(UINT16));
438   i860_framebuffer[1][1] = auto_malloc(0x8000 * sizeof(UINT16));
439
403440   /* pc==4016 : jump 4038 ... There's something strange about how it waits at 402e (interrupts all masked out)
404441       I think what is happening here is that M0 snags the first time
405442       it hits this point based on a counter test just above this
r4184r4185
418455
419456static DRIVER_INIT( shadfgtr )
420457{
421   /* Allocate just one framebuffer */
422   framebuffer_main = auto_malloc(0x10000 * sizeof(UINT16));
423   framebuffer_secondary = NULL;
458   /* Allocate th 68000 frame buffers */
459   m68k_framebuffer[0] = auto_malloc(0x8000 * sizeof(UINT16));
460   m68k_framebuffer[1] = auto_malloc(0x8000 * sizeof(UINT16));
424461
462   /* Only one i860 */
463   i860_framebuffer[0][0] = auto_malloc(0x8000 * sizeof(UINT16));
464   i860_framebuffer[0][1] = auto_malloc(0x8000 * sizeof(UINT16));
465   i860_framebuffer[1][0] = NULL;
466   i860_framebuffer[1][1] = NULL;
467
425468   /* The i860 executes out of RAM */
426469   memory_set_direct_update_handler(cputag_get_address_space(machine, "vid_0", ADDRESS_SPACE_PROGRAM), vid_0_direct_handler);
427470}
r4184r4185
451494
452495
453496static INPUT_PORTS_START( shadfgtr )
497   /* Check me */
454498   PORT_START("IN0")
455   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
456   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
457   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
458   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
459   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY /* ? */
460   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY /* ? */
461   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
462   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
499   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
500   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
501   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
502   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
503   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
504   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
505   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
506   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
463507
464508   PORT_START("IN1")
465509   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
r4184r4185
470514   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE )
471515   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
472516   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
517
518   /* Check me */
519   PORT_START("IN2")
520   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
521   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
522   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
523   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
524   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
525   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
526   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
527   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
473528INPUT_PORTS_END
474529
475530
531static MC6845_ON_HSYNC_CHANGED(sound_update)
532{
533   /* Seems reasonable */
534   cpu_set_input_line(cputag_get_cpu(device->machine, "sound"), M68K_IRQ_1, hsync ? ASSERT_LINE : CLEAR_LINE);
535}
536
537static const mc6845_interface mc6845_intf =
538{
539   "main",      /* screen we are acting on */
540   16,         /* number of pixels per video memory address */
541   NULL,      /* before pixel update callback */
542   NULL,      /* row update callback */
543   NULL,      /* after pixel update callback */
544   NULL,      /* callback for display state changes */
545   sound_update,      /* HSYNC callback */
546   NULL      /* VSYNC callback */
547};
548
549
476550static MACHINE_DRIVER_START( vcombat )
477551   MDRV_CPU_ADD("main", M68000, XTAL_12MHz)
478552   MDRV_CPU_PROGRAM_MAP(main_map,0)
r4184r4185
489563   /* Sound CPU */
490564   MDRV_CPU_ADD("sound", M68000, XTAL_12MHz)
491565   MDRV_CPU_PROGRAM_MAP(sound_map,0)
566   MDRV_CPU_PERIODIC_INT(irq1_line_hold, 15000)   /* Remove this if MC6845 is enabled */
492567
568   MDRV_NVRAM_HANDLER(generic_0fill)
493569   MDRV_MACHINE_RESET(vcombat)
494570
495571/* Temporary hack for experimenting with timing. */
r4184r4185
498574   MDRV_QUANTUM_PERFECT_CPU("main")
499575#endif
500576
577   /* Disabled for now as it can't handle multiple screens */
578//  MDRV_MC6845_ADD("crtc", MC6845, 6000000 / 16, mc6845_intf)
579   MDRV_DEFAULT_LAYOUT(layout_dualhsxs)
580
501581   MDRV_SCREEN_ADD("main", RASTER)
502   MDRV_SCREEN_REFRESH_RATE(50)
503   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
504582   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
505   MDRV_SCREEN_SIZE(640, 480)
506   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
583   MDRV_SCREEN_RAW_PARAMS(XTAL_12MHz / 2, 400, 0, 256, 291, 0, 208)
507584
585   MDRV_SCREEN_ADD("aux", RASTER)
586   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
587   MDRV_SCREEN_RAW_PARAMS(XTAL_12MHz / 2, 400, 0, 256, 291, 0, 208)
588
508589   MDRV_VIDEO_UPDATE(vcombat)
590
591   MDRV_SPEAKER_STANDARD_MONO("mono")
592
593   MDRV_SOUND_ADD("dac", DAC, 0)
594   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
509595MACHINE_DRIVER_END
510596
511597
r4184r4185
522608   MDRV_CPU_ADD("sound", M68000, XTAL_12MHz)
523609   MDRV_CPU_PROGRAM_MAP(sound_map,0)
524610
611   MDRV_NVRAM_HANDLER(generic_0fill)
525612   MDRV_MACHINE_RESET(shadfgtr)
526613
614   MDRV_MC6845_ADD("crtc", MC6845, XTAL_20MHz / 4 / 16, mc6845_intf)
615
527616   MDRV_SCREEN_ADD("main", RASTER)
528   MDRV_SCREEN_REFRESH_RATE(60)
529   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
530617   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
531   MDRV_SCREEN_SIZE(640, 480)
532   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
618   MDRV_SCREEN_RAW_PARAMS(XTAL_20MHz / 4, 320, 0, 256, 277, 0, 224)
533619
534620   MDRV_VIDEO_UPDATE(vcombat)
621
622   MDRV_SPEAKER_STANDARD_MONO("mono")
623
624   MDRV_SOUND_ADD("dac", DAC, 0)
625   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
535626MACHINE_DRIVER_END
536627
537628
538/* Perhaps add this to the core romload.h file?  */
539#define ROM_LOAD64_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6))
540
541629ROM_START( vcombat )
542630   ROM_REGION( 0x100000, "main", 0 )
543631   ROM_LOAD16_BYTE( "ep8v2.b49", 0x00000, 0x80000, CRC(98d5a45d) SHA1(099e314f11c93ad6e642ceaa311e2a5b6fd7193c) )
r4184r4185
577665   ROM_LOAD16_BYTE( "shadfgtr.b42", 0x00000, 0x20000, CRC(f8605dcd) SHA1(1b29f47856ccc757bc96674682ae48f87e6b0e54) )
578666   ROM_LOAD16_BYTE( "shadfgtr.b33", 0x00001, 0x20000, CRC(291d59ac) SHA1(cc4904c2ac8ef6a12033c10893246a438ac44014) )
579667
580   ROM_REGION( 0x100000, "samples", 0 )
668   ROM_REGION( 0x180000, "samples", 0 )
581669   ROM_LOAD16_BYTE( "shadfgtr.b41", 0x00000, 0x80000, CRC(9e4b4df3) SHA1(8101197275e9f728acdeef85737eecbdec132b27) )
582670   ROM_LOAD16_BYTE( "shadfgtr.b37", 0x00001, 0x80000, CRC(98446ba2) SHA1(1c8cc0d9c5de54d9e53699a5ab281579d15edc96) )
583671
r4184r4185
596684ROM_END
597685
598686/*    YEAR  NAME      PARENT  MACHINE   INPUT     INIT      MONITOR COMPANY      FULLNAME           FLAGS */
599GAME( 1993, vcombat,  0,      vcombat,  vcombat,  vcombat,  ORIENTATION_FLIP_X,  "VR8 Inc.",     "Virtual Combat",  GAME_NOT_WORKING | GAME_NO_SOUND )
600GAME( 1989, shadfgtr, 0,      shadfgtr, shadfgtr, shadfgtr, ROT0,                "DUTECH Inc.",  "Shadow Fighters", GAME_NOT_WORKING | GAME_NO_SOUND )
687GAME( 1993, vcombat,  0,      vcombat,  vcombat,  vcombat,  ORIENTATION_FLIP_X,  "VR8 Inc.",     "Virtual Combat",  GAME_NOT_WORKING )
688GAME( 1993, shadfgtr, 0,      shadfgtr, shadfgtr, shadfgtr, ROT0,                "DUTECH Inc.",  "Shadow Fighters", GAME_NOT_WORKING )
src/mame/drivers/guab.c
r4184r4185
1414        * Suit Pursuit
1515        * Treasure Trail?
1616
17    Known bugs:
18        * Neither game registers coins. Protection maybe?
17    Known issues:
18        * Neither game registers coins and I can't find where the credit
19        count gets updated in the code. Each game requires a unique
20        security PAL - maybe this is related? I'm poking the coin values
21        directly into RAM for now.
1922
2023***************************************************************************/
2124
r4184r4185
558561      }
559562      default:
560563      {
564         mame_printf_debug("Unknown IO R:0x%x\n", 0xc0000 + (offset * 2));
561565         return 0;
562566      }
563567   }
564568}
565569
570static INPUT_CHANGED( coin_inserted )
571{
572   if (newval == 0)
573   {
574      UINT32 credit;
575      const address_space *space = cpu_get_address_space(field->port->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
566576
577      /* Get the current credit value and add the new coin value */
578      credit = memory_read_dword(space, 0x8002c) + (UINT32)(FPTR)param;
579      memory_write_dword(space, 0x8002c, credit);
580   }
581}
582
567583/****************************************
568584 *
569585 *  Hardware outputs (lamps, meters etc)
r4184r4185
664680
665681static INPUT_PORTS_START( guab )
666682   PORT_START("IN0")
667   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_NAME("50p")
668   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_NAME("100p")
669   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Back door")  PORT_CODE(KEYCODE_R) PORT_TOGGLE
670   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Cash door")  PORT_CODE(KEYCODE_T) PORT_TOGGLE
683   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_NAME("50p") PORT_CHANGED(coin_inserted, (void *)50)
684   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_NAME("100p") PORT_CHANGED(coin_inserted, (void *)100)
685   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Back door") PORT_CODE(KEYCODE_R) PORT_TOGGLE
686   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Cash door") PORT_CODE(KEYCODE_T) PORT_TOGGLE
671687   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key switch") PORT_CODE(KEYCODE_Y) PORT_TOGGLE
672688   PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNUSED )  PORT_NAME("50p level")
673689   PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_UNUSED )  PORT_NAME("100p level")
r4184r4185
690706   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
691707   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("C")
692708   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("D")
693   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_NAME("10p")
694   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_NAME("20p")
709   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_NAME("10p") PORT_CHANGED(coin_inserted, (void *)10)
710   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_NAME("20p") PORT_CHANGED(coin_inserted, (void *)20)
695711INPUT_PORTS_END
696712
697713static INPUT_PORTS_START( tenup )
698714   PORT_START("IN0")
699   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_NAME("50p")
700   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_NAME("100p")
701   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Back door")  PORT_CODE(KEYCODE_R) PORT_TOGGLE
702   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Cash door")  PORT_CODE(KEYCODE_T) PORT_TOGGLE
715   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_NAME("50p") PORT_CHANGED(coin_inserted, (void *)50)
716   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_NAME("100p") PORT_CHANGED(coin_inserted, (void *)100)
717   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Back door") PORT_CODE(KEYCODE_R) PORT_TOGGLE
718   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Cash door") PORT_CODE(KEYCODE_T) PORT_TOGGLE
703719   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key switch") PORT_CODE(KEYCODE_Y) PORT_TOGGLE
704720   PORT_BIT( 0x20, IP_ACTIVE_HIGH,IPT_UNUSED )  PORT_NAME("10p level")
705721   PORT_BIT( 0x40, IP_ACTIVE_HIGH,IPT_UNUSED )  PORT_NAME("100p level")
r4184r4185
722738   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A")
723739   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B")
724740   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("C")
725   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_NAME("10p")
726   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_NAME("20p")
741   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_NAME("10p")  PORT_CHANGED(coin_inserted, (void *)10)
742   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_NAME("20p")  PORT_CHANGED(coin_inserted, (void *)20)
727743INPUT_PORTS_END
728744
729745
r4184r4185
830846 *
831847 *************************************/
832848
833GAME( 1986, guab,   0,     guab, guab,  0, ROT0, "JPM", "Give us a Break (6th edition)", GAME_NOT_WORKING )
834GAME( 1986, guab3,  guab,  guab, guab,  0, ROT0, "JPM", "Give us a Break (3rd edition)", GAME_NOT_WORKING )
835
836GAME( 1988, tenup,  0,     guab, tenup, 0, ROT0, "JPM", "Ten Up (compendium 17)",        GAME_NOT_WORKING )
837GAME( 1988, tenup3, tenup, guab, tenup, 0, ROT0, "JPM", "Ten Up (compendium 3)",         GAME_NOT_WORKING )
849GAME( 1986, guab,   0,     guab, guab,  0, ROT0, "JPM", "Give us a Break (6th edition)", 0 )
850GAME( 1986, guab3,  guab,  guab, guab,  0, ROT0, "JPM", "Give us a Break (3rd edition)", 0 )
851GAME( 1988, tenup,  0,     guab, tenup, 0, ROT0, "JPM", "Ten Up (compendium 17)",        0 )
852GAME( 1988, tenup3, tenup, guab, tenup, 0, ROT0, "JPM", "Ten Up (compendium 3)",         0 )
src/mame/drivers/sengokmj.c
r4184r4185
5656#include "cpu/nec/nec.h"
5757#include "audio/seibu.h"
5858#include "sound/3812intf.h"
59#include "includes/sei_crtc.h"
5960
60extern UINT16 *sengokmj_bgvram,*sengokmj_mdvram,*sengokmj_fgvram,*sengokmj_txvram;
61extern UINT16 *seibucrtc_sc0vram,*seibucrtc_sc1vram,*seibucrtc_sc2vram,*seibucrtc_sc3vram;
62extern UINT16 *seibucrtc_vregs;
63
6164static UINT16 sengokumj_mux_data;
65static UINT8 hopper_io;
6266
63WRITE16_HANDLER( sengokmj_bgvram_w );
64WRITE16_HANDLER( sengokmj_fgvram_w );
65WRITE16_HANDLER( sengokmj_mdvram_w );
66WRITE16_HANDLER( sengokmj_txvram_w );
67WRITE16_HANDLER( sengokmj_layer_enable_w );
68WRITE16_HANDLER( sengokmj_bg_scrolly_w );
69VIDEO_START( sengokmj );
70VIDEO_UPDATE( sengokmj );
71
7267/* Multiplexer device for the mahjong panel */
7368static READ16_HANDLER( mahjong_panel_r )
7469{
r4184r4185
9994   coin_lockout_w(0,~data & 2);
10095   coin_lockout_w(1,~data & 2);
10196   coin_counter_w(0,data & 4);
97   hopper_io = ((data & 1)<<6);
98//  popmessage("%02x",hopper_io);
10299}
103100
104101static WRITE16_HANDLER( seibu_z80_com_6_mirror_w )
r4184r4185
106103   seibu_main_word_w(space,6,data,0xffff);
107104}
108105
106static READ16_HANDLER( sengokmj_system_r )
107{
108   return (input_port_read(space->machine, "SYSTEM") & 0xffbf) | hopper_io;
109}
110
109111static ADDRESS_MAP_START( sengokmj_map, ADDRESS_SPACE_PROGRAM, 16 )
110112   AM_RANGE(0x00000, 0x07fff) AM_RAM
111113   AM_RANGE(0x08000, 0x09fff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
112   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(sengokmj_bgvram_w) AM_BASE(&sengokmj_bgvram)
113   AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(sengokmj_fgvram_w) AM_BASE(&sengokmj_fgvram)
114   AM_RANGE(0x0d000, 0x0d7ff) AM_RAM_WRITE(sengokmj_mdvram_w) AM_BASE(&sengokmj_mdvram)
115   AM_RANGE(0x0d800, 0x0e7ff) AM_RAM_WRITE(sengokmj_txvram_w) AM_BASE(&sengokmj_txvram)
114   AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(seibucrtc_sc0vram_w) AM_BASE(&seibucrtc_sc0vram)
115   AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(seibucrtc_sc1vram_w) AM_BASE(&seibucrtc_sc1vram)
116   AM_RANGE(0x0d000, 0x0d7ff) AM_RAM_WRITE(seibucrtc_sc2vram_w) AM_BASE(&seibucrtc_sc2vram)
117   AM_RANGE(0x0d800, 0x0e7ff) AM_RAM_WRITE(seibucrtc_sc3vram_w) AM_BASE(&seibucrtc_sc3vram)
116118   AM_RANGE(0x0e800, 0x0f7ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
117119   AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_BASE(&spriteram16)
118120   AM_RANGE(0xc0000, 0xfffff) AM_ROM
r4184r4185
121123static ADDRESS_MAP_START( sengokmj_io_map, ADDRESS_SPACE_IO, 16 )
122124   AM_RANGE(0x4000, 0x400f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
123125   /*Areas from 8000-804f are for the custom Seibu CRTC.*/
124//  AM_RANGE(0x8000, 0x800f) AM_WRITE(seibu_main_word_w)
125//  AM_RANGE(0x8010, 0x801b) AM_WRITENOP
126   AM_RANGE(0x801c, 0x801d) AM_WRITE(sengokmj_layer_enable_w)
127//  AM_RANGE(0x801e, 0x801f) AM_WRITENOP
128//  AM_RANGE(0x8020, 0x802f) AM_WRITENOP
129   AM_RANGE(0x8022, 0x8023) AM_WRITE(sengokmj_bg_scrolly_w)
130//  AM_RANGE(0x8030, 0x803f) AM_WRITENOP
131//  AM_RANGE(0x8040, 0x804f) AM_WRITENOP
126   AM_RANGE(0x8000, 0x804f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_BASE(&seibucrtc_vregs)
132127
133128   AM_RANGE(0x8080, 0x8081) AM_WRITE(seibu_z80_com_6_mirror_w)
134129//  AM_RANGE(0x80c0, 0x80c1) AM_WRITE(seibu_z80_com_unk_mirror_w)
r4184r4185
137132   AM_RANGE(0x8140, 0x8141) AM_WRITE(mahjong_panel_w)
138133   AM_RANGE(0xc000, 0xc001) AM_READ_PORT("DSW1")
139134   AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r)
140   AM_RANGE(0xc004, 0xc005) AM_READ_PORT("DSW2") //switches
135   AM_RANGE(0xc004, 0xc005) AM_READ(sengokmj_system_r) //switches
141136ADDRESS_MAP_END
142137
143138
r4184r4185
145140   SEIBU_COIN_INPUTS   /* coin inputs read through sound cpu */
146141
147142   PORT_START("DSW1")
148   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) )
143   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) )  PORT_DIPLOCATION("SW1:1")
149144   PORT_DIPSETTING(     0x0001, DEF_STR( Off ) )
150145   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
151   PORT_DIPNAME( 0x0002, 0x0002, "Re-start" )
146   PORT_DIPNAME( 0x0002, 0x0002, "Re-start" )  PORT_DIPLOCATION("SW1:2")
152147   PORT_DIPSETTING(     0x0002, DEF_STR( Off ) )
153148   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
154   PORT_DIPNAME( 0x0004, 0x0004, "Double G" )
149   PORT_DIPNAME( 0x0004, 0x0004, "Double G" )  PORT_DIPLOCATION("SW1:3")
155150   PORT_DIPSETTING(     0x0004, DEF_STR( Off ) )
156151   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
157   PORT_DIPNAME( 0x0008, 0x0008, "Double L" )
152   PORT_DIPNAME( 0x0008, 0x0008, "Double L" )  PORT_DIPLOCATION("SW1:4")
158153   PORT_DIPSETTING(     0x0008, DEF_STR( Off ) )
159154   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
160   PORT_DIPNAME( 0x0010, 0x0010, "Kamon" )
155   PORT_DIPNAME( 0x0010, 0x0010, "Kamon" )  PORT_DIPLOCATION("SW1:5")
161156   PORT_DIPSETTING(     0x0010, DEF_STR( Off ) )
162157   PORT_DIPSETTING(        0x0000, DEF_STR( On ) )
163   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) )
164   PORT_DIPSETTING(     0x0020, DEF_STR( Off ) )
165   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
166   PORT_DIPNAME( 0x0040, 0x0040, "Out Sw" )
158   PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0020, "SW1:6" )
159   PORT_DIPNAME( 0x0040, 0x0040, "Out Sw" ) PORT_DIPLOCATION("SW1:7")
167160   PORT_DIPSETTING(     0x0040, DEF_STR( Off ) )
168161   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
169   PORT_DIPNAME( 0x0080, 0x0080, "Hopper" )
162   PORT_DIPNAME( 0x0080, 0x0000, "Hopper" ) PORT_DIPLOCATION("SW1:8") //game gives hopper error with this off.
170163   PORT_DIPSETTING(     0x0080, DEF_STR( Off ) )
171164   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
172165   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
r4184r4185
182175   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
183176   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
184177
185
186178   PORT_START("KEY1")
187179   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_B )
188180   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_F )
r4184r4185
230222   PORT_START("UNUSED")
231223   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
232224
233   PORT_START("DSW2")
225   PORT_START("SYSTEM")
234226   PORT_DIPNAME( 0x0001, 0x0001, "Door" )
235227   PORT_DIPSETTING(     0x0001, DEF_STR( Off ) )
236228   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
r4184r4185
247239   PORT_DIPNAME( 0x0020, 0x0020, "Cash" )
248240   PORT_DIPSETTING(      0x0020, DEF_STR( Off ) )
249241   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
250   /* Used, causes "Hopper RunAway" message if you toggle it */
251   PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
252   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
253   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
242//  0x40 Hopper
254243   PORT_DIPNAME( 0x0080, 0x0080, "Meter" )
255244   PORT_DIPSETTING(     0x0080, DEF_STR( Off ) )
256245   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
r4184r4185
314303   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
315304   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
316305   MDRV_SCREEN_SIZE(64*8, 32*8)
317   MDRV_SCREEN_VISIBLE_AREA(16*8, 56*8-1, 2*8, 32*8-1)
306   MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) //TODO: dynamic resolution
318307
319308   MDRV_GFXDECODE(sengokmj)
320309   MDRV_PALETTE_LENGTH(0x800)
321310
322   MDRV_VIDEO_START(sengokmj)
323   MDRV_VIDEO_UPDATE(sengokmj)
311   MDRV_VIDEO_START(seibu_crtc)
312   MDRV_VIDEO_UPDATE(seibu_crtc)
324313
325314   /* sound hardware */
326315   SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(14318180/4,1320000)
src/mame/drivers/genesis.c
r4184r4185
501501
502502/* Z80 Sound Hardware - based on MESS code, to be improved, it can do some strange things */
503503
504#ifdef LSB_FIRST
505   #define BYTE_XOR(a) ((a) ^ 1)
506#else
507   #define BYTE_XOR(a) (a)
508#endif
509504
510
511
512505static WRITE8_HANDLER ( genesis_bank_select_w ) /* note value will be meaningless unless all bits are correctly set in */
513506{
514507   if (offset !=0 ) return;
r4184r4185
613606   logerror("z80 read from address %x\n", address);
614607
615608   /* Read the data out of the 68k ROM */
616   if (base != NULL && address < 0x400000) return base[BYTE_XOR(address)];
609   if (base != NULL && address < 0x400000) return base[BYTE_XOR_BE(address)];
617610   /* else read the data out of the 68k RAM */
618//  else if (address > 0xff0000) return genesis_68k_ram[BYTE_XOR(offset)];
611//  else if (address > 0xff0000) return genesis_68k_ram[BYTE_XOR_BE(offset)];
619612
620613   return -1;
621614}
src/emu/romload.h
r4184r4185
234234#define ROM_LOAD32_WORD(name,offset,length,hash)   ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(2))
235235#define ROM_LOAD32_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2))
236236#define ROM_LOAD32_DWORD(name,offset,length,hash)   ROMX_LOAD(name, offset, length, hash, ROM_GROUPDWORD)
237#define ROM_LOAD64_WORD(name,offset,length,hash)   ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6))
238#define ROM_LOAD64_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6))
237239
240
238241/* ----- ROM_RELOAD related macros ----- */
239242#define ROM_RELOAD(offset,length)               { NULL, NULL, offset, length, ROMENTRYTYPE_RELOAD | ROM_INHERITFLAGS },
240243#define ROM_RELOAD_PLAIN(offset,length)               { NULL, NULL, offset, length, ROMENTRYTYPE_RELOAD },
src/emu/debug/debugvw.c
r4184r4185
24672467         subview->index = curindex++;
24682468         subview->base = memory_region(machine, rgntag);
24692469         subview->length = memory_region_length(machine, rgntag);
2470#ifdef LSB_FIRST
2471         subview->offsetxor = width - 1;
2472#else
2473         subview->offsetxor = 0;
2474#endif
2470         subview->offsetxor = NATIVE_ENDIAN_VALUE_LE_BE(width - 1, 0);
24752471         subview->endianness = little_endian ? ENDIANNESS_LITTLE : ENDIANNESS_BIG;
24762472         subview->prefsize = MIN(width, 8);
24772473         strcpy(subview->name, astring_c(tempstring));
r4184r4185
25102506         subview->base = base;
25112507         subview->length = valcount * valsize;
25122508         subview->offsetxor = 0;
2513#ifdef LSB_FIRST
2514         subview->endianness = ENDIANNESS_LITTLE;
2515#else
2516         subview->endianness = ENDIANNESS_BIG;
2517#endif
2509         subview->endianness = ENDIANNESS_NATIVE;
25182510         subview->prefsize = MIN(valsize, 8);
25192511         strcpy(subview->name, astring_c(tempstring));
25202512
r4184r4185
33363328   debug_view_memory *memdata = view->extra_data;
33373329
33383330   assert(view->type == DVT_MEMORY);
3339   assert(rowchunks > 0);
33403331
3332   if (rowchunks < 1)
3333      return;
3334
33413335   if (rowchunks != memdata->chunks_per_row)
33423336   {
33433337      offs_t address;
src/emu/debug/express.c
r4184r4185
10771077   int tokindex = 0;
10781078   EXPRERR exprerr;
10791079
1080   memset(&dummy, 0, sizeof(dummy));
1081
10801082   /* start with an empty stack */
10811083   init_token_stack(expr);
10821084
r4184r4185
11991201   parse_token t1;
12001202   EXPRERR exprerr;
12011203
1204   memset(&t1, 0, sizeof(t1));
1205
12021206   /* pop off all pushed parameters */
12031207   while (paramcount < MAX_FUNCTION_PARAMS)
12041208   {
src/emu/cpu/drcfe.c
r4184r4185
148148   drcfe->program = memory_find_address_space(cpu, ADDRESS_SPACE_PROGRAM);
149149   drcfe->pageshift = cpu_get_page_shift(cpu, ADDRESS_SPACE_PROGRAM);
150150   drcfe->translate = (cpu_translate_func)device_get_info_fct(cpu, CPUINFO_FCT_TRANSLATE);
151#ifdef LSB_FIRST
152   if (cpu_get_endianness(cpu) == ENDIANNESS_BIG)
153#else
154   if (cpu_get_endianness(cpu) == ENDIANNESS_LITTLE)
155#endif
151   if (cpu_get_endianness(cpu) != ENDIANNESS_NATIVE)
156152      drcfe->codexor = (cpu_get_databus_width(cpu, ADDRESS_SPACE_PROGRAM) / 8 / cpu_get_min_opcode_bytes(cpu) - 1) * cpu_get_min_opcode_bytes(cpu);
157153
158154   return drcfe;
r4184r4185
291287   desc->physpc = curpc;
292288   desc->targetpc = BRANCH_TARGET_DYNAMIC;
293289
294   /* compute the physical PC */
295   if (drcfe->translate != NULL && !(*drcfe->translate)(drcfe->device, ADDRESS_SPACE_PROGRAM, TRANSLATE_FETCH, &desc->physpc))
296   {
297      /* uh-oh: a page fault; leave the description empty and just if this is the first instruction, leave it empty and */
298      /* mark as needing to validate; otherwise, just end the sequence here */
299      desc->flags |= OPFLAG_VALIDATE_TLB | OPFLAG_CAN_CAUSE_EXCEPTION | OPFLAG_COMPILER_PAGE_FAULT | OPFLAG_VIRTUAL_NOOP | OPFLAG_END_SEQUENCE;
300      return desc;
301   }
302
303   /* get a pointer to the physical address */
304   desc->opptr.v = memory_decrypted_read_ptr(drcfe->program, desc->physpc ^ drcfe->codexor);
305   assert(desc->opptr.v != NULL);
306   if (desc->opptr.v == NULL)
307   {
308      /* address is unmapped; report it as such */
309      desc->flags |= OPFLAG_VALIDATE_TLB | OPFLAG_CAN_CAUSE_EXCEPTION | OPFLAG_COMPILER_UNMAPPED | OPFLAG_VIRTUAL_NOOP | OPFLAG_END_SEQUENCE;
310      return desc;
311   }
312
313290   /* call the callback to describe an instruction */
314291   if (!(*drcfe->describe)(drcfe->param, desc, prevdesc))
315292   {
src/emu/cpu/drcfe.h
r4184r4185
105105   offs_t         physpc;               /* physical PC of this opcode */
106106   offs_t         targetpc;            /* target PC if we are a branch, or BRANCH_TARGET_DYNAMIC */
107107
108   /* pointer to the current opcode */
108   /* copy of up to 16 bytes of opcode */
109109   union
110110   {
111      void *      v;
112      UINT8 *      b;
113      UINT16 *   w;
114      UINT32 *   l;
115      UINT64 *   q;
111      UINT8      b[16];
112      UINT16      w[8];
113      UINT32      l[4];
114      UINT64      q[2];
116115   } opptr;                        /* pointer to opcode memory */
117116
118117   /* information about this instruction's execution */
src/emu/cpu/i860/i860dec.c
r4184r4185
4242#include <math.h>
4343
4444
45#ifdef LSB_FIRST
4645#undef HOST_MSB
47#else
48#define HOST_MSB
49#endif
5046
51
5247#undef  TRACE_RDWR_MEM
5348#undef  TRACE_ADDR_TRANSLATION
5449#undef  TRACE_PAGE_FAULT
src/emu/cpu/powerpc/ppcdrc.c
r4184r4185
20602060   {
20612061      if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP))
20622062      {
2063         UML_LOAD(block, IREG(0), seqhead->opptr.l, IMM(0), DWORD);                  // load    i0,*opptr,dword
2064         UML_CMP(block, IREG(0), IMM(*seqhead->opptr.l));                        // cmp     i0,*opptr
2063         void *base = memory_decrypted_read_ptr(ppc->program, seqhead->physpc);
2064         UML_LOAD(block, IREG(0), base, IMM(0), DWORD);                           // load    i0,base,dword
2065         UML_CMP(block, IREG(0), IMM(seqhead->opptr.l[0]));                        // cmp     i0,*opptr
20652066         UML_EXHc(block, IF_NE, ppc->impstate->nocode, IMM(seqhead->pc));            // exne    nocode,seqhead->pc
20662067      }
20672068   }
r4184r4185
20732074      for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
20742075         if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
20752076         {
2076            UML_LOAD(block, IREG(0), curdesc->opptr.l, IMM(0), DWORD);               // load    i0,*opptr,dword
2077            UML_CMP(block, IREG(0), IMM(*curdesc->opptr.l));                     // cmp     i0,*opptr
2077            void *base = memory_decrypted_read_ptr(ppc->program, seqhead->physpc);
2078            UML_LOAD(block, IREG(0), base, IMM(0), DWORD);                        // load    i0,base,dword
2079            UML_CMP(block, IREG(0), IMM(curdesc->opptr.l[0]));                     // cmp     i0,*opptr
20782080            UML_EXHc(block, IF_NE, ppc->impstate->nocode, IMM(seqhead->pc));         // exne    nocode,seqhead->pc
20792081         }
20802082#else
20812083      UINT32 sum = 0;
2082      UML_LOAD(block, IREG(0), seqhead->opptr.l, IMM(0), DWORD);                     // load    i0,*opptr,dword
2083      sum += *seqhead->opptr.l;
2084      void *base = memory_decrypted_read_ptr(ppc->program, seqhead->physpc);
2085      UML_LOAD(block, IREG(0), base, IMM(0), DWORD);                              // load    i0,base,dword
2086      sum += seqhead->opptr.l[0];
20842087      for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
20852088         if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
20862089         {
2087            UML_LOAD(block, IREG(1), curdesc->opptr.l, IMM(0), DWORD);               // load    i1,*opptr,dword
2090            base = memory_decrypted_read_ptr(ppc->program, curdesc->physpc);
2091            UML_LOAD(block, IREG(1), base, IMM(0), DWORD);                        // load    i1,base,dword
20882092            UML_ADD(block, IREG(0), IREG(0), IREG(1));                           // add     i0,i0,i1
2089            sum += *curdesc->opptr.l;
2093            sum += curdesc->opptr.l[0];
20902094         }
20912095      UML_CMP(block, IREG(0), IMM(sum));                                       // cmp     i0,sum
20922096      UML_EXHc(block, IF_NE, ppc->impstate->nocode, IMM(seqhead->pc));               // exne    nocode,seqhead->pc
r4184r4185
21062110
21072111   /* add an entry for the log */
21082112   if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
2109      log_add_disasm_comment(block, desc->pc, *desc->opptr.l);
2113      log_add_disasm_comment(block, desc->pc, desc->opptr.l[0]);
21102114
21112115   /* set the PC map variable */
21122116   UML_MAPVAR(block, MAPVAR_PC, desc->pc);                                       // mapvar  PC,desc->pc
r4184r4185
21162120
21172121   /* is this a hotspot? */
21182122   for (hotnum = 0; hotnum < PPC_MAX_HOTSPOTS; hotnum++)
2119      if (ppc->impstate->hotspot[hotnum].pc != 0 && desc->pc == ppc->impstate->hotspot[hotnum].pc && *desc->opptr.l == ppc->impstate->hotspot[hotnum].opcode)
2123      if (ppc->impstate->hotspot[hotnum].pc != 0 && desc->pc == ppc->impstate->hotspot[hotnum].pc && desc->opptr.l[0] == ppc->impstate->hotspot[hotnum].opcode)
21202124      {
21212125         compiler->cycles += ppc->impstate->hotspot[hotnum].cycles;
21222126         break;
r4184r4185
22102214      if (!generate_opcode(ppc, block, compiler, desc))
22112215      {
22122216         UML_MOV(block, MEM(&ppc->pc), IMM(desc->pc));                           // mov     [pc],desc->pc
2213         UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(*desc->opptr.l));               // mov     [arg0],*desc->opptr.l
2217         UML_MOV(block, MEM(&ppc->impstate->arg0), IMM(desc->opptr.l[0]));            // mov     [arg0],*desc->opptr.l
22142218         UML_CALLC(block, cfunc_unimplemented, ppc);                              // callc   cfunc_unimplemented,ppc
22152219      }
22162220   }
r4184r4185
23612365
23622366static int generate_opcode(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
23632367{
2364   UINT32 op = *desc->opptr.l;
2368   UINT32 op = desc->opptr.l[0];
23652369   UINT32 opswitch = op >> 26;
23662370   int regnum;
23672371
r4184r4185
27452749
27462750static int generate_instruction_13(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
27472751{
2748   UINT32 op = *desc->opptr.l;
2752   UINT32 op = desc->opptr.l[0];
27492753   UINT32 opswitch = (op >> 1) & 0x3ff;
27502754
27512755   switch (opswitch)
r4184r4185
28822886
28832887static int generate_instruction_1f(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
28842888{
2885   UINT32 op = *desc->opptr.l;
2889   UINT32 op = desc->opptr.l[0];
28862890   UINT32 opswitch = (op >> 1) & 0x3ff;
28872891   int item;
28882892
r4184r4185
37303734
37313735static int generate_instruction_3b(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
37323736{
3733   UINT32 op = *desc->opptr.l;
3737   UINT32 op = desc->opptr.l[0];
37343738   UINT32 opswitch = (op >> 1) & 0x1f;
37353739
37363740   switch (opswitch)
r4184r4185
38223826
38233827static int generate_instruction_3f(powerpc_state *ppc, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
38243828{
3825   UINT32 op = *desc->opptr.l;
3829   UINT32 op = desc->opptr.l[0];
38263830   UINT32 opswitch = (op >> 1) & 0x3ff;
38273831
38283832   if (opswitch & 0x10)
r4184r4185
41694173         if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
41704174            strcpy(buffer, "<virtual nop>");
41714175         else
4172            ppc_dasm_one(buffer, desclist->pc, *desclist->opptr.l);
4176            ppc_dasm_one(buffer, desclist->pc, desclist->opptr.l[0]);
41734177      }
41744178      else
41754179         strcpy(buffer, "???");
src/emu/cpu/powerpc/ppcfe.c
r4184r4185
130130int ppcfe_describe(void *param, opcode_desc *desc, const opcode_desc *prev)
131131{
132132   powerpc_state *ppc = param;
133   UINT32 op = *desc->opptr.l;
134   UINT32 opswitch = op >> 26;
133   UINT32 op, opswitch;
135134   int regnum;
136135
136   /* compute the physical PC */
137   if (!ppccom_translate_address(ppc, ADDRESS_SPACE_PROGRAM, TRANSLATE_FETCH, &desc->physpc))
138   {
139      /* uh-oh: a page fault; leave the description empty and just if this is the first instruction, leave it empty and */
140      /* mark as needing to validate; otherwise, just end the sequence here */
141      desc->flags |= OPFLAG_VALIDATE_TLB | OPFLAG_CAN_CAUSE_EXCEPTION | OPFLAG_COMPILER_PAGE_FAULT | OPFLAG_VIRTUAL_NOOP | OPFLAG_END_SEQUENCE;
142      return TRUE;
143   }
144
145   /* fetch the opcode */
146   op = desc->opptr.l[0] = memory_decrypted_read_dword(ppc->program, desc->physpc);
147
137148   /* all instructions are 4 bytes and default to a single cycle each */
138149   desc->length = 4;
139150   desc->cycles = 1;
140151
141152   /* parse the instruction */
153   opswitch = op >> 26;
142154   switch (opswitch)
143155   {
144156      case 0x02:   /* TDI - 64-bit only */
src/emu/cpu/z8000/z8000cpu.h
r4184r4185
4949 * higher bit positions.
5050 * That's the reason for the ordering in the following pointer table.
5151 **************************************************************************/
52#ifdef LSB_FIRST
53#define RB(n)   regs.B[((((n) & 7) << 1) | (((n) & 8) >> 3)) ^ 7]
54#define RW(n)   regs.W[(n) ^ 3]
55#define RL(n)   regs.L[((n) >> 1) ^ 1]
56#define RQ(n)   regs.Q[((n) >> 2)]
57#else
58#define RB(n)   regs.B[(((n) & 7) << 1) | (((n) & 8) >> 3)]
59#define RW(n)   regs.W[(n)]
60#define RL(n)   regs.L[((n) >> 1)]
61#define RQ(n)   regs.Q[((n) >> 2)]
62#endif
52#define RB(n)   regs.B[BYTE8_XOR_BE((((n) & 7) << 1) | (((n) & 8) >> 3))]
53#define RW(n)   regs.W[BYTE4_XOR_BE(n)]
54#define RL(n)   regs.L[BYTE_XOR_BE((n) >> 1)]
55#define RQ(n)   regs.Q[(n) >> 2]
6356
6457/* the register used as stack pointer */
6558#define SP      15
src/emu/cpu/sh2/sh2comn.h
r4184r4185
2121#include "cpu/drcumlsh.h"
2222#endif
2323
24#define SH2_CODE_XOR(a)      ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(2,0))
25
2426typedef struct _irq_entry irq_entry;
2527struct _irq_entry
2628{
src/emu/cpu/sh2/sh2drc.c
r4184r4185
13761376      if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
13771377         strcpy(buffer, "<virtual nop>");
13781378      else
1379         DasmSH2(buffer, desclist->pc, *desclist->opptr.w);
1379         DasmSH2(buffer, desclist->pc, desclist->opptr.w[0]);
13801380#else
13811381      strcpy(buffer, "???");
13821382#endif
r4184r4185
15051505   {
15061506      if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP))
15071507      {
1508         UML_LOAD(block, IREG(0), seqhead->opptr.l, IMM(0), DWORD);            // load    i0,*opptr,0,dword
1509         UML_CMP(block, IREG(0), IMM(*seqhead->opptr.l));                  // cmp     i0,*opptr
1508         void *base = memory_decrypted_read_ptr(sh2->program, SH2_CODE_XOR(seqhead->physpc));
1509         UML_LOAD(block, IREG(0), base, IMM(0), WORD);                     // load    i0,base,word
1510         UML_CMP(block, IREG(0), IMM(seqhead->opptr.w[0]));                  // cmp     i0,*opptr
15101511         UML_EXHc(block, IF_NE, sh2->nocode, IMM(epc(seqhead)));      // exne    nocode,seqhead->pc
15111512      }
15121513   }
r4184r4185
15181519      for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
15191520         if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
15201521         {
1522            base = memory_decrypted_read_ptr(sh2->program, SH2_CODE_XOR(curdesc->physpc));
15211523            UML_LOAD(block, IREG(0), curdesc->opptr.w, IMM(0), WORD);         // load    i0,*opptr,0,word
1522            UML_CMP(block, IREG(0), IMM(*curdesc->opptr.w));               // cmp     i0,*opptr
1524            UML_CMP(block, IREG(0), IMM(curdesc->opptr.w[0]));               // cmp     i0,*opptr
15231525            UML_EXHc(block, IF_NE, sh2->nocode, IMM(epc(seqhead)));   // exne    nocode,seqhead->pc
15241526         }
15251527#else
15261528      UINT32 sum = 0;
1527      UML_LOAD(block, IREG(0), seqhead->opptr.l, IMM(0), DWORD);               // load    i0,*opptr,0,dword
1528      sum += *seqhead->opptr.l;
1529      void *base = memory_decrypted_read_ptr(sh2->program, SH2_CODE_XOR(seqhead->physpc));
1530      UML_LOAD(block, IREG(0), base, IMM(0), WORD);                        // load    i0,base,word
1531      sum += seqhead->opptr.w[0];
15291532      for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
15301533         if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
15311534         {
1532            UML_LOAD(block, IREG(1), curdesc->opptr.l, IMM(0), DWORD);         // load    i1,*opptr,dword
1535            base = memory_decrypted_read_ptr(sh2->program, SH2_CODE_XOR(curdesc->physpc));
1536            UML_LOAD(block, IREG(1), base, IMM(0), WORD);                  // load    i1,*opptr,word
15331537            UML_ADD(block, IREG(0), IREG(0), IREG(1));                     // add     i0,i0,i1
1534            sum += *curdesc->opptr.l;
1538            sum += curdesc->opptr.w[0];
15351539         }
15361540      UML_CMP(block, IREG(0), IMM(sum));                                 // cmp     i0,sum
15371541      UML_EXHc(block, IF_NE, sh2->nocode, IMM(epc(seqhead)));         // exne    nocode,seqhead->pc
r4184r4185
15511555
15521556   /* add an entry for the log */
15531557   if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
1554      log_add_disasm_comment(block, desc->pc, *desc->opptr.l);
1558      log_add_disasm_comment(block, desc->pc, desc->opptr.w[0]);
15551559
15561560   /* set the PC map variable */
15571561   expc = (desc->flags & OPFLAG_IN_DELAY_SLOT) ? desc->pc - 1 : desc->pc;
r4184r4185
16221626      if (!generate_opcode(sh2, block, compiler, desc))
16231627      {
16241628         UML_MOV(block, MEM(&sh2->pc), IMM(desc->pc));                     // mov     [pc],desc->pc
1625         UML_MOV(block, MEM(&sh2->arg0), IMM(*desc->opptr.w));               // mov     [arg0],opcode
1629         UML_MOV(block, MEM(&sh2->arg0), IMM(desc->opptr.w[0]));               // mov     [arg0],opcode
16261630         UML_CALLC(block, cfunc_unimplemented, sh2);                        // callc   cfunc_unimplemented
16271631      }
16281632   }
r4184r4185
16531657{
16541658   UINT32 scratch, scratch2;
16551659   INT32 disp;
1656   UINT16 opcode = *desc->opptr.w;
1660   UINT16 opcode = desc->opptr.w[0];
16571661   UINT8 opswitch = opcode >> 12;
16581662   int in_delay_slot = ((desc->flags & OPFLAG_IN_DELAY_SLOT) != 0);
16591663
r4184r4185
18301834   case 0x24: // MOVBS0(Rm, Rn);
18311835   case 0x34: // MOVBS0(Rm, Rn);
18321836      UML_ADD(block, IREG(0), R32(0), R32(Rn));      // add r0, R0, Rn
1833      UML_MOV(block, IREG(1), R32(Rm));         // mov r1, Rm
1834      UML_AND(block, IREG(1), IREG(1), IMM(0x000000ff));      // and r1, r1, 0xff
1837      UML_AND(block, IREG(1), R32(Rm), IMM(0x000000ff));      // and r1, Rm, 0xff
18351838      UML_CALLH(block, sh2->write8);            // call write8
18361839
18371840      if (!in_delay_slot)
r4184r4185
18431846   case 0x25: // MOVWS0(Rm, Rn);
18441847   case 0x35: // MOVWS0(Rm, Rn);
18451848      UML_ADD(block, IREG(0), R32(0), R32(Rn));      // add r0, R0, Rn
1846      UML_MOV(block, IREG(1), R32(Rm));         // mov r1, Rm
1847      UML_AND(block, IREG(1), IREG(1), IMM(0x0000ffff));     // and r1, r1, 0xffff
1849      UML_AND(block, IREG(1), R32(Rm), IMM(0x0000ffff));     // and r1, Rm, 0xffff
18481850      UML_CALLH(block, sh2->write16);            // call write16
18491851
18501852      if (!in_delay_slot)
r4184r4185
19341936      if (sh2->cpu_type > CPU_TYPE_SH1)
19351937      {
19361938         save_fast_iregs(sh2, block);
1937         UML_MOV(block, MEM(&sh2->arg0), IMM(*desc->opptr.w));
1939         UML_MOV(block, MEM(&sh2->arg0), IMM(desc->opptr.w[0]));
19381940         UML_CALLC(block, cfunc_MAC_L, sh2);
19391941         load_fast_iregs(sh2, block);
19401942         return TRUE;
r4184r4185
20542056   {
20552057   case  0: // MOVBS(Rm, Rn);
20562058      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2057      UML_MOV(block, IREG(1), R32(Rm));      // mov r1, Rm
2058      UML_AND(block, IREG(1), IREG(1), IMM(0xff));   // and r1, r1, 0xff
2059      UML_AND(block, IREG(1), R32(Rm), IMM(0xff));   // and r1, Rm, 0xff
20592060      UML_CALLH(block, sh2->write8);
20602061
20612062      if (!in_delay_slot)
r4184r4185
20642065
20652066   case  1: // MOVWS(Rm, Rn);
20662067      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2067      UML_MOV(block, IREG(1), R32(Rm));      // mov r1, Rm
2068      UML_AND(block, IREG(1), IREG(1), IMM(0xffff));   // and r1, r1, 0xffff
2068      UML_AND(block, IREG(1), R32(Rm), IMM(0xffff));   // and r1, Rm, 0xffff
20692069      UML_CALLH(block, sh2->write16);
20702070
20712071      if (!in_delay_slot)
r4184r4185
22592259
22602260   case  4: // DIV1(Rm, Rn);
22612261      save_fast_iregs(sh2, block);
2262      UML_MOV(block, MEM(&sh2->arg0), IMM(*desc->opptr.w));
2262      UML_MOV(block, MEM(&sh2->arg0), IMM(desc->opptr.w[0]));
22632263      UML_CALLC(block, cfunc_DIV1, sh2);
22642264      load_fast_iregs(sh2, block);
22652265      return TRUE;
r4184r4185
23022302      UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(T)); // rolins [sr],i0,0,T
23032303#else
23042304      save_fast_iregs(sh2, block);
2305      UML_MOV(block, MEM(&sh2->arg0), IMM(*desc->opptr.w));
2305      UML_MOV(block, MEM(&sh2->arg0), IMM(desc->opptr.w[0]));
23062306      UML_CALLC(block, cfunc_SUBV, sh2);
23072307      load_fast_iregs(sh2, block);
23082308#endif
r4184r4185
23222322      UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(T)); // rolins [sr],i0,0,T
23232323#else
23242324      save_fast_iregs(sh2, block);
2325      UML_MOV(block, MEM(&sh2->arg0), IMM(*desc->opptr.w));
2325      UML_MOV(block, MEM(&sh2->arg0), IMM(desc->opptr.w[0]));
23262326      UML_CALLC(block, cfunc_ADDV, sh2);
23272327      load_fast_iregs(sh2, block);
23282328#endif
r4184r4185
24572457   case 0x2f: // MAC_W(Rm, Rn);
24582458   case 0x3f: // MAC_W(Rm, Rn);
24592459      save_fast_iregs(sh2, block);
2460      UML_MOV(block, MEM(&sh2->arg0), IMM(*desc->opptr.w));
2460      UML_MOV(block, MEM(&sh2->arg0), IMM(desc->opptr.w[0]));
24612461      UML_CALLC(block, cfunc_MAC_W, sh2);
24622462      load_fast_iregs(sh2, block);
24632463      return TRUE;
r4184r4185
27672767      UML_CALLH(block, sh2->read8);         // call read8
27682768      UML_SEXT(block, R32(Rn), IREG(0), BYTE);        // sext Rn, r0, BYTE
27692769
2770      UML_CMP(block, IMM(Rn), IMM(Rm));      // cmp N, M
2771      UML_JMPc(block, IF_Z, compiler->labelnum);       // jz compiler->labelnum
2770      if (Rm != Rn)
2771         UML_ADD(block, R32(Rm), R32(Rm), IMM(1));   // add Rm, Rm, #1
27722772
2773      UML_ADD(block, R32(Rm), R32(Rm), IMM(1));   // add Rm, Rm, #1
2774
2775      UML_LABEL(block, compiler->labelnum++);            // labelnum:
2776
27772773      if (!in_delay_slot)
27782774         generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE);
27792775      return TRUE;
r4184r4185
27832779      UML_CALLH(block, sh2->read16);         // call read16
27842780      UML_SEXT(block, R32(Rn), IREG(0), WORD);        // sext Rn, r0, WORD
27852781
2786      UML_CMP(block, IMM(Rn), IMM(Rm));      // cmp N, M
2787      UML_JMPc(block, IF_Z, compiler->labelnum);       // jz compiler->labelnum
2782      if (Rm != Rn)
2783         UML_ADD(block, R32(Rm), R32(Rm), IMM(2));   // add Rm, Rm, #2
27882784
2789      UML_ADD(block, R32(Rm), R32(Rm), IMM(2));   // add Rm, Rm, #2
2790
2791      UML_LABEL(block, compiler->labelnum++);            // labelnum:
2792
27932785      if (!in_delay_slot)
27942786         generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE);
27952787      return TRUE;
r4184r4185
27992791      UML_CALLH(block, sh2->read32);         // call read32
28002792      UML_MOV(block, R32(Rn), IREG(0));      // mov Rn, r0
28012793
2802      UML_CMP(block, IMM(Rn), IMM(Rm));      // cmp N, M
2803      UML_JMPc(block, IF_Z, compiler->labelnum);    // jz compiler->labelnum
2794      if (Rm != Rn)
2795         UML_ADD(block, R32(Rm), R32(Rm), IMM(4));   // add Rm, Rm, #4
28042796
2805      UML_ADD(block, R32(Rm), R32(Rm), IMM(4));   // add Rm, Rm, #4
2806
2807      UML_LABEL(block, compiler->labelnum++);      // labelnum:
2808
28092797      if (!in_delay_slot)
28102798         generate_update_cycles(sh2, block, compiler, IMM(desc->pc + 2), TRUE);
28112799      return TRUE;
src/emu/cpu/sh2/sh2fe.c
r4184r4185
2626static int describe_group_8(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode);
2727static int describe_group_12(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode);
2828
29
30
2931/***************************************************************************
3032    INSTRUCTION PARSERS
3133***************************************************************************/
r4184r4185
3739
3840int sh2_describe(void *param, opcode_desc *desc, const opcode_desc *prev)
3941{
40   UINT16 opcode = *desc->opptr.w;
4142   SH2 *context = (SH2 *)param;
43   UINT16 opcode;
4244
45   /* fetch the opcode */
46   opcode = desc->opptr.w[0] = memory_decrypted_read_word(context->program, SH2_CODE_XOR(desc->physpc));
47
4348   /* all instructions are 2 bytes and most are a single cycle */
4449   desc->length = 2;
4550   desc->cycles = 1;
src/emu/cpu/mips/mips3fe.c
r4184r4185
4242int mips3fe_describe(void *param, opcode_desc *desc, const opcode_desc *prev)
4343{
4444   mips3_state *mips = param;
45   UINT32 op = *desc->opptr.l;
46   UINT8 opswitch = op >> 26;
45   UINT32 op, opswitch;
4746
47   /* compute the physical PC */
48   if (!mips3com_translate_address(mips, ADDRESS_SPACE_PROGRAM, TRANSLATE_FETCH, &desc->physpc))
49   {
50      /* uh-oh: a page fault; leave the description empty and just if this is the first instruction, leave it empty and */
51      /* mark as needing to validate; otherwise, just end the sequence here */
52      desc->flags |= OPFLAG_VALIDATE_TLB | OPFLAG_CAN_CAUSE_EXCEPTION | OPFLAG_COMPILER_PAGE_FAULT | OPFLAG_VIRTUAL_NOOP | OPFLAG_END_SEQUENCE;
53      return TRUE;
54   }
55
56   /* fetch the opcode */
57   op = desc->opptr.l[0] = memory_decrypted_read_dword(mips->program, desc->physpc);
58
4859   /* all instructions are 4 bytes and default to a single cycle each */
4960   desc->length = 4;
5061   desc->cycles = 1;
5162
5263   /* parse the instruction */
64   opswitch = op >> 26;
5365   switch (opswitch)
5466   {
5567      case 0x00:   /* SPECIAL */
src/emu/cpu/mips/mips3drc.c
r4184r4185
9191    MACROS
9292***************************************************************************/
9393
94#ifdef LSB_FIRST
95#define LOPTR(x)            ((UINT32 *)(x))
96#else
97#define LOPTR(x)            ((UINT32 *)(x) + 1)
98#endif
94#define LOPTR(x)            ((UINT32 *)(x) + NATIVE_ENDIAN_VALUE_LE_BE(0,1))
9995
10096#define R32(reg)            mips3->impstate->regmaplo[reg].type, mips3->impstate->regmaplo[reg].value
10197#define LO32               R32(REG_LO)
r4184r4185
14751471   {
14761472      if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP))
14771473      {
1478         UML_LOAD(block, IREG(0), seqhead->opptr.l, IMM(0), DWORD);            // load    i0,*opptr,0,dword
1479         UML_CMP(block, IREG(0), IMM(*seqhead->opptr.l));                  // cmp     i0,*opptr
1474         void *base = memory_decrypted_read_ptr(mips3->program, seqhead->physpc);
1475         UML_LOAD(block, IREG(0), base, IMM(0), DWORD);                     // load    i0,base,0,dword
1476         UML_CMP(block, IREG(0), IMM(seqhead->opptr.l[0]));                  // cmp     i0,opptr[0]
14801477         UML_EXHc(block, IF_NE, mips3->impstate->nocode, IMM(epc(seqhead)));      // exne    nocode,seqhead->pc
14811478      }
14821479   }
r4184r4185
14881485      for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
14891486         if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
14901487         {
1491            UML_LOAD(block, IREG(0), curdesc->opptr.l, IMM(0), DWORD);         // load    i0,*opptr,0,dword
1492            UML_CMP(block, IREG(0), IMM(*curdesc->opptr.l));               // cmp     i0,*opptr
1488            void *base = memory_decrypted_read_ptr(mips3->program, seqhead->physpc);
1489            UML_LOAD(block, IREG(0), base, IMM(0), DWORD);                  // load    i0,base,0,dword
1490            UML_CMP(block, IREG(0), IMM(curdesc->opptr.l[0]));               // cmp     i0,opptr[0]
14931491            UML_EXHc(block, IF_NE, mips3->impstate->nocode, IMM(epc(seqhead)));   // exne    nocode,seqhead->pc
14941492         }
14951493#else
14961494      UINT32 sum = 0;
1497      UML_LOAD(block, IREG(0), seqhead->opptr.l, IMM(0), DWORD);               // load    i0,*opptr,0,dword
1498      sum += *seqhead->opptr.l;
1495      void *base = memory_decrypted_read_ptr(mips3->program, seqhead->physpc);
1496      UML_LOAD(block, IREG(0), base, IMM(0), DWORD);                        // load    i0,base,0,dword
1497      sum += seqhead->opptr.l[0];
14991498      for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
15001499         if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
15011500         {
1502            UML_LOAD(block, IREG(1), curdesc->opptr.l, IMM(0), DWORD);         // load    i1,*opptr,dword
1501            base = memory_decrypted_read_ptr(mips3->program, curdesc->physpc);
1502            UML_LOAD(block, IREG(1), base, IMM(0), DWORD);                  // load    i1,base,dword
15031503            UML_ADD(block, IREG(0), IREG(0), IREG(1));                     // add     i0,i0,i1
1504            sum += *curdesc->opptr.l;
1504            sum += curdesc->opptr.l[0];
15051505         }
15061506      UML_CMP(block, IREG(0), IMM(sum));                                 // cmp     i0,sum
15071507      UML_EXHc(block, IF_NE, mips3->impstate->nocode, IMM(epc(seqhead)));         // exne    nocode,seqhead->pc
r4184r4185
15221522
15231523   /* add an entry for the log */
15241524   if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
1525      log_add_disasm_comment(mips3, block, desc->pc, *desc->opptr.l);
1525      log_add_disasm_comment(mips3, block, desc->pc, desc->opptr.l[0]);
15261526
15271527   /* set the PC map variable */
15281528   expc = (desc->flags & OPFLAG_IN_DELAY_SLOT) ? desc->pc - 3 : desc->pc;
r4184r4185
15331533
15341534   /* is this a hotspot? */
15351535   for (hotnum = 0; hotnum < MIPS3_MAX_HOTSPOTS; hotnum++)
1536      if (mips3->impstate->hotspot[hotnum].pc != 0 && desc->pc == mips3->impstate->hotspot[hotnum].pc && *desc->opptr.l == mips3->impstate->hotspot[hotnum].opcode)
1536      if (mips3->impstate->hotspot[hotnum].pc != 0 && desc->pc == mips3->impstate->hotspot[hotnum].pc && desc->opptr.l[0] == mips3->impstate->hotspot[hotnum].opcode)
15371537      {
15381538         compiler->cycles += mips3->impstate->hotspot[hotnum].cycles;
15391539         break;
r4184r4185
16231623      if (!generate_opcode(mips3, block, compiler, desc))
16241624      {
16251625         UML_MOV(block, MEM(&mips3->pc), IMM(desc->pc));                     // mov     [pc],desc->pc
1626         UML_MOV(block, MEM(&mips3->impstate->arg0), IMM(*desc->opptr.l));      // mov     [arg0],desc->opptr.l
1626         UML_MOV(block, MEM(&mips3->impstate->arg0), IMM(desc->opptr.l[0]));      // mov     [arg0],desc->opptr.l
16271627         UML_CALLC(block, cfunc_unimplemented, mips3);                     // callc   cfunc_unimplemented
16281628      }
16291629   }
r4184r4185
16371637static void generate_delay_slot_and_branch(mips3_state *mips3, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT8 linkreg)
16381638{
16391639   compiler_state compiler_temp = *compiler;
1640   UINT32 op = *desc->opptr.l;
1640   UINT32 op = desc->opptr.l[0];
16411641
16421642   /* fetch the target register if dynamic, in case it is modified by the delay slot */
16431643   if (desc->targetpc == BRANCH_TARGET_DYNAMIC)
r4184r4185
16861686static int generate_opcode(mips3_state *mips3, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
16871687{
16881688   int in_delay_slot = ((desc->flags & OPFLAG_IN_DELAY_SLOT) != 0);
1689   UINT32 op = *desc->opptr.l;
1689   UINT32 op = desc->opptr.l[0];
16901690   UINT8 opswitch = op >> 26;
16911691   drcuml_codelabel skip;
16921692
r4184r4185
22082208
22092209static int generate_special(mips3_state *mips3, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
22102210{
2211   UINT32 op = *desc->opptr.l;
2211   UINT32 op = desc->opptr.l[0];
22122212   UINT8 opswitch = op & 63;
22132213
22142214   switch (opswitch)
r4184r4185
26012601
26022602static int generate_regimm(mips3_state *mips3, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
26032603{
2604   UINT32 op = *desc->opptr.l;
2604   UINT32 op = desc->opptr.l[0];
26052605   UINT8 opswitch = RTREG;
26062606   drcuml_codelabel skip;
26072607
r4184r4185
26792679
26802680static int generate_idt(mips3_state *mips3, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
26812681{
2682   UINT32 op = *desc->opptr.l;
2682   UINT32 op = desc->opptr.l[0];
26832683   UINT8 opswitch = op & 0x1f;
26842684
26852685   /* only enabled on IDT processors */
r4184r4185
28472847
28482848static int generate_cop0(mips3_state *mips3, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
28492849{
2850   UINT32 op = *desc->opptr.l;
2850   UINT32 op = desc->opptr.l[0];
28512851   UINT8 opswitch = RSREG;
28522852   int skip;
28532853
r4184r4185
29732973
29742974static int generate_cop1(mips3_state *mips3, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
29752975{
2976   UINT32 op = *desc->opptr.l;
2976   UINT32 op = desc->opptr.l[0];
29772977   drcuml_codelabel skip;
29782978   int condition;
29792979
r4184r4185
33503350static int generate_cop1x(mips3_state *mips3, drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
33513351{
33523352   int in_delay_slot = ((desc->flags & OPFLAG_IN_DELAY_SLOT) != 0);
3353   UINT32 op = *desc->opptr.l;
3353   UINT32 op = desc->opptr.l[0];
33543354
33553355   if (mips3->impstate->drcoptions & MIPS3DRC_STRICT_COP1)
33563356   {
r4184r4185
35953595      if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
35963596         strcpy(buffer, "<virtual nop>");
35973597      else
3598         dasmmips3(buffer, desclist->pc, *desclist->opptr.l);
3598         dasmmips3(buffer, desclist->pc, desclist->opptr.l[0]);
35993599#else
36003600      strcpy(buffer, "???");
36013601#endif
src/emu/video/cdp1869.c
r4184r4185
844844   state_save_register_device_item(device, 0, cdp1869->toneamp);
845845   state_save_register_device_item(device, 0, cdp1869->wnfreq);
846846   state_save_register_device_item(device, 0, cdp1869->wnamp);
847
848   return DEVICE_START_OK;
849847}
850848
851849static DEVICE_SET_INFO( cdp1869 )
src/emu/video/voodoo.c
r4184r4185
46144614
46154615   /* register for save states */
46164616   init_save_state(device);
4617
4618   return DEVICE_START_OK;
46194617}
46204618
46214619
src/emu/video/mc6845.c
r4184r4185
738738
739739
740740/* device interface */
741static device_start_err common_start(const device_config *device, int device_type)
741static void common_start(const device_config *device, int device_type)
742742{
743743   mc6845_t *mc6845 = get_safe_token(device);
744744
r4184r4185
806806   state_save_register_device_item(device, 0, mc6845->cursor_state);
807807   state_save_register_device_item(device, 0, mc6845->cursor_blink_count);
808808   state_save_register_device_item(device, 0, mc6845->update_addr);
809
810   return DEVICE_START_OK;
811809}
812810
813811static DEVICE_START( mc6845 )
814812{
815   return common_start(device, TYPE_MC6845);
813   common_start(device, TYPE_MC6845);
816814}
817815
818816static DEVICE_START( mc6845_1 )
819817{
820   return common_start(device, TYPE_MC6845_1);
818   common_start(device, TYPE_MC6845_1);
821819}
822820
823821static DEVICE_START( c6545_1 )
824822{
825   return common_start(device, TYPE_C6545_1);
823   common_start(device, TYPE_C6545_1);
826824}
827825
828826static DEVICE_START( r6545_1 )
829827{
830   return common_start(device, TYPE_R6545_1);
828   common_start(device, TYPE_R6545_1);
831829}
832830
833831static DEVICE_START( h46505 )
834832{
835   return common_start(device, TYPE_H46505);
833   common_start(device, TYPE_H46505);
836834}
837835
838836static DEVICE_START( hd6845 )
839837{
840   return common_start(device, TYPE_HD6845);
838   common_start(device, TYPE_HD6845);
841839}
842840
843841static DEVICE_START( sy6545_1 )
844842{
845   return common_start(device, TYPE_SY6545_1);
843   common_start(device, TYPE_SY6545_1);
846844}
847845
848846
src/emu/video.c
r4184r4185
12641264   state_save_register_device_item(screen, 0, state->vblank_end_time.attoseconds);
12651265   state_save_register_device_item(screen, 0, state->frame_number);
12661266   state_save_register_postload(device->machine, video_screen_postload, (void *)device);
1267
1268   return DEVICE_START_OK;
12691267}
12701268
12711269
src/emu/memory.c
r4184r4185
178178#define HANDLER_TO_BANK(h)      ((UINT32)(FPTR)(h))
179179#define BANK_TO_HANDLER(b)      ((genf *)(FPTR)(b))
180180
181#undef ADDR2BYTE
182#undef BYTE2ADDR
183#define ADDR2BYTE(s,a)         (((s)->ashift < 0) ? ((a) << -(s)->ashift) : ((a) >> (s)->ashift))
184#define ADDR2BYTE_END(s,a)      (((s)->ashift < 0) ? (((a) << -(s)->ashift) | ((1 << -(s)->ashift) - 1)) : ((a) >> (s)->ashift))
185#define BYTE2ADDR(s,a)         (((s)->ashift < 0) ? ((a) >> -(s)->ashift) : ((a) << (s)->ashift))
186
187181#define SUBTABLE_PTR(tabledata, entry) (&(tabledata)->table[(1 << LEVEL1_BITS) + (((entry) - SUBTABLE_BASE) << LEVEL2_BITS)])
188182
189183
r4184r4185
402396   *end &= ~*mirror & space->addrmask;
403397
404398   /* adjust to byte values */
405   *start = ADDR2BYTE(space, *start);
406   *end = ADDR2BYTE_END(space, *end);
407   *mask = ADDR2BYTE(space, *mask);
408   *mirror = ADDR2BYTE(space, *mirror);
399   *start = memory_address_to_byte(space, *start);
400   *end = memory_address_to_byte_end(space, *end);
401   *mask = memory_address_to_byte(space, *mask);
402   *mirror = memory_address_to_byte(space, *mirror);
409403}
410404
411405
r4184r4185
826820
827821void memory_set_decrypted_region(const address_space *space, offs_t addrstart, offs_t addrend, void *base)
828822{
829   offs_t bytestart = ADDR2BYTE(space, addrstart);
830   offs_t byteend = ADDR2BYTE_END(space, addrend);
823   offs_t bytestart = memory_address_to_byte(space, addrstart);
824   offs_t byteend = memory_address_to_byte_end(space, addrend);
831825   int banknum, found = FALSE;
832826
833827   /* loop over banks looking for a match */
r4184r4185
11601154   if (whandler != 0)
11611155      space_map_range(spacerw, ROW_WRITE, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, spacerw, whandler_name);
11621156   mem_dump(space->machine);
1163   return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
1157   return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart));
11641158}
11651159
11661160
r4184r4185
11771171   if (whandler != NULL)
11781172      space_map_range(spacerw, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name);
11791173   mem_dump(space->machine);
1180   return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
1174   return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart));
11811175}
11821176
11831177
r4184r4185
11941188   if (whandler != NULL)
11951189      space_map_range(spacerw, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name);
11961190   mem_dump(space->machine);
1197   return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
1191   return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart));
11981192}
11991193
12001194
r4184r4185
12111205   if (whandler != NULL)
12121206      space_map_range(spacerw, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name);
12131207   mem_dump(space->machine);
1214   return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
1208   return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart));
12151209}
12161210
12171211
r4184r4185
12281222   if (whandler != NULL)
12291223      space_map_range(spacerw, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name);
12301224   mem_dump(space->machine);
1231   return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
1225   return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart));
12321226}
12331227
12341228
r4184r4185
12491243   if (whandler != 0)
12501244      space_map_range(spacerw, ROW_WRITE, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, (void *)device, whandler_name);
12511245   mem_dump(space->machine);
1252   return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
1246   return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart));
12531247}
12541248
12551249
r4184r4185
12661260   if (whandler != NULL)
12671261      space_map_range(spacerw, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
12681262   mem_dump(space->machine);
1269   return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
1263   return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart));
12701264}
12711265
12721266
r4184r4185
12831277   if (whandler != NULL)
12841278      space_map_range(spacerw, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
12851279   mem_dump(space->machine);
1286   return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
1280   return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart));
12871281}
12881282
12891283
r4184r4185
13001294   if (whandler != NULL)
13011295      space_map_range(spacerw, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
13021296   mem_dump(space->machine);
1303   return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
1297   return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart));
13041298}
13051299
13061300
r4184r4185
13171311   if (whandler != NULL)
13181312      space_map_range(spacerw, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name);
13191313   mem_dump(space->machine);
1320   return space_find_backing_memory(spacerw, ADDR2BYTE(spacerw, addrstart));
1314   return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart));
13211315}
13221316
13231317
r4184r4185
15931587      if (space->map->globalmask != 0)
15941588      {
15951589         space->addrmask = space->map->globalmask;
1596         space->bytemask = ADDR2BYTE_END(space, space->addrmask);
1590         space->bytemask = memory_address_to_byte_end(space, space->addrmask);
15971591      }
15981592
15991593      /* make a pass over the address map, adjusting for the CPU and getting memory pointers */
src/emu/memory.h
r4184r4185
582582
583583
584584/* macros for accessing bytes and words within larger chunks */
585#ifdef LSB_FIRST
586585
587#define BYTE_XOR_BE(a)              ((a) ^ 1)      /* read/write a byte to a 16-bit space */
588#define BYTE_XOR_LE(a)              (a)
589#define BYTE4_XOR_BE(a)             ((a) ^ 3)      /* read/write a byte to a 32-bit space */
590#define BYTE4_XOR_LE(a)             (a)
591#define WORD_XOR_BE(a)              ((a) ^ 2)      /* read/write a word to a 32-bit space */
592#define WORD_XOR_LE(a)              (a)
593#define BYTE8_XOR_BE(a)             ((a) ^ 7)      /* read/write a byte to a 64-bit space */
594#define BYTE8_XOR_LE(a)             (a)
595#define WORD2_XOR_BE(a)              ((a) ^ 6)      /* read/write a word to a 64-bit space */
596#define WORD2_XOR_LE(a)              (a)
597#define DWORD_XOR_BE(a)              ((a) ^ 4)      /* read/write a dword to a 64-bit space */
598#define DWORD_XOR_LE(a)              (a)
586/* read/write a byte to a 16-bit space */
587#define BYTE_XOR_BE(a)              ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0))
588#define BYTE_XOR_LE(a)              ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(0,1))
599589
600#else
590/* read/write a byte to a 32-bit space */
591#define BYTE4_XOR_BE(a)             ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(3,0))
592#define BYTE4_XOR_LE(a)             ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(0,3))
601593
602#define BYTE_XOR_BE(a)              (a)
603#define BYTE_XOR_LE(a)              ((a) ^ 1)      /* read/write a byte to a 16-bit space */
604#define BYTE4_XOR_BE(a)             (a)
605#define BYTE4_XOR_LE(a)             ((a) ^ 3)      /* read/write a byte to a 32-bit space */
606#define WORD_XOR_BE(a)              (a)
607#define WORD_XOR_LE(a)              ((a) ^ 2)      /* read/write a word to a 32-bit space */
608#define BYTE8_XOR_BE(a)             (a)
609#define BYTE8_XOR_LE(a)             ((a) ^ 7)      /* read/write a byte to a 64-bit space */
610#define WORD2_XOR_BE(a)              (a)
611#define WORD2_XOR_LE(a)              ((a) ^ 6)      /* read/write a word to a 64-bit space */
612#define DWORD_XOR_BE(a)              (a)
613#define DWORD_XOR_LE(a)              ((a) ^ 4)      /* read/write a dword to a 64-bit space */
594/* read/write a word to a 32-bit space */
595#define WORD_XOR_BE(a)              ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(2,0))
596#define WORD_XOR_LE(a)              ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(0,2))
614597
615#endif
598/* read/write a byte to a 64-bit space */
599#define BYTE8_XOR_BE(a)             ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(7,0))
600#define BYTE8_XOR_LE(a)             ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(0,7))
616601
602/* read/write a word to a 64-bit space */
603#define WORD2_XOR_BE(a)              ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(6,0))
604#define WORD2_XOR_LE(a)              ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(0,6))
617605
606/* read/write a dword to a 64-bit space */
607#define DWORD_XOR_BE(a)              ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(4,0))
608#define DWORD_XOR_LE(a)              ((a) ^ NATIVE_ENDIAN_VALUE_LE_BE(0,4))
618609
610
611
619612/***************************************************************************
620613    ADDRESS MAP MACROS
621614***************************************************************************/
src/emu/devintrf.c
r4184r4185
2121#define TEMP_STRING_POOL_ENTRIES      16
2222#define MAX_STRING_LENGTH            256
2323
24// ->started states
25//
26// Only 0 and 1 are externally visible in practice, making it a
27// boolean //for external users
2428
29enum {
30   DEVICE_STOPPED = 0,
31   DEVICE_STARTED = 1,
32   DEVICE_STARTING = 2,
33   DEVICE_DELAYED = 3
34};
2535
36
2637/***************************************************************************
2738    GLOBAL VARIABLES
2839***************************************************************************/
r4184r4185
120131
121132   /* ensure live fields are all cleared */
122133   device->machine = NULL;
123   device->started = FALSE;
134   device->started = DEVICE_STOPPED;
124135   device->token = NULL;
125136   device->tokenbytes = 0;
126137   device->region = NULL;
r4184r4185
600611         device_start_func start = (device_start_func)device_get_info_fct(device, DEVINFO_FCT_START);
601612
602613         assert(start != NULL);
603         if (!device->started && (*start)(device) == DEVICE_START_OK)
604            device->started = TRUE;
605         numstarted += device->started;
614         if (!device->started)
615         {
616            device->started = DEVICE_STARTING;
617            (*start)(device);
618            if (device->started == DEVICE_DELAYED)
619               device->started = DEVICE_STOPPED;
620            else
621            {
622               device->started = DEVICE_STARTED;
623               numstarted ++;
624            }
625         }
606626      }
607627
608628      /* if we didn't start anything new, we're in trouble */
r4184r4185
613633
614634
615635/*-------------------------------------------------
636    device_delay_init - delay the startup of a given
637    device for dependency reasons
638-------------------------------------------------*/
639void device_delay_init(const device_config *device)
640{
641   if (device->started != DEVICE_STARTING && device->started != DEVICE_DELAYED)
642      fatalerror("Error: Calling device_delay_init on a device not in the process of starting.");
643   ((device_config *)device)->started = DEVICE_DELAYED;
644}
645
646/*-------------------------------------------------
616647    device_list_stop - stop the configured list
617648    of devices for a machine
618649-------------------------------------------------*/
src/emu/machine/timekpr.c
r4184r4185
330330   timer = timer_alloc( device->machine, timekeeper_tick, c );
331331   duration = ATTOTIME_IN_SEC(1);
332332   timer_adjust_periodic( timer, duration, 0, duration );
333
334   return DEVICE_START_OK;
335333}
336334
337335static DEVICE_START(m48t02)
src/emu/machine/6526cia.c
r4184r4185
196196   state_save_register_device_item(device, 0, cia->cnt);
197197   state_save_register_device_item(device, 0, cia->shift);
198198   state_save_register_device_item(device, 0, cia->serial);
199   return DEVICE_START_OK;
200199}
201200
202201
src/emu/machine/74123.c
r4184r4185
208208   state_save_register_device_item(device, 0, chip->a);
209209   state_save_register_device_item(device, 0, chip->b);
210210   state_save_register_device_item(device, 0, chip->clear);
211
212   return DEVICE_START_OK;
213211}
214212
215213
src/emu/machine/idectrl.c
r4184r4185
17521752
17531753   state_save_register_device_item(device, 0, ide->master_password_enable);
17541754   state_save_register_device_item(device, 0, ide->user_password_enable);
1755
1756   return DEVICE_START_OK;
17571755}
17581756
17591757
src/emu/machine/68681.c
r4184r4185
581581   state_save_register_device_item(device, 0, duart68681->channel[1].tx_enabled);
582582   state_save_register_device_item(device, 0, duart68681->channel[1].tx_data);
583583   state_save_register_device_item(device, 0, duart68681->channel[1].tx_ready);
584
585   return DEVICE_START_OK;
586584}
587585
588586/*-------------------------------------------------
src/emu/machine/6532riot.c
r4184r4185
462462
463463   state_save_register_device_item(device, 0, riot->timershift);
464464   state_save_register_device_item(device, 0, riot->timerstate);
465
466   return DEVICE_START_OK;
467465}
468466
469467
src/emu/machine/6522via.c
r4184r4185
233233   /* Default clock is from CPU1 */
234234   if (device->clock == 0)
235235      device_set_clock(device, device->machine->cpu[0]->clock);
236
237   return DEVICE_START_OK;
238236}
239237
240238
src/emu/machine/6821new.c
r4184r4185
154154   state_save_register_device_item(device, 0, p->in_cb1_pushed);
155155   state_save_register_device_item(device, 0, p->in_cb2_pushed);
156156   state_save_register_device_item(device, 0, p->out_cb2_needs_pulled);
157
158   return DEVICE_START_OK;
159157}
160158
161159
src/emu/machine/z80dma.c
r4184r4185
466466   state_save_register_device_item(device, 0, z80dma->is_read);
467467   state_save_register_device_item(device, 0, z80dma->cur_cycle);
468468   state_save_register_device_item(device, 0, z80dma->latch);
469
470   return DEVICE_START_OK;
471469}
472470
473471
src/emu/machine/8255ppi.c
r4184r4185
534534   state_save_register_device_item_array(device, 0, ppi8255->out_mask);
535535   state_save_register_device_item_array(device, 0, ppi8255->read);
536536   state_save_register_device_item_array(device, 0, ppi8255->latch);
537
538   return DEVICE_START_OK;
539537}
540538
541539
src/emu/machine/smc91c9x.c
r4184r4185
534534   state_save_register_device_item_array(device, 0, smc->tx);
535535   state_save_register_device_item(device, 0, smc->sent);
536536   state_save_register_device_item(device, 0, smc->recd);
537
538   return DEVICE_START_OK;
539537}
540538
541539
src/emu/machine/8257dma.c
r4184r4185
384384   state_save_register_device_item(device, 0, dma8257->msb);
385385   state_save_register_device_item(device, 0, dma8257->drq);
386386   state_save_register_device_item(device, 0, dma8257->status);
387
388   return DEVICE_START_OK;
389387}
390388
391389
src/emu/machine/z80pio.c
r4184r4185
557557   state_save_register_device_item_array(device, 0, z80pio->out);
558558   state_save_register_device_item_array(device, 0, z80pio->strobe);
559559   state_save_register_device_item_array(device, 0, z80pio->int_state);
560
561   return DEVICE_START_OK;
562560}
563561
564562
src/emu/machine/f3853.c
r4184r4185
189189   state_save_register_device_item( device, 0, f3853->request_flipflop );
190190   state_save_register_device_item( device, 0, f3853->priority_line );
191191   state_save_register_device_item( device, 0, f3853->external_interrupt_line );
192
193   return DEVICE_START_OK;
194192}
195193
196194
src/emu/machine/i8243.c
r4184r4185
142142
143143static DEVICE_START( i8243 )
144144{
145   return DEVICE_START_OK;
146145}
147146
148147
src/emu/machine/msm6242.c
r4184r4185
153153   msm6242->reg[1] = 0;
154154   msm6242->reg[2] = 0;
155155   memset(&msm6242->hold_time, 0, sizeof(mame_system_time));
156
157   return DEVICE_START_OK;
158156}
159157
160158
src/emu/machine/6850acia.c
r4184r4185
257257   state_save_register_device_item(device, 0, acia_p->rts);
258258   state_save_register_device_item(device, 0, acia_p->brk);
259259   state_save_register_device_item(device, 0, acia_p->status_read);
260   return DEVICE_START_OK;
261260}
262261
263262
src/emu/machine/pic8259.c
r4184r4185
397397   pic8259->intf = device->static_config;
398398
399399   pic8259->timer = timer_alloc( device->machine, pic8259_timerproc, (void *)device );
400
401   return DEVICE_START_OK;
402400}
403401
404402
src/emu/machine/ldcore.c
r4184r4185
14551455   ld->screen = devtag_get_device(device->machine, VIDEO_SCREEN, config->screen);
14561456   assert(ld->screen != NULL);
14571457   if (!ld->screen->started)
1458      return DEVICE_START_MISSING_DEPENDENCY;
1458   {
1459      device_delay_init(device);
1460      return;
1461   }
14591462
14601463   /* save a copy of the device pointer */
14611464   ld->device = device;
r4184r4185
14921495
14931496   /* register callbacks */
14941497   config_register(device->machine, "laserdisc", configuration_load, configuration_save);
1495
1496   return DEVICE_START_OK;
14971498}
14981499
14991500
src/emu/machine/x2212.c
r4184r4185
103103   state_save_register_device_item_pointer( device, 0, c->e2prom, SIZE_DATA );
104104   state_save_register_device_item( device, 0, c->store );
105105   state_save_register_device_item( device, 0, c->array_recall );
106
107   return DEVICE_START_OK;
108106}
109107
110108/*-------------------------------------------------
src/emu/machine/at28c16.c
r4184r4185
155155   state_save_register_device_item( device, 0, c->a9_12v );
156156   state_save_register_device_item( device, 0, c->oe_12v );
157157   state_save_register_device_item( device, 0, c->last_write );
158
159   return DEVICE_START_OK;
160158}
161159
162160/*-------------------------------------------------
src/emu/machine/latch8.c
r4184r4185
222222      }
223223
224224   state_save_register_device_item(device, 0, latch8->value);
225
226   return DEVICE_START_OK;
227225}
228226
229227
src/emu/machine/8237dma.c
r4184r4185
395395   dma8237_t   *dma8237 = get_safe_token(device);
396396
397397   dma8237->intf = device->static_config;
398
399   return DEVICE_START_OK;
400398}
401399
402400
src/emu/machine/cdp1852.c
r4184r4185
152152   state_save_register_device_item(device, 0, cdp1852->next_data);
153153   state_save_register_device_item(device, 0, cdp1852->sr);
154154   state_save_register_device_item(device, 0, cdp1852->next_sr);
155
156   return DEVICE_START_OK;
157155}
158156
159157static DEVICE_RESET( cdp1852 )
src/emu/machine/z80sio.c
r4184r4185
798798   sio->receive_poll_cb = intf->receive_poll_cb;
799799
800800   astring_free(tempstring);
801   return DEVICE_START_OK;
802801}
803802
804803
src/emu/machine/pci.c
r4184r4185
223223   /* register pci states */
224224   state_save_register_device_item(device, 0, pcibus->address);
225225   state_save_register_device_item(device, 0, pcibus->devicenum);
226
227   return DEVICE_START_OK;
228226}
229227
230228
src/emu/machine/z80ctc.c
r4184r4185
494494   }
495495
496496   astring_free(tempstring);
497   return DEVICE_START_OK;
498497}
499498
500499
src/emu/machine/pit8253.c
r4184r4185
10381038}
10391039
10401040
1041static device_start_err common_start( const device_config *device, int device_type ) {
1041static void common_start( const device_config *device, int device_type ) {
10421042   pit8253_t   *pit8253 = get_safe_token(device);
10431043   int         timerno;
10441044
r4184r4185
10771077      state_save_register_device_item(device, timerno, timer->last_updated.attoseconds);
10781078      state_save_register_device_item(device, timerno, timer->clock);
10791079   }
1080
1081   return DEVICE_START_OK;
10821080}
10831081
10841082
10851083static DEVICE_START( pit8253 ) {
1086   return common_start( device, TYPE_PIT8253 );
1084   common_start( device, TYPE_PIT8253 );
10871085}
10881086
10891087
10901088static DEVICE_START( pit8254 ) {
1091   return common_start( device, TYPE_PIT8254 );
1089   common_start( device, TYPE_PIT8254 );
10921090}
10931091
10941092
src/emu/devintrf.h
r4184r4185
3737typedef enum _device_class device_class;
3838
3939
40/* device start results */
41enum _device_start_err
42{
43   DEVICE_START_OK = 0,            /* everything is fine */
44   DEVICE_START_MISSING_DEPENDENCY      /* at least one device we depend on is not yet started */
45};
46typedef enum _device_start_err device_start_err;
47
48
4940/* useful in device_list functions for scanning through all devices */
5041#define DEVICE_TYPE_WILDCARD         NULL
5142
r4184r4185
118109#define DEVICE_SET_INFO_CALL(name)   DEVICE_SET_INFO_NAME(name)(device, state, info)
119110
120111#define DEVICE_START_NAME(name)      device_start_##name
121#define DEVICE_START(name)         device_start_err DEVICE_START_NAME(name)(const device_config *device)
112#define DEVICE_START(name)         void DEVICE_START_NAME(name)(const device_config *device)
122113#define DEVICE_START_CALL(name)      DEVICE_START_NAME(name)(device)
123114
124115#define DEVICE_STOP_NAME(name)      device_stop_##name
r4184r4185
194185/* device interface function types */
195186typedef void (*device_get_info_func)(const device_config *device, UINT32 state, deviceinfo *info);
196187typedef void (*device_set_info_func)(const device_config *device, UINT32 state, const deviceinfo *info);
197typedef device_start_err (*device_start_func)(const device_config *device);
188typedef void (*device_start_func)(const device_config *device);
198189typedef void (*device_stop_func)(const device_config *device);
199190typedef INT32 (*device_execute_func)(const device_config *device, INT32 clocks);
200191typedef void (*device_reset_func)(const device_config *device);
r4184r4185
341332/* change the clock on a device */
342333void device_set_clock(const device_config *device, UINT32 clock);
343334
335/* allow a device to ask for its initialization to be delayed */
336void device_delay_init(const device_config *device);
344337
345338
346339/* ----- device information getters ----- */
src/emu/cpuexec.c
r4184r4185
543543
544544   /* register some internal states as well */
545545   register_save_states(device);
546
547   return DEVICE_START_OK;
548546}
549547
550548
src/emu/mamecore.h
r4184r4185
138138#endif
139139
140140
141
142141/* Endianness constants */
143142enum
144143{
145   ENDIANNESS_LITTLE = 0,            /* emulated CPU is little endian */
146   ENDIANNESS_BIG               /* emulated CPU is big endian */
144   ENDIANNESS_LITTLE = 0,
145   ENDIANNESS_BIG
147146};
148147
149148
149/* Native endianness */
150#ifdef LSB_FIRST
151#define ENDIANNESS_NATIVE            ENDIANNESS_LITTLE
152#else
153#define ENDIANNESS_NATIVE            ENDIANNESS_BIG
154#endif
155
156
150157/* orientation of bitmaps */
151158#define   ORIENTATION_FLIP_X            0x0001   /* mirror everything in the X direction */
152159#define   ORIENTATION_FLIP_Y            0x0002   /* mirror everything in the Y direction */
r4184r4185
196203#define DEGREE_TO_RADIAN(x)   ((M_PI / 180.0) * (x))
197204
198205
206/* endian-based value: first value is if 'endian' is little-endian, second is if 'endian' is big-endian */
207#define ENDIAN_VALUE_LE_BE(endian,leval,beval)   (((endian) == ENDIANNESS_LITTLE) ? (leval) : (beval))
199208
209/* endian-based value: first value is if native endianness is little-endian, second is if native is big-endian */
210#define NATIVE_ENDIAN_VALUE_LE_BE(leval,beval)   ((ENDIANNESS_NATIVE == ENDIANNESS_LITTLE) ? (leval) : (beval))
211
212/* endian-based value: first value is if 'endian' matches native, second is if 'endian' doesn't match native */
213#define ENDIAN_VALUE_NE_NNE(endian,leval,beval)   (((endian) == ENDIANNESS_NATIVE) ? (neval) : (nneval))
214
215
200216/* Useful macros to deal with bit shuffling encryptions */
201217#define BIT(x,n) (((x)>>(n))&1)
202218
src/emu/sound/cdp1869.c
r4184r4185
105105
106106static SND_START( cdp1869 )
107107{
108   struct CDP1869 *info;
108   struct CDP1869 *info = device->token;
109109
110   info = auto_malloc(sizeof(*info));
111   memset(info, 0, sizeof(*info));
112
113110   info->device = device;
114111   info->stream = stream_create(device, 0, 1, device->machine->sample_rate, info, cdp1869_update );
115112   info->incr = 0;
r4184r4185
123120   info->toneamp = 0;
124121   info->wnfreq = 0;
125122   info->wnamp = 0;
126
127   return info;
128123}
129124
130125void cdp1869_set_toneamp(int which, int value)
r4184r4185
186181   switch (state)
187182   {
188183      /* --- the following bits of info are returned as 64-bit signed integers --- */
184      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct CDP1869);            break;
189185
190186      /* --- the following bits of info are returned as pointers to data or functions --- */
191187      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( cdp1869 );   break;
src/emu/sound/sp0256.c
r4184r4185
11711171
11721172static SND_START( sp0256 )
11731173{
1174   const sp0256_interface *intf = config;
1175   struct sp0256 *sp;
1174   const sp0256_interface *intf = device->static_config;
1175   struct sp0256 *sp = device->token;
11761176
1177   sp = auto_malloc(sizeof(*sp));
1178   memset(sp, 0, sizeof(*sp));
11791177   sp->device = device;
11801178   sp->drq = intf->lrq_callback;
11811179   sp->sby = intf->sby_callback;
r4184r4185
12091207    /* -------------------------------------------------------------------- */
12101208   sp->rom = device->region;
12111209   sp0256_bitrevbuff(sp->rom, 0, 0xffff);
1212
1213   return sp;
12141210}
12151211
12161212static SND_STOP( sp0256 )
r4184r4185
13621358   switch (state)
13631359   {
13641360      /* --- the following bits of info are returned as 64-bit signed integers --- */
1361      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct sp0256);             break;
13651362
13661363      /* --- the following bits of info are returned as pointers to data or functions --- */
13671364      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sp0256 );   break;
src/emu/sound/hc55516.c
r4184r4185
5252
5353
5454
55static void *start_common(const device_config *device, int clock,
55static void start_common(const device_config *device, int clock,
5656                    UINT8 _shiftreg_mask, int _active_clock_hi)
5757{
58   struct hc55516_data *chip;
58   struct hc55516_data *chip = device->token;
5959
60   /* allocate the chip */
61   chip = auto_malloc(sizeof(*chip));
62   memset(chip, 0, sizeof(*chip));
63
6460   /* compute the fixed charge, decay, and leak time constants */
6561   charge = pow(exp(-1), 1.0 / (FILTER_CHARGE_TC * 16000.0));
6662   decay = pow(exp(-1), 1.0 / (FILTER_DECAY_TC * 16000.0));
r4184r4185
8379   state_save_register_device_item(device, 0, chip->update_count);
8480   state_save_register_device_item(device, 0, chip->filter);
8581   state_save_register_device_item(device, 0, chip->integrator);
86
87   /* success */
88   return chip;
8982}
9083
9184
9285static SND_START( hc55516 )
9386{
94   return start_common(device, clock, 0x07, TRUE);
87   start_common(device, clock, 0x07, TRUE);
9588}
9689
9790
9891static SND_START( mc3417 )
9992{
100   return start_common(device, clock, 0x07, FALSE);
93   start_common(device, clock, 0x07, FALSE);
10194}
10295
10396
10497static SND_START( mc3418 )
10598{
106   return start_common(device, clock, 0x0f, FALSE);
99   start_common(device, clock, 0x0f, FALSE);
107100}
108101
109102
r4184r4185
339332   switch (state)
340333   {
341334      /* --- the following bits of info are returned as 64-bit signed integers --- */
335      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct hc55516_data);      break;
342336      case SNDINFO_FCT_ALIAS:                     info->type = SOUND_HC55516;               break;
343337
344338      /* --- the following bits of info are returned as pointers to data or functions --- */
src/emu/sound/iremga20.c
r4184r4185
230230
231231static SND_START( iremga20 )
232232{
233   struct IremGA20_chip_def *chip;
233   struct IremGA20_chip_def *chip = device->token;
234234   int i;
235235
236   chip = auto_malloc(sizeof(*chip));
237   memset(chip, 0, sizeof(*chip));
238
239236   /* Initialize our chip structure */
240237   chip->rom = device->region;
241238   chip->rom_size = device->regionbytes;
r4184r4185
260257      state_save_register_device_item(device, i, chip->channel[i].effect);
261258      state_save_register_device_item(device, i, chip->channel[i].play);
262259   }
263
264   return chip;
265260}
266261
267262
r4184r4185
285280   switch (state)
286281   {
287282      /* --- the following bits of info are returned as 64-bit signed integers --- */
283      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct IremGA20_chip_def);      break;
288284
289285      /* --- the following bits of info are returned as pointers to data or functions --- */
290286      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( iremga20 );   break;
src/emu/sound/custom.c
r4184r4185
1212
1313static SND_START( custom )
1414{
15   struct custom_info *info;
15   struct custom_info *info = device->token;
1616
17   info = auto_malloc(sizeof(*info));
18   memset(info, 0, sizeof(*info));
19
2017   /* stash a pointer and call the start routine */
21   info->intf = config;
18   info->intf = device->static_config;
2219   if (info->intf->start)
2320   {
24      info->token = (*info->intf->start)(device, clock, config);
25      if (!info->token)
26         return NULL;
21      info->token = (*info->intf->start)(device, clock, device->static_config);
22      assert_always(info->token != NULL, "Error starting custom sound");
2723   }
28
29   return info;
3024}
3125
3226
r4184r4185
7266   switch (state)
7367   {
7468      /* --- the following bits of info are returned as 64-bit signed integers --- */
69      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct custom_info);         break;
7570
7671      /* --- the following bits of info are returned as pointers to data or functions --- */
7772      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( custom );   break;
src/emu/sound/2612intf.c
r4184r4185
9090static SND_START( ym2612 )
9191{
9292   static const ym2612_interface dummy = { 0 };
93   struct ym2612_info *info;
93   struct ym2612_info *info = device->token;
9494   int rate = clock/72;
9595
96   info = auto_malloc(sizeof(*info));
97   memset(info, 0, sizeof(*info));
98
99   info->intf = config ? config : &dummy;
96   info->intf = device->static_config ? device->static_config : &dummy;
10097   info->device = device;
10198
10299   /* FM init */
r4184r4185
109106
110107   /**** initialize YM2612 ****/
111108   info->chip = ym2612_init(info,device,clock,rate,timer_handler,IRQHandler);
109   assert_always(info->chip != NULL, "Error creating YM2612 chip");
112110
113111   state_save_register_postload(device->machine, ym2612_intf_postload, info);
114
115   if (info->chip)
116      return info;
117   /* error */
118   return NULL;
119112}
120113
121114
r4184r4185
362355   switch (state)
363356   {
364357      /* --- the following bits of info are returned as 64-bit signed integers --- */
358      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ym2612_info);            break;
365359
366360      /* --- the following bits of info are returned as pointers to data or functions --- */
367361      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ym2612 );      break;
r4184r4185
398392   switch (state)
399393   {
400394      /* --- the following bits of info are returned as 64-bit signed integers --- */
395      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ym2612_info);            break;
401396
402397      /* --- the following bits of info are returned as pointers to data or functions --- */
403398      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ym3438 );      break;
src/emu/sound/c352.c
r4184r4185
532532
533533static SND_START( c352 )
534534{
535   struct c352_info *info;
535   struct c352_info *info = device->token;
536536
537   info = auto_malloc(sizeof(*info));
538   memset(info, 0, sizeof(*info));
539
540537   info->c352_rom_samples = device->region;
541538   info->c352_rom_length = device->regionbytes;
542539
r4184r4185
545542   info->stream = stream_create(device, 0, 4, info->sample_rate_base, info, c352_update);
546543
547544   c352_init(info, device);
548
549   return info;
550545}
551546
552547
r4184r4185
591586   switch (state)
592587   {
593588      /* --- the following bits of info are returned as 64-bit signed integers --- */
589      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct c352_info);         break;
594590
595591      /* --- the following bits of info are returned as pointers to data or functions --- */
596592      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( c352 );   break;
src/emu/sound/k051649.c
r4184r4185
5555};
5656
5757/* build a table to divide by the number of voices */
58static int make_mixer_table(struct k051649_info *info, int voices)
58static void make_mixer_table(struct k051649_info *info, int voices)
5959{
6060   int count = voices * 256;
6161   int i;
r4184r4185
7575      info->mixer_lookup[ i] = val;
7676      info->mixer_lookup[-i] = -val;
7777   }
78
79   return 0;
8078}
8179
8280
r4184r4185
129127
130128static SND_START( k051649 )
131129{
132   struct k051649_info *info;
130   struct k051649_info *info = device->token;
133131
134   info = auto_malloc(sizeof(*info));
135   memset(info, 0, sizeof(*info));
136
137132   /* get stream channels */
138133   info->rate = clock/16;
139134   info->stream = stream_create(device, 0, 1, info->rate, info, k051649_update);
r4184r4185
143138   info->mixer_buffer = auto_malloc(2 * sizeof(short) * info->rate);
144139
145140   /* build the mixer table */
146   if (make_mixer_table(info, 5))
147      return NULL;
148
149   return info;
141   make_mixer_table(info, 5);
150142}
151143
152144static SND_RESET( k051649 )
r4184r4185
237229   switch (state)
238230   {
239231      /* --- the following bits of info are returned as 64-bit signed integers --- */
232      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct k051649_info);         break;
240233
241234      /* --- the following bits of info are returned as pointers to data or functions --- */
242235      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k051649 );   break;
src/emu/sound/k054539.c
r4184r4185
633633{
634634   static const k054539_interface defintrf = { 0 };
635635   int i;
636   struct k054539_info *info;
636   struct k054539_info *info = device->token;
637637
638   info = auto_malloc(sizeof(*info));
639   memset(info, 0, sizeof(*info));
640
641638   for (i = 0; i < 8; i++)
642639      info->k054539_gain[i] = 1.0;
643640   info->k054539_flags = K054539_RESET_FLAGS;
644641
645   info->intf = (config != NULL) ? config : &defintrf;
642   info->intf = (device->static_config != NULL) ? device->static_config : &defintrf;
646643
647644   /*
648645        I've tried various equations on volume control but none worked consistently.
r4184r4185
669666   k054539_init_chip(device, info, clock);
670667
671668   state_save_register_postload(device->machine, reset_zones, info);
672   return info;
673669}
674670
675671WRITE8_HANDLER( k054539_0_w )
r4184r4185
713709   switch (state)
714710   {
715711      /* --- the following bits of info are returned as 64-bit signed integers --- */
712      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct k054539_info);         break;
716713
717714      /* --- the following bits of info are returned as pointers to data or functions --- */
718715      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k054539 );   break;
src/emu/sound/namco52.c
r4184r4185
134134
135135static SND_START( namco_52xx )
136136{
137   struct namco_52xx *chip;
137   struct namco_52xx *chip = device->token;
138138   int rate = clock/32;
139139
140   chip = auto_malloc(sizeof(*chip));
141   memset(chip, 0, sizeof(*chip));
142
143   chip->intf = config;
140   chip->intf = device->static_config;
144141   chip->rom     = device->region;
145142   chip->rom_len = device->regionbytes;
146143
r4184r4185
167164   state_save_register_device_item(device, 0, chip->n52_end);
168165   state_save_register_device_item(device, 0, chip->n52_length);
169166   state_save_register_device_item(device, 0, chip->n52_pos);
170
171   return chip;
172167}
173168
174169
r4184r4185
213208   switch (state)
214209   {
215210      /* --- the following bits of info are returned as 64-bit signed integers --- */
211      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct namco_52xx);            break;
216212
217213      /* --- the following bits of info are returned as pointers to data or functions --- */
218214      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco_52xx );   break;
src/emu/sound/c140.c
r4184r4185
456456
457457static SND_START( c140 )
458458{
459   const c140_interface *intf = config;
460   struct c140_info *info;
459   const c140_interface *intf = device->static_config;
460   struct c140_info *info = device->token;
461461
462   info = auto_malloc(sizeof(*info));
463   memset(info, 0, sizeof(*info));
464
465462   info->sample_rate=info->baserate=clock;
466463
467464   info->banking_type = intf->banking_type;
r4184r4185
490487   /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */
491488   info->mixer_buffer_left = auto_malloc(2 * sizeof(INT16)*info->sample_rate );
492489   info->mixer_buffer_right = info->mixer_buffer_left + info->sample_rate;
493   return info;
494490}
495491
496492
r4184r4185
514510   switch (state)
515511   {
516512      /* --- the following bits of info are returned as 64-bit signed integers --- */
513      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct c140_info);         break;
517514
518515      /* --- the following bits of info are returned as pointers to data or functions --- */
519516      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( c140 );   break;
src/emu/sound/msm5205.c
r4184r4185
172172
173173static SND_START( msm5205 )
174174{
175   struct MSM5205Voice *voice;
175   struct MSM5205Voice *voice = device->token;
176176
177   voice = auto_malloc(sizeof(*voice));
178   memset(voice, 0, sizeof(*voice));
179   sndintrf_register_token(voice);
180
181177   /* save a global pointer to our interface */
182   voice->intf = config;
178   voice->intf = device->static_config;
183179   voice->device = device;
184180   voice->clock = clock;
185181
r4184r4185
202198   state_save_register_device_item(device, 0, voice->bitwidth);
203199   state_save_register_device_item(device, 0, voice->signal);
204200   state_save_register_device_item(device, 0, voice->step);
205
206   /* success */
207   return voice;
208201}
209202
210203/*
r4184r4185
321314   switch (state)
322315   {
323316      /* --- the following bits of info are returned as 64-bit signed integers --- */
317      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct MSM5205Voice);         break;
324318
325319      /* --- the following bits of info are returned as pointers to data or functions --- */
326320      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( msm5205 );   break;
src/emu/sound/qsound.c
r4184r4185
9494
9595static SND_START( qsound )
9696{
97   struct qsound_info *chip;
97   struct qsound_info *chip = device->token;
9898   int i;
9999
100   chip = auto_malloc(sizeof(*chip));
101   memset(chip, 0, sizeof(*chip));
102
103100   chip->sample_rom = (QSOUND_SRC_SAMPLE *)device->region;
104101   chip->sample_rom_length = device->regionbytes;
105102
r4184r4185
148145      state_save_register_device_item(device, i, chip->channel[i].lastdt);
149146      state_save_register_device_item(device, i, chip->channel[i].offset);
150147   }
151
152   return chip;
153148}
154149
155150static SND_STOP( qsound )
r4184r4185
383378   switch (state)
384379   {
385380      /* --- the following bits of info are returned as 64-bit signed integers --- */
381      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct qsound_info);         break;
386382
387383      /* --- the following bits of info are returned as pointers to data or functions --- */
388384      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( qsound );   break;
src/emu/sound/3812intf.c
r4184r4185
8282static SND_START( ym3812 )
8383{
8484   static const ym3812_interface dummy = { 0 };
85   struct ym3812_info *info;
85   struct ym3812_info *info = device->token;
8686   int rate = clock/72;
8787
88   info = auto_malloc(sizeof(*info));
89   memset(info, 0, sizeof(*info));
90
91   info->intf = config ? config : &dummy;
88   info->intf = device->static_config ? device->static_config : &dummy;
9289   info->device = device;
9390
9491   /* stream system initialize */
9592   info->chip = ym3812_init(device,clock,rate);
96   if (!info->chip)
97      return NULL;
93   assert_always(info->chip != NULL, "Error creating YM3812 chip");
9894
9995   info->stream = stream_create(device,0,1,rate,info,ym3812_stream_update);
10096
r4184r4185
105101
106102   info->timer[0] = timer_alloc(device->machine, timer_callback_3812_0, info);
107103   info->timer[1] = timer_alloc(device->machine, timer_callback_3812_1, info);
108
109   return info;
110104}
111105
112106static SND_STOP( ym3812 )
r4184r4185
174168   switch (state)
175169   {
176170      /* --- the following bits of info are returned as 64-bit signed integers --- */
171      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ym3812_info);            break;
177172
178173      /* --- the following bits of info are returned as pointers to data or functions --- */
179174      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ym3812 );      break;
r4184r4185
253248static SND_START( ym3526 )
254249{
255250   static const ym3526_interface dummy = { 0 };
256   struct ym3526_info *info;
251   struct ym3526_info *info = device->token;
257252   int rate = clock/72;
258253
259   info = auto_malloc(sizeof(*info));
260   memset(info, 0, sizeof(*info));
261
262   info->intf = config ? config : &dummy;
254   info->intf = device->static_config ? device->static_config : &dummy;
263255   info->device = device;
264256
265257   /* stream system initialize */
266258   info->chip = ym3526_init(device,clock,rate);
267   if (!info->chip)
268      return NULL;
259   assert_always(info->chip != NULL, "Error creating YM3526 chip");
269260
270261   info->stream = stream_create(device,0,1,rate,info,ym3526_stream_update);
271262   /* YM3526 setup */
r4184r4185
275266
276267   info->timer[0] = timer_alloc(device->machine, timer_callback_3526_0, info);
277268   info->timer[1] = timer_alloc(device->machine, timer_callback_3526_1, info);
278
279   return info;
280269}
281270
282271static SND_STOP( ym3526 )
r4184r4185
344333   switch (state)
345334   {
346335      /* --- the following bits of info are returned as 64-bit signed integers --- */
336      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ym3526_info);            break;
347337
348338      /* --- the following bits of info are returned as pointers to data or functions --- */
349339      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ym3526 );      break;
r4184r4185
449439static SND_START( y8950 )
450440{
451441   static const y8950_interface dummy = { 0 };
452   struct y8950_info *info;
442   struct y8950_info *info = device->token;
453443   int rate = clock/72;
454444
455   info = auto_malloc(sizeof(*info));
456   memset(info, 0, sizeof(*info));
457
458   info->intf = config ? config : &dummy;
445   info->intf = device->static_config ? device->static_config : &dummy;
459446   info->device = device;
460447
461448   /* stream system initialize */
462449   info->chip = y8950_init(device,clock,rate);
463   if (!info->chip)
464      return NULL;
450   assert_always(info->chip != NULL, "Error creating Y8950 chip");
465451
466452   /* ADPCM ROM data */
467453   y8950_set_delta_t_memory(info->chip, device->region, device->regionbytes);
r4184r4185
479465
480466   info->timer[0] = timer_alloc(device->machine, timer_callback_8950_0, info);
481467   info->timer[1] = timer_alloc(device->machine, timer_callback_8950_1, info);
482
483   return info;
484468}
485469
486470static SND_STOP( y8950 )
r4184r4185
548532   switch (state)
549533   {
550534      /* --- the following bits of info are returned as 64-bit signed integers --- */
535      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct y8950_info);            break;
551536
552537      /* --- the following bits of info are returned as pointers to data or functions --- */
553538      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( y8950 );      break;
src/emu/sound/snkwave.c
r4184r4185
101101
102102static SND_START( snkwave )
103103{
104   struct snkwave_sound *chip;
104   struct snkwave_sound *chip = device->token;
105105
106   assert(config == 0);
106   assert(device->static_config == 0);
107107
108   chip = auto_malloc(sizeof(*chip));
109   memset(chip, 0, sizeof(*chip));
110
111108   /* adjust internal clock */
112109   chip->external_clock = clock;
113110
r4184r4185
127124   state_save_register_device_item(device, 0, chip->counter);
128125   state_save_register_device_item(device, 0, chip->waveform_position);
129126   state_save_register_device_item_pointer(device, 0, chip->waveform, WAVEFORM_LENGTH);
130
131   return chip;
132127}
133128
134129
r4184r4185
177172   switch (state)
178173   {
179174      /* --- the following bits of info are returned as 64-bit signed integers --- */
175      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct snkwave_sound);       break;
180176
181177      /* --- the following bits of info are returned as pointers to data or functions --- */
182178      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( snkwave );   break;
src/emu/sound/rf5c400.c
r4184r4185
340340
341341static SND_START( rf5c400 )
342342{
343   struct rf5c400_info *info;
343   struct rf5c400_info *info = device->token;
344344
345   info = auto_malloc(sizeof(*info));
346   memset(info, 0, sizeof(*info));
347
348345   rf5c400_init_chip(device, info, clock);
349
350   return info;
351346}
352347
353348/*****************************************************************************/
r4184r4185
580575   switch (state)
581576   {
582577      /* --- the following bits of info are returned as 64-bit signed integers --- */
578      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct rf5c400_info);         break;
583579
584580      /* --- the following bits of info are returned as pointers to data or functions --- */
585581      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( rf5c400 );   break;
src/emu/sound/cem3394.c
r4184r4185
317317
318318static SND_START( cem3394 )
319319{
320   const cem3394_interface *intf = config;
321   sound_chip *chip;
320   const cem3394_interface *intf = device->static_config;
321   sound_chip *chip = device->token;
322322
323   chip = auto_malloc(sizeof(*chip));
324   memset(chip, 0, sizeof(*chip));
325323   chip->device = device;
326324
327325   /* copy global parameters */
r4184r4185
350348   state_save_register_device_item(device, 0, chip->modulation_depth);
351349   state_save_register_device_item(device, 0, chip->last_ext);
352350   state_save_register_device_item(device, 0, chip->pulse_width);
353
354   return chip;
355351}
356352
357353
r4184r4185
575571   switch (state)
576572   {
577573      /* --- the following bits of info are returned as 64-bit signed integers --- */
574      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(sound_chip);               break;
578575
579576      /* --- the following bits of info are returned as pointers to data or functions --- */
580577      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( cem3394 );   break;
src/emu/sound/saa1099.c
r4184r4185
314314
315315static SND_START( saa1099 )
316316{
317   struct SAA1099 *saa;
317   struct SAA1099 *saa = device->token;
318318
319   saa = auto_malloc(sizeof(*saa));
320   memset(saa, 0, sizeof(*saa));
321
322319   /* copy global parameters */
323320   saa->device = device;
324321   saa->sample_rate = clock / 256;
325322
326323   /* for each chip allocate one stream */
327324   saa->stream = stream_create(device, 0, 2, saa->sample_rate, saa, saa1099_update);
328
329   return saa;
330325}
331326
332327static void saa1099_control_port_w( int chip, int reg, int data )
r4184r4185
504499   switch (state)
505500   {
506501      /* --- the following bits of info are returned as 64-bit signed integers --- */
502      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct SAA1099);            break;
507503
508504      /* --- the following bits of info are returned as pointers to data or functions --- */
509505      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( saa1099 );   break;
src/emu/sound/digitalk.c
r4184r4185
641641
642642static SND_START(digitalker)
643643{
644   digitalker *dg = auto_malloc(sizeof(*dg));
645   memset(dg, 0, sizeof(*dg));
644   digitalker *dg = device->token;
646645   dg->device = device;
647646   dg->rom = memory_region(device->machine, device->tag);
648647   dg->stream = stream_create(device, 0, 1, clock/4, dg, digitalker_update);
r4184r4185
653652   digitalker_set_intr(dg, 1);
654653
655654   digitalker_register_for_save(dg);
656
657   return dg;
658655}
659656
660657static SND_SET_INFO(digitalker)
r4184r4185
665662SND_GET_INFO(digitalker)
666663{
667664   switch(state) {
665   case SNDINFO_INT_TOKEN_BYTES:   info->i = sizeof(digitalker); break;
668666   case SNDINFO_PTR_SET_INFO:      info->set_info = SND_SET_INFO_NAME(digitalker); break;
669667   case SNDINFO_PTR_START:         info->start = SND_START_NAME(digitalker); break;
670668   case SNDINFO_PTR_STOP:         break;
src/emu/sound/ymz280b.c
r4184r4185
630630static SND_START( ymz280b )
631631{
632632   static const ymz280b_interface defintrf = { 0 };
633   const ymz280b_interface *intf = (config != NULL) ? config : &defintrf;
634   struct YMZ280BChip *chip;
633   const ymz280b_interface *intf = (device->static_config != NULL) ? device->static_config : &defintrf;
634   struct YMZ280BChip *chip = device->token;
635635
636   chip = auto_malloc(sizeof(*chip));
637   memset(chip, 0, sizeof(*chip));
638
639636   chip->device = device;
640637   chip->ext_ram_read = intf->ext_read;
641638   chip->ext_ram_write = intf->ext_write;
r4184r4185
697694#if MAKE_WAVS
698695   chip->wavresample = wav_open("resamp.wav", INTERNAL_SAMPLE_RATE, 2);
699696#endif
700
701   /* success */
702   return chip;
703697}
704698
705699
r4184r4185
11141108   switch (state)
11151109   {
11161110      /* --- the following bits of info are returned as 64-bit signed integers --- */
1111      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct YMZ280BChip);         break;
11171112
11181113      /* --- the following bits of info are returned as pointers to data or functions --- */
11191114      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ymz280b );   break;
src/emu/sound/rf5c68.c
r4184r4185
124124static SND_START( rf5c68 )
125125{
126126   /* allocate memory for the chip */
127   struct rf5c68pcm *chip = auto_malloc(sizeof(*chip));
128   memset(chip, 0, sizeof(*chip));
127   struct rf5c68pcm *chip = device->token;
129128
130129   /* allocate the stream */
131130   chip->stream = stream_create(device, 0, 2, clock / 384, chip, rf5c68_update);
132   return chip;
133131}
134132
135133
r4184r4185
240238   switch (state)
241239   {
242240      /* --- the following bits of info are returned as 64-bit signed integers --- */
241      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct rf5c68pcm);            break;
243242
244243      /* --- the following bits of info are returned as pointers to data or functions --- */
245244      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( rf5c68 );   break;
src/emu/sound/k005289.c
r4184r4185
6161};
6262
6363/* build a table to divide by the number of voices */
64static int make_mixer_table(struct k005289_info *info, int voices)
64static void make_mixer_table(struct k005289_info *info, int voices)
6565{
6666   int count = voices * 128;
6767   int i;
r4184r4185
8181      info->mixer_lookup[ i] = val;
8282      info->mixer_lookup[-i] = -val;
8383   }
84
85   return 0;
8684}
8785
8886
r4184r4185
153151static SND_START( k005289 )
154152{
155153   k005289_sound_channel *voice;
156   struct k005289_info *info;
154   struct k005289_info *info = device->token;
157155
158   info = auto_malloc(sizeof(*info));
159   memset(info, 0, sizeof(*info));
160156   voice = info->channel_list;
161157
162158   /* get stream channels */
r4184r4185
168164   info->mixer_buffer = auto_malloc(2 * sizeof(short) * info->rate);
169165
170166   /* build the mixer table */
171   if (make_mixer_table(info, 2))
172      return NULL;
167   make_mixer_table(info, 2);
173168
174169   info->sound_prom = device->region;
175170
r4184r4185
182177   voice[1].volume = 0;
183178   voice[1].wave = &info->sound_prom[0x100];
184179   voice[1].counter = 0;
185
186   return info;
187180}
188181
189182
r4184r4185
266259   switch (state)
267260   {
268261      /* --- the following bits of info are returned as 64-bit signed integers --- */
262      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct k005289_info);         break;
269263
270264      /* --- the following bits of info are returned as pointers to data or functions --- */
271265      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k005289 );   break;
src/emu/sound/votrax.c
r4184r4185
103103
104104static SND_START( votrax )
105105{
106   struct votrax_info *votrax;
106   struct votrax_info *votrax = device->token;
107107
108   votrax = auto_malloc(sizeof(*votrax));
109   memset(votrax, 0, sizeof(*votrax));
110
111108   votrax->device = device;
112109   votrax->samples = readsamples(VotraxTable,"votrax");
113110   votrax->frequency = 8000;
r4184r4185
117114
118115   votrax->sample = NULL;
119116   votrax->step = 0;
120
121   return votrax;
122117}
123118
124119
r4184r4185
174169   switch (state)
175170   {
176171      /* --- the following bits of info are returned as 64-bit signed integers --- */
172      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct votrax_info);          break;
177173
178174      /* --- the following bits of info are returned as pointers to data or functions --- */
179175      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( votrax );   break;
src/emu/sound/aica.c
r4184r4185
12801280{
12811281   const aica_interface *intf;
12821282
1283   struct _AICA *AICA;
1283   struct _AICA *AICA = device->token;
12841284
1285   AICA = auto_malloc(sizeof(*AICA));
1286   memset(AICA, 0, sizeof(*AICA));
1285   intf = device->static_config;
12871286
1288   intf = config;
1289
12901287   // init the emulation
12911288   AICA_Init(device, AICA, intf);
12921289
r4184r4185
12961293
12971294      AICA->stream = stream_create(device, 0, 2, 44100, AICA, AICA_Update);
12981295   }
1299
1300   return AICA;
13011296}
13021297
13031298#ifdef UNUSED_FUNCTION
r4184r4185
13731368   switch (state)
13741369   {
13751370      /* --- the following bits of info are returned as 64-bit signed integers --- */
1371      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct _AICA);         break;
13761372
13771373      /* --- the following bits of info are returned as pointers to data or functions --- */
13781374      case SNDINFO_PTR_SET_INFO:               info->set_info = SND_SET_INFO_NAME( aica );   break;
src/emu/sound/sn76496.c
r4184r4185
314314}
315315
316316
317static void *generic_start(const device_config *device, int clock, int feedbackmask, int noisetaps, int noiseinvert)
317static void generic_start(const device_config *device, int clock, int feedbackmask, int noisetaps, int noiseinvert)
318318{
319   struct SN76496 *chip;
319   struct SN76496 *chip = device->token;
320320
321   chip = auto_malloc(sizeof(*chip));
322   memset(chip, 0, sizeof(*chip));
323
324321   if (SN76496_init(device,clock,chip) != 0)
325      return NULL;
322      fatalerror("Error creating SN76496 chip");
326323   SN76496_set_gain(chip, 0);
327324
328325   chip->FeedbackMask = feedbackmask;
r4184r4185
337334   state_save_register_device_item_array(device, 0, chip->Period);
338335   state_save_register_device_item_array(device, 0, chip->Count);
339336   state_save_register_device_item_array(device, 0, chip->Output);
340
341   return chip;
342
343337}
344338
345339
346340static SND_START( sn76489 )
347341{
348   return generic_start(device, clock, 0x4000, 0x03, TRUE);
342   generic_start(device, clock, 0x4000, 0x03, TRUE);
349343}
350344
351345static SND_START( sn76489a )
352346{
353   return generic_start(device, clock, 0x8000, 0x06, FALSE);
347   generic_start(device, clock, 0x8000, 0x06, FALSE);
354348}
355349
356350static SND_START( sn76494 )
357351{
358   return generic_start(device, clock, 0x8000, 0x06, FALSE);
352   generic_start(device, clock, 0x8000, 0x06, FALSE);
359353}
360354
361355static SND_START( sn76496 )
362356{
363   return generic_start(device, clock, 0x8000, 0x06, FALSE);
357   generic_start(device, clock, 0x8000, 0x06, FALSE);
364358}
365359
366360static SND_START( gamegear )
367361{
368   return generic_start(device, clock, 0x8000, 0x09, FALSE);
362   generic_start(device, clock, 0x8000, 0x09, FALSE);
369363}
370364
371365static SND_START( smsiii )
372366{
373   return generic_start(device, clock, 0x8000, 0x09, FALSE);
367   generic_start(device, clock, 0x8000, 0x09, FALSE);
374368}
375369
376370
r4184r4185
392386   switch (state)
393387   {
394388      /* --- the following bits of info are returned as 64-bit signed integers --- */
389      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct SN76496);             break;
395390      case SNDINFO_FCT_ALIAS:                     info->type = SOUND_SN76496;                  break;
396391
397392      /* --- the following bits of info are returned as pointers to data or functions --- */
src/emu/sound/wave.c
r4184r4185
1818#include "wave.h"
1919
2020#define ALWAYS_PLAY_SOUND   0
21#define WAVE_TOKEN_MASK      0xFFFF0000
2221
2322
2423
r4184r4185
6463   image = device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, device->tag );
6564#endif
6665   stream_create(device, 0, 1, device->machine->sample_rate, (void *)image, wave_sound_update);
67   return (void *) (FPTR)(WAVE_TOKEN_MASK);
6866}
6967
7068
r4184r4185
8785   switch (state)
8886   {
8987      /* --- the following bits of info are returned as 64-bit signed integers --- */
88      case SNDINFO_INT_TOKEN_BYTES:               info->i = 1;                         break;
9089
9190      /* --- the following bits of info are returned as pointers to data or functions --- */
9291      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( wave );   break;
src/emu/sound/astrocde.c
r4184r4185
258258
259259static SND_START( astrocade )
260260{
261   struct astrocade_info *chip;
261   struct astrocade_info *chip = device->token;
262262   int i;
263263
264   /* allocate the chip memory */
265   chip = auto_malloc(sizeof(*chip));
266   memset(chip, 0, sizeof(*chip));
267
268264   /* generate a bitswap table for the noise */
269265   for (i = 0; i < 256; i++)
270266      chip->bitswap[i] = BITSWAP8(i, 0,1,2,3,4,5,6,7);
r4184r4185
275271   /* reset state */
276272   astrocade_reset(chip);
277273   astrocade_state_save_register(chip, device);
278
279   return chip;
280274}
281275
282276
r4184r4185
338332   switch (state)
339333   {
340334      /* --- the following bits of info are returned as 64-bit signed integers --- */
335      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct astrocade_info);         break;
341336
342337      /* --- the following bits of info are returned as pointers to data or functions --- */
343338      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( astrocade );   break;
src/emu/sound/x1_010.c
r4184r4185
194194static SND_START( x1_010 )
195195{
196196   int i;
197   const x1_010_interface *intf = config;
198   struct x1_010_info *info;
197   const x1_010_interface *intf = device->static_config;
198   struct x1_010_info *info = device->token;
199199
200   info = auto_malloc(sizeof(*info));
201   memset(info, 0, sizeof(*info));
202
203200   info->region      = device->region;
204201   info->base_clock   = clock;
205202   info->rate         = clock / 1024;
r4184r4185
214211
215212   /* get stream channels */
216213   info->stream = stream_create(device,0,2,info->rate,info,seta_update);
217
218   return info;
219214}
220215
221216
r4184r4185
302297   switch (state)
303298   {
304299      /* --- the following bits of info are returned as 64-bit signed integers --- */
300      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct x1_010_info);          break;
305301
306302      /* --- the following bits of info are returned as pointers to data or functions --- */
307303      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( x1_010 );   break;
src/emu/sound/upd7759.c
r4184r4185
629629static SND_START( upd7759 )
630630{
631631   static const upd7759_interface defintrf = { 0 };
632   const upd7759_interface *intf = (config != NULL) ? config : &defintrf;
633   struct upd7759_chip *chip;
632   const upd7759_interface *intf = (device->static_config != NULL) ? device->static_config : &defintrf;
633   struct upd7759_chip *chip = device->token;
634634
635   chip = auto_malloc(sizeof(*chip));
636   memset(chip, 0, sizeof(*chip));
637
638635   chip->device = device;
639636
640637   /* allocate a stream channel */
r4184r4185
665662   upd7759_reset(chip);
666663
667664   register_for_save(chip, device);
668
669   return chip;
670665}
671666
672667
r4184r4185
792787   switch (state)
793788   {
794789      /* --- the following bits of info are returned as 64-bit signed integers --- */
790      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct upd7759_chip);          break;
795791
796792      /* --- the following bits of info are returned as pointers to data or functions --- */
797793      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( upd7759 );   break;
src/emu/sound/ymf271.c
r4184r4185
17431743   static const ymf271_interface defintrf = { 0 };
17441744   const ymf271_interface *intf;
17451745   int i;
1746   YMF271Chip *chip;
1746   YMF271Chip *chip = device->token;
17471747
1748   chip = auto_malloc(sizeof(*chip));
1749   memset(chip, 0, sizeof(*chip));
17501748   chip->device = device;
17511749   chip->clock = clock;
17521750
1753   intf = (config != NULL) ? config : &defintrf;
1751   intf = (device->static_config != NULL) ? device->static_config : &defintrf;
17541752
17551753   ymf271_init(device, chip, device->region, intf->irq_callback, intf->ext_read, intf->ext_write);
17561754   chip->stream = stream_create(device, 0, 2, clock/384, chip, ymf271_update);
r4184r4185
17691767      double db = 0.75 * (double)i;
17701768      total_level[i] = (int)(65536.0 / pow(10.0, db / 20.0));
17711769   }
1772
1773   return chip;
17741770}
17751771
17761772READ8_HANDLER( ymf271_0_r )
r4184r4185
18231819   switch (state)
18241820   {
18251821      /* --- the following bits of info are returned as 64-bit signed integers --- */
1822      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(YMF271Chip);                break;
18261823
18271824      /* --- the following bits of info are returned as pointers to data or functions --- */
18281825      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ymf271 );   break;
src/emu/sound/n63701x.c
r4184r4185
101101
102102static SND_START( namco_63701x )
103103{
104   struct namco_63701x *chip;
104   struct namco_63701x *chip = device->token;
105105
106   chip = auto_malloc(sizeof(*chip));
107   memset(chip, 0, sizeof(*chip));
108
109106   chip->rom = device->region;
110107
111108   chip->stream = stream_create(device, 0, 2, clock/1000, chip, namco_63701x_update);
112
113   return chip;
114109}
115110
116111
r4184r4185
173168   switch (state)
174169   {
175170      /* --- the following bits of info are returned as 64-bit signed integers --- */
171      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct namco_63701x);            break;
176172
177173      /* --- the following bits of info are returned as pointers to data or functions --- */
178174      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco_63701x );   break;
src/emu/sound/pokey.c
r4184r4185
608608
609609static SND_START( pokey )
610610{
611   struct POKEYregisters *chip;
611   struct POKEYregisters *chip = device->token;
612612   int sample_rate = clock;
613613   int i;
614614
615   chip = auto_malloc(sizeof(*chip));
616   memset(chip, 0, sizeof(*chip));
617
618   if (config)
619      memcpy(&chip->intf, config, sizeof(pokey_interface));
615   if (device->static_config)
616      memcpy(&chip->intf, device->static_config, sizeof(pokey_interface));
620617   chip->device = device;
621618   chip->clock_period = ATTOTIME_IN_HZ(clock);
622619
r4184r4185
667664   chip->channel = stream_create(device, 0, 1, sample_rate, chip, pokey_update);
668665
669666   register_for_save(chip, device);
670
671    return chip;
672667}
673668
674669static TIMER_CALLBACK( pokey_timer_expire )
r4184r4185
15251520   switch (state)
15261521   {
15271522      /* --- the following bits of info are returned as 64-bit signed integers --- */
1523      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct POKEYregisters);      break;
15281524
15291525      /* --- the following bits of info are returned as pointers to data or functions --- */
15301526      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( pokey );   break;
src/emu/sound/sp0250.c
r4184r4185
194194
195195static SND_START( sp0250 )
196196{
197   const struct sp0250_interface *intf = config;
198   struct sp0250 *sp;
197   const struct sp0250_interface *intf = device->static_config;
198   struct sp0250 *sp = device->token;
199199
200   sp = auto_malloc(sizeof(*sp));
201   memset(sp, 0, sizeof(*sp));
202200   sp->RNG = 1;
203201   sp->drq = (intf != NULL) ? intf->drq_callback : NULL;
204202   if (sp->drq != NULL)
r4184r4185
208206   }
209207
210208   sp->stream = stream_create(device, 0, 1, clock / CLOCK_DIVIDER, sp, sp0250_update);
211
212   return sp;
213209}
214210
215211
r4184r4185
255251   switch (state)
256252   {
257253      /* --- the following bits of info are returned as 64-bit signed integers --- */
254      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct sp0250);             break;
258255
259256      /* --- the following bits of info are returned as pointers to data or functions --- */
260257      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sp0250 );   break;
src/emu/sound/speaker.c
r4184r4185
3737
3838static SND_START( speaker )
3939{
40   struct speaker *sp = auto_malloc(sizeof(*sp));
40   struct speaker *sp = device->token;
4141
4242   sp->channel = stream_create(device, 0, 1, device->machine->sample_rate, sp, speaker_sound_update);
4343   sp->num_levels = 2;
4444   sp->levels = default_levels;
4545   sp->level = 0;
46   return sp;
4746}
4847
4948
r4184r4185
8786   switch (state)
8887   {
8988      /* --- the following bits of info are returned as 64-bit signed integers --- */
89      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct speaker);             break;
9090
9191      /* --- the following bits of info are returned as pointers to data or functions --- */
9292      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( speaker );   break;
src/emu/sound/ay8910.c
r4184r4185
659659 *
660660 *************************************/
661661
662void *ay8910_start_ym(sound_type chip_type, const device_config *device, int clock, const ay8910_interface *intf)
662void *ay8910_start_ym(void *infoptr, sound_type chip_type, const device_config *device, int clock, const ay8910_interface *intf)
663663{
664   ay8910_context *info;
664   ay8910_context *info = infoptr;
665665
666   info = auto_malloc(sizeof(*info));
667   memset(info, 0, sizeof(*info));
666   if (info == NULL)
667   {
668      info = auto_malloc(sizeof(*info));
669      memset(info, 0, sizeof(*info));
670   }
668671   info->device = device;
669672   info->intf = intf;
670673   if ((info->intf->flags & AY8910_SINGLE_OUTPUT) != 0)
r4184r4185
818821      AY8910_DEFAULT_LOADS,
819822      NULL, NULL, NULL, NULL
820823   };
821   const ay8910_interface *intf = (config ? config : &generic_ay8910);
822   return ay8910_start_ym(SOUND_AY8910, device, clock, intf);
824   const ay8910_interface *intf = (device->static_config ? device->static_config : &generic_ay8910);
825   ay8910_start_ym(device->token, SOUND_AY8910, device, clock, intf);
823826}
824827
825828static SND_START( ym2149 )
r4184r4185
830833      AY8910_DEFAULT_LOADS,
831834      NULL, NULL, NULL, NULL
832835   };
833   const ay8910_interface *intf = (config ? config : &generic_ay8910);
834   return ay8910_start_ym(SOUND_YM2149, device, clock, intf);
836   const ay8910_interface *intf = (device->static_config ? device->static_config : &generic_ay8910);
837   ay8910_start_ym(device->token, SOUND_YM2149, device, clock, intf);
835838}
836839
837840static SND_STOP( ay8910 )
r4184r4185
857860   switch (state)
858861   {
859862      /* --- the following bits of info are returned as 64-bit signed integers --- */
860      case SNDINFO_FCT_ALIAS:                     info->type = SOUND_AY8910;                     break;
863      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(ay8910_context);            break;
864      case SNDINFO_FCT_ALIAS:                     info->type = SOUND_AY8910;                  break;
861865
862866      /* --- the following bits of info are returned as pointers to data or functions --- */
863867      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ay8910 );   break;
src/emu/sound/cdda.c
r4184r4185
4646static SND_START( cdda )
4747{
4848   const struct CDDAinterface *intf;
49   cdda_info *info;
49   cdda_info *info = device->token;
5050
51   info = auto_malloc(sizeof(*info));
52   memset(info, 0, sizeof(*info));
53
5451   /* allocate an audio cache */
5552   info->audio_cache = auto_malloc( CD_MAX_SECTOR_DATA * MAX_SECTORS );
5653
57   intf = config;
54   intf = device->static_config;
5855
5956   info->stream = stream_create(device, 0, 2, 44100, info, cdda_update);
6057
r4184r4185
6663   state_save_register_device_item_pointer( device, 0, info->audio_cache, CD_MAX_SECTOR_DATA * MAX_SECTORS );
6764   state_save_register_device_item( device, 0, info->audio_samples );
6865   state_save_register_device_item( device, 0, info->audio_bptr );
69
70   return info;
7166}
7267
7368
r4184r4185
280275   info->audio_length -= sectoread;
281276
282277   /* CD-DA data on the disc is big-endian, flip if we're not */
283   #ifdef LSB_FIRST
284   for( i = 0; i < info->audio_samples * 2; i++ )
278   if (ENDIANNESS_NATIVE == ENDIANNESS_LITTLE)
285279   {
286      audio_cache[ i ] = BIG_ENDIANIZE_INT16( audio_cache[ i ] );
280      for( i = 0; i < info->audio_samples * 2; i++ )
281      {
282         audio_cache[ i ] = BIG_ENDIANIZE_INT16( audio_cache[ i ] );
283      }
287284   }
288   #endif
289285
290286   /* reset feedout ptr */
291287   info->audio_bptr = 0;
r4184r4185
314310   switch (state)
315311   {
316312      /* --- the following bits of info are returned as 64-bit signed integers --- */
313      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(cdda_info);            break;
317314
318315      /* --- the following bits of info are returned as pointers to data or functions --- */
319316      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( cdda );   break;
src/emu/sound/tms36xx.c
r4184r4185
488488static SND_START( tms36xx )
489489{
490490   int j;
491   struct TMS36XX *tms;
491   struct TMS36XX *tms = device->token;
492492   int enable;
493493
494   tms = auto_malloc(sizeof(*tms));
495   memset(tms, 0, sizeof(*tms));
494   tms->intf = device->static_config;
496495
497   tms->intf = config;
498
499496   tms->channel = stream_create(device, 0, 1, clock * 64, tms, tms36xx_sound_update);
500497   tms->samplerate = clock * 64;
501498   tms->basefreq = clock;
r4184r4185
517514      tms->decay[0], tms->decay[1], tms->decay[2],
518515      tms->decay[3], tms->decay[4], tms->decay[5]));
519516   LOG(("TMS36xx speed         %d\n", tms->speed));
520
521    return tms;
522517}
523518
524519
r4184r4185
542537   switch (state)
543538   {
544539      /* --- the following bits of info are returned as 64-bit signed integers --- */
540      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct TMS36XX);             break;
545541
546542      /* --- the following bits of info are returned as pointers to data or functions --- */
547543      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tms36xx );   break;
src/emu/sound/st0016.c
r4184r4185
126126
127127static SND_START( st0016 )
128128{
129   const st0016_interface *intf = config;
130   struct st0016_info *info;
129   const st0016_interface *intf = device->static_config;
130   struct st0016_info *info = device->token;
131131
132   info = auto_malloc(sizeof(*info));
133   memset(info, 0, sizeof(*info));
134
135132   info->sound_ram = intf->p_soundram;
136133
137134   info->stream = stream_create(device, 0, 2, 44100, info, st0016_update);
138
139   return info;
140135}
141136
142137
r4184r4185
159154   switch (state)
160155   {
161156      /* --- the following bits of info are returned as 64-bit signed integers --- */
157      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct st0016_info);          break;
162158
163159      /* --- the following bits of info are returned as pointers to data or functions --- */
164160      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( st0016 );   break;
src/emu/sound/tiaintf.c
r4184r4185
1919
2020static SND_START( tia )
2121{
22   struct tia_info *info;
22   struct tia_info *info = device->token;
2323
24   info = auto_malloc(sizeof(*info));
25   memset(info, 0, sizeof(*info));
26
2724   info->channel = stream_create(device, 0, 1, clock, info, tia_update);
2825
2926   info->chip = tia_sound_init(clock, clock, 16);
30   if (!info->chip)
31      return NULL;
32
33    return info;
27   assert_always(info->chip != NULL, "Error creating TIA chip");
3428}
3529
3630static SND_STOP( tia )
r4184r4185
6761   switch (state)
6862   {
6963      /* --- the following bits of info are returned as 64-bit signed integers --- */
64      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct tia_info);          break;
7065
7166      /* --- the following bits of info are returned as pointers to data or functions --- */
7267      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tia );   break;
src/emu/sound/ay8910.h
r4184r4185
126126
127127/*********** An interface for SSG of YM2203 ***********/
128128
129void *ay8910_start_ym(sound_type chip_type, const device_config *device, int clock, const ay8910_interface *intf);
129void *ay8910_start_ym(void *infoptr, sound_type chip_type, const device_config *device, int clock, const ay8910_interface *intf);
130130
131131void ay8910_stop_ym(void *chip);
132132void ay8910_reset_ym(void *chip);
src/emu/sound/c6280.c
r4184r4185
310310static SND_START( c6280 )
311311{
312312    int rate = clock/16;
313    c6280_t *info;
313    c6280_t *info = device->token;
314314
315    info = auto_malloc(sizeof(*info));
316    memset(info, 0, sizeof(*info));
317
318315    /* Initialize PSG emulator */
319316    c6280_init(device, info, clock, rate);
320317
321318    /* Create stereo stream */
322319    info->stream = stream_create(device, 0, 2, rate, info, c6280_update);
323
324    return info;
325320}
326321
327322READ8_HANDLER( c6280_r ) { return h6280io_get_buffer((device_config*)space->cpu); }
r4184r4185
348343   switch (state)
349344   {
350345      /* --- the following bits of info are returned as 64-bit signed integers --- */
346      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(c6280_t);                  break;
351347
352348      /* --- the following bits of info are returned as pointers to data or functions --- */
353349      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( c6280 );   break;
src/emu/sound/discrete.c
r4184r4185
247247
248248static SND_START( discrete )
249249{
250   discrete_sound_block *intf = (discrete_sound_block *)config;
251   discrete_info *info;
250   discrete_sound_block *intf = (discrete_sound_block *)device->static_config;
251   discrete_info *info = device->token;
252252   char name[32];
253253
254   info = auto_malloc(sizeof(*info));
255   memset(info, 0, sizeof(*info));
256
257254   info->device = device;
258255
259256   /* If a clock is specified we will use it, otherwise run at the audio sample rate. */
r4184r4185
318315   setup_disc_logs(info);
319316
320317   discrete_current_context = NULL;
321   return info;
322318}
323319
324320
r4184r4185
755751   switch (state)
756752   {
757753      /* --- the following bits of info are returned as 64-bit signed integers --- */
754      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(discrete_info);               break;
758755
759756      /* --- the following bits of info are returned as pointers to data or functions --- */
760757      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( discrete );      break;
src/emu/sound/samples.c
r4184r4185
3737    read_wav_sample - read a WAV file as a sample
3838-------------------------------------------------*/
3939
40#ifdef LSB_FIRST
41#define intelLong(x) (x)
42#else
43#define intelLong(x) (((x << 24) | (((unsigned long) x) >> 24) | (( x & 0x0000ff00) << 8) | (( x & 0x00ff0000) >> 8)))
44#endif
45
4640static int read_wav_sample(mame_file *f, struct loaded_sample *sample)
4741{
4842   unsigned long offset = 0;
4943   UINT32 length, rate, filesize;
5044   UINT16 bits, temp16;
5145   char buf[32];
52   #ifndef LSB_FIRST
5346   UINT32 sindex;
54   #endif
5547
5648   /* read the core header and make sure it's a WAVE file */
5749   offset += mame_fread(f, buf, 4);
r4184r4185
6456   offset += mame_fread(f, &filesize, 4);
6557   if (offset < 8)
6658      return 0;
67   filesize = intelLong(filesize);
59   filesize = LITTLE_ENDIANIZE_INT32(filesize);
6860
6961   /* read the RIFF file type and make sure it's a WAVE file */
7062   offset += mame_fread(f, buf, 4);
r4184r4185
7870   {
7971      offset += mame_fread(f, buf, 4);
8072      offset += mame_fread(f, &length, 4);
81      length = intelLong(length);
73      length = LITTLE_ENDIANIZE_INT32(length);
8274      if (memcmp(&buf[0], "fmt ", 4) == 0)
8375         break;
8476
r4184r4185
10395
10496   /* sample rate */
10597   offset += mame_fread(f, &rate, 4);
106   rate = intelLong(rate);
98   rate = LITTLE_ENDIANIZE_INT32(rate);
10799
108100   /* bytes/second and block alignment are ignored */
109101   offset += mame_fread(f, buf, 6);
r4184r4185
123115   {
124116      offset += mame_fread(f, buf, 4);
125117      offset += mame_fread(f, &length, 4);
126      length = intelLong(length);
118      length = LITTLE_ENDIANIZE_INT32(length);
127119      if (memcmp(&buf[0], "data", 4) == 0)
128120         break;
129121
r4184r4185
162154      sample->data = auto_malloc(sizeof(*sample->data) * (length/2));
163155      mame_fread(f, sample->data, length);
164156      sample->length /= 2;
165#ifndef LSB_FIRST
166      for (sindex = 0; sindex < sample->length; sindex++)
167         sample->data[sindex] = LITTLE_ENDIANIZE_INT16(sample->data[sindex]);
168#endif
157      if (ENDIANNESS_NATIVE != ENDIANNESS_LITTLE)
158         for (sindex = 0; sindex < sample->length; sindex++)
159            sample->data[sindex] = LITTLE_ENDIANIZE_INT16(sample->data[sindex]);
169160   }
170161   return 1;
171162}
r4184r4185
532523static SND_START( samples )
533524{
534525   int i;
535   const samples_interface *intf = config;
536   struct samples_info *info;
526   const samples_interface *intf = device->static_config;
527   struct samples_info *info = device->token;
537528
538   info = auto_malloc(sizeof(*info));
539   memset(info, 0, sizeof(*info));
540529   info->device = device;
541   sndintrf_register_token(info);
542530
543531   /* read audio samples */
544532   if (intf->samplenames)
r4184r4185
572560   /* initialize any custom handlers */
573561   if (intf->start)
574562      (*intf->start)(device);
575
576   return info;
577563}
578564
579565
r4184r4185
596582   switch (state)
597583   {
598584      /* --- the following bits of info are returned as 64-bit signed integers --- */
585      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct samples_info);         break;
599586
600587      /* --- the following bits of info are returned as pointers to data or functions --- */
601588        case SNDINFO_PTR_SET_INFO:                      info->set_info = SND_SET_INFO_NAME( samples );   break;
src/emu/sound/msm5232.c
r4184r4185
780780
781781static SND_START( msm5232 )
782782{
783   const msm5232_interface *intf = config;
783   const msm5232_interface *intf = device->static_config;
784784   int rate = clock/CLOCK_RATE_DIVIDER;
785   MSM5232 *chip;
785   MSM5232 *chip = device->token;
786786
787   chip = auto_malloc(sizeof(*chip));
788   memset(chip, 0, sizeof(*chip));
789
790787   msm5232_init(chip, intf, clock, rate);
791788
792789   chip->stream = stream_create(device,0,11,rate,chip,MSM5232_update_one);
793   return chip;
794790}
795791
796792static SND_STOP( msm5232 )
r4184r4185
846842   switch (state)
847843   {
848844      /* --- the following bits of info are returned as 64-bit signed integers --- */
845      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(MSM5232);                  break;
849846
850847      /* --- the following bits of info are returned as pointers to data or functions --- */
851848      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( msm5232 );   break;
src/emu/sound/scsp.c
r4184r4185
12251225{
12261226   const scsp_interface *intf;
12271227
1228   struct _SCSP *SCSP;
1228   struct _SCSP *SCSP = device->token;
12291229
1230   SCSP = auto_malloc(sizeof(*SCSP));
1231   memset(SCSP, 0, sizeof(*SCSP));
1230   intf = device->static_config;
12321231
1233   intf = config;
1234
12351232   // init the emulation
12361233   SCSP_Init(device, SCSP, intf);
12371234
r4184r4185
12411238
12421239      SCSP->stream = stream_create(device, 0, 2, 44100, SCSP, SCSP_Update);
12431240   }
1244
1245   return SCSP;
12461241}
12471242
12481243
r4184r4185
13851380   switch (state)
13861381   {
13871382      /* --- the following bits of info are returned as 64-bit signed integers --- */
1383      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct _SCSP);            break;
13881384
13891385      /* --- the following bits of info are returned as pointers to data or functions --- */
13901386      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( scsp );   break;
src/emu/sound/flt_rc.c
r4184r4185
8282
8383static SND_START( filter_rc )
8484{
85   struct filter_rc_info *info;
86   const flt_rc_config *conf = config;
85   struct filter_rc_info *info = device->token;
86   const flt_rc_config *conf = device->static_config;
8787
88   info = auto_malloc(sizeof(*info));
89   memset(info, 0, sizeof(*info));
90
9188   info->device = device;
9289   info->stream = stream_create(device, 1, 1, device->machine->sample_rate, info, filter_rc_update);
9390   if (conf)
9491      set_RC_info(info, conf->type, conf->R1, conf->R2, conf->R3, conf->C);
9592   else
9693      set_RC_info(info, FLT_RC_LOWPASS, 1, 1, 1, 0);
97
98   return info;
9994}
10095
10196
r4184r4185
130125   switch (state)
131126   {
132127      /* --- the following bits of info are returned as 64-bit signed integers --- */
128      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct filter_rc_info);         break;
133129
134130      /* --- the following bits of info are returned as pointers to data or functions --- */
135131      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( filter_rc );   break;
src/emu/sound/2610intf.c
r4184r4185
129129      AY8910_DEFAULT_LOADS,
130130      NULL, NULL, NULL, NULL
131131   };
132   const ym2610_interface *intf = config ? config : &generic_2610;
132   const ym2610_interface *intf = device->static_config ? device->static_config : &generic_2610;
133133   int rate = clock/72;
134134   void *pcmbufa,*pcmbufb;
135135   int  pcmsizea,pcmsizeb;
136   struct ym2610_info *info;
136   struct ym2610_info *info = device->token;
137137   astring *name = astring_alloc();
138138
139139   chip_type = SOUND_YM2610;
140140
141   info = auto_malloc(sizeof(*info));
142   memset(info, 0, sizeof(*info));
143
144141   info->intf = intf;
145142   info->device = device;
146   info->psg = ay8910_start_ym(SOUND_YM2610, device, clock, &generic_ay8910);
147   if (!info->psg) return NULL;
143   info->psg = ay8910_start_ym(NULL, SOUND_YM2610, device, clock, &generic_ay8910);
144   assert_always(info->psg != NULL, "Error creating YM2610/AY8910 chip");
148145
149146   /* Timer Handler set */
150147   info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
r4184r4185
169166   info->chip = ym2610_init(info,device,clock,rate,
170167                 pcmbufa,pcmsizea,pcmbufb,pcmsizeb,
171168                 timer_handler,IRQHandler,&psgintf);
169   assert_always(info->chip != NULL, "Error creating YM2610 chip");
172170
173171   state_save_register_postload(device->machine, ym2610_intf_postload, info);
174
175   if (info->chip)
176      return info;
177
178   /* error */
179   return NULL;
180172}
181173#endif
182174
r4184r4185
196188      AY8910_DEFAULT_LOADS,
197189      NULL, NULL, NULL, NULL
198190   };
199   const ym2610_interface *intf = config ? config : &generic_2610;
191   const ym2610_interface *intf = device->static_config ? device->static_config : &generic_2610;
200192   int rate = clock/72;
201193   void *pcmbufa,*pcmbufb;
202194   int  pcmsizea,pcmsizeb;
203   struct ym2610_info *info;
195   struct ym2610_info *info = device->token;
204196   astring *name = astring_alloc();
205197
206198   chip_type = SOUND_YM2610B;
207199
208   info = auto_malloc(sizeof(*info));
209   memset(info, 0, sizeof(*info));
210
211200   info->intf = intf;
212201   info->device = device;
213   info->psg = ay8910_start_ym(SOUND_YM2610B, device, clock, &generic_ay8910);
214   if (!info->psg) return NULL;
202   info->psg = ay8910_start_ym(NULL, SOUND_YM2610B, device, clock, &generic_ay8910);
203   assert_always(info->psg != NULL, "Error creating YM2610B/AY8910 chip");
215204
216205   /* Timer Handler set */
217206   info->timer[0] =timer_alloc(device->machine, timer_callback_0, info);
r4184r4185
236225   info->chip = ym2610_init(info,device,clock,rate,
237226                 pcmbufa,pcmsizea,pcmbufb,pcmsizeb,
238227                 timer_handler,IRQHandler,&psgintf);
239   if (info->chip)
240      return info;
241
242   /* error */
243   return NULL;
228   assert_always(info->chip != NULL, "Error creating YM2610B chip");
244229}
245230#endif
246231
r4184r4185
495480   switch (state)
496481   {
497482      /* --- the following bits of info are returned as 64-bit signed integers --- */
483      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ym2610_info);            break;
498484
499485      /* --- the following bits of info are returned as pointers to data or functions --- */
500486      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ym2610 );      break;
r4184r4185
532518   switch (state)
533519   {
534520      /* --- the following bits of info are returned as 64-bit signed integers --- */
521      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ym2610_info);            break;
535522
536523      /* --- the following bits of info are returned as pointers to data or functions --- */
537524      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ym2610b );      break;
src/emu/sound/beep.c
r4184r4185
8383
8484static SND_START( beep )
8585{
86   struct beep_sound *pBeep;
86   struct beep_sound *pBeep = device->token;
8787
88   pBeep = auto_malloc(sizeof(*pBeep));
89   memset(pBeep, 0, sizeof(*pBeep));
90
9188   pBeep->stream = stream_create(device, 0, 1, BEEP_RATE, pBeep, beep_sound_update );
9289   pBeep->enable = 0;
9390   pBeep->frequency = 3250;
9491   pBeep->incr = 0;
9592   pBeep->signal = 0x07fff;
96   return pBeep;
9793}
9894
9995
r4184r4185
180176   switch (state)
181177   {
182178      /* --- the following bits of info are returned as 64-bit signed integers --- */
179      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct beep_sound);      break;
183180
184181      /* --- the following bits of info are returned as pointers to data or functions --- */
185182      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( beep );   break;
src/emu/sound/tms3615.c
r4184r4185
7979
8080static SND_START( tms3615 )
8181{
82   struct TMS3615 *tms;
82   struct TMS3615 *tms = device->token;
8383
84   tms = auto_malloc(sizeof(*tms));
85   memset(tms, 0, sizeof(*tms));
86
8784   tms->channel = stream_create(device, 0, 2, clock/8, tms, tms3615_sound_update);
8885   tms->samplerate = clock/8;
8986   tms->basefreq = clock;
90
91    return tms;
9287}
9388
9489/**************************************************************************
r4184r4185
108103   switch (state)
109104   {
110105      /* --- the following bits of info are returned as 64-bit signed integers --- */
106      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct TMS3615);             break;
111107
112108      /* --- the following bits of info are returned as pointers to data or functions --- */
113109      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tms3615 );   break;
src/emu/sound/ics2115.c
r4184r4185
441441
442442static SND_START( ics2115 )
443443{
444   struct ics2115 *chip;
444   struct ics2115 *chip = device->token;
445445   int i;
446446
447   chip = auto_malloc(sizeof(*chip));
448   memset(chip, 0, sizeof(*chip));
449
450447   chip->device = device;
451   chip->intf = config;
448   chip->intf = device->static_config;
452449   chip->rom = device->region;
453450   chip->timer[0].timer = timer_alloc(device->machine, timer_cb_0, chip);
454451   chip->timer[1].timer = timer_alloc(device->machine, timer_cb_1, chip);
r4184r4185
466463         v = v-33;
467464      chip->ulaw[i] = v;
468465   }
469
470   return chip;
471466}
472467
473468READ8_HANDLER( ics2115_r )
r4184r4185
552547   switch (state)
553548   {
554549      /* --- the following bits of info are returned as 64-bit signed integers --- */
550      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ics2115);            break;
555551
556552      /* --- the following bits of info are returned as pointers to data or functions --- */
557553      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ics2115 );   break;
src/emu/sound/dac.c
r4184r4185
101101
102102static SND_START( dac )
103103{
104   struct dac_info *info;
104   struct dac_info *info = device->token;
105105
106   info = auto_malloc(sizeof(*info));
107   memset(info, 0, sizeof(*info));
108
109106   DAC_build_voltable(info);
110107
111108   info->channel = stream_create(device,0,1,clock ? clock : DEFAULT_SAMPLE_RATE,info,DAC_update);
112109   info->output = 0;
113110
114111   state_save_register_device_item(device, 0, info->output);
115
116   return info;
117112}
118113
119114
r4184r4185
169164   switch (state)
170165   {
171166      /* --- the following bits of info are returned as 64-bit signed integers --- */
167      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct dac_info);         break;
172168
173169      /* --- the following bits of info are returned as pointers to data or functions --- */
174170      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( dac );   break;
src/emu/sound/s14001a.c
r4184r4185
559559
560560static SND_START( s14001a )
561561{
562   S14001AChip *chip;
562   S14001AChip *chip = device->token;
563563   int i;
564564
565   chip = auto_malloc(sizeof(*chip));
566   memset(chip, 0, sizeof(*chip));
567
568565   chip->GlobalSilenceState = 1;
569566   chip->OldDelta = 0x02;
570567   chip->DACOutput = SILENCE;
r4184r4185
577574   chip->SpeechRom = device->region;
578575
579576   chip->stream = stream_create(device, 0, 1, clock ? clock : device->machine->sample_rate, chip, s14001a_pcm_update);
580
581   return chip;
582577}
583578
584579static SND_SET_INFO( s14001a )
r4184r4185
632627{
633628   switch (state)
634629   {
630      /* --- the following bits of info are returned as 64-bit signed integers --- */
631      case SNDINFO_INT_TOKEN_BYTES:            info->i = sizeof(S14001AChip);               break;
632
635633      /* --- the following bits of info are returned as pointers to data or functions --- */
636634      case SNDINFO_PTR_SET_INFO:               info->set_info = SND_SET_INFO_NAME( s14001a );   break;
637635      case SNDINFO_PTR_START:                  info->start = SND_START_NAME( s14001a );      break;
src/emu/sound/gaelco.c
r4184r4185
242242                        CG-1V/GAE1 Init
243243  ============================================================================*/
244244
245static void *gaelcosnd_start(sound_type sndtype, const device_config *device, int clock, const void *config)
245static void gaelcosnd_start(sound_type sndtype, const device_config *device, int clock)
246246{
247247   int j, vol;
248   const gaelcosnd_interface *intf = config;
248   const gaelcosnd_interface *intf = device->static_config;
249249
250   struct GAELCOSND *info;
251   info = auto_malloc(sizeof(*info));
252   memset(info, 0, sizeof(*info));
250   struct GAELCOSND *info = device->token;
253251
254252   chip_type = sndtype;
255253
r4184r4185
271269
272270   if (LOG_WAVE)
273271      wavraw = wav_open("gae1_snd.wav", 8000, 2);
274
275   return info;
276272}
277273
278274static SND_START( gaelco_gae1 )
279275{
280   return gaelcosnd_start(SOUND_GAELCO_GAE1, device, clock, config);
276   gaelcosnd_start(SOUND_GAELCO_GAE1, device, clock);
281277}
282278
283279static SND_START( gaelco_cg1v )
284280{
285   return gaelcosnd_start(SOUND_GAELCO_CG1V, device, clock, config);
281   gaelcosnd_start(SOUND_GAELCO_CG1V, device, clock);
286282}
287283
288284
r4184r4185
314310   switch (state)
315311   {
316312      /* --- the following bits of info are returned as 64-bit signed integers --- */
313      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct GAELCOSND);               break;
317314
318315      /* --- the following bits of info are returned as pointers to data or functions --- */
319316      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( gaelco_gae1 );   break;
r4184r4185
350347   switch (state)
351348   {
352349      /* --- the following bits of info are returned as 64-bit signed integers --- */
350      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct GAELCOSND);               break;
353351
354352      /* --- the following bits of info are returned as pointers to data or functions --- */
355353      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( gaelco_cg1v );   break;
src/emu/sound/bsmt2000.c
r4184r4185
107107
108108static SND_START( bsmt2000 )
109109{
110   bsmt2000_chip *chip;
110   bsmt2000_chip *chip = device->token;
111111   int voicenum;
112112
113   /* allocate the chip */
114   chip = auto_malloc(sizeof(*chip));
115   memset(chip, 0, sizeof(*chip));
116
117113   /* create a stream at a nominal sample rate (real one specified later) */
118114   chip->stream = stream_create(device, 0, 2, clock / 1000, chip, bsmt2000_update);
119115   chip->clock = clock;
r4184r4185
147143
148144   /* reset the chip -- this also configures the default mode */
149145   bsmt2000_reset(chip);
150   return chip;
151146}
152147
153148
r4184r4185
500495   switch (state)
501496   {
502497      /* --- the following bits of info are returned as 64-bit signed integers --- */
498      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(bsmt2000_chip);               break;
503499
504500      /* --- the following bits of info are returned as pointers to data or functions --- */
505501      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( bsmt2000 );      break;
src/emu/sound/wavwrite.c
r4184r4185
88   UINT32 data_offs;
99};
1010
11#ifdef LSB_FIRST
12#define intel_long(x) (x)
13#define intel_short(x) (x)
14#else
15#define intel_long(x) (((x << 24) | (((unsigned long) x) >> 24) | (( x & 0x0000ff00) << 8) | (( x & 0x00ff0000) >> 8)))
16#define intel_short(x) (((x) << 8) | ((x) >> 8))
17#endif
1811
1912wav_file *wav_open(const char *filename, int sample_rate, int channels)
2013{
r4184r4185
5043   fwrite("fmt ", 1, 4, wav->file);
5144
5245   /* write the format length */
53   temp32 = intel_long(16);
46   temp32 = LITTLE_ENDIANIZE_INT32(16);
5447   fwrite(&temp32, 1, 4, wav->file);
5548
5649   /* write the format (PCM) */
57   temp16 = intel_short(1);
50   temp16 = LITTLE_ENDIANIZE_INT16(1);
5851   fwrite(&temp16, 1, 2, wav->file);
5952
6053   /* write the channels */
61   temp16 = intel_short(channels);
54   temp16 = LITTLE_ENDIANIZE_INT16(channels);
6255   fwrite(&temp16, 1, 2, wav->file);
6356
6457   /* write the sample rate */
65   temp32 = intel_long(sample_rate);
58   temp32 = LITTLE_ENDIANIZE_INT32(sample_rate);
6659   fwrite(&temp32, 1, 4, wav->file);
6760
6861   /* write the bytes/second */
6962   bps = sample_rate * 2 * channels;
70   temp32 = intel_long(bps);
63   temp32 = LITTLE_ENDIANIZE_INT32(bps);
7164   fwrite(&temp32, 1, 4, wav->file);
7265
7366   /* write the block align */
7467   align = 2 * channels;
75   temp16 = intel_short(align);
68   temp16 = LITTLE_ENDIANIZE_INT16(align);
7669   fwrite(&temp16, 1, 2, wav->file);
7770
7871   /* write the bits/sample */
79   temp16 = intel_short(16);
72   temp16 = LITTLE_ENDIANIZE_INT16(16);
8073   fwrite(&temp16, 1, 2, wav->file);
8174
8275   /* write the 'data' tag */
r4184r4185
10194   /* update the total file size */
10295   fseek(wav->file, wav->total_offs, SEEK_SET);
10396   temp32 = total - (wav->total_offs + 4);
104   temp32 = intel_long(temp32);
97   temp32 = LITTLE_ENDIANIZE_INT32(temp32);
10598   fwrite(&temp32, 1, 4, wav->file);
10699
107100   /* update the data size */
108101   fseek(wav->file, wav->data_offs, SEEK_SET);
109102   temp32 = total - (wav->data_offs + 4);
110   temp32 = intel_long(temp32);
103   temp32 = LITTLE_ENDIANIZE_INT32(temp32);
111104   fwrite(&temp32, 1, 4, wav->file);
112105
113106   fclose(wav->file);
src/emu/sound/dmadac.c
r4184r4185
9393
9494static SND_START( dmadac )
9595{
96   struct dmadac_channel_data *info;
96   struct dmadac_channel_data *info = device->token;
9797
98   info = auto_malloc(sizeof(*info));
99   memset(info, 0, sizeof(*info));
100
10198   /* allocate a clear a buffer */
10299   info->buffer = auto_malloc(sizeof(info->buffer[0]) * BUFFER_SIZE);
103100   memset(info->buffer, 0, sizeof(info->buffer[0]) * BUFFER_SIZE);
r4184r4185
115112   state_save_register_device_item(device, 0, info->enabled);
116113   state_save_register_device_item(device, 0, info->frequency);
117114   state_save_register_device_item_pointer(device, 0, info->buffer, BUFFER_SIZE);
118
119   return info;
120115}
121116
122117
r4184r4185
249244   switch (state)
250245   {
251246      /* --- the following bits of info are returned as 64-bit signed integers --- */
247      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct dmadac_channel_data);   break;
252248
253249      /* --- the following bits of info are returned as pointers to data or functions --- */
254250      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( dmadac );   break;
src/emu/sound/2608intf.c
r4184r4185
129129      },
130130      NULL
131131   };
132   const ym2608_interface *intf = config ? config : &generic_2608;
132   const ym2608_interface *intf = device->static_config ? device->static_config : &generic_2608;
133133   int rate = clock/72;
134134   void *pcmbufa;
135135   int  pcmsizea;
136136
137   struct ym2608_info *info;
137   struct ym2608_info *info = device->token;
138138
139   info = auto_malloc(sizeof(*info));
140   memset(info, 0, sizeof(*info));
141
142139   info->intf = intf;
143140   info->device = device;
144141
145142   /* FIXME: Force to use simgle output */
146   info->psg = ay8910_start_ym(SOUND_YM2608, device, clock, &intf->ay8910_intf);
147   if (!info->psg) return NULL;
143   info->psg = ay8910_start_ym(NULL, SOUND_YM2608, device, clock, &intf->ay8910_intf);
144   assert_always(info->psg != NULL, "Error creating YM2608/AY8910 chip");
148145
149146   /* Timer Handler set */
150147   info->timer[0] = timer_alloc(device->machine, timer_callback_2608_0, info);
r4184r4185
160157   info->chip = ym2608_init(info,device,clock,rate,
161158                 pcmbufa,pcmsizea,
162159                 timer_handler,IRQHandler,&psgintf);
160   assert_always(info->chip != NULL, "Error creating YM2608 chip");
163161
164162   state_save_register_postload(device->machine, ym2608_intf_postload, info);
165
166   if (info->chip)
167      return info;
168
169   /* error */
170   return NULL;
171163}
172164
173165static SND_STOP( ym2608 )
r4184r4185
309301   switch (state)
310302   {
311303      /* --- the following bits of info are returned as 64-bit signed integers --- */
304      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ym2608_info);            break;
312305
313306      /* --- the following bits of info are returned as pointers to data or functions --- */
314307      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ym2608 );      break;
src/emu/sound/okim6376.c
r4184r4185
5454   attenuation to apply to the sound signal. */
5555static int volume_table[4] =
5656{
57   0x10,   //   0 dB
58   0x08,   //  -6.0 dB
59   0x04,   // -12.0 dB
60   0x02,   // -24.0 dB
57   0x20,   //   0 dB
58   0x10,   //  -6.0 dB
59   0x08,   // -12.0 dB
60   0x04,   // -24.0 dB
6161};
6262
6363/* tables computed? */
r4184r4185
136136   voice->signal += diff_lookup[voice->step * 16 + (nibble & 15)];
137137
138138   /* clamp to the maximum 12bit */
139   if (voice->signal > 4095)
140      voice->signal = 4095;
141   else if (voice->signal < -4096)
142      voice->signal = -4096;
139   if (voice->signal > 2047)
140      voice->signal = 2047;
141   else if (voice->signal < -2048)
142      voice->signal = -2048;
143143
144144   /* adjust the step size and clamp */
145145   voice->step += index_shift[nibble & 7];
r4184r4185
289289
290290static SND_START( okim6376 )
291291{
292   struct okim6376 *info;
292   struct okim6376 *info = device->token;
293293   int voice;
294294   int divisor = 165;
295295
296   info = auto_malloc(sizeof(*info));
297   memset(info, 0, sizeof(*info));
298
299296   compute_tables();
300297
301298   info->command = -1;
r4184r4185
314311   }
315312
316313   okim6376_state_save_register(info, device);
317
318   /* success */
319   return info;
320314}
321315
322316
r4184r4185
599593   switch (state)
600594   {
601595      /* --- the following bits of info are returned as 64-bit signed integers --- */
596      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct okim6376);               break;
602597
603598      /* --- the following bits of info are returned as pointers to data or functions --- */
604599      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( okim6376 );      break;
src/emu/sound/okim6295.c
r4184r4185
319319
320320static SND_START( okim6295 )
321321{
322   const okim6295_interface *intf = config;
323   struct okim6295 *info;
322   const okim6295_interface *intf = device->static_config;
323   struct okim6295 *info = device->token;
324324   int voice;
325325   int divisor = intf->pin7 ? 132 : 165;
326326
327   info = auto_malloc(sizeof(*info));
328   memset(info, 0, sizeof(*info));
329
330327   compute_tables();
331328
332329   info->command = -1;
r4184r4185
349346   }
350347
351348   okim6295_state_save_register(info, device);
352
353   /* success */
354   return info;
355349}
356350
357351
r4184r4185
662656   switch (state)
663657   {
664658      /* --- the following bits of info are returned as 64-bit signed integers --- */
659      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct okim6295);               break;
665660
666661      /* --- the following bits of info are returned as pointers to data or functions --- */
667662      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( okim6295 );      break;
src/emu/sound/es5506.c
r4184r4185
177177
178178***********************************************************************************************/
179179
180static int compute_tables(struct ES5506Chip *chip)
180static void compute_tables(struct ES5506Chip *chip)
181181{
182182   int i;
183183
r4184r4185
211211
212212      chip->volume_lookup[i] = (mantissa << 11) >> (20 - exponent);
213213   }
214
215   return 1;
216214}
217215
218216
r4184r4185
821819
822820***********************************************************************************************/
823821
824static void *es5506_start_common(const device_config *device, int clock, const void *config, sound_type sndtype)
822static void es5506_start_common(const device_config *device, int clock, const void *config, sound_type sndtype)
825823{
826824   const es5506_interface *intf = config;
827   struct ES5506Chip *chip;
825   struct ES5506Chip *chip = device->token;
828826   int j;
829827   UINT32 accum_mask;
830828
831   chip = auto_malloc(sizeof(*chip));
832   memset(chip, 0, sizeof(*chip));
833
834829   /* debugging */
835830   if (LOG_COMMANDS && !eslog)
836831      eslog = fopen("es.log", "w");
837832
838833   /* compute the tables */
839   if (!compute_tables(chip))
840      return NULL;
834   compute_tables(chip);
841835
842836   /* create the stream */
843837   chip->stream = stream_create(device, 0, 2, clock / (16*32), chip, es5506_update);
r4184r4185
870864   chip->scratch = auto_malloc(sizeof(chip->scratch[0]) * 2 * MAX_SAMPLE_CHUNK);
871865
872866   /* success */
873   return chip;
874867}
875868
876869
877870static SND_START( es5506 )
878871{
879   return es5506_start_common(device, clock, config, SOUND_ES5506);
872   es5506_start_common(device, clock, device->static_config, SOUND_ES5506);
880873}
881874
882875
r4184r4185
15031496
15041497static SND_START( es5505 )
15051498{
1506   const es5505_interface *intf = config;
1499   const es5505_interface *intf = device->static_config;
15071500   es5506_interface es5506intf;
15081501
15091502   memset(&es5506intf, 0, sizeof(es5506intf));
r4184r4185
15131506   es5506intf.irq_callback = intf->irq_callback;
15141507   es5506intf.read_port = intf->read_port;
15151508
1516   return es5506_start_common(device, clock, &es5506intf, SOUND_ES5505);
1509   es5506_start_common(device, clock, &es5506intf, SOUND_ES5505);
15171510}
15181511
15191512
r4184r4185
21592152   switch (state)
21602153   {
21612154      /* --- the following bits of info are returned as 64-bit signed integers --- */
2155      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ES5506Chip);            break;
21622156
21632157      /* --- the following bits of info are returned as pointers to data or functions --- */
21642158      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( es5505 );      break;
r4184r4185
21942188   switch (state)
21952189   {
21962190      /* --- the following bits of info are returned as 64-bit signed integers --- */
2191      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ES5506Chip);            break;
21972192
21982193      /* --- the following bits of info are returned as pointers to data or functions --- */
21992194      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( es5506 );      break;
src/emu/sound/ymf278b.c
r4184r4185
670670   static const ymf278b_interface defintrf = { 0 };
671671   const ymf278b_interface *intf;
672672   int i;
673   YMF278BChip *chip;
673   YMF278BChip *chip = device->token;
674674
675   chip = auto_malloc(sizeof(*chip));
676   memset(chip, 0, sizeof(*chip));
675   intf = (device->static_config != NULL) ? device->static_config : &defintrf;
677676
678   intf = (config != NULL) ? config : &defintrf;
679
680677   ymf278b_init(device->machine, chip, device->region, intf->irq_callback, clock);
681678   chip->stream = stream_create(device, 0, 2, clock/768, chip, ymf278b_pcm_update);
682679
r4184r4185
697694   for(i=0; i<7; i++)
698695      chip->mix_level[i] = chip->volume[8*i+8];
699696   chip->mix_level[7] = 0;
700
701   return chip;
702697}
703698
704699
r4184r4185
804799   switch (state)
805800   {
806801      /* --- the following bits of info are returned as 64-bit signed integers --- */
802      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(YMF278BChip);                break;
807803
808804      /* --- the following bits of info are returned as pointers to data or functions --- */
809805      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ymf278b );   break;
src/emu/sound/sid6581.c
r4184r4185
2929
3030
3131
32static void *sid_start(const device_config *device, int clock, SIDTYPE sidtype)
32static void sid_start(const device_config *device, int clock, SIDTYPE sidtype)
3333{
34   SID6581 *sid;
34   SID6581 *sid = device->token;
3535   const sid6581_interface *iface = (const sid6581_interface*) device->static_config;
3636
37   sid = (SID6581 *) auto_malloc(sizeof(*sid));
38   memset(sid, 0, sizeof(*sid));
39
4037   sid->device = device;
4138   sid->mixer_channel = stream_create (device, 0, 1,  device->machine->sample_rate, (void *) sid, sid_update);
4239   sid->PCMfreq = device->machine->sample_rate;
r4184r4185
4643
4744   sid6581_init(sid);
4845   sidInitWaveformTables(sidtype);
49   return sid;
5046}
5147
5248
r4184r4185
113109   switch (state)
114110   {
115111      /* --- the following bits of info are returned as 64-bit signed integers --- */
112      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(SID6581);                  break;
116113
117114      /* --- the following bits of info are returned as pointers to data or functions --- */
118115      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sid6581 );   break;
src/emu/sound/flt_vol.c
r4184r4185
2424
2525static SND_START( filter_volume )
2626{
27   struct filter_volume_info *info;
27   struct filter_volume_info *info = device->token;
2828
29   info = auto_malloc(sizeof(*info));
30   memset(info, 0, sizeof(*info));
31
3229   info->gain = 0x100;
3330   info->stream = stream_create(device, 1, 1, device->machine->sample_rate, info, filter_volume_update);
34
35   return info;
3631}
3732
3833
r4184r4185
6257   switch (state)
6358   {
6459      /* --- the following bits of info are returned as 64-bit signed integers --- */
60      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct filter_volume_info);         break;
6561
6662      /* --- the following bits of info are returned as pointers to data or functions --- */
6763      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( filter_volume );   break;
src/emu/sound/5220intf.c
r4184r4185
4444static SND_START( tms5220 )
4545{
4646   static const tms5220_interface dummy = { 0 };
47   struct tms5220_info *info;
47   struct tms5220_info *info = device->token;
4848
49   info = auto_malloc(sizeof(*info));
50   memset(info, 0, sizeof(*info));
51   info->intf = config ? config : &dummy;
49   info->intf = device->static_config ? device->static_config : &dummy;
5250
5351   info->chip = tms5220_create(device);
54   if (!info->chip)
55      return NULL;
56   sndintrf_register_token(info);
52   assert_always(info->chip != NULL, "Error creating TMS5220 chip");
5753
5854   /* initialize a info->stream */
5955   info->stream = stream_create(device, 0, 1, clock / 80, info, tms5220_update);
r4184r4185
6763   tms5220_set_read(info->chip, info->intf->read);
6864   tms5220_set_load_address(info->chip, info->intf->load_address);
6965   tms5220_set_read_and_branch(info->chip, info->intf->read_and_branch);
70
71    /* request a sound channel */
72    return info;
7366}
7467
7568
7669#if (HAS_TMC0285 || HAS_TMS5200)
7770static SND_START( tms5200 )
7871{
79   struct tms5220_info *info = SND_START_CALL( tms5220 );
72   struct tms5220_info *info = device->token;
73   SND_START_CALL( tms5220 );
8074   tms5220_set_variant(info->chip, variant_tmc0285);
81   return info;
8275}
8376#endif /* (HAS_TMC0285) && (HAS_TMS5200) */
8477
r4184r4185
254247   switch (state)
255248   {
256249      /* --- the following bits of info are returned as 64-bit signed integers --- */
250      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct tms5220_info);         break;
257251      case SNDINFO_FCT_ALIAS:                     info->type = SOUND_TMS5220;                  break;
258252
259253      /* --- the following bits of info are returned as pointers to data or functions --- */
src/emu/sound/2151intf.c
r4184r4185
3939static SND_START( ym2151 )
4040{
4141   static const ym2151_interface dummy = { 0 };
42   struct ym2151_info *info;
42   struct ym2151_info *info = device->token;
4343   int rate;
4444
45   info = auto_malloc(sizeof(*info));
46   memset(info, 0, sizeof(*info));
45   info->intf = device->static_config ? device->static_config : &dummy;
4746
48   info->intf = config ? config : &dummy;
49
5047   rate = clock/64;
5148
5249   /* stream setup */
5350   info->stream = stream_create(device,0,2,rate,info,ym2151_update);
5451
5552   info->chip = ym2151_init(device,clock,rate);
53   assert_always(info->chip != NULL, "Error creating YM2151 chip");
5654
5755   state_save_register_postload(device->machine, ym2151intf_postload, info);
5856
59   if (info->chip != 0)
60   {
61      ym2151_set_irq_handler(info->chip,info->intf->irqhandler);
62      ym2151_set_port_write_handler(info->chip,info->intf->portwritehandler);
63      return info;
64   }
65   return NULL;
57   ym2151_set_irq_handler(info->chip,info->intf->irqhandler);
58   ym2151_set_port_write_handler(info->chip,info->intf->portwritehandler);
6659}
6760
6861
r4184r4185
222215   switch (state)
223216   {
224217      /* --- the following bits of info are returned as 64-bit signed integers --- */
218      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ym2151_info);            break;
225219
226220      /* --- the following bits of info are returned as pointers to data or functions --- */
227221      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ym2151 );      break;
src/emu/sound/psx.c
r4184r4185
252252
253253static SND_START( psxspu )
254254{
255   struct psxinfo *chip;
255   struct psxinfo *chip = device->token;
256256   int n_effect;
257257   int n_channel;
258258
259   chip = auto_malloc(sizeof(*chip));
260   memset(chip, 0, sizeof(*chip));
261
262   chip->intf = config;
259   chip->intf = device->static_config;
263260   chip->device = device;
264261   chip->g_p_n_psxram = *(chip->intf->p_psxram);
265262
r4184r4185
352349   chip->intf->spu_install_write_handler( 4, spu_write );
353350
354351   chip->stream = stream_create( device, 0, 2, 44100, chip, PSXSPU_update );
355   return chip;
356352}
357353
358354
r4184r4185
682678   switch (state)
683679   {
684680      /* --- the following bits of info are returned as 64-bit signed integers --- */
681      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct psxinfo);            break;
685682
686683      /* --- the following bits of info are returned as pointers to data or functions --- */
687684      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( psxspu );   break;
src/emu/sound/k053260.c
r4184r4185
202202static SND_START( k053260 )
203203{
204204   static const k053260_interface defintrf = { 0 };
205   struct k053260_chip_def *ic;
205   struct k053260_chip_def *ic = device->token;
206206   int rate = clock / 32;
207207   int i;
208208
209   ic = auto_malloc(sizeof(*ic));
210   memset(ic, 0, sizeof(*ic));
211
212209   /* Initialize our chip structure */
213210   ic->device = device;
214   ic->intf = (config != NULL) ? config : &defintrf;
211   ic->intf = (device->static_config != NULL) ? device->static_config : &defintrf;
215212
216213   ic->mode = 0;
217214   ic->rom = device->region;
r4184r4185
236233   /* setup SH1 timer if necessary */
237234   if ( ic->intf->irq )
238235      timer_pulse( device->machine, attotime_mul(ATTOTIME_IN_HZ(clock), 32), NULL, 0, ic->intf->irq );
239
240    return ic;
241236}
242237
243238INLINE void check_bounds( struct k053260_chip_def *ic, int channel ) {
r4184r4185
481476   switch (state)
482477   {
483478      /* --- the following bits of info are returned as 64-bit signed integers --- */
479      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct k053260_chip_def);      break;
484480
485481      /* --- the following bits of info are returned as pointers to data or functions --- */
486482      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k053260 );   break;
src/emu/sound/2413intf.c
r4184r4185
5151static SND_START( ym2413 )
5252{
5353   int rate = clock/72;
54   struct ym2413_info *info;
54   struct ym2413_info *info = device->token;
5555
56   info = auto_malloc(sizeof(*info));
57   memset(info, 0, sizeof(*info));
58
5956   /* emulator create */
6057   info->chip = ym2413_init(device, clock, rate);
61   if (!info->chip)
62      return NULL;
58   assert_always(info->chip != NULL, "Error creating YM2413 chip");
6359
6460   /* stream system initialize */
6561   info->stream = stream_create(device,0,2,rate,info,ym2413_stream_update);
6662
6763   ym2413_set_update_handler(info->chip, _stream_update, info);
6864
69   return info;
7065
7166
7267
73
7468#if 0
7569   int i, tst;
7670   char name[40];
r4184r4185
169163   switch (state)
170164   {
171165      /* --- the following bits of info are returned as 64-bit signed integers --- */
166      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ym2413_info);            break;
172167
173168      /* --- the following bits of info are returned as pointers to data or functions --- */
174169      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ym2413 );      break;
src/emu/sound/segapcm.c
r4184r4185
7878
7979static SND_START( segapcm )
8080{
81   const sega_pcm_interface *intf = config;
81   const sega_pcm_interface *intf = device->static_config;
8282   int mask, rom_mask, len;
83   struct segapcm *spcm;
83   struct segapcm *spcm = device->token;
8484
85   spcm = auto_malloc(sizeof(*spcm));
86   memset(spcm, 0, sizeof(*spcm));
87
8885   spcm->rom = (const UINT8 *)device->region;
8986   spcm->ram = auto_malloc(0x800);
9087
r4184r4185
105102
106103   state_save_register_device_item_array(device, 0, spcm->low);
107104   state_save_register_device_item_pointer(device, 0, spcm->ram, 0x800);
108
109   return spcm;
110105}
111106
112107
r4184r4185
144139   switch (state)
145140   {
146141      /* --- the following bits of info are returned as 64-bit signed integers --- */
142      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct segapcm);            break;
147143
148144      /* --- the following bits of info are returned as pointers to data or functions --- */
149145      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( segapcm );   break;
src/emu/sound/vrender0.c
r4184r4185
9797static SND_START( vrender0 )
9898{
9999   const vr0_interface *intf;
100   struct _VR0Chip *VR0;
100   struct _VR0Chip *VR0 = device->token;
101101
102   VR0 = auto_malloc(sizeof(*VR0));
103   memset(VR0, 0, sizeof(*VR0));
102   intf=device->static_config;
104103
105   intf=config;
106
107104   memcpy(&(VR0->Intf),intf,sizeof(vr0_interface));
108105   memset(VR0->SOUNDREGS,0,sizeof(VR0->SOUNDREGS));
109106
110107   VR0->stream = stream_create(device, 0, 2, 44100, VR0, VR0_Update);
111
112   return VR0;
113108}
114109
115110WRITE32_HANDLER(vr0_snd_write)
r4184r4185
256251   switch (state)
257252   {
258253      /* --- the following bits of info are returned as 64-bit signed integers --- */
254      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct _VR0Chip);             break;
259255
260256      /* --- the following bits of info are returned as pointers to data or functions --- */
261257      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( vrender0 );   break;
src/emu/sound/multipcm.c
r4184r4185
488488
489489static SND_START( multipcm )
490490{
491   struct _MultiPCM *ptChip;
491   struct _MultiPCM *ptChip = device->token;
492492   int i;
493493
494   ptChip=(struct _MultiPCM *)auto_malloc(sizeof(struct _MultiPCM));
495
496494   ptChip->ROM=(INT8 *)device->region;
497495   ptChip->Rate=(float) clock / MULTIPCM_CLOCKDIV;
498496
r4184r4185
635633   }
636634
637635   LFO_Init();
638
639   return ptChip;
640636}
641637
642638
r4184r4185
707703   switch (state)
708704   {
709705      /* --- the following bits of info are returned as 64-bit signed integers --- */
706      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct _MultiPCM);            break;
710707
711708      /* --- the following bits of info are returned as pointers to data or functions --- */
712709      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( multipcm );   break;
src/emu/sound/namco.c
r4184r4185
105105
106106
107107/* build the decoded waveform table */
108static int build_decoded_waveform(struct namco_sound *chip, UINT8 *rgnbase)
108static void build_decoded_waveform(struct namco_sound *chip, UINT8 *rgnbase)
109109{
110110   INT16 *p;
111111   int size;
r4184r4185
141141      for (offset = 0; offset < 256; offset++)
142142         update_namco_waveform(chip, offset, namco_wavedata[offset]);
143143   }
144
145   return 0;
146144}
147145
148146
r4184r4185
356354static SND_START( namco )
357355{
358356   sound_channel *voice;
359   const namco_interface *intf = config;
357   const namco_interface *intf = device->static_config;
360358   int clock_multiple;
361   struct namco_sound *chip;
359   struct namco_sound *chip = device->token;
362360
363   chip = auto_malloc(sizeof(*chip));
364   memset(chip, 0, sizeof(*chip));
365
366361   /* extract globals from the interface */
367362   chip->num_voices = intf->voices;
368363   chip->last_channel = chip->channel_list + chip->num_voices;
r4184r4185
381376   logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", chip->f_fracbits, chip->namco_clock, chip->sample_rate);
382377
383378   /* build the waveform table */
384   if (build_decoded_waveform(chip, device->region))
385      return NULL;
379   build_decoded_waveform(chip, device->region);
386380
387381   /* get stream channels */
388382   if (intf->stereo)
r4184r4185
425419      state_save_register_device_item(device, voicenum, voice->noise_counter);
426420      state_save_register_device_item(device, voicenum, voice->waveform_select);
427421   }
428
429   return chip;
430422}
431423
432424
r4184r4185
818810   switch (state)
819811   {
820812      /* --- the following bits of info are returned as 64-bit signed integers --- */
813      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct namco_sound);         break;
821814
822815      /* --- the following bits of info are returned as pointers to data or functions --- */
823816      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco );   break;
r4184r4185
852845   switch (state)
853846   {
854847      /* --- the following bits of info are returned as 64-bit signed integers --- */
848      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct namco_sound);            break;
855849
856850      /* --- the following bits of info are returned as pointers to data or functions --- */
857851      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco_15xx );   break;
r4184r4185
886880   switch (state)
887881   {
888882      /* --- the following bits of info are returned as 64-bit signed integers --- */
883      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct namco_sound);            break;
889884
890885      /* --- the following bits of info are returned as pointers to data or functions --- */
891886      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco_cus30 );   break;
src/emu/sound/sn76477.c
r4184r4185
23882388
23892389static SND_START( sn76477 )
23902390{
2391   struct SN76477 *sn;
2391   struct SN76477 *sn = device->token;
23922392   sn76477_interface *intf;
23932393
23942394
23952395#if TEST_MODE == 0
2396   intf = (sn76477_interface *)config;
2396   intf = (sn76477_interface *)device->static_config;
23972397#else
23982398   intf = &test_interface;
23992399#endif
24002400
24012401
2402   sn = auto_malloc(sizeof(*sn));
2403   memset(sn, 0, sizeof(*sn));
2404
24052402   sn->device = device;
24062403
24072404   sn->channel = stream_create(device, 0, 1, device->machine->sample_rate, sn, SN76477_update);
r4184r4185
24172414
24182415   intialize_noise(sn);
24192416
2420   sndintrf_register_token(sn);
2421
24222417   /* set up interface values */
24232418   _SN76477_enable_w(sn, intf->enable);
24242419   _SN76477_vco_w(sn, intf->vco);
r4184r4185
24562451
24572452   if (LOG_WAV)
24582453      open_wav_file(sn);
2459
2460   return sn;
24612454}
24622455
24632456
r4184r4185
24742467{
24752468   switch (state)
24762469   {
2470   case SNDINFO_INT_TOKEN_BYTES:   info->i = sizeof(struct SN76477); break;
24772471   case SNDINFO_PTR_START:         info->start = SND_START_NAME( sn76477 ); break;
24782472   case SNDINFO_PTR_STOP:         info->stop = SND_STOP_NAME( sn76477 ); break;
24792473   case SNDINFO_STR_NAME:         strcpy(info->s, "SN76477"); break;
src/emu/sound/vlm5030.c
r4184r4185
641641{
642642   const vlm5030_interface defintrf = { 0 };
643643   int emulation_rate;
644   struct vlm5030_info *chip;
644   struct vlm5030_info *chip = device->token;
645645
646   chip = auto_malloc(sizeof(*chip));
647   memset(chip, 0, sizeof(*chip));
648
649646   chip->device = device;
650   chip->intf = (config != NULL) ? config : &defintrf;
647   chip->intf = (device->static_config != NULL) ? device->static_config : &defintrf;
651648
652649   emulation_rate = clock / 440;
653650
r4184r4185
689686   state_save_register_device_item_array(device,0,chip->target_k);
690687   state_save_register_device_item_array(device,0,chip->x);
691688   state_save_register_postload(device->machine, vlm5030_restore_state, chip);
692
693   return chip;
694689}
695690
696691
r4184r4185
712707   switch (state)
713708   {
714709      /* --- the following bits of info are returned as 64-bit signed integers --- */
710      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct vlm5030_info);          break;
715711
716712      /* --- the following bits of info are returned as pointers to data or functions --- */
717713      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( vlm5030 );   break;
src/emu/sound/5110intf.c
r4184r4185
6767static SND_START( tms5110 )
6868{
6969   static const tms5110_interface dummy = { 0 };
70   struct tms5110_info *info;
70   struct tms5110_info *info = device->token;
7171
72   info = auto_malloc(sizeof(*info));
73   memset(info, 0, sizeof(*info));
74   info->intf = config ? config : &dummy;
72   info->intf = device->static_config ? device->static_config : &dummy;
7573   info->table = device->region;
7674
7775   info->chip = tms5110_create(device, TMS5110_IS_5110A);
78   if (!info->chip)
79      return NULL;
80   sndintrf_register_token(info);
76   assert_always(info->chip != NULL, "Error creating TMS5110 chip");
8177
8278   /* initialize a stream */
8379   info->stream = stream_create(device, 0, 1, clock / 80, info, tms5110_update);
8480
8581   if (info->table == NULL)
8682   {
87       if (info->intf->M0_callback==NULL)
88       {
89         logerror("\n file: 5110intf.c, SND_START( tms5110 ):\n  Missing _mandatory_ 'M0_callback' function pointer in the TMS5110 interface\n  This function is used by TMS5110 to call for a single bits\n  needed to generate the speech\n  Aborting startup...\n");
90         return NULL;
91       }
83      assert_always(info->intf->M0_callback != NULL, "Missing _mandatory_ 'M0_callback' function pointer in the TMS5110 interface\n  This function is used by TMS5110 to call for a single bits\n  needed to generate the speech\n  Aborting startup...\n");
9284       tms5110_set_M0_callback(info->chip, info->intf->M0_callback );
9385       tms5110_set_load_address(info->chip, info->intf->load_address );
9486   }
r4184r4185
10092
10193    /* reset the 5110 */
10294    tms5110_reset_chip(info->chip);
103
104    /* request a sound channel */
105    return info;
10695}
10796
10897static SND_START( tms5100 )
10998{
110   struct tms5110_info *info = SND_START_CALL( tms5110 );
99   struct tms5110_info *info = device->token;
100   SND_START_CALL( tms5110 );
111101   tms5110_set_variant(info->chip, TMS5110_IS_5100);
112   return info;
113102}
114103
115104static SND_START( tms5110a )
116105{
117   struct tms5110_info *info = SND_START_CALL( tms5110 );
106   struct tms5110_info *info = device->token;
107   SND_START_CALL( tms5110 );
118108   tms5110_set_variant(info->chip, TMS5110_IS_5110A);
119   return info;
120109}
121110
122111static SND_START( cd2801 )
123112{
124   struct tms5110_info *info = SND_START_CALL( tms5110 );
113   struct tms5110_info *info = device->token;
114   SND_START_CALL( tms5110 );
125115   tms5110_set_variant(info->chip, TMS5110_IS_CD2801);
126   return info;
127116}
128117
129118static SND_START( tmc0281 )
130119{
131   struct tms5110_info *info = SND_START_CALL( tms5110 );
120   struct tms5110_info *info = device->token;
121   SND_START_CALL( tms5110 );
132122   tms5110_set_variant(info->chip, TMS5110_IS_TMC0281);
133   return info;
134123}
135124
136125static SND_START( cd2802 )
137126{
138   struct tms5110_info *info = SND_START_CALL( tms5110 );
127   struct tms5110_info *info = device->token;
128   SND_START_CALL( tms5110 );
139129   tms5110_set_variant(info->chip, TMS5110_IS_CD2802);
140   return info;
141130}
142131
143132static SND_START( m58817 )
144133{
145   struct tms5110_info *info = SND_START_CALL( tms5110 );
134   struct tms5110_info *info = device->token;
135   SND_START_CALL( tms5110 );
146136   tms5110_set_variant(info->chip, TMS5110_IS_M58817);
147   return info;
148137}
149138
150139
r4184r4185
298287   switch (state)
299288   {
300289      /* --- the following bits of info are returned as 64-bit signed integers --- */
290      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct tms5110_info);         break;
301291      case SNDINFO_FCT_ALIAS:                     info->type = SOUND_TMS5110;                  break;
302292
303293      /* --- the following bits of info are returned as pointers to data or functions --- */
src/emu/sound/2203intf.c
r4184r4185
116116      },
117117      NULL
118118   };
119   const ym2203_interface *intf = config ? config : &generic_2203;
120   struct ym2203_info *info;
119   const ym2203_interface *intf = device->static_config ? device->static_config : &generic_2203;
120   struct ym2203_info *info = device->token;
121121   int rate = clock/72; /* ??? */
122122
123   info = auto_malloc(sizeof(*info));
124   memset(info, 0, sizeof(*info));
125
126123   info->intf = intf;
127124   info->device = device;
128   info->psg = ay8910_start_ym(SOUND_YM2203, device, clock, &intf->ay8910_intf);
129   if (!info->psg) return NULL;
125   info->psg = ay8910_start_ym(NULL, SOUND_YM2203, device, clock, &intf->ay8910_intf);
126   assert_always(info->psg != NULL, "Error creating YM2203/AY8910 chip");
130127
131128   /* Timer Handler set */
132129   info->timer[0] = timer_alloc(device->machine, timer_callback_2203_0, info);
r4184r4185
137134
138135   /* Initialize FM emurator */
139136   info->chip = ym2203_init(info,device,clock,rate,timer_handler,IRQHandler,&psgintf);
137   assert_always(info->chip != NULL, "Error creating YM2203 chip");
140138
141139   state_save_register_postload(device->machine, ym2203_intf_postload, info);
142
143   if (info->chip)
144      return info;
145
146   /* error */
147   /* stream close */
148   return NULL;
149140}
150141
151142static SND_STOP( ym2203 )
r4184r4185
341332   switch (state)
342333   {
343334      /* --- the following bits of info are returned as 64-bit signed integers --- */
335      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ym2203_info);            break;
344336
345337      /* --- the following bits of info are returned as pointers to data or functions --- */
346338      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ym2203 );      break;
src/emu/sound/k007232.c
r4184r4185
297297{
298298   static const k007232_interface defintrf = { 0 };
299299   int i;
300   struct kdacApcm *info;
300   struct kdacApcm *info = device->token;
301301
302   info = auto_malloc(sizeof(*info));
303   memset(info, 0, sizeof(*info));
302   info->intf = (device->static_config != NULL) ? device->static_config : &defintrf;
304303
305   info->intf = (config != NULL) ? config : &defintrf;
306
307304   /* Set up the chips */
308305
309306   info->pcmbuf[0] = device->region;
r4184r4185
329326   info->stream = stream_create(device,0,2,clock/128,info,KDAC_A_update);
330327
331328   KDAC_A_make_fncode(info);
332
333   return info;
334329}
335330
336331/************************************************/
r4184r4185
492487   switch (state)
493488   {
494489      /* --- the following bits of info are returned as 64-bit signed integers --- */
490      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct kdacApcm);            break;
495491
496492      /* --- the following bits of info are returned as pointers to data or functions --- */
497493      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k007232 );   break;
src/emu/sound/okim6258.c
r4184r4185
184184
185185static SND_START( okim6258 )
186186{
187   const okim6258_interface *intf = config;
188   struct okim6258 *info;
187   const okim6258_interface *intf = device->static_config;
188   struct okim6258 *info = device->token;
189189
190   info = auto_malloc(sizeof(*info));
191   memset(info, 0, sizeof(*info));
192
193190   compute_tables();
194191
195192   info->master_clock = clock;
r4184r4185
205202   info->step = 0;
206203
207204   okim6258_state_save_register(info, device);
208
209   return info;
210205}
211206
212207
r4184r4185
475470   switch (state)
476471   {
477472      /* --- the following bits of info are returned as 64-bit signed integers --- */
473      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct okim6258);         break;
478474
479475      /* --- the following bits of info are returned as pointers to data or functions --- */
480476      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME(okim6258); break;
src/emu/sound/es5503.c
r4184r4185
227227{
228228   const es5503_interface *intf;
229229   int osc;
230   ES5503Chip *chip;
230   ES5503Chip *chip = device->token;
231231
232   chip = auto_malloc(sizeof(*chip));
233   memset(chip, 0, sizeof(*chip));
232   intf = device->static_config;
234233
235   intf = config;
236
237234   chip->irq_callback = intf->irq_callback;
238235   chip->adc_read = intf->adc_read;
239236   chip->docram = intf->wave_memory;
r4184r4185
267264
268265   chip->output_rate = (clock/8)/34;   // (input clock / 8) / # of oscs. enabled + 2
269266   chip->stream = stream_create(device, 0, 2, chip->output_rate, chip, es5503_pcm_update);
270
271   return chip;
272267}
273268
274269READ8_HANDLER(es5503_reg_0_r)
r4184r4185
521516   switch (state)
522517   {
523518      /* --- the following bits of info are returned as 64-bit signed integers --- */
519      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(ES5503Chip);               break;
524520
525521      /* --- the following bits of info are returned as pointers to data or functions --- */
526522      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( es5503 );   break;
src/emu/sound/nile.c
r4184r4185
218218
219219static SND_START( nile )
220220{
221   struct nile_info *info;
221   struct nile_info *info = device->token;
222222
223   info = auto_malloc(sizeof(*info));
224   memset(info, 0, sizeof(*info));
225
226223   info->sound_ram = device->region;
227224
228225   info->stream = stream_create(device, 0, 2, 44100, info, nile_update);
229
230   return info;
231226}
232227
233228
r4184r4185
250245   switch (state)
251246   {
252247      /* --- the following bits of info are returned as 64-bit signed integers --- */
248      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct nile_info);         break;
253249
254250      /* --- the following bits of info are returned as pointers to data or functions --- */
255251      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( nile );   break;
src/emu/sound/es8712.c
r4184r4185
209209
210210static SND_START( es8712 )
211211{
212   struct es8712 *chip;
212   struct es8712 *chip = device->token;
213213
214   chip = auto_malloc(sizeof(*chip));
215   memset(chip, 0, sizeof(*chip));
216
217214   compute_tables();
218215
219216   chip->start = 0;
r4184r4185
230227   chip->signal = -2;
231228
232229   es8712_state_save_register(chip, device);
233
234   /* success */
235   return chip;
236230}
237231
238232
r4184r4185
450444   switch (state)
451445   {
452446      /* --- the following bits of info are returned as 64-bit signed integers --- */
447      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct es8712);            break;
453448
454449      /* --- the following bits of info are returned as pointers to data or functions --- */
455450      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( es8712 );   break;
src/emu/sound/nes_apu.c
r4184r4185
670670/* INITIALIZE APU SYSTEM */
671671static SND_START( nesapu )
672672{
673   const nes_interface *intf = config;
674   struct nesapu_info *info;
673   const nes_interface *intf = device->static_config;
674   struct nesapu_info *info = device->token;
675675   int rate = clock / 4;
676676   int i;
677677
678   info = auto_malloc(sizeof(*info));
679   memset(info, 0, sizeof(*info));
680
681678   /* Initialize global variables */
682679   info->samps_per_sync = rate / ATTOSECONDS_TO_HZ(video_screen_get_frame_period(device->machine->primary_screen).attoseconds);
683680   info->buffer_size = info->samps_per_sync;
r4184r4185
751748#else
752749   state_save_register_device_item(device, 0, info->APU.buf_pos);
753750#endif
754
755   return info;
756751}
757752
758753
r4184r4185
774769   switch (state)
775770   {
776771      /* --- the following bits of info are returned as 64-bit signed integers --- */
772      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct nesapu_info);         break;
777773
778774      /* --- the following bits of info are returned as pointers to data or functions --- */
779775      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( nesapu );   break;
src/emu/sound/262intf.c
r4184r4185
7070static SND_START( ymf262 )
7171{
7272   static const ymf262_interface dummy = { 0 };
73   struct ymf262_info *info;
73   struct ymf262_info *info = device->token;
7474   int rate = clock/288;
7575
76   info = auto_malloc(sizeof(*info));
77   memset(info, 0, sizeof(*info));
78
79   info->intf = config ? config : &dummy;
76   info->intf = device->static_config ? device->static_config : &dummy;
8077   info->device = device;
8178
8279   /* stream system initialize */
8380   info->chip = ymf262_init(device,clock,rate);
84   if (info->chip == NULL)
85      return NULL;
81   assert_always(info->chip != NULL, "Error creating YMF262 chip");
8682
8783   info->stream = stream_create(device,0,4,rate,info,ymf262_stream_update);
8884
r4184r4185
9389
9490   info->timer[0] = timer_alloc(device->machine, timer_callback_262_0, info);
9591   info->timer[1] = timer_alloc(device->machine, timer_callback_262_1, info);
96
97   return info;
9892}
9993
10094static SND_STOP( ymf262 )
r4184r4185
173167   switch (state)
174168   {
175169      /* --- the following bits of info are returned as 64-bit signed integers --- */
170      case SNDINFO_INT_TOKEN_BYTES:               info->i = sizeof(struct ymf262_info);            break;
176171
177172      /* --- the following bits of info are returned as pointers to data or functions --- */
178173      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ymf262 );      break;
src/emu/sndintrf.c
r4184r4185
3737typedef struct _sndintrf_data sndintrf_data;
3838struct _sndintrf_data
3939{
40   snd_class_header   intf;          /* copy of the interface data */
4140   sound_type      sndtype;       /* type index of this sound chip */
4241   sound_type      aliastype;      /* aliased type index of this sound chip */
4342   device_config *   device;         /* dummy device for now */
r4184r4185
6665***************************************************************************/
6766
6867static sndintrf_data sound[MAX_SOUND];
69static sndintrf_data *current_sound_start;
7068static int totalsnd;
7169
7270
r4184r4185
9795static DEVICE_GET_INFO( sndclass )
9896{
9997   sndintrf_data *snddata = device->inline_config;
100   (*snddata->intf.get_info)(device, state, (sndinfo *)info);
98   (*snddata->sndtype)(device, state, (sndinfo *)info);
10199}
102100
103101int sndintrf_init_sound(running_machine *machine, int sndnum, const char *tag, sound_type sndtype, int clock, const void *config)
104102{
105103   snd_start_func start;
106104   sndintrf_data *info = &sound[sndnum];
105   int tokenbytes;
107106   int index;
108107   int sndidx;
109108
r4184r4185
120119   info->device->inline_config = info;
121120
122121   /* fill in the type and interface */
123   info->intf.get_info = sndtype;
124   info->intf.set_info = (snd_set_info_func)sndtype_get_info_fct(sndtype, SNDINFO_PTR_SET_INFO);
125122   info->sndtype = sndtype;
126123   info->aliastype = (sound_type)sndtype_get_info_fct(sndtype, SNDINFO_FCT_ALIAS);
127124   if (info->aliastype == 0)
r4184r4185
135132   info->index = index;
136133   totalsnd++;
137134
135   /* allocate the token */
136   tokenbytes = sndtype_get_info_int(sndtype, DEVINFO_INT_TOKEN_BYTES);
137   assert(tokenbytes != 0);
138   info->device->token = auto_malloc(tokenbytes);
139   memset(info->device->token, 0, tokenbytes);
140
138141   /* start the chip, tagging all its streams */
139   current_sound_start = &sound[sndnum];
140142   start = (snd_start_func)sndtype_get_info_fct(sndtype, SNDINFO_PTR_START);
141   info->device->token = (*start)(info->device, clock, config);
142   current_sound_start = NULL;
143   (*start)(info->device, clock);
143144   VPRINTF(("  token = %p\n", info->device->token));
144145
145   /* if that failed, die */
146   if (info->device->token == NULL)
147      return 1;
148
149146   return 0;
150147}
151148
r4184r4185
160157   sndinfo info;
161158
162159   info.stop = NULL;
163   (*sound[sndnum].intf.get_info)(NULL, SNDINFO_PTR_STOP, &info);
160   (*sound[sndnum].sndtype)(NULL, SNDINFO_PTR_STOP, &info);
164161
165162   /* stop the chip */
166163   if (info.stop)
r4184r4185
174171***************************************************************************/
175172
176173/*-------------------------------------------------
177    sndintrf_register_token - register a token
178    from within the sound_start routine
179-------------------------------------------------*/
180
181void sndintrf_register_token(void *token)
182{
183   if (current_sound_start)
184      current_sound_start->device->token = token;
185}
186
187
188/*-------------------------------------------------
189174    sndti_exists - return TRUE if a (type,index)
190175    pair describes an existing chip
191176-------------------------------------------------*/
r4184r4185
258243
259244   VERIFY_SNDNUM(sndnum_get_info_int);
260245   info.i = 0;
261   (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info);
246   (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
262247   return info.i;
263248}
264249
r4184r4185
268253
269254   VERIFY_SNDNUM(sndnum_get_info_ptr);
270255   info.p = NULL;
271   (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info);
256   (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
272257   return info.p;
273258}
274259
r4184r4185
278263
279264   VERIFY_SNDNUM(sndnum_get_info_fct);
280265   info.f = NULL;
281   (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info);
266   (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
282267   return info.f;
283268}
284269
r4184r4185
289274
290275   VERIFY_SNDNUM(sndnum_get_info_string);
291276   info.s = get_temp_string_buffer();
292   (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info);
277   (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
293278   return info.s;
294279}
295280
296281
297282/*-------------------------------------------------
298    Set info accessors
299-------------------------------------------------*/
300
301void sndnum_set_info_int(int sndnum, UINT32 state, INT64 data)
302{
303   sndinfo info;
304   VERIFY_SNDNUM(sndnum_set_info_int);
305   info.i = data;
306   (*sound[sndnum].intf.set_info)(sound[sndnum].device, state, &info);
307}
308
309void sndnum_set_info_ptr(int sndnum, UINT32 state, void *data)
310{
311   sndinfo info;
312   VERIFY_SNDNUM(sndnum_set_info_ptr);
313   info.p = data;
314   (*sound[sndnum].intf.set_info)(sound[sndnum].device, state, &info);
315}
316
317void sndnum_set_info_fct(int sndnum, UINT32 state, genf *data)
318{
319   sndinfo info;
320   VERIFY_SNDNUM(sndnum_set_info_ptr);
321   info.f = data;
322   (*sound[sndnum].intf.set_info)(sound[sndnum].device, state, &info);
323}
324
325
326/*-------------------------------------------------
327283    Misc accessors
328284-------------------------------------------------*/
329285
r4184r4185
333289
334290   VERIFY_SNDNUM(sndnum_reset);
335291   info.reset = NULL;
336   (*sound[sndnum].intf.get_info)(NULL, SNDINFO_PTR_RESET, &info);
292   (*sound[sndnum].sndtype)(NULL, SNDINFO_PTR_RESET, &info);
337293   if (info.reset)
338294      (info.reset)(sound[sndnum].device);
339295}
r4184r4185
366322
367323   VERIFY_SNDTI(sndti_get_info_int);
368324   info.i = 0;
369   (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info);
325   (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
370326   return info.i;
371327}
372328
r4184r4185
376332
377333   VERIFY_SNDTI(sndti_get_info_ptr);
378334   info.p = NULL;
379   (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info);
335   (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
380336   return info.p;
381337}
382338
r4184r4185
386342
387343   VERIFY_SNDTI(sndti_get_info_fct);
388344   info.f = NULL;
389   (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info);
345   (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
390346   return info.f;
391347}
392348
r4184r4185
397353
398354   VERIFY_SNDTI(sndti_get_info_string);
399355   info.s = get_temp_string_buffer();
400   (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info);
356   (*sound[sndnum].sndtype)(sound[sndnum].device, state, &info);
401357   return info.s;
402358}
403359
404360
405361/*-------------------------------------------------
406    Set info accessors
407-------------------------------------------------*/
408
409void sndti_set_info_int(sound_type sndtype, int sndindex, UINT32 state, INT64 data)
410{
411   sndinfo info;
412
413   VERIFY_SNDTI(sndti_set_info_int);
414   info.i = data;
415   (*sound[sndnum].intf.set_info)(sound[sndnum].device, state, &info);
416}
417
418void sndti_set_info_ptr(sound_type sndtype, int sndindex, UINT32 state, void *data)
419{
420   sndinfo info;
421
422   VERIFY_SNDTI(sndti_set_info_ptr);
423   info.p = data;
424   (*sound[sndnum].intf.set_info)(sound[sndnum].device, state, &info);
425}
426
427void sndti_set_info_fct(sound_type sndtype, int sndindex, UINT32 state, genf *data)
428{
429   sndinfo info;
430
431   VERIFY_SNDTI(sndti_set_info_ptr);
432   info.f = data;
433   (*sound[sndnum].intf.set_info)(sound[sndnum].device, state, &info);
434}
435
436
437/*-------------------------------------------------
438362    Misc accessors
439363-------------------------------------------------*/
440364
r4184r4185
444368
445369   VERIFY_SNDTI(sndti_reset);
446370   info.reset = NULL;
447   (*sound[sndnum].intf.get_info)(NULL, SNDINFO_PTR_RESET, &info);
371   (*sound[sndnum].sndtype)(NULL, SNDINFO_PTR_RESET, &info);
448372
449373   if (info.reset)
450374      (*info.reset)(sound[sndnum].device);
src/emu/sound.c
r4184r4185
821821   /* copy in all the relevant info */
822822   info->speaker = device->inline_config;
823823   info->tag = device->tag;
824
825   return DEVICE_START_OK;
826824}
827825
828826
src/emu/sndintrf.h
r4184r4185
3232   /* --- the following bits of info are returned as 64-bit signed integers --- */
3333   SNDINFO_INT_FIRST = DEVINFO_INT_FIRST,
3434
35      SNDINFO_INT_TOKEN_BYTES = DEVINFO_INT_TOKEN_BYTES,   /* R/O: bytes to allocate for the token */
36
3537   SNDINFO_INT_CORE_SPECIFIC = DEVINFO_INT_DEVICE_SPECIFIC, /* R/W: core-specific values start here */
3638
3739   /* --- the following bits of info are returned as pointers to data or functions --- */
r4184r4185
4244   /* --- the following bits of info are returned as pointers to functions --- */
4345   SNDINFO_FCT_FIRST = DEVINFO_FCT_FIRST,
4446
47      SNDINFO_PTR_START = DEVINFO_FCT_START,            /* R/O: void *(*start)(const device_config *device, int clock) */
4548      SNDINFO_PTR_STOP = DEVINFO_FCT_STOP,            /* R/O: void (*stop)(const device_config *device) */
4649      SNDINFO_PTR_RESET = DEVINFO_FCT_RESET,            /* R/O: void (*reset)(const device_config *device) */
4750
4851      SNDINFO_PTR_SET_INFO = DEVINFO_FCT_CLASS_SPECIFIC,   /* R/O: void (*set_info)(const device_config *device, UINT32 state, sndinfo *info) */
49      SNDINFO_PTR_START,                           /* R/O: void *(*start)(const device_config *device, int clock, const void *config) */
5052      SNDINFO_FCT_ALIAS,                           /* R/O: alias to sound type for (type,index) identification */
5153
5254   SNDINFO_FCT_CORE_SPECIFIC = DEVINFO_FCT_DEVICE_SPECIFIC, /* R/W: core-specific values start here */
r4184r4185
7880#define SND_SET_INFO_CALL(name)      SND_SET_INFO_NAME(name)(device, state, info)
7981
8082#define SND_START_NAME(name)      snd_start_##name
81#define SND_START(name)            void *SND_START_NAME(name)(const device_config *device, int clock, const void *config)
82#define SND_START_CALL(name)      SND_START_NAME(name)(device, clock, config)
83#define SND_START(name)            void SND_START_NAME(name)(const device_config *device, int clock)
84#define SND_START_CALL(name)      SND_START_NAME(name)(device, clock)
8385
8486#define SND_STOP_NAME(name)         snd_stop_##name
8587#define SND_STOP(name)            void SND_STOP_NAME(name)(const device_config *device)
r4184r4185
101103/* define the various callback functions */
102104typedef void (*snd_get_info_func)(const device_config *device, UINT32 state, sndinfo *info);
103105typedef void (*snd_set_info_func)(const device_config *device, UINT32 state, sndinfo *info);
104typedef void *(*snd_start_func)(const device_config *device, int clock, const void *config);
106typedef void (*snd_start_func)(const device_config *device, int clock);
105107typedef void (*snd_stop_func)(const device_config *device);
106108typedef void (*snd_reset_func)(const device_config *device);
107109
r4184r4185
123125   snd_reset_func      reset;                     /* SNDINFO_PTR_RESET */
124126};
125127
126typedef struct _snd_class_header snd_class_header;
127struct _snd_class_header
128{
129   /* table of core functions */
130   snd_get_info_func   get_info;
131   snd_set_info_func   set_info;
132};
133128
134129
135130/***************************************************************************
r4184r4185
170165genf *sndti_get_info_fct(sound_type sndtype, int sndindex, UINT32 state);
171166const char *sndti_get_info_string(sound_type sndtype, int sndindex, UINT32 state);
172167
173/* set info accessors */
174void sndti_set_info_int(sound_type sndtype, int sndindex, UINT32 state, INT64 data);
175void sndti_set_info_ptr(sound_type sndtype, int sndindex, UINT32 state, void *data);
176void sndti_set_info_fct(sound_type sndtype, int sndindex, UINT32 state, genf *data);
177
178168#define sndti_get_name(sndtype, sndindex)         sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_NAME)
179169#define sndti_get_core_family(sndtype, sndindex)   sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_FAMILY)
180170#define sndti_get_core_version(sndtype, sndindex)   sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_VERSION)
r4184r4185
217207void sndintrf_init(running_machine *machine);
218208int sndintrf_init_sound(running_machine *machine, int sndnum, const char *tag, sound_type sndtype, int clock, const void *config);
219209void sndintrf_exit_sound(int sndnum);
220void sndintrf_register_token(void *token);
221210
222211/* Misc helpers */
223212int sndti_exists(sound_type sndtype, int sndindex);
src/emu/state.c
r4184r4185
569569   /* generate the header */
570570   memcpy(&header[0], ss_magic_num, 8);
571571   header[8] = SAVE_VERSION;
572#ifdef LSB_FIRST
573   header[9] = 0;
574#else
575   header[9] = SS_MSB_FIRST;
576#endif
572   header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST);
577573   strncpy((char *)&header[0x0a], machine->gamedrv->name, 0x1c - 0x0a);
578574   *(UINT32 *)&header[0x1c] = LITTLE_ENDIANIZE_INT32(signature);
579575
r4184r4185
629625      return STATERR_INVALID_HEADER;
630626
631627   /* determine whether or not to flip the data when done */
632#ifdef LSB_FIRST
633   flip = ((header[9] & SS_MSB_FIRST) != 0);
634#else
635   flip = ((header[9] & SS_MSB_FIRST) == 0);
636#endif
628   flip = NATIVE_ENDIAN_VALUE_LE_BE((header[9] & SS_MSB_FIRST) != 0, (header[9] & SS_MSB_FIRST) == 0);
637629
638630   /* read all the data, flipping if necessary */
639631   for (entry = global->entrylist; entry != NULL; entry = entry->next)
src/emu/timer.c
r4184r4185
12691269         fatalerror("Unknown timer device type");
12701270         break;
12711271   }
1272
1273   return DEVICE_START_OK;
12741272}
12751273
12761274
src/emu/drivers/xtal.h
r4184r4185
111111   XTAL_20_079MHz      = 20790000,      /* Blockade-hardware Gremlin games */
112112   XTAL_21MHz        = 21000000,      /* Lock-On pixel clock */
113113   XTAL_21_3MHz        = 21300000,
114   XTAL_21_477MHz       = 21477000,      /* Super Othello */
114115   XTAL_21_4772MHz    = 21477200,      /* BMC bowling, some Data East 90's games */
115116   XTAL_22MHz         = 22000000,
116117   XTAL_22_1184MHz      = 22118400,
src/emu/romload.c
r4184r4185
613613   UINT32 regionlength = memory_region_length(romdata->machine, rgntag);
614614   UINT32 regionflags = memory_region_flags(romdata->machine, rgntag);
615615   UINT8 *regionbase = memory_region(romdata->machine, rgntag);
616   int littleendian = ((regionflags & ROMREGION_ENDIANMASK) == ROMREGION_LE);
616   int endianness = ((regionflags & ROMREGION_ENDIANMASK) == ROMREGION_LE) ? ENDIANNESS_LITTLE : ENDIANNESS_BIG;
617617   int datawidth = 1 << ((regionflags & ROMREGION_WIDTHMASK) >> 8);
618618   UINT8 *base;
619619   int i, j;
620620
621   LOG(("+ datawidth=%d little=%d\n", datawidth, littleendian));
621   LOG(("+ datawidth=%d little=%d\n", datawidth, endianness == ENDIANNESS_LITTLE));
622622
623623   /* if the region is inverted, do that now */
624624   if (regionflags & ROMREGION_INVERTMASK)
r4184r4185
629629   }
630630
631631   /* swap the endianness if we need to */
632#ifdef LSB_FIRST
633   if (datawidth > 1 && !littleendian)
634#else
635   if (datawidth > 1 && littleendian)
636#endif
632   if (datawidth > 1 && endianness != ENDIANNESS_NATIVE)
637633   {
638634      LOG(("+ Byte swapping region\n"));
639635      for (i = 0, base = regionbase; i < regionlength; i += datawidth)
src/mess/audio/lmc1992.c
r4184r4185
159159   state_save_register_device_item(device, 0, lmc1992->fader_lf);
160160   state_save_register_device_item(device, 0, lmc1992->fader_rr);
161161   state_save_register_device_item(device, 0, lmc1992->fader_lr);
162   return DEVICE_START_OK;
163162}
164163
165164static DEVICE_SET_INFO( lmc1992 )
src/mess/audio/mea8000.c
r4184r4185
698698   state_save_register_item( device->machine, "mea8000", device->tag, 0, mea8000->last_pitch );
699699   state_save_register_item( device->machine, "mea8000", device->tag, 0, mea8000->pitch );
700700   state_save_register_item( device->machine, "mea8000", device->tag, 0, mea8000->noise );
701   return DEVICE_START_OK;
702701}
703702
704703
src/mess/audio/cdp1863.c
r4184r4185
149149   state_save_register_device_item(device, 0, cdp1863->latch);
150150   state_save_register_device_item(device, 0, cdp1863->signal);
151151   state_save_register_device_item(device, 0, cdp1863->incr);
152
153   return DEVICE_START_OK;
154152}
155153
156154static DEVICE_RESET( cdp1863 )
src/mess/video/i8275.c
r4184r4185
531531
532532   state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->burst_space_code);
533533   state_save_register_item(device->machine, "I8275", device->tag, 0, i8275->burst_count_code);
534   return DEVICE_START_OK;
535534}
536535
537536static DEVICE_RESET( i8275 )
src/mess/video/cdp1862.c
r4184r4185
151151   state_save_register_device_item(device, 0, cdp1862->bgcolor);
152152   state_save_register_device_item(device, 0, cdp1862->con);
153153   state_save_register_device_item_bitmap(device, 0, cdp1862->bitmap);
154
155   return DEVICE_START_OK;
156154}
157155
158156static DEVICE_RESET( cdp1862 )
src/mess/video/crtc_ega.c
r4184r4185
813813static DEVICE_START( crtc_ega )
814814{
815815   common_start(device, TYPE_CRTC_EGA);
816   return DEVICE_START_OK;
817816}
818817
819818
src/mess/video/zx8301.c
r4184r4185
265265   state_save_register_item(device->machine, "zx8301", device->tag, 0, zx8301->flash);
266266   state_save_register_item(device->machine, "zx8301", device->tag, 0, zx8301->vsync);
267267   state_save_register_item(device->machine, "zx8301", device->tag, 0, zx8301->vda);
268
269   return DEVICE_START_OK;
270268}
271269
272270static DEVICE_RESET( zx8301 )
src/mess/video/msm6255.c
r4184r4185
374374
375375   state_save_register_device_item(device, 0, msm6255->cursor);
376376   state_save_register_device_item(device, 0, msm6255->frame);
377   return DEVICE_START_OK;
378377}
379378
380379static DEVICE_RESET( msm6255 )
src/mess/video/cdp1864.c
r4184r4185
395395   state_save_register_device_item(device, 0, cdp1864->incr);
396396
397397   state_save_register_bitmap(device->machine, "cdp1864", device->tag, 0, "cdp1864->bitmap", cdp1864->bitmap);
398   return DEVICE_START_OK;
399398}
400399
401400static DEVICE_RESET( cdp1864 )
src/mess/video/dl1416.c
r4184r4185
133133   state_save_register_item(device->machine, "dl1416", device->tag, 0, dl1416->cursor_enable);
134134   state_save_register_item(device->machine, "dl1416", device->tag, 0, dl1416->write_enable);
135135   state_save_register_item_array(device->machine, "dl1416", device->tag, 0, dl1416->cursor_ram);
136
137   return DEVICE_START_OK;
138136}
139137
140138
src/mess/video/cdp1861.c
r4184r4185
216216   state_save_register_device_item(device, 0, cdp1861->disp);
217217   state_save_register_device_item(device, 0, cdp1861->dmaout);
218218   state_save_register_device_item_bitmap(device, 0, cdp1861->bitmap);
219
220   return DEVICE_START_OK;
221219}
222220
223221static DEVICE_RESET( cdp1861 )
src/mess/device.c
r4184r4185
181181
182182static DEVICE_START(mess_device)
183183{
184   device_start_err err = DEVICE_START_OK;
185
186184   mess_device_config *mess_device = (mess_device_config *) device->inline_config;
187185   mess_device_token *token = (mess_device_token *) device->token;
188186   device_start_func inner_start;
r4184r4185
193191   /* if present, invoke the start handler */
194192   inner_start = (device_start_func) mess_device_get_info_fct(&mess_device->io_device.devclass, MESS_DEVINFO_PTR_START);
195193   if (inner_start != NULL)
196      err = (*inner_start)(device);
197
198   return err;
194      (*inner_start)(device);
199195}
200196
201197
src/mess/machine/pdp1.c
r4184r4185
372372
373373DEVICE_START( pdp1_tape )
374374{
375   return DEVICE_START_OK;
376375}
377376
378377
src/mess/machine/applefdc.c
r4184r4185
643643static DEVICE_START(oldfdc)
644644{
645645   applefdc_start(device, APPLEFDC_APPLE2);
646   return DEVICE_START_OK;
647646}
648647
649648
r4184r4185
677676static DEVICE_START(iwm)
678677{
679678   applefdc_start(device, APPLEFDC_IWM);
680   return DEVICE_START_OK;
681679}
682680
683681
r4184r4185
711709static DEVICE_START(swim)
712710{
713711   applefdc_start(device, APPLEFDC_SWIM);
714   return DEVICE_START_OK;
715712}
716713
717714
src/mess/machine/conkort.c
r4184r4185
835835   state_save_register_device_item(device, 0, conkort->fdc_irq);
836836
837837   astring_free(tempstring);
838
839   return DEVICE_START_OK;
840838}
841839
842840static DEVICE_RESET( luxor_55_10828 )
r4184r4185
903901   state_save_register_device_item(device, 0, conkort->fdc_irq);
904902
905903   astring_free(tempstring);
906
907   return DEVICE_START_OK;
908904}
909905
910906static DEVICE_RESET( luxor_55_21046 )
src/mess/machine/hp48.c
r4184r4185
10781078static DEVICE_START( hp48_port )
10791079{
10801080   hp48_unfill_port( device );
1081   return DEVICE_START_OK;
10821081}
10831082
10841083DEVICE_GET_INFO( hp48_port )
src/mess/machine/ap2_slot.c
r4184r4185
9696   {
9797      token->slot_device = NULL;
9898   }
99   return DEVICE_START_OK;
10099}
101100
102101
src/mess/machine/mockngbd.c
r4184r4185
7676
7777static DEVICE_START(mockingboard)
7878{
79   return DEVICE_START_OK;
8079}
8180
8281
src/mess/machine/ncr5380.c
r4184r4185
440440#if NCR5380_DEVICE_CONVERSION
441441static DEVICE_START( ncr5380 )
442442{
443   return DEVICE_START_OK;
444443}
445444
446445
src/mess/machine/at45dbxx.c
r4184r4185
8787    IMPLEMENTATION
8888***************************************************************************/
8989
90static device_start_err common_start(const device_config *device, int device_type)
90static void common_start(const device_config *device, int device_type)
9191{
9292   at45dbxx_t *flash = get_token(device);
9393   
r4184r4185
114114   state_save_register_item(device->machine, "at45dbxx", device->tag, 0, flash->pin.wp);
115115   state_save_register_item(device->machine, "at45dbxx", device->tag, 0, flash->pin.reset);
116116   state_save_register_item(device->machine, "at45dbxx", device->tag, 0, flash->pin.busy);
117   return DEVICE_START_OK;   
118117}
119118
120119static DEVICE_START( at45db041 )
121120{
122   return common_start(device, TYPE_AT45DB041);
121   common_start(device, TYPE_AT45DB041);
123122}
124123
125124static DEVICE_START( at45db081 )
126125{
127   return common_start(device, TYPE_AT45DB081);
126   common_start(device, TYPE_AT45DB081);
128127}
129128
130129static DEVICE_START( at45db161 )
131130{
132   return common_start(device, TYPE_AT45DB161);
131   common_start(device, TYPE_AT45DB161);
133132}
134133
135134static DEVICE_RESET( at45dbxx )
src/mess/machine/d88.c
r4184r4185
3535DEVICE_START(d88image_floppy)
3636{
3737   floppy_drive_init(device, &d88image_floppy_interface);
38   return DEVICE_START_OK;
3938}
4039
4140/* attempt to insert a disk into the drive specified with id */
src/mess/machine/pokemini.c
r4184r4185
14001400
14011401DEVICE_START( pokemini_cart )
14021402{
1403   return DEVICE_START_OK;
14041403}
14051404
14061405DEVICE_IMAGE_LOAD( pokemini_cart )
src/mess/machine/rp5c15.c
r4184r4185
185185
186186   rtc_timer = timer_alloc(device->machine, rtc_alarm_pulse, (void*)device);
187187   timer_adjust_periodic(rtc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(32));
188
189   return DEVICE_START_OK;
190188}
191189
192190static int rp5c15_read(const device_config* device, int offset, UINT16 mem_mask)
src/mess/machine/tc8521.c
r4184r4185
388388   tc8521_t *rtc = get_token(device);
389389   memset(rtc, 0, sizeof(*rtc));
390390   timer_pulse(device->machine, ATTOTIME_IN_HZ(32), (void *) device, 0, tc8521_timer_callback);
391   return DEVICE_START_OK;
392391}
393392
394393
src/mess/machine/mc6854.c
r4184r4185
10181018   state_save_register_item_array( device->machine, "mc6854", device->tag, 0, mc6854->frame );
10191019   state_save_register_item( device->machine, "mc6854", device->tag, 0, mc6854->flen );
10201020   state_save_register_item( device->machine, "mc6854", device->tag, 0, mc6854->fpos );
1021
1022   return DEVICE_START_OK;
10231021}
10241022
10251023
src/mess/machine/gb.c
r4184r4185
14181418   CartType = 0;
14191419   ROMMask = 0;
14201420   RAMMask = 0;
1421   return DEVICE_START_OK;
14221421}
14231422
14241423DEVICE_IMAGE_LOAD(gb_cart)
src/mess/machine/gamecom.c
r4184r4185
652652DEVICE_START( gamecom_cart )
653653{
654654   internal_ram = device_get_info_ptr(device->machine->cpu[0], CPUINFO_PTR_SM8500_INTERNAL_RAM);
655   return DEVICE_START_OK;
656655}
657656
658657DEVICE_IMAGE_LOAD( gamecom_cart )
src/mess/machine/ins8154.c
r4184r4185
6060   state_save_register_item(device->machine, "ins8154", device->tag, 0, ins8154->mdr);
6161   state_save_register_item(device->machine, "ins8154", device->tag, 0, ins8154->odra);
6262   state_save_register_item(device->machine, "ins8154", device->tag, 0, ins8154->odrb);
63   return DEVICE_START_OK;
6463}
6564
6665
src/mess/machine/smartmed.c
r4184r4185
120120   smartmedia[id].pagereg = NULL;
121121   smartmedia[id].id[0] = smartmedia[id].id[1] = 0;
122122   smartmedia[id].mp_opcode = 0;
123   return DEVICE_START_OK;
124123}
125124
126125/*
src/mess/machine/serial.c
r4184r4185
639639{
640640   int id = image_index_in_device(device);
641641   memset(&serial_devices[id], 0, sizeof(serial_devices[id]));
642   return DEVICE_START_OK;
643642}
644643
645644DEVICE_IMAGE_LOAD(serial_device)
src/mess/machine/74145.c
r4184r4185
128128
129129   /* register for state saving */
130130   state_save_register_item(device->machine, "ttl74145", device->tag, 0, ttl74145->number);
131
132   return DEVICE_START_OK;
133131}
134132
135133
src/mess/machine/thomson.c
r4184r4185
407407   serial_device_setup( device, 2400, 7, 2, SERIAL_PARITY_NONE ); /* default */
408408   serial_device_set_protocol( device, SERIAL_PROTOCOL_NONE );
409409   serial_device_set_transmit_state( device, 1 );
410   return DEVICE_START_OK;
411410}
412411
413412
src/mess/machine/mc6846.c
r4184r4185
606606   state_save_register_item( device->machine, "mc6846", device->tag, 0, mc6846->latch );
607607   state_save_register_item( device->machine, "mc6846", device->tag, 0, mc6846->preset );
608608   state_save_register_item( device->machine, "mc6846", device->tag, 0, mc6846->timer_started );
609
610   return DEVICE_START_OK;
611609}
612610
613611
src/mess/machine/cdp1871.c
r4184r4185
320320   state_save_register_device_item(device, 0, cdp1871->next_da);
321321   state_save_register_device_item(device, 0, cdp1871->rpt);
322322   state_save_register_device_item(device, 0, cdp1871->next_rpt);
323   return DEVICE_START_OK;
324323}
325324
326325static DEVICE_SET_INFO( cdp1871 )
src/mess/machine/8530scc.c
r4184r4185
6666{
6767   scc8530_t *scc = get_token(device);
6868   memset(scc, 0, sizeof(*scc));
69   return DEVICE_START_OK;
7069}
7170
7271
src/mess/machine/sst39vfx.c
r4184r4185
5353    IMPLEMENTATION
5454***************************************************************************/
5555
56static device_start_err common_start(const device_config *device, int device_type)
56static void common_start(const device_config *device, int device_type)
5757{
5858   sst39vfx_t *flash = get_token(device);
5959   const sst39vfx_config *config = get_config(device);
r4184r4185
7474
7575   state_save_register_item_pointer(device->machine, "sst39vfx", device->tag, 0, flash->data, flash->size);
7676   state_save_register_item(device->machine, "sst39vfx", device->tag, 0, flash->swap);
77   
78   return DEVICE_START_OK;   
7977}
8078
8179
8280static DEVICE_START( sst39vf020 )
8381{
84   return common_start(device, TYPE_SST39VF020);
82   common_start(device, TYPE_SST39VF020);
8583}
8684
8785static DEVICE_START( sst39vf400a )
8886{
89   return common_start(device, TYPE_SST39VF400A);
87   common_start(device, TYPE_SST39VF400A);
9088}
9189
9290UINT8* sst39vfx_get_base( const device_config *device)
src/mess/machine/6883sam.c
r4184r4185
234234}
235235
236236/* Device Interface */
237static device_start_err common_start(const device_config *device, SAM6883_VERSION device_type)
237static void common_start(const device_config *device, SAM6883_VERSION device_type)
238238{
239239   sam6883_t *sam = get_safe_token(device);
240240   // validate arguments
r4184r4185
253253   state_save_register_item(device->machine, "6883sam", NULL, 0, sam->state);
254254   state_save_register_item(device->machine, "6883sam", NULL, 0, sam->video_position);
255255   state_save_register_postload(device->machine, update_sam_postload, (void*)device);
256   return DEVICE_START_OK;
257256}
258257
259258static DEVICE_START( sam6883 )
260259{
261   return common_start(device, TYPE_SAM6883);
260   common_start(device, TYPE_SAM6883);
262261}
263262
264263static DEVICE_START( sam6883_gime )
265264{
266   return common_start(device, TYPE_SAM6883_GIME);
265   common_start(device, TYPE_SAM6883_GIME);
267266}
268267
269268static DEVICE_RESET( sam6883 )
src/mess/machine/tx0.c
r4184r4185
189189
190190DEVICE_START( tx0_tape )
191191{
192   return DEVICE_START_OK;
193192}
194193
195194
r4184r4185
547546DEVICE_START( tx0_magtape )
548547{
549548   magtape.img = device;
550   return DEVICE_START_OK;
551549}
552550
553551/*
src/mess/machine/ap2_lang.c
r4184r4185
8989static DEVICE_START(apple2_langcard)
9090{
9191   /* nothing to do */
92   return DEVICE_START_OK;
9392}
9493
9594
src/mess/machine/6530miot.c
r4184r4185
409409
410410   state_save_register_device_item(device, 0, miot->timershift);
411411   state_save_register_device_item(device, 0, miot->timerstate);
412
413   return DEVICE_START_OK;
414412}
415413
416414
src/mess/machine/tms9901.c
r4184r4185
596596   tms->clock_rate = tms->intf->clock_rate;
597597
598598   tms->int_state = 0;
599   return DEVICE_START_OK;
600599}
601600
602601
src/mess/machine/oric.c
r4184r4185
11121112{
11131113   /* TODO - THIS DOES NOT MULTITASK BETWEEN ORIC BASICDSKs AND MFM DISKS */
11141114   floppy_drive_init(device, NULL);
1115   return DEVICE_START_OK;
11161115}
11171116
11181117
src/mess/machine/68901mfp.c
r4184r4185
14441444   state_save_register_device_item(device, 0, mc68901->rxtx_stop);
14451445   state_save_register_device_item(device, 0, mc68901->rsr_read);
14461446   state_save_register_device_item(device, 0, mc68901->next_rsr);
1447   return DEVICE_START_OK;
14481447}
14491448
14501449static DEVICE_RESET( mc68901 )
src/mess/machine/amigafdc.c
r4184r4185
9595   fdc_side = 1;
9696   fdc_step = 1;
9797   fdc_rdy = 0;
98   return DEVICE_START_OK;
9998}
10099
101100static void check_extended_image( int id )
src/mess/machine/cbmdrive.c
r4184r4185
17211721   int id = image_index_in_device(device);
17221722   if (id == 0)
17231723      cbm_drive_open();   /* boy these C64 drivers are butt ugly */
1724   return DEVICE_START_OK;
17251724}
17261725
17271726static DEVICE_STOP( cbm_drive )
src/mess/machine/z80dart.c
r4184r4185
13491349
13501350   /* register for state saving */
13511351   //state_save_register_item_array(machine, "z80dart", device->tag, 0, z80dart->);
1352
1353   return DEVICE_START_OK;
13541352}
13551353
13561354static DEVICE_RESET( z80dart )
src/mess/machine/a7800.c
r4184r4185
218218   /* defaults for PAL bios without cart */
219219   a7800_cart_type = 0;
220220   a7800_stick_type = 1;
221   return DEVICE_START_OK;
222221}
223222
224223DEVICE_IMAGE_LOAD( a7800_cart )
src/mess/machine/tms9902.c
r4184r4185
641641   tms9902->clock_rate = tms9902->intf->clock_rate;
642642
643643   tms9902->timer = timer_alloc(device->machine, decrementer_callback, (void *) device);
644
645   return DEVICE_START_OK;
646644}
647645
648646
src/mess/machine/osborne1.c
r4184r4185
547547
548548static DEVICE_START( osborne1_daisy )
549549{
550   return DEVICE_START_OK;
551550}
552551
553552
src/mess/machine/sms.c
r4184r4185
763763
764764   /* Initially set the vdp to not use sms compatibility mode for GG */
765765   sms_set_ggsmsmode( 0 );
766   return DEVICE_START_OK;
767766}
768767
769768DEVICE_IMAGE_LOAD( sms_cart )
src/mess/machine/wd17xx.c
r4184r4185
16341634const wd17xx_interface default_wd17xx_interface = { NULL, NULL };
16351635
16361636/* device interface */
1637static device_start_err common_start(const device_config *device, wd17xx_type_t device_type)
1637static void common_start(const device_config *device, wd17xx_type_t device_type)
16381638{
16391639   wd17xx_t *w = get_safe_token(device);
16401640
r4184r4185
16521652   w->timer_rs = timer_alloc(device->machine, wd17xx_read_sector_callback, (void*)device);
16531653   w->timer_ws = timer_alloc(device->machine, wd17xx_write_sector_callback, (void*)device);
16541654   w->pause_time = 40;
1655     
1656   return DEVICE_START_OK;
1657
16581655}
16591656
16601657static DEVICE_RESET( wd17xx )
src/mess/machine/ti85.c
r4184r4185
674674{
675675   ti85_free_serial_data_memory(device->machine);
676676   ti85_receive_serial (NULL,0);
677   return DEVICE_START_OK;
678677}
679678
680679DEVICE_IMAGE_LOAD( ti85_serial )
src/mess/machine/svi318.c
r4184r4185
109109{
110110   pcart = NULL;
111111   pcart_rom_size = 0;
112   return DEVICE_START_OK;
113112}
114113
115114DEVICE_IMAGE_LOAD( svi318_cart )
src/mess/machine/wswan.c
r4184r4185
12911291   rtc.minute = 0;
12921292   rtc.second = 0;
12931293   rtc.setting = 0xFF;
1294   return DEVICE_START_OK;
12951294}
12961295
12971296DEVICE_IMAGE_LOAD(wswan_cart)
src/mess/machine/nec765.c
r4184r4185
22462246
22472247/* Device Interface */
22482248
2249static device_start_err common_start(const device_config *device, int device_type)
2249static void common_start(const device_config *device, int device_type)
22502250{
22512251   nec765_t *fdc = get_safe_token(device);
22522252   // validate arguments
r4184r4185
22682268
22692269   // register for state saving
22702270   //state_save_register_item(device->machine, "nec765", device->tag, 0, nec765->number);
2271   return DEVICE_START_OK;
22722271}
22732272
22742273static DEVICE_START( nec765a )
22752274{
2276   return common_start(device, TYPE_NEC765A);
2275   common_start(device, TYPE_NEC765A);
22772276}
22782277
22792278static DEVICE_START( nec765b )
22802279{
2281   return common_start(device, TYPE_NEC765B);
2280   common_start(device, TYPE_NEC765B);
22822281}
22832282
22842283static DEVICE_START( smc37c78 )
22852284{
2286   return common_start(device, TYPE_SMC37C78);
2285   common_start(device, TYPE_SMC37C78);
22872286}
22882287
22892288static DEVICE_START( nec72065 )
22902289{
2291   return common_start(device, TYPE_NEC72065);
2290   common_start(device, TYPE_NEC72065);
22922291}
22932292
22942293static DEVICE_RESET( nec765 )
src/mess/machine/abc99.c
r4184r4185
1313
1414static DEVICE_START( abc99 )
1515{
16   return DEVICE_START_OK;
1716}
1817
1918static DEVICE_SET_INFO( abc99 )
src/mess/machine/x68k_hdc.c
r4184r4185
5151   sasi->status_port = 0x00;
5252   sasi->phase = SASI_PHASE_BUSFREE;
5353   hd.current_block = 0;
54   return DEVICE_START_OK;
5554}
5655
5756DEVICE_IMAGE_CREATE( sasihd )
src/mess/machine/nc.c
r4184r4185
9797   /* card ram NULL */
9898   nc_card_ram = NULL;
9999   nc_card_size = 0;
100   return DEVICE_START_OK;
101100}
102101
103102/* load pcmcia card */
src/mess/machine/pcf8593.c
r4184r4185
9090   memset( rtc, 0, sizeof(*rtc));
9191   rtc->timer = timer_alloc(device->machine,  pcf8593_timer_callback , (void *) device);
9292   timer_adjust_periodic(rtc->timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1));
93   return DEVICE_START_OK;
9493}
9594
9695
src/mess/machine/i8271.c
r4184r4185
15651565
15661566   // register for state saving
15671567   //state_save_register_item(device->machine, "i8271", device->tag, 0, i8271->number);
1568   return DEVICE_START_OK;
15691568}
15701569
15711570static DEVICE_RESET( i8271 )
src/mess/machine/nes.c
r4184r4185
600600
601601   nes_fds.sides = 0;
602602   nes_fds.data = NULL;
603   return DEVICE_START_OK;
604603}
605604
606605
src/mess/machine/990_tap.c
r4184r4185
120120   t->wp = 1;
121121   t->bot = 0;
122122   t->eot = 0;
123   return DEVICE_START_OK;
124123}
125124
126125/*DEVICE_STOP( ti990_tape )
src/mess/machine/upd7002.c
r4184r4185
197197   state_save_register_item(device->machine, "uPD7002", device->tag, 0, uPD7002->data0);
198198   state_save_register_item(device->machine, "uPD7002", device->tag, 0, uPD7002->digitalvalue);
199199   state_save_register_item(device->machine, "uPD7002", device->tag, 0, uPD7002->conversion_counter);
200   return DEVICE_START_OK;
201200}
202201
203202static DEVICE_RESET( uPD7002 )
src/mess/machine/adc080x.c
r4184r4185
161161   state_save_register_item(device->machine, "adc080x", device->tag, 0, adc080x->sar);
162162   state_save_register_item(device->machine, "adc080x", device->tag, 0, adc080x->cycle);
163163   state_save_register_item(device->machine, "adc080x", device->tag, 0, adc080x->bit);
164   return DEVICE_START_OK;
165164}
166165
167166static DEVICE_SET_INFO( adc080x )
src/mess/machine/ds1315.c
r4184r4185
8484   memset(ds1315, 0, sizeof(*ds1315));
8585   ds1315->count = 0;
8686   ds1315->mode = DS_SEEK_MATCHING;
87
88   return DEVICE_START_OK;
8987}
9088
9189
src/mess/machine/6551.c
r4184r4185
154154   serial_connection_set_in_callback(device->machine, &acia->connection, acia_6551_in_callback);
155155   transmit_register_reset(&acia->transmit_reg);
156156   receive_register_reset(&acia->receive_reg);
157   return DEVICE_START_OK;
158157}
159158
160159
src/mess/machine/ay31015.c
r4184r4185
721721
722722   ay31015_update_rx_timer( device );
723723   ay31015_update_tx_timer( device );
724
725   return DEVICE_START_OK;
726724}
727725
728726
src/mess/machine/mc68328.c
r4184r4185
28052805    mc68328->pwm = timer_alloc(device->machine, mc68328_pwm_transition, 0);
28062806
28072807    mc68328_register_state_save(device);
2808
2809    return DEVICE_START_OK;
28102808}
28112809
28122810static DEVICE_SET_INFO( mc68328 )
src/mess/machine/vc20.c
r4184r4185
695695   vc20_rom_4000 = NULL;
696696   vc20_rom_6000 = NULL;
697697   vc20_rom_a000 = NULL;
698   return DEVICE_START_OK;
699698}
700699
701700static DEVICE_IMAGE_LOAD(vic20_cart)
src/mess/machine/mc6843.c
r4184r4185
830830   state_save_register_item( device->machine,"mc6843", device->tag, 0, mc6843->data_size );
831831   state_save_register_item( device->machine,"mc6843", device->tag, 0, mc6843->data_idx );
832832   state_save_register_item( device->machine,"mc6843", device->tag, 0, mc6843->data_id );
833   
834   return DEVICE_START_OK;
835833}
836834
837835
src/mess/machine/mm58274c.c
r4184r4185
474474   mm58274c->increment_rtc = timer_alloc(device->machine, increment_rtc, ((void*)device));
475475   timer_adjust_periodic(mm58274c->increment_rtc, attotime_zero, 0, ATTOTIME_IN_MSEC(100));
476476   mm58274c->interrupt_timer = timer_alloc(device->machine, rtc_interrupt_callback, ((void*)device));
477
478   return DEVICE_START_OK;
479477}
480478
481479
src/mess/machine/e0516.c
r4184r4185
212212   state_save_register_item(device->machine, "e0516", device->tag, 0, e0516->dio);
213213
214214   state_save_register_item_array(device->machine, "e0516", device->tag, 0, e0516->reg);
215   return DEVICE_START_OK;
216215}
217216
218217static DEVICE_SET_INFO( e0516 )
src/mess/machine/6525tpi.c
r4184r4185
165165   state_save_register_device_item(device, 0, tpi6525->cr);
166166   state_save_register_device_item(device, 0, tpi6525->air);
167167   state_save_register_device_item_array(device, 0, tpi6525->irq_level);
168
169   return DEVICE_START_OK;
170168}
171169
172170
src/mess/machine/intv.c
r4184r4185
477477   /* assume keyboard is absent */
478478   memory[0x7000 << 1] = 0xff;
479479   memory[(0x7000 << 1) + 1] = 0xff;
480
481   return DEVICE_START_OK;
482480}
483481
484482DEVICE_IMAGE_LOAD( intv_cart )
src/mess/machine/abc77.c
r4184r4185
345345   state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->clock);
346346   state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->hys);
347347   state_save_register_item(device->machine, "abc77", device->tag, 0, abc77->reset);
348
349   return DEVICE_START_OK;
350348}
351349
352350static DEVICE_SET_INFO( abc77 )
src/mess/machine/ins8250.c
r4184r4185
551551static DEVICE_START( ins8250 )
552552{
553553   common_start( device, TYPE_INS8250 );
554   return DEVICE_START_OK;
555554}
556555
557556
558557static DEVICE_START( ins8250a )
559558{
560559   common_start( device, TYPE_INS8250A );
561   return DEVICE_START_OK;
562560}
563561
564562
565563static DEVICE_START( ns16450 )
566564{
567565   common_start( device, TYPE_NS16450 );
568   return DEVICE_START_OK;
569566}
570567
571568
572569static DEVICE_START( ns16550 )
573570{
574571   common_start( device, TYPE_NS16550 );
575   return DEVICE_START_OK;
576572}
577573
578574
579575static DEVICE_START( ns16550a )
580576{
581577   common_start( device, TYPE_NS16550A );
582   return DEVICE_START_OK;
583578}
584579
585580
586581static DEVICE_START( pc16550d )
587582{
588583   common_start( device, TYPE_PC16550D );
589   return DEVICE_START_OK;
590584}
591585
592586
src/mess/machine/zx8302.c
r4184r4185
634634
635635   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->mdv_motor);
636636   state_save_register_item_array(device->machine, "zx8302", device->tag, 0, zx8302->mdv_offset);
637   return DEVICE_START_OK;
638637}
639638
640639static DEVICE_RESET( zx8302 )
src/mess/machine/c64.c
r4184r4185
14031403      cbm_c64_game = -1;
14041404      cbm_c64_exrom = -1;
14051405   }
1406   return DEVICE_START_OK;
14071406}
14081407
14091408/* Hardware Types for C64 carts */
src/mess/machine/hd63450.c
r4184r4185
6363      dmac->clock[x] = dmac->intf->clock[x];
6464      dmac->burst_clock[x] = dmac->intf->burst_clock[x];
6565   }
66   return DEVICE_START_OK;
6766}
6867
6968int hd63450_read(const device_config* device, int offset, UINT16 mem_mask)
src/mess/machine/ti99_4x.c
r4184r4185
387387   }
388388   
389389   cartridge_pages[id] = (UINT16 *) (memory_region(device->machine, "main") + offset_cart + (id * 0x2000));
390   return DEVICE_START_OK;
391390}
392391
393392/*
r4184r4185
786785      {
787786         memory_install_read16_handler(space, 0x9000, 0x93ff, 0, 0, ti99_rspeech_r);
788787         memory_install_write16_handler(space, 0x9400, 0x97ff, 0, 0, ti99_wspeech_w);
789
790         sndti_set_info_int(SOUND_TMS5220, 0, SNDINFO_INT_TMS5220_VARIANT, variant_tmc0285);
791788      }
792789   }
793790   else
src/mess/machine/msm8251.c
r4184r4185
141141   serial_connection_init(device->machine,&uart->connection);
142142   serial_connection_set_in_callback(device->machine,&uart->connection, msm8251_in_callback);
143143   uart->connection.input_state = 0;
144   return DEVICE_START_OK;
145144}
146145
147146
src/mess/machine/tms5501.c
r4184r4185
301301
302302   tms->command = 0;
303303   LOG_TMS5501(device, "Init", 0);
304   return DEVICE_START_OK;
305304}
306305
307306
src/mess/mess.mak
r4184r4185
450450   $(MESSOBJ)/osborne.a \
451451   $(MESSOBJ)/osi.a \
452452   $(MESSOBJ)/p2000.a \
453   $(MESSOBJ)/palm.a \
453454   $(MESSOBJ)/pasogo.a \
454455   $(MESSOBJ)/pc.a \
455456   $(MESSOBJ)/pcshare.a \
r4184r4185
463464   $(MESSOBJ)/rca.a \
464465   $(MESSOBJ)/rockwell.a \
465466   $(MESSOBJ)/rt1715.a \
466   $(MESSOBJ)/palm.a \
467467   $(MESSOBJ)/samcoupe.a \
468468   $(MESSOBJ)/sapi1.a \
469469   $(MESSOBJ)/sega.a \
src/mess/devices/harddriv.c
r4184r4185
273273   harddisk->config = device->static_config;
274274   harddisk->chd = NULL;
275275   harddisk->hard_disk_handle = NULL;
276   return DEVICE_START_OK;
277276}
278277
279278
src/mess/devices/cassette.c
r4184r4185
238238   cassette->config = device->static_config;
239239   cassette->cassette = NULL;
240240   cassette->state = cassette->config->default_state;
241   return DEVICE_START_OK;
242241}
243242
244243
src/mess/devices/microdrv.c
r4184r4185
1111
1212static DEVICE_START(microdrv)
1313{
14   return DEVICE_START_OK;
1514}
1615
1716DEVICE_GET_INFO(microdrv)
src/mess/devices/xmodem.c
r4184r4185
300300   state->conf = (xmodem_config*) device->static_config;
301301   state->machine = device->machine;
302302   state->timer = timer_alloc(device->machine,  xmodem_nak_cb, state );
303   return DEVICE_START_OK;
304303}
305304
306305static DEVICE_RESET( xmodem )
src/mess/devices/kermit.c
r4184r4185
640640   state->machine = device->machine;
641641   state->resend = timer_alloc(device->machine,  kermit_resend_cb, state );
642642   kermit_reset( state );
643   return DEVICE_START_OK;
644643}
645644
646645static DEVICE_RESET( kermit )
src/mess/devices/cartslot.c
r4184r4185
178178      return (*config->device_start)(device);
179179   
180180   process_cartridge(device, NULL);
181   return DEVICE_START_OK;
182181}
183182
184183
src/mess/devices/chd_cd.c
r4184r4185
129129   dev_cdrom_t   *cdrom = get_safe_token( device );
130130
131131   cdrom->cdrom_handle = NULL;
132   return DEVICE_START_OK;
133132}
134133
135134
src/mess/devices/mflopimg.c
r4184r4185
261261{
262262    image_alloctag(device, FLOPPY_TAG, sizeof(mess_flopimg));
263263   floppy_drive_init(device, &mess_floppy_interface);
264   return DEVICE_START_OK;
265264}
266265
267266
src/mess/devices/dsk.c
r4184r4185
7474static DEVICE_START( dsk_floppy )
7575{
7676   floppy_drive_init(device, NULL);
77   return DEVICE_START_OK;
7877}
7978
8079
src/mess/devices/appldriv.c
r4184r4185
283283
284284   parent_init = (device_start_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_START);
285285   parent_init(device);
286   return DEVICE_START_OK;
287286}
288287
289288
src/mess/devices/basicdsk.c
r4184r4185
8787DEVICE_START( basicdsk_floppy )
8888{
8989   floppy_drive_init(device, &basicdsk_floppy_interface);
90   return DEVICE_START_OK;
9190}
9291
9392/* attempt to insert a disk into the drive specified with id */
src/mess/devices/printer.c
r4184r4185
4848
4949static DEVICE_START(printer)
5050{
51   return DEVICE_START_OK;
5251}
5352
5453
src/mess/devices/coco_vhd.c
r4184r4185
9696{
9797   vhd_info *vhd = get_safe_token(device);
9898   vhd->status = VHDSTATUS_NO_VHD_ATTACHED;
99   return DEVICE_START_OK;
10099}
101100
102101
src/mess/devices/bitbngr.c
r4184r4185
9393   bi->value = config->initial_value;
9494   bi->timeout_timer = timer_alloc(device->machine, bitbanger_overthreshhold, (void *) device);
9595   bi->over_threshhold = 1;
96   return DEVICE_START_OK;
9796}
9897
9998
src/mess/devices/snapquik.c
r4184r4185
105105
106106   /* locate the load function */
107107   token->load = (snapquick_load_func) device_get_info_fct(device, DEVINFO_FCT_SNAPSHOT_QUICKLOAD_LOAD);
108   return DEVICE_START_OK;
109108}
110109
111110
src/mess/formats/thom_dsk.c
r4184r4185
787787   thom_qdd_compute_map();
788788   thom_floppy_reset( thom_floppy_drive_of_image( device  ) );
789789   floppy_drive_init( device, &thom_floppy_interface );
790   return DEVICE_START_OK;
791790}
792791
793792
src/mess/drivers/apexc.c
r4184r4185
172172
173173static DEVICE_START( apexc_tape )
174174{
175   return DEVICE_START_OK;
176175}
177176
178177
src/mess/drivers/a2600.c
r4184r4185
543543static DEVICE_START( a2600_cart )
544544{
545545   banking_mode = 0xFF;
546   return DEVICE_START_OK;
547546}
548547
549548
src/mess/drivers/newbrain.c
r4184r4185
618618
619619static READ8_HANDLER( cop_r )
620620{
621   newbrain_state *state = space->machine->driver_data;
621/*   newbrain_state *state = space->machine->driver_data; */
622622   UINT8 data = 0; // REGINT
623623
624624/*   state->cop_rd = 0;
src/mess/drivers/einstein.c
r4184r4185
488488
489489static DEVICE_START( einstein_daisy )
490490{
491   return DEVICE_START_OK;
492491}
493492
494493
src/mess/drivers/gamepock.c
r4184r4185
3838
3939static const UPD7810_CONFIG gamepock_cpu_config = { TYPE_78C06, gamepock_io_callback };
4040
41static DEVICE_START(gamepock_cart) {
41static DEVICE_START(gamepock_cart)
42{
4243   memory_set_bankptr( device->machine, 1, memory_region(device->machine,  "user1" ) );
43   return DEVICE_START_OK;
4444}
4545
4646static DEVICE_IMAGE_LOAD(gamepock_cart) {
docs/messnew.txt
r4184r4185
4646
4747Source Changes:
4848----------------
49- The core is based on MAME 0.129u1.  This incorporates all features of the
49- The core is based on MAME 0.129u2.  This incorporates all features of the
5050  update to this core.  [MAME team]
5151
5252- Changed the DS1315 implementation to be a device.  [Nathan Woods]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team