1 /***************************************************************************
2 
3 	Centuri Aztarac hardware
4 
5 	driver by Mathis Rosenhauer
6 	Thanks to David Fish for additional hardware information.
7 
8 	Games supported:
9 		* Aztarac
10 
11 	Known bugs:
12 		* none at this time
13 
14 ***************************************************************************/
15 
16 #include "driver.h"
17 #include "vidhrdw/vector.h"
18 #include "aztarac.h"
19 
20 
21 
22 /*************************************
23  *
24  *	Machine init
25  *
26  *************************************/
27 
aztarac_irq_callback(int irqline)28 static int aztarac_irq_callback(int irqline)
29 {
30 	return 0xc;
31 }
32 
33 
MACHINE_INIT(aztarac)34 static MACHINE_INIT( aztarac )
35 {
36 	cpu_set_irq_callback(0, aztarac_irq_callback);
37 }
38 
39 
40 
41 /*************************************
42  *
43  *	NVRAM handler
44  *
45  *************************************/
46 
READ16_HANDLER(nvram_r)47 static READ16_HANDLER( nvram_r )
48 {
49 	return ((data16_t *)generic_nvram)[offset] | 0xfff0;
50 }
51 
52 
53 
54 /*************************************
55  *
56  *	Input ports
57  *
58  *************************************/
59 
READ16_HANDLER(joystick_r)60 static READ16_HANDLER( joystick_r )
61 {
62     return (((input_port_0_r (offset) - 0xf) << 8) |
63             ((input_port_1_r (offset) - 0xf) & 0xff));
64 }
65 
66 
67 
68 /*************************************
69  *
70  *	Main CPU memory handlers
71  *
72  *************************************/
73 
MEMORY_READ16_START(readmem)74 static MEMORY_READ16_START( readmem )
75 	{ 0x000000, 0x00bfff, MRA16_ROM },
76 	{ 0x022000, 0x022fff, nvram_r },
77 	{ 0x027000, 0x027001, joystick_r },
78 	{ 0x027004, 0x027005, input_port_3_word_r },
79 	{ 0x027008, 0x027009, aztarac_sound_r },
80 	{ 0x02700c, 0x02700d, input_port_2_word_r },
81 	{ 0x02700e, 0x02700f, watchdog_reset16_r },
82 	{ 0xff8000, 0xffafff, MRA16_RAM },
83 	{ 0xffe000, 0xffffff, MRA16_RAM },
84 MEMORY_END
85 
86 
87 static MEMORY_WRITE16_START( writemem )
88 	{ 0x000000, 0x00bfff, MWA16_ROM },
89 	{ 0x022000, 0x0220ff, MWA16_RAM, (data16_t **)&generic_nvram, &generic_nvram_size },
90 	{ 0x027008, 0x027009, aztarac_sound_w },
91 	{ 0xff8000, 0xffafff, MWA16_RAM, &aztarac_vectorram },
92 	{ 0xffb000, 0xffb001, aztarac_ubr_w },
93 	{ 0xffe000, 0xffffff, MWA16_RAM },
94 MEMORY_END
95 
96 
97 
98 /*************************************
99  *
100  *	Sound CPU memory handlers
101  *
102  *************************************/
103 
104 static MEMORY_READ_START( sound_readmem )
105 	{ 0x0000, 0x1fff, MRA_ROM },
106 	{ 0x8000, 0x87ff, MRA_RAM },
107 	{ 0x8800, 0x8800, aztarac_snd_command_r },
108 	{ 0x8c00, 0x8c01, AY8910_read_port_0_r },
109 	{ 0x8c02, 0x8c03, AY8910_read_port_1_r },
110 	{ 0x8c04, 0x8c05, AY8910_read_port_2_r },
111 	{ 0x8c06, 0x8c07, AY8910_read_port_3_r },
112 	{ 0x9000, 0x9000, aztarac_snd_status_r },
113 MEMORY_END
114 
115 
116 static MEMORY_WRITE_START( sound_writemem )
117 	{ 0x0000, 0x1fff, MWA_ROM },
118 	{ 0x8000, 0x87ff, MWA_RAM },
119 	{ 0x8c00, 0x8c00, AY8910_write_port_0_w },
120 	{ 0x8c01, 0x8c01, AY8910_control_port_0_w },
121 	{ 0x8c02, 0x8c02, AY8910_write_port_1_w },
122 	{ 0x8c03, 0x8c03, AY8910_control_port_1_w },
123 	{ 0x8c04, 0x8c04, AY8910_write_port_2_w },
124 	{ 0x8c05, 0x8c05, AY8910_control_port_2_w },
125 	{ 0x8c06, 0x8c06, AY8910_write_port_3_w },
126 	{ 0x8c07, 0x8c07, AY8910_control_port_3_w },
127 	{ 0x9000, 0x9000, aztarac_snd_status_w },
128 MEMORY_END
129 
130 
131 
132 /*************************************
133  *
134  *	Port definitions
135  *
136  *************************************/
137 
138 INPUT_PORTS_START( aztarac )
139 	PORT_START /* IN0 */
140 	PORT_ANALOG( 0x1f, 0xf, IPT_AD_STICK_Z | IPF_CENTER, 100, 1, 0, 0x1e )
141 
142 	PORT_START /* IN1 */
143 	PORT_ANALOG( 0x1f, 0xf, IPT_AD_STICK_Y | IPF_CENTER | IPF_REVERSE, 100, 1, 0, 0x1e )
144 
145 	PORT_START /* IN2 */
146 	PORT_ANALOGX( 0xff, 0x00, IPT_DIAL | IPF_REVERSE, 25, 10, 0, 0, KEYCODE_Z, KEYCODE_X, IP_JOY_NONE, IP_JOY_NONE )
147 
148 	PORT_START /* IN3 */
149 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
150 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
151 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
152 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
153 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
154 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
155 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
156 	PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
157 INPUT_PORTS_END
158 
159 
160 
161 /*************************************
162  *
163  *	Sound interfaces
164  *
165  *************************************/
166 
167 static struct AY8910interface ay8910_interface =
168 {
169 	4,	/* 4 chips */
170 	2000000,	/* 2 MHz */
171 	{ 15, 15, 15, 15 },
172 	{ 0, 0, 0, 0 },
173 	{ 0, 0, 0, 0 },
174 	{ 0, 0, 0, 0 },
175 	{ 0, 0, 0, 0 }
176 };
177 
178 
179 
180 /*************************************
181  *
182  *	Machine drivers
183  *
184  *************************************/
185 
186 static MACHINE_DRIVER_START( aztarac )
187 
188 	/* basic machine hardware */
189 	MDRV_CPU_ADD(M68000, 8000000)
190 	MDRV_CPU_MEMORY(readmem,writemem)
191 	MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
192 
193 	MDRV_CPU_ADD(Z80, 2000000)
194 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)
195 	MDRV_CPU_MEMORY(sound_readmem,sound_writemem)
196 	MDRV_CPU_PERIODIC_INT(aztarac_snd_timed_irq,100)
197 
198 	MDRV_FRAMES_PER_SECOND(40)
199 	MDRV_MACHINE_INIT(aztarac)
200 	MDRV_NVRAM_HANDLER(generic_1fill)
201 
202 	/* video hardware */
203 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_VECTOR | VIDEO_RGB_DIRECT)
204 	MDRV_SCREEN_SIZE(400, 300)
205 	MDRV_VISIBLE_AREA(0, 1024-1, 0, 768-1)
206 	MDRV_PALETTE_LENGTH(32768)
207 
208 	MDRV_VIDEO_START(aztarac)
209 	MDRV_VIDEO_UPDATE(vector)
210 
211 	/* sound hardware */
212 	MDRV_SOUND_ADD(AY8910, ay8910_interface)
213 MACHINE_DRIVER_END
214 
215 
216 
217 /*************************************
218  *
219  *	ROM definitions
220  *
221  *************************************/
222 
223 ROM_START( aztarac )
224 	ROM_REGION( 0xc000, REGION_CPU1, 0 )
225 	ROM_LOAD16_BYTE( "l8_6.bin", 0x000000, 0x001000, CRC(25f8da18) SHA1(e8179ba3683e39c8225b549ead74c8af2d0a0b3e) )
226 	ROM_LOAD16_BYTE( "n8_0.bin", 0x000001, 0x001000, CRC(04e20626) SHA1(2b6a04992037257830df2c01a6da748fb4449f79) )
227 	ROM_LOAD16_BYTE( "l7_7.bin", 0x002000, 0x001000, CRC(230e244c) SHA1(42283a368144acf2aad2ef390e312e0951c3ea64) )
228 	ROM_LOAD16_BYTE( "n7_1.bin", 0x002001, 0x001000, CRC(37b12697) SHA1(da288b077902e3205600a021c3fac5730f9fb832) )
229 	ROM_LOAD16_BYTE( "l6_8.bin", 0x004000, 0x001000, CRC(1293fb9d) SHA1(5a8d512372fd38f1a55f990f5c3eb51833c463d8) )
230 	ROM_LOAD16_BYTE( "n6_2.bin", 0x004001, 0x001000, CRC(712c206a) SHA1(eb29f161189c14d84896502940e3ab6cc3bd1cd0) )
231 	ROM_LOAD16_BYTE( "l5_9.bin", 0x006000, 0x001000, CRC(743a6501) SHA1(da83a8f756466bcd94d4b0cc28a1a1858e9532f3) )
232 	ROM_LOAD16_BYTE( "n5_3.bin", 0x006001, 0x001000, CRC(a65cbf99) SHA1(dd06f98c0989604bd4ac6317e545e1fcf6722e75) )
233 	ROM_LOAD16_BYTE( "l4_a.bin", 0x008000, 0x001000, CRC(9cf1b0a1) SHA1(dd644026f49d8430c0b4cf4c750dc33c013c19fc) )
234 	ROM_LOAD16_BYTE( "n4_4.bin", 0x008001, 0x001000, CRC(5f0080d5) SHA1(fb1303f9a02067faea2ac4d523051c416de9cf35) )
235 	ROM_LOAD16_BYTE( "l3_b.bin", 0x00a000, 0x001000, CRC(8cc7f7fa) SHA1(fefb9a4fdd63878bc5d8138e3e8456cb6638425a) )
236 	ROM_LOAD16_BYTE( "n3_5.bin", 0x00a001, 0x001000, CRC(40452376) SHA1(1d058b7ecd2bbff3393950aab9215b262908475b) )
237 
238 	ROM_REGION( 0x10000, REGION_CPU2, 0 )
239 	ROM_LOAD( "j4_c.bin", 0x0000, 0x1000, CRC(e897dfcd) SHA1(750df3d08512d8098a13ec62677831efa164c126) )
240 	ROM_LOAD( "j3_d.bin", 0x1000, 0x1000, CRC(4016de77) SHA1(7232ec003f1b9d3623d762f3270108a1d1837846) )
241 ROM_END
242 
243 
244 
245 /*************************************
246  *
247  *	Game drivers
248  *
249  *************************************/
250 
251 GAME( 1983, aztarac, 0, aztarac, aztarac, 0, ROT0, "Centuri", "Aztarac" )
252