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

« back to all changes in this revision

Viewing changes to mess/src/mame/drivers/tcl.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
 
/*
2
 
Taiwan Chess Legend
3
 
Uniwang, 1995
4
 
 
5
 
Preliminary driver by Tomasz Slanina
6
 
 
7
 
PCB Layout
8
 
----------
9
 
 
10
 
 
11
 
|-----------------------------------------------|
12
 
|  AY8930   DSW5  TCL.1E                        |
13
 
|           DSW4  TCL.3E   TCL.3F  TCL.3H       |
14
 
|           DSW3  TCL.4E   TCL.4F  TCL.4H       |
15
 
|           DSW2  6116                          |
16
 
|           DSW1  6116          6116            |
17
 
|                               6116            |
18
 
|  8255                               12MHz     |
19
 
|                                               |
20
 
|                                               |
21
 
|                 TCL_PR3.9E                    |
22
 
|                                               |
23
 
|  8255                     PAL                 |
24
 
|                                               |
25
 
|                           PAL                 |
26
 
|  BATTERY                    LATTICE           |
27
 
|                       PAL   PLSI 1016 Z80 PAL |
28
 
|           TCL_PR1.15C                     PAL |
29
 
|  SW1      TCL_PR2.16C 6116      TCL.16F       |
30
 
|-----------------------------------------------|
31
 
 
32
 
Notes:
33
 
      Z80 Clock: 3.000MHz
34
 
          VSync: 60Hz
35
 
          HSync: 15.15kHz
36
 
 
37
 
 This appears to be based off a Blue
38
 
 Dyna Cherry Master board -- emualted goldstar.c
39
 
 but with extra protection (the sub-board with CPU)
40
 
 
41
 
*/
42
 
 
43
 
#include "emu.h"
44
 
#include "cpu/z80/z80.h"
45
 
#include "machine/8255ppi.h"
46
 
#include "sound/ay8910.h"
47
 
 
48
 
 
49
 
class tcl_state : public driver_device
50
 
{
51
 
public:
52
 
        tcl_state(const machine_config &mconfig, device_type type, const char *tag)
53
 
                : driver_device(mconfig, type, tag) { }
54
 
 
55
 
};
56
 
 
57
 
 
58
 
static VIDEO_START( tcl )
59
 
{
60
 
}
61
 
static SCREEN_UPDATE( tcl )
62
 
{
63
 
        return 0;
64
 
}
65
 
 
66
 
static ADDRESS_MAP_START( tcl_map, AS_PROGRAM, 8 )
67
 
        AM_RANGE(0x0000, 0x7fff) AM_ROM  /* bfff ? */
68
 
ADDRESS_MAP_END
69
 
 
70
 
 
71
 
static INPUT_PORTS_START( tcl )
72
 
        PORT_START("IN0")
73
 
INPUT_PORTS_END
74
 
 
75
 
static const gfx_layout charlayout =
76
 
{
77
 
        8,8,
78
 
        RGN_FRAC(1,3),
79
 
        3,
80
 
        { 0, RGN_FRAC(1,3), RGN_FRAC(2,3) },
81
 
        { 0, 1, 2, 3, 4, 5, 6, 7 },
82
 
        { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
83
 
        8*8
84
 
};
85
 
 
86
 
static const gfx_layout charlayout2 =
87
 
{
88
 
        8,8,
89
 
        RGN_FRAC(1,4),
90
 
        4,
91
 
        { 0, RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4)},
92
 
        { 0, 1, 2, 3, 4, 5, 6, 7 },
93
 
        { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
94
 
        8*8
95
 
};
96
 
 
97
 
 
98
 
static GFXDECODE_START( tcl )
99
 
        GFXDECODE_ENTRY( "gfx1", 0, charlayout,     0, 16 )
100
 
        GFXDECODE_ENTRY( "gfx2", 0, charlayout2,     0, 16 ) /* wrong */
101
 
GFXDECODE_END
102
 
 
103
 
static const ppi8255_interface ppi8255_intf[2] =
104
 
{
105
 
        {
106
 
                DEVCB_NULL,
107
 
                DEVCB_NULL,
108
 
                DEVCB_NULL,
109
 
                DEVCB_NULL,
110
 
                DEVCB_NULL,
111
 
                DEVCB_NULL
112
 
        },
113
 
        {
114
 
                DEVCB_NULL,
115
 
                DEVCB_NULL,
116
 
                DEVCB_NULL,
117
 
                DEVCB_NULL,
118
 
                DEVCB_NULL,
119
 
                DEVCB_NULL
120
 
        }
121
 
};
122
 
 
123
 
 
124
 
static MACHINE_CONFIG_START( tcl, tcl_state )
125
 
 
126
 
        /* basic machine hardware */
127
 
        MCFG_CPU_ADD("maincpu", Z80,12000000/4)
128
 
        MCFG_CPU_PROGRAM_MAP(tcl_map)
129
 
 
130
 
        /* video hardware */
131
 
        MCFG_SCREEN_ADD("screen", RASTER)
132
 
        MCFG_SCREEN_REFRESH_RATE(60)
133
 
        MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
134
 
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
135
 
        MCFG_SCREEN_SIZE(32*8, 32*8)
136
 
        MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
137
 
        MCFG_SCREEN_UPDATE(tcl)
138
 
 
139
 
        MCFG_GFXDECODE(tcl)
140
 
        MCFG_PALETTE_LENGTH(16*16)
141
 
 
142
 
        MCFG_VIDEO_START(tcl)
143
 
 
144
 
        MCFG_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] )
145
 
        MCFG_PPI8255_ADD( "ppi8255_1", ppi8255_intf[1] )
146
 
 
147
 
        /* sound hardware */
148
 
        MCFG_SPEAKER_STANDARD_MONO("mono")
149
 
 
150
 
        MCFG_SOUND_ADD("aysnd", AY8910, 12000000/6)
151
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
152
 
MACHINE_CONFIG_END
153
 
 
154
 
/***************************************************************************
155
 
 
156
 
  Game driver(s)
157
 
 
158
 
***************************************************************************/
159
 
 
160
 
ROM_START( tcl )
161
 
        ROM_REGION( 0x10000*2, "maincpu", 0 )
162
 
        ROM_LOAD( "tcl.16f",   0x00000, 0x20000, CRC(8e694a58) SHA1(7a3c20a7c740065b71fe66ec581edce0dd32f145) )
163
 
 
164
 
        ROM_REGION( 0x8000*3, "gfx1", 0 )
165
 
        ROM_LOAD( "tcl.1e",   0x00000, 0x8000, CRC(37edf9b8) SHA1(9225728116d6edfe8476e565a12e1f1e59766d26) )
166
 
        ROM_LOAD( "tcl.3e",   0x08000, 0x8000, CRC(396298cf) SHA1(0ee306179a9d3dd84f7e5799527e6825d2979ddb) )
167
 
        ROM_LOAD( "tcl.4e",   0x10000, 0x8000, CRC(f880101c) SHA1(8417410a7dcb304a88e98f9199f44a4df1ee3fb7) )
168
 
 
169
 
        ROM_REGION( 0x2000*4, "gfx2", 0 ) /* ??? */
170
 
        ROM_LOAD( "tcl.3f",   0x0000, 0x2000, CRC(c290c1eb) SHA1(00eb5ff46affe01f240081211b7f9a40e9f76bd8) )
171
 
        ROM_LOAD( "tcl.4f",   0x2000, 0x2000, CRC(225e0148) SHA1(26d8db263b1957fc6b2204765c8aa1f10f44b591) )
172
 
        ROM_LOAD( "tcl.3h",   0x4000, 0x2000, CRC(ee63d380) SHA1(c1d9ca4584bb2ef0fa85e2afb0876040b473a924) )
173
 
        ROM_LOAD( "tcl.4h",   0x6000, 0x2000, CRC(6afa36a1) SHA1(a87423f01dbf9b1e69feb049d6ae3fd63321ee1a) )
174
 
 
175
 
        ROM_REGION( 0x100*3, "proms", 0 )
176
 
        ROM_LOAD( "tcl_pr1.15c",   0x000, 0x100, CRC(21eb5b19) SHA1(9b8425bdb97f11f4855c998c7792c3291fd07470) )
177
 
        ROM_LOAD( "tcl_pr2.16c",   0x100, 0x100, CRC(0489b760) SHA1(78f8632b17a76335183c5c204cdec856988368b0) )
178
 
        ROM_LOAD( "tcl_pr3.9e",    0x200, 0x100, CRC(50ec383b) SHA1(ae95b92bd3946b40134bcdc22708d5c6b0f4c23e) )
179
 
ROM_END
180
 
 
181
 
#define ROL(x,n) (BITSWAP8((x),(7+8-n)&7,(6+8-n)&7,(5+8-n)&7,(4+8-n)&7,(3+8-n)&7,(2+8-n)&7,(1+8-n)&7,(0+8-n)&7))
182
 
 
183
 
#define WRITEDEST( n ) \
184
 
                dest[idx]=n;    \
185
 
                dest[idx+0x10000]=(n)^0xff;     \
186
 
                idx++;
187
 
 
188
 
static DRIVER_INIT(tcl)
189
 
{
190
 
        /* only the first part is decrypted (and verified)*/
191
 
 
192
 
        address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
193
 
        UINT8 *dest = machine.region("maincpu")->base();
194
 
        int len = machine.region("maincpu")->bytes();
195
 
        UINT8 *src = auto_alloc_array(machine, UINT8, len);
196
 
 
197
 
        int i,idx=0;
198
 
        memcpy(src, dest, len);
199
 
        for(i=0;i<64*1024;i+=4)
200
 
        {
201
 
                if(i&0x8000)
202
 
                {
203
 
                        WRITEDEST(ROL(src[idx]^0x44,4)); // abcdefgh -> aFghaBcd
204
 
                        WRITEDEST(ROL(src[idx]^0x44,7)); // abcdefgh -> haBcdeFg
205
 
                        WRITEDEST(ROL(src[idx]^0x44,2)); // abcdefgh -> cdeFghaB
206
 
                        WRITEDEST((src[idx]^0x44)^0xf0); // abcdefgh -> AbCEeFgh
207
 
                }
208
 
                else
209
 
                {
210
 
                        WRITEDEST(ROL(src[idx]^0x11,4)); // abcdefgh -> efgHabcD
211
 
                        WRITEDEST(ROL(src[idx]^0x11,7)); // abcdefgh -> HabcDefg
212
 
                        WRITEDEST(ROL(src[idx]^0x11,2)); // abcdefgh -> cDefgHab
213
 
                        WRITEDEST((src[idx]^0x11)^0xf0); // abcdefgh -> ABCdefgH
214
 
                }
215
 
        }
216
 
        auto_free(machine, src);
217
 
 
218
 
        space->set_decrypted_region(0x0000, 0x7fff, dest+0x10000);
219
 
}
220
 
 
221
 
GAME( 1995, tcl,  0,       tcl,  tcl,  tcl, ROT0, "Uniwang", "Taiwan Chess Legend", GAME_NOT_WORKING )