~ubuntu-branches/ubuntu/raring/mame/raring-proposed

« back to all changes in this revision

Viewing changes to mess/src/mame/drivers/pokechmp.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Poke Champ */
2
 
 
3
 
/* This is a Korean hack of Data East's Pocket Gal
4
 
 
5
 
   It uses RAM for Palette instead of PROMs
6
 
   Samples are played by OKIM6295
7
 
   Different Banking
8
 
   More Tiles, 8bpp
9
 
   Sprites 4bpp? instead of 2bpp
10
 
   Many code changes
11
 
 
12
 
   Todo:
13
 
 
14
 
   Fix colours
15
 
   Fix sound banking
16
 
   Verify frequencies etc.
17
 
 
18
 
*/
19
 
 
20
 
/* README
21
 
 
22
 
-The ROMs are labeled as "Unico".
23
 
-The CPUs and some other chips are labeled as "SEA HUNTER".
24
 
-The chips with the "SEA HUNTER" label all have their
25
 
 surfaces scratched out, so I don't know what they are
26
 
 (all 40 -pin chips).
27
 
 
28
 
ROMs 1 to 4 = GFX?
29
 
ROMs 5 to 8 = Program?
30
 
ROM 9 = Sound CPU code?
31
 
ROM 10 = Sound samples?
32
 
ROM 11 = Main CPU code?
33
 
 
34
 
-There's a "copyright 1987 data east corp.all rights reserved"
35
 
 string inside ROM 11
36
 
 
37
 
-Sound = Yamaha YM2203C + Y3014B
38
 
 
39
 
-Also, there are some GALs on the board (not dumped) a
40
 
 8-dips bank and two oscilators (4 MHz and 24 MHz, both near
41
 
 the sound parts).
42
 
 
43
 
ClawGrip, Jul 2006
44
 
 
45
 
*/
46
 
 
47
 
#include "emu.h"
48
 
#include "cpu/m6502/m6502.h"
49
 
#include "sound/2203intf.h"
50
 
#include "sound/3812intf.h"
51
 
#include "sound/okim6295.h"
52
 
#include "includes/pokechmp.h"
53
 
 
54
 
static WRITE8_HANDLER( pokechmp_bank_w )
55
 
{
56
 
        UINT8 *RAM = space->machine().region("maincpu")->base();
57
 
 
58
 
        if (data == 0x00)
59
 
        {
60
 
                memory_set_bankptr(space->machine(), "bank1",&RAM[0x10000]);
61
 
                memory_set_bankptr(space->machine(), "bank2",&RAM[0x12000]);
62
 
        }
63
 
        if (data == 0x01)
64
 
        {
65
 
                memory_set_bankptr(space->machine(), "bank1",&RAM[0x14000]);
66
 
                memory_set_bankptr(space->machine(), "bank2",&RAM[0x16000]);
67
 
        }
68
 
        if (data == 0x02)
69
 
        {
70
 
                memory_set_bankptr(space->machine(), "bank1",&RAM[0x20000]);
71
 
                memory_set_bankptr(space->machine(), "bank2",&RAM[0x22000]);
72
 
        }
73
 
 
74
 
        if (data == 0x03)
75
 
        {
76
 
                memory_set_bankptr(space->machine(), "bank1",&RAM[0x04000]);
77
 
                memory_set_bankptr(space->machine(), "bank2",&RAM[0x06000]);
78
 
        }
79
 
}
80
 
 
81
 
#ifdef UNUSED_FUNCTION
82
 
static WRITE8_HANDLER( pokechmp_sound_bank_w )
83
 
{
84
 
        memory_set_bank(space->machine(), "bank3", (data >> 2) & 1);
85
 
}
86
 
#endif
87
 
 
88
 
static WRITE8_HANDLER( pokechmp_sound_w )
89
 
{
90
 
        soundlatch_w(space, 0, data);
91
 
        cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
92
 
}
93
 
 
94
 
 
95
 
INLINE void pokechmp_set_color(running_machine &machine, pen_t color, int rshift, int gshift, int bshift, UINT16 data)
96
 
{
97
 
        palette_set_color_rgb(machine, color, pal5bit(data >> rshift), pal5bit(data >> gshift), pal5bit(data >> bshift));
98
 
}
99
 
 
100
 
 
101
 
static WRITE8_HANDLER( pokechmp_paletteram_w )
102
 
{
103
 
        space->machine().generic.paletteram.u8[offset] = data;
104
 
        pokechmp_set_color(space->machine(), offset &0x3ff, 0, 5, 10, (space->machine().generic.paletteram.u8[offset&0x3ff]<<8) | ( space->machine().generic.paletteram.u8[ (offset&0x3ff)+0x400 ] )  );
105
 
}
106
 
 
107
 
 
108
 
static ADDRESS_MAP_START( pokechmp_map, AS_PROGRAM, 8 )
109
 
        AM_RANGE(0x0000, 0x07ff) AM_RAM
110
 
        AM_RANGE(0x0800, 0x0fff) AM_RAM_WRITE(pokechmp_videoram_w) AM_BASE_MEMBER(pokechmp_state, m_videoram)
111
 
        AM_RANGE(0x1000, 0x11ff) AM_RAM AM_BASE_SIZE_MEMBER(pokechmp_state, m_spriteram, m_spriteram_size)
112
 
 
113
 
        AM_RANGE(0x1800, 0x1800) AM_READ_PORT("P1")
114
 
        AM_RANGE(0x1801, 0x1801) AM_WRITE(pokechmp_flipscreen_w)
115
 
        /* 1800 - 0x181f are unused BAC-06 registers, see video/dec0.c */
116
 
        AM_RANGE(0x1802, 0x181f) AM_WRITENOP
117
 
 
118
 
        AM_RANGE(0x1a00, 0x1a00) AM_READ_PORT("P2") AM_WRITE(pokechmp_sound_w)
119
 
        AM_RANGE(0x1c00, 0x1c00) AM_READ_PORT("DSW") AM_WRITE(pokechmp_bank_w)
120
 
 
121
 
        /* Extra on Poke Champ (not on Pocket Gal) */
122
 
        AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(pokechmp_paletteram_w) AM_BASE_GENERIC(paletteram)
123
 
 
124
 
        AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank1")
125
 
        AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank2")
126
 
        AM_RANGE(0x8000, 0xffff) AM_ROM
127
 
ADDRESS_MAP_END
128
 
 
129
 
 
130
 
/***************************************************************************/
131
 
 
132
 
static ADDRESS_MAP_START( pokechmp_sound_map, AS_PROGRAM, 8 )
133
 
        AM_RANGE(0x0000, 0x07ff) AM_RAM
134
 
        AM_RANGE(0x0800, 0x0801) AM_DEVWRITE("ym1", ym2203_w)
135
 
        AM_RANGE(0x1000, 0x1001) AM_DEVWRITE("ym2", ym3812_w)
136
 
        AM_RANGE(0x1800, 0x1800) AM_WRITENOP    /* MSM5205 chip on Pocket Gal, not connected here? */
137
 
//  AM_RANGE(0x2000, 0x2000) AM_WRITE(pokechmp_sound_bank_w)/ * might still be sound bank */
138
 
        AM_RANGE(0x2800, 0x2800) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write) // extra
139
 
        AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
140
 
//  AM_RANGE(0x3400, 0x3400) AM_READ(pokechmp_adpcm_reset_r)    /* ? not sure */
141
 
        AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank3")
142
 
        AM_RANGE(0x8000, 0xffff) AM_ROM
143
 
ADDRESS_MAP_END
144
 
 
145
 
 
146
 
static INPUT_PORTS_START( pokechmp )
147
 
        PORT_START("P1")
148
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
149
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
150
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
151
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
152
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
153
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
154
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
155
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
156
 
 
157
 
        PORT_START("P2")
158
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
159
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
160
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
161
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
162
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
163
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
164
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
165
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
166
 
 
167
 
        PORT_START("DSW")       /* Dip switch */
168
 
        PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
169
 
        PORT_DIPSETTING(        0x00, DEF_STR( 2C_1C ) )
170
 
        PORT_DIPSETTING(        0x03, DEF_STR( 1C_1C ) )
171
 
        PORT_DIPSETTING(        0x02, DEF_STR( 1C_2C ) )
172
 
        PORT_DIPSETTING(        0x01, DEF_STR( 1C_3C ) )
173
 
        PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) )
174
 
        PORT_DIPSETTING(        0x04, DEF_STR( Off ) )
175
 
        PORT_DIPSETTING(        0x00, DEF_STR( On ) )
176
 
        PORT_DIPNAME( 0x08, 0x08, "Allow 2 Players Game" )
177
 
        PORT_DIPSETTING(        0x00, DEF_STR( No ) )
178
 
        PORT_DIPSETTING(        0x08, DEF_STR( Yes ) )
179
 
        PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) )
180
 
        PORT_DIPSETTING(        0x00, DEF_STR( Off ) )
181
 
        PORT_DIPSETTING(        0x10, DEF_STR( On ) )
182
 
        PORT_DIPNAME( 0x20, 0x20, "Time" )
183
 
        PORT_DIPSETTING(        0x00, "100" )
184
 
        PORT_DIPSETTING(        0x20, "120" )
185
 
        PORT_DIPNAME( 0x40, 0x00, DEF_STR( Lives ) )
186
 
        PORT_DIPSETTING(        0x00, "3" )
187
 
        PORT_DIPSETTING(        0x40, "4" )
188
 
        PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
189
 
        PORT_DIPSETTING(        0x80, DEF_STR( Off ) )
190
 
        PORT_DIPSETTING(        0x00, DEF_STR( On ) )
191
 
INPUT_PORTS_END
192
 
 
193
 
/* this makes no sense at all!  it seems impossible to get the colours to align up in the korean flag ingame and everything else is slightly broken too */
194
 
static const gfx_layout pokechmp_charlayout =
195
 
{
196
 
        8,8,    /* 8*8 characters */
197
 
        RGN_FRAC(1,8),
198
 
        8,
199
 
        { RGN_FRAC(1,8), RGN_FRAC(0,8),RGN_FRAC(3,8),RGN_FRAC(2,8),RGN_FRAC(5,8),RGN_FRAC(4,8),RGN_FRAC(7,8),RGN_FRAC(6,8) },
200
 
        { 0, 1, 2, 3, 4, 5, 6, 7 },
201
 
        { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
202
 
        8*8      /* every char takes 8 consecutive bytes */
203
 
};
204
 
 
205
 
 
206
 
/* should be ok.. */
207
 
static const gfx_layout pokechmp_spritelayout =
208
 
{
209
 
16,16,  /* 16*16 sprites */
210
 
RGN_FRAC(1,8),   /* 1024 sprites */
211
 
4,
212
 
{RGN_FRAC(1,8),RGN_FRAC(3,8),RGN_FRAC(5,8),RGN_FRAC(7,8)},
213
 
{ 128+7, 128+6, 128+5, 128+4, 128+3, 128+2, 128+1, 128+0, 7, 6, 5, 4, 3, 2, 1, 0 },
214
 
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
215
 
32*8    /* every char takes 8 consecutive bytes */
216
 
};
217
 
 
218
 
 
219
 
static GFXDECODE_START( pokechmp )
220
 
        GFXDECODE_ENTRY( "gfx1", 0x00000, pokechmp_charlayout,   0x100, 32 ) /* chars */
221
 
        GFXDECODE_ENTRY( "gfx2", 0x00000, pokechmp_spritelayout,   0,  32 ) /* sprites */
222
 
GFXDECODE_END
223
 
 
224
 
 
225
 
static MACHINE_CONFIG_START( pokechmp, pokechmp_state )
226
 
 
227
 
        /* basic machine hardware */
228
 
        MCFG_CPU_ADD("maincpu", M6502, 4000000)
229
 
        MCFG_CPU_PROGRAM_MAP(pokechmp_map)
230
 
        MCFG_CPU_VBLANK_INT("screen", nmi_line_pulse)
231
 
 
232
 
        MCFG_CPU_ADD("audiocpu", M6502, 4000000)
233
 
        MCFG_CPU_PROGRAM_MAP(pokechmp_sound_map)
234
 
        MCFG_CPU_VBLANK_INT("screen", irq0_line_hold)
235
 
 
236
 
        /* video hardware */
237
 
        MCFG_SCREEN_ADD("screen", RASTER)
238
 
        MCFG_SCREEN_REFRESH_RATE(60)
239
 
        MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
240
 
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
241
 
        MCFG_SCREEN_SIZE(32*8, 32*8)
242
 
        MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
243
 
        MCFG_SCREEN_UPDATE(pokechmp)
244
 
 
245
 
        MCFG_GFXDECODE(pokechmp)
246
 
        MCFG_PALETTE_LENGTH(0x400)
247
 
 
248
 
        MCFG_VIDEO_START(pokechmp)
249
 
 
250
 
        /* sound hardware */
251
 
        MCFG_SPEAKER_STANDARD_MONO("mono")
252
 
 
253
 
        MCFG_SOUND_ADD("ym1", YM2203, 1500000)
254
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
255
 
 
256
 
        MCFG_SOUND_ADD("ym2", YM3812, 3000000)
257
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
258
 
 
259
 
        MCFG_OKIM6295_ADD("oki", 4000000/4, OKIM6295_PIN7_HIGH) // ?? unknown frequency
260
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)     /* sound fx */
261
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
262
 
MACHINE_CONFIG_END
263
 
 
264
 
static DRIVER_INIT( pokechmp )
265
 
{
266
 
        memory_configure_bank(machine, "bank3", 0, 2, machine.region("audiocpu")->base() + 0x10000, 0x4000);
267
 
}
268
 
 
269
 
 
270
 
ROM_START( pokechmp )
271
 
        ROM_REGION( 0x24000, "maincpu", 0 )      /* 64k for code + 16k for banks */
272
 
        ROM_LOAD( "pokechamp_11_27010.bin",        0x10000, 0x14000, CRC(9afb6912) SHA1(e45da9524e3bb6f64a68200b70d0f83afe6e4379) )
273
 
        ROM_CONTINUE(                      0x04000, 0xc000)
274
 
 
275
 
        ROM_REGION( 0x18000, "audiocpu", 0 )     /* 96k for code + 96k for decrypted opcodes */
276
 
        ROM_LOAD( "pokechamp_09_27c512.bin",       0x10000, 0x8000, CRC(c78f6483) SHA1(a0d063effd8d1850f674edccb6e7a285b2311d21) )
277
 
        ROM_CONTINUE(                      0x08000, 0x8000 )
278
 
 
279
 
        ROM_REGION( 0x100000, "gfx1", 0)
280
 
        /* Seems to be 8bpp */
281
 
        ROM_LOAD( "pokechamp_05_27c020.bin",       0x00000, 0x40000, CRC(554cfa42) SHA1(862d0dd83697da7bd52dc640c34926c62691afea) )
282
 
        ROM_LOAD( "pokechamp_06_27c020.bin",       0x40000, 0x40000, CRC(00bb9536) SHA1(1a5584297ebb425d6ce331955e0c6a4f467cd1e6) )
283
 
        ROM_LOAD( "pokechamp_07_27c020.bin",       0x80000, 0x40000, CRC(4b15ab5e) SHA1(5523134853b9ea1c81fd5aeb58061376d94e9298) )
284
 
        ROM_LOAD( "pokechamp_08_27c020.bin",       0xc0000, 0x40000, CRC(e9db54d6) SHA1(ac3b7c06d0f61847bf9bc6147f2f88d712f2b4b3) )
285
 
 
286
 
        ROM_REGION( 0x40000, "gfx2", 0 )
287
 
        /* the first half of all these roms is identical.  For rom 3 both halves match.  Correct decode is to ignore the first half */
288
 
        ROM_LOAD( "pokechamp_02_27c512.bin",       0x00000, 0x10000, CRC(1ff44545) SHA1(2eee44484accce7b0ba21babf6e8344b234a4e87) )
289
 
        ROM_LOAD( "pokechamp_01_27c512.bin",       0x10000, 0x10000, CRC(338fc412) SHA1(bb8ae99ee6a399a8c67bedb88d0837fd0a4a426c) )
290
 
        ROM_LOAD( "pokechamp_04_27c512.bin",       0x20000, 0x10000, CRC(ee6991af) SHA1(8eca3cdfd2eb74257253957a87b245b7f85bd038) )
291
 
        ROM_LOAD( "pokechamp_03_27c512.bin",       0x30000, 0x10000, CRC(99f9884a) SHA1(096d6ce70dc51fb9142e80e1ec45d6d7225481f5) )
292
 
 
293
 
        ROM_REGION( 0x80000, "oki", 0 )
294
 
        ROM_LOAD( "pokechamp_10_27c040.bin",       0x00000, 0x80000, CRC(b54806ed) SHA1(c6e1485c263ebd9102ff1e8c09b4c4ca5f63c3da) )
295
 
ROM_END
296
 
 
297
 
GAME( 1995, pokechmp, 0, pokechmp, pokechmp, pokechmp, ROT0, "D.G.R.M.", "Poke Champ", GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )