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

« back to all changes in this revision

Viewing changes to src/mame/drivers/pturn.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:
83
83
{
84
84
public:
85
85
        pturn_state(const machine_config &mconfig, device_type type, const char *tag)
86
 
                : driver_device(mconfig, type, tag) { }
 
86
                : driver_device(mconfig, type, tag) ,
 
87
                m_videoram(*this, "videoram"),
 
88
                m_spriteram(*this, "spriteram"){ }
87
89
 
88
 
        UINT8 *m_videoram;
 
90
        required_shared_ptr<UINT8> m_videoram;
89
91
        tilemap_t *m_fgmap;
90
92
        tilemap_t *m_bgmap;
91
93
        int m_bgbank;
95
97
        int m_bgcolor;
96
98
        int m_nmi_main;
97
99
        int m_nmi_sub;
98
 
        UINT8 *m_spriteram;
99
 
        size_t m_spriteram_size;
 
100
        required_shared_ptr<UINT8> m_spriteram;
 
101
        DECLARE_WRITE8_MEMBER(pturn_videoram_w);
 
102
        DECLARE_WRITE8_MEMBER(nmi_main_enable_w);
 
103
        DECLARE_WRITE8_MEMBER(nmi_sub_enable_w);
 
104
        DECLARE_WRITE8_MEMBER(sound_w);
 
105
        DECLARE_WRITE8_MEMBER(bgcolor_w);
 
106
        DECLARE_WRITE8_MEMBER(bg_scrollx_w);
 
107
        DECLARE_WRITE8_MEMBER(fgpalette_w);
 
108
        DECLARE_WRITE8_MEMBER(bg_scrolly_w);
 
109
        DECLARE_WRITE8_MEMBER(fgbank_w);
 
110
        DECLARE_WRITE8_MEMBER(bgbank_w);
 
111
        DECLARE_WRITE8_MEMBER(flip_w);
 
112
        DECLARE_READ8_MEMBER(pturn_custom_r);
 
113
        DECLARE_READ8_MEMBER(pturn_protection_r);
 
114
        DECLARE_READ8_MEMBER(pturn_protection2_r);
100
115
};
101
116
 
102
117
 
128
143
{
129
144
        pturn_state *state = machine.driver_data<pturn_state>();
130
145
        int tileno,palno;
131
 
        tileno = machine.region("user1")->base()[tile_index];
 
146
        tileno = state->memregion("user1")->base()[tile_index];
132
147
        palno=state->m_bgpalette;
133
148
        if(palno==1)
134
149
        {
165
180
                flipy=spriteram[offs+1]&0x80;
166
181
 
167
182
 
168
 
                if (flip_screen_x_get(screen.machine()))
 
183
                if (state->flip_screen_x())
169
184
                {
170
185
                        sx = 224 - sx;
171
186
                        flipx ^= 0x40;
172
187
                }
173
188
 
174
 
                if (flip_screen_y_get(screen.machine()))
 
189
                if (state->flip_screen_y())
175
190
                {
176
191
                        flipy ^= 0x80;
177
192
                        sy = 224 - sy;
191
206
}
192
207
 
193
208
#ifdef UNUSED_FUNCTION
194
 
READ8_HANDLER (pturn_protection_r)
 
209
READ8_MEMBER(pturn_state::pturn_protection_r)
195
210
{
196
211
    return 0x66;
197
212
}
198
213
 
199
 
READ8_HANDLER (pturn_protection2_r)
 
214
READ8_MEMBER(pturn_state::pturn_protection2_r)
200
215
{
201
216
    return 0xfe;
202
217
}
203
218
#endif
204
219
 
205
 
static WRITE8_HANDLER( pturn_videoram_w )
 
220
WRITE8_MEMBER(pturn_state::pturn_videoram_w)
206
221
{
207
 
        pturn_state *state = space->machine().driver_data<pturn_state>();
208
 
        UINT8 *videoram = state->m_videoram;
 
222
        UINT8 *videoram = m_videoram;
209
223
        videoram[offset]=data;
210
 
        state->m_fgmap->mark_tile_dirty(offset);
211
 
}
212
 
 
213
 
 
214
 
static WRITE8_HANDLER( nmi_main_enable_w )
215
 
{
216
 
        pturn_state *state = space->machine().driver_data<pturn_state>();
217
 
        state->m_nmi_main = data;
218
 
}
219
 
 
220
 
static WRITE8_HANDLER( nmi_sub_enable_w )
221
 
{
222
 
        pturn_state *state = space->machine().driver_data<pturn_state>();
223
 
        state->m_nmi_sub = data;
224
 
}
225
 
 
226
 
static WRITE8_HANDLER(sound_w)
227
 
{
228
 
        soundlatch_w(space,0,data);
229
 
}
230
 
 
231
 
 
232
 
static WRITE8_HANDLER(bgcolor_w)
233
 
{
234
 
        pturn_state *state = space->machine().driver_data<pturn_state>();
235
 
        state->m_bgcolor=data;
236
 
}
237
 
 
238
 
static WRITE8_HANDLER(bg_scrollx_w)
239
 
{
240
 
        pturn_state *state = space->machine().driver_data<pturn_state>();
241
 
        state->m_bgmap->set_scrolly(0, (data>>5)*32*8);
242
 
        state->m_bgpalette=data&0x1f;
243
 
        state->m_bgmap->mark_all_dirty();
244
 
}
245
 
 
246
 
static WRITE8_HANDLER(fgpalette_w)
247
 
{
248
 
        pturn_state *state = space->machine().driver_data<pturn_state>();
249
 
        state->m_fgpalette=data&0x1f;
250
 
        state->m_fgmap->mark_all_dirty();
251
 
}
252
 
 
253
 
static WRITE8_HANDLER(bg_scrolly_w)
254
 
{
255
 
        pturn_state *state = space->machine().driver_data<pturn_state>();
256
 
        state->m_bgmap->set_scrollx(0, data);
257
 
}
258
 
 
259
 
static WRITE8_HANDLER(fgbank_w)
260
 
{
261
 
        pturn_state *state = space->machine().driver_data<pturn_state>();
262
 
        state->m_fgbank=data&1;
263
 
        state->m_fgmap->mark_all_dirty();
264
 
}
265
 
 
266
 
static WRITE8_HANDLER(bgbank_w)
267
 
{
268
 
        pturn_state *state = space->machine().driver_data<pturn_state>();
269
 
        state->m_bgbank=data&1;
270
 
        state->m_bgmap->mark_all_dirty();
271
 
}
272
 
 
273
 
static WRITE8_HANDLER(flip_w)
274
 
{
275
 
        flip_screen_set(space->machine(), data);
276
 
}
277
 
 
278
 
 
279
 
static READ8_HANDLER (pturn_custom_r)
 
224
        m_fgmap->mark_tile_dirty(offset);
 
225
}
 
226
 
 
227
 
 
228
WRITE8_MEMBER(pturn_state::nmi_main_enable_w)
 
229
{
 
230
        m_nmi_main = data;
 
231
}
 
232
 
 
233
WRITE8_MEMBER(pturn_state::nmi_sub_enable_w)
 
234
{
 
235
        m_nmi_sub = data;
 
236
}
 
237
 
 
238
WRITE8_MEMBER(pturn_state::sound_w)
 
239
{
 
240
        soundlatch_byte_w(space,0,data);
 
241
}
 
242
 
 
243
 
 
244
WRITE8_MEMBER(pturn_state::bgcolor_w)
 
245
{
 
246
        m_bgcolor=data;
 
247
}
 
248
 
 
249
WRITE8_MEMBER(pturn_state::bg_scrollx_w)
 
250
{
 
251
        m_bgmap->set_scrolly(0, (data>>5)*32*8);
 
252
        m_bgpalette=data&0x1f;
 
253
        m_bgmap->mark_all_dirty();
 
254
}
 
255
 
 
256
WRITE8_MEMBER(pturn_state::fgpalette_w)
 
257
{
 
258
        m_fgpalette=data&0x1f;
 
259
        m_fgmap->mark_all_dirty();
 
260
}
 
261
 
 
262
WRITE8_MEMBER(pturn_state::bg_scrolly_w)
 
263
{
 
264
        m_bgmap->set_scrollx(0, data);
 
265
}
 
266
 
 
267
WRITE8_MEMBER(pturn_state::fgbank_w)
 
268
{
 
269
        m_fgbank=data&1;
 
270
        m_fgmap->mark_all_dirty();
 
271
}
 
272
 
 
273
WRITE8_MEMBER(pturn_state::bgbank_w)
 
274
{
 
275
        m_bgbank=data&1;
 
276
        m_bgmap->mark_all_dirty();
 
277
}
 
278
 
 
279
WRITE8_MEMBER(pturn_state::flip_w)
 
280
{
 
281
        flip_screen_set(data);
 
282
}
 
283
 
 
284
 
 
285
READ8_MEMBER(pturn_state::pturn_custom_r)
280
286
{
281
287
        int addr = (int)offset + 0xc800;
282
288
 
302
308
}
303
309
 
304
310
 
305
 
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 )
 
311
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, pturn_state )
306
312
        AM_RANGE(0x0000, 0x7fff) AM_ROM
307
313
        AM_RANGE(0xc000, 0xc7ff) AM_RAM
308
314
        AM_RANGE(0xc800, 0xcfff) AM_WRITENOP AM_READ(pturn_custom_r)
309
315
 
310
316
        AM_RANGE(0xdfe0, 0xdfe0) AM_NOP
311
317
 
312
 
        AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(pturn_videoram_w) AM_BASE_MEMBER(pturn_state, m_videoram)
 
318
        AM_RANGE(0xe000, 0xe3ff) AM_RAM_WRITE(pturn_videoram_w) AM_SHARE("videoram")
313
319
        AM_RANGE(0xe400, 0xe400) AM_WRITE(fgpalette_w)
314
320
        AM_RANGE(0xe800, 0xe800) AM_WRITE(sound_w)
315
321
 
316
 
        AM_RANGE(0xf000, 0xf0ff) AM_RAM AM_BASE_SIZE_MEMBER(pturn_state, m_spriteram, m_spriteram_size)
 
322
        AM_RANGE(0xf000, 0xf0ff) AM_RAM AM_SHARE("spriteram")
317
323
 
318
324
        AM_RANGE(0xf400, 0xf400) AM_WRITE(bg_scrollx_w)
319
325
 
325
331
        AM_RANGE(0xf805, 0xf805) AM_READ_PORT("DSW1")
326
332
        AM_RANGE(0xf806, 0xf806) AM_READNOP /* Protection related, ((val&3)==2) -> jump to 0 */
327
333
 
328
 
        AM_RANGE(0xfc00, 0xfc00) AM_WRITE (flip_w)
 
334
        AM_RANGE(0xfc00, 0xfc00) AM_WRITE(flip_w)
329
335
        AM_RANGE(0xfc01, 0xfc01) AM_WRITE(nmi_main_enable_w)
330
336
        AM_RANGE(0xfc02, 0xfc02) AM_WRITENOP /* Unknown */
331
337
        AM_RANGE(0xfc03, 0xfc03) AM_WRITENOP /* Unknown */
336
342
 
337
343
ADDRESS_MAP_END
338
344
 
339
 
static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8 )
 
345
static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, pturn_state )
340
346
        AM_RANGE(0x0000, 0x0fff) AM_ROM
341
347
        AM_RANGE(0x2000, 0x23ff) AM_RAM
342
 
        AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_r) AM_WRITE(nmi_sub_enable_w)
 
348
        AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r) AM_WRITE(nmi_sub_enable_w)
343
349
        AM_RANGE(0x4000, 0x4000) AM_RAM
344
 
        AM_RANGE(0x5000, 0x5001) AM_DEVWRITE("ay1", ay8910_address_data_w)
345
 
        AM_RANGE(0x6000, 0x6001) AM_DEVWRITE("ay2", ay8910_address_data_w)
 
350
        AM_RANGE(0x5000, 0x5001) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
 
351
        AM_RANGE(0x6000, 0x6001) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
346
352
ADDRESS_MAP_END
347
353
 
348
354
static const gfx_layout charlayout =
471
477
 
472
478
static MACHINE_RESET( pturn )
473
479
{
 
480
        pturn_state *state = machine.driver_data<pturn_state>();
474
481
        address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
475
 
        soundlatch_clear_w(space,0,0);
 
482
        state->soundlatch_clear_byte_w(*space,0,0);
476
483
}
477
484
 
478
485
static MACHINE_CONFIG_START( pturn, pturn_state )