trunk/src/emu/cpu/amis2000/amis2000.c
| r243589 | r243590 | |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
| 182 | void amis2152_cpu_device::device_start() |
| 183 | { |
| 184 | amis2000_base_device::device_start(); |
| 182 | 185 | |
| 186 | m_d2f_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amis2152_cpu_device::d2f_timer_cb), this)); |
| 187 | |
| 188 | // zerofill |
| 189 | m_d2f_latch = 0; |
| 190 | m_fout_state = 0; |
| 191 | |
| 192 | // register for savestates |
| 193 | save_item(NAME(m_d2f_latch)); |
| 194 | save_item(NAME(m_fout_state)); |
| 195 | } |
| 196 | |
| 197 | |
| 198 | |
| 183 | 199 | //------------------------------------------------- |
| 184 | 200 | // device_reset - device-specific reset |
| 185 | 201 | //------------------------------------------------- |
| r243589 | r243590 | |
| 191 | 207 | m_skip = false; |
| 192 | 208 | |
| 193 | 209 | // clear i/o |
| 210 | m_a = 0x1fff; |
| 211 | m_write_a(0, m_a, 0xffff); |
| 194 | 212 | m_d_polarity = 0; |
| 195 | | m_d = 0; d_latch_out(false); |
| 196 | | m_a = 0; m_write_a(0, 0, 0xffff); |
| 213 | m_d = 0; |
| 214 | d_latch_out(false); |
| 197 | 215 | } |
| 198 | 216 | |
| 199 | 217 | |
| 218 | void amis2152_cpu_device::device_reset() |
| 219 | { |
| 220 | amis2000_base_device::device_reset(); |
| 200 | 221 | |
| 222 | // start d2f timer |
| 223 | m_write_f(0); |
| 224 | d2f_timer_clock(); |
| 225 | } |
| 226 | |
| 227 | |
| 228 | |
| 201 | 229 | //------------------------------------------------- |
| 202 | 230 | // execute |
| 203 | 231 | //------------------------------------------------- |
trunk/src/mess/drivers/wildfire.c
| r243589 | r243590 | |
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | TODO: |
| 16 | | - bad sound (probably MCU related) |
| 16 | - bad sound, A12 seems to strobe too fast |
| 17 | 17 | - when the game strobes a led faster, it should appear brighter, for example when |
| 18 | 18 | the ball hits one of the bumpers |
| 19 | 19 | - some 7segs digits are wrong (mcu on-die decoder is customizable?) |
| r243589 | r243590 | |
| 46 | 46 | |
| 47 | 47 | UINT8 m_d; |
| 48 | 48 | UINT16 m_a; |
| 49 | UINT8 m_f; |
| 49 | 50 | |
| 50 | 51 | UINT16 m_display_state[0x10]; |
| 51 | 52 | UINT16 m_display_cache[0x10]; |
| r243589 | r243590 | |
| 53 | 54 | |
| 54 | 55 | DECLARE_WRITE8_MEMBER(write_d); |
| 55 | 56 | DECLARE_WRITE16_MEMBER(write_a); |
| 57 | DECLARE_WRITE_LINE_MEMBER(write_f); |
| 56 | 58 | |
| 57 | 59 | TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); |
| 60 | bool index_is_7segled(int index); |
| 58 | 61 | void display_update(); |
| 59 | | bool index_is_7segled(int index); |
| 62 | void sound_update(); |
| 60 | 63 | |
| 61 | 64 | virtual void machine_start(); |
| 62 | 65 | }; |
| r243589 | r243590 | |
| 104 | 107 | for (int i = 0; i < 0x10; i++) |
| 105 | 108 | { |
| 106 | 109 | // update current state |
| 107 | | m_display_state[i] = (~m_a >> i & 1) ? m_d : 0; |
| 110 | m_display_state[i] = (m_a >> i & 1) ? m_d : 0; |
| 108 | 111 | |
| 109 | 112 | active_state[i] = 0; |
| 110 | 113 | |
| r243589 | r243590 | |
| 163 | 166 | |
| 164 | 167 | WRITE16_MEMBER(wildfire_state::write_a) |
| 165 | 168 | { |
| 166 | | // A12: enable speaker out |
| 167 | | // this is in combination with the MCU K4-pin, how? |
| 168 | | m_speaker->level_w(data >> 12 & 1); |
| 169 | | |
| 170 | 169 | // A0-A2: select 7segleds |
| 171 | 170 | // A3-A11: select other leds |
| 172 | | m_a = data; |
| 171 | m_a = data ^ 0x1fff; // active-low |
| 173 | 172 | display_update(); |
| 173 | |
| 174 | // A12: enable speaker |
| 175 | sound_update(); |
| 174 | 176 | } |
| 175 | 177 | |
| 178 | WRITE_LINE_MEMBER(wildfire_state::write_f) |
| 179 | { |
| 180 | m_f = (state) ? 1 : 0; |
| 181 | sound_update(); |
| 182 | } |
| 176 | 183 | |
| 184 | void wildfire_state::sound_update() |
| 185 | { |
| 186 | m_speaker->level_w(m_a >> 12 & m_f); |
| 187 | } |
| 177 | 188 | |
| 189 | |
| 190 | |
| 178 | 191 | /*************************************************************************** |
| 179 | 192 | |
| 180 | 193 | Inputs |
| r243589 | r243590 | |
| 206 | 219 | |
| 207 | 220 | m_d = 0; |
| 208 | 221 | m_a = 0; |
| 222 | m_f = 0; |
| 209 | 223 | |
| 210 | 224 | // register for savestates |
| 211 | 225 | save_item(NAME(m_display_state)); |
| r243589 | r243590 | |
| 214 | 228 | |
| 215 | 229 | save_item(NAME(m_d)); |
| 216 | 230 | save_item(NAME(m_a)); |
| 231 | save_item(NAME(m_f)); |
| 217 | 232 | } |
| 218 | 233 | |
| 219 | 234 | |
| 220 | 235 | static MACHINE_CONFIG_START( wildfire, wildfire_state ) |
| 221 | 236 | |
| 222 | 237 | /* basic machine hardware */ |
| 223 | | MCFG_CPU_ADD("maincpu", AMI_S2150, MASTER_CLOCK) |
| 238 | MCFG_CPU_ADD("maincpu", AMI_S2152, MASTER_CLOCK) |
| 224 | 239 | MCFG_AMI_S2000_READ_I_CB(IOPORT("IN1")) |
| 225 | 240 | MCFG_AMI_S2000_WRITE_D_CB(WRITE8(wildfire_state, write_d)) |
| 226 | 241 | MCFG_AMI_S2000_WRITE_A_CB(WRITE16(wildfire_state, write_a)) |
| 242 | MCFG_AMI_S2152_FOUT_CB(WRITELINE(wildfire_state, write_f)) |
| 227 | 243 | |
| 228 | 244 | MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", wildfire_state, display_decay_tick, attotime::from_msec(1)) |
| 229 | 245 | |