1 /* Hanaroku */
2
3 /*
4 TODO:
5 - colour decoding might not be perfect
6 - Background color should be green, but current handling might be wrong.
7 - some unknown sprite attributes, sprite flipping in flip screen needed
8 - don't know what to do when the jackpot is displayed (missing controls ?)
9 - according to the board pic, there should be one more 4-switches dip
10 switch bank, and probably some NVRAM because there's a battery.
11 */
12
13 #include "driver.h"
14 #include "vidhrdw/generic.h"
15
16 /* vidhrdw */
17
18 UINT8 *hanaroku_spriteram1;
19 UINT8 *hanaroku_spriteram2;
20 UINT8 *hanaroku_spriteram3;
21
22
PALETTE_INIT(hanaroku)23 PALETTE_INIT( hanaroku )
24 {
25 int i;
26 int r,g,b;
27
28 for (i = 0; i < 0x200; i++)
29 {
30 b = (color_prom[i*2+1] & 0x1f);
31 g = ((color_prom[i*2+1] & 0xe0) | ( (color_prom[i*2+0]& 0x03) <<8) ) >> 5;
32 r = (color_prom[i*2+0]&0x7c) >> 2;
33
34 palette_set_color(i,r<<3,g<<3,b<<3);
35 }
36 }
37
38
VIDEO_START(hanaroku)39 VIDEO_START(hanaroku)
40 {
41 return 0;
42 }
43
hanaroku_draw_sprites(struct mame_bitmap * bitmap,const struct rectangle * cliprect)44 static void hanaroku_draw_sprites( struct mame_bitmap *bitmap, const struct rectangle *cliprect )
45 {
46 int i;
47
48 for (i = 511; i >= 0; i--)
49 {
50 int code = hanaroku_spriteram1[i] | (hanaroku_spriteram2[i] << 8);
51 int color = (hanaroku_spriteram2[i + 0x200] & 0xf8) >> 3;
52 int flipx = 0;
53 int flipy = 0;
54 int sx = hanaroku_spriteram1[i + 0x200] | ((hanaroku_spriteram2[i + 0x200] & 0x07) << 8);
55 int sy = 242 - hanaroku_spriteram3[i];
56
57 if (flip_screen)
58 {
59 sy = 242 - sy;
60 flipx = !flipx;
61 flipy = !flipy;
62 }
63
64 drawgfx(bitmap, Machine->gfx[0], code, color, flipx, flipy,
65 sx, sy, cliprect, TRANSPARENCY_PEN, 0);
66 }
67 }
68
VIDEO_UPDATE(hanaroku)69 VIDEO_UPDATE(hanaroku)
70 {
71 fillbitmap(bitmap, Machine->pens[0x1f0], cliprect); // ???
72 hanaroku_draw_sprites(bitmap, cliprect);
73 }
74
WRITE_HANDLER(hanaroku_out_0_w)75 static WRITE_HANDLER( hanaroku_out_0_w )
76 {
77 /*
78 bit description
79
80 0 meter1 (coin1)
81 1 meter2 (coin2)
82 2 meter3 (1/2 d-up)
83 3 meter4
84 4 call out (meter)
85 5 lockout (key)
86 6 hopper2 (play)
87 7 meter5 (start)
88 */
89
90 coin_counter_w(0, data & 0x01);
91 coin_counter_w(1, data & 0x02);
92 coin_counter_w(2, data & 0x04);
93 coin_counter_w(3, data & 0x08);
94 coin_counter_w(4, data & 0x80);
95 }
96
WRITE_HANDLER(hanaroku_out_1_w)97 static WRITE_HANDLER( hanaroku_out_1_w )
98 {
99 /*
100 bit description
101
102 0 hopper1 (data clear)
103 1 dis dat
104 2 dis clk
105 3 pay out
106 4 ext in 1
107 5 ext in 2
108 6 ?
109 7 ?
110 */
111 }
112
WRITE_HANDLER(hanaroku_out_2_w)113 static WRITE_HANDLER( hanaroku_out_2_w )
114 {
115 // unused
116 }
117
118 /* main cpu */
119
MEMORY_READ_START(readmem)120 static MEMORY_READ_START( readmem )
121 { 0x0000, 0x7fff, MRA_ROM },
122 { 0x8000, 0x87ff, MRA_RAM },
123 { 0x9000, 0x97ff, MRA_RAM },
124 { 0xa000, 0xa1ff, MRA_RAM },
125 { 0xc000, 0xc3ff, MRA_RAM },
126 { 0xc400, 0xc4ff, MRA_RAM },
127 { 0xd000, 0xd000, AY8910_read_port_0_r },
128 { 0xe000, 0xe000, input_port_0_r },
129 { 0xe001, 0xe001, input_port_1_r },
130 { 0xe002, 0xe002, input_port_2_r },
131 { 0xe004, 0xe004, input_port_5_r },
132 MEMORY_END
133
134 static MEMORY_WRITE_START( writemem )
135 { 0x0000, 0x7fff, MWA_ROM },
136 { 0x8000, 0x87ff, MWA_RAM, &hanaroku_spriteram1 },
137 { 0x9000, 0x97ff, MWA_RAM, &hanaroku_spriteram2 },
138 { 0xa000, 0xa1ff, MWA_RAM, &hanaroku_spriteram3 },
139 { 0xa200, 0xa2ff, MWA_NOP }, // ??? written once during P.O.S.T.
140 { 0xa300, 0xa304, MWA_NOP }, // ???
141 { 0xc000, 0xc3ff, MWA_RAM }, // main ram
142 { 0xc400, 0xc4ff, MWA_RAM }, // ???
143 { 0xb000, 0xb000, MWA_NOP }, // ??? always 0x40
144 { 0xd000, 0xd000, AY8910_control_port_0_w },
145 { 0xd001, 0xd001, AY8910_write_port_0_w },
146 { 0xe000, 0xe000, hanaroku_out_0_w },
147 { 0xe002, 0xe002, hanaroku_out_1_w },
148 { 0xe004, 0xe004, hanaroku_out_2_w },
149 MEMORY_END
150
151
152 INPUT_PORTS_START( hanaroku )
153 PORT_START // IN0 (0xe000)
154 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) // adds n credits depending on "Coinage" Dip Switch
155 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) // adds 5 credits
156 PORT_BITX( 0x04, IP_ACTIVE_LOW, IPT_SERVICE, "1/2 D-Up", KEYCODE_H, IP_JOY_DEFAULT )
157 PORT_BITX( 0x08, IP_ACTIVE_LOW, IPT_SERVICE, "Reset", KEYCODE_R, IP_JOY_DEFAULT )
158 PORT_BITX( 0x10, IP_ACTIVE_LOW, IPT_SERVICE, "Meter", KEYCODE_M, IP_JOY_DEFAULT )
159 PORT_BITX( 0x20, IP_ACTIVE_LOW, IPT_SERVICE, "Key", KEYCODE_K, IP_JOY_DEFAULT )
160 PORT_BITX( 0x40, IP_ACTIVE_LOW, IPT_START2, "Play", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
161 PORT_BITX( 0x80, IP_ACTIVE_LOW, IPT_START1, "Start", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
162
163 PORT_START // IN1 (0xe001)
164 PORT_BITX( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1, "Card 1", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
165 PORT_BITX( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2, "Card 2", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
166 PORT_BITX( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3, "Card 3", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
167 PORT_BITX( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4, "Card 4", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
168 PORT_BITX( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5, "Card 5", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
169 PORT_BITX( 0x20, IP_ACTIVE_LOW, IPT_BUTTON6, "Card 6", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
170 PORT_BITX( 0x40, IP_ACTIVE_LOW, IPT_BUTTON7, DEF_STR( Yes ), KEYCODE_Y, IP_JOY_DEFAULT )
171 PORT_BITX( 0x80, IP_ACTIVE_LOW, IPT_BUTTON8, DEF_STR( No ), KEYCODE_N, IP_JOY_DEFAULT )
172
173 PORT_START // IN2 (0xe002)
174 PORT_BITX( 0x01, IP_ACTIVE_LOW, IPT_SERVICE, "Data Clear", KEYCODE_D, IP_JOY_DEFAULT )
175 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT )
176 PORT_BITX( 0x04, IP_ACTIVE_LOW, IPT_BUTTON9, "Medal In", KEYCODE_I, IP_JOY_DEFAULT )
177 PORT_BITX( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10, "Pay Out", KEYCODE_O, IP_JOY_DEFAULT )
178 PORT_BITX( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1, "Ext In 1", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
179 PORT_BITX( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2, "Ext In 2", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
180 PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
181
182 PORT_START // DSW1 (0xd000 - Port A)
183 PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
184
185 PORT_START // DSW2 (0xd000 - Port B)
186 PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
187
188 PORT_START // DSW3 (0xe004)
189 PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) // Stored at 0xc028
190 PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
191 PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
192 PORT_DIPSETTING( 0x01, DEF_STR( 1C_5C ) )
193 PORT_DIPSETTING( 0x00, "1 Coin/10 Credits" )
194 PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) ) // Stored at 0xc03a
195 PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
196 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
197 PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) // Stored at 0xc078
198 PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
199 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
200 PORT_DIPNAME( 0x30, 0x20, "Game Mode" ) // Stored at 0xc02e
201 PORT_DIPSETTING( 0x30, "Mode 0" ) // Collect OFF
202 PORT_DIPSETTING( 0x20, "Mode 1" ) // Collect ON (code at 0x36ea)
203 PORT_DIPSETTING( 0x10, "Mode 2" ) // Collect ON (code at 0x3728)
204 PORT_DIPSETTING( 0x00, "Mode 3" ) // No credit counter
205 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
206 PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
207 INPUT_PORTS_END
208
209
210 static struct GfxLayout hanaroku_charlayout =
211 {
212 16,16,
213 RGN_FRAC(1,4),
214 4,
215 { RGN_FRAC(3,4),RGN_FRAC(2,4),RGN_FRAC(1,4),RGN_FRAC(0,4) },
216 { 0,1,2,3,4,5,6,7,
217 64,65,66,67,68,69,70,71},
218 { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
219 128+0*8,128+1*8,128+2*8,128+3*8,128+4*8,128+5*8,128+6*8,128+7*8 },
220 16*16
221 };
222
223
224
225 static struct GfxDecodeInfo gfxdecodeinfo[] =
226 {
227 { REGION_GFX1, 0, &hanaroku_charlayout, 0, 32 },
228
229 { -1 } /* end of array */
230 };
231
232
233 static struct AY8910interface ay8910_interface =
234 {
235 1, /* 1 chip */
236 1500000, /* 1.5 MHz ???? */
237 { 50 },
238 { input_port_3_r },
239 { input_port_4_r },
240 { 0 },
241 { 0 }
242 };
243
244
245 static MACHINE_DRIVER_START( hanaroku )
246 MDRV_CPU_ADD(Z80,6000000) /* ? MHz */
247 MDRV_CPU_MEMORY(readmem,writemem)
248 MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
249
250 MDRV_FRAMES_PER_SECOND(60)
251 MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
252
253 /* video hardware */
254 MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER )
255 MDRV_SCREEN_SIZE(64*8, 64*8)
256 MDRV_VISIBLE_AREA(0, 48*8-1, 2*8, 30*8-1)
257 MDRV_GFXDECODE(gfxdecodeinfo)
258 MDRV_PALETTE_LENGTH(0x200)
259
260 MDRV_PALETTE_INIT(hanaroku)
261 MDRV_VIDEO_START(hanaroku)
262 MDRV_VIDEO_UPDATE(hanaroku)
263
264 /* sound hardware */
265 MDRV_SOUND_ADD(AY8910, ay8910_interface)
266 MACHINE_DRIVER_END
267
268
269 ROM_START( hanaroku )
270 ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* z80 code */
271 ROM_LOAD( "zc5_1a.u02", 0x00000, 0x08000, CRC(9e3b62ce) SHA1(81aee570b67950c21ab3c8f9235dd383529b34d5) )
272
273 ROM_REGION( 0x20000, REGION_GFX1, 0 ) /* tiles */
274 ROM_LOAD( "zc0_002.u14", 0x00000, 0x08000, CRC(76adab7f) SHA1(6efbe52ae4a1d15fe93bd05058546bf146a64154) )
275 ROM_LOAD( "zc0_003.u15", 0x08000, 0x08000, CRC(c208e64b) SHA1(0bc226c39331bb2e1d4d8f756199ceec85c28f28) )
276 ROM_LOAD( "zc0_004.u16", 0x10000, 0x08000, CRC(e8a46ee4) SHA1(09cac230c1c49cb282f540b1608ad33b1cc1a943) )
277 ROM_LOAD( "zc0_005.u17", 0x18000, 0x08000, CRC(7ad160a5) SHA1(c897fbe4a7c2a2f352333131dfd1a76e176f0ed8) )
278
279 ROM_REGION( 0x0400, REGION_PROMS, 0 ) /* colour */
280 ROM_LOAD16_BYTE( "zc0_006.u21", 0x0000, 0x0200, CRC(8e8fbc30) SHA1(7075521bbd790c46c58d9e408b0d7d6a42ed00bc) )
281 ROM_LOAD16_BYTE( "zc0_007.u22", 0x0001, 0x0200, CRC(67225de1) SHA1(98322e71d93d247a67fb4e52edad6c6c32a603d8) )
282 ROM_END
283
284
285 GAMEX( 1988, hanaroku, 0, hanaroku, hanaroku, 0, ROT0, "Alba", "Hanaroku", GAME_NO_COCKTAIL | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_COLORS )
286