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

« back to all changes in this revision

Viewing changes to src/mame/video/arkanoid.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:
12
12
 
13
13
WRITE8_HANDLER( arkanoid_videoram_w )
14
14
{
15
 
        arkanoid_state *state = space->machine->driver_data<arkanoid_state>();
16
 
        state->videoram[offset] = data;
17
 
        tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
 
15
        arkanoid_state *state = space->machine().driver_data<arkanoid_state>();
 
16
        state->m_videoram[offset] = data;
 
17
        tilemap_mark_tile_dirty(state->m_bg_tilemap, offset / 2);
18
18
}
19
19
 
20
20
WRITE8_HANDLER( arkanoid_d008_w )
21
21
{
22
 
        arkanoid_state *state = space->machine->driver_data<arkanoid_state>();
 
22
        arkanoid_state *state = space->machine().driver_data<arkanoid_state>();
23
23
        int bank;
24
24
 
25
25
        /* bits 0 and 1 flip X and Y, I don't know which is which */
26
 
        if (flip_screen_x_get(space->machine) != (data & 0x01))
 
26
        if (flip_screen_x_get(space->machine()) != (data & 0x01))
27
27
        {
28
 
                flip_screen_x_set(space->machine, data & 0x01);
29
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
28
                flip_screen_x_set(space->machine(), data & 0x01);
 
29
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
30
30
        }
31
31
 
32
 
        if (flip_screen_y_get(space->machine) != (data & 0x02))
 
32
        if (flip_screen_y_get(space->machine()) != (data & 0x02))
33
33
        {
34
 
                flip_screen_y_set(space->machine, data & 0x02);
35
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
34
                flip_screen_y_set(space->machine(), data & 0x02);
 
35
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
36
36
        }
37
37
 
38
38
        /* bit 2 selects the input paddle */
39
 
        state->paddle_select = data & 0x04;
 
39
        state->m_paddle_select = data & 0x04;
40
40
 
41
41
        /* bit 3 is coin lockout (but not the service coin) */
42
 
        coin_lockout_w(space->machine, 0, !(data & 0x08));
43
 
        coin_lockout_w(space->machine, 1, !(data & 0x08));
 
42
        coin_lockout_w(space->machine(), 0, !(data & 0x08));
 
43
        coin_lockout_w(space->machine(), 1, !(data & 0x08));
44
44
 
45
45
        /* bit 4 is unknown */
46
46
 
48
48
        /* so I don't know which is which. */
49
49
        bank = (data & 0x20) >> 5;
50
50
 
51
 
        if (state->gfxbank != bank)
 
51
        if (state->m_gfxbank != bank)
52
52
        {
53
 
                state->gfxbank = bank;
54
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
53
                state->m_gfxbank = bank;
 
54
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
55
55
        }
56
56
 
57
57
        bank = (data & 0x40) >> 6;
58
58
 
59
 
        if (state->palettebank != bank)
 
59
        if (state->m_palettebank != bank)
60
60
        {
61
 
                state->palettebank = bank;
62
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
61
                state->m_palettebank = bank;
 
62
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
63
63
        }
64
64
 
65
65
        /* BM:  bit 7 is suspected to be MCU reset, the evidence for this is that
68
68
     leaving the tilt screen (as the MCU is now out of sync with main CPU
69
69
     which resets itself).  This bit is the likely candidate as it is flipped
70
70
     early in bootup just prior to accessing the MCU for the first time. */
71
 
        if (state->mcu != NULL) // Bootlegs don't have the MCU but still set this bit
72
 
                cpu_set_input_line(state->mcu, INPUT_LINE_RESET, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
 
71
        if (state->m_mcu != NULL)       // Bootlegs don't have the MCU but still set this bit
 
72
                device_set_input_line(state->m_mcu, INPUT_LINE_RESET, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
73
73
}
74
74
 
75
75
/* different hook-up, everything except for bits 0-1 and 7 aren't tested afaik. */
76
76
WRITE8_HANDLER( tetrsark_d008_w )
77
77
{
78
 
        arkanoid_state *state = space->machine->driver_data<arkanoid_state>();
 
78
        arkanoid_state *state = space->machine().driver_data<arkanoid_state>();
79
79
        int bank;
80
80
 
81
81
        /* bits 0 and 1 flip X and Y, I don't know which is which */
82
 
        if (flip_screen_x_get(space->machine) != (data & 0x01))
 
82
        if (flip_screen_x_get(space->machine()) != (data & 0x01))
83
83
        {
84
 
                flip_screen_x_set(space->machine, data & 0x01);
85
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
84
                flip_screen_x_set(space->machine(), data & 0x01);
 
85
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
86
86
        }
87
87
 
88
 
        if (flip_screen_y_get(space->machine) != (data & 0x02))
 
88
        if (flip_screen_y_get(space->machine()) != (data & 0x02))
89
89
        {
90
 
                flip_screen_y_set(space->machine, data & 0x02);
91
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
90
                flip_screen_y_set(space->machine(), data & 0x02);
 
91
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
92
92
        }
93
93
 
94
94
        /* bit 2 selects the input paddle? */
95
 
        state->paddle_select = data & 0x04;
 
95
        state->m_paddle_select = data & 0x04;
96
96
 
97
97
        /* bit 3-4 is unknown? */
98
98
 
100
100
        /* so I don't know which is which.? */
101
101
        bank = (data & 0x20) >> 5;
102
102
 
103
 
        if (state->gfxbank != bank)
 
103
        if (state->m_gfxbank != bank)
104
104
        {
105
 
                state->gfxbank = bank;
106
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
105
                state->m_gfxbank = bank;
 
106
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
107
107
        }
108
108
 
109
109
        bank = (data & 0x40) >> 6;
110
110
 
111
 
        if (state->palettebank != bank)
 
111
        if (state->m_palettebank != bank)
112
112
        {
113
 
                state->palettebank = bank;
114
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
113
                state->m_palettebank = bank;
 
114
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
115
115
        }
116
116
 
117
117
        /* bit 7 is coin lockout (but not the service coin) */
118
 
        coin_lockout_w(space->machine, 0, !(data & 0x80));
119
 
        coin_lockout_w(space->machine, 1, !(data & 0x80));
 
118
        coin_lockout_w(space->machine(), 0, !(data & 0x80));
 
119
        coin_lockout_w(space->machine(), 1, !(data & 0x80));
120
120
}
121
121
 
122
122
 
123
123
WRITE8_HANDLER( hexa_d008_w )
124
124
{
125
 
        arkanoid_state *state = space->machine->driver_data<arkanoid_state>();
 
125
        arkanoid_state *state = space->machine().driver_data<arkanoid_state>();
126
126
 
127
127
        /* bit 0 = flipx (or y?) */
128
 
        if (flip_screen_x_get(space->machine) != (data & 0x01))
 
128
        if (flip_screen_x_get(space->machine()) != (data & 0x01))
129
129
        {
130
 
                flip_screen_x_set(space->machine, data & 0x01);
131
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
130
                flip_screen_x_set(space->machine(), data & 0x01);
 
131
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
132
132
        }
133
133
 
134
134
        /* bit 1 = flipy (or x?) */
135
 
        if (flip_screen_y_get(space->machine) != (data & 0x02))
 
135
        if (flip_screen_y_get(space->machine()) != (data & 0x02))
136
136
        {
137
 
                flip_screen_y_set(space->machine, data & 0x02);
138
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
137
                flip_screen_y_set(space->machine(), data & 0x02);
 
138
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
139
139
        }
140
140
 
141
141
        /* bit 2 - 3 unknown */
142
142
 
143
143
        /* bit 4 could be the ROM bank selector for 8000-bfff (not sure) */
144
 
        memory_set_bank(space->machine, "bank1", ((data & 0x10) >> 4));
 
144
        memory_set_bank(space->machine(), "bank1", ((data & 0x10) >> 4));
145
145
 
146
146
        /* bit 5 = gfx bank */
147
 
        if (state->gfxbank != ((data & 0x20) >> 5))
 
147
        if (state->m_gfxbank != ((data & 0x20) >> 5))
148
148
        {
149
 
                state->gfxbank = (data & 0x20) >> 5;
150
 
                tilemap_mark_all_tiles_dirty(state->bg_tilemap);
 
149
                state->m_gfxbank = (data & 0x20) >> 5;
 
150
                tilemap_mark_all_tiles_dirty(state->m_bg_tilemap);
151
151
        }
152
152
 
153
153
        /* bit 6 - 7 unknown */
155
155
 
156
156
static TILE_GET_INFO( get_bg_tile_info )
157
157
{
158
 
        arkanoid_state *state = machine->driver_data<arkanoid_state>();
 
158
        arkanoid_state *state = machine.driver_data<arkanoid_state>();
159
159
        int offs = tile_index * 2;
160
 
        int code = state->videoram[offs + 1] + ((state->videoram[offs] & 0x07) << 8) + 2048 * state->gfxbank;
161
 
        int color = ((state->videoram[offs] & 0xf8) >> 3) + 32 * state->palettebank;
 
160
        int code = state->m_videoram[offs + 1] + ((state->m_videoram[offs] & 0x07) << 8) + 2048 * state->m_gfxbank;
 
161
        int color = ((state->m_videoram[offs] & 0xf8) >> 3) + 32 * state->m_palettebank;
162
162
 
163
163
        SET_TILE_INFO(0, code, color, 0);
164
164
}
165
165
 
166
166
VIDEO_START( arkanoid )
167
167
{
168
 
        arkanoid_state *state = machine->driver_data<arkanoid_state>();
 
168
        arkanoid_state *state = machine.driver_data<arkanoid_state>();
169
169
 
170
 
        state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
 
170
        state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
171
171
}
172
172
 
173
 
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
 
173
static void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect )
174
174
{
175
 
        arkanoid_state *state = machine->driver_data<arkanoid_state>();
 
175
        arkanoid_state *state = machine.driver_data<arkanoid_state>();
176
176
        int offs;
177
177
 
178
 
        for (offs = 0; offs < state->spriteram_size; offs += 4)
 
178
        for (offs = 0; offs < state->m_spriteram_size; offs += 4)
179
179
        {
180
180
                int sx, sy, code;
181
181
 
182
 
                sx = state->spriteram[offs];
183
 
                sy = 248 - state->spriteram[offs + 1];
 
182
                sx = state->m_spriteram[offs];
 
183
                sy = 248 - state->m_spriteram[offs + 1];
184
184
                if (flip_screen_x_get(machine))
185
185
                        sx = 248 - sx;
186
186
                if (flip_screen_y_get(machine))
187
187
                        sy = 248 - sy;
188
188
 
189
 
                code = state->spriteram[offs + 3] + ((state->spriteram[offs + 2] & 0x03) << 8) + 1024 * state->gfxbank;
 
189
                code = state->m_spriteram[offs + 3] + ((state->m_spriteram[offs + 2] & 0x03) << 8) + 1024 * state->m_gfxbank;
190
190
 
191
 
                drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
 
191
                drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
192
192
                                2 * code,
193
 
                                ((state->spriteram[offs + 2] & 0xf8) >> 3) + 32 * state->palettebank,
 
193
                                ((state->m_spriteram[offs + 2] & 0xf8) >> 3) + 32 * state->m_palettebank,
194
194
                                flip_screen_x_get(machine),flip_screen_y_get(machine),
195
195
                                sx,sy + (flip_screen_y_get(machine) ? 8 : -8),0);
196
 
                drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
 
196
                drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
197
197
                                2 * code + 1,
198
 
                                ((state->spriteram[offs + 2] & 0xf8) >> 3) + 32 * state->palettebank,
 
198
                                ((state->m_spriteram[offs + 2] & 0xf8) >> 3) + 32 * state->m_palettebank,
199
199
                                flip_screen_x_get(machine),flip_screen_y_get(machine),
200
200
                                sx,sy,0);
201
201
        }
202
202
}
203
203
 
204
204
 
205
 
VIDEO_UPDATE( arkanoid )
 
205
SCREEN_UPDATE( arkanoid )
206
206
{
207
 
        arkanoid_state *state = screen->machine->driver_data<arkanoid_state>();
 
207
        arkanoid_state *state = screen->machine().driver_data<arkanoid_state>();
208
208
 
209
 
        tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
210
 
        draw_sprites(screen->machine, bitmap, cliprect);
 
209
        tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0);
 
210
        draw_sprites(screen->machine(), bitmap, cliprect);
211
211
        return 0;
212
212
}
213
213
 
214
 
VIDEO_UPDATE( hexa )
 
214
SCREEN_UPDATE( hexa )
215
215
{
216
 
        arkanoid_state *state = screen->machine->driver_data<arkanoid_state>();
 
216
        arkanoid_state *state = screen->machine().driver_data<arkanoid_state>();
217
217
 
218
 
        tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
 
218
        tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0);
219
219
        return 0;
220
220
}