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

« back to all changes in this revision

Viewing changes to src/mame/video/atarigx2.c

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Emmanuel Kasper, Félix Arreola Rodríguez, Jordi Mallach
  • Date: 2011-05-11 21:06:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110511210650-jizvh8a6x117y9hr
Tags: 0.142-1
[ Emmanuel Kasper ]
* New upstream release
* Set NOWERROR=1 to allow compiling with gcc-4.6
* Remove fix_powerpc_build.patch, as upstream has taken it in this release
* Add gnome-video-arcade front end as a suggested package

[ Félix Arreola Rodríguez ]
* Add kfreebsd-build.patch to quilt series, to fix build on kfreebsd

[ Jordi Mallach ]
* Remove unneeded and bogus addition of --with-quilt to the dh invocation.
* Add Cesare Falco (long time Ubuntu maintainer) to Uploaders, and wrap
  them into multiple lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
 
22
22
#include "emu.h"
23
 
#include "machine/atarigen.h"
 
23
#include "video/atarirle.h"
24
24
#include "includes/atarigx2.h"
25
25
 
26
26
 
33
33
 
34
34
static TILE_GET_INFO( get_alpha_tile_info )
35
35
{
36
 
        atarigx2_state *state = machine->driver_data<atarigx2_state>();
37
 
        UINT16 data = state->alpha32[tile_index / 2] >> (16 * (~tile_index & 1));
 
36
        atarigx2_state *state = machine.driver_data<atarigx2_state>();
 
37
        UINT16 data = state->m_alpha32[tile_index / 2] >> (16 * (~tile_index & 1));
38
38
        int code = data & 0xfff;
39
39
        int color = (data >> 12) & 0x0f;
40
40
        int opaque = data & 0x8000;
44
44
 
45
45
static TILE_GET_INFO( get_playfield_tile_info )
46
46
{
47
 
        atarigx2_state *state = machine->driver_data<atarigx2_state>();
48
 
        UINT16 data = state->playfield32[tile_index / 2] >> (16 * (~tile_index & 1));
49
 
        int code = (state->playfield_tile_bank << 12) | (data & 0xfff);
50
 
        int color = (state->playfield_base >> 5) + ((state->playfield_color_bank << 3) & 0x18) + ((data >> 12) & 7);
 
47
        atarigx2_state *state = machine.driver_data<atarigx2_state>();
 
48
        UINT16 data = state->m_playfield32[tile_index / 2] >> (16 * (~tile_index & 1));
 
49
        int code = (state->m_playfield_tile_bank << 12) | (data & 0xfff);
 
50
        int color = (state->m_playfield_base >> 5) + ((state->m_playfield_color_bank << 3) & 0x18) + ((data >> 12) & 7);
51
51
        SET_TILE_INFO(0, code, color, (data >> 15) & 1);
52
 
        tileinfo->category = (state->playfield_color_bank >> 2) & 7;
 
52
        tileinfo->category = (state->m_playfield_color_bank >> 2) & 7;
53
53
}
54
54
 
55
55
 
69
69
 
70
70
VIDEO_START( atarigx2 )
71
71
{
72
 
        static const atarirle_desc modesc =
73
 
        {
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 */
78
 
 
79
 
                0x000,          /* base palette entry */
80
 
                0x400,          /* maximum number of colors */
81
 
 
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 */
91
 
        };
92
 
        atarigx2_state *state = machine->driver_data<atarigx2_state>();
93
 
        atarirle_desc adjusted_modesc = modesc;
94
 
        int i;
 
72
        atarigx2_state *state = machine.driver_data<atarigx2_state>();
95
73
 
96
74
        /* blend the playfields and free the temporary one */
97
75
        atarigen_blend_gfx(machine, 0, 2, 0x0f, 0x30);
98
76
 
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);
101
79
 
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");
107
82
 
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);
111
86
 
112
87
        /* save states */
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));
118
93
}
119
94
 
120
95
 
127
102
 
128
103
WRITE16_HANDLER( atarigx2_mo_control_w )
129
104
{
130
 
        atarigx2_state *state = space->machine->driver_data<atarigx2_state>();
 
105
        atarigx2_state *state = space->machine().driver_data<atarigx2_state>();
131
106
 
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());
133
108
 
134
109
        /* set the control value */
135
 
        COMBINE_DATA(&state->current_control);
 
110
        COMBINE_DATA(&state->m_current_control);
136
111
}
137
112
 
138
113
 
139
114
void atarigx2_scanline_update(screen_device &screen, int scanline)
140
115
{
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];
143
118
        int i;
144
119
 
145
120
        if (scanline == 0) logerror("-------\n");
146
121
 
147
122
        /* keep in range */
148
 
        if (base >= &state->alpha32[0x400])
 
123
        if (base >= &state->m_alpha32[0x400])
149
124
                return;
150
125
 
151
126
        /* update the playfield scrolls */
157
132
                {
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)
161
136
                        {
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;
166
141
                        }
167
 
                        if (newbank != state->playfield_color_bank)
 
142
                        if (newbank != state->m_playfield_color_bank)
168
143
                        {
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;
173
148
                        }
174
149
                }
175
150
 
177
152
                {
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)
181
156
                        {
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;
186
161
                        }
187
 
                        if (newbank != state->playfield_tile_bank)
 
162
                        if (newbank != state->m_playfield_tile_bank)
188
163
                        {
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;
193
168
                        }
194
169
                }
195
170
        }
203
178
 *
204
179
 *************************************/
205
180
 
206
 
VIDEO_UPDATE( atarigx2 )
 
181
SCREEN_UPDATE( atarigx2 )
207
182
{
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;
210
185
 
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);
221
196
 
222
197
        /* copy the motion objects on top */
223
198
        {
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;
241
216
        }
242
217
 
243
218
        /* add the alpha on top */
244
 
        tilemap_draw(bitmap, cliprect, state->alpha_tilemap, 0, 0);
 
219
        tilemap_draw(bitmap, cliprect, state->m_alpha_tilemap, 0, 0);
245
220
        return 0;
246
221
}
 
222
 
 
223
SCREEN_EOF( atarigx2 )
 
224
{
 
225
        atarigx2_state *state = machine.driver_data<atarigx2_state>();
 
226
 
 
227
        atarirle_eof(state->m_rle);
 
228
}