regence: add power-off nmi

This commit is contained in:
hap 2023-02-08 20:17:46 +01:00
parent ffc3454fb9
commit 96e8ea4ddb
4 changed files with 45 additions and 19 deletions

View File

@ -8,7 +8,7 @@ Applied Concepts Great Game Machine (GGM), electronic board game computer.
Hardware notes:
- 6502A 2MHz, SYP6522 VIA
- 2KB RAM(4*HM472114AP-2 or 1*M58725P), no ROM on main PCB
- 2KB battery-backed RAM(4*HM472114AP-2 or 1*M58725P), no ROM on main PCB
- 2*74164 shift register, 3*6118P VFD driver
- 8-digit 14seg VFD panel (same one as in Speak & Spell)
- 5*4 keypad(unlabeled by default), 1-bit sound

View File

@ -11,16 +11,20 @@ Hardware notes:
- PCB label: FRANCE DOUBLE R, MADE IN FRANCE
- Sharp LH0080A Z80A @ 4 MHz (8MHz XTAL)
- 3*4KB ROM, sockets support up to 48KB ROM
- 2KB RAM (MSM5128-15RS), 3 sockets, only middle one used
- 2KB battery-backed RAM (MSM5128-15RS), 3 sockets, only middle one used. Power-off
or power outage triggers an NMI. If this isn't done, the next power-on may fail.
- TTL, piezo, 8*8+4 LEDs, magnetic sensors
******************************************************************************/
#include "emu.h"
#include "cpu/z80/z80.h"
#include "machine/nvram.h"
#include "machine/sensorboard.h"
#include "sound/dac.h"
#include "video/pwm.h"
#include "speaker.h"
// internal artwork
@ -41,11 +45,14 @@ public:
m_inputs(*this, "IN.%u", 0)
{ }
DECLARE_INPUT_CHANGED_MEMBER(power) { if (newval && m_power) power_off(); }
// machine configs
void regence(machine_config &config);
protected:
virtual void machine_start() override;
virtual void machine_reset() override { m_power = true; }
private:
// devices/pointers
@ -64,6 +71,9 @@ private:
void leds_w(u8 data);
u8 input_r();
void power_off();
bool m_power = false;
u8 m_inp_mux = 0;
u8 m_led_data = 0;
};
@ -71,10 +81,18 @@ private:
void regence_state::machine_start()
{
// register for savestates
save_item(NAME(m_power));
save_item(NAME(m_inp_mux));
save_item(NAME(m_led_data));
}
void regence_state::power_off()
{
// NMI at power-off (it prepares nvram for next power-on)
m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
m_power = false;
}
/******************************************************************************
@ -132,7 +150,7 @@ void regence_state::main_map(address_map &map)
map(0x0000, 0x0fff).rom();
map(0x4000, 0x4fff).rom();
map(0x8000, 0x8fff).rom();
map(0xd000, 0xd7ff).ram();
map(0xd000, 0xd7ff).ram().share("nvram");
map(0xf000, 0xf000).rw(FUNC(regence_state::input_r), FUNC(regence_state::control_w));
map(0xf800, 0xf800).w(FUNC(regence_state::leds_w));
}
@ -163,6 +181,9 @@ static INPUT_PORTS_START( regence )
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Pawn")
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Knight")
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
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, regence_state, power, 0) PORT_NAME("Power Off")
INPUT_PORTS_END
@ -173,21 +194,24 @@ INPUT_PORTS_END
void regence_state::regence(machine_config &config)
{
/* basic machine hardware */
// basic machine hardware
Z80(config, m_maincpu, 8_MHz_XTAL/2);
m_maincpu->set_addrmap(AS_PROGRAM, &regence_state::main_map);
m_maincpu->set_periodic_int(FUNC(regence_state::irq0_line_hold), attotime::from_hz(448)); // from 555, measured
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
SENSORBOARD(config, m_board).set_type(sensorboard_device::MAGNETS);
m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess));
m_board->set_delay(attotime::from_msec(150));
m_board->set_nvram_enable(true);
/* video hardware */
// video hardware
PWM_DISPLAY(config, m_display).set_size(10, 8);
config.set_default_layout(layout_regence);
/* sound hardware */
// sound hardware
SPEAKER(config, "speaker").front_center();
DAC_1BIT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25);
}

View File

@ -39,7 +39,8 @@ Constellation Quattro:
Super Sensor IV:
- MOS MPS6502A @ 2MHz
- 1KB battery-backed RAM (2*TC5514AP-3)
- 1KB battery-backed RAM (2*TC5514AP-3). Power-off or power outage triggers
an NMI. If this isn't done, the next power-on may fail.
- 8KB ROM (TMM2364P)
- 2 ROM sockets for expansion (blue @ u6, white @ u5)
@ -350,7 +351,7 @@ INPUT_PORTS_END
void const_state::nconst(machine_config &config)
{
/* basic machine hardware */
// basic machine hardware
M6502(config, m_maincpu, 2_MHz_XTAL);
m_maincpu->set_addrmap(AS_PROGRAM, &const_state::const_map);
@ -362,11 +363,11 @@ void const_state::nconst(machine_config &config)
m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess));
m_board->set_delay(attotime::from_msec(250));
/* video hardware */
// video hardware
PWM_DISPLAY(config, m_display).set_size(3, 8);
config.set_default_layout(layout_novag_const);
/* sound hardware */
// sound hardware
SPEAKER(config, "mono").front_center();
BEEP(config, m_beeper, 2_MHz_XTAL / 0x800); // ~976Hz
m_beeper->add_route(ALL_OUTPUTS, "mono", 0.25);
@ -376,7 +377,7 @@ void const_state::ssensor4(machine_config &config)
{
nconst(config);
/* basic machine hardware */
// basic machine hardware
m_maincpu->set_addrmap(AS_PROGRAM, &const_state::ssensor4_map);
subdevice<clock_device>("irq_clock")->set_pulse_width(attotime::from_usec(39)); // irq active for 39us
@ -386,7 +387,7 @@ void const_state::ssensor4(machine_config &config)
config.set_default_layout(layout_novag_ssensor4);
/* expansion */
// expansion
GENERIC_SOCKET(config, "exrom", generic_plain_slot, "novag_ssensor4");
SOFTWARE_LIST(config, "cart_list").set_original("novag_ssensor4");
}
@ -395,7 +396,7 @@ void const_state::nconst36(machine_config &config)
{
nconst(config);
/* basic machine hardware */
// basic machine hardware
M65SC02(config.replace(), m_maincpu, 7.2_MHz_XTAL/2);
m_maincpu->set_addrmap(AS_PROGRAM, &const_state::const_map);
@ -403,7 +404,7 @@ void const_state::nconst36(machine_config &config)
m_board->set_delay(attotime::from_msec(200));
/* sound hardware */
// sound hardware
BEEP(config.replace(), m_beeper, 7.2_MHz_XTAL/2 / 0x800); // ~1758Hz
m_beeper->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@ -412,14 +413,14 @@ void const_state::nconst36a(machine_config &config)
{
nconst36(config);
/* basic machine hardware */
// basic machine hardware
R65C02(config.replace(), m_maincpu, 7.2_MHz_XTAL/2);
m_maincpu->set_addrmap(AS_PROGRAM, &const_state::const_map);
// 4020 CLK is 7.2_MHz_XTAL/4, but with IRQ on Q11 instead of Q12, result
// frequency and duty cycle are identical to nconst36
/* sound hardware */
// sound hardware
BEEP(config.replace(), m_beeper, 7.2_MHz_XTAL/4 / 0x800); // ~879Hz
m_beeper->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@ -428,14 +429,14 @@ void const_state::nconstq(machine_config &config)
{
nconst36a(config);
/* basic machine hardware */
// basic machine hardware
m_maincpu->set_clock(8_MHz_XTAL/2);
subdevice<clock_device>("irq_clock")->set_clock(8_MHz_XTAL/4 / 0x1000); // ~488Hz (pulse width same as nconst)
config.set_default_layout(layout_novag_constq);
/* sound hardware */
// sound hardware
BEEP(config.replace(), m_beeper, 8_MHz_XTAL/4 / 0x800); // ~976Hz
m_beeper->add_route(ALL_OUTPUTS, "mono", 0.25);
}
@ -444,7 +445,7 @@ void const_state::sconst(machine_config &config)
{
nconstq(config);
/* basic machine hardware */
// basic machine hardware
M6502(config.replace(), m_maincpu, 8_MHz_XTAL/2); // UM6502C
m_maincpu->set_addrmap(AS_PROGRAM, &const_state::sconst_map);

View File

@ -33,6 +33,7 @@ Printer Unit:
PSU ("permanent storage unit"?) is just a 256x4 battery-backed RAM (TC5501P)
module, not sure why it was so expensive (~180DM).
A chess clock accessory was also announced but unreleased.
SciSys Super System IV (AKA MK IV) is on similar hardware. It was supposed to