-dpb_storeaddr: Started fleshing out some behavior based on schematics, nw

This commit is contained in:
mooglyguy 2019-06-20 20:51:55 +02:00
parent ddcabbf52c
commit 3af81e1158
3 changed files with 213 additions and 10 deletions

View File

@ -36,7 +36,7 @@
#define LOG_FDC_PORT (1 << 7)
#define LOG_FDC_CMD (1 << 8)
#define LOG_OUTPUT_TIMING (1 << 9)
#define LOG_BRUSH_ADDR (1 << 11)
#define LOG_BRUSH_ADDR (1 << 10)
#define LOG_ALL (LOG_UNKNOWN | LOG_UCODE | LOG_MORE_UCODE | LOG_CSR | LOG_CTRLBUS | LOG_SYS_CTRL | LOG_FDC_CTRL | LOG_FDC_PORT | LOG_FDC_CMD | \
LOG_OUTPUT_TIMING | LOG_BRUSH_ADDR)

View File

@ -24,12 +24,26 @@ DEFINE_DEVICE_TYPE(DPB7000_STOREADDR, dpb7000_storeaddr_card_device, "dpb_storea
dpb7000_storeaddr_card_device::dpb7000_storeaddr_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, DPB7000_STOREADDR, tag, owner, clock)
, m_bb_base(nullptr)
, m_bc_base(nullptr)
, m_bd_base(nullptr)
, m_protx_base(nullptr)
, m_proty_base(nullptr)
, m_bb_out(0)
, m_bc_out(0)
, m_bd_out(0)
, m_protx(false)
, m_proty(false)
, m_rhscr(0)
, m_rvscr(0)
, m_rzoom(0)
, m_fld_sel(0)
, m_cxpos(0)
, m_cypos(0)
, m_orig_cx_stripe_addr(0)
, m_orig_cx_stripe_num(0)
, m_orig_cy_addr(0)
, m_cx_stripe_addr(0)
, m_cx_stripe_num(0)
, m_cy_addr(0)
, m_s_type(0)
, m_cen(false)
, m_cxd(false)
@ -48,6 +62,12 @@ dpb7000_storeaddr_card_device::dpb7000_storeaddr_card_device(const machine_confi
, m_selvideo(false)
, m_creq(false)
, m_cread(false)
, m_prot_a(false)
, m_prot_b(false)
, m_x_prom(*this, "x_prom")
, m_protx_prom(*this, "protx_prom")
, m_proty_prom(*this, "proty_prom")
, m_blanking_pal(*this, "blanking_pal")
{
}
@ -74,12 +94,22 @@ const tiny_rom_entry *dpb7000_storeaddr_card_device::device_rom_region() const
void dpb7000_storeaddr_card_device::device_start()
{
save_item(NAME(m_bb_out));
save_item(NAME(m_bc_out));
save_item(NAME(m_bd_out));
save_item(NAME(m_protx));
save_item(NAME(m_proty));
save_item(NAME(m_rhscr));
save_item(NAME(m_rvscr));
save_item(NAME(m_rzoom));
save_item(NAME(m_fld_sel));
save_item(NAME(m_cxpos));
save_item(NAME(m_cypos));
save_item(NAME(m_orig_cx_stripe_addr));
save_item(NAME(m_orig_cx_stripe_num));
save_item(NAME(m_orig_cy_addr));
save_item(NAME(m_cx_stripe_addr));
save_item(NAME(m_cx_stripe_num));
save_item(NAME(m_cy_addr));
save_item(NAME(m_s_type));
@ -111,8 +141,12 @@ void dpb7000_storeaddr_card_device::device_reset()
m_rvscr = 0;
m_rzoom = 0;
m_fld_sel = 0;
m_cxpos = 0;
m_cypos = 0;
m_orig_cx_stripe_addr = 0;
m_orig_cx_stripe_num = 0;
m_orig_cy_addr = 0;
m_cx_stripe_addr = 0;
m_cx_stripe_num = 0;
m_cy_addr = 0;
m_s_type = 0;
@ -136,6 +170,18 @@ void dpb7000_storeaddr_card_device::device_reset()
m_selvideo = false;
m_creq = false;
m_cread = false;
m_bb_base = m_x_prom->base() + 0x000;
m_bc_base = m_x_prom->base() + 0x400;
m_bd_base = m_x_prom->base() + 0x800;
m_protx_base = m_protx_prom->base();
m_proty_base = m_proty_prom->base();
m_bb_out = 0;
m_bc_out = 0;
m_bd_out = 0;
m_protx = false;
m_proty = false;
}
void dpb7000_storeaddr_card_device::reg_w(uint16_t data)
@ -160,11 +206,11 @@ void dpb7000_storeaddr_card_device::reg_w(uint16_t data)
break;
case 4:
LOG("%s: Store Address Card %d, set CXPOS: %03x\n", machine().describe_context(), m_s_type, data & 0xfff);
m_cxpos = data & 0xfff;
set_cxpos(data & 0xfff);
break;
case 5:
LOG("%s: Store Address Card %d, set CYPOS: %03x\n", machine().describe_context(), m_s_type, data & 0xfff);
m_cypos = data & 0xfff;
m_orig_cy_addr = data & 0xfff;
break;
default:
LOG("%s: Store Address Card %d, unknown register: %04x\n", machine().describe_context(), m_s_type, data);
@ -172,6 +218,16 @@ void dpb7000_storeaddr_card_device::reg_w(uint16_t data)
}
}
void dpb7000_storeaddr_card_device::set_cxpos(uint16_t data)
{
const uint16_t prom_addr = (data >> 1) & 0x3ff;
m_bb_out = m_bb_base[prom_addr];
m_bc_out = m_bc_base[prom_addr];
m_bd_out = m_bd_base[prom_addr];
m_orig_cx_stripe_addr = BIT(data, 0) | (m_bb_out & 0xe);
m_orig_cx_stripe_num = m_bc_out | (m_bd_out << 4);
}
void dpb7000_storeaddr_card_device::s_type_w(int state)
{
m_s_type = state ? 2 : 1;
@ -199,7 +255,64 @@ void dpb7000_storeaddr_card_device::cxld_w(int state)
void dpb7000_storeaddr_card_device::cxck_w(int state)
{
bool old = m_cxck;
m_cxck = (bool)state;
if (old && !m_cxck) // Inverted by 74LS240 AE
tick_cxck();
}
void dpb7000_storeaddr_card_device::tick_cxck()
{
if (m_cxld)
{
m_cx_stripe_addr = m_orig_cx_stripe_addr;
m_cx_stripe_num = m_orig_cx_stripe_num;
}
else if (!m_cen && !m_cxen)
{
if (m_cxd)
{
m_cx_stripe_addr--;
if (m_cx_stripe_addr == -1)
{
m_cx_stripe_addr = 9;
m_cx_stripe_num--;
update_prot_proms();
}
}
else
{
m_cx_stripe_addr++;
if (m_cx_stripe_addr == 10)
{
m_cx_stripe_addr = 0;
m_cx_stripe_num++;
update_prot_proms();
}
}
}
if (!m_cen && !m_cxoen)
{
if (m_cxod)
{
m_orig_cx_stripe_addr--;
if (m_orig_cx_stripe_addr == -1)
{
m_orig_cx_stripe_addr = 9;
m_orig_cx_stripe_num--;
}
}
else
{
m_orig_cx_stripe_addr++;
if (m_orig_cx_stripe_addr == 10)
{
m_orig_cx_stripe_addr = 0;
m_orig_cx_stripe_num++;
}
}
}
}
void dpb7000_storeaddr_card_device::cxod_w(int state)
@ -229,7 +342,38 @@ void dpb7000_storeaddr_card_device::cyld_w(int state)
void dpb7000_storeaddr_card_device::cyck_w(int state)
{
bool old = m_cyck;
m_cyck = (bool)state;
if (old && !m_cyck) // Inverted by 74LS240 AE
tick_cyck();
}
void dpb7000_storeaddr_card_device::tick_cyck()
{
if (m_cyld)
{
m_cy_addr = m_orig_cy_addr;
}
else if (!m_cen && !m_cyen)
{
if (m_cyd)
{
m_cy_addr--;
}
else
{
m_cy_addr++;
}
update_prot_proms();
}
if (!m_cen && !m_cyoen)
{
if (m_cyod)
m_orig_cy_addr--;
else
m_orig_cy_addr++;
}
}
void dpb7000_storeaddr_card_device::cyod_w(int state)
@ -262,3 +406,26 @@ void dpb7000_storeaddr_card_device::cr_w(int state)
m_cread = (bool)state;
}
void dpb7000_storeaddr_card_device::prot_a_w(int state)
{
const bool old = m_prot_a;
m_prot_a = (bool)state;
if (old != m_prot_b)
update_prot_proms();
}
void dpb7000_storeaddr_card_device::prot_b_w(int state)
{
const bool old = m_prot_b;
m_prot_b = (bool)state;
if (old != m_prot_b)
update_prot_proms();
}
void dpb7000_storeaddr_card_device::update_prot_proms()
{
const uint16_t m_x_addr = ((uint8_t)m_cx_stripe_num) | (m_prot_a ? 0x000 : 0x100) | (m_prot_b ? 0x000 : 0x200);
const uint16_t m_y_addr = ((uint8_t)(m_cy_addr >> 2)) | (m_prot_a ? 0x000 : 0x100) | (m_prot_b ? 0x000 : 0x200);
m_protx = BIT(m_protx_base[m_x_addr], 0);
m_proty = BIT(m_proty_base[m_y_addr], 0);
}

View File

@ -48,19 +48,47 @@ public:
void creq_w(int state);
void cr_w(int state);
void prot_a_w(int state);
void prot_b_w(int state);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual const tiny_rom_entry *device_rom_region() const override;
void set_cxpos(uint16_t data);
void tick_cxck();
void tick_cyck();
void update_prot_proms();
uint8_t *m_bb_base;
uint8_t *m_bc_base;
uint8_t *m_bd_base;
uint8_t *m_protx_base;
uint8_t *m_proty_base;
uint8_t m_bb_out;
uint8_t m_bc_out;
uint8_t m_bd_out;
bool m_protx;
bool m_proty;
uint16_t m_rhscr;
uint16_t m_rvscr;
uint16_t m_rzoom;
uint16_t m_fld_sel;
uint16_t m_cxpos;
uint16_t m_cypos;
int8_t m_orig_cx_stripe_addr;
int16_t m_orig_cx_stripe_num;
int16_t m_orig_cy_addr;
int8_t m_cx_stripe_addr;
int16_t m_cx_stripe_num;
int16_t m_cy_addr;
int m_s_type;
bool m_cen;
@ -83,6 +111,14 @@ protected:
bool m_selvideo;
bool m_creq;
bool m_cread;
bool m_prot_a;
bool m_prot_b;
required_memory_region m_x_prom;
required_memory_region m_protx_prom;
required_memory_region m_proty_prom;
required_memory_region m_blanking_pal;
};
// device type definition