~ubuntu-branches/debian/wheezy/mame/wheezy

« back to all changes in this revision

Viewing changes to src/mame/video/n8080.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:
10
10
 
11
11
WRITE8_HANDLER( n8080_video_control_w )
12
12
{
13
 
        n8080_state *state = space->machine->driver_data<n8080_state>();
 
13
        n8080_state *state = space->machine().driver_data<n8080_state>();
14
14
 
15
 
        state->sheriff_color_mode = (data >> 3) & 3;
16
 
        state->sheriff_color_data = (data >> 0) & 7;
17
 
        flip_screen_set_no_update(space->machine, data & 0x20);
 
15
        state->m_sheriff_color_mode = (data >> 3) & 3;
 
16
        state->m_sheriff_color_data = (data >> 0) & 7;
 
17
        flip_screen_set_no_update(space->machine(), data & 0x20);
18
18
}
19
19
 
20
20
 
46
46
}
47
47
 
48
48
 
49
 
void spacefev_start_red_cannon( running_machine *machine )
 
49
void spacefev_start_red_cannon( running_machine &machine )
50
50
{
51
 
        n8080_state *state = machine->driver_data<n8080_state>();
 
51
        n8080_state *state = machine.driver_data<n8080_state>();
52
52
 
53
 
        state->spacefev_red_cannon = 1;
54
 
        timer_adjust_oneshot(state->cannon_timer, ATTOTIME_IN_USEC(550 * 68 * 10), 0);
 
53
        state->m_spacefev_red_cannon = 1;
 
54
        state->m_cannon_timer->adjust(attotime::from_usec(550 * 68 * 10));
55
55
}
56
56
 
57
57
 
58
58
static TIMER_CALLBACK( spacefev_stop_red_cannon )
59
59
{
60
 
        n8080_state *state = machine->driver_data<n8080_state>();
 
60
        n8080_state *state = machine.driver_data<n8080_state>();
61
61
 
62
 
        state->spacefev_red_cannon = 0;
63
 
        timer_adjust_oneshot(state->cannon_timer, attotime_never, 0);
 
62
        state->m_spacefev_red_cannon = 0;
 
63
        state->m_cannon_timer->adjust(attotime::never);
64
64
}
65
65
 
66
66
 
67
 
static void helifire_next_line( running_machine *machine )
 
67
static void helifire_next_line( running_machine &machine )
68
68
{
69
 
        n8080_state *state = machine->driver_data<n8080_state>();
70
 
 
71
 
        state->helifire_mv++;
72
 
 
73
 
        if (state->helifire_sc % 4 == 2)
 
69
        n8080_state *state = machine.driver_data<n8080_state>();
 
70
 
 
71
        state->m_helifire_mv++;
 
72
 
 
73
        if (state->m_helifire_sc % 4 == 2)
74
74
        {
75
 
                state->helifire_mv %= 256;
 
75
                state->m_helifire_mv %= 256;
76
76
        }
77
77
        else
78
78
        {
79
79
                if (flip_screen_get(machine))
80
 
                        state->helifire_mv %= 255;
 
80
                        state->m_helifire_mv %= 255;
81
81
                else
82
 
                        state->helifire_mv %= 257;
 
82
                        state->m_helifire_mv %= 257;
83
83
        }
84
84
 
85
 
        if (state->helifire_mv == 128)
 
85
        if (state->m_helifire_mv == 128)
86
86
        {
87
 
                state->helifire_sc++;
 
87
                state->m_helifire_sc++;
88
88
        }
89
89
}
90
90
 
91
91
 
92
92
VIDEO_START( spacefev )
93
93
{
94
 
        n8080_state *state = machine->driver_data<n8080_state>();
 
94
        n8080_state *state = machine.driver_data<n8080_state>();
95
95
 
96
 
        state->cannon_timer = timer_alloc(machine, spacefev_stop_red_cannon, NULL);
 
96
        state->m_cannon_timer = machine.scheduler().timer_alloc(FUNC(spacefev_stop_red_cannon));
97
97
 
98
98
        flip_screen_set_no_update(machine, 0);
99
99
 
100
 
        state_save_register_global(machine, state->spacefev_red_screen);
101
 
        state_save_register_global(machine, state->spacefev_red_cannon);
 
100
        state->save_item(NAME(state->m_spacefev_red_screen));
 
101
        state->save_item(NAME(state->m_spacefev_red_cannon));
102
102
}
103
103
 
104
104
 
105
105
VIDEO_START( sheriff )
106
106
{
107
 
        n8080_state *state = machine->driver_data<n8080_state>();
 
107
        n8080_state *state = machine.driver_data<n8080_state>();
108
108
 
109
109
        flip_screen_set_no_update(machine, 0);
110
110
 
111
 
        state_save_register_global(machine, state->sheriff_color_mode);
112
 
        state_save_register_global(machine, state->sheriff_color_data);
 
111
        state->save_item(NAME(state->m_sheriff_color_mode));
 
112
        state->save_item(NAME(state->m_sheriff_color_data));
113
113
}
114
114
 
115
115
 
116
116
VIDEO_START( helifire )
117
117
{
118
 
        n8080_state *state = machine->driver_data<n8080_state>();
 
118
        n8080_state *state = machine.driver_data<n8080_state>();
119
119
        UINT8 data = 0;
120
120
        int i;
121
121
 
122
 
        state_save_register_global(machine, state->helifire_mv);
123
 
        state_save_register_global(machine, state->helifire_sc);
124
 
        state_save_register_global(machine, state->helifire_flash);
125
 
        state_save_register_global_array(machine, state->helifire_LSFR);
 
122
        state->save_item(NAME(state->m_helifire_mv));
 
123
        state->save_item(NAME(state->m_helifire_sc));
 
124
        state->save_item(NAME(state->m_helifire_flash));
 
125
        state->save_item(NAME(state->m_helifire_LSFR));
126
126
 
127
127
        for (i = 0; i < 63; i++)
128
128
        {
132
132
 
133
133
                data = (data << 1) | (bit & 1);
134
134
 
135
 
                state->helifire_LSFR[i] = data;
 
135
                state->m_helifire_LSFR[i] = data;
136
136
        }
137
137
 
138
138
        flip_screen_set_no_update(machine, 0);
139
139
}
140
140
 
141
141
 
142
 
VIDEO_UPDATE( spacefev )
 
142
SCREEN_UPDATE( spacefev )
143
143
{
144
 
        n8080_state *state = screen->machine->driver_data<n8080_state>();
145
 
        UINT8 mask = flip_screen_get(screen->machine) ? 0xff : 0x00;
 
144
        n8080_state *state = screen->machine().driver_data<n8080_state>();
 
145
        UINT8 mask = flip_screen_get(screen->machine()) ? 0xff : 0x00;
146
146
 
147
147
        int x;
148
148
        int y;
149
149
 
150
 
        const UINT8* pRAM = state->videoram;
151
 
        const UINT8* pPROM = screen->machine->region("proms")->base();
 
150
        const UINT8* pRAM = state->m_videoram;
 
151
        const UINT8* pPROM = screen->machine().region("proms")->base();
152
152
 
153
153
        for (y = 0; y < 256; y++)
154
154
        {
160
160
 
161
161
                        UINT8 color = 0;
162
162
 
163
 
                        if (state->spacefev_red_screen)
 
163
                        if (state->m_spacefev_red_screen)
164
164
                                color = 1;
165
165
                        else
166
166
                        {
168
168
 
169
169
                                if ((x >> 3) == 0x06)
170
170
                                {
171
 
                                        color = state->spacefev_red_cannon ? 1 : 7;
 
171
                                        color = state->m_spacefev_red_cannon ? 1 : 7;
172
172
                                }
173
173
 
174
174
                                if ((x >> 3) == 0x1b)
209
209
}
210
210
 
211
211
 
212
 
VIDEO_UPDATE( sheriff )
 
212
SCREEN_UPDATE( sheriff )
213
213
{
214
 
        n8080_state *state = screen->machine->driver_data<n8080_state>();
215
 
        UINT8 mask = flip_screen_get(screen->machine) ? 0xff : 0x00;
 
214
        n8080_state *state = screen->machine().driver_data<n8080_state>();
 
215
        UINT8 mask = flip_screen_get(screen->machine()) ? 0xff : 0x00;
216
216
 
217
 
        const UINT8* pPROM = screen->machine->region("proms")->base();
 
217
        const UINT8* pPROM = screen->machine().region("proms")->base();
218
218
 
219
219
        int x;
220
220
        int y;
221
221
 
222
 
        const UINT8* pRAM = state->videoram;
 
222
        const UINT8* pRAM = state->m_videoram;
223
223
 
224
224
        for (y = 0; y < 256; y++)
225
225
        {
231
231
 
232
232
                        UINT8 color = pPROM[32 * (y >> 3) + (x >> 3)];
233
233
 
234
 
                        if (state->sheriff_color_mode == 1 && !(color & 8))
235
 
                                color = state->sheriff_color_data ^ 7;
236
 
 
237
 
                        if (state->sheriff_color_mode == 2)
238
 
                                color = state->sheriff_color_data ^ 7;
239
 
 
240
 
                        if (state->sheriff_color_mode == 3)
 
234
                        if (state->m_sheriff_color_mode == 1 && !(color & 8))
 
235
                                color = state->m_sheriff_color_data ^ 7;
 
236
 
 
237
                        if (state->m_sheriff_color_mode == 2)
 
238
                                color = state->m_sheriff_color_data ^ 7;
 
239
 
 
240
                        if (state->m_sheriff_color_mode == 3)
241
241
                                color = 7;
242
242
 
243
243
                        for (n = 0; n < 8; n++)
252
252
}
253
253
 
254
254
 
255
 
VIDEO_UPDATE( helifire )
 
255
SCREEN_UPDATE( helifire )
256
256
{
257
 
        n8080_state *state = screen->machine->driver_data<n8080_state>();
258
 
        int SUN_BRIGHTNESS = input_port_read(screen->machine, "POT0");
259
 
        int SEA_BRIGHTNESS = input_port_read(screen->machine, "POT1");
 
257
        n8080_state *state = screen->machine().driver_data<n8080_state>();
 
258
        int SUN_BRIGHTNESS = input_port_read(screen->machine(), "POT0");
 
259
        int SEA_BRIGHTNESS = input_port_read(screen->machine(), "POT1");
260
260
 
261
261
        static const int wave[8] = { 0, 1, 2, 2, 2, 1, 0, 0 };
262
262
 
263
 
        unsigned saved_mv = state->helifire_mv;
264
 
        unsigned saved_sc = state->helifire_sc;
 
263
        unsigned saved_mv = state->m_helifire_mv;
 
264
        unsigned saved_sc = state->m_helifire_sc;
265
265
 
266
266
        int x;
267
267
        int y;
270
270
        {
271
271
                UINT16* pLine = BITMAP_ADDR16(bitmap, y, 0);
272
272
 
273
 
                int level = 120 + wave[state->helifire_mv & 7];
 
273
                int level = 120 + wave[state->m_helifire_mv & 7];
274
274
 
275
275
                /* draw sky */
276
276
 
281
281
 
282
282
                /* draw stars */
283
283
 
284
 
                if (state->helifire_mv % 8 == 4) /* upper half */
 
284
                if (state->m_helifire_mv % 8 == 4) /* upper half */
285
285
                {
286
 
                        int step = (320 * (state->helifire_mv - 0)) % sizeof state->helifire_LSFR;
 
286
                        int step = (320 * (state->m_helifire_mv - 0)) % sizeof state->m_helifire_LSFR;
287
287
 
288
288
                        int data =
289
 
                                ((state->helifire_LSFR[step] & 1) << 6) |
290
 
                                ((state->helifire_LSFR[step] & 2) << 4) |
291
 
                                ((state->helifire_LSFR[step] & 4) << 2) |
292
 
                                ((state->helifire_LSFR[step] & 8) << 0);
 
289
                                ((state->m_helifire_LSFR[step] & 1) << 6) |
 
290
                                ((state->m_helifire_LSFR[step] & 2) << 4) |
 
291
                                ((state->m_helifire_LSFR[step] & 4) << 2) |
 
292
                                ((state->m_helifire_LSFR[step] & 8) << 0);
293
293
 
294
294
                        pLine[0x80 + data] |= 0x100;
295
295
                }
296
296
 
297
 
                if (state->helifire_mv % 8 == 5) /* lower half */
 
297
                if (state->m_helifire_mv % 8 == 5) /* lower half */
298
298
                {
299
 
                        int step = (320 * (state->helifire_mv - 1)) % sizeof state->helifire_LSFR;
 
299
                        int step = (320 * (state->m_helifire_mv - 1)) % sizeof state->m_helifire_LSFR;
300
300
 
301
301
                        int data =
302
 
                                ((state->helifire_LSFR[step] & 1) << 6) |
303
 
                                ((state->helifire_LSFR[step] & 2) << 4) |
304
 
                                ((state->helifire_LSFR[step] & 4) << 2) |
305
 
                                ((state->helifire_LSFR[step] & 8) << 0);
 
302
                                ((state->m_helifire_LSFR[step] & 1) << 6) |
 
303
                                ((state->m_helifire_LSFR[step] & 2) << 4) |
 
304
                                ((state->m_helifire_LSFR[step] & 4) << 2) |
 
305
                                ((state->m_helifire_LSFR[step] & 8) << 0);
306
306
 
307
307
                        pLine[0x00 + data] |= 0x100;
308
308
                }
324
324
 
325
325
                        for (n = 0; n < 8; n++)
326
326
                        {
327
 
                                if (flip_screen_get(screen->machine))
 
327
                                if (flip_screen_get(screen->machine()))
328
328
                                {
329
 
                                        if ((state->videoram[offset ^ 0x1fff] << n) & 0x80)
 
329
                                        if ((state->m_videoram[offset ^ 0x1fff] << n) & 0x80)
330
330
                                        {
331
 
                                                pLine[x + n] = state->colorram[offset ^ 0x1fff] & 7;
 
331
                                                pLine[x + n] = state->m_colorram[offset ^ 0x1fff] & 7;
332
332
                                        }
333
333
                                }
334
334
                                else
335
335
                                {
336
 
                                        if ((state->videoram[offset] >> n) & 1)
 
336
                                        if ((state->m_videoram[offset] >> n) & 1)
337
337
                                        {
338
 
                                                pLine[x + n] = state->colorram[offset] & 7;
 
338
                                                pLine[x + n] = state->m_colorram[offset] & 7;
339
339
                                        }
340
340
                                }
341
341
                        }
343
343
 
344
344
                /* next line */
345
345
 
346
 
                helifire_next_line(screen->machine);
 
346
                helifire_next_line(screen->machine());
347
347
        }
348
348
 
349
 
        state->helifire_mv = saved_mv;
350
 
        state->helifire_sc = saved_sc;
 
349
        state->m_helifire_mv = saved_mv;
 
350
        state->m_helifire_sc = saved_sc;
351
351
        return 0;
352
352
}
353
353
 
354
354
 
355
 
VIDEO_EOF( helifire )
 
355
SCREEN_EOF( helifire )
356
356
{
357
 
        n8080_state *state = machine->driver_data<n8080_state>();
358
 
        int n = (machine->primary_screen->frame_number() >> 1) % sizeof state->helifire_LSFR;
 
357
        n8080_state *state = machine.driver_data<n8080_state>();
 
358
        int n = (machine.primary_screen->frame_number() >> 1) % sizeof state->m_helifire_LSFR;
359
359
 
360
360
        int i;
361
361
 
365
365
                int G = (i & 2);
366
366
                int B = (i & 4);
367
367
 
368
 
                if (state->helifire_flash)
 
368
                if (state->m_helifire_flash)
369
369
                {
370
 
                        if (state->helifire_LSFR[n] & 0x20)
 
370
                        if (state->m_helifire_LSFR[n] & 0x20)
371
371
                        {
372
372
                                G |= B;
373
373
                        }
374
374
 
375
 
                        if (machine->primary_screen->frame_number() & 0x04)
 
375
                        if (machine.primary_screen->frame_number() & 0x04)
376
376
                        {
377
377
                                R |= G;
378
378
                        }