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

« back to all changes in this revision

Viewing changes to src/mame/drivers/eprom.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:
74
74
 *
75
75
 *************************************/
76
76
 
77
 
static READ16_HANDLER( special_port1_r )
 
77
READ16_MEMBER(eprom_state::special_port1_r)
78
78
{
79
 
        eprom_state *state = space->machine().driver_data<eprom_state>();
80
 
        int result = input_port_read(space->machine(), "260010");
 
79
        int result = ioport("260010")->read();
81
80
 
82
 
        if (state->m_sound_to_cpu_ready) result ^= 0x0004;
83
 
        if (state->m_cpu_to_sound_ready) result ^= 0x0008;
 
81
        if (m_sound_to_cpu_ready) result ^= 0x0004;
 
82
        if (m_cpu_to_sound_ready) result ^= 0x0008;
84
83
        result ^= 0x0010;
85
84
 
86
85
        return result;
87
86
}
88
87
 
89
88
 
90
 
static READ16_HANDLER( adc_r )
 
89
READ16_MEMBER(eprom_state::adc_r)
91
90
{
92
 
        eprom_state *state = space->machine().driver_data<eprom_state>();
93
91
        static const char *const adcnames[] = { "ADC0", "ADC1", "ADC2", "ADC3" };
94
 
        int result = input_port_read(space->machine(), adcnames[state->m_last_offset & 3]);
 
92
        int result = ioport(adcnames[m_last_offset & 3])->read();
95
93
 
96
 
        state->m_last_offset = offset;
 
94
        m_last_offset = offset;
97
95
        return result;
98
96
}
99
97
 
105
103
 *
106
104
 *************************************/
107
105
 
108
 
static WRITE16_HANDLER( eprom_latch_w )
 
106
WRITE16_MEMBER(eprom_state::eprom_latch_w)
109
107
{
110
 
        eprom_state *state = space->machine().driver_data<eprom_state>();
111
108
 
112
 
        if (ACCESSING_BITS_0_7 && (space->machine().device("extra") != NULL))
 
109
        if (ACCESSING_BITS_0_7 && (machine().device("extra") != NULL))
113
110
        {
114
111
                /* bit 0: reset extra CPU */
115
112
                if (data & 1)
116
 
                        cputag_set_input_line(space->machine(), "extra", INPUT_LINE_RESET, CLEAR_LINE);
 
113
                        cputag_set_input_line(machine(), "extra", INPUT_LINE_RESET, CLEAR_LINE);
117
114
                else
118
 
                        cputag_set_input_line(space->machine(), "extra", INPUT_LINE_RESET, ASSERT_LINE);
 
115
                        cputag_set_input_line(machine(), "extra", INPUT_LINE_RESET, ASSERT_LINE);
119
116
 
120
117
                /* bits 1-4: screen intensity */
121
 
                state->m_screen_intensity = (data & 0x1e) >> 1;
 
118
                m_screen_intensity = (data & 0x1e) >> 1;
122
119
 
123
120
                /* bit 5: video disable */
124
 
                state->m_video_disable = (data & 0x20);
 
121
                m_video_disable = (data & 0x20);
125
122
        }
126
123
}
127
124
 
133
130
 *
134
131
 *************************************/
135
132
 
136
 
static READ16_HANDLER( sync_r )
 
133
READ16_MEMBER(eprom_state::sync_r)
137
134
{
138
 
        eprom_state *state = space->machine().driver_data<eprom_state>();
139
 
        return state->m_sync_data[offset];
 
135
        return m_sync_data[offset];
140
136
}
141
137
 
142
138
 
143
 
static WRITE16_HANDLER( sync_w )
 
139
WRITE16_MEMBER(eprom_state::sync_w)
144
140
{
145
 
        eprom_state *state = space->machine().driver_data<eprom_state>();
146
 
        int oldword = state->m_sync_data[offset];
 
141
        int oldword = m_sync_data[offset];
147
142
        int newword = oldword;
148
143
        COMBINE_DATA(&newword);
149
144
 
150
 
        state->m_sync_data[offset] = newword;
 
145
        m_sync_data[offset] = newword;
151
146
        if ((oldword & 0xff00) != (newword & 0xff00))
152
 
                device_yield(&space->device());
 
147
                device_yield(&space.device());
153
148
}
154
149
 
155
150
 
160
155
 *
161
156
 *************************************/
162
157
 
163
 
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16 )
 
158
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, eprom_state )
164
159
        AM_RANGE(0x000000, 0x09ffff) AM_ROM
165
 
        AM_RANGE(0x0e0000, 0x0e0fff) AM_READWRITE(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
166
 
        AM_RANGE(0x16cc00, 0x16cc01) AM_RAM AM_SHARE("share2")
 
160
        AM_RANGE(0x0e0000, 0x0e0fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
 
161
        AM_RANGE(0x16cc00, 0x16cc01) AM_RAM AM_SHARE("sync_data")
167
162
        AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1")
168
 
        AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE(atarigen_eeprom_enable_w)
 
163
        AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
169
164
        AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000")
170
165
        AM_RANGE(0x260010, 0x26001f) AM_READ(special_port1_r)
171
166
        AM_RANGE(0x260020, 0x26002f) AM_READ(adc_r)
172
 
        AM_RANGE(0x260030, 0x260031) AM_READ(atarigen_sound_r)
 
167
        AM_RANGE(0x260030, 0x260031) AM_READ_LEGACY(atarigen_sound_r)
173
168
        AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w)
174
 
        AM_RANGE(0x360000, 0x360001) AM_WRITE(atarigen_video_int_ack_w)
 
169
        AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
175
170
        AM_RANGE(0x360010, 0x360011) AM_WRITE(eprom_latch_w)
176
 
        AM_RANGE(0x360020, 0x360021) AM_WRITE(atarigen_sound_reset_w)
177
 
        AM_RANGE(0x360030, 0x360031) AM_WRITE(atarigen_sound_w)
178
 
        AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM AM_BASE_GENERIC(paletteram)
179
 
        AM_RANGE(0x3f0000, 0x3f1fff) AM_WRITE(atarigen_playfield_w) AM_BASE_MEMBER(eprom_state, m_playfield)
180
 
        AM_RANGE(0x3f2000, 0x3f3fff) AM_READWRITE(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
181
 
        AM_RANGE(0x3f4000, 0x3f4f7f) AM_WRITE(atarigen_alpha_w) AM_BASE_MEMBER(eprom_state, m_alpha)
182
 
        AM_RANGE(0x3f4f80, 0x3f4fff) AM_READWRITE(atarimo_0_slipram_r, atarimo_0_slipram_w)
183
 
        AM_RANGE(0x3f8000, 0x3f9fff) AM_WRITE(atarigen_playfield_upper_w) AM_BASE_MEMBER(eprom_state, m_playfield_upper)
 
171
        AM_RANGE(0x360020, 0x360021) AM_WRITE_LEGACY(atarigen_sound_reset_w)
 
172
        AM_RANGE(0x360030, 0x360031) AM_WRITE_LEGACY(atarigen_sound_w)
 
173
        AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM AM_SHARE("paletteram")
 
174
        AM_RANGE(0x3f0000, 0x3f1fff) AM_WRITE_LEGACY(atarigen_playfield_w) AM_SHARE("playfield")
 
175
        AM_RANGE(0x3f2000, 0x3f3fff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
 
176
        AM_RANGE(0x3f4000, 0x3f4f7f) AM_WRITE_LEGACY(atarigen_alpha_w) AM_SHARE("alpha")
 
177
        AM_RANGE(0x3f4f80, 0x3f4fff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
 
178
        AM_RANGE(0x3f8000, 0x3f9fff) AM_WRITE_LEGACY(atarigen_playfield_upper_w) AM_SHARE("playfield_up")
184
179
        AM_RANGE(0x3f0000, 0x3f9fff) AM_RAM
185
180
ADDRESS_MAP_END
186
181
 
187
182
 
188
 
static ADDRESS_MAP_START( guts_map, AS_PROGRAM, 16 )
 
183
static ADDRESS_MAP_START( guts_map, AS_PROGRAM, 16, eprom_state )
189
184
        AM_RANGE(0x000000, 0x09ffff) AM_ROM
190
 
        AM_RANGE(0x0e0000, 0x0e0fff) AM_READWRITE(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
191
 
        AM_RANGE(0x16cc00, 0x16cc01) AM_RAM AM_SHARE("share2")
 
185
        AM_RANGE(0x0e0000, 0x0e0fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
 
186
        AM_RANGE(0x16cc00, 0x16cc01) AM_RAM AM_SHARE("sync_data")
192
187
        AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1")
193
 
        AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE(atarigen_eeprom_enable_w)
 
188
        AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w)
194
189
        AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000")
195
190
        AM_RANGE(0x260010, 0x26001f) AM_READ(special_port1_r)
196
191
        AM_RANGE(0x260020, 0x26002f) AM_READ(adc_r)
197
 
        AM_RANGE(0x260030, 0x260031) AM_READ(atarigen_sound_r)
 
192
        AM_RANGE(0x260030, 0x260031) AM_READ_LEGACY(atarigen_sound_r)
198
193
        AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w)
199
 
        AM_RANGE(0x360000, 0x360001) AM_WRITE(atarigen_video_int_ack_w)
 
194
        AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
200
195
//  AM_RANGE(0x360010, 0x360011) AM_WRITE(eprom_latch_w)
201
 
        AM_RANGE(0x360020, 0x360021) AM_WRITE(atarigen_sound_reset_w)
202
 
        AM_RANGE(0x360030, 0x360031) AM_WRITE(atarigen_sound_w)
203
 
        AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM AM_BASE_GENERIC(paletteram)
204
 
        AM_RANGE(0xff0000, 0xff1fff) AM_WRITE(atarigen_playfield_upper_w) AM_BASE_MEMBER(eprom_state, m_playfield_upper)
205
 
        AM_RANGE(0xff8000, 0xff9fff) AM_WRITE(atarigen_playfield_w) AM_BASE_MEMBER(eprom_state, m_playfield)
206
 
        AM_RANGE(0xffa000, 0xffbfff) AM_READWRITE(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
207
 
        AM_RANGE(0xffc000, 0xffcf7f) AM_WRITE(atarigen_alpha_w) AM_BASE_MEMBER(eprom_state, m_alpha)
208
 
        AM_RANGE(0xffcf80, 0xffcfff) AM_READWRITE(atarimo_0_slipram_r, atarimo_0_slipram_w)
 
196
        AM_RANGE(0x360020, 0x360021) AM_WRITE_LEGACY(atarigen_sound_reset_w)
 
197
        AM_RANGE(0x360030, 0x360031) AM_WRITE_LEGACY(atarigen_sound_w)
 
198
        AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM AM_SHARE("paletteram")
 
199
        AM_RANGE(0xff0000, 0xff1fff) AM_WRITE_LEGACY(atarigen_playfield_upper_w) AM_SHARE("playfield_up")
 
200
        AM_RANGE(0xff8000, 0xff9fff) AM_WRITE_LEGACY(atarigen_playfield_w) AM_SHARE("playfield")
 
201
        AM_RANGE(0xffa000, 0xffbfff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w)
 
202
        AM_RANGE(0xffc000, 0xffcf7f) AM_WRITE_LEGACY(atarigen_alpha_w) AM_SHARE("alpha")
 
203
        AM_RANGE(0xffcf80, 0xffcfff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w)
209
204
        AM_RANGE(0xff0000, 0xff1fff) AM_RAM
210
205
        AM_RANGE(0xff8000, 0xffffff) AM_RAM
211
206
ADDRESS_MAP_END
218
213
 *
219
214
 *************************************/
220
215
 
221
 
static ADDRESS_MAP_START( extra_map, AS_PROGRAM, 16 )
 
216
static ADDRESS_MAP_START( extra_map, AS_PROGRAM, 16, eprom_state )
222
217
        AM_RANGE(0x000000, 0x07ffff) AM_ROM
223
 
        AM_RANGE(0x16cc00, 0x16cc01) AM_READWRITE(sync_r, sync_w) AM_SHARE("share2") AM_BASE_MEMBER(eprom_state, m_sync_data)
 
218
        AM_RANGE(0x16cc00, 0x16cc01) AM_READWRITE(sync_r, sync_w) AM_SHARE("sync_data")
224
219
        AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1")
225
220
        AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000")
226
221
        AM_RANGE(0x260010, 0x26001f) AM_READ(special_port1_r)
227
222
        AM_RANGE(0x260020, 0x26002f) AM_READ(adc_r)
228
 
        AM_RANGE(0x260030, 0x260031) AM_READ(atarigen_sound_r)
229
 
        AM_RANGE(0x360000, 0x360001) AM_WRITE(atarigen_video_int_ack_w)
 
223
        AM_RANGE(0x260030, 0x260031) AM_READ_LEGACY(atarigen_sound_r)
 
224
        AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(atarigen_video_int_ack_w)
230
225
        AM_RANGE(0x360010, 0x360011) AM_WRITE(eprom_latch_w)
231
 
        AM_RANGE(0x360020, 0x360021) AM_WRITE(atarigen_sound_reset_w)
232
 
        AM_RANGE(0x360030, 0x360031) AM_WRITE(atarigen_sound_w)
 
226
        AM_RANGE(0x360020, 0x360021) AM_WRITE_LEGACY(atarigen_sound_reset_w)
 
227
        AM_RANGE(0x360030, 0x360031) AM_WRITE_LEGACY(atarigen_sound_w)
233
228
ADDRESS_MAP_END
234
229
 
235
230
 
250
245
        PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
251
246
 
252
247
        PORT_START("260010")
253
 
        PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK )
 
248
        PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
254
249
        PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
255
250
        PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )   /* Input buffer full (@260030) */
256
251
        PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) /* Output buffer full (@360030) */
295
290
        PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
296
291
 
297
292
        PORT_START("260010")
298
 
        PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK )
 
293
        PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
299
294
        PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
300
295
        PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )   /* Input buffer full (@260030) */
301
296
        PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) /* Output buffer full (@360030) */
324
319
        PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
325
320
 
326
321
        PORT_START("260010")            /* 260010 */
327
 
        PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_VBLANK )
 
322
        PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
328
323
        PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
329
324
        PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )   /* Input buffer full (@260030) */
330
325
        PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) /* Output buffer full (@360030) */
728
723
        atarijsa_init(machine, "260010", 0x0002);
729
724
 
730
725
        /* install CPU synchronization handlers */
731
 
        state->m_sync_data = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x16cc00, 0x16cc01, FUNC(sync_r), FUNC(sync_w));
732
 
        state->m_sync_data = machine.device("extra")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x16cc00, 0x16cc01, FUNC(sync_r), FUNC(sync_w));
 
726
        state->m_sync_data = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),state), write16_delegate(FUNC(eprom_state::sync_w),state));
 
727
        state->m_sync_data = machine.device("extra")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),state), write16_delegate(FUNC(eprom_state::sync_w),state));
733
728
}
734
729
 
735
730