~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to src/mame/drivers/88games.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
                irq0_line_hold(device);
31
31
}
32
32
 
33
 
static READ8_HANDLER( bankedram_r )
 
33
READ8_MEMBER(_88games_state::bankedram_r)
34
34
{
35
 
        _88games_state *state = space->machine().driver_data<_88games_state>();
36
35
 
37
 
        if (state->m_videobank)
38
 
                return state->m_ram[offset];
 
36
        if (m_videobank)
 
37
                return m_ram[offset];
39
38
        else
40
39
        {
41
 
                if (state->m_zoomreadroms)
42
 
                        return k051316_rom_r(state->m_k051316, offset);
 
40
                if (m_zoomreadroms)
 
41
                        return k051316_rom_r(m_k051316, offset);
43
42
                else
44
 
                        return k051316_r(state->m_k051316, offset);
 
43
                        return k051316_r(m_k051316, offset);
45
44
        }
46
45
}
47
46
 
48
 
static WRITE8_HANDLER( bankedram_w )
 
47
WRITE8_MEMBER(_88games_state::bankedram_w)
49
48
{
50
 
        _88games_state *state = space->machine().driver_data<_88games_state>();
51
49
 
52
 
        if (state->m_videobank)
53
 
                state->m_ram[offset] = data;
 
50
        if (m_videobank)
 
51
                m_ram[offset] = data;
54
52
        else
55
 
                k051316_w(state->m_k051316, offset, data);
 
53
                k051316_w(m_k051316, offset, data);
56
54
}
57
55
 
58
 
static WRITE8_HANDLER( k88games_5f84_w )
 
56
WRITE8_MEMBER(_88games_state::k88games_5f84_w)
59
57
{
60
 
        _88games_state *state = space->machine().driver_data<_88games_state>();
61
58
 
62
59
        /* bits 0/1 coin counters */
63
 
        coin_counter_w(space->machine(), 0, data & 0x01);
64
 
        coin_counter_w(space->machine(), 1, data & 0x02);
 
60
        coin_counter_w(machine(), 0, data & 0x01);
 
61
        coin_counter_w(machine(), 1, data & 0x02);
65
62
 
66
63
        /* bit 2 enables ROM reading from the 051316 */
67
64
        /* also 5fce == 2 read roms, == 3 read ram */
68
 
        state->m_zoomreadroms = data & 0x04;
 
65
        m_zoomreadroms = data & 0x04;
69
66
 
70
67
        if (data & 0xf8)
71
68
                popmessage("5f84 = %02x", data);
72
69
}
73
70
 
74
 
static WRITE8_HANDLER( k88games_sh_irqtrigger_w )
 
71
WRITE8_MEMBER(_88games_state::k88games_sh_irqtrigger_w)
75
72
{
76
 
        _88games_state *state = space->machine().driver_data<_88games_state>();
77
 
        device_set_input_line_and_vector(state->m_audiocpu, 0, HOLD_LINE, 0xff);
 
73
        device_set_input_line_and_vector(m_audiocpu, 0, HOLD_LINE, 0xff);
78
74
}
79
75
 
80
76
 
81
 
static WRITE8_HANDLER( speech_control_w )
 
77
WRITE8_MEMBER(_88games_state::speech_control_w)
82
78
{
83
 
        _88games_state *state = space->machine().driver_data<_88games_state>();
84
79
        device_t *upd;
85
80
 
86
 
        state->m_speech_chip = (data & 4) ? 1 : 0;
87
 
        upd = state->m_speech_chip ? state->m_upd_2 : state->m_upd_1;
 
81
        m_speech_chip = (data & 4) ? 1 : 0;
 
82
        upd = m_speech_chip ? m_upd_2 : m_upd_1;
88
83
 
89
84
        upd7759_reset_w(upd, data & 2);
90
85
        upd7759_start_w(upd, data & 1);
91
86
}
92
87
 
93
 
static WRITE8_HANDLER( speech_msg_w )
 
88
WRITE8_MEMBER(_88games_state::speech_msg_w)
94
89
{
95
 
        _88games_state *state = space->machine().driver_data<_88games_state>();
96
 
        device_t *upd = state->m_speech_chip ? state->m_upd_2 : state->m_upd_1;
 
90
        device_t *upd = m_speech_chip ? m_upd_2 : m_upd_1;
97
91
 
98
92
        upd7759_port_w(upd, 0, data);
99
93
}
100
94
 
101
95
/* special handlers to combine 052109 & 051960 */
102
 
static READ8_HANDLER( k052109_051960_r )
 
96
READ8_MEMBER(_88games_state::k052109_051960_r)
103
97
{
104
 
        _88games_state *state = space->machine().driver_data<_88games_state>();
105
98
 
106
 
        if (k052109_get_rmrd_line(state->m_k052109) == CLEAR_LINE)
 
99
        if (k052109_get_rmrd_line(m_k052109) == CLEAR_LINE)
107
100
        {
108
101
                if (offset >= 0x3800 && offset < 0x3808)
109
 
                        return k051937_r(state->m_k051960, offset - 0x3800);
 
102
                        return k051937_r(m_k051960, offset - 0x3800);
110
103
                else if (offset < 0x3c00)
111
 
                        return k052109_r(state->m_k052109, offset);
 
104
                        return k052109_r(m_k052109, offset);
112
105
                else
113
 
                        return k051960_r(state->m_k051960, offset - 0x3c00);
 
106
                        return k051960_r(m_k051960, offset - 0x3c00);
114
107
        }
115
108
        else
116
 
                return k052109_r(state->m_k052109, offset);
 
109
                return k052109_r(m_k052109, offset);
117
110
}
118
111
 
119
 
static WRITE8_HANDLER( k052109_051960_w )
 
112
WRITE8_MEMBER(_88games_state::k052109_051960_w)
120
113
{
121
 
        _88games_state *state = space->machine().driver_data<_88games_state>();
122
114
 
123
115
        if (offset >= 0x3800 && offset < 0x3808)
124
 
                k051937_w(state->m_k051960, offset - 0x3800, data);
 
116
                k051937_w(m_k051960, offset - 0x3800, data);
125
117
        else if (offset < 0x3c00)
126
 
                k052109_w(state->m_k052109, offset, data);
 
118
                k052109_w(m_k052109, offset, data);
127
119
        else
128
 
                k051960_w(state->m_k051960, offset - 0x3c00, data);
 
120
                k051960_w(m_k051960, offset - 0x3c00, data);
129
121
}
130
122
 
131
123
/*************************************
134
126
 *
135
127
 *************************************/
136
128
 
137
 
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 )
138
 
        AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE_MEMBER(_88games_state, m_banked_rom) /* banked ROM + palette RAM */
139
 
        AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_be_w) AM_BASE_MEMBER(_88games_state, m_paletteram_1000)       /* banked ROM + palette RAM */
 
129
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, _88games_state )
 
130
        AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("banked_rom") /* banked ROM + palette RAM */
 
131
        AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram_1000")        /* banked ROM + palette RAM */
140
132
        AM_RANGE(0x2000, 0x2fff) AM_RAM
141
133
        AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("nvram")
142
 
        AM_RANGE(0x3800, 0x3fff) AM_READWRITE(bankedram_r, bankedram_w) AM_BASE_MEMBER(_88games_state, m_ram)
 
134
        AM_RANGE(0x3800, 0x3fff) AM_READWRITE(bankedram_r, bankedram_w) AM_SHARE("ram")
143
135
        AM_RANGE(0x5f84, 0x5f84) AM_WRITE(k88games_5f84_w)
144
136
        AM_RANGE(0x5f88, 0x5f88) AM_WRITE(watchdog_reset_w)
145
 
        AM_RANGE(0x5f8c, 0x5f8c) AM_WRITE(soundlatch_w)
 
137
        AM_RANGE(0x5f8c, 0x5f8c) AM_WRITE(soundlatch_byte_w)
146
138
        AM_RANGE(0x5f90, 0x5f90) AM_WRITE(k88games_sh_irqtrigger_w)
147
139
        AM_RANGE(0x5f94, 0x5f94) AM_READ_PORT("IN0")
148
140
        AM_RANGE(0x5f95, 0x5f95) AM_READ_PORT("IN1")
149
141
        AM_RANGE(0x5f96, 0x5f96) AM_READ_PORT("IN2")
150
142
        AM_RANGE(0x5f97, 0x5f97) AM_READ_PORT("DSW1")
151
143
        AM_RANGE(0x5f9b, 0x5f9b) AM_READ_PORT("DSW2")
152
 
        AM_RANGE(0x5fc0, 0x5fcf) AM_DEVWRITE("k051316", k051316_ctrl_w)
 
144
        AM_RANGE(0x5fc0, 0x5fcf) AM_DEVWRITE_LEGACY("k051316", k051316_ctrl_w)
153
145
        AM_RANGE(0x4000, 0x7fff) AM_READWRITE(k052109_051960_r, k052109_051960_w)
154
146
        AM_RANGE(0x8000, 0xffff) AM_ROM
155
147
ADDRESS_MAP_END
156
148
 
157
 
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8 )
 
149
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, _88games_state )
158
150
        AM_RANGE(0x0000, 0x7fff) AM_ROM
159
151
        AM_RANGE(0x8000, 0x87ff) AM_RAM
160
152
        AM_RANGE(0x9000, 0x9000) AM_WRITE(speech_msg_w)
161
 
        AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_r)
162
 
        AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE("ymsnd", ym2151_r, ym2151_w)
 
153
        AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
 
154
        AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
163
155
        AM_RANGE(0xe000, 0xe000) AM_WRITE(speech_control_w)
164
156
ADDRESS_MAP_END
165
157
 
274
266
static KONAMI_SETLINES_CALLBACK( k88games_banking )
275
267
{
276
268
        _88games_state *state = device->machine().driver_data<_88games_state>();
277
 
        UINT8 *RAM = device->machine().region("maincpu")->base();
 
269
        UINT8 *RAM = state->memregion("maincpu")->base();
278
270
        int offs;
279
271
 
280
272
        logerror("%04x: bank select %02x\n", cpu_get_pc(device), lines);
286
278
        memcpy(state->m_banked_rom, &RAM[offs], 0x1000);
287
279
        if (lines & 0x08)
288
280
        {
289
 
                if (device->machine().generic.paletteram.u8 != state->m_paletteram_1000)
 
281
                if (state->m_generic_paletteram_8 != state->m_paletteram_1000)
290
282
                {
291
 
                        memcpy(state->m_paletteram_1000, device->machine().generic.paletteram.u8, 0x1000);
292
 
                        device->machine().generic.paletteram.u8 = state->m_paletteram_1000;
 
283
                        memcpy(state->m_paletteram_1000, state->m_generic_paletteram_8, 0x1000);
 
284
                        state->m_generic_paletteram_8.set_target(state->m_paletteram_1000, 0x1000);
293
285
                }
294
286
        }
295
287
        else
296
288
        {
297
 
                if (device->machine().generic.paletteram.u8 != &RAM[0x20000])
 
289
                if (state->m_generic_paletteram_8 != &RAM[0x20000])
298
290
                {
299
 
                        memcpy(&RAM[0x20000], device->machine().generic.paletteram.u8, 0x1000);
300
 
                        device->machine().generic.paletteram.u8 = &RAM[0x20000];
 
291
                        memcpy(&RAM[0x20000], state->m_generic_paletteram_8, 0x1000);
 
292
                        state->m_generic_paletteram_8.set_target(&RAM[0x20000], 0x01000);
301
293
                }
302
294
                memcpy(state->m_paletteram_1000, &RAM[offs+0x1000], 0x1000);
303
295
        }
338
330
        _88games_state *state = machine.driver_data<_88games_state>();
339
331
 
340
332
        konami_configure_set_lines(machine.device("maincpu"), k88games_banking);
341
 
        machine.generic.paletteram.u8 = &machine.region("maincpu")->base()[0x20000];
 
333
        state->m_generic_paletteram_8.set_target(&state->memregion("maincpu")->base()[0x20000], 0x1000);
342
334
 
343
335
        state->m_videobank = 0;
344
336
        state->m_zoomreadroms = 0;