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

« back to all changes in this revision

Viewing changes to src/mame/drivers/parodius.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:
26
26
                device_set_input_line(device, 0, HOLD_LINE);
27
27
}
28
28
 
29
 
static READ8_HANDLER( bankedram_r )
30
 
{
31
 
        parodius_state *state = space->machine().driver_data<parodius_state>();
32
 
 
33
 
        if (state->m_videobank & 0x01)
34
 
        {
35
 
                if (state->m_videobank & 0x04)
36
 
                        return space->machine().generic.paletteram.u8[offset + 0x0800];
37
 
                else
38
 
                        return space->machine().generic.paletteram.u8[offset];
39
 
        }
40
 
        else
41
 
                return state->m_ram[offset];
42
 
}
43
 
 
44
 
static WRITE8_HANDLER( bankedram_w )
45
 
{
46
 
        parodius_state *state = space->machine().driver_data<parodius_state>();
47
 
 
48
 
        if (state->m_videobank & 0x01)
49
 
        {
50
 
                if (state->m_videobank & 0x04)
51
 
                        paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset + 0x0800, data);
52
 
                else
53
 
                        paletteram_xBBBBBGGGGGRRRRR_be_w(space, offset, data);
54
 
        }
55
 
        else
56
 
                state->m_ram[offset] = data;
57
 
}
58
 
 
59
 
static READ8_HANDLER( parodius_052109_053245_r )
60
 
{
61
 
        parodius_state *state = space->machine().driver_data<parodius_state>();
62
 
 
63
 
        if (state->m_videobank & 0x02)
64
 
                return k053245_r(state->m_k053245, offset);
65
 
        else
66
 
                return k052109_r(state->m_k052109, offset);
67
 
}
68
 
 
69
 
static WRITE8_HANDLER( parodius_052109_053245_w )
70
 
{
71
 
        parodius_state *state = space->machine().driver_data<parodius_state>();
72
 
 
73
 
        if (state->m_videobank & 0x02)
74
 
                k053245_w(state->m_k053245, offset, data);
75
 
        else
76
 
                k052109_w(state->m_k052109, offset, data);
77
 
}
78
 
 
79
 
static WRITE8_HANDLER( parodius_videobank_w )
80
 
{
81
 
        parodius_state *state = space->machine().driver_data<parodius_state>();
82
 
 
83
 
        if (state->m_videobank & 0xf8)
84
 
                logerror("%04x: videobank = %02x\n",cpu_get_pc(&space->device()),data);
 
29
READ8_MEMBER(parodius_state::bankedram_r)
 
30
{
 
31
 
 
32
        if (m_videobank & 0x01)
 
33
        {
 
34
                if (m_videobank & 0x04)
 
35
                        return m_generic_paletteram_8[offset + 0x0800];
 
36
                else
 
37
                        return m_generic_paletteram_8[offset];
 
38
        }
 
39
        else
 
40
                return m_ram[offset];
 
41
}
 
42
 
 
43
WRITE8_MEMBER(parodius_state::bankedram_w)
 
44
{
 
45
 
 
46
        if (m_videobank & 0x01)
 
47
        {
 
48
                if (m_videobank & 0x04)
 
49
                        paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset + 0x0800, data);
 
50
                else
 
51
                        paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
 
52
        }
 
53
        else
 
54
                m_ram[offset] = data;
 
55
}
 
56
 
 
57
READ8_MEMBER(parodius_state::parodius_052109_053245_r)
 
58
{
 
59
 
 
60
        if (m_videobank & 0x02)
 
61
                return k053245_r(m_k053245, offset);
 
62
        else
 
63
                return k052109_r(m_k052109, offset);
 
64
}
 
65
 
 
66
WRITE8_MEMBER(parodius_state::parodius_052109_053245_w)
 
67
{
 
68
 
 
69
        if (m_videobank & 0x02)
 
70
                k053245_w(m_k053245, offset, data);
 
71
        else
 
72
                k052109_w(m_k052109, offset, data);
 
73
}
 
74
 
 
75
WRITE8_MEMBER(parodius_state::parodius_videobank_w)
 
76
{
 
77
 
 
78
        if (m_videobank & 0xf8)
 
79
                logerror("%04x: videobank = %02x\n",cpu_get_pc(&space.device()),data);
85
80
 
86
81
        /* bit 0 = select palette or work RAM at 0000-07ff */
87
82
        /* bit 1 = select 052109 or 053245 at 2000-27ff */
88
83
        /* bit 2 = select palette bank 0 or 1 */
89
 
        state->m_videobank = data;
 
84
        m_videobank = data;
90
85
}
91
86
 
92
 
static WRITE8_HANDLER( parodius_3fc0_w )
 
87
WRITE8_MEMBER(parodius_state::parodius_3fc0_w)
93
88
{
94
 
        parodius_state *state = space->machine().driver_data<parodius_state>();
95
89
 
96
90
        if ((data & 0xf4) != 0x10)
97
 
                logerror("%04x: 3fc0 = %02x\n",cpu_get_pc(&space->device()),data);
 
91
                logerror("%04x: 3fc0 = %02x\n",cpu_get_pc(&space.device()),data);
98
92
 
99
93
        /* bit 0/1 = coin counters */
100
 
        coin_counter_w(space->machine(), 0, data & 0x01);
101
 
        coin_counter_w(space->machine(), 1, data & 0x02);
 
94
        coin_counter_w(machine(), 0, data & 0x01);
 
95
        coin_counter_w(machine(), 1, data & 0x02);
102
96
 
103
97
        /* bit 3 = enable char ROM reading through the video RAM */
104
 
        k052109_set_rmrd_line(state->m_k052109, (data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
 
98
        k052109_set_rmrd_line(m_k052109, (data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
105
99
 
106
100
        /* other bits unknown */
107
101
}
111
105
        return k053260_r(device, 2 + offset);
112
106
}
113
107
 
114
 
static WRITE8_HANDLER( parodius_sh_irqtrigger_w )
 
108
WRITE8_MEMBER(parodius_state::parodius_sh_irqtrigger_w)
115
109
{
116
 
        parodius_state *state = space->machine().driver_data<parodius_state>();
117
 
        device_set_input_line_and_vector(state->m_audiocpu, 0, HOLD_LINE, 0xff);
 
110
        device_set_input_line_and_vector(m_audiocpu, 0, HOLD_LINE, 0xff);
118
111
}
119
112
 
120
113
#if 0
134
127
        device_set_input_line(state->m_audiocpu, INPUT_LINE_NMI, ASSERT_LINE);
135
128
}
136
129
 
137
 
static WRITE8_HANDLER( sound_arm_nmi_w )
 
130
WRITE8_MEMBER(parodius_state::sound_arm_nmi_w)
138
131
{
139
 
        parodius_state *state = space->machine().driver_data<parodius_state>();
140
132
 
141
 
        device_set_input_line(state->m_audiocpu, INPUT_LINE_NMI, CLEAR_LINE);
142
 
        space->machine().scheduler().timer_set(attotime::from_usec(50), FUNC(nmi_callback));    /* kludge until the K053260 is emulated correctly */
 
133
        device_set_input_line(m_audiocpu, INPUT_LINE_NMI, CLEAR_LINE);
 
134
        machine().scheduler().timer_set(attotime::from_usec(50), FUNC(nmi_callback));   /* kludge until the K053260 is emulated correctly */
143
135
}
144
136
 
145
137
/********************************************/
146
138
 
147
 
static ADDRESS_MAP_START( parodius_map, AS_PROGRAM, 8 )
148
 
        AM_RANGE(0x0000, 0x07ff) AM_READWRITE(bankedram_r, bankedram_w) AM_BASE_MEMBER(parodius_state, m_ram)
 
139
static ADDRESS_MAP_START( parodius_map, AS_PROGRAM, 8, parodius_state )
 
140
        AM_RANGE(0x0000, 0x07ff) AM_READWRITE(bankedram_r, bankedram_w) AM_SHARE("ram")
149
141
        AM_RANGE(0x0800, 0x1fff) AM_RAM
150
142
        AM_RANGE(0x3f8c, 0x3f8c) AM_READ_PORT("P1")
151
143
        AM_RANGE(0x3f8d, 0x3f8d) AM_READ_PORT("P2")
152
144
        AM_RANGE(0x3f8e, 0x3f8e) AM_READ_PORT("DSW3")
153
145
        AM_RANGE(0x3f8f, 0x3f8f) AM_READ_PORT("DSW1")
154
146
        AM_RANGE(0x3f90, 0x3f90) AM_READ_PORT("DSW2")
155
 
        AM_RANGE(0x3fa0, 0x3faf) AM_DEVREADWRITE("k053245", k053244_r, k053244_w)
156
 
        AM_RANGE(0x3fb0, 0x3fbf) AM_DEVWRITE("k053251", k053251_w)
157
 
        AM_RANGE(0x3fc0, 0x3fc0) AM_READWRITE(watchdog_reset_r,parodius_3fc0_w)
 
147
        AM_RANGE(0x3fa0, 0x3faf) AM_DEVREADWRITE_LEGACY("k053245", k053244_r, k053244_w)
 
148
        AM_RANGE(0x3fb0, 0x3fbf) AM_DEVWRITE_LEGACY("k053251", k053251_w)
 
149
        AM_RANGE(0x3fc0, 0x3fc0) AM_READ(watchdog_reset_r) AM_WRITE(parodius_3fc0_w)
158
150
        AM_RANGE(0x3fc4, 0x3fc4) AM_WRITE(parodius_videobank_w)
159
151
        AM_RANGE(0x3fc8, 0x3fc8) AM_WRITE(parodius_sh_irqtrigger_w)
160
 
        AM_RANGE(0x3fcc, 0x3fcd) AM_DEVREADWRITE("k053260", parodius_sound_r, k053260_w)        /* K053260 */
 
152
        AM_RANGE(0x3fcc, 0x3fcd) AM_DEVREADWRITE_LEGACY("k053260", parodius_sound_r, k053260_w) /* K053260 */
161
153
        AM_RANGE(0x2000, 0x27ff) AM_READWRITE(parodius_052109_053245_r, parodius_052109_053245_w)
162
 
        AM_RANGE(0x2000, 0x5fff) AM_DEVREADWRITE("k052109", k052109_r, k052109_w)
 
154
        AM_RANGE(0x2000, 0x5fff) AM_DEVREADWRITE_LEGACY("k052109", k052109_r, k052109_w)
163
155
        AM_RANGE(0x6000, 0x9fff) AM_ROMBANK("bank1")                    /* banked ROM */
164
156
        AM_RANGE(0xa000, 0xffff) AM_ROM                                 /* ROM */
165
157
ADDRESS_MAP_END
166
158
 
167
 
static ADDRESS_MAP_START( parodius_sound_map, AS_PROGRAM, 8 )
 
159
static ADDRESS_MAP_START( parodius_sound_map, AS_PROGRAM, 8, parodius_state )
168
160
        AM_RANGE(0x0000, 0xefff) AM_ROM
169
161
        AM_RANGE(0xf000, 0xf7ff) AM_RAM
170
 
        AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE("ymsnd", ym2151_r,ym2151_w)
 
162
        AM_RANGE(0xf800, 0xf801) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r,ym2151_w)
171
163
        AM_RANGE(0xfa00, 0xfa00) AM_WRITE(sound_arm_nmi_w)
172
 
        AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE("k053260", k053260_r,k053260_w)
 
164
        AM_RANGE(0xfc00, 0xfc2f) AM_DEVREADWRITE_LEGACY("k053260", k053260_r,k053260_w)
173
165
ADDRESS_MAP_END
174
166
 
175
167
 
256
248
static MACHINE_START( parodius )
257
249
{
258
250
        parodius_state *state = machine.driver_data<parodius_state>();
259
 
        UINT8 *ROM = machine.region("maincpu")->base();
260
 
 
261
 
        memory_configure_bank(machine, "bank1", 0, 14, &ROM[0x10000], 0x4000);
262
 
        memory_configure_bank(machine, "bank1", 14, 2, &ROM[0x08000], 0x4000);
263
 
        memory_set_bank(machine, "bank1", 0);
264
 
 
265
 
        machine.generic.paletteram.u8 = auto_alloc_array_clear(machine, UINT8, 0x1000);
 
251
        UINT8 *ROM = state->memregion("maincpu")->base();
 
252
 
 
253
        state->membank("bank1")->configure_entries(0, 14, &ROM[0x10000], 0x4000);
 
254
        state->membank("bank1")->configure_entries(14, 2, &ROM[0x08000], 0x4000);
 
255
        state->membank("bank1")->set_entry(0);
 
256
 
 
257
        state->m_generic_paletteram_8.allocate(0x1000);
266
258
 
267
259
        state->m_maincpu = machine.device("maincpu");
268
260
        state->m_audiocpu = machine.device("audiocpu");
275
267
        state->save_item(NAME(state->m_sprite_colorbase));
276
268
        state->save_item(NAME(state->m_layer_colorbase));
277
269
        state->save_item(NAME(state->m_layerpri));
278
 
        state_save_register_global_pointer(machine, machine.generic.paletteram.u8, 0x1000);
279
270
}
280
271
 
281
272
static MACHINE_RESET( parodius )
416
407
        if (lines & 0xf0)
417
408
                logerror("%04x: setlines %02x\n", cpu_get_pc(device), lines);
418
409
 
419
 
        memory_set_bank(device->machine(),  "bank1", (lines & 0x0f) ^ 0x0f);
 
410
        device->machine().root_device().membank("bank1")->set_entry((lines & 0x0f) ^ 0x0f);
420
411
}
421
412
 
422
413
GAME( 1990, parodius,  0,        parodius, parodius, 0, ROT0, "Konami", "Parodius DA! (World, set 1)", GAME_SUPPORTS_SAVE )