~ubuntu-branches/ubuntu/raring/mame/raring-proposed

« back to all changes in this revision

Viewing changes to mess/src/mame/drivers/badlands.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
 
 
3
 
    Atari Bad Lands hardware
4
 
 
5
 
    driver by Aaron Giles
6
 
 
7
 
    Games supported:
8
 
        * Bad Lands (1989)
9
 
 
10
 
    Known bugs:
11
 
        * none at this time
12
 
 
13
 
****************************************************************************
14
 
 
15
 
    Memory map
16
 
 
17
 
****************************************************************************
18
 
 
19
 
    ========================================================================
20
 
    MAIN CPU
21
 
    ========================================================================
22
 
    000000-03FFFF   R     xxxxxxxx xxxxxxxx   Program ROM
23
 
    FC0000          R     -------x --------   Sound command buffer full
24
 
    FC0000            W   -------- --------   Sound CPU reset
25
 
    FD0000-FD1FFF   R/W   -------- xxxxxxxx   EEPROM
26
 
    FE0000            W   -------- --------   Watchdog reset
27
 
    FE2000            W   -------- --------   VBLANK IRQ acknowledge
28
 
    FE4000          R     -------- xxxx----   Switch inputs
29
 
                    R     -------- x-------      (Self test)
30
 
                    R     -------- -x------      (VBLANK)
31
 
                    R     -------- --x-----      (Player 2 button)
32
 
                    R     -------- ---x----      (Player 1 button)
33
 
    FE6000          R     -------- xxxxxxxx   Player 1 steering
34
 
    FE6002          R     -------- xxxxxxxx   Player 2 steering
35
 
    FE6004          R     -------- xxxxxxxx   Player 1 pedal
36
 
    FE6006          R     -------- xxxxxxxx   Player 2 pedal
37
 
    FE8000            W   xxxxxxxx --------   Sound command write
38
 
    FEA000          R     xxxxxxxx --------   Sound response read
39
 
    FEC000            W   -------- -------x   Playfield tile bank select
40
 
    FEE000            W   -------- --------   EEPROM enable
41
 
    FFC000-FFC0FF   R/W   xxxxxxxx xxxxxxxx   Playfield palette RAM (128 entries)
42
 
                    R/W   x------- --------      (RGB 1 LSB)
43
 
                    R/W   -xxxxx-- --------      (Red 5 MSB)
44
 
                    R/W   ------xx xxx-----      (Green 5 MSB)
45
 
                    R/W   -------- ---xxxxx      (Blue 5 MSB)
46
 
    FFC100-FFC1FF   R/W   xxxxxxxx xxxxxxxx   Motion object palette RAM (128 entries)
47
 
    FFC200-FFC3FF   R/W   xxxxxxxx xxxxxxxx   Extra palette RAM (256 entries)
48
 
    FFE000-FFEFFF   R/W   xxxxxxxx xxxxxxxx   Playfield RAM (64x32 tiles)
49
 
                    R/W   xxx----- --------      (Palette select)
50
 
                    R/W   ---x---- --------      (Tile bank select)
51
 
                    R/W   ----xxxx xxxxxxxx      (Tile index)
52
 
    FFF000-FFFFFF   R/W   xxxxxxxx xxxxxxxx   Motion object RAM (32 entries x 4 words)
53
 
                    R/W   ----xxxx xxxxxxxx      (0: Tile index)
54
 
                    R/W   xxxxxxxx x-------      (1: Y position)
55
 
                    R/W   -------- ----xxxx      (1: Number of Y tiles - 1)
56
 
                    R/W   xxxxxxxx x-------      (3: X position)
57
 
                    R/W   -------- ----x---      (3: Priority)
58
 
                    R/W   -------- -----xxx      (3: Palette select)
59
 
    ========================================================================
60
 
    Interrupts:
61
 
        IRQ1 = VBLANK
62
 
        IRQ2 = sound CPU communications
63
 
    ========================================================================
64
 
 
65
 
 
66
 
    ========================================================================
67
 
    SOUND CPU (based on JSA II, but implemented onboard)
68
 
    ========================================================================
69
 
    0000-1FFF   R/W   xxxxxxxx   Program RAM
70
 
    2000-2001   R/W   xxxxxxxx   YM2151 communications
71
 
    2802        R     xxxxxxxx   Sound command read
72
 
    2804        R     xxxx--xx   Status input
73
 
                R     x-------      (Self test)
74
 
                R     -x------      (Sound command buffer full)
75
 
                R     --x-----      (Sound response buffer full)
76
 
                R     ---x----      (Self test)
77
 
                R     ------xx      (Coin inputs)
78
 
    2806        R/W   --------   IRQ acknowledge
79
 
    2A02          W   xxxxxxxx   Sound response write
80
 
    2A04          W   xxxx---x   Sound control
81
 
                  W   xx------      (ROM bank select)
82
 
                  W   --xx----      (Coin counters)
83
 
                  W   -------x      (YM2151 reset)
84
 
    3000-3FFF   R     xxxxxxxx   Banked ROM
85
 
    4000-FFFF   R     xxxxxxxx   Program ROM
86
 
    ========================================================================
87
 
    Interrupts:
88
 
        IRQ = timed interrupt ORed with YM2151 interrupt
89
 
        NMI = latch on sound command
90
 
    ========================================================================
91
 
 
92
 
 
93
 
Badlands
94
 
Atari Games, 1989
95
 
 
96
 
PCB Layout
97
 
----------
98
 
 
99
 
A047193-01 BADLANDS
100
 
|-------------------------------------------------|
101
 
|TDA2030 LM324                ROM.2N ROM.2S ROM.2U|
102
 
|VOL     LM324                ROM.4N ROM.4S ROM.4U|
103
 
|6264    YM3012                                   |
104
 
|      YM2151          6116     PAL3              |
105
 
|   ROM.9C   PAL2                 ROM.10R  10T    |
106
 
|J    6502                        ROM.14R  ROM.14T|
107
 
|A                            MB87316             |
108
 
|M                     14.31818MHz    PAL4  VMA   |
109
 
|M                                                |
110
 
|A    VGC7205      ROM.17F          PAL5          |
111
 
|  TEST_SW   68000 ROM.20F      SOS               |
112
 
| NE556 PAL1       ROM.24F          PAL6     6264 |
113
 
|LED    DIP20      ROM.27F 2816                   |
114
 
|-------------------------------------------------|
115
 
Notes:
116
 
      68000  - clock 7.15909MHz [14.31818/2]
117
 
      6502   - clock 1.7897725 [14.31818/8]
118
 
      YM2151 - clock 3.579545MHz [14.31818/4]
119
 
      VGC7205- VLSI VGC7205A0672 ATARI 137304-2002
120
 
      2816   - 2k x8 EEPROM
121
 
      DIP20  - socket not populated
122
 
      SOS    - Motorola (rebadged) SOS-137550-001 ZKZKAA8946
123
 
      VMA    - Motorola (rebadged) VMA-137552-001 ZKZKAB8948
124
 
      MB87316- Fujitsu MB87316 137536-001 with clock input 7.15909MHz
125
 
               Listed in Jed Margolin's Atari Approved Vendor List
126
 
               (http://www.jmargolin.com/schem/atariavl.htm) as.....
127
 
               137536-001 IC,Line_Buffer(LB),CMOS,672B_RAM,500_Gate,40pin FUJITSU MB87316
128
 
 
129
 
      ROMs   -
130
 
               location  label
131
 
               ------------------------
132
 
               9C        136074-1018 E1FF
133
 
               17F       136074-1009 86DF
134
 
               20F       136074-1008 87FF
135
 
               24F       136074-1007 F2DE
136
 
               27F       136074-1006 xxxx (byte checksum unreadable)
137
 
               2N        136074-1013 A5A0
138
 
               2S        136074-1014 567B
139
 
               2U        136074-1017 BB88
140
 
               4N        136074-1012 6B70
141
 
               4S        136074-1014 4475
142
 
               4U        136074-1016 42A5
143
 
               10R       136074-1011 041C
144
 
               10T       not populated
145
 
               14R       136074-1010 5E67
146
 
               14T       136074-1019 D4C4
147
 
 
148
 
      PALs   -
149
 
               PAL1 - Lattice GAL16V8 labelled '136074-1001'
150
 
               PAL2 - Lattice GAL16V8 labelled '136074-1005'
151
 
               PAL3 - Lattice GAL16V8 labelled '136074-1004'
152
 
               PAL4 - Lattice GAL16V8 labelled '136074-1003'
153
 
               PAL5 - Lattice GAL16V8 labelled '136074-1002'
154
 
               PAL6 - Lattice GAL16V8 labelled '136074-2000'
155
 
 
156
 
Measurements -
157
 
              X1    - 14.31995MHz
158
 
              VSync - 59.9310Hz
159
 
              HSync - 15.4611kHz
160
 
 
161
 
****************************************************************************/
162
 
 
163
 
 
164
 
#include "emu.h"
165
 
#include "cpu/z80/z80.h"
166
 
#include "cpu/m68000/m68000.h"
167
 
#include "cpu/m6502/m6502.h"
168
 
#include "sound/2151intf.h"
169
 
#include "video/atarimo.h"
170
 
#include "includes/badlands.h"
171
 
 
172
 
 
173
 
 
174
 
/*************************************
175
 
 *
176
 
 *  Initialization
177
 
 *
178
 
 *************************************/
179
 
 
180
 
static void update_interrupts(running_machine &machine)
181
 
{
182
 
        badlands_state *state = machine.driver_data<badlands_state>();
183
 
        cputag_set_input_line(machine, "maincpu", 1, state->m_video_int_state ? ASSERT_LINE : CLEAR_LINE);
184
 
        cputag_set_input_line(machine, "maincpu", 2, state->m_sound_int_state ? ASSERT_LINE : CLEAR_LINE);
185
 
}
186
 
 
187
 
 
188
 
static void scanline_update(screen_device &screen, int scanline)
189
 
{
190
 
        address_space *space = screen.machine().device("audiocpu")->memory().space(AS_PROGRAM);
191
 
 
192
 
        /* sound IRQ is on 32V */
193
 
        if (scanline & 32)
194
 
                atarigen_6502_irq_ack_r(space, 0);
195
 
        else if (!(input_port_read(screen.machine(), "FE4000") & 0x40))
196
 
                atarigen_6502_irq_gen(screen.machine().device("audiocpu"));
197
 
}
198
 
 
199
 
 
200
 
static MACHINE_START( badlands )
201
 
{
202
 
        badlands_state *state = machine.driver_data<badlands_state>();
203
 
 
204
 
        atarigen_init(machine);
205
 
 
206
 
        state->save_item(NAME(state->m_pedal_value));
207
 
}
208
 
 
209
 
 
210
 
static MACHINE_RESET( badlands )
211
 
{
212
 
        badlands_state *state = machine.driver_data<badlands_state>();
213
 
 
214
 
        state->m_pedal_value[0] = state->m_pedal_value[1] = 0x80;
215
 
 
216
 
        atarigen_eeprom_reset(state);
217
 
        atarigen_interrupt_reset(state, update_interrupts);
218
 
        atarigen_scanline_timer_reset(*machine.primary_screen, scanline_update, 32);
219
 
 
220
 
        atarigen_sound_io_reset(machine.device("audiocpu"));
221
 
        memcpy(state->m_bank_base, &state->m_bank_source_data[0x0000], 0x1000);
222
 
}
223
 
 
224
 
 
225
 
 
226
 
/*************************************
227
 
 *
228
 
 *  Interrupt handling
229
 
 *
230
 
 *************************************/
231
 
 
232
 
static INTERRUPT_GEN( vblank_int )
233
 
{
234
 
        badlands_state *state = device->machine().driver_data<badlands_state>();
235
 
        int pedal_state = input_port_read(device->machine(), "PEDALS");
236
 
        int i;
237
 
 
238
 
        /* update the pedals once per frame */
239
 
        for (i = 0; i < 2; i++)
240
 
        {
241
 
                state->m_pedal_value[i]--;
242
 
                if (pedal_state & (1 << i))
243
 
                        state->m_pedal_value[i]++;
244
 
        }
245
 
 
246
 
        atarigen_video_int_gen(device);
247
 
}
248
 
 
249
 
 
250
 
 
251
 
/*************************************
252
 
 *
253
 
 *  I/O read dispatch
254
 
 *
255
 
 *************************************/
256
 
 
257
 
static READ16_HANDLER( sound_busy_r )
258
 
{
259
 
        badlands_state *state = space->machine().driver_data<badlands_state>();
260
 
        int temp = 0xfeff;
261
 
        if (state->m_cpu_to_sound_ready) temp ^= 0x0100;
262
 
        return temp;
263
 
}
264
 
 
265
 
 
266
 
static READ16_HANDLER( pedal_0_r )
267
 
{
268
 
        badlands_state *state = space->machine().driver_data<badlands_state>();
269
 
        return state->m_pedal_value[0];
270
 
}
271
 
 
272
 
 
273
 
static READ16_HANDLER( pedal_1_r )
274
 
{
275
 
        badlands_state *state = space->machine().driver_data<badlands_state>();
276
 
        return state->m_pedal_value[1];
277
 
}
278
 
 
279
 
 
280
 
 
281
 
/*************************************
282
 
 *
283
 
 *  Audio I/O handlers
284
 
 *
285
 
 *************************************/
286
 
 
287
 
static READ8_HANDLER( audio_io_r )
288
 
{
289
 
        badlands_state *state = space->machine().driver_data<badlands_state>();
290
 
        int result = 0xff;
291
 
 
292
 
        switch (offset & 0x206)
293
 
        {
294
 
                case 0x000:             /* n/c */
295
 
                        logerror("audio_io_r: Unknown read at %04X\n", offset & 0x206);
296
 
                        break;
297
 
 
298
 
                case 0x002:             /* /RDP */
299
 
                        result = atarigen_6502_sound_r(space, offset);
300
 
                        break;
301
 
 
302
 
                case 0x004:             /* /RDIO */
303
 
                        /*
304
 
                0x80 = self test
305
 
                0x40 = NMI line state (active low)
306
 
                0x20 = sound output full
307
 
                0x10 = self test
308
 
                0x08 = +5V
309
 
                0x04 = +5V
310
 
                0x02 = coin 2
311
 
                0x01 = coin 1
312
 
            */
313
 
                        result = input_port_read(space->machine(), "AUDIO");
314
 
                        if (!(input_port_read(space->machine(), "FE4000") & 0x0080)) result ^= 0x90;
315
 
                        if (state->m_cpu_to_sound_ready) result ^= 0x40;
316
 
                        if (state->m_sound_to_cpu_ready) result ^= 0x20;
317
 
                        result ^= 0x10;
318
 
                        break;
319
 
 
320
 
                case 0x006:             /* /IRQACK */
321
 
                        atarigen_6502_irq_ack_r(space, 0);
322
 
                        break;
323
 
 
324
 
                case 0x200:             /* /VOICE */
325
 
                case 0x202:             /* /WRP */
326
 
                case 0x204:             /* /WRIO */
327
 
                case 0x206:             /* /MIX */
328
 
                        logerror("audio_io_r: Unknown read at %04X\n", offset & 0x206);
329
 
                        break;
330
 
        }
331
 
 
332
 
        return result;
333
 
}
334
 
 
335
 
 
336
 
static WRITE8_HANDLER( audio_io_w )
337
 
{
338
 
        badlands_state *state = space->machine().driver_data<badlands_state>();
339
 
 
340
 
        switch (offset & 0x206)
341
 
        {
342
 
                case 0x000:             /* n/c */
343
 
                case 0x002:             /* /RDP */
344
 
                case 0x004:             /* /RDIO */
345
 
                        logerror("audio_io_w: Unknown write (%02X) at %04X\n", data & 0xff, offset & 0x206);
346
 
                        break;
347
 
 
348
 
                case 0x006:             /* /IRQACK */
349
 
                        atarigen_6502_irq_ack_r(space, 0);
350
 
                        break;
351
 
 
352
 
                case 0x200:             /* n/c */
353
 
                case 0x206:             /* n/c */
354
 
                        break;
355
 
 
356
 
                case 0x202:             /* /WRP */
357
 
                        atarigen_6502_sound_w(space, offset, data);
358
 
                        break;
359
 
 
360
 
                case 0x204:             /* WRIO */
361
 
                        /*
362
 
                0xc0 = bank address
363
 
                0x20 = coin counter 2
364
 
                0x10 = coin counter 1
365
 
                0x08 = n/c
366
 
                0x04 = n/c
367
 
                0x02 = n/c
368
 
                0x01 = YM2151 reset (active low)
369
 
            */
370
 
 
371
 
                        /* update the bank */
372
 
                        memcpy(state->m_bank_base, &state->m_bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000);
373
 
                        break;
374
 
        }
375
 
}
376
 
 
377
 
 
378
 
 
379
 
/*************************************
380
 
 *
381
 
 *  Main CPU memory handlers
382
 
 *
383
 
 *************************************/
384
 
 
385
 
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16 )
386
 
        AM_RANGE(0x000000, 0x03ffff) AM_ROM
387
 
        AM_RANGE(0xfc0000, 0xfc1fff) AM_READWRITE(sound_busy_r, atarigen_sound_reset_w)
388
 
        AM_RANGE(0xfd0000, 0xfd1fff) AM_READWRITE(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
389
 
        AM_RANGE(0xfe0000, 0xfe1fff) AM_WRITE(watchdog_reset16_w)
390
 
        AM_RANGE(0xfe2000, 0xfe3fff) AM_WRITE(atarigen_video_int_ack_w)
391
 
        AM_RANGE(0xfe4000, 0xfe5fff) AM_READ_PORT("FE4000")
392
 
        AM_RANGE(0xfe6000, 0xfe6001) AM_READ_PORT("FE6000")
393
 
        AM_RANGE(0xfe6002, 0xfe6003) AM_READ_PORT("FE6002")
394
 
        AM_RANGE(0xfe6004, 0xfe6005) AM_READ(pedal_0_r)
395
 
        AM_RANGE(0xfe6006, 0xfe6007) AM_READ(pedal_1_r)
396
 
        AM_RANGE(0xfe8000, 0xfe9fff) AM_WRITE(atarigen_sound_upper_w)
397
 
        AM_RANGE(0xfea000, 0xfebfff) AM_READ(atarigen_sound_upper_r)
398
 
        AM_RANGE(0xfec000, 0xfedfff) AM_WRITE(badlands_pf_bank_w)
399
 
        AM_RANGE(0xfee000, 0xfeffff) AM_WRITE(atarigen_eeprom_enable_w)
400
 
        AM_RANGE(0xffc000, 0xffc3ff) AM_RAM_WRITE(atarigen_expanded_666_paletteram_w) AM_BASE_GENERIC(paletteram)
401
 
        AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(atarigen_playfield_w) AM_BASE_MEMBER(badlands_state, m_playfield)
402
 
        AM_RANGE(0xfff000, 0xfff1ff) AM_READWRITE(atarimo_0_spriteram_r, atarimo_0_spriteram_expanded_w)
403
 
        AM_RANGE(0xfff200, 0xffffff) AM_RAM
404
 
ADDRESS_MAP_END
405
 
 
406
 
 
407
 
 
408
 
/*************************************
409
 
 *
410
 
 *  Sound CPU memory handlers
411
 
 *
412
 
 *************************************/
413
 
 
414
 
static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8 )
415
 
        AM_RANGE(0x0000, 0x1fff) AM_RAM
416
 
        AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE("ymsnd", ym2151_r, ym2151_w)
417
 
        AM_RANGE(0x2800, 0x2bff) AM_READWRITE(audio_io_r, audio_io_w)
418
 
        AM_RANGE(0x3000, 0xffff) AM_ROM
419
 
ADDRESS_MAP_END
420
 
 
421
 
 
422
 
 
423
 
/*************************************
424
 
 *
425
 
 *  Port definitions
426
 
 *
427
 
 *************************************/
428
 
 
429
 
static INPUT_PORTS_START( badlands )
430
 
        PORT_START("FE4000")    /* fe4000 */
431
 
        PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED )
432
 
        PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
433
 
        PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
434
 
        PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_VBLANK )
435
 
        PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
436
 
        PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
437
 
 
438
 
        PORT_START("FE6000")    /* fe6000 */
439
 
        PORT_BIT( 0x00ff, 0, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
440
 
        PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
441
 
 
442
 
        PORT_START("FE6002")    /* fe6002 */
443
 
        PORT_BIT( 0x00ff, 0, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
444
 
        PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
445
 
 
446
 
        PORT_START("AUDIO")             /* audio port */
447
 
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
448
 
        PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
449
 
        PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )
450
 
        PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
451
 
        PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* self test */
452
 
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* response buffer full */
453
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SPECIAL )    /* command buffer full */
454
 
        PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* self test */
455
 
 
456
 
        PORT_START("PEDALS")    /* fake for pedals */
457
 
        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
458
 
        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
459
 
        PORT_BIT( 0xfffc, IP_ACTIVE_HIGH, IPT_UNUSED )
460
 
INPUT_PORTS_END
461
 
 
462
 
 
463
 
 
464
 
/*************************************
465
 
 *
466
 
 *  Graphics definitions
467
 
 *
468
 
 *************************************/
469
 
 
470
 
static const gfx_layout pflayout =
471
 
{
472
 
        8,8,
473
 
        RGN_FRAC(1,1),
474
 
        4,
475
 
        { 0, 1, 2, 3 },
476
 
        { 0, 4, 8, 12, 16, 20, 24, 28 },
477
 
        { 0*8, 4*8, 8*8, 12*8, 16*8, 20*8, 24*8, 28*8 },
478
 
        32*8
479
 
};
480
 
 
481
 
 
482
 
static const gfx_layout molayout =
483
 
{
484
 
        16,8,
485
 
        RGN_FRAC(1,1),
486
 
        4,
487
 
        { 0, 1, 2, 3 },
488
 
        { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60 },
489
 
        { 0*8, 8*8, 16*8, 24*8, 32*8, 40*8, 48*8, 56*8 },
490
 
        64*8
491
 
};
492
 
 
493
 
 
494
 
static GFXDECODE_START( badlands )
495
 
        GFXDECODE_ENTRY( "gfx1", 0, pflayout,    0, 8 )
496
 
        GFXDECODE_ENTRY( "gfx2", 0, molayout,  128, 8 )
497
 
GFXDECODE_END
498
 
 
499
 
 
500
 
 
501
 
/*************************************
502
 
 *
503
 
 *  Machine driver
504
 
 *
505
 
 *************************************/
506
 
 
507
 
static MACHINE_CONFIG_START( badlands, badlands_state )
508
 
 
509
 
        /* basic machine hardware */
510
 
        MCFG_CPU_ADD("maincpu", M68000, ATARI_CLOCK_14MHz/2)
511
 
        MCFG_CPU_PROGRAM_MAP(main_map)
512
 
        MCFG_CPU_VBLANK_INT("screen", vblank_int)
513
 
 
514
 
        MCFG_CPU_ADD("audiocpu", M6502, ATARI_CLOCK_14MHz/8)
515
 
        MCFG_CPU_PROGRAM_MAP(audio_map)
516
 
 
517
 
        MCFG_MACHINE_START(badlands)
518
 
        MCFG_MACHINE_RESET(badlands)
519
 
        MCFG_NVRAM_ADD_1FILL("eeprom")
520
 
 
521
 
        /* video hardware */
522
 
        MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
523
 
        MCFG_GFXDECODE(badlands)
524
 
        MCFG_PALETTE_LENGTH(256)
525
 
 
526
 
        MCFG_SCREEN_ADD("screen", RASTER)
527
 
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
528
 
        /* note: these parameters are from published specs, not derived */
529
 
        /* the board uses an SOS-2 chip to generate video signals */
530
 
        MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240)
531
 
        MCFG_SCREEN_UPDATE(badlands)
532
 
 
533
 
        MCFG_VIDEO_START(badlands)
534
 
 
535
 
        /* sound hardware */
536
 
        MCFG_SPEAKER_STANDARD_MONO("mono")
537
 
 
538
 
        MCFG_SOUND_ADD("ymsnd", YM2151, ATARI_CLOCK_14MHz/4)
539
 
        MCFG_SOUND_ROUTE(0, "mono", 0.30)
540
 
        MCFG_SOUND_ROUTE(1, "mono", 0.30)
541
 
MACHINE_CONFIG_END
542
 
 
543
 
 
544
 
 
545
 
/*************************************
546
 
 *
547
 
 *  ROM definition(s)
548
 
 *
549
 
 *************************************/
550
 
 
551
 
ROM_START( badlands )
552
 
        ROM_REGION( 0x40000, "maincpu", 0 )     /* 4*64k for 68000 code */
553
 
        ROM_LOAD16_BYTE( "136074-1008.20f",  0x00000, 0x10000, CRC(a3da5774) SHA1(5ab1eb61d25594b2d7c40400cb57e7f47a717598) )
554
 
        ROM_LOAD16_BYTE( "136074-1006.27f",  0x00001, 0x10000, CRC(aa03b4f3) SHA1(5eda60c715ffcefd4ad34bdb90579e8671dc384a) )
555
 
        ROM_LOAD16_BYTE( "136074-1009.17f",  0x20000, 0x10000, CRC(0e2e807f) SHA1(5b61de066dca12c44335aa68a13c821845657866) )
556
 
        ROM_LOAD16_BYTE( "136074-1007.24f",  0x20001, 0x10000, CRC(99a20c2c) SHA1(9b0a5a5dafb8816e72330d302c60339b600b49a8) )
557
 
 
558
 
        ROM_REGION( 0x14000, "audiocpu", 0 )    /* 64k for 6502 code */
559
 
        ROM_LOAD( "136074-1018.9c", 0x10000, 0x4000, CRC(a05fd146) SHA1(d97abbcf7897ca720cc18ff3a323f41cd3b23c34) )
560
 
        ROM_CONTINUE(               0x04000, 0xc000 )
561
 
 
562
 
        ROM_REGION( 0x60000, "gfx1", ROMREGION_INVERT )
563
 
        ROM_LOAD( "136074-1012.4n",  0x000000, 0x10000, CRC(5d124c6c) SHA1(afebaaf90b3751f5e873fc4c45f1d5385ef86a6e) )  /* playfield */
564
 
        ROM_LOAD( "136074-1013.2n",  0x010000, 0x10000, CRC(b1ec90d6) SHA1(8d4c7db8e1bf9c050f5869eb38fa573867fdc12b) )
565
 
        ROM_LOAD( "136074-1014.4s",  0x020000, 0x10000, CRC(248a6845) SHA1(086ef0840b889e790ce3fcd09f98589aae932456) )
566
 
        ROM_LOAD( "136074-1015.2s",  0x030000, 0x10000, CRC(792296d8) SHA1(833cdb968064151ca77bb3dbe416ff7127a12de4) )
567
 
        ROM_LOAD( "136074-1016.4u",  0x040000, 0x10000, CRC(878f7c66) SHA1(31159bea5d6aac8100fca8f3860220b97d63e72e) )
568
 
        ROM_LOAD( "136074-1017.2u",  0x050000, 0x10000, CRC(ad0071a3) SHA1(472b197e5d320b3424d8a8d8c051b1023a07ae08) )
569
 
 
570
 
        ROM_REGION( 0x30000, "gfx2", ROMREGION_INVERT )
571
 
        ROM_LOAD( "136074-1010.14r", 0x000000, 0x10000, CRC(c15f629e) SHA1(944e3479dce6e420cf9a3f4c1438c5ca66e5cb97) )  /* mo */
572
 
        ROM_LOAD( "136074-1011.10r", 0x010000, 0x10000, CRC(fb0b6717) SHA1(694ab0f04d673682831a24027757d4b3c40a4e0e) )
573
 
        ROM_LOAD( "136074-1019.14t", 0x020000, 0x10000, CRC(0e26bff6) SHA1(ee018dd37a27c7e7c16a57ea0d32aeb9cdf26bb4) )
574
 
 
575
 
        ROM_REGION( 0x0800, "plds", 0 )
576
 
        ROM_LOAD( "gal16v8-1001.26c",  0x0000, 0x0117, CRC(04c3be6a) SHA1(f027834e652f3ff778b09c3754294b303f9ed826) )
577
 
        ROM_LOAD( "gal16v8-1002.21r",  0x0200, 0x0117, CRC(f68bf41d) SHA1(72edd6d0f5d55d39c0020f384149de7ac964f273) )
578
 
        ROM_LOAD( "gal16v8-1003.16s",  0x0400, 0x0117, CRC(a288bbd0) SHA1(62f5900ac88ffb335257f58d892492f370805498) )
579
 
        ROM_LOAD( "gal16v8-1005.12e",  0x0600, 0x0117, CRC(9df77c79) SHA1(52c1c190b80db9b9bc43ce6eefd5f37ac16e590c) )
580
 
ROM_END
581
 
 
582
 
 
583
 
 
584
 
/*************************************
585
 
 *
586
 
 *  Driver initialization
587
 
 *
588
 
 *************************************/
589
 
 
590
 
static DRIVER_INIT( badlands )
591
 
{
592
 
        badlands_state *state = machine.driver_data<badlands_state>();
593
 
 
594
 
        /* initialize the audio system */
595
 
        state->m_bank_base = &machine.region("audiocpu")->base()[0x03000];
596
 
        state->m_bank_source_data = &machine.region("audiocpu")->base()[0x10000];
597
 
}
598
 
 
599
 
 
600
 
 
601
 
/*************************************
602
 
 *
603
 
 *  Game driver(s)
604
 
 *
605
 
 *************************************/
606
 
 
607
 
GAME( 1989, badlands, 0, badlands, badlands, badlands, ROT0, "Atari Games", "Bad Lands", 0 )
608
 
 
609
 
/* Badlands - Playmark Bootleg support - split this into its own file?
610
 
 
611
 
 Year: 1989
612
 
 Producer: Playmark
613
 
 
614
 
 cpu: 68000
615
 
 sound cpu:  Z80
616
 
 sound ics: YM2151 + 3012
617
 
 
618
 
 other ics: 28c16 2kx8 eeprom.Used to store bookeeping,settings etc. like original pcb.
619
 
 
620
 
 Osc: 20 Mhz, 28 Mhz
621
 
 
622
 
 ROMs:
623
 
 
624
 
 blb21, blb22, blb27, blb28 main program
625
 
 blb26 sound program
626
 
 blb29 to blb40 graphics
627
 
 
628
 
 All eproms are 27c512
629
 
 
630
 
 Note
631
 
 
632
 
 This romset comes from a bootleg pcb produced by Playmark.This pcb was been modified to use as control standard joysticks instead of steering wheels.Game differences are: Copyright string removed.
633
 
 
634
 
*/
635
 
 
636
 
static READ16_HANDLER( badlandsb_unk_r )
637
 
{
638
 
 
639
 
        return 0xffff;
640
 
}
641
 
 
642
 
static ADDRESS_MAP_START( bootleg_map, AS_PROGRAM, 16 )
643
 
        AM_RANGE(0x000000, 0x03ffff) AM_ROM
644
 
 
645
 
 
646
 
        AM_RANGE(0x400008, 0x400009) AM_READ(badlandsb_unk_r )
647
 
        AM_RANGE(0x4000fe, 0x4000ff) AM_READ(badlandsb_unk_r )
648
 
 
649
 
        AM_RANGE(0xfc0000, 0xfc0001) AM_READ(badlandsb_unk_r )
650
 
 
651
 
        AM_RANGE(0xfe4000, 0xfe4001) AM_READ(badlandsb_unk_r )
652
 
        AM_RANGE(0xfe4004, 0xfe4005) AM_READ(badlandsb_unk_r )
653
 
        AM_RANGE(0xfe4006, 0xfe4007) AM_READ(badlandsb_unk_r )
654
 
 
655
 
 
656
 
        AM_RANGE(0xfd0000, 0xfd1fff) AM_READWRITE(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom")
657
 
        //AM_RANGE(0xfe0000, 0xfe1fff) AM_WRITE(watchdog_reset16_w)
658
 
        AM_RANGE(0xfe2000, 0xfe3fff) AM_WRITE(atarigen_video_int_ack_w)
659
 
 
660
 
        AM_RANGE(0xfec000, 0xfedfff) AM_WRITE(badlands_pf_bank_w)
661
 
        AM_RANGE(0xfee000, 0xfeffff) AM_WRITE(atarigen_eeprom_enable_w)
662
 
        AM_RANGE(0xffc000, 0xffc3ff) AM_RAM_WRITE(atarigen_expanded_666_paletteram_w) AM_BASE_GENERIC(paletteram)
663
 
        AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(atarigen_playfield_w) AM_BASE_MEMBER(badlands_state, m_playfield)
664
 
        AM_RANGE(0xfff000, 0xfff1ff) AM_READWRITE(atarimo_0_spriteram_r, atarimo_0_spriteram_expanded_w)
665
 
        AM_RANGE(0xfff200, 0xffffff) AM_RAM
666
 
ADDRESS_MAP_END
667
 
 
668
 
 
669
 
static const gfx_layout pflayout_bootleg =
670
 
{
671
 
        8,8,
672
 
        RGN_FRAC(1,4),
673
 
        4,
674
 
        { RGN_FRAC(0,4), RGN_FRAC(1,4), RGN_FRAC(2,4), RGN_FRAC(3,4) },
675
 
        { 0, 1, 2, 3, 4, 5, 6, 7 },
676
 
        { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
677
 
        8*8
678
 
};
679
 
 
680
 
static GFXDECODE_START( badlandsb )
681
 
        GFXDECODE_ENTRY( "gfx1", 0, pflayout_bootleg,    0, 8 )
682
 
        GFXDECODE_ENTRY( "gfx2", 0, molayout,  128, 8 )
683
 
GFXDECODE_END
684
 
 
685
 
static void update_interrupts_bootleg(running_machine &machine)
686
 
{
687
 
        badlands_state *state = machine.driver_data<badlands_state>();
688
 
        cputag_set_input_line(machine, "maincpu", 1, state->m_video_int_state ? ASSERT_LINE : CLEAR_LINE);
689
 
}
690
 
 
691
 
 
692
 
static void scanline_update_bootleg(screen_device &screen, int scanline)
693
 
{
694
 
        /* sound IRQ is on 32V */
695
 
//  if (scanline & 32)
696
 
//      atarigen_6502_irq_ack_r(screen->machine(), 0);
697
 
//  else if (!(input_port_read(machine, "FE4000") & 0x40))
698
 
//      atarigen_6502_irq_gen(screen->machine().device("audiocpu"));
699
 
}
700
 
 
701
 
 
702
 
 
703
 
static MACHINE_RESET( badlandsb )
704
 
{
705
 
        badlands_state *state = machine.driver_data<badlands_state>();
706
 
//  state->m_pedal_value[0] = state->m_pedal_value[1] = 0x80;
707
 
 
708
 
        atarigen_eeprom_reset(state);
709
 
        atarigen_interrupt_reset(state, update_interrupts_bootleg);
710
 
        atarigen_scanline_timer_reset(*machine.primary_screen, scanline_update_bootleg, 32);
711
 
 
712
 
//  atarigen_sound_io_reset(machine.device("audiocpu"));
713
 
//  memcpy(state->m_bank_base, &state->m_bank_source_data[0x0000], 0x1000);
714
 
}
715
 
 
716
 
static MACHINE_CONFIG_START( badlandsb, badlands_state )
717
 
 
718
 
        /* basic machine hardware */
719
 
        MCFG_CPU_ADD("maincpu", M68000, XTAL_28MHz/4)   /* Divisor estimated */
720
 
        MCFG_CPU_PROGRAM_MAP(bootleg_map)
721
 
        MCFG_CPU_VBLANK_INT("screen", vblank_int)
722
 
 
723
 
//  MCFG_CPU_ADD("audiocpu", Z80, XTAL_20MHz/12)    /* Divisor estimated */
724
 
//  MCFG_CPU_PROGRAM_MAP(bootleg_soundmap)
725
 
 
726
 
        MCFG_MACHINE_START(badlands)
727
 
        MCFG_MACHINE_RESET(badlandsb)
728
 
        MCFG_NVRAM_ADD_1FILL("eeprom")
729
 
 
730
 
        /* video hardware */
731
 
        MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
732
 
        MCFG_GFXDECODE(badlandsb)
733
 
        MCFG_PALETTE_LENGTH(256)
734
 
 
735
 
        MCFG_SCREEN_ADD("screen", RASTER)
736
 
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
737
 
        /* note: these parameters are from published specs, not derived */
738
 
        /* the board uses an SOS-2 chip to generate video signals */
739
 
        MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240)
740
 
        MCFG_SCREEN_UPDATE(badlands)
741
 
 
742
 
        MCFG_VIDEO_START(badlands)
743
 
 
744
 
        /* sound hardware */
745
 
        MCFG_SPEAKER_STANDARD_MONO("mono")
746
 
 
747
 
        MCFG_SOUND_ADD("ymsnd", YM2151, XTAL_20MHz/8)   /* Divisor estimated */
748
 
        MCFG_SOUND_ROUTE(0, "mono", 0.30)
749
 
        MCFG_SOUND_ROUTE(1, "mono", 0.30)
750
 
MACHINE_CONFIG_END
751
 
 
752
 
 
753
 
 
754
 
/* bootleg by Playmark, uses Joystick controls */
755
 
ROM_START( badlandsb )
756
 
        /* bootleg 68k Program */
757
 
        ROM_REGION( 0x40000, "maincpu", 0 )     /* 4*64k for 68000 code */
758
 
        ROM_LOAD16_BYTE( "blb28.ic21",  0x00000, 0x10000, CRC(dffb025d) SHA1(f2c17607acbbeee7d5d3f3dd2e8dc768b755e991) )
759
 
        ROM_LOAD16_BYTE( "blb22.ic22",  0x00001, 0x10000, CRC(ca3015c4) SHA1(72e1451498143d920239487704f4b4a8a71410e0) )
760
 
        ROM_LOAD16_BYTE( "blb27.ic19",  0x20000, 0x10000, CRC(0e2e807f) SHA1(5b61de066dca12c44335aa68a13c821845657866) )
761
 
        ROM_LOAD16_BYTE( "blb21.ic20",  0x20001, 0x10000, CRC(99a20c2c) SHA1(9b0a5a5dafb8816e72330d302c60339b600b49a8) )
762
 
 
763
 
        /* Z80 on the bootleg! */
764
 
        ROM_REGION( 0x10000, "cpu1", 0 )
765
 
        ROM_LOAD( "blb26.ic27", 0x00000, 0x10000, CRC(59503ab4) SHA1(ea5686ee28f6125c1394d687cc35c6322c8f900c) )
766
 
 
767
 
        /* the 2nd half of 122,123,124 and 125 is identical to the first half and not used */
768
 
        ROM_REGION( 0x80000, "gfx1", 0 )
769
 
        ROM_LOAD( "blb36.ic123",  0x000000, 0x10000, BAD_DUMP CRC(d7978eeb) SHA1(1adc95bebe9eea8c112d40cd04ab7a8d75c4f961) ) /* bad dump -- empty */
770
 
        ROM_LOAD( "blb37.ic92",   0x008000, 0x10000, CRC(9188db9f) SHA1(8f7dc2c4c0dec9a80b6214a2efaa0de0858de84c) )
771
 
        ROM_LOAD( "blb38.ic125",  0x020000, 0x10000, CRC(4839dd54) SHA1(031efbc144e5e088be0f3576aa514c7c2b775f6d) )
772
 
        ROM_LOAD( "blb31.ic91",   0x028000, 0x10000, BAD_DUMP CRC(77e3dabc) SHA1(fa3c93f37ab11cfe82cf17c25ec2f9b8bee8a64e) ) /* bad dump -- BADADDR        xxxx-xxxxxxxxxxx */
773
 
        ROM_LOAD( "blb30.ic122",  0x040000, 0x10000, CRC(61a1bcec) SHA1(fd38bbf8f6c8d1e0e936740db757f9fa85753503) )
774
 
        ROM_LOAD( "blb35.ic90",   0x048000, 0x10000, CRC(649c17f0) SHA1(bed3b7fc2c0516fe309bb81b65d8925ecf3065e4) )
775
 
        ROM_LOAD( "blb32.ic124",  0x060000, 0x10000, CRC(a67c61ba) SHA1(d701eb7f4520b57be54a7113d39f81d52800ee7e) )
776
 
        ROM_LOAD( "blb29.ic88",   0x068000, 0x10000, CRC(a9f280e5) SHA1(daff021d14f17da8c4469270a1e50e5a01d05d49) )
777
 
 
778
 
        /* the 1st half of 67 & 68 are empty and not used */
779
 
        ROM_REGION( 0x40000, "gfx2", 0 )
780
 
        ROM_LOAD16_BYTE( "blb33.ic67", 0x10001, 0x10000, CRC(aebf9938) SHA1(3778aacbde07e5a5d010e41ab62d5b0db8632ad8) )
781
 
        ROM_LOAD16_BYTE( "blb34.ic34", 0x00001, 0x10000, CRC(3eac30a5) SHA1(deefc668185bf30ad3eeba73853f97ce12b85293) )
782
 
        ROM_LOAD16_BYTE( "blb39.ic68", 0x10000, 0x10000, CRC(f398f2d7) SHA1(1eef64680101888425490eb4d5b86072e59753cf) )
783
 
        ROM_LOAD16_BYTE( "blb40.ic35", 0x00000, 0x10000, CRC(b47679ee) SHA1(0bd7d40dad214c54021c2014efbd374a7e4c7a3f) )
784
 
ROM_END
785
 
 
786
 
 
787
 
GAME( 1989, badlandsb, badlands, badlandsb, badlands, 0, ROT0, "bootleg (Playmark)", "Bad Lands (bootleg)", GAME_NOT_WORKING )