1 /***************************************************************************
2 
3 	Atari I, Robot hardware
4 
5 	Games supported:
6 		* I, Robot
7 
8 	Known issues:
9 		* none at this time
10 
11 ****************************************************************************
12 
13 	I-Robot Memory Map
14 
15 	0000 - 07FF  R/W    RAM
16 	0800 - 0FFF  R/W    Banked RAM
17 	1000 - 1000  INRD1  Bit 7 = Right Coin
18 	                    Bit 6 = Left Coin
19 	                    Bit 5 = Aux Coin
20 	                    Bit 4 = Self Test
21 	                    Bit 3 = ?
22 	                    Bit 2 = ?
23 	                    Bit 1 = ?
24 	                    Bit 0 = ?
25 	1040 - 1040  INRD2  Bit 7 = Start 1
26 	                    Bit 6 = Start 2
27 	                    Bit 5 = ?
28 	                    Bit 4 = Fire
29 	                    Bit 3 = ?
30 	                    Bit 2 = ?
31 	                    Bit 1 = ?
32 	                    Bit 0 = ?
33 	1080 - 1080  STATRD Bit 7 = VBLANK
34 	                    Bit 6 = Polygon generator done
35 	                    Bit 5 = Mathbox done
36 	                    Bit 4 = Unused
37 	                    Bit 3 = ?
38 	                    Bit 2 = ?
39 	                    Bit 1 = ?
40 	                    Bit 0 = ?
41 	10C0 - 10C0  INRD3  Dip switch
42 	1140 - 1140  STATWR Bit 7 = Select Polygon RAM banks
43 	                    Bit 6 = BFCALL
44 	                    Bit 5 = Cocktail Flip
45 	                    Bit 4 = Start Mathbox
46 	                    Bit 3 = Connect processor bus to mathbox bus
47 	                    Bit 2 = Start polygon generator
48 	                    Bit 1 = Select polygon image RAM bank
49 	                    Bit 0 = Erase polygon image memory
50 	1180 - 1180  OUT0   Bit 7 = Alpha Map 1
51 	                    Bit 6,5 = RAM bank select
52 	                    Bit 4,3 = Mathbox memory select
53 	                    Bit 2,1 = Mathbox bank select
54 	11C0 - 11C0  OUT1   Bit 7 = Coin Counter R
55 	                    Bit 6 = Coin Counter L
56 	                    Bit 5 = LED2
57 	                    Bit 4 = LED1
58 	                    Bit 3,2,1 = ROM bank select
59 	1200 - 12FF  R/W    NVRAM (bits 0..3 only)
60 	1300 - 13FF  W      Select analog controller
61 	1300 - 13FF  R      Read analog controller
62 	1400 - 143F  R/W    Quad Pokey
63 	1800 - 18FF         Palette RAM
64 	1900 - 1900  W      Watchdog reset
65 	1A00 - 1A00  W      FIREQ Enable
66 	1B00 - 1BFF  W      Start analog controller ADC
67 	1C00 - 1FFF  R/W    Character RAM
68 	2000 - 3FFF  R/W    Mathbox/Vector Gen Shared RAM
69 	4000 - 5FFF  R      Banked ROM
70 	6000 - FFFF  R      Fixed ROM
71 
72 	Notes:
73 	- There is no flip screen nor cocktail mode in the original game
74 
75 ****************************************************************************/
76 
77 #include "driver.h"
78 #include "vidhrdw/generic.h"
79 #include "cpu/m6809/m6809.h"
80 #include "irobot.h"
81 
82 
83 
84 /*************************************
85  *
86  *	NVRAM handler
87  *
88  *************************************/
89 
WRITE_HANDLER(irobot_nvram_w)90 WRITE_HANDLER( irobot_nvram_w )
91 {
92 	generic_nvram[offset] = data & 0x0f;
93 }
94 
95 
96 
97 /*************************************
98  *
99  *	IRQ acknowledgement
100  *
101  *************************************/
102 
WRITE_HANDLER(irobot_clearirq_w)103 static WRITE_HANDLER( irobot_clearirq_w )
104 {
105     cpu_set_irq_line(0, M6809_IRQ_LINE ,CLEAR_LINE);
106 }
107 
108 
WRITE_HANDLER(irobot_clearfirq_w)109 static WRITE_HANDLER( irobot_clearfirq_w )
110 {
111     cpu_set_irq_line(0, M6809_FIRQ_LINE ,CLEAR_LINE);
112 }
113 
114 
115 
116 /*************************************
117  *
118  *	Main CPU memory handlers
119  *
120  *************************************/
121 
MEMORY_READ_START(readmem)122 static MEMORY_READ_START( readmem )
123     { 0x0000, 0x07ff, MRA_RAM },
124     { 0x0800, 0x0fff, MRA_BANK2 },
125     { 0x1000, 0x103f, input_port_0_r },
126     { 0x1040, 0x1040, input_port_1_r },
127     { 0x1080, 0x1080, irobot_status_r },
128     { 0x10c0, 0x10c0, input_port_3_r },
129     { 0x1200, 0x12ff, MRA_RAM },
130     { 0x1300, 0x13ff, irobot_control_r },
131     { 0x1400, 0x143f, quad_pokey_r },
132     { 0x1c00, 0x1fff, MRA_RAM },
133     { 0x2000, 0x3fff, irobot_sharedmem_r },
134     { 0x4000, 0x5fff, MRA_BANK1 },
135     { 0x6000, 0xffff, MRA_ROM },
136 MEMORY_END
137 
138 
139 static MEMORY_WRITE_START( writemem )
140     { 0x0000, 0x07ff, MWA_RAM },
141     { 0x0800, 0x0fff, MWA_BANK2 },
142     { 0x1100, 0x1100, irobot_clearirq_w },
143     { 0x1140, 0x1140, irobot_statwr_w },
144     { 0x1180, 0x1180, irobot_out0_w },
145     { 0x11c0, 0x11c0, irobot_rom_banksel_w },
146     { 0x1200, 0x12ff, irobot_nvram_w, &generic_nvram, &generic_nvram_size },
147     { 0x1400, 0x143f, quad_pokey_w },
148     { 0x1800, 0x18ff, irobot_paletteram_w },
149     { 0x1900, 0x19ff, MWA_RAM },            /* Watchdog reset */
150     { 0x1a00, 0x1a00, irobot_clearfirq_w },
151     { 0x1b00, 0x1bff, irobot_control_w },
152     { 0x1c00, 0x1fff, MWA_RAM, &videoram, &videoram_size },
153     { 0x2000, 0x3fff, irobot_sharedmem_w},
154     { 0x4000, 0xffff, MWA_ROM },
155 MEMORY_END
156 
157 
158 
159 /*************************************
160  *
161  *	Port definitions
162  *
163  *************************************/
164 
165 INPUT_PORTS_START( irobot )
166 	PORT_START	/* IN0 */
167     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
168     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
169     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
170     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
171     PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
172     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
173     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
174     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
175 
176 	PORT_START	/* IN1 */
177     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
178     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
179     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
180     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
181     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
182     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
183     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
184     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
185 
186 	PORT_START	/* IN2 */
187     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
188     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
189     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
190     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
191     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
192     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* MB DONE */
193     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* EXT DONE */
194     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
195 
196 	PORT_START /* DSW1 */
197 	PORT_DIPNAME(    0x03, 0x00, "Coins Per Credit" )
198 	PORT_DIPSETTING( 0x00, "1 Coin 1 Credit" )
199 	PORT_DIPSETTING( 0x01, "2 Coins 1 Credit" )
200 	PORT_DIPSETTING( 0x02, "3 Coins 1 Credit" )
201 	PORT_DIPSETTING( 0x03, "4 Coins 1 Credit" )
202 	PORT_DIPNAME(    0x0c, 0x00, "Right Coin" )
203 	PORT_DIPSETTING( 0x00, "1 Coin for 1 Coin Unit" )
204 	PORT_DIPSETTING( 0x04, "1 Coin for 4 Coin Units" )
205 	PORT_DIPSETTING( 0x08, "1 Coin for 5 Coin Units" )
206 	PORT_DIPSETTING( 0x0c, "1 Coin for 6 Coin Units" )
207 	PORT_DIPNAME(    0x10, 0x00, "Left Coin" )
208 	PORT_DIPSETTING( 0x00, "1 Coin for 1 Coin Unit" )
209 	PORT_DIPSETTING( 0x10, "1 Coin for 2 Coin Units" )
210 	PORT_DIPNAME(    0xe0, 0x00, "Bonus Adder" )
211 	PORT_DIPSETTING( 0x00, "None" )
212 	PORT_DIPSETTING( 0x20, "1 Credit for 2 Coin Units" )
213 	PORT_DIPSETTING( 0xa0, "1 Credit for 3 Coin Units" )
214 	PORT_DIPSETTING( 0x40, "1 Credit for 4 Coin Units" )
215 	PORT_DIPSETTING( 0x80, "1 Credit for 5 Coin Units" )
216 	PORT_DIPSETTING( 0x60, "2 Credits for 4 Coin Units" )
217 	PORT_DIPSETTING( 0xe0, DEF_STR( Free_Play ) )
218 
219 	PORT_START /* DSW2 */
220 	PORT_DIPNAME(    0x01, 0x01, "Language" )
221 	PORT_DIPSETTING( 0x01, "English" )
222 	PORT_DIPSETTING( 0x00, "German" )
223 	PORT_DIPNAME(    0x02, 0x02, "Min Game Time" )
224 	PORT_DIPSETTING( 0x00, "90 Sec" )
225 	PORT_DIPSETTING( 0x02, "3 Lives" )
226 	PORT_DIPNAME(    0x0c, 0x0c, DEF_STR( Bonus_Life ) )
227 	PORT_DIPSETTING( 0x08, "None" )
228 	PORT_DIPSETTING( 0x0c, "20000" )
229 	PORT_DIPSETTING( 0x00, "30000" )
230 	PORT_DIPSETTING( 0x04, "50000" )
231 	PORT_DIPNAME(    0x30, 0x30, DEF_STR( Lives ) )
232 	PORT_DIPSETTING( 0x20, "2" )
233 	PORT_DIPSETTING( 0x30, "3" )
234 	PORT_DIPSETTING( 0x00, "4" )
235 	PORT_DIPSETTING( 0x10, "5" )
236 	PORT_DIPNAME(    0x40, 0x40, DEF_STR( Difficulty ) )
237 	PORT_DIPSETTING( 0x00, "Easy" )
238 	PORT_DIPSETTING( 0x40, "Medium" )
239 	PORT_DIPNAME(    0x80, 0x80, "Demo Mode" )
240 	PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
241 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
242 
243 	PORT_START	/* IN4 */
244 	PORT_ANALOG( 0xff, 0x80, IPT_AD_STICK_Y | IPF_CENTER, 70, 50, 95, 159 )
245 
246 	PORT_START	/* IN5 */
247 	PORT_ANALOG( 0xff, 0x80, IPT_AD_STICK_X | IPF_REVERSE | IPF_CENTER, 50, 50, 95, 159 )
248 
249 INPUT_PORTS_END
250 
251 
252 
253 /*************************************
254  *
255  *	Graphics definitions
256  *
257  *************************************/
258 
259 static struct GfxLayout charlayout =
260 {
261 	8,8,
262     64,
263     1,
264     { 0 },
265     { 4, 5, 6, 7, 12, 13, 14, 15},
266     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16},
267     16*8
268 };
269 
270 
271 static struct GfxDecodeInfo gfxdecodeinfo[] =
272 {
273     { REGION_GFX1, 0, &charlayout, 64, 16 },
274 	{ -1 }
275 };
276 
277 
278 
279 /*************************************
280  *
281  *	Sound interfaces
282  *
283  *************************************/
284 
285 static struct POKEYinterface pokey_interface =
286 {
287 	4,	/* 4 chips */
288 	1250000,	/* 1.25 MHz??? */
289 	{ 25, 25, 25, 25 },
290 	/* The 8 pot handlers */
291 	{ 0, 0, 0, 0 },
292 	{ 0, 0, 0, 0 },
293 	{ 0, 0, 0, 0 },
294 	{ 0, 0, 0, 0 },
295 	{ 0, 0, 0, 0 },
296 	{ 0, 0, 0, 0 },
297 	{ 0, 0, 0, 0 },
298 	{ 0, 0, 0, 0 },
299 	/* The allpot handler */
300     { input_port_4_r, 0, 0, 0 },
301 };
302 
303 
304 
305 /*************************************
306  *
307  *	Machine driver
308  *
309  *************************************/
310 
311 static MACHINE_DRIVER_START( irobot )
312 
313 	/* basic machine hardware */
314 	MDRV_CPU_ADD(M6809,1500000)
315 	MDRV_CPU_MEMORY(readmem,writemem)
316 
317 	MDRV_FRAMES_PER_SECOND(60)
318 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
319 
320 	MDRV_MACHINE_INIT(irobot)
321 	MDRV_NVRAM_HANDLER(generic_0fill)
322 
323 	/* video hardware */
324 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
325 	MDRV_SCREEN_SIZE(32*8, 32*8)
326 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 0*8, 29*8-1)
327 	MDRV_GFXDECODE(gfxdecodeinfo)
328 	MDRV_PALETTE_LENGTH(64 + 32)
329 	MDRV_COLORTABLE_LENGTH(64 + 32)	/* 64 for polygons, 32 for text */
330 
331 	MDRV_PALETTE_INIT(irobot)
332 	MDRV_VIDEO_START(irobot)
333 	MDRV_VIDEO_UPDATE(irobot)
334 
335 	/* sound hardware */
336 	MDRV_SOUND_ADD(POKEY, pokey_interface)
337 MACHINE_DRIVER_END
338 
339 
340 
341 /*************************************
342  *
343  *	ROM definitions
344  *
345  *************************************/
346 
347 ROM_START( irobot )
348 	ROM_REGION( 0x20000, REGION_CPU1, 0 ) /* 64k for code + 48K Banked ROM*/
349 	ROM_LOAD( "136029.208",     0x06000, 0x2000, CRC(b4d0be59) SHA1(5b476dbee8b171a96301b2204420161333d4ca97) )
350 	ROM_LOAD( "136029.209",     0x08000, 0x4000, CRC(f6be3cd0) SHA1(a88ae0cc9ee22aa5dd3db0173f24313189f894f8) )
351 	ROM_LOAD( "136029.210",     0x0c000, 0x4000, CRC(c0eb2133) SHA1(daa77293678b7e822d0672b90789c53098c5451e) )
352 	ROM_LOAD( "136029.405",     0x10000, 0x4000, CRC(9163efe4) SHA1(5d71d8ec80c9be4726189d48ad519b4638160d64) )
353 	ROM_LOAD( "136029.206",     0x14000, 0x4000, CRC(e114a526) SHA1(bd94ad4d536f681efa81153050a12098a31d79cf) )
354 	ROM_LOAD( "136029.207",     0x18000, 0x4000, CRC(b4556cb0) SHA1(2e0c1e4c265e7d232ca86d5c8760e32fc49fe08d) )
355 
356 	ROM_REGION16_BE( 0x10000, REGION_CPU2, 0 )  /* mathbox region */
357 	ROM_LOAD16_BYTE( "ir104.bin", 0x0000,  0x2000, CRC(0a6cdcca) SHA1(b9fd76eae8ca24fa3abc30c46bbf30d89943d97d) )
358 	ROM_LOAD16_BYTE( "ir103.bin", 0x0001,  0x2000, CRC(0c83296d) SHA1(c1f4041a58f395e24855254849604dfe3b8b0d71) )	/* ROM data from 0000-bfff */
359 	ROM_LOAD16_BYTE( "ir102.bin", 0x4000,  0x4000, CRC(9d588f22) SHA1(787ec3e642e1dc3417477348afa88c764e1f2a88) )
360 	ROM_LOAD16_BYTE( "ir101.bin", 0x4001,  0x4000, CRC(62a38c08) SHA1(868bb3fe5657a4ce45c3dd04ba26a7fb5a5ded42) )
361 	/* RAM data from c000-dfff */
362 	/* COMRAM from   e000-ffff */
363 
364 	ROM_REGION( 0x800, REGION_GFX1, ROMREGION_DISPOSE )
365 	ROM_LOAD( "136029.124",     0x0000,  0x0800, CRC(848948b6) SHA1(743c6570c787bc9a2a14716adc66b8e2fe57129f) )
366 
367 	ROM_REGION( 0x3420, REGION_PROMS, 0 )
368 	ROM_LOAD( "ir125.bin",      0x0000,  0x0020, CRC(446335ba) SHA1(5b42cc065bfac467028ae883844c8f94465c3666) )
369 	ROM_LOAD( "ir111.bin",      0x0020,  0x0400, CRC(9fbc9bf3) SHA1(33dee2382e1e3899ffbaea859a67af7334270b4a) )	/* program ROMs from c000-f3ff */
370 	ROM_LOAD( "ir112.bin",      0x0420,  0x0400, CRC(b2713214) SHA1(4e1ea039e7a3e341796097b0c6943a4805b89f56) )
371 	ROM_LOAD( "ir113.bin",      0x0820,  0x0400, CRC(7875930a) SHA1(63a3818450a76d230a75f038b140c3934659313e) )
372 	ROM_LOAD( "ir114.bin",      0x0c20,  0x0400, CRC(51d29666) SHA1(34887df0f1ac064b4cf4252a225406e8b30872c6) )
373 	ROM_LOAD( "ir115.bin",      0x1020,  0x0400, CRC(00f9b304) SHA1(46b4495002ddf80668a66a4f85cab99432677b50) )
374 	ROM_LOAD( "ir116.bin",      0x1420,  0x0400, CRC(326aba54) SHA1(e4caab90910b3aa16c314909f8c02eaf212449a1) )
375 	ROM_LOAD( "ir117.bin",      0x1820,  0x0400, CRC(98efe8d0) SHA1(39532fc1b14714396764500a9b1c9e4fed97a970) )
376 	ROM_LOAD( "ir118.bin",      0x1c20,  0x0400, CRC(4a6aa7f9) SHA1(163e8e764b400d726c725b6a45901c311e62667e) )
377 	ROM_LOAD( "ir119.bin",      0x2020,  0x0400, CRC(a5a13ad8) SHA1(964a87c879c953563ca84f8e3c1201302c7b2b91) )
378 	ROM_LOAD( "ir120.bin",      0x2420,  0x0400, CRC(2a083465) SHA1(35ca23d5bbdc2827afb823a974864b96eb135797) )
379 	ROM_LOAD( "ir121.bin",      0x2820,  0x0400, CRC(adebcb99) SHA1(4628f8af43d82e578833b1452ec747eeb822b4e4) )
380 	ROM_LOAD( "ir122.bin",      0x2c20,  0x0400, CRC(da7b6f79) SHA1(02398ba6e7c56d961bf92e2755e530db1144219d) )
381 	ROM_LOAD( "ir123.bin",      0x3020,  0x0400, CRC(39fff18f) SHA1(85f338eeff7d8ed58804611bf8446ebb697d196d) )
382 ROM_END
383 
384 	/*  Colorprom from John's driver. ? */
385 	/*  ROM_LOAD( "136029.125",    0x0000, 0x0020, CRC(c05abf82) ) */
386 
387 
388 
389 /*************************************
390  *
391  *	Game drivers
392  *
393  *************************************/
394 
395 GAME( 1983, irobot, 0, irobot, irobot, irobot, ROT0, "Atari", "I, Robot" )
396