1 #include "../vidhrdw/arabian.c"
2
3 /***************************************************************************
4
5 Arabian memory map (preliminary)
6
7 0000-1fff ROM 0
8 2000-3fff ROM 1
9 4000-5fff ROM 2
10 6000-7fff ROM 3
11 8000-bfff VIDEO RAM
12
13 d000-dfff RAM
14 e000-e100 CRT controller ? blitter ?
15
16 memory mapped ports:
17 read:
18 d7f0 - IN 0
19 d7f1 - IN 1
20 d7f2 - IN 2
21 d7f3 - IN 3
22 d7f4 - IN 4
23 d7f5 - IN 5
24 d7f6 - clock HI ?
25 d7f7 - clock set ?
26 d7f8 - clock LO ?
27
28 c000 - DSW 0
29 c200 - DSW 1
30
31 DSW 0
32 bit 7 = ?
33 bit 6 = ?
34 bit 5 = ?
35 bit 4 = ?
36 bit 3 = ?
37 bit 2 = 1 - test mode
38 bit 1 = COIN 2
39 bit 0 = COIN 1
40
41 DSW 1
42 bit 7 - \
43 bit 6 - - coins per credit (ALL=1 free play)
44 bit 5 - -
45 bit 4 - /
46 bit 3 - carry bowls / don't carry bowls to next level (0 DON'T CARRY)
47 bit 2 - PIC NORMAL or FLIPPED (0 NORMAL)
48 bit 1 - COCKTAIL or UPRIGHT (0 COCKTAIL)
49 bit 0 - LIVES 0=3 lives 1=5 lives
50
51 write:
52 c800 - AY-3-8910 control
53 ca00 - AY-3-8910 write
54
55 ON AY PORTS there are two things :
56
57 port 0x0e (write only) to do ...
58
59 port 0x0f (write only) controls (active LO):
60 BIT 0 - coin counter 1
61 BIT 1 - coin counter 2
62 BIT 2 -
63 BIT 3 -
64 BIT 4 - 0-read RAM 1-read switches(ports)
65 BIT 5 -
66 BIT 6 -
67 BIT 7 -
68
69 interrupts:
70 standart IM 1 interrupt mode (rst #38 every vblank)
71
72 ***************************************************************************/
73
74 #include "driver.h"
75 #include "vidhrdw/generic.h"
76
77
78
79 void arabian_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
80 int arabian_vh_start(void);
81 void arabian_vh_stop(void);
82 void arabian_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
83 WRITE_HANDLER( arabian_blitter_w );
84 WRITE_HANDLER( arabian_videoram_w );
85
86
87 static UINT8 arabian_clock=0;
88 static UINT8 portB=0;
89
90
arabian_interrupt(void)91 static int arabian_interrupt(void)
92 {
93 arabian_clock++;
94 return interrupt();
95 }
96
97
WRITE_HANDLER(arabian_portB_w)98 static WRITE_HANDLER( arabian_portB_w )
99 {
100 int pc;
101 static int last;
102
103 portB = data;
104
105 pc = cpu_get_pc();
106 if ((pc == 0x0a7a) || (pc == 0x002a)) pc = cpu_geturnpc();
107 //if ((data & 0xec) != last) logerror("Port B written %02X PC=%04X\n",data,pc);
108 last = data & 0xec;
109
110 coin_counter_w(0, ~data & 0x01);
111 coin_counter_w(1, ~data & 0x02);
112 }
113
READ_HANDLER(arabian_input_port_r)114 static READ_HANDLER( arabian_input_port_r )
115 {
116 int pom;
117
118
119 if (portB & 0x10) /* if 1 read the switches */
120 {
121 switch(offset)
122 {
123 case 0: pom = readinputport(2); break;
124 case 1: pom = readinputport(3); break;
125 case 2: pom = readinputport(4); break;
126 case 3: pom = readinputport(5); break;
127 case 4: pom = readinputport(6); break;
128 case 5: pom = readinputport(7); break;
129 case 6: pom = arabian_clock >> 4; break;
130 case 8: pom = arabian_clock & 0x0f; break;
131 default:
132 //logerror("Input Port %04X read. PC=%04X\n", offset+0xd7f0, cpu_get_pc());
133 pom = 0;
134 break;
135 }
136 }
137 else /* if bit 4 of AY port 0f==0 then read RAM memory instead of switches */
138 {
139 unsigned char *RAM = memory_region(REGION_CPU1);
140 pom = RAM[ 0xd7f0 + offset ];
141 }
142
143 return pom;
144 }
145
146
147 static struct MemoryReadAddress readmem[] =
148 {
149 { 0x0000, 0x7fff, MRA_ROM },
150 { 0xc000, 0xc000, input_port_0_r },
151 { 0xc200, 0xc200, input_port_1_r },
152 { 0xd000, 0xd7ef, MRA_RAM },
153 { 0xd7f0, 0xd7ff, arabian_input_port_r },
154 { -1 } /* end of table */
155 };
156
157 static struct MemoryWriteAddress writemem[] =
158 {
159 { 0x0000, 0x7fff, MWA_ROM },
160 { 0x8000, 0xbfff, arabian_videoram_w, &videoram },
161 { 0xd000, 0xd7ff, MWA_RAM },
162 { 0xe000, 0xe07f, arabian_blitter_w, &spriteram },
163 { -1 } /* end of table */
164 };
165
166
167
168 static struct IOWritePort writeport[] =
169 {
170 { 0xc800, 0xc800, AY8910_control_port_0_w },
171 { 0xca00, 0xca00, AY8910_write_port_0_w },
172 { -1 } /* end of table */
173 };
174
175
176
177 INPUT_PORTS_START( arabian )
178 PORT_START /* IN0 */
179 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
180 PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
181 PORT_SERVICE( 0x04, IP_ACTIVE_HIGH )
182 PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
183 PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
184 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
185 PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
186 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
187
188 PORT_START /* DSW1 */
189 PORT_DIPNAME( 0x01, 0x00, DEF_STR( Lives ) )
190 PORT_DIPSETTING( 0x00, "3" )
191 PORT_DIPSETTING( 0x01, "5" )
192 PORT_DIPNAME( 0x02, 0x02, DEF_STR( Cabinet ) )
193 PORT_DIPSETTING( 0x02, DEF_STR( Upright ) )
194 PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) )
195 PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) )
196 PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
197 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
198 PORT_DIPNAME( 0x08, 0x00, "Carry Bowls to Next Life" )
199 PORT_DIPSETTING( 0x08, DEF_STR( No ) )
200 PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
201 PORT_DIPNAME( 0xf0, 0x00, DEF_STR( Coinage ) )
202 PORT_DIPSETTING( 0x10, "A 2/1 B 2/1" )
203 PORT_DIPSETTING( 0x20, "A 2/1 B 1/3" )
204 PORT_DIPSETTING( 0x00, "A 1/1 B 1/1" )
205 PORT_DIPSETTING( 0x30, "A 1/1 B 1/2" )
206 PORT_DIPSETTING( 0x40, "A 1/1 B 1/3" )
207 PORT_DIPSETTING( 0x50, "A 1/1 B 1/4" )
208 PORT_DIPSETTING( 0x60, "A 1/1 B 1/5" )
209 PORT_DIPSETTING( 0x70, "A 1/1 B 1/6" )
210 PORT_DIPSETTING( 0x80, "A 1/2 B 1/2" )
211 PORT_DIPSETTING( 0x90, "A 1/2 B 1/4" )
212 PORT_DIPSETTING( 0xa0, "A 1/2 B 1/6" )
213 PORT_DIPSETTING( 0xb0, "A 1/2 B 1/10" )
214 PORT_DIPSETTING( 0xc0, "A 1/2 B 1/11" )
215 PORT_DIPSETTING( 0xd0, "A 1/2 B 1/12" )
216 PORT_DIPSETTING( 0xf0, DEF_STR( Free_Play ) )
217 /* 0xe0 gives A 1/2 B 1/6 */
218
219 PORT_START /* IN1 */
220 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
221 PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
222 PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 )
223 PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN3 )
224 PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
225 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
226 PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
227 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
228
229 PORT_START /* IN2 */
230 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
231 PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
232 PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
233 PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
234 PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
235 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
236 PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
237 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
238
239 PORT_START /* IN3 */
240 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
241 PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
242 PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
243 PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
244 PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
245 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
246 PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
247 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
248
249 PORT_START /* IN4 */
250 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
251 PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
252 PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
253 PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
254 PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
255 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
256 PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
257 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
258
259 PORT_START /* IN5 */
260 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
261 PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
262 PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
263 PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
264 PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
265 PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
266 PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
267 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
268
269 PORT_START /* DSW2 */
270 PORT_DIPNAME( 0x01, 0x00, "Coin Chutes" )
271 PORT_DIPSETTING( 0x01, "1" )
272 PORT_DIPSETTING( 0x00, "2" )
273 PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
274 PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
275 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
276 PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Bonus_Life ) )
277 PORT_DIPSETTING( 0x04, "20000" )
278 PORT_DIPSETTING( 0x08, "40000" )
279 PORT_DIPSETTING( 0x0c, "20000 50000 +100K" )
280 PORT_DIPSETTING( 0x00, "None" )
281 PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unused ) )
282 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
283 PORT_DIPSETTING( 0x10, DEF_STR( On ) )
284 PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) )
285 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
286 PORT_DIPSETTING( 0x20, DEF_STR( On ) )
287 PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )
288 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
289 PORT_DIPSETTING( 0x40, DEF_STR( On ) )
290 PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
291 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
292 PORT_DIPSETTING( 0x80, DEF_STR( On ) )
293 INPUT_PORTS_END
294
295
296
297
298 static struct AY8910interface ay8910_interface =
299 {
300 1, /* 1 chip */
301 1500000, /* 1.5 MHz?????? */
302 { 50 },
303 { 0 },
304 { 0 },
305 { 0 },
306 { arabian_portB_w }
307 };
308
309
310
311 static struct MachineDriver machine_driver_arabian =
312 {
313 /* basic machine hardware */
314 {
315 {
316 CPU_Z80 | CPU_16BIT_PORT,
317 4000000, /* 4 Mhz */
318 readmem,writemem,0,writeport,
319 arabian_interrupt,1
320 }
321 },
322 60, DEFAULT_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
323 1, /* single CPU, no need for interleaving */
324 0,
325
326 /* video hardware */
327 256, 256, { 0, 255, 11, 242 },
328 0,
329 32,32,
330 arabian_vh_convert_color_prom,
331
332 VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,
333 0,
334 arabian_vh_start,
335 arabian_vh_stop,
336 arabian_vh_screenrefresh,
337
338 /* sound hardware */
339 0,0,0,0,
340 {
341 {
342 SOUND_AY8910,
343 &ay8910_interface
344 }
345 }
346 };
347
348
349
350 /***************************************************************************
351
352 Game driver(s)
353
354 ***************************************************************************/
355
356 ROM_START( arabian )
357 ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
358 ROM_LOAD( "ic1rev2.87", 0x0000, 0x2000, 0x5e1c98b8 )
359 ROM_LOAD( "ic2rev2.88", 0x2000, 0x2000, 0x092f587e )
360 ROM_LOAD( "ic3rev2.89", 0x4000, 0x2000, 0x15145f23 )
361 ROM_LOAD( "ic4rev2.90", 0x6000, 0x2000, 0x32b77b44 )
362
363 ROM_REGION( 0x10000, REGION_GFX1 ) /* graphics roms */
364 ROM_LOAD( "ic84.91", 0x0000, 0x2000, 0xc4637822 ) /* because of very rare way */
365 ROM_LOAD( "ic85.92", 0x2000, 0x2000, 0xf7c6866d ) /* CRT controller uses these roms */
366 ROM_LOAD( "ic86.93", 0x4000, 0x2000, 0x71acd48d ) /* there's no way, but to decode */
367 ROM_LOAD( "ic87.94", 0x6000, 0x2000, 0x82160b9a ) /* it at runtime - which is SLOW */
368 ROM_END
369
370 ROM_START( arabiana )
371 ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
372 ROM_LOAD( "ic1.87", 0x0000, 0x2000, 0x51e9a6b1 )
373 ROM_LOAD( "ic2.88", 0x2000, 0x2000, 0x1cdcc1ab )
374 ROM_LOAD( "ic3.89", 0x4000, 0x2000, 0xb7b7faa0 )
375 ROM_LOAD( "ic4.90", 0x6000, 0x2000, 0xdbded961 )
376
377 ROM_REGION( 0x10000, REGION_GFX1 ) /* graphics roms */
378 ROM_LOAD( "ic84.91", 0x0000, 0x2000, 0xc4637822 ) /* because of very rare way */
379 ROM_LOAD( "ic85.92", 0x2000, 0x2000, 0xf7c6866d ) /* CRT controller uses these roms */
380 ROM_LOAD( "ic86.93", 0x4000, 0x2000, 0x71acd48d ) /* there's no way, but to decode */
381 ROM_LOAD( "ic87.94", 0x6000, 0x2000, 0x82160b9a ) /* it at runtime - which is SLOW */
382 ROM_END
383
384
385
386 GAMEX( 1983, arabian, 0, arabian, arabian, 0, ROT270, "Sun Electronics", "Arabian", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
387 GAMEX( 1983, arabiana, arabian, arabian, arabian, 0, ROT270, "[Sun Electronics] (Atari license)", "Arabian (Atari)", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
388