From b1e2be4cdbaf5f35cdc5c01b48cbcf94e68c1bee Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Thu, 21 Dec 2023 13:33:26 +0100 Subject: brother/pn8800fxb: Add buzzer and battery state --- src/mame/brother/pn8800fxb.cpp | 50 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/src/mame/brother/pn8800fxb.cpp b/src/mame/brother/pn8800fxb.cpp index cc83a67da04..c1492df5a02 100644 --- a/src/mame/brother/pn8800fxb.cpp +++ b/src/mame/brother/pn8800fxb.cpp @@ -20,7 +20,6 @@ - Fix ROM banking (ROM self-test shows NG) - Improve video emulation (offset, modes, etc.) - Floppy - - Buzzer - Centronics - Modem - Soft power off/on @@ -41,9 +40,11 @@ #include "cpu/z180/z180.h" #include "machine/rp5c01.h" #include "machine/timer.h" +#include "sound/beep.h" #include "emupal.h" #include "screen.h" +#include "speaker.h" namespace { @@ -62,6 +63,7 @@ public: m_palette(*this, "palette"), m_gfxdecode(*this, "gfxdecode"), m_keys(*this, "KO%u", 0U), + m_buzzer(*this, "buzzer"), m_lomem_view(*this, "lomem") { } @@ -77,6 +79,7 @@ private: required_device m_palette; required_device m_gfxdecode; required_ioport_array<9> m_keys; + required_device m_buzzer; memory_view m_lomem_view; uint8_t m_key_select; @@ -109,6 +112,8 @@ private: void video_offset_w(uint8_t data); void cursor_ctrl_w(uint8_t data); + void buzzer_w(uint8_t data); + void mem_change_w(uint8_t data); void bank_select_w(uint8_t data); void int_ack_w(uint8_t data); @@ -152,19 +157,19 @@ void pn8800fxb_state::io_map(address_map &map) map(0x77, 0x77).w(FUNC(pn8800fxb_state::cursor_ctrl_w)); // 78-7f mode select // 80-87 fdc - // 88-8f input + map(0x88, 0x88).mirror(0x07).portr("misc"); map(0x90, 0x90).mirror(0x07).w(FUNC(pn8800fxb_state::mem_change_w)); // 98-9f rs break // a0-a7 rs232 map(0xa8, 0xa8).mirror(0x07).nopr(); // "not used" - but read often - // b0-b7 power supply + map(0xb0, 0xb0).mirror(0x07).portr("power"); map(0xb8, 0xb8).rw(FUNC(pn8800fxb_state::keyboard_r), FUNC(pn8800fxb_state::keyboard_w)); // c0-c7 cdcc data // c8-cf cdcc control map(0xd0, 0xdf).rw("rtc", FUNC(tc8521_device::read), FUNC(tc8521_device::write)); map(0xe0, 0xe0).mirror(0x07).w(FUNC(pn8800fxb_state::bank_select_w)); // e8-ef ga test - // f0-f7 buzzer + map(0xf0, 0xf0).mirror(0x07).w(FUNC(pn8800fxb_state::buzzer_w)); map(0xf8, 0xf8).mirror(0x07).w(FUNC(pn8800fxb_state::int_ack_w)); } @@ -174,6 +179,23 @@ void pn8800fxb_state::io_map(address_map &map) //************************************************************************** static INPUT_PORTS_START( pn8800fxb ) + PORT_START("misc") + // 0x01 sp3 + // 0x02 index + PORT_CONFNAME(0x04, 0x00, "AC Adaptor") + PORT_CONFSETTING( 0x00, "Good") + PORT_CONFSETTING( 0x04, "Not Good") + // 0x08 sp1 + + PORT_START("power") + PORT_CONFNAME(0x01, 0x00, "Li Battery") + PORT_CONFSETTING( 0x00, "Good") + PORT_CONFSETTING( 0x01, "Not Good") + PORT_CONFNAME(0x06, 0x00, "NiCd Battery") + PORT_CONFSETTING( 0x00, "Good") + PORT_CONFSETTING( 0x02, "Low") + PORT_CONFSETTING( 0x04, "Not Good") + PORT_START("KO0") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_NAME("\xe2\x86\x90 EXPR") // ← @@ -491,6 +513,20 @@ static GFXDECODE_START( gfx ) GFXDECODE_END +//************************************************************************** +// AUDIO EMULATION +//************************************************************************** + +void pn8800fxb_state::buzzer_w(uint8_t data) +{ + // 7------- buzzer + // -654321- not used + // -------0 4khzoff + + m_buzzer->set_state(BIT(data, 7)); +} + + //************************************************************************** // MACHINE EMULATION //************************************************************************** @@ -583,6 +619,10 @@ void pn8800fxb_state::pn8800fxb(machine_config &config) GFXDECODE(config, m_gfxdecode, m_palette, gfx); + // sound hardware + SPEAKER(config, "mono").front_center(); + BEEP(config, m_buzzer, 4'000).add_route(ALL_OUTPUTS, "mono", 1.0); // 4.0 kHz generated by the gate array + TC8521(config, "rtc", XTAL(32'768)); // alarm output connected to auto power-on } @@ -606,4 +646,4 @@ ROM_END //************************************************************************** // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1996, pn8800, 0, 0, pn8800fxb, pn8800fxb, pn8800fxb_state, empty_init, "Brother", "PN-8800FXB", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) +COMP( 1996, pn8800, 0, 0, pn8800fxb, pn8800fxb, pn8800fxb_state, empty_init, "Brother", "PN-8800FXB", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3