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

« back to all changes in this revision

Viewing changes to src/mame/video/gameplan.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:
69
69
 *
70
70
 *************************************/
71
71
 
72
 
static VIDEO_UPDATE( gameplan )
 
72
static SCREEN_UPDATE( gameplan )
73
73
{
74
 
        gameplan_state *state = screen->machine->driver_data<gameplan_state>();
 
74
        gameplan_state *state = screen->machine().driver_data<gameplan_state>();
75
75
        pen_t pens[GAMEPLAN_NUM_PENS];
76
76
        offs_t offs;
77
77
 
78
78
        gameplan_get_pens(pens);
79
79
 
80
 
        for (offs = 0; offs < state->videoram_size; offs++)
 
80
        for (offs = 0; offs < state->m_videoram_size; offs++)
81
81
        {
82
82
                UINT8 y = offs >> 8;
83
83
                UINT8 x = offs & 0xff;
84
84
 
85
 
                *BITMAP_ADDR32(bitmap, y, x) = pens[state->videoram[offs] & 0x07];
 
85
                *BITMAP_ADDR32(bitmap, y, x) = pens[state->m_videoram[offs] & 0x07];
86
86
        }
87
87
 
88
88
        return 0;
89
89
}
90
90
 
91
91
 
92
 
static VIDEO_UPDATE( leprechn )
 
92
static SCREEN_UPDATE( leprechn )
93
93
{
94
 
        gameplan_state *state = screen->machine->driver_data<gameplan_state>();
 
94
        gameplan_state *state = screen->machine().driver_data<gameplan_state>();
95
95
        pen_t pens[LEPRECHN_NUM_PENS];
96
96
        offs_t offs;
97
97
 
98
98
        leprechn_get_pens(pens);
99
99
 
100
 
        for (offs = 0; offs < state->videoram_size; offs++)
 
100
        for (offs = 0; offs < state->m_videoram_size; offs++)
101
101
        {
102
102
                UINT8 y = offs >> 8;
103
103
                UINT8 x = offs & 0xff;
104
104
 
105
 
                *BITMAP_ADDR32(bitmap, y, x) = pens[state->videoram[offs]];
 
105
                *BITMAP_ADDR32(bitmap, y, x) = pens[state->m_videoram[offs]];
106
106
        }
107
107
 
108
108
        return 0;
118
118
 
119
119
static WRITE8_DEVICE_HANDLER( video_data_w )
120
120
{
121
 
        gameplan_state *state = device->machine->driver_data<gameplan_state>();
 
121
        gameplan_state *state = device->machine().driver_data<gameplan_state>();
122
122
 
123
 
        state->video_data = data;
 
123
        state->m_video_data = data;
124
124
}
125
125
 
126
126
 
127
127
static WRITE8_DEVICE_HANDLER( gameplan_video_command_w )
128
128
{
129
 
        gameplan_state *state = device->machine->driver_data<gameplan_state>();
 
129
        gameplan_state *state = device->machine().driver_data<gameplan_state>();
130
130
 
131
 
        state->video_command = data & 0x07;
 
131
        state->m_video_command = data & 0x07;
132
132
}
133
133
 
134
134
 
135
135
static WRITE8_DEVICE_HANDLER( leprechn_video_command_w )
136
136
{
137
 
        gameplan_state *state = device->machine->driver_data<gameplan_state>();
 
137
        gameplan_state *state = device->machine().driver_data<gameplan_state>();
138
138
 
139
 
        state->video_command = (data >> 3) & 0x07;
 
139
        state->m_video_command = (data >> 3) & 0x07;
140
140
}
141
141
 
142
142
 
143
143
static TIMER_CALLBACK( clear_screen_done_callback )
144
144
{
145
 
        gameplan_state *state = machine->driver_data<gameplan_state>();
 
145
        gameplan_state *state = machine.driver_data<gameplan_state>();
146
146
 
147
147
        /* indicate that the we are done clearing the screen */
148
 
        state->via_0->write_ca1(0);
 
148
        state->m_via_0->write_ca1(0);
149
149
}
150
150
 
151
151
 
152
152
static WRITE_LINE_DEVICE_HANDLER( video_command_trigger_w )
153
153
{
154
 
        gameplan_state *driver_state = device->machine->driver_data<gameplan_state>();
 
154
        gameplan_state *driver_state = device->machine().driver_data<gameplan_state>();
155
155
 
156
156
        if (state == 0)
157
157
        {
158
 
                switch (driver_state->video_command)
 
158
                switch (driver_state->m_video_command)
159
159
                {
160
160
                /* draw pixel */
161
161
                case 0:
162
162
                        /* auto-adjust X? */
163
 
                        if (driver_state->video_data & 0x10)
 
163
                        if (driver_state->m_video_data & 0x10)
164
164
                        {
165
 
                                if (driver_state->video_data & 0x40)
166
 
                                        driver_state->video_x = driver_state->video_x - 1;
 
165
                                if (driver_state->m_video_data & 0x40)
 
166
                                        driver_state->m_video_x = driver_state->m_video_x - 1;
167
167
                                else
168
 
                                        driver_state->video_x = driver_state->video_x + 1;
 
168
                                        driver_state->m_video_x = driver_state->m_video_x + 1;
169
169
                        }
170
170
 
171
171
                        /* auto-adjust Y? */
172
 
                        if (driver_state->video_data & 0x20)
 
172
                        if (driver_state->m_video_data & 0x20)
173
173
                        {
174
 
                                if (driver_state->video_data & 0x80)
175
 
                                        driver_state->video_y = driver_state->video_y - 1;
 
174
                                if (driver_state->m_video_data & 0x80)
 
175
                                        driver_state->m_video_y = driver_state->m_video_y - 1;
176
176
                                else
177
 
                                        driver_state->video_y = driver_state->video_y + 1;
 
177
                                        driver_state->m_video_y = driver_state->m_video_y + 1;
178
178
                        }
179
179
 
180
 
                        driver_state->videoram[driver_state->video_y * (HBSTART - HBEND) + driver_state->video_x] = driver_state->video_data & 0x0f;
 
180
                        driver_state->m_videoram[driver_state->m_video_y * (HBSTART - HBEND) + driver_state->m_video_x] = driver_state->m_video_data & 0x0f;
181
181
 
182
182
                        break;
183
183
 
184
184
                /* load X register */
185
185
                case 1:
186
 
                        driver_state->video_x = driver_state->video_data;
 
186
                        driver_state->m_video_x = driver_state->m_video_data;
187
187
                        break;
188
188
 
189
189
                /* load Y register */
190
190
                case 2:
191
 
                        driver_state->video_y = driver_state->video_data;
 
191
                        driver_state->m_video_y = driver_state->m_video_data;
192
192
                        break;
193
193
 
194
194
                /* clear screen */
195
195
                case 3:
196
196
                        /* indicate that the we are busy */
197
197
                        {
198
 
                                driver_state->via_0->write_ca1(1);
 
198
                                driver_state->m_via_0->write_ca1(1);
199
199
                        }
200
200
 
201
 
                        memset(driver_state->videoram, driver_state->video_data & 0x0f, driver_state->videoram_size);
 
201
                        memset(driver_state->m_videoram, driver_state->m_video_data & 0x0f, driver_state->m_videoram_size);
202
202
 
203
203
                        /* set a timer for an arbitrarily short period.
204
204
               The real time it takes to clear to screen is not
205
205
               important to the software */
206
 
                        timer_call_after_resynch(device->machine, NULL, 0, clear_screen_done_callback);
 
206
                        device->machine().scheduler().synchronize(FUNC(clear_screen_done_callback));
207
207
 
208
208
                        break;
209
209
                }
213
213
 
214
214
static TIMER_CALLBACK( via_irq_delayed )
215
215
{
216
 
        gameplan_state *state = machine->driver_data<gameplan_state>();
217
 
        cpu_set_input_line(state->maincpu, 0, param);
 
216
        gameplan_state *state = machine.driver_data<gameplan_state>();
 
217
        device_set_input_line(state->m_maincpu, 0, param);
218
218
}
219
219
 
220
220
 
223
223
        /* Kaos sits in a tight loop polling the VIA irq flags register, but that register is
224
224
       cleared by the irq handler. Therefore, I wait a bit before triggering the irq to
225
225
       leave time for the program to see the flag change. */
226
 
        timer_set(device->machine, ATTOTIME_IN_USEC(50), NULL, state, via_irq_delayed);
 
226
        device->machine().scheduler().timer_set(attotime::from_usec(50), FUNC(via_irq_delayed), state);
227
227
}
228
228
 
229
229
 
266
266
 
267
267
static TIMER_CALLBACK( via_0_ca1_timer_callback )
268
268
{
269
 
        gameplan_state *state = machine->driver_data<gameplan_state>();
 
269
        gameplan_state *state = machine.driver_data<gameplan_state>();
270
270
 
271
271
        /* !VBLANK is connected to CA1 */
272
 
        state->via_0->write_ca1(param);
 
272
        state->m_via_0->write_ca1(param);
273
273
 
274
274
        if (param)
275
 
                timer_adjust_oneshot(state->via_0_ca1_timer, machine->primary_screen->time_until_pos(VBSTART), 0);
 
275
                state->m_via_0_ca1_timer->adjust(machine.primary_screen->time_until_pos(VBSTART));
276
276
        else
277
 
                timer_adjust_oneshot(state->via_0_ca1_timer, machine->primary_screen->time_until_pos(VBEND), 1);
 
277
                state->m_via_0_ca1_timer->adjust(machine.primary_screen->time_until_pos(VBEND), 1);
278
278
}
279
279
 
280
280
 
286
286
 
287
287
static VIDEO_START( common )
288
288
{
289
 
        gameplan_state *state = machine->driver_data<gameplan_state>();
290
 
 
291
 
        state->videoram_size = (HBSTART - HBEND) * (VBSTART - VBEND);
292
 
        state->videoram = auto_alloc_array(machine, UINT8, state->videoram_size);
293
 
 
294
 
        state->via_0_ca1_timer = timer_alloc(machine, via_0_ca1_timer_callback, NULL);
 
289
        gameplan_state *state = machine.driver_data<gameplan_state>();
 
290
 
 
291
        state->m_videoram_size = (HBSTART - HBEND) * (VBSTART - VBEND);
 
292
        state->m_videoram = auto_alloc_array(machine, UINT8, state->m_videoram_size);
 
293
 
 
294
        state->m_via_0_ca1_timer = machine.scheduler().timer_alloc(FUNC(via_0_ca1_timer_callback));
295
295
 
296
296
        /* register for save states */
297
 
        state_save_register_global_pointer(machine, state->videoram, state->videoram_size);
 
297
        state->save_pointer(NAME(state->m_videoram), state->m_videoram_size);
298
298
}
299
299
 
300
300
 
325
325
 
326
326
static VIDEO_RESET( gameplan )
327
327
{
328
 
        gameplan_state *state = machine->driver_data<gameplan_state>();
329
 
        timer_adjust_oneshot(state->via_0_ca1_timer, machine->primary_screen->time_until_pos(VBSTART), 0);
 
328
        gameplan_state *state = machine.driver_data<gameplan_state>();
 
329
        state->m_via_0_ca1_timer->adjust(machine.primary_screen->time_until_pos(VBSTART));
330
330
}
331
331
 
332
332
 
342
342
        MCFG_VIDEO_RESET(gameplan)
343
343
 
344
344
        MCFG_VIDEO_START(gameplan)
345
 
        MCFG_VIDEO_UPDATE(gameplan)
346
345
 
347
346
        MCFG_SCREEN_ADD("screen", RASTER)
348
347
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
349
348
        MCFG_SCREEN_RAW_PARAMS(GAMEPLAN_PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
 
349
        MCFG_SCREEN_UPDATE(gameplan)
350
350
MACHINE_CONFIG_END
351
351
 
352
352
 
353
353
MACHINE_CONFIG_FRAGMENT( leprechn_video )
354
354
        MCFG_VIDEO_START(leprechn)
355
 
        MCFG_VIDEO_UPDATE(leprechn)
 
355
        MCFG_SCREEN_MODIFY("screen")
 
356
        MCFG_SCREEN_UPDATE(leprechn)
356
357
MACHINE_CONFIG_END
357
358
 
358
359
 
359
360
MACHINE_CONFIG_DERIVED( trvquest_video, gameplan_video )
360
361
        MCFG_VIDEO_START(trvquest)
361
 
        MCFG_VIDEO_UPDATE(gameplan)
 
362
        MCFG_SCREEN_MODIFY("screen")
 
363
        MCFG_SCREEN_UPDATE(gameplan)
362
364
MACHINE_CONFIG_END