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

« back to all changes in this revision

Viewing changes to src/mame/drivers/pipeline.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:
67
67
#include "cpu/z80/z80.h"
68
68
#include "machine/z80ctc.h"
69
69
#include "sound/2203intf.h"
70
 
#include "machine/8255ppi.h"
 
70
#include "machine/i8255.h"
71
71
#include "cpu/z80/z80daisy.h"
72
72
#include "cpu/m6805/m6805.h"
73
73
 
76
76
{
77
77
public:
78
78
        pipeline_state(const machine_config &mconfig, device_type type, const char *tag)
79
 
                : driver_device(mconfig, type, tag) { }
 
79
                : driver_device(mconfig, type, tag) ,
 
80
                m_vram1(*this, "vram1"),
 
81
                m_vram2(*this, "vram2"){ }
80
82
 
81
83
        tilemap_t *m_tilemap1;
82
84
        tilemap_t *m_tilemap2;
83
 
        UINT8 *m_vram1;
84
 
        UINT8 *m_vram2;
 
85
        required_shared_ptr<UINT8> m_vram1;
 
86
        required_shared_ptr<UINT8> m_vram2;
85
87
        UINT8 m_vidctrl;
86
88
        UINT8 *m_palram;
87
89
        UINT8 m_toMCU;
88
90
        UINT8 m_fromMCU;
89
91
        UINT8 m_ddrA;
 
92
        DECLARE_WRITE8_MEMBER(vram2_w);
 
93
        DECLARE_WRITE8_MEMBER(vram1_w);
 
94
        DECLARE_WRITE8_MEMBER(mcu_portA_w);
 
95
        DECLARE_READ8_MEMBER(mcu_portA_r);
 
96
        DECLARE_WRITE8_MEMBER(mcu_ddrA_w);
90
97
};
91
98
 
92
99
 
139
146
        state->m_vidctrl=data;
140
147
}
141
148
 
142
 
static WRITE8_HANDLER(vram2_w)
 
149
WRITE8_MEMBER(pipeline_state::vram2_w)
143
150
{
144
 
        pipeline_state *state = space->machine().driver_data<pipeline_state>();
145
 
        if(!(state->m_vidctrl&1))
 
151
        if(!(m_vidctrl&1))
146
152
        {
147
 
                state->m_tilemap1->mark_tile_dirty(offset&0x7ff);
148
 
                state->m_vram2[offset]=data;
 
153
                m_tilemap1->mark_tile_dirty(offset&0x7ff);
 
154
                m_vram2[offset]=data;
149
155
        }
150
156
        else
151
157
        {
152
 
                 state->m_palram[offset]=data;
 
158
                 m_palram[offset]=data;
153
159
                 if(offset<0x300)
154
160
                 {
155
161
                        offset&=0xff;
156
 
                        palette_set_color_rgb(space->machine(), offset, pal6bit(state->m_palram[offset]), pal6bit(state->m_palram[offset+0x100]), pal6bit(state->m_palram[offset+0x200]));
 
162
                        palette_set_color_rgb(machine(), offset, pal6bit(m_palram[offset]), pal6bit(m_palram[offset+0x100]), pal6bit(m_palram[offset+0x200]));
157
163
                 }
158
164
        }
159
165
}
160
166
 
161
 
static WRITE8_HANDLER(vram1_w)
 
167
WRITE8_MEMBER(pipeline_state::vram1_w)
162
168
{
163
 
        pipeline_state *state = space->machine().driver_data<pipeline_state>();
164
 
        state->m_tilemap2->mark_tile_dirty(offset&0x7ff);
165
 
        state->m_vram1[offset]=data;
 
169
        m_tilemap2->mark_tile_dirty(offset&0x7ff);
 
170
        m_vram1[offset]=data;
166
171
}
167
172
 
168
173
static READ8_DEVICE_HANDLER(protection_r)
183
188
        device->machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
184
189
}
185
190
 
186
 
static ADDRESS_MAP_START( cpu0_mem, AS_PROGRAM, 8 )
 
191
static ADDRESS_MAP_START( cpu0_mem, AS_PROGRAM, 8, pipeline_state )
187
192
        AM_RANGE(0x0000, 0x7fff) AM_ROM
188
193
        AM_RANGE(0x8000, 0x87ff) AM_RAM
189
 
        AM_RANGE(0x8800, 0x97ff) AM_RAM_WRITE(vram1_w) AM_BASE_MEMBER(pipeline_state, m_vram1)
190
 
        AM_RANGE(0x9800, 0xa7ff) AM_RAM_WRITE(vram2_w) AM_BASE_MEMBER(pipeline_state, m_vram2)
191
 
        AM_RANGE(0xb800, 0xb803) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
192
 
        AM_RANGE(0xb810, 0xb813) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
 
194
        AM_RANGE(0x8800, 0x97ff) AM_RAM_WRITE(vram1_w) AM_SHARE("vram1")
 
195
        AM_RANGE(0x9800, 0xa7ff) AM_RAM_WRITE(vram2_w) AM_SHARE("vram2")
 
196
        AM_RANGE(0xb800, 0xb803) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)
 
197
        AM_RANGE(0xb810, 0xb813) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
193
198
        AM_RANGE(0xb830, 0xb830) AM_NOP
194
199
        AM_RANGE(0xb840, 0xb840) AM_NOP
195
200
ADDRESS_MAP_END
196
201
 
197
 
static ADDRESS_MAP_START( cpu1_mem, AS_PROGRAM, 8 )
 
202
static ADDRESS_MAP_START( cpu1_mem, AS_PROGRAM, 8, pipeline_state )
198
203
        AM_RANGE(0x0000, 0x7fff) AM_ROM
199
204
        AM_RANGE(0xc000, 0xc7ff) AM_RAM
200
 
        AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE("ppi8255_2", ppi8255_r, ppi8255_w)
 
205
        AM_RANGE(0xe000, 0xe003) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write)
201
206
ADDRESS_MAP_END
202
207
 
203
 
static ADDRESS_MAP_START( sound_port, AS_IO, 8 )
 
208
static ADDRESS_MAP_START( sound_port, AS_IO, 8, pipeline_state )
204
209
        ADDRESS_MAP_GLOBAL_MASK(0xff)
205
 
        AM_RANGE(0x00, 0x03) AM_DEVREADWRITE("ctc", z80ctc_r, z80ctc_w)
 
210
        AM_RANGE(0x00, 0x03) AM_DEVREADWRITE_LEGACY("ctc", z80ctc_r, z80ctc_w)
206
211
        AM_RANGE(0x06, 0x07) AM_NOP
207
212
ADDRESS_MAP_END
208
213
 
209
 
static WRITE8_HANDLER(mcu_portA_w)
210
 
{
211
 
        pipeline_state *state = space->machine().driver_data<pipeline_state>();
212
 
        state->m_fromMCU=data;
213
 
}
214
 
 
215
 
static READ8_HANDLER(mcu_portA_r)
216
 
{
217
 
        pipeline_state *state = space->machine().driver_data<pipeline_state>();
218
 
        return (state->m_fromMCU&state->m_ddrA)|(state->m_toMCU& ~state->m_ddrA);
219
 
}
220
 
 
221
 
static WRITE8_HANDLER(mcu_ddrA_w)
222
 
{
223
 
        pipeline_state *state = space->machine().driver_data<pipeline_state>();
224
 
        state->m_ddrA=data;
225
 
}
226
 
 
227
 
static ADDRESS_MAP_START( mcu_mem, AS_PROGRAM, 8 )
 
214
WRITE8_MEMBER(pipeline_state::mcu_portA_w)
 
215
{
 
216
        m_fromMCU=data;
 
217
}
 
218
 
 
219
READ8_MEMBER(pipeline_state::mcu_portA_r)
 
220
{
 
221
        return (m_fromMCU&m_ddrA)|(m_toMCU& ~m_ddrA);
 
222
}
 
223
 
 
224
WRITE8_MEMBER(pipeline_state::mcu_ddrA_w)
 
225
{
 
226
        m_ddrA=data;
 
227
}
 
228
 
 
229
static ADDRESS_MAP_START( mcu_mem, AS_PROGRAM, 8, pipeline_state )
228
230
        AM_RANGE(0x0000, 0x0000) AM_READ(mcu_portA_r) AM_WRITE(mcu_portA_w)
229
231
        AM_RANGE(0x0004, 0x0004) AM_WRITE(mcu_ddrA_w)
230
232
        AM_RANGE(0x0010, 0x007f) AM_RAM
324
326
        { NULL }
325
327
};
326
328
 
327
 
static const ppi8255_interface ppi8255_intf[3] =
328
 
{
329
 
        {
330
 
                DEVCB_INPUT_PORT("P1"),                 /* Port A read */
331
 
                DEVCB_NULL,                                             /* Port B read */
332
 
                DEVCB_NULL,                                             /* Port C read */
333
 
                DEVCB_NULL,                                             /* Port A write */
334
 
                DEVCB_NULL,                                             /* Port B write */  /* related to sound/music : check code at 0x1c0a */
335
 
                DEVCB_HANDLER(vidctrl_w)                /* Port C write */
336
 
        },
337
 
        {
338
 
                DEVCB_INPUT_PORT("DSW1"),               /* Port A read */
339
 
                DEVCB_INPUT_PORT("DSW2"),               /* Port B read */
340
 
                DEVCB_HANDLER(protection_r),    /* Port C read */
341
 
                DEVCB_NULL,                                             /* Port A write */
342
 
                DEVCB_NULL,                                             /* Port B write */
343
 
                DEVCB_HANDLER(protection_w)             /* Port C write */
344
 
        },
345
 
        {
346
 
                DEVCB_NULL,                                             /* Port A read */
347
 
                DEVCB_NULL,                                             /* Port B read */
348
 
                DEVCB_NULL,                                             /* Port C read */
349
 
                DEVCB_NULL,                                             /* Port A write */
350
 
                DEVCB_NULL,                                             /* Port B write */
351
 
                DEVCB_NULL                                              /* Port C write */
352
 
        }
 
329
static I8255A_INTERFACE( ppi8255_0_intf )
 
330
{
 
331
        DEVCB_INPUT_PORT("P1"),                         /* Port A read */
 
332
        DEVCB_NULL,                                                     /* Port A write */
 
333
        DEVCB_NULL,                                                     /* Port B read */
 
334
        DEVCB_NULL,                                                     /* Port B write */  // related to sound/music : check code at 0x1c0a
 
335
        DEVCB_NULL,                                                     /* Port C read */
 
336
        DEVCB_HANDLER(vidctrl_w)                        /* Port C write */
 
337
};
 
338
 
 
339
static I8255A_INTERFACE( ppi8255_1_intf )
 
340
{
 
341
        DEVCB_INPUT_PORT("DSW1"),                       /* Port A read */
 
342
        DEVCB_NULL,                                                     /* Port A write */
 
343
        DEVCB_INPUT_PORT("DSW2"),                       /* Port B read */
 
344
        DEVCB_NULL,                                                     /* Port B write */
 
345
        DEVCB_HANDLER(protection_r),            /* Port C read */
 
346
        DEVCB_HANDLER(protection_w)                     /* Port C write */
 
347
};
 
348
 
 
349
static I8255A_INTERFACE( ppi8255_2_intf )
 
350
{
 
351
        DEVCB_NULL,                                                     /* Port A read */
 
352
        DEVCB_NULL,                                                     /* Port A write */
 
353
        DEVCB_NULL,                                                     /* Port B read */
 
354
        DEVCB_NULL,                                                     /* Port B write */
 
355
        DEVCB_NULL,                                                     /* Port C read */
 
356
        DEVCB_NULL                                                      /* Port C write */
353
357
};
354
358
 
355
359
static const ym2203_interface ym2203_config =
365
369
static PALETTE_INIT(pipeline)
366
370
{
367
371
        int r,g,b,i,c;
368
 
        UINT8 *prom1 = &machine.region("proms")->base()[0x000];
369
 
        UINT8 *prom2 = &machine.region("proms")->base()[0x100];
 
372
        UINT8 *prom1 = &machine.root_device().memregion("proms")->base()[0x000];
 
373
        UINT8 *prom2 = &machine.root_device().memregion("proms")->base()[0x100];
370
374
 
371
375
        for(i=0;i<0x100;i++)
372
376
        {
398
402
 
399
403
        MCFG_Z80CTC_ADD( "ctc", 7372800/2 /* same as "audiocpu" */, ctc_intf )
400
404
 
401
 
        MCFG_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] )
402
 
        MCFG_PPI8255_ADD( "ppi8255_1", ppi8255_intf[1] )
403
 
        MCFG_PPI8255_ADD( "ppi8255_2", ppi8255_intf[2] )
 
405
        MCFG_I8255A_ADD( "ppi8255_0", ppi8255_0_intf )
 
406
        MCFG_I8255A_ADD( "ppi8255_1", ppi8255_1_intf )
 
407
        MCFG_I8255A_ADD( "ppi8255_2", ppi8255_2_intf )
404
408
 
405
409
        /* video hardware */
406
410
        MCFG_SCREEN_ADD("screen", RASTER)