From 27b4e602870709ad5225bfde3c553c109439683a Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 7 Mar 2024 19:13:10 +0100 Subject: misc hap disasm: correction to prev commit --- src/devices/cpu/amis2000/amis2000d.cpp | 2 +- src/devices/cpu/cops1/cops1d.cpp | 2 +- src/devices/cpu/e0c6200/e0c6200d.cpp | 4 +- src/devices/cpu/h8/h83217.cpp | 4 +- src/devices/cpu/h8/h8325.cpp | 4 +- src/devices/cpu/h8/h8s2319.cpp | 6 +- src/devices/cpu/hmcs40/hmcs40d.cpp | 2 +- src/devices/cpu/melps4/melps4d.cpp | 2 +- src/devices/cpu/mn1400/mn1400d.cpp | 2 +- src/devices/cpu/pps41/pps41d.cpp | 2 +- src/devices/cpu/rw5000/rw5000d.cpp | 2 +- src/devices/cpu/sm510/sm510d.cpp | 2 +- src/devices/cpu/tms1000/tms1k_dasm.cpp | 2 +- src/devices/cpu/ucom4/ucom4d.cpp | 2 +- src/mame/mame.lst | 3 + src/mame/novag/sdiamond.cpp | 375 +++++++++++++++++++++++++++++++++ 16 files changed, 397 insertions(+), 19 deletions(-) create mode 100644 src/mame/novag/sdiamond.cpp diff --git a/src/devices/cpu/amis2000/amis2000d.cpp b/src/devices/cpu/amis2000/amis2000d.cpp index 697f909607b..6f9d95d2a70 100644 --- a/src/devices/cpu/amis2000/amis2000d.cpp +++ b/src/devices/cpu/amis2000/amis2000d.cpp @@ -12,7 +12,7 @@ // common lookup tables -enum e_mnemonics : unsigned +enum amis2000_disassembler::e_mnemonics : unsigned { mLAB = 0, mLAE, mLAI, mLBE, mLBEP, mLBF, mLBZ, mXAB, mXABU, mXAE, mLAM, mXC, mXCI, mXCD, mSTM, mRSM, diff --git a/src/devices/cpu/cops1/cops1d.cpp b/src/devices/cpu/cops1/cops1d.cpp index ee7eb049504..8ccdcf8ac08 100644 --- a/src/devices/cpu/cops1/cops1d.cpp +++ b/src/devices/cpu/cops1/cops1d.cpp @@ -32,7 +32,7 @@ offs_t cops1_common_disassembler::increment_pc(offs_t pc) // common lookup tables -enum e_mnemonics : unsigned +enum cops1_common_disassembler::e_mnemonics : unsigned { mILL, mAD, mADD, mSUB, mCOMP, m0TA, mADX, mHXA, mTAM, mSC, mRSC, mTC, diff --git a/src/devices/cpu/e0c6200/e0c6200d.cpp b/src/devices/cpu/e0c6200/e0c6200d.cpp index 85505b96b43..adb324a1a79 100644 --- a/src/devices/cpu/e0c6200/e0c6200d.cpp +++ b/src/devices/cpu/e0c6200/e0c6200d.cpp @@ -12,7 +12,7 @@ // common lookup tables -enum e_mnemonics : unsigned +enum e0c6200_disassembler::e_mnemonics : unsigned { em_JP, em_RETD, em_CALL, em_CALZ, em_LD, em_LBPX, em_ADC, em_CP, em_ADD, em_SUB, em_SBC, em_AND, em_OR, em_XOR, @@ -22,7 +22,7 @@ enum e_mnemonics : unsigned em_NOT, em_SCF, em_SZF, em_SDF, em_EI, em_DI, em_RDF, em_RZF, em_RCF, em_ILL }; -enum e_params : unsigned +enum e0c6200_disassembler::e_params : unsigned { ep_S, ep_E, ep_I, ep_R0, ep_R2, ep_R4, ep_Q, ep_cC, ep_cNC, ep_cZ, ep_cNZ, diff --git a/src/devices/cpu/h8/h83217.cpp b/src/devices/cpu/h8/h83217.cpp index eac23419814..a26a0282ef4 100644 --- a/src/devices/cpu/h8/h83217.cpp +++ b/src/devices/cpu/h8/h83217.cpp @@ -72,7 +72,7 @@ h83202_device::h83202_device(const machine_config &mconfig, const char *tag, dev void h83217_device::map(address_map &map) { - if (m_md >= 2) + if(m_md >= 2) map(0x0000, m_rom_size - 1).rom(); map(0xff80 - m_ram_size, 0xff7f).view(m_ram_view); @@ -258,7 +258,7 @@ void h83217_device::syscr_w(u8 data) logerror("syscr = %02x\n", data); // RAME - if (data & 1) + if(data & 1) m_ram_view.select(0); else m_ram_view.disable(); diff --git a/src/devices/cpu/h8/h8325.cpp b/src/devices/cpu/h8/h8325.cpp index c18706b444b..69d93062c00 100644 --- a/src/devices/cpu/h8/h8325.cpp +++ b/src/devices/cpu/h8/h8325.cpp @@ -71,7 +71,7 @@ h8322_device::h8322_device(const machine_config &mconfig, const char *tag, devic void h8325_device::map(address_map &map) { - if (m_md >= 2) + if(m_md >= 2) map(0x0000, m_rom_size - 1).rom(); map(0xff80 - m_ram_size, 0xff7f).view(m_ram_view); @@ -225,7 +225,7 @@ void h8325_device::syscr_w(u8 data) logerror("syscr = %02x\n", data); // RAME - if (data & 1) + if(data & 1) m_ram_view.select(0); else m_ram_view.disable(); diff --git a/src/devices/cpu/h8/h8s2319.cpp b/src/devices/cpu/h8/h8s2319.cpp index 49bfcac7e73..480c7deed89 100644 --- a/src/devices/cpu/h8/h8s2319.cpp +++ b/src/devices/cpu/h8/h8s2319.cpp @@ -92,7 +92,7 @@ h8s2318_device::h8s2318_device(const machine_config &mconfig, const char *tag, d void h8s2319_device::map(address_map &map) { - if (m_rom_size && m_md >= 6) + if(m_rom_size && m_md >= 6) map(0x000000, m_rom_size - 1).rom(); map(0xfffc00 - m_ram_size, 0xfffbff).view(m_ram_view); @@ -375,7 +375,7 @@ void h8s2319_device::internal_update(u64 current_time) add_event(event_time, m_sci[1]->internal_update(current_time)); // SCI2 used by H8S-2329 - if (m_sci[2]) + if(m_sci[2]) add_event(event_time, m_sci[2]->internal_update(current_time)); add_event(event_time, m_timer8[0]->internal_update(current_time)); @@ -452,7 +452,7 @@ void h8s2319_device::syscr_w(u8 data) logerror("syscr = %02x\n", data); // RAME - if (data & 1) + if(data & 1) m_ram_view.select(0); else m_ram_view.disable(); diff --git a/src/devices/cpu/hmcs40/hmcs40d.cpp b/src/devices/cpu/hmcs40/hmcs40d.cpp index 87f270a10f0..cbf318eecce 100644 --- a/src/devices/cpu/hmcs40/hmcs40d.cpp +++ b/src/devices/cpu/hmcs40/hmcs40d.cpp @@ -38,7 +38,7 @@ hmcs40_disassembler::hmcs40_disassembler() // common lookup tables -enum e_mnemonics : unsigned +enum hmcs40_disassembler::e_mnemonics : unsigned { mILL, mLAB, mLBA, mLAY, mLASPX, mLASPY, mXAMR, diff --git a/src/devices/cpu/melps4/melps4d.cpp b/src/devices/cpu/melps4/melps4d.cpp index cb677ed3a41..656bef4eee0 100644 --- a/src/devices/cpu/melps4/melps4d.cpp +++ b/src/devices/cpu/melps4/melps4d.cpp @@ -15,7 +15,7 @@ // common lookup tables -enum e_mnemonics : unsigned +enum melps4_disassembler::e_mnemonics : unsigned { mILL, mTAB, mTBA, mTAY, mTYA, mTEAB, mTABE, mTEPA, mTXA, mTAX, diff --git a/src/devices/cpu/mn1400/mn1400d.cpp b/src/devices/cpu/mn1400/mn1400d.cpp index 7860845b3fb..ae22889279c 100644 --- a/src/devices/cpu/mn1400/mn1400d.cpp +++ b/src/devices/cpu/mn1400/mn1400d.cpp @@ -12,7 +12,7 @@ // common lookup tables -enum e_mnemonics : unsigned +enum mn1400_disassembler::e_mnemonics : unsigned { mILL, mILL2, mL, mLD, mLI, mLIC, mLDC, mST, mSTD, mSTIC, mSTDC, diff --git a/src/devices/cpu/pps41/pps41d.cpp b/src/devices/cpu/pps41/pps41d.cpp index 080c14769e0..70e1401f87a 100644 --- a/src/devices/cpu/pps41/pps41d.cpp +++ b/src/devices/cpu/pps41/pps41d.cpp @@ -32,7 +32,7 @@ offs_t pps41_common_disassembler::increment_pc(offs_t pc) // common lookup tables -enum e_mnemonics : unsigned +enum pps41_common_disassembler::e_mnemonics : unsigned { // MM76/shared mILL /* 0! */, diff --git a/src/devices/cpu/rw5000/rw5000d.cpp b/src/devices/cpu/rw5000/rw5000d.cpp index e0ca8bc5e56..5d76fdafff3 100644 --- a/src/devices/cpu/rw5000/rw5000d.cpp +++ b/src/devices/cpu/rw5000/rw5000d.cpp @@ -32,7 +32,7 @@ offs_t rw5000_common_disassembler::increment_pc(offs_t pc) // common lookup tables -enum e_mnemonics : unsigned +enum rw5000_common_disassembler::e_mnemonics : unsigned { mILL, mNOP, mRSC, mSC, mTC, mTAM, diff --git a/src/devices/cpu/sm510/sm510d.cpp b/src/devices/cpu/sm510/sm510d.cpp index c8e484073ca..5a4bbc8fc8f 100644 --- a/src/devices/cpu/sm510/sm510d.cpp +++ b/src/devices/cpu/sm510/sm510d.cpp @@ -46,7 +46,7 @@ offs_t sm510_common_disassembler::increment_pc(offs_t pc, u8 pclen) // common lookup tables -enum e_mnemonics : unsigned +enum sm510_common_disassembler::e_mnemonics : unsigned { // SM510 common mILL /* 0! */, mEXT, diff --git a/src/devices/cpu/tms1000/tms1k_dasm.cpp b/src/devices/cpu/tms1000/tms1k_dasm.cpp index b80afb1483f..745907f9377 100644 --- a/src/devices/cpu/tms1000/tms1k_dasm.cpp +++ b/src/devices/cpu/tms1000/tms1k_dasm.cpp @@ -84,7 +84,7 @@ offs_t tms1000_base_disassembler::pc_real_to_linear(offs_t pc) const // common lookup tables -enum e_mnemonics : unsigned +enum tms1000_base_disassembler::e_mnemonics : unsigned { mILL = 0, mAC0AC, mAC1AC, mACACC, mACNAA, mALEC, mALEM, mAMAAC, mBRANCH, diff --git a/src/devices/cpu/ucom4/ucom4d.cpp b/src/devices/cpu/ucom4/ucom4d.cpp index 7609340b60b..6b450c7fbc9 100644 --- a/src/devices/cpu/ucom4/ucom4d.cpp +++ b/src/devices/cpu/ucom4/ucom4d.cpp @@ -12,7 +12,7 @@ // common lookup tables -enum e_mnemonics : unsigned +enum ucom4_disassembler::e_mnemonics : unsigned { mILL, mLI, mL, mLM, mLDI, mLDZ, mS, mTAL, mTLA, diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 3788bc0aaf2..adde9afccad 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -9,6 +9,9 @@ ******************************************************************************/ +@source:novag/sdiamond.cpp +sdiamond + @source:access/acvirus.cpp virusa // (c) 1997 Access GmbH virusb // (c) 1999 Access GmbH diff --git a/src/mame/novag/sdiamond.cpp b/src/mame/novag/sdiamond.cpp new file mode 100644 index 00000000000..d0a19e2ce7f --- /dev/null +++ b/src/mame/novag/sdiamond.cpp @@ -0,0 +1,375 @@ +// license:BSD-3-Clause +// copyright-holders:hap +// thanks-to:Berger +/******************************************************************************* + +@source:novag/sdiamond.cpp +sdiamond + +Novag (Perfect Technology*) Star Diamond + +*: Novag Industries dissolved in 2000. The Novag brand continued for a few years +under Perfect Technology, Ltd., established by the daughter of Novag's founder. +The main programmer (David Kittinger) also moved to the new company. + +Hardware notes: +- PCB label: TF-05 94V0Δ +- Hitachi H8S/2312 12312VTE25V, 25MHz XTAL +- 512KB Flash ROM (SST 39VF400A), only 192KB used +- 256KB RAM (2*Hynix HY62V8100B) +- LCD with custom segments +- piezo, 16 LEDs, button sensors chessboard + +TODO: +- it does a cold boot at every reset, so nvram won't work properly unless MAME + adds some kind of auxillary autosave state feature at power-off +- serial comms doesn't work, 25MHz XTAL is correct and the SCI baud rate is + configured as close as it can get to 57600, but it still desyncs quickly + +*******************************************************************************/ + +#include "emu.h" + +#include "bus/rs232/rs232.h" +#include "cpu/h8/h8s2319.h" +#include "machine/nvram.h" +#include "machine/sensorboard.h" +#include "sound/dac.h" +#include "video/pwm.h" + +#include "screen.h" +#include "speaker.h" + +// internal artwork +//#include "novag_sdiamond.lh" + + +namespace { + +class sdiamond_state : public driver_device +{ +public: + sdiamond_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_board(*this, "board"), + m_led_pwm(*this, "led_pwm"), + m_lcd_pwm(*this, "lcd_pwm"), + m_dac(*this, "dac"), + m_rs232(*this, "rs232"), + m_inputs(*this, "IN.%u", 0), + m_out_lcd(*this, "s%u.%u", 0U, 0U) + { } + + void sdiamond(machine_config &config); + + DECLARE_INPUT_CHANGED_MEMBER(power_switch); + +protected: + virtual void machine_reset() override { set_power(true); } + virtual void machine_start() override; + +private: + // devices/pointers + required_device m_maincpu; + required_device m_board; + required_device m_led_pwm; + required_device m_lcd_pwm; + required_device m_dac; + required_device m_rs232; + required_ioport_array<4> m_inputs; + output_finder<4, 16> m_out_lcd; + + bool m_power = false; + u8 m_inp_mux = 0; + u8 m_lcd_sclk = 0; + u16 m_lcd_segs = 0; + u8 m_lcd_com = 0; + + void main_map(address_map &map); + + // I/O handlers + void lcd_pwm_w(offs_t offset, u8 data); + void update_lcd(); + void lcd_segs_w(u8 data); + void lcd_com_w(offs_t offset, u8 data, u8 mem_mask); + + void standby(int state); + void set_power(bool power); + + void p1_w(u8 data); + u8 p2_r(); + u8 p4_r(); + u8 pf_r(); + void pg_w(u8 data); +}; + +void sdiamond_state::machine_start() +{ + m_out_lcd.resolve(); + + // register for savestates + save_item(NAME(m_power)); + save_item(NAME(m_inp_mux)); + save_item(NAME(m_lcd_sclk)); + save_item(NAME(m_lcd_segs)); + save_item(NAME(m_lcd_com)); +} + + + +/******************************************************************************* + I/O +*******************************************************************************/ + +// power + +void sdiamond_state::standby(int state) +{ + // clear display + if (state) + { + m_lcd_pwm->clear(); + m_led_pwm->clear(); + } +} + +void sdiamond_state::set_power(bool power) +{ + // power switch is tied to NMI + m_maincpu->set_input_line(INPUT_LINE_NMI, power ? ASSERT_LINE : CLEAR_LINE); + m_power = power; +} + +INPUT_CHANGED_MEMBER(sdiamond_state::power_switch) +{ + if (newval) + set_power(bool(param)); +} + + +// LCD + +void sdiamond_state::lcd_pwm_w(offs_t offset, u8 data) +{ + m_out_lcd[offset & 0x3f][offset >> 6] = data; +} + +void sdiamond_state::update_lcd() +{ + for (int i = 0; i < 4; i++) + { + // LCD common is 0/1/Hi-Z + const u32 data = BIT(m_lcd_com, i + 4) ? (BIT(m_lcd_com, i) ? ~m_lcd_segs : m_lcd_segs) : 0; + m_lcd_pwm->write_row(i, data); + } +} + +void sdiamond_state::lcd_com_w(offs_t offset, u8 data, u8 mem_mask) +{ + // P20-P23: LCD common + m_lcd_com = mem_mask << 4 | (data & 0xf); + update_lcd(); +} + +void sdiamond_state::lcd_segs_w(u8 data) +{ + // P35: 2*14015B C (chained) + if (data & 0x20 && !m_lcd_sclk) + { + // P34: 14015B D, outputs to LCD segments + m_lcd_segs = m_lcd_segs << 1 | BIT(data, 4); + update_lcd(); + } + + m_lcd_sclk = BIT(data, 5); +} + + +// misc + +void sdiamond_state::p1_w(u8 data) +{ + // P10-P17: input mux, led data + m_inp_mux = ~data; + m_led_pwm->write_mx(~data); +} + +u8 sdiamond_state::p2_r() +{ + u8 data = 0; + + // P26: power switch + if (!m_power) + data |= 0x40; + + // P27: battery status + data |= m_inputs[3]->read() << 7; + return data | 0xf; +} + +u8 sdiamond_state::p4_r() +{ + u8 data = 0; + + // P40-P47: read chessboard + for (int i = 0; i < 8; i++) + if (BIT(m_inp_mux, i)) + data |= m_board->read_rank(i ^ 7); + + return ~data; +} + +u8 sdiamond_state::pf_r() +{ + u8 data = 0; + + // PF0-PF2: read buttons + for (int i = 0; i < 3; i++) + if (m_inp_mux & m_inputs[i]->read()) + data |= 1 << i; + + return ~data; +} + +void sdiamond_state::pg_w(u8 data) +{ + // PG0,PG1: led select + m_led_pwm->write_my(~data & 3); +} + + + +/******************************************************************************* + Address Maps +*******************************************************************************/ + +void sdiamond_state::main_map(address_map &map) +{ + map(0x000000, 0x07ffff).rom(); + map(0x400000, 0x43ffff).ram().share("nvram"); +} + + + +/******************************************************************************* + Input Ports +*******************************************************************************/ + +static INPUT_PORTS_START( sdiamond ) + PORT_START("IN.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Next Best / Take Back / Print Board") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_2) PORT_NAME("Trace Forward / Print Game") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_3) PORT_NAME("Easy / Replay") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_4) PORT_NAME("Random / Video") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_NAME("Restore / Human") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_NAME("Book Select / Auto/Demo") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_NAME("Sound / Auto Clock") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Referee / Print Moves") + + PORT_START("IN.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Color") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_W) PORT_NAME("Verify / Setup / Rating") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_E) PORT_NAME("Pro-op Print / King") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Pro-op Priority / Queen") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_T) PORT_NAME("Pro-op Delete / Rook") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Y) PORT_NAME("Pro-op Save / Bishop") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_U) PORT_NAME("Load Game / Knight") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_NAME("Save Game / Pawn") + + PORT_START("IN.2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_NAME("Go") + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_S) PORT_NAME("Info") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_D) PORT_NAME("Hint") + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_NAME("Training") + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_G) PORT_NAME("Option 1/2") + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_NAME("Set Level") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_J) PORT_NAME("Clear / Clear Board") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_K) PORT_NAME("New Game") + + PORT_START("IN.3") + PORT_CONFNAME( 0x01, 0x00, "Battery Status" ) + PORT_CONFSETTING( 0x01, "Low" ) + PORT_CONFSETTING( 0x00, DEF_STR( Normal ) ) + + PORT_START("POWER") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_POWER_ON) PORT_CHANGED_MEMBER(DEVICE_SELF, sdiamond_state, power_switch, 1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_POWER_OFF) PORT_CHANGED_MEMBER(DEVICE_SELF, sdiamond_state, power_switch, 0) +INPUT_PORTS_END + + + +/******************************************************************************* + Machine Configs +*******************************************************************************/ + +void sdiamond_state::sdiamond(machine_config &config) +{ + // basic machine hardware + H8S2312(config, m_maincpu, 25_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &sdiamond_state::main_map); + m_maincpu->nvram_enable_backup(true); + m_maincpu->standby_cb().set(m_maincpu, FUNC(h8s2312_device::nvram_set_battery)); + m_maincpu->standby_cb().append(FUNC(sdiamond_state::standby)); + m_maincpu->write_sci_tx<0>().set(m_rs232, FUNC(rs232_port_device::write_txd)); + m_maincpu->write_port1().set(FUNC(sdiamond_state::p1_w)); + m_maincpu->read_port2().set(FUNC(sdiamond_state::p2_r)); + m_maincpu->write_port2().set(FUNC(sdiamond_state::lcd_com_w)); + m_maincpu->write_port3().set(FUNC(sdiamond_state::lcd_segs_w)); + m_maincpu->read_port4().set(FUNC(sdiamond_state::p4_r)); + m_maincpu->read_portf().set(FUNC(sdiamond_state::pf_r)); + m_maincpu->write_portf().set(m_dac, FUNC(dac_1bit_device::write)).bit(6); + m_maincpu->write_portg().set(FUNC(sdiamond_state::pg_w)); + + NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); + + SENSORBOARD(config, m_board).set_type(sensorboard_device::BUTTONS); + 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 + PWM_DISPLAY(config, m_lcd_pwm).set_size(4, 16); + m_lcd_pwm->output_x().set(FUNC(sdiamond_state::lcd_pwm_w)); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_SVG)); + screen.set_refresh_hz(60); + screen.set_size(1920/5, 671/5); + screen.set_visarea_full(); + + PWM_DISPLAY(config, m_led_pwm).set_size(2, 8); + //config.set_default_layout(layout_novag_sdiamond); + + // rs232 (configure after video) + RS232_PORT(config, m_rs232, default_rs232_devices, nullptr); + m_rs232->rxd_handler().set(m_maincpu, FUNC(h8s2312_device::sci_rx_w<0>)); + + // sound hardware + SPEAKER(config, "speaker").front_center(); + DAC_1BIT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25); +} + + + +/******************************************************************************* + ROM Definitions +*******************************************************************************/ + +ROM_START( sdiamond ) // ID = H8S/SD V1.04 + ROM_REGION16_BE( 0x80000, "maincpu", 0 ) + ROM_LOAD16_WORD_SWAP("39vf400a.ic3", 0x00000, 0x80000, CRC(ee9a4fee) SHA1(b86e5efa5b7b9ddbe9fe1dabfe8cbc2bc40809b8) ) + + ROM_REGION( 72533, "screen", 0 ) + ROM_LOAD("sdiamond.svg", 0, 72533, CRC(34944b61) SHA1(4a0536ac07790cced9f9bf15522b17ebc375ff8a) ) +ROM_END + +} // anonymous namespace + + + +/******************************************************************************* + Drivers +*******************************************************************************/ + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS +SYST( 2003, sdiamond, 0, 0, sdiamond, sdiamond, sdiamond_state, empty_init, "Perfect Technology", "Star Diamond", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -- cgit v1.2.3