1 #include "../vidhrdw/warlord.c"
2 
3 /***************************************************************************
4 Warlords Driver by Lee Taylor and John Clegg
5 
6 
7               Warlords Memory map and Dip Switches
8               ------------------------------------
9 
10  Address  R/W  D7 D6 D5 D4 D3 D2 D1 D0   Function
11 --------------------------------------------------------------------------------------
12 0000-03FF       D  D  D  D  D  D  D  D   RAM
13 --------------------------------------------------------------------------------------
14 0400-07BF       D  D  D  D  D  D  D  D   Screen RAM (8x8 TILES, 32x32 SCREEN)
15 07C0-07CF       D  D  D  D  D  D  D  D   Motion Object Picture
16 07D0-07DF       D  D  D  D  D  D  D  D   Motion Object Vert.
17 07E0-07EF       D  D  D  D  D  D  D  D   Motion Object Horiz.
18 --------------------------------------------------------------------------------------
19 0800       R    D  D  D  D  D  D  D  D   Option Switch 1 (0 = On) (DSW 1)
20 0801       R    D  D  D  D  D  D  D  D   Option Switch 2 (0 = On) (DSW 2)
21 --------------------------------------------------------------------------------------
22 0C00       R    D                        Cocktail Cabinet  (0 = Cocktail)
23            R       D                     VBLANK  (1 = VBlank)
24            R          D                  SELF TEST
25 		   R             D               DIAG STEP (Unused)
26 0C01       R    D  D  D                  R,C,L Coin Switches (0 = On)
27            R             D               Slam (0 = On)
28            R                D            Player 4 Start Switch (0 = On)
29            R                   D         Player 3 Start Switch (0 = On)
30            R                      D      Player 2 Start Switch (0 = On)
31            R                         D   Player 1 Start Switch (0 = On)
32 --------------------------------------------------------------------------------------
33 1000-100F  W   D  D  D  D  D  D  D  D    Pokey
34 --------------------------------------------------------------------------------------
35 1800       W                             IRQ Acknowledge
36 --------------------------------------------------------------------------------------
37 1C00-1C02  W    D  D  D  D  D  D  D  D   Coin Counters
38 --------------------------------------------------------------------------------------
39 1C03-1C06  W    D  D  D  D  D  D  D  D   LEDs
40 --------------------------------------------------------------------------------------
41 4000       W                             Watchdog
42 --------------------------------------------------------------------------------------
43 5000-7FFF  R                             Program ROM
44 --------------------------------------------------------------------------------------
45 
46 Game Option Settings - J2 (DSW1)
47 =========================
48 
49 8   7   6   5   4   3   2   1       Option
50 ------------------------------------------
51                         On  On      English
52                         On  Off     French
53                         Off On      Spanish
54                         Off Off     German
55                     On              Music at end of each game
56                     Off             Music at end of game for new highscore
57         On  On                      1 or 2 player game costs 1 credit
58         On  Off                     1 player game=1 credit, 2 player=2 credits
59         Off Off                     1 or 2 player game costs 2 credits
60         Off On                      Not used
61 -------------------------------------------
62 
63 
64 Game Price Settings - M2 (DSW2)
65 ========================
66 
67 8   7   6   5   4   3   2   1       Option
68 ------------------------------------------
69                         On  On      Free play
70                         On  Off     1 coin for 2 credits
71                         Off On      1 coin for 1 credit
72                         Off Off     2 coins for 1 credit
73                 On  On              Right coin mech x 1
74                 On  Off             Right coin mech x 4
75                 Off On              Right coin mech x 5
76                 Off Off             Right coin mech x 6
77             On                      Left coin mech x 1
78             Off                     Left coin mech x 2
79 On  On  On                          No bonus coins
80 On  On  Off                         For every 2 coins, add 1 coin
81 On  Off On                          For every 4 coins, add 1 coin
82 On  Off Off                         For every 4 coins, add 2 coins
83 Off On  On                          For every 5 coins, add 1 coin
84 ------------------------------------------
85 
86 
87 ***************************************************************************/
88 
89 #include "driver.h"
90 #include "vidhrdw/generic.h"
91 
92 void warlord_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
93 void warlord_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
94 
WRITE_HANDLER(warlord_led_w)95 static WRITE_HANDLER( warlord_led_w )
96 {
97 	osd_led_w(offset,~data >> 7);
98 }
99 
100 
101 
102 static struct MemoryReadAddress readmem[] =
103 {
104 	{ 0x0000, 0x07ff, MRA_RAM },
105 	{ 0x0800, 0x0800, input_port_2_r },	/* DSW1 */
106 	{ 0x0801, 0x0801, input_port_3_r },	/* DSW2 */
107 	{ 0x0c00, 0x0c00, input_port_0_r },	/* IN0 */
108 	{ 0x0c01, 0x0c01, input_port_1_r },	/* IN1 */
109 	{ 0x1000, 0x100f, pokey1_r },		/* Read the 4 paddle values & the random # gen */
110 	{ 0x5000, 0x7fff, MRA_ROM },
111 	{ 0xf800, 0xffff, MRA_ROM },		/* for the reset / interrupt vectors */
112 	{ -1 }	/* end of table */
113 };
114 
115 static struct MemoryWriteAddress writemem[] =
116 {
117 	{ 0x0000, 0x03ff, MWA_RAM },
118 	{ 0x0400, 0x07bf, videoram_w, &videoram, &videoram_size },
119 	{ 0x07c0, 0x07ff, MWA_RAM, &spriteram },
120 	{ 0x1000, 0x100f, pokey1_w },
121 	{ 0x1800, 0x1800, MWA_NOP },        /* IRQ Acknowledge */
122 	{ 0x1c00, 0x1c02, coin_counter_w },
123 	{ 0x1c03, 0x1c06, warlord_led_w },	/* 4 start lights */
124 	{ 0x4000, 0x4000, watchdog_reset_w },
125 	{ -1 }	/* end of table */
126 };
127 
128 
129 INPUT_PORTS_START( warlord )
130 	PORT_START	/* IN0 */
131 	PORT_BIT ( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED )
132 	PORT_DIPNAME(0x10, 0x00, "Diag Step" )  /* Not referenced */
133 	PORT_DIPSETTING (   0x00, DEF_STR( Off ) )
134 	PORT_DIPSETTING (   0x10, DEF_STR( On ) )
135 	PORT_SERVICE( 0x20, IP_ACTIVE_LOW )
136 	PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK )
137 	PORT_DIPNAME(0x80, 0x00, DEF_STR( Cabinet ) )
138 	PORT_DIPSETTING (   0x80, DEF_STR( Upright ) )
139 	PORT_DIPSETTING (   0x00, DEF_STR( Cocktail ) )
140 
141 	PORT_START	/* IN1 */
142 	PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
143 	PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
144 	PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
145 	PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
146 	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_TILT )
147 	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
148 	PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
149 	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN3 )
150 
151 	PORT_START	/* IN2 */
152 	PORT_DIPNAME(0x03, 0x00, "Language" )
153 	PORT_DIPSETTING (   0x00, "English" )
154 	PORT_DIPSETTING (   0x01, "French" )
155 	PORT_DIPSETTING (   0x02, "Spanish" )
156 	PORT_DIPSETTING (   0x03, "German" )
157 	PORT_DIPNAME(0x04, 0x00, "Music" )
158 	PORT_DIPSETTING (   0x00, "End of game" )
159 	PORT_DIPSETTING (   0x04, "High score only" )
160 	PORT_BIT ( 0xc8, IP_ACTIVE_HIGH, IPT_UNUSED )
161 	PORT_DIPNAME(0x30, 0x00, "Credits" )
162 	PORT_DIPSETTING (   0x00, "1p/2p = 1 credit" )
163 	PORT_DIPSETTING (   0x10, "1p = 1, 2p = 2" )
164 	PORT_DIPSETTING (   0x20, "1p/2p = 2 credits" )
165 
166 	PORT_START	/* IN3 */
167 	PORT_DIPNAME(0x03, 0x02, DEF_STR( Coinage ) )
168 	PORT_DIPSETTING (   0x03, DEF_STR( 2C_1C ) )
169 	PORT_DIPSETTING (   0x02, DEF_STR( 1C_1C ) )
170 	PORT_DIPSETTING (   0x01, DEF_STR( 1C_2C ) )
171 	PORT_DIPSETTING (   0x00, DEF_STR( Free_Play ) )
172 	PORT_DIPNAME(0x0c, 0x00, "Right Coin" )
173 	PORT_DIPSETTING (   0x00, "*1" )
174 	PORT_DIPSETTING (   0x04, "*4" )
175 	PORT_DIPSETTING (   0x08, "*5" )
176 	PORT_DIPSETTING (   0x0c, "*6" )
177 	PORT_DIPNAME(0x10, 0x00, "Left Coin" )
178 	PORT_DIPSETTING (   0x00, "*1" )
179 	PORT_DIPSETTING (   0x10, "*2" )
180 	PORT_DIPNAME(0xe0, 0x00, "Bonus Coins" )
181 	PORT_DIPSETTING (   0x00, "None" )
182 	PORT_DIPSETTING (   0x20, "3 credits/2 coins" )
183 	PORT_DIPSETTING (   0x40, "5 credits/4 coins" )
184 	PORT_DIPSETTING (   0x60, "6 credits/4 coins" )
185 	PORT_DIPSETTING (   0x80, "6 credits/5 coins" )
186 
187     /* IN4-7 fake to control player paddles */
188 	PORT_START
189 	PORT_ANALOG( 0xff, 0x80, IPT_PADDLE | IPF_PLAYER1, 50, 10, 0x1d, 0xcb )
190 
191 	PORT_START
192 	PORT_ANALOG( 0xff, 0x80, IPT_PADDLE | IPF_PLAYER2, 50, 10, 0x1d, 0xcb )
193 
194 	PORT_START
195 	PORT_ANALOG( 0xff, 0x80, IPT_PADDLE | IPF_PLAYER3, 50, 10, 0x1d, 0xcb )
196 
197 	PORT_START
198 	PORT_ANALOG( 0xff, 0x80, IPT_PADDLE | IPF_PLAYER4, 50, 10, 0x1d, 0xcb )
199 INPUT_PORTS_END
200 
201 
202 static struct GfxLayout charlayout =
203 {
204 	8,8,	/* 8*8 characters */
205 	64,	    /* 64  characters */
206 	2,	    /* 2 bits per pixel */
207 	{ 128*8*8, 0 },	/* bitplane separation */
208 	{ 7, 6, 5, 4, 3, 2, 1, 0 },
209 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
210 	8*8	/* every char takes 8 consecutive bytes */
211 };
212 
213 
214 
215 static struct GfxDecodeInfo gfxdecodeinfo[] =
216 {
217 	{ REGION_GFX1, 0x0000, &charlayout,   0,   8 },
218 	{ REGION_GFX1, 0x0200, &charlayout,   8*4, 8 },
219 	{ -1 } /* end of array */
220 };
221 
222 
223 
224 static struct POKEYinterface pokey_interface =
225 {
226 	1,	/* 1 chip */
227 	12096000/8,	/* 1.512 MHz */
228 	{ 100 },
229 	/* The 8 pot handlers */
230 	{ input_port_4_r },
231 	{ input_port_5_r },
232 	{ input_port_6_r },
233 	{ input_port_7_r },
234 	{ 0 },
235 	{ 0 },
236 	{ 0 },
237 	{ 0 },
238 	/* The allpot handler */
239 	{ 0 },
240 };
241 
242 
243 
244 static struct MachineDriver machine_driver_warlord =
245 {
246 	/* basic machine hardware */
247 	{
248 		{
249 			CPU_M6502,
250 			12096000/16, /* 756 kHz */
251 			readmem,writemem,0,0,
252 			interrupt,4
253 		}
254 	},
255 	60, DEFAULT_REAL_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
256 	1,
257 	0,
258 
259 	/* video hardware */
260 	32*8, 32*8, { 0*8, 32*8-1, 0*8, 30*8-1 },
261 	gfxdecodeinfo,
262 	128, 8*4+8*4,
263 	warlord_vh_convert_color_prom,
264 
265 	VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY|VIDEO_MODIFIES_PALETTE,
266 	0,
267 	generic_vh_start,
268 	generic_vh_stop,
269 	warlord_vh_screenrefresh,
270 
271 	/* sound hardware */
272 	0,0,0,0,
273 	{
274 		{
275 			SOUND_POKEY,
276 			&pokey_interface
277 		}
278 	}
279 };
280 
281 
282 
283 /***************************************************************************
284 
285   Game driver(s)
286 
287 ***************************************************************************/
288 
289 ROM_START( warlord )
290 	ROM_REGION( 0x10000, REGION_CPU1 )	/* 64k for code */
291 	ROM_LOAD( "037154.1m",    0x5000, 0x0800, 0x18006c87 )
292 	ROM_LOAD( "037153.1k",    0x5800, 0x0800, 0x67758f4c )
293 	ROM_LOAD( "037158.1j",    0x6000, 0x0800, 0x1f043a86 )
294 	ROM_LOAD( "037157.1h",    0x6800, 0x0800, 0x1a639100 )
295 	ROM_LOAD( "037156.1e",    0x7000, 0x0800, 0x534f34b4 )
296 	ROM_LOAD( "037155.1d",    0x7800, 0x0800, 0x23b94210 )
297 	ROM_RELOAD(            0xf800, 0x0800 )	/* for the reset and interrupt vectors */
298 
299 	ROM_REGION( 0x0800, REGION_GFX1 | REGIONFLAG_DISPOSE )
300 	ROM_LOAD( "037159.6e",    0x0000, 0x0800, 0xff979a08 )
301 
302 	ROM_REGION( 0x0100, REGION_PROMS )
303 	/* Only the first 0x80 bytes are used by the hardware. A7 is grounded. */
304 	/* Bytes 0x00-0x3f are used fore the color cocktail version. */
305 	/* Bytes 0x40-0x7f are for the upright version of the cabinet with a */
306 	/* mirror and painted background. */
307 	ROM_LOAD( "warlord.clr",  0x0000, 0x0100, 0xa2c5c277 )
308 ROM_END
309 
310 
311 
312 GAME( 1980, warlord, 0, warlord, warlord, 0, ROT0, "Atari", "Warlords" )
313