summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2017-09-05 01:20:38 +0200
committer hap <happppp@users.noreply.github.com>2017-09-05 01:21:01 +0200
commitcfaad61effadfdfdfdf541cf73ef5eda9d449095 (patch)
tree84138462ac090aabafa85f58dfe38a5b3a54989c /src/devices
parent79a1cdaff0f369dd0b0428cfeb44ee8b1f6ece71 (diff)
New working machine added
--------- R-Zone: Indy 500 [hap, Sean Riddle]
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/cpu/sm510/sm510.h11
-rw-r--r--src/devices/cpu/sm510/sm510core.cpp20
2 files changed, 24 insertions, 7 deletions
diff --git a/src/devices/cpu/sm510/sm510.h b/src/devices/cpu/sm510/sm510.h
index a3c4129329f..cb963e87fa8 100644
--- a/src/devices/cpu/sm510/sm510.h
+++ b/src/devices/cpu/sm510/sm510.h
@@ -36,6 +36,10 @@
#define MCFG_SM510_WRITE_R_CB(_devcb) \
devcb = &sm510_base_device::set_write_r_callback(*device, DEVCB_##_devcb);
+// R port can be set to direct control with a mask option (default false)
+#define MCFG_SM510_R_DIRECT_CONTROL(_direct) \
+ sm510_base_device::set_r_direct_control(*device, _direct);
+
// LCD segment outputs: H1-4 as offset(low), a/b/c 1-16 as data d0-d15
#define MCFG_SM510_WRITE_SEGA_CB(_devcb) \
devcb = &sm510_base_device::set_write_sega_callback(*device, DEVCB_##_devcb);
@@ -81,8 +85,8 @@ a1 48 | | 28 b10
H4 49 | | 27 a11
H3 50 | | 26 b11
H2 51 | | 25 a12
-H1 52 | SM510 | 24 b12
-S1 53 | SM511 | 23 a13
+H1 52 | | 24 b12
+S1 53 | SM510 | 23 a13
S2 54 | | 22 b13
S3 55 | | 21 a14
S4 56 | | 20 b14
@@ -108,6 +112,7 @@ public:
, m_prgwidth(prgwidth)
, m_datawidth(datawidth)
, m_stack_levels(stack_levels)
+ , m_r_direct(false)
, m_lcd_ram_a(*this, "lcd_ram_a"), m_lcd_ram_b(*this, "lcd_ram_b"), m_lcd_ram_c(*this, "lcd_ram_c")
, m_write_sega(*this), m_write_segb(*this), m_write_segc(*this), m_write_segbs(*this)
, m_melody_rom(*this, "melody")
@@ -123,6 +128,7 @@ public:
template <class Object> static devcb_base &set_read_b_callback(device_t &device, Object &&cb) { return downcast<sm510_base_device &>(device).m_read_b.set_callback(std::forward<Object>(cb)); }
template <class Object> static devcb_base &set_write_s_callback(device_t &device, Object &&cb) { return downcast<sm510_base_device &>(device).m_write_s.set_callback(std::forward<Object>(cb)); }
template <class Object> static devcb_base &set_write_r_callback(device_t &device, Object &&cb) { return downcast<sm510_base_device &>(device).m_write_r.set_callback(std::forward<Object>(cb)); }
+ static void set_r_direct_control(device_t &device, bool direct) { downcast<sm510_base_device &>(device).m_r_direct = direct; }
template <class Object> static devcb_base &set_write_sega_callback(device_t &device, Object &&cb) { return downcast<sm510_base_device &>(device).m_write_sega.set_callback(std::forward<Object>(cb)); }
template <class Object> static devcb_base &set_write_segb_callback(device_t &device, Object &&cb) { return downcast<sm510_base_device &>(device).m_write_segb.set_callback(std::forward<Object>(cb)); }
@@ -179,6 +185,7 @@ protected:
bool m_skip;
u8 m_w;
u8 m_r, m_r_out;
+ bool m_r_direct;
bool m_k_active;
bool m_halt;
int m_clk_div;
diff --git a/src/devices/cpu/sm510/sm510core.cpp b/src/devices/cpu/sm510/sm510core.cpp
index 3abc2ee1e9b..fe422988459 100644
--- a/src/devices/cpu/sm510/sm510core.cpp
+++ b/src/devices/cpu/sm510/sm510core.cpp
@@ -5,7 +5,7 @@
Sharp SM510 MCU core implementation
TODO:
- - buzzer control divider bit is mask-programmable?
+ - X
*/
@@ -55,10 +55,20 @@ offs_t sm510_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u
void sm510_device::clock_melody()
{
- // buzzer from divider, R2 inverse phase
- u8 out = m_div >> 2 & 1;
- out |= (out << 1 ^ 2);
- out &= m_r;
+ u8 out = 0;
+
+ if (m_r_direct)
+ {
+ // direct output
+ out = m_r & 3;
+ }
+ else
+ {
+ // buzzer from divider, R2 inverse phase
+ out = m_div >> 2 & 1;
+ out |= (out << 1 ^ 2);
+ out &= m_r;
+ }
// output to R pins
if (out != m_r_out)