~ubuntu-branches/ubuntu/lucid/sdlmame/lucid

« back to all changes in this revision

Viewing changes to src/mame/drivers/tgtpanic.c

  • Committer: Bazaar Package Importer
  • Author(s): Cesare Falco
  • Date: 2009-11-03 17:10:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20091103171015-6hop4ory5lxnumpn
Tags: 0.135-0ubuntu1
* New upstream release - Closes (LP: #403212)
* debian/watch: unstable releases are no longer detected
* mame.ini: added the cheat subdirectories to cheatpath so zipped
  cheatfiles will be searched too
* renamed crsshair subdirectory to crosshair to reflect upstream change
* mame.ini: renamed references to crosshair subdirectory (see above)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 
 
3
    Konami Target Panic (cabinet test PCB)
 
4
 
 
5
    driver by Phil Bennett
 
6
 
 
7
    TODO: Determine correct clock frequencies, fix 'stuck' inputs in
 
8
    test mode
 
9
 
 
10
***************************************************************************/
 
11
 
 
12
#include "driver.h"
 
13
#include "cpu/z80/z80.h"
 
14
 
 
15
static UINT8 *ram;
 
16
static UINT8 color;
 
17
 
 
18
 
 
19
/*************************************
 
20
 *
 
21
 *  Video hardware
 
22
 *
 
23
 *************************************/
 
24
 
 
25
static VIDEO_UPDATE( tgtpanic )
 
26
{
 
27
        UINT32 colors[4];
 
28
        UINT32 offs;
 
29
        UINT32 x, y;
 
30
 
 
31
        colors[0] = 0;
 
32
        colors[1] = 0xffffffff;
 
33
        colors[2] = MAKE_RGB(pal1bit(color >> 2), pal1bit(color >> 1), pal1bit(color >> 0));
 
34
        colors[3] = MAKE_RGB(pal1bit(color >> 6), pal1bit(color >> 5), pal1bit(color >> 4));
 
35
 
 
36
        for (offs = 0; offs < 0x2000; ++offs)
 
37
        {
 
38
                UINT8 val = ram[offs];
 
39
 
 
40
                y = (offs & 0x7f) << 1;
 
41
                x = (offs >> 7) << 2;
 
42
 
 
43
                /* I'm guessing the hardware doubles lines */
 
44
                *BITMAP_ADDR32(bitmap, y + 0, x + 0) = colors[val & 3];
 
45
                *BITMAP_ADDR32(bitmap, y + 1, x + 0) = colors[val & 3];
 
46
                val >>= 2;
 
47
                *BITMAP_ADDR32(bitmap, y + 0, x + 1) = colors[val & 3];
 
48
                *BITMAP_ADDR32(bitmap, y + 1, x + 1) = colors[val & 3];
 
49
                val >>= 2;
 
50
                *BITMAP_ADDR32(bitmap, y + 0, x + 2) = colors[val & 3];
 
51
                *BITMAP_ADDR32(bitmap, y + 1, x + 2) = colors[val & 3];
 
52
                val >>= 2;
 
53
                *BITMAP_ADDR32(bitmap, y + 0, x + 3) = colors[val & 3];
 
54
                *BITMAP_ADDR32(bitmap, y + 1, x + 3) = colors[val & 3];
 
55
        }
 
56
 
 
57
        return 0;
 
58
}
 
59
 
 
60
static WRITE8_HANDLER( color_w )
 
61
{
 
62
        video_screen_update_partial(space->machine->primary_screen, video_screen_get_vpos(space->machine->primary_screen));
 
63
        color = data;
 
64
}
 
65
 
 
66
 
 
67
/*************************************
 
68
 *
 
69
 *  Address maps
 
70
 *
 
71
 *************************************/
 
72
 
 
73
static ADDRESS_MAP_START( prg_map, ADDRESS_SPACE_PROGRAM, 8 )
 
74
        AM_RANGE(0x0000, 0x7fff) AM_ROM
 
75
        AM_RANGE(0x8000, 0xbfff) AM_RAM AM_BASE(&ram)
 
76
ADDRESS_MAP_END
 
77
 
 
78
static ADDRESS_MAP_START( io_map, ADDRESS_SPACE_IO, 8 )
 
79
        ADDRESS_MAP_GLOBAL_MASK(0xff)
 
80
        AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(color_w)
 
81
        AM_RANGE(0x01, 0x01) AM_READ_PORT("IN1")
 
82
ADDRESS_MAP_END
 
83
 
 
84
 
 
85
/*************************************
 
86
 *
 
87
 *  Inputs
 
88
 *
 
89
 *************************************/
 
90
 
 
91
static INPUT_PORTS_START( tgtpanic )
 
92
        PORT_START("IN0")
 
93
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
 
94
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
 
95
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
 
96
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
 
97
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
 
98
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
 
99
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
 
100
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
 
101
 
 
102
        PORT_START("IN1")
 
103
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
 
104
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE )
 
105
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
 
106
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
 
107
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
 
108
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
 
109
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
 
110
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
 
111
INPUT_PORTS_END
 
112
 
 
113
 
 
114
/*************************************
 
115
 *
 
116
 *  Machine driver
 
117
 *
 
118
 *************************************/
 
119
 
 
120
static MACHINE_DRIVER_START( tgtpanic )
 
121
 
 
122
        /* basic machine hardware */
 
123
        MDRV_CPU_ADD("cpu", Z80, XTAL_4MHz)
 
124
        MDRV_CPU_PROGRAM_MAP(prg_map)
 
125
        MDRV_CPU_IO_MAP(io_map)
 
126
        MDRV_CPU_PERIODIC_INT(irq0_line_hold, 20) /* Unverified */
 
127
 
 
128
        /* video hardware */
 
129
        MDRV_VIDEO_UPDATE(tgtpanic)
 
130
 
 
131
        MDRV_SCREEN_ADD("screen", RASTER)
 
132
        MDRV_SCREEN_REFRESH_RATE(60) /* Unverified */
 
133
        MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* Unverified */
 
134
        MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
 
135
        MDRV_SCREEN_SIZE(256, 256)
 
136
        MDRV_SCREEN_VISIBLE_AREA(0, 192 - 1, 0, 192 - 1)
 
137
MACHINE_DRIVER_END
 
138
 
 
139
 
 
140
 /*************************************
 
141
 *
 
142
 *  ROM definition
 
143
 *
 
144
 *************************************/
 
145
 
 
146
ROM_START( tgtpanic )
 
147
        ROM_REGION( 0x10000, "cpu", 0 )
 
148
        ROM_LOAD( "601_ja_a01.13e", 0x0000, 0x8000, CRC(ece71952) SHA1(0f9cbd8adac2b1950bc608d51f0f122399c8f00f) )
 
149
ROM_END
 
150
 
 
151
 
 
152
/*************************************
 
153
 *
 
154
 *  Game driver
 
155
 *
 
156
 *************************************/
 
157
 
 
158
GAME( 1996, tgtpanic, 0, tgtpanic, tgtpanic, 0, ROT0, "Konami", "Target Panic", GAME_NO_SOUND )