21
21
/******************************************************************************/
23
static READ16_HANDLER( stadhero_control_r )
23
READ16_MEMBER(stadhero_state::stadhero_control_r)
28
return input_port_read(space->machine(), "INPUTS");
28
return ioport("INPUTS")->read();
31
return input_port_read(space->machine(), "COIN");
31
return ioport("COIN")->read();
34
return input_port_read(space->machine(), "DSW");
34
return ioport("DSW")->read();
37
logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",cpu_get_pc(&space->device()),0x30c000+offset);
37
logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",cpu_get_pc(&space.device()),0x30c000+offset);
41
static WRITE16_HANDLER( stadhero_control_w )
41
WRITE16_MEMBER(stadhero_state::stadhero_control_w)
45
45
case 4: /* Interrupt ack (VBL - IRQ 5) */
47
47
case 6: /* 6502 sound cpu */
48
soundlatch_w(space, 0, data & 0xff);
49
cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
48
soundlatch_byte_w(space, 0, data & 0xff);
49
cputag_set_input_line(machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
52
logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space->device()),data,0x30c010+offset);
52
logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(&space.device()),data,0x30c010+offset);
58
58
/******************************************************************************/
60
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16 )
60
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, stadhero_state )
61
61
AM_RANGE(0x000000, 0x01ffff) AM_ROM
62
AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(stadhero_pf1_data_w) AM_BASE_MEMBER(stadhero_state, m_pf1_data)
63
AM_RANGE(0x240000, 0x240007) AM_DEVWRITE("tilegen1", deco_bac06_pf_control_0_w) /* text layer */
64
AM_RANGE(0x240010, 0x240017) AM_DEVWRITE("tilegen1", deco_bac06_pf_control_1_w)
65
AM_RANGE(0x260000, 0x261fff) AM_DEVREADWRITE("tilegen1", deco_bac06_pf_data_r, deco_bac06_pf_data_w)
62
AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(stadhero_pf1_data_w) AM_SHARE("pf1_data")
63
AM_RANGE(0x240000, 0x240007) AM_DEVWRITE_LEGACY("tilegen1", deco_bac06_pf_control_0_w) /* text layer */
64
AM_RANGE(0x240010, 0x240017) AM_DEVWRITE_LEGACY("tilegen1", deco_bac06_pf_control_1_w)
65
AM_RANGE(0x260000, 0x261fff) AM_DEVREADWRITE_LEGACY("tilegen1", deco_bac06_pf_data_r, deco_bac06_pf_data_w)
66
66
AM_RANGE(0x30c000, 0x30c00b) AM_READWRITE(stadhero_control_r, stadhero_control_w)
67
AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
67
AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
68
68
AM_RANGE(0xff8000, 0xffbfff) AM_RAM /* Main ram */
69
AM_RANGE(0xffc000, 0xffc7ff) AM_MIRROR(0x000800) AM_RAM AM_BASE_MEMBER(stadhero_state, m_spriteram)
69
AM_RANGE(0xffc000, 0xffc7ff) AM_MIRROR(0x000800) AM_RAM AM_SHARE("spriteram")
72
72
/******************************************************************************/
74
static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8 )
74
static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, stadhero_state )
75
75
AM_RANGE(0x0000, 0x05ff) AM_RAM
76
AM_RANGE(0x0800, 0x0801) AM_DEVWRITE("ym1", ym2203_w)
77
AM_RANGE(0x1000, 0x1001) AM_DEVWRITE("ym2", ym3812_w)
78
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r)
79
AM_RANGE(0x3800, 0x3800) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write)
76
AM_RANGE(0x0800, 0x0801) AM_DEVWRITE_LEGACY("ym1", ym2203_w)
77
AM_RANGE(0x1000, 0x1001) AM_DEVWRITE_LEGACY("ym2", ym3812_w)
78
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
79
AM_RANGE(0x3800, 0x3800) AM_DEVREADWRITE("oki", okim6295_device, read, write)
80
80
AM_RANGE(0x8000, 0xffff) AM_ROM
139
139
PORT_DIPUNUSED( 0x8000, IP_ACTIVE_LOW )
141
141
PORT_START("COIN") /* 0x30c002 & 0x30c003 */
142
PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE")
143
PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(custom_port_read, "FAKE")
142
PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE")
143
PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, driver_device,custom_port_read, "FAKE")
145
145
PORT_START("FAKE")
146
146
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* related to music/sound */
150
150
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
151
151
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
152
152
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
153
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
153
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
156
156
/******************************************************************************/