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

« back to all changes in this revision

Viewing changes to mess/src/mame/video/subs.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
 
    Atari Subs hardware
4
 
 
5
 
***************************************************************************/
6
 
 
7
 
#include "emu.h"
8
 
#include "includes/subs.h"
9
 
#include "sound/discrete.h"
10
 
 
11
 
WRITE8_HANDLER( subs_invert1_w )
12
 
{
13
 
        if ((offset & 0x01) == 1)
14
 
        {
15
 
                palette_set_color(space->machine(), 0, MAKE_RGB(0x00, 0x00, 0x00));
16
 
                palette_set_color(space->machine(), 1, MAKE_RGB(0xFF, 0xFF, 0xFF));
17
 
        }
18
 
        else
19
 
        {
20
 
                palette_set_color(space->machine(), 1, MAKE_RGB(0x00, 0x00, 0x00));
21
 
                palette_set_color(space->machine(), 0, MAKE_RGB(0xFF, 0xFF, 0xFF));
22
 
        }
23
 
}
24
 
 
25
 
WRITE8_HANDLER( subs_invert2_w )
26
 
{
27
 
        if ((offset & 0x01) == 1)
28
 
        {
29
 
                palette_set_color(space->machine(), 2, MAKE_RGB(0x00, 0x00, 0x00));
30
 
                palette_set_color(space->machine(), 3, MAKE_RGB(0xFF, 0xFF, 0xFF));
31
 
        }
32
 
        else
33
 
        {
34
 
                palette_set_color(space->machine(), 3, MAKE_RGB(0x00, 0x00, 0x00));
35
 
                palette_set_color(space->machine(), 2, MAKE_RGB(0xFF, 0xFF, 0xFF));
36
 
        }
37
 
}
38
 
 
39
 
 
40
 
SCREEN_UPDATE( subs )
41
 
{
42
 
        subs_state *state = screen->machine().driver_data<subs_state>();
43
 
        UINT8 *videoram = state->m_videoram;
44
 
        UINT8 *spriteram = state->m_spriteram;
45
 
        int offs;
46
 
 
47
 
        device_t *left_screen  = screen->machine().device("lscreen");
48
 
        device_t *right_screen = screen->machine().device("rscreen");
49
 
        device_t *discrete = screen->machine().device("discrete");
50
 
 
51
 
        /* for every character in the Video RAM, check if it has been modified */
52
 
        /* since last time and update it accordingly. */
53
 
        for (offs = 0x400 - 1; offs >= 0; offs--)
54
 
        {
55
 
                int charcode;
56
 
                int sx,sy;
57
 
                int left_enable,right_enable;
58
 
                int left_sonar_window,right_sonar_window;
59
 
 
60
 
                left_sonar_window = 0;
61
 
                right_sonar_window = 0;
62
 
 
63
 
                charcode = videoram[offs];
64
 
 
65
 
                /* Which monitor is this for? */
66
 
                right_enable = charcode & 0x40;
67
 
                left_enable = charcode & 0x80;
68
 
 
69
 
                sx = 8 * (offs % 32);
70
 
                sy = 8 * (offs / 32);
71
 
 
72
 
                /* Special hardware logic for sonar windows */
73
 
                if ((sy >= (128+64)) && (sx < 32))
74
 
                        left_sonar_window = 1;
75
 
                else if ((sy >= (128+64)) && (sx >= (128+64+32)))
76
 
                        right_sonar_window = 1;
77
 
                else
78
 
                        charcode = charcode & 0x3F;
79
 
 
80
 
                /* draw the left screen */
81
 
                if (screen == left_screen)
82
 
                {
83
 
                        if ((left_enable || left_sonar_window) && (!right_sonar_window))
84
 
                                drawgfx_opaque(bitmap,cliprect,screen->machine().gfx[0],
85
 
                                                charcode, 1,
86
 
                                                0,0,sx,sy);
87
 
                        else
88
 
                                drawgfx_opaque(bitmap,cliprect,screen->machine().gfx[0],
89
 
                                                0, 1,
90
 
                                                0,0,sx,sy);
91
 
                }
92
 
 
93
 
                /* draw the right screen */
94
 
                if (screen == right_screen)
95
 
                {
96
 
                        if ((right_enable || right_sonar_window) && (!left_sonar_window))
97
 
                                drawgfx_opaque(bitmap,cliprect,screen->machine().gfx[0],
98
 
                                                charcode, 0,
99
 
                                                0,0,sx,sy);
100
 
                        else
101
 
                                drawgfx_opaque(bitmap,cliprect,screen->machine().gfx[0],
102
 
                                                0, 0,
103
 
                                                0,0,sx,sy);
104
 
                }
105
 
        }
106
 
 
107
 
        /* draw the motion objects */
108
 
        for (offs = 0; offs < 4; offs++)
109
 
        {
110
 
                int sx,sy;
111
 
                int charcode;
112
 
                int prom_set;
113
 
                int sub_enable;
114
 
 
115
 
                sx = spriteram[0x00 + (offs * 2)] - 16;
116
 
                sy = spriteram[0x08 + (offs * 2)] - 16;
117
 
                charcode = spriteram[0x09 + (offs * 2)];
118
 
                if (offs < 2)
119
 
                        sub_enable = spriteram[0x01 + (offs * 2)] & 0x80;
120
 
                else
121
 
                        sub_enable = 1;
122
 
 
123
 
                prom_set = charcode & 0x01;
124
 
                charcode = (charcode >> 3) & 0x1F;
125
 
 
126
 
                /* left screen - special check for drawing right screen's sub */
127
 
                if (screen == left_screen)
128
 
                {
129
 
                        if ((offs!=0) || (sub_enable))
130
 
                                drawgfx_transpen(bitmap,cliprect,screen->machine().gfx[1],
131
 
                                                charcode + 32 * prom_set,
132
 
                                                0,
133
 
                                                0,0,sx,sy,0);
134
 
                }
135
 
 
136
 
 
137
 
                /* right screen - special check for drawing left screen's sub */
138
 
                if (screen == right_screen)
139
 
                {
140
 
                        if ((offs!=1) || (sub_enable))
141
 
                                drawgfx_transpen(bitmap,cliprect,screen->machine().gfx[1],
142
 
                                                charcode + 32 * prom_set,
143
 
                                                0,
144
 
                                                0,0,sx,sy,0);
145
 
                }
146
 
        }
147
 
 
148
 
        /* Update sound */
149
 
        discrete_sound_w(discrete, SUBS_LAUNCH_DATA, spriteram[5] & 0x0f);      // Launch data
150
 
        discrete_sound_w(discrete, SUBS_CRASH_DATA, spriteram[5] >> 4);         // Crash/explode data
151
 
        return 0;
152
 
}