Previous 199869 Revisions Next

r20036 Thursday 3rd January, 2013 at 14:13:25 UTC by Luca Elia
metro.c update [Luca Elia]
- I4220 supports 16x16 tiles too
- merged in vmetal.c
[src/mame]mame.mak
[src/mame/drivers]metro.c vmetal.c
[src/mame/includes]metro.h
[src/mame/video]metro.c

trunk/src/mame/drivers/vmetal.c
r20035r20036
1/*
2
3Varia Metal
4Excellent System Ltd, 1995
5
6PCB Layout
7----------
8This game runs on Metro hardware.
9
10ES-9309B-B
11|--------------------------------------------|
12| TA7222   8.U9     DSW1(8)  DSW2(8)         |
13|VOL    M6295  1.000MHz                      |
14|                   |------------|           |
15|          7.U12    |   68000    |           |
16|  uPC3403          |------------|           |
17|J 640kHz  ES-8712                           |
18|A M6585           EPM7032    6B.U18  5B.U19 |
19|M       MM1035                              |
20|M        26.666MHz  16MHz    62256   62256  |
21|A                                           |
22|                 |--------|          1.U29  |
23|         62256   |Imagetek|                 |
24|         62256   |I4220   |          2.U31  |
25|                 |        |                 |
26|                 |--------|          3.U28  |
27|                                            |
28|                  6264               4.U30  |
29|--------------------------------------------|
30Notes:
31      68000   - clock 16.000MHz
32      ES-8712 - ES-8712 Single Channel ADPCM Samples Player. Clock ?? seems to be 16kHz?
33                This chip is branded 'EXCELLENT', may be (or not??) manufactured by Ensonic (SDIP48)
34      M6295   - clock 1.000MHz. Sample rate = 1000000/132
35      M6585   - Oki M6585 ADPCM Voice Synthesizer IC (DIP18). Clock 640kHz.
36                Sample rate = 16kHz (selection - pin 1 LOW, pin 2 HIGH = 16kHz)
37                This is a version-up to the previous M5205 with some additional
38                capabilies and improvements.
39      MM1035  - Mitsumi Monolithic IC MM1035 System Reset and Watchdog Timer (DIP8)
40      uPC3403 - NEC uPC3403 High Performance Quad Operational Amplifier (DIP14)
41      62256   - 32k x8 SRAM (DIP28)
42      6264    - 8k x8 SRAM (DIP28)
43      TA7222  - Toshiba TA7222 5.8 Watt Audio Power Amplifier (SIP10)
44      EPM7032 - Altera EPM7032LC44-15T High Performance EEPROM-based Programmable Logic Device (PLCC44)
45      Custom  - Imagetek I4220 Graphics Controller (QFP208)
46      VSync   - 58.2328Hz
47      HSync   - 15.32kHz
48      ROMs    -
49                6B & 5B are 27C040 EPROM (DIP32)
50                8 is 4M MaskROM (DIP32)
51                All other ROMs are 16M MaskROM (DIP42)
52
53
54
55
56Varia Metal
57
58Notes:
59
60*****
61i should fully merge video with metro.c, it uses the same imagetek chip (although with 16x16 tiles)
62this should fix most of the remaining gfx glitches - looks very similar to 'taidoa' (stephh)
63*****
64
65
66It has Sega and Taito logos in the roms ?!
67
68ES8712 sound may not be quite right. Samples are currently looped, but
69whether they should and how, is unknown.
70
71where does the M6585 hook up to?
72
73cleanup
74
75
76*/
77
78#include "emu.h"
79#include "cpu/m68000/m68000.h"
80#include "sound/okim6295.h"
81#include "sound/es8712.h"
82#include "includes/metro.h"
83
84class vmetal_state : public metro_state
85{
86public:
87   vmetal_state(const machine_config &mconfig, device_type type, const char *tag)
88      : metro_state(mconfig, type, tag),
89      m_texttileram(*this, "texttileram"),
90      m_mid1tileram(*this, "mid1tileram"),
91      m_mid2tileram(*this, "mid2tileram"),
92      m_tlookup(*this, "tlookup"),
93      m_vmetal_videoregs(*this, "vmetal_regs")
94   { }
95
96   required_shared_ptr<UINT16> m_texttileram;
97   required_shared_ptr<UINT16> m_mid1tileram;
98   required_shared_ptr<UINT16> m_mid2tileram;
99   required_shared_ptr<UINT16> m_tlookup;
100   required_shared_ptr<UINT16> m_vmetal_videoregs;
101
102   tilemap_t *m_texttilemap;
103   tilemap_t *m_mid1tilemap;
104   tilemap_t *m_mid2tilemap;
105   DECLARE_READ16_MEMBER(varia_crom_read);
106   DECLARE_WRITE16_MEMBER(vmetal_texttileram_w);
107   DECLARE_WRITE16_MEMBER(vmetal_mid1tileram_w);
108   DECLARE_WRITE16_MEMBER(vmetal_mid2tileram_w);
109   DECLARE_READ16_MEMBER(varia_dips_bit8_r);
110   DECLARE_READ16_MEMBER(varia_dips_bit7_r);
111   DECLARE_READ16_MEMBER(varia_dips_bit6_r);
112   DECLARE_READ16_MEMBER(varia_dips_bit5_r);
113   DECLARE_READ16_MEMBER(varia_dips_bit4_r);
114   DECLARE_READ16_MEMBER(varia_dips_bit3_r);
115   DECLARE_READ16_MEMBER(varia_dips_bit2_r);
116   DECLARE_READ16_MEMBER(varia_dips_bit1_r);
117   DECLARE_WRITE8_MEMBER(vmetal_control_w);
118   DECLARE_WRITE8_MEMBER(vmetal_es8712_w);
119   TILE_GET_INFO_MEMBER(get_vmetal_texttilemap_tile_info);
120   TILE_GET_INFO_MEMBER(get_vmetal_mid1tilemap_tile_info);
121   TILE_GET_INFO_MEMBER(get_vmetal_mid2tilemap_tile_info);
122   DECLARE_VIDEO_START(varia);
123   UINT32 screen_update_varia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
124};
125
126
127READ16_MEMBER(vmetal_state::varia_crom_read)
128{
129   /* game reads the cgrom, result is 7772, verified to be correct on the real board */
130
131
132   UINT8 *cgrom = memregion("gfx1")->base();
133   UINT16 retdat;
134
135   offset = offset << 1;
136   offset |= (m_vmetal_videoregs[0x0ab / 2] & 0x7f) << 16;
137   retdat = ((cgrom[offset] << 8) | (cgrom[offset + 1]));
138   // popmessage("varia romread offset %06x data %04x", offset, retdat);
139
140   return retdat;
141}
142
143
144static void get_vmetal_tlookup(running_machine &machine, UINT16 data, UINT16 *tileno, UINT16 *color)
145{
146   vmetal_state *state = machine.driver_data<vmetal_state>();
147   int idx = ((data & 0x7fff) >> 4) * 2;
148   UINT32 lookup = (state->m_tlookup[idx] << 16) | state->m_tlookup[idx + 1];
149
150   *tileno = (data & 0xf) | ((lookup >> 2) & 0xfff0);
151   *color = (lookup >> 20) & 0xff;
152}
153
154
155WRITE16_MEMBER(vmetal_state::vmetal_texttileram_w)
156{
157
158   COMBINE_DATA(&m_texttileram[offset]);
159   m_texttilemap->mark_tile_dirty(offset);
160}
161
162WRITE16_MEMBER(vmetal_state::vmetal_mid1tileram_w)
163{
164
165   COMBINE_DATA(&m_mid1tileram[offset]);
166   m_mid1tilemap->mark_tile_dirty(offset);
167}
168
169WRITE16_MEMBER(vmetal_state::vmetal_mid2tileram_w)
170{
171
172   COMBINE_DATA(&m_mid2tileram[offset]);
173   m_mid2tilemap->mark_tile_dirty(offset);
174}
175
176
177READ16_MEMBER(vmetal_state::varia_dips_bit8_r){ return ((ioport("DSW2")->read() & 0x80) << 0) | ((ioport("DSW1")->read() & 0x80) >> 1); }
178READ16_MEMBER(vmetal_state::varia_dips_bit7_r){ return ((ioport("DSW2")->read() & 0x40) << 1) | ((ioport("DSW1")->read() & 0x40) >> 0); }
179READ16_MEMBER(vmetal_state::varia_dips_bit6_r){ return ((ioport("DSW2")->read() & 0x20) << 2) | ((ioport("DSW1")->read() & 0x20) << 1); }
180READ16_MEMBER(vmetal_state::varia_dips_bit5_r){ return ((ioport("DSW2")->read() & 0x10) << 3) | ((ioport("DSW1")->read() & 0x10) << 2); }
181READ16_MEMBER(vmetal_state::varia_dips_bit4_r){ return ((ioport("DSW2")->read() & 0x08) << 4) | ((ioport("DSW1")->read() & 0x08) << 3); }
182READ16_MEMBER(vmetal_state::varia_dips_bit3_r){ return ((ioport("DSW2")->read() & 0x04) << 5) | ((ioport("DSW1")->read() & 0x04) << 4); }
183READ16_MEMBER(vmetal_state::varia_dips_bit2_r){ return ((ioport("DSW2")->read() & 0x02) << 6) | ((ioport("DSW1")->read() & 0x02) << 5); }
184READ16_MEMBER(vmetal_state::varia_dips_bit1_r){ return ((ioport("DSW2")->read() & 0x01) << 7) | ((ioport("DSW1")->read() & 0x01) << 6); }
185
186WRITE8_MEMBER(vmetal_state::vmetal_control_w)
187{
188   device_t *device = machine().device("essnd");
189   /* Lower nibble is the coin control bits shown in
190       service mode, but in game mode they're different */
191   coin_counter_w(machine(), 0, data & 0x04);
192   coin_counter_w(machine(), 1, data & 0x08);   /* 2nd coin schute activates coin 0 counter in game mode?? */
193//  coin_lockout_w(machine(), 0, data & 0x01);  /* always on in game mode?? */
194   coin_lockout_w(machine(), 1, data & 0x02);   /* never activated in game mode?? */
195
196   if ((data & 0x40) == 0)
197      device->reset();
198   else
199      es8712_play(device);
200
201   if (data & 0x10)
202      es8712_set_bank_base(device, 0x100000);
203   else
204      es8712_set_bank_base(device, 0x000000);
205
206   if (data & 0xa0)
207      logerror("%s:Writing unknown bits %04x to $200000\n",machine().describe_context(),data);
208}
209
210WRITE8_MEMBER(vmetal_state::vmetal_es8712_w)
211{
212   device_t *device = machine().device("essnd");
213   /* Many samples in the ADPCM ROM are actually not used.
214
215    Snd         Offset Writes                 Sample Range
216         0000 0004 0002 0006 000a 0008 000c
217    --   ----------------------------------   -------------
218    00   006e 0001 00ab 003c 0002 003a 003a   01ab6e-023a3c
219    01   003d 0002 003a 001d 0002 007e 007e   023a3d-027e1d
220    02   00e2 0003 0005 002e 0003 00f3 00f3   0305e2-03f32e
221    03   000a 0005 001e 00f6 0005 00ec 00ec   051e0a-05ecf6
222    04   00f7 0005 00ec 008d 0006 0060 0060   05ecf7-06608d
223    05   0016 0008 002e 0014 0009 0019 0019   082e16-091914
224    06   0015 0009 0019 0094 000b 0015 0015   091915-0b1594
225    07   0010 000d 0012 00bf 000d 0035 0035   0d1210-0d35bf
226    08   00ce 000e 002f 0074 000f 0032 0032   0e2fce-0f3274
227    09   0000 0000 0000 003a 0000 007d 007d   000000-007d3a
228    0a   0077 0000 00fa 008d 0001 00b6 00b6   00fa77-01b68d
229    0b   008e 0001 00b6 00b3 0002 0021 0021   01b68e-0221b3
230    0c   0062 0002 00f7 0038 0003 00de 00de   02f762-03de38
231    0d   00b9 0005 00ab 00ef 0006 0016 0016   05abb9-0616ef
232    0e   00dd 0007 0058 00db 0008 001a 001a   0758dd-081adb
233    0f   00dc 0008 001a 002e 0008 008a 008a   081adc-088a2e
234    10   00db 0009 00d7 00ff 000a 0046 0046   09d7db-0a46ff
235    11   0077 000c 0003 006d 000c 0080 0080   0c0377-0c806d
236    12   006e 000c 0080 006c 000d 0002 0002   0c806e-0d026c
237    13   006d 000d 0002 002b 000d 0041 0041   0d026d-0d412b
238    14   002c 000d 0041 002a 000d 00be 00be   0d412c-0dbe2a
239    15   002b 000d 00be 0029 000e 0083 0083   0dbe2b-0e8329
240    16   002a 000e 0083 00ee 000f 0069 0069   0e832a-0f69ee
241    */
242
243   es8712_w(device, space, offset, data);
244   logerror("%s:Writing %04x to ES8712 offset %02x\n", machine().describe_context(), data, offset);
245}
246
247
248static ADDRESS_MAP_START( varia_program_map, AS_PROGRAM, 16, vmetal_state )
249   AM_RANGE(0x000000, 0x0fffff) AM_ROM
250   AM_RANGE(0x100000, 0x11ffff) AM_RAM_WRITE(vmetal_texttileram_w) AM_SHARE("texttileram")
251   AM_RANGE(0x120000, 0x13ffff) AM_RAM_WRITE(vmetal_mid1tileram_w) AM_SHARE("mid1tileram")
252   AM_RANGE(0x140000, 0x15ffff) AM_RAM_WRITE(vmetal_mid2tileram_w) AM_SHARE("mid2tileram")
253
254   AM_RANGE(0x160000, 0x16ffff) AM_READ(varia_crom_read) // cgrom read window ..
255
256   AM_RANGE(0x170000, 0x173fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
257   AM_RANGE(0x174000, 0x174fff) AM_RAM AM_SHARE("spriteram")
258   AM_RANGE(0x175000, 0x177fff) AM_RAM
259   AM_RANGE(0x178000, 0x1787ff) AM_RAM AM_SHARE("tlookup")
260   AM_RANGE(0x178800, 0x1796ff) AM_RAM AM_SHARE("vmetal_regs")
261   AM_RANGE(0x179700, 0x179713) AM_WRITEONLY AM_SHARE("videoregs")   // Metro sprite chip Video Registers
262
263   AM_RANGE(0x200000, 0x200001) AM_READ_PORT("P1_P2") AM_WRITE8(vmetal_control_w, 0x00ff)
264   AM_RANGE(0x200002, 0x200003) AM_READ_PORT("SYSTEM")
265
266   /* same weird way to read Dip Switches as in many games in metro.c driver - use balcube_dsw_r read handler once the driver is merged */
267   AM_RANGE(0x30fffe, 0x30ffff) AM_READNOP               // 0x40 = dip1-16 -> 0xff0086 (doesn't exist in this game : address is NEVER read back)
268   AM_RANGE(0x317ffe, 0x317fff) AM_READNOP               // 0x40 = dip1-15 -> 0xff0086 (doesn't exist in this game : address is NEVER read back)
269   AM_RANGE(0x31bffe, 0x31bfff) AM_READNOP               // 0x40 = dip1-14 -> 0xff0086 (doesn't exist in this game : address is NEVER read back)
270   AM_RANGE(0x31dffe, 0x31dfff) AM_READNOP               // 0x40 = dip1-13 -> 0xff0086 (doesn't exist in this game : address is NEVER read back)
271   AM_RANGE(0x31effe, 0x31efff) AM_READNOP               // 0x40 = dip1-12 -> 0xff0086 (doesn't exist in this game : address is NEVER read back)
272   AM_RANGE(0x31f7fe, 0x31f7ff) AM_READNOP               // 0x40 = dip1-11 -> 0xff0086 (doesn't exist in this game : address is NEVER read back)
273   AM_RANGE(0x31fbfe, 0x31fbff) AM_READNOP               // 0x40 = dip1-10 -> 0xff0086 (doesn't exist in this game : address is NEVER read back)
274   AM_RANGE(0x31fdfe, 0x31fdff) AM_READNOP               // 0x40 = dip1-9  -> 0xff0086 (doesn't exist in this game : address is NEVER read back)
275   AM_RANGE(0x31fefe, 0x31feff) AM_READ(varia_dips_bit8_r)   // 0x40 = dip1-8  -> 0xff0085 , 0x80 = dip2-8 -> 0xff0084
276   AM_RANGE(0x31ff7e, 0x31ff7f) AM_READ(varia_dips_bit7_r)   // 0x40 = dip1-7  -> 0xff0085 , 0x80 = dip2-7 -> 0xff0084
277   AM_RANGE(0x31ffbe, 0x31ffbf) AM_READ(varia_dips_bit6_r)   // 0x40 = dip1-6  -> 0xff0085 , 0x80 = dip2-6 -> 0xff0084
278   AM_RANGE(0x31ffde, 0x31ffdf) AM_READ(varia_dips_bit5_r)   // 0x40 = dip1-5  -> 0xff0085 , 0x80 = dip2-5 -> 0xff0084
279   AM_RANGE(0x31ffee, 0x31ffef) AM_READ(varia_dips_bit4_r)   // 0x40 = dip1-4  -> 0xff0085 , 0x80 = dip2-4 -> 0xff0084
280   AM_RANGE(0x31fff6, 0x31fff7) AM_READ(varia_dips_bit3_r)   // 0x40 = dip1-3  -> 0xff0085 , 0x80 = dip2-3 -> 0xff0084
281   AM_RANGE(0x31fffa, 0x31fffb) AM_READ(varia_dips_bit2_r)   // 0x40 = dip1-2  -> 0xff0085 , 0x80 = dip2-2 -> 0xff0084
282   AM_RANGE(0x31fffc, 0x31fffd) AM_READ(varia_dips_bit1_r)   // 0x40 = dip1-1  -> 0xff0085 , 0x80 = dip2-1 -> 0xff0084
283
284   AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
285   AM_RANGE(0x400002, 0x400003) AM_DEVWRITE8("oki", okim6295_device, write, 0x00ff)   // Volume/channel info
286   AM_RANGE(0x500000, 0x50000d) AM_WRITE8(vmetal_es8712_w, 0x00ff)
287
288   AM_RANGE(0xff0000, 0xffffff) AM_RAM
289ADDRESS_MAP_END
290
291
292/* verified from M68000 code */
293static INPUT_PORTS_START( varia )
294   PORT_START("P1_P2")
295   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(2)
296   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(2)
297   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(2)
298   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
299   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
300   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
301   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
302   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 )
303   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(1)
304   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(1)
305   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(1)
306   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
307   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
308   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
309   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
310   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 )
311
312   PORT_START("SYSTEM")
313   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
314   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
315   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_TILT )             /* 'Tilt' only in "test mode" - no effect ingame */
316   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE1 )         /* same coinage as COIN1 and COIN2 */
317   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE2 )         /* 'Test' only in "test mode" - no effect ingame */
318   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNUSED )
319
320   /* stored to 0xff0085.b (cpl'ed) */
321   PORT_START("DSW1")
322   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )
323   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C )  )
324   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C )  )
325   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C )  )
326   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C )  )
327   PORT_DIPSETTING(      0x0003, DEF_STR( 1C_3C )  )
328   PORT_DIPSETTING(      0x0002, DEF_STR( 1C_4C )  )
329   PORT_DIPSETTING(      0x0001, DEF_STR( 1C_5C )  )
330   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C )  )
331   PORT_DIPUNUSED( 0x0008, IP_ACTIVE_LOW )                 /* 0x01 (OFF) or 0x02 (ON) written to 0xff0112.b but NEVER read back - old credits for 2 players game ? */
332   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Flip_Screen ) )  /* 0x07c1 written to 0x1788ac.w (screen control ?) at first (code at 0x0001b8) */
333   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )          /* 0x07c1 written to 0xff0114.w (then 0x1788ac.w) during initialisation (code at 0x000436) */
334   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )           /* 0x07c0 written to 0xff0114.w (then 0x1788ac.w) during initialisation (code at 0x000436) */
335   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )
336   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
337   PORT_DIPSETTING(      0x0020, DEF_STR( On ) )
338   PORT_DIPUNUSED( 0x0040, IP_ACTIVE_LOW )
339   PORT_DIPUNUSED( 0x0080, IP_ACTIVE_LOW )
340
341   /* stored to 0xff0084.b (cpl'ed) */
342   PORT_START("DSW2")
343   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
344   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
345   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
346   PORT_DIPSETTING(      0x0001, DEF_STR( Hard ) )
347   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
348   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Lives ) )
349   PORT_DIPSETTING(      0x0008, "1"  )
350   PORT_DIPSETTING(      0x0004, "2"  )
351   PORT_DIPSETTING(      0x000c, "3"  )
352   PORT_DIPSETTING(      0x0000, "4"  )
353   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Bonus_Life ) )   /* code at 0x0004a4 */
354   PORT_DIPSETTING(      0x0010, "Every 30000" )
355   PORT_DIPSETTING(      0x0000, "Every 60000" )
356   PORT_DIPUNUSED( 0x0020, IP_ACTIVE_LOW )
357   PORT_DIPUNUSED( 0x0040, IP_ACTIVE_LOW )
358   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
359INPUT_PORTS_END
360
361
362
363static const gfx_layout char16x16layout =
364{
365   16,16,
366   RGN_FRAC(1,1),
367   4,
368   { 0,1,2,3 },
369   { 4, 0, 12, 8, 20, 16, 28, 24, 36, 32, 44, 40, 52, 48, 60, 56 },
370   { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
371   16*64
372};
373
374static const gfx_layout char8x8layout =
375{
376   8,8,
377   RGN_FRAC(1,1),
378   4,
379   { 0,1,2,3 },
380   { 4, 0, 12, 8, 20, 16, 28, 24 },
381   { 0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32 },
382   8*32
383};
384
385static GFXDECODE_START( vmetal )
386   GFXDECODE_ENTRY( "gfx1", 0, char16x16layout,   0x1000, 512  ) /* bg tiles */
387   GFXDECODE_ENTRY( "gfx1", 0, char8x8layout,   0x1000, 512  ) /* bg tiles */
388GFXDECODE_END
389
390
391TILE_GET_INFO_MEMBER(vmetal_state::get_vmetal_texttilemap_tile_info)
392{
393   UINT32 tile;
394   UINT16 color, data = m_texttileram[tile_index];
395   int idx = ((data & 0x7fff) >> 4) * 2;
396   UINT32 lookup = (m_tlookup[idx] << 16) | m_tlookup[idx + 1];
397
398   tile = (data & 0xf) | (lookup & 0x7fff0);
399   color = ((lookup >> 20) & 0x1f) + 0xe0;
400
401   if (data & 0x8000)
402      tile = 0;
403
404   SET_TILE_INFO_MEMBER(1, tile, color, TILE_FLIPYX(0x0));
405}
406
407
408TILE_GET_INFO_MEMBER(vmetal_state::get_vmetal_mid1tilemap_tile_info)
409{
410   UINT16 tile, color, data = m_mid1tileram[tile_index];
411
412   get_vmetal_tlookup(machine(), data, &tile, &color);
413
414   if (data & 0x8000)
415      tile = 0;
416
417   SET_TILE_INFO_MEMBER(0, tile, color, TILE_FLIPYX(0x0));
418}
419
420TILE_GET_INFO_MEMBER(vmetal_state::get_vmetal_mid2tilemap_tile_info)
421{
422   UINT16 tile, color, data = m_mid2tileram[tile_index];
423
424   get_vmetal_tlookup(machine(), data, &tile, &color);
425
426   if (data & 0x8000)
427      tile = 0;
428
429   SET_TILE_INFO_MEMBER(0, tile, color, TILE_FLIPYX(0x0));
430}
431
432static void expand_gfx1(running_machine &machine)
433{
434   metro_state *state = machine.driver_data<metro_state>();
435   UINT8 *base_gfx = state->memregion("gfx1")->base();
436   UINT32 length = 2 * state->memregion("gfx1")->bytes();
437   state->m_expanded_gfx1 = auto_alloc_array(machine, UINT8, length);
438   for (int i = 0; i < length; i += 2)
439   {
440      UINT8 src = base_gfx[i / 2];
441      state->m_expanded_gfx1[i+0] = src & 15;
442      state->m_expanded_gfx1[i+1] = src >> 4;
443   }
444}
445
446VIDEO_START_MEMBER(vmetal_state,varia)
447{
448
449   m_texttilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(vmetal_state::get_vmetal_texttilemap_tile_info),this), TILEMAP_SCAN_ROWS,  8,  8, 256, 256);
450   m_mid1tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(vmetal_state::get_vmetal_mid1tilemap_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 256, 256);
451   m_mid2tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(vmetal_state::get_vmetal_mid2tilemap_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 256, 256);
452
453   m_texttilemap->set_transparent_pen(15);
454   m_mid1tilemap->set_transparent_pen(15);
455   m_mid2tilemap->set_transparent_pen(15);
456
457   expand_gfx1(machine());
458}
459
460UINT32 vmetal_state::screen_update_varia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
461{
462
463   bitmap.fill(get_black_pen(machine()), cliprect);
464   machine().priority_bitmap.fill(0, cliprect);
465
466   m_mid2tilemap->set_scrollx(0, m_vmetal_videoregs[0x06a/2]-64 /*+ m_vmetal_videoregs[0x066/2]*/);
467   m_mid1tilemap->set_scrollx(0, m_vmetal_videoregs[0x07a/2]-64 /*+ m_vmetal_videoregs[0x076/2]*/);
468   m_texttilemap->set_scrollx(0, -64 /*+ m_vmetal_videoregs[0x076/2]*/);
469
470   m_mid2tilemap->set_scrolly(0, -64);
471   m_mid1tilemap->set_scrolly(0, -64);
472   m_texttilemap->set_scrolly(0, -64);
473
474   m_mid1tilemap->draw(bitmap, cliprect, 0, 0);
475   m_mid2tilemap->draw(bitmap, cliprect, 0, 0);
476   metro_draw_sprites(machine(), bitmap, cliprect);
477   m_texttilemap->draw(bitmap, cliprect, 0, 0);
478   return 0;
479}
480
481
482static MACHINE_CONFIG_START( varia, vmetal_state )
483
484   /* basic machine hardware */
485   MCFG_CPU_ADD("maincpu", M68000, 16000000)
486   MCFG_CPU_PROGRAM_MAP(varia_program_map)
487   MCFG_CPU_VBLANK_INT_DRIVER("screen", vmetal_state,  irq1_line_hold) // also level 3
488
489   /* video hardware */
490   MCFG_SCREEN_ADD("screen", RASTER)
491   MCFG_SCREEN_REFRESH_RATE(60)
492   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
493   MCFG_SCREEN_SIZE(2048, 2048)
494   MCFG_SCREEN_VISIBLE_AREA(0+64, 319+64, 0+64, 223+64)
495   MCFG_SCREEN_UPDATE_DRIVER(vmetal_state, screen_update_varia)
496
497   MCFG_GFXDECODE(vmetal)
498   MCFG_PALETTE_LENGTH(0x4000)
499
500   MCFG_VIDEO_START_OVERRIDE(vmetal_state,varia)
501
502   /* sound hardware */
503   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
504
505   MCFG_OKIM6295_ADD("oki", 1320000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified
506   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.75)
507   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.75)
508
509   MCFG_SOUND_ADD("essnd", ES8712, 12000)
510   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
511   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
512MACHINE_CONFIG_END
513
514
515ROM_START( vmetal )
516   ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
517   ROM_LOAD16_BYTE( "5b.u19", 0x00001, 0x80000, CRC(4933ac6c) SHA1(1a3303e32fcb08854d4d6e13f36ca99d92aed4cc) )
518   ROM_LOAD16_BYTE( "6b.u18", 0x00000, 0x80000, CRC(4eb939d5) SHA1(741ab05043fc3bd886162d878630e45da9359718) )
519
520   ROM_REGION( 0x800000, "gfx1", 0 )
521   ROMX_LOAD( "1.u29", 0x000004, 0x200000, CRC(b470c168) SHA1(c30462dc134da1e71a94b36ef96ecd65c325b07e) , ROM_GROUPWORD | ROM_SKIP(6))
522   ROMX_LOAD( "2.u31", 0x000000, 0x200000, CRC(b36f8d60) SHA1(1676859d0fee4eb9897ce1601a2c9fd9a6dc4a43) , ROM_GROUPWORD | ROM_SKIP(6))
523   ROMX_LOAD( "3.u28", 0x000006, 0x200000, CRC(00fca765) SHA1(ca9010bd7f59367e483868018db9a9abf871386e) , ROM_GROUPWORD | ROM_SKIP(6))
524   ROMX_LOAD( "4.u30", 0x000002, 0x200000, CRC(5a25a49c) SHA1(c30781202ec882e1ec6adfb560b0a1075b3cce55) , ROM_GROUPWORD | ROM_SKIP(6))
525
526   ROM_REGION( 0x080000, "oki", 0 ) /* OKI6295 Samples */
527   /* Second half is junk */
528   ROM_LOAD( "8.u9", 0x00000, 0x80000, CRC(c14c001c) SHA1(bad96b5cd40d1c34ef8b702262168ecab8192fb6) )
529
530   ROM_REGION( 0x200000, "essnd", 0 ) /* Samples */
531   ROM_LOAD( "7.u12", 0x00000, 0x200000, CRC(a88c52f1) SHA1(d74a5a11f84ba6b1042b33a2c156a1071b6fbfe1) )
532ROM_END
533
534ROM_START( vmetaln )
535   ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
536   ROM_LOAD16_BYTE( "vm5.bin", 0x00001, 0x80000, CRC(43ef844e) SHA1(c673f34fcc9e406282c9008795b52d01a240099a) )
537   ROM_LOAD16_BYTE( "vm6.bin", 0x00000, 0x80000, CRC(cb292ab1) SHA1(41fdfe67e6cb848542fd5aa0dfde3b1936bb3a28) )
538
539   ROM_REGION( 0x800000, "gfx1", 0 )
540   ROMX_LOAD( "1.u29", 0x000004, 0x200000, CRC(b470c168) SHA1(c30462dc134da1e71a94b36ef96ecd65c325b07e) , ROM_GROUPWORD | ROM_SKIP(6))
541   ROMX_LOAD( "2.u31", 0x000000, 0x200000, CRC(b36f8d60) SHA1(1676859d0fee4eb9897ce1601a2c9fd9a6dc4a43) , ROM_GROUPWORD | ROM_SKIP(6))
542   ROMX_LOAD( "3.u28", 0x000006, 0x200000, CRC(00fca765) SHA1(ca9010bd7f59367e483868018db9a9abf871386e) , ROM_GROUPWORD | ROM_SKIP(6))
543   ROMX_LOAD( "4.u30", 0x000002, 0x200000, CRC(5a25a49c) SHA1(c30781202ec882e1ec6adfb560b0a1075b3cce55) , ROM_GROUPWORD | ROM_SKIP(6))
544
545   ROM_REGION( 0x080000, "oki", 0 ) /* OKI6295 Samples */
546   /* Second half is junk */
547   ROM_LOAD( "8.u9", 0x00000, 0x80000, CRC(c14c001c) SHA1(bad96b5cd40d1c34ef8b702262168ecab8192fb6) )
548
549   ROM_REGION( 0x200000, "essnd", 0 ) /* Samples */
550   ROM_LOAD( "7.u12", 0x00000, 0x200000, CRC(a88c52f1) SHA1(d74a5a11f84ba6b1042b33a2c156a1071b6fbfe1) )
551ROM_END
552
553
554GAME( 1995, vmetal,  0,      varia, varia, driver_device, 0, ROT270, "Excellent System",                                "Varia Metal",                        GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
555GAME( 1995, vmetaln, vmetal, varia, varia, driver_device, 0, ROT270, "Excellent System (New Ways Trading Co. license)", "Varia Metal (New Ways Trading Co.)", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/metro.c
r20035r20036
1818
1919Other        :  Memory Blitter
2020
21-----------------------------------------------------------------------------
22Year + Game                     PCB         Video Chip    Issues / Notes
23-----------------------------------------------------------------------------
21------------------------------------------------------------------------------------------------
22Year + Game                     PCB           Video   Issues / Notes
23------------------------------------------------------------------------------------------------
242492  Last Fortress - Toride      VG420         I4100
252592  Last Fortress - Toride (Ger)VG460-(A)     I4100
262692  Pang Pom's                  VG420         I4100
r20035r20036
393995  Mouse Shooter GoGo          -             I4220    No sound CPU
404095  Pururun                     MTR5260-A     I4220
414195  Puzzli                      MTR5260-A     I4220
4295  Varia Metal                 ES-9309B-B    I4220    No sound CPU but ES-8712 + M6295 + M6585
424396  Bal Cube                    -             I4220    No sound CPU
434496  Bang Bang Ball              -             I4220    No sound CPU
444596  Daitoride (YMF278B)         -             I4220    No sound CPU
r20035r20036
525397  Mahjong Gakuensai           VG340-A       I4300    No sound CPU
535498  Mahjong Gakuensai 2         VG340-A       I4300    No sound CPU
545500  Puzzlet                     VG2200-(B)    I4300    Z86E02 Zilog Z8 8-bit MCU
55-----------------------------------------------------------------------------
56------------------------------------------------------------------------------------------------
5657
5758Mouse Shooter GoGo, Bal Cube, Bang Bang Ball & Daitoride (YMF278B) PCBs have
5859no PCB number but all look identical to each other.
5960
6061To Do:
6162
63-   Tilemaps/sprites offsets may be emulated understanding what appear to be CRT registers
64    at c78880 (sequence of 4 values), c78890 (sequence of 5 values) and c788a0 (start sequence).
6265-   Wrong color bars in service mode (e.g. balcube, toride2g).
6366    They use solid color tiles (80xx), but the right palette is not at 00-ff.
6467    Related to the unknown table in the RAM mapped just before the palette?
r20035r20036
6770-   Coin lockout
6871-   Some gfx problems in ladykill, 3kokushi, puzzli, gakusai,
6972    seem related to how we handle windows and wrapping
70-   Are the 16x16 tiles used by Mouja a Imagetek I4300-only feature?
7173-   Interrupt timing needs figuring out properly, having it incorrect
7274    causes scrolling glitches in some games.  Test cases Mouse Go Go
7375    title screen, GunMaster title screen.  Changing it can cause
r20035r20036
7577-   Bang Bang Ball / Bubble Buster slow to a crawl when you press a
7678    button between levels, on a real PCB it speeds up instead (related
7779    to above?)
80-   vmetal: ES8712 sound may not be quite right. Samples are currently looped, but
81    whether they should and how, is unknown. Where does the M6585 hook up to?
7882
7983Notes:
8084
r20035r20036
8286    keeping start 2 pressed.
8387-   Sprite zoom in Mouja at the end of a match looks wrong, but it's been verified
8488    to be the same on the original board
89-   vmetal: has Sega and Taito logos in the roms ?!
8590
91
8692driver modified by Eisuke Watanabe
8793***************************************************************************/
8894
r20035r20036
9399#include "cpu/upd7810/upd7810.h"
94100#include "includes/metro.h"
95101#include "machine/eeprom.h"
96#include "sound/2610intf.h"
97102#include "sound/2151intf.h"
98103#include "sound/2413intf.h"
104#include "sound/2610intf.h"
105#include "sound/es8712.h"
99106#include "sound/okim6295.h"
100107#include "sound/ymf278b.h"
101108#include "video/konicdev.h"
r20035r20036
785792   AM_RANGE(0x678840, 0x67884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
786793   AM_RANGE(0x678860, 0x67886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
787794   AM_RANGE(0x678870, 0x67887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
788   AM_RANGE(0x678880, 0x678881) AM_WRITENOP                              // ? increasing
789   AM_RANGE(0x678890, 0x678891) AM_WRITENOP                              // ? increasing
795   AM_RANGE(0x678880, 0x678881) AM_WRITENOP                              // ? CRT
796   AM_RANGE(0x678890, 0x678891) AM_WRITENOP                              // ? CRT
790797   AM_RANGE(0x6788a2, 0x6788a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
791798   AM_RANGE(0x6788a4, 0x6788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
792799   AM_RANGE(0x6788aa, 0x6788ab) AM_WRITEONLY AM_SHARE("rombank")               // Rom Bank
r20035r20036
814821   AM_RANGE(0x178840, 0x17884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
815822   AM_RANGE(0x178860, 0x17886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
816823   AM_RANGE(0x178870, 0x17887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
817   AM_RANGE(0x178880, 0x178881) AM_WRITENOP                              // ? increasing
818   AM_RANGE(0x178890, 0x178891) AM_WRITENOP                              // ? increasing
824   AM_RANGE(0x178880, 0x178881) AM_WRITENOP                              // ? CRT
825   AM_RANGE(0x178890, 0x178891) AM_WRITENOP                              // ? CRT
819826   AM_RANGE(0x1788a2, 0x1788a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
820827   AM_RANGE(0x1788a4, 0x1788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
821828   AM_RANGE(0x1788aa, 0x1788ab) AM_WRITEONLY AM_SHARE("rombank")               // Rom Bank
r20035r20036
856863   AM_RANGE(0xe78840, 0xe7884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
857864   AM_RANGE(0xe78860, 0xe7886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
858865   AM_RANGE(0xe78870, 0xe7887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
859   AM_RANGE(0xe78880, 0xe78881) AM_WRITENOP                              // ? increasing
860   AM_RANGE(0xe78890, 0xe78891) AM_WRITENOP                              // ? increasing
866   AM_RANGE(0xe78880, 0xe78881) AM_WRITENOP                              // ? CRT
867   AM_RANGE(0xe78890, 0xe78891) AM_WRITENOP                              // ? CRT
861868   AM_RANGE(0xe788a2, 0xe788a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
862869   AM_RANGE(0xe788a4, 0xe788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
863870   AM_RANGE(0xe788aa, 0xe788ab) AM_WRITEONLY AM_SHARE("rombank")               // Rom Bank
r20035r20036
884891   AM_RANGE(0x178840, 0x17884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
885892   AM_RANGE(0x178860, 0x17886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
886893   AM_RANGE(0x178870, 0x17887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
887   AM_RANGE(0x178880, 0x178881) AM_WRITENOP                              // ? increasing
888   AM_RANGE(0x178890, 0x178891) AM_WRITENOP                              // ? increasing
894   AM_RANGE(0x178880, 0x178881) AM_WRITENOP                              // ? CRT
895   AM_RANGE(0x178890, 0x178891) AM_WRITENOP                              // ? CRT
889896   AM_RANGE(0x1788a2, 0x1788a3) AM_READWRITE(metro_irq_cause_r,metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
890897   AM_RANGE(0x1788a4, 0x1788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
891898   AM_RANGE(0x1788aa, 0x1788ab) AM_WRITEONLY AM_SHARE("rombank")               // Rom Bank
r20035r20036
920927   AM_RANGE(0x178840, 0x17884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
921928   AM_RANGE(0x178860, 0x17886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
922929   AM_RANGE(0x178870, 0x17887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
923   AM_RANGE(0x178880, 0x178881) AM_WRITENOP                              // ? increasing
924   AM_RANGE(0x178890, 0x178891) AM_WRITENOP                              // ? increasing
930   AM_RANGE(0x178880, 0x178881) AM_WRITENOP                              // ? CRT
931   AM_RANGE(0x178890, 0x178891) AM_WRITENOP                              // ? CRT
925932   AM_RANGE(0x1788a2, 0x1788a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
926933   AM_RANGE(0x1788a4, 0x1788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
927934   AM_RANGE(0x1788aa, 0x1788ab) AM_WRITEONLY AM_SHARE("rombank")               // Rom Bank
r20035r20036
954961   AM_RANGE(0x478840, 0x47884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
955962   AM_RANGE(0x478860, 0x47886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
956963   AM_RANGE(0x478870, 0x47887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
957   AM_RANGE(0x478880, 0x478881) AM_WRITENOP                              // ? increasing
958   AM_RANGE(0x478890, 0x478891) AM_WRITENOP                              // ? increasing
964   AM_RANGE(0x478880, 0x478881) AM_WRITENOP                              // ? CRT
965   AM_RANGE(0x478890, 0x478891) AM_WRITENOP                              // ? CRT
959966   AM_RANGE(0x4788a2, 0x4788a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
960967   AM_RANGE(0x4788a4, 0x4788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
961968   AM_RANGE(0x4788a8, 0x4788a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
r20035r20036
989996   AM_RANGE(0x878840, 0x87884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
990997   AM_RANGE(0x878860, 0x87886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
991998   AM_RANGE(0x878870, 0x87887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll Regs
992   AM_RANGE(0x878880, 0x878881) AM_WRITENOP                              // ? increasing
993   AM_RANGE(0x878890, 0x878891) AM_WRITENOP                              // ? increasing
999   AM_RANGE(0x878880, 0x878881) AM_WRITENOP                              // ? CRT
1000   AM_RANGE(0x878890, 0x878891) AM_WRITENOP                              // ? CRT
9941001   AM_RANGE(0x8788a4, 0x8788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
9951002   AM_RANGE(0x8788a8, 0x8788a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
9961003   AM_RANGE(0x8788aa, 0x8788ab) AM_WRITEONLY AM_SHARE("rombank")               // Rom Bank
r20035r20036
10441051   AM_RANGE(0x878840, 0x87884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
10451052   AM_RANGE(0x878860, 0x87886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
10461053   AM_RANGE(0x878870, 0x87887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
1047   AM_RANGE(0x878880, 0x878881) AM_WRITENOP                              // ? increasing
1048   AM_RANGE(0x878890, 0x878891) AM_WRITENOP                              // ? increasing
1054   AM_RANGE(0x878880, 0x878881) AM_WRITENOP                              // ? CRT
1055   AM_RANGE(0x878890, 0x878891) AM_WRITENOP                              // ? CRT
10491056   AM_RANGE(0x8788a2, 0x8788a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
10501057   AM_RANGE(0x8788a4, 0x8788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
10511058   AM_RANGE(0x8788a8, 0x8788a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
r20035r20036
10751082   AM_RANGE(0x878840, 0x87884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
10761083   AM_RANGE(0x878860, 0x87886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
10771084   AM_RANGE(0x878870, 0x87887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll Regs - WRONG
1078//  AM_RANGE(0x878880, 0x878881) AM_WRITENOP                                        // ? increasing
1079   AM_RANGE(0x878890, 0x878891) AM_WRITENOP                              // ? increasing
1085//  AM_RANGE(0x878880, 0x878881) AM_WRITENOP                                        // ? CRT
1086   AM_RANGE(0x878890, 0x878891) AM_WRITENOP                              // ? CRT
10801087   AM_RANGE(0x8788a2, 0x8788a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause /  IRQ Acknowledge
10811088   AM_RANGE(0x8788a4, 0x8788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
10821089   AM_RANGE(0x8788a8, 0x8788a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
r20035r20036
11091116   AM_RANGE(0x878840, 0x87884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
11101117   AM_RANGE(0x878860, 0x87886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
11111118   AM_RANGE(0x878870, 0x87887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
1112   AM_RANGE(0x878880, 0x878881) AM_WRITENOP                              // ? increasing
1113   AM_RANGE(0x878890, 0x878891) AM_WRITENOP                              // ? increasing
1119   AM_RANGE(0x878880, 0x878881) AM_WRITENOP                              // ? CRT
1120   AM_RANGE(0x878890, 0x878891) AM_WRITENOP                              // ? CRT
11141121   AM_RANGE(0x8788a2, 0x8788a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
11151122   AM_RANGE(0x8788a4, 0x8788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
11161123   AM_RANGE(0x8788a8, 0x8788a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
r20035r20036
11501157   AM_RANGE(0x8f8840, 0x8f884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
11511158   AM_RANGE(0x8f8860, 0x8f886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
11521159   AM_RANGE(0x8f8870, 0x8f887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
1153   AM_RANGE(0x8f8880, 0x8f8881) AM_WRITENOP                              // ? increasing
1154   AM_RANGE(0x8f8890, 0x8f8891) AM_WRITENOP                              // ? increasing
1160   AM_RANGE(0x8f8880, 0x8f8881) AM_WRITENOP                              // ? CRT
1161   AM_RANGE(0x8f8890, 0x8f8891) AM_WRITENOP                              // ? CRT
11551162   AM_RANGE(0x8f88a2, 0x8f88a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
11561163   AM_RANGE(0x8f88a4, 0x8f88a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
11571164   AM_RANGE(0x8f88a8, 0x8f88a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
r20035r20036
14391446   AM_RANGE(0x478840, 0x47884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
14401447   AM_RANGE(0x478860, 0x47886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
14411448   AM_RANGE(0x478870, 0x47887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll Regs
1442   AM_RANGE(0x478880, 0x478881) AM_WRITENOP                              // ? increasing
1443   AM_RANGE(0x478890, 0x478891) AM_WRITENOP                              // ? increasing
1449   AM_RANGE(0x478880, 0x478881) AM_WRITENOP                              // ? CRT
1450   AM_RANGE(0x478890, 0x478891) AM_WRITENOP                              // ? CRT
14441451   AM_RANGE(0x4788a2, 0x4788a3) AM_READWRITE(metro_irq_cause_r,metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
14451452   AM_RANGE(0x4788a4, 0x4788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
14461453   AM_RANGE(0x4788a8, 0x4788a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
r20035r20036
14821489   AM_RANGE(0xc78840, 0xc7884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
14831490   AM_RANGE(0xc78860, 0xc7886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
14841491   AM_RANGE(0xc78870, 0xc7887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll Regs
1485   AM_RANGE(0xc78880, 0xc78881) AM_WRITENOP                              // ? increasing
1486   AM_RANGE(0xc78890, 0xc78891) AM_WRITENOP                              // ? increasing
1492   AM_RANGE(0xc78880, 0xc78881) AM_WRITENOP                              // ? CRT
1493   AM_RANGE(0xc78890, 0xc78891) AM_WRITENOP                              // ? CRT
14871494   AM_RANGE(0xc788a2, 0xc788a3) AM_READWRITE(metro_irq_cause_r,metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
14881495   AM_RANGE(0xc788a4, 0xc788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
14891496   AM_RANGE(0xc788a8, 0xc788a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
r20035r20036
15181525   AM_RANGE(0x878840, 0x87884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
15191526   AM_RANGE(0x878860, 0x87886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
15201527   AM_RANGE(0x878870, 0x87887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
1521   AM_RANGE(0x878880, 0x878881) AM_WRITENOP                              // ? increasing
1522   AM_RANGE(0x878890, 0x878891) AM_WRITENOP                              // ? increasing
1528   AM_RANGE(0x878880, 0x878881) AM_WRITENOP                              // ? CRT
1529   AM_RANGE(0x878890, 0x878891) AM_WRITENOP                              // ? CRT
15231530   AM_RANGE(0x8788a2, 0x8788a3) AM_READWRITE(metro_irq_cause_r,metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
15241531   AM_RANGE(0x8788a4, 0x8788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
15251532   AM_RANGE(0x8788a8, 0x8788a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
r20035r20036
15521559   AM_RANGE(0xc78840, 0xc7884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
15531560   AM_RANGE(0xc78860, 0xc7886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
15541561   AM_RANGE(0xc78870, 0xc7887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll Regs
1555   AM_RANGE(0xc78880, 0xc78881) AM_WRITENOP                              // ? increasing
1556   AM_RANGE(0xc78890, 0xc78891) AM_WRITENOP                              // ? increasing
1562   AM_RANGE(0xc78880, 0xc78881) AM_WRITENOP                              // ? CRT
1563   AM_RANGE(0xc78890, 0xc78891) AM_WRITENOP                              // ? CRT
15571564   AM_RANGE(0xc788a2, 0xc788a3) AM_READWRITE(metro_irq_cause_r,metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
15581565   AM_RANGE(0xc788a4, 0xc788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
15591566   AM_RANGE(0xc788a8, 0xc788a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
r20035r20036
15861593   AM_RANGE(0xc78840, 0xc7884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
15871594   AM_RANGE(0xc78860, 0xc7886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
15881595   AM_RANGE(0xc78870, 0xc7887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll Regs
1589   AM_RANGE(0xc78880, 0xc78881) AM_WRITENOP                              // ? increasing
1590   AM_RANGE(0xc78890, 0xc78891) AM_WRITENOP                              // ? increasing
1596   AM_RANGE(0xc78880, 0xc78881) AM_WRITENOP                              // ? CRT
1597   AM_RANGE(0xc78890, 0xc78891) AM_WRITENOP                              // ? CRT
15911598   AM_RANGE(0xc788a2, 0xc788a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
15921599   AM_RANGE(0xc788a4, 0xc788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
15931600   AM_RANGE(0xc788a8, 0xc788a9) AM_WRITE(metro_soundlatch_w)                  // To Sound CPU
r20035r20036
16531660   AM_RANGE(0x278000, 0x2787ff) AM_RAM AM_SHARE("tiletable")                  // Tiles Set
16541661   AM_RANGE(0x278860, 0x27886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
16551662   AM_RANGE(0x278870, 0x27887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
1656   AM_RANGE(0x278890, 0x278891) AM_WRITENOP                              // ? increasing
1663   AM_RANGE(0x278890, 0x278891) AM_WRITENOP                              // ? CRT
16571664   AM_RANGE(0x2788a2, 0x2788a3) AM_READWRITE(metro_irq_cause_r,metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
16581665   AM_RANGE(0x2788a4, 0x2788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
16591666   AM_RANGE(0x2788aa, 0x2788ab) AM_WRITEONLY AM_SHARE("rombank")               // Rom Bank
r20035r20036
17891796   AM_RANGE(0x778840, 0x77884f) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
17901797   AM_RANGE(0x778860, 0x77886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
17911798   AM_RANGE(0x778870, 0x77887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
1792   AM_RANGE(0x778890, 0x778891) AM_WRITENOP                              // ? increasing
1799   AM_RANGE(0x778890, 0x778891) AM_WRITENOP                              // ? CRT
17931800   AM_RANGE(0x7788a2, 0x7788a3) AM_WRITE(metro_irq_cause_w)                     // IRQ Cause
17941801   AM_RANGE(0x7788a4, 0x7788a5) AM_WRITE(puzzlet_irq_enable_w) AM_SHARE("irq_enable")   // IRQ Enable
17951802
r20035r20036
18191826
18201827
18211828/***************************************************************************
1829                                Varia Metal
1830***************************************************************************/
18221831
1832WRITE8_MEMBER(metro_state::vmetal_control_w)
1833{
1834   device_t *device = machine().device("essnd");
1835   /* Lower nibble is the coin control bits shown in
1836       service mode, but in game mode they're different */
1837   coin_counter_w(machine(), 0, data & 0x04);
1838   coin_counter_w(machine(), 1, data & 0x08);   /* 2nd coin schute activates coin 0 counter in game mode?? */
1839//  coin_lockout_w(machine(), 0, data & 0x01);  /* always on in game mode?? */
1840   coin_lockout_w(machine(), 1, data & 0x02);   /* never activated in game mode?? */
18231841
1842   if ((data & 0x40) == 0)
1843      device->reset();
1844   else
1845      es8712_play(device);
1846
1847   if (data & 0x10)
1848      es8712_set_bank_base(device, 0x100000);
1849   else
1850      es8712_set_bank_base(device, 0x000000);
1851
1852   if (data & 0xa0)
1853      logerror("%s: Writing unknown bits %04x to $200000\n",machine().describe_context(),data);
1854}
1855
1856WRITE8_MEMBER(metro_state::vmetal_es8712_w)
1857{
1858   /* Many samples in the ADPCM ROM are actually not used.
1859
1860    Snd         Offset Writes                 Sample Range
1861         0000 0004 0002 0006 000a 0008 000c
1862    --   ----------------------------------   -------------
1863    00   006e 0001 00ab 003c 0002 003a 003a   01ab6e-023a3c
1864    01   003d 0002 003a 001d 0002 007e 007e   023a3d-027e1d
1865    02   00e2 0003 0005 002e 0003 00f3 00f3   0305e2-03f32e
1866    03   000a 0005 001e 00f6 0005 00ec 00ec   051e0a-05ecf6
1867    04   00f7 0005 00ec 008d 0006 0060 0060   05ecf7-06608d
1868    05   0016 0008 002e 0014 0009 0019 0019   082e16-091914
1869    06   0015 0009 0019 0094 000b 0015 0015   091915-0b1594
1870    07   0010 000d 0012 00bf 000d 0035 0035   0d1210-0d35bf
1871    08   00ce 000e 002f 0074 000f 0032 0032   0e2fce-0f3274
1872    09   0000 0000 0000 003a 0000 007d 007d   000000-007d3a
1873    0a   0077 0000 00fa 008d 0001 00b6 00b6   00fa77-01b68d
1874    0b   008e 0001 00b6 00b3 0002 0021 0021   01b68e-0221b3
1875    0c   0062 0002 00f7 0038 0003 00de 00de   02f762-03de38
1876    0d   00b9 0005 00ab 00ef 0006 0016 0016   05abb9-0616ef
1877    0e   00dd 0007 0058 00db 0008 001a 001a   0758dd-081adb
1878    0f   00dc 0008 001a 002e 0008 008a 008a   081adc-088a2e
1879    10   00db 0009 00d7 00ff 000a 0046 0046   09d7db-0a46ff
1880    11   0077 000c 0003 006d 000c 0080 0080   0c0377-0c806d
1881    12   006e 000c 0080 006c 000d 0002 0002   0c806e-0d026c
1882    13   006d 000d 0002 002b 000d 0041 0041   0d026d-0d412b
1883    14   002c 000d 0041 002a 000d 00be 00be   0d412c-0dbe2a
1884    15   002b 000d 00be 0029 000e 0083 0083   0dbe2b-0e8329
1885    16   002a 000e 0083 00ee 000f 0069 0069   0e832a-0f69ee
1886    */
1887
1888   device_t *device = machine().device("essnd");
1889   es8712_w(device, space, offset, data);
1890   logerror("%s: Writing %04x to ES8712 offset %02x\n", machine().describe_context(), data, offset);
1891}
1892
1893static ADDRESS_MAP_START( vmetal_map, AS_PROGRAM, 16, metro_state )
1894   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                    // ROM
1895   AM_RANGE(0x100000, 0x11ffff) AM_RAM_WRITE(metro_vram_0_w) AM_SHARE("vram_0")   // Layer 0
1896   AM_RANGE(0x120000, 0x13ffff) AM_RAM_WRITE(metro_vram_1_w) AM_SHARE("vram_1")   // Layer 1
1897   AM_RANGE(0x140000, 0x15ffff) AM_RAM_WRITE(metro_vram_2_w) AM_SHARE("vram_2")   // Layer 2
1898   AM_RANGE(0x160000, 0x16ffff) AM_READ(metro_bankedrom_r)                     // Banked ROM
1899   AM_RANGE(0x170000, 0x171fff) AM_RAM                                    // ???
1900   AM_RANGE(0x172000, 0x173fff) AM_RAM_WRITE(paletteram_GGGGGRRRRRBBBBBx_word_w) AM_SHARE("paletteram")   // Palette
1901   AM_RANGE(0x174000, 0x174fff) AM_RAM AM_SHARE("spriteram")                  // Sprites
1902   AM_RANGE(0x178000, 0x1787ff) AM_RAM AM_SHARE("tiletable")                  // Tiles Set
1903   AM_RANGE(0x178840, 0x17884d) AM_WRITE(metro_blitter_w) AM_SHARE("blitter_regs")   // Tiles Blitter
1904   AM_RANGE(0x178860, 0x17886b) AM_WRITE(metro_window_w) AM_SHARE("window")      // Tilemap Window
1905   AM_RANGE(0x178870, 0x17887b) AM_WRITEONLY AM_SHARE("scroll")               // Scroll
1906   AM_RANGE(0x178880, 0x178881) AM_WRITENOP                              // ? CRT
1907   AM_RANGE(0x178890, 0x178891) AM_WRITENOP                              // ? CRT
1908   AM_RANGE(0x1788a2, 0x1788a3) AM_READWRITE(metro_irq_cause_r, metro_irq_cause_w)   // IRQ Cause / IRQ Acknowledge
1909   AM_RANGE(0x1788a4, 0x1788a5) AM_WRITEONLY AM_SHARE("irq_enable")            // IRQ Enable
1910   AM_RANGE(0x1788aa, 0x1788ab) AM_WRITEONLY AM_SHARE("rombank")               // Rom Bank
1911   AM_RANGE(0x1788ac, 0x1788ad) AM_WRITEONLY AM_SHARE("screenctrl")            // Screen Control
1912   AM_RANGE(0x179700, 0x179713) AM_WRITEONLY AM_SHARE("videoregs")               // Video Registers
1913   AM_RANGE(0x200000, 0x200001) AM_READ_PORT("P1_P2") AM_WRITE8(vmetal_control_w, 0x00ff)
1914   AM_RANGE(0x200002, 0x200003) AM_READ_PORT("SYSTEM")
1915   AM_RANGE(0x300000, 0x31ffff) AM_READ(balcube_dsw_r)                        // DSW x 3
1916   AM_RANGE(0x400000, 0x400001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
1917   AM_RANGE(0x400002, 0x400003) AM_DEVWRITE8("oki", okim6295_device, write, 0x00ff)
1918   AM_RANGE(0x500000, 0x50000d) AM_WRITE8(vmetal_es8712_w, 0x00ff)
1919   AM_RANGE(0xf00000, 0xf0ffff) AM_RAM AM_MIRROR(0x0f0000)                     // RAM (mirrored)
1920ADDRESS_MAP_END
1921
1922
1923/***************************************************************************
1924
1925
18241926                                Input Ports
18251927
18261928
r20035r20036
32783380   PORT_BIT(  0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN )   // BIT 6 !?
32793381INPUT_PORTS_END
32803382
3383/***************************************************************************
3384                                Varia Metal
3385***************************************************************************/
32813386
3387/* verified from M68000 code */
3388static INPUT_PORTS_START( vmetal )
3389   PORT_START("P1_P2")
3390   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(2)
3391   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(2)
3392   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(2)
3393   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
3394   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3395   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
3396   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
3397   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 )
3398   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(1)
3399   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(1)
3400   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_8WAY PORT_PLAYER(1)
3401   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
3402   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
3403   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
3404   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
3405   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 )
32823406
3407   PORT_START("SYSTEM")
3408   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
3409   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
3410   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_TILT )             /* 'Tilt' only in "test mode" - no effect ingame */
3411   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE1 )         /* same coinage as COIN1 and COIN2 */
3412   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE2 )         /* 'Test' only in "test mode" - no effect ingame */
3413   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNUSED )
3414
3415   PORT_START("DSW0")
3416   // DSW1, stored at 0xff0085.b (cpl'ed)
3417   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )
3418   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C )  )
3419   PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C )  )
3420   PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C )  )
3421   PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C )  )
3422   PORT_DIPSETTING(      0x0003, DEF_STR( 1C_3C )  )
3423   PORT_DIPSETTING(      0x0002, DEF_STR( 1C_4C )  )
3424   PORT_DIPSETTING(      0x0001, DEF_STR( 1C_5C )  )
3425   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C )  )
3426   PORT_DIPUNUSED( 0x0008, IP_ACTIVE_LOW )                 /* 0x01 (OFF) or 0x02 (ON) written to 0xff0112.b but NEVER read back - old credits for 2 players game ? */
3427   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Flip_Screen ) )  /* 0x07c1 written to 0x1788ac.w (screen control ?) at first (code at 0x0001b8) */
3428   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )          /* 0x07c1 written to 0xff0114.w (then 0x1788ac.w) during initialisation (code at 0x000436) */
3429   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )           /* 0x07c0 written to 0xff0114.w (then 0x1788ac.w) during initialisation (code at 0x000436) */
3430   PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )
3431   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
3432   PORT_DIPSETTING(      0x0020, DEF_STR( On ) )
3433   PORT_DIPUNUSED( 0x0040, IP_ACTIVE_LOW )
3434   PORT_DIPUNUSED( 0x0080, IP_ACTIVE_LOW )
3435
3436   PORT_START("IN2")
3437   // DSW2, stored at 0xff0084.b (cpl'ed)
3438   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
3439   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
3440   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
3441   PORT_DIPSETTING(      0x0001, DEF_STR( Hard ) )
3442   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
3443   PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Lives ) )
3444   PORT_DIPSETTING(      0x0008, "1"  )
3445   PORT_DIPSETTING(      0x0004, "2"  )
3446   PORT_DIPSETTING(      0x000c, "3"  )
3447   PORT_DIPSETTING(      0x0000, "4"  )
3448   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Bonus_Life ) )   /* code at 0x0004a4 */
3449   PORT_DIPSETTING(      0x0010, "Every 30000" )
3450   PORT_DIPSETTING(      0x0000, "Every 60000" )
3451   PORT_DIPUNUSED( 0x0020, IP_ACTIVE_LOW )
3452   PORT_DIPUNUSED( 0x0040, IP_ACTIVE_LOW )
3453   PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
3454INPUT_PORTS_END
3455
3456
3457
32833458/***************************************************************************
32843459
32853460
r20035r20036
33023477};
33033478
33043479/* 8x8x8 tiles for later games */
3305static GFXLAYOUT_RAW( layout_8x8x8h, 8, 8, 8*8, 32*8 )
3480static GFXLAYOUT_RAW( layout_8x8x8, 8, 8, 8*8, 32*8 )
33063481
33073482/* 16x16x4 tiles for later games */
3308static const gfx_layout layout_16x16x4q =
3483static const gfx_layout layout_16x16x4 =
33093484{
33103485   16,16,
33113486   RGN_FRAC(1,1),
r20035r20036
33173492};
33183493
33193494/* 16x16x8 tiles for later games */
3320static GFXLAYOUT_RAW( layout_16x16x8o, 16, 16, 16*8, 32*8 )
3495static GFXLAYOUT_RAW( layout_16x16x8, 16, 16, 16*8, 32*8 )
33213496
33223497static const gfx_layout layout_053936 =
33233498{
r20035r20036
33523527
33533528static GFXDECODE_START( i4220 )
33543529   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x4,    0x0, 0x100 ) // [0] 4 Bit Tiles
3355   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x8h,   0x0,  0x10 ) // [1] 8 Bit Tiles
3530   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x8,    0x0,  0x10 ) // [1] 8 Bit Tiles
3531   GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x4,  0x0, 0x100 ) // [2] 4 Bit Tiles 16x16
3532   GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x8,  0x0, 0x100 ) // [3] 8 Bit Tiles 16x16
33563533GFXDECODE_END
33573534
33583535static GFXDECODE_START( blzntrnd )
33593536   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x4,    0x0, 0x100 ) // [0] 4 Bit Tiles
3360   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x8h,   0x0,  0x10 ) // [1] 8 Bit Tiles
3361   GFXDECODE_ENTRY( "gfx3", 0, layout_053936,   0x0,  0x10 ) // [2] 053936 Tiles
3537   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x8,    0x0,  0x10 ) // [1] 8 Bit Tiles
3538   GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x4,  0x0, 0x100 ) // [2] 4 Bit Tiles 16x16
3539   GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x8,  0x0, 0x100 ) // [3] 8 Bit Tiles 16x16
3540   GFXDECODE_ENTRY( "gfx2", 0, layout_053936,   0x0,  0x10 ) // [4] 053936 Tiles
33623541GFXDECODE_END
33633542
33643543static GFXDECODE_START( gstrik2 )
33653544   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x4,    0x0, 0x100 ) // [0] 4 Bit Tiles
3366   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x8h,   0x0,  0x10 ) // [1] 8 Bit Tiles
3367   GFXDECODE_ENTRY( "gfx3", 0, layout_053936_16,0x0,  0x10 ) // [2] 053936 Tiles
3545   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x8,    0x0,  0x10 ) // [1] 8 Bit Tiles
3546   GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x4,  0x0, 0x100 ) // [2] 4 Bit Tiles 16x16
3547   GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x8,  0x0, 0x100 ) // [3] 8 Bit Tiles 16x16
3548   GFXDECODE_ENTRY( "gfx2", 0, layout_053936_16,0x0,  0x10 ) // [4] 053936 Tiles
33683549GFXDECODE_END
33693550
3551// same as 14220:
33703552static GFXDECODE_START( i4300 )
33713553   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x4,    0x0, 0x100 ) // [0] 4 Bit Tiles
3372   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x8h,   0x0,  0x10 ) // [1] 8 Bit Tiles
3373   GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x4q, 0x0, 0x100 ) // [2] 4 Bit Tiles 16x16
3374   GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x8o, 0x0, 0x100 ) // [2] 8 Bit Tiles 16x16
3554   GFXDECODE_ENTRY( "gfx1", 0, layout_8x8x8,    0x0,  0x10 ) // [1] 8 Bit Tiles
3555   GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x4,  0x0, 0x100 ) // [2] 4 Bit Tiles 16x16
3556   GFXDECODE_ENTRY( "gfx1", 0, layout_16x16x8,  0x0, 0x100 ) // [3] 8 Bit Tiles 16x16
33753557GFXDECODE_END
33763558
33773559
r20035r20036
33963578   save_item(NAME(m_gakusai_oki_bank_hi));
33973579   save_item(NAME(m_sprite_xoffs));
33983580   save_item(NAME(m_sprite_yoffs));
3399   save_item(NAME(m_bg_tilemap_enable));
3400   save_item(NAME(m_bg_tilemap_enable16));
34013581}
34023582
34033583MACHINE_RESET_MEMBER(metro_state,metro)
r20035r20036
34333613   MCFG_SCREEN_UPDATE_DRIVER(metro_state, screen_update_metro)
34343614
34353615   MCFG_GFXDECODE(i4220)
3436   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_offset)
3616   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_dx_tmap)
34373617   MCFG_PALETTE_LENGTH(0x1000)
34383618
34393619   /* sound hardware */
r20035r20036
34663646   MCFG_SCREEN_UPDATE_DRIVER(metro_state, screen_update_metro)
34673647
34683648   MCFG_GFXDECODE(i4220)
3469   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_offset)
3649   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_dx_tmap)
34703650   MCFG_PALETTE_LENGTH(0x1000)
34713651
34723652   /* sound hardware */
r20035r20036
34993679   MCFG_SCREEN_UPDATE_DRIVER(metro_state, screen_update_metro)
35003680
35013681   MCFG_GFXDECODE(i4220)
3502   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_offset)
3682   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_dx_tmap)
35033683   MCFG_PALETTE_LENGTH(0x1000)
35043684
35053685   /* sound hardware */
r20035r20036
35323712   MCFG_SCREEN_UPDATE_DRIVER(metro_state, screen_update_metro)
35333713
35343714   MCFG_GFXDECODE(i4220)
3535   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_offset)
3715   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_dx_tmap)
35363716   MCFG_PALETTE_LENGTH(0x1000)
35373717
35383718   /* sound hardware */
r20035r20036
35653745   MCFG_SCREEN_UPDATE_DRIVER(metro_state, screen_update_metro)
35663746
35673747   MCFG_GFXDECODE(i4220)
3568   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_offset)
3748   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_dx_tmap)
35693749   MCFG_PALETTE_LENGTH(0x1000)
35703750
35713751   /* sound hardware */
r20035r20036
36023782   MCFG_SCREEN_UPDATE_DRIVER(metro_state, screen_update_metro)
36033783
36043784   MCFG_GFXDECODE(i4220)
3605   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_offset)
3785   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_dx_tmap)
36063786   MCFG_PALETTE_LENGTH(0x1000)
36073787
36083788   /* sound hardware */
r20035r20036
42044384MACHINE_CONFIG_END
42054385
42064386
4387static MACHINE_CONFIG_START( vmetal, metro_state )
4388
4389   /* basic machine hardware */
4390   MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz)
4391   MCFG_CPU_PROGRAM_MAP(vmetal_map)
4392   MCFG_CPU_VBLANK_INT_DRIVER("screen", metro_state,  metro_vblank_interrupt)
4393   MCFG_CPU_PERIODIC_INT_DRIVER(metro_state, metro_periodic_interrupt,  8*60) // ?
4394
4395   MCFG_MACHINE_START_OVERRIDE(metro_state,metro)
4396   MCFG_MACHINE_RESET_OVERRIDE(metro_state,metro)
4397
4398   /* video hardware */
4399   MCFG_SCREEN_ADD("screen", RASTER)
4400   MCFG_SCREEN_REFRESH_RATE(58.2328) // VSync 58.2328Hz, HSync 15.32kHz
4401   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
4402   MCFG_SCREEN_SIZE(320, 224)
4403   MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 224-1)
4404   MCFG_SCREEN_UPDATE_DRIVER(metro_state, screen_update_metro)
4405
4406   MCFG_GFXDECODE(i4220)
4407   MCFG_VIDEO_START_OVERRIDE(metro_state,metro_i4220_dx_sprite)
4408   MCFG_PALETTE_LENGTH(0x1000)
4409
4410   /* sound hardware */
4411   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
4412
4413   MCFG_OKIM6295_ADD("oki", XTAL_1MHz, OKIM6295_PIN7_HIGH)
4414   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.75)
4415   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.75)
4416
4417   MCFG_SOUND_ADD("essnd", ES8712, 12000)
4418   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
4419   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
4420
4421   // OKI M6585 not hooked up...
4422MACHINE_CONFIG_END
4423
4424
42074425static const k053936_interface blzntrnd_k053936_intf =
42084426{
42094427   0, -69, -21
r20035r20036
45224740   ROMX_LOAD( "rom331.bin", 0x1000004, 0x200000, CRC(4d909c28) SHA1(fb9bb824e518f67713799ed2c0159a7bd70f35c4) , ROM_GROUPWORD | ROM_SKIP(6))
45234741   ROMX_LOAD( "rom375.bin", 0x1000006, 0x200000, CRC(6eb4f97c) SHA1(c7f006230cbf10e706b0362eeed34655a3aef1a5) , ROM_GROUPWORD | ROM_SKIP(6))
45244742
4525   ROM_REGION( 0x200000, "gfx3", 0 )   /* 053936 gfx data */
4743   ROM_REGION( 0x200000, "gfx2", 0 )   /* 053936 gfx data */
45264744   ROM_LOAD( "rom9.bin", 0x000000, 0x200000, CRC(37ca3570) SHA1(3374c586bf84583fa33f2793c4e8f2f61a0cab1c) )
45274745
45284746   ROM_REGION( 0x080000, "ymsnd.deltat", 0 )   /* Samples */
r20035r20036
46084826//  ROMX_LOAD( "chr14.90", 0x1800004, 0x200000, CRC() SHA1() , ROM_GROUPWORD | ROM_SKIP(6))
46094827//  ROMX_LOAD( "chr15.89", 0x1800006, 0x200000, CRC() SHA1() , ROM_GROUPWORD | ROM_SKIP(6))
46104828
4611   ROM_REGION( 0x200000, "gfx3", 0 )   /* 053936 gfx data */
4829   ROM_REGION( 0x200000, "gfx2", 0 )   /* 053936 gfx data */
46124830   ROM_LOAD( "psacrom.60", 0x000000, 0x200000,  CRC(73f1f279) SHA1(1135b2b1eb4c52249bc12ee178340bbb202a94c8) )
46134831
46144832   ROM_REGION( 0x200000, "ymsnd.deltat", 0 )   /* Samples */
r20035r20036
46484866//  ROMX_LOAD( "chr14.90", 0x1800004, 0x200000, CRC() SHA1() , ROM_GROUPWORD | ROM_SKIP(6))
46494867//  ROMX_LOAD( "chr15.89", 0x1800006, 0x200000, CRC() SHA1() , ROM_GROUPWORD | ROM_SKIP(6))
46504868
4651   ROM_REGION( 0x200000, "gfx3", 0 )   /* 053936 gfx data */
4869   ROM_REGION( 0x200000, "gfx2", 0 )   /* 053936 gfx data */
46524870   ROM_LOAD( "psacrom.60", 0x000000, 0x200000,  CRC(73f1f279) SHA1(1135b2b1eb4c52249bc12ee178340bbb202a94c8) )
46534871
46544872   ROM_REGION( 0x200000, "ymsnd.deltat", 0 )   /* Samples */
r20035r20036
59496167   ROM_LOAD( "tr2_ja_7.3g", 0x000000, 0x020000, CRC(6ee32315) SHA1(ef4d59576929deab0aa459a67be21d97c2803dea) )
59506168ROM_END
59516169
6170/***************************************************************************
59526171
6172Varia Metal
6173Excellent System Ltd, 1995
6174
6175PCB Layout
6176----------
6177This game runs on Metro hardware.
6178
6179ES-9309B-B
6180|--------------------------------------------|
6181| TA7222   8.U9     DSW1(8)  DSW2(8)         |
6182|VOL    M6295  1.000MHz                      |
6183|                   |------------|           |
6184|          7.U12    |   68000    |           |
6185|  uPC3403          |------------|           |
6186|J 640kHz  ES-8712                           |
6187|A M6585           EPM7032    6B.U18  5B.U19 |
6188|M       MM1035                              |
6189|M        26.666MHz  16MHz    62256   62256  |
6190|A                                           |
6191|                 |--------|          1.U29  |
6192|         62256   |Imagetek|                 |
6193|         62256   |I4220   |          2.U31  |
6194|                 |        |                 |
6195|                 |--------|          3.U28  |
6196|                                            |
6197|                  6264               4.U30  |
6198|--------------------------------------------|
6199Notes:
6200      68000   - clock 16.000MHz
6201      ES-8712 - ES-8712 Single Channel ADPCM Samples Player. Clock ?? seems to be 16kHz?
6202                This chip is branded 'EXCELLENT', may be (or not??) manufactured by Ensonic (SDIP48)
6203      M6295   - clock 1.000MHz. Sample rate = 1000000/132
6204      M6585   - Oki M6585 ADPCM Voice Synthesizer IC (DIP18). Clock 640kHz.
6205                Sample rate = 16kHz (selection - pin 1 LOW, pin 2 HIGH = 16kHz)
6206                This is a version-up to the previous M5205 with some additional
6207                capabilies and improvements.
6208      MM1035  - Mitsumi Monolithic IC MM1035 System Reset and Watchdog Timer (DIP8)
6209      uPC3403 - NEC uPC3403 High Performance Quad Operational Amplifier (DIP14)
6210      62256   - 32k x8 SRAM (DIP28)
6211      6264    - 8k x8 SRAM (DIP28)
6212      TA7222  - Toshiba TA7222 5.8 Watt Audio Power Amplifier (SIP10)
6213      EPM7032 - Altera EPM7032LC44-15T High Performance EEPROM-based Programmable Logic Device (PLCC44)
6214      Custom  - Imagetek I4220 Graphics Controller (QFP208)
6215      VSync   - 58.2328Hz
6216      HSync   - 15.32kHz
6217      ROMs    -
6218                6B & 5B are 27C040 EPROM (DIP32)
6219                8 is 4M MaskROM (DIP32)
6220                All other ROMs are 16M MaskROM (DIP42)
6221
6222***************************************************************************/
6223
6224ROM_START( vmetal )
6225   ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
6226   ROM_LOAD16_BYTE( "6b.u18", 0x00000, 0x80000, CRC(4eb939d5) SHA1(741ab05043fc3bd886162d878630e45da9359718) )
6227   ROM_LOAD16_BYTE( "5b.u19", 0x00001, 0x80000, CRC(4933ac6c) SHA1(1a3303e32fcb08854d4d6e13f36ca99d92aed4cc) )
6228
6229   ROM_REGION( 0x800000, "gfx1", 0 )
6230   ROMX_LOAD( "2.u31", 0x000000, 0x200000, CRC(b36f8d60) SHA1(1676859d0fee4eb9897ce1601a2c9fd9a6dc4a43), ROM_GROUPWORD | ROM_SKIP(6))
6231   ROMX_LOAD( "4.u30", 0x000002, 0x200000, CRC(5a25a49c) SHA1(c30781202ec882e1ec6adfb560b0a1075b3cce55), ROM_GROUPWORD | ROM_SKIP(6))
6232   ROMX_LOAD( "1.u29", 0x000004, 0x200000, CRC(b470c168) SHA1(c30462dc134da1e71a94b36ef96ecd65c325b07e), ROM_GROUPWORD | ROM_SKIP(6))
6233   ROMX_LOAD( "3.u28", 0x000006, 0x200000, CRC(00fca765) SHA1(ca9010bd7f59367e483868018db9a9abf871386e), ROM_GROUPWORD | ROM_SKIP(6))
6234
6235   ROM_REGION( 0x080000, "oki", 0 ) /* OKI6295 Samples */
6236   /* Second half is junk */
6237   ROM_LOAD( "8.u9", 0x00000, 0x80000, CRC(c14c001c) SHA1(bad96b5cd40d1c34ef8b702262168ecab8192fb6) )
6238
6239   ROM_REGION( 0x200000, "essnd", 0 ) /* Samples */
6240   ROM_LOAD( "7.u12", 0x00000, 0x200000, CRC(a88c52f1) SHA1(d74a5a11f84ba6b1042b33a2c156a1071b6fbfe1) )
6241ROM_END
6242
6243ROM_START( vmetaln )
6244   ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
6245   ROM_LOAD16_BYTE( "vm6.bin", 0x00000, 0x80000, CRC(cb292ab1) SHA1(41fdfe67e6cb848542fd5aa0dfde3b1936bb3a28) )
6246   ROM_LOAD16_BYTE( "vm5.bin", 0x00001, 0x80000, CRC(43ef844e) SHA1(c673f34fcc9e406282c9008795b52d01a240099a) )
6247
6248   ROM_REGION( 0x800000, "gfx1", 0 )
6249   ROMX_LOAD( "2.u31", 0x000000, 0x200000, CRC(b36f8d60) SHA1(1676859d0fee4eb9897ce1601a2c9fd9a6dc4a43), ROM_GROUPWORD | ROM_SKIP(6))
6250   ROMX_LOAD( "4.u30", 0x000002, 0x200000, CRC(5a25a49c) SHA1(c30781202ec882e1ec6adfb560b0a1075b3cce55), ROM_GROUPWORD | ROM_SKIP(6))
6251   ROMX_LOAD( "1.u29", 0x000004, 0x200000, CRC(b470c168) SHA1(c30462dc134da1e71a94b36ef96ecd65c325b07e), ROM_GROUPWORD | ROM_SKIP(6))
6252   ROMX_LOAD( "3.u28", 0x000006, 0x200000, CRC(00fca765) SHA1(ca9010bd7f59367e483868018db9a9abf871386e), ROM_GROUPWORD | ROM_SKIP(6))
6253
6254   ROM_REGION( 0x080000, "oki", 0 ) /* OKI6295 Samples */
6255   /* Second half is junk */
6256   ROM_LOAD( "8.u9", 0x00000, 0x80000, CRC(c14c001c) SHA1(bad96b5cd40d1c34ef8b702262168ecab8192fb6) )
6257
6258   ROM_REGION( 0x200000, "essnd", 0 ) /* Samples */
6259   ROM_LOAD( "7.u12", 0x00000, 0x200000, CRC(a88c52f1) SHA1(d74a5a11f84ba6b1042b33a2c156a1071b6fbfe1) )
6260ROM_END
6261
6262
59536263/***************************************************************************
59546264
59556265
r20035r20036
60916401
60926402***************************************************************************/
60936403
6094GAME( 1992, karatour,  0,        karatour, karatour, metro_state, karatour, ROT0,   "Mitchell",                               "The Karate Tournament",             GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6095GAME( 1992, pangpoms,  0,        pangpoms, pangpoms, metro_state, metro,    ROT0,   "Metro",                                  "Pang Pom's",                        GAME_SUPPORTS_SAVE )
6096GAME( 1992, pangpomsm, pangpoms, pangpoms, pangpoms, metro_state, metro,    ROT0,   "Metro (Mitchell license)",               "Pang Pom's (Mitchell)",             GAME_SUPPORTS_SAVE )
6097GAME( 1992, skyalert,  0,        skyalert, skyalert, metro_state, metro,    ROT270, "Metro",                                  "Sky Alert",                         GAME_SUPPORTS_SAVE )
6098GAME( 1993, ladykill,  0,        karatour, ladykill, metro_state, karatour, ROT90,  "Yanyaka (Mitchell license)",             "Lady Killer",                       GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6099GAME( 1993, moegonta,  ladykill, karatour, moegonta, metro_state, karatour, ROT90,  "Yanyaka",                                "Moeyo Gonta!! (Japan)",             GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6100GAME( 1993, poitto,    0,        poitto,   poitto,   metro_state, metro,    ROT0,   "Metro / Able Corp.",                     "Poitto!",                           GAME_SUPPORTS_SAVE )
6101GAME( 1994, blzntrnd,  0,        blzntrnd, blzntrnd, metro_state, blzntrnd, ROT0,   "Human Amusement",                        "Blazing Tornado",                   GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6102GAME( 1994, dharma,    0,        dharma,   dharma,   metro_state, metro,    ROT0,   "Metro",                                  "Dharma Doujou",                     GAME_SUPPORTS_SAVE )
6103GAME( 1994, dharmak,   dharma,   dharma,   dharma,   metro_state, dharmak,  ROT0,   "Metro",                                  "Dharma Doujou (Korea)",             GAME_SUPPORTS_SAVE )
6104GAME( 1994, lastfort,  0,        lastfort, lastfort, metro_state, metro,    ROT0,   "Metro",                                  "Last Fortress - Toride",            GAME_SUPPORTS_SAVE )
6105GAME( 1994, lastforte, lastfort, lastfort, lastfero, metro_state, metro,    ROT0,   "Metro",                                  "Last Fortress - Toride (Erotic, Rev C)", GAME_SUPPORTS_SAVE )
6106GAME( 1994, lastfortea,lastfort, lastfort, lastfero, metro_state, metro,    ROT0,   "Metro",                                  "Last Fortress - Toride (Erotic, Rev A)", GAME_SUPPORTS_SAVE )
6107GAME( 1994, lastfortk, lastfort, lastfort, lastfero, metro_state, metro,    ROT0,   "Metro",                                  "Last Fortress - Toride (Korea)",    GAME_SUPPORTS_SAVE )
6108GAME( 1994, lastfortg, lastfort, lastforg, ladykill, metro_state, metro,    ROT0,   "Metro",                                  "Last Fortress - Toride (German)",   GAME_SUPPORTS_SAVE )
6109GAME( 1994, toride2g,  0,        toride2g, toride2g, metro_state, metro,    ROT0,   "Metro",                                  "Toride II Adauchi Gaiden",          GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6110GAME( 1994, toride2gg, toride2g, toride2g, toride2g, metro_state, metro,    ROT0,   "Metro",                                  "Toride II Adauchi Gaiden (German)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6111GAME( 1994, toride2gk, toride2g, toride2g, toride2g, metro_state, metro,    ROT0,   "Metro",                                  "Toride II Bok Su Oi Jeon Adauchi Gaiden (Korea)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6112GAME( 1994, toride2j,  toride2g, toride2g, toride2g, metro_state, metro,    ROT0,   "Metro",                                  "Toride II (Japan)",                 GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6113GAME( 1994, gunmast,   0,        pururun,  gunmast,  metro_state, daitorid, ROT0,   "Metro",                                  "Gun Master",                        GAME_SUPPORTS_SAVE )
6114GAME( 1995, daitorid,  0,        daitorid, daitorid, metro_state, daitorid, ROT0,   "Metro",                                  "Daitoride",                         GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6115GAME( 1996, daitorida, daitorid, daitoa,   daitorid, metro_state, balcube,  ROT0,   "Metro",                                  "Daitoride (YMF278B version)",       GAME_SUPPORTS_SAVE )
6116GAME( 1995, dokyusei,  0,        dokyusei, dokyusei, metro_state, gakusai,  ROT0,   "Make Software / Elf / Media Trading",    "Mahjong Doukyuusei",                GAME_SUPPORTS_SAVE )
6117GAME( 1995, dokyusp,   0,        dokyusp,  gakusai,  metro_state, gakusai,  ROT0,   "Make Software / Elf / Media Trading",    "Mahjong Doukyuusei Special",        GAME_SUPPORTS_SAVE )
6118GAME( 1995, msgogo,    0,        msgogo,   msgogo,   metro_state, balcube,  ROT0,   "Metro",                                  "Mouse Shooter GoGo",                GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6119GAME( 1995, pururun,   0,        pururun,  pururun,  metro_state, daitorid, ROT0,   "Metro / Banpresto",                      "Pururun",                           GAME_SUPPORTS_SAVE )
6120GAME( 1995, puzzli,    0,        daitorid, puzzli,   metro_state, daitorid, ROT0,   "Metro / Banpresto",                      "Puzzli",                            GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6121GAME( 1996, 3kokushi,  0,        3kokushi, 3kokushi, metro_state, karatour, ROT0,   "Mitchell",                               "Sankokushi (Japan)",                GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6122GAME( 1996, balcube,   0,        balcube,  balcube,  metro_state, balcube,  ROT0,   "Metro",                                  "Bal Cube",                          GAME_SUPPORTS_SAVE )
6123GAME( 1996, bangball,  0,        bangball, bangball, metro_state, balcube,  ROT0,   "Banpresto / Kunihiko Tashiro+Goodhouse", "Bang Bang Ball (v1.05)",            GAME_SUPPORTS_SAVE )
6124GAME( 1996, gstrik2,   0,        gstrik2,  gstrik2,  metro_state, blzntrnd, ROT0,   "Human Amusement",                        "Grand Striker 2 (Europe and Oceania)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6125GAME( 1996, gstrik2j,  gstrik2,  gstrik2,  gstrik2,  metro_state, blzntrnd, ROT0,   "Human Amusement",                        "Grand Striker 2 (Japan)",           GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) // priority between rounds
6126GAME( 1999, batlbubl,  bangball, batlbubl, batlbubl, metro_state, balcube,  ROT0,   "Banpresto (Limenko license?)",           "Battle Bubble (v2.00)",             GAME_SUPPORTS_SAVE ) // or bootleg?
6127GAME( 1996, mouja,     0,        mouja,    mouja,    metro_state, mouja,    ROT0,   "Etona",                                  "Mouja (Japan)",                     GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
6128GAME( 1997, gakusai,   0,        gakusai,  gakusai,  metro_state, gakusai,  ROT0,   "MakeSoft",                               "Mahjong Gakuensai (Japan)",         GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6129GAME( 1998, gakusai2,  0,        gakusai2, gakusai,  metro_state, gakusai,  ROT0,   "MakeSoft",                               "Mahjong Gakuensai 2 (Japan)",       GAME_SUPPORTS_SAVE )
6130GAME( 2000, puzzlet,   0,        puzzlet,  puzzlet,  metro_state, puzzlet,  ROT0,   "Unies Corporation",                      "Puzzlet (Japan)",                   GAME_NOT_WORKING | GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
6404GAME( 1992, karatour,  0,        karatour, karatour, metro_state, karatour, ROT0,   "Mitchell",                                        "The Karate Tournament",                  GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6405GAME( 1992, pangpoms,  0,        pangpoms, pangpoms, metro_state, metro,    ROT0,   "Metro",                                           "Pang Pom's",                             GAME_SUPPORTS_SAVE )
6406GAME( 1992, pangpomsm, pangpoms, pangpoms, pangpoms, metro_state, metro,    ROT0,   "Metro (Mitchell license)",                        "Pang Pom's (Mitchell)",                  GAME_SUPPORTS_SAVE )
6407GAME( 1992, skyalert,  0,        skyalert, skyalert, metro_state, metro,    ROT270, "Metro",                                           "Sky Alert",                              GAME_SUPPORTS_SAVE )
6408GAME( 1993, ladykill,  0,        karatour, ladykill, metro_state, karatour, ROT90,  "Yanyaka (Mitchell license)",                      "Lady Killer",                            GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6409GAME( 1993, moegonta,  ladykill, karatour, moegonta, metro_state, karatour, ROT90,  "Yanyaka",                                         "Moeyo Gonta!! (Japan)",                  GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6410GAME( 1993, poitto,    0,        poitto,   poitto,   metro_state, metro,    ROT0,   "Metro / Able Corp.",                              "Poitto!",                                GAME_SUPPORTS_SAVE )
6411GAME( 1994, blzntrnd,  0,        blzntrnd, blzntrnd, metro_state, blzntrnd, ROT0,   "Human Amusement",                                 "Blazing Tornado",                        GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6412GAME( 1994, dharma,    0,        dharma,   dharma,   metro_state, metro,    ROT0,   "Metro",                                           "Dharma Doujou",                          GAME_SUPPORTS_SAVE )
6413GAME( 1994, dharmak,   dharma,   dharma,   dharma,   metro_state, dharmak,  ROT0,   "Metro",                                           "Dharma Doujou (Korea)",                  GAME_SUPPORTS_SAVE )
6414GAME( 1994, lastfort,  0,        lastfort, lastfort, metro_state, metro,    ROT0,   "Metro",                                           "Last Fortress - Toride",                 GAME_SUPPORTS_SAVE )
6415GAME( 1994, lastforte, lastfort, lastfort, lastfero, metro_state, metro,    ROT0,   "Metro",                                           "Last Fortress - Toride (Erotic, Rev C)", GAME_SUPPORTS_SAVE )
6416GAME( 1994, lastfortea,lastfort, lastfort, lastfero, metro_state, metro,    ROT0,   "Metro",                                           "Last Fortress - Toride (Erotic, Rev A)", GAME_SUPPORTS_SAVE )
6417GAME( 1994, lastfortk, lastfort, lastfort, lastfero, metro_state, metro,    ROT0,   "Metro",                                           "Last Fortress - Toride (Korea)",         GAME_SUPPORTS_SAVE )
6418GAME( 1994, lastfortg, lastfort, lastforg, ladykill, metro_state, metro,    ROT0,   "Metro",                                           "Last Fortress - Toride (German)",        GAME_SUPPORTS_SAVE )
6419GAME( 1994, toride2g,  0,        toride2g, toride2g, metro_state, metro,    ROT0,   "Metro",                                           "Toride II Adauchi Gaiden",               GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6420GAME( 1994, toride2gg, toride2g, toride2g, toride2g, metro_state, metro,    ROT0,   "Metro",                                           "Toride II Adauchi Gaiden (German)",      GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6421GAME( 1994, toride2gk, toride2g, toride2g, toride2g, metro_state, metro,    ROT0,   "Metro",                                           "Toride II Bok Su Oi Jeon Adauchi Gaiden (Korea)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6422GAME( 1994, toride2j,  toride2g, toride2g, toride2g, metro_state, metro,    ROT0,   "Metro",                                           "Toride II (Japan)",                      GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6423GAME( 1994, gunmast,   0,        pururun,  gunmast,  metro_state, daitorid, ROT0,   "Metro",                                           "Gun Master",                             GAME_SUPPORTS_SAVE )
6424GAME( 1995, daitorid,  0,        daitorid, daitorid, metro_state, daitorid, ROT0,   "Metro",                                           "Daitoride",                              GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6425GAME( 1996, daitorida, daitorid, daitoa,   daitorid, metro_state, balcube,  ROT0,   "Metro",                                           "Daitoride (YMF278B version)",            GAME_SUPPORTS_SAVE )
6426GAME( 1995, dokyusei,  0,        dokyusei, dokyusei, metro_state, gakusai,  ROT0,   "Make Software / Elf / Media Trading",             "Mahjong Doukyuusei",                     GAME_SUPPORTS_SAVE )
6427GAME( 1995, dokyusp,   0,        dokyusp,  gakusai,  metro_state, gakusai,  ROT0,   "Make Software / Elf / Media Trading",             "Mahjong Doukyuusei Special",             GAME_SUPPORTS_SAVE )
6428GAME( 1995, msgogo,    0,        msgogo,   msgogo,   metro_state, balcube,  ROT0,   "Metro",                                           "Mouse Shooter GoGo",                     GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6429GAME( 1995, pururun,   0,        pururun,  pururun,  metro_state, daitorid, ROT0,   "Metro / Banpresto",                               "Pururun",                                GAME_SUPPORTS_SAVE )
6430GAME( 1995, puzzli,    0,        daitorid, puzzli,   metro_state, daitorid, ROT0,   "Metro / Banpresto",                               "Puzzli",                                 GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6431GAME( 1996, 3kokushi,  0,        3kokushi, 3kokushi, metro_state, karatour, ROT0,   "Mitchell",                                        "Sankokushi (Japan)",                     GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6432GAME( 1996, balcube,   0,        balcube,  balcube,  metro_state, balcube,  ROT0,   "Metro",                                           "Bal Cube",                               GAME_SUPPORTS_SAVE )
6433GAME( 1996, bangball,  0,        bangball, bangball, metro_state, balcube,  ROT0,   "Banpresto / Kunihiko Tashiro+Goodhouse",          "Bang Bang Ball (v1.05)",                 GAME_SUPPORTS_SAVE )
6434GAME( 1996, gstrik2,   0,        gstrik2,  gstrik2,  metro_state, blzntrnd, ROT0,   "Human Amusement",                                 "Grand Striker 2 (Europe and Oceania)",   GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6435GAME( 1996, gstrik2j,  gstrik2,  gstrik2,  gstrik2,  metro_state, blzntrnd, ROT0,   "Human Amusement",                                 "Grand Striker 2 (Japan)",                GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) // priority between rounds
6436GAME( 1999, batlbubl,  bangball, batlbubl, batlbubl, metro_state, balcube,  ROT0,   "Banpresto (Limenko license?)",                    "Battle Bubble (v2.00)",                  GAME_SUPPORTS_SAVE ) // or bootleg?
6437GAME( 1996, mouja,     0,        mouja,    mouja,    metro_state, mouja,    ROT0,   "Etona",                                           "Mouja (Japan)",                          GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
6438GAME( 1997, gakusai,   0,        gakusai,  gakusai,  metro_state, gakusai,  ROT0,   "MakeSoft",                                        "Mahjong Gakuensai (Japan)",              GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
6439GAME( 1998, gakusai2,  0,        gakusai2, gakusai,  metro_state, gakusai,  ROT0,   "MakeSoft",                                        "Mahjong Gakuensai 2 (Japan)",            GAME_SUPPORTS_SAVE )
6440GAME( 2000, puzzlet,   0,        puzzlet,  puzzlet,  metro_state, puzzlet,  ROT0,   "Unies Corporation",                               "Puzzlet (Japan)",                        GAME_NOT_WORKING | GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
6441GAME( 1995, vmetal,    0,        vmetal,   vmetal,   metro_state, blzntrnd, ROT90,  "Excellent System",                                "Varia Metal",                            GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
6442GAME( 1995, vmetaln,   vmetal,   vmetal,   vmetal,   metro_state, blzntrnd, ROT90,  "Excellent System (New Ways Trading Co. license)", "Varia Metal (New Ways Trading Co.)",     GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
trunk/src/mame/video/metro.c
r20035r20036
6060   int code = m_k053936_ram[tile_index];
6161
6262   SET_TILE_INFO_MEMBER(
63         2,
63         4,
6464         code & 0x7fff,
6565         0xe,
6666         0);
r20035r20036
7171   int code = m_k053936_ram[tile_index];
7272
7373   SET_TILE_INFO_MEMBER(
74         2,
74         4,
7575         (code & 0x7fff)>>2,
7676         0xe,
7777         0);
r20035r20036
100100
101101/***************************************************************************
102102
103
104103                        Tilemaps: Tiles Set & Window
105104
106105    Each entry in the Tiles Set RAM uses 2 words to specify a starting
r20035r20036
116115        2.w                                 Code Low Bits
117116
118117* 00-ff, but on later chips supporting it, xf means 256 color tile and palette x
118
119119***************************************************************************/
120120
121121
r20035r20036
127127
128128***************************************************************************/
129129
130/* A 2048 x 2048 virtual tilemap */
130// A 2048 x 2048 virtual tilemap
131131#define BIG_NX      (0x100)
132132#define BIG_NY      (0x100)
133133
134/* A smaller 512 x 256 window defines the actual tilemap */
134// A smaller 512 x 256 window defines the actual tilemap
135135
136136#define WIN_NX      (0x40)
137137#define WIN_NY      (0x20)
138138
139// this looks up a single pixel in a tile, given the code
140// the metro hardware has an indirection table, which is used here
141// returns if to draw the pixel or not, pixel colour is placed in pix
142INLINE UINT8 get_tile_pix( running_machine &machine, UINT16 code, UINT8 x, UINT8 y, int big, UINT16* pix )
139/* This looks up a single pixel in a tile, given the tile code.
140   The Metro hardware has an indirection table, which is used here.
141   Returns if to draw the pixel or not, pixel colour is placed in pix */
142INLINE UINT8 get_tile_pix( running_machine &machine, UINT16 code, UINT8 x, UINT8 y, int big, UINT16 *pix )
143143{
144144   metro_state *state = machine.driver_data<metro_state>();
145145   int table_index;
146146   UINT32 tile;
147147
148   /* Use code as an index into the tiles set table */
148   // Use code as an index into the tiles set table
149149   table_index = ((code & 0x1ff0) >> 4) * 2;
150150   tile = (state->m_tiletable[table_index + 0] << 16) + state->m_tiletable[table_index + 1];
151151
152   if (code & 0x8000) /* Special: draw a tile of a single color (i.e. not from the gfx ROMs) */
152   if (code & 0x8000) // Special: draw a tile of a single color (i.e. not from the gfx ROMs)
153153   {
154154      *pix = code & 0x0fff;
155155
r20035r20036
157157         return 1;
158158      else
159159         return 0;
160
161160   }
162161   else if (((tile & 0x00f00000) == 0x00f00000)   && (state->m_support_8bpp)) /* draw tile as 8bpp (e.g. balcube bg) */
163162   {
r20035r20036
171170         data = gfx1->get_data(tile2);
172171      else
173172      {
174         *pix |= 0;
173         *pix = 0;
175174         return 0;
176175      }
177176
r20035r20036
190189         return 1;
191190      else
192191         return 0;
193
194192   }
195193   else
196194   {
r20035r20036
204202         data = gfx1->get_data(tile2);
205203      else
206204      {
207         *pix |= 0;
205         *pix = 0;
208206         return 0;
209207      }
210208
r20035r20036
241239
242240
243241
244/* Dirty the relevant tilemap when its window changes */
245242WRITE16_MEMBER(metro_state::metro_window_w)
246243{
247244   COMBINE_DATA(&m_window[offset]);
r20035r20036
265262 the tile's sizes to be known at startup - which we don't!
266263*/
267264
268/* Dirty tilemaps when the tiles set changes */
269
270static void expand_gfx1(metro_state &state)
265void metro_state::expand_gfx1()
271266{
272   UINT8 *base_gfx = state.machine().root_device().memregion("gfx1")->base();
273   UINT32 length = 2 * state.machine().root_device().memregion("gfx1")->bytes();
274   state.m_expanded_gfx1 = auto_alloc_array(state.machine(), UINT8, length);
267   UINT8 *base_gfx   =   machine().root_device().memregion("gfx1")->base();
268   UINT32 length   =   machine().root_device().memregion("gfx1")->bytes() * 2;
269
270   m_expanded_gfx1 = auto_alloc_array(machine(), UINT8, length);
271
275272   for (int i = 0; i < length; i += 2)
276273   {
277274      UINT8 src = base_gfx[i / 2];
278      state.m_expanded_gfx1[i+0] = src & 15;
279      state.m_expanded_gfx1[i+1] = src >> 4;
275
276      m_expanded_gfx1[i + 0] = src & 0xf;
277      m_expanded_gfx1[i + 1] = src >> 4;
280278   }
281279}
282280
283281VIDEO_START_MEMBER(metro_state,metro_i4100)
284282{
285   expand_gfx1(*this);
283   expand_gfx1();
286284
287285   m_support_8bpp = 0;
288286   m_support_16x16 = 0;
289287   m_has_zoom = 0;
290288
291   m_bg_tilemap_enable[0] = 1;
292   m_bg_tilemap_enable[1] = 1;
293   m_bg_tilemap_enable[2] = 1;
289   m_tilemap_scrolldx[0] = 0;
290   m_tilemap_scrolldx[1] = 0;
291   m_tilemap_scrolldx[2] = 0;
294292
295   m_bg_tilemap_enable16[0] = 0;
296   m_bg_tilemap_enable16[1] = 0;
297   m_bg_tilemap_enable16[2] = 0;
298
299   m_bg_tilemap_scrolldx[0] = 0;
300   m_bg_tilemap_scrolldx[1] = 0;
301   m_bg_tilemap_scrolldx[2] = 0;
293   m_sprite_xoffs_dx = 0;
302294}
303295
304296VIDEO_START_MEMBER(metro_state,metro_i4220)
305297{
306298   VIDEO_START_CALL_MEMBER(metro_i4100);
307299
308   m_support_8bpp = 1;
300   m_support_8bpp = 1;      // balcube
301   m_support_16x16 = 1;   // vmetal
309302}
310VIDEO_START_MEMBER(metro_state,metro_i4220_offset)
303VIDEO_START_MEMBER(metro_state,metro_i4220_dx_tmap)
311304{
312305   VIDEO_START_CALL_MEMBER(metro_i4220);
313306
314   m_bg_tilemap_scrolldx[0] = -2;
315   m_bg_tilemap_scrolldx[1] = -2;
316   m_bg_tilemap_scrolldx[2] = -2;
307   m_tilemap_scrolldx[0] = -2;
308   m_tilemap_scrolldx[1] = -2;
309   m_tilemap_scrolldx[2] = -2;
317310}
311VIDEO_START_MEMBER(metro_state,metro_i4220_dx_sprite)
312{
313   VIDEO_START_CALL_MEMBER(metro_i4220);
318314
315   m_sprite_xoffs_dx = 8;
316}
317
319318VIDEO_START_MEMBER(metro_state,metro_i4300)
320319{
321320   VIDEO_START_CALL_MEMBER(metro_i4220);
322321
323   m_support_16x16 = 1;
322   // any additional feature?
324323}
325324
326325VIDEO_START_MEMBER(metro_state,blzntrnd)
r20035r20036
331330
332331   m_k053936_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(metro_state::metro_k053936_get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 256, 512);
333332
334   m_bg_tilemap_scrolldx[0] = 8;
335   m_bg_tilemap_scrolldx[1] = 8;
336   m_bg_tilemap_scrolldx[2] = 8;
333   m_tilemap_scrolldx[0] = 8;
334   m_tilemap_scrolldx[1] = 8;
335   m_tilemap_scrolldx[2] = 8;
337336}
338337
339338VIDEO_START_MEMBER(metro_state,gstrik2)
r20035r20036
344343
345344   m_k053936_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(metro_state::metro_k053936_gstrik2_get_tile_info),this), tilemap_mapper_delegate(FUNC(metro_state::tilemap_scan_gstrik2),this), 16, 16, 128, 256);
346345
347   m_bg_tilemap_scrolldx[0] = 8;
348   m_bg_tilemap_scrolldx[1] = 0;
349   m_bg_tilemap_scrolldx[2] = 8;
346   m_tilemap_scrolldx[0] = 8;
347   m_tilemap_scrolldx[1] = 0;
348   m_tilemap_scrolldx[2] = 8;
350349}
351350
352351/***************************************************************************
r20035r20036
409408
410409***************************************************************************/
411410
412/* Draw sprites */
413
414411void metro_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
415412{
416413   metro_state *state = machine.driver_data<metro_state>();
r20035r20036
450447      {
451448         int x, y, attr, code, color, flipx, flipy, zoom, curr_pri, width, height;
452449
453         /* Exponential zoom table extracted from daitoride */
450         // Exponential zoom table extracted from daitoride
454451         static const int zoomtable[0x40] =
455452         {   0xAAC,0x800,0x668,0x554,0x494,0x400,0x390,0x334,
456453            0x2E8,0x2AC,0x278,0x248,0x224,0x200,0x1E0,0x1C8,
r20035r20036
556553
557554***************************************************************************/
558555
559/* copy a 'window' from the large 2048x2048 (or 4096x4096 for 16x16 tiles) tilemap */
556// Copy a 'window' from the large 2048x2048 (or 4096x4096 for 16x16 tiles) tilemap
560557
561
562558static void draw_tilemap( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 flags, UINT32 pcode,
563                   int sx, int sy, int wx, int wy, int big, UINT16* tilemapram, int layer )
559                   int sx, int sy, int wx, int wy, int big, UINT16 *tilemapram, int layer )
564560{
565561   metro_state *state = machine.driver_data<metro_state>();
566562   int y;
567563
568564   bitmap_ind8 &priority_bitmap = machine.priority_bitmap;
569565
570   int width = big ? 4096 : 2048;//pixdata->width;
571   int height = big ? 4096 : 2048;//pixdata->height;
566   int width  = big ? 4096 : 2048;
567   int height = big ? 4096 : 2048;
572568
573   int scrwidth = bitmap.width();
569   int scrwidth = bitmap.width();
574570   int scrheight = bitmap.height();
575571
576   int windowwidth = width >> 2;
572   int windowwidth = width >> 2;
577573   int windowheight = height >> 3;
578574
579   if (!big)
580   {
581      if (!state->m_bg_tilemap_enable[layer]) return;
582   }
583   else
584   {
585      if (!state->m_bg_tilemap_enable16[layer]) return;
586   }
575   sx += state->m_tilemap_scrolldx[layer] * (state->m_flip_screen ? 1 : -1);
587576
588
589   if (!state->m_flip_screen)
577   for (y = 0; y < scrheight; y++)
590578   {
591      sx -= state->m_bg_tilemap_scrolldx[layer];
592   }
593   else
594   {
595      sx += state->m_bg_tilemap_scrolldx[layer];
596   }
597
598   for (y=0;y<scrheight;y++)
599   {
600579      int scrolly = (sy+y-wy)&(windowheight-1);
601580      int x;
602      UINT16* dst;
581      UINT16 *dst;
603582      UINT8 *priority_baseaddr;
604583      int srcline = (wy+scrolly)&(height-1);
605584      int srctilerow = srcline >> (big ? 4 : 3);
r20035r20036
609588         dst = &bitmap.pix16(y);
610589         priority_baseaddr = &priority_bitmap.pix8(y);
611590
612         for (x=0;x<scrwidth;x++)
591         for (x = 0; x < scrwidth; x++)
613592         {
614593            int scrollx = (sx+x-wx)&(windowwidth-1);
615594            int srccol = (wx+scrollx)&(width-1);
r20035r20036
633612         dst = &bitmap.pix16(scrheight-y-1);
634613         priority_baseaddr = &priority_bitmap.pix8(scrheight-y-1);
635614
636         for (x=0;x<scrwidth;x++)
615         for (x = 0; x < scrwidth; x++)
637616         {
638617            int scrollx = (sx+x-wx)&(windowwidth-1);
639618            int srccol = (wx+scrollx)&(width-1);
r20035r20036
655634   }
656635}
657636
658/* Draw all the layers that match the given priority */
637// Draw all the layers that match the given priority
638
659639static void draw_layers( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int layers_ctrl )
660640{
661641   metro_state *state = machine.driver_data<metro_state>();
662642   UINT16 layers_pri = state->m_videoregs[0x10 / 2];
663643   int layer;
664644
665   /* Draw all the layers with priority == pri */
666   for (layer = 2; layer >= 0; layer--)   // tilemap[2] below?
645   // Draw all the layers with priority == pri
646   for (layer = 2; layer >= 0; layer--)
667647   {
668648      if (pri == ((layers_pri >> (layer * 2)) & 3))
669649      {
670         /* Scroll and Window values */
650         // Scroll and Window values
671651         UINT16 sy = state->m_scroll[layer * 2 + 0];   UINT16 sx = state->m_scroll[layer * 2 + 1];
672652         UINT16 wy = state->m_window[layer * 2 + 0];   UINT16 wx = state->m_window[layer * 2 + 1];
673653
674654         if (BIT(layers_ctrl, layer))   // for debug
675655         {
676            UINT16* tilemapram = 0;
656            UINT16 *tilemapram = 0;
677657
678            if (layer==0) tilemapram = state->m_vram_0;
679            else if (layer==1) tilemapram = state->m_vram_1;
680            else if (layer==2) tilemapram = state->m_vram_2;
658            switch (layer)
659            {
660               case 0:   tilemapram = state->m_vram_0;   break;
661               case 1:   tilemapram = state->m_vram_1;   break;
662               case 2:   tilemapram = state->m_vram_2;   break;
663            }
681664
682            draw_tilemap(machine, bitmap, cliprect, 0, 1 << (3 - pri), sx, sy, wx, wy, 0, tilemapram, layer);
665            int big = state->m_support_16x16 && (*state->m_screenctrl & (0x0020 << layer));
683666
684            if (state->m_support_16x16)
685               draw_tilemap(machine, bitmap, cliprect, 0, 1 << (3 - pri), sx, sy, wx, wy, 1, tilemapram, layer);
667            draw_tilemap(machine, bitmap, cliprect, 0, 1 << (3 - pri), sx, sy, wx, wy, big, tilemapram, layer);
686668         }
687669      }
688670   }
689671}
690672
691673
692
693674UINT32 metro_state::screen_update_metro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
694675{
695676   int pri, layers_ctrl = -1;
696677   UINT16 screenctrl = *m_screenctrl;
697678
698   m_sprite_xoffs = m_videoregs[0x06 / 2] - screen.width()  / 2;
679   m_sprite_xoffs = m_videoregs[0x06 / 2] - screen.width()  / 2 + m_sprite_xoffs_dx;
699680   m_sprite_yoffs = m_videoregs[0x04 / 2] - screen.height() / 2;
700681
701   /* The background color is selected by a register */
702682   machine().priority_bitmap.fill(0, cliprect);
683
684   // The background color is selected by a register
703685   bitmap.fill(m_videoregs[0x12/2] & 0x0fff, cliprect);
704686
705687   /*  Screen Control Register:
706688
707689        f--- ---- ---- ----     ?
708690        -edc b--- ---- ----
709        ---- -a98 ---- ----     ? Leds
710        ---- ---- 7--- ----     16x16 Tiles (Layer 2)
711        ---- ---- -6-- ----     16x16 Tiles (Layer 1)
712        ---- ---- --5- ----     16x16 Tiles (Layer 0)
691        ---- -a98 ---- ----     ? Leds (see gakusai attract)
692        ---- ---- 765- ----     16x16 Tiles  (Layer 2-1-0)
713693        ---- ---- ---4 32--
714        ---- ---- ---- --1-     ? Blank Screen
694        ---- ---- ---- --1-     Blank Screen
715695        ---- ---- ---- ---0     Flip  Screen    */
716696   if (screenctrl & 2)
717697      return 0;
718698
719   //flip_screen_set(screenctrl & 1);
720699   m_flip_screen = screenctrl & 1;
721700
722   /* If the game supports 16x16 tiles, make sure that the
723       16x16 and 8x8 tilemaps of a given layer are not simultaneously
724       enabled! */
725   if (m_support_16x16)
726   {
727      int layer;
728
729      for (layer = 0; layer < 3; layer++)
730      {
731         int big = screenctrl & (0x0020 << layer);
732
733         m_bg_tilemap_enable[layer] = !big;
734         m_bg_tilemap_enable16[layer] = big;
735      }
736   }
737
738
739701#ifdef MAME_DEBUG
740702if (machine().input().code_pressed(KEYCODE_Z))
741703{
r20035r20036
746708   if (machine().input().code_pressed(KEYCODE_A))   msk |= 8;
747709   if (msk != 0)
748710   {
749      bitmap.fill(0, cliprect);
711      bitmap.fill(get_black_pen(machine()), cliprect);
750712      layers_ctrl &= msk;
751713   }
752714
753   popmessage("l %x-%x-%x r %04x %04x %04x",
715   popmessage(   "lyr: %x-%x-%x spr: %04x clr: %04x scr: %04x",
754716            (m_videoregs[0x10/2] & 0x30) >> 4, (m_videoregs[0x10/2] & 0xc) >> 2, m_videoregs[0x10/2] & 3,
755717            m_videoregs[0x02/2], m_videoregs[0x12/2],
756718            *m_screenctrl);
r20035r20036
765727
766728   if (layers_ctrl & 0x08)
767729      metro_draw_sprites(machine(), bitmap, cliprect);
730
768731   return 0;
769732}
trunk/src/mame/mame.mak
r20035r20036
713713   $(DRIVERS)/dblcrown.o \
714714   $(DRIVERS)/gcpinbal.o $(VIDEO)/gcpinbal.o \
715715   $(DRIVERS)/lastbank.o \
716   $(DRIVERS)/vmetal.o \
717716
718717$(MAMEOBJ)/exidy.a: \
719718   $(DRIVERS)/carpolo.o $(MACHINE)/carpolo.o $(VIDEO)/carpolo.o \
trunk/src/mame/includes/metro.h
r20035r20036
6666
6767   /* video-related */
6868   tilemap_t   *m_k053936_tilemap;
69   int         m_bg_tilemap_enable[3];
70   int         m_bg_tilemap_enable16[3];
71   int         m_bg_tilemap_scrolldx[3];
69   int         m_tilemap_scrolldx[3];
7270
7371   int         m_support_8bpp;
7472   int         m_support_16x16;
7573   int         m_has_zoom;
7674   int         m_sprite_xoffs;
7775   int         m_sprite_yoffs;
76   int         m_sprite_xoffs_dx;
7877
79   UINT8 *      m_expanded_gfx1;
78   UINT8       *m_expanded_gfx1;
8079
8180   /* irq_related */
8281   int         m_vblank_bit;
r20035r20036
142141   DECLARE_WRITE16_MEMBER(dokyusp_eeprom_bit_w);
143142   DECLARE_WRITE16_MEMBER(dokyusp_eeprom_reset_w);
144143   DECLARE_WRITE16_MEMBER(mouja_sound_rombank_w);
144
145   // vmetal
146   DECLARE_WRITE8_MEMBER(vmetal_control_w);
147   DECLARE_WRITE8_MEMBER(vmetal_es8712_w);
148
145149   DECLARE_DRIVER_INIT(karatour);
146150   DECLARE_DRIVER_INIT(daitorid);
147151   DECLARE_DRIVER_INIT(blzntrnd);
r20035r20036
156160   TILEMAP_MAPPER_MEMBER(tilemap_scan_gstrik2);
157161   DECLARE_MACHINE_START(metro);
158162   DECLARE_MACHINE_RESET(metro);
163   void expand_gfx1();
159164   DECLARE_VIDEO_START(metro_i4100);
160165   DECLARE_VIDEO_START(metro_i4220);
161   DECLARE_VIDEO_START(metro_i4220_offset);
166   DECLARE_VIDEO_START(metro_i4220_dx_tmap);
167   DECLARE_VIDEO_START(metro_i4220_dx_sprite);
162168   DECLARE_VIDEO_START(metro_i4300);
163169   DECLARE_VIDEO_START(blzntrnd);
164170   DECLARE_VIDEO_START(gstrik2);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team