diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index b2aba60c804..0f8dfc70669 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -3211,16 +3211,6 @@ files { createMESSProjects(_target, _subtarget, "quantel") files { MAME_DIR .. "src/mame/drivers/dpb7000.cpp", - MAME_DIR .. "src/mame/video/dpb_combiner.cpp", - MAME_DIR .. "src/mame/video/dpb_combiner.h", - MAME_DIR .. "src/mame/video/dpb_brushproc.cpp", - MAME_DIR .. "src/mame/video/dpb_brushproc.h", - MAME_DIR .. "src/mame/video/dpb_brushstore.cpp", - MAME_DIR .. "src/mame/video/dpb_brushstore.h", - MAME_DIR .. "src/mame/video/dpb_framestore.cpp", - MAME_DIR .. "src/mame/video/dpb_framestore.h", - MAME_DIR .. "src/mame/video/dpb_storeaddr.cpp", - MAME_DIR .. "src/mame/video/dpb_storeaddr.h", MAME_DIR .. "src/mame/drivers/harriet.cpp", } diff --git a/src/mame/drivers/dpb7000.cpp b/src/mame/drivers/dpb7000.cpp index 682e5d08922..ca6206540d2 100644 --- a/src/mame/drivers/dpb7000.cpp +++ b/src/mame/drivers/dpb7000.cpp @@ -12,17 +12,14 @@ #include "bus/rs232/rs232.h" #include "cpu/m68000/m68000.h" #include "cpu/m6800/m6801.h" +#include "imagedev/floppy.h" #include "machine/6850acia.h" #include "machine/am25s55x.h" #include "machine/am2910.h" #include "machine/com8116.h" +#include "machine/fdc_pll.h" #include "machine/input_merger.h" #include "machine/tdc1008.h" -#include "video/dpb_brushproc.h" -#include "video/dpb_brushstore.h" -#include "video/dpb_combiner.h" -#include "video/dpb_framestore.h" -#include "video/dpb_storeaddr.h" #include "video/mc6845.h" #include "emupal.h" #include "screen.h" @@ -37,10 +34,15 @@ #define LOG_FDC_CTRL (1 << 6) #define LOG_FDC_PORT (1 << 7) #define LOG_FDC_CMD (1 << 8) -#define LOG_OUTPUT_TIMING (1 << 9) -#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) +#define LOG_FDC_MECH (1 << 9) +#define LOG_OUTPUT_TIMING (1 << 10) +#define LOG_BRUSH_ADDR (1 << 11) +#define LOG_STORE_ADDR (1 << 12) +#define LOG_COMBINER (1 << 13) +#define LOG_SIZE_CARD (1 << 14) +#define LOG_FILTER_CARD (1 << 15) +#define LOG_ALL (LOG_UNKNOWN | LOG_CSR | LOG_CTRLBUS | LOG_SYS_CTRL | LOG_FDC_CTRL | LOG_FDC_PORT | LOG_FDC_CMD | LOG_FDC_MECH | LOG_BRUSH_ADDR | \ + LOG_STORE_ADDR | LOG_COMBINER | LOG_SIZE_CARD | LOG_FILTER_CARD) #define VERBOSE (LOG_ALL &~ LOG_FDC_CTRL) #include "logmacro.h" @@ -68,15 +70,12 @@ public: , m_diskseq_prom(*this, "diskseq_prom") , m_fddcpu(*this, "fddcpu") , m_fdd_serial(*this, "fddserial") - , m_filter_cd(*this, "filter_cd") - , m_filter_ce(*this, "filter_ce") - , m_filter_cf(*this, "filter_cf") - , m_filter_cg(*this, "filter_cg") - , m_store_addr(*this, "store_addr%u", 0U) - , m_brush_proc(*this, "brush_proc%u", 0U) - , m_brush_store(*this, "brush_store") - , m_combiner(*this, "combiner") - , m_framestore(*this, "framestore%u", 0U) + , m_floppy0(*this, "0") + , m_floppy(nullptr) + , m_filter_signalprom(*this, "filter_signalprom") + , m_filter_multprom(*this, "filter_multprom") + , m_filter_signal(nullptr) + , m_filter_mult(nullptr) { } @@ -89,7 +88,7 @@ private: template uint32_t store_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - static constexpr device_timer_id TIMER_DISKSEQ = 0; + static constexpr device_timer_id TIMER_DISKSEQ_COMPLETE = 0; static constexpr device_timer_id TIMER_FIELD_IN = 1; static constexpr device_timer_id TIMER_FIELD_OUT = 2; @@ -108,6 +107,7 @@ private: DECLARE_WRITE_LINE_MEMBER(req_a_w); DECLARE_WRITE_LINE_MEMBER(req_b_w); + void fdd_index_callback(floppy_image_device *floppy, int state); DECLARE_READ8_MEMBER(fdd_ctrl_r); DECLARE_READ8_MEMBER(fdd_cmd_r); DECLARE_WRITE8_MEMBER(fddcpu_p1_w); @@ -115,8 +115,9 @@ private: DECLARE_WRITE8_MEMBER(fddcpu_p2_w); DECLARE_WRITE_LINE_MEMBER(fddcpu_debug_rx); - void handle_brush_function(uint16_t data); + void handle_command(uint16_t data); void store_address_w(uint8_t card, uint16_t data); + void combiner_reg_w(uint16_t data); enum : uint16_t { @@ -165,27 +166,12 @@ private: uint8_t m_fdd_ctrl; uint8_t m_fdd_port1; uint8_t m_fdd_track; + fdc_pll_t m_fdd_pll; - uint16_t m_rhscr[2]; - uint16_t m_rvscr[2]; - uint16_t m_rzoom[2]; - uint16_t m_fld_sel[2]; - uint16_t m_window_enable[2]; - uint16_t m_cxpos[2]; - uint16_t m_cypos[2]; + required_device m_floppy0; + floppy_image_device *m_floppy; - required_device m_filter_cd; - required_device m_filter_ce; - required_device m_filter_cf; - required_device m_filter_cg; - - required_device_array m_store_addr; - required_device_array m_brush_proc; - required_device m_brush_store; - required_device m_combiner; - required_device_array m_framestore; - - emu_timer *m_diskseq_clk; + emu_timer *m_diskseq_complete_clk; emu_timer *m_field_in_clk; emu_timer *m_field_out_clk; @@ -248,6 +234,12 @@ private: uint8_t m_diskseq_status_out; // BC uint8_t m_diskseq_ucode_latch[7]; // GG/GF/GE/GD/GC/GB/GA uint8_t m_diskseq_cc_inputs[4]; // Inputs to FE/FD/FC/FB + bool m_diskseq_cyl_read_pending; + + // Disc Data Buffer Card + uint16_t m_diskbuf_ram_addr; + uint8_t m_diskbuf_ram[14 * 0x800]; + uint16_t m_diskbuf_data_count; // Output Timing Card uint16_t m_cursor_origin_x; @@ -262,14 +254,57 @@ private: uint8_t m_biyos; uint16_t m_bxlen; uint16_t m_bylen; + uint16_t m_bxlen_counter; + uint16_t m_bylen_counter; uint8_t m_plum; uint8_t m_pchr; std::unique_ptr m_framestore_chr[2]; std::unique_ptr m_framestore_lum[2]; std::unique_ptr m_framestore_ext[2]; - std::unique_ptr m_brushstore_chr[2]; - std::unique_ptr m_brushstore_lum[2]; - std::unique_ptr m_brushstore_ext[2]; + + // Brush Store Card + uint8_t m_bs_y_latch; + uint8_t m_bs_u_latch; + uint8_t m_bs_v_latch; + std::unique_ptr m_brushstore_chr; + std::unique_ptr m_brushstore_lum; + std::unique_ptr m_brushstore_ext; + + // Store Address Card + uint16_t m_rhscr[2]; + uint16_t m_rvscr[2]; + uint16_t m_rzoom[2]; + uint16_t m_fld_sel[2]; + uint16_t m_window_enable[2]; + uint16_t m_cxpos[2]; + uint16_t m_cypos[2]; + uint16_t m_ca0; + + // Combiner Card + uint8_t m_cursor_y; + uint8_t m_cursor_u; + uint8_t m_cursor_v; + uint8_t m_invert_mask; + bool m_select_matte[2]; + uint8_t m_matte_ext[2]; + uint8_t m_matte_y[2]; + uint8_t m_matte_u[2]; + uint8_t m_matte_v[2]; + + // Filter Card + required_memory_region m_filter_signalprom; + required_memory_region m_filter_multprom; + uint8_t *m_filter_signal; + uint8_t *m_filter_mult; + uint8_t m_filter_acbc[16]; + uint8_t m_filter_abbb[16]; + + // Size Card + uint8_t m_size_h; + uint8_t m_size_v; + + // Utility + std::unique_ptr m_yuv_lut; }; void dpb7000_state::main_map(address_map &map) @@ -376,49 +411,49 @@ static INPUT_PORTS_START( dpb7000 ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_START("CONFIGSW34") - PORT_DIPNAME( 0x0003, 0x0003, "Disc Group 1 Count" ) + PORT_DIPNAME( 0x0003, 0x0003, "Disc Group 0 Count" ) PORT_DIPSETTING( 0x0003, "One" ) PORT_DIPSETTING( 0x0002, "Two" ) PORT_DIPSETTING( 0x0001, "Three" ) PORT_DIPSETTING( 0x0000, "Four" ) - PORT_DIPNAME( 0x001c, 0x001c, "Disc Group 0 Type" ) - PORT_DIPSETTING( 0x001c, "160Mb CDC Fixed" ) - PORT_DIPSETTING( 0x0018, "80Mb CDC Removable" ) - PORT_DIPSETTING( 0x0014, "NTSC/Floppy/PAL/Conv" ) - PORT_DIPSETTING( 0x0010, "Floppy Disc" ) - PORT_DIPSETTING( 0x000c, "80Mb Fujitsu" ) - PORT_DIPSETTING( 0x0008, "330Mb Fujitsu" ) - PORT_DIPSETTING( 0x0004, "160Mb Fujitsu" ) - PORT_DIPSETTING( 0x0000, "Unsupported" ) + PORT_DIPNAME( 0x001c, 0x0018, "Disc Group 0 Type" ) + PORT_DIPSETTING( 0x001c, "None" ) + PORT_DIPSETTING( 0x0018, "160Mb Fujitsu" ) + PORT_DIPSETTING( 0x0014, "330Mb Fujitsu" ) + PORT_DIPSETTING( 0x0010, "80Mb Fujitsu" ) + PORT_DIPSETTING( 0x000c, "Floppy Disc" ) + PORT_DIPSETTING( 0x0008, "NTSC/Floppy/PAL/Conv" ) + PORT_DIPSETTING( 0x0004, "80Mb CDC Removable" ) + PORT_DIPSETTING( 0x0000, "160Mb CDC Fixed" ) PORT_DIPNAME( 0x0060, 0x0060, "Disc Group 1 Count" ) PORT_DIPSETTING( 0x0060, "One" ) PORT_DIPSETTING( 0x0040, "Two" ) PORT_DIPSETTING( 0x0020, "Three" ) PORT_DIPSETTING( 0x0000, "Four" ) - PORT_DIPNAME( 0x0380, 0x0380, "Disc Group 1 Type" ) - PORT_DIPSETTING( 0x0380, "160Mb CDC Fixed" ) - PORT_DIPSETTING( 0x0300, "80Mb CDC Removable" ) - PORT_DIPSETTING( 0x0280, "NTSC/Floppy/PAL/Conv" ) - PORT_DIPSETTING( 0x0200, "Floppy Disc" ) - PORT_DIPSETTING( 0x0180, "80Mb Fujitsu" ) - PORT_DIPSETTING( 0x0100, "330Mb Fujitsu" ) - PORT_DIPSETTING( 0x0080, "160Mb Fujitsu" ) - PORT_DIPSETTING( 0x0000, "Unsupported" ) + PORT_DIPNAME( 0x0380, 0x0180, "Disc Group 1 Type" ) + PORT_DIPSETTING( 0x0380, "None" ) + PORT_DIPSETTING( 0x0300, "160Mb Fujitsu" ) + PORT_DIPSETTING( 0x0280, "330Mb Fujitsu" ) + PORT_DIPSETTING( 0x0200, "80Mb Fujitsu" ) + PORT_DIPSETTING( 0x0180, "Floppy Disc" ) + PORT_DIPSETTING( 0x0100, "NTSC/Floppy/PAL/Conv" ) + PORT_DIPSETTING( 0x0080, "80Mb CDC Removable" ) + PORT_DIPSETTING( 0x0000, "160Mb CDC Fixed" ) PORT_DIPNAME( 0x0c00, 0x0c00, "Disc Group 2 Count" ) PORT_DIPSETTING( 0x0c00, "One" ) PORT_DIPSETTING( 0x0800, "Two" ) PORT_DIPSETTING( 0x0400, "Three" ) PORT_DIPSETTING( 0x0000, "Four" ) PORT_DIPNAME( 0x7000, 0x7000, "Disc Group 2 Type" ) - PORT_DIPSETTING( 0x7000, "160Mb CDC Fixed" ) - PORT_DIPSETTING( 0x6000, "80Mb CDC Removable" ) - PORT_DIPSETTING( 0x5000, "NTSC/Floppy/PAL/Conv" ) - PORT_DIPSETTING( 0x4000, "Floppy Disc" ) - PORT_DIPSETTING( 0x3000, "80Mb Fujitsu" ) - PORT_DIPSETTING( 0x2000, "330Mb Fujitsu" ) - PORT_DIPSETTING( 0x1000, "160Mb Fujitsu" ) - PORT_DIPSETTING( 0x0000, "Unsupported" ) - PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x7000, "None" ) + PORT_DIPSETTING( 0x6000, "160Mb Fujitsu" ) + PORT_DIPSETTING( 0x5000, "330Mb Fujitsu" ) + PORT_DIPSETTING( 0x4000, "80Mb Fujitsu" ) + PORT_DIPSETTING( 0x3000, "Floppy Disc" ) + PORT_DIPSETTING( 0x2000, "NTSC/Floppy/PAL/Conv" ) + PORT_DIPSETTING( 0x1000, "80Mb CDC Removable" ) + PORT_DIPSETTING( 0x0000, "160Mb CDC Fixed" ) + PORT_DIPNAME( 0x8000, 0x8000, "Start Up In Dialogue" ) PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) INPUT_PORTS_END @@ -450,6 +485,11 @@ void dpb7000_state::machine_start() save_item(NAME(m_diskseq_status_out)); save_item(NAME(m_diskseq_ucode_latch)); save_item(NAME(m_diskseq_cc_inputs)); + save_item(NAME(m_diskseq_cyl_read_pending)); + m_diskseq_complete_clk = timer_alloc(TIMER_DISKSEQ_COMPLETE); + m_diskseq_complete_clk->adjust(attotime::never); + + // Floppy Disc Controller Card save_item(NAME(m_fdd_debug_rx_bit_count)); save_item(NAME(m_fdd_debug_rx_byte_count)); save_item(NAME(m_fdd_debug_rx_recv_count)); @@ -457,8 +497,10 @@ void dpb7000_state::machine_start() save_item(NAME(m_fdd_port1)); save_item(NAME(m_fdd_track)); - m_diskseq_clk = timer_alloc(TIMER_DISKSEQ); - m_diskseq_clk->adjust(attotime::never); + // Disc Data Buffer Card + save_item(NAME(m_diskbuf_ram_addr)); + save_item(NAME(m_diskbuf_ram)); + save_item(NAME(m_diskbuf_data_count)); // Output Timing Card save_item(NAME(m_cursor_origin_x)); @@ -473,6 +515,8 @@ void dpb7000_state::machine_start() save_item(NAME(m_biyos)); save_item(NAME(m_bxlen)); save_item(NAME(m_bylen)); + save_item(NAME(m_bxlen_counter)); + save_item(NAME(m_bylen_counter)); save_item(NAME(m_plum)); save_item(NAME(m_pchr)); @@ -483,23 +527,72 @@ void dpb7000_state::machine_start() m_framestore_lum[i] = std::make_unique(10 * 0x10000); m_framestore_ext[i] = std::make_unique(10 * 0x10000); } + save_pointer(&m_framestore_chr[0][0], "m_framestore_chr[0]", 10 * 0x10000); + save_pointer(&m_framestore_lum[0][0], "m_framestore_lum[0]", 10 * 0x10000); + save_pointer(&m_framestore_ext[0][0], "m_framestore_ext[0]", 10 * 0x10000); + save_pointer(&m_framestore_chr[1][0], "m_framestore_chr[1]", 10 * 0x10000); + save_pointer(&m_framestore_lum[1][0], "m_framestore_lum[1]", 10 * 0x10000); + save_pointer(&m_framestore_ext[1][0], "m_framestore_ext[1]", 10 * 0x10000); - // Brush Store Cards - for (int i = 0; i < 2; i++) - { - m_brushstore_chr[i] = std::make_unique(0x10000); - m_brushstore_lum[i] = std::make_unique(0x10000); - m_brushstore_ext[i] = std::make_unique(0x10000); - } + // Brush Store Card + save_item(NAME(m_bs_y_latch)); + save_item(NAME(m_bs_u_latch)); + save_item(NAME(m_bs_v_latch)); + m_brushstore_chr = std::make_unique(0x10000); + m_brushstore_lum = std::make_unique(0x10000); + m_brushstore_ext = std::make_unique(0x10000); + save_pointer(&m_brushstore_chr[0], "m_brushstore_chr", 0x10000); + save_pointer(&m_brushstore_lum[0], "m_brushstore_lum", 0x10000); + save_pointer(&m_brushstore_ext[0], "m_brushstore_ext", 0x10000); // Store Address Cards - memset(m_rhscr, 0, sizeof(uint16_t) * 2); - memset(m_rvscr, 0, sizeof(uint16_t) * 2); - memset(m_rzoom, 0, sizeof(uint16_t) * 2); - memset(m_fld_sel, 0, sizeof(uint16_t) * 2); - memset(m_window_enable, 0, sizeof(uint16_t) * 2); - memset(m_cxpos, 0, sizeof(uint16_t) * 2); - memset(m_cypos, 0, sizeof(uint16_t) * 2); + 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_window_enable)); + save_item(NAME(m_cxpos)); + save_item(NAME(m_cypos)); + save_item(NAME(m_ca0)); + + // Combiner Card + save_item(NAME(m_cursor_y)); + save_item(NAME(m_cursor_u)); + save_item(NAME(m_cursor_v)); + save_item(NAME(m_invert_mask)); + save_item(NAME(m_select_matte)); + save_item(NAME(m_matte_ext)); + save_item(NAME(m_matte_y)); + save_item(NAME(m_matte_u)); + save_item(NAME(m_matte_v)); + + // Size Card + save_item(NAME(m_size_h)); + save_item(NAME(m_size_v)); + + // Filter Card + m_filter_signal = m_filter_signalprom->base(); + m_filter_mult = m_filter_multprom->base(); + save_item(NAME(m_filter_acbc)); + save_item(NAME(m_filter_abbb)); + + m_yuv_lut = std::make_unique(0x1000000); + for (uint16_t u = 0; u < 256; u++) + { + for (uint16_t v = 0; v < 256; v++) + { + for (uint16_t y = 0; y < 256; y++) + { + float fr = y + 1.4075f * (v - 128); + float fg = y - 0.3455f * (u - 128) - (0.7169f * (v - 128)); + float fb = y + 1.7790f * (u - 128); + uint8_t r = (fr < 0.0f) ? 0 : (fr > 255.0f ? 255 : (uint8_t)fr); + uint8_t g = (fg < 0.0f) ? 0 : (fg > 255.0f ? 255 : (uint8_t)fg); + uint8_t b = (fb < 0.0f) ? 0 : (fb > 255.0f ? 255 : (uint8_t)fb); + m_yuv_lut[(u << 16) | (v << 8) | y] = 0xff000000 | (r << 16) | (g << 8) | b; + } + } + } } void dpb7000_state::machine_reset() @@ -524,13 +617,13 @@ void dpb7000_state::machine_reset() m_diskseq_cyl_to_ctrl = 0; m_diskseq_cmd_to_ctrl = 0; m_diskseq_status_in = 0; - m_diskseq_status_out = 0; + m_diskseq_status_out = 0xff; memset(m_diskseq_ucode_latch, 0, 7); memset(m_diskseq_cc_inputs, 0, 4); + m_diskseq_cyl_read_pending = false; + m_diskseq_complete_clk->adjust(attotime::never); - m_diskseq_clk->adjust(attotime::from_hz(1000000), 0, attotime::from_hz(1000000)); - - // Floppy Disc Controller + // Floppy Disc Controller Card m_fdd_debug_rx_bits.clear(); m_fdd_debug_rx_bit_count = 0; m_fdd_debug_rx_byte_count = 0; @@ -538,6 +631,14 @@ void dpb7000_state::machine_reset() m_fdd_ctrl = 0; m_fdd_port1 = 0; m_fdd_track = 20; + m_fdd_pll.set_clock(attotime::from_hz(1000000)); + m_fdd_pll.reset(machine().time()); + m_floppy = nullptr; + + // Disc Data Buffer Card + m_diskbuf_ram_addr = 0; + memset(m_diskbuf_ram, 0, 14 * 0x800); + m_diskbuf_data_count = 0; // Output Timing Card m_cursor_origin_x = 0; @@ -545,10 +646,6 @@ void dpb7000_state::machine_reset() m_cursor_size_x = 0; m_cursor_size_y = 0; - // Store Address Card - m_store_addr[0]->s_type_w(0); - m_store_addr[1]->s_type_w(1); - // Brush Address Card m_brush_addr_func = 0; m_bif = 0; @@ -556,6 +653,8 @@ void dpb7000_state::machine_reset() m_biyos = 0; m_bxlen = 0; m_bylen = 0; + m_bxlen_counter = 0; + m_bylen_counter = 0; m_plum = 0; m_pchr = 0; @@ -567,19 +666,48 @@ void dpb7000_state::machine_reset() memset(&m_framestore_ext[i][0], 0, 10 * 0x10000); } - // Brush Store Cards - for (int i = 0; i < 2; i++) - { - memset(&m_brushstore_chr[i][0], 0, 0x10000); - memset(&m_brushstore_lum[i][0], 0, 0x10000); - memset(&m_brushstore_ext[i][0], 0, 0x10000); - } + // Brush Store Card + m_bs_y_latch = 0; + m_bs_u_latch = 0; + m_bs_v_latch = 0; + memset(&m_brushstore_chr[0], 0, 0x10000); + memset(&m_brushstore_lum[0], 0, 0x10000); + memset(&m_brushstore_ext[0], 0, 0x10000); + + // Store Address Card + memset(m_rhscr, 0, sizeof(uint16_t) * 2); + memset(m_rvscr, 0, sizeof(uint16_t) * 2); + memset(m_rzoom, 0, sizeof(uint16_t) * 2); + memset(m_fld_sel, 0, sizeof(uint16_t) * 2); + memset(m_window_enable, 0, sizeof(uint16_t) * 2); + memset(m_cxpos, 0, sizeof(uint16_t) * 2); + memset(m_cypos, 0, sizeof(uint16_t) * 2); + m_ca0 = 0; + + // Combiner Card + m_cursor_y = 0; + m_cursor_u = 0; + m_cursor_v = 0; + m_invert_mask = 0; + memset(m_select_matte, 0, 2); + memset(m_matte_ext, 0, 2); + memset(m_matte_y, 0, 2); + memset(m_matte_u, 0, 2); + memset(m_matte_v, 0, 2); + + // Filter Card + memset(m_filter_acbc, 0, 16); + memset(m_filter_abbb, 0, 16); + + // Size Card + m_size_h = 0; + m_size_v = 0; } void dpb7000_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - if (id == TIMER_DISKSEQ) - diskseq_tick(); + if (id == TIMER_DISKSEQ_COMPLETE) + req_b_w(1); else if (id == TIMER_FIELD_IN) req_a_w(1); else if (id == TIMER_FIELD_OUT) @@ -618,6 +746,7 @@ MC6845_ON_UPDATE_ADDR_CHANGED(dpb7000_state::crtc_addr_changed) { } +// NOTE: This function is not used, but is retained in the event we wish for low-level disk sequencer emulation. WRITE16_MEMBER(dpb7000_state::diskseq_y_w) { uint8_t old_prom_latch[7]; @@ -783,6 +912,7 @@ WRITE16_MEMBER(dpb7000_state::diskseq_y_w) } } +// NOTE: This function is not used, but is retained in the event we wish for low-level disk sequencer emulation. void dpb7000_state::diskseq_tick() { m_diskseq_cp = (m_diskseq_cp ? 0 : 1); @@ -839,6 +969,12 @@ READ16_MEMBER(dpb7000_state::cpu_ctrlbus_r) case 1: LOGMASKED(LOG_CTRLBUS, "%s: CPU read from Control Bus, Disk Sequencer Card status: %02x\n", machine().describe_context(), m_diskseq_status_out); ret = m_diskseq_status_out; + //req_b_w(0); + break; + case 0x7: + ret = m_diskbuf_ram[m_diskbuf_ram_addr]; + LOGMASKED(LOG_CTRLBUS, "%s: CPU read from Control Bus, Disc Data Buffer Card RAM read: %04x = %02x\n", machine().describe_context(), m_diskbuf_ram_addr, ret); + m_diskbuf_ram_addr++; break; case 12: ret = m_config_sw34->read(); @@ -860,39 +996,90 @@ void dpb7000_state::store_address_w(uint8_t card, uint16_t data) switch ((data >> 12) & 7) { case 0: - LOG("%s: Store Address Card %d, set RHSCR: %03x\n", machine().describe_context(), card + 1, data & 0xfff); + LOGMASKED(LOG_STORE_ADDR, "%s: Store Address Card %d, set RHSCR: %03x\n", machine().describe_context(), card + 1, data & 0xfff); m_rhscr[card] = data & 0xfff; break; case 1: - LOG("%s: Store Address Card %d, set RVSCR: %03x\n", machine().describe_context(), card + 1, data & 0xfff); + LOGMASKED(LOG_STORE_ADDR, "%s: Store Address Card %d, set RVSCR: %03x\n", machine().describe_context(), card + 1, data & 0xfff); m_rvscr[card] = data & 0xfff; break; case 2: - LOG("%s: Store Address Card %d, set R ZOOM: %03x\n", machine().describe_context(), card + 1, data & 0xfff); + LOGMASKED(LOG_STORE_ADDR, "%s: Store Address Card %d, set R ZOOM: %03x\n", machine().describe_context(), card + 1, data & 0xfff); m_rzoom[card] = data & 0xf; break; case 3: - LOG("%s: Store Address Card %d, set FLDSEL: %03x\n", machine().describe_context(), card + 1, data & 0xfff); + LOGMASKED(LOG_STORE_ADDR, "%s: Store Address Card %d, set FLDSEL: %03x\n", machine().describe_context(), card + 1, data & 0xfff); m_fld_sel[card] = data & 0xf; m_window_enable[card] = BIT(m_fld_sel[card], 2); break; case 4: - LOG("%s: Store Address Card %d, set CXPOS: %03x\n", machine().describe_context(), card + 1, data & 0xfff); + LOGMASKED(LOG_STORE_ADDR, "%s: Store Address Card %d, set CXPOS: %03x\n", machine().describe_context(), card + 1, data & 0xfff); m_cxpos[card] = data & 0xfff; break; case 5: - LOG("%s: Store Address Card %d, set CYPOS: %03x\n", machine().describe_context(), card + 1, data & 0xfff); + LOGMASKED(LOG_STORE_ADDR, "%s: Store Address Card %d, set CYPOS: %03x\n", machine().describe_context(), card + 1, data & 0xfff); m_cypos[card] = data & 0xfff; break; default: - LOG("%s: Store Address Card %d, unknown register: %04x\n", machine().describe_context(), card + 1, data); + LOGMASKED(LOG_STORE_ADDR, "%s: Store Address Card %d, unknown register: %04x\n", machine().describe_context(), card + 1, data); break; } } -void dpb7000_state::handle_brush_function(uint16_t data) +void dpb7000_state::combiner_reg_w(uint16_t data) { - //printf("handle_brush_function %d, cxpos %d, cypos %d\n", (data >> 1) & 0xf, m_cxpos[1], m_cypos[1]); + static const char* const s_const_names[16] = { "Y0", "CY", "CU", "CV", "ES", "EI", "EII", "Y7", "IS", "IY", "IU", "IV", "IIS", "IIY", "IIU", "IIV" }; + LOGMASKED(LOG_COMBINER, "%s: Combiner Card register write: %s = %02x\n", machine().describe_context(), s_const_names[(data >> 10) & 0xf], (uint8_t)data); + switch ((data >> 10) & 0xf) + { + case 1: // CY + m_cursor_y = (uint8_t)data; + break; + case 2: // CU + m_cursor_u = (uint8_t)data; + break; + case 3: // CV + m_cursor_v = (uint8_t)data; + break; + case 4: // ES + m_invert_mask = (uint8_t)data; + break; + case 5: // EI + m_matte_ext[0] = (uint8_t)data; + break; + case 6: // EII + m_matte_ext[1] = (uint8_t)data; + break; + case 8: // IS + m_select_matte[0] = BIT(data, 0); + break; + case 9: // IY + m_matte_y[0] = (uint8_t)data; + break; + case 10: // IU + m_matte_u[0] = (uint8_t)data; + break; + case 11: // IV + m_matte_v[0] = (uint8_t)data; + break; + case 12: // IIS + m_select_matte[1] = BIT(data, 0); + break; + case 13: // IIY + m_matte_y[1] = (uint8_t)data; + break; + case 14: // IIU + m_matte_u[1] = (uint8_t)data; + break; + case 15: // IIV + m_matte_v[1] = (uint8_t)data; + break; + } +} + +void dpb7000_state::handle_command(uint16_t data) +{ + //printf("handle_command %d, cxpos %d, cypos %d\n", (data >> 1) & 0xf, m_cxpos[1], m_cypos[1]); switch ((data >> 1) & 0xf) { case 0: // Live Video @@ -910,22 +1097,56 @@ void dpb7000_state::handle_brush_function(uint16_t data) case 6: // Fast Wipe Brush Store break; case 7: // Fast Wipe Framestore - if (!BIT(data, 5) && m_cxpos[0] < 800 && m_cypos[0] < 768) + for (int i = 0; i < 2; i++) { - //printf("Plotting store 1 at %d, %d\n", m_cxpos[0], m_cypos[0]); - m_framestore_lum[0][m_cypos[0] * 800 + m_cxpos[0]] = 0xff; - m_framestore_chr[0][m_cypos[0] * 800 + (m_cxpos[0] & ~1)] = 0x80; - m_framestore_chr[0][m_cypos[0] * 800 + (m_cxpos[0] | 1)] = 0x80; - } - if (!BIT(data, 6) && m_cxpos[1] < 800 && m_cypos[1] < 768) - { - //printf("Plotting store 2 at %d, %d\n", m_cxpos[1], m_cypos[1]); - m_framestore_lum[1][m_cypos[1] * 800 + m_cxpos[1]] = 0xff; - m_framestore_chr[1][m_cypos[1] * 800 + (m_cxpos[1] & ~1)] = 0x80; - m_framestore_chr[1][m_cypos[1] * 800 + (m_cxpos[1] | 1)] = 0x80; + if (!BIT(data, 5 + i) && m_cxpos[i] < 800 && m_cypos[i] < 768) + { + m_bylen_counter = m_bylen; + for (uint16_t y = m_cypos[i]; m_bylen_counter != 0x1000 && y < 768; m_bylen_counter++, y++) + { + uint8_t *lum = &m_framestore_lum[i][y * 800]; + uint8_t *chr = &m_framestore_chr[i][y * 800]; + m_bxlen_counter = m_bxlen; + for (uint16_t x = m_cxpos[i]; m_bxlen_counter != 0x1000 && x < 800; m_bxlen_counter++, x++) + { + lum[x] = m_bs_y_latch; + chr[x] = (x & 1) ? m_bs_v_latch : m_bs_u_latch; + } + } + } } break; case 8: // Draw + for (int i = 0; i < 2; i++) + { + if (!BIT(data, 5 + i) && m_cxpos[i] < 800 && m_cypos[i] < 768) + { + uint16_t bxlen = (((m_bxlen << 3) | (m_bixos & 7)) >> (m_bif & 3)) & 0xfff; + uint16_t bylen = (((m_bylen << 3) | (m_biyos & 7)) >> ((m_bif >> 2) & 3)) & 0xfff; + for (uint16_t y = m_cypos[i], by = bylen; by != 0x1000 && y < 768; by++, y++) + { + uint8_t *lum = &m_framestore_lum[i][y * 800]; + uint8_t *chr = &m_framestore_chr[i][y * 800]; + for (uint16_t x = m_cxpos[i], bx = bxlen; bx != 0x1000 && x < 800; bx++, x++) + { + if (BIT(data, 13)) // Fixed Colour Select + { + uint8_t y = 0x00; + uint8_t u = 0x80; + uint8_t v = 0x80; + if (!BIT(data, 12)) // Brush Zero + { + y = m_bs_y_latch; + u = m_bs_u_latch; + v = m_bs_v_latch; + } + lum[x] = y; + chr[x] = (m_cxpos[i] & 1) ? v : u; + } + } + } + } + } break; case 9: // Draw with Stencil I break; @@ -957,22 +1178,22 @@ WRITE16_MEMBER(dpb7000_state::cpu_ctrlbus_w) "Draw", "Draw with Stencil I", "Draw with Stencil II", "Copy to Framestore", "Copy to Brush Store", "Paste with Stencil I", "Paste with Stencil II", "Copy to same Framestore (Invert)" }; - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, "%s: Brush Address Card, Function Select: %04x\n", machine().describe_context(), data); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Function: %s\n", s_func_names[(data >> 1) & 0xf]); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Store I: %d\n", BIT(data, 5)); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Store II: %d\n", BIT(data, 6)); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Luma Enable: %d\n", BIT(data, 7)); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Chroma Enable: %d\n", BIT(data, 8)); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Brush Select: %d\n", BIT(data, 9)); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Disc Enable: %d\n", BIT(data, 10)); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Brush Invert: %d\n", BIT(data, 11)); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Brush Zero: %d\n", BIT(data, 12)); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Fixed Color Select: %d\n", BIT(data, 13)); - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, " Go: %d\n", BIT(data, 0)); + LOGMASKED(LOG_BRUSH_ADDR, "%s: Brush Address Card, Function Select: %04x\n", machine().describe_context(), data); + LOGMASKED(LOG_BRUSH_ADDR, " Function: %s\n", s_func_names[(data >> 1) & 0xf]); + LOGMASKED(LOG_BRUSH_ADDR, " Store I: %d\n", BIT(data, 5)); + LOGMASKED(LOG_BRUSH_ADDR, " Store II: %d\n", BIT(data, 6)); + LOGMASKED(LOG_BRUSH_ADDR, " Luma Enable: %d\n", BIT(data, 7)); + LOGMASKED(LOG_BRUSH_ADDR, " Chroma Enable: %d\n", BIT(data, 8)); + LOGMASKED(LOG_BRUSH_ADDR, " Brush Select: %d\n", BIT(data, 9)); + LOGMASKED(LOG_BRUSH_ADDR, " Disc Enable: %d\n", BIT(data, 10)); + LOGMASKED(LOG_BRUSH_ADDR, " Brush Invert: %d\n", BIT(data, 11)); + LOGMASKED(LOG_BRUSH_ADDR, " Brush Zero: %d\n", BIT(data, 12)); + LOGMASKED(LOG_BRUSH_ADDR, " Fixed Color Select: %d\n", BIT(data, 13)); + LOGMASKED(LOG_BRUSH_ADDR, " Go: %d\n", BIT(data, 0)); m_brush_addr_func = data & ~1; if (BIT(data, 0)) { - handle_brush_function(data); + handle_command(data); } break; } @@ -982,15 +1203,127 @@ WRITE16_MEMBER(dpb7000_state::cpu_ctrlbus_w) const uint8_t hi_nybble = data >> 12; if (hi_nybble == 0) { + uint16_t old_cyl = m_diskseq_cyl_from_cpu; m_diskseq_cyl_from_cpu = data & 0x3ff; LOGMASKED(LOG_CTRLBUS, "%s: CPU write to Control Bus, Disk Sequencer Card, Cylinder Number: %04x\n", machine().describe_context(), m_diskseq_cyl_from_cpu); + if (old_cyl != m_diskseq_cyl_from_cpu && m_diskseq_cyl_from_cpu < 78 && m_floppy != nullptr) + { + if (m_diskseq_cyl_from_cpu < old_cyl) + { + m_floppy->dir_w(1); + for (uint16_t i = m_diskseq_cyl_from_cpu; i < old_cyl; i++) + { + m_floppy->stp_w(1); + m_floppy->stp_w(0); + m_floppy->stp_w(1); + } + } + else + { + m_floppy->dir_w(0); + for (uint16_t i = old_cyl; i < m_diskseq_cyl_from_cpu; i++) + { + m_floppy->stp_w(1); + m_floppy->stp_w(0); + m_floppy->stp_w(1); + } + } + LOGMASKED(LOG_CTRLBUS, "%s: New floppy cylinder: %04x\n", machine().describe_context(), m_floppy->get_cyl()); + } + } + else if (hi_nybble == 1) + { + LOGMASKED(LOG_CTRLBUS, "%s: CPU write to Control Bus, Disc Data Buffer Card, Preset RAM Address: %04x\n", machine().describe_context(), data & 0xfff); + m_diskbuf_ram_addr = data & 0xfff; } else if (hi_nybble == 2) { m_diskseq_cmd_from_cpu = data & 0xfff; - m_diskseq_halt = false; - req_b_w(0); - LOGMASKED(LOG_CTRLBUS, "%s: CPU write to Control Bus, Disk Sequencer Card, Command: %04x\n", machine().describe_context(), m_diskseq_cmd_from_cpu); + req_b_w(0); // Flag ourselves as in-use + LOGMASKED(LOG_CTRLBUS, "%s: CPU write to Control Bus, Disk Sequencer Card, Command: %x (%04x)\n", machine().describe_context(), (data >> 8) & 0xf, data); + LOGMASKED(LOG_CTRLBUS, "%s Head: %x\n", machine().describe_context(), data & 0xf); + LOGMASKED(LOG_CTRLBUS, "%s Drive: %x\n", machine().describe_context(), (data >> 5) & 7); + switch ((data >> 8) & 0xf) + { + case 1: + LOGMASKED(LOG_CTRLBUS, "%s: Disk Sequencer Card Command: Unknown command nybble 1\n", machine().describe_context()); + req_b_w(1); + //m_diskseq_complete_clk->adjust(attotime::from_msec(1)); + break; + case 0: + LOGMASKED(LOG_CTRLBUS, "%s: Disk Sequencer Card Command: Read (floppy?) track to RAM buffer?\n", machine().describe_context()); + if (!BIT(m_diskseq_status_out, 3)) + { + m_diskseq_cyl_read_pending = true; + } + break; + case 6: + case 4: + { + //req_b_w(1); + m_diskseq_cyl_read_pending = true; + LOGMASKED(LOG_CTRLBUS, "%s: Disk Sequencer Card Command: %s track read to Brush Store (ignored for now)\n", machine().describe_context(), + ((data >> 8) & 0xf) == 6 ? "Initiate" : "Continue"); + /*if (((data >> 8) & 0xf) == 6) + { + m_size_h = 0; + m_size_v = 0; + } + uint16_t disc_buffer_addr = 0; + uint16_t bx = m_bxlen_counter - m_bxlen; + uint16_t by = m_bylen_counter - m_bylen; + while (m_diskbuf_data_count > 0 && m_bylen_counter < 0x1000) + { + uint8_t hv = (m_size_h << 4) | m_size_v; + uint8_t hv_permuted = bitswap<8>(hv,4,6,0,2,5,7,1,3); + + if (BIT(m_brush_addr_func, 7)) // Luma Enable + { + //printf("%02x ", m_diskbuf_ram[disc_buffer_addr]); + m_brushstore_lum[by * 256 + hv_permuted] = m_diskbuf_ram[disc_buffer_addr]; + } + + disc_buffer_addr++; + m_diskbuf_data_count--; + + if (BIT(m_brush_addr_func, 8)) // Chroma Enable + { + m_brushstore_chr[by * 256 + hv_permuted] = m_diskbuf_ram[disc_buffer_addr]; + } + + disc_buffer_addr++; + m_diskbuf_data_count--; + + m_size_h++; + if (m_size_h == 16) + { + m_size_h = 0; + m_size_v++; + if (m_size_v == 16) + { + m_size_v = 0; + } + } + + bx++; + m_bxlen_counter++; + if (m_bxlen_counter == 0x1000) + { + bx = 0; + by++; + m_bxlen_counter = m_bxlen; + m_bylen_counter++; + //printf("\n"); + } + }*/ + m_diskseq_complete_clk->adjust(attotime::from_msec(1)); + break; + } + default: + LOGMASKED(LOG_CTRLBUS, "%s: Unknown Disk Sequencer Card command.\n", machine().describe_context()); + m_diskseq_complete_clk->adjust(attotime::from_msec(1)); + break; + } } else { @@ -1003,14 +1336,44 @@ WRITE16_MEMBER(dpb7000_state::cpu_ctrlbus_w) store_address_w(1, data); if (BIT(data, 15)) store_address_w(0, data); - - //m_store_addr[1]->reg_w(data); - //if (BIT(data, 15)) - // m_store_addr[0]->reg_w(data); break; - case 8: // Brush Address Card, "Select 8" signal to PAL 16L8, BE - LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, "%s: Brush Address Card, Select 8: %04x\n", machine().describe_context(), data); + case 3: // Size Card, Y6/Y7 + if (BIT(data, 15)) + { + LOGMASKED(LOG_CTRLBUS | LOG_SIZE_CARD, "%s: Size Card Y7 (Flags): %04x\n", machine().describe_context(), data & 0x7fff); + } + else + { + LOGMASKED(LOG_CTRLBUS | LOG_SIZE_CARD, "%s: Size Card Y6 (Coefficients): %04x\n", machine().describe_context(), data & 0x7fff); + } + break; + + case 5: // Filter Card + if (BIT(data, 15)) + { + LOGMASKED(LOG_CTRLBUS | LOG_FILTER_CARD, "%s: Coefficient(?) RAM B: Index %x = %02x\n", machine().describe_context(), (data >> 8) & 0xf, data & 0xff); + m_filter_abbb[(data >> 8) & 0xf] = data & 0xff; + } + else + { + LOGMASKED(LOG_CTRLBUS | LOG_FILTER_CARD, "%s: Coefficient(?) RAM C: Index %x = %02x\n", machine().describe_context(), (data >> 8) & 0xf, data & 0xff); + m_filter_acbc[(data >> 8) & 0xf] = data & 0xff; + } + break; + + case 8: // Brush Store Card color latches + LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, "%s: Brush Store Card color latches (%s): %04x\n", machine().describe_context(), m_ca0 ? "VY" : "UY", data); + if (m_ca0) + { + m_bs_v_latch = (uint8_t)(data >> 8); + m_bs_y_latch = (uint8_t)data; + } + else + { + m_bs_u_latch = (uint8_t)(data >> 8); + } + m_ca0 = 1 - m_ca0; break; case 9: // Brush Address Card, register write/select @@ -1031,10 +1394,12 @@ WRITE16_MEMBER(dpb7000_state::cpu_ctrlbus_w) case 4: LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, "%s: Brush Address Card, Register Write: BXLEN = %03x\n", machine().describe_context(), data & 0xfff); m_bxlen = data & 0xfff; + m_bxlen_counter = data & 0xfff; break; case 5: LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, "%s: Brush Address Card, Register Write: BYLEN = %03x\n", machine().describe_context(), data & 0xfff); m_bylen = data & 0xfff; + m_bylen_counter = data & 0xfff; break; case 6: LOGMASKED(LOG_CTRLBUS | LOG_BRUSH_ADDR, "%s: Brush Address Card, Register Write: PLUM = %03x(?)\n", machine().describe_context(), data & 0xff); @@ -1076,7 +1441,7 @@ WRITE16_MEMBER(dpb7000_state::cpu_ctrlbus_w) } else if (hi_bits == 3) // Combiner Card, constant registers { - m_combiner->reg_w(data); + combiner_reg_w(data); } else { @@ -1153,31 +1518,136 @@ READ8_MEMBER(dpb7000_state::fdd_ctrl_r) return ret; } +void dpb7000_state::fdd_index_callback(floppy_image_device *floppy, int state) +{ + if (!state && m_diskseq_cyl_read_pending && m_floppy) + { + m_fdd_pll.read_reset(machine().time()); + + static const uint16_t PREGAP_MARK = 0xaaaa; + static const uint16_t SYNC_MARK = 0x9125; + + m_floppy->ss_w(0); + + for (int side = 0; side < 2; side++) + { + bool seen_pregap = false; + bool in_track = false; + int curr_bit = -1; + uint16_t curr_window = 0; + uint16_t bit_idx = 0; + + attotime tm = machine().time(); + attotime limit = machine().time() + attotime::from_ticks(1, 6); // One revolution at 360rpm on a Shugart SA850 + do + { + curr_bit = m_fdd_pll.get_next_bit(tm, m_floppy, limit); + if (curr_bit < 0) + { + LOGMASKED(LOG_FDC_MECH, "Warning: Unable to retrieve full track %d side %d!\n", m_floppy->get_cyl(), side); + } + else + { + curr_window <<= 1; + curr_window |= curr_bit; + bit_idx++; + //if ((bit_idx % 8) == 0) + //{ + // printf("%02x ", (uint8_t)curr_window); + //} + + if (!seen_pregap && curr_window == PREGAP_MARK) + { + seen_pregap = true; + //printf("\nFound pregap area.\n"); + bit_idx = 0; + curr_window = 0; + } + else if (seen_pregap && !in_track && curr_window == SYNC_MARK) + { + in_track = true; + //printf("\nOh hi, mark.\n"); + bit_idx = 0; + curr_window = 0; + } + else if (seen_pregap && in_track && bit_idx == 16) + { + uint8_t data_byte = (uint8_t)bitswap<16>((uint16_t)curr_window, 15, 13, 11, 9, 7, 5, 3, 1, 14, 12, 10, 8, 6, 4, 2, 0); + m_diskbuf_ram[m_diskbuf_ram_addr] = data_byte; + m_diskbuf_ram_addr++; + if (m_diskbuf_ram_addr >= 0x2700 && side == 0) + { + // If we've read the side 0 portion of the cylinder, yield out and begin processing side 1 + curr_bit = -1; + m_floppy->ss_w(1); + //printf("\nCatch you on the flip side!\n"); + } + else if(m_diskbuf_ram_addr >= 0x4b00 && side == 1) + { + // If we've read the side 1 portion of the cylinder, yield out, we're done + curr_bit = -1; + //printf("\nYou're my favorite customer.\n"); + } + bit_idx = 0; + curr_window = 0; + } + } + } while (curr_bit != -1); + } + m_diskseq_cyl_read_pending = false; + req_b_w(1); + } +} + WRITE8_MEMBER(dpb7000_state::fddcpu_p1_w) { LOGMASKED(LOG_FDC_PORT, "%s: Floppy CPU Port 1 Write: %02x\n", machine().describe_context(), data); const uint8_t old_value = m_fdd_port1; m_fdd_port1 = data; - if (!BIT(old_value, 0) && BIT(m_fdd_port1, 0)) + + floppy_image_device *newflop = m_floppy0->get_device(); + if (newflop != m_floppy) { - if (BIT(m_fdd_port1, 1) && m_fdd_track < 40) + if (m_floppy) { - m_fdd_track++; + m_floppy->mon_w(1); + m_floppy->setup_index_pulse_cb(floppy_image_device::index_pulse_cb()); } - else if (!BIT(m_fdd_port1, 1) && m_fdd_track > 0) + if (newflop) { - m_fdd_track--; + newflop->set_rpm(360); + newflop->mon_w(BIT(old_value, 2)); + newflop->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(&dpb7000_state::fdd_index_callback, this)); + m_fdd_track = newflop->get_cyl(); } + m_floppy = newflop; + } + + if (m_floppy) + { + m_floppy->mon_w(BIT(m_fdd_port1, 2)); + m_floppy->dir_w(1 - BIT(m_fdd_port1, 1)); + m_floppy->stp_w(1 - BIT(m_fdd_port1, 0)); + m_fdd_track = m_floppy->get_cyl(); if (m_fdd_track == 0) - m_fdd_ctrl |= 4; + { + m_fdd_ctrl |= 0x04; + } else - m_fdd_ctrl &= ~4; + { + m_fdd_ctrl &= ~0x04; + } } - if (BIT(m_fdd_port1, 7)) - m_diskseq_status_in |= (1 << DSEQ_STATUS_READY_BIT); else - m_diskseq_status_in &= ~(1 << DSEQ_STATUS_READY_BIT); + { + m_fdd_ctrl &= ~0x04; + } + + if (BIT(m_fdd_port1, 7)) + m_diskseq_status_out &= ~0x08; + else + m_diskseq_status_out |= 0x08; } WRITE8_MEMBER(dpb7000_state::fddcpu_p2_w) @@ -1230,28 +1700,50 @@ WRITE_LINE_MEMBER(dpb7000_state::fddcpu_debug_rx) template uint32_t dpb7000_state::store_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - for (int y = 0; y < 768; y++) + for (int py = 0; py < 768; py++) { - uint8_t *src_lum = &m_framestore_lum[StoreNum][y * 800]; - uint8_t *src_chr = &m_framestore_chr[StoreNum][y * 800]; - uint32_t *dst = &bitmap.pix32(y); - for (int x = 0; x < 800; x++) + uint8_t *src_lum = &m_framestore_lum[StoreNum][py * 800]; + uint8_t *src_chr = &m_framestore_chr[StoreNum][py * 800]; + uint32_t *dst = &bitmap.pix32(py); + for (int px = 0; px < 800; px++) { - uint8_t y = src_lum[x]; - uint8_t u = src_chr[x & ~1]; - uint8_t v = src_chr[x | 1]; - float fr = y + 1.4075f * (v - 128); - float fg = y - 0.3455f * (u - 128) - (0.7169f * (v - 128)); - float fb = y + 1.7790f * (u - 128); - uint8_t r = (fr < 0.0f) ? 0 : (fr > 255.0f ? 255 : (uint8_t)fr); - uint8_t g = (fg < 0.0f) ? 0 : (fg > 255.0f ? 255 : (uint8_t)fg); - uint8_t b = (fb < 0.0f) ? 0 : (fb > 255.0f ? 255 : (uint8_t)fb); - dst[x] = 0xff000000 | (r << 16) | (g << 8) | b; + const uint32_t u = *src_chr++ << 16; + const uint32_t v = *src_chr++ << 8; + *dst++ = m_yuv_lut[u | v | *src_lum++]; + *dst++ = m_yuv_lut[u | v | *src_lum++]; + } + } + + if (StoreNum == 0) + { + for (int py = 512; py < 768; py++) + { + uint8_t *src_lum = &m_brushstore_lum[(py - 512) * 256]; + uint8_t *src_chr = &m_brushstore_chr[(py - 512) * 256]; + uint32_t *dst = &bitmap.pix32(py); + for (int px = 0; px < 256; px++) + { + const uint32_t u = *src_chr++ << 16; + const uint32_t v = *src_chr++ << 8; + *dst++ = m_yuv_lut[u | v | *src_lum++]; + *dst++ = m_yuv_lut[u | v | *src_lum++]; + } } } return 0; } +static const floppy_format_type dpb7000_floppy_formats[] = +{ + FLOPPY_HFE_FORMAT, + FLOPPY_MFM_FORMAT +}; + +static void dpb7000_floppies(device_slot_interface &device) +{ + device.option_add("8", FLOPPY_8_DSDD); +} + void dpb7000_state::dpb7000(machine_config &config) { // Computer Card 1 & 2 @@ -1327,57 +1819,12 @@ void dpb7000_state::dpb7000(machine_config &config) m_fddcpu->in_p2_cb().set(FUNC(dpb7000_state::fddcpu_p2_r)); m_fddcpu->out_p2_cb().set(FUNC(dpb7000_state::fddcpu_p2_w)); + FLOPPY_CONNECTOR(config, m_floppy0, dpb7000_floppies, "8", dpb7000_floppy_formats); + RS232_PORT(config, m_fdd_serial, default_rs232_devices, nullptr); m_fdd_serial->rxd_handler().set(FUNC(dpb7000_state::fddcpu_debug_rx)); config.set_perfect_quantum(m_fddcpu); - - // Filter Card - TDC1008(config, m_filter_cd); - TDC1008(config, m_filter_ce); - TDC1008(config, m_filter_cf); - TDC1008(config, m_filter_cg); - - // Store Address Cards - DPB7000_STOREADDR(config, m_store_addr[0]); - DPB7000_STOREADDR(config, m_store_addr[1]); - - // Brush Processor Cards - DPB7000_BRUSHPROC(config, m_brush_proc[0]); - DPB7000_BRUSHPROC(config, m_brush_proc[1]); - - // Brush Store Card - DPB7000_BRUSHSTORE(config, m_brush_store); - - // Combiner Card - DPB7000_COMBINER(config, m_combiner, 14.318181_MHz_XTAL); - - // Framestore Cards - for (size_t i = 0; i < FRAMESTORE_COUNT; i++) - { - DPB7000_FRAMESTORE(config, m_framestore[i]); - } - - for (size_t i = 0; i < 2; i++) - { - for (size_t j = 0; j < FRAMESTORE_COUNT; j++) - { - m_store_addr[i]->ipsel().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::ipsel_w)); - m_store_addr[i]->csel().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::csel_w)); - m_store_addr[i]->rck().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::rck_w)); - m_store_addr[i]->cck().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::cck_w)); - m_store_addr[i]->ra().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::ra_w)); - m_store_addr[i]->opstr().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::opstr_w)); - m_store_addr[i]->opwa().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::opwa_w)); - m_store_addr[i]->opwb().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::opwb_w)); - m_store_addr[i]->opra().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::opra_w)); - m_store_addr[i]->oprb().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::oprb_w)); - m_store_addr[i]->a().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::a_w)); - m_store_addr[i]->ras().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::ras_w)); - m_store_addr[i]->cas().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::cas_w)); - m_store_addr[i]->write().set(m_framestore[j], FUNC(dpb7000_framestore_card_device::write_w)); - } - } } @@ -1424,6 +1871,51 @@ ROM_START( dpb7000 ) ROM_LOAD("pb-037-17418-cda.bin", 0x0800, 0x400, CRC(a31f3793) SHA1(4e74e528088c155e2c2592fa937e4cabfe6324c8)) ROM_LOAD("pb-037-17418-dfa.bin", 0x0c00, 0x400, CRC(ca2ec308) SHA1(4232f44ea5bd3fa240eaf7c14e4b925140f90a1e)) ROM_LOAD("pb-037-17418-bfa.bin", 0x1000, 0x200, CRC(db84a171) SHA1(ed63f384928a017dafd694c7bcf99e315af6bd3c)) + + ROM_REGION(0x800, "keyboard", 0) + ROM_LOAD("etc2716 63b2.bin", 0x000, 0x800, CRC(04614a50) SHA1(e547458f2c9cf29cf52f02b8824b32e5e91807fd)) + + ROM_REGION(0x2000, "tablet", 0) + ROM_LOAD("hn482764g.bin", 0x0000, 0x2000, CRC(3626059c) SHA1(1a4f5c8b337f31c7b2b93096b59234ffbc2f1f00)) + + ROM_REGION(0x2000, "tds", 0) + ROM_LOAD("nmc27c64q.bin", 0x0000, 0x2000, CRC(a453928f) SHA1(f4a25298fb446f0046c6f9f3ce70e7169dcebd01)) + + ROM_REGION(0x200, "brushproc_prom", 0) + ROM_LOAD("pb-02c-17593-baa.bin", 0x000, 0x200, CRC(a74cc1f5) SHA1(3b789d5a29c70c93dec56f44be8c14b41915bdef)) + + ROM_REGION16_BE(0x800, "brushproc_pal", 0) + ROMX_LOAD("pb-02c-17593-hba.bin", 0x000, 0x800, CRC(76018e4f) SHA1(73d995e2e78410676061d45857756d5305a9984a), ROM_GROUPWORD) + + ROM_REGION(0x100, "brushstore_pal", 0) + ROM_LOAD("pb-02a-17421-ada.bin", 0x000, 0x100, CRC(84bf7029) SHA1(9d58322994f6f7e99a9c6478577559c8171670ed)) + + ROM_REGION(0x400, "framestore_back_pal", 0) + ROM_LOAD("pb-02f-01748a-aba.bin", 0x000, 0x400, CRC(24b31494) SHA1(f9185a00e5470ec95d234a76c15acbf33cfb285d)) + + ROM_REGION(0x400, "framestore_front_pal", 0) + ROM_LOAD("pb-02f-01748a-bba.bin", 0x000, 0x400, CRC(8f06b632) SHA1(233b841c3957a6df229f3a693f9288cb8feec58c)) + + ROM_REGION(0x100, "filter_signalprom", 0) + ROM_LOAD("pb-027-17427a-dab.bin", 0x000, 0x100, CRC(6deac5cc) SHA1(184c34267e1b390bad0ca4a94befceece979e677)) + + ROM_REGION(0x200, "filter_multprom", 0) + ROM_LOAD("pb-027-17427a-afa-bfa.bin", 0x000, 0x200, CRC(58164a20) SHA1(c32997350bae22be075a8eee7fe4d1bdd8a34fd2)) + + ROM_REGION(0x100, "size_pal", 0) + ROM_LOAD("pb-012-17428a-aca.bin", 0x000, 0x100, CRC(0003b9ec) SHA1(8484e4c3b57069c5166201a7cb43d028c87e06cc)) + + ROM_REGION(0x200, "size_prom_yh", 0) + ROM_LOAD("pb-012-17428a-fda.bin", 0x000, 0x200, CRC(159418f4) SHA1(4e4c9be6d2e3ccdfdf8edfcb5cad106887e03fd2)) + + ROM_REGION(0x200, "size_prom_yl", 0) + ROM_LOAD("pb-012-17428a-gda.bin", 0x000, 0x200, CRC(1207291a) SHA1(ea44cf510169fdba2cfb0570a508fb3b0c93b06e)) + + ROM_REGION(0x200, "size_prom_xh", 0) + ROM_LOAD("pb-012-17428a-ecb.bin", 0x000, 0x200, CRC(1e324bf1) SHA1(efd88294dcb9fba58b2bb2b8d4715ba2c16f511d)) + + ROM_REGION(0x200, "size_prom_xl", 0) + ROM_LOAD("pb-012-17428a-gca.bin", 0x000, 0x200, CRC(ec7d26f3) SHA1(8bdbec33218f903294c135554d61271fa18d1a8d)) ROM_END COMP( 1981, dpb7000, 0, 0, dpb7000, dpb7000, dpb7000_state, empty_init, "Quantel", "DPB-7000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/video/dpb_brushproc.cpp b/src/mame/video/dpb_brushproc.cpp deleted file mode 100644 index a0745b8d8b0..00000000000 --- a/src/mame/video/dpb_brushproc.cpp +++ /dev/null @@ -1,548 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - dpb_brushproc.cpp - DPB-7000/1 - Brush Processor Card - -***************************************************************************/ - -#include "emu.h" -#include "dpb_brushproc.h" - -#define VERBOSE (1) -#include "logmacro.h" - -/*****************************************************************************/ - -DEFINE_DEVICE_TYPE(DPB7000_BRUSHPROC, dpb7000_brushproc_card_device, "dpb_brushproc", "Quantel DPB-7000 Brush Processor Card") - - -//------------------------------------------------- -// dpb7000_brushproc_card_device - constructor -//------------------------------------------------- - -dpb7000_brushproc_card_device::dpb7000_brushproc_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, DPB7000_BRUSHPROC, tag, owner, clock) - , m_ext_in(0) - , m_brush_in(0) - , m_cbus_in(0) - , m_k_in(0) - , m_k_enable(0) - , m_k_zero(false) - , m_k_invert(false) - , m_k_product(0) - , m_ext_product(0) - , m_final_product(0) - , m_final_result(0) - , m_brush_value(0) - , m_final_brush_value(0) - , m_compare_b_value(0) - , m_func(0) - , m_subtract_result(false) - , m_sel_eh(false) - , m_b_bus_ah(false) - , m_fcs(false) - , m_use_store1_for_brush(false) - , m_use_store2_for_brush(false) - , m_use_ext_for_brush(false) - , m_use_store1_or_ext_for_brush(false) - , m_use_store2_for_store1(false) - , m_enable_store_ext_multiplicand(false) - , m_output_16bit(false) - , m_pal_proc_in(false) - , m_disable_k_data(false) - , m_prom_addr(0) - , m_prom_base(nullptr) - , m_prom_out(0) - , m_pal_in(0) - , m_pal_base(nullptr) - , m_pal_data_out(0) - , m_pal_bpinv_out(false) - , m_pal_sel_out(false) - , m_store1(*this) - , m_store2(*this) - , 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") - , m_pal(*this, "pal") -{ -} - -void dpb7000_brushproc_card_device::device_start() -{ - save_item(NAME(m_store_in)); - save_item(NAME(m_store_out)); - save_item(NAME(m_ext_in)); - save_item(NAME(m_brush_in)); - save_item(NAME(m_cbus_in)); - - save_item(NAME(m_k_in)); - save_item(NAME(m_k_enable)); - save_item(NAME(m_k_zero)); - save_item(NAME(m_k_invert)); - - save_item(NAME(m_k_product)); - save_item(NAME(m_ext_product)); - save_item(NAME(m_final_product)); - save_item(NAME(m_final_result)); - - save_item(NAME(m_brush_value)); - save_item(NAME(m_final_brush_value)); - save_item(NAME(m_compare_b_value)); - - save_item(NAME(m_func)); - - save_item(NAME(m_subtract_result)); - - save_item(NAME(m_sel_luma)); - save_item(NAME(m_sel_eh)); - save_item(NAME(m_b_bus_ah)); - save_item(NAME(m_fcs)); - - save_item(NAME(m_oe)); - save_item(NAME(m_use_store1_for_brush)); - save_item(NAME(m_use_store2_for_brush)); - save_item(NAME(m_use_ext_for_brush)); - save_item(NAME(m_use_store1_or_ext_for_brush)); - save_item(NAME(m_use_store2_for_store1)); - save_item(NAME(m_enable_store_ext_multiplicand)); - save_item(NAME(m_output_16bit)); - save_item(NAME(m_pal_proc_in)); - save_item(NAME(m_disable_k_data)); - - save_item(NAME(m_prom_addr)); - save_item(NAME(m_prom_out)); - - save_item(NAME(m_pal_in)); - save_item(NAME(m_pal_data_out)); - save_item(NAME(m_pal_bpinv_out)); - save_item(NAME(m_pal_sel_out)); - - m_store1.resolve_safe(); - m_store2.resolve_safe(); -} - -void dpb7000_brushproc_card_device::device_reset() -{ - memset(m_store_in, 0, 2); - memset(m_store_out, 0, 2); - m_ext_in = 0; - m_brush_in = 0; - m_cbus_in = 0; - - m_k_in = 0; - m_k_enable = false; - m_k_zero = false; - m_k_invert = false; - - m_k_product = 0; - m_ext_product = 0; - m_final_product = 0; - m_final_result = 0; - - m_brush_value = 0; - m_final_brush_value = 0; - m_compare_b_value = 0; - - m_func = 0; - - m_subtract_result = false; - - memset(m_sel_luma, 0, 2); - m_sel_eh = false; - m_b_bus_ah = false; - m_fcs = false; - - memset(m_oe, 0, 4); - m_use_store1_for_brush = false; - m_use_store2_for_brush = false; - m_use_ext_for_brush = false; - m_use_store1_or_ext_for_brush = false; - m_use_store2_for_store1 = false; - m_enable_store_ext_multiplicand = false; - m_output_16bit = false; - m_pal_proc_in = false; - m_disable_k_data = false; - - m_prom_addr = 0; - m_prom_base = m_prom->base(); - m_prom_out = 0; - - m_pal_in = 0; - m_pal_base = m_pal->base(); - m_pal_data_out = 0; - m_pal_bpinv_out = false; - m_pal_sel_out = false; - - m_mult_fa->xm_w(0); - m_mult_fa->ym_w(0); - m_mult_fa->rs_w(0); - m_mult_fa->ru_w(1); - - m_mult_ga->xm_w(0); - m_mult_ga->ym_w(0); - m_mult_ga->rs_w(0); - m_mult_ga->ru_w(1); - - m_mult_gd->xm_w(0); - m_mult_gd->ym_w(0); - m_mult_gd->rs_w(0); - m_mult_gd->ru_w(1); -} - -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, "prom", 0) - ROM_LOAD("pb-02c-17593-baa.bin", 0x000, 0x200, CRC(a74cc1f5) SHA1(3b789d5a29c70c93dec56f44be8c14b41915bdef)) - - ROM_REGION16_BE(0x800, "pal", 0) - ROMX_LOAD("pb-02c-17593-hba.bin", 0x000, 0x800, CRC(76018e4f) SHA1(73d995e2e78410676061d45857756d5305a9984a), ROM_GROUPWORD) -ROM_END - -const tiny_rom_entry *dpb7000_brushproc_card_device::device_rom_region() const -{ - return ROM_NAME( dpb7000_brushproc ); -} - -void dpb7000_brushproc_card_device::store1_w(uint8_t data) -{ - m_store_in[0] = data; -} - -void dpb7000_brushproc_card_device::store2_w(uint8_t data) -{ - m_store_in[1] = data; -} - -void dpb7000_brushproc_card_device::ext_w(uint8_t data) -{ - m_ext_in = data; -} - -void dpb7000_brushproc_card_device::brush_w(uint8_t data) -{ - m_brush_in = data; -} - -void dpb7000_brushproc_card_device::cbus_w(uint8_t data) -{ - m_cbus_in = data; - update_k_product(); -} - -void dpb7000_brushproc_card_device::k_w(uint8_t data) -{ - m_k_in = data; - if (m_k_enable && !m_disable_k_data) - update_k_product(); -} - -void dpb7000_brushproc_card_device::k_en_w(int state) -{ - const bool old = m_k_enable; - m_k_enable = (bool)state; - if (!old && m_k_enable && !m_disable_k_data) - update_k_product(); -} - -void dpb7000_brushproc_card_device::k_zero_w(int state) -{ - const bool old = m_k_zero; - m_k_zero = (bool)state; - if (old != m_k_zero) - update_ext_product(); -} - -void dpb7000_brushproc_card_device::k_inv_w(int state) -{ - const bool old = m_k_invert; - m_k_invert = (bool)state; - if (old != m_k_invert) - update_pal_signals(); -} - -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)); - update_brush_value(); - update_compare_b_value(); -} - -void dpb7000_brushproc_card_device::update_pal_signals() -{ - const uint16_t old_data = m_pal_data_out; - const bool old_bpinv = m_pal_bpinv_out; - const uint16_t old_addr = m_pal_in; - m_pal_in = m_ext_product | (m_pal_proc_in ? 0x100 : 0) | (m_k_invert ? 0x200 : 0); - if (old_addr != m_pal_in) - { - const uint16_t shifted_addr = m_pal_in << 1; - const uint8_t pal_msb = m_pal_base[shifted_addr]; - m_pal_data_out = m_pal_base[shifted_addr + 1]; - m_pal_bpinv_out = BIT(pal_msb, 0); - m_pal_sel_out = BIT(pal_msb, 1); - if (old_bpinv != m_pal_bpinv_out) - { - m_final_brush_value = m_brush_value ^ (m_pal_bpinv_out ? 0xff : 0x00); - } - if (old_data != m_pal_data_out) - { - update_final_product(); - } - } -} - -void dpb7000_brushproc_card_device::update_k_product() -{ - const uint16_t x = (uint16_t)m_cbus_in; - const uint16_t y = (m_disable_k_data || !m_k_enable) ? 0x00ff : (uint16_t)m_k_in; - const uint8_t old = m_k_product; - m_k_product = (uint8_t)((x * y + 0x0080) >> 8); - if (old != m_k_product) - update_ext_product(); -} - -void dpb7000_brushproc_card_device::update_ext_product() -{ - const uint16_t y = (uint16_t)m_k_product; - uint16_t x = 0; - if (!m_k_zero) - { - if (m_enable_store_ext_multiplicand) - x = (uint16_t)m_ext_in; - else - x = 0xff; - } - const uint16_t old = m_ext_product; - m_ext_product = (uint8_t)((x * y + 0x0080) >> 8); - if (old != m_ext_product) - update_final_product(); -} - -void dpb7000_brushproc_card_device::update_final_product() -{ - const uint16_t x = (uint16_t)update_brush_alu_result(); - const uint16_t y = (uint16_t)m_pal_data_out; - m_final_product = x * y + (m_output_16bit ? 0x80 : 0x00); - uint16_t a = (m_compare_b_value << 8) | m_store_in[1]; - m_final_result = m_subtract_result ? (a - m_final_product) : (a + m_final_product); - m_store_out[0] = m_pal_sel_out ? (uint8_t)(m_final_result >> 8) : m_final_brush_value; - m_store_out[1] = m_output_16bit ? (uint8_t)m_final_result : m_store_out[0]; - m_store1(m_store_out[0]); - m_store2(m_store_out[1]); -} - -uint8_t dpb7000_brushproc_card_device::update_brush_alu_result() -{ - // Handled by a pair of 74S85 comparators (BB, CB), a pair of 74S381 ALUs (CD, DD) and a 74S182 carry lookahead generator (ED). - const uint8_t a = m_brush_value; - const uint8_t b = m_compare_b_value; - if (a <= b) - { - m_subtract_result = false; - return b - a; - } - else - { - m_subtract_result = true; - return a - b; - } -} - -void dpb7000_brushproc_card_device::set_oe1(int state) -{ - // When 0, force Store I or Store Ext. data onto Brush Data lanes - m_oe[0] = (bool)state; - m_use_store1_or_ext_for_brush = !m_oe[0]; - m_use_store1_for_brush = m_use_store1_or_ext_for_brush && !m_oe[2]; - m_use_ext_for_brush = m_use_store1_or_ext_for_brush && m_oe[2]; -} - -void dpb7000_brushproc_card_device::set_oe2(int state) -{ - // When 0, force Store II data onto Brush Data lanes - m_oe[1] = (bool)state; - m_use_store2_for_brush = !m_oe[1]; -} - -void dpb7000_brushproc_card_device::set_oe3(int state) -{ - // When 0, force Store Ext. data onto Store I data lanes (disables Store I data input) - m_oe[2] = (bool)state; - m_use_store1_for_brush = m_use_store1_or_ext_for_brush && m_oe[2]; - m_use_ext_for_brush = m_use_store1_or_ext_for_brush && !m_oe[2]; -} - -void dpb7000_brushproc_card_device::update_brush_value() -{ - if (m_use_store1_for_brush) - { - m_brush_value = m_store_in[0]; - } - else if (m_use_store2_for_brush) - { - m_brush_value = m_store_in[1]; - } - else if (m_use_ext_for_brush) - { - m_brush_value = m_ext_in; - } - else - { - m_brush_value = m_brush_in; - } -} - -void dpb7000_brushproc_card_device::update_compare_b_value() -{ - if (m_use_store2_for_store1) - { - m_compare_b_value = m_store_in[1]; - } - else if (m_oe[2]) - { - m_compare_b_value = m_ext_in; - } - else - { - m_compare_b_value = m_store_in[0]; - } -} - -void dpb7000_brushproc_card_device::set_oe4(int state) -{ - // When 0, force Store II data onto Store I data lanes (disables Store I data input) - m_oe[3] = (bool)state; - m_use_store2_for_store1 = !m_oe[3]; -} - -void dpb7000_brushproc_card_device::set_mask_sel_h(int state) -{ - // When 0, multiplies K product with 1.0 (0xff) instead of Store Ext. data. - m_enable_store_ext_multiplicand = (bool)state; -} - -void dpb7000_brushproc_card_device::set_16bit_h(int state) -{ - // When 0, enables Store II data output, enables Cx carry-out, and enables Ru pin on multiplier GD. - m_output_16bit = (bool)(1 - state); -} - -void dpb7000_brushproc_card_device::set_proc_sel_h(int state) -{ - // When 1, enables the PROC input pin on PAL 20L10 HB, not yet dumped. - m_pal_proc_in = (bool)state; - update_pal_signals(); -} - -void dpb7000_brushproc_card_device::set_k_eq_il(int state) -{ - // When 1, disables K data lanes, which collectively get pulled to 1.0 (0xff). - m_disable_k_data = (bool)state; - if (!m_disable_k_data && m_k_enable) - update_k_product(); -} - diff --git a/src/mame/video/dpb_brushproc.h b/src/mame/video/dpb_brushproc.h deleted file mode 100644 index 5b3d56f7d0e..00000000000 --- a/src/mame/video/dpb_brushproc.h +++ /dev/null @@ -1,148 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - dpb_brushproc.h - DPB-7000/1 - Brush Processor Card - - TODO: - - Everything - -***************************************************************************/ - -#ifndef MAME_VIDEO_DPB_BRUSHPROC_H -#define MAME_VIDEO_DPB_BRUSHPROC_H - -#pragma once - -#include "machine/74381.h" -#include "machine/am25s55x.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> dpb7000_brushproc_card_device - -class dpb7000_brushproc_card_device : public device_t -{ -public: - // construction/destruction - dpb7000_brushproc_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); - - void store1_w(uint8_t data); - void store2_w(uint8_t data); - void ext_w(uint8_t data); - void brush_w(uint8_t data); - void cbus_w(uint8_t data); - - void k_w(uint8_t data); - void k_en_w(int state); - void k_zero_w(int state); - void k_inv_w(int state); - - void func_w(uint8_t data); - void sel_lum1_w(int state); - void sel_lum2_w(int state); - void sel_eh_w(int state); - void b_bus_ah_w(int state); - void fixed_col_select_w(int state); - - auto store1() { return m_store1.bind(); } - auto store2() { return m_store2.bind(); } - -protected: - // device-level overrides - virtual void device_start() override; - virtual void device_reset() override; - virtual void device_add_mconfig(machine_config &config) override; - virtual const tiny_rom_entry *device_rom_region() const override; - - void update_prom_signals(); - void update_pal_signals(); - void update_k_product(); - void update_ext_product(); - void update_final_product(); - void update_brush_value(); - void update_compare_b_value(); - uint8_t update_brush_alu_result(); - - 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 get_compare_b(); - - uint8_t m_store_in[2]; - uint8_t m_store_out[2]; - uint8_t m_ext_in; - uint8_t m_brush_in; - uint8_t m_cbus_in; - - uint8_t m_k_in; - bool m_k_enable; - bool m_k_zero; - bool m_k_invert; - - uint8_t m_k_product; - uint8_t m_ext_product; - uint16_t m_final_product; - uint16_t m_final_result; - - uint8_t m_brush_value; - uint8_t m_final_brush_value; - uint8_t m_compare_b_value; - - uint8_t m_func; - - bool m_subtract_result; - - bool m_sel_luma[2]; - bool m_sel_eh; - bool m_b_bus_ah; - bool m_fcs; - - bool m_oe[4]; - bool m_use_store1_for_brush; - bool m_use_store2_for_brush; - bool m_use_ext_for_brush; - bool m_use_store1_or_ext_for_brush; - bool m_use_store2_for_store1; - bool m_enable_store_ext_multiplicand; - bool m_output_16bit; - bool m_pal_proc_in; - bool m_disable_k_data; - - uint16_t m_prom_addr; - uint8_t *m_prom_base; - uint8_t m_prom_out; - - uint16_t m_pal_in; - uint8_t *m_pal_base; - uint16_t m_pal_data_out; - bool m_pal_bpinv_out; - bool m_pal_sel_out; - - devcb_write8 m_store1; - devcb_write8 m_store2; - - required_device m_mult_fa; - required_device m_mult_ga; - required_device m_mult_gd; - required_device m_alu_he; - required_device m_alu_ge; - required_device m_alu_fe; - required_device m_alu_ee; - required_memory_region m_prom; - required_memory_region m_pal; -}; - -// device type definition -DECLARE_DEVICE_TYPE(DPB7000_BRUSHPROC, dpb7000_brushproc_card_device) - -#endif // MAME_VIDEO_DPB_BRUSHPROC_H diff --git a/src/mame/video/dpb_brushstore.cpp b/src/mame/video/dpb_brushstore.cpp deleted file mode 100644 index e1cfe610b4e..00000000000 --- a/src/mame/video/dpb_brushstore.cpp +++ /dev/null @@ -1,407 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - dpb_brushstore.cpp - DPB-7000/1 - Brush Store Card - - TODO: - - Code is currently a more or less direct translation of the board - schematic. It is highly inefficient, but accurate. An equally- - accurate, but faster, version can be made once better understanding - of the overall DPB-7000 system is had. - -***************************************************************************/ - -#include "emu.h" -#include "dpb_brushstore.h" - - -/*****************************************************************************/ - -DEFINE_DEVICE_TYPE(DPB7000_BRUSHSTORE, dpb7000_brush_store_card_device, "dpb_brushstore", "Quantel DPB-7000 Brush Store Card") - - -//------------------------------------------------- -// dpb7000_brush_store_card_device - constructor -//------------------------------------------------- - -dpb7000_brush_store_card_device::dpb7000_brush_store_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, DPB7000_BRUSHSTORE, tag, owner, clock) - , m_pal_base(nullptr) - , m_pal_addr(0) - , m_pal_data(0) - , m_addr(0) - , m_a0_chr(0) - , m_data(0) - , m_is_read(false) - , m_is_write(false) - , m_lumen(false) - , m_chren(false) - , m_ca0(false) - , m_ksel(false) - , m_fcs(false) - , m_func(0) - , m_b_bus_a(false) - , m_data_in(false) - , m_fast_wipe(false) - , m_store_write(false) - , m_oe_brush(false) - , m_brush_write(false) - , m_store_write_out(*this) - , m_data_out(*this) - , m_pal(*this, "pal") -{ -} - -ROM_START( dpb7000_brush_store ) - ROM_REGION(0x100, "pal", 0) - ROM_LOAD("pb-02a-17421-ada.bin", 0x000, 0x100, CRC(84bf7029) SHA1(9d58322994f6f7e99a9c6478577559c8171670ed)) -ROM_END - -const tiny_rom_entry *dpb7000_brush_store_card_device::device_rom_region() const -{ - return ROM_NAME( dpb7000_brush_store ); -} - -void dpb7000_brush_store_card_device::device_start() -{ - save_item(NAME(m_pal_addr)); - save_item(NAME(m_pal_data)); - - save_item(NAME(m_addr)); - save_item(NAME(m_a0_chr)); - save_item(NAME(m_data)); - - save_item(NAME(m_is_read)); - save_item(NAME(m_is_write)); - - save_item(NAME(m_ras)); - save_item(NAME(m_cas)); - - save_pointer(NAME(m_rav), STRIPE_COUNT); - save_pointer(NAME(m_cav), STRIPE_COUNT); - - save_item(NAME(m_lumen)); - save_item(NAME(m_chren)); - - save_item(NAME(m_ca0)); - - save_item(NAME(m_ksel)); - save_item(NAME(m_fcs)); - save_item(NAME(m_func)); - save_item(NAME(m_b_bus_a)); - - save_item(NAME(m_data_in)); - save_item(NAME(m_fast_wipe)); - save_item(NAME(m_store_write)); - save_item(NAME(m_oe)); - save_item(NAME(m_oe_brush)); - save_item(NAME(m_brush_write)); - - save_item(NAME(m_write_enable)); - save_item(NAME(m_brush_latches)); - save_item(NAME(m_input_latches)); - - m_store_write_out.resolve_safe(); - - m_pal_base = m_pal->base(); - - for (size_t i = 0; i < STRIPE_COUNT; i++) - { - m_data_out[i].resolve_safe(); - m_stripes[i] = make_unique_clear(0x10000); - save_pointer(NAME(m_stripes[i]), 0x10000, i); - } -} - -void dpb7000_brush_store_card_device::device_reset() -{ - m_pal_addr = 0; - m_pal_data = 0; - - m_addr = 0; - m_a0_chr = 0; - m_data = 0; - - m_is_read = false; - m_is_write = false; - - m_ras = false; - m_cas = false; - - memset(m_rav, 0, STRIPE_COUNT); - memset(m_cav, 0, STRIPE_COUNT); - - m_lumen = false; - m_chren = false; - - m_ca0 = false; - - m_ksel = false; - m_fcs = false; - m_func = 0; - m_b_bus_a = false; - - m_data_in = false; - m_fast_wipe = false; - m_store_write = false; - memset(m_oe, 0, STRIPE_COUNT); - m_oe_brush = false; - m_brush_write = false; - - memset(m_write_enable, 0, STRIPE_COUNT); - memset(m_brush_latches, 0, STRIPE_COUNT); - memset(m_input_latches, 0, STRIPE_COUNT); - - for (size_t i = 0; i < STRIPE_COUNT; i++) - { - memset(&m_stripes[i][0], 0, 0x10000); - } -} - -uint16_t dpb7000_brush_store_card_device::read() -{ - m_is_read = true; - m_is_write = false; - uint8_t msb = m_brush_latches[STRIPE_CHR]; - uint8_t lsb = m_oe[STRIPE_K] ? m_brush_latches[STRIPE_K] : (m_oe[STRIPE_LUM] ? m_brush_latches[STRIPE_LUM] : 0); - return (msb << 8) | lsb; -} - -void dpb7000_brush_store_card_device::write(uint16_t data) -{ - m_is_read = false; - m_is_write = true; - m_data = data; - update_input_latches(); - m_is_write = false; -} - - -void dpb7000_brush_store_card_device::addr_w(uint8_t data) -{ - m_addr = data; -} - -void dpb7000_brush_store_card_device::a0_chr_w(int state) -{ - m_a0_chr = (uint8_t)state; -} - -void dpb7000_brush_store_card_device::ras_w(int state) -{ - const bool old = m_ras; - m_ras = (bool)state; - if (old && !m_ras) - { - m_rav[STRIPE_CHR] = (m_addr & ~1) | m_a0_chr; - m_rav[STRIPE_K] = m_addr; - m_rav[STRIPE_LUM] = m_addr; - } -} - -void dpb7000_brush_store_card_device::cas_w(int state) -{ - const bool old = m_cas; - m_cas = (bool)state; - if (old && !m_cas) - { - m_cav[STRIPE_CHR] = (m_addr & ~1) | m_a0_chr; - m_cav[STRIPE_K] = m_addr; - m_cav[STRIPE_LUM] = m_addr; - - for (size_t i = 0; i < STRIPE_COUNT; i++) - { - const uint8_t addr = (m_rav[i] << 8) | m_cav[i]; - if (m_oe_brush && !m_write_enable[i]) - { - m_brush_latches[i] = m_stripes[i][addr]; - m_data_out[i](m_brush_latches[i]); - } - else if (m_write_enable[i]) - { - switch (i) - { - case STRIPE_CHR: - m_stripes[i][addr] = m_oe[i] ? m_brush_latches[i] : - ((m_fast_wipe && m_ca0) ? m_input_latches[STRIPE_K] : m_input_latches[i]); - break; - case STRIPE_LUM: - m_stripes[i][addr] = m_oe[i] ? m_brush_latches[i] : m_input_latches[i]; - break; - case STRIPE_K: - m_stripes[i][addr] = m_oe[STRIPE_LUM] ? m_brush_latches[STRIPE_LUM] : m_input_latches[STRIPE_LUM]; - break; - } - } - } - } -} - - -void dpb7000_brush_store_card_device::lumen_w(int state) -{ - const bool old = m_lumen; - m_lumen = (bool)state; - if (old != m_lumen) - { - update_write_enables(); - } -} - -void dpb7000_brush_store_card_device::chren_w(int state) -{ - const bool old = m_chren; - m_chren = (bool)state; - if (old != m_lumen) - { - update_write_enables(); - } -} - - -void dpb7000_brush_store_card_device::ca0_w(int state) -{ - m_ca0 = (bool)state; -} - -void dpb7000_brush_store_card_device::ksel_w(int state) -{ - const bool old = m_ksel; - m_ksel = (bool)state; - if (old != m_ksel) - { - update_pal_addr(); - update_write_enables(); - } -} - -void dpb7000_brush_store_card_device::fcs_w(int state) -{ - const bool old = m_fcs; - m_fcs = (bool)state; - if (old != m_fcs) - { - update_pal_addr(); - } -} - -void dpb7000_brush_store_card_device::func_w(uint8_t data) -{ - const uint8_t old = m_func; - m_func = data; - if (old != m_func) - { - update_pal_addr(); - } -} - -void dpb7000_brush_store_card_device::b_bus_a_w(int state) -{ - const bool old = m_b_bus_a; - m_b_bus_a = (bool)state; - if (old != m_b_bus_a) - { - update_pal_addr(); - } -} - -void dpb7000_brush_store_card_device::update_pal_addr() -{ - const uint8_t old = m_pal_addr; - m_pal_addr = m_func; - m_pal_addr |= m_ksel ? 0x10 : 0x00; - m_pal_addr |= m_b_bus_a ? 0x20 : 0x00; - m_pal_addr |= m_fcs ? 0x40 : 0x00; - if (old != m_pal_addr) - { - update_pal_output(); - } -} - -void dpb7000_brush_store_card_device::update_pal_output() -{ - const uint8_t old = m_pal_data; - m_pal_data = m_pal_base[m_pal_addr]; - if (old != m_pal_data) - { - data_in_w(BIT(m_pal_data, 0)); - fast_wipe_w(BIT(m_pal_data, 1)); - store_write_w(BIT(m_pal_data, 2)); - oe_k_w(BIT(m_pal_data, 3)); - oe_chr_w(BIT(m_pal_data, 4)); - oe_lum_w(BIT(m_pal_data, 5)); - oe_brush_w(BIT(m_pal_data, 6)); - brush_write_w(BIT(m_pal_data, 7)); - } -} - -void dpb7000_brush_store_card_device::data_in_w(bool state) -{ - m_data_in = state; -} - -void dpb7000_brush_store_card_device::fast_wipe_w(bool state) -{ - m_fast_wipe = state; -} - -void dpb7000_brush_store_card_device::store_write_w(bool state) -{ - const bool old = m_store_write; - m_store_write = state; - if (old != m_store_write) - { - m_store_write_out(!m_store_write); - } -} - -void dpb7000_brush_store_card_device::oe_k_w(bool state) -{ - m_oe[STRIPE_K] = state; -} - -void dpb7000_brush_store_card_device::oe_chr_w(bool state) -{ - m_oe[STRIPE_CHR] = state; -} - -void dpb7000_brush_store_card_device::oe_lum_w(bool state) -{ - m_oe[STRIPE_LUM] = state; -} - -void dpb7000_brush_store_card_device::oe_brush_w(bool state) -{ - m_oe_brush = state; -} - -void dpb7000_brush_store_card_device::brush_write_w(bool state) -{ - m_brush_write = state; - update_write_enables(); -} - -void dpb7000_brush_store_card_device::update_write_enables() -{ - m_write_enable[STRIPE_CHR] = m_chren && m_brush_write && !m_ksel; - m_write_enable[STRIPE_LUM] = m_lumen && m_brush_write && !m_ksel; - m_write_enable[STRIPE_K] = m_lumen && m_brush_write && m_ksel; -} - -void dpb7000_brush_store_card_device::update_input_latches() -{ - if (m_is_write && m_data_in) - { - m_input_latches[STRIPE_LUM] = (uint8_t)m_data; - if (!m_ksel) - { - m_input_latches[STRIPE_CHR] = (uint8_t)(m_data >> 8); - } - else - { - m_input_latches[STRIPE_K] = (uint8_t)(m_data >> 8); - } - } -} diff --git a/src/mame/video/dpb_brushstore.h b/src/mame/video/dpb_brushstore.h deleted file mode 100644 index 6daf4def3a7..00000000000 --- a/src/mame/video/dpb_brushstore.h +++ /dev/null @@ -1,128 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - dpb_brushstore.h - DPB-7000/1 - Brush Store Card - -***************************************************************************/ - -#ifndef MAME_VIDEO_DPB_BRUSHSTORE_H -#define MAME_VIDEO_DPB_BRUSHSTORE_H - -#pragma once - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> dpb7000_brush_store_card_device - -class dpb7000_brush_store_card_device : public device_t -{ -public: - // construction/destruction - dpb7000_brush_store_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); - - uint16_t read(); - void write(uint16_t data); - - void addr_w(uint8_t data); - void a0_chr_w(int state); - void ras_w(int state); - void cas_w(int state); - - void lumen_w(int state); - void chren_w(int state); - - void ca0_w(int state); - void ksel_w(int state); - - void fcs_w(int state); - void func_w(uint8_t data); - - void b_bus_a_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 update_pal_addr(); - void update_pal_output(); - - void data_in_w(bool state); - void fast_wipe_w(bool state); - void store_write_w(bool state); - void oe_k_w(bool state); - void oe_chr_w(bool state); - void oe_lum_w(bool state); - void oe_brush_w(bool state); - void brush_write_w(bool state); - - void update_write_enables(); - void update_input_latches(); - - enum : size_t - { - STRIPE_CHR, - STRIPE_K, - STRIPE_LUM, - STRIPE_COUNT - }; - - uint8_t *m_pal_base; - uint8_t m_pal_addr; - uint8_t m_pal_data; - - uint8_t m_addr; - uint8_t m_a0_chr; - uint16_t m_data; - - bool m_is_read; - bool m_is_write; - - bool m_ras; - bool m_cas; - - uint8_t m_rav[STRIPE_COUNT]; - uint8_t m_cav[STRIPE_COUNT]; - - bool m_lumen; - bool m_chren; - - bool m_ca0; - - bool m_ksel; - bool m_fcs; - uint8_t m_func; - bool m_b_bus_a; - - bool m_data_in; - bool m_fast_wipe; - bool m_store_write; - bool m_oe[STRIPE_COUNT]; - bool m_oe_brush; - bool m_brush_write; - - bool m_write_enable[STRIPE_COUNT]; - uint8_t m_brush_latches[STRIPE_COUNT]; - uint8_t m_stripe_outputs[STRIPE_COUNT]; - uint8_t m_input_latches[STRIPE_COUNT]; // AC (Y), AB (U), ABB (V) - - std::unique_ptr m_stripes[STRIPE_COUNT]; - - // Output Lines - devcb_write_line m_store_write_out; - devcb_write8::array m_data_out; - - // Devices - required_memory_region m_pal; -}; - -// device type definition -DECLARE_DEVICE_TYPE(DPB7000_BRUSHSTORE, dpb7000_brush_store_card_device) - -#endif // MAME_VIDEO_DPB_BRUSHSTORE_H diff --git a/src/mame/video/dpb_combiner.h b/src/mame/video/dpb_combiner.h deleted file mode 100644 index 256a356c6a4..00000000000 --- a/src/mame/video/dpb_combiner.h +++ /dev/null @@ -1,116 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - dpb_combiner.h - DPB-7000/1 - Combiner Card - -***************************************************************************/ - -#ifndef MAME_VIDEO_DPB_COMBINER_H -#define MAME_VIDEO_DPB_COMBINER_H - -#pragma once - -#include "machine/tmc208k.h" -//#include "screen.h" - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> dpb7000_combiner_card_device - -class dpb7000_combiner_card_device : public device_t -{ -public: - // construction/destruction - dpb7000_combiner_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - void reg_w(uint16_t data); - void lum1_w(uint8_t data); - void lum2_w(uint8_t data); - void blank1(int state); - void blank2(int state); - void chr1_w(uint8_t data); - void chr2_w(uint8_t data); - void chr_flag_w(int state); - void ext1_w(uint8_t data); - void ext2_w(uint8_t data); - void palette_l_w(int state); - void cursor_enb_w(int state); - void cursor_col_w(int state); - - auto lum() { return m_lum.bind(); } - auto chr() { return m_chr.bind(); } - -protected: - // device-level overrides - virtual void device_start() override; - virtual void device_reset() override; - virtual void device_add_mconfig(machine_config &config) override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - - static constexpr device_timer_id FSCK_TIMER = 0; - - void fsck_tick(); - - //uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void update_matte_selects(); - - uint8_t m_lum_in[2]; - uint8_t m_latched_lum[2]; - uint8_t m_selected_lum[2]; - uint8_t m_chr_in[2]; - uint8_t m_latched_chr[2]; - uint8_t m_selected_chr[2]; - uint8_t m_ext_in[2]; - uint8_t m_selected_ext[2]; - uint8_t m_latched_lum_sum; - uint8_t m_latched_chr_sum; - uint8_t m_lum_out; - uint8_t m_chr_out; - - bool m_blank[2]; - bool m_chr_i_in; - bool m_chr_i; - bool m_palette_l; - bool m_cursor_enb; - bool m_cursor_col; - bool m_fsck; - - uint8_t m_cursor_y; - uint8_t m_cursor_u; - uint8_t m_cursor_v; - uint8_t m_invert_mask; - bool m_select_matte[2]; - uint8_t m_matte_ext[2]; - uint8_t m_matte_y[2]; - uint8_t m_matte_u[2]; - uint8_t m_matte_v[2]; - - bool m_blank_or_suppress[2]; // FH - bool m_output_matte_y[2]; // EB - bool m_output_matte_u[2]; // EG - bool m_output_matte_v[2]; // EG - bool m_output_matte_ext[2]; // FA - - devcb_write8 m_lum; - devcb_write8 m_chr; - - emu_timer *m_fsck_timer; - - //required_device m_screen; - required_device m_mult_ge; - required_device m_mult_gd; - required_device m_mult_gc; - required_device m_mult_gb; - required_device m_mult_ga; -}; - -// device type definition -DECLARE_DEVICE_TYPE(DPB7000_COMBINER, dpb7000_combiner_card_device) - -#endif // MAME_VIDEO_DPB_COMBINER_H diff --git a/src/mame/video/dpb_framestore.cpp b/src/mame/video/dpb_framestore.cpp deleted file mode 100644 index 7d9c7d3b31f..00000000000 --- a/src/mame/video/dpb_framestore.cpp +++ /dev/null @@ -1,539 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - dpb_framestore.cpp - DPB-7000/1 - Framestore Card - - TODO: - - Code is currently a more or less direct translation of the board - schematic. It is highly inefficient, but accurate. An equally- - accurate, but faster, version can be made once better understanding - of the overall DPB-7000 system is had. - -***************************************************************************/ - -#include "emu.h" -#include "dpb_framestore.h" - - -/*****************************************************************************/ - -DEFINE_DEVICE_TYPE(DPB7000_FRAMESTORE, dpb7000_framestore_card_device, "dpb_framestore", "Quantel DPB-7000 Framestore Card") - - -//------------------------------------------------- -// dpb7000_framestore_card_device - constructor -//------------------------------------------------- - -dpb7000_framestore_card_device::dpb7000_framestore_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, DPB7000_FRAMESTORE, tag, owner, clock) - , m_vopen(false) - , m_copen(false) - , m_csel(false) - , m_rck(false) - , m_cck(false) - , m_opstr(false) - , m_opwa(false) - , m_opwb(false) - , m_opw(0) - , m_opra(false) - , m_oprb(false) - , m_opr(0) - , m_ras_in(false) - , m_cas(false) - , m_write(false) - , m_ipen(false) - , m_whp(false) - , m_lumen(false) - , m_bdsel(false) - , m_ipsel(0) - , m_cav(0) - , m_front_pal_base(nullptr) - , m_front_pal_addr(0) - , m_front_pal_out(0) - , m_back_pal_base(nullptr) - , m_back_pal_addr(0) - , m_back_pal_out(0) - , m_a(0) - , m_ra(0) - , m_wa(0) - , m_cdata_front(0) - , m_cdata_back(0) - , m_cdata(0) - , m_vdata_front(0) - , m_vdata_back(0) - , m_vdata(0) - , m_cdata_out(*this) - , m_vdata_out(*this) - , m_cbusy_out(*this) - , m_back_pal(*this, "back_pal") - , m_front_pal(*this, "front_pal") -{ -} - -ROM_START( dpb7000_framestore ) - ROM_REGION(0x400, "back_pal", 0) - ROM_LOAD("pb-02f-01748a-aba.bin", 0x000, 0x400, CRC(24b31494) SHA1(f9185a00e5470ec95d234a76c15acbf33cfb285d)) - - ROM_REGION(0x400, "front_pal", 0) - ROM_LOAD("pb-02f-01748a-bba.bin", 0x000, 0x400, CRC(8f06b632) SHA1(233b841c3957a6df229f3a693f9288cb8feec58c)) -ROM_END - -const tiny_rom_entry *dpb7000_framestore_card_device::device_rom_region() const -{ - return ROM_NAME( dpb7000_framestore ); -} - -void dpb7000_framestore_card_device::device_start() -{ - save_item(NAME(m_vopen)); - save_item(NAME(m_copen)); - save_item(NAME(m_csel)); - save_item(NAME(m_rck)); - save_item(NAME(m_cck)); - - save_item(NAME(m_openx)); - save_item(NAME(m_opstr)); - save_item(NAME(m_opwa)); - save_item(NAME(m_opwb)); - save_item(NAME(m_opw)); - save_item(NAME(m_opra)); - save_item(NAME(m_oprb)); - save_item(NAME(m_opr)); - - save_item(NAME(m_ras_in)); - save_pointer(NAME(m_ras), 10); - save_item(NAME(m_cas)); - save_item(NAME(m_write)); - save_item(NAME(m_ipen)); - save_item(NAME(m_whp)); - save_item(NAME(m_lumen)); - save_item(NAME(m_bdsel)); - save_item(NAME(m_ipsel)); - - save_pointer(NAME(m_ipenx), 10); - save_pointer(NAME(m_rav), 10); - save_item(NAME(m_cav)); - - save_item(NAME(m_front_pal_addr)); - save_item(NAME(m_front_pal_out)); - save_item(NAME(m_back_pal_addr)); - save_item(NAME(m_back_pal_out)); - - save_item(NAME(m_a)); - for (int i = 0; i < 10; i++) - { - save_item(NAME(m_d_in[i][0]), i); - save_item(NAME(m_d_in[i][1]), i); - save_item(NAME(m_d_out[i][0]), i); - save_item(NAME(m_d_out[i][1]), i); - save_item(NAME(m_d_out[i][2]), i); - save_item(NAME(m_d_out[i][3]), i); - } - save_item(NAME(m_ra)); - save_item(NAME(m_wa)); - save_item(NAME(m_cdata_front)); - save_item(NAME(m_cdata_back)); - save_item(NAME(m_cdata)); - save_item(NAME(m_vdata_front)); - save_item(NAME(m_vdata_back)); - save_item(NAME(m_vdata)); - - for (int i = 0; i < 10; i++) - { - m_stripes[i] = make_unique_clear(0x10000); - save_pointer(NAME(m_stripes[i]), 0x10000, i); - } - - m_cdata_out.resolve_safe(); - m_vdata_out.resolve_safe(); - m_cbusy_out.resolve_safe(); - - m_front_pal_base = m_front_pal->base(); - m_back_pal_base = m_back_pal->base(); -} - -void dpb7000_framestore_card_device::device_reset() -{ - m_vopen = false; - m_copen = false; - m_csel = false; - m_rck = false; - m_cck = false; - - memset(m_openx, 0, 5); - m_opstr = false; - m_opwa = false; - m_opwb = false; - m_opw = 0; - m_opra = false; - m_oprb = false; - m_opr = 0; - - m_ras_in = false; - memset(m_ras, 0, 10); - m_cas = false; - m_write = false; - m_ipen = false; - m_whp = false; - m_lumen = false; - m_bdsel = false; - m_ipsel = 0; - - memset(m_ipenx, 0, 10); - memset(m_rav, 0, 10); - m_cav = 0; - - m_front_pal_addr = 0; - m_front_pal_out = 0; - m_back_pal_addr = 0; - m_back_pal_out = 0; - - m_a = 0; - m_ra = 0; - m_wa = 0; - m_cdata_front = 0; - m_cdata_back = 0; - m_cdata = 0; - m_vdata_front = 0; - m_vdata_back = 0; - m_vdata = 0; - - for (int i = 0; i < 10; i++) - { - memset(&m_stripes[i][0], 0, 0x10000); - } -} - -void dpb7000_framestore_card_device::update_vdata_latches(const uint8_t stripe) -{ - for (int i = 0; i < 5; i++) - { - if (m_openx[i]) - { - m_vdata_front = m_d_out[ i << 1 ][m_opr]; - m_vdata_back = m_d_out[(i << 1) | 1][m_opr]; - } - } -} - -void dpb7000_framestore_card_device::update_cdata_latches(const uint8_t stripe) -{ - for (int i = 0; i < 5; i++) - { - if (m_openx[i]) - { - m_cdata_front = m_d_out[ i << 1 ][m_opr]; - m_cdata_back = m_d_out[(i << 1) | 1][m_opr]; - } - } -} - -void dpb7000_framestore_card_device::update_cdata_out() -{ - if (m_copen) - { - m_cdata_out(m_csel ? m_cdata_back : m_cdata_front); - } -} - -void dpb7000_framestore_card_device::update_vdata_out() -{ - if (m_vopen) - { - m_vdata_out(BIT(m_ra, 0) ? m_vdata_back : m_vdata_front); - } -} - -void dpb7000_framestore_card_device::update_pals() -{ - const uint8_t old_front_addr = m_front_pal_addr; - const uint8_t old_back_addr = m_back_pal_addr; - const uint8_t old_front_ras = m_front_pal_out & 0x1f; - const uint8_t old_back_ras = m_back_pal_out & 0x1f; - - do - { - m_front_pal_out = m_front_pal_base[m_front_pal_addr]; - m_back_pal_out = m_back_pal_base[m_back_pal_addr]; - - m_front_pal_addr &= 0x0ff; - m_front_pal_addr |= BIT(m_back_pal_out, 6) ? 0x100 : 0x000; - m_front_pal_addr |= BIT(m_back_pal_out, 5) ? 0x200 : 0x000; - m_back_pal_addr &= 0x0ff; - m_back_pal_addr |= BIT(m_front_pal_out, 6) ? 0x100 : 0x000; - m_back_pal_addr |= BIT(m_front_pal_out, 5) ? 0x200 : 0x000; - } while (old_front_addr != m_front_pal_addr || old_back_addr != m_back_pal_addr); - - if (old_front_ras != (m_front_pal_out & 0x1f) || old_back_ras != (m_back_pal_out & 0x1f)) - { - m_ras[0] = BIT(m_front_pal_out, 4); - m_ras[2] = BIT(m_front_pal_out, 3); - m_ras[4] = BIT(m_front_pal_out, 2); - m_ras[6] = BIT(m_front_pal_out, 1); - m_ras[8] = BIT(m_front_pal_out, 0); - m_ras[1] = BIT(m_back_pal_out, 4); - m_ras[3] = BIT(m_back_pal_out, 3); - m_ras[5] = BIT(m_back_pal_out, 2); - m_ras[7] = BIT(m_back_pal_out, 1); - m_ras[9] = BIT(m_back_pal_out, 0); - - for (int i = 0; i < 10; i++) - { - if (!m_ras[i]) - { - m_rav[i] = m_a; - } - } - } -} - -void dpb7000_framestore_card_device::vopen_w(int state) -{ - const bool old = m_vopen; - m_vopen = (bool)state; - if (!old && m_vopen) - { - update_vdata_out(); - } -} - -void dpb7000_framestore_card_device::copen_w(int state) -{ - const bool old = m_copen; - m_copen = (bool)state; - if (!old && m_copen) - { - update_cdata_out(); - } -} - -void dpb7000_framestore_card_device::csel_w(int state) -{ - const bool old = m_csel; - m_csel = (bool)state; - if (old != m_csel) - { - update_cdata_out(); - } -} - -void dpb7000_framestore_card_device::rck_w(int state) -{ - const bool old = m_rck; - m_rck = (bool)state; - if (old != m_rck) - { - update_vdata_latches(m_ra & 0xe); - } -} - -void dpb7000_framestore_card_device::cck_w(int state) -{ - const bool old = m_cck; - m_cck = (bool)state; - if (old != m_cck) - { - update_cdata_latches(m_ra & 0xe); - } -} - - -void dpb7000_framestore_card_device::opstr_w(int state) -{ - m_opstr = (bool)state; -} - -void dpb7000_framestore_card_device::opwa_w(int state) -{ - m_opw &= 2; - m_opw |= state; -} - -void dpb7000_framestore_card_device::opwb_w(int state) -{ - m_opw &= 1; - m_opw |= state << 1; -} - -void dpb7000_framestore_card_device::opra_w(int state) -{ - m_opr &= 2; - m_opr |= state; -} - -void dpb7000_framestore_card_device::oprb_w(int state) -{ - m_opr &= 1; - m_opr |= state << 1; -} - - -void dpb7000_framestore_card_device::ras_w(int state) -{ - const bool old = m_ras_in; - m_ras_in = (bool)state; - if (old != m_ras_in) - { - m_front_pal_addr &= ~0x001; - m_back_pal_addr &= ~0x001; - const uint16_t value = m_ras_in ? 0x001 : 0x000; - m_front_pal_addr |= value; - m_back_pal_addr |= value; - - update_pals(); - } -} - -void dpb7000_framestore_card_device::cas_w(int state) -{ - const bool old = m_cas; - m_cas = (bool)state; - if (old && !m_cas) - { - m_cav = m_a; - - for (int i = 0; i < 10; i++) - { - if (m_ipenx[i]) - { - m_stripes[i][(m_cav << 8) | m_rav[i]] = m_d_in[i][m_ipsel]; - } - if (!m_opstr) - { - m_d_out[i][m_opw] = m_stripes[i][(m_cav << 8) | m_rav[i]]; - } - } - } -} - -void dpb7000_framestore_card_device::write_w(int state) -{ - const bool old = m_write; - m_write = (bool)state; - if (old != m_write) - { - m_front_pal_addr &= ~0x002; - m_back_pal_addr &= ~0x002; - const uint16_t value = m_write ? 0x000 : 0x002; - m_front_pal_addr |= value; - m_back_pal_addr |= value; - - update_pals(); - } -} - -void dpb7000_framestore_card_device::ipen_w(int state) -{ - const bool old = m_ipen; - m_ipen = (bool)state; - if (old != m_ipen) - { - m_front_pal_addr &= ~0x008; - m_back_pal_addr &= ~0x008; - const uint16_t value = m_ipen ? 0x008 : 0x000; - m_front_pal_addr |= value; - m_back_pal_addr |= value; - - update_pals(); - } -} - -void dpb7000_framestore_card_device::whp_w(int state) -{ - const bool old = m_whp; - m_whp = (bool)state; - if (old != m_whp) - { - m_front_pal_addr &= ~0x004; - m_back_pal_addr &= ~0x004; - const uint16_t value = m_whp ? 0x004 : 0x000; - m_front_pal_addr |= value; - m_back_pal_addr |= value; - - update_pals(); - } -} - -void dpb7000_framestore_card_device::lumen_w(int state) -{ - const bool old = m_lumen; - m_lumen = (bool)state; - if (old != m_lumen) - { - m_front_pal_addr &= ~0x080; - m_back_pal_addr &= ~0x080; - const uint16_t value = m_lumen ? 0x080 : 0x000; - m_front_pal_addr |= value; - m_back_pal_addr |= value; - - update_pals(); - } -} - -void dpb7000_framestore_card_device::bdsel_w(int state) -{ - const bool old = m_bdsel; - m_bdsel = (bool)state; - if (old != m_bdsel) - { - m_front_pal_addr &= ~0x040; - m_back_pal_addr &= ~0x040; - const uint16_t value = m_bdsel ? 0x040 : 0x000; - m_front_pal_addr |= value; - m_back_pal_addr |= value; - - update_pals(); - } -} - -void dpb7000_framestore_card_device::ipsel_w(int state) -{ - m_ipsel = state; -} - - -void dpb7000_framestore_card_device::a_w(uint8_t data) -{ - m_a = data; -} - -void dpb7000_framestore_card_device::d_w(uint8_t data) -{ - for (int i = 0; i < 10; i++) - { - if (m_ipenx[i]) - { - m_d_in[i][1 - m_ipsel] = data; - } - } -} - -void dpb7000_framestore_card_device::ra_w(uint8_t data) -{ - m_openx[m_ra >> 1] = false; - m_ra = data & 0xf; - m_openx[m_ra >> 1] = true; -} - -void dpb7000_framestore_card_device::wa_w(uint8_t data) -{ - const uint8_t old = m_wa; - m_wa = data & 0xf; - if (old != m_wa) - { - m_ipenx[old] = false; - m_ipenx[m_wa] = true; - - m_back_pal_addr &= ~0x030; - m_back_pal_addr |= BIT(m_wa, 3) ? 0x010 : 0x000; - m_back_pal_addr |= BIT(m_wa, 2) ? 0x020 : 0x000; - m_front_pal_addr &= ~0x030; - m_front_pal_addr |= BIT(m_wa, 1) ? 0x010 : 0x000; - m_front_pal_addr |= BIT(m_wa, 0) ? 0x020 : 0x000; - - update_pals(); - } -} - diff --git a/src/mame/video/dpb_framestore.h b/src/mame/video/dpb_framestore.h deleted file mode 100644 index d4f851178c9..00000000000 --- a/src/mame/video/dpb_framestore.h +++ /dev/null @@ -1,131 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - dpb_framestore.h - DPB-7000/1 - Framestore Card - -***************************************************************************/ - -#ifndef MAME_VIDEO_DPB_FRAMESTORE_H -#define MAME_VIDEO_DPB_FRAMESTORE_H - -#pragma once - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> dpb7000_framestore_card_device - -class dpb7000_framestore_card_device : public device_t -{ -public: - // construction/destruction - dpb7000_framestore_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); - - void vopen_w(int state); - void copen_w(int state); - void csel_w(int state); - void rck_w(int state); - void cck_w(int state); - - void opstr_w(int state); - void opwa_w(int state); - void opwb_w(int state); - void opra_w(int state); - void oprb_w(int state); - - void ras_w(int state); - void cas_w(int state); - void write_w(int state); - void ipen_w(int state); - void whp_w(int state); - void lumen_w(int state); - void bdsel_w(int state); - void ipsel_w(int state); - - void a_w(uint8_t data); - void d_w(uint8_t data); - void ra_w(uint8_t data); - void wa_w(uint8_t data); - -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 update_cdata_latches(const uint8_t stripe); - void update_cdata_out(); - void update_vdata_latches(const uint8_t stripe); - void update_vdata_out(); - - void update_pals(); - - bool m_vopen; - bool m_copen; - bool m_csel; - bool m_rck; - bool m_cck; - - bool m_openx[5]; - bool m_opstr; - bool m_opwa; - bool m_opwb; - uint8_t m_opw; - bool m_opra; - bool m_oprb; - uint8_t m_opr; - - bool m_ras_in; - bool m_ras[10]; - bool m_cas; - bool m_write; - bool m_ipen; - bool m_whp; - bool m_lumen; - bool m_bdsel; - uint8_t m_ipsel; - - bool m_ipenx[10]; - uint8_t m_rav[10]; - uint8_t m_cav; - - uint8_t *m_front_pal_base; - uint16_t m_front_pal_addr; - uint8_t m_front_pal_out; - uint8_t *m_back_pal_base; - uint16_t m_back_pal_addr; - uint8_t m_back_pal_out; - - uint8_t m_a; - uint8_t m_d_in[10][2]; - uint8_t m_d_out[10][4]; - uint8_t m_ra; - uint8_t m_wa; - uint8_t m_stripe; - uint8_t m_cdata_front; - uint8_t m_cdata_back; - uint8_t m_cdata; - uint8_t m_vdata_front; - uint8_t m_vdata_back; - uint8_t m_vdata; - - std::unique_ptr m_stripes[10]; - - // Output Lines - devcb_write8 m_cdata_out; - devcb_write8 m_vdata_out; - devcb_write_line m_cbusy_out; - - // Devices - required_memory_region m_back_pal; - required_memory_region m_front_pal; -}; - -// device type definition -DECLARE_DEVICE_TYPE(DPB7000_FRAMESTORE, dpb7000_framestore_card_device) - -#endif // MAME_VIDEO_DPB_FRAMESTORE_H diff --git a/src/mame/video/dpb_storeaddr.cpp b/src/mame/video/dpb_storeaddr.cpp deleted file mode 100644 index f4f4dc52234..00000000000 --- a/src/mame/video/dpb_storeaddr.cpp +++ /dev/null @@ -1,1299 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - dpb_storeaddr.cpp - DPB-7000/1 - Store Address Card - - TODO: - - Code is currently a more or less direct translation of the board - schematic. It is highly inefficient, but accurate. An equally- - accurate, but faster, version can be made once better understanding - of the overall DPB-7000 system is had. - -***************************************************************************/ - -#include "emu.h" -#include "dpb_storeaddr.h" - -#define VERBOSE (1) -#include "logmacro.h" - -/*****************************************************************************/ - -DEFINE_DEVICE_TYPE(DPB7000_STOREADDR, dpb7000_storeaddr_card_device, "dpb_storeaddr", "Quantel DPB-7000 Store Address Card") - - -//------------------------------------------------- -// dpb7000_storeaddr_card_device - constructor -//------------------------------------------------- - -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_blanking_base(nullptr) - , m_bb_out(0) - , m_bc_out(0) - , m_bd_out(0) - , m_protx(false) - , m_proty(false) - , m_delay_timer(nullptr) - , m_delay_step(0) - , m_df_out(0) - , m_ee_out(0) - , m_addr(0) - , m_rhscr(0) - , m_rvscr(0) - , m_rzoom(0) - , m_fld_sel(0) - , m_hzoom_count(0) - , m_vzoom_count(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_rhscr_stripe_addr(0) - , m_rhscr_stripe_num(0) - , m_rvscr_counter(0) - , m_rvscr_with_v0(0) - , m_s_type(0) - , m_cen(false) - , m_cxd(false) - , m_cxen(false) - , m_cxld(false) - , m_cxck(false) - , m_cxod(false) - , m_cxoen(false) - , m_cyd(false) - , m_cyen(false) - , m_cyld(false) - , m_cyck(false) - , m_cyod(false) - , m_cyoen(false) - , m_clrc(false) - , m_selvideo(false) - , m_creq(false) - , m_cread(false) - , m_prot_a(false) - , m_prot_b(false) - , m_preread(false) - , m_rreq_pending(false) - , m_rreq_active(false) - , m_creq_pending(false) - , m_creq_active(false) - , m_store_busy(false) - , m_rvl(false) - , m_rhr(false) - , m_plt(false) - , m_zb(false) - , m_rppck(false) - , m_rb(false) - , m_pflag(false) - , m_mxr(false) - , m_ras(false) - , m_cas(false) - , m_laac(false) - , m_t6(false) - , m_clrw(false) - , m_opstr(false) - , m_cck_clear(false) - , m_creq_sel(false) - , m_write_active(false) - , m_window_enable(false) - , m_b26(false) - , m_blank_d(false) - , m_blank_a(false) - , m_blank_b(false) - , m_blank_q(0) - , m_crc(false) - , m_ipen(false) - , m_ipsel(false) - , m_rck(false) - , m_ra(0) - , m_opra(false) - , m_opwa(false) - , m_opwb(false) - , m_cck(false) - , m_csel(false) - , m_ipsel_out(*this) - , m_rck_out(*this) - , m_ra_out(*this) - , m_opra_out(*this) - , m_oprb_out(*this) - , m_blk_out(*this) - , m_addr_out(*this) - , m_r_busy_out(*this) - , m_ras_out(*this) - , m_cas_out(*this) - , m_opwb_out(*this) - , m_opstr_out(*this) - , m_w_out(*this) - , m_opwa_out(*this) - , m_csel_out(*this) - , m_cck_out(*this) - , m_cbusy_out(*this) - , m_x_prom(*this, "x_prom") - , m_protx_prom(*this, "protx_prom") - , m_proty_prom(*this, "proty_prom") - , m_blanking_pal(*this, "blanking_pal") -{ -} - -ROM_START( dpb7000_storeaddr ) - ROM_REGION(0xc00, "x_prom", 0) - ROM_LOAD("pb-032-17425b-bbb.bin", 0x000, 0x400, CRC(2051a6e4) SHA1(3bd8a9015e77b034a94fe072a9753649b76f9f69)) - ROM_LOAD("pb-032-17425b-bcb.bin", 0x400, 0x400, CRC(01aaa6f7) SHA1(e31bff0c68f74996368443bfb58a3524a838f270)) - ROM_LOAD("pb-032-17425b-bdb.bin", 0x800, 0x400, CRC(20e2fb9e) SHA1(c4c77ec02ab6d3a1a28edf5543e57235a64a9d8d)) - - ROM_REGION(0xc00, "protx_prom", 0) - ROM_LOAD("pb-032-17425b-deb.bin", 0x000, 0x400, CRC(faeb44dd) SHA1(3eaf981245824332d216e97095bdc02ff04e4800)) - - ROM_REGION(0xc00, "proty_prom", 0) - ROM_LOAD("pb-032-17425b-edb.bin", 0x000, 0x400, CRC(183bfdc0) SHA1(175b052948e4e4a9421d8913479e7531b7e5f03c)) - - ROM_REGION(0x10000, "blanking_pal", 0) - ROM_LOAD("pb-032-17425b-igb.bin", 0x00000, 0x10000, CRC(cdd80590) SHA1(fecb64695b61e8ec740af1480240088d5447688d)) -ROM_END - -const tiny_rom_entry *dpb7000_storeaddr_card_device::device_rom_region() const -{ - return ROM_NAME( dpb7000_storeaddr ); -} - -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_delay_step)); - - save_item(NAME(m_df_in)); - save_item(NAME(m_df_out)); - save_item(NAME(m_ee_in)); - save_item(NAME(m_ee_out)); - - save_item(NAME(m_dg_in)); - save_item(NAME(m_eg_in)); - save_item(NAME(m_fg_in)); - save_item(NAME(m_gg_in)); - - 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_hzoom_count)); - save_item(NAME(m_vzoom_count)); - - 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_rhscr_stripe_addr)); - save_item(NAME(m_rhscr_stripe_num)); - - save_item(NAME(m_rvscr_counter)); - save_item(NAME(m_rvscr_with_v0)); - - save_item(NAME(m_s_type)); - - save_item(NAME(m_cen)); - - save_item(NAME(m_cxd)); - save_item(NAME(m_cxen)); - save_item(NAME(m_cxld)); - save_item(NAME(m_cxck)); - save_item(NAME(m_cxod)); - save_item(NAME(m_cxoen)); - - save_item(NAME(m_cyd)); - save_item(NAME(m_cyen)); - save_item(NAME(m_cyld)); - save_item(NAME(m_cyck)); - save_item(NAME(m_cyod)); - save_item(NAME(m_cyoen)); - - save_item(NAME(m_clrc)); - save_item(NAME(m_selvideo)); - save_item(NAME(m_creq)); - save_item(NAME(m_cread)); - - save_item(NAME(m_prot_a)); - save_item(NAME(m_prot_b)); - - save_item(NAME(m_preread)); - save_item(NAME(m_rreq_pending)); - save_item(NAME(m_rreq_active)); - save_item(NAME(m_creq_pending)); - save_item(NAME(m_creq_active)); - save_item(NAME(m_store_busy)); - - save_item(NAME(m_rvl)); - save_item(NAME(m_rhr)); - save_item(NAME(m_plt)); - save_item(NAME(m_zb)); - save_item(NAME(m_rppck)); - save_item(NAME(m_rb)); - save_item(NAME(m_pflag)); - - save_item(NAME(m_mxr)); - save_item(NAME(m_ras)); - save_item(NAME(m_cas)); - save_item(NAME(m_laac)); - save_item(NAME(m_t6)); - save_item(NAME(m_clrw)); - save_item(NAME(m_opstr)); - save_item(NAME(m_cck_clear)); - - save_item(NAME(m_creq_sel)); - - save_item(NAME(m_write_active)); - - save_item(NAME(m_window_enable)); - save_item(NAME(m_b26)); - - save_item(NAME(m_blank_d)); - save_item(NAME(m_blank_a)); - save_item(NAME(m_blank_b)); - save_item(NAME(m_blank_q)); - - save_item(NAME(m_crc)); - save_item(NAME(m_ipen)); - - save_item(NAME(m_ipsel)); - save_item(NAME(m_rck)); - save_item(NAME(m_ra)); - save_item(NAME(m_opra)); - save_item(NAME(m_opwa)); - save_item(NAME(m_opwb)); - save_item(NAME(m_cck)); - save_item(NAME(m_csel)); - - m_ipsel_out.resolve_safe(); - m_rck_out.resolve_safe(); - m_ra_out.resolve_safe(); - m_opra_out.resolve_safe(); - m_oprb_out.resolve_safe(); - m_blk_out.resolve_safe(); - m_addr_out.resolve_safe(); - m_r_busy_out.resolve_safe(); - m_ras_out.resolve_safe(); - m_cas_out.resolve_safe(); - m_opwb_out.resolve_safe(); - m_opstr_out.resolve_safe(); - m_w_out.resolve_safe(); - m_opwa_out.resolve_safe(); - m_csel_out.resolve_safe(); - m_cck_out.resolve_safe(); - m_cbusy_out.resolve_safe(); - - m_delay_timer = timer_alloc(DELAY_TIMER); - m_delay_timer->adjust(attotime::never); -} - -void dpb7000_storeaddr_card_device::device_reset() -{ - m_bb_out = 0; - m_bc_out = 0; - m_bd_out = 0; - m_protx = false; - m_proty = false; - - m_delay_timer->adjust(attotime::never); - m_delay_step = 0; - - memset(m_df_in, 0, 2); - m_df_in[1] = 0xc; - m_df_out = 0; - - memset(m_ee_in, 0, 2); - m_ee_in[1] = 0xc; - m_ee_out = 0; - - memset(m_dg_in, 0, 2); - memset(m_eg_in, 0, 2); - memset(m_fg_in, 0, 2); - memset(m_gg_in, 0, 2); - m_addr = 0; - - m_rhscr = 0; - m_rvscr = 0; - m_rzoom = 0; - m_fld_sel = 0; - - m_hzoom_count = 0; - m_vzoom_count = 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_rhscr_stripe_addr = 0; - m_rhscr_stripe_num = 0; - - m_rvscr_counter = 0; - m_rvscr_with_v0 = 0; - - m_s_type = 0; - - m_cen = false; - - m_cxd = false; - m_cxen = false; - m_cxld = false; - m_cxck = false; - m_cxod = false; - m_cxoen = false; - - m_cyd = false; - m_cyen = false; - m_cyld = false; - m_cyck = false; - m_cyod = false; - m_cyoen = false; - - m_clrc = false; - m_selvideo = false; - m_creq = false; - m_cread = false; - - m_prot_a = false; - m_prot_b = false; - - m_preread = false; - m_rreq_pending = false; - m_rreq_active = false; - m_creq_pending = false; - m_creq_active = false; - m_store_busy = false; - - m_rvl = false; - m_rhr = false; - m_plt = false; - m_zb = false; - m_rppck = false; - m_rb = false; - m_pflag = false; - - m_mxr = false; - m_ras = false; - m_cas = false; - m_store_busy = false; - m_laac = false; - m_t6 = false; - m_clrw = false; - m_opstr = false; - m_cck_clear = false; - - m_creq_sel = false; - - m_write_active = false; - - m_window_enable = false; - m_b26 = false; - - m_blank_d = false; - m_blank_a = false; - m_blank_b = false; - m_blank_q = 0; - - m_crc = false; - m_ipen = false; - - m_ipsel = false; - m_rck = false; - m_ra = 0; - m_opra = false; - m_opwa = false; - m_opwb = false; - m_clrw = false; - m_cck = false; - m_csel = 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_blanking_base = m_blanking_pal->base(); -} - -void dpb7000_storeaddr_card_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - if (id == DELAY_TIMER) - { - tick_delay_step(); - } -} - -void dpb7000_storeaddr_card_device::tick_delay_step() -{ - m_delay_step++; - switch (m_delay_step & 15) - { - case 1: - ras_w(true); - break; - case 3: - mxr_w(false); - break; - case 5: - cas_w(true); - break; - case 6: - t6_w(true); - break; - case 10: - t6_w(false); - laac_w(true); - break; - case 11: - ras_w(false); - break; - case 12: - cas_w(false); - laac_w(false); - break; - case 13: - clrw_w(true); - break; - case 14: - clrw_w(false); - break; - case 15: - default: - // Do nothing - break; - } -} - -void dpb7000_storeaddr_card_device::mxr_w(bool state) -{ - m_mxr = state; - update_addr_select_outputs(); -} - -void dpb7000_storeaddr_card_device::opwb_w(bool state) -{ - const bool old = m_opwb; - m_opwb = state; - if (old != m_opwb) - { - m_opwb_out(!m_opwb); - update_r_busy(m_ras); - - m_opwa_out(!(m_opwb || BIT(m_rhscr_stripe_num, 0))); - } -} - -void dpb7000_storeaddr_card_device::update_opwa() -{ - const bool old = m_opwa; - m_opwa = !(m_opwb || BIT(m_rhscr_stripe_num, 0)); - if (old != m_opwa) - { - m_opwa_out(m_opwa); - update_req_clears(); - } -} - -void dpb7000_storeaddr_card_device::update_req_clears() -{ - if (m_laac) - { - if (m_opwa) - { - m_creq_pending = false; - m_creq_active = false; - } - else - { - m_rreq_pending = false; - m_rreq_active = false; - } - } -} - -void dpb7000_storeaddr_card_device::update_opstr() -{ - const bool old = m_opstr; - m_opstr = !(m_t6 && !m_write_active); - if (old != m_opstr) - { - m_opstr_out(m_opstr); - } -} - -void dpb7000_storeaddr_card_device::update_cck() -{ - const bool old_clear = m_cck_clear; - m_cck_clear = !(m_opwb && m_t6); - - if (old_clear != m_cck_clear) - { - const bool old_csel = m_csel; - m_csel = BIT(m_cx_stripe_addr, 0); - if (old_csel != m_csel) - { - m_csel_out(m_csel); - } - } - - const bool old = m_cck; - m_cck = !m_cck_clear; - if (old != m_cck) - { - m_cck_out(m_cck); - } -} - -void dpb7000_storeaddr_card_device::ras_w(bool state) -{ - const bool old_ras = m_ras; - m_ras = state; - if (old_ras != m_ras) - { - m_ras_out(!m_ras); - update_r_busy(old_ras); - } -} - -void dpb7000_storeaddr_card_device::update_r_busy(bool old_ras) -{ - const bool old_r_busy = m_opwb || !old_ras; - const bool r_busy = m_opwb || !m_ras; - if (old_r_busy != r_busy) - { - m_r_busy_out(r_busy); - } -} - -void dpb7000_storeaddr_card_device::cas_w(bool state) -{ - const bool old_cas = m_cas; - m_cas = state; - if (old_cas != m_cas) - { - m_cas_out(!m_cas); - } -} - -void dpb7000_storeaddr_card_device::laac_w(bool state) -{ - const bool old_laac = m_laac; - m_laac = state; - if (old_laac != m_laac) - { - update_req_clears(); - } -} - -void dpb7000_storeaddr_card_device::t6_w(bool state) -{ - const bool old = m_t6; - m_t6 = state; - if (old != m_t6) - { - update_opstr(); - update_cck(); - } -} - -void dpb7000_storeaddr_card_device::clrw_w(bool state) -{ - const bool old = m_clrw; - m_clrw = state; - if (old != m_clrw) - { - if (m_clrw) - { - opwb_w(false); - m_write_active = false; - update_opstr(); - } - } -} - -void dpb7000_storeaddr_card_device::reg_w(uint16_t data) -{ - switch ((data >> 12) & 7) - { - case 0: - { - LOG("%s: Store Address Card %d, set RHSCR: %03x\n", machine().describe_context(), m_s_type, data & 0xfff); - const uint16_t old = m_rhscr; - m_rhscr = data & 0xfff; - if (BIT(old, 0) != BIT(m_rhscr, 0)) - { - update_rck(); - } - break; - } - case 1: - LOG("%s: Store Address Card %d, set RVSCR: %03x\n", machine().describe_context(), m_s_type, data & 0xfff); - m_rvscr = data & 0xfff; - break; - case 2: - { - LOG("%s: Store Address Card %d, set R ZOOM: %03x\n", machine().describe_context(), m_s_type, data & 0xfff); - const uint8_t old = m_rzoom; - m_rzoom = data & 0xf; - if (BIT(old, 0) != BIT(m_rzoom, 0)) - { - update_rck(); - } - break; - } - case 3: - LOG("%s: Store Address Card %d, set FLDSEL: %03x\n", machine().describe_context(), m_s_type, data & 0xfff); - m_fld_sel = data & 0xf; - m_window_enable = BIT(m_fld_sel, 2); - m_blank_b = !(m_window_enable && m_b26); - break; - case 4: - LOG("%s: Store Address Card %d, set CXPOS: %03x\n", machine().describe_context(), m_s_type, 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_orig_cy_addr = data & 0xfff; - break; - default: - LOG("%s: Store Address Card %d, unknown register: %04x\n", machine().describe_context(), m_s_type, data); - break; - } -} - -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; -} - -void dpb7000_storeaddr_card_device::cen_w(int state) -{ - m_cen = (bool)state; -} - -void dpb7000_storeaddr_card_device::cxd_w(int state) -{ - m_cxd = (bool)state; -} - -void dpb7000_storeaddr_card_device::cxen_w(int state) -{ - m_cxen = (bool)state; -} - -void dpb7000_storeaddr_card_device::cxld_w(int state) -{ - m_cxld = (bool)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) - { - const int8_t old_ca = m_cx_stripe_addr; - const int16_t old_cn = m_cx_stripe_num; - - if (m_cxd) - { - m_cx_stripe_addr--; - if (m_cx_stripe_addr == -1) - { - m_cx_stripe_addr = 9; - m_cx_stripe_num--; - m_crc = true; - update_prot_proms(); - } - else - { - m_crc = false; - } - } - else - { - m_cx_stripe_addr++; - if (m_cx_stripe_addr == 10) - { - m_cx_stripe_addr = 0; - m_cx_stripe_num++; - m_crc = true; - update_prot_proms(); - } - else - { - m_crc = false; - } - } - - if ((old_ca & 0x0e) != (m_cx_stripe_addr & 0x0e) && !m_rck) - { - m_ra &= 1; - m_ra |= m_cx_stripe_addr & 0x0e; - m_ra_out(m_ra); - } - - const int16_t changed = old_cn ^ m_cx_stripe_num; - if (changed & 0x30) - update_addr_mux_inputs(); - else if (changed & 0x40) - update_addr_mux_outputs(); - else - update_addr_select_inputs(); - } - - 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) -{ - m_cxod = (bool)state; -} - -void dpb7000_storeaddr_card_device::cxoen_w(int state) -{ - m_cxoen = (bool)state; -} - -void dpb7000_storeaddr_card_device::cyd_w(int state) -{ - m_cyd = (bool)state; -} - -void dpb7000_storeaddr_card_device::cyen_w(int state) -{ - m_cyen = (bool)state; -} - -void dpb7000_storeaddr_card_device::cyld_w(int state) -{ - m_cyld = (bool)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) - { - const int16_t old_cy = m_cy_addr; - if (m_cyd) - { - m_cy_addr--; - } - else - { - m_cy_addr++; - } - - const int16_t changed = old_cy ^ m_cy_addr; - if (changed & 0x300) - update_addr_mux_inputs(); - else - update_addr_select_inputs(); - - 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) -{ - m_cyod = (bool)state; -} - -void dpb7000_storeaddr_card_device::cyoen_w(int state) -{ - m_cyoen = (bool)state; -} - -void dpb7000_storeaddr_card_device::clrc_w(int state) -{ - const bool old = m_clrc; - m_clrc = (bool)state; - if (old != m_clrc && !m_clrc) - { - m_creq_pending = false; - m_creq_active = true; - } -} - -void dpb7000_storeaddr_card_device::selvideo_w(int state) -{ - const bool old = m_selvideo; - m_selvideo = (bool)state; - if (!old && m_selvideo && BIT(m_cx_stripe_addr, 3)) - { - request_c_read(); - } -} - -void dpb7000_storeaddr_card_device::creq_w(int state) -{ - const bool old = m_creq; - m_creq = (bool)state; - if (!old && m_creq) - { - request_c_read(); - } -} - -void dpb7000_storeaddr_card_device::cr_w(int state) -{ - m_cread = (bool)state; -} - -void dpb7000_storeaddr_card_device::request_r_read() -{ - m_rreq_pending = true; - check_r_read(); -} - -void dpb7000_storeaddr_card_device::check_r_read() -{ - if (m_rreq_pending && !m_creq_active) - { - m_rreq_active = true; - m_creq_sel = false; - update_addr_select_outputs(); - check_cycle_start(); - } -} - -void dpb7000_storeaddr_card_device::request_c_read() -{ - const bool old = m_creq_pending; - m_creq_pending = true; - if (!old && m_creq_pending) - { - m_cbusy_out(!m_creq_pending); - } - check_c_read(); -} - -void dpb7000_storeaddr_card_device::check_c_read() -{ - if (m_creq_pending && !m_rreq_active) - { - m_creq_active = true; - m_creq_sel = true; - update_addr_select_outputs(); - check_cycle_start(); - - const bool old_write = m_write_active; - m_write_active = !(m_protx || m_proty || m_cread || BIT(m_cy_addr, 10)); - if (old_write != m_write_active) - { - update_opstr(); - m_w_out(m_write_active); - } - - opwb_w(true); - } -} - -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::preread_w(int state) -{ - const bool old = m_preread; - m_preread = (bool)state; - if (!old && m_preread) - { - request_r_read(); - } -} - -void dpb7000_storeaddr_card_device::check_cycle_start() -{ - if ((m_creq_active || m_rreq_active) && !m_store_busy) - { - m_store_busy = true; - mxr_w(true); - m_delay_timer->adjust(attotime::from_nsec(25), 0, attotime::from_nsec(25)); - } -} - -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); -} - -void dpb7000_storeaddr_card_device::rvl_w(int state) -{ - m_rvl = (bool)state; -} - -void dpb7000_storeaddr_card_device::rhr_w(int state) -{ - const bool old = m_rhr; - m_rhr = (bool)state; - if (old && !m_rhr) - { - if (!m_rhr) - { - m_rreq_pending = false; - m_rreq_active = false; - } - - if (!m_plt && !m_rhr) - { - m_rvscr_counter = 0; - } - - const uint8_t old_vzoom = m_vzoom_count; - if (!m_rvl || m_vzoom_count == 15) - { - m_vzoom_count = ~m_rzoom & 15; - } - else - { - m_vzoom_count++; - } - - if (!m_rvl) - { - m_rvscr_counter = m_rvscr; - } - else if (m_zb || old_vzoom == 15) - { - const uint16_t old_counter = m_rvscr_counter; - m_rvscr_counter++; - - if (((old_counter ^ m_rvscr_counter) & 0x3fc) != 0) - update_blanking_pal(); - - const int16_t changed = old_counter ^ m_rvscr_counter; - if (changed & 0x300) - update_addr_mux_inputs(); - else - update_addr_select_inputs(); - } - update_v0(); - } -} - -void dpb7000_storeaddr_card_device::plt_w(int state) -{ - m_plt = (bool)state; - update_rck(); -} - -void dpb7000_storeaddr_card_device::zb_w(int state) -{ - m_zb = (bool)state; -} - -void dpb7000_storeaddr_card_device::rppck_w(int state) -{ - const bool old = m_rppck; - m_rppck = (bool)state; - if (old && !m_rppck) - { - if (!m_plt && !m_rppck) - { - m_rvscr_counter = 0; - } - - const uint8_t old_hzoom = m_hzoom_count; - if (!m_rhr || m_hzoom_count == 15) - { - m_hzoom_count = ~m_rzoom & 15; - } - - m_blank_q <<= 1; - if (m_blank_a && m_blank_b) - { - m_blank_q |= 1; - } - m_blk_out(BIT(m_blank_q, 7)); - - if (m_zb || old_hzoom == 15) - { - const uint8_t old_addr = m_rhscr_stripe_addr; - m_rhscr_stripe_addr++; - if ((old_addr & 0x08) != (m_rhscr_stripe_addr & 0x08)) - { - m_blank_a = !m_blank_d; - } - - if (m_rhscr_stripe_addr == 10) - { - m_rhscr_stripe_addr = 0; - - const uint8_t old_stripe_num = m_rhscr_stripe_num; - m_rhscr_stripe_num++; - update_opwa(); - update_blanking_pal(); - if ((old_stripe_num & 1) != (m_rhscr_stripe_num & 1) && m_rck) - { - m_opra = BIT(m_rhscr_stripe_num, 0); - m_opra_out(m_opra); - } - - const int16_t changed = old_stripe_num ^ m_rhscr_stripe_num; - if (changed & 0x30) - update_addr_mux_inputs(); - else if (changed & 0x40) - update_addr_mux_outputs(); - else - update_addr_select_inputs(); - } - - const uint8_t old_ra = m_ra; - if (m_rck) - { - m_ra = m_rhscr_stripe_addr; - } - else - { - m_ra &= ~1; - m_ra |= BIT(m_rhscr_stripe_addr, 0); - } - - if (old_ra != m_ra) - m_ra_out(m_ra); - } - } -} - -void dpb7000_storeaddr_card_device::rb_w(int state) -{ - m_rb = (bool)state; -} - -void dpb7000_storeaddr_card_device::pflag_w(int state) -{ - const bool old = m_pflag; - m_pflag = (bool)state; - if (old != m_pflag) - update_rck(); -} - -void dpb7000_storeaddr_card_device::b26_w(int state) -{ - m_b26 = (bool)state; - m_blank_b = !(m_window_enable && m_b26); -} - -void dpb7000_storeaddr_card_device::ipen_w(int state) -{ - const bool old_en = m_ipen; - m_ipen = (bool)state; - if (!old_en && m_ipen) - { - const bool old_sel = m_ipsel; - m_ipsel = ((!m_crc || m_selvideo) != m_ipsel); - if (old_sel != m_ipsel) - m_ipsel_out(m_ipsel); - } -} - -void dpb7000_storeaddr_card_device::update_rck() -{ - const bool scroll0 = BIT(m_rhscr, 0); - const bool zoom0 = BIT(m_rzoom, 0); - const bool old_rck = m_rck; - m_rck = (scroll0 && m_plt && !zoom0) != m_pflag; - if (old_rck != m_rck) - { - m_rck_out(m_rck); - m_oprb_out(m_rck); - if (!old_rck && m_rck) - { - update_cck(); - } - - const uint8_t old_ra = m_ra; - const bool old_opra = m_opra; - const bool ah_sel = !m_rck; - m_ra = (m_rhscr_stripe_addr & 1); - if (ah_sel) - { - m_ra |= m_cx_stripe_addr & 0x0e; - m_opra = false; - } - else - { - m_ra |= m_rhscr_stripe_addr & 0x0e; - m_opra = BIT(m_rhscr_stripe_num, 0); - } - - if (old_ra != m_ra) - m_ra_out(m_ra); - if (old_opra != m_opra) - m_opra_out(m_opra); - } -} - -void dpb7000_storeaddr_card_device::update_v0() -{ - // FLDSEL1 VLSB NAND1 FLDSEL0 V0 - // 0 0 1 0 1 - // 0 1 1 0 1 - // 1 0 1 0 1 - // 1 1 0 0 1 - // 0 0 1 1 0 - // 0 1 1 1 0 - // 1 0 1 1 0 - // 1 1 0 1 1 - const bool v0 = !BIT(m_fld_sel, 0) || (BIT(m_fld_sel, 1) && BIT(m_rvscr_counter, 0)); - m_rvscr_with_v0 = (m_rvscr_counter &~ 1) | (v0 ? 1 : 0); -} - -void dpb7000_storeaddr_card_device::update_blanking_pal() -{ - uint16_t addr = (m_rhscr_stripe_num >> 4); - addr |= (m_rvscr_counter & 0xfc) << 2; - addr |= BIT(m_rhscr_stripe_num, 0) << 10; - addr |= (m_rvscr_counter & 0x300) << 3; - addr |= (m_rhscr_stripe_num & 0x0e) << 12; - const uint8_t blanking = m_blanking_base[addr]; - m_blank_d = !(BIT(blanking, 0) && BIT(blanking, 1)); -} - -void dpb7000_storeaddr_card_device::update_addr_mux_inputs() -{ - m_df_in[0] = (m_cx_stripe_num & 0x30) >> 4; - const uint8_t cy_df_bits = (m_cy_addr & 0x300) >> 8; - m_df_in[0] |= cy_df_bits << 2; - m_df_in[1] = cy_df_bits | 0xc; - - m_ee_in[0] = (m_rhscr_stripe_num & 0x30) >> 4; - const uint8_t ry_ee_bits = (m_rvscr_counter & 0x300) >> 8; - m_ee_in[0] |= ry_ee_bits << 2; - m_ee_in[1] = ry_ee_bits | 0xc; - - update_addr_mux_outputs(); -} - -void dpb7000_storeaddr_card_device::update_addr_mux_outputs() -{ - m_df_out = m_df_in[BIT(m_cx_stripe_num, 6)]; - m_ee_out = m_ee_in[BIT(m_rhscr_stripe_num, 6)]; - - update_addr_select_inputs(); -} - -void dpb7000_storeaddr_card_device::update_addr_select_inputs() -{ - m_dg_in[0] = BIT(m_rhscr_stripe_num, 0) | (BIT(m_ee_out, 0) << 1) | (BIT(m_cx_stripe_num, 0) << 2) | (BIT(m_df_out, 0) << 3); - m_dg_in[1] = BIT(m_rhscr_stripe_num, 1) | (BIT(m_ee_out, 1) << 1) | (BIT(m_cx_stripe_num, 1) << 2) | (BIT(m_df_out, 1) << 3); - m_eg_in[0] = BIT(m_rhscr_stripe_num, 2) | (BIT(m_rvscr_with_v0, 5) << 1) | (BIT(m_cx_stripe_num, 2) << 2) | (BIT(m_cy_addr, 5) << 3); - m_eg_in[1] = BIT(m_rhscr_stripe_num, 3) | (BIT(m_rvscr_with_v0, 6) << 1) | (BIT(m_cx_stripe_num, 3) << 2) | (BIT(m_cy_addr, 6) << 3); - m_fg_in[0] = BIT(m_rvscr_with_v0, 1) | (BIT(m_rvscr_with_v0, 7) << 1) | (BIT(m_cy_addr, 1) << 2) | (BIT(m_cy_addr, 7) << 3); - m_fg_in[1] = BIT(m_rvscr_with_v0, 2) | (BIT(m_ee_out, 2) << 1) | (BIT(m_cy_addr, 2) << 2) | (BIT(m_df_out, 2) << 3); - m_gg_in[0] = BIT(m_rvscr_with_v0, 3) | (BIT(m_ee_out, 3) << 1) | (BIT(m_cy_addr, 3) << 2) | (BIT(m_df_out, 3) << 3); - m_gg_in[1] = BIT(m_rvscr_with_v0, 4) | (BIT(m_rvscr_with_v0, 0) << 1) | (BIT(m_cy_addr, 4) << 2) | (BIT(m_cy_addr, 0) << 3); - - update_addr_select_outputs(); -} - -void dpb7000_storeaddr_card_device::update_addr_select_outputs() -{ - const uint8_t sel = (m_mxr ? 1 : 0) | (m_creq_sel ? 2 : 0); - const uint8_t old = m_addr; - m_addr = BIT(m_dg_in[0], sel); - m_addr |= BIT(m_dg_in[1], sel) << 1; - m_addr |= BIT(m_eg_in[0], sel) << 2; - m_addr |= BIT(m_eg_in[1], sel) << 3; - m_addr |= BIT(m_fg_in[0], sel) << 4; - m_addr |= BIT(m_fg_in[1], sel) << 5; - m_addr |= BIT(m_gg_in[0], sel) << 6; - m_addr |= BIT(m_gg_in[1], sel) << 7; - if (old != m_addr) - m_addr_out(m_addr); -} diff --git a/src/mame/video/dpb_storeaddr.h b/src/mame/video/dpb_storeaddr.h deleted file mode 100644 index be93295179f..00000000000 --- a/src/mame/video/dpb_storeaddr.h +++ /dev/null @@ -1,285 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -/*************************************************************************** - - dpb_storeaddr.h - DPB-7000/1 - Store Address Card - -***************************************************************************/ - -#ifndef MAME_VIDEO_DPB_STOREADDR_H -#define MAME_VIDEO_DPB_STOREADDR_H - -#pragma once - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> dpb7000_storeaddr_card_device - -class dpb7000_storeaddr_card_device : public device_t -{ -public: - // construction/destruction - dpb7000_storeaddr_card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); - - void reg_w(uint16_t data); - void s_type_w(int state); - void cen_w(int state); - - void cxd_w(int state); - void cxen_w(int state); - void cxld_w(int state); - void cxck_w(int state); - void cxod_w(int state); - void cxoen_w(int state); - - void cyd_w(int state); - void cyen_w(int state); - void cyld_w(int state); - void cyck_w(int state); - void cyod_w(int state); - void cyoen_w(int state); - - void clrc_w(int state); - void selvideo_w(int state); - void creq_w(int state); - void cr_w(int state); - - void prot_a_w(int state); - void prot_b_w(int state); - - void preread_w(int state); - - void rvl_w(int state); - void rhr_w(int state); - void plt_w(int state); - void zb_w(int state); - void rppck_w(int state); - void rb_w(int state); - void pflag_w(int state); - void b26_w(int state); - - void ipen_w(int state); - - auto ipsel() { return m_ipsel_out.bind(); } - auto csel() { return m_csel_out.bind(); } - auto rck() { return m_rck_out.bind(); } - auto cck() { return m_cck_out.bind(); } - auto ra() { return m_ra_out.bind(); } - auto opstr() { return m_opstr_out.bind(); } - auto opwa() { return m_opwa_out.bind(); } - auto opwb() { return m_opwb_out.bind(); } - auto opra() { return m_opra_out.bind(); } - auto oprb() { return m_oprb_out.bind(); } - auto blk() { return m_blk_out.bind(); } - auto a() { return m_addr_out.bind(); } - auto r_busy() { return m_r_busy_out.bind(); } - auto ras() { return m_ras_out.bind(); } - auto cas() { return m_cas_out.bind(); } - auto write() { return m_w_out.bind(); } - auto cbusy() { return m_cbusy_out.bind(); } - -protected: - // device-level overrides - virtual void device_start() override; - virtual void device_reset() override; - virtual const tiny_rom_entry *device_rom_region() const override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - - static constexpr device_timer_id DELAY_TIMER = 0; - - void set_cxpos(uint16_t data); - - void tick_cxck(); - void tick_cyck(); - - void update_r_busy(bool old_ras); - - void update_blanking_pal(); - void update_prot_proms(); - void update_rck(); - void update_v0(); - void update_opwa(); - void update_opstr(); - void update_req_clears(); - void update_cck(); - - void update_addr_mux_inputs(); - void update_addr_mux_outputs(); - void update_addr_select_inputs(); - void update_addr_select_outputs(); - - void check_cycle_start(); - void tick_delay_step(); - - void request_r_read(); - void check_r_read(); - void request_c_read(); - void check_c_read(); - - void opwb_w(bool state); - - // Timed control signals - void mxr_w(bool state); - void ras_w(bool state); - void cas_w(bool state); - void laac_w(bool state); - void t6_w(bool state); - void clrw_w(bool state); - - 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_blanking_base; - - uint8_t m_bb_out; - uint8_t m_bc_out; - uint8_t m_bd_out; - bool m_protx; - bool m_proty; - - emu_timer *m_delay_timer; - uint8_t m_delay_step; - - uint8_t m_df_in[2]; - uint8_t m_df_out; - uint8_t m_ee_in[2]; - uint8_t m_ee_out; - - uint8_t m_dg_in[2]; - uint8_t m_eg_in[2]; - uint8_t m_fg_in[2]; - uint8_t m_gg_in[2]; - uint8_t m_addr; - - uint16_t m_rhscr; - uint16_t m_rvscr; - uint8_t m_rzoom; - uint8_t m_fld_sel; - - uint8_t m_hzoom_count; - uint8_t m_vzoom_count; - - 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; - - uint8_t m_rhscr_stripe_addr; - uint8_t m_rhscr_stripe_num; - - uint16_t m_rvscr_counter; - uint16_t m_rvscr_with_v0; - - int m_s_type; - - bool m_cen; - - bool m_cxd; - bool m_cxen; - bool m_cxld; - bool m_cxck; - bool m_cxod; - bool m_cxoen; - - bool m_cyd; - bool m_cyen; - bool m_cyld; - bool m_cyck; - bool m_cyod; - bool m_cyoen; - - bool m_clrc; - bool m_selvideo; - bool m_creq; - bool m_cread; - - bool m_prot_a; - bool m_prot_b; - - bool m_preread; - bool m_rreq_pending; - bool m_rreq_active; - bool m_creq_pending; - bool m_creq_active; - bool m_store_busy; - - bool m_rvl; - bool m_rhr; - bool m_plt; - bool m_zb; - bool m_rppck; - bool m_rb; - bool m_pflag; - - bool m_mxr; - bool m_ras; - bool m_cas; - bool m_laac; - bool m_t6; - bool m_clrw; - bool m_opstr; - bool m_cck_clear; - - bool m_creq_sel; - - bool m_write_active; - - bool m_window_enable; - bool m_b26; - - bool m_blank_d; - bool m_blank_a; - bool m_blank_b; - uint8_t m_blank_q; - - bool m_crc; - bool m_ipen; - - // Output Signals - bool m_ipsel; - bool m_rck; - uint8_t m_ra; - bool m_opra; - bool m_opwa; - bool m_opwb; - bool m_cck; - bool m_csel; - - // Output Handlers - devcb_write_line m_ipsel_out; - devcb_write_line m_rck_out; - devcb_write8 m_ra_out; - devcb_write_line m_opra_out; - devcb_write_line m_oprb_out; - devcb_write_line m_blk_out; - devcb_write8 m_addr_out; - devcb_write_line m_r_busy_out; - devcb_write_line m_ras_out; - devcb_write_line m_cas_out; - devcb_write_line m_opwb_out; - devcb_write_line m_opstr_out; - devcb_write_line m_w_out; - devcb_write_line m_opwa_out; - devcb_write_line m_csel_out; - devcb_write_line m_cck_out; - devcb_write_line m_cbusy_out; - - // Devices - 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 -DECLARE_DEVICE_TYPE(DPB7000_STOREADDR, dpb7000_storeaddr_card_device) - -#endif // MAME_VIDEO_DPB_STOREADDR_H