nc.cpp: coverity 138975

Note says nc200 hang at start, but when tested it works, so...
Machines promoted to working
----------------------------
NC200
This commit is contained in:
Robbbert 2022-04-10 10:02:03 +10:00
parent 0e804f50cd
commit 120388363e
2 changed files with 8 additions and 20 deletions

View File

@ -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 )

View File

@ -113,7 +113,7 @@ protected: // HACK FOR MC6845
optional_device<upd765a_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;