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

« back to all changes in this revision

Viewing changes to mess/src/mame/video/calomega.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***********************************************
2
 
 
3
 
    +-------------------------------------+
4
 
    |                                     |
5
 
    | CAL OMEGA - SYSTEMS 903/904/905/906 |
6
 
    |                                     |
7
 
    |      Driver by Roberto Fresca.      |
8
 
    |                                     |
9
 
    +-------------------------------------+
10
 
 
11
 
             * Video Hardware *
12
 
 
13
 
************************************************/
14
 
 
15
 
 
16
 
#include "emu.h"
17
 
#include "includes/calomega.h"
18
 
 
19
 
 
20
 
WRITE8_HANDLER( calomega_videoram_w )
21
 
{
22
 
        calomega_state *state = space->machine().driver_data<calomega_state>();
23
 
        state->m_videoram[offset] = data;
24
 
        tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
25
 
}
26
 
 
27
 
WRITE8_HANDLER( calomega_colorram_w )
28
 
{
29
 
        calomega_state *state = space->machine().driver_data<calomega_state>();
30
 
        state->m_colorram[offset] = data;
31
 
        tilemap_mark_tile_dirty(state->m_bg_tilemap, offset);
32
 
}
33
 
 
34
 
static TILE_GET_INFO( get_bg_tile_info )
35
 
{
36
 
        calomega_state *state = machine.driver_data<calomega_state>();
37
 
/*  - bits -
38
 
    7654 3210
39
 
    --xx xx--   tiles color.
40
 
    ---- --x-   tiles bank.
41
 
    xx-- ---x   seems unused. */
42
 
 
43
 
        int attr = state->m_colorram[tile_index];
44
 
        int code = state->m_videoram[tile_index];
45
 
        int bank = (attr & 0x02) >> 1;  /* bit 1 switch the gfx banks */
46
 
        int color = (attr & 0x3c);      /* bits 2-3-4-5 for color */
47
 
 
48
 
        if (attr == 0x3a)       /* Is the palette wrong? */
49
 
                color = 0x3b;   /* 0x3b is the best match */
50
 
 
51
 
        if (attr == 0x36)       /* Is the palette wrong? */
52
 
                color = 0x3a;   /* 0x3a is the best match */
53
 
 
54
 
        if (attr == 0x32)       /* Is the palette wrong? */
55
 
                color = 0x39;   /* 0x39 is the best match */
56
 
 
57
 
        SET_TILE_INFO(bank, code, color, 0);
58
 
}
59
 
 
60
 
VIDEO_START( calomega )
61
 
{
62
 
        calomega_state *state = machine.driver_data<calomega_state>();
63
 
        state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 31);
64
 
}
65
 
 
66
 
SCREEN_UPDATE( calomega )
67
 
{
68
 
        calomega_state *state = screen->machine().driver_data<calomega_state>();
69
 
        tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0);
70
 
        return 0;
71
 
}
72
 
 
73
 
PALETTE_INIT( calomega )
74
 
{
75
 
/*  prom bits
76
 
    7654 3210
77
 
    ---- ---x   red component.
78
 
    ---- --x-   green component.
79
 
    ---- -x--   blue component.
80
 
    xxxx x---   unused.
81
 
*/
82
 
        int i;
83
 
 
84
 
        /* 00000BGR */
85
 
        if (color_prom == 0) return;
86
 
 
87
 
        for (i = 0;i < machine.total_colors();i++)
88
 
        {
89
 
                int bit0, bit1, bit2, r, g, b;
90
 
 
91
 
                /* red component */
92
 
                bit0 = (color_prom[i] >> 0) & 0x01;
93
 
                r = bit0 * 0xff;
94
 
 
95
 
                /* green component */
96
 
                bit1 = (color_prom[i] >> 1) & 0x01;
97
 
                g = bit1 * 0xff;
98
 
 
99
 
                /* blue component */
100
 
                bit2 = (color_prom[i] >> 2) & 0x01;
101
 
                b = bit2 * 0xff;
102
 
 
103
 
 
104
 
                palette_set_color(machine, i, MAKE_RGB(r, g, b));
105
 
        }
106
 
}