Skip to content

add preliminary driver for Casio FZ series samplers #13623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/devices/cpu/nec/v5x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void v50_base_device::OPCN_w(u8 data)
m_OPCN = data & 0x0f;

m_tout1_callback((data & 0x03) == 0x03 ? m_tout1 : 1);
m_icu->ir1_w(BIT(data, 2) ? 0 : m_intp1);
m_icu->ir1_w(BIT(data, 2) ? m_sint : m_intp1);
m_icu->ir2_w(BIT(data, 3) ? m_tout1 : m_intp2);
}

Expand All @@ -333,6 +333,13 @@ void v50_base_device::tout1_w(int state)
m_icu->ir2_w(state);
}

void v50_base_device::sint_w(int state)
{
m_sint = state;
if (BIT(m_OPCN, 2))
m_icu->ir1_w(state);
}

void v50_base_device::device_reset()
{
nec_common_device::device_reset();
Expand All @@ -348,8 +355,11 @@ void v50_base_device::device_start()

set_irq_acknowledge_callback(*m_icu, FUNC(v5x_icu_device::inta_cb));

m_scu->write_cts(0);

save_item(NAME(m_OPCN));
save_item(NAME(m_tout1));
save_item(NAME(m_sint));
save_item(NAME(m_intp1));
save_item(NAME(m_intp2));
}
Expand Down Expand Up @@ -502,6 +512,8 @@ void v50_base_device::device_add_mconfig(machine_config &config)
m_tcu->out_handler<1>().set(m_scu, FUNC(v5x_scu_device::write_rxc));
m_tcu->out_handler<1>().append(m_scu, FUNC(v5x_scu_device::write_txc));
m_tcu->out_handler<1>().append(FUNC(v50_base_device::tout1_w));

m_scu->sint_handler().set(FUNC(v50_base_device::sint_w));
}

device_memory_interface::space_config_vector v50_base_device::memory_space_config() const
Expand Down
23 changes: 14 additions & 9 deletions src/devices/cpu/nec/v5x.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ class device_v5x_interface : public device_interface

// SCU
auto txd_handler_cb() { return m_scu.lookup()->txd_handler(); }
auto dtr_handler_cb() { return m_scu.lookup()->dtr_handler(); }
auto rts_handler_cb() { return m_scu.lookup()->rts_handler(); }
auto rxrdy_handler_cb() { return m_scu.lookup()->rxrdy_handler(); }
auto txrdy_handler_cb() { return m_scu.lookup()->txrdy_handler(); }
auto txempty_handler_cb() { return m_scu.lookup()->txempty_handler(); }
auto syndet_handler_cb() { return m_scu.lookup()->syndet_handler(); }
void rxd_w(int state) { m_scu->write_rxd(state); }

protected:
device_v5x_interface(const machine_config &mconfig, nec_common_device &device, bool is_16bit);
Expand Down Expand Up @@ -190,14 +185,16 @@ class v50_base_device : public nec_common_device, public device_v5x_interface

private:
void tout1_w(int state);
void sint_w(int state);

devcb_write_line m_tout1_callback;
devcb_read8 m_icu_slave_ack;

u8 m_OPCN;
bool m_tout1;
bool m_intp1;
bool m_intp2;
u8 m_tout1;
u8 m_sint;
u8 m_intp1;
u8 m_intp2;
};

class v40_device : public v50_base_device
Expand Down Expand Up @@ -239,6 +236,14 @@ class v53_device : public v33_base_device, public device_v5x_interface

template <unsigned Timer> auto tout_handler() { return m_tcu.lookup()->out_handler<Timer>(); }

// SCU
auto dtr_handler_cb() { return m_scu.lookup()->dtr_handler(); }
auto rts_handler_cb() { return m_scu.lookup()->rts_handler(); }
auto rxrdy_handler_cb() { return m_scu.lookup()->rxrdy_handler(); }
auto txrdy_handler_cb() { return m_scu.lookup()->txrdy_handler(); }
auto txempty_handler_cb() { return m_scu.lookup()->txempty_handler(); }
auto syndet_handler_cb() { return m_scu.lookup()->syndet_handler(); }

protected:
v53_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);

Expand Down
44 changes: 30 additions & 14 deletions src/devices/machine/i8251.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ i8251_device::i8251_device(const machine_config &mconfig, const char *tag, devic

v5x_scu_device::v5x_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: i8251_device(mconfig, V5X_SCU, tag, owner, clock)
, m_sint_handler(*this)
{
}

Expand Down Expand Up @@ -126,15 +127,14 @@ void i8251_device::device_start()

void i8251_device::update_rx_ready()
{
int state = m_status & I8251_STATUS_RX_READY;

// masked?
if (!BIT(m_command, 2))
state = 0;

m_rxrdy_handler(state != 0);
m_rxrdy_handler(rxrdy_r());
}

void v5x_scu_device::update_rx_ready()
{
i8251_device::update_rx_ready();
sint_bit_w<0>(rxrdy_r());
}


/*-------------------------------------------------
Expand Down Expand Up @@ -376,21 +376,20 @@ void i8251_device::transmit_clock()

void i8251_device::update_tx_ready()
{
/* clear tx ready state */
int tx_ready;

/* tx ready output is set if:
DB Buffer Empty &
CTS is set &
Transmit enable is 1
*/

tx_ready = is_tx_enabled() && (m_status & I8251_STATUS_TX_READY) != 0;

m_txrdy_handler(tx_ready);
m_txrdy_handler(txrdy_r());
}


void v5x_scu_device::update_tx_ready()
{
i8251_device::update_tx_ready();
sint_bit_w<1>(txrdy_r());
}

/*-------------------------------------------------
update_tx_empty
Expand Down Expand Up @@ -875,10 +874,22 @@ int i8251_device::txrdy_r()
return is_tx_enabled() && (m_status & I8251_STATUS_TX_READY) != 0;
}

int i8251_device::rxrdy_r()
{
// masked?
if (!BIT(m_command, 2))
return 0;

return (m_status & I8251_STATUS_RX_READY) != 0;
}

void v5x_scu_device::device_start()
{
i8251_device::device_start();

m_sint = 0;

save_item(NAME(m_sint));
save_item(NAME(m_simk));
}

Expand All @@ -890,6 +901,11 @@ void v5x_scu_device::device_reset()
i8251_device::device_reset();
}

void v5x_scu_device::update_sint()
{
m_sint_handler((m_sint & ~m_simk) != 0);
}

u8 v5x_scu_device::read(offs_t offset)
{
u8 data = 0;
Expand Down
29 changes: 25 additions & 4 deletions src/devices/machine/i8251.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class i8251_device : public device_t, public device_serial_interface
void write_syn(int state);

int txrdy_r();
int rxrdy_r();

protected:
enum
Expand Down Expand Up @@ -74,8 +75,8 @@ class i8251_device : public device_t, public device_serial_interface

void receive_character(uint8_t ch);

void update_rx_ready();
void update_tx_ready();
virtual void update_rx_ready();
virtual void update_tx_ready();
void update_tx_empty();
void transmit_clock();
void receive_clock();
Expand Down Expand Up @@ -153,6 +154,8 @@ class v5x_scu_device : public i8251_device
// construction/destruction
v5x_scu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

auto sint_handler() { return m_sint_handler.bind(); }

virtual uint8_t read(offs_t offset) override;
virtual void write(offs_t offset, uint8_t data) override;

Expand All @@ -161,11 +164,29 @@ class v5x_scu_device : public i8251_device
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;

// TODO: currently unimplemented interrupt masking
virtual void update_rx_ready() override;
virtual void update_tx_ready() override;

template<int Bit>
void sint_bit_w(int state)
{
if (state)
m_sint |= (1 << Bit);
else
m_sint &= ~(1 << Bit);

update_sint();
}

u8 simk_r() { return m_simk; }
void simk_w(u8 data) { m_simk = data; }
void simk_w(u8 data) { m_simk = data; update_sint(); }

private:
void update_sint();

devcb_write_line m_sint_handler;

u8 m_sint;
u8 m_simk;
};

Expand Down
12 changes: 10 additions & 2 deletions src/devices/video/hd44352.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "emu.h"
#include "hd44352.h"

#include "screen.h"

#define LCD_BYTE_INPUT 0x01
#define LCD_BYTE_OUTPUT 0x02
#define LCD_CHAR_OUTPUT 0x03
Expand Down Expand Up @@ -132,6 +134,11 @@ uint32_t hd44352_device::screen_update(screen_device &screen, bitmap_ind16 &bitm
if (m_control_lines&0x80 && m_lcd_on)
{
for (int a=0; a<2; a++)
{
// drivers can be arranged as 96x64 or 192x32 when char width is 6
const unsigned sx = (a * 16 * cw) % screen.width();
const unsigned sy = (a * 32) % screen.height();

for (int py=0; py<4; py++)
for (int px=0; px<16; px++)
if (BIT(m_cursor_status, 4) && px == m_cursor_x && py == m_cursor_y && a == m_cursor_lcd)
Expand All @@ -142,7 +149,7 @@ uint32_t hd44352_device::screen_update(screen_device &screen, bitmap_ind16 &bitm
uint8_t d = compute_newval((m_cursor_status>>5) & 0x07, m_video_ram[a][py*16*cw + px*cw + c + m_scroll * 48], m_cursor[c]);
for (int b=0; b<8; b++)
{
bitmap.pix(py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b);
bitmap.pix(sy + py*8 + b, sx + px*cw + c) = BIT(d, 7-b);
}
}
}
Expand All @@ -153,10 +160,11 @@ uint32_t hd44352_device::screen_update(screen_device &screen, bitmap_ind16 &bitm
uint8_t d = m_video_ram[a][py*16*cw + px*cw + c + m_scroll * 48];
for (int b=0; b<8; b++)
{
bitmap.pix(py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b);
bitmap.pix(sy + py*8 + b, sx + px*cw + c) = BIT(d, 7-b);
}
}
}
}
}

return 0;
Expand Down
Loading
Loading