ht1130: add wake up after halt

This commit is contained in:
hap 2024-01-05 12:49:30 +01:00
parent 5d8945a046
commit dea11b9ebe
4 changed files with 35 additions and 8 deletions

View File

@ -6,7 +6,6 @@
TODO:
- Interrupts (not used by brke23p2)
- Sound (needs internal frequency ROM data?)
- IO wake-up from HALT etc.
- 1 machine cycle (eg. a 1 byte opcode) takes 4 system clock cycles (from OSC pins).
- The timer rate can be configured with a mask option (system clock / 2^n), n=0-13 (except 6 for some reason).
So, timer rate can be faster or slower than machine cycle rate.
@ -254,6 +253,7 @@ void ht1130_device::device_start()
m_irqen = 0;
m_timer_en = 0;
m_inhalt = 0;
m_wakeline = 0;
m_timerover = 0;
m_timer = 0;
m_comcount = 0;
@ -265,6 +265,7 @@ void ht1130_device::device_start()
save_item(NAME(m_irqen));
save_item(NAME(m_timer_en));
save_item(NAME(m_inhalt));
save_item(NAME(m_wakeline));
save_item(NAME(m_timerover));
save_item(NAME(m_timer));
save_item(NAME(m_comcount));
@ -1099,4 +1100,16 @@ void ht1130_device::execute_run()
void ht1130_device::execute_set_input(int inputnum, int state)
{
switch (inputnum)
{
case HT1130_EXT_WAKEUP_LINE:
// wake up is edge triggered
if (state && !m_wakeline)
m_inhalt = 0;
m_wakeline = state;
break;
default:
break;
}
}

View File

@ -6,6 +6,10 @@
#pragma once
// when in halt state, inputs (configured by mask option) can wake up the CPU,
// driver is required to use set_input_line(HT1130_EXT_WAKEUP_LINE, state)
#define HT1130_EXT_WAKEUP_LINE 0
class ht1130_device : public cpu_device
{
@ -24,13 +28,15 @@ public:
HT1130_TIMER,
};
// I/O ports
auto pm_in_cb() { return m_port_in_pm.bind(); }
auto ps_in_cb() { return m_port_in_ps.bind(); }
auto pp_in_cb() { return m_port_in_pp.bind(); }
auto pa_out_cb() { return m_port_out_pa.bind(); }
auto segment_out_cb() { return m_segment_out.bind(); } // COM in offset, SEG in data
// LCD output: COM in offset, SEG in data
auto segment_out_cb() { return m_segment_out.bind(); }
protected:
ht1130_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor data);
@ -39,6 +45,8 @@ protected:
virtual void device_reset() override;
virtual void execute_run() override;
virtual u32 execute_input_lines() const noexcept override { return 1; }
virtual bool execute_input_edge_triggered(int inputnum) const noexcept override { return inputnum == HT1130_EXT_WAKEUP_LINE; }
virtual void execute_set_input(int inputnum, int state) override;
virtual uint32_t execute_max_cycles() const noexcept override { return 2; }
@ -97,6 +105,7 @@ protected:
u8 m_irqen;
u8 m_timer_en;
u8 m_inhalt;
u8 m_wakeline;
u8 m_timerover;
u16 m_timer;

View File

@ -47,6 +47,8 @@ public:
m_in(*this, "IN%u", 1)
{ }
virtual DECLARE_INPUT_CHANGED_MEMBER(input_wakeup);
void ht11xx_brickgame(machine_config &config);
protected:
@ -67,11 +69,16 @@ void hh_ht11xx_state::machine_start()
m_out_x.resolve();
}
INPUT_CHANGED_MEMBER(hh_ht11xx_state::input_wakeup)
{
m_maincpu->set_input_line(HT1130_EXT_WAKEUP_LINE, newval ? CLEAR_LINE : ASSERT_LINE);
}
static INPUT_PORTS_START( ht11xx_brickgame )
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VOLUME_DOWN ) PORT_NAME("Mute")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POWER_ON ) PORT_NAME("Power")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POWER_ON ) PORT_NAME("Power") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_ht11xx_state, input_wakeup, 0)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("IN2") // not a joystick, but buttons are used for directional inputs in the snake game etc.

View File

@ -6277,14 +6277,12 @@ ROM_END
*******************************************************************************/
class nstarfox_state : public hh_sm510_state
class nstarfox_state : public gamewatch_state
{
public:
nstarfox_state(const machine_config &mconfig, device_type type, const char *tag) :
hh_sm510_state(mconfig, type, tag)
{
inp_fixed_last();
}
gamewatch_state(mconfig, type, tag)
{ }
void nstarfox(machine_config &config);