pc9801: don't init egc at reset,

mos6560: mask offset to fix possible array out of bounds access,
avr8: correct copy paste error on some gpio_out_cb
This commit is contained in:
hap 2024-03-28 18:00:52 +01:00
parent 8202c76788
commit 01647fbe69
4 changed files with 24 additions and 21 deletions

View File

@ -1484,7 +1484,7 @@ void avr8_device<NumTimers>::timer0_tick_ctc_toggle()
m_timer_top[0] = 0;
LOGMASKED(LOG_TIMER0, "%s: timer0: Toggle OC0B on match\n", machine().describe_context());
m_r[PORTG] ^= (1 << 5);
m_gpio_out_cb[PORTG](m_r[PORTG]);
m_gpio_out_cb[GPIOG](m_r[PORTG]);
}
m_r[TCNT0]++;
m_timer_prescale_count[0] -= m_timer_prescale[0];
@ -1498,7 +1498,7 @@ void avr8_device<NumTimers>::timer0_tick_ctc_clear()
m_timer_top[0] = 0;
LOGMASKED(LOG_TIMER0, "[0] timer0: Clear OC0B on match\n", machine().describe_context());
m_r[PORTG] &= ~(1 << 5);
m_gpio_out_cb[PORTG](m_r[PORTG]);
m_gpio_out_cb[GPIOG](m_r[PORTG]);
}
m_r[TCNT0]++;
m_timer_prescale_count[0] -= m_timer_prescale[0];
@ -1512,7 +1512,7 @@ void avr8_device<NumTimers>::timer0_tick_ctc_set()
m_timer_top[0] = 0;
LOGMASKED(LOG_TIMER0, "%s: timer0: Set OC0B on match\n", machine().describe_context());
m_r[PORTG] |= (1 << 5);
m_gpio_out_cb[PORTG](m_r[PORTG]);
m_gpio_out_cb[GPIOG](m_r[PORTG]);
}
m_r[TCNT0]++;
m_timer_prescale_count[0] -= m_timer_prescale[0];
@ -2254,7 +2254,7 @@ void avr8_device<NumTimers>::timer5_tick()
m_timer_top[5] = 0;
LOGMASKED(LOG_TIMER5, "%s: timer5: Toggle OC5B on compare match\n", machine().describe_context());
m_r[PORTL] ^= 1 << 4;
m_gpio_out_cb[PORTL](m_r[PORTL]);
m_gpio_out_cb[GPIOL](m_r[PORTL]);
}
break;
case 2: /* Clear OC5B on compare match */
@ -2264,7 +2264,7 @@ void avr8_device<NumTimers>::timer5_tick()
// Clear OC5B
LOGMASKED(LOG_TIMER5, "%s: timer5: Clear OC5B on compare match\n", machine().describe_context());
m_r[PORTL] &= ~(1 << 4);
m_gpio_out_cb[PORTL](m_r[PORTL]);
m_gpio_out_cb[GPIOL](m_r[PORTL]);
}
break;
case 3: /* Set OC5B on compare match */
@ -2273,7 +2273,7 @@ void avr8_device<NumTimers>::timer5_tick()
m_timer_top[5] = 0;
LOGMASKED(LOG_TIMER5, "%s: timer5: Set OC5B on compare match\n", machine().describe_context());
m_r[PORTL] |= 1 << 4;
m_gpio_out_cb[PORTL](m_r[PORTL]);
m_gpio_out_cb[GPIOL](m_r[PORTL]);
}
break;
}

View File

@ -325,6 +325,8 @@ void mos6560_device::drawlines( int first, int last )
void mos6560_device::write(offs_t offset, uint8_t data)
{
offset &= 0xf;
DBG_LOG(1, "mos6560_port_w", ("%.4x:%.2x\n", offset, data));
switch (offset)
@ -403,6 +405,8 @@ void mos6560_device::write(offs_t offset, uint8_t data)
uint8_t mos6560_device::read(offs_t offset)
{
offset &= 0xf;
int val;
switch (offset)

View File

@ -79,21 +79,21 @@ ROM_START( egret )
ROMX_LOAD("341s0851.bin", 0x0000, 0x1100, CRC(ea9ea6e4) SHA1(8b0dae3ec66cdddbf71567365d2c462688aeb571), ROM_BIOS(2))
ROM_END
//-------------------------------------------------
// ADDRESS_MAP
//-------------------------------------------------
//-------------------------------------------------
// ADDRESS_MAP
//-------------------------------------------------
void egret_device::egret_map(address_map &map)
{
map(0x0000, 0x0002).rw(FUNC(egret_device::ports_r), FUNC(egret_device::ports_w));
map(0x0004, 0x0006).rw(FUNC(egret_device::ddr_r), FUNC(egret_device::ddr_w));
map(0x0007, 0x0007).rw(FUNC(egret_device::pll_r), FUNC(egret_device::pll_w));
map(0x0008, 0x0008).rw(FUNC(egret_device::timer_ctrl_r), FUNC(egret_device::timer_ctrl_w));
map(0x0009, 0x0009).rw(FUNC(egret_device::timer_counter_r), FUNC(egret_device::timer_counter_w));
map(0x0012, 0x0012).rw(FUNC(egret_device::onesec_r), FUNC(egret_device::onesec_w));
map(0x0090, 0x00ff).ram().share(m_internal_ram); // work RAM and stack
map(0x0100, 0x01ff).rw(FUNC(egret_device::pram_r), FUNC(egret_device::pram_w));
map(0x0f00, 0x1fff).rom().region("roms", 0);
void egret_device::egret_map(address_map &map)
{
map(0x0000, 0x0002).rw(FUNC(egret_device::ports_r), FUNC(egret_device::ports_w));
map(0x0004, 0x0006).rw(FUNC(egret_device::ddr_r), FUNC(egret_device::ddr_w));
map(0x0007, 0x0007).rw(FUNC(egret_device::pll_r), FUNC(egret_device::pll_w));
map(0x0008, 0x0008).rw(FUNC(egret_device::timer_ctrl_r), FUNC(egret_device::timer_ctrl_w));
map(0x0009, 0x0009).rw(FUNC(egret_device::timer_counter_r), FUNC(egret_device::timer_counter_w));
map(0x0012, 0x0012).rw(FUNC(egret_device::onesec_r), FUNC(egret_device::onesec_w));
map(0x0090, 0x00ff).ram().share(m_internal_ram); // work RAM and stack
map(0x0100, 0x01ff).rw(FUNC(egret_device::pram_r), FUNC(egret_device::pram_w));
map(0x0f00, 0x1fff).rom().region("roms", 0);
}

View File

@ -2067,7 +2067,6 @@ MACHINE_RESET_MEMBER(pc9801vm_state,pc9801rs)
}
m_dac1bit_disable = true;
m_egc = { };
}
MACHINE_RESET_MEMBER(pc9801bx_state,pc9801bx2)