1 /***************************************************************************
2 
3 Ramtek Star Cruiser Driver
4 
5 (no known issues)
6 
7 Frank Palazzolo
8 palazzol@home.com
9 
10 ***************************************************************************/
11 
12 #include "driver.h"
13 #include "vidhrdw/generic.h"
14 #include "cpu/i8085/i8085.h"
15 
16 /* included from vidhrdw/starcrus.c */
17 WRITE_HANDLER( starcrus_s1_x_w );
18 WRITE_HANDLER( starcrus_s1_y_w );
19 WRITE_HANDLER( starcrus_s2_x_w );
20 WRITE_HANDLER( starcrus_s2_y_w );
21 WRITE_HANDLER( starcrus_p1_x_w );
22 WRITE_HANDLER( starcrus_p1_y_w );
23 WRITE_HANDLER( starcrus_p2_x_w );
24 WRITE_HANDLER( starcrus_p2_y_w );
25 WRITE_HANDLER( starcrus_ship_parm_1_w );
26 WRITE_HANDLER( starcrus_ship_parm_2_w );
27 WRITE_HANDLER( starcrus_proj_parm_1_w );
28 WRITE_HANDLER( starcrus_proj_parm_2_w );
29 READ_HANDLER( starcrus_coll_det_r );
30 extern VIDEO_START( starcrus );
31 extern VIDEO_UPDATE( starcrus );
32 extern int p1_sprite;
33 extern int p2_sprite;
34 extern int s1_sprite;
35 extern int s2_sprite;
36 
MEMORY_READ_START(readmem)37 static MEMORY_READ_START( readmem )
38 	{ 0x0000, 0x0fff, MRA_ROM }, /* Program ROM */
39 	{ 0x1000, 0x10ff, MRA_RAM }, /* RAM */
40 MEMORY_END
41 
42 static MEMORY_WRITE_START( writemem )
43     { 0x0000, 0x0fff, MWA_ROM }, /* Program ROM */
44     { 0x1000, 0x10ff, MWA_RAM }, /* RAM */
45 MEMORY_END
46 
47 static PORT_READ_START( readport )
48     { 0x00, 0x00, input_port_0_r },
49     { 0x01, 0x01, input_port_1_r },
50     { 0x02, 0x02, starcrus_coll_det_r },
51     { 0x03, 0x03, input_port_2_r },
52 PORT_END
53 
54 static PORT_WRITE_START( writeport )
55     { 0x00, 0x00, starcrus_s1_x_w },
56     { 0x01, 0x01, starcrus_s1_y_w },
57     { 0x02, 0x02, starcrus_s2_x_w },
58     { 0x03, 0x03, starcrus_s2_y_w },
59     { 0x04, 0x04, starcrus_p1_x_w },
60     { 0x05, 0x05, starcrus_p1_y_w },
61     { 0x06, 0x06, starcrus_p2_x_w },
62     { 0x07, 0x07, starcrus_p2_y_w },
63     { 0x08, 0x08, starcrus_ship_parm_1_w },
64     { 0x09, 0x09, starcrus_ship_parm_2_w },
65     { 0x0a, 0x0a, starcrus_proj_parm_1_w },
66     { 0x0b, 0x0b, starcrus_proj_parm_2_w },
67 PORT_END
68 
69 
70 
71 INPUT_PORTS_START( starcrus )
72 		PORT_START	/* player 1 */
73 		PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY ) /* ccw */
74 		PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* engine */
75 		PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY ) /* cw */
76         PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
77         PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) /* torpedo */
78         PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
79         PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* phaser */
80         PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
81 
82         PORT_START  /* player 2 */
83         PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_PLAYER2 ) /* ccw */
84         PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 ) /* engine */
85         PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_PLAYER2 ) /* cw */
86         PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
87         PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 ) /* torpedo */
88         PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
89         PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 ) /* phaser */
90         PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
91 
92 		PORT_START
93         PORT_DIPNAME ( 0x03, 0x02, "Game Time" )
94         PORT_DIPSETTING ( 0x03, "60 secs" )
95         PORT_DIPSETTING ( 0x02, "90 secs" )
96         PORT_DIPSETTING ( 0x01, "120 secs" )
97         PORT_DIPSETTING ( 0x00, "150 secs" )
98         PORT_DIPNAME ( 0x04, 0x00, DEF_STR( Coinage ))
99         PORT_DIPSETTING ( 0x04, DEF_STR( 2C_1C ))
100         PORT_DIPSETTING ( 0x00, DEF_STR( 1C_1C ))
101         PORT_BIT (0x08, IP_ACTIVE_LOW, IPT_COIN2 )
102         PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_COIN1 )
103         PORT_DIPNAME ( 0x20, 0x20, "Mode" )
104         PORT_DIPSETTING ( 0x20, "Standard" )
105         PORT_DIPSETTING ( 0x00, "Alternate" )
106         PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
107         PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
108 INPUT_PORTS_END
109 
110 
111 
112 static struct GfxLayout spritelayout1 =
113 {
114 	16,16,    /* 16x16 sprites */
115 	4,          /* 4 sprites */
116 	1,      /* 1 bits per pixel */
117 	{ 0 },  /* 1 chip */
118 	{ 0*8+4,  0*8+4,  1*8+4,  1*8+4, 2*8+4, 2*8+4, 3*8+4, 3*8+4,
119 	  4*8+4,  4*8+4,  5*8+4,  5*8+4, 6*8+4, 6*8+4, 7*8+4, 7*8+4 },
120 	{ 0, 0, 1*64, 1*64, 2*64, 2*64, 3*64, 3*64,
121 	  4*64, 4*64, 5*64, 5*64, 6*64, 6*64, 7*64, 7*64 },
122 	1  /* every sprite takes 1 consecutive bit */
123 };
124 static struct GfxLayout spritelayout2 =
125 {
126     16,16,   /* 16x16 sprites */
127     4,       /* 4 sprites */
128     1,       /* 1 bits per pixel */
129     { 0 },   /* 1 chip */
130     { 0*8+4,  1*8+4,  2*8+4,  3*8+4, 4*8+4, 5*8+4, 6*8+4, 7*8+4,
131       8*8+4,  9*8+4,  10*8+4,  11*8+4, 12*8+4, 13*8+4, 14*8+4, 15*8+4 },
132     { 0, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128,
133       8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
134     1 /* every sprite takes 1 consecutive bytes */
135 };
136 
137 static struct GfxDecodeInfo gfxdecodeinfo[] =
138 {
139 	{ REGION_GFX1, 0x0000, &spritelayout1, 0, 1 },
140     { REGION_GFX1, 0x0040, &spritelayout1, 0, 1 },
141     { REGION_GFX1, 0x0080, &spritelayout1, 0, 1 },
142     { REGION_GFX1, 0x00c0, &spritelayout1, 0, 1 },
143     { REGION_GFX2, 0x0000, &spritelayout1, 0, 1 },
144     { REGION_GFX2, 0x0040, &spritelayout1, 0, 1 },
145     { REGION_GFX2, 0x0080, &spritelayout1, 0, 1 },
146     { REGION_GFX2, 0x00c0, &spritelayout1, 0, 1 },
147     { REGION_GFX3, 0x0000, &spritelayout2, 0, 1 },
148     { REGION_GFX3, 0x0100, &spritelayout2, 0, 1 },
149     { REGION_GFX3, 0x0200, &spritelayout2, 0, 1 },
150     { REGION_GFX3, 0x0300, &spritelayout2, 0, 1 },
151 	{ -1 } /* end of array */
152 };
153 
154 
155 static unsigned short colortable_source[] =
156 {
157 	0x00, 0x01, /* White on Black */
158 };
PALETTE_INIT(starcrus)159 static PALETTE_INIT( starcrus )
160 {
161 	palette_set_color(0,0x00,0x00,0x00); /* Black */
162     palette_set_color(1,0xff,0xff,0xff); /* White */
163 	memcpy(colortable,colortable_source,sizeof(colortable_source));
164 }
165 
166 static const char *starcrus_sample_names[] =
167 {
168     "*starcrus",
169     "engine.wav",	/* engine sound, channel 0 */
170     "explos1.wav",	/* explosion sound, first part, channel 1 */
171     "explos2.wav",	/* explosion sound, second part, channel 1 */
172     "launch.wav",	/* launch sound, channels 2 and 3 */
173     0   /* end of array */
174 };
175 
176 static struct Samplesinterface samples_interface =
177 {
178     4,	/* 4 channels */
179 	100,	/* volume */
180 	starcrus_sample_names
181 };
182 
183 
184 static MACHINE_DRIVER_START( starcrus )
185 
186 	/* basic machine hardware */
187 	MDRV_CPU_ADD(8080,9750000/9)  /* 8224 chip is a divide by 9 */
188 	MDRV_CPU_MEMORY(readmem,writemem)
189 	MDRV_CPU_PORTS(readport,writeport)
190 	MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
191 
192 	MDRV_FRAMES_PER_SECOND(57)
193 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
194 
195 	/* video hardware */
196 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
197 	MDRV_SCREEN_SIZE(32*8, 32*8)
198 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
199 	MDRV_GFXDECODE(gfxdecodeinfo)
200 	MDRV_PALETTE_LENGTH(2)
201 	MDRV_COLORTABLE_LENGTH(sizeof(colortable_source) / sizeof(colortable_source[0]))
202 
203 	MDRV_PALETTE_INIT(starcrus)
204 	MDRV_VIDEO_START(starcrus)
205 	MDRV_VIDEO_UPDATE(starcrus)
206 
207     /* sound hardware */
208 	MDRV_SOUND_ADD(SAMPLES, samples_interface)
209 MACHINE_DRIVER_END
210 
211 /***************************************************************************
212 
213   Game ROMs
214 
215 ***************************************************************************/
216 
217 ROM_START( starcrus )
218     ROM_REGION( 0x10000, REGION_CPU1, 0 )  /* code */
219 	ROM_LOAD( "starcrus.j1",   0x0000, 0x0200, CRC(0ee60a50) SHA1(7419e7cb4c589da53d4a10ad129373502682464e) )
220 	ROM_LOAD( "starcrus.k1",   0x0200, 0x0200, CRC(a7bc3bc4) SHA1(0e38076e921856608b1dd712687bef1c2522b4b8) )
221 	ROM_LOAD( "starcrus.l1",   0x0400, 0x0200, CRC(10d233ec) SHA1(8933cf9fc51716a9e8f75a4444e7d7070cf5834d) )
222 	ROM_LOAD( "starcrus.m1",   0x0600, 0x0200, CRC(2facbfee) SHA1(d78fb38de49da938fce2b55c8decc244efee6f94) )
223 	ROM_LOAD( "starcrus.n1",   0x0800, 0x0200, CRC(42083247) SHA1(b32d67c914833f18e9955cd1c3cb1d948be0a7d5) )
224 	ROM_LOAD( "starcrus.p1",   0x0a00, 0x0200, CRC(61dfe581) SHA1(e1802fedf94541e9ccd9786b60e90890485f422f) )
225 	ROM_LOAD( "starcrus.r1",   0x0c00, 0x0200, CRC(010cdcfe) SHA1(ae76f1739b468e2987ce949470b36f1a873e061d) )
226 	ROM_LOAD( "starcrus.s1",   0x0e00, 0x0200, CRC(da4e276b) SHA1(3298f7cb259803f118a47292cbb413df253ef74d) )
227 
228     ROM_REGION( 0x0200, REGION_GFX1, ROMREGION_DISPOSE )
229 	ROM_LOAD( "starcrus.e6",   0x0000, 0x0200, CRC(54887a25) SHA1(562bf85cd063c2cc0a2f803095aaa6138dfb5bff) )
230 
231     ROM_REGION( 0x0200, REGION_GFX2, ROMREGION_DISPOSE )
232 	ROM_LOAD( "starcrus.l2",   0x0000, 0x0200, CRC(54887a25) SHA1(562bf85cd063c2cc0a2f803095aaa6138dfb5bff) )
233 
234     ROM_REGION( 0x0400, REGION_GFX3, ROMREGION_DISPOSE )
235 	ROM_LOAD( "starcrus.j4",   0x0000, 0x0200, CRC(25f15ae1) SHA1(7528edaa01ad5a167191c7e72394cb6009db1b27) )
236 	ROM_LOAD( "starcrus.g5",   0x0200, 0x0200, CRC(73b27f6e) SHA1(4a6cf9244556a2c2647d594c7a19fe1a374a57e6) )
237 ROM_END
238 
239 
240 GAME( 1977, starcrus, 0, starcrus, starcrus, 0, ROT0, "RamTek", "Star Cruiser" )
241