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

« back to all changes in this revision

Viewing changes to mess/src/mame/machine/cclimber.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "emu.h"
2
 
#include "includes/cclimber.h"
3
 
 
4
 
/* set to 1 to fix protection check after bonus round (see notes in pacman.c driver) */
5
 
#define CANNONB_HACK    0
6
 
 
7
 
static void cclimber_decode(running_machine &machine, const UINT8 convtable[8][16])
8
 
{
9
 
        address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
10
 
        UINT8 *rom = machine.region("maincpu")->base();
11
 
        UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000);
12
 
        int A;
13
 
 
14
 
        space->set_decrypted_region(0x0000, 0xffff, decrypt);
15
 
 
16
 
        for (A = 0x0000;A < 0x10000;A++)
17
 
        {
18
 
                int i,j;
19
 
                UINT8 src = rom[A];
20
 
 
21
 
                /* pick the translation table from bit 0 of the address */
22
 
                /* and from bits 1 7 of the source data */
23
 
                i = (A & 1) | (src & 0x02) | ((src & 0x80) >> 5);
24
 
 
25
 
                /* pick the offset in the table from bits 0 2 4 6 of the source data */
26
 
                j = (src & 0x01) | ((src & 0x04) >> 1) | ((src & 0x10) >> 2) | ((src & 0x40) >> 3);
27
 
 
28
 
                /* decode the opcodes */
29
 
                decrypt[A] = (src & 0xaa) | convtable[i][j];
30
 
        }
31
 
}
32
 
 
33
 
DRIVER_INIT( cclimber )
34
 
{
35
 
        static const UINT8 convtable[8][16] =
36
 
        {
37
 
                /* -1 marks spots which are unused and therefore unknown */
38
 
                { 0x44,0x14,0x54,0x10,0x11,0x41,0x05,0x50,0x51,0x00,0x40,0x55,0x45,0x04,0x01,0x15 },
39
 
                { 0x44,0x10,0x15,0x55,0x00,0x41,0x40,0x51,0x14,0x45,0x11,0x50,0x01,0x54,0x04,0x05 },
40
 
                { 0x45,0x10,0x11,0x44,0x05,0x50,0x51,0x04,0x41,0x14,0x15,0x40,0x01,0x54,0x55,0x00 },
41
 
                { 0x04,0x51,0x45,0x00,0x44,0x10,  -1,0x55,0x11,0x54,0x50,0x40,0x05,  -1,0x14,0x01 },
42
 
                { 0x54,0x51,0x15,0x45,0x44,0x01,0x11,0x41,0x04,0x55,0x50,  -1,0x00,0x10,0x40,  -1 },
43
 
                {   -1,0x54,0x14,0x50,0x51,0x01,  -1,0x40,0x41,0x10,0x00,0x55,0x05,0x44,0x11,0x45 },
44
 
                { 0x51,0x04,0x10,  -1,0x50,0x40,0x00,  -1,0x41,0x01,0x05,0x15,0x11,0x14,0x44,0x54 },
45
 
                {   -1,  -1,0x54,0x01,0x15,0x40,0x45,0x41,0x51,0x04,0x50,0x05,0x11,0x44,0x10,0x14 }
46
 
        };
47
 
 
48
 
        cclimber_decode(machine, convtable);
49
 
}
50
 
 
51
 
DRIVER_INIT( cclimberj )
52
 
{
53
 
        static const UINT8 convtable[8][16] =
54
 
        {
55
 
                { 0x41,0x54,0x51,0x14,0x05,0x10,0x01,0x55,0x44,0x11,0x00,0x50,0x15,0x40,0x04,0x45 },
56
 
                { 0x50,0x11,0x40,0x55,0x51,0x14,0x45,0x04,0x54,0x15,0x10,0x05,0x44,0x01,0x00,0x41 },
57
 
                { 0x44,0x11,0x00,0x50,0x41,0x54,0x04,0x14,0x15,0x40,0x51,0x55,0x05,0x10,0x01,0x45 },
58
 
                { 0x10,0x50,0x54,0x55,0x01,0x44,0x40,0x04,0x14,0x11,0x00,0x41,0x45,0x15,0x51,0x05 },
59
 
                { 0x14,0x41,0x01,0x44,0x04,0x50,0x51,0x45,0x11,0x40,0x54,0x15,0x10,0x00,0x55,0x05 },
60
 
                { 0x01,0x05,0x41,0x45,0x54,0x50,0x55,0x10,0x11,0x15,0x51,0x14,0x44,0x40,0x04,0x00 },
61
 
                { 0x05,0x55,0x00,0x50,0x11,0x40,0x54,0x14,0x45,0x51,0x10,0x04,0x44,0x01,0x41,0x15 },
62
 
                { 0x55,0x50,0x15,0x10,0x01,0x04,0x41,0x44,0x45,0x40,0x05,0x00,0x11,0x14,0x51,0x54 },
63
 
        };
64
 
 
65
 
        cclimber_decode(machine, convtable);
66
 
}
67
 
 
68
 
DRIVER_INIT( ckongb )
69
 
{
70
 
        int A;
71
 
        UINT8 *rom = machine.region("maincpu")->base();
72
 
 
73
 
        for (A = 0x0000;A < 0x6000;A++) /* all the program ROMs are encrypted */
74
 
        {
75
 
                rom[A] = rom[A] ^ 0xf0;
76
 
        }
77
 
}
78
 
 
79
 
#if CANNONB_HACK
80
 
static void cannonb_patch(running_machine &machine)
81
 
{
82
 
        UINT8 *rom = machine.region("maincpu")->base();
83
 
 
84
 
        rom[0x2ba0] = 0x21;
85
 
        rom[0x2ba1] = 0xfb;
86
 
        rom[0x2ba2] = 0x0e;
87
 
        rom[0x2ba3] = 0x00;
88
 
}
89
 
#endif
90
 
 
91
 
DRIVER_INIT( cannonb )
92
 
{
93
 
        int A;
94
 
        UINT8 *rom = machine.region("maincpu")->base();
95
 
 
96
 
        for (A = 0x0000;A < 0x1000;A++) /* only first ROM is encrypted */
97
 
        {
98
 
                UINT8 src;
99
 
                int i;
100
 
                static const UINT8 xor_tab[4] ={0x92, 0x82, 0x12, 0x10};
101
 
 
102
 
                src = rom[A+0x10000];
103
 
 
104
 
                i = ((A&0x200)>>8) | ((A&0x80)>>7);
105
 
 
106
 
                src ^= xor_tab[i];
107
 
 
108
 
                rom[A] = src;
109
 
        }
110
 
 
111
 
#if CANNONB_HACK
112
 
        cannonb_patch(machine);
113
 
#endif
114
 
}
115
 
 
116
 
DRIVER_INIT( cannonb2 )
117
 
{
118
 
#if CANNONB_HACK
119
 
        cannonb_patch(machine);
120
 
#endif
121
 
}
122