src/mess/machine/upd65031.c
| r14743 | r14744 | |
| 13 | 13 | |
| 14 | 14 | TODO: |
| 15 | 15 | - coma and snooze mode |
| 16 | | - speaker controlled by constant tone or txd |
| 16 | - speaker controlled by txd |
| 17 | 17 | - EPROM programming |
| 18 | 18 | - UART |
| 19 | 19 | |
| r14743 | r14744 | |
| 33 | 33 | |
| 34 | 34 | #define LOG 0 |
| 35 | 35 | |
| 36 | #define SPEAKER_ALARM_FREQ attotime::from_hz(3200) |
| 37 | |
| 36 | 38 | // internal registers |
| 37 | 39 | enum |
| 38 | 40 | { |
| r14743 | r14744 | |
| 239 | 241 | // allocate timers |
| 240 | 242 | m_rtc_timer = timer_alloc(TIMER_RTC); |
| 241 | 243 | m_flash_timer = timer_alloc(TIMER_FLASH); |
| 244 | m_speaker_timer = timer_alloc(TIMER_SPEAKER); |
| 242 | 245 | m_rtc_timer->adjust(attotime::from_msec(5), 0, attotime::from_msec(5)); |
| 243 | 246 | m_flash_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); |
| 247 | m_speaker_timer->reset(); |
| 244 | 248 | |
| 245 | 249 | // state saving |
| 246 | 250 | save_item(NAME(m_mode)); |
| r14743 | r14744 | |
| 386 | 390 | case TIMER_FLASH: |
| 387 | 391 | m_flash = !m_flash; |
| 388 | 392 | break; |
| 393 | case TIMER_SPEAKER: |
| 394 | m_speaker_state = !m_speaker_state; |
| 395 | m_out_spkr_func(m_speaker_state ? 1 : 0); |
| 396 | break; |
| 389 | 397 | } |
| 390 | 398 | } |
| 391 | 399 | |
| r14743 | r14744 | |
| 496 | 504 | if (data & COM_RESTIM) |
| 497 | 505 | m_tim[0] = m_tim[1] = m_tim[2] = m_tim[3] = m_tim[4] = 0; |
| 498 | 506 | |
| 499 | | // SBIT controls speaker direct? |
| 500 | | if (!(data & COM_SRUN)) |
| 507 | if ((data & COM_SRUN) && !(data & COM_SBIT)) |
| 501 | 508 | { |
| 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); |
| 504 | 511 | } |
| 505 | 512 | else |
| 506 | 513 | { |
| 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(); |
| 509 | 527 | } |
| 510 | 528 | |
| 511 | 529 | // bit 2 controls the lower 8kb of memory |
src/mess/machine/upd65031.h
| r14743 | r14744 | |
| 77 | 77 | inline void set_mode(int mode); |
| 78 | 78 | static const device_timer_id TIMER_RTC = 0; |
| 79 | 79 | static const device_timer_id TIMER_FLASH = 1; |
| 80 | static const device_timer_id TIMER_SPEAKER = 2; |
| 80 | 81 | |
| 81 | 82 | devcb_resolved_write_line m_out_int_func; |
| 82 | 83 | devcb_resolved_write_line m_out_nmi_func; |
| r14743 | r14744 | |
| 95 | 96 | UINT8 m_tack; // timer interrupts acknowledge |
| 96 | 97 | UINT8 m_com; // command register |
| 97 | 98 | int m_flash; // cursor flash |
| 99 | int m_speaker_state; // spkr line |
| 98 | 100 | |
| 99 | 101 | // timers |
| 100 | 102 | emu_timer *m_rtc_timer; |
| 101 | 103 | emu_timer *m_flash_timer; |
| 104 | emu_timer *m_speaker_timer; |
| 102 | 105 | }; |
| 103 | 106 | |
| 104 | 107 | |
src/mess/includes/z88.h
| r14743 | r14744 | |
| 36 | 36 | z88_state(const machine_config &mconfig, device_type type, const char *tag) |
| 37 | 37 | : driver_device(mconfig, type, tag), |
| 38 | 38 | m_maincpu(*this, "maincpu"), |
| 39 | | m_speaker(*this, SPEAKER_TAG), |
| 40 | 39 | m_ram(*this, RAM_TAG) |
| 41 | 40 | { } |
| 42 | 41 | |
| 43 | 42 | required_device<cpu_device> m_maincpu; |
| 44 | | required_device<device_t> m_speaker; |
| 45 | 43 | required_device<ram_device> m_ram; |
| 46 | 44 | |
| 47 | 45 | virtual void machine_start(); |
src/mess/drivers/z88.c
| r14743 | r14744 | |
| 7 | 7 | system driver |
| 8 | 8 | |
| 9 | 9 | TODO: |
| 10 | | - speaker controlled by constant tone or txd |
| 10 | - speaker controlled by txd |
| 11 | 11 | - Facility to load games |
| 12 | 12 | - expansion interface |
| 13 | 13 | |
| r14743 | r14744 | |
| 316 | 316 | DEVCB_DRIVER_MEMBER(z88_state, kb_r), // kb read input |
| 317 | 317 | DEVCB_CPU_INPUT_LINE("maincpu", 0), // INT line out |
| 318 | 318 | 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 |
| 320 | 320 | }; |
| 321 | 321 | |
| 322 | 322 | static const z88cart_interface z88_cart_interface = |