~ubuntu-branches/ubuntu/karmic/xmame/karmic

« back to all changes in this revision

Viewing changes to src/vidhrdw/dec0.c

  • Committer: Bazaar Package Importer
  • Author(s): Bruno Barrera C.
  • Date: 2007-02-16 10:06:54 UTC
  • mfrom: (2.1.5 edgy)
  • Revision ID: james.westby@ubuntu.com-20070216100654-iztas2cl47k5j039
Tags: 0.106-2
* Added Italian debconf templates translation. (closes: #382672)
* Added German debconf templates translation. (closes: #396610)
* Added Japanese debconf templates translation. (closes: #400011)
* Added Portuguese debconf templates translation. (closes: #409960)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
*********************************************************************
6
6
 
7
 
        Each game uses the MXC-06 chip to produce sprites.
8
 
 
9
 
        Sprite data:  The unknown bits seem to be unused.
10
 
 
11
 
        Byte 0:
12
 
                Bit 0 : Y co-ord hi bit
13
 
                Bit 1,2: ?
14
 
                Bit 3,4 : Sprite height (1x, 2x, 4x, 8x)
15
 
                Bit 5  - X flip
16
 
                Bit 6  - Y flip
17
 
                Bit 7  - Only display Sprite if set
18
 
        Byte 1: Y-coords
19
 
        Byte 2:
20
 
                Bit 0,1,2,3: Hi bits of sprite number
21
 
                Bit 4,5,6,7: (Probably unused MSB's of sprite)
22
 
        Byte 3: Low bits of sprite number
23
 
        Byte 4:
24
 
                Bit 0 : X co-ords hi bit
25
 
                Bit 1,2: ??
26
 
                Bit 3: Sprite flash (sprite is displayed every other frame)
27
 
                Bit 4,5,6,7:  - Colour
28
 
        Byte 5: X-coords
 
7
    Each game uses the MXC-06 chip to produce sprites.
 
8
 
 
9
    Sprite data:  The unknown bits seem to be unused.
 
10
 
 
11
    Byte 0:
 
12
        Bit 0 : Y co-ord hi bit
 
13
        Bit 1,2 : Sprite width (1x, 2x, 4x, 8x) - NOT YET EMULATED (todo)
 
14
        Bit 3,4 : Sprite height (1x, 2x, 4x, 8x)
 
15
        Bit 5  - X flip
 
16
        Bit 6  - Y flip
 
17
        Bit 7  - Only display Sprite if set
 
18
    Byte 1: Y-coords
 
19
    Byte 2:
 
20
        Bit 0,1,2,3: Hi bits of sprite number
 
21
        Bit 4,5,6,7: (Probably unused MSB's of sprite)
 
22
    Byte 3: Low bits of sprite number
 
23
    Byte 4:
 
24
        Bit 0 : X co-ords hi bit
 
25
        Bit 1,2: ??
 
26
        Bit 3: Sprite flash (sprite is displayed every other frame)
 
27
        Bit 4,5,6,7:  - Colour
 
28
    Byte 5: X-coords
29
29
 
30
30
**********************************************************************
31
31
 
34
34
    0x000 - character palettes (Sprites on Midnight R)
35
35
    0x200 - sprite palettes (Characters on Midnight R)
36
36
    0x400 - tiles 1
37
 
        0x600 - tiles 2
 
37
    0x600 - tiles 2
38
38
 
39
 
        Bad Dudes, Robocop, Heavy Barrel, Hippodrome - 24 bit rgb
40
 
        Sly Spy, Midnight Resistance - 12 bit rgb
 
39
    Bad Dudes, Robocop, Heavy Barrel, Hippodrome - 24 bit rgb
 
40
    Sly Spy, Midnight Resistance - 12 bit rgb
41
41
 
42
42
  Tile data
43
43
 
44
 
        4 bit palette select, 12 bit tile select
 
44
    4 bit palette select, 12 bit tile select
45
45
 
46
46
**********************************************************************
47
47
 
51
51
 Playfield control registers:
52
52
   bank 0:
53
53
   0:
54
 
                bit 0 (0x1) set = 8*8 tiles, else 16*16 tiles
55
 
                Bit 1 (0x2) unknown
56
 
                bit 2 (0x4) set enables rowscroll
57
 
                bit 3 (0x8) set enables colscroll
58
 
                bit 7 (0x80) set in playfield 1 is reverse screen (set via dip-switch)
59
 
                bit 7 (0x80) in other playfields unknown
 
54
        bit 0 (0x1) set = 8*8 tiles, else 16*16 tiles
 
55
        Bit 1 (0x2) unknown
 
56
        bit 2 (0x4) set enables rowscroll
 
57
        bit 3 (0x8) set enables colscroll
 
58
        bit 7 (0x80) set in playfield 1 is reverse screen (set via dip-switch)
 
59
        bit 7 (0x80) in other playfields unknown
60
60
   2: unknown (00 in bg, 03 in fg+text - maybe controls pf transparency?)
61
61
   4: unknown (always 00)
62
62
   6: playfield shape: 00 = 4x1, 01 = 2x2, 02 = 1x4 (low 4 bits only)
64
64
   bank 1:
65
65
   0: horizontal scroll
66
66
   2: vertical scroll
67
 
   4: Style of colscroll (low 4 bits, top 4 bits do nothing)
68
 
   6: Style of rowscroll (low 4 bits, top 4 bits do nothing)
69
 
 
70
 
Rowscroll/Colscroll styles:
71
 
        0: 256 scroll registers (Robocop)
72
 
        1: 128 scroll registers
73
 
        2:  64 scroll registers
74
 
        3:  32 scroll registers (Heavy Barrel, Midres)
75
 
        4:  16 scroll registers (Bad Dudes, Sly Spy)
76
 
        5:   8 scroll registers (Hippodrome)
77
 
        6:   4 scroll registers (Heavy Barrel)
78
 
        7:   2 scroll registers (Heavy Barrel, used on other games but registers kept at 0)
79
 
        8:   1 scroll register (ie, none)
80
 
 
81
 
        Values above are *multiplied* by playfield shape.
 
67
   4: colscroll shifter (low 4 bits, top 4 bits do nothing)
 
68
   6: rowscroll shifter (low 4 bits, top 4 bits do nothing)
 
69
 
 
70
   Row & column scroll can be applied simultaneously or by themselves.
 
71
   The shift register controls the granularity of the scroll offsets
 
72
   (more details given later).
82
73
 
83
74
Playfield priority (Bad Dudes, etc):
84
 
        In the bottommost playfield, pens 8-15 can have priority over the next playfield.
85
 
        In that next playfield, pens 8-15 can have priority over sprites.
 
75
    In the bottommost playfield, pens 8-15 can have priority over the next playfield.
 
76
    In that next playfield, pens 8-15 can have priority over sprites.
86
77
 
87
78
Bit 0:  Playfield inversion
88
79
Bit 1:  Enable playfield mixing (for palettes 8-15 only)
89
80
Bit 2:  Enable playfield/sprite mixing (for palettes 8-15 only)
90
81
 
91
82
Priority word (Midres):
92
 
        Bit 0 set = Playfield 3 drawn over Playfield 2
93
 
                        ~ = Playfield 2 drawn over Playfield 3
94
 
        Bit 1 set = Sprites are drawn inbetween playfields
95
 
                        ~ = Sprites are on top of playfields
96
 
        Bit 2
97
 
        Bit 3 set = ...
 
83
    Bit 0 set = Playfield 3 drawn over Playfield 2
 
84
            ~ = Playfield 2 drawn over Playfield 3
 
85
    Bit 1 set = Sprites are drawn inbetween playfields
 
86
            ~ = Sprites are on top of playfields
 
87
    Bit 2
 
88
    Bit 3 set = ...
 
89
 
 
90
Todo:
 
91
    Implement multi-width sprites (used by Birdtry).
 
92
    Implement sprite/tilemap orthogonality (not strictly needed as no
 
93
    games make deliberate use of it).
98
94
 
99
95
***************************************************************************/
100
96
 
101
97
#include "driver.h"
102
 
#include "vidhrdw/generic.h"
103
 
 
104
 
static struct tilemap *pf1_tilemap_0,*pf1_tilemap_1,*pf1_tilemap_2;
105
 
static struct tilemap *pf2_tilemap_0,*pf2_tilemap_1,*pf2_tilemap_2;
106
 
static struct tilemap *pf3_tilemap_0,*pf3_tilemap_1,*pf3_tilemap_2;
107
 
 
108
 
data16_t *dec0_pf1_data,*dec0_pf2_data,*dec0_pf3_data;
109
 
data16_t *dec0_pf1_rowscroll,*dec0_pf2_rowscroll,*dec0_pf3_rowscroll;
110
 
data16_t *dec0_pf1_colscroll,*dec0_pf2_colscroll,*dec0_pf3_colscroll;
111
 
static data16_t dec0_pf1_control_0[4];
112
 
static data16_t dec0_pf1_control_1[4];
113
 
static data16_t dec0_pf2_control_0[4];
114
 
static data16_t dec0_pf2_control_1[4];
115
 
static data16_t dec0_pf3_control_0[4];
116
 
static data16_t dec0_pf3_control_1[4];
117
 
static data16_t *dec0_spriteram;
118
 
static data16_t dec0_pri;
 
98
#include "includes/dec0.h"
 
99
 
 
100
static tilemap *pf1_tilemap_0,*pf1_tilemap_1,*pf1_tilemap_2;
 
101
static tilemap *pf2_tilemap_0,*pf2_tilemap_1,*pf2_tilemap_2;
 
102
static tilemap *pf3_tilemap_0,*pf3_tilemap_1,*pf3_tilemap_2;
 
103
 
 
104
UINT16 *dec0_pf1_data,*dec0_pf2_data,*dec0_pf3_data;
 
105
UINT16 *dec0_pf1_rowscroll,*dec0_pf2_rowscroll,*dec0_pf3_rowscroll;
 
106
UINT16 *dec0_pf1_colscroll,*dec0_pf2_colscroll,*dec0_pf3_colscroll;
 
107
static UINT16 dec0_pf1_control_0[4];
 
108
static UINT16 dec0_pf1_control_1[4];
 
109
static UINT16 dec0_pf2_control_0[4];
 
110
static UINT16 dec0_pf2_control_1[4];
 
111
static UINT16 dec0_pf3_control_0[4];
 
112
static UINT16 dec0_pf3_control_1[4];
 
113
static UINT16 *dec0_spriteram;
 
114
static UINT16 dec0_pri;
119
115
 
120
116
/******************************************************************************/
121
117
 
151
147
 
152
148
/******************************************************************************/
153
149
 
154
 
static void dec0_drawsprites(struct mame_bitmap *bitmap,const struct rectangle *cliprect,int pri_mask,int pri_val)
 
150
static void dec0_drawsprites(mame_bitmap *bitmap,const rectangle *cliprect,int pri_mask,int pri_val)
155
151
{
156
152
        int offs;
157
153
 
219
215
 
220
216
/******************************************************************************/
221
217
 
222
 
static void dec0_pf1_update(void)
223
 
{
224
 
        int offs,lines,height,scrolly,scrollx;
225
 
        struct tilemap *tilemap_ptr;
226
 
 
227
 
        /* Flipscreen */
228
 
        flip_screen_set(dec0_pf1_control_0[0]&0x80);
229
 
 
230
 
        /* Master scroll registers */
231
 
        scrollx = dec0_pf1_control_1[0];
232
 
        scrolly = dec0_pf1_control_1[1];
233
 
 
234
 
        /* Playfield shape */
235
 
        switch (dec0_pf1_control_0[3]&0x3) {
236
 
                case 0: height=1; tilemap_ptr=pf1_tilemap_0; break; /* 4x1, 256 rows */
237
 
                case 1: height=2; tilemap_ptr=pf1_tilemap_1; break; /* 2x2, 512 rows */
238
 
                case 2: height=4; tilemap_ptr=pf1_tilemap_2; break; /* 1x4, 1024 rows */
239
 
                default: height=2; tilemap_ptr=pf1_tilemap_1; break; /* Never happens */
240
 
        }
241
 
 
242
 
        /* Column scroll - may be screen-wise rather than tilemap-wise, not confirmed yet */
243
 
        if (dec0_pf1_control_0[0]&0x8 && dec0_pf1_colscroll[0]) {
244
 
                tilemap_set_scroll_cols(tilemap_ptr,32);
245
 
                tilemap_set_scroll_rows(tilemap_ptr,1);
246
 
                tilemap_set_scrollx(tilemap_ptr,0,scrollx);
247
 
 
248
 
                for (offs = 0;offs < 32;offs++)
249
 
                        tilemap_set_scrolly(tilemap_ptr, offs, scrolly + dec0_pf1_colscroll[offs]);
250
 
        }
251
 
 
252
 
        /* Row scroll enable bit */
253
 
        else if (dec0_pf1_control_0[0]&0x4) {
254
 
                /* Rowscroll style */
255
 
                switch (dec0_pf1_control_1[3]&0xf) {
256
 
                        case 0: lines=256; break; /* 256 horizontal scroll registers (Robocop) */
257
 
                        case 1: lines=128; break; /* 128 horizontal scroll registers (Not used?) */
258
 
                        case 2: lines=64; break; /* 64 horizontal scroll registers (Not used?) */
259
 
                        case 3: lines=32; break; /* 32 horizontal scroll registers (Heavy Barrel title screen) */
260
 
                        case 4: lines=16; break; /* 16 horizontal scroll registers (Bad Dudes, Sly Spy) */
261
 
                        case 5: lines=8; break; /* 8 horizontal scroll registers (Not used?) */
262
 
                        case 6: lines=4; break; /* 4 horizontal scroll registers (Not used?) */
263
 
                        case 7: lines=2; break; /* 2 horizontal scroll registers (Not used?) */
264
 
                        default: lines=1;
265
 
                }
266
 
 
267
 
                tilemap_set_scroll_cols(tilemap_ptr,1);
268
 
                tilemap_set_scroll_rows(tilemap_ptr,lines*height);
269
 
                tilemap_set_scrolly(tilemap_ptr,0,scrolly);
270
 
                for (offs = 0; offs < lines*height; offs++)
271
 
                        tilemap_set_scrollx(tilemap_ptr,offs,scrollx + dec0_pf1_rowscroll[offs]);
272
 
        }
273
 
        else { /* Scroll registers not enabled */
274
 
                tilemap_set_scroll_rows(tilemap_ptr,1);
275
 
                tilemap_set_scroll_cols(tilemap_ptr,1);
276
 
                tilemap_set_scrollx(tilemap_ptr,0,scrollx);
277
 
                tilemap_set_scrolly(tilemap_ptr,0,scrolly);
278
 
        }
279
 
}
280
 
 
281
 
static void dec0_pf2_update(void)
282
 
{
283
 
        int offs,lines,height,scrolly,scrollx;
284
 
        struct tilemap *tilemap_ptr;
285
 
 
286
 
        /* Master scroll registers */
287
 
        scrollx = dec0_pf2_control_1[0];
288
 
        scrolly = dec0_pf2_control_1[1];
289
 
 
290
 
        /* Playfield shape */
291
 
        switch (dec0_pf2_control_0[3]&0x3) {
292
 
                case 0: height=1; tilemap_ptr=pf2_tilemap_0; break; /* 4x1, 256 rows */
293
 
                case 1: height=2; tilemap_ptr=pf2_tilemap_1; break; /* 2x2, 512 rows */
294
 
                case 2: height=4; tilemap_ptr=pf2_tilemap_2; break; /* 1x4, 1024 rows */
295
 
                default: height=2; tilemap_ptr=pf2_tilemap_1; break; /* Never happens */
296
 
        }
297
 
 
298
 
        /* Column scroll - may be screen-wise rather than tilemap-wise, not confirmed yet */
299
 
        if (dec0_pf2_control_0[0]&0x8 && (dec0_pf2_colscroll[0] || dec0_pf2_colscroll[1])) {
300
 
                switch (dec0_pf2_control_1[2]&0x7) {
301
 
                        case 0: lines=1; break;
302
 
                        case 1: lines=2; break;
303
 
                        case 2: lines=4; break;
304
 
                        case 3: lines=8; break;
305
 
                        case 4: lines=16; break;
306
 
                        case 5: lines=32; break;
307
 
                        case 6: lines=64; break;
308
 
                        case 7: lines=128; break;
309
 
                        default: lines=1;
310
 
                }
311
 
                if (height==2) lines*=2; else if (height==1) lines*=4;
312
 
 
313
 
                tilemap_set_scroll_cols(tilemap_ptr,lines);
314
 
                tilemap_set_scroll_rows(tilemap_ptr,1);
315
 
                tilemap_set_scrollx(tilemap_ptr,0,scrollx);
316
 
 
317
 
                for (offs = 0;offs < lines;offs++)
318
 
                        tilemap_set_scrolly(tilemap_ptr, offs, scrolly + dec0_pf2_colscroll[offs]);
319
 
        }
320
 
 
321
 
        /* Row scroll enable bit */
322
 
        else if (dec0_pf2_control_0[0]&0x4) {
323
 
                /* Rowscroll style */
324
 
                switch (dec0_pf2_control_1[3]&0xf) {
325
 
                        case 0: lines=256; break; /* 256 horizontal scroll registers (Robocop) */
326
 
                        case 1: lines=128; break; /* 128 horizontal scroll registers (Not used?) */
327
 
                        case 2: lines=64; break; /* 64 horizontal scroll registers (Not used?) */
328
 
                        case 3: lines=32; break; /* 32 horizontal scroll registers (Heavy Barrel title screen) */
329
 
                        case 4: lines=16; break; /* 16 horizontal scroll registers (Bad Dudes, Sly Spy) */
330
 
                        case 5: lines=8; break; /* 8 horizontal scroll registers (Not used?) */
331
 
                        case 6: lines=4; break; /* 4 horizontal scroll registers (Not used?) */
332
 
                        case 7: lines=2; break; /* 2 horizontal scroll registers (Not used?) */
333
 
                        default: lines=1;
334
 
                }
335
 
 
336
 
                tilemap_set_scroll_cols(tilemap_ptr,1);
337
 
                tilemap_set_scroll_rows(tilemap_ptr,lines*height);
338
 
                tilemap_set_scrolly(tilemap_ptr,0,scrolly);
339
 
                for (offs = 0; offs < lines*height; offs++)
340
 
                        tilemap_set_scrollx(tilemap_ptr,offs,scrollx + dec0_pf2_rowscroll[offs]);
341
 
        }
342
 
        else { /* Scroll registers not enabled */
343
 
                tilemap_set_scroll_rows(tilemap_ptr,1);
344
 
                tilemap_set_scroll_cols(tilemap_ptr,1);
345
 
                tilemap_set_scrollx(tilemap_ptr,0,scrollx);
346
 
                tilemap_set_scrolly(tilemap_ptr,0,scrolly);
347
 
        }
348
 
}
349
 
 
350
 
static void dec0_pf3_update(void)
351
 
{
352
 
        int offs,lines,height,scrolly,scrollx;
353
 
        struct tilemap *tilemap_ptr;
354
 
 
355
 
        /* Master scroll registers */
356
 
        scrollx = dec0_pf3_control_1[0];
357
 
        scrolly = dec0_pf3_control_1[1];
358
 
 
359
 
        /* Playfield shape */
360
 
        switch (dec0_pf3_control_0[3]&0x3) {
361
 
                case 0: height=1; tilemap_ptr=pf3_tilemap_0; break; /* 4x1, 256 rows */
362
 
                case 1: height=2; tilemap_ptr=pf3_tilemap_1; break; /* 2x2, 512 rows */
363
 
                case 2: height=4; tilemap_ptr=pf3_tilemap_2; break; /* 1x4, 1024 rows */
364
 
                default: height=2; tilemap_ptr=pf3_tilemap_1; break; /* Never happens */
365
 
        }
366
 
 
367
 
        /* Column scroll - may be screen-wise rather than tilemap-wise, not confirmed yet */
368
 
        if (dec0_pf3_control_0[0]&0x8 && (dec0_pf3_colscroll[0] || dec0_pf3_colscroll[1])) {
369
 
                switch (dec0_pf3_control_1[2]&0x7) {
370
 
                        case 0: lines=2; break;
371
 
                        case 1: lines=2; break;
372
 
                        case 2: lines=4; break;
373
 
                        case 3: lines=8; break;
374
 
                        case 4: lines=16; break;
375
 
                        case 5: lines=32; break;
376
 
                        case 6: lines=64; break;
377
 
                        case 7: lines=128; break;
378
 
                        default: lines=1;
379
 
                }
380
 
                if (height==2) lines*=2; else if (height==1) lines*=4;
381
 
 
382
 
                tilemap_set_scroll_cols(tilemap_ptr,lines);
383
 
                tilemap_set_scroll_rows(tilemap_ptr,1);
384
 
                tilemap_set_scrollx(tilemap_ptr,0,scrollx);
385
 
 
386
 
                for (offs = 0;offs < lines;offs++) {
387
 
                        tilemap_set_scrolly(tilemap_ptr, offs, scrolly + dec0_pf3_colscroll[offs]);
388
 
                }
389
 
        }
390
 
 
391
 
        /* Row scroll enable bit */
392
 
        else if (dec0_pf3_control_0[0]&0x4) {
393
 
                /* Rowscroll style */
394
 
                switch (dec0_pf3_control_1[3]&0xf) {
395
 
                        case 0: lines=256; break; /* 256 horizontal scroll registers (Robocop) */
396
 
                        case 1: lines=128; break; /* 128 horizontal scroll registers (Not used?) */
397
 
                        case 2: lines=64; break; /* 64 horizontal scroll registers (Not used?) */
398
 
                        case 3: lines=32; break; /* 32 horizontal scroll registers (Heavy Barrel title screen) */
399
 
                        case 4: lines=16; break; /* 16 horizontal scroll registers (Bad Dudes, Sly Spy) */
400
 
                        case 5: lines=8; break; /* 8 horizontal scroll registers (Not used?) */
401
 
                        case 6: lines=4; break; /* 4 horizontal scroll registers (Not used?) */
402
 
                        case 7: lines=2; break; /* 2 horizontal scroll registers (Not used?) */
403
 
                        default: lines=1;
404
 
                }
405
 
 
406
 
                tilemap_set_scroll_cols(tilemap_ptr,1);
407
 
                tilemap_set_scroll_rows(tilemap_ptr,lines*height);
408
 
                tilemap_set_scrolly(tilemap_ptr,0,scrolly);
409
 
                for (offs = 0; offs < lines*height; offs++)
410
 
                        tilemap_set_scrollx(tilemap_ptr,offs,scrollx + dec0_pf3_rowscroll[offs]);
411
 
        }
412
 
        else { /* Scroll registers not enabled */
413
 
                tilemap_set_scroll_rows(tilemap_ptr,1);
414
 
                tilemap_set_scroll_cols(tilemap_ptr,1);
415
 
                tilemap_set_scrollx(tilemap_ptr,0,scrollx);
416
 
                tilemap_set_scrolly(tilemap_ptr,0,scrolly);
 
218
static void custom_tilemap_draw(mame_bitmap *bitmap,
 
219
                                                                const rectangle *cliprect,
 
220
                                                                tilemap *tilemap_ptr,
 
221
                                                                const UINT16 *rowscroll_ptr,
 
222
                                                                const UINT16 *colscroll_ptr,
 
223
                                                                const UINT16 *control0,
 
224
                                                                const UINT16 *control1,
 
225
                                                                int flags)
 
226
{
 
227
        const mame_bitmap *src_bitmap = tilemap_get_pixmap(tilemap_ptr);
 
228
        int x, y, p;
 
229
        int column_offset=0, src_x=0, src_y=0;
 
230
        unsigned int scrollx=control1[0];
 
231
        unsigned int scrolly=control1[1];
 
232
        int width_mask = src_bitmap->width - 1;
 
233
        int height_mask = src_bitmap->height - 1;
 
234
        int row_scroll_enabled = (rowscroll_ptr && (control0[0]&0x4));
 
235
        int col_scroll_enabled = (colscroll_ptr && (control0[0]&0x8));
 
236
 
 
237
        if (!src_bitmap)
 
238
                return;
 
239
 
 
240
        /* Column scroll & row scroll may per applied per pixel, there are
 
241
    shift registers for each which control the granularity of the row/col
 
242
    offset (down to per line level for row, and per 8 lines for column).
 
243
 
 
244
    Nb:  The row & col selectors are _not_ affected by the shape of the
 
245
    playfield (ie, 256*1024, 512*512 or 1024*256).  So even if the tilemap
 
246
    width is only 256, 'src_x' should not wrap at 256 in the code below (to
 
247
    do so would mean the top half of row RAM would never be accessed which
 
248
    is incorrect).
 
249
 
 
250
    Nb2:  Real hardware exhibits a strange bug with column scroll on 'mode 2'
 
251
    (256*1024) - the first column has a strange additional offset, but
 
252
    curiously the first 'wrap' (at scroll offset 256) does not have this offset,
 
253
    it is displayed as expected.  The bug is confimed to only affect this mode,
 
254
    the other two modes work as expected.  This bug is not emulated, as it
 
255
    doesn't affect any games.
 
256
    */
 
257
 
 
258
        if (flip_screen)
 
259
                src_y = (src_bitmap->height - 256) - scrolly;
 
260
        else
 
261
                src_y = scrolly;
 
262
 
 
263
        for (y=0; y<=cliprect->max_y; y++) {
 
264
                if (row_scroll_enabled)
 
265
                        src_x=scrollx + rowscroll_ptr[(src_y >> (control1[3]&0xf))&(0x1ff>>(control1[3]&0xf))];
 
266
                else
 
267
                        src_x=scrollx;
 
268
 
 
269
                if (flip_screen)
 
270
                        src_x=(src_bitmap->width - 256) - src_x;
 
271
 
 
272
                for (x=0; x<=cliprect->max_x; x++) {
 
273
                        if (col_scroll_enabled)
 
274
                                column_offset=colscroll_ptr[((src_x >> 3) >> (control1[2]&0xf))&(0x3f>>(control1[2]&0xf))];
 
275
 
 
276
                        p = (((UINT16*)src_bitmap->line[(src_y + column_offset)&height_mask])[src_x&width_mask]);
 
277
 
 
278
                        src_x++;
 
279
                        if ((flags&TILEMAP_IGNORE_TRANSPARENCY) || (p&0xf))
 
280
                        {
 
281
                                if( flags & TILEMAP_FRONT )
 
282
                                {
 
283
                                        /* Top 8 pens of top 8 palettes only */
 
284
                                        if ((p&0x88)==0x88)
 
285
                                                plot_pixel(bitmap, x, y, Machine->pens[p]);
 
286
                                }
 
287
                                else
 
288
                                {
 
289
                                        plot_pixel(bitmap, x, y, Machine->pens[p]);
 
290
                                }
 
291
                        }
 
292
                }
 
293
                src_y++;
417
294
        }
418
295
}
419
296
 
420
297
/******************************************************************************/
421
298
 
422
 
static void dec0_pf1_draw(struct mame_bitmap *bitmap,const struct rectangle *cliprect,int flags,int pri)
 
299
static void dec0_pf1_draw(mame_bitmap *bitmap,const rectangle *cliprect,int flags)
423
300
{
424
 
        tilemap_set_enable(pf1_tilemap_0,0);
425
 
        tilemap_set_enable(pf1_tilemap_1,0);
426
 
        tilemap_set_enable(pf1_tilemap_2,0);
427
 
 
428
301
        switch (dec0_pf1_control_0[3]&0x3) {
429
302
                case 0: /* 4x1 */
430
 
                        tilemap_set_enable(pf1_tilemap_0,1);
431
 
                        tilemap_draw(bitmap,cliprect,pf1_tilemap_0,flags,pri);
 
303
                        custom_tilemap_draw(bitmap,cliprect,pf1_tilemap_0,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
432
304
                        break;
433
305
                case 1: /* 2x2 */
434
306
                default:
435
 
                        tilemap_set_enable(pf1_tilemap_1,1);
436
 
                        tilemap_draw(bitmap,cliprect,pf1_tilemap_1,flags,pri);
 
307
                        custom_tilemap_draw(bitmap,cliprect,pf1_tilemap_1,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
437
308
                        break;
438
309
                case 2: /* 1x4 */
439
 
                        tilemap_set_enable(pf1_tilemap_2,1);
440
 
                        tilemap_draw(bitmap,cliprect,pf1_tilemap_2,flags,pri);
 
310
                        custom_tilemap_draw(bitmap,cliprect,pf1_tilemap_2,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
441
311
                        break;
442
 
        }
 
312
        };
443
313
}
444
314
 
445
 
static void dec0_pf2_draw(struct mame_bitmap *bitmap,const struct rectangle *cliprect,int flags,int pri)
 
315
static void dec0_pf2_draw(mame_bitmap *bitmap,const rectangle *cliprect,int flags)
446
316
{
447
 
        tilemap_set_enable(pf2_tilemap_0,0);
448
 
        tilemap_set_enable(pf2_tilemap_1,0);
449
 
        tilemap_set_enable(pf2_tilemap_2,0);
450
 
 
451
317
        switch (dec0_pf2_control_0[3]&0x3) {
452
318
                case 0: /* 4x1 */
453
 
                        tilemap_set_enable(pf2_tilemap_0,1);
454
 
                        tilemap_draw(bitmap,cliprect,pf2_tilemap_0,flags,pri);
 
319
                        custom_tilemap_draw(bitmap,cliprect,pf2_tilemap_0,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
455
320
                        break;
456
321
                case 1: /* 2x2 */
457
322
                default:
458
 
                        tilemap_set_enable(pf2_tilemap_1,1);
459
 
                        tilemap_draw(bitmap,cliprect,pf2_tilemap_1,flags,pri);
 
323
                        custom_tilemap_draw(bitmap,cliprect,pf2_tilemap_1,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
460
324
                        break;
461
325
                case 2: /* 1x4 */
462
 
                        tilemap_set_enable(pf2_tilemap_2,1);
463
 
                        tilemap_draw(bitmap,cliprect,pf2_tilemap_2,flags,pri);
 
326
                        custom_tilemap_draw(bitmap,cliprect,pf2_tilemap_2,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
464
327
                        break;
465
 
        }
 
328
        };
466
329
}
467
330
 
468
 
static void dec0_pf3_draw(struct mame_bitmap *bitmap,const struct rectangle *cliprect,int flags,int pri)
 
331
static void dec0_pf3_draw(mame_bitmap *bitmap,const rectangle *cliprect,int flags)
469
332
{
470
 
        tilemap_set_enable(pf3_tilemap_0,0);
471
 
        tilemap_set_enable(pf3_tilemap_1,0);
472
 
        tilemap_set_enable(pf3_tilemap_2,0);
473
 
 
474
333
        switch (dec0_pf3_control_0[3]&0x3) {
475
334
                case 0: /* 4x1 */
476
 
                        tilemap_set_enable(pf3_tilemap_0,1);
477
 
                        tilemap_draw(bitmap,cliprect,pf3_tilemap_0,flags,pri);
 
335
                        custom_tilemap_draw(bitmap,cliprect,pf3_tilemap_0,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
478
336
                        break;
479
337
                case 1: /* 2x2 */
480
338
                default:
481
 
                        tilemap_set_enable(pf3_tilemap_1,1);
482
 
                        tilemap_draw(bitmap,cliprect,pf3_tilemap_1,flags,pri);
 
339
                        custom_tilemap_draw(bitmap,cliprect,pf3_tilemap_1,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
483
340
                        break;
484
341
                case 2: /* 1x4 */
485
 
                        tilemap_set_enable(pf3_tilemap_2,1);
486
 
                        tilemap_draw(bitmap,cliprect,pf3_tilemap_2,flags,pri);
 
342
                        custom_tilemap_draw(bitmap,cliprect,pf3_tilemap_2,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
487
343
                        break;
488
 
        }
 
344
        };
489
345
}
490
346
 
491
347
/******************************************************************************/
492
348
 
493
349
VIDEO_UPDATE( hbarrel )
494
350
{
495
 
        dec0_pf1_update();
496
 
        dec0_pf2_update();
497
 
        dec0_pf3_update();
 
351
        flip_screen_set(dec0_pf1_control_0[0]&0x80);
498
352
 
499
 
        dec0_pf3_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
500
 
        dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
 
353
        dec0_pf3_draw(bitmap,cliprect,TILEMAP_IGNORE_TRANSPARENCY);
501
354
        dec0_drawsprites(bitmap,cliprect,0x08,0x08);
502
 
        dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK,0);
503
 
        dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
355
        dec0_pf2_draw(bitmap,cliprect,0);
504
356
 
505
357
        /* HB always keeps pf2 on top of pf3, no need explicitly support priority register */
506
358
 
507
359
        dec0_drawsprites(bitmap,cliprect,0x08,0x00);
508
 
        dec0_pf1_draw(bitmap,cliprect,0,0);
 
360
        dec0_pf1_draw(bitmap,cliprect,0);
509
361
}
510
362
 
511
363
/******************************************************************************/
512
364
 
513
365
VIDEO_UPDATE( baddudes )
514
366
{
515
 
        /* WARNING: priority inverted wrt all the other games */
516
 
        dec0_pf1_update();
517
 
        dec0_pf2_update();
518
 
        dec0_pf3_update();
 
367
        flip_screen_set(dec0_pf1_control_0[0]&0x80);
519
368
 
520
369
        /* WARNING: inverted wrt Midnight Resistance */
521
370
        if ((dec0_pri & 0x01) == 0)
522
371
        {
523
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
524
 
                if (!(dec0_pri & 2))
525
 
                        dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
526
 
 
527
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_BACK,0);
528
 
                if (!(dec0_pri & 4))
529
 
                        dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
372
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_IGNORE_TRANSPARENCY);
 
373
                dec0_pf3_draw(bitmap,cliprect,0);
530
374
 
531
375
                if (dec0_pri & 2)
532
 
                        dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
376
                        dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT); /* Foreground pens only */
533
377
 
534
378
                dec0_drawsprites(bitmap,cliprect,0x00,0x00);
535
379
 
536
380
                if (dec0_pri & 4)
537
 
                        dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT,1); /* Foreground pens only */
 
381
                        dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT); /* Foreground pens only */
538
382
        }
539
383
        else
540
384
        {
541
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
542
 
                if (!(dec0_pri & 2))
543
 
                        dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
544
 
 
545
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK,0);
546
 
                if (!(dec0_pri & 4))
547
 
                        dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
385
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_IGNORE_TRANSPARENCY);
 
386
                dec0_pf2_draw(bitmap,cliprect,0);
548
387
 
549
388
                if (dec0_pri & 2)
550
 
                        dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
389
                        dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT); /* Foreground pens only */
551
390
 
552
391
                dec0_drawsprites(bitmap,cliprect,0x00,0x00);
553
392
 
554
393
                if (dec0_pri & 4)
555
 
                        dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
394
                        dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT); /* Foreground pens only */
556
395
        }
557
396
 
558
 
        dec0_pf1_draw(bitmap,cliprect,0,0);
 
397
        dec0_pf1_draw(bitmap,cliprect,0);
559
398
}
560
399
 
561
400
/******************************************************************************/
564
403
{
565
404
        int trans;
566
405
 
567
 
        dec0_pf1_update();
568
 
        dec0_pf2_update();
569
 
        dec0_pf3_update();
 
406
        flip_screen_set(dec0_pf1_control_0[0]&0x80);
570
407
 
571
408
        if (dec0_pri & 0x04)
572
409
                trans = 0x08;
579
416
                /* Robocop uses it only for the title screen, so this might be just */
580
417
                /* completely wrong. The top 8 bits of the register might mean */
581
418
                /* something (they are 0x80 in midres, 0x00 here) */
582
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
583
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
 
419
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY);
584
420
 
585
421
                if (dec0_pri & 0x02)
586
422
                        dec0_drawsprites(bitmap,cliprect,0x08,trans);
587
423
 
588
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_BACK,0);
589
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
424
                dec0_pf3_draw(bitmap,cliprect,0);
590
425
        }
591
426
        else
592
427
        {
593
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
594
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
 
428
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_IGNORE_TRANSPARENCY);
595
429
 
596
430
                if (dec0_pri & 0x02)
597
431
                        dec0_drawsprites(bitmap,cliprect,0x08,trans);
598
432
 
599
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK,0);
600
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
433
                dec0_pf2_draw(bitmap,cliprect,0);
601
434
        }
602
435
 
603
436
        if (dec0_pri & 0x02)
605
438
        else
606
439
                dec0_drawsprites(bitmap,cliprect,0x00,0x00);
607
440
 
608
 
        dec0_pf1_draw(bitmap,cliprect,0,0);
 
441
        dec0_pf1_draw(bitmap,cliprect,0);
609
442
}
610
443
 
611
444
/******************************************************************************/
612
445
 
613
446
VIDEO_UPDATE( birdtry )
614
447
{
615
 
        /* This game doesn't have the extra playfield chip on the game board */
616
 
        dec0_pf1_update();
617
 
        dec0_pf2_update();
618
 
        dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
619
 
        dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
 
448
        flip_screen_set(dec0_pf1_control_0[0]&0x80);
 
449
 
 
450
        /* This game doesn't have the extra playfield chip on the game board, but
 
451
    the palette does show through. */
 
452
        fillbitmap(bitmap,Machine->pens[768],cliprect);
 
453
        dec0_pf2_draw(bitmap,cliprect,0);
620
454
        dec0_drawsprites(bitmap,cliprect,0x00,0x00);
621
 
        dec0_pf1_draw(bitmap,cliprect,0,0);
 
455
        dec0_pf1_draw(bitmap,cliprect,0);
622
456
}
623
457
 
624
458
/******************************************************************************/
625
459
 
626
460
VIDEO_UPDATE( hippodrm )
627
461
{
628
 
        dec0_pf1_update();
629
 
        dec0_pf2_update();
630
 
        dec0_pf3_update();
 
462
        flip_screen_set(dec0_pf1_control_0[0]&0x80);
631
463
 
632
464
        if (dec0_pri & 0x01)
633
465
        {
634
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
635
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
636
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_BACK,0);
637
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
466
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_IGNORE_TRANSPARENCY);
 
467
                dec0_pf3_draw(bitmap,cliprect,0);
638
468
        }
639
469
        else
640
470
        {
641
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
642
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
643
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK,0);
644
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
471
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_IGNORE_TRANSPARENCY);
 
472
                dec0_pf2_draw(bitmap,cliprect,0);
645
473
        }
646
474
 
647
475
        dec0_drawsprites(bitmap,cliprect,0x00,0x00);
648
 
        dec0_pf1_draw(bitmap,cliprect,0,0);
 
476
        dec0_pf1_draw(bitmap,cliprect,0);
649
477
}
650
478
 
651
479
/******************************************************************************/
652
480
 
653
481
VIDEO_UPDATE( slyspy )
654
482
{
655
 
        dec0_pf1_update();
656
 
        dec0_pf2_update();
657
 
        dec0_pf3_update();
 
483
        flip_screen_set(dec0_pf1_control_0[0]&0x80);
658
484
 
659
 
        dec0_pf3_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
660
 
        dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
661
 
        dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK,0);
662
 
        if (!(dec0_pri&0x80))
663
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
485
        dec0_pf3_draw(bitmap,cliprect,TILEMAP_IGNORE_TRANSPARENCY);
 
486
        dec0_pf2_draw(bitmap,cliprect,0);
664
487
 
665
488
        dec0_drawsprites(bitmap,cliprect,0x00,0x00);
666
489
 
 
490
        /* Redraw top 8 pens of top 8 palettes over sprites */
667
491
        if (dec0_pri&0x80)
668
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
492
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT);
669
493
 
670
 
        dec0_pf1_draw(bitmap,cliprect,0,0);
 
494
        dec0_pf1_draw(bitmap,cliprect,0);
671
495
}
672
496
 
673
497
/******************************************************************************/
676
500
{
677
501
        int trans;
678
502
 
 
503
        flip_screen_set(dec0_pf1_control_0[0]&0x80);
 
504
 
679
505
        if (dec0_pri & 0x04)
680
506
                trans = 0x00;
681
507
        else trans = 0x08;
682
508
 
683
 
        dec0_pf1_update();
684
 
        dec0_pf2_update();
685
 
        dec0_pf3_update();
686
 
 
687
509
        if (dec0_pri & 0x01)
688
510
        {
689
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
690
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
 
511
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_IGNORE_TRANSPARENCY);
691
512
 
692
513
                if (dec0_pri & 0x02)
693
514
                        dec0_drawsprites(bitmap,cliprect,0x08,trans);
694
515
 
695
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_BACK,0);
696
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
516
                dec0_pf3_draw(bitmap,cliprect,0);
697
517
        }
698
518
        else
699
519
        {
700
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_BACK|TILEMAP_IGNORE_TRANSPARENCY,0);
701
 
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_FRONT|TILEMAP_IGNORE_TRANSPARENCY,1);
 
520
                dec0_pf3_draw(bitmap,cliprect,TILEMAP_IGNORE_TRANSPARENCY);
702
521
 
703
522
                if (dec0_pri & 0x02)
704
523
                        dec0_drawsprites(bitmap,cliprect,0x08,trans);
705
524
 
706
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_BACK,0);
707
 
                dec0_pf2_draw(bitmap,cliprect,TILEMAP_FRONT,1);
 
525
                dec0_pf2_draw(bitmap,cliprect,0);
708
526
        }
709
527
 
710
528
        if (dec0_pri & 0x02)
712
530
        else
713
531
                dec0_drawsprites(bitmap,cliprect,0x00,0x00);
714
532
 
715
 
        dec0_pf1_draw(bitmap,cliprect,0,0);
 
533
        dec0_pf1_draw(bitmap,cliprect,0);
716
534
}
717
535
 
718
536
/******************************************************************************/
729
547
 
730
548
WRITE16_HANDLER( dec0_pf1_data_w )
731
549
{
732
 
        data16_t oldword=dec0_pf1_data[offset];
 
550
        UINT16 oldword=dec0_pf1_data[offset];
733
551
        COMBINE_DATA(&dec0_pf1_data[offset]);
734
552
        if (oldword!=dec0_pf1_data[offset]) {
735
553
                tilemap_mark_tile_dirty(pf1_tilemap_0,offset);
750
568
 
751
569
WRITE16_HANDLER( dec0_pf2_data_w )
752
570
{
753
 
        data16_t oldword=dec0_pf2_data[offset];
 
571
        UINT16 oldword=dec0_pf2_data[offset];
754
572
        COMBINE_DATA(&dec0_pf2_data[offset]);
755
573
        if (oldword!=dec0_pf2_data[offset]) {
756
574
                tilemap_mark_tile_dirty(pf2_tilemap_0,offset);
771
589
 
772
590
WRITE16_HANDLER( dec0_pf3_data_w )
773
591
{
774
 
        data16_t oldword=dec0_pf3_data[offset];
 
592
        UINT16 oldword=dec0_pf3_data[offset];
775
593
        COMBINE_DATA(&dec0_pf3_data[offset]);
776
594
        if (oldword!=dec0_pf3_data[offset]) {
777
595
                tilemap_mark_tile_dirty(pf3_tilemap_0,offset);
788
606
WRITE8_HANDLER( dec0_pf3_control_8bit_w )
789
607
{
790
608
        static int buffer[0x20];
791
 
        data16_t myword;
 
609
        UINT16 myword;
792
610
 
793
611
        buffer[offset]=data;
794
612
 
803
621
WRITE8_HANDLER( dec0_pf3_data_8bit_w )
804
622
{
805
623
        if (offset&1) { /* MSB has changed */
806
 
                data16_t lsb=dec0_pf3_data[offset>>1];
807
 
                data16_t newword=(lsb&0xff) | (data<<8);
 
624
                UINT16 lsb=dec0_pf3_data[offset>>1];
 
625
                UINT16 newword=(lsb&0xff) | (data<<8);
808
626
                dec0_pf3_data[offset>>1]=newword;
809
627
        }
810
628
        else { /* LSB has changed */
811
 
                data16_t msb=dec0_pf3_data[offset>>1];
812
 
                data16_t newword=(msb&0xff00) | data;
 
629
                UINT16 msb=dec0_pf3_data[offset>>1];
 
630
                UINT16 newword=(msb&0xff00) | data;
813
631
                dec0_pf3_data[offset>>1]=newword;
814
632
        }
815
633
        tilemap_mark_tile_dirty(pf3_tilemap_0,offset>>1);
882
700
        pf1_tilemap_0 = tilemap_create(get_pf1_tile_info,tile_shape0_8x8_scan,TILEMAP_TRANSPARENT, 8, 8,128, 32);
883
701
        pf1_tilemap_1 = tilemap_create(get_pf1_tile_info,tile_shape1_8x8_scan,TILEMAP_TRANSPARENT, 8, 8, 64, 64);
884
702
        pf1_tilemap_2 = tilemap_create(get_pf1_tile_info,tile_shape2_8x8_scan,TILEMAP_TRANSPARENT, 8, 8, 32,128);
885
 
        pf2_tilemap_0 = tilemap_create(get_pf2_tile_info,tile_shape0_scan,    TILEMAP_SPLIT,      16,16, 64, 16);
886
 
        pf2_tilemap_1 = tilemap_create(get_pf2_tile_info,tile_shape1_scan,    TILEMAP_SPLIT,      16,16, 32, 32);
887
 
        pf2_tilemap_2 = tilemap_create(get_pf2_tile_info,tile_shape2_scan,    TILEMAP_SPLIT,      16,16, 16, 64);
888
 
        pf3_tilemap_0 = tilemap_create(get_pf3_tile_info,tile_shape0_scan,    TILEMAP_SPLIT,      16,16, 64, 16);
889
 
        pf3_tilemap_1 = tilemap_create(get_pf3_tile_info,tile_shape1_scan,    TILEMAP_SPLIT,      16,16, 32, 32);
890
 
        pf3_tilemap_2 = tilemap_create(get_pf3_tile_info,tile_shape2_scan,    TILEMAP_SPLIT,      16,16, 16, 64);
 
703
        pf2_tilemap_0 = tilemap_create(get_pf2_tile_info,tile_shape0_scan,    TILEMAP_TRANSPARENT,16,16, 64, 16);
 
704
        pf2_tilemap_1 = tilemap_create(get_pf2_tile_info,tile_shape1_scan,    TILEMAP_TRANSPARENT,16,16, 32, 32);
 
705
        pf2_tilemap_2 = tilemap_create(get_pf2_tile_info,tile_shape2_scan,    TILEMAP_TRANSPARENT,16,16, 16, 64);
 
706
        pf3_tilemap_0 = tilemap_create(get_pf3_tile_info,tile_shape0_scan,    TILEMAP_TRANSPARENT,16,16, 64, 16);
 
707
        pf3_tilemap_1 = tilemap_create(get_pf3_tile_info,tile_shape1_scan,    TILEMAP_TRANSPARENT,16,16, 32, 32);
 
708
        pf3_tilemap_2 = tilemap_create(get_pf3_tile_info,tile_shape2_scan,    TILEMAP_TRANSPARENT,16,16, 16, 64);
891
709
 
892
710
        if (!pf1_tilemap_0 || !pf1_tilemap_1 || !pf1_tilemap_2
893
711
                || !pf2_tilemap_0 || !pf2_tilemap_1 || !pf2_tilemap_2
894
712
                || !pf3_tilemap_0 || !pf3_tilemap_1 || !pf3_tilemap_2)
895
713
                return 1;
896
714
 
897
 
        tilemap_set_transparent_pen(pf1_tilemap_0,0);
898
 
        tilemap_set_transparent_pen(pf1_tilemap_1,0);
899
 
        tilemap_set_transparent_pen(pf1_tilemap_2,0);
900
 
        tilemap_set_transparent_pen(pf2_tilemap_0,0);
901
 
        tilemap_set_transparent_pen(pf2_tilemap_1,0);
902
 
        tilemap_set_transparent_pen(pf2_tilemap_2,0);
903
 
        tilemap_set_transparent_pen(pf3_tilemap_0,0);
904
 
        tilemap_set_transparent_pen(pf3_tilemap_1,0);
905
 
        tilemap_set_transparent_pen(pf3_tilemap_2,0);
906
 
        tilemap_set_transmask(pf2_tilemap_0,0,0xffff,0x0001); /* Transparent pen 1 only */
907
 
        tilemap_set_transmask(pf2_tilemap_1,0,0xffff,0x0001); /* Transparent pen 1 only */
908
 
        tilemap_set_transmask(pf2_tilemap_2,0,0xffff,0x0001); /* Transparent pen 1 only */
909
 
        tilemap_set_transmask(pf3_tilemap_0,0,0xffff,0x0001); /* Transparent pen 1 only */
910
 
        tilemap_set_transmask(pf3_tilemap_1,0,0xffff,0x0001); /* Transparent pen 1 only */
911
 
        tilemap_set_transmask(pf3_tilemap_2,0,0xffff,0x0001); /* Transparent pen 1 only */
912
 
        tilemap_set_transmask(pf2_tilemap_0,1,0x00ff,0xff01); /* Bottom/Top 8 pen split */
913
 
        tilemap_set_transmask(pf2_tilemap_1,1,0x00ff,0xff01); /* Bottom/Top 8 pen split */
914
 
        tilemap_set_transmask(pf2_tilemap_2,1,0x00ff,0xff01); /* Bottom/Top 8 pen split */
915
 
        tilemap_set_transmask(pf3_tilemap_0,1,0x00ff,0xff01); /* Bottom/Top 8 pen split */
916
 
        tilemap_set_transmask(pf3_tilemap_1,1,0x00ff,0xff01); /* Bottom/Top 8 pen split */
917
 
        tilemap_set_transmask(pf3_tilemap_2,1,0x00ff,0xff01); /* Bottom/Top 8 pen split */
918
 
 
919
715
        dec0_spriteram=spriteram16;
920
716
 
921
717
        return 0;