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

« back to all changes in this revision

Viewing changes to src/mame/drivers/cubeqst.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
        UINT8 m_reset_latch;
39
39
        required_device<simutrek_special_device> m_laserdisc;
40
40
        rgb_t *m_colormap;
 
41
        DECLARE_WRITE16_MEMBER(palette_w);
 
42
        DECLARE_READ16_MEMBER(line_r);
 
43
        DECLARE_WRITE16_MEMBER(laserdisc_w);
 
44
        DECLARE_READ16_MEMBER(laserdisc_r);
 
45
        DECLARE_WRITE16_MEMBER(ldaud_w);
 
46
        DECLARE_WRITE16_MEMBER(control_w);
 
47
        DECLARE_WRITE16_MEMBER(reset_w);
 
48
        DECLARE_WRITE16_MEMBER(io_w);
 
49
        DECLARE_READ16_MEMBER(io_r);
 
50
        DECLARE_READ16_MEMBER(chop_r);
 
51
        DECLARE_READ16_MEMBER(read_rotram);
 
52
        DECLARE_WRITE16_MEMBER(write_rotram);
 
53
        DECLARE_READ16_MEMBER(read_sndram);
 
54
        DECLARE_WRITE16_MEMBER(write_sndram);
41
55
};
42
56
 
43
57
 
87
101
        }
88
102
}
89
103
 
90
 
static WRITE16_HANDLER( palette_w )
 
104
WRITE16_MEMBER(cubeqst_state::palette_w)
91
105
{
92
 
        space->machine().primary_screen->update_now();
93
 
        COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]);
 
106
        machine().primary_screen->update_now();
 
107
        COMBINE_DATA(&m_generic_paletteram_16[offset]);
94
108
}
95
109
 
96
110
/* TODO: This is a simplified version of what actually happens */
154
168
                                }
155
169
 
156
170
                                /* Draw the span, testing for depth */
157
 
                                pen = state->m_colormap[screen.machine().generic.paletteram.u16[color]];
 
171
                                pen = state->m_colormap[state->m_generic_paletteram_16[color]];
158
172
                                for (x = h1; x <= h2; ++x)
159
173
                                {
160
174
                                        if (!(state->m_depth_buffer[x] < depth))
170
184
        return 0;
171
185
}
172
186
 
173
 
static READ16_HANDLER( line_r )
 
187
READ16_MEMBER(cubeqst_state::line_r)
174
188
{
175
189
        /* I think this is unusued */
176
 
        return space->machine().primary_screen->vpos();
 
190
        return machine().primary_screen->vpos();
177
191
}
178
192
 
179
193
static INTERRUPT_GEN( vblank )
194
208
 *
195
209
 *************************************/
196
210
 
197
 
static WRITE16_HANDLER( laserdisc_w )
 
211
WRITE16_MEMBER(cubeqst_state::laserdisc_w)
198
212
{
199
 
        cubeqst_state *state = space->machine().driver_data<cubeqst_state>();
200
 
        state->m_laserdisc->data_w(data & 0xff);
 
213
        m_laserdisc->data_w(data & 0xff);
201
214
}
202
215
 
203
216
/*
204
217
    D0: Command acknowledge
205
218
    D1: Seek status (0 = searching, 1 = ready)
206
219
*/
207
 
static READ16_HANDLER( laserdisc_r )
 
220
READ16_MEMBER(cubeqst_state::laserdisc_r)
208
221
{
209
 
        cubeqst_state *state = space->machine().driver_data<cubeqst_state>();
210
 
        int ldp_command_flag = (state->m_laserdisc->ready_r() == ASSERT_LINE) ? 0 : 1;
211
 
        int ldp_seek_status = (state->m_laserdisc->status_r() == ASSERT_LINE) ? 1 : 0;
 
222
        int ldp_command_flag = (m_laserdisc->ready_r() == ASSERT_LINE) ? 0 : 1;
 
223
        int ldp_seek_status = (m_laserdisc->status_r() == ASSERT_LINE) ? 1 : 0;
212
224
 
213
225
        return (ldp_seek_status << 1) | ldp_command_flag;
214
226
}
215
227
 
216
228
 
217
229
/* LDP audio squelch control */
218
 
static WRITE16_HANDLER( ldaud_w )
 
230
WRITE16_MEMBER(cubeqst_state::ldaud_w)
219
231
{
220
 
        cubeqst_state *state = space->machine().driver_data<cubeqst_state>();
221
 
        state->m_laserdisc->set_external_audio_squelch(data & 1 ? ASSERT_LINE : CLEAR_LINE);
 
232
        m_laserdisc->set_external_audio_squelch(data & 1 ? ASSERT_LINE : CLEAR_LINE);
222
233
}
223
234
 
224
235
/*
231
242
 
232
243
    Note: Can only be written during VBLANK (as with palette RAM)
233
244
*/
234
 
static WRITE16_HANDLER( control_w )
 
245
WRITE16_MEMBER(cubeqst_state::control_w)
235
246
{
236
 
        cubeqst_state *state = space->machine().driver_data<cubeqst_state>();
237
 
        state->m_laserdisc->video_enable(data & 1);
 
247
        m_laserdisc->video_enable(data & 1);
238
248
}
239
249
 
240
250
 
268
278
    D1: /Sound
269
279
    D2: /Disk
270
280
*/
271
 
static WRITE16_HANDLER( reset_w )
 
281
WRITE16_MEMBER(cubeqst_state::reset_w)
272
282
{
273
 
        cubeqst_state *state = space->machine().driver_data<cubeqst_state>();
274
 
        cputag_set_input_line(space->machine(), "rotate_cpu", INPUT_LINE_RESET, data & 1 ? CLEAR_LINE : ASSERT_LINE);
275
 
        cputag_set_input_line(space->machine(), "line_cpu", INPUT_LINE_RESET, data & 1 ? CLEAR_LINE : ASSERT_LINE);
276
 
        cputag_set_input_line(space->machine(), "sound_cpu", INPUT_LINE_RESET, data & 2 ? CLEAR_LINE : ASSERT_LINE);
 
283
        cputag_set_input_line(machine(), "rotate_cpu", INPUT_LINE_RESET, data & 1 ? CLEAR_LINE : ASSERT_LINE);
 
284
        cputag_set_input_line(machine(), "line_cpu", INPUT_LINE_RESET, data & 1 ? CLEAR_LINE : ASSERT_LINE);
 
285
        cputag_set_input_line(machine(), "sound_cpu", INPUT_LINE_RESET, data & 2 ? CLEAR_LINE : ASSERT_LINE);
277
286
 
278
287
        /* Swap stack and pointer RAM banks on rising edge of display reset */
279
 
        if (!BIT(state->m_reset_latch, 0) && BIT(data, 0))
280
 
                swap_linecpu_banks(space->machine());
 
288
        if (!BIT(m_reset_latch, 0) && BIT(data, 0))
 
289
                swap_linecpu_banks(machine());
281
290
 
282
291
        if (!BIT(data, 2))
283
 
                state->m_laserdisc->reset();
 
292
                m_laserdisc->reset();
284
293
 
285
 
        state->m_reset_latch = data & 0xff;
 
294
        m_reset_latch = data & 0xff;
286
295
}
287
296
 
288
297
 
292
301
 *
293
302
 *************************************/
294
303
 
295
 
static WRITE16_HANDLER( io_w )
 
304
WRITE16_MEMBER(cubeqst_state::io_w)
296
305
{
297
 
        cubeqst_state *state = space->machine().driver_data<cubeqst_state>();
298
306
        /*
299
307
       0: Spare lamp
300
308
       1: Spare driver
307
315
    */
308
316
 
309
317
        /* TODO: On rising edge of Q7, status LED latch is written */
310
 
        if ( !BIT(state->m_io_latch, 7) && BIT(data, 7) )
 
318
        if ( !BIT(m_io_latch, 7) && BIT(data, 7) )
311
319
        {
312
320
                /*
313
321
            0: Battery failure
316
324
        */
317
325
        }
318
326
 
319
 
        state->m_io_latch = data;
 
327
        m_io_latch = data;
320
328
}
321
329
 
322
 
static READ16_HANDLER( io_r )
 
330
READ16_MEMBER(cubeqst_state::io_r)
323
331
{
324
 
        cubeqst_state *state = space->machine().driver_data<cubeqst_state>();
325
 
        UINT16 port_data = input_port_read(space->machine(), "IO");
 
332
        UINT16 port_data = ioport("IO")->read();
326
333
 
327
334
        /*
328
335
         Certain bits depend on Q7 of the IO latch:
333
340
         10: Spare  / Trackball V data
334
341
    */
335
342
 
336
 
        if ( !BIT(state->m_io_latch, 7) )
 
343
        if ( !BIT(m_io_latch, 7) )
337
344
                return port_data;
338
345
        else
339
346
                /* Return zeroes for the trackball signals for now */
341
348
}
342
349
 
343
350
/* Trackball ('CHOP') */
344
 
static READ16_HANDLER( chop_r )
 
351
READ16_MEMBER(cubeqst_state::chop_r)
345
352
{
346
 
        return (input_port_read(space->machine(), "TRACK_X") << 8) | input_port_read(space->machine(), "TRACK_Y");
 
353
        return (ioport("TRACK_X")->read() << 8) | ioport("TRACK_Y")->read();
347
354
}
348
355
 
349
356
 
382
389
 *
383
390
 *************************************/
384
391
 
385
 
static READ16_HANDLER( read_rotram )
386
 
{
387
 
        return cubeqcpu_rotram_r(space->machine().device("rotate_cpu"), offset, mem_mask);
388
 
}
389
 
 
390
 
static WRITE16_HANDLER( write_rotram )
391
 
{
392
 
        cubeqcpu_rotram_w(space->machine().device("rotate_cpu"), offset, data, mem_mask);
393
 
}
394
 
 
395
 
static READ16_HANDLER( read_sndram )
396
 
{
397
 
        return cubeqcpu_sndram_r(space->machine().device("sound_cpu"), offset, mem_mask);
398
 
}
399
 
 
400
 
static WRITE16_HANDLER( write_sndram )
401
 
{
402
 
        cubeqcpu_sndram_w(space->machine().device("sound_cpu"), offset, data, mem_mask);
403
 
}
404
 
 
405
 
static ADDRESS_MAP_START( m68k_program_map, AS_PROGRAM, 16 )
 
392
READ16_MEMBER(cubeqst_state::read_rotram)
 
393
{
 
394
        return cubeqcpu_rotram_r(machine().device("rotate_cpu"), offset, mem_mask);
 
395
}
 
396
 
 
397
WRITE16_MEMBER(cubeqst_state::write_rotram)
 
398
{
 
399
        cubeqcpu_rotram_w(machine().device("rotate_cpu"), offset, data, mem_mask);
 
400
}
 
401
 
 
402
READ16_MEMBER(cubeqst_state::read_sndram)
 
403
{
 
404
        return cubeqcpu_sndram_r(machine().device("sound_cpu"), offset, mem_mask);
 
405
}
 
406
 
 
407
WRITE16_MEMBER(cubeqst_state::write_sndram)
 
408
{
 
409
        cubeqcpu_sndram_w(machine().device("sound_cpu"), offset, data, mem_mask);
 
410
}
 
411
 
 
412
static ADDRESS_MAP_START( m68k_program_map, AS_PROGRAM, 16, cubeqst_state )
406
413
        ADDRESS_MAP_GLOBAL_MASK(0x03ffff)
407
414
        AM_RANGE(0x000000, 0x01ffff) AM_ROM
408
415
        AM_RANGE(0x020000, 0x027fff) AM_READWRITE(read_rotram, write_rotram)
411
418
        AM_RANGE(0x038002, 0x038003) AM_READWRITE(chop_r, ldaud_w)
412
419
        AM_RANGE(0x038008, 0x038009) AM_READWRITE(line_r, reset_w)
413
420
        AM_RANGE(0x03800e, 0x03800f) AM_READWRITE(laserdisc_r, laserdisc_w)
414
 
        AM_RANGE(0x03c800, 0x03c9ff) AM_RAM_WRITE(palette_w) AM_BASE_GENERIC(paletteram)
 
421
        AM_RANGE(0x03c800, 0x03c9ff) AM_RAM_WRITE(palette_w) AM_SHARE("paletteram")
415
422
        AM_RANGE(0x03cc00, 0x03cc01) AM_WRITE(control_w)
416
423
        AM_RANGE(0x03e000, 0x03efff) AM_RAM AM_SHARE("nvram")
417
424
        AM_RANGE(0x03f000, 0x03ffff) AM_RAM
419
426
 
420
427
 
421
428
/* For the bit-sliced CPUs */
422
 
static ADDRESS_MAP_START( rotate_map, AS_PROGRAM, 64 )
 
429
static ADDRESS_MAP_START( rotate_map, AS_PROGRAM, 64, cubeqst_state )
423
430
        AM_RANGE(0x000, 0x1ff) AM_ROM
424
431
ADDRESS_MAP_END
425
432
 
426
 
static ADDRESS_MAP_START( line_sound_map, AS_PROGRAM, 64 )
 
433
static ADDRESS_MAP_START( line_sound_map, AS_PROGRAM, 64, cubeqst_state )
427
434
        AM_RANGE(0x000, 0x0ff) AM_ROM
428
435
ADDRESS_MAP_END
429
436
 
528
535
        MCFG_LASERDISC_SIMUTREK_ADD("laserdisc")
529
536
        MCFG_LASERDISC_OVERLAY_STATIC(CUBEQST_HBLANK, CUBEQST_VCOUNT, cubeqst)
530
537
        MCFG_LASERDISC_OVERLAY_CLIP(0, 320-1, 0, 256-8)
531
 
        MCFG_LASERDISC_OVERLAY_POSITION(0.002, -0.018)
532
 
        MCFG_LASERDISC_OVERLAY_SCALE(1.0, 1.030)
 
538
        MCFG_LASERDISC_OVERLAY_POSITION(0.002f, -0.018f)
 
539
        MCFG_LASERDISC_OVERLAY_SCALE(1.0f, 1.030f)
533
540
 
534
541
        MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
535
542