-74381: Added untested 74S381 ALU / Function Generator device. [Ryan Holtz]

-dpb_brushproc: Added PROM signal lookups, nw

-am25s55x: Fixed some incorrect comments, nw
This commit is contained in:
MooglyGuy 2019-06-18 14:37:14 +02:00
parent 56af5d0d26
commit 1af85e45ca
9 changed files with 365 additions and 6 deletions

View File

@ -478,6 +478,18 @@ if (MACHINES["TTL74259"]~=null) then
}
end
---------------------------------------------------
--
--@src/devices/machine/74381.h,MACHINES["TTL74381"] = true
---------------------------------------------------
if (MACHINES["TTL74381"]~=null) then
files {
MAME_DIR .. "src/devices/machine/74381.cpp",
MAME_DIR .. "src/devices/machine/74381.h",
}
end
---------------------------------------------------
--
--@src/devices/machine/7474.h,MACHINES["TTL7474"] = true

View File

@ -398,6 +398,7 @@ MACHINES["TTL74166"] = true
--MACHINES["TTL74175"] = true
MACHINES["TTL74181"] = true
MACHINES["TTL74259"] = true
--MACHINES["TTL74381"] = true
MACHINES["TTL7474"] = true
MACHINES["KBDC8042"] = true
MACHINES["I8257"] = true

View File

@ -629,6 +629,7 @@ MACHINES["TTL74164"] = true
MACHINES["TTL74175"] = true
MACHINES["TTL74181"] = true
MACHINES["TTL74259"] = true
MACHINES["TTL74381"] = true
MACHINES["TTL7474"] = true
MACHINES["TUBE"] = true
MACHINES["UPD1990A"] = true

View File

@ -0,0 +1,151 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
/***************************************************************************
74381.cpp
TI SN74S381 ALU / Function Generator
***************************************************************************/
#include "emu.h"
#include "74381.h"
/*****************************************************************************/
DEFINE_DEVICE_TYPE(SN74S381, sn74s381_device, "sn74s381", "TI SN74S381 ALU / Function Generator")
//-------------------------------------------------
// sn74s381_device - constructor
//-------------------------------------------------
sn74s381_device::sn74s381_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SN74S381, tag, owner, clock)
, m_a(0)
, m_b(0)
, m_s(0)
, m_cn(0)
, m_f(0)
, m_p(false)
, m_g(false)
, m_f_out(*this)
, m_p_out(*this)
, m_g_out(*this)
{
}
void sn74s381_device::device_start()
{
save_item(NAME(m_a));
save_item(NAME(m_b));
save_item(NAME(m_s));
save_item(NAME(m_cn));
save_item(NAME(m_f));
save_item(NAME(m_p));
save_item(NAME(m_g));
m_f_out.resolve_safe();
m_p_out.resolve_safe();
m_g_out.resolve_safe();
}
void sn74s381_device::device_reset()
{
m_a = 0;
m_b = 0;
m_s = 0;
m_cn = 0;
m_f = 0;
m_p = false;
m_g = false;
m_f_out(0);
m_p_out(true);
m_g_out(true);
}
void sn74s381_device::a_w(uint8_t data)
{
m_a = data;
update();
}
void sn74s381_device::b_w(uint8_t data)
{
m_b = data;
update();
}
void sn74s381_device::s_w(uint8_t data)
{
m_s = data;
update();
}
void sn74s381_device::cn_w(int state)
{
m_cn = state;
update();
}
void sn74s381_device::update()
{
switch (m_s)
{
case 0: // Clear
m_f = 0;
m_p = true;
m_g = true;
break;
case 1: // B - A
{
const uint8_t c = 1 - m_cn;
const uint8_t d = (m_a + c) & 0xf;
m_f = (m_b - d) & 0xf;
m_p = (( m_a ^ m_b) >> 3) == 0;
m_g = ((~m_a & m_b) >> 3) != 0;
break;
}
case 2: // A - B
{
const uint8_t c = 1 - m_cn;
const uint8_t d = (m_b + c) & 0xf;
m_f = (m_a - d) & 0xf;
m_p = ((m_a ^ m_b) >> 3) == 0;
m_g = ((m_a & ~m_b) >> 3) != 0;
break;
}
case 3: // A + B
{
const uint8_t c = m_cn;
const uint8_t d = (m_b + c) & 0xf;
m_f = (m_a + d) & 0xf;
m_p = ((m_a ^ m_b) >> 3) != 0;
m_g = ((m_a & m_b) >> 3) != 0;
break;
}
case 4: // A ^ B
m_f = m_a ^ m_b;
m_p = (m_a >> 3) != (m_b >> 3);
m_g = false;
break;
case 5: // A | B
m_f = m_a | m_b;
m_p = (m_a >> 3) != 0 || (m_b >> 3) != 0;
m_g = false;
break;
case 6: // A & B
m_f = m_a & m_b;
m_p = (m_a >> 3) != 0 && (m_b >> 3) != 0;
m_g = false;
break;
case 7: // Preset
m_f = 0xf;
m_p = true;
m_g = false;
break;
}
m_f_out(m_f);
m_p_out(m_p ? 0 : 1);
m_g_out(m_g ? 0 : 1);
}

View File

@ -0,0 +1,61 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
/***************************************************************************
74381.h
SN74S381 ALU / Function Generator
***************************************************************************/
#ifndef MAME_MACHINE_74381_H
#define MAME_MACHINE_74381_H
#pragma once
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> sn74s381_device
class sn74s381_device : public device_t
{
public:
// construction/destruction
sn74s381_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
void a_w(uint8_t data);
void b_w(uint8_t data);
void s_w(uint8_t data);
void cn_w(int state);
auto f() { return m_f_out.bind(); }
auto p() { return m_p_out.bind(); }
auto g() { return m_g_out.bind(); }
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
void update();
uint8_t m_a;
uint8_t m_b;
uint8_t m_s;
uint8_t m_cn;
uint8_t m_f;
bool m_p;
bool m_g;
devcb_write8 m_f_out;
devcb_write_line m_p_out;
devcb_write_line m_g_out;
};
// device type definition
DECLARE_DEVICE_TYPE(SN74S381, sn74s381_device)
#endif // MAME_MACHINE_74381_H

View File

@ -2,7 +2,7 @@
// copyright-holders:Ryan Holtz
/***************************************************************************
am25s55x.h
am25s55x.cpp
AMD Am25S557/Am25S558 8x8-bit Combinatorial Multiplier
***************************************************************************/

View File

@ -16,7 +16,7 @@
// TYPE DEFINITIONS
//**************************************************************************
// ======================> am25s557_base_device
// ======================> am25s55x_device
class am25s55x_device : public device_t
{

View File

@ -34,6 +34,9 @@ dpb7000_brushproc_card_device::dpb7000_brushproc_card_device(const machine_confi
, m_sel_eh(false)
, m_b_bus_ah(false)
, m_fcs(false)
, m_prom_addr(0)
, m_prom_base(nullptr)
, m_prom_out(0)
, m_store1(*this)
, m_store2(*this)
, m_cbus(*this)
@ -41,6 +44,11 @@ dpb7000_brushproc_card_device::dpb7000_brushproc_card_device(const machine_confi
, m_mult_fa(*this, "mult_fa")
, m_mult_ga(*this, "mult_ga")
, m_mult_gd(*this, "mult_gd")
, m_alu_he(*this, "alu_he")
, m_alu_ge(*this, "alu_ge")
, m_alu_fe(*this, "alu_fe")
, m_alu_ee(*this, "alu_ee")
, m_prom(*this, "prom")
{
}
@ -62,6 +70,9 @@ void dpb7000_brushproc_card_device::device_start()
save_item(NAME(m_b_bus_ah));
save_item(NAME(m_fcs));
save_item(NAME(m_prom_addr));
save_item(NAME(m_prom_out));
m_store1.resolve_safe();
m_store2.resolve_safe();
m_cbus.resolve_safe();
@ -85,6 +96,10 @@ void dpb7000_brushproc_card_device::device_reset()
m_sel_eh = 0;
m_b_bus_ah = 0;
m_fcs = 0;
m_prom_addr = 0;
m_prom_base = m_prom->base();
m_prom_out = 0;
}
void dpb7000_brushproc_card_device::device_add_mconfig(machine_config &config)
@ -92,10 +107,15 @@ void dpb7000_brushproc_card_device::device_add_mconfig(machine_config &config)
AM25S558(config, m_mult_fa);
AM25S558(config, m_mult_ga);
AM25S558(config, m_mult_gd);
SN74S381(config, m_alu_he);
SN74S381(config, m_alu_ge);
SN74S381(config, m_alu_fe);
SN74S381(config, m_alu_ee);
}
ROM_START( dpb7000_brushproc )
ROM_REGION(0x200, "brushproc_prom", 0)
ROM_REGION(0x200, "prom", 0)
ROM_LOAD("pb-02c-17593-baa.bin", 0x000, 0x200, CRC(a74cc1f5) SHA1(3b789d5a29c70c93dec56f44be8c14b41915bdef))
ROM_END
@ -124,7 +144,6 @@ void dpb7000_brushproc_card_device::brush_w(uint8_t data)
m_brush_in = data;
}
void dpb7000_brushproc_card_device::k_w(uint8_t data)
{
m_k_in = data;
@ -145,33 +164,126 @@ void dpb7000_brushproc_card_device::k_inv_w(int state)
m_k_invert = (bool)state;
}
void dpb7000_brushproc_card_device::func_w(uint8_t data)
{
m_func = data;
const uint16_t old = m_prom_addr;
m_prom_addr &= 0x1f0;
m_prom_addr |= BIT(data, 3);
m_prom_addr |= BIT(data, 2) << 1;
m_prom_addr |= BIT(data, 1) << 2;
m_prom_addr |= BIT(data, 0) << 3;
if (old != m_prom_addr)
update_prom_signals();
}
void dpb7000_brushproc_card_device::sel_lum1_w(int state)
{
m_sel_luma[0] = (bool)state;
const uint16_t old = m_prom_addr;
m_prom_addr &= ~0x20;
m_prom_addr |= state << 5;
if (old != m_prom_addr)
update_prom_signals();
}
void dpb7000_brushproc_card_device::sel_lum2_w(int state)
{
m_sel_luma[1] = (bool)state;
const uint16_t old = m_prom_addr;
m_prom_addr &= ~0x10;
m_prom_addr |= state << 4;
if (old != m_prom_addr)
update_prom_signals();
}
void dpb7000_brushproc_card_device::sel_eh_w(int state)
{
m_sel_eh = (bool)state;
const uint16_t old = m_prom_addr;
m_prom_addr &= ~0x40;
m_prom_addr |= state << 6;
if (old != m_prom_addr)
update_prom_signals();
}
void dpb7000_brushproc_card_device::b_bus_ah_w(int state)
{
m_b_bus_ah = (bool)state;
const uint16_t old = m_prom_addr;
m_prom_addr &= ~0x80;
m_prom_addr |= state << 7;
if (old != m_prom_addr)
update_prom_signals();
}
void dpb7000_brushproc_card_device::fixed_col_select_w(int state)
{
m_fcs = (bool)state;
const uint16_t old = m_prom_addr;
m_prom_addr &= ~0x80;
m_prom_addr |= state << 8;
if (old != m_prom_addr)
update_prom_signals();
}
void dpb7000_brushproc_card_device::update_prom_signals()
{
const uint8_t old = m_prom_out;
m_prom_out = m_prom_base[m_prom_addr];
if (BIT(old, 0) != BIT(m_prom_out, 0))
set_oe1(BIT(m_prom_out, 0));
if (BIT(old, 1) != BIT(m_prom_out, 1))
set_oe2(BIT(m_prom_out, 1));
if (BIT(old, 2) != BIT(m_prom_out, 2))
set_oe3(BIT(m_prom_out, 2));
if (BIT(old, 3) != BIT(m_prom_out, 3))
set_mask_sel_h(BIT(m_prom_out, 3));
if (BIT(old, 4) != BIT(m_prom_out, 4))
set_16bit_h(BIT(m_prom_out, 4));
if (BIT(old, 5) != BIT(m_prom_out, 5))
set_proc_sel_h(BIT(m_prom_out, 5));
if (BIT(old, 6) != BIT(m_prom_out, 6))
set_k_eq_il(BIT(m_prom_out, 6));
if (BIT(old, 7) != BIT(m_prom_out, 7))
set_oe4(BIT(m_prom_out, 7));
}
void dpb7000_brushproc_card_device::set_oe1(int state)
{
}
void dpb7000_brushproc_card_device::set_oe2(int state)
{
}
void dpb7000_brushproc_card_device::set_oe3(int state)
{
}
void dpb7000_brushproc_card_device::set_oe4(int state)
{
}
void dpb7000_brushproc_card_device::set_mask_sel_h(int state)
{
}
void dpb7000_brushproc_card_device::set_16bit_h(int state)
{
}
void dpb7000_brushproc_card_device::set_proc_sel_h(int state)
{
}
void dpb7000_brushproc_card_device::set_k_eq_il(int state)
{
}

View File

@ -15,9 +15,9 @@
#pragma once
#include "machine/74381.h"
#include "machine/am25s55x.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@ -59,6 +59,17 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry *device_rom_region() const override;
void update_prom_signals();
void set_oe1(int state);
void set_oe2(int state);
void set_oe3(int state);
void set_oe4(int state);
void set_mask_sel_h(int state);
void set_16bit_h(int state);
void set_proc_sel_h(int state);
void set_k_eq_il(int state);
uint8_t m_store_in[2];
uint8_t m_ext_in;
uint8_t m_brush_in;
@ -75,13 +86,23 @@ protected:
bool m_b_bus_ah;
bool m_fcs;
uint16_t m_prom_addr;
uint8_t *m_prom_base;
uint8_t m_prom_out;
devcb_write8 m_store1;
devcb_write8 m_store2;
devcb_write8 m_cbus;
devcb_write_line m_pck;
required_device<am25s558_device> m_mult_fa;
required_device<am25s558_device> m_mult_ga;
required_device<am25s558_device> m_mult_gd;
required_device<sn74s381_device> m_alu_he;
required_device<sn74s381_device> m_alu_ge;
required_device<sn74s381_device> m_alu_fe;
required_device<sn74s381_device> m_alu_ee;
required_memory_region m_prom;
};
// device type definition