Previous 199869 Revisions Next

r35078 Monday 16th February, 2015 at 19:54:17 UTC by hap
added AMI_S2152 F_out pin
[src/emu/cpu/amis2000]amis2000.c amis2000.h amis2000op.inc
[src/mess/drivers]wildfire.c

trunk/src/emu/cpu/amis2000/amis2000.c
r243589r243590
179179}
180180
181181
182void amis2152_cpu_device::device_start()
183{
184   amis2000_base_device::device_start();
182185
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
183199//-------------------------------------------------
184200//  device_reset - device-specific reset
185201//-------------------------------------------------
r243589r243590
191207   m_skip = false;
192208   
193209   // clear i/o
210   m_a = 0x1fff;
211   m_write_a(0, m_a, 0xffff);
194212   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);
197215}
198216
199217
218void amis2152_cpu_device::device_reset()
219{
220   amis2000_base_device::device_reset();
200221
222   // start d2f timer
223   m_write_f(0);
224   d2f_timer_clock();
225}
226
227
228
201229//-------------------------------------------------
202230//  execute
203231//-------------------------------------------------
trunk/src/emu/cpu/amis2000/amis2000.h
r243589r243590
208208{
209209public:
210210   amis2152_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
211
212protected:
213   // device-level overrides
214   virtual void device_start();
215   virtual void device_reset();
216   
217   // digital-to-frequency converter
218   UINT8 m_d2f_latch;
219   emu_timer *m_d2f_timer;
220   int m_fout_state;
221
222   void d2f_timer_clock();
223   TIMER_CALLBACK_MEMBER(d2f_timer_cb);
224   
225   // opcode handlers
226   virtual void op_szk();
211227};
212228
213229
trunk/src/emu/cpu/amis2000/amis2000op.inc
r243589r243590
490490   // RF2: reset flag 2
491491   m_f &= ~0x02;
492492}
493
494
495
496// AMI S2152 specific handlers
497
498void amis2152_cpu_device::d2f_timer_clock()
499{
500   // schedule next timeout (frequency is guessed)
501   attotime base = attotime::from_hz(unscaled_clock() / 4 / 64);
502   m_d2f_timer->adjust(base * (0x10 - m_d2f_latch));
503}
504
505TIMER_CALLBACK_MEMBER(amis2152_cpu_device::d2f_timer_cb)
506{
507   m_write_f(m_fout_state);
508   m_fout_state ^= 1;
509   
510   d2f_timer_clock();
511}
512
513void amis2152_cpu_device::op_szk()
514{
515   // instead of SZK: ???: load d2f latch with ACC(?)
516   m_d2f_latch = m_acc;
517}
trunk/src/mess/drivers/wildfire.c
r243589r243590
1313
1414
1515  TODO:
16  - bad sound (probably MCU related)
16  - bad sound, A12 seems to strobe too fast
1717  - when the game strobes a led faster, it should appear brighter, for example when
1818    the ball hits one of the bumpers
1919  - some 7segs digits are wrong (mcu on-die decoder is customizable?)
r243589r243590
4646
4747   UINT8 m_d;
4848   UINT16 m_a;
49   UINT8 m_f;
4950
5051   UINT16 m_display_state[0x10];
5152   UINT16 m_display_cache[0x10];
r243589r243590
5354
5455   DECLARE_WRITE8_MEMBER(write_d);
5556   DECLARE_WRITE16_MEMBER(write_a);
57   DECLARE_WRITE_LINE_MEMBER(write_f);
5658
5759   TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
60   bool index_is_7segled(int index);
5861   void display_update();
59   bool index_is_7segled(int index);
62   void sound_update();
6063
6164   virtual void machine_start();
6265};
r243589r243590
104107   for (int i = 0; i < 0x10; i++)
105108   {
106109      // 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;
108111
109112      active_state[i] = 0;
110113
r243589r243590
163166
164167WRITE16_MEMBER(wildfire_state::write_a)
165168{
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
170169   // A0-A2: select 7segleds
171170   // A3-A11: select other leds
172   m_a = data;
171   m_a = data ^ 0x1fff; // active-low
173172   display_update();
173
174   // A12: enable speaker
175   sound_update();
174176}
175177
178WRITE_LINE_MEMBER(wildfire_state::write_f)
179{
180   m_f = (state) ? 1 : 0;
181   sound_update();
182}
176183
184void wildfire_state::sound_update()
185{
186   m_speaker->level_w(m_a >> 12 & m_f);
187}
177188
189
190
178191/***************************************************************************
179192
180193  Inputs
r243589r243590
206219
207220   m_d = 0;
208221   m_a = 0;
222   m_f = 0;
209223
210224   // register for savestates
211225   save_item(NAME(m_display_state));
r243589r243590
214228
215229   save_item(NAME(m_d));
216230   save_item(NAME(m_a));
231   save_item(NAME(m_f));
217232}
218233
219234
220235static MACHINE_CONFIG_START( wildfire, wildfire_state )
221236
222237   /* basic machine hardware */
223   MCFG_CPU_ADD("maincpu", AMI_S2150, MASTER_CLOCK)
238   MCFG_CPU_ADD("maincpu", AMI_S2152, MASTER_CLOCK)
224239   MCFG_AMI_S2000_READ_I_CB(IOPORT("IN1"))
225240   MCFG_AMI_S2000_WRITE_D_CB(WRITE8(wildfire_state, write_d))
226241   MCFG_AMI_S2000_WRITE_A_CB(WRITE16(wildfire_state, write_a))
242   MCFG_AMI_S2152_FOUT_CB(WRITELINE(wildfire_state, write_f))
227243
228244   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", wildfire_state, display_decay_tick, attotime::from_msec(1))
229245


Previous 199869 Revisions Next


© 1997-2024 The MAME Team