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

« back to all changes in this revision

Viewing changes to src/mame/drivers/chsuper.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:
15
15
#include "sound/dac.h"
16
16
#include "machine/nvram.h"
17
17
 
18
 
static int chsuper_tilexor;
 
18
 
 
19
class chsuper_state : public driver_device
 
20
{
 
21
public:
 
22
        chsuper_state(running_machine &machine, const driver_device_config_base &config)
 
23
                : driver_device(machine, config) { }
 
24
 
 
25
        int m_tilexor;
 
26
        struct { int r,g,b,offs,offs_internal; } m_pal;
 
27
};
 
28
 
 
29
 
19
30
 
20
31
static VIDEO_START(chsuper)
21
32
{
22
33
}
23
34
 
24
 
static VIDEO_UPDATE(chsuper)
 
35
static SCREEN_UPDATE(chsuper)
25
36
{
26
 
        const gfx_element *gfx = screen->machine->gfx[0];
27
 
        UINT8 *vram = screen->machine->region("vram")->base();
 
37
        //chsuper_state *state = screen->machine().driver_data<chsuper_state>();
 
38
        const gfx_element *gfx = screen->machine().gfx[0];
 
39
        UINT8 *vram = screen->machine().region("vram")->base();
28
40
        int count = 0x0000;
29
41
        int y,x;
30
42
 
34
46
                {
35
47
                        int tile = ((vram[count+1]<<8) | vram[count]) & 0xffff;
36
48
 
37
 
                        //tile ^=chsuper_tilexor;
 
49
                        //tile ^=state->m_tilexor;
38
50
 
39
51
                        drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*4,y*8);
40
52
                        count+=2;
46
58
 
47
59
static WRITE8_HANDLER( paletteram_io_w )
48
60
{
49
 
        static int pal_offs,r,g,b,internal_pal_offs;
50
 
 
 
61
        chsuper_state *state = space->machine().driver_data<chsuper_state>();
51
62
        switch(offset)
52
63
        {
53
64
                case 0:
54
 
                        pal_offs = data;
 
65
                        state->m_pal.offs = data;
55
66
                        break;
56
67
                case 2:
57
 
                        internal_pal_offs = 0;
 
68
                        state->m_pal.offs_internal = 0;
58
69
                        break;
59
70
                case 1:
60
 
                        switch(internal_pal_offs)
 
71
                        switch(state->m_pal.offs_internal)
61
72
                        {
62
73
                                case 0:
63
 
                                        r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
64
 
                                        internal_pal_offs++;
 
74
                                        state->m_pal.r = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
 
75
                                        state->m_pal.offs_internal++;
65
76
                                        break;
66
77
                                case 1:
67
 
                                        g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
68
 
                                        internal_pal_offs++;
 
78
                                        state->m_pal.g = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
 
79
                                        state->m_pal.offs_internal++;
69
80
                                        break;
70
81
                                case 2:
71
 
                                        b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
72
 
                                        palette_set_color(space->machine, pal_offs, MAKE_RGB(r, g, b));
73
 
                                        internal_pal_offs = 0;
74
 
                                        pal_offs++;
 
82
                                        state->m_pal.b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
 
83
                                        palette_set_color(space->machine(), state->m_pal.offs, MAKE_RGB(state->m_pal.r, state->m_pal.g, state->m_pal.b));
 
84
                                        state->m_pal.offs_internal = 0;
 
85
                                        state->m_pal.offs++;
75
86
                                        break;
76
87
                        }
77
88
 
86
97
 
87
98
static WRITE8_HANDLER( chsuper_vram_w )
88
99
{
89
 
        UINT8 *vram = space->machine->region("vram")->base();
 
100
        UINT8 *vram = space->machine().region("vram")->base();
90
101
 
91
102
        vram[offset] = data;
92
103
}
93
104
 
94
 
static ADDRESS_MAP_START( chsuper_prg_map, ADDRESS_SPACE_PROGRAM, 8 )
 
105
static ADDRESS_MAP_START( chsuper_prg_map, AS_PROGRAM, 8 )
95
106
        AM_RANGE(0x00000, 0x0efff) AM_ROM
96
107
        AM_RANGE(0x00000, 0x01fff) AM_WRITE( chsuper_vram_w )
97
108
        AM_RANGE(0x0f000, 0x0ffff) AM_RAM AM_REGION("maincpu", 0xf000)
100
111
 
101
112
//  AM_RANGE(0xaff8, 0xaff8) AM_DEVWRITE_MODERN("oki", okim6295_device, write)
102
113
 
103
 
static ADDRESS_MAP_START( chsuper_portmap, ADDRESS_SPACE_IO, 8 )
 
114
static ADDRESS_MAP_START( chsuper_portmap, AS_IO, 8 )
104
115
        AM_RANGE( 0x0000, 0x003f ) AM_RAM // Z180 internal regs
105
116
        AM_RANGE( 0x00e8, 0x00e8 ) AM_READ_PORT("IN0")
106
117
        AM_RANGE( 0x00e9, 0x00e9 ) AM_READ_PORT("IN1")
190
201
        GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout,   0, 1 )
191
202
GFXDECODE_END
192
203
 
193
 
static MACHINE_CONFIG_START( chsuper, driver_device )
 
204
static MACHINE_CONFIG_START( chsuper, chsuper_state )
194
205
 
195
206
        /* basic machine hardware */
196
207
        MCFG_CPU_ADD("maincpu", Z180, XTAL_12MHz / 2)   /* HD64180RP8, 8 MHz? */
205
216
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
206
217
        MCFG_SCREEN_SIZE(64*8, 64*8)
207
218
        MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 0, 30*8-1)
 
219
        MCFG_SCREEN_UPDATE(chsuper)
208
220
 
209
221
        MCFG_NVRAM_ADD_0FILL("nvram")
210
222
 
212
224
        MCFG_PALETTE_LENGTH(0x100)
213
225
 
214
226
        MCFG_VIDEO_START(chsuper)
215
 
        MCFG_VIDEO_UPDATE(chsuper)
216
227
 
217
228
        /* sound hardware */
218
229
        MCFG_SPEAKER_STANDARD_MONO("mono")
269
280
 
270
281
static DRIVER_INIT( chsuper2 )
271
282
{
 
283
        chsuper_state *state = machine.driver_data<chsuper_state>();
272
284
        UINT8 *buffer;
273
 
        UINT8 *rom = machine->region("gfx1")->base();
 
285
        UINT8 *rom = machine.region("gfx1")->base();
274
286
        int i;
275
287
 
276
 
        chsuper_tilexor = 0x7f00;
 
288
        state->m_tilexor = 0x7f00;
277
289
 
278
290
        buffer = auto_alloc_array(machine, UINT8, 0x100000);
279
291
 
281
293
        {
282
294
                int j;
283
295
 
284
 
                j = i ^ (chsuper_tilexor << 5);
 
296
                j = i ^ (state->m_tilexor << 5);
285
297
 
286
298
                buffer[j] = rom[i];
287
299
        }
288
300
 
289
301
        memcpy(rom,buffer,0x100000);
290
302
 
291
 
        chsuper_tilexor = 0x0000;
 
303
        state->m_tilexor = 0x0000;
292
304
}
293
305
 
294
306
static DRIVER_INIT( chsuper3 )
295
307
{
 
308
        chsuper_state *state = machine.driver_data<chsuper_state>();
296
309
        UINT8 *buffer;
297
 
        UINT8 *rom = machine->region("gfx1")->base();
 
310
        UINT8 *rom = machine.region("gfx1")->base();
298
311
        int i;
299
312
 
300
 
        chsuper_tilexor = 0x0e00;
 
313
        state->m_tilexor = 0x0e00;
301
314
 
302
315
        buffer = auto_alloc_array(machine, UINT8, 0x100000);
303
316
 
305
318
        {
306
319
                int j;
307
320
 
308
 
                j = i ^ (chsuper_tilexor << 5);
 
321
                j = i ^ (state->m_tilexor << 5);
309
322
 
310
323
                buffer[j] = rom[i];
311
324
        }
312
325
 
313
326
        memcpy(rom,buffer,0x100000);
314
327
 
315
 
        chsuper_tilexor = 0x0000;
 
328
        state->m_tilexor = 0x0000;
316
329
}
317
330
 
318
331
static DRIVER_INIT( chmpnum )
319
332
{
 
333
        chsuper_state *state = machine.driver_data<chsuper_state>();
320
334
        UINT8 *buffer;
321
 
        UINT8 *rom = machine->region("gfx1")->base();
 
335
        UINT8 *rom = machine.region("gfx1")->base();
322
336
        int i;
323
337
 
324
 
        chsuper_tilexor = 0x1800;
 
338
        state->m_tilexor = 0x1800;
325
339
 
326
340
        buffer = auto_alloc_array(machine, UINT8, 0x100000);
327
341
 
329
343
        {
330
344
                int j;
331
345
 
332
 
                j = i ^ (chsuper_tilexor << 5);
 
346
                j = i ^ (state->m_tilexor << 5);
333
347
 
334
348
                j = BITSWAP24(j,23,22,21,20,19,18,17,13, 15,14,16,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
335
349
                j = BITSWAP24(j,23,22,21,20,19,18,17,14, 15,16,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
340
354
 
341
355
        memcpy(rom,buffer,0x100000);
342
356
 
343
 
        chsuper_tilexor = 0x0000;
 
357
        state->m_tilexor = 0x0000;
344
358
}
345
359
 
346
360