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

« back to all changes in this revision

Viewing changes to src/mame/drivers/sub.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:
118
118
        sub_state(running_machine &machine, const driver_device_config_base &config)
119
119
                : driver_device(machine, config) { }
120
120
 
121
 
        UINT8* vid;
122
 
        UINT8* attr;
123
 
        UINT8* scrolly;
124
 
        UINT8* spriteram;
125
 
        UINT8* spriteram2;
126
 
        UINT8 nmi_en;
 
121
        UINT8* m_vid;
 
122
        UINT8* m_attr;
 
123
        UINT8* m_scrolly;
 
124
        UINT8* m_spriteram;
 
125
        UINT8* m_spriteram2;
 
126
        UINT8 m_nmi_en;
127
127
};
128
128
 
129
129
static VIDEO_START(sub)
130
130
{
131
131
}
132
132
 
133
 
static VIDEO_UPDATE(sub)
 
133
static SCREEN_UPDATE(sub)
134
134
{
135
 
        sub_state *state = screen->machine->driver_data<sub_state>();
136
 
        const gfx_element *gfx = screen->machine->gfx[0];
137
 
        const gfx_element *gfx_1 = screen->machine->gfx[1];
 
135
        sub_state *state = screen->machine().driver_data<sub_state>();
 
136
        const gfx_element *gfx = screen->machine().gfx[0];
 
137
        const gfx_element *gfx_1 = screen->machine().gfx[1];
138
138
        int y,x;
139
139
        int count = 0;
140
140
 
142
142
        {
143
143
                for (x=0;x<32;x++)
144
144
                {
145
 
                        UINT16 tile = state->vid[count];
 
145
                        UINT16 tile = state->m_vid[count];
146
146
                        UINT8 col;
147
 
                        UINT8 y_offs = state->scrolly[x];
 
147
                        UINT8 y_offs = state->m_scrolly[x];
148
148
 
149
 
                        tile += (state->attr[count]&0xe0)<<3;
150
 
                        col = (state->attr[count]&0x1f);
 
149
                        tile += (state->m_attr[count]&0xe0)<<3;
 
150
                        col = (state->m_attr[count]&0x1f);
151
151
 
152
152
                        drawgfx_opaque(bitmap,cliprect,gfx,tile,col+0x40,0,0,x*8,(y*8)-y_offs);
153
153
                        drawgfx_opaque(bitmap,cliprect,gfx,tile,col+0x40,0,0,x*8,(y*8)-y_offs+256);
168
168
    1 --cc cccc color
169
169
    */
170
170
        {
171
 
                UINT8 *spriteram = state->spriteram;
172
 
                UINT8 *spriteram_2 = state->spriteram2;
 
171
                UINT8 *spriteram = state->m_spriteram;
 
172
                UINT8 *spriteram_2 = state->m_spriteram2;
173
173
                UINT8 x,y,spr_offs,i,col,fx,fy;
174
174
 
175
175
                for(i=0;i<0x40;i+=2)
193
193
        {
194
194
                for (x=0;x<32;x++)
195
195
                {
196
 
                        UINT16 tile = state->vid[count];
 
196
                        UINT16 tile = state->m_vid[count];
197
197
                        UINT8 col;
198
 
                        UINT8 y_offs = state->scrolly[x];
 
198
                        UINT8 y_offs = state->m_scrolly[x];
199
199
 
200
 
                        tile += (state->attr[count]&0xe0)<<3;
201
 
                        col = (state->attr[count]&0x1f);
 
200
                        tile += (state->m_attr[count]&0xe0)<<3;
 
201
                        col = (state->m_attr[count]&0x1f);
202
202
 
203
203
                        if(x >= 28)
204
204
                        {
213
213
        return 0;
214
214
}
215
215
 
216
 
static ADDRESS_MAP_START( subm_map, ADDRESS_SPACE_PROGRAM, 8 )
 
216
static ADDRESS_MAP_START( subm_map, AS_PROGRAM, 8 )
217
217
        AM_RANGE(0x0000, 0xafff) AM_ROM
218
218
        AM_RANGE(0xb000, 0xbfff) AM_RAM
219
 
        AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_BASE_MEMBER(sub_state,attr)
220
 
        AM_RANGE(0xc400, 0xc7ff) AM_RAM AM_BASE_MEMBER(sub_state,vid)
221
 
        AM_RANGE(0xd000, 0xd03f) AM_RAM AM_BASE_MEMBER(sub_state,spriteram)
222
 
        AM_RANGE(0xd800, 0xd83f) AM_RAM AM_BASE_MEMBER(sub_state,spriteram2)
223
 
        AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE_MEMBER(sub_state,scrolly)
 
219
        AM_RANGE(0xc000, 0xc3ff) AM_RAM AM_BASE_MEMBER(sub_state,m_attr)
 
220
        AM_RANGE(0xc400, 0xc7ff) AM_RAM AM_BASE_MEMBER(sub_state,m_vid)
 
221
        AM_RANGE(0xd000, 0xd03f) AM_RAM AM_BASE_MEMBER(sub_state,m_spriteram)
 
222
        AM_RANGE(0xd800, 0xd83f) AM_RAM AM_BASE_MEMBER(sub_state,m_spriteram2)
 
223
        AM_RANGE(0xd840, 0xd85f) AM_RAM AM_BASE_MEMBER(sub_state,m_scrolly)
224
224
 
225
225
        AM_RANGE(0xe000, 0xe000) AM_NOP
226
226
        AM_RANGE(0xe800, 0xe800) AM_NOP
238
238
static WRITE8_HANDLER( subm_to_sound_w )
239
239
{
240
240
        soundlatch_w(space, 0, data & 0xff);
241
 
        cputag_set_input_line(space->machine, "soundcpu", 0, HOLD_LINE);
 
241
        cputag_set_input_line(space->machine(), "soundcpu", 0, HOLD_LINE);
242
242
}
243
243
 
244
244
static WRITE8_HANDLER( nmi_mask_w )
245
245
{
246
 
        sub_state *state = space->machine->driver_data<sub_state>();
 
246
        sub_state *state = space->machine().driver_data<sub_state>();
247
247
 
248
 
        state->nmi_en = data & 1;
 
248
        state->m_nmi_en = data & 1;
249
249
}
250
250
 
251
 
static ADDRESS_MAP_START( subm_io, ADDRESS_SPACE_IO, 8 )
 
251
static ADDRESS_MAP_START( subm_io, AS_IO, 8 )
252
252
        ADDRESS_MAP_GLOBAL_MASK(0xff)
253
253
        AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch2_r, subm_to_sound_w) // to/from sound CPU
254
254
ADDRESS_MAP_END
255
255
 
256
 
static ADDRESS_MAP_START( subm_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
 
256
static ADDRESS_MAP_START( subm_sound_map, AS_PROGRAM, 8 )
257
257
        AM_RANGE(0x0000, 0x3fff) AM_ROM
258
258
        AM_RANGE(0x4000, 0x47ff) AM_RAM
259
259
        AM_RANGE(0x6000, 0x6000) AM_WRITE(nmi_mask_w)
260
260
ADDRESS_MAP_END
261
261
 
262
 
static ADDRESS_MAP_START( subm_sound_io, ADDRESS_SPACE_IO, 8 )
 
262
static ADDRESS_MAP_START( subm_sound_io, AS_IO, 8 )
263
263
        ADDRESS_MAP_GLOBAL_MASK(0xff)
264
264
        AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_r, soundlatch2_w) // to/from main CPU
265
265
        AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("ay1", ay8910_r, ay8910_address_data_w)
381
381
static PALETTE_INIT( sub )
382
382
{
383
383
        int i;
384
 
        UINT8* lookup = machine->region("proms2")->base();
 
384
        UINT8* lookup = machine.region("proms2")->base();
385
385
 
386
386
        /* allocate the colortable */
387
 
        machine->colortable = colortable_alloc(machine, 0x100);
 
387
        machine.colortable = colortable_alloc(machine, 0x100);
388
388
 
389
389
        for (i = 0;i < 0x100;i++)
390
390
        {
393
393
                g = (color_prom[0x100] >> 0);
394
394
                b = (color_prom[0x200] >> 0);
395
395
 
396
 
                //colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
397
 
                colortable_palette_set_color(machine->colortable, i, MAKE_RGB(pal4bit(r), pal4bit(g), pal4bit(b)));
 
396
                //colortable_palette_set_color(machine.colortable, i, MAKE_RGB(r, g, b));
 
397
                colortable_palette_set_color(machine.colortable, i, MAKE_RGB(pal4bit(r), pal4bit(g), pal4bit(b)));
398
398
 
399
399
                color_prom++;
400
400
        }
403
403
        for (i = 0;i < 0x400;i++)
404
404
        {
405
405
                UINT8 ctabentry = lookup[i+0x400] | (lookup[i+0x000] << 4);
406
 
                colortable_entry_set_value(machine->colortable, i, ctabentry);
 
406
                colortable_entry_set_value(machine.colortable, i, ctabentry);
407
407
        }
408
408
 
409
409
}
411
411
 
412
412
static INTERRUPT_GEN( subm_sound_irq )
413
413
{
414
 
        sub_state *state = device->machine->driver_data<sub_state>();
 
414
        sub_state *state = device->machine().driver_data<sub_state>();
415
415
 
416
 
        if(state->nmi_en)
417
 
                cputag_set_input_line(device->machine, "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
 
416
        if(state->m_nmi_en)
 
417
                cputag_set_input_line(device->machine(), "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
418
418
}
419
419
 
420
420
static MACHINE_CONFIG_START( sub, sub_state )
438
438
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
439
439
        MCFG_SCREEN_SIZE(256, 256)
440
440
        MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
 
441
        MCFG_SCREEN_UPDATE(sub)
441
442
 
442
443
        MCFG_GFXDECODE(sub)
443
444
        MCFG_PALETTE_LENGTH(0x400)
444
445
        MCFG_PALETTE_INIT(sub)
445
446
 
446
447
        MCFG_VIDEO_START(sub)
447
 
        MCFG_VIDEO_UPDATE(sub)
448
448
 
449
449
        /* sound hardware */
450
450
        MCFG_SPEAKER_STANDARD_MONO("mono")