trunk/src/mame/drivers/flicker.c
r17422 | r17423 | |
12 | 12 | Some clues from PinMAME |
13 | 13 | |
14 | 14 | ToDo: |
15 | | - Add remaining inputs |
| 15 | - Better artwork |
| 16 | - It freezes when F3 pressed or game tilted |
16 | 17 | |
17 | 18 | |
18 | 19 | ************************************************************************************/ |
19 | 20 | |
20 | 21 | #include "emu.h" |
21 | 22 | #include "cpu/i4004/i4004.h" |
| 23 | #include "sound/beep.h" |
22 | 24 | #include "flicker.lh" |
23 | 25 | |
24 | 26 | class flicker_state : public driver_device |
r17422 | r17423 | |
26 | 28 | public: |
27 | 29 | flicker_state(const machine_config &mconfig, device_type type, const char *tag) |
28 | 30 | : driver_device(mconfig, type, tag), |
29 | | m_maincpu(*this, "maincpu") |
| 31 | m_maincpu(*this, "maincpu"), |
| 32 | m_beeper(*this, BEEPER_TAG) |
30 | 33 | { } |
| 34 | |
31 | 35 | DECLARE_WRITE8_MEMBER(port00_w); |
32 | 36 | DECLARE_WRITE8_MEMBER(port01_w); |
33 | 37 | DECLARE_WRITE8_MEMBER(port10_w); |
r17422 | r17423 | |
37 | 41 | |
38 | 42 | // devices |
39 | 43 | required_device<cpu_device> m_maincpu; |
| 44 | required_device<device_t> m_beeper; |
40 | 45 | |
41 | 46 | // driver_device overrides |
42 | 47 | virtual void machine_reset(); |
43 | | public: |
44 | | DECLARE_DRIVER_INIT(flicker); |
45 | 48 | }; |
46 | 49 | |
47 | 50 | |
r17422 | r17423 | |
53 | 56 | AM_RANGE(0x0000, 0x00FF) AM_RAM |
54 | 57 | ADDRESS_MAP_END |
55 | 58 | |
56 | | static ADDRESS_MAP_START( flicker_io , AS_IO, 8, flicker_state ) |
| 59 | static ADDRESS_MAP_START( flicker_io, AS_IO, 8, flicker_state ) |
57 | 60 | AM_RANGE(0x0000, 0x0000) AM_WRITE(port00_w) |
58 | 61 | AM_RANGE(0x0001, 0x0001) AM_WRITE(port01_w) |
59 | 62 | AM_RANGE(0x0002, 0x0002) AM_READ(port02_r) |
60 | 63 | AM_RANGE(0x0010, 0x0010) AM_WRITE(port10_w) |
61 | 64 | ADDRESS_MAP_END |
62 | 65 | |
63 | | // from us patent 4093232 |
64 | 66 | static INPUT_PORTS_START( flicker ) |
65 | 67 | PORT_START("TEST") |
66 | 68 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Door Slam") PORT_CODE(KEYCODE_HOME) |
67 | | PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("4 coins") |
68 | | PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3 coins") |
69 | | PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2 coins") |
70 | 69 | PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("1 coin credit") PORT_CODE(KEYCODE_5) |
71 | 70 | PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2 credit") PORT_CODE(KEYCODE_6) |
72 | 71 | PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3 credit") PORT_CODE(KEYCODE_7) |
r17422 | r17423 | |
75 | 74 | PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("6 credit") PORT_CODE(KEYCODE_0) |
76 | 75 | PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Tilt") PORT_CODE(KEYCODE_T) |
77 | 76 | PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Start") PORT_CODE(KEYCODE_1) |
78 | | PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Test") PORT_CODE(KEYCODE_W) |
| 77 | PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Test") |
79 | 78 | |
| 79 | PORT_START("B0") |
| 80 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left Lane Target") PORT_CODE(KEYCODE_W) |
| 81 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("/B Target") PORT_CODE(KEYCODE_E) |
| 82 | PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left Lane 1000") PORT_CODE(KEYCODE_R) |
| 83 | PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("/A Target") PORT_CODE(KEYCODE_Y) |
80 | 84 | PORT_START("B1") |
81 | | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bumper") PORT_CODE(KEYCODE_M) |
| 85 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right Lane Target") PORT_CODE(KEYCODE_U) |
| 86 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("/C Target") PORT_CODE(KEYCODE_I) |
| 87 | PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right Lane 1000") PORT_CODE(KEYCODE_O) |
| 88 | PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("/D Target") PORT_CODE(KEYCODE_A) |
| 89 | PORT_START("B2") |
| 90 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Spinner") PORT_CODE(KEYCODE_S) |
| 91 | PORT_START("B3") |
| 92 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("10's Target") PORT_CODE(KEYCODE_D) |
| 93 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("100's Target") PORT_CODE(KEYCODE_F) |
| 94 | PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Pot Bumper") PORT_CODE(KEYCODE_G) |
| 95 | PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3000 Hole") PORT_CODE(KEYCODE_H) |
| 96 | PORT_START("B4") |
| 97 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("1000 Bonus") PORT_CODE(KEYCODE_J) |
| 98 | PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("500 Target") PORT_CODE(KEYCODE_K) |
| 99 | PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Out Hole") PORT_CODE(KEYCODE_X) |
| 100 | PORT_START("B5") |
| 101 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left 500 Out") PORT_CODE(KEYCODE_L) |
| 102 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left Bumper") PORT_CODE(KEYCODE_Z) |
| 103 | PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right 500 Out") PORT_CODE(KEYCODE_C) |
| 104 | PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right Bumper") PORT_CODE(KEYCODE_V) |
| 105 | PORT_START("B6") |
| 106 | PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("A Target") PORT_CODE(KEYCODE_B) |
| 107 | PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("B target") PORT_CODE(KEYCODE_N) |
| 108 | PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C target") PORT_CODE(KEYCODE_M) |
| 109 | PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("D Target") PORT_CODE(KEYCODE_COMMA) |
82 | 110 | INPUT_PORTS_END |
83 | 111 | |
84 | 112 | READ8_MEMBER( flicker_state::port02_r ) |
85 | 113 | { |
86 | 114 | offset = cpu_get_reg(m_maincpu, I4004_RAM) - 0x20; // we need the full address |
87 | 115 | |
88 | | if (offset == 0) |
89 | | return ioport("B1")->read(); |
90 | | else |
91 | | return 0; |
| 116 | if (offset < 7) |
| 117 | { |
| 118 | char kbdrow[6]; |
| 119 | sprintf(kbdrow,"B%X",offset); |
| 120 | return ioport(kbdrow)->read(); |
| 121 | } |
| 122 | return 0; |
92 | 123 | } |
93 | 124 | |
94 | 125 | WRITE8_MEMBER( flicker_state::port00_w ) |
r17422 | r17423 | |
100 | 131 | |
101 | 132 | WRITE8_MEMBER( flicker_state::port01_w ) |
102 | 133 | { |
| 134 | // The output lines operate the various lamps (44 of them) |
103 | 135 | offset = cpu_get_reg(m_maincpu, I4004_RAM) - 0x10; // we need the full address |
104 | 136 | |
105 | 137 | if (offset < 0x10) |
r17422 | r17423 | |
108 | 140 | |
109 | 141 | WRITE8_MEMBER( flicker_state::port10_w ) |
110 | 142 | { |
111 | | //offset = cpu_get_reg(m_maincpu, I4004_RAM) - 0x10; // we need the full address |
| 143 | /* Outputs depend on data: |
| 144 | 1 = tens chime |
| 145 | 2 = hundreds chime |
| 146 | 3 = thousands chime |
| 147 | 4 = left bumper |
| 148 | 5 = right bumper |
| 149 | 6 = pot bumper |
| 150 | 7 = out hole |
| 151 | 8 = 3000 hole |
| 152 | 9 = knocker |
| 153 | A = coin counter |
| 154 | B = coin acceptor */ |
| 155 | offset = cpu_get_reg(m_maincpu, I4004_RAM) - 0x10; // we need the full address |
| 156 | if (data && data != offset) |
| 157 | { |
| 158 | switch (offset) |
| 159 | { |
| 160 | case 0x01: |
| 161 | beep_set_state(m_beeper, 1); |
| 162 | beep_set_frequency(m_beeper, 2000); |
| 163 | break; |
| 164 | case 0x02: |
| 165 | beep_set_state(m_beeper, 1); |
| 166 | beep_set_frequency(m_beeper, 1500); |
| 167 | break; |
| 168 | case 0x03: |
| 169 | beep_set_state(m_beeper, 1); |
| 170 | beep_set_frequency(m_beeper, 800); |
| 171 | break; |
| 172 | case 0x09: |
| 173 | beep_set_state(m_beeper, 1); |
| 174 | beep_set_frequency(m_beeper, 200); |
| 175 | break; |
| 176 | case 0x0a: |
| 177 | coin_counter_w(machine(), 0, 1); |
| 178 | coin_counter_w(machine(), 0, 0); |
| 179 | break; |
| 180 | default: |
| 181 | break; |
| 182 | } |
| 183 | } |
| 184 | else |
| 185 | beep_set_state(m_beeper, 0); |
112 | 186 | } |
113 | 187 | |
114 | 188 | |
r17422 | r17423 | |
116 | 190 | { |
117 | 191 | } |
118 | 192 | |
119 | | DRIVER_INIT_MEMBER(flicker_state,flicker) |
120 | | { |
121 | | } |
122 | | |
123 | 193 | static MACHINE_CONFIG_START( flicker, flicker_state ) |
124 | 194 | /* basic machine hardware */ |
125 | 195 | MCFG_CPU_ADD("maincpu", I4004, XTAL_5MHz / 8) |
r17422 | r17423 | |
129 | 199 | |
130 | 200 | /* Video */ |
131 | 201 | MCFG_DEFAULT_LAYOUT(layout_flicker) |
| 202 | |
| 203 | /* Sound */ |
| 204 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 205 | MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0) |
| 206 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
132 | 207 | MACHINE_CONFIG_END |
133 | 208 | |
134 | 209 | |
r17422 | r17423 | |
138 | 213 | ROM_END |
139 | 214 | |
140 | 215 | // YEAR GAME PARENT MACHINE INPUT CLASS INIT ORIENTATION COMPANY DESCRIPTION FLAGS |
141 | | GAME(1974, flicker, 0, flicker, flicker, flicker_state, flicker, ROT0, "Nutting Associates", "Flicker (Prototype)", GAME_IS_SKELETON_MECHANICAL) |
| 216 | GAME(1974, flicker, 0, flicker, flicker, driver_device, 0, ROT0, "Nutting Associates", "Flicker (Prototype)", GAME_MECHANICAL ) |