From ef515893122866f8e98e47f9f758f96f539a60c3 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Tue, 11 May 2021 22:19:16 +0200 Subject: [PATCH] pc9801.cpp: add implementation of the DAC_1BIT interface (#8017) * pc9801.cpp: add implementation of the DAC_1BIT interface * pc9801.cpp: fix DAC1BIT sound aliasing by changing it to a speaker_sound_device, kudos to Lord Nightmare for pointing this out * pc98.xml: update QA notes * pc98.xml: fix zeta boot order, promoted to working * pc9801.cpp: bind level_w directly instead of lambda trampoline --- hash/pc98.xml | 50 ++++++++++++++++++++----------------- src/mame/drivers/pc9801.cpp | 31 +++++++++++++++++------ src/mame/includes/pc9801.h | 13 +++++++--- 3 files changed, 61 insertions(+), 33 deletions(-) diff --git a/hash/pc98.xml b/hash/pc98.xml index 178faa189d2..9b8c947e46f 100644 --- a/hash/pc98.xml +++ b/hash/pc98.xml @@ -5474,8 +5474,8 @@ only have some part of Windows file and a Video driver(CLGD?). - - + + Arquelphos 1993 @@ -7286,7 +7286,7 @@ only have some part of Windows file and a Video driver(CLGD?). - + Bishoujo Tsuushin - Chat no Susume @@ -7603,7 +7603,7 @@ only have some part of Windows file and a Video driver(CLGD?). - + Block Out (Patched?) 1991 @@ -20933,7 +20933,7 @@ only have some part of Windows file and a Video driver(CLGD?). - + Gals Talk Hyper Bingo @@ -23399,7 +23399,7 @@ only have some part of Windows file and a Video driver(CLGD?). - + Hercequary 1994 @@ -28339,8 +28339,8 @@ only have some part of Windows file and a Video driver(CLGD?). - - + + Madou Monogatari 1 1991 コンパイル (Compile) @@ -28360,8 +28360,8 @@ only have some part of Windows file and a Video driver(CLGD?). - - + + Madou Monogatari 2 1991 コンパイル (Compile) @@ -28381,8 +28381,8 @@ only have some part of Windows file and a Video driver(CLGD?). - - + + Madou Monogatari 3 1991 コンパイル (Compile) @@ -36345,8 +36345,9 @@ Requires MS-DOS 5.00H plus an unknown procedure (HDD install?) - - + + + Puyo Puyo 1993 コンパイル (Compile) @@ -49368,12 +49369,15 @@ Requires MS-DOS 5.00H plus an unknown procedure (HDD install?) - + + Zeta 1991 トンキンハウス (Tonkin House) + + @@ -49381,17 +49385,17 @@ Requires MS-DOS 5.00H plus an unknown procedure (HDD install?) - - - - - - + + + + + + @@ -69101,8 +69105,8 @@ Same as Police Quest 2 - Quest for Glory stand-alone disks - - + + TransbOrder 1993 コンパイル (Compile) diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 861a097c6e8..287fcd89a42 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -15,8 +15,7 @@ - CMT support (-13/-36 cbus only, identify which models mounted it off the bat); - Write a PC80S31K device for 2d type floppies (also used on PC-8801 and PC-88VA, it's the FDC + Z80 sub-system); - - Anything post-PC9801E/F/M should overwrite "speaker_device" to actually use a - dac_bit_interface instead (cfr. DAC1BIT in SW list); + - DAC1BIT has a bit of clicking with start/end of samples, is it fixable or just a btanb? - clean-ups & split into separate devices and driver flavours; - derive romsets by default options (cfr. 3.5 2HD floppies vs. default 5.25, 2D/2DD etc.); - Remove kludge for POR bit in a20_ctrl_w fn; @@ -1877,11 +1876,19 @@ ch3 SCSI * ****************************************/ -void pc9801_state::ppi_sys_portc_w(uint8_t data) +void pc9801_state::ppi_sys_beep_portc_w(uint8_t data) { m_beeper->set_state(!(data & 0x08)); } +void pc9801_state::ppi_sys_dac_portc_w(uint8_t data) +{ + m_dac_disable = BIT(data, 3); + // TODO: some models have a finer grained volume control at I/O port 0xae8e + // (98NOTE only?) + m_dac->set_output_gain(0, m_dac_disable ? 0.0 : 1.0); +} + /* * Mouse 8255 I/F * @@ -2083,6 +2090,8 @@ MACHINE_START_MEMBER(pc9801_state,pc9801rs) { MACHINE_START_CALL_MEMBER(pc9801_common); + save_item(NAME(m_dac_disable)); + m_sys_type = 0x80 >> 6; } @@ -2112,8 +2121,6 @@ MACHINE_RESET_MEMBER(pc9801_state,pc9801_common) { memset(m_tvram.get(), 0, sizeof(uint16_t) * 0x2000); - m_beeper->set_state(0); - m_nmi_ff = 0; m_mouse.control = 0xff; m_mouse.freq_reg = 0; @@ -2143,6 +2150,8 @@ MACHINE_RESET_MEMBER(pc9801_state,pc9801f) for(i=0;i<0x1000;i++) ROM[i] = PRG[i+op_mode*0x8000+0x10000]; + + m_beeper->set_state(0); } MACHINE_RESET_MEMBER(pc9801_state,pc9801rs) @@ -2162,6 +2171,8 @@ MACHINE_RESET_MEMBER(pc9801_state,pc9801rs) else m_maincpu->space(AS_PROGRAM).install_rom(0xd8000, 0xd9fff, memregion("ide")->base() + 0x2000); } + + m_dac_disable = true; } MACHINE_RESET_MEMBER(pc9801_state,pc9821) @@ -2348,7 +2359,7 @@ void pc9801_state::pc9801_common(machine_config &config) m_ppi_sys->in_pa_callback().set_ioport("DSW2"); m_ppi_sys->in_pb_callback().set_ioport("DSW1"); m_ppi_sys->in_pc_callback().set_constant(0xa0); // 0x80 cpu triple fault reset flag? - m_ppi_sys->out_pc_callback().set(FUNC(pc9801_state::ppi_sys_portc_w)); +// m_ppi_sys->out_pc_callback().set(FUNC(pc9801_state::ppi_sys_portc_w)); I8255(config, m_ppi_prn, 0); // TODO: check this one @@ -2393,7 +2404,6 @@ void pc9801_state::pc9801_common(machine_config &config) SPEAKER(config, "mono").front_center(); - BEEP(config, m_beeper, 2400).add_route(ALL_OUTPUTS, "mono", 0.15); GFXDECODE(config, m_gfxdecode, m_palette, gfx_pc9801); } @@ -2405,6 +2415,7 @@ void pc9801_state::pc9801(machine_config &config) m_maincpu->set_irq_acknowledge_callback("pic8259_master", FUNC(pic8259_device::inta_cb)); pc9801_common(config); + m_ppi_sys->out_pc_callback().set(FUNC(pc9801_state::ppi_sys_beep_portc_w)); MCFG_MACHINE_START_OVERRIDE(pc9801_state, pc9801f) MCFG_MACHINE_RESET_OVERRIDE(pc9801_state, pc9801f) @@ -2424,6 +2435,7 @@ void pc9801_state::pc9801(machine_config &config) m_dmac->in_ior_callback<3>().set(m_fdc_2dd, FUNC(upd765a_device::dma_r)); m_dmac->out_iow_callback<3>().set(m_fdc_2dd, FUNC(upd765a_device::dma_w)); + BEEP(config, m_beeper, 2400).add_route(ALL_OUTPUTS, "mono", 0.15); PALETTE(config, m_palette, FUNC(pc9801_state::pc9801_palette), 16); } @@ -2435,6 +2447,9 @@ void pc9801_state::pc9801rs(machine_config &config) m_maincpu->set_irq_acknowledge_callback("pic8259_master", FUNC(pic8259_device::inta_cb)); pc9801_common(config); + m_ppi_sys->out_pc_callback().set(FUNC(pc9801_state::ppi_sys_dac_portc_w)); + // TODO: verify if it needs invert(); + m_pit8253->out_handler<1>().set( m_dac, FUNC(speaker_sound_device::level_w)); ADDRESS_MAP_BANK(config, "ipl_bank").set_map(&pc9801_state::ipl_bank).set_options(ENDIANNESS_LITTLE, 16, 18, 0x18000); @@ -2450,6 +2465,8 @@ void pc9801_state::pc9801rs(machine_config &config) m_hgdc2->set_addrmap(0, &pc9801_state::upd7220_grcg_2_map); +// DAC_1BIT(config, m_dac, 0).set_output_range(-1, 1).add_route(ALL_OUTPUTS, "mono", 0.15); + SPEAKER_SOUND(config, m_dac).add_route(ALL_OUTPUTS, "mono", 0.40); PALETTE(config, m_palette, FUNC(pc9801_state::pc9801_palette), 16 + 16); } diff --git a/src/mame/includes/pc9801.h b/src/mame/includes/pc9801.h index e4d4e2e98d3..c426a5da972 100644 --- a/src/mame/includes/pc9801.h +++ b/src/mame/includes/pc9801.h @@ -30,6 +30,7 @@ #include "bus/scsi/scsihd.h" #include "sound/beep.h" +//#include "sound/dac.h" #include "sound/spkrdev.h" #include "sound/ym2608.h" @@ -105,6 +106,7 @@ public: m_video_ram_2(*this, "video_ram_2"), m_ext_gvram(*this, "ext_gvram"), m_beeper(*this, "beeper"), + m_dac(*this, "dac"), m_ram(*this, RAM_TAG), m_ipl(*this, "ipl_bank"), m_gfxdecode(*this, "gfxdecode"), @@ -175,7 +177,9 @@ private: required_shared_ptr m_video_ram_1; required_shared_ptr m_video_ram_2; optional_shared_ptr m_ext_gvram; - required_device m_beeper; + optional_device m_beeper; +// optional_device m_dac; + optional_device m_dac; optional_device m_ram; optional_device m_ipl; required_device m_gfxdecode; @@ -317,7 +321,8 @@ private: DECLARE_WRITE_LINE_MEMBER(dack1_w); DECLARE_WRITE_LINE_MEMBER(dack2_w); DECLARE_WRITE_LINE_MEMBER(dack3_w); - void ppi_sys_portc_w(uint8_t data); + void ppi_sys_beep_portc_w(uint8_t data); + void ppi_sys_dac_portc_w(uint8_t data); DECLARE_WRITE_LINE_MEMBER(fdc_2dd_irq); DECLARE_WRITE_LINE_MEMBER(pc9801rs_fdc_irq); @@ -330,7 +335,6 @@ private: TIMER_DEVICE_CALLBACK_MEMBER( mouse_irq_cb ); uint8_t unk_r(); - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t a20_286(bool state); @@ -393,6 +397,9 @@ private: uint8_t m_ide_sel; + // starting from PC9801VF/U buzzer is substituted with a DAC1BIT + bool m_dac_disable; + /* PC9801RS specific, move to specific state */ uint8_t m_gate_a20; //A20 line uint8_t m_access_ctrl; // DMA related