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

« back to all changes in this revision

Viewing changes to src/mame/drivers/exerion.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:
130
130
 *************************************/
131
131
 
132
132
/* Players inputs are muxed at 0xa000 */
133
 
static CUSTOM_INPUT( exerion_controls_r )
 
133
CUSTOM_INPUT_MEMBER(exerion_state::exerion_controls_r)
134
134
{
135
135
        static const char *const inname[2] = { "P1", "P2" };
136
 
        exerion_state *state = field.machine().driver_data<exerion_state>();
137
 
        return input_port_read(field.machine(), inname[state->m_cocktail_flip]) & 0x3f;
 
136
        return ioport(inname[m_cocktail_flip])->read() & 0x3f;
138
137
}
139
138
 
140
139
 
141
 
static INPUT_CHANGED( coin_inserted )
 
140
INPUT_CHANGED_MEMBER(exerion_state::coin_inserted)
142
141
{
143
 
        exerion_state *state = field.machine().driver_data<exerion_state>();
144
142
        /* coin insertion causes an NMI */
145
 
        device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
 
143
        device_set_input_line(m_maincpu, INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
146
144
}
147
145
 
148
146
 
167
165
{
168
166
        exerion_state *state = device->machine().driver_data<exerion_state>();
169
167
        /* pull the expected value from the ROM */
170
 
        state->m_porta = device->machine().region("maincpu")->base()[0x5f76];
 
168
        state->m_porta = state->memregion("maincpu")->base()[0x5f76];
171
169
        state->m_portb = data;
172
170
 
173
171
        logerror("Port B = %02X\n", data);
174
172
}
175
173
 
176
174
 
177
 
static READ8_HANDLER( exerion_protection_r )
 
175
READ8_MEMBER(exerion_state::exerion_protection_r)
178
176
{
179
 
        exerion_state *state = space->machine().driver_data<exerion_state>();
180
 
        if (cpu_get_pc(&space->device()) == 0x4143)
181
 
                return space->machine().region("maincpu")->base()[0x33c0 + (state->m_main_ram[0xd] << 2) + offset];
 
177
        if (cpu_get_pc(&space.device()) == 0x4143)
 
178
                return memregion("maincpu")->base()[0x33c0 + (m_main_ram[0xd] << 2) + offset];
182
179
        else
183
 
                return state->m_main_ram[0x8 + offset];
 
180
                return m_main_ram[0x8 + offset];
184
181
}
185
182
 
186
183
 
191
188
 *
192
189
 *************************************/
193
190
 
194
 
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 )
 
191
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, exerion_state )
195
192
        AM_RANGE(0x0000, 0x5fff) AM_ROM
196
193
        AM_RANGE(0x6008, 0x600b) AM_READ(exerion_protection_r)
197
 
        AM_RANGE(0x6000, 0x67ff) AM_RAM AM_BASE_MEMBER(exerion_state, m_main_ram)
198
 
        AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE_SIZE_MEMBER(exerion_state, m_videoram, m_videoram_size)
199
 
        AM_RANGE(0x8800, 0x887f) AM_RAM AM_BASE_SIZE_MEMBER(exerion_state, m_spriteram, m_spriteram_size)
 
194
        AM_RANGE(0x6000, 0x67ff) AM_RAM AM_SHARE("main_ram")
 
195
        AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("videoram")
 
196
        AM_RANGE(0x8800, 0x887f) AM_RAM AM_SHARE("spriteram")
200
197
        AM_RANGE(0x8800, 0x8bff) AM_RAM
201
198
        AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")
202
199
        AM_RANGE(0xa800, 0xa800) AM_READ_PORT("DSW0")
203
200
        AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW1")
204
201
        AM_RANGE(0xc000, 0xc000) AM_WRITE(exerion_videoreg_w)
205
 
        AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
206
 
        AM_RANGE(0xd000, 0xd001) AM_DEVWRITE("ay1", ay8910_address_data_w)
207
 
        AM_RANGE(0xd800, 0xd801) AM_DEVWRITE("ay2", ay8910_address_data_w)
208
 
        AM_RANGE(0xd802, 0xd802) AM_DEVREAD("ay2", ay8910_r)
 
202
        AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_byte_w)
 
203
        AM_RANGE(0xd000, 0xd001) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
 
204
        AM_RANGE(0xd800, 0xd801) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
 
205
        AM_RANGE(0xd802, 0xd802) AM_DEVREAD_LEGACY("ay2", ay8910_r)
209
206
ADDRESS_MAP_END
210
207
 
211
208
 
216
213
 *
217
214
 *************************************/
218
215
 
219
 
static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8 )
 
216
static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, exerion_state )
220
217
        AM_RANGE(0x0000, 0x1fff) AM_ROM
221
218
        AM_RANGE(0x4000, 0x47ff) AM_RAM
222
 
        AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
 
219
        AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_byte_r)
223
220
        AM_RANGE(0x8000, 0x800c) AM_WRITE(exerion_video_latch_w)
224
221
        AM_RANGE(0xa000, 0xa000) AM_READ(exerion_video_timing_r)
225
222
ADDRESS_MAP_END
235
232
/* verified from Z80 code */
236
233
static INPUT_PORTS_START( exerion )
237
234
        PORT_START("IN0")
238
 
        PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(exerion_controls_r, (void *)0)
 
235
        PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, exerion_state,exerion_controls_r, (void *)0)
239
236
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
240
237
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
241
238
 
264
261
        PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
265
262
 
266
263
        PORT_START("DSW1")
267
 
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_VBLANK )
 
264
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
268
265
        PORT_DIPNAME( 0x0e, 0x00, DEF_STR( Coinage ) )          /* see notes */
269
266
        PORT_DIPSETTING(    0x0e, DEF_STR( 5C_1C ) )
270
267
        PORT_DIPSETTING(    0x0a, DEF_STR( 4C_1C ) )
277
274
        PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
278
275
 
279
276
        PORT_START("COIN")
280
 
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0)
 
277
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, exerion_state,coin_inserted, 0)
281
278
 
282
279
        PORT_START("P1")          /* fake input port */
283
280
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY
561
558
 
562
559
        /* make a temporary copy of the character data */
563
560
        src = temp;
564
 
        dst = machine.region("gfx1")->base();
565
 
        length = machine.region("gfx1")->bytes();
 
561
        dst = machine.root_device().memregion("gfx1")->base();
 
562
        length = machine.root_device().memregion("gfx1")->bytes();
566
563
        memcpy(src, dst, length);
567
564
 
568
565
        /* decode the characters */
579
576
 
580
577
        /* make a temporary copy of the sprite data */
581
578
        src = temp;
582
 
        dst = machine.region("gfx2")->base();
583
 
        length = machine.region("gfx2")->bytes();
 
579
        dst = machine.root_device().memregion("gfx2")->base();
 
580
        length = machine.root_device().memregion("gfx2")->bytes();
584
581
        memcpy(src, dst, length);
585
582
 
586
583
        /* decode the sprites */
602
599
 
603
600
static DRIVER_INIT( exerionb )
604
601
{
605
 
        UINT8 *ram = machine.region("maincpu")->base();
 
602
        UINT8 *ram = machine.root_device().memregion("maincpu")->base();
606
603
        int addr;
607
604
 
608
605
        /* the program ROMs have data lines D1 and D2 swapped. Decode them. */