From f69af40d25a075cd5b0c6f76e897fc31c9e2be5b Mon Sep 17 00:00:00 2001 From: hap Date: Wed, 26 Jul 2023 12:45:48 +0200 Subject: ay8910: reorder documentation, misc: remove some use of set_log --- src/devices/bus/bbc/tube/tube_a500.cpp | 4 +- src/devices/sound/ay8910.cpp | 520 ++++++++++++++++----------------- src/mame/alba/vsmjtria.cpp | 12 +- src/mame/alpha/champbas.cpp | 16 +- src/mame/midcoin/24cdjuke.cpp | 2 +- src/mame/misc/imolagp.cpp | 3 +- src/mame/namco/sweetland.cpp | 2 +- src/mame/neogeo/neogeocd.cpp | 3 +- src/mame/sega/kopunch.cpp | 6 +- src/mame/taito/pkspirit.cpp | 2 +- src/mame/toaplan/slapfght.cpp | 12 +- 11 files changed, 283 insertions(+), 299 deletions(-) diff --git a/src/devices/bus/bbc/tube/tube_a500.cpp b/src/devices/bus/bbc/tube/tube_a500.cpp index 904cc4aeda1..316629585e8 100644 --- a/src/devices/bus/bbc/tube/tube_a500.cpp +++ b/src/devices/bus/bbc/tube/tube_a500.cpp @@ -81,8 +81,8 @@ void bbc_tube_a500_device::device_add_mconfig(machine_config &config) m_ioc->kout_w().set("keyboard", FUNC(archimedes_keyboard_device::kin_w)); m_ioc->peripheral_r<4>().set(m_ula, FUNC(tube_device::parasite_r)); m_ioc->peripheral_w<4>().set(m_ula, FUNC(tube_device::parasite_w)); - m_ioc->peripheral_r<6>().set_log("IOC: External Expansion R"); - m_ioc->peripheral_w<6>().set_log("IOC: External Expansion W"); + m_ioc->peripheral_r<6>().set([this]() { logerror("%s IOC: External Expansion R\n", machine().describe_context()); return 0xffffffff; }); + m_ioc->peripheral_w<6>().set([this](uint32_t data) { logerror("%s IOC: External Expansion W %08X\n", machine().describe_context(), data); }); ARCHIMEDES_KEYBOARD(config, "keyboard").kout().set(m_ioc, FUNC(acorn_ioc_device::kin_w)); diff --git a/src/devices/sound/ay8910.cpp b/src/devices/sound/ay8910.cpp index 8d29e58537a..92e9fcc7df3 100644 --- a/src/devices/sound/ay8910.cpp +++ b/src/devices/sound/ay8910.cpp @@ -1,193 +1,73 @@ // license:BSD-3-Clause // copyright-holders:Couriersud /* - * Couriersud, July 2014: - * - * This documents recent work on the AY8910. A YM2149 is now on it's way from - * Hong Kong as well. - * - * TODO: - * - * - Create a true sound device nAY8910 driver. - * - implement approach outlined below in this driver. - * - * For years I had a AY8910 in my drawer. Arduinos were around as well. - * Using the approach documented in this blog post - * http://www.986-studio.com/2014/05/18/another-ay-entry/#more-476 - * I measured the output voltages using a Extech 520. - * - * Measurement Setup - * - * Laptop <--> Arduino <---> AY8910 - * - * AY8910 Registers: - * 0x07: 3f - * 0x08: RV - * 0x09: RV - * 0x0A: RV - * - * Output was measured on Analog Output B with a resistor RD to - * ground. - * - * Measurement results: - * - * RD 983 9.830k 99.5k 1.001M open - * - * RV B B B B B - * 0 0.0000 0.0000 0.0001 0.0011 0.0616 - * 1 0.0106 0.0998 0.6680 1.8150 2.7260 - * 2 0.0150 0.1377 0.8320 1.9890 2.8120 - * 3 0.0222 0.1960 1.0260 2.1740 2.9000 - * 4 0.0320 0.2708 1.2320 2.3360 2.9760 - * 5 0.0466 0.3719 1.4530 2.4880 3.0440 - * 6 0.0665 0.4938 1.6680 2.6280 3.1130 - * 7 0.1039 0.6910 1.9500 2.7900 3.1860 - * 8 0.1237 0.7790 2.0500 2.8590 3.2340 - * 9 0.1986 1.0660 2.3320 3.0090 3.3090 - * 10 0.2803 1.3010 2.5050 3.0850 3.3380 - * 11 0.3548 1.4740 2.6170 3.1340 3.3590 - * 12 0.4702 1.6870 2.7340 3.1800 3.3730 - * 13 0.6030 1.8870 2.8410 3.2300 3.4050 - * 14 0.7530 2.0740 2.9280 3.2580 3.4170 - * 15 0.9250 2.2510 3.0040 3.2940 3.4380 - * - * Using an equivalent model approach with two resistors - * - * 5V - * | - * Z - * Z Resistor Value for RV - * Z - * | - * +---> Output signal - * | - * Z - * Z External RD - * Z - * | - * GND - * - * will NOT work out of the box since RV = RV(RD). - * - * The following approach will be used going forward based on die pictures - * of the AY8910 done by Dr. Stack van Hay: - * - * - * 5V - * _| D - * G | NMOS - * Vg ---|| Kn depends on volume selected - * |_ S Vs - * | - * | - * +---> VO Output signal - * | - * Z - * Z External RD - * Z - * | - * GND - * - * Whilst conducting, the FET operates in saturation mode: - * - * Id = Kn * (Vgs - Vth)^2 - * - * Using Id = Vs / RD - * - * Vs = Kn * RD * (Vg - Vs - Vth)^2 - * - * finally using Vg' = Vg - Vth - * - * Vs = Vg' + 1 / (2 * Kn * RD) - sqrt((Vg' + 1 / (2 * Kn * RD))^2 - Vg'^2) - * - * and finally - * - * VO = Vs - * - * and this can be used to re-Thenevin to 5V - * - * RVequiv = RD * ( 5V / VO - 1) - * - * The RV and Kn parameter are derived using least squares to match - * calculation results with measurements. - * - * FIXME: - * There is voltage of 60 mV measured with the EX520 (Ri ~ 10M). This may - * be induced by cutoff currents from the 15 FETs. - * - */ - - -/*************************************************************************** - - ay8910.cpp - - Emulation of the AY-3-8910 / YM2149 sound chip. - - Based on various code snippets by Ville Hallik, Michael Cuddy, - Tatsuyuki Satoh, Fabrice Frances, Nicola Salmoria. - - Mostly rewritten by couriersud in 2008 - - Public documentation: - - - http://privatfrickler.de/blick-auf-den-chip-soundchip-general-instruments-ay-3-8910/ - Die pictures of the AY8910 - - - US Patent 4933980 - - Games using ADSR: gyruss - - A list with more games using ADSR can be found here: - http://mametesters.org/view.php?id=3043 - - TODO: - * Measure volume / envelope parameters for AY8930 expanded mode - * YM2610 & YM2608 will need a separate flag in their config structures - to distinguish between legacy and discrete mode. - - The rewrite also introduces a generic model for the DAC. This model is - not perfect, but allows channel mixing based on a parametrized approach. - This model also allows to factor in different loads on individual channels. - If a better model is developed in the future or better measurements are - available, the driver should be easy to change. The model is described - later. - - In order to not break hundreds of existing drivers by default the flag - AY8910_LEGACY_OUTPUT is used by drivers not changed to take into account the - new model. All outputs are normalized to the old output range (i.e. 0 .. 7ffff). - In the case of channel mixing, output range is 0...3 * 7fff. - - The main difference between the AY-3-8910 and the YM2149 is, that the - AY-3-8910 datasheet mentions, that fixed volume level 0, which is set by - registers 8 to 10 is "channel off". The YM2149 mentions, that the generated - signal has a 2V DC component. This is confirmed by measurements. The approach - taken here is to assume the 2V DC offset for all outputs for the YM2149. - For the AY-3-8910, an offset is used if envelope is active for a channel. - This is backed by oscilloscope pictures from the datasheet. If a fixed volume - is set, i.e. envelope is disabled, the output voltage is set to 0V. Recordings - I found on the web for gyruss indicate, that the AY-3-8910 offset should - be around 0.2V. This will also make sound levels more compatible with - user observations for scramble. - - The Model: - 5V 5V - | | - / | - Volume Level x >---| Z - > Z Pullup Resistor RU - | Z - Z | - Rx Z | - Z | - | | - '-----+--------> >---+----> Output signal - | | - Z Z - Pulldown RD Z Z Load RL - Z Z - | | - GND GND + +Emulation of the AY-3-8910 / YM2149 sound chip. + +Based on various code snippets by Ville Hallik, Michael Cuddy, +Tatsuyuki Satoh, Fabrice Frances, Nicola Salmoria. + +Mostly rewritten by couriersud in 2008 + +Public documentation: + +- http://privatfrickler.de/blick-auf-den-chip-soundchip-general-instruments-ay-3-8910/ + Die pictures of the AY8910 + +- US Patent 4933980 + +Games using ADSR: gyruss + +A list with more games using ADSR can be found here: + http://mametesters.org/view.php?id=3043 + +TODO: +* Measure volume / envelope parameters for AY8930 expanded mode +* YM2610 & YM2608 will need a separate flag in their config structures + to distinguish between legacy and discrete mode. + +The rewrite also introduces a generic model for the DAC. This model is +not perfect, but allows channel mixing based on a parametrized approach. +This model also allows to factor in different loads on individual channels. +If a better model is developed in the future or better measurements are +available, the driver should be easy to change. The model is described +later. + +In order to not break hundreds of existing drivers by default the flag +AY8910_LEGACY_OUTPUT is used by drivers not changed to take into account the +new model. All outputs are normalized to the old output range (i.e. 0 .. 7ffff). +In the case of channel mixing, output range is 0...3 * 7fff. + +The main difference between the AY-3-8910 and the YM2149 is, that the +AY-3-8910 datasheet mentions, that fixed volume level 0, which is set by +registers 8 to 10 is "channel off". The YM2149 mentions, that the generated +signal has a 2V DC component. This is confirmed by measurements. The approach +taken here is to assume the 2V DC offset for all outputs for the YM2149. +For the AY-3-8910, an offset is used if envelope is active for a channel. +This is backed by oscilloscope pictures from the datasheet. If a fixed volume +is set, i.e. envelope is disabled, the output voltage is set to 0V. Recordings +I found on the web for gyruss indicate, that the AY-3-8910 offset should +be around 0.2V. This will also make sound levels more compatible with +user observations for scramble. + +The Model: + 5V 5V + | | + / | +Volume Level x >---| Z + > Z Pullup Resistor RU + | Z + Z | + Rx Z | + Z | + | | + '-----+--------> >---+----> Output signal + | | + Z Z + Pulldown RD Z Z Load RL + Z Z + | | + GND GND Each Volume level x will select a different resistor Rx. Measurements from fpgaarcade.com where used to calibrate channel mixing for the YM2149. This was done using @@ -228,29 +108,28 @@ has twice the steps, happening twice as fast. **************************************************************************** - The bus control and chip selection signals of the AY PSGs and their - pin-compatible clones such as YM2149 are somewhat unconventional and - redundant, having been designed for compatibility with GI's CP1610 - series of microprocessors. Much of the redundancy can be finessed by - tying BC2 to Vcc; AY-3-8913 and AY8930 do this internally. - - /A9 A8 /CS BDIR BC2 BC1 - AY-3-8910 24 25 n/a 27 28 29 - AY-3-8912 n/a 17 n/a 18 19 20 - AY-3-8913 22 23 24 2 n/a 3 - ------------------------------------ - Inactive NACT 0 0 0 - Latch address ADAR 0 0 1 - Inactive IAB 0 1 0 - Read from PSG DTB 0 1 1 - Latch address BAR 1 0 0 - Inactive DW 1 0 1 - Write to PSG DWS 1 1 0 - Latch address INTAK 1 1 1 - -***************************************************************************/ - -/** +The bus control and chip selection signals of the AY PSGs and their +pin-compatible clones such as YM2149 are somewhat unconventional and +redundant, having been designed for compatibility with GI's CP1610 +series of microprocessors. Much of the redundancy can be finessed by +tying BC2 to Vcc; AY-3-8913 and AY8930 do this internally. + + /A9 A8 /CS BDIR BC2 BC1 + AY-3-8910 24 25 n/a 27 28 29 + AY-3-8912 n/a 17 n/a 18 19 20 + AY-3-8913 22 23 24 2 n/a 3 + ------------------------------------ + Inactive NACT 0 0 0 + Latch address ADAR 0 0 1 + Inactive IAB 0 1 0 + Read from PSG DTB 0 1 1 + Latch address BAR 1 0 0 + Inactive DW 1 0 1 + Write to PSG DWS 1 1 0 + Latch address INTAK 1 1 1 + +**************************************************************************** + AY-3-8910(A)/8914/8916/8917/8930/YM2149 (others?): _______ _______ _| \__/ |_ @@ -579,6 +458,122 @@ AY-8930 datasheet: http://www.ym2149.com/ay8930.pdf YM2149 datasheet: http://www.ym2149.com/ym2149.pdf YM2203 English datasheet: http://www.appleii-box.de/APPLE2/JonasCard/YM2203%20datasheet.pdf YM2203 Japanese datasheet contents, translated: http://www.larwe.com/technical/chip_ymopn.html + +**************************************************************************** + +Couriersud, July 2014: + +This documents recent work on the AY8910. A YM2149 is now on it's way from +Hong Kong as well. + +TODO: +- Create a true sound device nAY8910 driver. +- implement approach outlined below in this driver. + +For years I had a AY8910 in my drawer. Arduinos were around as well. +Using the approach documented in this blog post + http://www.986-studio.com/2014/05/18/another-ay-entry/#more-476 +I measured the output voltages using a Extech 520. + +Measurement Setup + +Laptop <--> Arduino <---> AY8910 + +AY8910 Registers: +0x07: 3f +0x08: RV +0x09: RV +0x0A: RV + +Output was measured on Analog Output B with a resistor RD to +ground. + +Measurement results: + +RD 983 9.830k 99.5k 1.001M open + +RV B B B B B + 0 0.0000 0.0000 0.0001 0.0011 0.0616 + 1 0.0106 0.0998 0.6680 1.8150 2.7260 + 2 0.0150 0.1377 0.8320 1.9890 2.8120 + 3 0.0222 0.1960 1.0260 2.1740 2.9000 + 4 0.0320 0.2708 1.2320 2.3360 2.9760 + 5 0.0466 0.3719 1.4530 2.4880 3.0440 + 6 0.0665 0.4938 1.6680 2.6280 3.1130 + 7 0.1039 0.6910 1.9500 2.7900 3.1860 + 8 0.1237 0.7790 2.0500 2.8590 3.2340 + 9 0.1986 1.0660 2.3320 3.0090 3.3090 +10 0.2803 1.3010 2.5050 3.0850 3.3380 +11 0.3548 1.4740 2.6170 3.1340 3.3590 +12 0.4702 1.6870 2.7340 3.1800 3.3730 +13 0.6030 1.8870 2.8410 3.2300 3.4050 +14 0.7530 2.0740 2.9280 3.2580 3.4170 +15 0.9250 2.2510 3.0040 3.2940 3.4380 + +Using an equivalent model approach with two resistors + + 5V + | + Z + Z Resistor Value for RV + Z + | + +---> Output signal + | + Z + Z External RD + Z + | + GND + +will NOT work out of the box since RV = RV(RD). + +The following approach will be used going forward based on die pictures +of the AY8910 done by Dr. Stack van Hay: + + + 5V + _| D + G | NMOS + Vg ---|| Kn depends on volume selected + |_ S Vs + | + | + +---> VO Output signal + | + Z + Z External RD + Z + | + GND + +Whilst conducting, the FET operates in saturation mode: + +Id = Kn * (Vgs - Vth)^2 + +Using Id = Vs / RD + +Vs = Kn * RD * (Vg - Vs - Vth)^2 + +finally using Vg' = Vg - Vth + +Vs = Vg' + 1 / (2 * Kn * RD) - sqrt((Vg' + 1 / (2 * Kn * RD))^2 - Vg'^2) + +and finally + +VO = Vs + +and this can be used to re-Thenevin to 5V + +RVequiv = RD * ( 5V / VO - 1) + +The RV and Kn parameter are derived using least squares to match +calculation results with measurements. + +FIXME: +There is voltage of 60 mV measured with the EX520 (Ri ~ 10M). This may +be induced by cutoff currents from the 15 FETs. + */ #include "emu.h" @@ -599,12 +594,6 @@ YM2203 Japanese datasheet contents, translated: http://www.larwe.com/technical/c static constexpr stream_buffer::sample_t MAX_OUTPUT = 1.0; -/************************************* - * - * Type definitions - * - *************************************/ - /************************************* * @@ -654,11 +643,9 @@ static const ay8910_device::ay_ym_param ay8910_param = 4120, 2512, 1737, 1335, 1005, 747, 586, 451 }, }; -/* - * RL = 3000, Hacker Kay normalized pattern, 1.5V to 2.8V - * These values correspond with guesses based on Gyruss schematics - * They work well with scramble as well. - */ +// RL = 3000, Hacker Kay normalized pattern, 1.5V to 2.8V +// These values correspond with guesses based on Gyruss schematics +// They work well with scramble as well. static const ay8910_device::ay_ym_param ay8910_param = { 930, 454, @@ -667,12 +654,10 @@ static const ay8910_device::ay_ym_param ay8910_param = 4189, 2557, 1772, 1363, 1028, 766, 602, 464 }, }; -/* - * RL = 1000, Hacker Kay normalized pattern, 0.75V to 2.05V - * These values correspond with guesses based on Gyruss schematics - * They work well with scramble as well. - */ -static const ay8910_device::ay_ym_param ay8910_param = +// RL = 1000, Hacker Kay normalized pattern, 0.75V to 2.05V +// These values correspond with guesses based on Gyruss schematics +// They work well with scramble as well. + tatic const ay8910_device::ay_ym_param ay8910_param = { 1371, 313, 16, @@ -680,9 +665,7 @@ static const ay8910_device::ay_ym_param ay8910_param = 3814, 2337, 1629, 1263, 962, 727, 580, 458 }, }; -/* - * RL = 1000, Hacker Kay normalized pattern, 0.2V to 1.5V - */ +// RL = 1000, Hacker Kay normalized pattern, 0.2V to 1.5V static const ay8910_device::ay_ym_param ay8910_param = { 5806, 300, @@ -693,44 +676,45 @@ static const ay8910_device::ay_ym_param ay8910_param = #endif /* - * RL = 2000, Based on Matthew Westcott's measurements from Dec 2001. - * ------------------------------------------------------------------- - * - * http://groups.google.com/group/comp.sys.sinclair/browse_thread/thread/fb3091da4c4caf26/d5959a800cda0b5e?lnk=gst&q=Matthew+Westcott#d5959a800cda0b5e - * After what Russell mentioned a couple of weeks back about the lack of - * publicised measurements of AY chip volumes - I've finally got round to - * making these readings, and I'm placing them in the public domain - so - * anyone's welcome to use them in emulators or anything else. - - * To make the readings, I set up the chip to produce a constant voltage on - * channel C (setting bits 2 and 5 of register 6), and varied the amplitude - * (the low 4 bits of register 10). The voltages were measured between the - * channel C output (pin 1) and ground (pin 6). - * - * Level Voltage - * 0 1.147 - * 1 1.162 - * 2 1.169 - * 3 1.178 - * 4 1.192 - * 5 1.213 - * 6 1.238 - * 7 1.299 - * 8 1.336 - * 9 1.457 - * 10 1.573 - * 11 1.707 - * 12 1.882 - * 13 2.06 - * 14 2.32 - * 15 2.58 - * ------------------------------------------------------------------- - * - * The ZX spectrum output circuit was modelled in SwitcherCAD and - * the resistor values below create the voltage levels above. - * RD was measured on a real chip to be 8m Ohm, RU was 0.8m Ohm. - */ +RL = 2000, Based on Matthew Westcott's measurements from Dec 2001. +------------------------------------------------------------------- + +http://groups.google.com/group/comp.sys.sinclair/browse_thread/thread/fb3091da4c4caf26/d5959a800cda0b5e?lnk=gst&q=Matthew+Westcott#d5959a800cda0b5e +After what Russell mentioned a couple of weeks back about the lack of +publicised measurements of AY chip volumes - I've finally got round to +making these readings, and I'm placing them in the public domain - so +anyone's welcome to use them in emulators or anything else. + +To make the readings, I set up the chip to produce a constant voltage on +channel C (setting bits 2 and 5 of register 6), and varied the amplitude +(the low 4 bits of register 10). The voltages were measured between the +channel C output (pin 1) and ground (pin 6). + +Level Voltage + 0 1.147 + 1 1.162 + 2 1.169 + 3 1.178 + 4 1.192 + 5 1.213 + 6 1.238 + 7 1.299 + 8 1.336 + 9 1.457 +10 1.573 +11 1.707 +12 1.882 +13 2.06 +14 2.32 +15 2.58 +------------------------------------------------------------------- + +The ZX spectrum output circuit was modelled in SwitcherCAD and +the resistor values below create the voltage levels above. +RD was measured on a real chip to be 8m Ohm, RU was 0.8m Ohm. + +*/ static const ay8910_device::ay_ym_param ay8910_param = { @@ -767,7 +751,6 @@ static const ay8910_device::mosfet_param ay8910_mosfet_param = - /************************************* * * Inline @@ -1501,6 +1484,7 @@ void ay8910_device::device_reset() ay8910_reset_ym(); } + /************************************* * * Read/Write Handlers diff --git a/src/mame/alba/vsmjtria.cpp b/src/mame/alba/vsmjtria.cpp index a17bf2495e3..5cfc9c407ff 100644 --- a/src/mame/alba/vsmjtria.cpp +++ b/src/mame/alba/vsmjtria.cpp @@ -525,20 +525,20 @@ void vsmjtria_state::vsmjtria(machine_config &config) GENERIC_LATCH_8(config, "latch1"); i8255_device &ppi0(I8255(config, "ppi0")); - ppi0.in_pa_callback().set_log("ppi0 pa read"); + ppi0.in_pa_callback().set([this]() { logerror("%s ppi0 pa read\n", machine().describe_context()); return 0; }); ppi0.in_pb_callback().set(FUNC(vsmjtria_state::keyboard_r<0>)); ppi0.in_pc_callback().set_ioport("P1_COIN"); ppi0.out_pa_callback().set(FUNC(vsmjtria_state::keyboard_w<0>)); - ppi0.out_pb_callback().set_log("ppi0 pb write"); - ppi0.out_pc_callback().set_log("ppi0 pc write"); + ppi0.out_pb_callback().set([this](uint8_t data) { logerror("%s ppi0 pb write: %02X\n", machine().describe_context(), data); }); + ppi0.out_pc_callback().set([this](uint8_t data) { logerror("%s ppi0 pc write: %02X\n", machine().describe_context(), data); }); i8255_device &ppi1(I8255(config, "ppi1")); - ppi1.in_pa_callback().set_log("ppi1 pa read"); + ppi1.in_pa_callback().set([this]() { logerror("%s ppi1 pa read\n", machine().describe_context()); return 0; }); ppi1.in_pb_callback().set(FUNC(vsmjtria_state::keyboard_r<1>)); ppi1.in_pc_callback().set_ioport("P2_COIN"); ppi1.out_pa_callback().set(FUNC(vsmjtria_state::keyboard_w<1>)); - ppi1.out_pb_callback().set_log("ppi1 pb write"); - ppi1.out_pc_callback().set_log("ppi1 pc write"); + ppi1.out_pb_callback().set([this](uint8_t data) { logerror("%s ppi1 pb write: %02X\n", machine().describe_context(), data); }); + ppi1.out_pc_callback().set([this](uint8_t data) { logerror("%s ppi1 pc write: %02X\n", machine().describe_context(), data); }); PALETTE(config, "palette0", palette_device::RGB_444_PROMS, "mainproms", 256); PALETTE(config, "palette1", palette_device::RGB_444_PROMS, "subproms", 256); diff --git a/src/mame/alpha/champbas.cpp b/src/mame/alpha/champbas.cpp index 7ee183ac992..bf64f3f68aa 100644 --- a/src/mame/alpha/champbas.cpp +++ b/src/mame/alpha/champbas.cpp @@ -1056,16 +1056,16 @@ void champbas_state::tbasebal(machine_config &config) /* basic machine hardware */ m_maincpu->set_addrmap(AS_PROGRAM, &champbas_state::tbasebal_map); - m_mainlatch->q_out_cb<6>().set([this](int state){ logerror("%s latch bit 6 w: %02x\n", machine().describe_context(), state); }); // to M68705? the code here seems the same as champbb2 - m_mainlatch->q_out_cb<7>().set([this](int state){ logerror("%s latch bit 7 w: %02x\n", machine().describe_context(), state); }); // " + m_mainlatch->q_out_cb<6>().set([this](int state) { logerror("%s latch bit 6 w: %d\n", machine().describe_context(), state); }); // to M68705? the code here seems the same as champbb2 + m_mainlatch->q_out_cb<7>().set([this](int state) { logerror("%s latch bit 7 w: %d\n", machine().describe_context(), state); }); // " m68705p_device &mcu(M68705P3(config, "mcu", XTAL(18'432'000) / 6)); // ?Mhz - mcu.porta_r().set_log("MCU port A r"); - mcu.porta_w().set([this](uint8_t data){ logerror("%s MCU port A w: %02x\n", machine().describe_context(), data); }); - mcu.portb_r().set_log("MCU port B r"); - mcu.portb_w().set([this](uint8_t data){ logerror("%s MCU port B w: %02x\n", machine().describe_context(), data); }); - mcu.portc_r().set_log("MCU port C r"); - mcu.portc_w().set([this](uint8_t data){ logerror("%s MCU port C w: %02x\n", machine().describe_context(), data); }); + mcu.porta_r().set([this]() { logerror("%s MCU port A r\n", machine().describe_context()); return 0xff; }); + mcu.porta_w().set([this](uint8_t data) { logerror("%s MCU port A w: %02X\n", machine().describe_context(), data); }); + mcu.portb_r().set([this]() { logerror("%s MCU port B r\n", machine().describe_context()); return 0xff; }); + mcu.portb_w().set([this](uint8_t data) { logerror("%s MCU port B w: %02X\n", machine().describe_context(), data); }); + mcu.portc_r().set([this]() { logerror("%s MCU port C r\n", machine().describe_context()); return 0xff; }); + mcu.portc_w().set([this](uint8_t data) { logerror("%s MCU port C w: %02X\n", machine().describe_context(), data); }); } diff --git a/src/mame/midcoin/24cdjuke.cpp b/src/mame/midcoin/24cdjuke.cpp index e52d360d0ff..a48ecd08262 100644 --- a/src/mame/midcoin/24cdjuke.cpp +++ b/src/mame/midcoin/24cdjuke.cpp @@ -309,7 +309,7 @@ void midcoin24cdjuke_state::midcoin24cdjuke(machine_config &config) ic25.out_pc_callback().set(FUNC(midcoin24cdjuke_state::kb_col_w)); i8255_device &ic31(I8255A(config, "ic31", 0)); - ic31.out_pb_callback().set_log("PPI8255 - unmapped write port B"); + ic31.out_pb_callback().set([this](uint8_t data) { logerror("%s ic31 write port B: %02X\n", machine().describe_context(), data); }); ic31.in_pc_callback().set_ioport("MD4"); } diff --git a/src/mame/misc/imolagp.cpp b/src/mame/misc/imolagp.cpp index 02dcbcc2e78..435ca1cd633 100644 --- a/src/mame/misc/imolagp.cpp +++ b/src/mame/misc/imolagp.cpp @@ -554,8 +554,7 @@ void imolagp_state::imolagp(machine_config &config) i8255_device &ppi(I8255A(config, "ppi8255", 0)); // mode $91 - ports A & C-lower as input, ports B & C-upper as output ppi.in_pa_callback().set_ioport("IN0"); - ppi.in_pb_callback().set_log("PPI8255 - unmapped read port B"); - ppi.out_pb_callback().set_log("PPI8255 - unmapped write port B"); + ppi.out_pb_callback().set([this](uint8_t data) { logerror("%s PPI write port B: %02X\n", machine().describe_context(), data); }); ppi.in_pc_callback().set_ioport("IN1"); /* video hardware */ diff --git a/src/mame/namco/sweetland.cpp b/src/mame/namco/sweetland.cpp index cbf3bfb69fa..40b84c9208c 100644 --- a/src/mame/namco/sweetland.cpp +++ b/src/mame/namco/sweetland.cpp @@ -162,7 +162,7 @@ void sweetland_state::sweetland(machine_config &config) ym2203_device &ym(YM2203(config, "ym", XTAL(8'000'000)/2)); ym.irq_handler().set_inputline("maincpu", 0); - ym.port_a_read_callback().set_log("YM2203IOA read"); + ym.port_a_read_callback().set([this]() { logerror("%s YM2203IOA read\n", machine().describe_context()); return 0; }); ym.port_b_read_callback().set_ioport("YM2203IOB"); ym.add_route(0, "mono", 0.25); ym.add_route(1, "mono", 0.25); diff --git a/src/mame/neogeo/neogeocd.cpp b/src/mame/neogeo/neogeocd.cpp index 10e840127a8..a4112b35b42 100644 --- a/src/mame/neogeo/neogeocd.cpp +++ b/src/mame/neogeo/neogeocd.cpp @@ -1049,7 +1049,8 @@ void ngcd_state::neocd_ntsc(machine_config &config) m_audiocpu->set_addrmap(AS_PROGRAM, &ngcd_state::neocd_audio_map); m_audiocpu->set_addrmap(AS_IO, &ngcd_state::neocd_audio_io_map); - subdevice("systemlatch")->q_out_cb<1>().set_log("NeoCD: write to regular vector change address?"); // what IS going on with "neocdz doubledr" and why do games write here if it's hooked up to nothing? + // what IS going on with "neocdz doubledr" and why do games write here if it's hooked up to nothing? + subdevice("systemlatch")->q_out_cb<1>().set([this](int state) { logerror("%s NeoCD: write %d to regular vector change address?\n", machine().describe_context(), state); }); m_screen->set_screen_update(FUNC(ngcd_state::screen_update)); diff --git a/src/mame/sega/kopunch.cpp b/src/mame/sega/kopunch.cpp index eef5ce262c1..72196f7daec 100644 --- a/src/mame/sega/kopunch.cpp +++ b/src/mame/sega/kopunch.cpp @@ -430,13 +430,13 @@ void kopunch_state::kopunch(machine_config &config) i8255_device &ppi1(I8255A(config, "ppi8255_1")); // $34 - always $80 (PPI mode 0, ports A & B & C as output) ppi1.out_pa_callback().set(FUNC(kopunch_state::coin_w)); - ppi1.out_pb_callback().set_log("PPI8255 - unmapped write port B"); - ppi1.out_pc_callback().set_log("PPI8255 - unmapped write port C"); + ppi1.out_pb_callback().set([this](uint8_t data) { logerror("%s ppi1 write port B: %02X\n", machine().describe_context(), data); }); + ppi1.out_pc_callback().set([this](uint8_t data) { logerror("%s ppi1 write port C: %02X\n", machine().describe_context(), data); }); i8255_device &ppi2(I8255A(config, "ppi8255_2")); // $38 - always $89 (PPI mode 0, ports A & B as output, port C as input) ppi2.out_pa_callback().set(FUNC(kopunch_state::lamp_w)); - ppi2.out_pb_callback().set_log("PPI8255 - unmapped write port B"); + ppi2.out_pb_callback().set([this](uint8_t data) { logerror("%s ppi2 write port B: %02X\n", machine().describe_context(), data); }); ppi2.in_pc_callback().set_ioport("DSW"); i8255_device &ppi3(I8255A(config, "ppi8255_3")); diff --git a/src/mame/taito/pkspirit.cpp b/src/mame/taito/pkspirit.cpp index 1bf79db769b..dc164c19f0d 100644 --- a/src/mame/taito/pkspirit.cpp +++ b/src/mame/taito/pkspirit.cpp @@ -222,7 +222,7 @@ void pkspirit_state::pkspirit(machine_config &config) // basic machine hardware TMP68301(config, m_maincpu, 32_MHz_XTAL / 2); // divider not verified, actually TMP68303F-16 m_maincpu->set_addrmap(AS_PROGRAM, &pkspirit_state::main_map); - m_maincpu->parallel_r_cb().set_log("par_r"); + m_maincpu->parallel_r_cb().set([this]() { logerror("%s par_r\n", machine().describe_context()); return 0xffff; }); z80_device &audiocpu(Z80(config, "audiocpu", 36_MHz_XTAL / 9)); // divider not verified, but marked as 4MHz on PCB audiocpu.set_addrmap(AS_PROGRAM, &pkspirit_state::sound_map); diff --git a/src/mame/toaplan/slapfght.cpp b/src/mame/toaplan/slapfght.cpp index 3a7e5c8bd29..513e6e37334 100644 --- a/src/mame/toaplan/slapfght.cpp +++ b/src/mame/toaplan/slapfght.cpp @@ -1015,12 +1015,12 @@ void slapfght_state::tigerhb4(machine_config &config) // TODO: hook up m68705p_device &mcu(M68705P5(config, "mcu", 6000000)); // unverified clock - mcu.porta_r().set_log("port A read"); - mcu.portb_r().set_log("port B read"); - mcu.portc_r().set_log("port C read"); - mcu.porta_w().set([this](uint8_t data) { logerror("port a write: %02x\n", data); }); - mcu.portb_w().set([this](uint8_t data) { logerror("port b write: %02x\n", data); }); - mcu.portc_w().set([this](uint8_t data) { logerror("port c write: %02x\n", data); }); + mcu.porta_r().set([this]() { logerror("%s MCU port A read\n", machine().describe_context()); return 0xff; }); + mcu.portb_r().set([this]() { logerror("%s MCU port B read\n", machine().describe_context()); return 0xff; }); + mcu.portc_r().set([this]() { logerror("%s MCU port C read\n", machine().describe_context()); return 0xff; }); + mcu.porta_w().set([this](uint8_t data) { logerror("%s MCU port a write: %02X\n", machine().describe_context(), data); }); + mcu.portb_w().set([this](uint8_t data) { logerror("%s MCU port b write: %02X\n", machine().describe_context(), data); }); + mcu.portc_w().set([this](uint8_t data) { logerror("%s MCU port c write: %02X\n", machine().describe_context(), data); }); } void slapfght_state::slapfigh(machine_config &config) -- cgit v1.2.3