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

« back to all changes in this revision

Viewing changes to mess/src/mame/drivers/sliver.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
 
Sliver - Hollow Corp.1996
3
 
driver by Tomasz Slanina
4
 
 
5
 
Custom blitter + background framebuffer + oki for sound.
6
 
 
7
 
The background images on this hardware are in JPEG format, the Zoran chips are
8
 
hardware JPEG decompression chips.
9
 
Driver (temporary) uses fake rom with decompressed images (gfx.bin)
10
 
 
11
 
TODO:
12
 
- verify OKI rom banking  (bank num inverted or not)
13
 
- DIPS
14
 
- add jpeg decompression
15
 
- fix transparency problems in some stages
16
 
 
17
 
 
18
 
PCB Layout
19
 
----------
20
 
 
21
 
WS16-AJ-940820
22
 
|---------|-----------|------------------------------------|
23
 
|   TL084 |   i8031   |   KA-1                             |
24
 
|         |-----------||--------|                          |
25
 
|  AD-65    KA-2       |ACTEL   |   KA-6  KA-7  KA-8  KA-9 |
26
 
|                      |A1020B  |                          |
27
 
|           KA-3       |PL84C   |                          |
28
 
|               PAL    |        |                          |
29
 
|                      |--------|                          |
30
 
|             AT76C176                62256        62256   |
31
 
|                                                          |
32
 
|J             KM75C02                62256        62256   |
33
 
|A                                                         |
34
 
|M                 PAL                62256        62256   |
35
 
|M                                                         |
36
 
|A                                    62256        62256   |
37
 
|                                                  HY534256|
38
 
|   DSW1           PAL                 |-------|   HY534256|
39
 
|          PAL     PAL                 |ZORAN  |   HY534256|
40
 
|                            |-------| |ZR36011|   HY534256|
41
 
|   DSW2   62256    62256    |ZORAN  | |-------|           |
42
 
|          KA-4     KA-5     |ZR36050|                     |
43
 
|                            |-------|        |-------|    |
44
 
|        |------------------|16MHz            |FUJI   |    |
45
 
|        |                  |                 |MD0204 |    |
46
 
|        |    MC68000P10    |                 |-------|    |
47
 
|        |                  |           KA-12  KA-11  KA-10|
48
 
|24MHz   |------------------|                              |
49
 
|----------------------------------------------------------|
50
 
Notes:
51
 
      i8031    - Intel 8031 CPU, clock 8.000MHz (DIP40)
52
 
      68000    - Motorola MC68000 CPU, clock 12.000MHz (DIP64)
53
 
      AT76C176 - Atmel AT76C176 1-Channel 6-Bit AD/DA Convertor with Clamp Circuit (DIP28).
54
 
                 When removed, text and _some_ graphics turn black (palette related use)
55
 
                 This chip is compatible to Fujitsu MB40176
56
 
      A1020B   - Actel A1020B FPGA (PLCC84)
57
 
      ZR36050  - Zoran ZR36050PQC-21 DF4B9423G (QFP100)
58
 
      ZR36011  - Zoran ZR36011PQC JAPAN 079414 (QFP100)
59
 
      MD0204   - Fuji MD0204 JAPAN F39D110 (QFP128) - Memory controller
60
 
      62256    - 32K x8 SRAM (DIP28)
61
 
      HY534256 - Hyundai 256K x4 (1MBit) DRAM (DIP20)
62
 
      KM75C02  - Samsung KM75C02 FIFO RAM (DIP28)
63
 
      AD-65    - Clone OKI M6295 (QFP44), clock 1.000MHz, sample rate = 1000000Hz / 132
64
 
      VSync    - 60Hz
65
 
*/
66
 
 
67
 
#include "emu.h"
68
 
#include "cpu/m68000/m68000.h"
69
 
#include "deprecat.h"
70
 
#include "sound/okim6295.h"
71
 
#include "cpu/mcs51/mcs51.h"
72
 
 
73
 
#define FIFO_SIZE 1024
74
 
#define IO_SIZE         0x100
75
 
#define COMMAND_SIZE 8
76
 
#define x_offset 0x45
77
 
#define y_offset 0x0d
78
 
 
79
 
class sliver_state : public driver_device
80
 
{
81
 
public:
82
 
        sliver_state(const machine_config &mconfig, device_type type, const char *tag)
83
 
                : driver_device(mconfig, type, tag) { }
84
 
 
85
 
        UINT16 m_io_offset;
86
 
        UINT16 m_io_reg[IO_SIZE];
87
 
        UINT16 m_fifo[FIFO_SIZE];
88
 
        UINT16 m_fptr;
89
 
 
90
 
        int m_jpeg_addr;
91
 
        UINT16 m_jpeg1;
92
 
        UINT16 m_jpeg2;
93
 
        int m_jpeg_h;
94
 
        int m_jpeg_w;
95
 
        int m_jpeg_x;
96
 
        int m_jpeg_y;
97
 
        int m_tmp_counter;
98
 
        int m_clr_offset;
99
 
 
100
 
        UINT8 *m_colorram;
101
 
        bitmap_t *m_bitmap_fg;
102
 
        bitmap_t *m_bitmap_bg;
103
 
 
104
 
        UINT16 m_tempbuf[8];
105
 
};
106
 
 
107
 
static const int gfxlookup[][4]=
108
 
{
109
 
   { 0x0000000, 0x0000000, 512, 256 },
110
 
   { 0x0060000, 0x0007fa5, 512, 256 },
111
 
   { 0x00c0000, 0x0008c04, 512, 512 },
112
 
   { 0x0180000, 0x001642b, 512, 512 },
113
 
   { 0x0240000, 0x00240fb, 512, 512 },
114
 
   { 0x0300000, 0x0033494, 512, 256 },
115
 
   { 0x0360000, 0x003ad9a, 512, 256 },
116
 
   { 0x03c0000, 0x003cab3, 512, 256 },
117
 
   { 0x0420000, 0x003e50c, 512, 256 },
118
 
   { 0x0480000, 0x003fd94, 512, 256 },
119
 
   { 0x04e0000, 0x004166e, 512, 256 },
120
 
   { 0x0540000, 0x004306a, 512, 256 },
121
 
   { 0x05a0000, 0x0044c65, 512, 256 },
122
 
   { 0x0600000, 0x0046aeb, 512, 256 },
123
 
   { 0x0660000, 0x0048a86, 512, 512 },
124
 
   { 0x0720000, 0x00527c7, 512, 512 },
125
 
   { 0x07e0000, 0x005a789, 512, 256 },
126
 
   { 0x0840000, 0x005f9b0, 512, 256 },
127
 
   { 0x08a0000, 0x0065621, 512, 512 },
128
 
   { 0x0960000, 0x006fbd6, 512, 512 },
129
 
   { 0x0a20000, 0x0077b98, 512, 512 },
130
 
   { 0x0ae0000, 0x007fa6e, 512, 512 },
131
 
   { 0x0ba0000, 0x0087a42, 512, 512 },
132
 
   { 0x0c60000, 0x008f996, 512, 256 },
133
 
   { 0x0cc0000, 0x0094b82, 512, 512 },
134
 
   { 0x0d80000, 0x009e27a, 512, 512 },
135
 
   { 0x0e40000, 0x00a6157, 512, 256 },
136
 
   { 0x0ea0000, 0x00ab417, 512, 512 },
137
 
   { 0x0f60000, 0x00b33c1, 512, 512 },
138
 
   { 0x1020000, 0x00bd7f1, 512, 256 },
139
 
   { 0x1080000, 0x00c1679, 512, 512 },
140
 
   { 0x1140000, 0x00cbc8a, 512, 256 },
141
 
   { 0x11a0000, 0x00d0ee2, 512, 256 },
142
 
   { 0x1200000, 0x00d4d76, 512, 256 },
143
 
   { 0x1260000, 0x00d8a4f, 512, 256 },
144
 
   { 0x12c0000, 0x00dc980, 512, 256 },
145
 
   { 0x1320000, 0x00e07ba, 512, 256 },
146
 
   { 0x1380000, 0x00e45a2, 512, 256 },
147
 
   { 0x13e0000, 0x00e842e, 512, 256 },
148
 
   { 0x1440000, 0x00ec0db, 512, 256 },
149
 
   { 0x14a0000, 0x00efdae, 512, 256 },
150
 
   { 0x1500000, 0x00f3c99, 512, 256 },
151
 
   { 0x1560000, 0x00f794f, 512, 256 },
152
 
   { 0x15c0000, 0x00fb5db, 512, 256 },
153
 
   { 0x1620000, 0x00ff2e6, 512, 256 },
154
 
   { 0x1680000, 0x0103156, 512, 256 },
155
 
   { 0x16e0000, 0x0106fcf, 512, 256 },
156
 
   { 0x1740000, 0x010ae0c, 512, 256 },
157
 
   { 0x17a0000, 0x010edaf, 512, 256 },
158
 
   { 0x1800000, 0x0112bac, 512, 256 },
159
 
   { 0x1860000, 0x01169c1, 128, 128 },
160
 
   { 0x186c000, 0x0119b95, 128, 128 },
161
 
   { 0x1878000, 0x011d0dc, 128, 128 },
162
 
   { 0x1884000, 0x01205ca, 128, 128 },
163
 
   { 0x1890000, 0x01236b2, 128, 128 },
164
 
   { 0x189c000, 0x01268ff, 128, 128 },
165
 
   { 0x18a8000, 0x0129bef, 128, 128 },
166
 
   { 0x18b4000, 0x012cf51, 128, 128 },
167
 
   { 0x18c0000, 0x0130331, 128, 128 },
168
 
   { 0x18cc000, 0x013370d, 128, 128 },
169
 
   { 0x18d8000, 0x0136a80, 128, 128 },
170
 
   { 0x18e4000, 0x0139d2a, 128, 128 },
171
 
   { 0x18f0000, 0x013ce39, 128, 128 },
172
 
   { 0x18fc000, 0x0140236, 128, 128 },
173
 
   { 0x1908000, 0x0143701, 128, 128 },
174
 
   { 0x1914000, 0x0146cb3, 128, 128 },
175
 
   { 0x1920000, 0x014a40d, 128, 128 },
176
 
   { 0x192c000, 0x014da18, 128, 128 },
177
 
   { 0x1938000, 0x0150ea4, 512, 256 },
178
 
   { 0x1998000, 0x0154e17, 512, 256 },
179
 
   { 0x19f8000, 0x0158ddf, 512, 256 },
180
 
   { 0x1a58000, 0x015cd80, 512, 256 },
181
 
   { 0x1ab8000, 0x0160d5b, 512, 256 },
182
 
   { 0x1b18000, 0x0164d2f, 512, 256 },
183
 
   { 0x1b78000, 0x017b5db, 512, 256 },
184
 
   { 0x1bd8000, 0x017f2e6, 512, 256 },
185
 
   { -1,-1,-1,-1}
186
 
};
187
 
 
188
 
static WRITE16_HANDLER( sliver_RAMDAC_offset_w )
189
 
{
190
 
        sliver_state *state = space->machine().driver_data<sliver_state>();
191
 
 
192
 
        state->m_clr_offset=data*3;
193
 
}
194
 
 
195
 
static WRITE16_HANDLER( sliver_RAMDAC_color_w )
196
 
{
197
 
        sliver_state *state = space->machine().driver_data<sliver_state>();
198
 
 
199
 
        state->m_colorram[state->m_clr_offset]=data;
200
 
        state->m_clr_offset=(state->m_clr_offset+1)%768;
201
 
}
202
 
 
203
 
static void plot_pixel_rgb(sliver_state *state, int x, int y, UINT32 r, UINT32 g, UINT32 b)
204
 
{
205
 
        UINT16 color;
206
 
 
207
 
        if (y < 0 || x < 0 || x > 383 || y > 255)
208
 
                return;
209
 
 
210
 
        if (state->m_bitmap_bg->bpp == 32)
211
 
        {
212
 
                *BITMAP_ADDR32(state->m_bitmap_bg, y, x) = r | (g<<8) | (b<<16);
213
 
        }
214
 
        else
215
 
        {
216
 
                r>>=3;
217
 
                g>>=3;
218
 
                b>>=3;
219
 
                color = r|(g<<5)|(b<<10);
220
 
                *BITMAP_ADDR16(state->m_bitmap_bg, y, x) = color;
221
 
        }
222
 
}
223
 
 
224
 
static void plot_pixel_pal(running_machine &machine, int x, int y, int addr)
225
 
{
226
 
        sliver_state *state = machine.driver_data<sliver_state>();
227
 
        UINT32 r,g,b;
228
 
        UINT16 color;
229
 
 
230
 
        if (y < 0 || x < 0 || x > 383 || y > 255)
231
 
                return;
232
 
 
233
 
        addr*=3;
234
 
 
235
 
        b=state->m_colorram[addr] << 2;
236
 
        g=state->m_colorram[addr+1] << 2;
237
 
        r=state->m_colorram[addr+2] << 2;
238
 
 
239
 
        if (state->m_bitmap_fg->bpp == 32)
240
 
        {
241
 
 
242
 
                *BITMAP_ADDR32(state->m_bitmap_fg, y, x) = r | (g<<8) | (b<<16);
243
 
        }
244
 
        else
245
 
        {
246
 
                r>>=3;
247
 
                g>>=3;
248
 
                b>>=3;
249
 
                color = r|(g<<5)|(b<<10);
250
 
                *BITMAP_ADDR16(state->m_bitmap_fg, y, x) = color;
251
 
        }
252
 
}
253
 
 
254
 
static WRITE16_HANDLER( fifo_data_w )
255
 
{
256
 
        sliver_state *state = space->machine().driver_data<sliver_state>();
257
 
 
258
 
        if (state->m_tmp_counter < 8)
259
 
        {
260
 
                COMBINE_DATA(&state->m_tempbuf[state->m_tmp_counter]);
261
 
                state->m_tmp_counter++;
262
 
                if (state->m_tmp_counter == 8) // copy 8 bytes to fifo,  every byte should be copied directly, but it's easier to copy whole commands
263
 
                {
264
 
                        do
265
 
                        {
266
 
                                state->m_fifo[state->m_fptr++]=state->m_tempbuf[8-state->m_tmp_counter];
267
 
                                if (state->m_fptr > (FIFO_SIZE - 1))
268
 
                                {
269
 
                                        state->m_fptr=FIFO_SIZE-1;
270
 
                                }
271
 
                        }
272
 
                        while (--state->m_tmp_counter > 0);
273
 
                }
274
 
        }
275
 
}
276
 
 
277
 
static void blit_gfx(running_machine &machine)
278
 
{
279
 
        sliver_state *state = machine.driver_data<sliver_state>();
280
 
        int tmpptr=0;
281
 
        const UINT8 *rom = machine.region("user1")->base();
282
 
 
283
 
        while (tmpptr < state->m_fptr)
284
 
        {
285
 
                int x,y,romdata;
286
 
                int w,h;
287
 
                int romoffs=state->m_fifo[tmpptr+0]+(state->m_fifo[tmpptr+1] << 8)+(state->m_fifo[tmpptr+2] << 16);
288
 
 
289
 
                w=state->m_fifo[tmpptr+3]+1;
290
 
                h=state->m_fifo[tmpptr+4]+1;
291
 
 
292
 
                if (state->m_fifo[tmpptr+7] == 0)
293
 
                {
294
 
                        for (y=0; y < h; y++)
295
 
                        {
296
 
                                for (x=0; x < w; x++)
297
 
                                {
298
 
                                        romdata = rom[romoffs&0x1fffff];
299
 
                                        if (romdata)
300
 
                                        {
301
 
                                                plot_pixel_pal(machine, state->m_fifo[tmpptr+5]+state->m_fifo[tmpptr+3]-x, state->m_fifo[tmpptr+6]+state->m_fifo[tmpptr+4]-y, romdata);
302
 
                                        }
303
 
                                        romoffs++;
304
 
                                }
305
 
                        }
306
 
                }
307
 
                tmpptr+=COMMAND_SIZE;
308
 
        }
309
 
}
310
 
 
311
 
static WRITE16_HANDLER( fifo_clear_w )
312
 
{
313
 
        sliver_state *state = space->machine().driver_data<sliver_state>();
314
 
 
315
 
        bitmap_fill(state->m_bitmap_fg, 0,0);
316
 
        state->m_fptr=0;
317
 
        state->m_tmp_counter=0;
318
 
}
319
 
 
320
 
static WRITE16_HANDLER( fifo_flush_w )
321
 
{
322
 
        blit_gfx(space->machine());
323
 
}
324
 
 
325
 
 
326
 
static WRITE16_HANDLER( jpeg1_w )
327
 
{
328
 
        sliver_state *state = space->machine().driver_data<sliver_state>();
329
 
 
330
 
        COMBINE_DATA(&state->m_jpeg1);
331
 
}
332
 
 
333
 
static void render_jpeg(running_machine &machine)
334
 
{
335
 
        sliver_state *state = machine.driver_data<sliver_state>();
336
 
        int x, y;
337
 
        int addr = state->m_jpeg_addr;
338
 
        UINT8 *rom;
339
 
 
340
 
        bitmap_fill(state->m_bitmap_bg, 0, 0);
341
 
        if (addr < 0)
342
 
        {
343
 
                return;
344
 
        }
345
 
 
346
 
        rom = machine.region("user3")->base();
347
 
        for (y = 0; y < state->m_jpeg_h; y++)
348
 
        {
349
 
                for (x = 0; x < state->m_jpeg_w; x++)
350
 
                {
351
 
                        plot_pixel_rgb(state, x - x_offset + state->m_jpeg_x, state->m_jpeg_h - y - y_offset - state->m_jpeg_y, rom[addr], rom[addr + 1], rom[addr + 2]);
352
 
                        addr+=3;
353
 
                }
354
 
        }
355
 
}
356
 
 
357
 
static int find_data(int offset)
358
 
{
359
 
        int idx = 0;
360
 
        while (gfxlookup[idx][0] >= 0)
361
 
        {
362
 
                if (offset == gfxlookup[idx][1])
363
 
                {
364
 
                        return idx;
365
 
                }
366
 
                ++idx;
367
 
        }
368
 
        return -1;
369
 
}
370
 
 
371
 
static WRITE16_HANDLER( jpeg2_w )
372
 
{
373
 
        sliver_state *state = space->machine().driver_data<sliver_state>();
374
 
        int idx;
375
 
 
376
 
        COMBINE_DATA(&state->m_jpeg2);
377
 
 
378
 
        idx = find_data((int)state->m_jpeg2 + (((int)state->m_jpeg1) << 16));
379
 
        if (idx >= 0)
380
 
        {
381
 
                state->m_jpeg_addr = gfxlookup[idx][0];
382
 
                state->m_jpeg_w = gfxlookup[idx][2];
383
 
                state->m_jpeg_h = gfxlookup[idx][3];
384
 
                render_jpeg(space->machine());
385
 
        }
386
 
        else
387
 
        {
388
 
                state->m_jpeg_addr = -1;
389
 
        }
390
 
}
391
 
 
392
 
static WRITE16_HANDLER(io_offset_w)
393
 
{
394
 
        sliver_state *state = space->machine().driver_data<sliver_state>();
395
 
 
396
 
        COMBINE_DATA(&state->m_io_offset);
397
 
}
398
 
 
399
 
static WRITE16_HANDLER(io_data_w)
400
 
{
401
 
        sliver_state *state = space->machine().driver_data<sliver_state>();
402
 
 
403
 
        if (state->m_io_offset < IO_SIZE)
404
 
        {
405
 
                int tmpx, tmpy;
406
 
                COMBINE_DATA(&state->m_io_reg[state->m_io_offset]);
407
 
 
408
 
                tmpy = state->m_io_reg[0x1a] + (state->m_io_reg[0x1b] << 8) - state->m_io_reg[0x20]; //0x20  ???
409
 
                tmpx = state->m_io_reg[0x1e] + (state->m_io_reg[0x1f] << 8);
410
 
 
411
 
                if (tmpy != state->m_jpeg_y || tmpx != state->m_jpeg_x)
412
 
                {
413
 
                        state->m_jpeg_x = tmpx;
414
 
                        state->m_jpeg_y = tmpy;
415
 
                        render_jpeg(space->machine());
416
 
                }
417
 
        }
418
 
        else
419
 
        {
420
 
                logerror("I/O access out of range: %x\n", state->m_io_offset);
421
 
        }
422
 
}
423
 
 
424
 
static WRITE16_HANDLER(sound_w)
425
 
{
426
 
        soundlatch_w(space, 0, data & 0xff);
427
 
        cputag_set_input_line(space->machine(), "audiocpu", MCS51_INT0_LINE, HOLD_LINE);
428
 
}
429
 
 
430
 
static ADDRESS_MAP_START( sliver_map, AS_PROGRAM, 16 )
431
 
        AM_RANGE(0x000000, 0x0fffff) AM_ROM
432
 
 
433
 
        AM_RANGE(0x100000, 0x100001) AM_WRITE(sliver_RAMDAC_offset_w)
434
 
        AM_RANGE(0x100002, 0x100003) AM_WRITE(sliver_RAMDAC_color_w)
435
 
        AM_RANGE(0x100004, 0x100005) AM_WRITENOP//RAMDAC
436
 
 
437
 
        AM_RANGE(0x300002, 0x300003) AM_NOP // bit 0 tested, writes 0xe0 and 0xc0 - both r and w at the end of interrupt code
438
 
 
439
 
        AM_RANGE(0x300004, 0x300005) AM_WRITE(io_offset_w) //unknown i/o device
440
 
        AM_RANGE(0x300006, 0x300007) AM_WRITE(io_data_w)
441
 
 
442
 
        AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1_P2")
443
 
        AM_RANGE(0x400002, 0x400003) AM_READ_PORT("SYSTEM")
444
 
        AM_RANGE(0x400004, 0x400005) AM_READ_PORT("DSW")
445
 
        AM_RANGE(0x400006, 0x400007) AM_WRITE(fifo_data_w)
446
 
        AM_RANGE(0x400008, 0x400009) AM_WRITE(fifo_clear_w)
447
 
        AM_RANGE(0x40000a, 0x40000b) AM_WRITE(fifo_flush_w)
448
 
        AM_RANGE(0x40000c, 0x40000d) AM_WRITE(jpeg1_w)
449
 
        AM_RANGE(0x40000e, 0x40000f) AM_WRITE(jpeg2_w)
450
 
 
451
 
        AM_RANGE(0x400010, 0x400015) AM_WRITENOP //unknown
452
 
        AM_RANGE(0x400016, 0x400017) AM_WRITE(sound_w)
453
 
        AM_RANGE(0x400018, 0x400019) AM_WRITENOP //unknown
454
 
 
455
 
        AM_RANGE(0xff0000, 0xffffff) AM_RAM
456
 
ADDRESS_MAP_END
457
 
 
458
 
// Sound CPU
459
 
 
460
 
static WRITE8_HANDLER(oki_setbank)
461
 
{
462
 
        UINT8 *sound = space->machine().region("oki")->base();
463
 
        int bank=(data^0xff)&3; //xor or not ?
464
 
        memcpy(sound+0x20000, sound+0x100000+0x20000*bank, 0x20000);
465
 
}
466
 
 
467
 
static ADDRESS_MAP_START( soundmem_prg, AS_PROGRAM, 8 )
468
 
        AM_RANGE(0x0000, 0xffff) AM_ROM
469
 
ADDRESS_MAP_END
470
 
 
471
 
static ADDRESS_MAP_START( soundmem_io, AS_IO, 8 )
472
 
        AM_RANGE(0x0100, 0x0100) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write)
473
 
        AM_RANGE(0x0101, 0x0101) AM_READ(soundlatch_r)
474
 
        /* ports */
475
 
        AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_WRITE( oki_setbank )
476
 
ADDRESS_MAP_END
477
 
 
478
 
static VIDEO_START(sliver)
479
 
{
480
 
        sliver_state *state = machine.driver_data<sliver_state>();
481
 
 
482
 
        state->m_bitmap_bg = machine.primary_screen->alloc_compatible_bitmap();
483
 
        state->m_bitmap_fg = machine.primary_screen->alloc_compatible_bitmap();
484
 
}
485
 
 
486
 
static SCREEN_UPDATE(sliver)
487
 
{
488
 
        sliver_state *state = screen->machine().driver_data<sliver_state>();
489
 
 
490
 
        copybitmap      (bitmap, state->m_bitmap_bg, 0, 0, 0, 0, cliprect);
491
 
        copybitmap_trans(bitmap, state->m_bitmap_fg, 0, 0, 0, 0, cliprect, 0);
492
 
        return 0;
493
 
}
494
 
 
495
 
static INPUT_PORTS_START( sliver )
496
 
        PORT_START("P1_P2")
497
 
        PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
498
 
        PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
499
 
        PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
500
 
        PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
501
 
        PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
502
 
        PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
503
 
        PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
504
 
        PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
505
 
        PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
506
 
        PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
507
 
        PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
508
 
        PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
509
 
        PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
510
 
        PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
511
 
        PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
512
 
        PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
513
 
 
514
 
        PORT_START("SYSTEM")
515
 
        PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
516
 
        PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START1 )
517
 
        PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_COIN2 )
518
 
        PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
519
 
        PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN ) //jpeg ready flag
520
 
        PORT_BIT( 0xffa4, IP_ACTIVE_LOW, IPT_UNKNOWN )
521
 
 
522
 
        PORT_START("DSW")
523
 
        PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) )
524
 
        PORT_DIPSETTING(        0x000f, DEF_STR( 1C_1C ) )
525
 
        PORT_DIPSETTING(        0x000e, DEF_STR( 1C_2C ) )
526
 
        PORT_DIPSETTING(        0x000d, DEF_STR( 1C_3C ) )
527
 
        PORT_DIPSETTING(        0x000c, DEF_STR( 1C_4C ) )
528
 
        PORT_DIPSETTING(        0x000b, DEF_STR( 1C_5C ) )
529
 
        PORT_DIPSETTING(        0x0000, DEF_STR( Free_Play ) )
530
 
        PORT_DIPNAME( 0x0030, 0x0020, DEF_STR( Lives ) )
531
 
        PORT_DIPSETTING(    0x0030, "2" )
532
 
        PORT_DIPSETTING(    0x0020, "3" )
533
 
        PORT_DIPSETTING(    0x0010, "4" )
534
 
        PORT_DIPSETTING(    0x0000, "5" )
535
 
        PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
536
 
        PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
537
 
        PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
538
 
        PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
539
 
        PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
540
 
        PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
541
 
        PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
542
 
        PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
543
 
        PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
544
 
        PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
545
 
        PORT_DIPSETTING(      0x0200, DEF_STR( Off ) )
546
 
        PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
547
 
        PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
548
 
        PORT_DIPSETTING(      0x0400, DEF_STR( Off ) )
549
 
        PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
550
 
        PORT_DIPNAME( 0x0800, 0x0800, "Demo_Sounds" )
551
 
        PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
552
 
        PORT_DIPSETTING(      0x0800, DEF_STR( On ) )
553
 
        PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
554
 
        PORT_DIPSETTING(      0x1000, DEF_STR( Off ) )
555
 
        PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
556
 
        PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
557
 
        PORT_DIPSETTING(      0x2000, DEF_STR( Off ) )
558
 
        PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
559
 
        PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // unknown
560
 
        PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
561
 
        PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
562
 
        PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
563
 
INPUT_PORTS_END
564
 
 
565
 
static INTERRUPT_GEN( sliver_int )
566
 
{
567
 
        //valid interrupts are 2,3,4
568
 
        device_set_input_line(device, 2+cpu_getiloops(device), HOLD_LINE);
569
 
}
570
 
 
571
 
static MACHINE_CONFIG_START( sliver, sliver_state )
572
 
 
573
 
        MCFG_CPU_ADD("maincpu", M68000, 12000000)
574
 
        MCFG_CPU_PROGRAM_MAP(sliver_map)
575
 
        MCFG_CPU_VBLANK_INT_HACK(sliver_int,3)
576
 
 
577
 
        MCFG_CPU_ADD("audiocpu", I8051, 8000000)
578
 
        MCFG_CPU_PROGRAM_MAP(soundmem_prg)
579
 
        MCFG_CPU_IO_MAP(soundmem_io)
580
 
 
581
 
 
582
 
        MCFG_SCREEN_ADD("screen", RASTER)
583
 
        MCFG_SCREEN_REFRESH_RATE(60)
584
 
        MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
585
 
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
586
 
        MCFG_SCREEN_SIZE(64*8, 32*8)
587
 
        MCFG_SCREEN_VISIBLE_AREA(0*8, 384-1-16, 0*8, 240-1)
588
 
        MCFG_SCREEN_UPDATE(sliver)
589
 
 
590
 
        MCFG_VIDEO_START(sliver)
591
 
 
592
 
        MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
593
 
 
594
 
        MCFG_OKIM6295_ADD("oki", 1000000, OKIM6295_PIN7_HIGH)
595
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.6)
596
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.6)
597
 
MACHINE_CONFIG_END
598
 
 
599
 
ROM_START( sliver )
600
 
        ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
601
 
        ROM_LOAD16_BYTE( "ka-4.bin", 0x00001, 0x20000, CRC(4906367f) SHA1(cc030930ffe7018ba6c362cab136798d027db7d8) )
602
 
        ROM_LOAD16_BYTE( "ka-5.bin", 0x00000, 0x20000, CRC(f260dabc) SHA1(3727cb8aa652809386075b39a1d85d5b20973702) )
603
 
 
604
 
        ROM_REGION( 0x10000, "audiocpu", 0 ) /* 8031 */
605
 
        ROM_LOAD( "ka-1.bin", 0x000000, 0x10000, CRC(56e616a2) SHA1(f8952aba62ae0410e300d99e95dc8b752543af1e) )
606
 
 
607
 
        ROM_REGION( 0x180000, "oki", 0 ) /* Samples */
608
 
        ROM_LOAD( "ka-2.bin", 0x000000, 0x20000, CRC(3df96eb0) SHA1(ec3dfc29da08f6525a1c708839f83094a6784f72) )
609
 
        ROM_LOAD( "ka-3.bin", 0x100000, 0x80000, CRC(33ee929c) SHA1(a652ad68c547248ef5fa1ed8006b7ac7aef76383) )
610
 
 
611
 
        ROM_REGION( 0x200000, "user1", 0 ) /* Graphics (not tiles) */
612
 
        ROM_LOAD16_BYTE( "ka-8.bin", 0x000000, 0x80000, CRC(dbfd7489) SHA1(4a7b07d041dce04a8d8d6688698164f988baefc9) )
613
 
        ROM_LOAD16_BYTE( "ka-6.bin", 0x000001, 0x80000, CRC(bd182316) SHA1(a22db9f73a2865f59630183c14201aeede821642) )
614
 
        ROM_LOAD16_BYTE( "ka-9.bin", 0x100000, 0x40000, CRC(71f044ba) SHA1(bd88bfaa0249de9fd8eb8bd25eae0126744a9046) )
615
 
        ROM_LOAD16_BYTE( "ka-7.bin", 0x100001, 0x40000, CRC(1c5d6fb9) SHA1(372533264eb41a5f57b2a59eb039adb6334f36c5) )
616
 
 
617
 
        ROM_REGION( 0x180000, "user2", 0 ) /* JPEG(!) compressed GFX */
618
 
        ROM_LOAD( "ka-10.bin", 0x000000, 0x80000, CRC(a6824271) SHA1(2eefa4e61491f7b72ccde744fa6f88a1a3c60c92) )
619
 
        ROM_LOAD( "ka-11.bin", 0x080000, 0x80000, CRC(4ae121ff) SHA1(ece7cc07483801a0d436def977d72dc7b1a07c8f) )
620
 
        ROM_LOAD( "ka-12.bin", 0x100000, 0x80000, CRC(0901e142) SHA1(68ebd38beeedf53414a831c01813881feee33446) )
621
 
 
622
 
        ROM_REGION( 0x2000000, "user3", 0 ) /* decompressed GFX  - temporary!*/
623
 
        ROM_LOAD( "gfx.bin", 0x000000, 0x2000000, BAD_DUMP CRC(706f264e) SHA1(dbcc8dbf30bd65d86bcde7d6db1b08af4242a253) )
624
 
ROM_END
625
 
 
626
 
static DRIVER_INIT(sliver)
627
 
{
628
 
        sliver_state *state = machine.driver_data<sliver_state>();
629
 
 
630
 
        state->m_jpeg_addr = -1;
631
 
        state->m_colorram=auto_alloc_array(machine, UINT8, 256*3);
632
 
}
633
 
 
634
 
GAME( 1996, sliver, 0,        sliver, sliver, sliver, ROT0,  "Hollow Corp", "Sliver", GAME_IMPERFECT_GRAPHICS )