Previous 15994 Revisions Next

r14744 Sunday 11th March, 2012 at 13:58:11 UTC by Sandro Ronco
z88: connected speaker. (nw)
[src/mess/drivers]z88.c
[src/mess/includes]z88.h
[src/mess/machine]upd65031.c upd65031.h

src/mess/machine/upd65031.c
r14743r14744
1313
1414    TODO:
1515    - coma and snooze mode
16    - speaker controlled by constant tone or txd
16    - speaker controlled by txd
1717    - EPROM programming
1818    - UART
1919
r14743r14744
3333
3434#define LOG 0
3535
36#define SPEAKER_ALARM_FREQ    attotime::from_hz(3200)
37
3638// internal registers
3739enum
3840{
r14743r14744
239241   // allocate timers
240242   m_rtc_timer = timer_alloc(TIMER_RTC);
241243   m_flash_timer = timer_alloc(TIMER_FLASH);
244   m_speaker_timer = timer_alloc(TIMER_SPEAKER);
242245   m_rtc_timer->adjust(attotime::from_msec(5), 0, attotime::from_msec(5));
243246   m_flash_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2));
247   m_speaker_timer->reset();
244248
245249   // state saving
246250   save_item(NAME(m_mode));
r14743r14744
386390   case TIMER_FLASH:
387391      m_flash = !m_flash;
388392      break;
393   case TIMER_SPEAKER:
394      m_speaker_state = !m_speaker_state;
395      m_out_spkr_func(m_speaker_state ? 1 : 0);
396      break;
389397   }
390398}
391399
r14743r14744
496504         if (data & COM_RESTIM)
497505            m_tim[0] = m_tim[1] = m_tim[2] = m_tim[3] = m_tim[4] = 0;
498506
499         // SBIT controls speaker direct?
500         if (!(data & COM_SRUN))
507         if ((data & COM_SRUN) && !(data & COM_SBIT))
501508         {
502            // speaker controlled by SBIT
503            m_out_spkr_func(BIT(data, 6));
509            // constant tone used for keyclick and alarm
510            m_speaker_timer->adjust(SPEAKER_ALARM_FREQ, 0, SPEAKER_ALARM_FREQ);
504511         }
505512         else
506513         {
507            // speaker under control of continuous tone, or txd
508            // TODO
514            if (!(data & COM_SRUN))
515            {
516               // speaker controlled by SBIT
517               m_speaker_state = BIT(data, 6);
518               m_out_spkr_func(m_speaker_state);
519            }
520            else
521            {
522               // speaker controlled by txd line
523               // TODO
524            }
525
526            m_speaker_timer->reset();
509527         }
510528
511529         // bit 2 controls the lower 8kb of memory
src/mess/machine/upd65031.h
r14743r14744
7777   inline void set_mode(int mode);
7878   static const device_timer_id TIMER_RTC = 0;
7979   static const device_timer_id TIMER_FLASH = 1;
80   static const device_timer_id TIMER_SPEAKER = 2;
8081
8182   devcb_resolved_write_line   m_out_int_func;
8283   devcb_resolved_write_line   m_out_nmi_func;
r14743r14744
9596   UINT8   m_tack;            // timer interrupts acknowledge
9697   UINT8   m_com;            // command register
9798   int      m_flash;         // cursor flash
99   int      m_speaker_state;   // spkr line
98100
99101   // timers
100102   emu_timer *m_rtc_timer;
101103   emu_timer *m_flash_timer;
104   emu_timer *m_speaker_timer;
102105};
103106
104107
src/mess/includes/z88.h
r14743r14744
3636   z88_state(const machine_config &mconfig, device_type type, const char *tag)
3737      : driver_device(mconfig, type, tag),
3838        m_maincpu(*this, "maincpu"),
39        m_speaker(*this, SPEAKER_TAG),
4039        m_ram(*this, RAM_TAG)
4140   { }
4241
4342   required_device<cpu_device> m_maincpu;
44   required_device<device_t> m_speaker;
4543   required_device<ram_device> m_ram;
4644
4745   virtual void machine_start();
src/mess/drivers/z88.c
r14743r14744
77        system driver
88
99        TODO:
10        - speaker controlled by constant tone or txd
10        - speaker controlled by txd
1111        - Facility to load games
1212        - expansion interface
1313
r14743r14744
316316   DEVCB_DRIVER_MEMBER(z88_state, kb_r),                // kb read input
317317   DEVCB_CPU_INPUT_LINE("maincpu", 0),                  // INT line out
318318   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI),        // NMI line out
319   DEVCB_NULL                                    // Speaker line out
319   DEVCB_DEVICE_LINE(SPEAKER_TAG, speaker_level_w)         // Speaker line out
320320};
321321
322322static const z88cart_interface z88_cart_interface =

Previous 15994 Revisions Next


© 1998-2018 The MESS Team