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

« back to all changes in this revision

Viewing changes to src/mame/drivers/m79amb.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:
62
62
{
63
63
public:
64
64
        m79amb_state(const machine_config &mconfig, device_type type, const char *tag)
65
 
                : driver_device(mconfig, type, tag) { }
 
65
                : driver_device(mconfig, type, tag) ,
 
66
                m_videoram(*this, "videoram"),
 
67
                m_mask(*this, "mask"){ }
66
68
 
67
69
        /* memory pointers */
68
 
        UINT8 *        m_videoram;
69
 
        UINT8 *        m_mask;
 
70
        required_shared_ptr<UINT8> m_videoram;
 
71
        required_shared_ptr<UINT8> m_mask;
70
72
 
71
73
        /* misc */
72
74
        UINT8 m_lut_gun1[0x100];
73
75
        UINT8 m_lut_gun2[0x100];
 
76
        DECLARE_WRITE8_MEMBER(ramtek_videoram_w);
 
77
        DECLARE_READ8_MEMBER(gray5bit_controller0_r);
 
78
        DECLARE_READ8_MEMBER(gray5bit_controller1_r);
 
79
        DECLARE_WRITE8_MEMBER(m79amb_8002_w);
74
80
};
75
81
 
76
82
 
77
 
static WRITE8_HANDLER( ramtek_videoram_w )
 
83
WRITE8_MEMBER(m79amb_state::ramtek_videoram_w)
78
84
{
79
 
        m79amb_state *state = space->machine().driver_data<m79amb_state>();
80
 
        state->m_videoram[offset] = data & ~*state->m_mask;
 
85
        m_videoram[offset] = data & ~*m_mask;
81
86
}
82
87
 
83
88
static SCREEN_UPDATE_RGB32( ramtek )
107
112
}
108
113
 
109
114
 
110
 
static READ8_HANDLER( gray5bit_controller0_r )
111
 
{
112
 
        m79amb_state *state = space->machine().driver_data<m79amb_state>();
113
 
        UINT8 port_data = input_port_read(space->machine(), "8004");
114
 
        UINT8 gun_pos = input_port_read(space->machine(), "GUN1");
115
 
 
116
 
        return (port_data & 0xe0) | state->m_lut_gun1[gun_pos];
117
 
}
118
 
 
119
 
static READ8_HANDLER( gray5bit_controller1_r )
120
 
{
121
 
        m79amb_state *state = space->machine().driver_data<m79amb_state>();
122
 
        UINT8 port_data = input_port_read(space->machine(), "8005");
123
 
        UINT8 gun_pos = input_port_read(space->machine(), "GUN2");
124
 
 
125
 
        return (port_data & 0xe0) | state->m_lut_gun2[gun_pos];
126
 
}
127
 
 
128
 
static WRITE8_HANDLER( m79amb_8002_w )
 
115
READ8_MEMBER(m79amb_state::gray5bit_controller0_r)
 
116
{
 
117
        UINT8 port_data = ioport("8004")->read();
 
118
        UINT8 gun_pos = ioport("GUN1")->read();
 
119
 
 
120
        return (port_data & 0xe0) | m_lut_gun1[gun_pos];
 
121
}
 
122
 
 
123
READ8_MEMBER(m79amb_state::gray5bit_controller1_r)
 
124
{
 
125
        UINT8 port_data = ioport("8005")->read();
 
126
        UINT8 gun_pos = ioport("GUN2")->read();
 
127
 
 
128
        return (port_data & 0xe0) | m_lut_gun2[gun_pos];
 
129
}
 
130
 
 
131
WRITE8_MEMBER(m79amb_state::m79amb_8002_w)
129
132
{
130
133
        /* D1 may also be watchdog reset */
131
134
        /* port goes to 0x7f to turn on explosion lamp */
132
135
        output_set_value("EXP_LAMP", data ? 1 : 0);
133
136
}
134
137
 
135
 
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 )
 
138
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, m79amb_state )
136
139
        AM_RANGE(0x0000, 0x1fff) AM_ROM
137
 
        AM_RANGE(0x4000, 0x5fff) AM_RAM_WRITE(ramtek_videoram_w) AM_BASE_MEMBER(m79amb_state, m_videoram)
 
140
        AM_RANGE(0x4000, 0x5fff) AM_RAM_WRITE(ramtek_videoram_w) AM_SHARE("videoram")
138
141
        AM_RANGE(0x6000, 0x63ff) AM_RAM                                 /* ?? */
139
 
        AM_RANGE(0x8000, 0x8000) AM_READ_PORT("8000") AM_DEVWRITE("discrete", m79amb_8000_w)
140
 
        AM_RANGE(0x8001, 0x8001) AM_WRITEONLY AM_BASE_MEMBER(m79amb_state, m_mask)
 
142
        AM_RANGE(0x8000, 0x8000) AM_READ_PORT("8000") AM_DEVWRITE_LEGACY("discrete", m79amb_8000_w)
 
143
        AM_RANGE(0x8001, 0x8001) AM_WRITEONLY AM_SHARE("mask")
141
144
        AM_RANGE(0x8002, 0x8002) AM_READ_PORT("8002") AM_WRITE(m79amb_8002_w)
142
 
        AM_RANGE(0x8003, 0x8003) AM_DEVWRITE("discrete", m79amb_8003_w)
 
145
        AM_RANGE(0x8003, 0x8003) AM_DEVWRITE_LEGACY("discrete", m79amb_8003_w)
143
146
        AM_RANGE(0x8004, 0x8004) AM_READ(gray5bit_controller0_r)
144
147
        AM_RANGE(0x8005, 0x8005) AM_READ(gray5bit_controller1_r)
145
148
        AM_RANGE(0xc000, 0xc07f) AM_RAM                                 /* ?? */
168
171
        PORT_DIPSETTING(    0xc0, DEF_STR( Free_Play ))
169
172
 
170
173
        PORT_START("8002")
171
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_VBLANK )
 
174
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
172
175
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
173
176
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
174
177
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT )
287
290
static DRIVER_INIT( m79amb )
288
291
{
289
292
        m79amb_state *state = machine.driver_data<m79amb_state>();
290
 
        UINT8 *rom = machine.region("maincpu")->base();
 
293
        UINT8 *rom = state->memregion("maincpu")->base();
291
294
        int i, j;
292
295
 
293
296
        /* PROM data is active low */