trunk/src/mess/drivers/tmtennis.c
| r243504 | r243505 | |
| 9 | 9 | |
| 10 | 10 | The initial release of this game was in 1979, known as Pro-Tennis, |
| 11 | 11 | it is unknown if the hardware and/or ROM contents differ. |
| 12 | |
| 13 | This is an early VFD simple electronic tennis game. Player 1 is on the right |
| 14 | side, player 2 or CPU on the left. Each player has six possible positions |
| 15 | where to hit the ball. A backdrop behind the VFD shows a tennis court. |
| 12 | 16 | |
| 17 | NOTE!: MESS external artwork is required to be able to play |
| 13 | 18 | |
| 14 | | TODO: |
| 15 | | - 2-player mode doesn't work: the guys auto-serve and the left player |
| 16 | | always hits the net, mcu emulation bug? |
| 17 | | - difficulty switch changes mcu freq |
| 18 | | |
| 19 | 19 | ***************************************************************************/ |
| 20 | 20 | |
| 21 | 21 | #include "emu.h" |
| r243504 | r243505 | |
| 24 | 24 | |
| 25 | 25 | #include "tmtennis.lh" // this is a test layout, external artwork is necessary |
| 26 | 26 | |
| 27 | | // master clock is from an LC circuit oscillating by default at 360kHz, |
| 28 | | // the difficulty switch puts a capacitor across it to slow it down to 260kHz |
| 29 | | #define MASTER_CLOCK_PRO1 (260000) |
| 30 | | #define MASTER_CLOCK_PRO2 (360000) |
| 31 | 27 | |
| 32 | | |
| 33 | 28 | class tmtennis_state : public driver_device |
| 34 | 29 | { |
| 35 | 30 | public: |
| r243504 | r243505 | |
| 53 | 48 | DECLARE_WRITE8_MEMBER(plate_w); |
| 54 | 49 | DECLARE_WRITE8_MEMBER(grid_w); |
| 55 | 50 | |
| 51 | DECLARE_INPUT_CHANGED_MEMBER(difficulty_switch); |
| 52 | void update_clock(); |
| 53 | |
| 56 | 54 | UINT16 m_vfd_state[0x10]; |
| 57 | 55 | void update_vfd(); |
| 58 | 56 | |
| 57 | virtual void machine_reset(); |
| 59 | 58 | virtual void machine_start(); |
| 60 | 59 | }; |
| 61 | 60 | |
| 61 | // master clock is from an LC circuit oscillating by default at 360kHz, but... |
| 62 | #define MASTER_CLOCK (360000) |
| 62 | 63 | |
| 64 | void tmtennis_state::update_clock() |
| 65 | { |
| 66 | // ...on PRO1, the difficulty switch puts a capacitor across the LC circuit |
| 67 | // to slow it down to approx. 260kHz (28%) |
| 68 | m_maincpu->set_clock_scale(m_button_matrix[1]->read() & 0x100 ? 0.72 : 1); |
| 69 | } |
| 63 | 70 | |
| 71 | |
| 72 | |
| 64 | 73 | /*************************************************************************** |
| 65 | 74 | |
| 66 | 75 | Display |
| r243504 | r243505 | |
| 95 | 104 | |
| 96 | 105 | // read selected button rows |
| 97 | 106 | for (int i = 0; i < 2; i++) |
| 98 | | if (~m_input_mux >> i & 1) |
| 107 | if (m_input_mux >> i & 1) |
| 99 | 108 | inp &= m_button_matrix[i]->read(); |
| 100 | 109 | |
| 101 | 110 | return inp >> (offset*4); |
| r243504 | r243505 | |
| 137 | 146 | |
| 138 | 147 | ***************************************************************************/ |
| 139 | 148 | |
| 149 | INPUT_CHANGED_MEMBER(tmtennis_state::difficulty_switch) |
| 150 | { |
| 151 | update_clock(); |
| 152 | } |
| 153 | |
| 140 | 154 | /* Pro-Tennis physical button layout and labels is like this: |
| 141 | 155 | |
| 142 | 156 | [SERVE] [1] [2] [3] [3] [2] [1] [SERVE] |
| r243504 | r243505 | |
| 146 | 160 | */ |
| 147 | 161 | |
| 148 | 162 | static INPUT_PORTS_START( tmtennis ) |
| 149 | | PORT_START("IN.0") // E0 port A/B (left side) |
| 150 | | PORT_CONFNAME( 0x101, 0x001, DEF_STR( Difficulty ) ) |
| 163 | PORT_START("IN.0") // E0 port A/B |
| 164 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("P1 Serve") |
| 165 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("P2 Serve") |
| 166 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 167 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) |
| 168 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 169 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) |
| 170 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| 171 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) |
| 172 | |
| 173 | PORT_START("IN.1") // E1 port A/B |
| 174 | PORT_CONFNAME( 0x101, 0x101, DEF_STR( Difficulty ) ) PORT_CHANGED_MEMBER(DEVICE_SELF, tmtennis_state, difficulty_switch, NULL) |
| 151 | 175 | PORT_CONFSETTING( 0x000, "Practice" ) |
| 152 | | PORT_CONFSETTING( 0x001, "Pro 1" ) |
| 153 | | PORT_CONFSETTING( 0x101, "Pro 2" ) |
| 154 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) // P2 serve |
| 176 | PORT_CONFSETTING( 0x101, "Pro 1" ) // -> difficulty_switch |
| 177 | PORT_CONFSETTING( 0x001, "Pro 2" ) |
| 178 | PORT_CONFNAME( 0x02, 0x02, "Players" ) |
| 179 | PORT_CONFSETTING( 0x02, "1" ) |
| 180 | PORT_CONFSETTING( 0x00, "2" ) |
| 155 | 181 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 156 | 182 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) |
| 157 | 183 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 158 | 184 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) |
| 159 | 185 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 160 | 186 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) |
| 161 | | |
| 162 | | PORT_START("IN.1") // E1 port A/B (right side) |
| 163 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) // P1 serve |
| 164 | | PORT_CONFNAME( 0x02, 0x02, "Players" ) |
| 165 | | PORT_CONFSETTING( 0x02, "1" ) |
| 166 | | PORT_CONFSETTING( 0x00, "2" ) |
| 167 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 168 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) |
| 169 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 170 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) |
| 171 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| 172 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) |
| 173 | 187 | INPUT_PORTS_END |
| 174 | 188 | |
| 175 | 189 | |
| r243504 | r243505 | |
| 180 | 194 | |
| 181 | 195 | ***************************************************************************/ |
| 182 | 196 | |
| 197 | void tmtennis_state::machine_reset() |
| 198 | { |
| 199 | update_clock(); |
| 200 | } |
| 201 | |
| 183 | 202 | void tmtennis_state::machine_start() |
| 184 | 203 | { |
| 185 | 204 | // zerofill |
| r243504 | r243505 | |
| 199 | 218 | static MACHINE_CONFIG_START( tmtennis, tmtennis_state ) |
| 200 | 219 | |
| 201 | 220 | /* basic machine hardware */ |
| 202 | | MCFG_CPU_ADD("maincpu", NEC_D552, MASTER_CLOCK_PRO2) |
| 221 | MCFG_CPU_ADD("maincpu", NEC_D552, MASTER_CLOCK) |
| 203 | 222 | MCFG_UCOM4_READ_A_CB(READ8(tmtennis_state, input_r)) |
| 204 | 223 | MCFG_UCOM4_READ_B_CB(READ8(tmtennis_state, input_r)) |
| 205 | 224 | MCFG_UCOM4_WRITE_C_CB(WRITE8(tmtennis_state, plate_w)) |
| r243504 | r243505 | |
| 234 | 253 | ROM_END |
| 235 | 254 | |
| 236 | 255 | |
| 237 | | CONS( 1980, tmtennis, 0, 0, tmtennis, tmtennis, driver_device, 0, "Tomy", "Tennis (Tomytronic)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) |
| 256 | CONS( 1980, tmtennis, 0, 0, tmtennis, tmtennis, driver_device, 0, "Tomy", "Tennis (Tomytronic)", GAME_SUPPORTS_SAVE ) |