1 /***************************************************************************
2 
3 	Atari Cloud 9 (prototype) hardware
4 
5 	driver by Mike Balfour
6 
7 	Games supported:
8 		* Cloud 9
9 
10 	Known issues:
11 		* none at this time
12 
13 ****************************************************************************
14 
15 	Cloud9 (prototype) driver.
16 
17 	This hardware is yet another variant of the Centipede/Millipede hardware,
18 	but as you can see there are some significant deviations...
19 
20 	0000			R/W 	X index into the bitmap
21 	0001			R/W 	Y index into the bitmap
22 	0002			R/W 	Current bitmap pixel value
23 	0003-05FF 	R/W 	RAM
24 	0600-3FFF 	R/W 	Bitmap RAM bank 0 (and bank 1 ?)
25 	5000-5073 	R/W 	Motion Object RAM
26 	5400			W		Watchdog
27 	5480			W		IRQ Acknowledge
28 	5500-557F 	W		Color RAM (9 bits, 4 banks, LSB of Blue is addr&$40)
29 
30 	5580			W		Auto-increment X bitmap index (~D7)
31 	5581			W		Auto-increment Y bitmap index (~D7)
32 	5584			W		VRAM Both Banks - (D7) seems to allow writing to both banks
33 	5585			W		Invert screen?
34 	5586			W		VRAM Bank select?
35 	5587			W		Color bank select
36 
37 	5600			W		Coin Counter 1 (D7)
38 	5601			W		Coin Counter 2 (D7)
39 	5602			W		Start1 LED (~D7)
40 	5603			W		Start2 LED (~D7)
41 
42 	5680			W		Force Write to EAROM?
43 	5700			W		EAROM Off?
44 	5780			W		EAROM On?
45 
46 	5800			R		IN0 (D7=Vblank, D6=Right Coin, D5=Left Coin, D4=Aux, D3=Self Test)
47 	5801			R		IN1 (D7=Start1, D6=Start2, D5=Fire, D4=Zap)
48 	5900			R		Trackball Vert
49 	5901			R		Trackball Horiz
50 
51 	5A00-5A0F 	R/W 	Pokey 1
52 	5B00-5B0F 	R/W 	Pokey 2
53 	5C00-5CFF 	W		EAROM
54 	6000-FFFF 	R		Program ROM
55 
56 	If you have any questions about how this driver works, don't hesitate to
57 	ask.  - Mike Balfour (mab22@po.cwru.edu)
58 
59 ***************************************************************************/
60 
61 #include "driver.h"
62 #include "vidhrdw/generic.h"
63 #include "cloud9.h"
64 
65 
66 /*************************************
67  *
68  *	Output ports
69  *
70  *************************************/
71 
WRITE_HANDLER(cloud9_led_w)72 static WRITE_HANDLER( cloud9_led_w )
73 {
74 	set_led_status(offset,~data & 0x80);
75 }
76 
77 
WRITE_HANDLER(cloud9_coin_counter_w)78 static WRITE_HANDLER( cloud9_coin_counter_w )
79 {
80 	coin_counter_w(offset,data);
81 }
82 
83 
84 
85 /*************************************
86  *
87  *	Main CPU memory handlers
88  *
89  *************************************/
90 
MEMORY_READ_START(readmem)91 static MEMORY_READ_START( readmem )
92 	{ 0x0000, 0x0002, cloud9_bitmap_regs_r },
93 	{ 0x0003, 0x05ff, MRA_RAM },
94 	{ 0x0600, 0x3fff, MRA_RAM },
95 	{ 0x5500, 0x557f, MRA_RAM },
96 	{ 0x5800, 0x5800, input_port_0_r },
97 	{ 0x5801, 0x5801, input_port_1_r },
98 	{ 0x5900, 0x5900, input_port_2_r },
99 	{ 0x5901, 0x5901, input_port_3_r },
100 	{ 0x5a00, 0x5a0f, pokey1_r },
101 	{ 0x5b00, 0x5b0f, pokey2_r },
102 	{ 0x5c00, 0x5cff, MRA_RAM },	/* EAROM */
103 	{ 0x6000, 0xffff, MRA_ROM },
104 MEMORY_END
105 
106 
107 static MEMORY_WRITE_START( writemem )
108 	{ 0x0000, 0x0002, cloud9_bitmap_regs_w, &cloud9_bitmap_regs },
109 	{ 0x0003, 0x05ff, MWA_RAM },
110 	{ 0x0600, 0x3fff, cloud9_bitmap_w, &videoram, &videoram_size },
111 	{ 0x5000, 0x50ff, MWA_RAM, &spriteram },
112 	{ 0x5400, 0x5400, watchdog_reset_w },
113 	{ 0x5480, 0x5480, MWA_NOP },	/* IRQ Ack */
114 	{ 0x5500, 0x557f, cloud9_paletteram_w, &paletteram },
115 	{ 0x5580, 0x5580, MWA_RAM, &cloud9_auto_inc_x },
116 	{ 0x5581, 0x5581, MWA_RAM, &cloud9_auto_inc_y },
117 	{ 0x5584, 0x5584, MWA_RAM, &cloud9_both_banks },
118 	{ 0x5586, 0x5586, MWA_RAM, &cloud9_vram_bank },
119 	{ 0x5587, 0x5587, MWA_RAM, &cloud9_color_bank },
120 	{ 0x5600, 0x5601, cloud9_coin_counter_w },
121 	{ 0x5602, 0x5603, cloud9_led_w },
122 	{ 0x5a00, 0x5a0f, pokey1_w },
123 	{ 0x5b00, 0x5b0f, pokey2_w },
124 	{ 0x5c00, 0x5cff, MWA_RAM, &generic_nvram, &generic_nvram_size },
125 	{ 0x6000, 0xffff, MWA_ROM },
126 MEMORY_END
127 
128 
129 
130 /*************************************
131  *
132  *	Port definitions
133  *
134  *************************************/
135 
136 INPUT_PORTS_START( cloud9 )
137 	PORT_START	/* IN0 */
138 	PORT_BIT ( 0x07, IP_ACTIVE_LOW, IPT_UNKNOWN )
139 	PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
140 	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )
141 	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
142 	PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
143 	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
144 
145 	PORT_START		/* IN1 */
146 	PORT_BIT ( 0x0F, IP_ACTIVE_LOW, IPT_UNKNOWN )
147 	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
148 	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
149 	PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_START2 )
150 	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_START1 )
151 
152 	PORT_START		/* IN2 */
153 	PORT_ANALOG( 0xff, 0x7f, IPT_TRACKBALL_Y | IPF_REVERSE, 30, 30, 0, 0 )
154 
155 	PORT_START		/* IN3 */
156 	PORT_ANALOG( 0xff, 0x7f, IPT_TRACKBALL_X, 30, 30, 0, 0 )
157 
158 	PORT_START	/* IN4 */ /* DSW1 */
159 	PORT_BIT ( 0xFF, IP_ACTIVE_HIGH, IPT_UNKNOWN )
160 
161 	PORT_START	/* IN5 */ /* DSW2 */
162 	PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
163 	PORT_DIPNAME( 0x06, 0x04, DEF_STR( Coinage ) )
164 	PORT_DIPSETTING (	0x06, DEF_STR( 2C_1C ) )
165 	PORT_DIPSETTING (	0x04, DEF_STR( 1C_1C ) )
166 	PORT_DIPSETTING (	0x02, DEF_STR( 1C_2C ) )
167 	PORT_DIPSETTING (	0x00, DEF_STR( Free_Play ) )
168 	PORT_DIPNAME(0x18,	0x00, "Right Coin" )
169 	PORT_DIPSETTING (	0x00, "*1" )
170 	PORT_DIPSETTING (	0x08, "*4" )
171 	PORT_DIPSETTING (	0x10, "*5" )
172 	PORT_DIPSETTING (	0x18, "*6" )
173 	PORT_DIPNAME(0x20,	0x00, "Middle Coin" )
174 	PORT_DIPSETTING (	0x00, "*1" )
175 	PORT_DIPSETTING (	0x20, "*2" )
176 	PORT_DIPNAME(0xC0,	0x00, "Bonus Coins" )
177 	PORT_DIPSETTING (	0xC0, "4 coins + 2 coins" )
178 	PORT_DIPSETTING (	0x80, "4 coins + 1 coin" )
179 	PORT_DIPSETTING (	0x40, "2 coins + 1 coin" )
180 	PORT_DIPSETTING (	0x00, "None" )
181 INPUT_PORTS_END
182 
183 
184 
185 /*************************************
186  *
187  *	Graphics definitions
188  *
189  *************************************/
190 
191 static struct GfxLayout charlayout =
192 {
193 	8,8,
194 	128,
195 	4,
196 	{ 0x3000*8, 0x2000*8, 0x1000*8, 0 },
197 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
198 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
199 	16*8
200 };
201 
202 
203 static struct GfxLayout spritelayout =
204 {
205 	16,16,
206 	64,
207 	4,
208 	{ 0x3000*8, 0x2000*8, 0x1000*8, 0x0000*8 },
209 	{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
210 	{ 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8,
211 			16*8, 18*8, 20*8, 22*8, 24*8, 26*8, 28*8, 30*8 },
212 	32*8
213 };
214 
215 
216 static struct GfxDecodeInfo gfxdecodeinfo[] =
217 {
218 	{ REGION_GFX1, 0x0800, &charlayout,   0, 4 },
219 	{ REGION_GFX1, 0x0808, &charlayout,   0, 4 },
220 	{ REGION_GFX1, 0x0000, &spritelayout, 0, 4 },
221 	{ -1 }
222 };
223 
224 
225 
226 /*************************************
227  *
228  *	Sound interfaces
229  *
230  *************************************/
231 
232 static struct POKEYinterface pokey_interface =
233 {
234 	2,	/* 2 chips */
235 	1500000,	/* 1.5 MHz??? */
236 	{ 50, 50 },
237 	/* The 8 pot handlers */
238 	{ 0, 0 },
239 	{ 0, 0 },
240 	{ 0, 0 },
241 	{ 0, 0 },
242 	{ 0, 0 },
243 	{ 0, 0 },
244 	{ 0, 0 },
245 	{ 0, 0 },
246 	/* The allpot handler */
247 	{ input_port_4_r, input_port_5_r },
248 };
249 
250 
251 
252 /*************************************
253  *
254  *	Machine driver
255  *
256  *************************************/
257 
258 static MACHINE_DRIVER_START( cloud9 )
259 
260 	/* basic machine hardware */
261 	MDRV_CPU_ADD(M6502,12096000/8)	/* 1.512 MHz?? */
262 	MDRV_CPU_MEMORY(readmem,writemem)
263 	MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
264 
265 	MDRV_FRAMES_PER_SECOND(60)
266 	MDRV_VBLANK_DURATION(1460)
267 
268 	MDRV_NVRAM_HANDLER(generic_0fill)
269 
270 	/* video hardware */
271 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
272 	MDRV_SCREEN_SIZE(32*8, 32*8)
273 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 2*8, 32*8-1)
274 	MDRV_GFXDECODE(gfxdecodeinfo)
275 	MDRV_PALETTE_LENGTH(64)
276 
277 	MDRV_VIDEO_START(cloud9)
278 	MDRV_VIDEO_UPDATE(cloud9)
279 
280 	/* sound hardware */
281 	MDRV_SOUND_ADD(POKEY, pokey_interface)
282 MACHINE_DRIVER_END
283 
284 /*************************************
285  *
286  *	ROM definitions
287  *
288  *************************************/
289 
290 ROM_START( cloud9 )
291 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
292 	ROM_LOAD( "c9_6000.bin", 0x6000, 0x2000, CRC(b5d95d98) SHA1(9a347e5fc6e9e753e5c6972341725b5f4412e451) )
293 	ROM_LOAD( "c9_8000.bin", 0x8000, 0x2000, CRC(49af8f22) SHA1(c118372bec0c428c2b60d29df95f358b302d5e66) )
294 	ROM_LOAD( "c9_a000.bin", 0xa000, 0x2000, CRC(7cf404a6) SHA1(d20b662102f8426af51b1ca4ed8e18b00d711365) )
295 	ROM_LOAD( "c9_c000.bin", 0xc000, 0x2000, CRC(26a4d7df) SHA1(8eef0a5f5d1ff13eec75d0c50f5a5dea28486ae5) )
296 	ROM_LOAD( "c9_e000.bin", 0xe000, 0x2000, CRC(6e663bce) SHA1(4f4a5dc57ba6bc38a17973a6644849f6f5a2dfd1) )
297 
298 	ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
299 	ROM_LOAD( "c9_gfx0.bin", 0x0000, 0x1000, CRC(d01a8019) SHA1(a77d6125b116ab4bf9446e3b99469dad2719f7e5) )
300 	ROM_LOAD( "c9_gfx1.bin", 0x1000, 0x1000, CRC(514ac009) SHA1(f05081d8da47e650b0bd12cd00460c98a4f745b1) )
301 	ROM_LOAD( "c9_gfx2.bin", 0x2000, 0x1000, CRC(930c1ade) SHA1(ba22cb7b105da2ab8c40574e70f18d594d833452) )
302 	ROM_LOAD( "c9_gfx3.bin", 0x3000, 0x1000, CRC(27e9b88d) SHA1(a1d27e62eea9cdff662a3c160f650bbdb32b7f47) )
303 ROM_END
304 
305 
306 
307 /*************************************
308  *
309  *	Game drivers
310  *
311  *************************************/
312 
313 GAMEX( 1983, cloud9, 0, cloud9, cloud9, 0, ROT0, "Atari", "Cloud 9 (prototype)", GAME_NO_COCKTAIL )
314