1 #include "../vidhrdw/superqix.c"
2 
3 /***************************************************************************
4 
5 Super QIX memory map (preliminary)
6 
7 driver by Mirko Buffoni
8 
9 CPU:
10 0000-7fff ROM
11 8000-bfff BANK 0-1-2-3	(All banks except 2 contain code)
12 
13 Notes:
14 - the original doesn't work due to protection. There is an unknown ROM: code
15   for a mcu?
16 
17 ***************************************************************************/
18 
19 #include "driver.h"
20 #include "vidhrdw/generic.h"
21 
22 
23 
24 int superqix_vh_start(void);
25 void superqix_vh_stop(void);
26 READ_HANDLER( superqix_bitmapram_r );
27 WRITE_HANDLER( superqix_bitmapram_w );
28 READ_HANDLER( superqix_bitmapram2_r );
29 WRITE_HANDLER( superqix_bitmapram2_w );
30 WRITE_HANDLER( superqix_0410_w );
31 void superqix_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
32 
33 
34 
35 static struct MemoryReadAddress readmem[] =
36 {
37 	{ 0x0000, 0x7fff, MRA_ROM },
38 	{ 0x8000, 0xbfff, MRA_BANK1 },
39 	{ 0xe000, 0xffff, MRA_RAM },
40 	{ -1 }	/* end of table */
41 };
42 
43 static struct MemoryWriteAddress writemem[] =
44 {
45 	{ 0x0000, 0xbfff, MWA_ROM },
46 	{ 0xe000, 0xe0ff, MWA_RAM, &spriteram, &spriteram_size },
47 	{ 0xe100, 0xe7ff, MWA_RAM },
48 	{ 0xe800, 0xebff, videoram_w, &videoram, &videoram_size },
49 	{ 0xec00, 0xefff, colorram_w, &colorram },
50 	{ 0xf000, 0xffff, MWA_RAM },
51 	{ -1 }	/* end of table */
52 };
53 
54 static struct IOReadPort readport[] =
55 {
56 	{ 0x0000, 0x00ff, paletteram_r },
57 	{ 0x0401, 0x0401, AY8910_read_port_0_r },
58 	{ 0x0405, 0x0405, AY8910_read_port_1_r },
59 	{ 0x0418, 0x0418, input_port_4_r },
60 	{ 0x0800, 0x77ff, superqix_bitmapram_r },
61 	{ 0x8800, 0xf7ff, superqix_bitmapram2_r },
62 	{ -1 }	/* end of table */
63 };
64 
65 static struct IOWritePort writeport[] =
66 {
67 	{ 0x0000, 0x00ff, paletteram_BBGGRRII_w },
68 	{ 0x0402, 0x0402, AY8910_write_port_0_w },
69 	{ 0x0403, 0x0403, AY8910_control_port_0_w },
70 	{ 0x0406, 0x0406, AY8910_write_port_1_w },
71 	{ 0x0407, 0x0407, AY8910_control_port_1_w },
72 	{ 0x0410, 0x0410, superqix_0410_w },	/* ROM bank, NMI enable, tile bank */
73 	{ 0x0800, 0x77ff, superqix_bitmapram_w },
74 	{ 0x8800, 0xf7ff, superqix_bitmapram2_w },
75 	{ -1 }	/* end of table */
76 };
77 
78 
79 
80 INPUT_PORTS_START( superqix )
81 	PORT_START	/* IN0 */
82 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
83 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
84 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
85 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
86 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
87 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
88 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_VBLANK )	/* ??? */
89 	PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
90 
91 	PORT_START	/* IN1 */
92 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
93 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
94 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
95 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
96 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
97 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
98 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
99 	PORT_BITX(    0x80, 0x00, IPT_DIPSWITCH_NAME, "Freeze???", IP_KEY_NONE, IP_JOY_NONE )
100 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
101 	PORT_DIPSETTING(    0x80, DEF_STR( On ) )
102 
103 	PORT_START	/* DSW1 */
104 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
105 	PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
106 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
107 	PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ))
108 	PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
109 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_A ) )
110 	PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
111 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
112 	PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ))
113 	PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
114 	PORT_DIPNAME( 0x10, 0x00, "Allow Continue" )
115 	PORT_DIPSETTING(    0x10, DEF_STR( No ) )
116 	PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
117 	PORT_DIPNAME( 0x20, 0x20, "Freeze" )
118 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
119 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
120 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
121 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
122 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
123 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
124 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
125 	PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
126 
127 	PORT_START	/* DSW2 */
128 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
129 	PORT_DIPSETTING(    0x02, "Easy" )
130 	PORT_DIPSETTING(    0x03, "Normal" )
131 	PORT_DIPSETTING(    0x01, "Hard" )
132 	PORT_DIPSETTING(    0x00, "Hardest" )
133 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
134 	PORT_DIPSETTING(    0x08, "20000 50000" )
135 	PORT_DIPSETTING(    0x0c, "30000 100000" )
136 	PORT_DIPSETTING(    0x04, "50000 100000" )
137 	PORT_DIPSETTING(    0x00, "None" )
138 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
139 	PORT_DIPSETTING(    0x20, "2" )
140 	PORT_DIPSETTING(    0x30, "3" )
141 	PORT_DIPSETTING(    0x10, "4" )
142 	PORT_DIPSETTING(    0x00, "5" )
143 	PORT_DIPNAME( 0xc0, 0xc0, "Fill Area" )
144 	PORT_DIPSETTING(    0x80, "70%" )
145 	PORT_DIPSETTING(    0xc0, "75%" )
146 	PORT_DIPSETTING(    0x40, "80%" )
147 	PORT_DIPSETTING(    0x00, "85%" )
148 
149 	PORT_START	/* IN2 */
150 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
151 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
152 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
153 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
154 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
155 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
156 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
157 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
158 INPUT_PORTS_END
159 
160 
161 
162 static struct GfxLayout charlayout =
163 {
164 	8,8,    /* 8*8 characters */
165 	1024,    /* 1024 characters */
166 	4,      /* 4 bits per pixel */
167 	{ 0, 1, 2, 3 }, /* the bitplanes are packed in one nibble */
168 	{ 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
169 	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
170 	32*8   /* every char takes 32 consecutive bytes */
171 };
172 
173 static struct GfxLayout spritelayout =
174 {
175 	16,16,    /* 16*16 sprites */
176 	512,    /* 512 sprites */
177 	4,      /* 4 bits per pixel */
178 	{ 0, 1, 2, 3 }, /* the bitplanes are packed in one nibble */
179 	{ 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
180 			32*8+0*4, 32*8+1*4, 32*8+2*4, 32*8+3*4, 32*8+4*4, 32*8+5*4, 32*8+6*4, 32*8+7*4 },
181 	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
182 			16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 },
183 	128*8   /* every sprites takes 128 consecutive bytes */
184 };
185 
186 static struct GfxDecodeInfo gfxdecodeinfo[] =
187 {
188 	{ REGION_GFX1, 0x00000, &charlayout,   0, 16 },	/* Chars */
189 	{ REGION_GFX2, 0x00000, &charlayout,   0, 16 },	/* Background tiles */
190 	{ REGION_GFX2, 0x08000, &charlayout,   0, 16 },
191 	{ REGION_GFX2, 0x10000, &charlayout,   0, 16 },
192 	{ REGION_GFX2, 0x18000, &charlayout,   0, 16 },
193 	{ REGION_GFX3, 0x00000, &spritelayout, 0, 16 },	/* Sprites */
194 	{ -1 } /* end of array */
195 };
196 
197 
198 
199 static struct AY8910interface ay8910_interface =
200 {
201 	2,	/* 2 chips */
202 	1500000,	/* 1.5 MHz??? */
203 	{ 25, 25 },
204 	{ input_port_0_r, input_port_3_r },		/* port Aread */
205 	{ input_port_1_r, input_port_2_r },		/* port Bread */
206 	{ 0 },	/* port Awrite */
207 	{ 0 }	/* port Bwrite */
208 };
209 
sqix_interrupt(void)210 int sqix_interrupt(void)
211 {
212 	static int loop=0;
213 
214 	loop++;
215 
216 	if(loop>2) {
217 		if(loop==6) loop=0;
218 		return nmi_interrupt();
219 	}
220 	else
221 		return 0;
222 }
223 
224 static struct MachineDriver machine_driver_superqix =
225 {
226 	/* basic machine hardware */
227 	{
228 		{
229 			CPU_Z80 | CPU_16BIT_PORT,
230 //			10000000,	/* 10 Mhz ? */
231 			6000000,	/* 6 Mhz ? */
232 			readmem,writemem,readport,writeport,
233 //			nmi_interrupt,3	/* ??? */
234 			sqix_interrupt,6	/* ??? */
235 		}
236 	},
237 	60, DEFAULT_REAL_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
238 	1,	/* single CPU, no need for interleaving */
239 	0,
240 
241 	/* video hardware */
242 	32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
243 	gfxdecodeinfo,
244 	256, 256,
245 	0,
246 
247 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,// | VIDEO_SUPPORTS_DIRTY,
248 	0,
249 	superqix_vh_start,
250 	superqix_vh_stop,
251 	superqix_vh_screenrefresh,
252 
253 	/* sound hardware */
254 	0,0,0,0,
255 	{
256 		{
257 			SOUND_AY8910,
258 			&ay8910_interface
259 		}
260 	}
261 };
262 
263 
264 
265 /***************************************************************************
266 
267   Game driver(s)
268 
269 ***************************************************************************/
270 
271 ROM_START( superqix )
272 	ROM_REGION( 0x20000, REGION_CPU1 )	/* 64k for code */
273 	ROM_LOAD( "sq01.97",      0x00000, 0x08000, 0x0888b7de )
274 	ROM_LOAD( "sq02.96",      0x10000, 0x10000, 0x9c23cb64 )
275 
276 	ROM_REGION( 0x08000, REGION_GFX1 | REGIONFLAG_DISPOSE )
277 	ROM_LOAD( "sq04.2",       0x00000, 0x08000, 0xf815ef45 )
278 
279 	ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
280 	ROM_LOAD( "sq03.3",       0x00000, 0x10000, 0x6e8b6a67 )
281 	ROM_LOAD( "sq06.14",      0x10000, 0x10000, 0x38154517 )
282 
283 	ROM_REGION( 0x10000, REGION_GFX3 | REGIONFLAG_DISPOSE )
284 	ROM_LOAD( "sq05.1",       0x00000, 0x10000, 0xdf326540 )
285 
286 	ROM_REGION( 0x1000, REGION_USER1 )	/* Unknown (protection related?) */
287 	ROM_LOAD( "sq07.108",     0x00000, 0x1000, 0x071a598c )
288 ROM_END
289 
290 ROM_START( sqixbl )
291 	ROM_REGION( 0x20000, REGION_CPU1 )	/* 64k for code */
292 	ROM_LOAD( "cpu.2",        0x00000, 0x08000, 0x682e28e3 )
293 	ROM_LOAD( "sq02.96",      0x10000, 0x10000, 0x9c23cb64 )
294 
295 	ROM_REGION( 0x08000, REGION_GFX1 | REGIONFLAG_DISPOSE )
296 	ROM_LOAD( "sq04.2",       0x00000, 0x08000, 0xf815ef45 )
297 
298 	ROM_REGION( 0x20000, REGION_GFX2 | REGIONFLAG_DISPOSE )
299 	ROM_LOAD( "sq03.3",       0x00000, 0x10000, 0x6e8b6a67 )
300 	ROM_LOAD( "sq06.14",      0x10000, 0x10000, 0x38154517 )
301 
302 	ROM_REGION( 0x10000, REGION_GFX3 | REGIONFLAG_DISPOSE )
303 	ROM_LOAD( "sq05.1",       0x00000, 0x10000, 0xdf326540 )
304 ROM_END
305 
306 
307 
308 GAMEX( 1987, superqix, 0,        superqix, superqix, 0, ROT90, "Taito", "Super Qix", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
309 GAMEX( 1987, sqixbl,   superqix, superqix, superqix, 0, ROT90, "bootleg", "Super Qix (bootleg)", GAME_NO_COCKTAIL )
310