1
/***************************************************************************
5
***************************************************************************/
8
#include "includes/subs.h"
9
#include "sound/discrete.h"
11
WRITE8_HANDLER( subs_invert1_w )
13
if ((offset & 0x01) == 1)
15
palette_set_color(space->machine(), 0, MAKE_RGB(0x00, 0x00, 0x00));
16
palette_set_color(space->machine(), 1, MAKE_RGB(0xFF, 0xFF, 0xFF));
20
palette_set_color(space->machine(), 1, MAKE_RGB(0x00, 0x00, 0x00));
21
palette_set_color(space->machine(), 0, MAKE_RGB(0xFF, 0xFF, 0xFF));
25
WRITE8_HANDLER( subs_invert2_w )
27
if ((offset & 0x01) == 1)
29
palette_set_color(space->machine(), 2, MAKE_RGB(0x00, 0x00, 0x00));
30
palette_set_color(space->machine(), 3, MAKE_RGB(0xFF, 0xFF, 0xFF));
34
palette_set_color(space->machine(), 3, MAKE_RGB(0x00, 0x00, 0x00));
35
palette_set_color(space->machine(), 2, MAKE_RGB(0xFF, 0xFF, 0xFF));
42
subs_state *state = screen->machine().driver_data<subs_state>();
43
UINT8 *videoram = state->m_videoram;
44
UINT8 *spriteram = state->m_spriteram;
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");
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--)
57
int left_enable,right_enable;
58
int left_sonar_window,right_sonar_window;
60
left_sonar_window = 0;
61
right_sonar_window = 0;
63
charcode = videoram[offs];
65
/* Which monitor is this for? */
66
right_enable = charcode & 0x40;
67
left_enable = charcode & 0x80;
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;
78
charcode = charcode & 0x3F;
80
/* draw the left screen */
81
if (screen == left_screen)
83
if ((left_enable || left_sonar_window) && (!right_sonar_window))
84
drawgfx_opaque(bitmap,cliprect,screen->machine().gfx[0],
88
drawgfx_opaque(bitmap,cliprect,screen->machine().gfx[0],
93
/* draw the right screen */
94
if (screen == right_screen)
96
if ((right_enable || right_sonar_window) && (!left_sonar_window))
97
drawgfx_opaque(bitmap,cliprect,screen->machine().gfx[0],
101
drawgfx_opaque(bitmap,cliprect,screen->machine().gfx[0],
107
/* draw the motion objects */
108
for (offs = 0; offs < 4; offs++)
115
sx = spriteram[0x00 + (offs * 2)] - 16;
116
sy = spriteram[0x08 + (offs * 2)] - 16;
117
charcode = spriteram[0x09 + (offs * 2)];
119
sub_enable = spriteram[0x01 + (offs * 2)] & 0x80;
123
prom_set = charcode & 0x01;
124
charcode = (charcode >> 3) & 0x1F;
126
/* left screen - special check for drawing right screen's sub */
127
if (screen == left_screen)
129
if ((offs!=0) || (sub_enable))
130
drawgfx_transpen(bitmap,cliprect,screen->machine().gfx[1],
131
charcode + 32 * prom_set,
137
/* right screen - special check for drawing left screen's sub */
138
if (screen == right_screen)
140
if ((offs!=1) || (sub_enable))
141
drawgfx_transpen(bitmap,cliprect,screen->machine().gfx[1],
142
charcode + 32 * prom_set,
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