mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
4004clk: fix 50hz setting
This commit is contained in:
parent
4c9efbc43b
commit
bc0c0b22f6
@ -9,29 +9,41 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#include "cpu/mcs40/mcs40.h"
|
||||
#include "machine/clock.h"
|
||||
#include "sound/dac.h"
|
||||
|
||||
#include "speaker.h"
|
||||
|
||||
#include "4004clk.lh"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
class nixieclock_state : public driver_device
|
||||
{
|
||||
public:
|
||||
nixieclock_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_test_line(*this, "test_line")
|
||||
, m_nixie_out(*this, "nixie%u", 0U)
|
||||
, m_neon_out(*this, "neon%u", 0U)
|
||||
{ }
|
||||
|
||||
DECLARE_INPUT_CHANGED_MEMBER(switch_hz) { m_test_line->set_clock(newval ? 60 : 50); }
|
||||
void _4004clk(machine_config &config);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
|
||||
private:
|
||||
required_device<i4004_cpu_device> m_maincpu;
|
||||
required_device<clock_device> m_test_line;
|
||||
output_finder<6> m_nixie_out;
|
||||
output_finder<4> m_neon_out;
|
||||
|
||||
void nixie_w(offs_t offset, uint8_t data);
|
||||
void neon_w(uint8_t data);
|
||||
|
||||
@ -58,10 +70,20 @@ private:
|
||||
}
|
||||
|
||||
uint16_t m_nixie[16];
|
||||
output_finder<6> m_nixie_out;
|
||||
output_finder<4> m_neon_out;
|
||||
};
|
||||
|
||||
void nixieclock_state::machine_start()
|
||||
{
|
||||
m_nixie_out.resolve();
|
||||
m_neon_out.resolve();
|
||||
|
||||
std::fill(std::begin(m_nixie), std::end(m_nixie), 0);
|
||||
save_item(NAME(m_nixie));
|
||||
}
|
||||
|
||||
|
||||
// I/O handlers
|
||||
|
||||
void nixieclock_state::nixie_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_nixie[offset >> 4] = data;
|
||||
@ -81,6 +103,9 @@ void nixieclock_state::neon_w(uint8_t data)
|
||||
m_neon_out[3] = BIT(data,0);
|
||||
}
|
||||
|
||||
|
||||
// Address maps
|
||||
|
||||
void nixieclock_state::_4004clk_rom(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x0fff).rom().region("maincpu", 0);
|
||||
@ -111,7 +136,9 @@ void nixieclock_state::_4004clk_mp(address_map &map)
|
||||
map(0x00, 0x00).w("dac", FUNC(dac_bit_interface::data_w));
|
||||
}
|
||||
|
||||
/* Input ports */
|
||||
|
||||
// Input ports
|
||||
|
||||
static INPUT_PORTS_START( 4004clk )
|
||||
PORT_START("INPUT")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Select") PORT_CODE(KEYCODE_1)
|
||||
@ -120,42 +147,37 @@ static INPUT_PORTS_START( 4004clk )
|
||||
PORT_CONFNAME( 0x04, 0x00, "Tick-Tock")
|
||||
PORT_CONFSETTING( 0x00, "ON" )
|
||||
PORT_CONFSETTING( 0x04, "OFF" )
|
||||
PORT_CONFNAME( 0x08, 0x08, "50/60 Hz")
|
||||
PORT_CONFNAME( 0x08, 0x08, "50/60 Hz") PORT_CHANGED_MEMBER(DEVICE_SELF, nixieclock_state, switch_hz, 0)
|
||||
PORT_CONFSETTING( 0x00, "50 Hz" )
|
||||
PORT_CONFSETTING( 0x08, "60 Hz" )
|
||||
INPUT_PORTS_END
|
||||
|
||||
void nixieclock_state::machine_start()
|
||||
{
|
||||
m_nixie_out.resolve();
|
||||
m_neon_out.resolve();
|
||||
|
||||
/* register for state saving */
|
||||
save_pointer(NAME(m_nixie), 6);
|
||||
}
|
||||
// Machine config
|
||||
|
||||
void nixieclock_state::_4004clk(machine_config &config)
|
||||
{
|
||||
/* basic machine hardware */
|
||||
i4004_cpu_device &cpu(I4004(config, "maincpu", 5_MHz_XTAL / 8));
|
||||
cpu.set_rom_map(&nixieclock_state::_4004clk_rom);
|
||||
cpu.set_ram_memory_map(&nixieclock_state::_4004clk_mem);
|
||||
cpu.set_rom_ports_map(&nixieclock_state::_4004clk_rp);
|
||||
cpu.set_ram_status_map(&nixieclock_state::_4004clk_stat);
|
||||
cpu.set_ram_ports_map(&nixieclock_state::_4004clk_mp);
|
||||
// basic machine hardware
|
||||
I4004(config, m_maincpu, 5_MHz_XTAL / 8);
|
||||
m_maincpu->set_rom_map(&nixieclock_state::_4004clk_rom);
|
||||
m_maincpu->set_ram_memory_map(&nixieclock_state::_4004clk_mem);
|
||||
m_maincpu->set_rom_ports_map(&nixieclock_state::_4004clk_rp);
|
||||
m_maincpu->set_ram_status_map(&nixieclock_state::_4004clk_stat);
|
||||
m_maincpu->set_ram_ports_map(&nixieclock_state::_4004clk_mp);
|
||||
|
||||
/* video hardware */
|
||||
CLOCK(config, m_test_line, 60).signal_handler().set_inputline(m_maincpu, I4004_TEST_LINE);
|
||||
|
||||
// video hardware
|
||||
config.set_default_layout(layout_4004clk);
|
||||
|
||||
/* sound hardware */
|
||||
// sound hardware
|
||||
SPEAKER(config, "speaker").front_center();
|
||||
DAC_1BIT(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25);
|
||||
|
||||
clock_device &clk(CLOCK(config, "clk", 60));
|
||||
clk.signal_handler().set_inputline("maincpu", I4004_TEST_LINE);
|
||||
}
|
||||
|
||||
/* ROM definition */
|
||||
|
||||
// ROM definition
|
||||
|
||||
ROM_START( 4004clk )
|
||||
ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF )
|
||||
ROM_LOAD( "clock.u30", 0x0000, 0x0100, CRC(3d8608a5) SHA1(47fa0a91779e1afc34592f91068f8af2e74593d4))
|
||||
@ -176,7 +198,10 @@ ROM_START( 4004clk )
|
||||
ROM_LOAD( "clock.u45", 0x0F00, 0x0100, CRC(a8d419ef) SHA1(86742a5ad410c027e9cf9a95e2006dc1128715e5))
|
||||
ROM_END
|
||||
|
||||
/* Driver */
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
// Driver
|
||||
|
||||
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
|
||||
SYST( 2008, 4004clk, 0, 0, _4004clk, 4004clk, nixieclock_state, empty_init, "John L. Weinrich", "4004 Nixie Clock", MACHINE_SUPPORTS_SAVE )
|
||||
|
Loading…
Reference in New Issue
Block a user