1 /****************************************************************************
2 
3 Ace by Allied Leisure
4 
5 Driver by Jarek Burczynski
6 2002.09.19
7 
8 
9 
10 Allied Leisure 1976
11 "MAJOR MFG. INC. SUNNYVALE, CA" in PCB etch
12 
13 18MHz
14                                                           5MHz
15 
16 8080
17 
18 
19 2101
20 2101
21 
22 
23 A5               3106          3106         3106
24 A4
25 A3                                                      3622.K4
26 A2                                   2101
27 A1                   2101            2101
28 
29                                                          [ RANGE ] [ TIME ]
30                                                         (two 0-9 thumbwheel switches)
31 
32 
33 5x2101 - SRAM 256x4
34 3x3106 - SRAM 256x1
35 1x3622 - ROM 512x4
36 
37 
38 ****************************************************************************/
39 
40 #include "driver.h"
41 
42 
43 static unsigned char *ace_scoreram;
44 static unsigned char *ace_ram2;
45 static unsigned char *ace_characterram;
46 
47 
48 static int objpos[8];
49 
WRITE_HANDLER(ace_objpos_w)50 static WRITE_HANDLER( ace_objpos_w )
51 {
52 	objpos[offset]=data;
53 }
54 
55 #if 0
56 static READ_HANDLER( ace_objpos_r )
57 {
58 	return objpos[offset];
59 }
60 #endif
61 
VIDEO_UPDATE(ace)62 VIDEO_UPDATE( ace )
63 {
64 	int offs;
65 
66 	decodechar(Machine->gfx[1], 0, ace_characterram, Machine->drv->gfxdecodeinfo[1].gfxlayout);
67 	decodechar(Machine->gfx[2], 0, ace_characterram, Machine->drv->gfxdecodeinfo[2].gfxlayout);
68 	decodechar(Machine->gfx[3], 0, ace_characterram, Machine->drv->gfxdecodeinfo[3].gfxlayout);
69 
70 	for (offs = 0; offs < 8; offs++)
71 	{
72 		decodechar(Machine->gfx[4], offs, ace_scoreram, Machine->drv->gfxdecodeinfo[4].gfxlayout);
73 	}
74 
75 	/* first of all, fill the screen with the background color */
76 	fillbitmap(bitmap, Machine->pens[0], &Machine->visible_area);
77 
78 
79 		drawgfx(bitmap,Machine->gfx[1],
80 				0,
81 				0,
82 				0,0,
83 				objpos[0],objpos[1],
84 				&Machine->visible_area,TRANSPARENCY_NONE,0);
85 
86 		drawgfx(bitmap,Machine->gfx[2],
87 				0,
88 				0,
89 				0,0,
90 				objpos[2],objpos[3],
91 				&Machine->visible_area,TRANSPARENCY_NONE,0);
92 
93 		drawgfx(bitmap,Machine->gfx[3],
94 				0,
95 				0,
96 				0,0,
97 				objpos[4],objpos[5],
98 				&Machine->visible_area,TRANSPARENCY_NONE,0);
99 
100 	for (offs = 0; offs < 8; offs++)
101 	{
102 		drawgfx(bitmap,Machine->gfx[4],
103 				offs,
104 				0,
105 				0,0,
106 				10*8+offs*16,256-16, /* ?? */
107 				&Machine->visible_area,TRANSPARENCY_NONE,0);
108 	}
109 }
110 
111 
PALETTE_INIT(ace)112 static PALETTE_INIT( ace )
113 {
114 	palette_set_color(0,0x10,0x20,0xd0); /* light bluish */
115 	palette_set_color(1,0xff,0xff,0xff); /* white */
116 }
117 
118 
READ_HANDLER(ace_characterram_r)119 static READ_HANDLER( ace_characterram_r )
120 {
121 	return ace_characterram[offset];
122 }
123 
WRITE_HANDLER(ace_characterram_w)124 static WRITE_HANDLER( ace_characterram_w )
125 {
126 	if (ace_characterram[offset] != data)
127 	{
128 		if (data&(~0x07))
129 		{
130 			logerror("write to %04x data=%02x\n", 0x8000+offset, data);
131 			usrintf_showmessage("write to %04x data=%02x\n", 0x8000+offset, data);
132 		}
133 		ace_characterram[offset] = data;
134 	}
135 }
136 
137 
READ_HANDLER(unk_r)138 static READ_HANDLER( unk_r )
139 {
140 	return rand()&0xff;
141 }
142 
143 
MEMORY_READ_START(readmem)144 static MEMORY_READ_START( readmem )
145 
146 	{ 0x0000, 0x09ff, MRA_ROM },
147 
148 	{ 0x2000, 0x20ff, MRA_RAM },
149 	{ 0x8300, 0x83ff, MRA_RAM },
150 	{ 0x8000, 0x80ff, ace_characterram_r },
151 
152 	/* players inputs */
153 	{ 0xc008, 0xc008, input_port_0_r },
154 	{ 0xc009, 0xc009, input_port_1_r },
155 	{ 0xc00a, 0xc00a, input_port_2_r },
156 	{ 0xc00b, 0xc00b, input_port_3_r },
157 	{ 0xc00c, 0xc00c, input_port_4_r },
158 	{ 0xc00d, 0xc00d, input_port_5_r },
159 	{ 0xc00e, 0xc00e, input_port_6_r },
160 	{ 0xc00f, 0xc00f, input_port_7_r },
161 	{ 0xc010, 0xc010, input_port_8_r },
162 	{ 0xc011, 0xc011, input_port_9_r },
163 
164 	{ 0xc012, 0xc012, unk_r },
165 
166 	/* vblank */
167 	{ 0xc014, 0xc014, input_port_10_r },
168 
169 	/* coin */
170 	{ 0xc015, 0xc015, input_port_11_r },
171 
172 	/* start (must read 1 at least once to make the game run) */
173 	{ 0xc016, 0xc016, input_port_12_r },
174 
175 	{ 0xc017, 0xc017, unk_r },
176 	{ 0xc018, 0xc018, unk_r },
177 	{ 0xc019, 0xc019, unk_r },
178 
179 	{ 0xc020, 0xc020, unk_r },
180 	{ 0xc021, 0xc021, unk_r },
181 	{ 0xc022, 0xc022, unk_r },
182 	{ 0xc023, 0xc023, unk_r },
183 	{ 0xc024, 0xc024, unk_r },
184 	{ 0xc025, 0xc025, unk_r },
185 	{ 0xc026, 0xc026, unk_r },
186 
187 MEMORY_END
188 
189 /* 5x2101 - SRAM 256x4 */
190 /* 3x3106 - SRAM 256x1 */
191 /* 1x3622 - ROM 512x4  - doesn't seem to be used ????????????*/
192 
193 static MEMORY_WRITE_START( writemem )
194 	{ 0x0000, 0x09ff, MWA_ROM },
195 
196 	{ 0x2000, 0x20ff, MWA_RAM, &ace_scoreram },	/* 2x2101 */
197 	{ 0x8300, 0x83ff, MWA_RAM, &ace_ram2 },		/* 2x2101 */
198 	{ 0x8000, 0x80ff, ace_characterram_w, &ace_characterram },	/* 3x3101 (3bits: 0, 1, 2) */
199 
200 	{ 0xc000, 0xc005, ace_objpos_w },
201 MEMORY_END
202 
203 
204 INPUT_PORTS_START( ace )
205 
206 	PORT_START	/* player thrust c008 */
207 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_PLAYER1 )
208 
209 	PORT_START	/* player slowdown c009 */
210 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER1 )
211 
212 	PORT_START	/* player left c00a */
213 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER1 )
214 
215 	PORT_START	/* player right c00b */
216 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
217 
218 	PORT_START	/* player fire c00c */
219 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER1 )
220 
221 	PORT_START	/* enemy thrust c00d */
222 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_PLAYER2 )
223 
224 	PORT_START	/* enemy slowdown c00e */
225 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
226 
227 	PORT_START	/* enemy left c00f */
228 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
229 
230 	PORT_START	/* enemy right c010 */
231 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
232 
233 	PORT_START	/* enemy fire c011 */
234 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_PLAYER2 )
235 
236 //c012
237 
238 
239 	PORT_START	/* VBLANK??? read from 0xc014 */
240 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_VBLANK )
241 
242 	PORT_START	/* coin input c015 */
243 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
244 
245 	PORT_START	/* game start c016 */
246 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
247 
248 INPUT_PORTS_END
249 
250 
251 static struct GfxLayout charlayout =
252 {
253 	16,16,	/* 16*16 chars */
254 	8,	/* 8 characters */
255 	1,		/* 1 bit per pixel */
256 	{ 4 },	/* character rom is 512x4 bits (3622 type)*/
257 	{ 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3, 16+0, 16+1, 16+2, 16+3, 24+0, 24+1, 24+2, 24+3 },
258 	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 },
259 	64*8	/* every char takes 64 consecutive bytes */
260 };
261 
262 static struct GfxLayout charlayout0 =
263 {
264 	16,16,	/* 16*16 chars */
265 	1,	/* 1 characters */
266 	1,		/* 1 bit per pixel */
267 	{ 7 },	/* bit 0 in character ram */
268 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
269 	{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
270 	256*8	/* every char takes 256 consecutive bytes */
271 };
272 
273 static struct GfxLayout charlayout1 =
274 {
275 	16,16,	/* 16*16 chars */
276 	1,	/* 1 characters */
277 	1,		/* 1 bit per pixel */
278 	{ 6 },	/* bit 1 in character ram */
279 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
280 	{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
281 	256*8	/* every char takes 256 consecutive bytes */
282 };
283 
284 static struct GfxLayout charlayout2 =
285 {
286 	16,16,	/* 16*16 chars */
287 	1,	/* 1 characters */
288 	1,		/* 1 bit per pixel */
289 	{ 5 },	/* bit 2 in character ram */
290 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
291 	{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
292 	256*8	/* every char takes 256 consecutive bytes */
293 };
294 
295 static struct GfxLayout scorelayout =
296 {
297 	16,16,	/* 16*16 chars */
298 	8,	/* 8 characters */
299 	1,		/* 1 bit per pixel */
300 	{ 0 },	/*  */
301 	{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
302 	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16, 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
303 	32*8	/* every char takes 32 consecutive bytes */
304 };
305 
306 static struct GfxDecodeInfo gfxdecodeinfo[] =
307 {
308 	{ REGION_GFX1, 0     , &charlayout,  0, 2 },
309 	{ 0          , 0x8000, &charlayout0, 0, 2 },    /* the game dynamically modifies this */
310 	{ 0          , 0x8000, &charlayout1, 0, 2 },    /* the game dynamically modifies this */
311 	{ 0          , 0x8000, &charlayout2, 0, 2 },    /* the game dynamically modifies this */
312 	{ 0          , 0x8000, &scorelayout, 0, 2 },    /* the game dynamically modifies this */
313 	{ -1 } /* end of array */
314 };
315 
316 
317 
318 static MACHINE_DRIVER_START( ace )
319 
320 	/* basic machine hardware */
321 	MDRV_CPU_ADD(8080, 18000000 / 9)	/* 2 MHz ? */
322 	MDRV_CPU_MEMORY(readmem,writemem)
323 
324 	MDRV_FRAMES_PER_SECOND(60)
325 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
326 
327 	/* video hardware */
328 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
329 	MDRV_SCREEN_SIZE(32*8, 32*8)
330 	MDRV_VISIBLE_AREA(4*8, 32*8-1, 2*8, 32*8-1)
331 	MDRV_GFXDECODE(gfxdecodeinfo)
332 	MDRV_PALETTE_LENGTH(2)
333 	MDRV_COLORTABLE_LENGTH(2*2)
334 
335 	MDRV_PALETTE_INIT(ace)
336 	MDRV_VIDEO_UPDATE(ace)
337 
338 	/* sound hardware */
339 	/* ???? */
340 
341 MACHINE_DRIVER_END
342 
343 /***************************************************************************
344 
345   Game driver(s)
346 
347 ***************************************************************************/
348 
349 ROM_START( ace )
350 	ROM_REGION( 0x10000, REGION_CPU1, 0 )     /* 64k for main CPU */
351 	ROM_LOAD( "ace.a1",		0x0000, 0x0200, CRC(16811834) SHA1(5502812dd161908eea3fa8851d7e5c1e22b0f8ff) )
352 	ROM_LOAD( "ace.a2",		0x0200, 0x0200, CRC(f9eae80e) SHA1(8865b86c7b5d57c76312c16f8a614bf35ffaf532) )
353 	ROM_LOAD( "ace.a3",		0x0400, 0x0200, CRC(c5c63b8c) SHA1(2079dd12ff0c4aafec19aeb9baa70fc9b6788356) )
354 	ROM_LOAD( "ace.a4",		0x0600, 0x0200, CRC(ea4503aa) SHA1(fea610124b9f7ea18d29b4e4599253ba1ee067e1) )
355 	ROM_LOAD( "ace.a5",		0x0800, 0x0200, CRC(623c58e7) SHA1(a92418bc323a1ae76eae8e094e4d6ebd1e8da14e) )
356 
357 	/* not used - I couldn't guess when this should be displayed */
358 	ROM_REGION( 0x0200, REGION_GFX1, 0 )
359 	ROM_LOAD( "ace.k4",		0x0000, 0x0200, CRC(daa05ec6) SHA1(8b71ffb802293dc93f6b492ff128a704e676a5fd) )
360 
361 ROM_END
362 
363 GAMEX( 1976, ace, 0, ace, ace, 0, ROT0, "Allied Leisure", "Ace", GAME_NO_SOUND | GAME_IMPERFECT_COLORS )
364