1 /****************************************************************************
2 
3 Tropical Angel
4 
5 driver by Phil Stroffolino
6 
7 ****************************************************************************/
8 #include "driver.h"
9 #include "sndhrdw/irem.h"
10 #include "vidhrdw/generic.h"
11 
12 extern unsigned char *troangel_scroll;
13 WRITE_HANDLER( troangel_flipscreen_w );
14 PALETTE_INIT( troangel );
15 VIDEO_UPDATE( troangel );
16 
17 
18 
MEMORY_READ_START(troangel_readmem)19 static MEMORY_READ_START( troangel_readmem )
20 	{ 0x0000, 0x7fff, MRA_ROM },
21 	{ 0x8000, 0x8fff, MRA_RAM },
22 	{ 0x9000, 0x90ff, MRA_RAM },
23 	{ 0xd000, 0xd000, input_port_0_r },
24 	{ 0xd001, 0xd001, input_port_1_r },
25 	{ 0xd002, 0xd002, input_port_2_r },
26 	{ 0xd003, 0xd003, input_port_3_r },
27 	{ 0xd004, 0xd004, input_port_4_r },
28 	{ 0xe000, 0xe7ff, MRA_RAM },
29 MEMORY_END
30 
31 static MEMORY_WRITE_START( troangel_writemem )
32 	{ 0x0000, 0x7fff, MWA_ROM },
33 	{ 0x8000, 0x87ff, videoram_w, &videoram, &videoram_size },
34 //	{ 0x8800, 0x8fff, MWA_RAM },
35 	{ 0x9000, 0x91ff, MWA_RAM, &troangel_scroll },
36 	{ 0xc820, 0xc8ff, MWA_RAM, &spriteram, &spriteram_size },
37 	{ 0xd000, 0xd000, irem_sound_cmd_w },
38 	{ 0xd001, 0xd001, troangel_flipscreen_w },	/* + coin counters */
39 	{ 0xe000, 0xe7ff, MWA_RAM },
40 MEMORY_END
41 
42 
43 
44 INPUT_PORTS_START( troangel )
45 	PORT_START	/* IN0 */
46 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
47 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
48 	/* coin input must be active for 19 frames to be consistently recognized */
49 	PORT_BIT_IMPULSE( 0x04, IP_ACTIVE_LOW, IPT_COIN3, 19 )
50 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
51 	PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
52 
53 	PORT_START	/* IN1 */
54 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
55 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
56 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
57 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
58 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
59 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
60 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
61 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
62 
63 	PORT_START	/* IN2 */
64 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
65 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
66 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
67 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
68 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
69 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
70 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
71 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
72 
73 	PORT_START	/* DSW1 */
74 	PORT_DIPNAME( 0x03, 0x03, "Time" )
75 	PORT_DIPSETTING(    0x03, "180 160 140" )
76 	PORT_DIPSETTING(    0x02, "160 140 120" )
77 	PORT_DIPSETTING(    0x01, "140 120 100" )
78 	PORT_DIPSETTING(    0x00, "120 100 100" )
79 	PORT_DIPNAME( 0x04, 0x04, "Crash Loss Time" )
80 	PORT_DIPSETTING(    0x04, "5" )
81 	PORT_DIPSETTING(    0x00, "10" )
82 	PORT_DIPNAME( 0x08, 0x08, "Background Sound" )
83 	PORT_DIPSETTING(    0x08, "Boat Motor" )
84 	PORT_DIPSETTING(    0x00, "Music" )
85 	/* TODO: support the different settings which happen in Coin Mode 2 */
86 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) ) /* mapped on coin mode 1 */
87 	PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
88 	PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
89 	PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
90 	PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
91 	PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
92 	PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
93 	PORT_DIPSETTING(    0x70, DEF_STR( 1C_2C ) )
94 	PORT_DIPSETTING(    0x60, DEF_STR( 1C_3C ) )
95 	PORT_DIPSETTING(    0x50, DEF_STR( 1C_4C ) )
96 	PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
97 	PORT_DIPSETTING(    0x30, DEF_STR( 1C_6C ) )
98 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
99 	/* settings 0x10, 0x20, 0x80, 0x90 all give 1 Coin/1 Credit */
100 
101 	PORT_START	/* DSW2 */
102 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
103 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
104 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
105 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
106 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
107 	PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
108 /* This activates a different coin mode. Look at the dip switch setting schematic */
109 	PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
110 	PORT_DIPSETTING(    0x04, "Mode 1" )
111 	PORT_DIPSETTING(    0x00, "Mode 2" )
112 /* TODO: the following enables an analog accelerator input read from 0xd003 */
113 /* however that is the DSW1 input so it must be multiplexed some way */
114 	PORT_DIPNAME( 0x08, 0x08, "Analog Accelarator" )
115 	PORT_DIPSETTING(    0x08, DEF_STR( No ) )
116 	PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
117 	/* In stop mode, press 2 to stop and 1 to restart */
118 	PORT_BITX   ( 0x10, 0x10, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Stop Mode", IP_KEY_NONE, IP_JOY_NONE )
119 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
120 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
121 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
122 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
123 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
124 	PORT_BITX(    0x40, 0x40, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
125 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
126 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
127 	PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
128 INPUT_PORTS_END
129 
130 
131 
132 static struct GfxLayout charlayout =
133 {
134 	8,8, /* character size */
135 	1024, /* number of characters */
136 	3, /* bits per pixel */
137 	{ 0, 1024*8*8, 2*1024*8*8 },
138 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
139 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
140 	8*8	/* character offset */
141 };
142 
143 static struct GfxLayout spritelayout =
144 {
145 	16,32, /* sprite size */
146 	64, /* number of sprites */
147 	3, /* bits per pixel */
148 	{ 0, 0x4000*8, 2*0x4000*8 },
149 	{ 0, 1, 2, 3, 4, 5, 6, 7,
150 			16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 },
151 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
152 			8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8,
153 			256*64+0*8, 256*64+1*8, 256*64+2*8, 256*64+3*8, 256*64+4*8, 256*64+5*8, 256*64+6*8, 256*64+7*8,
154 			256*64+8*8, 256*64+9*8, 256*64+10*8, 256*64+11*8, 256*64+12*8, 256*64+13*8, 256*64+14*8, 256*64+15*8 },
155 	32*8	/* character offset */
156 };
157 
158 static struct GfxDecodeInfo troangel_gfxdecodeinfo[] =
159 {
160 	{ REGION_GFX1, 0x0000, &charlayout,      0, 32 },
161 	{ REGION_GFX2, 0x0000, &spritelayout, 32*8, 32 },
162 	{ REGION_GFX2, 0x1000, &spritelayout, 32*8, 32 },
163 	{ REGION_GFX2, 0x2000, &spritelayout, 32*8, 32 },
164 	{ REGION_GFX2, 0x3000, &spritelayout, 32*8, 32 },
165 	{ -1 } /* end of array */
166 };
167 
168 
169 
170 static MACHINE_DRIVER_START( troangel )
171 
172 	/* basic machine hardware */
173 	MDRV_CPU_ADD(Z80, 3000000)	/* 3 MHz ??? */
174 	MDRV_CPU_MEMORY(troangel_readmem,troangel_writemem)
175 	MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
176 
177 	MDRV_FRAMES_PER_SECOND(57)
178 	MDRV_VBLANK_DURATION(1790)	/* accurate frequency, measured on a Moon Patrol board, is 56.75Hz. */
179 				/* the Lode Runner manual (similar but different hardware) */
180 				/* talks about 55Hz and 1790ms vblank duration. */
181 
182 	/* video hardware */
183 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
184 	MDRV_SCREEN_SIZE(32*8, 32*8)
185 	MDRV_VISIBLE_AREA(1*8, 31*8-1, 1*8, 31*8-1)
186 	MDRV_GFXDECODE(troangel_gfxdecodeinfo)
187 	MDRV_PALETTE_LENGTH(32*8+16)
188 	MDRV_COLORTABLE_LENGTH(32*8+32*8)
189 
190 	MDRV_PALETTE_INIT(troangel)
191 	MDRV_VIDEO_START(generic)
192 	MDRV_VIDEO_UPDATE(troangel)
193 
194 	/* sound hardware */
195 	MDRV_IMPORT_FROM(irem_audio)
196 MACHINE_DRIVER_END
197 
198 
199 
200 
201 ROM_START( troangel )
202 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* main CPU */
203 	ROM_LOAD( "ta-a-3k",	0x0000, 0x2000, CRC(f21f8196) SHA1(7cbf74b77a559ee70312b799e707394d9b849f5b) )
204 	ROM_LOAD( "ta-a-3m",	0x2000, 0x2000, CRC(58801e55) SHA1(91bdda778f2c4486001bc4ad26d6f21ba275ae08) )
205 	ROM_LOAD( "ta-a-3n",	0x4000, 0x2000, CRC(de3dea44) SHA1(1290755ffc04dc3b3667e063118669a0eab6fb79) )
206 	ROM_LOAD( "ta-a-3q",	0x6000, 0x2000, CRC(fff0fc2a) SHA1(82f3f5a8817e956192323eb555daa85b7766676d) )
207 
208 	ROM_REGION(  0x10000 , REGION_CPU2, 0 )	/* sound CPU */
209 	ROM_LOAD( "ta-s-1a",	0xe000, 0x2000, CRC(15a83210) SHA1(8ada510db689ffa372b2f4dc4bd1b1c69a0c5307) )
210 
211 	ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE )
212 	ROM_LOAD( "ta-a-3c",	0x00000, 0x2000, CRC(7ff5482f) SHA1(fe8c181fed113007d69d11e8aa467e86a6357ffb) )	/* characters */
213 	ROM_LOAD( "ta-a-3d",	0x02000, 0x2000, CRC(06eef241) SHA1(4f327a54169046d8d84b5f5cf5d9f45e1df4dae6) )
214 	ROM_LOAD( "ta-a-3e",	0x04000, 0x2000, CRC(e49f7ad8) SHA1(915de1084fd3c5fc81dd8c80107c28cc57b33226) )
215 
216 	ROM_REGION( 0x0c000, REGION_GFX2, ROMREGION_DISPOSE )
217 	ROM_LOAD( "ta-b-5j",	0x00000, 0x2000, CRC(86895c0c) SHA1(b42b041e3e20dadd8411805d492133d371426ebf) )	/* sprites */
218 	ROM_LOAD( "ta-b-5h",	0x02000, 0x2000, CRC(f8cff29d) SHA1(dabf3bbf50f73a381056131c2239c84dd966b63e) )
219 	ROM_LOAD( "ta-b-5e",	0x04000, 0x2000, CRC(8b21ee9a) SHA1(1272722211d22d5b153e9415cc189a5aa9028543) )
220 	ROM_LOAD( "ta-b-5d",	0x06000, 0x2000, CRC(cd473d47) SHA1(854cb532bd62851a206da2affd66a1257b7085b6) )
221 	ROM_LOAD( "ta-b-5c",	0x08000, 0x2000, CRC(c19134c9) SHA1(028660e66fd033473c468b694e870c633ca05ec6) )
222 	ROM_LOAD( "ta-b-5a",	0x0a000, 0x2000, CRC(0012792a) SHA1(b4380f5fbe5e9ce9b44f87ce48a8b402bab58b52) )
223 
224 	ROM_REGION( 0x0320, REGION_PROMS, 0 )
225 	ROM_LOAD( "ta-a-5a",	0x0000,	0x0100, CRC(01de1167) SHA1(b9070f8c70eb362fc4d6a0a92235ce0a5b2ab858) ) /* chars palette low 4 bits */
226 	ROM_LOAD( "ta-a-5b",	0x0100,	0x0100, CRC(efd11d4b) SHA1(7c7c356063ab35e4ffb8d65cd20c27c2a4b36537) ) /* chars palette high 4 bits */
227 	ROM_LOAD( "ta-b-1b",	0x0200, 0x0020, CRC(f94911ea) SHA1(ad61a323476a97156a255a72048a28477b421284) ) /* sprites palette */
228 	ROM_LOAD( "ta-b-3d",	0x0220,	0x0100, CRC(ed3e2aa4) SHA1(cfdfc151803080d1ecdd04af1bfea3dbdce8dca0) ) /* sprites lookup table */
229 ROM_END
230 
231 
232 
233 GAME( 1983, troangel, 0, troangel, troangel, 0, ROT0, "Irem", "Tropical Angel" )
234