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

« back to all changes in this revision

Viewing changes to src/mame/video/galivan.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:
54
54
 
55
55
PALETTE_INIT( galivan )
56
56
{
 
57
        const UINT8 *color_prom = machine.root_device().memregion("proms")->base();
57
58
        int i;
58
59
 
59
60
        /* allocate the colortable */
121
122
 
122
123
static TILE_GET_INFO( get_bg_tile_info )
123
124
{
124
 
        UINT8 *BGROM = machine.region("gfx4")->base();
 
125
        UINT8 *BGROM = machine.root_device().memregion("gfx4")->base();
125
126
        int attr = BGROM[tile_index + 0x4000];
126
127
        int code = BGROM[tile_index] | ((attr & 0x03) << 8);
127
128
        SET_TILE_INFO(
146
147
 
147
148
static TILE_GET_INFO( ninjemak_get_bg_tile_info )
148
149
{
149
 
        UINT8 *BGROM = machine.region("gfx4")->base();
 
150
        UINT8 *BGROM = machine.root_device().memregion("gfx4")->base();
150
151
        int attr = BGROM[tile_index + 0x4000];
151
152
        int code = BGROM[tile_index] | ((attr & 0x03) << 8);
152
153
        SET_TILE_INFO(
208
209
 
209
210
***************************************************************************/
210
211
 
211
 
WRITE8_HANDLER( galivan_videoram_w )
 
212
WRITE8_MEMBER(galivan_state::galivan_videoram_w)
212
213
{
213
 
        galivan_state *state = space->machine().driver_data<galivan_state>();
214
 
        state->m_videoram[offset] = data;
215
 
        state->m_tx_tilemap->mark_tile_dirty(offset & 0x3ff);
 
214
        m_videoram[offset] = data;
 
215
        m_tx_tilemap->mark_tile_dirty(offset & 0x3ff);
216
216
}
217
217
 
218
218
/* Written through port 40 */
219
 
WRITE8_HANDLER( galivan_gfxbank_w )
 
219
WRITE8_MEMBER(galivan_state::galivan_gfxbank_w)
220
220
{
221
 
        galivan_state *state = space->machine().driver_data<galivan_state>();
222
221
 
223
222
        /* bits 0 and 1 coin counters */
224
 
        coin_counter_w(space->machine(), 0,data & 1);
225
 
        coin_counter_w(space->machine(), 1,data & 2);
 
223
        coin_counter_w(machine(), 0,data & 1);
 
224
        coin_counter_w(machine(), 1,data & 2);
226
225
 
227
226
        /* bit 2 flip screen */
228
 
        state->m_flipscreen = data & 0x04;
229
 
        state->m_bg_tilemap->set_flip(state->m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
230
 
        state->m_tx_tilemap->set_flip(state->m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
 
227
        m_flipscreen = data & 0x04;
 
228
        m_bg_tilemap->set_flip(m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
 
229
        m_tx_tilemap->set_flip(m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
231
230
 
232
231
        /* bit 7 selects one of two ROM banks for c000-dfff */
233
 
        memory_set_bank(space->machine(), "bank1", (data & 0x80) >> 7);
 
232
        membank("bank1")->set_entry((data & 0x80) >> 7);
234
233
 
235
 
        /*  logerror("Address: %04X - port 40 = %02x\n", cpu_get_pc(&space->device()), data); */
 
234
        /*  logerror("Address: %04X - port 40 = %02x\n", cpu_get_pc(&space.device()), data); */
236
235
}
237
236
 
238
 
WRITE8_HANDLER( ninjemak_gfxbank_w )
 
237
WRITE8_MEMBER(galivan_state::ninjemak_gfxbank_w)
239
238
{
240
 
        galivan_state *state = space->machine().driver_data<galivan_state>();
241
239
 
242
240
        /* bits 0 and 1 coin counters */
243
 
        coin_counter_w(space->machine(), 0,data & 1);
244
 
        coin_counter_w(space->machine(), 1,data & 2);
 
241
        coin_counter_w(machine(), 0,data & 1);
 
242
        coin_counter_w(machine(), 1,data & 2);
245
243
 
246
244
        /* bit 2 flip screen */
247
 
        state->m_flipscreen = data & 0x04;
248
 
        state->m_bg_tilemap->set_flip(state->m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
249
 
        state->m_tx_tilemap->set_flip(state->m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
 
245
        m_flipscreen = data & 0x04;
 
246
        m_bg_tilemap->set_flip(m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
 
247
        m_tx_tilemap->set_flip(m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
250
248
 
251
249
        /* bit 3 unknown */
252
250
 
253
251
        /* bit 4 background disable flag */
254
 
        state->m_ninjemak_dispdisable = data & 0x10;
 
252
        m_ninjemak_dispdisable = data & 0x10;
255
253
 
256
254
        /* bit 5 sprite flag ??? */
257
255
 
258
256
        /* bit 6, 7 ROM bank select */
259
 
        memory_set_bank(space->machine(), "bank1", (data & 0xc0) >> 6);
 
257
        membank("bank1")->set_entry((data & 0xc0) >> 6);
260
258
 
261
259
#if 0
262
260
        {
275
273
 
276
274
 
277
275
/* Written through port 41-42 */
278
 
WRITE8_HANDLER( galivan_scrollx_w )
 
276
WRITE8_MEMBER(galivan_state::galivan_scrollx_w)
279
277
{
280
 
        galivan_state *state = space->machine().driver_data<galivan_state>();
281
278
        if (offset == 1)
282
279
        {
283
280
                if (data & 0x80)
284
 
                        state->m_write_layers = 1;
285
 
                else if (state->m_write_layers)
 
281
                        m_write_layers = 1;
 
282
                else if (m_write_layers)
286
283
                {
287
 
                        state->m_layers = data & 0x60;
288
 
                        state->m_write_layers = 0;
 
284
                        m_layers = data & 0x60;
 
285
                        m_write_layers = 0;
289
286
                }
290
287
        }
291
 
        state->m_galivan_scrollx[offset] = data;
 
288
        m_galivan_scrollx[offset] = data;
292
289
}
293
290
 
294
291
/* Written through port 43-44 */
295
 
WRITE8_HANDLER( galivan_scrolly_w )
 
292
WRITE8_MEMBER(galivan_state::galivan_scrolly_w)
296
293
{
297
 
        galivan_state *state = space->machine().driver_data<galivan_state>();
298
 
        state->m_galivan_scrolly[offset] = data;
 
294
        m_galivan_scrolly[offset] = data;
299
295
}
300
296
 
301
297
 
309
305
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
310
306
{
311
307
        galivan_state *state = machine.driver_data<galivan_state>();
312
 
        const UINT8 *spritepalettebank = machine.region("user1")->base();
 
308
        const UINT8 *spritepalettebank = state->memregion("user1")->base();
313
309
        UINT8 *spriteram = state->m_spriteram;
314
310
        int offs;
315
311
 
316
312
        /* draw the sprites */
317
 
        for (offs = 0; offs < state->m_spriteram_size; offs += 4)
 
313
        for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
318
314
        {
319
315
                int code;
320
316
                int attr = spriteram[offs + 2];