1 /*
2 05/01/2003 MooglyGuy/Ryan Holtz
3 - Corrected second AY (shouldn't have been there)
4 - Added first AY's status read
5 - Added coinage DIP
6 - What the hell are those unmapped port writes!? Not AY...
7
8 2003.01.01. Tomasz Slanina
9
10 changes :
11 - nmi generation ( incorrect freq probably)
12 - music/sfx (partially)
13 - more sprite tiles (twice than before)
14 - fixed sprites flips
15 - scrolling (2nd game level)
16 - better colors (weird 'hack' .. but works in most cases ( comparing with screens from emustatus ))
17 - dips - lives
18 - visible area .. a bit smaller (at least bg 'generation' is not visible for scrolling levels )
19 - cpu clock .. now 4 mhz
20 */
21
22
23 #include "driver.h"
24 #include "vidhrdw/generic.h"
25
26 data8_t *skyarmy_videoram;
27 data8_t *skyarmy_colorram;
28 data8_t *skyarmy_scrollram;
29 static struct tilemap* skyarmy_tilemap;
30
get_skyarmy_tile_info(int tile_index)31 static void get_skyarmy_tile_info(int tile_index)
32 {
33 int code = skyarmy_videoram[tile_index];
34 int attr = skyarmy_colorram[tile_index];
35
36 /* bit 0 <-> bit 2 ????? */
37 switch(attr)
38 {
39 case 1: attr=4; break;
40 case 3: attr=6; break;
41 case 4: attr=1; break;
42 case 6: attr=3; break;
43 }
44
45 SET_TILE_INFO( 0, code, attr, 0)
46 }
47
WRITE_HANDLER(skyarmy_videoram_w)48 WRITE_HANDLER( skyarmy_videoram_w )
49 {
50 skyarmy_videoram[offset] = data;
51 tilemap_mark_tile_dirty(skyarmy_tilemap,offset);
52 }
53
WRITE_HANDLER(skyarmy_colorram_w)54 WRITE_HANDLER( skyarmy_colorram_w )
55 {
56 skyarmy_colorram[offset] = data;
57 tilemap_mark_tile_dirty(skyarmy_tilemap,offset);
58 }
59
WRITE_HANDLER(skyarmy_scrollram_w)60 WRITE_HANDLER( skyarmy_scrollram_w )
61 {
62 skyarmy_scrollram[offset] = data;
63 }
64
65
READ_HANDLER(skyarmy_scrollram_r)66 READ_HANDLER( skyarmy_scrollram_r )
67 {
68 return skyarmy_scrollram[offset];
69 }
70
71
PALETTE_INIT(skyarmy)72 PALETTE_INIT( skyarmy )
73 {
74 int i;
75
76 for (i = 0;i < 32;i++)
77 {
78 int bit0,bit1,bit2,r,g,b;
79
80 bit0 = (*color_prom >> 0) & 0x01;
81 bit1 = (*color_prom >> 1) & 0x01;
82 bit2 = (*color_prom >> 2) & 0x01;
83 r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
84
85 bit0 = (*color_prom >> 3) & 0x01;
86 bit1 = (*color_prom >> 4) & 0x01;
87 bit2 = (*color_prom >> 5) & 0x01;
88 g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
89
90 bit0=0;
91 bit1 = (*color_prom >> 6) & 0x01;
92 bit2 = (*color_prom >> 7) & 0x01;
93 b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
94
95 palette_set_color(i,r,g,b);
96 color_prom++;
97 }
98 }
99
VIDEO_START(skyarmy)100 VIDEO_START( skyarmy )
101 {
102 skyarmy_tilemap = tilemap_create(get_skyarmy_tile_info,tilemap_scan_rows,TILEMAP_OPAQUE,8,8,32,32);
103 tilemap_set_scroll_cols(skyarmy_tilemap,32);
104
105 if(!skyarmy_tilemap)
106 return 1;
107
108 return 0;
109 }
110
111
VIDEO_UPDATE(skyarmy)112 VIDEO_UPDATE( skyarmy )
113 {
114 int sx, sy, flipx, flipy, offs,pal;
115 int i;
116
117 for(i=0;i<0x20;i++)tilemap_set_scrolly( skyarmy_tilemap,i,skyarmy_scrollram[i]);
118
119 tilemap_draw(bitmap,cliprect,skyarmy_tilemap,0,0);
120
121 for (offs = 0 ; offs < 0x40; offs+=4)
122 {
123
124 pal=spriteram[offs+2]&0x7;
125
126 switch(pal)
127 {
128 case 1: pal=4; break;
129 case 2: pal=2; break;
130 case 3: pal=6; break;
131 case 4: pal=1; break;
132 case 6: pal=3; break;
133 }
134 sx = spriteram[offs+3];
135 sy = 242-spriteram[offs];
136 flipy = (spriteram[offs+1]&0x80)>>7;
137 flipx = (spriteram[offs+1]&0x40)>>6;
138 drawgfx(bitmap,Machine->gfx[1],
139 spriteram[offs+1]&0x3f,
140 pal,
141 flipx,flipy,
142 sx,sy,
143 cliprect,TRANSPARENCY_PEN,0);
144 }
145 }
146
147 static int skyarmy_nmi=0;
148
INTERRUPT_GEN(skyarmy_nmi_source)149 static INTERRUPT_GEN( skyarmy_nmi_source )
150 {
151 if(skyarmy_nmi) cpu_set_irq_line(0,IRQ_LINE_NMI, PULSE_LINE) ;
152 }
153
154
WRITE_HANDLER(nmi_enable_w)155 WRITE_HANDLER( nmi_enable_w )
156 {
157 skyarmy_nmi=data&1;
158 }
159
160
MEMORY_READ_START(skyarmy_readmem)161 static MEMORY_READ_START( skyarmy_readmem )
162 { 0x0000, 0x7FFF, MRA_ROM },
163 { 0x8000, 0x87FF, MRA_RAM },
164 { 0x8800, 0x93FF, MRA_RAM }, /* Video RAM */
165 { 0x9800, 0x983F, MRA_RAM }, /* Sprites */
166 { 0x9840, 0x985F, skyarmy_scrollram_r }, /* Sroll RAM */
167 { 0xA000, 0xA000, input_port_0_r },
168 { 0xA001, 0xA001, input_port_1_r },
169 { 0xA002, 0xA002, input_port_2_r },
170 { 0xA003, 0xA003, input_port_3_r },
171 MEMORY_END
172
173 static MEMORY_WRITE_START( skyarmy_writemem )
174 { 0x0000, 0x7FFF, MWA_ROM },
175 { 0x8000, 0x87FF, MWA_RAM },
176 { 0x8800, 0x8BFF, skyarmy_videoram_w, &skyarmy_videoram }, /* Video RAM */
177 { 0x9000, 0x93FF, skyarmy_colorram_w, &skyarmy_colorram }, /* Color RAM */
178 { 0x9800, 0x983F, spriteram_w, &spriteram, &spriteram_size }, /* Sprites */
179 { 0x9840, 0x985F, skyarmy_scrollram_w, &skyarmy_scrollram }, /* Sprites */
180 { 0xa004, 0xa004, nmi_enable_w }, /* ???*/
181 { 0xa005, 0xa005, MWA_NOP },
182 { 0xa006, 0xa006, MWA_NOP },
183 { 0xa007, 0xa007, MWA_NOP },
184 MEMORY_END
185
186 INPUT_PORTS_START( skyarmy )
187 PORT_START
188 PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
189 PORT_DIPSETTING( 0x00, "2" )
190 PORT_DIPSETTING( 0x01, "3" )
191 PORT_DIPSETTING( 0x02, "4" )
192 PORT_DIPSETTING( 0x03, DEF_STR ( Free_Play ) )
193 PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )
194 PORT_DIPSETTING( 0x00, "10000" )
195 PORT_DIPSETTING( 0x04, "20000" )
196 PORT_DIPSETTING( 0x08, "30000" )
197 PORT_DIPSETTING( 0x0c, "40000" )
198 PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coinage ) )
199 PORT_DIPSETTING( 0x30, DEF_STR( 3C_1C ) )
200 PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) )
201 PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
202 PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) )
203 PORT_DIPNAME( 0x40, 0x00, DEF_STR( Flip_Screen ) )
204 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
205 PORT_DIPSETTING( 0x40, DEF_STR( On ) )
206 PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
207 PORT_DIPSETTING( 0x80, DEF_STR( Upright ) )
208 PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) )
209
210 PORT_START
211 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
212 PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
213 PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
214 PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
215 PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
216 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 )
217 PORT_BIT( 0xC0, IP_ACTIVE_HIGH, IPT_UNUSED )
218
219 PORT_START
220 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
221 PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
222 PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
223 PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
224 PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
225 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
226 PORT_BIT( 0xC0, IP_ACTIVE_HIGH, IPT_UNUSED )
227
228 PORT_START
229 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
230 PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
231 PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 )
232 PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
233 PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
234 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
235 PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
236 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
237 INPUT_PORTS_END
238
239 static struct GfxLayout charlayout =
240 {
241 8,8,
242 256,
243 2,
244 { 0, 256*8*8 },
245 { 0, 1, 2, 3, 4, 5, 6, 7 },
246 { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
247 8*8
248 };
249
250 static struct GfxLayout spritelayout =
251 {
252 16,16,
253 32*2,
254 2,
255 { 0, 256*8*8 },
256 { 0, 1, 2, 3, 4, 5, 6, 7,
257 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
258 { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
259 16*8,17*8,18*8,19*8,20*8,21*8,22*8,23*8 },
260 32*8
261 };
262
263 static struct GfxDecodeInfo gfxdecodeinfo[] =
264 {
265 { REGION_GFX1, 0, &charlayout, 0, 8 },
266 { REGION_GFX2, 0, &spritelayout, 0, 8 },
267 { -1 } /* end of array */
268 };
269
PORT_READ_START(readport)270 static PORT_READ_START( readport )
271 { 0x06, 0x06, AY8910_read_port_0_r },
272 PORT_END
273
274 static PORT_WRITE_START( writeport )
275 { 0x04, 0x04, AY8910_control_port_0_w },
276 { 0x05, 0x05, AY8910_write_port_0_w },
277 PORT_END
278
279 static struct AY8910interface ay8910_interface =
280 {
281 1, /* number of chips */
282 2500000, /* 2.5 MHz ??? */
283 { 15 },
284 { 0 },
285 { 0 },
286 { 0 },
287 { 0 }
288 };
289
290 static MACHINE_DRIVER_START( skyarmy )
291 MDRV_CPU_ADD(Z80,4000000)
292 MDRV_CPU_MEMORY(skyarmy_readmem,skyarmy_writemem)
293 MDRV_CPU_PORTS(readport,writeport)
294 MDRV_CPU_VBLANK_INT(irq0_line_pulse,1)
295 MDRV_CPU_PERIODIC_INT(skyarmy_nmi_source,650) /* Hz */
296
297 MDRV_FRAMES_PER_SECOND(60)
298 MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
299
300 MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
301 MDRV_SCREEN_SIZE(32*8,32*8)
302 MDRV_VISIBLE_AREA(0*8,32*8-1,1*8,31*8-1)
303 MDRV_GFXDECODE(gfxdecodeinfo)
304 MDRV_PALETTE_LENGTH(32)
305
306 MDRV_PALETTE_INIT(skyarmy)
307 MDRV_VIDEO_START(skyarmy)
308 MDRV_VIDEO_UPDATE(skyarmy)
309
310 MDRV_SOUND_ADD(AY8910, ay8910_interface)
311 MACHINE_DRIVER_END
312
313
314 ROM_START( skyarmy )
315 ROM_REGION( 0x10000, REGION_CPU1, 0 )
316 ROM_LOAD( "a1h.bin", 0x0000, 0x2000, CRC(46507488) SHA1(a9a43caa6f3eab48c3fd9e2f34fe2b4aacfd4641) )
317 ROM_LOAD( "a2h.bin", 0x2000, 0x2000, CRC(0417653e) SHA1(4f6ad7335b5b7e85b4e16cce3c127488c02401b2) )
318 ROM_LOAD( "a3h.bin", 0x4000, 0x2000, CRC(95485e56) SHA1(c4cbcd31ba68769d2d0d0875e2a92982265339ae) )
319 ROM_LOAD( "j4.bin", 0x6000, 0x2000, CRC(843783df) SHA1(256d8375a8af7de080d456dbc6290a22473d011b) )
320
321 ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE )
322 ROM_LOAD( "13b.bin", 0x0000, 0x0800, CRC(3b0e0f7c) SHA1(2bbba10121d3e745146f50c14dc6df97de40fb96) )
323 ROM_LOAD( "15b.bin", 0x0800, 0x0800, CRC(5ccfd782) SHA1(408406ae068e5578b8a742abed1c37dcd3720fe5) )
324
325 ROM_REGION( 0x1000, REGION_GFX2, ROMREGION_DISPOSE )
326 ROM_LOAD( "8b.bin", 0x0000, 0x0800, CRC(6ac6bd98) SHA1(e653d80ec1b0f8e07821ea781942dae3de7d238d) )
327 ROM_LOAD( "10b.bin", 0x0800, 0x0800, CRC(cada7682) SHA1(83ce8336274cb8006a445ac17a179d9ffd4d6809) )
328
329 ROM_REGION( 0x0020, REGION_PROMS, 0 )
330 ROM_LOAD( "a6.bin", 0x0000, 0x0020, CRC(c721220b) SHA1(61b3320fb616c0600d56840cb6438616c7e0c6eb) )
331 ROM_END
332
333 GAMEX( 1982, skyarmy, 0, skyarmy, skyarmy, 0, ROT90, "Shoei", "Sky Army", GAME_NO_COCKTAIL )
334