130
130
*************************************/
132
132
/* Players inputs are muxed at 0xa000 */
133
static CUSTOM_INPUT( exerion_controls_r )
133
CUSTOM_INPUT_MEMBER(exerion_state::exerion_controls_r)
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;
141
static INPUT_CHANGED( coin_inserted )
140
INPUT_CHANGED_MEMBER(exerion_state::coin_inserted)
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);
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;
173
171
logerror("Port B = %02X\n", data);
177
static READ8_HANDLER( exerion_protection_r )
175
READ8_MEMBER(exerion_state::exerion_protection_r)
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];
183
return state->m_main_ram[0x8 + offset];
180
return m_main_ram[0x8 + offset];
192
189
*************************************/
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)
217
214
*************************************/
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)
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 )
264
261
PORT_DIPSETTING( 0x80, DEF_STR( Cocktail ) )
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 )
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)
282
279
PORT_START("P1") /* fake input port */
283
280
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
562
559
/* make a temporary copy of the character data */
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);
568
565
/* decode the characters */
580
577
/* make a temporary copy of the sprite data */
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);
586
583
/* decode the sprites */