trunk/src/mess/drivers/simon.c
r0 | r241696 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:hap |
| 3 | /*************************************************************************** |
| 4 | |
| 5 | Milton Bradley Simon |
| 6 | |
| 7 | Revision A hardware: |
| 8 | * TMS1000 (has internal ROM), SN75494 lamp driver |
| 9 | |
| 10 | Newer revisions have a smaller 16-pin MB4850 chip instead of the TMS1000. |
| 11 | It has been decapped, but we couldn't yet find the internal ROM. |
| 12 | |
| 13 | |
| 14 | TODO: |
| 15 | - where's the skill switch? |
| 16 | |
| 17 | ***************************************************************************/ |
| 18 | |
| 19 | #include "emu.h" |
| 20 | #include "cpu/tms0980/tms0980.h" |
| 21 | #include "sound/speaker.h" |
| 22 | |
| 23 | #include "simon.lh" |
| 24 | |
| 25 | |
| 26 | class simon_state : public driver_device |
| 27 | { |
| 28 | public: |
| 29 | simon_state(const machine_config &mconfig, device_type type, const char *tag) |
| 30 | : driver_device(mconfig, type, tag), |
| 31 | m_maincpu(*this, "maincpu"), |
| 32 | m_button_matrix(*this, "R"), |
| 33 | m_speaker(*this, "speaker") |
| 34 | { } |
| 35 | |
| 36 | required_device<cpu_device> m_maincpu; |
| 37 | required_ioport_array<3> m_button_matrix; |
| 38 | required_device<speaker_sound_device> m_speaker; |
| 39 | |
| 40 | UINT16 m_o; |
| 41 | UINT16 m_r; |
| 42 | |
| 43 | DECLARE_READ8_MEMBER(read_k); |
| 44 | DECLARE_WRITE16_MEMBER(write_o); |
| 45 | DECLARE_WRITE16_MEMBER(write_r); |
| 46 | |
| 47 | virtual void machine_start(); |
| 48 | virtual void machine_reset(); |
| 49 | }; |
| 50 | |
| 51 | |
| 52 | /*************************************************************************** |
| 53 | |
| 54 | I/O |
| 55 | |
| 56 | ***************************************************************************/ |
| 57 | |
| 58 | READ8_MEMBER(simon_state::read_k) |
| 59 | { |
| 60 | UINT8 ret = 0; |
| 61 | |
| 62 | // read selected button rows |
| 63 | for (int i = 0; i < 3; i++) |
| 64 | if (m_r & (1 << i)) |
| 65 | ret |= m_button_matrix[i]->read(); |
| 66 | |
| 67 | return ret; |
| 68 | } |
| 69 | |
| 70 | WRITE16_MEMBER(simon_state::write_r) |
| 71 | { |
| 72 | // R4-R7: lamps, through 75494 IC |
| 73 | for (int i = 0; i < 4; i++) |
| 74 | output_set_lamp_value(i, data >> (4 + i) & 1); |
| 75 | |
| 76 | // R8: speaker |
| 77 | m_speaker->level_w(data >> 8 & 1); |
| 78 | |
| 79 | // R0-R2: input mux |
| 80 | // R3: GND |
| 81 | // other bits: N/C |
| 82 | m_r = data; |
| 83 | } |
| 84 | |
| 85 | WRITE16_MEMBER(simon_state::write_o) |
| 86 | { |
| 87 | // N/C |
| 88 | m_o = data; |
| 89 | } |
| 90 | |
| 91 | |
| 92 | |
| 93 | /*************************************************************************** |
| 94 | |
| 95 | Inputs |
| 96 | |
| 97 | ***************************************************************************/ |
| 98 | |
| 99 | static INPUT_PORTS_START( simon ) |
| 100 | PORT_START("R.0") |
| 101 | PORT_CONFNAME( 0x07, 0x02, "Game Select") |
| 102 | PORT_CONFSETTING( 0x02, "1" ) |
| 103 | PORT_CONFSETTING( 0x01, "2" ) |
| 104 | PORT_CONFSETTING( 0x04, "3" ) |
| 105 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 106 | |
| 107 | PORT_START("R.1") |
| 108 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Green Button") |
| 109 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Red Button") |
| 110 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Yellow Button") |
| 111 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Blue Button") |
| 112 | |
| 113 | PORT_START("R.2") |
| 114 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Start") |
| 115 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Last") |
| 116 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Longest") |
| 117 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 118 | INPUT_PORTS_END |
| 119 | |
| 120 | |
| 121 | |
| 122 | /*************************************************************************** |
| 123 | |
| 124 | Machine Config |
| 125 | |
| 126 | ***************************************************************************/ |
| 127 | |
| 128 | void simon_state::machine_reset() |
| 129 | { |
| 130 | } |
| 131 | |
| 132 | void simon_state::machine_start() |
| 133 | { |
| 134 | m_o = 0; |
| 135 | m_r = 0; |
| 136 | |
| 137 | save_item(NAME(m_o)); |
| 138 | save_item(NAME(m_r)); |
| 139 | } |
| 140 | |
| 141 | |
| 142 | static const UINT16 simon_output_pla[0x20] = |
| 143 | { |
| 144 | /* The output PLA just maps 1 2 4 8 and SL to O0-O4 */ |
| 145 | 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
| 146 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 147 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
| 148 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f |
| 149 | }; |
| 150 | |
| 151 | |
| 152 | static MACHINE_CONFIG_START( simon, simon_state ) |
| 153 | |
| 154 | /* basic machine hardware */ |
| 155 | MCFG_CPU_ADD( "maincpu", TMS1000, 330000 ) // RC osc, approximation compared with recordings |
| 156 | MCFG_TMS1XXX_OUTPUT_PLA(simon_output_pla) |
| 157 | MCFG_TMS1XXX_READ_K(READ8(simon_state, read_k)) |
| 158 | MCFG_TMS1XXX_WRITE_O(WRITE16(simon_state, write_o)) |
| 159 | MCFG_TMS1XXX_WRITE_R(WRITE16(simon_state, write_r)) |
| 160 | |
| 161 | MCFG_DEFAULT_LAYOUT(layout_simon) |
| 162 | |
| 163 | /* no video! */ |
| 164 | |
| 165 | /* sound hardware */ |
| 166 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 167 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
| 168 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 169 | MACHINE_CONFIG_END |
| 170 | |
| 171 | |
| 172 | |
| 173 | /*************************************************************************** |
| 174 | |
| 175 | Game drivers |
| 176 | |
| 177 | ***************************************************************************/ |
| 178 | |
| 179 | ROM_START( simon ) |
| 180 | ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 ) |
| 181 | ROM_LOAD( "simon.bin", 0x0000, 0x0400, CRC(9961719d) SHA1(35dddb018a8a2b31f377ab49c1f0cb76951b81c0) ) |
| 182 | ROM_END |
| 183 | |
| 184 | |
| 185 | CONS( 1978, simon, 0, 0, simon, simon, driver_device, 0, "Milton Bradley", "Simon (Rev. A)", GAME_SUPPORTS_SAVE ) |
trunk/src/mess/layout/simon.lay
r0 | r241696 | |
| 1 | <?xml version="1.0"?> |
| 2 | <mamelayout version="2"> |
| 3 | |
| 4 | |
| 5 | <!-- define elements --> |
| 6 | |
| 7 | <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element> |
| 8 | <element name="disk_black"><disk><color red="0.0" green="0.0" blue="0.0" /></disk></element> |
| 9 | <element name="disk_grey"><disk><color red="0.6" green="0.6" blue="0.6" /></disk></element> |
| 10 | |
| 11 | <!-- TODO: add these, maybe --> |
| 12 | <element name="text_game"> |
| 13 | <rect><color red="0.6" green="0.6" blue="0.6" /></rect> |
| 14 | <text string="GAME"> |
| 15 | <color red="0.0" green="0.0" blue="0.0" /> |
| 16 | </text> |
| 17 | </element> |
| 18 | <element name="text_skill"> |
| 19 | <rect><color red="0.6" green="0.6" blue="0.6" /></rect> |
| 20 | <text string="SKILL LEVEL"> |
| 21 | <color red="0.0" green="0.0" blue="0.0" /> |
| 22 | </text> |
| 23 | </element> |
| 24 | |
| 25 | <element name="text_last"> |
| 26 | <rect><color red="0.6" green="0.6" blue="0.6" /></rect> |
| 27 | <text string="LAST"> |
| 28 | <color red="0.0" green="0.0" blue="0.0" /> |
| 29 | </text> |
| 30 | </element> |
| 31 | <element name="text_start"> |
| 32 | <rect><color red="0.6" green="0.6" blue="0.6" /></rect> |
| 33 | <text string="START"> |
| 34 | <color red="0.0" green="0.0" blue="0.0" /> |
| 35 | </text> |
| 36 | </element> |
| 37 | <element name="text_long"> |
| 38 | <rect><color red="0.6" green="0.6" blue="0.6" /></rect> |
| 39 | <text string="LONGEST"> |
| 40 | <color red="0.0" green="0.0" blue="0.0" /> |
| 41 | </text> |
| 42 | </element> |
| 43 | |
| 44 | <element name="button_r" defstate="0"> |
| 45 | <disk><color red="0.0" green="0.0" blue="0.0" /></disk> |
| 46 | <disk state="0"> |
| 47 | <color red="0.8" green="0.25" blue="0.1" /> |
| 48 | <bounds x="0.2" y="0.2" width="0.6" height="0.6" /> |
| 49 | </disk> |
| 50 | <disk state="1"> |
| 51 | <color red="0.8" green="0.25" blue="0.1" /> |
| 52 | <bounds x="0.30" y="0.30" width="0.4" height="0.4" /> |
| 53 | </disk> |
| 54 | </element> |
| 55 | <element name="button_y" defstate="0"> |
| 56 | <disk><color red="0.0" green="0.0" blue="0.0" /></disk> |
| 57 | <disk state="0"> |
| 58 | <color red="0.8" green="0.78" blue="0.1" /> |
| 59 | <bounds x="0.2" y="0.2" width="0.6" height="0.6" /> |
| 60 | </disk> |
| 61 | <disk state="1"> |
| 62 | <color red="0.8" green="0.78" blue="0.1" /> |
| 63 | <bounds x="0.30" y="0.30" width="0.4" height="0.4" /> |
| 64 | </disk> |
| 65 | </element> |
| 66 | |
| 67 | <element name="lamp_g" defstate="0"> |
| 68 | <rect state="0"><color red="0.15" green="0.5" blue="0.1" /></rect> |
| 69 | <rect state="1"><color red="0.52" green="1.0" blue="0.4" /></rect> |
| 70 | </element> |
| 71 | <element name="lamp_r" defstate="0"> |
| 72 | <rect state="0"><color red="0.5" green="0.15" blue="0.1" /></rect> |
| 73 | <rect state="1"><color red="1.0" green="0.4" blue="0.28" /></rect> |
| 74 | </element> |
| 75 | <element name="lamp_y" defstate="0"> |
| 76 | <rect state="0"><color red="0.5" green="0.45" blue="0.1" /></rect> |
| 77 | <rect state="1"><color red="1.0" green="0.93" blue="0.4" /></rect> |
| 78 | </element> |
| 79 | <element name="lamp_b" defstate="0"> |
| 80 | <rect state="0"><color red="0.1" green="0.15" blue="0.5" /></rect> |
| 81 | <rect state="1"><color red="0.3" green="0.42" blue="1.0" /></rect> |
| 82 | </element> |
| 83 | |
| 84 | |
| 85 | |
| 86 | <!-- build screen --> |
| 87 | |
| 88 | <view name="Internal Layout"> |
| 89 | <bounds left="0" right="200" top="0" bottom="200" /> |
| 90 | <bezel element="static_black"> |
| 91 | <bounds left="0" right="200" top="0" bottom="200" /> |
| 92 | </bezel> |
| 93 | |
| 94 | <!-- big lamps --> |
| 95 | |
| 96 | <bezel name="lamp0" element="lamp_g" inputtag="R.1" inputmask="0x01" > |
| 97 | <bounds left="0" right="91" top="0" bottom="50" /> |
| 98 | </bezel> |
| 99 | <bezel name="lamp0" element="lamp_g" inputtag="R.1" inputmask="0x01" > |
| 100 | <bounds left="0" right="50" top="0" bottom="91" /> |
| 101 | </bezel> |
| 102 | <bezel name="lamp0" element="lamp_g" inputtag="R.1" inputmask="0x01" > |
| 103 | <bounds x="40" y="40" width="20" height="20" /> |
| 104 | </bezel> |
| 105 | |
| 106 | <bezel name="lamp1" element="lamp_r" inputtag="R.1" inputmask="0x02" > |
| 107 | <bounds left="109" right="200" top="0" bottom="50" /> |
| 108 | </bezel> |
| 109 | <bezel name="lamp1" element="lamp_r" inputtag="R.1" inputmask="0x02" > |
| 110 | <bounds left="150" right="200" top="0" bottom="91" /> |
| 111 | </bezel> |
| 112 | <bezel name="lamp1" element="lamp_r" inputtag="R.1" inputmask="0x02" > |
| 113 | <bounds x="140" y="40" width="20" height="20" /> |
| 114 | </bezel> |
| 115 | |
| 116 | <bezel name="lamp2" element="lamp_y" inputtag="R.1" inputmask="0x04" > |
| 117 | <bounds left="0" right="91" top="150" bottom="200" /> |
| 118 | </bezel> |
| 119 | <bezel name="lamp2" element="lamp_y" inputtag="R.1" inputmask="0x04" > |
| 120 | <bounds left="0" right="50" top="109" bottom="200" /> |
| 121 | </bezel> |
| 122 | <bezel name="lamp2" element="lamp_y" inputtag="R.1" inputmask="0x04" > |
| 123 | <bounds x="40" y="140" width="20" height="20" /> |
| 124 | </bezel> |
| 125 | |
| 126 | <bezel name="lamp3" element="lamp_b" inputtag="R.1" inputmask="0x08" > |
| 127 | <bounds left="109" right="200" top="150" bottom="200" /> |
| 128 | </bezel> |
| 129 | <bezel name="lamp3" element="lamp_b" inputtag="R.1" inputmask="0x08" > |
| 130 | <bounds left="150" right="200" top="109" bottom="200" /> |
| 131 | </bezel> |
| 132 | <bezel name="lamp3" element="lamp_b" inputtag="R.1" inputmask="0x08" > |
| 133 | <bounds x="140" y="140" width="20" height="20" /> |
| 134 | </bezel> |
| 135 | |
| 136 | |
| 137 | <bezel element="static_black"> |
| 138 | <bounds x="0" y="90" width="200" height="20" /> |
| 139 | </bezel> |
| 140 | <bezel element="static_black"> |
| 141 | <bounds x="90" y="0" width="20" height="200" /> |
| 142 | </bezel> |
| 143 | <bezel element="disk_black"> |
| 144 | <bounds x="35" y="35" width="130" height="130" /> |
| 145 | </bezel> |
| 146 | |
| 147 | <bezel element="disk_grey"> |
| 148 | <bounds x="50" y="50" width="100" height="100" /> |
| 149 | </bezel> |
| 150 | <bezel element="static_black"> |
| 151 | <bounds x="52" y="90" width="96" height="1" /> |
| 152 | </bezel> |
| 153 | |
| 154 | |
| 155 | <!-- other controls --> |
| 156 | |
| 157 | <bezel element="text_last"> |
| 158 | <bounds x="65" y="110" width="20" height="4" /> |
| 159 | </bezel> |
| 160 | <bezel element="button_y" inputtag="R.2" inputmask="0x02"> |
| 161 | <bounds x="71" y="115" width="8" height="8" /> |
| 162 | </bezel> |
| 163 | |
| 164 | <bezel element="text_start"> |
| 165 | <bounds x="90" y="110" width="20" height="4" /> |
| 166 | </bezel> |
| 167 | <bezel element="button_r" inputtag="R.2" inputmask="0x01"> |
| 168 | <bounds x="96" y="115" width="8" height="8" /> |
| 169 | </bezel> |
| 170 | |
| 171 | <bezel element="text_long"> |
| 172 | <bounds x="115" y="110" width="20" height="4" /> |
| 173 | </bezel> |
| 174 | <bezel element="button_y" inputtag="R.2" inputmask="0x04"> |
| 175 | <bounds x="121" y="115" width="8" height="8" /> |
| 176 | </bezel> |
| 177 | |
| 178 | |
| 179 | </view> |
| 180 | </mamelayout> |