From 120388363eb7f24892bc6bcad24cfd1069abca44 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sun, 10 Apr 2022 10:02:03 +1000 Subject: nc.cpp: coverity 138975 Note says nc200 hang at start, but when tested it works, so... Machines promoted to working ---------------------------- NC200 --- src/mame/drivers/nc.cpp | 24 ++++++------------------ src/mame/includes/nc.h | 4 ++-- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/mame/drivers/nc.cpp b/src/mame/drivers/nc.cpp index 9dac8e3a4ce..8be5d21d178 100644 --- a/src/mame/drivers/nc.cpp +++ b/src/mame/drivers/nc.cpp @@ -556,28 +556,16 @@ uint8_t nc_state::nc_key_data_in_r(offs_t offset) void nc_state::nc_sound_update(int channel) { - int on; - int frequency; - int period; - beep_device *beeper_device = nullptr; + channel &= 1; + beep_device *beeper_device = channel ? m_beeper2 : m_beeper1; - switch(channel) - { - case 0: - beeper_device = m_beeper1; - break; - case 1: - beeper_device = m_beeper2; - break; - } - - period = m_sound_channel_periods[channel]; + int period = m_sound_channel_periods[channel]; /* if top bit is 0, sound is on */ - on = ((period & (1<<15))==0); + int on = ((period & (1<<15))==0); /* calculate frequency from period */ - frequency = (int)(1000000.0f/((float)((period & 0x07fff)<<1) * 1.6276f)); + int frequency = (int)(1000000.0f/((float)((period & 0x07fff)<<1) * 1.6276f)); /* set state */ beeper_device->set_state(on); @@ -1513,4 +1501,4 @@ ROM_END COMP( 1992, nc100, 0, 0, nc100, nc100, nc100_state, init_nc, "Amstrad plc", "NC100", 0 ) COMP( 1992, dw225, nc100, 0, nc100, nc100, nc100_state, init_nc, "NTS Computer Systems", "DreamWriter 225", 0 ) COMP( 1992, nc150, nc100, 0, nc100, nc100, nc100_state, init_nc, "Amstrad plc", "NC150", 0 ) -COMP( 1993, nc200, 0, 0, nc200, nc200, nc200_state, init_nc, "Amstrad plc", "NC200", MACHINE_NOT_WORKING ) // boot hangs while checking the MC146818 UIP (update in progress) bit +COMP( 1993, nc200, 0, 0, nc200, nc200, nc200_state, init_nc, "Amstrad plc", "NC200", 0 ) diff --git a/src/mame/includes/nc.h b/src/mame/includes/nc.h index af7a3602199..492746f2d7a 100644 --- a/src/mame/includes/nc.h +++ b/src/mame/includes/nc.h @@ -113,7 +113,7 @@ protected: // HACK FOR MC6845 optional_device m_fdc; required_memory_bank_array<4> m_bankhandler_r, m_bankhandler_w; - char m_memory_config[4]; + char m_memory_config[4]{}; emu_timer *m_keyboard_timer = nullptr; int m_membank_rom_mask = 0; int m_membank_internal_ram_mask = 0; @@ -124,7 +124,7 @@ protected: // HACK FOR MC6845 int m_irq_status = 0; int m_irq_latch = 0; int m_irq_latch_mask = 0; - int m_sound_channel_periods[2]; + int m_sound_channel_periods[2]{}; int m_previous_inputport_10_state = 0; int m_previous_alarm_state = 0; memory_region *m_card_ram = nullptr; -- cgit v1.2.3