novag_const: nmi at poweroff (nw)

This commit is contained in:
hap 2020-05-24 15:15:21 +02:00
parent 97244a743a
commit f41877e447

View File

@ -52,7 +52,6 @@ Super Constellation:
- 2*32KB ROM custom label - 2*32KB ROM custom label
TODO: TODO:
- ssensor4 nvram doesn't work, at boot it always starts a new game
- is Dynamic S a program update of ssensor4 or identical? - is Dynamic S a program update of ssensor4 or identical?
- verify IRQ active time for ssensor4 - verify IRQ active time for ssensor4
@ -91,6 +90,8 @@ public:
m_inputs(*this, "IN.%u", 0) m_inputs(*this, "IN.%u", 0)
{ } { }
DECLARE_INPUT_CHANGED_MEMBER(power) { if (newval && m_power) power_off(); }
// machine configs // machine configs
void nconst(machine_config &config); void nconst(machine_config &config);
void nconst36(machine_config &config); void nconst36(machine_config &config);
@ -103,6 +104,7 @@ public:
protected: protected:
virtual void machine_start() override; virtual void machine_start() override;
virtual void machine_reset() override { m_power = true; }
private: private:
// devices/pointers // devices/pointers
@ -129,21 +131,28 @@ private:
DECLARE_READ8_MEMBER(input1_r); DECLARE_READ8_MEMBER(input1_r);
DECLARE_READ8_MEMBER(input2_r); DECLARE_READ8_MEMBER(input2_r);
u8 m_inp_mux; void power_off();
u8 m_led_select; bool m_power = false;
u8 m_inp_mux = 0;
u8 m_led_select = 0;
}; };
void const_state::machine_start() void const_state::machine_start()
{ {
// zerofill
m_inp_mux = 0;
m_led_select = 0;
// register for savestates // register for savestates
save_item(NAME(m_power));
save_item(NAME(m_inp_mux)); save_item(NAME(m_inp_mux));
save_item(NAME(m_led_select)); save_item(NAME(m_led_select));
} }
void const_state::power_off()
{
// NMI at power-off (clears peripherals, and ssensor4 prepares nvram for next power-on)
m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
m_power = false;
}
void const_state::init_const() void const_state::init_const()
{ {
// game relies on RAM filled with FF at power-on // game relies on RAM filled with FF at power-on
@ -298,6 +307,9 @@ static INPUT_PORTS_START( ssensor4 )
PORT_MODIFY("IN.6") PORT_MODIFY("IN.6")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Hint") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Hint")
PORT_START("POWER") // needs to be triggered for nvram to work
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, const_state, power, 0) PORT_NAME("Power Off")
INPUT_PORTS_END INPUT_PORTS_END
static INPUT_PORTS_START( nconstq ) static INPUT_PORTS_START( nconstq )
@ -320,6 +332,9 @@ static INPUT_PORTS_START( sconst )
PORT_MODIFY("IN.5") PORT_MODIFY("IN.5")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Form Size") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Form Size")
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Print List / Acc. Time / Pawn") PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Print List / Acc. Time / Pawn")
PORT_START("POWER")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, const_state, power, 0) PORT_NAME("Power Off")
INPUT_PORTS_END INPUT_PORTS_END