70
70
VIDEO_START( atarigx2 )
72
static const atarirle_desc modesc =
74
"gfx3", /* region where the GFX data lives */
75
256, /* number of entries in sprite RAM */
76
0, /* left clip coordinate */
77
0, /* right clip coordinate */
79
0x000, /* base palette entry */
80
0x400, /* maximum number of colors */
82
{{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */
83
{{ 0,0x03f0,0,0,0,0,0,0 }}, /* mask for the color */
84
{{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */
85
{{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */
86
{{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */
87
{{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */
88
{{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */
89
{{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */
90
{{ 0 }} /* mask for the VRAM target */
92
atarigx2_state *state = machine->driver_data<atarigx2_state>();
93
atarirle_desc adjusted_modesc = modesc;
72
atarigx2_state *state = machine.driver_data<atarigx2_state>();
96
74
/* blend the playfields and free the temporary one */
97
75
atarigen_blend_gfx(machine, 0, 2, 0x0f, 0x30);
99
77
/* initialize the playfield */
100
state->playfield_tilemap = tilemap_create(machine, get_playfield_tile_info, atarigx2_playfield_scan, 8,8, 128,64);
78
state->m_playfield_tilemap = tilemap_create(machine, get_playfield_tile_info, atarigx2_playfield_scan, 8,8, 128,64);
102
80
/* initialize the motion objects */
103
adjusted_modesc.palettebase = state->motion_object_base;
104
for (i = 0; i < 8; i++)
105
adjusted_modesc.colormask.data[i] &= state->motion_object_mask;
106
atarirle_init(machine, 0, &adjusted_modesc);
81
state->m_rle = machine.device("rle");
108
83
/* initialize the alphanumerics */
109
state->alpha_tilemap = tilemap_create(machine, get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,32);
110
tilemap_set_transparent_pen(state->alpha_tilemap, 0);
84
state->m_alpha_tilemap = tilemap_create(machine, get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,32);
85
tilemap_set_transparent_pen(state->m_alpha_tilemap, 0);
113
state_save_register_global(machine, state->current_control);
114
state_save_register_global(machine, state->playfield_tile_bank);
115
state_save_register_global(machine, state->playfield_color_bank);
116
state_save_register_global(machine, state->playfield_xscroll);
117
state_save_register_global(machine, state->playfield_yscroll);
88
state->save_item(NAME(state->m_current_control));
89
state->save_item(NAME(state->m_playfield_tile_bank));
90
state->save_item(NAME(state->m_playfield_color_bank));
91
state->save_item(NAME(state->m_playfield_xscroll));
92
state->save_item(NAME(state->m_playfield_yscroll));
128
103
WRITE16_HANDLER( atarigx2_mo_control_w )
130
atarigx2_state *state = space->machine->driver_data<atarigx2_state>();
105
atarigx2_state *state = space->machine().driver_data<atarigx2_state>();
132
logerror("MOCONT = %d (scan = %d)\n", data, space->machine->primary_screen->vpos());
107
logerror("MOCONT = %d (scan = %d)\n", data, space->machine().primary_screen->vpos());
134
109
/* set the control value */
135
COMBINE_DATA(&state->current_control);
110
COMBINE_DATA(&state->m_current_control);
139
114
void atarigx2_scanline_update(screen_device &screen, int scanline)
141
atarigx2_state *state = screen.machine->driver_data<atarigx2_state>();
142
UINT32 *base = &state->alpha32[(scanline / 8) * 32 + 24];
116
atarigx2_state *state = screen.machine().driver_data<atarigx2_state>();
117
UINT32 *base = &state->m_alpha32[(scanline / 8) * 32 + 24];
145
120
if (scanline == 0) logerror("-------\n");
147
122
/* keep in range */
148
if (base >= &state->alpha32[0x400])
123
if (base >= &state->m_alpha32[0x400])
151
126
/* update the playfield scrolls */
158
133
int newscroll = (word >> 21) & 0x3ff;
159
134
int newbank = (word >> 16) & 0x1f;
160
if (newscroll != state->playfield_xscroll)
135
if (newscroll != state->m_playfield_xscroll)
162
137
if (scanline + i > 0)
163
138
screen.update_partial(scanline + i - 1);
164
tilemap_set_scrollx(state->playfield_tilemap, 0, newscroll);
165
state->playfield_xscroll = newscroll;
139
tilemap_set_scrollx(state->m_playfield_tilemap, 0, newscroll);
140
state->m_playfield_xscroll = newscroll;
167
if (newbank != state->playfield_color_bank)
142
if (newbank != state->m_playfield_color_bank)
169
144
if (scanline + i > 0)
170
145
screen.update_partial(scanline + i - 1);
171
tilemap_mark_all_tiles_dirty(state->playfield_tilemap);
172
state->playfield_color_bank = newbank;
146
tilemap_mark_all_tiles_dirty(state->m_playfield_tilemap);
147
state->m_playfield_color_bank = newbank;
178
153
int newscroll = ((word >> 6) - (scanline + i)) & 0x1ff;
179
154
int newbank = word & 15;
180
if (newscroll != state->playfield_yscroll)
155
if (newscroll != state->m_playfield_yscroll)
182
157
if (scanline + i > 0)
183
158
screen.update_partial(scanline + i - 1);
184
tilemap_set_scrolly(state->playfield_tilemap, 0, newscroll);
185
state->playfield_yscroll = newscroll;
159
tilemap_set_scrolly(state->m_playfield_tilemap, 0, newscroll);
160
state->m_playfield_yscroll = newscroll;
187
if (newbank != state->playfield_tile_bank)
162
if (newbank != state->m_playfield_tile_bank)
189
164
if (scanline + i > 0)
190
165
screen.update_partial(scanline + i - 1);
191
tilemap_mark_all_tiles_dirty(state->playfield_tilemap);
192
state->playfield_tile_bank = newbank;
166
tilemap_mark_all_tiles_dirty(state->m_playfield_tilemap);
167
state->m_playfield_tile_bank = newbank;
204
179
*************************************/
206
VIDEO_UPDATE( atarigx2 )
181
SCREEN_UPDATE( atarigx2 )
208
atarigx2_state *state = screen->machine->driver_data<atarigx2_state>();
209
bitmap_t *priority_bitmap = screen->machine->priority_bitmap;
183
atarigx2_state *state = screen->machine().driver_data<atarigx2_state>();
184
bitmap_t *priority_bitmap = screen->machine().priority_bitmap;
211
186
/* draw the playfield */
212
187
bitmap_fill(priority_bitmap, cliprect, 0);
213
tilemap_draw(bitmap, cliprect, state->playfield_tilemap, 0, 0);
214
tilemap_draw(bitmap, cliprect, state->playfield_tilemap, 1, 1);
215
tilemap_draw(bitmap, cliprect, state->playfield_tilemap, 2, 2);
216
tilemap_draw(bitmap, cliprect, state->playfield_tilemap, 3, 3);
217
tilemap_draw(bitmap, cliprect, state->playfield_tilemap, 4, 4);
218
tilemap_draw(bitmap, cliprect, state->playfield_tilemap, 5, 5);
219
tilemap_draw(bitmap, cliprect, state->playfield_tilemap, 6, 6);
220
tilemap_draw(bitmap, cliprect, state->playfield_tilemap, 7, 7);
188
tilemap_draw(bitmap, cliprect, state->m_playfield_tilemap, 0, 0);
189
tilemap_draw(bitmap, cliprect, state->m_playfield_tilemap, 1, 1);
190
tilemap_draw(bitmap, cliprect, state->m_playfield_tilemap, 2, 2);
191
tilemap_draw(bitmap, cliprect, state->m_playfield_tilemap, 3, 3);
192
tilemap_draw(bitmap, cliprect, state->m_playfield_tilemap, 4, 4);
193
tilemap_draw(bitmap, cliprect, state->m_playfield_tilemap, 5, 5);
194
tilemap_draw(bitmap, cliprect, state->m_playfield_tilemap, 6, 6);
195
tilemap_draw(bitmap, cliprect, state->m_playfield_tilemap, 7, 7);
222
197
/* copy the motion objects on top */
224
bitmap_t *mo_bitmap = atarirle_get_vram(0, 0);
199
bitmap_t *mo_bitmap = atarirle_get_vram(state->m_rle, 0);
225
200
int left = cliprect->min_x;
226
201
int top = cliprect->min_y;
227
202
int right = cliprect->max_x + 1;