diff options
author | Vas Crabb <vas@vastheman.com> | 2018-01-31 12:32:33 +1100 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2018-01-31 12:32:33 +1100 |
commit | 031b78e92dd736f31f37d2b041e325d3786ec335 (patch) | |
tree | dd5d6805fec9ff85e632a9950eedbf73d3670a29 | |
parent | 5be2496d0cfa035881ebd3b6352951232880fc4b (diff) | |
parent | f652d21e167265bded620fab397f142d18bd7b45 (diff) |
Merge remote-tracking branch 'origin/master' into release0194
Conflicts:
language/German/strings.po
plugins/cheatfind/init.lua
src/mame/drivers/ti85.cpp
27 files changed, 2061 insertions, 1276 deletions
diff --git a/plugins/cheatfind/init.lua b/plugins/cheatfind/init.lua index 514e574f87e..17bfef7c4d0 100644 --- a/plugins/cheatfind/init.lua +++ b/plugins/cheatfind/init.lua @@ -67,7 +67,7 @@ function cheatfind.startplugin() local temp = {} local j = 1 if data.shift >= 0 then -- region or byte wide space - for i = start, start + size, 1 << data.shift do + for i = start, start + (size << data.shift), 1 << data.shift do if j < 65536 then temp[j] = string.pack("B", space:read_u8(i)) j = j + 1 diff --git a/src/devices/machine/74157.cpp b/src/devices/machine/74157.cpp index 6321e9c88dd..8ca2cae3617 100644 --- a/src/devices/machine/74157.cpp +++ b/src/devices/machine/74157.cpp @@ -5,11 +5,19 @@ 74LS157/74HCT157 Quad 2 to 1-Line Data Selectors/Multiplexers (TTL) - Often used to help feed 8-bit ROM data into a MSM5205, and for many - other purposes. + Often used to help feed 8-bit ROM data into a MSM5205 (which may + require additional pullups for CMOS compatibility), and for many other + purposes. 74LS158 has inverted outputs; 74LS157 is non-inverting. + 74LS257 and 74LS258 have three-state outputs with an active-low enable, + making these devices popular for bus-compatible applications which the + emulation here is not particularly suitable for. When pin 15 is tied to + GND, however, these devices become pin-compatible replacements for + 74LS157 and 74LS158; this substitution is somewhat common on arcade + bootlegs. + ***************************************************************************/ #include "emu.h" diff --git a/src/devices/video/clgd542x.cpp b/src/devices/video/clgd542x.cpp index 9897675ac09..fa3dd3c67f7 100644 --- a/src/devices/video/clgd542x.cpp +++ b/src/devices/video/clgd542x.cpp @@ -43,6 +43,7 @@ DEFINE_DEVICE_TYPE(CIRRUS_GD5428, cirrus_gd5428_device, "clgd5428", "Cirrus Logic GD5428") DEFINE_DEVICE_TYPE(CIRRUS_GD5430, cirrus_gd5430_device, "clgd5430", "Cirrus Logic GD5430") +DEFINE_DEVICE_TYPE(CIRRUS_GD5446, cirrus_gd5446_device, "clgd5446", "Cirrus Logic GD5446") cirrus_gd5428_device::cirrus_gd5428_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) @@ -60,6 +61,11 @@ cirrus_gd5430_device::cirrus_gd5430_device(const machine_config &mconfig, const { } +cirrus_gd5446_device::cirrus_gd5446_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cirrus_gd5428_device(mconfig, CIRRUS_GD5446, tag, owner, clock) +{ +} + void cirrus_gd5428_device::device_start() { zero(); @@ -96,6 +102,13 @@ void cirrus_gd5430_device::device_start() m_chip_id = 0xa0; // GD5430 - Rev 0 } +void cirrus_gd5446_device::device_start() +{ + cirrus_gd5428_device::device_start(); + m_chip_id = 0x80 | 0x39; // GD5446 +} + + void cirrus_gd5428_device::device_reset() { vga_device::device_reset(); diff --git a/src/devices/video/clgd542x.h b/src/devices/video/clgd542x.h index a6bad5716ec..a54acb7460d 100644 --- a/src/devices/video/clgd542x.h +++ b/src/devices/video/clgd542x.h @@ -117,8 +117,19 @@ protected: virtual void device_start() override; }; +class cirrus_gd5446_device : public cirrus_gd5428_device +{ +public: + cirrus_gd5446_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual void device_start() override; +}; + + // device type definition DECLARE_DEVICE_TYPE(CIRRUS_GD5428, cirrus_gd5428_device) DECLARE_DEVICE_TYPE(CIRRUS_GD5430, cirrus_gd5430_device) +DECLARE_DEVICE_TYPE(CIRRUS_GD5446, cirrus_gd5446_device) #endif // MAME_VIDEO_CLGD542X_H diff --git a/src/devices/video/i8275.cpp b/src/devices/video/i8275.cpp index c962768e17f..50a0be52a45 100644 --- a/src/devices/video/i8275.cpp +++ b/src/devices/video/i8275.cpp @@ -11,6 +11,9 @@ TODO: - double spaced rows + - blanking of top and bottom rows when underline MSB is set + - end of row/screen - stop dma + - preset counters */ @@ -106,6 +109,8 @@ i8275_device::i8275_device(const machine_config &mconfig, const char *tag, devic m_param_idx(0), m_param_end(0), m_buffer_idx(0), + m_fifo_idx(0), + m_dma_idx(0), m_fifo_next(false), m_buffer_dma(0), m_lpen(0), @@ -156,6 +161,7 @@ void i8275_device::device_start() save_item(NAME(m_buffer[1])); save_item(NAME(m_buffer_idx)); save_item(NAME(m_fifo_idx)); + save_item(NAME(m_dma_idx)); save_item(NAME(m_fifo_next)); save_item(NAME(m_buffer_dma)); save_item(NAME(m_lpen)); @@ -215,8 +221,6 @@ void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param, break; case TIMER_SCANLINE: - if (!(m_status & ST_VE)) break; - //LOG("I8275 y %u x %u HRTC 0\n", y, x); m_write_hrtc(0); @@ -226,11 +230,11 @@ void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param, m_write_vrtc(0); } - if (m_scanline <= (m_vrtc_scanline - SCANLINES_PER_ROW)) + if ((m_status & ST_VE) && m_scanline <= (m_vrtc_scanline - SCANLINES_PER_ROW)) { if (lc == 0) { - if (m_buffer_idx < CHARACTERS_PER_ROW) + if (m_dma_idx < CHARACTERS_PER_ROW) { m_status |= ST_DU; m_du = true; @@ -246,6 +250,7 @@ void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param, m_buffer_dma = !m_buffer_dma; m_buffer_idx = 0; m_fifo_idx = 0; + m_dma_idx = 0; if ((m_scanline < (m_vrtc_scanline - SCANLINES_PER_ROW))) { @@ -271,37 +276,41 @@ void i8275_device::device_timer(emu_timer &timer, device_timer_id id, int param, //LOG("I8275 y %u x %u VRTC 1\n", y, x); m_write_vrtc(1); - // reset field attributes - m_hlgt = 0; - m_vsp = 0; - m_gpa = 0; - m_rvv = 0, - m_lten = 0; - - m_du = false; - m_dma_stop = false; - m_end_of_screen = false; - - m_cursor_blink++; - m_cursor_blink &= 0x1f; - - m_char_blink++; - m_char_blink &= 0x3f; - m_stored_attr = 0; + if (m_status & ST_VE) + { + // reset field attributes + m_hlgt = 0; + m_vsp = 0; + m_gpa = 0; + m_rvv = 0; + m_lten = 0; + + m_du = false; + m_dma_stop = false; + m_end_of_screen = false; + + m_cursor_blink++; + m_cursor_blink &= 0x1f; + + m_char_blink++; + m_char_blink &= 0x3f; + m_stored_attr = 0; + } } - if (m_scanline == m_vrtc_drq_scanline) + if ((m_status & ST_VE) && m_scanline == m_vrtc_drq_scanline) { // swap line buffers m_buffer_dma = !m_buffer_dma; m_buffer_idx = 0; m_fifo_idx = 0; + m_dma_idx = 0; // start DMA burst m_drq_on_timer->adjust(clocks_to_attotime(DMA_BURST_SPACE)); } - if (m_scanline < m_vrtc_scanline) + if ((m_status & ST_VE) && m_scanline < m_vrtc_scanline) { int line_counter = OFFSET_LINE_COUNTER ? ((lc - 1) % SCANLINES_PER_ROW) : lc; bool end_of_row = false; @@ -493,24 +502,41 @@ WRITE8_MEMBER( i8275_device::write ) switch (data >> 5) { + /* + * DMA requests stop; + * IE is reset, interrupts are disabled; + * VE is reset, VSP output is used to blank the screen; + * HRTC and VRTC continue to run; + * HRTC and VRTC timing are random on power-up. + */ case CMD_RESET: LOG("I8275 Reset\n"); - m_status &= ~ST_IE; + m_status &= ~(ST_IE | ST_VE); LOG("I8275 IRQ 0\n"); m_write_irq(CLEAR_LINE); m_write_drq(0); + m_drq_on_timer->adjust(attotime::zero); m_param_idx = REG_SCN1; m_param_end = REG_SCN4; break; + /* + * IE is set, interrupts are enabled; + * VE is set, video is enabled; + * DMA requests begin. + */ case CMD_START_DISPLAY: m_param[REG_DMA] = data; LOG("I8275 Start Display %u %u\n", DMA_BURST_COUNT, DMA_BURST_SPACE); m_status |= (ST_IE | ST_VE); break; + /* + * interrupts remain enabled; + * HRTC and VRTC continue to run. + */ case CMD_STOP_DISPLAY: LOG("I8275 Stop Display\n"); m_status &= ~ST_VE; @@ -540,7 +566,6 @@ WRITE8_MEMBER( i8275_device::write ) case CMD_PRESET_COUNTERS: LOG("I8275 Preset Counters\n"); - m_scanline = 0; break; } } @@ -566,7 +591,7 @@ WRITE8_MEMBER( i8275_device::write ) WRITE8_MEMBER( i8275_device::dack_w ) { - //LOG("I8275 y %u x %u DACK %04x:%02x %u\n", screen().vpos(), screen().hpos(), offset, data, m_buffer_idx); + //LOG("I8275 y %u x %u DACK %04x:%02x %u (%u)\n", screen().vpos(), screen().hpos(), offset, data, m_buffer_idx, m_dma_idx); m_write_drq(0); @@ -584,41 +609,43 @@ WRITE8_MEMBER( i8275_device::dack_w ) } else { - if (m_buffer_idx < ARRAY_LENGTH(m_buffer[m_buffer_dma])) + if (m_dma_idx < ARRAY_LENGTH(m_buffer[m_buffer_dma])) m_buffer[m_buffer_dma][m_buffer_idx++] = data; if (!VISIBLE_FIELD_ATTRIBUTE && ((data & 0xc0) == 0x80)) { m_fifo_next = true; } + } - switch (data) - { - case SCC_END_OF_ROW_DMA: - // stop DMA - // TODO should read one more character if DMA burst not completed - break; + m_dma_idx++; - case SCC_END_OF_SCREEN_DMA: - m_dma_stop = true; - // TODO should read one more character if DMA burst not completed - break; + switch (data) + { + case SCC_END_OF_ROW_DMA: + // stop DMA + // TODO should read one more character if DMA burst not completed + m_drq_on_timer->adjust(screen().time_until_pos(screen().vpos() + 1, 0)); + break; - default: - if (m_buffer_idx == CHARACTERS_PER_ROW) - { - // stop DMA - } - else if (!(m_buffer_idx % DMA_BURST_COUNT)) - { - m_drq_on_timer->adjust(clocks_to_attotime(DMA_BURST_SPACE)); - } - else - { - m_drq_on_timer->adjust(attotime::zero); - } - } + case SCC_END_OF_SCREEN_DMA: + m_dma_stop = true; + // TODO should read one more character if DMA burst not completed + break; + default: + if (m_dma_idx == CHARACTERS_PER_ROW) + { + // stop DMA + } + else if (!(m_dma_idx % DMA_BURST_COUNT)) + { + m_drq_on_timer->adjust(clocks_to_attotime(DMA_BURST_SPACE)); + } + else + { + m_drq_on_timer->adjust(attotime::zero); + } } } @@ -688,6 +715,7 @@ void i8275_device::recompute_parameters() LOG("irq_y %u vrtc_y %u drq_y %u\n", m_irq_scanline, m_vrtc_scanline, m_vrtc_drq_scanline); m_scanline_timer->adjust(screen().time_until_pos(0, 0), 0, screen().scan_period()); + m_scanline = 0; if (DOUBLE_SPACED_ROWS) fatalerror("Double spaced rows not supported!"); } diff --git a/src/devices/video/i8275.h b/src/devices/video/i8275.h index 06a6495698d..a2a8715972c 100644 --- a/src/devices/video/i8275.h +++ b/src/devices/video/i8275.h @@ -197,6 +197,7 @@ protected: uint8_t m_fifo[2][16]; int m_buffer_idx; int m_fifo_idx; + int m_dma_idx; bool m_fifo_next; int m_buffer_dma; diff --git a/src/devices/video/tms9927.cpp b/src/devices/video/tms9927.cpp index 3380ad2c48c..c5653c88b13 100644 --- a/src/devices/video/tms9927.cpp +++ b/src/devices/video/tms9927.cpp @@ -293,22 +293,10 @@ READ_LINE_MEMBER(tms9927_device::bl_r) } -bool tms9927_device::screen_reset() -{ - return m_reset; -} - - -int tms9927_device::upscroll_offset() -{ - return m_start_datarow; -} - - -bool tms9927_device::cursor_bounds(rectangle &bounds) +bool tms9927_device::cursor_bounds(rectangle &bounds) const { int cursorx = CURSOR_CHAR_ADDRESS; - int cursory = CURSOR_ROW_ADDRESS; + int cursory = (CURSOR_ROW_ADDRESS + DATA_ROWS_PER_FRAME - m_start_datarow) % DATA_ROWS_PER_FRAME; bounds.min_x = cursorx * m_hpixels_per_column; bounds.max_x = bounds.min_x + m_hpixels_per_column - 1; @@ -371,8 +359,12 @@ void tms9927_device::recompute_parameters(bool postload) m_hsyn = false; if (!m_write_hsyn.isnull()) + { + m_write_hsyn(0); m_hsync_timer->adjust(screen().time_until_pos(m_vsyn_start, m_hsyn_start)); + } m_vsyn = false; + m_write_vsyn(0); m_vsync_timer->adjust(screen().time_until_pos(m_vsyn_start, m_hsyn_start)); } diff --git a/src/devices/video/tms9927.h b/src/devices/video/tms9927.h index 4108f015b71..c1b6ec7bce8 100644 --- a/src/devices/video/tms9927.h +++ b/src/devices/video/tms9927.h @@ -48,9 +48,9 @@ public: DECLARE_READ_LINE_MEMBER(bl_r); - bool screen_reset(); - int upscroll_offset(); - bool cursor_bounds(rectangle &bounds); + bool screen_reset() const { return m_reset; } + int upscroll_offset() const { return m_start_datarow; } + bool cursor_bounds(rectangle &bounds) const; protected: tms9927_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/lib/netlist/plib/ppmf.h b/src/lib/netlist/plib/ppmf.h index 726a6c63b42..6d08b9c9af0 100644 --- a/src/lib/netlist/plib/ppmf.h +++ b/src/lib/netlist/plib/ppmf.h @@ -181,7 +181,19 @@ namespace plib { function_ptr t = *reinterpret_cast<function_ptr *>(&m_func); return (obj->*t)(std::forward<Targs>(args)...); } - bool is_set() { return m_func != nullptr; } + bool is_set() { +#if defined(_MSC_VER) || (defined (__INTEL_COMPILER) && defined (_M_X64)) + int *p = reinterpret_cast<int *>(&m_func); + int *e = p + sizeof(generic_function) / sizeof(int); + for (; p < e; p++) + if (*p != 0) + return true; + + return false; +#else + return m_func != nullptr; +#endif + } private: generic_function m_func; #if 0 && defined(_MSC_VER) diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp index 554baac9bc7..47d35d7c82f 100644 --- a/src/lib/netlist/plib/pstring.cpp +++ b/src/lib/netlist/plib/pstring.cpp @@ -25,32 +25,28 @@ std::size_t strlen_mem(const T *s) template<typename F> int pstring_t<F>::compare(const pstring_t &right) const { - std::size_t l = std::min(mem_t_size(), right.mem_t_size()); - if (l == 0) - { - if (mem_t_size() == 0 && right.mem_t_size() == 0) - return 0; - else if (right.mem_t_size() == 0) - return 1; - else - return -1; - } + if (mem_t_size() == 0 && right.mem_t_size() == 0) + return 0; + else if (right.mem_t_size() == 0) + return 1; + else if (mem_t_size() == 0) + return -1; + auto si = this->begin(); auto ri = right.begin(); - while (si != this->end() && *si == *ri) + while (si != this->end() && ri != right.end() && *si == *ri) { ri++; si++; } - int ret = (si == this->end() ? 0 : static_cast<int>(*si) - static_cast<int>(*ri)); - if (ret == 0) - { - if (this->mem_t_size() > right.mem_t_size()) - ret = 1; - else if (this->mem_t_size() < right.mem_t_size()) - ret = -1; - } - return ret; + + if (si != this->end() && ri != right.end()) + return static_cast<int>(*si) - static_cast<int>(*ri); + else if (this->mem_t_size() > right.mem_t_size()) + return 1; + else if (this->mem_t_size() < right.mem_t_size()) + return -1; + return 0; } template<typename F> diff --git a/src/mame/drivers/alphatpx.cpp b/src/mame/drivers/alphatpx.cpp index 37389da111f..c829d0353e0 100644 --- a/src/mame/drivers/alphatpx.cpp +++ b/src/mame/drivers/alphatpx.cpp @@ -1,12 +1,11 @@ // license: GPL-2.0+ // copyright-holders: Dirk Best -// test / modify oct-2017 begin: rfka01 + helwie44 /*************************************************************************** Triumph-Adler Alphatronic Px series =================================== - The Px series was designed by SKS, like the ITT3030 and the SKS Nano, + The Px series was designed by SKS (Steinmetz-Krischke Systemtechnik), like the ITT3030 and the SKS Nano, the boards are closely related. Keyboard and floppy stuff was copypasted from ITT3030 and adapted to the best of knowledge. @@ -59,6 +58,9 @@ P30 and P40 =========== Those were P3 and P4's with an additional 8088 card, a 128K RAM card (some with an extra 32K graphics extension) to support MS-DOS. + + + comments, testing, modification: rfka01, helwie44 ***************************************************************************/ @@ -72,23 +74,23 @@ #include "sound/beep.h" #include "screen.h" #include "speaker.h" +#include "debugger.h" //************************************************************************** -// TYPE DEFINITIONS +// TYPE DEFINITIONS - Alphatronic P1, P2, P2S, P2U and Hell 2069 //************************************************************************** -class alphatpx_state : public driver_device +class alphatp_12_state : public driver_device { public: - alphatpx_state(const machine_config &mconfig, device_type type, const char *tag) : + alphatp_12_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_bankdev(*this, "bankdev"), m_kbdmcu(*this, "kbdmcu"), m_crtc(*this, "crtc"), m_fdc (*this, "fdc"), - m_floppy0(*this, "fdc:0"), - m_floppy1(*this, "fdc:1"), + m_floppy(*this, "fdc:%u", 0), m_beep(*this, "beeper"), m_keycols(*this, "COL.%u", 0), m_palette(*this, "palette"), @@ -115,9 +117,74 @@ public: DECLARE_WRITE8_MEMBER(beep_w); DECLARE_WRITE8_MEMBER(bank_w); + void alphatp1(machine_config &config); void alphatp2(machine_config &config); - void alphatp3(machine_config &config); void alphatp2u(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + required_device<address_map_bank_device> m_bankdev; + required_device<i8041_device> m_kbdmcu; + required_device<crt5027_device> m_crtc; + required_device<fd1791_device> m_fdc; + required_device_array<floppy_connector, 2> m_floppy; + required_device<beep_device> m_beep; + required_ioport_array<16> m_keycols; + +private: + uint8_t m_kbdclk, m_kbdread, m_kbdport2; + required_device<palette_device> m_palette; + required_shared_ptr<u8> m_vram; + required_region_ptr<u8> m_gfx; + required_shared_ptr<u8> m_ram; + floppy_image_device *m_curfloppy; + bool m_fdc_irq, m_fdc_drq, m_fdc_hld; +}; + +//************************************************************************** +// TYPE DEFINITIONS - Alphatronic P3, P4, P30 and P4 +//************************************************************************** + +class alphatp_34_state : public driver_device +{ +public: + alphatp_34_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_bankdev(*this, "bankdev"), + m_kbdmcu(*this, "kbdmcu"), + m_crtc(*this, "crtc"), + m_fdc (*this, "fdc"), + m_floppy(*this, "fdc:%u", 0), + m_beep(*this, "beeper"), + m_keycols(*this, "COL.%u", 0), + m_palette(*this, "palette"), + m_vram(*this, "vram"), + m_gfx(*this, "gfx"), + m_ram(*this, "ram") + { } + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + DECLARE_READ_LINE_MEMBER(kbd_matrix_r); + DECLARE_WRITE8_MEMBER(kbd_matrix_w); + DECLARE_READ8_MEMBER(kbd_port2_r); + DECLARE_WRITE8_MEMBER(kbd_port2_w); + + DECLARE_READ8_MEMBER(fdc_r); + DECLARE_WRITE8_MEMBER(fdc_w); + DECLARE_READ8_MEMBER(fdc_stat_r); + DECLARE_WRITE8_MEMBER(fdc_cmd_w); + + DECLARE_WRITE_LINE_MEMBER(fdcirq_w); + DECLARE_WRITE_LINE_MEMBER(fdcdrq_w); + DECLARE_WRITE_LINE_MEMBER(fdchld_w); + DECLARE_WRITE8_MEMBER(beep_w); + DECLARE_WRITE8_MEMBER(bank_w); + + void alphatp3(machine_config &config); + protected: virtual void machine_start() override; virtual void machine_reset() override; @@ -126,8 +193,7 @@ protected: required_device<i8041_device> m_kbdmcu; required_device<crt5037_device> m_crtc; required_device<fd1791_device> m_fdc; - required_device<floppy_connector> m_floppy0; - required_device<floppy_connector> m_floppy1; + required_device_array<floppy_connector, 2> m_floppy; required_device<beep_device> m_beep; required_ioport_array<16> m_keycols; @@ -141,16 +207,51 @@ private: bool m_fdc_irq, m_fdc_drq, m_fdc_hld; }; +//************************************************************************** +// ADDRESS MAPS - Alphatronic P1, P2, P2S, P2U and Hell 2069 +//************************************************************************** + +static ADDRESS_MAP_START( alphatp2_mem, AS_PROGRAM, 8, alphatp_12_state ) + AM_RANGE(0x0000, 0xffff) AM_DEVICE("bankdev", address_map_bank_device, amap8) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( alphatp2_map, AS_PROGRAM, 8, alphatp_12_state ) + AM_RANGE(0x00000, 0x017ff) AM_ROM AM_REGION("boot", 0) // P2 0x0000 , 0x17ff -hw 6kB, P3 only 4 kB + AM_RANGE(0x01800, 0x01c00) AM_RAM // boot rom variables + AM_RANGE(0x03000, 0x03bff) AM_WRITEONLY AM_SHARE("vram") // test 2017 hw, MOS directly writes to display RAM + AM_RANGE(0x03FF0, 0x03fff) AM_DEVWRITE("crtc", crt5027_device, write) //test hw, mem-mapped registers, cursor position can be determined through this range + AM_RANGE(0x00000, 0x0ffff) AM_RAMBANK("ram_0000") + + AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_SHARE("ram") +ADDRESS_MAP_END + +static ADDRESS_MAP_START( alphatp2_io, AS_IO, 8, alphatp_12_state ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x04, 0x04) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) + AM_RANGE(0x05, 0x05) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x10, 0x11) AM_DEVREADWRITE("kbdmcu", i8041_device, upi41_master_r, upi41_master_w) + AM_RANGE(0x12, 0x12) AM_WRITE(beep_w) + AM_RANGE(0x50, 0x53) AM_READWRITE(fdc_r, fdc_w) + AM_RANGE(0x54, 0x54) AM_READWRITE(fdc_stat_r, fdc_cmd_w) + AM_RANGE(0x78, 0x78) AM_WRITE(bank_w) +ADDRESS_MAP_END + + +WRITE8_MEMBER(alphatp_12_state::bank_w) +{ + m_bankdev->set_bank(BIT(data, 6)); +} + //************************************************************************** -// ADDRESS MAPS +// ADDRESS MAPS - Alphatronic P3, P4, P30 and P40 //************************************************************************** -static ADDRESS_MAP_START( alphatp3_mem, AS_PROGRAM, 8, alphatpx_state ) +static ADDRESS_MAP_START( alphatp3_mem, AS_PROGRAM, 8, alphatp_34_state ) AM_RANGE(0x0000, 0xffff) AM_DEVICE("bankdev", address_map_bank_device, amap8) ADDRESS_MAP_END -static ADDRESS_MAP_START( alphatp3_map, AS_PROGRAM, 8, alphatpx_state ) +static ADDRESS_MAP_START( alphatp3_map, AS_PROGRAM, 8, alphatp_34_state ) AM_RANGE(0x00000, 0x017ff) AM_ROM AM_REGION("boot", 0) // P2 0x0000 , 0x17ff -hw 6kB, P3 only 4 kB AM_RANGE(0x01800, 0x01c00) AM_RAM // boot rom variables AM_RANGE(0x03000, 0x03bff) AM_WRITEONLY AM_SHARE("vram") // test 2017 hw, MOS directly writes to display RAM @@ -160,7 +261,7 @@ static ADDRESS_MAP_START( alphatp3_map, AS_PROGRAM, 8, alphatpx_state ) AM_RANGE(0x10000, 0x1ffff) AM_RAM AM_SHARE("ram") ADDRESS_MAP_END -static ADDRESS_MAP_START( alphatp3_io, AS_IO, 8, alphatpx_state ) +static ADDRESS_MAP_START( alphatp3_io, AS_IO, 8, alphatp_34_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x04, 0x04) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) AM_RANGE(0x05, 0x05) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) @@ -171,28 +272,59 @@ static ADDRESS_MAP_START( alphatp3_io, AS_IO, 8, alphatpx_state ) AM_RANGE(0x78, 0x78) AM_WRITE(bank_w) ADDRESS_MAP_END -WRITE8_MEMBER(alphatpx_state::bank_w) + +WRITE8_MEMBER(alphatp_34_state::bank_w) { m_bankdev->set_bank(BIT(data, 6)); } //************************************************************************** -// INPUTS +// INPUTS - Alphatronic P1, P2, P2S, P2U and Hell 2069 //************************************************************************** -READ_LINE_MEMBER(alphatpx_state::kbd_matrix_r) +READ_LINE_MEMBER(alphatp_12_state::kbd_matrix_r) { return m_kbdread; } -WRITE8_MEMBER(alphatpx_state::kbd_matrix_w) +WRITE8_MEMBER(alphatp_12_state::kbd_matrix_w) +{ + if ((data & 0x80) && (!m_kbdclk)) + { + const ioport_value tmp_read = m_keycols[(data >> 3) & 0xf]->read() & (1 << (data & 0x7)); + m_kbdread = (tmp_read != 0) ? 1 : 0; + } + + m_kbdclk = (data & 0x80) ? 1 : 0; + +} + +// bit 2 is UPI-41 host IRQ to Z80 +WRITE8_MEMBER(alphatp_12_state::kbd_port2_w) +{ + m_kbdport2 = data; + +} + +READ8_MEMBER(alphatp_12_state::kbd_port2_r) +{ + return m_kbdport2; +} + +//************************************************************************** +// INPUTS - Alphatronic P3, P4, P30 and P40 +//************************************************************************** + +READ_LINE_MEMBER(alphatp_34_state::kbd_matrix_r) { - int rd_masks[8] = { 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80 }; - int tmp_read; + return m_kbdread; +} +WRITE8_MEMBER(alphatp_34_state::kbd_matrix_w) +{ if ((data & 0x80) && (!m_kbdclk)) { - tmp_read = m_keycols[(data >> 3) & 0xf]->read() & rd_masks[data & 0x7]; + const ioport_value tmp_read = m_keycols[(data >> 3) & 0xf]->read() & (1 << (data & 0x7)); m_kbdread = (tmp_read != 0) ? 1 : 0; } @@ -201,19 +333,23 @@ WRITE8_MEMBER(alphatpx_state::kbd_matrix_w) } // bit 2 is UPI-41 host IRQ to Z80 -WRITE8_MEMBER(alphatpx_state::kbd_port2_w) +WRITE8_MEMBER(alphatp_34_state::kbd_port2_w) { m_kbdport2 = data; } -READ8_MEMBER(alphatpx_state::kbd_port2_r) +READ8_MEMBER(alphatp_34_state::kbd_port2_r) { return m_kbdport2; } -/* +//************************************************************************** +// KEYBOARD - Alphatronic P1, P2, P2S, P2U and Hell 2069 +//************************************************************************** + +/* P2 keyboard: [ ][ ! ][ " ][ ยง ][ $ ][ % ][ & ][ / ][ ( ][ ) ][ = ][ ? ][ ` ][ F ][ F ][ F ][ F ][ F ][ F ] @@ -238,7 +374,145 @@ entered too quickly. [] [] is two overlapping squares, the manual calls it "Kontroll-Taste", i.e. CTRL TB is the TAB key and is unmarked +*/ + +// translation table at offset 0xdc0 in the main rom +static INPUT_PORTS_START( alphatp2 ) + +PORT_START("COL.0") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("W") PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("S") PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(8) // left arrow works as backspace + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + +PORT_START("COL.1") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("E") PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5)) // SCAN:=0Dh ->8Ah-funct F5 ok + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + +PORT_START("COL.2") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) // 0x82 + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6)) // scan:=15h 8Ch-> F6 ok + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR(0x00a7) + +PORT_START("COL.3") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("T") PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) // 0x8b + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + +PORT_START("COL.4") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // scan:=25h ->0xc0 ?capslock ? + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') +PORT_START("COL.5") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("J") PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP)) // 0x89 + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + +PORT_START("COL.6") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("I") PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('k') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<>") PORT_CODE(KEYCODE_BACKSLASH2)PORT_CHAR('<') PORT_CHAR('>') + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') + +PORT_START("COL.7") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". :") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR(':') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Pos 1") PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) // 0x8f + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("L_SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) // 3Dh ->C1h-function P3 key left + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + +PORT_START("COL.8") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("รถ ร") PORT_CODE(KEYCODE_COLON) PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('-') PORT_CHAR('_') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R_CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) // 44h ->84h clear ? + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER Pad") PORT_CODE(KEYCODE_ENTER_PAD)PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + +PORT_START("COL.9") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("รผ ร") PORT_CODE(KEYCODE_OPENBRACE)PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("รค ร") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R_SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 Pad") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') + +PORT_START("COL.10") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ *") PORT_CODE(KEYCODE_CLOSEBRACE)PORT_CHAR('+') PORT_CHAR('*') + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("# ^") PORT_CODE(KEYCODE_BACKSLASH)PORT_CHAR('#') PORT_CHAR('^') + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[][]/ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) // Esc test this work ?! + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL Pad") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ร ?") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0x00df) PORT_CHAR('?') // ร and ? + +PORT_START("COL.11") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') // TAB key + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 Pad") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ Pad") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ยด `") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00b4) PORT_CHAR(0x0060) + +PORT_START("COL.12") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 Pad") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 Pad") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 Pad") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) // scan 68h -> 88h func. F4 + +PORT_START("COL.13") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ Pad") PORT_CODE(KEYCODE_SLASH_PAD)PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // test ? + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xc2\xae /Ctrl")PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_LCONTROL) // scan 6Bh -> C2h funct. + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) // 0xc2 ?? + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) // scan:=68h 88h-> F3 ok + +PORT_START("COL.14") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 Pad") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 Pad") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- Pad") PORT_CODE(KEYCODE_MINUS_PAD)PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) // 70h -> 87h func.F2 ok + +PORT_START("COL.15") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 Pad") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 Pad") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 Pad") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) // 7Dh -> 85H func. F1 ok + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SM") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))// SM (typewriter) mode key */ +INPUT_PORTS_END + +//************************************************************************** +// KEYBOARD - Alphatronic P3, P4, P30 and P40 +//************************************************************************** + +/* P3 keyboard: [RST] @@ -315,6 +589,7 @@ PORT_START("COL.4") PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("H") PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // scan:=25h ->0xc0 ?capslock ? PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') @@ -331,7 +606,7 @@ PORT_START("COL.6") PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("K") PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('k') PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", ;") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR(';') PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) - PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("<>") PORT_CODE(KEYCODE_BACKSLASH2)PORT_CHAR('<') PORT_CHAR('>') PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('/') PORT_START("COL.7") @@ -353,8 +628,9 @@ PORT_START("COL.8") PORT_START("COL.9") PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("รผ ร") PORT_CODE(KEYCODE_OPENBRACE)PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("รค ร") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) - PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R_SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("R_SHIFT") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 Pad") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('=') PORT_START("COL.10") @@ -362,26 +638,30 @@ PORT_START("COL.10") PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("# ^") PORT_CODE(KEYCODE_BACKSLASH)PORT_CHAR('#') PORT_CHAR('^') PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[][]/ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) // Esc test this work ?! PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DEL Pad") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ร ?") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(0x00df) PORT_CHAR('?') // ร and ? PORT_START("COL.11") - PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB)) + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR('\t') // TAB key PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 Pad") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ Pad") PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD)) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ยด `") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR(0x00b4) PORT_CHAR(0x0060) PORT_START("COL.12") PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 Pad") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 Pad") PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 Pad") PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) // scan 68h -> 88h func. F4 PORT_START("COL.13") PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ Pad") PORT_CODE(KEYCODE_SLASH_PAD)PORT_CHAR(UCHAR_MAMEKEY(SLASH_PAD)) PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR(UCHAR_MAMEKEY(ASTERISK)) // test ? PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xc2\xae /Ctrl")PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_LCONTROL) // scan 6Bh -> C2h funct. - PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) // 0xc2 ?? + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) // 0xc2 ?? PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) // scan:=68h 88h-> F3 ok @@ -389,19 +669,21 @@ PORT_START("COL.14") PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 Pad") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 Pad") PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- Pad") PORT_CODE(KEYCODE_MINUS_PAD)PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN) PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) // 70h -> 87h func.F2 ok PORT_START("COL.15") PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 Pad") PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 Pad") PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 Pad") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_UNKNOWN) PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) // 7Dh -> 85H func. F1 ok PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("SM") PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))// SM (typewriter) mode key */ INPUT_PORTS_END - //************************************************************************** -// VIDEO +// VIDEO - Alphatronic Px //************************************************************************** static const gfx_layout charlayout = @@ -415,11 +697,15 @@ static const gfx_layout charlayout = 8*16 }; -static GFXDECODE_START( alphatp3 ) +//************************************************************************** +// VIDEO - Alphatronic P1, P2, P2S, P2U and Hell 2069 +//************************************************************************** + +static GFXDECODE_START( alphatp2 ) GFXDECODE_ENTRY("gfx", 0, charlayout, 0, 1) GFXDECODE_END -uint32_t alphatpx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t alphatp_12_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { const pen_t *pen = m_palette->pens(); int start = m_crtc->upscroll_offset(); @@ -436,7 +722,7 @@ uint32_t alphatpx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm for (int line = 0; line < 12; line++) { uint8_t data = m_gfx[((code & 0x7f) * 16) + line]; - if(cursoren) + if (cursoren) data ^= 0xff; bitmap.pix32(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; bitmap.pix32(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; @@ -453,52 +739,173 @@ uint32_t alphatpx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm return 0; } +//************************************************************************** +// VIDEO - Alphatronic P3, P4, P30 and P40 +//************************************************************************** + +static GFXDECODE_START( alphatp3 ) + GFXDECODE_ENTRY("gfx", 0, charlayout, 0, 1) +GFXDECODE_END + +uint32_t alphatp_34_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const pen_t *pen = m_palette->pens(); + int start = m_crtc->upscroll_offset(); + rectangle cursor; + m_crtc->cursor_bounds(cursor); + for (int y = 0; y < 24; y++) + { + int vramy = (start + y) % 24; + for (int x = 0; x < 80; x++) + { + uint8_t code = m_vram[(vramy * 128) + x]; // helwie44 must be 128d is 080h physical display-ram step line + // draw 12 lines of the character + bool cursoren = cursor.contains(x * 8, y * 12); + for (int line = 0; line < 12; line++) + { + uint8_t data = m_gfx[((code & 0x7f) * 16) + line]; + if (cursoren) + data ^= 0xff; + bitmap.pix32(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; + bitmap.pix32(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; + bitmap.pix32(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; + bitmap.pix32(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; + bitmap.pix32(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; + bitmap.pix32(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; + bitmap.pix32(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; + bitmap.pix32(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; + } + } + } + + return 0; +} //************************************************************************** -// SOUND +// SOUND - Alphatronic P1, P2, P2S, P2U and Hell 2069 //************************************************************************** -WRITE8_MEMBER( alphatpx_state::beep_w ) +WRITE8_MEMBER( alphatp_12_state::beep_w ) { m_beep->set_state(data&1); } //************************************************************************** -// SOUND +// SOUND - Alphatronic P3, P4, P30 and P40 //************************************************************************** -WRITE_LINE_MEMBER(alphatpx_state::fdcirq_w) +WRITE8_MEMBER( alphatp_34_state::beep_w ) +{ + m_beep->set_state(data&1); +} + +//************************************************************************** +// FLOPPY - Alphatronic P1, P2, P2S, P2U and Hell 2069 +//************************************************************************** + +WRITE_LINE_MEMBER(alphatp_12_state::fdcirq_w) { m_fdc_irq = state; } -#include "debugger.h" +WRITE_LINE_MEMBER(alphatp_12_state::fdcdrq_w) +{ + m_fdc_drq = state; +} -WRITE_LINE_MEMBER(alphatpx_state::fdcdrq_w) +WRITE_LINE_MEMBER(alphatp_12_state::fdchld_w) +{ + m_fdc_hld = state; +} + +READ8_MEMBER(alphatp_12_state::fdc_stat_r) +{ + uint8_t res = 0; + floppy_image_device *floppy1,*floppy2; + floppy1 = floppy2 = nullptr; + + floppy1 = m_floppy[0] ? m_floppy[0]->get_device() : nullptr; + floppy2 = m_floppy[1] ? m_floppy[1]->get_device() : nullptr; + + res = m_fdc_drq ? 0x80 : 0x00; + res |= m_fdc_irq ? 0x40 : 0x00; + res |= m_fdc_hld ? 0x00 : 0x20; + + if (floppy2) res |= !floppy2->ready_r() ? 0x08 : 0; + if (floppy1) res |= !floppy1->ready_r() ? 0x04 : 0; + if (m_curfloppy) res |= m_curfloppy->wpt_r() ? 0x02 : 0; + + return res; +} + +READ8_MEMBER(alphatp_12_state::fdc_r) +{ + return m_fdc->gen_r(offset) ^ 0xff; +} + +WRITE8_MEMBER(alphatp_12_state::fdc_w) +{ + m_fdc->gen_w(offset, data ^ 0xff); +} + + +WRITE8_MEMBER(alphatp_12_state::fdc_cmd_w) +{ + floppy_image_device *floppy = nullptr; + + logerror("%02x to fdc_cmd_w: motor %d side %d\n", data, (data & 0x10)>>4, (data & 4)>>2); + + // select drive + if (!(data & 0x80)) + { + floppy = m_floppy[0] ? m_floppy[0]->get_device() : nullptr; + } + else if (!(data & 0x40)) + { + floppy = m_floppy[1] ? m_floppy[1]->get_device() : nullptr; + } + + // selecting a new drive? + if (floppy != m_curfloppy) + { + m_fdc->set_floppy(floppy); + m_curfloppy = floppy; + } + + if (floppy != nullptr) + { + // side select + floppy->ss_w((data & 4) ? 0 : 1); + + // motor control (active low) + floppy->mon_w((data & 0x10) ? 1 : 0); + } +} + +//************************************************************************** +// FLOPPY - Alphatronic P3, P4, P30 and P40 +//************************************************************************** + +WRITE_LINE_MEMBER(alphatp_34_state::fdcirq_w) +{ + m_fdc_irq = state; +} + +WRITE_LINE_MEMBER(alphatp_34_state::fdcdrq_w) { m_fdc_drq = state; } -WRITE_LINE_MEMBER(alphatpx_state::fdchld_w) +WRITE_LINE_MEMBER(alphatp_34_state::fdchld_w) { m_fdc_hld = state; } -/* - 7 Data Request (DRQ - inverted 1791-Signal) - 6 Interrupt Request (INTRQ - 1791-Signal) - 5 Head Load (HLD - inverted 1791-Signal) - 4 Ready 3 (Drive 3 ready) - 3 Ready 2 (Drive 2 ready) - 2 Ready l (Drive 1 ready) - 1 Write protect (the disk in the selected drive is write protected) - 0 HLT (Halt signal during head load and track change) -*/ -READ8_MEMBER(alphatpx_state::fdc_stat_r) +READ8_MEMBER(alphatp_34_state::fdc_stat_r) { uint8_t res = 0; - floppy_image_device *floppy1 = m_floppy0->get_device(); - floppy_image_device *floppy2 = m_floppy1->get_device(); + floppy_image_device *floppy1 = m_floppy[0]->get_device(); + floppy_image_device *floppy2 = m_floppy[1]->get_device(); res = m_fdc_drq ? 0x80 : 0x00; res |= m_fdc_irq ? 0x40 : 0x00; @@ -510,28 +917,18 @@ READ8_MEMBER(alphatpx_state::fdc_stat_r) return res; } -/* As far as we can tell, the mess of ttl de-inverts the bus */ -READ8_MEMBER(alphatpx_state::fdc_r) +READ8_MEMBER(alphatp_34_state::fdc_r) { return m_fdc->gen_r(offset) ^ 0xff; } -WRITE8_MEMBER(alphatpx_state::fdc_w) +WRITE8_MEMBER(alphatp_34_state::fdc_w) { m_fdc->gen_w(offset, data ^ 0xff); } -/* - 7 SEL1 - Select drive 1 - 6 SEL2 - Select drive 2 - 5 SEL3 - Select drive 3 - 4 MOTOR - Motor on - 3 DOOR - Drive door lock drives 1 + 2 (not possible with all drives) - 2 SIDESEL - Select disk side - 1 KOMP - write comp on/off - 0 RG J - Change separator stage to read -*/ -WRITE8_MEMBER(alphatpx_state::fdc_cmd_w) + +WRITE8_MEMBER(alphatp_34_state::fdc_cmd_w) { floppy_image_device *floppy = nullptr; @@ -539,9 +936,9 @@ WRITE8_MEMBER(alphatpx_state::fdc_cmd_w) // select drive if (!(data & 0x80)) - floppy = m_floppy0->get_device(); + floppy = m_floppy[0]->get_device(); else if (!(data & 0x40)) - floppy = m_floppy1->get_device(); + floppy = m_floppy[1]->get_device(); // selecting a new drive? if (floppy != m_curfloppy) @@ -560,23 +957,27 @@ WRITE8_MEMBER(alphatpx_state::fdc_cmd_w) } } -static SLOT_INTERFACE_START( alphatp2_floppies ) // P3: two BASF 6106 drives - SLOT_INTERFACE("525ssdd", FLOPPY_525_SSDD) // P30: two Shugart SA465-3AA drives +//************************************************************************** +// FLOPPY - Drive definitions +//************************************************************************** + +static SLOT_INTERFACE_START( alphatp2_floppies ) // two BASF 2471 drives + SLOT_INTERFACE("525ssdd", FLOPPY_525_SSDD) SLOT_INTERFACE_END static SLOT_INTERFACE_START( alphatp2su_floppies ) SLOT_INTERFACE("525dd", FLOPPY_525_DD) SLOT_INTERFACE_END -static SLOT_INTERFACE_START( alphatp3_floppies ) // two BASF 2471 drives - SLOT_INTERFACE("525qd", FLOPPY_525_QD) +static SLOT_INTERFACE_START( alphatp3_floppies ) // P3: two BASF 6106 drives + SLOT_INTERFACE("525qd", FLOPPY_525_QD) // P30: two Shugart SA465-3AA drives SLOT_INTERFACE_END //************************************************************************** -// MACHINE +// MACHINE - Alphatronic P1, P2, P2S, P2U and Hell 2069 //************************************************************************** -void alphatpx_state::machine_start() +void alphatp_12_state::machine_start() { // setup banking membank("ram_0000")->set_base(m_ram.target()); @@ -585,32 +986,28 @@ void alphatpx_state::machine_start() m_kbdclk = 0; // must be initialized here b/c mcs48_reset() causes write of 0xff to all ports } -void alphatpx_state::machine_reset() +void alphatp_12_state::machine_reset() { m_kbdread = 1; m_kbdclk = 1; m_fdc_irq = m_fdc_drq = m_fdc_hld = 0; m_curfloppy = nullptr; } -//************************************************************************** -// MACHINE DEFINITIONS -//************************************************************************** - -MACHINE_CONFIG_START(alphatpx_state::alphatp3) +MACHINE_CONFIG_START(alphatp_12_state::alphatp2) MCFG_CPU_ADD("maincpu", I8085A, XTAL(6'000'000)) - MCFG_CPU_PROGRAM_MAP(alphatp3_mem) - MCFG_CPU_IO_MAP(alphatp3_io) + MCFG_CPU_PROGRAM_MAP(alphatp2_mem) + MCFG_CPU_IO_MAP(alphatp2_io) MCFG_QUANTUM_PERFECT_CPU("maincpu") MCFG_CPU_ADD("kbdmcu", I8041, XTAL(12'854'400)/2) - MCFG_MCS48_PORT_T0_IN_CB(READLINE(alphatpx_state, kbd_matrix_r)) - MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(alphatpx_state, kbd_matrix_w)) - MCFG_MCS48_PORT_P2_IN_CB(READ8(alphatpx_state, kbd_port2_r)) - MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(alphatpx_state, kbd_port2_w)) + MCFG_MCS48_PORT_T0_IN_CB(READLINE(alphatp_12_state, kbd_matrix_r)) + MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(alphatp_12_state, kbd_matrix_w)) + MCFG_MCS48_PORT_P2_IN_CB(READ8(alphatp_12_state, kbd_port2_r)) + MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(alphatp_12_state, kbd_port2_w)) MCFG_DEVICE_ADD("bankdev", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(alphatp3_map) + MCFG_DEVICE_PROGRAM_MAP(alphatp2_map) MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) MCFG_ADDRESS_MAP_BANK_DATA_WIDTH(8) MCFG_ADDRESS_MAP_BANK_ADDR_WIDTH(18) @@ -619,13 +1016,13 @@ MACHINE_CONFIG_START(alphatpx_state::alphatp3) // video hardware MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::green()) MCFG_SCREEN_RAW_PARAMS(XTAL(12'854'400), 824, 0, 640, 312, 0, 288) - MCFG_SCREEN_UPDATE_DRIVER(alphatpx_state, screen_update) + MCFG_SCREEN_UPDATE_DRIVER(alphatp_12_state, screen_update) MCFG_PALETTE_ADD_MONOCHROME("palette") - MCFG_DEVICE_ADD("crtc", CRT5037, XTAL(12'854'400)) + MCFG_DEVICE_ADD("crtc", CRT5027, XTAL(12'854'400)) MCFG_TMS9927_CHAR_WIDTH(8) - + MCFG_TMS9927_HSYN_CALLBACK(INPUTLINE("maincpu", I8085_RST55_LINE)) MCFG_TMS9927_VSYN_CALLBACK(INPUTLINE("maincpu", I8085_RST65_LINE)) MCFG_DEVCB_XOR(1) MCFG_VIDEO_SET_SCREEN("screen") @@ -640,14 +1037,41 @@ MACHINE_CONFIG_START(alphatpx_state::alphatp3) // XTAL(4'915'200) serial clock MCFG_FD1791_ADD("fdc", XTAL(4'000'000) / 4) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(alphatpx_state, fdcirq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(alphatpx_state, fdcdrq_w)) - MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(alphatpx_state, fdchld_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", alphatp3_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", alphatp3_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(alphatp_12_state, fdcirq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(alphatp_12_state, fdcdrq_w)) + MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(alphatp_12_state, fdchld_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", alphatp2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", alphatp2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) +MACHINE_CONFIG_END + +MACHINE_CONFIG_DERIVED(alphatp_12_state::alphatp2u, alphatp2) + MCFG_DEVICE_REMOVE("fdc:0") + MCFG_DEVICE_REMOVE("fdc:1") + MCFG_FLOPPY_DRIVE_ADD("fdc:0", alphatp2su_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", alphatp2su_floppies, "525dd", floppy_image_device::default_floppy_formats) MACHINE_CONFIG_END -MACHINE_CONFIG_START(alphatpx_state::alphatp2) + +//************************************************************************** +// MACHINE - Alphatronic P3, P4, P30 and P40 +//************************************************************************** + +void alphatp_34_state::machine_start() +{ + // setup banking + membank("ram_0000")->set_base(m_ram.target()); + + + m_kbdclk = 0; // must be initialized here b/c mcs48_reset() causes write of 0xff to all ports +} + +void alphatp_34_state::machine_reset() +{ + m_kbdread = 1; + m_kbdclk = 1; m_fdc_irq = m_fdc_drq = m_fdc_hld = 0; + m_curfloppy = nullptr; +} +MACHINE_CONFIG_START(alphatp_34_state::alphatp3) MCFG_CPU_ADD("maincpu", I8085A, XTAL(6'000'000)) MCFG_CPU_PROGRAM_MAP(alphatp3_mem) MCFG_CPU_IO_MAP(alphatp3_io) @@ -655,10 +1079,10 @@ MACHINE_CONFIG_START(alphatpx_state::alphatp2) MCFG_QUANTUM_PERFECT_CPU("maincpu") MCFG_CPU_ADD("kbdmcu", I8041, XTAL(12'854'400)/2) - MCFG_MCS48_PORT_T0_IN_CB(READLINE(alphatpx_state, kbd_matrix_r)) - MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(alphatpx_state, kbd_matrix_w)) - MCFG_MCS48_PORT_P2_IN_CB(READ8(alphatpx_state, kbd_port2_r)) - MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(alphatpx_state, kbd_port2_w)) + MCFG_MCS48_PORT_T0_IN_CB(READLINE(alphatp_34_state, kbd_matrix_r)) + MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(alphatp_34_state, kbd_matrix_w)) + MCFG_MCS48_PORT_P2_IN_CB(READ8(alphatp_34_state, kbd_port2_r)) + MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(alphatp_34_state, kbd_port2_w)) MCFG_DEVICE_ADD("bankdev", ADDRESS_MAP_BANK, 0) MCFG_DEVICE_PROGRAM_MAP(alphatp3_map) @@ -670,13 +1094,13 @@ MACHINE_CONFIG_START(alphatpx_state::alphatp2) // video hardware MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::green()) MCFG_SCREEN_RAW_PARAMS(XTAL(12'854'400), 824, 0, 640, 312, 0, 288) - MCFG_SCREEN_UPDATE_DRIVER(alphatpx_state, screen_update) + MCFG_SCREEN_UPDATE_DRIVER(alphatp_34_state, screen_update) MCFG_PALETTE_ADD_MONOCHROME("palette") MCFG_DEVICE_ADD("crtc", CRT5037, XTAL(12'854'400)) MCFG_TMS9927_CHAR_WIDTH(8) - MCFG_TMS9927_HSYN_CALLBACK(INPUTLINE("maincpu", I8085_RST55_LINE)) + MCFG_TMS9927_VSYN_CALLBACK(INPUTLINE("maincpu", I8085_RST65_LINE)) MCFG_DEVCB_XOR(1) MCFG_VIDEO_SET_SCREEN("screen") @@ -691,31 +1115,39 @@ MACHINE_CONFIG_START(alphatpx_state::alphatp2) // XTAL(4'915'200) serial clock MCFG_FD1791_ADD("fdc", XTAL(4'000'000) / 4) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(alphatpx_state, fdcirq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(alphatpx_state, fdcdrq_w)) - MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(alphatpx_state, fdchld_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", alphatp2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", alphatp2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(alphatp_34_state, fdcirq_w)) + MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(alphatp_34_state, fdcdrq_w)) + MCFG_WD_FDC_HLD_CALLBACK(WRITELINE(alphatp_34_state, fdchld_w)) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", alphatp3_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", alphatp3_floppies, "525qd", floppy_image_device::default_floppy_formats) MACHINE_CONFIG_END -MACHINE_CONFIG_DERIVED(alphatpx_state::alphatp2u, alphatp2) - MCFG_DEVICE_REMOVE("fdc:0") - MCFG_DEVICE_REMOVE("fdc:1") - MCFG_FLOPPY_DRIVE_ADD("fdc:0", alphatp2su_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", alphatp2su_floppies, "525dd", floppy_image_device::default_floppy_formats) -MACHINE_CONFIG_END + //************************************************************************** // ROM DEFINITIONS //************************************************************************** +// Alphatronic P1 +ROM_START( alphatp1 ) + ROM_REGION(0x1800, "boot", 0) + ROM_LOAD("p1mos1.bin", 0x0000, 0x0800, CRC(9317a694) SHA1(3b51a6b72d2ccae2459ddb2e16fbd21b19dfa2b8) ) + ROM_LOAD("p1mos2.bin", 0x0800, 0x0800, CRC(f38113a3) SHA1(078405ad202e26b7bac7132b06682fb01270af63) ) + ROM_LOAD("p1mos3.bin", 0x1000, 0x0800, CRC(fb5ae050) SHA1(ba55553764326dfda3fbd35237761c3fb6fde18a) ) + + ROM_REGION(0x400, "kbdmcu", 0) + ROM_LOAD("p2_keyboard_ip8041a_8278.bin", 0x000, 0x400, CRC(5db00d85) SHA1(0dc8e274a5aece261ef60494901601c0d8b1eb51)) // P1 keyboard driver is contained in a MF-1702AR on the keyboard + // needs to be dumped + ROM_REGION(0x800, "gfx", 0) + ROM_LOAD("p1chargen.bin", 0x000, 0x800, CRC(51ea8a7e) SHA1(c514df7ab3761490af4a16c9106d08540f0d7352)) +ROM_END + // Alphatronic P2 ROM_START( alphatp2 ) // P2 ROM space 0x1800 ROM_REGION(0x1800, "boot", 0) ROM_SYSTEM_BIOS(0, "caap94-96", "caap94-96") ROM_SYSTEM_BIOS(1, "caap04-06", "caap04-06") ROM_SYSTEM_BIOS(2, "p2_es", "p2_es") - ROM_SYSTEM_BIOS(3, "p2_sks", "p2_sks") ROMX_LOAD("caap_96_00_5a.bin", 0x0000, 0x0800, CRC(cb137796) SHA1(876bd0762faffc7b74093922d8fbf1c72ec70060), ROM_BIOS(1) ) // earlier P2, three 16K RAM boards ROMX_LOAD("caap_05_02_12.bin", 0x0800, 0x0800, CRC(14f19693) SHA1(7ecb66818a3e352fede1857a18cd12bf742603a9), ROM_BIOS(1) ) @@ -729,10 +1161,6 @@ ROM_START( alphatp2 ) // P2 ROM space 0x1800 ROMX_LOAD("caap_p2_es_2.bin", 0x0800, 0x0800, CRC(f4dfac82) SHA1(266d1fdaef875515d9c68ae3e67ec88831bb55cb), ROM_BIOS(3) ) ROMX_LOAD("caap_p2_es_3.bin", 0x1000, 0x0800, CRC(6f6918ba) SHA1(8dc9f5e337df8abf42e5b55f5f1a1a9d61c42d78), ROM_BIOS(3) ) - ROMX_LOAD("mos3-p2_sks_1.bin", 0x0000, 0x0800, CRC(c98d2982) SHA1(11e98ae441b7a9c8dfd22795f8208667959f1d1c), ROM_BIOS(4) ) // P2 sks - ROMX_LOAD("mos3-p2_sks_2.bin", 0x0800, 0x0800, CRC(14f19693) SHA1(7ecb66818a3e352fede1857a18cd12bf742603a9), ROM_BIOS(4) ) - ROMX_LOAD("mos3-p2_sks_3.bin", 0x1000, 0x0800, CRC(f304c3aa) SHA1(92213e77e4e6de12a4eaee25a9c1ec0ab54e93d4), ROM_BIOS(4) ) - ROM_REGION(0x400, "kbdmcu", 0) // same across all dumped P2 and P3 machines so far ROM_LOAD("p2_keyboard_ip8041a_8278.bin", 0x000, 0x400, CRC(5db00d85) SHA1(0dc8e274a5aece261ef60494901601c0d8b1eb51)) // needs to be checked with P2 sks and Spain @@ -744,11 +1172,11 @@ ROM_START( alphatp2 ) // P2 ROM space 0x1800 ROM_END // Alphatronic P2U -ROM_START (alphatp2u) +ROM_START( alphatp2u ) ROM_REGION(0x1800, "boot", 0) - ROM_LOAD("prom2p00.bin", 0x0000, 0x0800, CRC(c98d2982) SHA1(11e98ae441b7a9c8dfd22795f8208667959f1d1c) ) - ROM_LOAD("prom2p01.bin", 0x0800, 0x0800, CRC(14f19693) SHA1(7ecb66818a3e352fede1857a18cd12bf742603a9) ) - ROM_LOAD("prom2p02.bin", 0x1000, 0x0800, CRC(f304c3aa) SHA1(92213e77e4e6de12a4eaee25a9c1ec0ab54e93d4) ) + ROM_LOAD("mos3-p2_sks_1", 0x0000, 0x0800, CRC(c98d2982) SHA1(11e98ae441b7a9c8dfd22795f8208667959f1d1c) ) + ROM_LOAD("mos3-p2_sks_2", 0x0800, 0x0800, CRC(14f19693) SHA1(7ecb66818a3e352fede1857a18cd12bf742603a9) ) + ROM_LOAD("mos3-p2_sks_3", 0x1000, 0x0800, CRC(f304c3aa) SHA1(92213e77e4e6de12a4eaee25a9c1ec0ab54e93d4) ) ROM_REGION(0x400, "kbdmcu", 0) // same across all dumped P2 and P3 machines so far ROM_LOAD("p2_keyboard_ip8041a_8278.bin", 0x000, 0x400, CRC(5db00d85) SHA1(0dc8e274a5aece261ef60494901601c0d8b1eb51)) // needs to be checked for P2U @@ -794,7 +1222,8 @@ ROM_END //************************************************************************** // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 198?, alphatp2, alphatp3, 0, alphatp2, alphatp3, alphatpx_state, 0, "Triumph-Adler", "alphatronic P2", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 198?, alphatp2u, alphatp3, 0, alphatp2u,alphatp3, alphatpx_state, 0, "Triumph-Adler", "alphatronic P2U", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -COMP( 1982, alphatp3, 0, 0, alphatp3, alphatp3, alphatpx_state, 0, "Triumph-Adler", "alphatronic P3", MACHINE_NOT_WORKING ) -COMP( 198?, alphatp30, alphatp3, 0, alphatp3, alphatp3, alphatpx_state, 0, "Triumph-Adler", "alphatronic P30",MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 198?, alphatp1, alphatp2, 0, alphatp2, alphatp2, alphatp_12_state, 0, "Triumph-Adler", "alphatronic P1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 198?, alphatp2, 0, 0, alphatp2, alphatp2, alphatp_12_state, 0, "Triumph-Adler", "alphatronic P2", MACHINE_NOT_WORKING ) +COMP( 198?, alphatp2u, alphatp2, 0, alphatp2u,alphatp3, alphatp_12_state, 0, "Triumph-Adler", "alphatronic P2U", MACHINE_NOT_WORKING ) +COMP( 1982, alphatp3, 0, 0, alphatp3, alphatp3, alphatp_34_state, 0, "Triumph-Adler", "alphatronic P3", MACHINE_NOT_WORKING ) +COMP( 198?, alphatp30, alphatp3, 0, alphatp3, alphatp3, alphatp_34_state, 0, "Triumph-Adler", "alphatronic P30",MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/asteroid.cpp b/src/mame/drivers/asteroid.cpp index b456b64fb1e..af1671e45a0 100644 --- a/src/mame/drivers/asteroid.cpp +++ b/src/mame/drivers/asteroid.cpp @@ -658,6 +658,8 @@ MACHINE_CONFIG_START(asteroid_state::asteroid_base) MCFG_WATCHDOG_ADD("watchdog") + MCFG_TTL153_ADD("dsw_sel") + /* video hardware */ MCFG_VECTOR_ADD("vector") MCFG_SCREEN_ADD("screen", VECTOR) diff --git a/src/mame/drivers/fmtowns.cpp b/src/mame/drivers/fmtowns.cpp index fbc44631e7d..c3eae5627c8 100644 --- a/src/mame/drivers/fmtowns.cpp +++ b/src/mame/drivers/fmtowns.cpp @@ -267,34 +267,6 @@ void towns_state::init_serial_rom() m_towns_serial_rom[25] = 0x10; } -void towns_state::init_rtc() -{ - system_time systm; - - machine().base_datetime(systm); - - // seconds - m_towns_rtc_reg[0] = systm.local_time.second % 10; - m_towns_rtc_reg[1] = systm.local_time.second / 10; - // minutes - m_towns_rtc_reg[2] = systm.local_time.minute % 10; - m_towns_rtc_reg[3] = systm.local_time.minute / 10; - // hours - m_towns_rtc_reg[4] = systm.local_time.hour % 10; - m_towns_rtc_reg[5] = systm.local_time.hour / 10; - // weekday - m_towns_rtc_reg[6] = systm.local_time.weekday; - // day - m_towns_rtc_reg[7] = systm.local_time.mday % 10; - m_towns_rtc_reg[8] = systm.local_time.mday / 10; - // month - m_towns_rtc_reg[9] = (systm.local_time.month + 1) % 10; - m_towns_rtc_reg[10] = (systm.local_time.month + 1) / 10; - // year - m_towns_rtc_reg[11] = (systm.local_time.year - 2000) % 10; - m_towns_rtc_reg[12] = (systm.local_time.year - 2000) / 10; -} - READ8_MEMBER(towns_state::towns_system_r) { uint8_t ret = 0; @@ -417,9 +389,6 @@ void towns_state::device_timer(emu_timer &timer, device_timer_id id, int param, { switch(id) { - case TIMER_RTC: - rtc_second(); - break; case TIMER_FREERUN: freerun_inc(); break; @@ -1956,67 +1925,49 @@ WRITE8_MEMBER(towns_state::towns_cdrom_w) */ READ8_MEMBER(towns_state::towns_rtc_r) { - return 0x80 | m_towns_rtc_reg[m_towns_rtc_select]; + return (m_rtc_busy ? 0 : 0x80) | m_rtc_d; } WRITE8_MEMBER(towns_state::towns_rtc_w) { - m_towns_rtc_data = data; + m_rtc->d0_w(data & 1 ? ASSERT_LINE : CLEAR_LINE); + m_rtc->d1_w(data & 2 ? ASSERT_LINE : CLEAR_LINE); + m_rtc->d2_w(data & 4 ? ASSERT_LINE : CLEAR_LINE); + m_rtc->d3_w(data & 8 ? ASSERT_LINE : CLEAR_LINE); } WRITE8_MEMBER(towns_state::towns_rtc_select_w) { - if(data & 0x80) - { - if(data & 0x01) - m_towns_rtc_select = m_towns_rtc_data & 0x0f; - } + m_rtc->cs1_w(data & 0x80 ? ASSERT_LINE : CLEAR_LINE); + m_rtc->cs2_w(data & 0x80 ? ASSERT_LINE : CLEAR_LINE); + m_rtc->read_w(data & 4 ? ASSERT_LINE : CLEAR_LINE); + m_rtc->write_w(data & 2 ? ASSERT_LINE : CLEAR_LINE); + m_rtc->address_write_w(data & 1 ? ASSERT_LINE : CLEAR_LINE); } -void towns_state::rtc_hour() +WRITE_LINE_MEMBER(towns_state::rtc_d0_w) { - m_towns_rtc_reg[4]++; - if(m_towns_rtc_reg[4] > 4 && m_towns_rtc_reg[5] == 2) - { - m_towns_rtc_reg[4] = 0; - m_towns_rtc_reg[5] = 0; - } - else if(m_towns_rtc_reg[4] > 9) - { - m_towns_rtc_reg[4] = 0; - m_towns_rtc_reg[5]++; - } + m_rtc_d = (m_rtc_d & ~1) | (state == ASSERT_LINE ? 1 : 0); } -void towns_state::rtc_minute() +WRITE_LINE_MEMBER(towns_state::rtc_d1_w) { - m_towns_rtc_reg[2]++; - if(m_towns_rtc_reg[2] > 9) - { - m_towns_rtc_reg[2] = 0; - m_towns_rtc_reg[3]++; - if(m_towns_rtc_reg[3] > 5) - { - m_towns_rtc_reg[3] = 0; - rtc_hour(); - } - } + m_rtc_d = (m_rtc_d & ~2) | (state == ASSERT_LINE ? 2 : 0); } -void towns_state::rtc_second() +WRITE_LINE_MEMBER(towns_state::rtc_d2_w) { - // increase RTC time by one second - m_towns_rtc_reg[0]++; - if(m_towns_rtc_reg[0] > 9) - { - m_towns_rtc_reg[0] = 0; - m_towns_rtc_reg[1]++; - if(m_towns_rtc_reg[1] > 5) - { - m_towns_rtc_reg[1] = 0; - rtc_minute(); - } - } + m_rtc_d = (m_rtc_d & ~4) | (state == ASSERT_LINE ? 4 : 0); +} + +WRITE_LINE_MEMBER(towns_state::rtc_d3_w) +{ + m_rtc_d = (m_rtc_d & ~8) | (state == ASSERT_LINE ? 8 : 0); +} + +WRITE_LINE_MEMBER(towns_state::rtc_busy_w) +{ + m_rtc_busy = state == ASSERT_LINE ? true : false; } // SCSI controller - I/O ports 0xc30 and 0xc32 @@ -2690,8 +2641,6 @@ void towns_state::driver_start() //towns_sprram = std::make_unique<uint8_t[]>(0x20000); m_towns_serial_rom = std::make_unique<uint8_t[]>(256/8); init_serial_rom(); - init_rtc(); - m_towns_rtc_timer = timer_alloc(TIMER_RTC); m_towns_kb_timer = timer_alloc(TIMER_KEYBOARD); m_towns_mouse_timer = timer_alloc(TIMER_MOUSE); m_towns_wait_timer = timer_alloc(TIMER_WAIT); @@ -2750,10 +2699,12 @@ void towns_state::machine_reset() m_intervaltimer2_timeout_flag = 0; m_intervaltimer2_timeout_flag2 = 0; m_intervaltimer2_irqmask = 1; // masked - m_towns_rtc_timer->adjust(attotime::zero,0,attotime::from_hz(1)); m_towns_kb_timer->adjust(attotime::zero,0,attotime::from_msec(10)); m_towns_freerun_counter->adjust(attotime::zero,0,attotime::from_usec(1)); m_serial_irq_source = 0; + m_rtc_d = 0; + m_rtc_busy = false; + m_vram_mask_addr = 0; } READ8_MEMBER(towns_state::get_slave_ack) @@ -2918,6 +2869,15 @@ MACHINE_CONFIG_START(towns_state::towns_base) MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("6M") MCFG_RAM_EXTRA_OPTIONS("2M,4M,8M,16M,32M,64M,96M") + + MCFG_DEVICE_ADD("rtc58321", MSM58321, 32768_Hz_XTAL) + MCFG_MSM58321_D0_HANDLER(WRITELINE(towns_state, rtc_d0_w)) + MCFG_MSM58321_D1_HANDLER(WRITELINE(towns_state, rtc_d1_w)) + MCFG_MSM58321_D2_HANDLER(WRITELINE(towns_state, rtc_d2_w)) + MCFG_MSM58321_D3_HANDLER(WRITELINE(towns_state, rtc_d3_w)) + MCFG_MSM58321_BUSY_HANDLER(WRITELINE(towns_state, rtc_busy_w)) + MCFG_MSM58321_YEAR0(2000) + MCFG_MSM58321_DEFAULT_24H(true) MACHINE_CONFIG_END MACHINE_CONFIG_START(towns_state::towns) diff --git a/src/mame/drivers/galaxold.cpp b/src/mame/drivers/galaxold.cpp index 2f5ea5fbf7b..3fedb312404 100644 --- a/src/mame/drivers/galaxold.cpp +++ b/src/mame/drivers/galaxold.cpp @@ -3323,10 +3323,10 @@ ROM_START( drivfrcsg ) // This PCB has a big epoxy block by Tanaka Enterprises m ROM_LOAD( "1J-2764A.bin", 0x0000, 0x2000, CRC(156e20bd) SHA1(8ec4020d179674856f43e543ce5e54730752568a) ) ROM_LOAD( "1L-2764A.bin", 0x2000, 0x2000, CRC(88d0f70b) SHA1(c91aa798f7450c0cf1a8db4225d4a4efa25555d8) ) - /* piggy-backed colour proms, not dumped for this board */ + /* piggy-backed colour proms */ ROM_REGION( 0x0040, "proms", 0 ) - ROM_LOAD( "top.clr", 0x0000, 0x0020, CRC(3110ddae) SHA1(53b2e1cc07915592f6c868131ec296c63a407f04) ) - ROM_LOAD( "bot.clr", 0x0020, 0x0020, CRC(0f0782af) SHA1(32c0dd09ead5c70cee2657e9cb8cb9fcf54c5a6a) ) + ROM_LOAD( "82s123-1.bin", 0x0000, 0x0020, CRC(3110ddae) SHA1(53b2e1cc07915592f6c868131ec296c63a407f04) ) + ROM_LOAD( "82s123-2.bin", 0x0020, 0x0020, CRC(0f0782af) SHA1(32c0dd09ead5c70cee2657e9cb8cb9fcf54c5a6a) ) ROM_END ROM_START( drivfrcb ) diff --git a/src/mame/drivers/itt3030.cpp b/src/mame/drivers/itt3030.cpp index f3c28f74fdd..e35901811b9 100644 --- a/src/mame/drivers/itt3030.cpp +++ b/src/mame/drivers/itt3030.cpp @@ -8,7 +8,6 @@ ToDo: - Check Beeper - finish hooking up keyboard - - According to the manual, the keyboard is based on a 8278 ... it's nowhere to be found. The keyboard / video card has a 8741 instead of which a ROM dump exists - serial port - daisy chain - ... @@ -198,15 +197,17 @@ Beeper Circuit, all ICs shown: #include "machine/wd_fdc.h" #include "sound/beep.h" #include "video/tms9927.h" //Display hardware - #include "screen.h" #include "speaker.h" - #include "formats/itt3030_dsk.h" - +#include "debugger.h" #define MAIN_CLOCK XTAL_4.194MHz +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + class itt3030_state : public driver_device { public: @@ -218,8 +219,7 @@ public: , m_crtc(*this, "crt5027") , m_48kbank(*this, "lowerbank") , m_fdc (*this, "fdc") - , m_floppy0(*this, "fdc:0") - , m_floppy1(*this, "fdc:1") + , m_floppy(*this, "fdc:%u", 0) , m_beep(*this, "beeper") , m_keyrows(*this, "ROW.%u", 0) , m_vram(*this, "vram") @@ -263,8 +263,7 @@ protected: required_device<crt5027_device> m_crtc; required_device<address_map_bank_device> m_48kbank; required_device<fd1791_device> m_fdc; - required_device<floppy_connector> m_floppy0; - required_device<floppy_connector> m_floppy1; + required_device_array<floppy_connector, 3> m_floppy; required_device<beep_device> m_beep; required_ioport_array<16> m_keyrows; @@ -278,165 +277,11 @@ private: required_device<palette_device> m_palette; floppy_image_device *m_curfloppy; bool m_fdc_irq, m_fdc_drq, m_fdc_hld; - floppy_connector *m_con1, *m_con2, *m_con3; }; -READ8_MEMBER(itt3030_state::vsync_r) -{ - uint8_t ret = 0; - - if (machine().first_screen()->vblank()) - { - ret |= 0xc0; // set both bits 6 and 7 if vblank - } - - if (machine().first_screen()->hblank()) - { - ret |= 0x80; // set only bit 7 if hblank - } - - return ret; -} - -WRITE8_MEMBER( itt3030_state::beep_w ) -{ - m_beep->set_state(data&1); -} - -WRITE8_MEMBER(itt3030_state::bank_w) -{ - int bank = 8; - - if (BIT(data, 4)) - { - bank = (BIT(data, 5) << 2) | (BIT(data, 6) << 1) | BIT(data, 7); - } - - // printf("bank_w: new value %02x, m_bank %x, bank %x\n", data, m_bank, bank); - - m_48kbank->set_bank(bank); -} - -uint32_t itt3030_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int start = m_crtc->upscroll_offset(); - for(int y = 0; y < 24; y++ ) - { - int vramy = (start + y) % 24; - for(int x = 0; x < 80; x++ ) - { - uint8_t code = m_vram[x + vramy*128]; - int invert = code & 0x80 ? 1 : 0; - code &= 0x7f; - m_gfxdecode->gfx(invert)->opaque(bitmap,cliprect, code , 0, 0,0, x*8,y*12); - } - } - - return 0; -} - -WRITE_LINE_MEMBER(itt3030_state::fdcirq_w) -{ - m_fdc_irq = state; -} - -#include "debugger.h" - -WRITE_LINE_MEMBER(itt3030_state::fdcdrq_w) -{ - m_fdc_drq = state; -} - -WRITE_LINE_MEMBER(itt3030_state::fdchld_w) -{ - m_fdc_hld = state; -} - -/* - 7 Data Request (DRQ - inverted 1791-Signal) - 6 Interrupt Request (INTRQ - 1791-Signal) - 5 Head Load (HLD - inverted 1791-Signal) - 4 Ready 3 (Drive 3 ready) - 3 Ready 2 (Drive 2 ready) - 2 Ready l (Drive 1 ready) - 1 Write protect (the disk in the selected drive is write protected) - 0 HLT (Halt signal during head load and track change) -*/ -READ8_MEMBER(itt3030_state::fdc_stat_r) -{ - uint8_t res = 0; - floppy_image_device *floppy1 = m_con1 ? m_con1->get_device() : nullptr; - floppy_image_device *floppy2 = m_con2 ? m_con2->get_device() : nullptr; - floppy_image_device *floppy3 = m_con3 ? m_con3->get_device() : nullptr; - - res = m_fdc_drq ? 0x80 : 0x00; - res |= m_fdc_irq ? 0x40 : 0x00; - res |= m_fdc_hld ? 0x00 : 0x20; - if (floppy3) res |= !floppy3->ready_r() ? 0x10 : 0; - if (floppy2) res |= !floppy2->ready_r() ? 0x08 : 0; - if (floppy1) res |= !floppy1->ready_r() ? 0x04 : 0; - if (m_curfloppy) res |= m_curfloppy->wpt_r() ? 0x02 : 0; - - return res; -} - -/* As far as we can tell, the mess of ttl de-inverts the bus */ -READ8_MEMBER(itt3030_state::fdc_r) -{ - return m_fdc->gen_r(offset) ^ 0xff; -} - -WRITE8_MEMBER(itt3030_state::fdc_w) -{ - m_fdc->gen_w(offset, data ^ 0xff); -} - -/* - 7 SEL1 - Select drive 1 - 6 SEL2 - Select drive 2 - 5 SEL3 - Select drive 3 - 4 MOTOR - Motor on - 3 DOOR - Drive door lock drives 1 + 2 (not possible with all drives) - 2 SIDESEL - Select disk side - 1 KOMP - write comp on/off - 0 RG J - Change separator stage to read -*/ -WRITE8_MEMBER(itt3030_state::fdc_cmd_w) -{ - floppy_image_device *floppy = nullptr; - - logerror("%02x to fdc_cmd_w: motor %d side %d\n", data, (data & 0x10)>>4, (data & 4)>>2); - - // select drive - if (data & 0x80) - { - floppy = m_con1 ? m_con1->get_device() : nullptr; - } - else if (data & 0x40) - { - floppy = m_con2 ? m_con2->get_device() : nullptr; - } - else if (data & 0x20) - { - floppy = m_con3 ? m_con3->get_device() : nullptr; - } - - // selecting a new drive? - if (floppy != m_curfloppy) - { - m_fdc->set_floppy(floppy); - m_curfloppy = floppy; - } - - if (floppy != nullptr) - { - // side select - floppy->ss_w((data & 4) ? 1 : 0); - - // motor control (active low) - floppy->mon_w((data & 0x10) ? 0 : 1); - } -} +//************************************************************************** +// ADDRESS MAPS +//************************************************************************** // The lower 48K is switchable among the first 48K of each of 8 48K banks numbered 0-7 or "bank 8" which is the internal ROM and VRAM // The upper 16K is always the top 16K of the first bank, F5 can set this to 32K @@ -464,6 +309,11 @@ static ADDRESS_MAP_START( itt3030_io, AS_IO, 8, itt3030_state ) AM_RANGE(0xf6, 0xf6) AM_WRITE(bank_w) ADDRESS_MAP_END + +//************************************************************************** +// INPUTS +//************************************************************************** + READ_LINE_MEMBER(itt3030_state::kbd_matrix_r) { return m_kbdread; @@ -471,14 +321,11 @@ READ_LINE_MEMBER(itt3030_state::kbd_matrix_r) WRITE8_MEMBER(itt3030_state::kbd_matrix_w) { - int rd_masks[8] = { 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80 }; - int tmp_read; - // printf("matrix_w: %02x (col %d row %d clk %d)\n", data, m_kbdcol, m_kbdrow, (data & 0x80) ? 1 : 0); if ((data & 0x80) && (!m_kbdclk)) { - tmp_read = m_keyrows[(data >> 3) & 0xf]->read() & rd_masks[data & 0x7]; + const ioport_value tmp_read = m_keyrows[(data >> 3) & 0xf]->read() & (1 << (data & 0x7)); m_kbdread = (tmp_read != 0) ? 1 : 0; } @@ -496,6 +343,11 @@ READ8_MEMBER(itt3030_state::kbd_port2_r) return m_kbdport2; } + +//************************************************************************** +// KEYBOARD +//************************************************************************** + static INPUT_PORTS_START( itt3030 ) PORT_START("ROW.0") PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4)) @@ -599,6 +451,60 @@ static INPUT_PORTS_START( itt3030 ) PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_MAMEKEY(RSHIFT)) INPUT_PORTS_END + +//************************************************************************** +// VIDEO +//************************************************************************** + +READ8_MEMBER(itt3030_state::vsync_r) +{ + uint8_t ret = 0; + + if (machine().first_screen()->vblank()) + { + ret |= 0xc0; // set both bits 6 and 7 if vblank + } + + if (machine().first_screen()->hblank()) + { + ret |= 0x80; // set only bit 7 if hblank + } + + return ret; +} + +WRITE8_MEMBER(itt3030_state::bank_w) +{ + int bank = 8; + + if (BIT(data, 4)) + { + bank = (BIT(data, 5) << 2) | (BIT(data, 6) << 1) | BIT(data, 7); + } + + // printf("bank_w: new value %02x, m_bank %x, bank %x\n", data, m_bank, bank); + + m_48kbank->set_bank(bank); +} + +uint32_t itt3030_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int start = m_crtc->upscroll_offset(); + for(int y = 0; y < 24; y++ ) + { + int vramy = (start + y) % 24; + for(int x = 0; x < 80; x++ ) + { + uint8_t code = m_vram[x + vramy*128]; + int invert = code & 0x80 ? 1 : 0; + code &= 0x7f; + m_gfxdecode->gfx(invert)->opaque(bitmap,cliprect, code , 0, 0,0, x*8,y*12); + } + } + + return 0; +} + static const gfx_layout charlayout = { 8, 16, /* 8x16 characters */ @@ -616,31 +522,132 @@ static GFXDECODE_START( itt3030 ) GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) GFXDECODE_END +PALETTE_INIT_MEMBER(itt3030_state, itt3030) +{ + palette.set_pen_color(0, rgb_t::black()); + palette.set_pen_color(1, rgb_t(215, 229, 82)); + palette.set_pen_color(2, rgb_t::black()); +} -void itt3030_state::machine_start() +//************************************************************************** +// SOUND +//************************************************************************** + +WRITE8_MEMBER( itt3030_state::beep_w ) { - save_item(NAME(m_kbdread)); - m_48kbank->space(AS_PROGRAM).install_ram(0, m_ram->size() - 16384, m_ram->pointer()); - m_maincpu->space(AS_PROGRAM).install_ram(0xc000, 0xffff, m_ram->pointer() + m_ram->size() - 16384); - m_gfxdecode->gfx(1)->set_colorbase(1); + m_beep->set_state(data&1); +} - m_kbdclk = 0; // must be initialized here b/c mcs48_reset() causes write of 0xff to all ports +//************************************************************************** +// FLOPPY +//************************************************************************** + +WRITE_LINE_MEMBER(itt3030_state::fdcirq_w) +{ + m_fdc_irq = state; } -void itt3030_state::machine_reset() + +WRITE_LINE_MEMBER(itt3030_state::fdcdrq_w) { - m_48kbank->set_bank(8); - m_kbdread = 1; - m_kbdclk = 1; - m_fdc_irq = m_fdc_drq = m_fdc_hld = 0; - m_curfloppy = nullptr; + m_fdc_drq = state; +} - // look up floppies in advance - m_con1 = machine().device<floppy_connector>("fdc:0"); - m_con2 = machine().device<floppy_connector>("fdc:1"); - m_con3 = machine().device<floppy_connector>("fdc:2"); +WRITE_LINE_MEMBER(itt3030_state::fdchld_w) +{ + m_fdc_hld = state; } +/* + 7 Data Request (DRQ - inverted 1791-Signal) + 6 Interrupt Request (INTRQ - 1791-Signal) + 5 Head Load (HLD - inverted 1791-Signal) + 4 Ready 3 (Drive 3 ready) + 3 Ready 2 (Drive 2 ready) + 2 Ready l (Drive 1 ready) + 1 Write protect (the disk in the selected drive is write protected) + 0 HLT (Halt signal during head load and track change) +*/ +READ8_MEMBER(itt3030_state::fdc_stat_r) +{ + uint8_t res = 0; + floppy_image_device *floppy1 = m_floppy[0] ? m_floppy[0]->get_device() : nullptr; + floppy_image_device *floppy2 = m_floppy[1] ? m_floppy[1]->get_device() : nullptr; + floppy_image_device *floppy3 = m_floppy[2] ? m_floppy[2]->get_device() : nullptr; + + res = m_fdc_drq ? 0x80 : 0x00; + res |= m_fdc_irq ? 0x40 : 0x00; + res |= m_fdc_hld ? 0x00 : 0x20; + if (floppy3) res |= !floppy3->ready_r() ? 0x10 : 0; + if (floppy2) res |= !floppy2->ready_r() ? 0x08 : 0; + if (floppy1) res |= !floppy1->ready_r() ? 0x04 : 0; + if (m_curfloppy) res |= m_curfloppy->wpt_r() ? 0x02 : 0; + + return res; +} + +/* As far as we can tell, the mess of ttl de-inverts the bus */ +READ8_MEMBER(itt3030_state::fdc_r) +{ + return m_fdc->gen_r(offset) ^ 0xff; +} + +WRITE8_MEMBER(itt3030_state::fdc_w) +{ + m_fdc->gen_w(offset, data ^ 0xff); +} + +/* + 7 SEL1 - Select drive 1 + 6 SEL2 - Select drive 2 + 5 SEL3 - Select drive 3 + 4 MOTOR - Motor on + 3 DOOR - Drive door lock drives 1 + 2 (not possible with all drives) + 2 SIDESEL - Select disk side + 1 KOMP - write comp on/off + 0 RG J - Change separator stage to read +*/ +WRITE8_MEMBER(itt3030_state::fdc_cmd_w) +{ + floppy_image_device *floppy = nullptr; + + logerror("%02x to fdc_cmd_w: motor %d side %d\n", data, (data & 0x10)>>4, (data & 4)>>2); + + // select drive + if (data & 0x80) + { + floppy = m_floppy[0] ? m_floppy[0]->get_device() : nullptr; + } + else if (data & 0x40) + { + floppy = m_floppy[1] ? m_floppy[1]->get_device() : nullptr; + } + else if (data & 0x20) + { + floppy = m_floppy[2] ? m_floppy[2]->get_device() : nullptr; + } + + // selecting a new drive? + if (floppy != m_curfloppy) + { + m_fdc->set_floppy(floppy); + m_curfloppy = floppy; + } + + if (floppy != nullptr) + { + // side select + floppy->ss_w((data & 4) ? 1 : 0); + + // motor control (active low) + floppy->mon_w((data & 0x10) ? 0 : 1); + } +} + +//************************************************************************** +// FLOPPY - Drive definitions +//************************************************************************** + FLOPPY_FORMATS_MEMBER( itt3030_state::itt3030_floppy_formats ) FLOPPY_ITT3030_FORMAT FLOPPY_FORMATS_END @@ -651,11 +658,30 @@ static SLOT_INTERFACE_START( itt3030_floppies ) SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) SLOT_INTERFACE_END -PALETTE_INIT_MEMBER(itt3030_state, itt3030) + + + +//************************************************************************** +// MACHINE +//************************************************************************** + +void itt3030_state::machine_start() { - palette.set_pen_color(0, rgb_t::black()); - palette.set_pen_color(1, rgb_t(215, 229, 82)); - palette.set_pen_color(2, rgb_t::black()); + save_item(NAME(m_kbdread)); + m_48kbank->space(AS_PROGRAM).install_ram(0, m_ram->size() - 16384, m_ram->pointer()); + m_maincpu->space(AS_PROGRAM).install_ram(0xc000, 0xffff, m_ram->pointer() + m_ram->size() - 16384); + m_gfxdecode->gfx(1)->set_colorbase(1); + + m_kbdclk = 0; // must be initialized here b/c mcs48_reset() causes write of 0xff to all ports +} + +void itt3030_state::machine_reset() +{ + m_48kbank->set_bank(8); + m_kbdread = 1; + m_kbdclk = 1; + m_fdc_irq = m_fdc_drq = m_fdc_hld = 0; + m_curfloppy = nullptr; } MACHINE_CONFIG_START(itt3030_state::itt3030) @@ -720,11 +746,9 @@ MACHINE_CONFIG_START(itt3030_state::itt3030) MACHINE_CONFIG_END -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** ROM_START( itt3030 ) ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 ) @@ -735,4 +759,8 @@ ROM_START( itt3030 ) ROM_LOAD( "8741ad.bin", 0x0000, 0x0400, CRC(cabf4394) SHA1(e5d1416b568efa32b578ca295a29b7b5d20c0def)) ROM_END +//************************************************************************** +// SYSTEM DRIVERS +//************************************************************************** + COMP( 1982, itt3030, 0, 0, itt3030, itt3030, itt3030_state, 0, "ITT RFA", "ITT3030", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/namcos1.cpp b/src/mame/drivers/namcos1.cpp index eca5feff204..148b3daa089 100644 --- a/src/mame/drivers/namcos1.cpp +++ b/src/mame/drivers/namcos1.cpp @@ -362,9 +362,16 @@ WRITE8_MEMBER(namcos1_state::mcu_irq_ack_w) READ8_MEMBER(namcos1_state::dsw_r) { - int ret = m_io_dipsw->read(); - if (!(offset & 2)) ret >>= 4; - return 0xf0 | ret; + // 7654---- not used + // ----3--- ls257 dsw selector 1y + // -----2-- ls257 dsw selector 2y + // ------1- ls257 dsw selector 3y + // -------0 ls257 dsw selector 4y + + m_dsw_sel->ba_w(m_io_dipsw->read()); + m_dsw_sel->select_w(BIT(offset, 1)); + + return 0xf0 | bitswap<4>(m_dsw_sel->output_r(space, 0), 0, 1, 2, 3); } WRITE8_MEMBER(namcos1_state::coin_w) @@ -469,14 +476,14 @@ static INPUT_PORTS_START( ns1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) PORT_START( "DIPSW" ) - PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW:1" ) - PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW:2" ) - PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW:3" ) - PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW:4" ) - PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW:5" ) - PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW:6" ) - PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW:7" ) - PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW:8" ) + PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW:1" ) + PORT_DIPUNKNOWN_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW:2" ) + PORT_DIPUNKNOWN_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW:3" ) + PORT_DIPUNKNOWN_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW:4" ) + PORT_DIPUNKNOWN_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW:5" ) + PORT_DIPUNKNOWN_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW:6" ) + PORT_DIPUNKNOWN_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW:7" ) + PORT_DIPUNKNOWN_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW:8" ) PORT_START( "COIN" ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* OUT:coin lockout */ @@ -495,11 +502,11 @@ static INPUT_PORTS_START( shadowld ) PORT_INCLUDE( ns1 ) PORT_MODIFY( "DIPSW" ) - PORT_DIPNAME( 0x40, 0x40, "Freeze" ) PORT_DIPLOCATION("SW:2") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPNAME( 0x02, 0x02, "Freeze" ) PORT_DIPLOCATION("SW:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "Alternate sound effects" ) PORT_DIPLOCATION("SW:3") // e.g. the red bird - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPNAME( 0x04, 0x04, "Alternate sound effects" ) PORT_DIPLOCATION("SW:3") // e.g. the red bird + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -509,30 +516,30 @@ static INPUT_PORTS_START( dspirit ) PORT_MODIFY( "DIPSW" ) #ifdef PRIORITY_EASINESS_TO_PLAY - PORT_DIPNAME( 0x7f, 0x7f, "Life" ) PORT_DIPLOCATION("SW:8,7,6,5,4,3,2") - PORT_DIPSETTING( 0x7f, "2" ) - PORT_DIPSETTING( 0x16, "3" ) + PORT_DIPNAME( 0xfe, 0xfe, "Life" ) PORT_DIPLOCATION("SW:2,3,4,5,6,7,8") + PORT_DIPSETTING( 0xfe, "2" ) + PORT_DIPSETTING( 0x68, "3" ) #else - PORT_DIPNAME( 0x40, 0x40, "Open 3rd Life (step1of7)" ) PORT_DIPLOCATION("SW:2") - PORT_DIPSETTING( 0x40, "No (off)" ) + PORT_DIPNAME( 0x02, 0x02, "Open 3rd Life (step1of7)" ) PORT_DIPLOCATION("SW:2") + PORT_DIPSETTING( 0x02, "No (off)" ) PORT_DIPSETTING( 0x00, "Yes (on)" ) - PORT_DIPNAME( 0x20, 0x20, "Open 3rd Life (step2of7)" ) PORT_DIPLOCATION("SW:3") - PORT_DIPSETTING( 0x20, "No (off)" ) + PORT_DIPNAME( 0x04, 0x04, "Open 3rd Life (step2of7)" ) PORT_DIPLOCATION("SW:3") + PORT_DIPSETTING( 0x04, "No (off)" ) PORT_DIPSETTING( 0x00, "Yes (on)" ) - PORT_DIPNAME( 0x10, 0x10, "Open 3rd Life (step3of7)" ) PORT_DIPLOCATION("SW:4") - PORT_DIPSETTING( 0x10, "Yes (off)" ) + PORT_DIPNAME( 0x08, 0x08, "Open 3rd Life (step3of7)" ) PORT_DIPLOCATION("SW:4") + PORT_DIPSETTING( 0x08, "Yes (off)" ) PORT_DIPSETTING( 0x00, "No (on)" ) - PORT_DIPNAME( 0x08, 0x08, "Open 3rd Life (step4of7)" ) PORT_DIPLOCATION("SW:5") - PORT_DIPSETTING( 0x08, "No (off)" ) + PORT_DIPNAME( 0x10, 0x10, "Open 3rd Life (step4of7)" ) PORT_DIPLOCATION("SW:5") + PORT_DIPSETTING( 0x10, "No (off)" ) PORT_DIPSETTING( 0x00, "Yes (on)" ) - PORT_DIPNAME( 0x04, 0x04, "Open 3rd Life (step5of7)" ) PORT_DIPLOCATION("SW:6") - PORT_DIPSETTING( 0x04, "Yes (off)" ) + PORT_DIPNAME( 0x20, 0x20, "Open 3rd Life (step5of7)" ) PORT_DIPLOCATION("SW:6") + PORT_DIPSETTING( 0x20, "Yes (off)" ) PORT_DIPSETTING( 0x00, "No (on)" ) - PORT_DIPNAME( 0x02, 0x02, "Open 3rd Life (step6of7)" ) PORT_DIPLOCATION("SW:7") - PORT_DIPSETTING( 0x02, "Yes (off)" ) + PORT_DIPNAME( 0x40, 0x40, "Open 3rd Life (step6of7)" ) PORT_DIPLOCATION("SW:7") + PORT_DIPSETTING( 0x40, "Yes (off)" ) PORT_DIPSETTING( 0x00, "No (on)" ) - PORT_DIPNAME( 0x01, 0x01, "Open 3rd Life (step7of7)" ) PORT_DIPLOCATION("SW:8") - PORT_DIPSETTING( 0x01, "No (off)" ) + PORT_DIPNAME( 0x80, 0x80, "Open 3rd Life (step7of7)" ) PORT_DIPLOCATION("SW:8") + PORT_DIPSETTING( 0x80, "No (off)" ) PORT_DIPSETTING( 0x00, "Yes (on)" ) // Allow "Open 3rd Life" = _ooxoxxo // 12345678 @@ -558,17 +565,17 @@ static INPUT_PORTS_START( quester ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) PORT_MODIFY( "DIPSW" ) - PORT_DIPNAME( 0x40, 0x40, "Unk 1" ) PORT_DIPLOCATION("SW:2") // read @ fac7 - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPNAME( 0x02, 0x02, "Unk 1" ) PORT_DIPLOCATION("SW:2") // read @ fac7 + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Freeze" ) PORT_DIPLOCATION("SW:4") - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW:4") + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x00, "Brightness" ) PORT_DIPLOCATION("SW:6") - PORT_DIPSETTING( 0x04, DEF_STR( Low ) ) + PORT_DIPNAME( 0x20, 0x00, "Brightness" ) PORT_DIPLOCATION("SW:6") + PORT_DIPSETTING( 0x20, DEF_STR( Low ) ) PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Level_Select ) ) PORT_DIPLOCATION("SW:8") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Level_Select ) ) PORT_DIPLOCATION("SW:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START( "PADDLE0" ) /* fake input port for player 1 paddle */ @@ -639,16 +646,16 @@ static INPUT_PORTS_START( pacmania ) PORT_INCLUDE( ns1 ) PORT_MODIFY( "DIPSW" ) - PORT_DIPNAME( 0x40, 0x40, "Freeze" ) PORT_DIPLOCATION("SW:2") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPNAME( 0x02, 0x02, "Freeze" ) PORT_DIPLOCATION("SW:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) /* this doesn't seem to have much use... */ - PORT_DIPNAME( 0x20, 0x20, "Kick Watchdog in IRQ" ) PORT_DIPLOCATION("SW:3") - PORT_DIPSETTING( 0x20, DEF_STR( No ) ) + PORT_DIPNAME( 0x04, 0x04, "Kick Watchdog in IRQ" ) PORT_DIPLOCATION("SW:3") + PORT_DIPSETTING( 0x04, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) /* to enter the A.D.S. menu, set the dip switch and reset with service coin pressed */ - PORT_DIPNAME( 0x08, 0x08, "Auto Data Sampling" ) PORT_DIPLOCATION("SW:5") - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPNAME( 0x10, 0x10, "Auto Data Sampling" ) PORT_DIPLOCATION("SW:5") + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -662,11 +669,11 @@ static INPUT_PORTS_START( galaga88 ) PORT_DIPSETTING( 0x28, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) #else - PORT_DIPNAME( 0x20, 0x20, "Auto Data Sampling (step1of2)" ) PORT_DIPLOCATION("SW:3") - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPNAME( 0x04, 0x04, "Auto Data Sampling (step1of2)" ) PORT_DIPLOCATION("SW:3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "Auto Data Sampling (step2of2)" ) PORT_DIPLOCATION("SW:5") - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPNAME( 0x10, 0x10, "Auto Data Sampling (step2of2)" ) PORT_DIPLOCATION("SW:5") + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // Allow "Auto Data Sampling" = __o_o___ // 12345678 @@ -684,11 +691,11 @@ static INPUT_PORTS_START( berabohm ) PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_SPECIAL ) /* timing from the buttons interface */ PORT_MODIFY( "DIPSW" ) - PORT_DIPNAME( 0x20, 0x20, "Invulnerability" ) PORT_DIPLOCATION("SW:3") - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPNAME( 0x04, 0x04, "Invulnerability" ) PORT_DIPLOCATION("SW:3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SW:8") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("SW:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) #ifdef PRESSURE_SENSITIVE @@ -749,11 +756,11 @@ static INPUT_PORTS_START( mmaze ) PORT_INCLUDE( ns1 ) PORT_MODIFY( "DIPSW" ) - PORT_DIPNAME( 0x10, 0x10, "Freeze" ) PORT_DIPLOCATION("SW:4") - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPNAME( 0x08, 0x08, "Freeze" ) PORT_DIPLOCATION("SW:4") + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Level_Select ) ) PORT_DIPLOCATION("SW:8") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Level_Select ) ) PORT_DIPLOCATION("SW:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -762,20 +769,20 @@ static INPUT_PORTS_START( bakutotu ) PORT_INCLUDE( ns1 ) PORT_MODIFY( "DIPSW" ) - PORT_DIPNAME( 0x40, 0x40, "Invincibility (Cheat)") PORT_DIPLOCATION("SW:2") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "Show Coordinates" ) PORT_DIPLOCATION("SW:3") - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPNAME( 0x02, 0x02, "Invincibility (Cheat)") PORT_DIPLOCATION("SW:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "Level Selection" ) PORT_DIPLOCATION("SW:4") - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPNAME( 0x04, 0x04, "Show Coordinates" ) PORT_DIPLOCATION("SW:3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "Sprite Viewer" ) PORT_DIPLOCATION("SW:5") + PORT_DIPNAME( 0x08, 0x08, "Level Selection" ) PORT_DIPLOCATION("SW:4") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SW:8") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPNAME( 0x10, 0x10, "Sprite Viewer" ) PORT_DIPLOCATION("SW:5") + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("SW:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -786,33 +793,33 @@ static INPUT_PORTS_START( wldcourt ) PORT_MODIFY( "DIPSW" ) #ifdef PRIORITY_EASINESS_TO_PLAY /* see code @ e331. The lines this draws can't even be seen because they are erased afterwards */ - PORT_DIPNAME( 0x7e, 0x7e, "Draw Debug Lines" ) PORT_DIPLOCATION("SW:7,6,5,4,3,2") + PORT_DIPNAME( 0x7e, 0x7e, "Draw Debug Lines" ) PORT_DIPLOCATION("SW:2,3,4,5,6,7") PORT_DIPSETTING( 0x7e, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x5c, DEF_STR( On ) ) + PORT_DIPSETTING( 0x3a, DEF_STR( On ) ) #else - PORT_DIPNAME( 0x40, 0x40, "Draw Debug Lines (step1of6)" ) PORT_DIPLOCATION("SW:2") - PORT_DIPSETTING( 0x40, "Yes (off)" ) + PORT_DIPNAME( 0x02, 0x02, "Draw Debug Lines (step1of6)" ) PORT_DIPLOCATION("SW:2") + PORT_DIPSETTING( 0x02, "Yes (off)" ) PORT_DIPSETTING( 0x00, "No (on)" ) - PORT_DIPNAME( 0x20, 0x20, "Draw Debug Lines (step2of6)" ) PORT_DIPLOCATION("SW:3") - PORT_DIPSETTING( 0x20, "No (off)" ) + PORT_DIPNAME( 0x04, 0x04, "Draw Debug Lines (step2of6)" ) PORT_DIPLOCATION("SW:3") + PORT_DIPSETTING( 0x04, "No (off)" ) PORT_DIPSETTING( 0x00, "Yes (on)" ) - PORT_DIPNAME( 0x10, 0x10, "Draw Debug Lines (step3of6)" ) PORT_DIPLOCATION("SW:4") - PORT_DIPSETTING( 0x10, "Yes (off)" ) - PORT_DIPSETTING( 0x00, "No (on)" ) - PORT_DIPNAME( 0x08, 0x08, "Draw Debug Lines (step4of6)" ) PORT_DIPLOCATION("SW:5") + PORT_DIPNAME( 0x08, 0x08, "Draw Debug Lines (step3of6)" ) PORT_DIPLOCATION("SW:4") PORT_DIPSETTING( 0x08, "Yes (off)" ) PORT_DIPSETTING( 0x00, "No (on)" ) - PORT_DIPNAME( 0x04, 0x04, "Draw Debug Lines (step5of6)" ) PORT_DIPLOCATION("SW:6") - PORT_DIPSETTING( 0x04, "Yes (off)" ) + PORT_DIPNAME( 0x10, 0x10, "Draw Debug Lines (step4of6)" ) PORT_DIPLOCATION("SW:5") + PORT_DIPSETTING( 0x10, "Yes (off)" ) + PORT_DIPSETTING( 0x00, "No (on)" ) + PORT_DIPNAME( 0x20, 0x20, "Draw Debug Lines (step5of6)" ) PORT_DIPLOCATION("SW:6") + PORT_DIPSETTING( 0x20, "Yes (off)" ) PORT_DIPSETTING( 0x00, "No (on)" ) - PORT_DIPNAME( 0x02, 0x02, "Draw Debug Lines (step6of6)" ) PORT_DIPLOCATION("SW:7") - PORT_DIPSETTING( 0x02, "No (off)" ) + PORT_DIPNAME( 0x40, 0x40, "Draw Debug Lines (step6of6)" ) PORT_DIPLOCATION("SW:7") + PORT_DIPSETTING( 0x40, "No (off)" ) PORT_DIPSETTING( 0x00, "Yes (on)" ) // Allow "Draw Debug Lines" = _xxoxxo_ // 12345678 #endif - PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SW:8") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("SW:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -823,29 +830,29 @@ static INPUT_PORTS_START( splatter ) PORT_MODIFY( "DIPSW" ) /* these two don't seem to have much use... */ #ifdef PRIORITY_EASINESS_TO_PLAY - PORT_DIPNAME( 0x11, 0x11, "CPU #0 Kick Watchdog in IRQ" ) PORT_DIPLOCATION("SW:8,4") - PORT_DIPSETTING( 0x11, DEF_STR( No ) ) + PORT_DIPNAME( 0x88, 0x88, "CPU #0 Kick Watchdog in IRQ" ) PORT_DIPLOCATION("SW:4,8") + PORT_DIPSETTING( 0x88, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) #else - PORT_DIPNAME( 0x10, 0x10, "CPU #0 Kick Watchdog in IRQ (step1of2)" ) PORT_DIPLOCATION("SW:4") - PORT_DIPSETTING( 0x10, DEF_STR( No ) ) + PORT_DIPNAME( 0x08, 0x08, "CPU #0 Kick Watchdog in IRQ (step1of2)" ) PORT_DIPLOCATION("SW:4") + PORT_DIPSETTING( 0x08, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x01, 0x01, "CPU #0 Kick Watchdog in IRQ (step2of2)" ) PORT_DIPLOCATION("SW:8") - PORT_DIPSETTING( 0x01, DEF_STR( No ) ) + PORT_DIPNAME( 0x80, 0x80, "CPU #0 Kick Watchdog in IRQ (step2of2)" ) PORT_DIPLOCATION("SW:8") + PORT_DIPSETTING( 0x80, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) // Allow "CPU #0 Kick Watchdog in IRQ" = ___o___o // 12345678 #endif #ifdef PRIORITY_EASINESS_TO_PLAY - PORT_DIPNAME( 0x06, 0x06, "CPU #0&1 Kick Watchdog in IRQ" ) PORT_DIPLOCATION("SW:7,6") - PORT_DIPSETTING( 0x06, DEF_STR( No ) ) + PORT_DIPNAME( 0x60, 0x60, "CPU #0&1 Kick Watchdog in IRQ" ) PORT_DIPLOCATION("SW:6,7") + PORT_DIPSETTING( 0x60, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) #else - PORT_DIPNAME( 0x04, 0x04, "CPU #0&1 Kick Watchdog in IRQ (step1of2)" ) PORT_DIPLOCATION("SW:6") - PORT_DIPSETTING( 0x04, DEF_STR( No ) ) + PORT_DIPNAME( 0x20, 0x20, "CPU #0&1 Kick Watchdog in IRQ (step1of2)" ) PORT_DIPLOCATION("SW:6") + PORT_DIPSETTING( 0x20, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x02, 0x02, "CPU #0&1 Kick Watchdog in IRQ (step2of2)" ) PORT_DIPLOCATION("SW:7") - PORT_DIPSETTING( 0x02, DEF_STR( No ) ) + PORT_DIPNAME( 0x40, 0x40, "CPU #0&1 Kick Watchdog in IRQ (step2of2)" ) PORT_DIPLOCATION("SW:7") + PORT_DIPSETTING( 0x40, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) // Allow "CPU #0&1 Kick Watchdog in IRQ" = _____oo_ // 12345678 @@ -857,8 +864,8 @@ static INPUT_PORTS_START( splatter3 ) PORT_INCLUDE( splatter ) PORT_MODIFY( "DIPSW" ) - PORT_DIPNAME( 0x20, 0x20, "Stage Select" ) PORT_DIPLOCATION("SW:3") - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPNAME( 0x04, 0x04, "Stage Select" ) PORT_DIPLOCATION("SW:3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -913,11 +920,11 @@ static INPUT_PORTS_START( ws89 ) PORT_MODIFY( "DIPSW" ) /* see code @ e90c. The lines this draws can't even be seen because they are erased afterwards */ - PORT_DIPNAME( 0x02, 0x02, "Draw Debug Lines" ) PORT_DIPLOCATION("SW:7") - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPNAME( 0x40, 0x40, "Draw Debug Lines" ) PORT_DIPLOCATION("SW:7") + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SW:8") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("SW:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -926,16 +933,16 @@ static INPUT_PORTS_START( dangseed ) PORT_INCLUDE( ns1 ) PORT_MODIFY( "DIPSW" ) - PORT_DIPNAME( 0x40, 0x40, "Freeze" ) PORT_DIPLOCATION("SW:2") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPNAME( 0x02, 0x02, "Freeze" ) PORT_DIPLOCATION("SW:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) /* this doesn't seem to have much use... */ - PORT_DIPNAME( 0x20, 0x20, "Kick Watchdog in IRQ" ) PORT_DIPLOCATION("SW:3") - PORT_DIPSETTING( 0x20, DEF_STR( No ) ) + PORT_DIPNAME( 0x04, 0x04, "Kick Watchdog in IRQ" ) PORT_DIPLOCATION("SW:3") + PORT_DIPSETTING( 0x04, DEF_STR( No ) ) PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) /* to enter the A.D.S. menu, set the dip switch, keep 1p start pressed and press service coin */ - PORT_DIPNAME( 0x04, 0x04, "Auto Data Sampling" ) PORT_DIPLOCATION("SW:6") - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPNAME( 0x20, 0x20, "Auto Data Sampling" ) PORT_DIPLOCATION("SW:6") + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -945,11 +952,11 @@ static INPUT_PORTS_START( ws90 ) PORT_MODIFY( "DIPSW" ) /* see code @ e8ff. The lines this draws can't even be seen because they are erased afterwards */ - PORT_DIPNAME( 0x02, 0x02, "Draw Debug Lines" ) PORT_DIPLOCATION("SW:7") - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPNAME( 0x40, 0x40, "Draw Debug Lines" ) PORT_DIPLOCATION("SW:7") + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SW:8") - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("SW:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -958,8 +965,8 @@ static INPUT_PORTS_START( boxyboy ) PORT_INCLUDE( ns1 ) PORT_MODIFY( "DIPSW" ) - PORT_DIPNAME( 0x40, 0x40, "Freeze" ) PORT_DIPLOCATION("SW:2") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPNAME( 0x02, 0x02, "Freeze" ) PORT_DIPLOCATION("SW:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -968,8 +975,8 @@ static INPUT_PORTS_START( puzlclub ) PORT_INCLUDE( ns1 ) PORT_MODIFY( "DIPSW" ) - PORT_DIPNAME( 0x40, 0x40, "Auto Data Sampling" ) PORT_DIPLOCATION("SW:2") - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPNAME( 0x02, 0x02, "Auto Data Sampling" ) PORT_DIPLOCATION("SW:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END @@ -1046,6 +1053,8 @@ MACHINE_CONFIG_START(namcos1_state::ns1) MCFG_NVRAM_ADD_0FILL("nvram") + MCFG_DEVICE_ADD("dsw_sel", LS157, 0) // LS257 'A3' + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL(49'152'000)/8, 384, 9+8*8, 9+44*8, 264, 2*8, 30*8) diff --git a/src/mame/drivers/pce.cpp b/src/mame/drivers/pce.cpp index 93c711635c9..795aa1c2c0f 100644 --- a/src/mame/drivers/pce.cpp +++ b/src/mame/drivers/pce.cpp @@ -72,7 +72,8 @@ Super System Card: #include "speaker.h" -/* todo: alternate forms of input (multitap, mouse, etc.) */ +// TODO: slotify this mess, also add alternate forms of input (multitap, mouse, pachinko controller etc.) +// hucard pachikun gives you option to select pachinko controller after pressing start, likely because it doesn't have a true header id static INPUT_PORTS_START( pce ) PORT_START("JOY_P.0") @@ -96,7 +97,10 @@ static INPUT_PORTS_START( pce ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CONDITION("JOY_TYPE", 0x000c, EQUALS, 0x0000) + // pachinko controller paddle maps here (!?) with this arrangement + //PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_MINMAX(0,0x5f) PORT_SENSITIVITY(15) PORT_KEYDELTA(15) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) + PORT_START("JOY_P.2") /* II is left of I on the original pad so we map them in reverse order */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P3 Button I") PORT_PLAYER(3) PORT_CONDITION("JOY_TYPE", 0x0030, EQUALS, 0x0000) diff --git a/src/mame/drivers/photoply.cpp b/src/mame/drivers/photoply.cpp index a83a69ed263..fa5bc44397c 100644 --- a/src/mame/drivers/photoply.cpp +++ b/src/mame/drivers/photoply.cpp @@ -7,7 +7,15 @@ Photo Play (c) 199? Funworld Preliminary driver by Angelo Salese TODO: -- Puts a FDC error, needs a DASM investigation / work-around. +- DISK BOOT FAILURE after eeprom checking (many unknown IDE cs1 reads/writes); +- partition boot sector is missing from the CHD dump, protection? +- Detects CPU type as "-S 16 MHz"? Sometimes it detects it as 486SX, unknown repro (after fiddling with CMOS settings anyway) +- VGA BIOS reports being a Cirrus Logic GD5436 / 5446, it is unknown what exactly this game uses. +- PCI hookups (no idea about what this uses), and improve/device-ify SiS85C49x; +- ISA bus cards are completely guessworked; +- EEPROM (most likely at i/o 0x200); +- Eventually needs AudioDrive ES688 / ES1688 / ES1788 & ES1868 devices and serial ports "for linking" before actually booting; + *******************************************************************************************************/ @@ -17,32 +25,155 @@ TODO: #include "machine/pcshare.h" #include "machine/pckeybrd.h" #include "machine/idectrl.h" -#include "video/pc_vga.h" +#include "video/clgd542x.h" class photoply_state : public pcat_base_state { public: photoply_state(const machine_config &mconfig, device_type type, const char *tag) - : pcat_base_state(mconfig, type, tag) + : pcat_base_state(mconfig, type, tag), + m_main_bios(*this, "bios"), + m_video_bios(*this, "video_bios"), + m_ex_bios(*this, "ex_bios") { } - uint8_t m_vga_address; + required_region_ptr<uint8_t> m_main_bios; + required_region_ptr<uint8_t> m_video_bios; + required_region_ptr<uint8_t> m_ex_bios; + + uint8_t *m_shadow_ram; + + DECLARE_READ8_MEMBER(bios_r); + DECLARE_WRITE8_MEMBER(bios_w); + uint16_t m_pci_shadow_reg; DECLARE_DRIVER_INIT(photoply); - virtual void machine_start() override; void photoply(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; }; +// regs 0x00-0x3f both devices below +// regs 0x40-0x7f SiS85C496 PCI & CPU Memory Controller (PCM) +// regs 0x80-0xff SiS85C497 AT Bus Controller & Megacell (ATM) +static uint32_t sis_pcm_r(device_t *busdevice, device_t *device, int function, int reg, uint32_t mem_mask) +{ + uint32_t r = 0; + photoply_state *state = busdevice->machine().driver_data<photoply_state>(); + + //printf("PCM %02x %08x\n",reg,mem_mask); + if(reg == 0) + { + // Device ID / Vendor ID + return 0x04961039; + } + + if(reg == 8) + { + // Device Class Code / Device Revision Identification + return 0x06000002; + } + + // Device Header Type + if(reg == 0xc) + return 0; + + if(reg == 0x44) + { + + if(ACCESSING_BITS_8_15) // reg 0x45 + r |= (state->m_pci_shadow_reg & 0xff00); + if(ACCESSING_BITS_0_7) // reg 0x44 + r |= (state->m_pci_shadow_reg & 0x00ff); + } + return r; +} + +static void sis_pcm_w(device_t *busdevice, device_t *device, int function, int reg, uint32_t data, uint32_t mem_mask) +{ + photoply_state *state = busdevice->machine().driver_data<photoply_state>(); + + if(reg == 0x44) + { + + /* + * reg 0x45 + * shadow RAM control + * xxxx ---- <reserved> + * ---- x--- Internal Cache Cacheable Area Control + * ---- -x-- PCI,ISA Master Access Shadow RAM Area Enable + * ---- --x- Shadow RAM Read Control (1=Enable) + * ---- ---x Shadow RAM Write Control (0=Enable) + */ + if(ACCESSING_BITS_8_15) + state->m_pci_shadow_reg = (data & 0xff00) | (state->m_pci_shadow_reg & 0x00ff); + + /* + * shadow RAM enable: + * bit 7: 0xf8000-0xfffff shadow RAM enable + * ... + * bit 0: 0xc0000-0xc7fff shadow RAM enable + */ + if(ACCESSING_BITS_0_7) // reg 0x44 + state->m_pci_shadow_reg = (data & 0x00ff) | (state->m_pci_shadow_reg & 0xff00); + + //printf("%04x\n",state->m_pci_shadow_reg); + } +} + +READ8_MEMBER(photoply_state::bios_r) +{ + uint8_t bit_mask = (offset & 0x38000) >> 15; + + if((m_pci_shadow_reg & 0x200) == 0x200) + { + if(m_pci_shadow_reg & (1 << bit_mask)) + return m_shadow_ram[offset]; + } + + // TODO: this mapping is a complete guesswork + // TODO: worth converting this to bankdev when PCI gets de-legacized + switch(bit_mask & 7) + { + // cirrus logic video bios + case 0: // c0000-c7fff + return m_video_bios[offset & 0x7fff]; + // multifunction board bios + // Note: if filled with a reload on 0x4000-0x7fff it will repeat the "Combo I/O" EEPROM check (which looks unlikely) + case 1: // c8000-cffff + return m_ex_bios[offset & 0x7fff]; + case 2: // d0000-dffff + case 3: + return 0; + } + + // e0000-fffff + return m_main_bios[offset & 0x1ffff]; +} + +WRITE8_MEMBER(photoply_state::bios_w) +{ +// return m_bios[offset]; + if((m_pci_shadow_reg & 0x100) == 0) + { + uint8_t bit_mask = (offset & 0x38000) >> 15; + + if(m_pci_shadow_reg & (1 << bit_mask)) + m_shadow_ram[offset] = data; + } +} static ADDRESS_MAP_START( photoply_map, AS_PROGRAM, 32, photoply_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) // VGA RAM - AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0) //??? - AM_RANGE(0x000c8000, 0x000cffff) AM_RAM AM_REGION("video_bios", 0) - AM_RANGE(0x000d0000, 0x000dffff) AM_RAM AM_REGION("ex_bios", 0) - AM_RANGE(0x000e0000, 0x000fffff) AM_ROM AM_REGION("bios", 0) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", cirrus_gd5446_device, mem_r, mem_w, 0xffffffff) +// AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0) +// AM_RANGE(0x000c8000, 0x000cffff) AM_RAM AM_REGION("ex_bios", 0) + AM_RANGE(0x000c0000, 0x000fffff) AM_READWRITE8(bios_r,bios_w,0xffffffff) + AM_RANGE(0x00100000, 0x07ffffff) AM_RAM // 64MB RAM, guess! AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("bios", 0) ADDRESS_MAP_END @@ -51,14 +182,21 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( photoply_io, AS_IO, 32, photoply_state ) AM_IMPORT_FROM(pcat32_io_common) AM_RANGE(0x00e8, 0x00eb) AM_NOP - AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE16("ide", ide_controller_device, read_cs0, write_cs0, 0xffffffff) - AM_RANGE(0x0278, 0x027f) AM_RAM //parallel port 2 - AM_RANGE(0x0378, 0x037f) AM_RAM //parallel port - //AM_RANGE(0x03bc, 0x03bf) AM_RAM //parallel port 3 - AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) - AM_RANGE(0x03f0, 0x03f7) AM_DEVREADWRITE16("ide", ide_controller_device, read_cs1, write_cs1, 0xffffffff) + + AM_RANGE(0x0170, 0x0177) AM_DEVREADWRITE("ide2", ide_controller_32_device, read_cs0, write_cs0) + AM_RANGE(0x01f0, 0x01f7) AM_DEVREADWRITE("ide", ide_controller_32_device, read_cs0, write_cs0) + AM_RANGE(0x0200, 0x0203) AM_NOP // eeprom +// AM_RANGE(0x0278, 0x027f) AM_RAM //parallel port 2 + AM_RANGE(0x0370, 0x0377) AM_DEVREADWRITE("ide2", ide_controller_32_device, read_cs1, write_cs1) +// AM_RANGE(0x0378, 0x037f) AM_RAM //parallel port + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", cirrus_gd5446_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", cirrus_gd5446_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", cirrus_gd5446_device, port_03d0_r, port_03d0_w, 0xffffffff) + + AM_RANGE(0x03f0, 0x03f7) AM_DEVREADWRITE("ide", ide_controller_32_device, read_cs1, write_cs1) + + AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write) + ADDRESS_MAP_END #define AT_KEYB_HELPER(bit, text, key1) \ @@ -68,6 +206,8 @@ static INPUT_PORTS_START( photoply ) PORT_START("pc_keyboard_0") PORT_BIT ( 0x0001, 0x0000, IPT_UNUSED ) /* unused scancode 0 */ AT_KEYB_HELPER( 0x0002, "Esc", KEYCODE_Q ) /* Esc 01 81 */ + AT_KEYB_HELPER( 0x0004, "1", KEYCODE_1 ) + AT_KEYB_HELPER( 0x0008, "2", KEYCODE_2 ) PORT_START("pc_keyboard_1") AT_KEYB_HELPER( 0x0020, "Y", KEYCODE_Y ) /* Y 15 95 */ @@ -77,7 +217,9 @@ static INPUT_PORTS_START( photoply ) PORT_START("pc_keyboard_3") AT_KEYB_HELPER( 0x0002, "N", KEYCODE_N ) /* N 31 B1 */ - AT_KEYB_HELPER( 0x0800, "F1", KEYCODE_S ) /* F1 3B BB */ + AT_KEYB_HELPER( 0x0800, "F1", KEYCODE_F1 ) /* F1 3B BB */ + AT_KEYB_HELPER( 0x1000, "F2", KEYCODE_F2 ) + AT_KEYB_HELPER( 0x4000, "F4", KEYCODE_F4 ) PORT_START("pc_keyboard_4") @@ -97,8 +239,16 @@ INPUT_PORTS_END void photoply_state::machine_start() { + m_shadow_ram = auto_alloc_array(machine(), uint8_t, 0x40000); + save_pointer(NAME(m_shadow_ram),0x40000); } +void photoply_state::machine_reset() +{ + m_pci_shadow_reg = 0; +} + + static const gfx_layout CGA_charlayout = { 8,8, @@ -117,7 +267,7 @@ GFXDECODE_END MACHINE_CONFIG_START(photoply_state::photoply) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", I486, 75000000) /* I486DX4, 75 or 100 Mhz */ + MCFG_CPU_ADD("maincpu", I486DX4, 75000000) /* I486DX4, 75 or 100 Mhz */ MCFG_CPU_PROGRAM_MAP(photoply_map) MCFG_CPU_IO_MAP(photoply_io) MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_1", pic8259_device, inta_cb) @@ -126,10 +276,21 @@ MACHINE_CONFIG_START(photoply_state::photoply) MCFG_GFXDECODE_ADD("gfxdecode", "palette", photoply ) - MCFG_IDE_CONTROLLER_ADD("ide", ata_devices, "hdd", nullptr, true) + MCFG_IDE_CONTROLLER_32_ADD("ide", ata_devices, "hdd", nullptr, true) MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_2", pic8259_device, ir6_w)) - MCFG_FRAGMENT_ADD( pcvideo_vga ) + MCFG_IDE_CONTROLLER_32_ADD("ide2", ata_devices, nullptr, nullptr, true) + MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("pic8259_2", pic8259_device, ir7_w)) + + MCFG_PCI_BUS_LEGACY_ADD("pcibus", 0) + MCFG_PCI_BUS_LEGACY_DEVICE(5, nullptr, sis_pcm_r, sis_pcm_w) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL(25'174'800),900,0,640,526,0,480) + MCFG_SCREEN_UPDATE_DEVICE("vga", cirrus_gd5446_device, screen_update) + + MCFG_PALETTE_ADD("palette", 0x100) + MCFG_DEVICE_ADD("vga", CIRRUS_GD5446, 0) MACHINE_CONFIG_END @@ -137,11 +298,11 @@ ROM_START(photoply) ROM_REGION(0x20000, "bios", 0) /* motherboard bios */ ROM_LOAD("award bootblock bios v1.0.bin", 0x000000, 0x20000, CRC(e96d1bbc) SHA1(64d0726c4e9ecee8fddf4cc39d92aecaa8184d5c) ) - ROM_REGION(0x10000, "ex_bios", 0) /* multifunction board with a ESS AudioDrive chip, M27128A */ + ROM_REGION(0x8000, "ex_bios", ROMREGION_ERASE00 ) /* multifunction board with a ESS AudioDrive chip, M27128A */ ROM_LOAD("enhanced bios.bin", 0x000000, 0x4000, CRC(a216404e) SHA1(c9067cf87d5c8106de00866bb211eae3a6c02c65) ) - ROM_RELOAD( 0x004000, 0x4000 ) - ROM_RELOAD( 0x008000, 0x4000 ) - ROM_RELOAD( 0x00c000, 0x4000 ) +// ROM_RELOAD( 0x004000, 0x4000 ) +// ROM_RELOAD( 0x008000, 0x4000 ) +// ROM_RELOAD( 0x00c000, 0x4000 ) ROM_REGION(0x8000, "video_bios", 0 ) ROM_LOAD("vga.bin", 0x000000, 0x8000, CRC(7a859659) SHA1(ff667218261969c48082ec12aa91088a01b0cb2a) ) @@ -154,4 +315,4 @@ DRIVER_INIT_MEMBER(photoply_state,photoply) { } -GAME( 199?, photoply, 0, photoply, photoply, photoply_state, photoply, ROT0, "Funworld", "Photo Play 2000 (v2.01)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) +GAME( 199?, photoply, 0, photoply, photoply, photoply_state, photoply, ROT0, "Funworld", "Photo Play 2000 (v2.01)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND|MACHINE_UNEMULATED_PROTECTION ) diff --git a/src/mame/drivers/tv912.cpp b/src/mame/drivers/tv912.cpp index 0b36e40e6a9..7ae5f02895a 100644 --- a/src/mame/drivers/tv912.cpp +++ b/src/mame/drivers/tv912.cpp @@ -294,9 +294,11 @@ u32 tv912_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, cons rectangle curs; m_crtc->cursor_bounds(curs); + int scroll = m_crtc->upscroll_offset(); + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - int row = y / 10; + int row = ((y / 10) + scroll) % 24; int ra = y % 10; int x = 0; u8 *charbase = &m_p_chargen[(ra & 7) | BIT(videoctrl, 1) << 10]; diff --git a/src/mame/drivers/vii.cpp b/src/mame/drivers/vii.cpp index 0e870df1a55..963ddf6e506 100644 --- a/src/mame/drivers/vii.cpp +++ b/src/mame/drivers/vii.cpp @@ -27,6 +27,7 @@ Known u'nSP-Based Systems: + D - SPG240 - Radica Skateboarder (Sunplus QL8041C die) ND - SPG243 - Some form of Leapfrog "edutainment" system ND - SPG243 - Star Wars: Clone Wars ND - SPG243 - Toy Story @@ -101,25 +102,22 @@ Detailed list of bugs: #define TILE_X_FLIP 0x0004 #define TILE_Y_FLIP 0x0008 -class vii_state : public driver_device +class spg2xx_game_state : public driver_device { public: - vii_state(const machine_config &mconfig, device_type type, const char *tag) + spg2xx_game_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_cart(*this, "cartslot"), m_p_ram(*this, "p_ram"), m_p_rowscroll(*this, "p_rowscroll"), m_p_palette(*this, "p_palette"), m_p_spriteram(*this, "p_spriteram"), - m_bank(*this, "cart"), - m_bios_rom(*this, "bios"), m_io_p1(*this, "P1"), - m_io_p2(*this, "P2") + m_io_p2(*this, "P2"), + m_io_p3(*this, "P3"), + m_bank(*this, "cart") { } - required_device<cpu_device> m_maincpu; - optional_device<generic_slot_device> m_cart; DECLARE_READ16_MEMBER(video_r); DECLARE_WRITE16_MEMBER(video_w); DECLARE_READ16_MEMBER(audio_r); @@ -127,104 +125,132 @@ public: DECLARE_READ16_MEMBER(io_r); DECLARE_WRITE16_MEMBER(io_w); DECLARE_READ16_MEMBER(rom_r); - required_shared_ptr<uint16_t> m_p_ram; - required_shared_ptr<uint16_t> m_p_rowscroll; - required_shared_ptr<uint16_t> m_p_palette; - required_shared_ptr<uint16_t> m_p_spriteram; - required_memory_bank m_bank; + + DECLARE_DRIVER_INIT(walle); + DECLARE_DRIVER_INIT(batman); + DECLARE_DRIVER_INIT(wirels60); + DECLARE_DRIVER_INIT(rad_skat); + + uint32_t screen_update_vii(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + INTERRUPT_GEN_MEMBER(vii_vblank); + + TIMER_CALLBACK_MEMBER(tmb1_tick); + TIMER_CALLBACK_MEMBER(tmb2_tick); + + void spg2xx_base(machine_config &config); + void spg2xx_basep(machine_config &config); + void batman(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + void switch_bank(uint32_t bank); + uint32_t m_centered_coordinates; // this must be a vreg? + void test_centered(uint8_t *ROM); + + typedef delegate<uint16_t(uint16_t, int)> vii_io_rw_delegate; + vii_io_rw_delegate m_vii_io_rw; +private: + + uint16_t do_spg240_rad_skat_io(uint16_t what, int index); + uint16_t do_spg243_batman_io(uint16_t what, int index); + uint16_t do_spg243_wireless60_io(uint16_t what, int index); uint32_t m_current_bank; uint16_t m_video_regs[0x100]; - uint32_t m_centered_coordinates; - void test_centered(uint8_t *ROM); struct { uint8_t r, g, b; } - m_screenram[320*240]; + m_screenram[320 * 240]; uint16_t m_io_regs[0x200]; uint16_t m_uart_rx_count; uint8_t m_controller_input[8]; uint8_t m_w60_controller_input; - uint32_t m_spg243_mode; emu_timer *m_tmb1; emu_timer *m_tmb2; void do_dma(uint32_t len); void do_gpio(uint32_t offset); - void switch_bank(uint32_t bank); void do_i2c(); void spg_do_dma(uint32_t len); - DECLARE_DRIVER_INIT(vsmile); - DECLARE_DRIVER_INIT(walle); - DECLARE_DRIVER_INIT(vii); - DECLARE_DRIVER_INIT(batman); - DECLARE_DRIVER_INIT(wirels60); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - uint32_t screen_update_vii(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vii_vblank); - TIMER_CALLBACK_MEMBER(tmb1_tick); - TIMER_CALLBACK_MEMBER(tmb2_tick); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vii_cart); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vsmile_cart); - - void vii(machine_config &config); - void vsmile(machine_config &config); - void wirels60(machine_config &config); - void batman(machine_config &config); -protected: - optional_memory_region m_bios_rom; - required_ioport m_io_p1; - optional_ioport m_io_p2; - - memory_region *m_cart_rom; void blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t xoff, uint32_t yoff, uint32_t attr, uint32_t ctrl, uint32_t bitmap_addr, uint16_t tile); void blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, uint32_t bitmap_addr, uint16_t *regs); void blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, uint32_t base_addr); void blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth); - inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3,4); + inline void verboselog(int n_level, const char *s_fmt, ...) ATTR_PRINTF(3, 4); inline uint8_t expand_rgb5_to_rgb8(uint8_t val); inline uint8_t mix_channel(uint8_t a, uint8_t b); void mix_pixel(uint32_t offset, uint16_t rgb); void set_pixel(uint32_t offset, uint16_t rgb); + + // devices + + required_device<cpu_device> m_maincpu; + required_shared_ptr<uint16_t> m_p_ram; + required_shared_ptr<uint16_t> m_p_rowscroll; + required_shared_ptr<uint16_t> m_p_palette; + required_shared_ptr<uint16_t> m_p_spriteram; + required_ioport m_io_p1; + optional_ioport m_io_p2; + optional_ioport m_io_p3; +protected: + required_memory_bank m_bank; }; -enum + +class spg2xx_cart_state : public spg2xx_game_state { - SPG243_VII = 0, - SPG243_BATMAN, - SPG243_VSMILE, - SPG243_WIRELESS60, +public: + spg2xx_cart_state(const machine_config &mconfig, device_type type, const char *tag) + : spg2xx_game_state(mconfig, type, tag), + m_cart(*this, "cartslot") + { } - SPG243_MODEL_COUNT -}; + DECLARE_DRIVER_INIT(vii); + DECLARE_DRIVER_INIT(vsmile); + + uint16_t do_spg243_vsmile_io(uint16_t what, int index); + uint16_t do_spg243_vii_io(uint16_t what, int index); + + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vii_cart); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(vsmile_cart); + + void vii(machine_config &config); + void vsmile(machine_config &config); +protected: + virtual void machine_start() override; + +private: + optional_device<generic_slot_device> m_cart; + memory_region *m_cart_rom; +}; #define VII_CTLR_IRQ_ENABLE m_io_regs[0x21] #define VII_VIDEO_IRQ_ENABLE m_video_regs[0x62] #define VII_VIDEO_IRQ_STATUS m_video_regs[0x63] - #define VERBOSE_LEVEL (3) #define ENABLE_VERBOSE_LOG (1) -inline void vii_state::verboselog(int n_level, const char *s_fmt, ...) +inline void spg2xx_game_state::verboselog(int n_level, const char *s_fmt, ...) { #if ENABLE_VERBOSE_LOG - if( VERBOSE_LEVEL >= n_level ) + if (VERBOSE_LEVEL >= n_level) { va_list v; - char buf[ 32768 ]; - va_start( v, s_fmt ); - vsprintf( buf, s_fmt, v ); - va_end( v ); + char buf[32768]; + va_start(v, s_fmt); + vsprintf(buf, s_fmt, v); + va_end(v); } #endif } @@ -233,38 +259,38 @@ inline void vii_state::verboselog(int n_level, const char *s_fmt, ...) * Video Hardware * *************************/ -void vii_state::video_start() +void spg2xx_game_state::video_start() { } -inline uint8_t vii_state::expand_rgb5_to_rgb8(uint8_t val) +inline uint8_t spg2xx_game_state::expand_rgb5_to_rgb8(uint8_t val) { uint8_t temp = val & 0x1f; return (temp << 3) | (temp >> 2); } // Perform a lerp between a and b -inline uint8_t vii_state::mix_channel(uint8_t a, uint8_t b) +inline uint8_t spg2xx_game_state::mix_channel(uint8_t a, uint8_t b) { uint8_t alpha = m_video_regs[0x1c] & 0x00ff; return ((64 - alpha) * a + alpha * b) / 64; } -void vii_state::mix_pixel(uint32_t offset, uint16_t rgb) +void spg2xx_game_state::mix_pixel(uint32_t offset, uint16_t rgb) { m_screenram[offset].r = mix_channel(m_screenram[offset].r, expand_rgb5_to_rgb8(rgb >> 10)); m_screenram[offset].g = mix_channel(m_screenram[offset].g, expand_rgb5_to_rgb8(rgb >> 5)); m_screenram[offset].b = mix_channel(m_screenram[offset].b, expand_rgb5_to_rgb8(rgb)); } -void vii_state::set_pixel(uint32_t offset, uint16_t rgb) +void spg2xx_game_state::set_pixel(uint32_t offset, uint16_t rgb) { m_screenram[offset].r = expand_rgb5_to_rgb8(rgb >> 10); m_screenram[offset].g = expand_rgb5_to_rgb8(rgb >> 5); m_screenram[offset].b = expand_rgb5_to_rgb8(rgb); } -void vii_state::blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t xoff, uint32_t yoff, uint32_t attr, uint32_t ctrl, uint32_t bitmap_addr, uint16_t tile) +void spg2xx_game_state::blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t xoff, uint32_t yoff, uint32_t attr, uint32_t ctrl, uint32_t bitmap_addr, uint16_t tile) { address_space &space = m_maincpu->space(AS_PROGRAM); @@ -280,23 +306,23 @@ void vii_state::blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t x palette_offset >>= nc; palette_offset <<= nc; - uint32_t m = bitmap_addr + nc*w*h/16*tile; + uint32_t m = bitmap_addr + nc * w*h / 16 * tile; uint32_t bits = 0; uint32_t nbits = 0; uint32_t x, y; - for(y = 0; y < h; y++) + for (y = 0; y < h; y++) { uint32_t yy = (yoff + (y ^ yflipmask)) & 0x1ff; - for(x = 0; x < w; x++) + for (x = 0; x < w; x++) { uint32_t xx = (xoff + (x ^ xflipmask)) & 0x1ff; uint32_t pal; bits <<= nc; - if(nbits < nc) + if (nbits < nc) { uint16_t b = space.read_word(m++ & 0x3fffff); b = (b << 8) | (b >> 8); @@ -308,23 +334,23 @@ void vii_state::blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t x pal = palette_offset | (bits >> 16); bits &= 0xffff; - if((ctrl & 0x0010) && yy < 240) + if ((ctrl & 0x0010) && yy < 240) { xx = (xx - (int16_t)m_p_rowscroll[yy]) & 0x01ff; } - if(xx < 320 && yy < 240) + if (xx < 320 && yy < 240) { uint16_t rgb = m_p_palette[pal]; - if(!(rgb & 0x8000)) + if (!(rgb & 0x8000)) { if (attr & 0x4000) { - mix_pixel(xx + 320*yy, rgb); + mix_pixel(xx + 320 * yy, rgb); } else { - set_pixel(xx + 320*yy, rgb); + set_pixel(xx + 320 * yy, rgb); } } } @@ -332,7 +358,7 @@ void vii_state::blit(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t x } } -void vii_state::blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, uint32_t bitmap_addr, uint16_t *regs) +void spg2xx_game_state::blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, uint32_t bitmap_addr, uint16_t *regs) { uint32_t x0, y0; uint32_t xscroll = regs[0]; @@ -344,12 +370,12 @@ void vii_state::blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int d uint32_t h, w, hn, wn; address_space &space = m_maincpu->space(AS_PROGRAM); - if(!(ctrl & PAGE_ENABLE_MASK)) + if (!(ctrl & PAGE_ENABLE_MASK)) { return; } - if(((attr & PAGE_DEPTH_FLAG_MASK) >> PAGE_DEPTH_FLAG_SHIFT) != depth) + if (((attr & PAGE_DEPTH_FLAG_MASK) >> PAGE_DEPTH_FLAG_SHIFT) != depth) { return; } @@ -360,21 +386,21 @@ void vii_state::blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int d hn = 256 / h; wn = 512 / w; - for(y0 = 0; y0 < hn; y0++) + for (y0 = 0; y0 < hn; y0++) { - for(x0 = 0; x0 < wn; x0++) + for (x0 = 0; x0 < wn; x0++) { uint16_t tile = space.read_word(tilemap + x0 + wn * y0); uint16_t palette = 0; uint32_t xx, yy; - if(!tile) + if (!tile) { continue; } palette = space.read_word(palette_map + (x0 + wn * y0) / 2); - if(x0 & 1) + if (x0 & 1) { palette >>= 8; } @@ -401,7 +427,7 @@ void vii_state::blit_page(bitmap_rgb32 &bitmap, const rectangle &cliprect, int d } } -void vii_state::blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, uint32_t base_addr) +void spg2xx_game_state::blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth, uint32_t base_addr) { address_space &space = m_maincpu->space(AS_PROGRAM); uint16_t tile, attr; @@ -414,17 +440,17 @@ void vii_state::blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y = space.read_word(base_addr + 2); attr = space.read_word(base_addr + 3); - if(!tile) + if (!tile) { return; } - if(((attr & PAGE_DEPTH_FLAG_MASK) >> PAGE_DEPTH_FLAG_SHIFT) != depth) + if (((attr & PAGE_DEPTH_FLAG_MASK) >> PAGE_DEPTH_FLAG_SHIFT) != depth) { return; } - if(m_centered_coordinates) + if (m_centered_coordinates) { x = 160 + x; y = 120 - y; @@ -432,8 +458,8 @@ void vii_state::blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT); w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT); - x -= (w/2); - y -= (h/2) - 8; + x -= (w / 2); + y -= (h / 2) - 8; } x &= 0x01ff; @@ -442,7 +468,7 @@ void vii_state::blit_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprect, int blit(bitmap, cliprect, x, y, attr, 0, bitmap_addr, tile); } -void vii_state::blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth) +void spg2xx_game_state::blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int depth) { uint32_t n; @@ -451,16 +477,16 @@ void vii_state::blit_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, in return; } - for(n = 0; n < 256; n++) + for (n = 0; n < 256; n++) { //if(space.read_word(0x2c00 + 4*n) { - blit_sprite(bitmap, cliprect, depth, 0x2c00 + 4*n); + blit_sprite(bitmap, cliprect, depth, 0x2c00 + 4 * n); } } } -uint32_t vii_state::screen_update_vii(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t spg2xx_game_state::screen_update_vii(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { int i, x, y; @@ -468,18 +494,18 @@ uint32_t vii_state::screen_update_vii(screen_device &screen, bitmap_rgb32 &bitma memset(m_screenram, 0, sizeof(m_screenram)); - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { blit_page(bitmap, cliprect, i, 0x40 * m_video_regs[0x20], m_video_regs + 0x10); blit_page(bitmap, cliprect, i, 0x40 * m_video_regs[0x21], m_video_regs + 0x16); blit_sprites(bitmap, cliprect, i); } - for(y = 0; y < 240; y++) + for (y = 0; y < 240; y++) { - for(x = 0; x < 320; x++) + for (x = 0; x < 320; x++) { - bitmap.pix32(y, x) = (m_screenram[x + 320*y].r << 16) | (m_screenram[x + 320*y].g << 8) | m_screenram[x + 320*y].b; + bitmap.pix32(y, x) = (m_screenram[x + 320 * y].r << 16) | (m_screenram[x + 320 * y].g << 8) | m_screenram[x + 320 * y].b; } } @@ -490,117 +516,117 @@ uint32_t vii_state::screen_update_vii(screen_device &screen, bitmap_rgb32 &bitma * Machine Hardware * *************************/ -void vii_state::do_dma(uint32_t len) +void spg2xx_game_state::do_dma(uint32_t len) { address_space &mem = m_maincpu->space(AS_PROGRAM); uint32_t src = m_video_regs[0x70]; uint32_t dst = m_video_regs[0x71] + 0x2c00; uint32_t j; - for(j = 0; j < len; j++) + for (j = 0; j < len; j++) { - mem.write_word(dst+j, mem.read_word(src+j)); + mem.write_word(dst + j, mem.read_word(src + j)); } m_video_regs[0x72] = 0; m_video_regs[0x63] |= 4; } -READ16_MEMBER( vii_state::video_r ) +READ16_MEMBER(spg2xx_game_state::video_r) { - switch(offset) + switch (offset) { - case 0x62: // Video IRQ Enable - verboselog(0, "video_r: Video IRQ Enable: %04x\n", VII_VIDEO_IRQ_ENABLE); - return VII_VIDEO_IRQ_ENABLE; + case 0x62: // Video IRQ Enable + verboselog(0, "video_r: Video IRQ Enable: %04x\n", VII_VIDEO_IRQ_ENABLE); + return VII_VIDEO_IRQ_ENABLE; - case 0x63: // Video IRQ Status - verboselog(0, "video_r: Video IRQ Status: %04x\n", VII_VIDEO_IRQ_STATUS); - return VII_VIDEO_IRQ_STATUS; + case 0x63: // Video IRQ Status + verboselog(0, "video_r: Video IRQ Status: %04x\n", VII_VIDEO_IRQ_STATUS); + return VII_VIDEO_IRQ_STATUS; - default: - verboselog(0, "video_r: Unknown register %04x = %04x\n", 0x2800 + offset, m_video_regs[offset]); - break; + default: + verboselog(0, "video_r: Unknown register %04x = %04x\n", 0x2800 + offset, m_video_regs[offset]); + break; } return m_video_regs[offset]; } -WRITE16_MEMBER( vii_state::video_w ) +WRITE16_MEMBER(spg2xx_game_state::video_w) { - switch(offset) + switch (offset) { - case 0x10: case 0x16: // page 1,2 X scroll - data &= 0x01ff; - COMBINE_DATA(&m_video_regs[offset]); - break; - - case 0x11: case 0x17: // page 1,2 Y scroll - data &= 0x00ff; - COMBINE_DATA(&m_video_regs[offset]); - break; - case 0x36: // IRQ pos V - case 0x37: // IRQ pos H - data &= 0x01ff; - COMBINE_DATA(&m_video_regs[offset]); - break; - case 0x62: // Video IRQ Enable - verboselog(0, "video_w: Video IRQ Enable = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&VII_VIDEO_IRQ_ENABLE); - break; - - case 0x63: // Video IRQ Acknowledge - verboselog(0, "video_w: Video IRQ Acknowledge = %04x (%04x)\n", data, mem_mask); - VII_VIDEO_IRQ_STATUS &= ~data; - if(!VII_VIDEO_IRQ_STATUS) - { - m_maincpu->set_input_line(UNSP_IRQ0_LINE, CLEAR_LINE); - } - break; - - case 0x70: // Video DMA Source - verboselog(0, "video_w: Video DMA Source = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_video_regs[offset]); - break; - - case 0x71: // Video DMA Dest - verboselog(0, "video_w: Video DMA Dest = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_video_regs[offset]); - break; - - case 0x72: // Video DMA Length - verboselog(0, "video_w: Video DMA Length = %04x (%04x)\n", data, mem_mask); - do_dma(data); - break; - - default: - verboselog(0, "video_w: Unknown register %04x = %04x (%04x)\n", 0x2800 + offset, data, mem_mask); - COMBINE_DATA(&m_video_regs[offset]); - break; + case 0x10: case 0x16: // page 1,2 X scroll + data &= 0x01ff; + COMBINE_DATA(&m_video_regs[offset]); + break; + + case 0x11: case 0x17: // page 1,2 Y scroll + data &= 0x00ff; + COMBINE_DATA(&m_video_regs[offset]); + break; + case 0x36: // IRQ pos V + case 0x37: // IRQ pos H + data &= 0x01ff; + COMBINE_DATA(&m_video_regs[offset]); + break; + case 0x62: // Video IRQ Enable + verboselog(0, "video_w: Video IRQ Enable = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&VII_VIDEO_IRQ_ENABLE); + break; + + case 0x63: // Video IRQ Acknowledge + verboselog(0, "video_w: Video IRQ Acknowledge = %04x (%04x)\n", data, mem_mask); + VII_VIDEO_IRQ_STATUS &= ~data; + if (!VII_VIDEO_IRQ_STATUS) + { + m_maincpu->set_input_line(UNSP_IRQ0_LINE, CLEAR_LINE); + } + break; + + case 0x70: // Video DMA Source + verboselog(0, "video_w: Video DMA Source = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_video_regs[offset]); + break; + + case 0x71: // Video DMA Dest + verboselog(0, "video_w: Video DMA Dest = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_video_regs[offset]); + break; + + case 0x72: // Video DMA Length + verboselog(0, "video_w: Video DMA Length = %04x (%04x)\n", data, mem_mask); + do_dma(data); + break; + + default: + verboselog(0, "video_w: Unknown register %04x = %04x (%04x)\n", 0x2800 + offset, data, mem_mask); + COMBINE_DATA(&m_video_regs[offset]); + break; } } -READ16_MEMBER( vii_state::audio_r ) +READ16_MEMBER(spg2xx_game_state::audio_r) { - switch(offset) + switch (offset) { - default: - verboselog(4, "audio_r: Unknown register %04x\n", 0x3000 + offset); - break; + default: + verboselog(4, "audio_r: Unknown register %04x\n", 0x3000 + offset); + break; } return 0; } -WRITE16_MEMBER( vii_state::audio_w ) +WRITE16_MEMBER(spg2xx_game_state::audio_w) { - switch(offset) + switch (offset) { - default: - verboselog(4, "audio_w: Unknown register %04x = %04x (%04x)\n", 0x3000 + offset, data, mem_mask); - break; + default: + verboselog(4, "audio_w: Unknown register %04x = %04x (%04x)\n", 0x3000 + offset, data, mem_mask); + break; } } -void vii_state::switch_bank(uint32_t bank) +void spg2xx_game_state::switch_bank(uint32_t bank) { if (bank != m_current_bank) { @@ -609,90 +635,123 @@ void vii_state::switch_bank(uint32_t bank) } } -void vii_state::do_gpio(uint32_t offset) +uint16_t spg2xx_cart_state::do_spg243_vii_io(uint16_t what, int index) { - uint32_t index = (offset - 1) / 5; - uint16_t buffer = m_io_regs[5*index + 2]; - uint16_t dir = m_io_regs[5*index + 3]; - uint16_t attr = m_io_regs[5*index + 4]; - uint16_t special= m_io_regs[5*index + 5]; - - uint16_t push = dir; - uint16_t pull = (~dir) & (~attr); - uint16_t what = (buffer & (push | pull)); - what ^= (dir & ~attr); - what &= ~special; + if (index == 1) + { + uint32_t bank = ((what & 0x80) >> 7) | ((what & 0x20) >> 4); + switch_bank(bank); + } + return what; +} - if (m_spg243_mode == SPG243_VII) +uint16_t spg2xx_cart_state::do_spg243_vsmile_io(uint16_t what, int index) +{ + // TODO: find out how vsmile accesses these GPIO regs! + return what; +} + +uint16_t spg2xx_game_state::do_spg243_batman_io(uint16_t what, int index) +{ + if (index == 0) { - if(index == 1) - { - uint32_t bank = ((what & 0x80) >> 7) | ((what & 0x20) >> 4); - switch_bank(bank); - } + uint16_t temp = m_io_p1->read(); + what |= (temp & 0x0001) ? 0x8000 : 0; + what |= (temp & 0x0002) ? 0x4000 : 0; + what |= (temp & 0x0004) ? 0x2000 : 0; + what |= (temp & 0x0008) ? 0x1000 : 0; + what |= (temp & 0x0010) ? 0x0800 : 0; + what |= (temp & 0x0020) ? 0x0400 : 0; + what |= (temp & 0x0040) ? 0x0200 : 0; + what |= (temp & 0x0080) ? 0x0100 : 0; } - else if (m_spg243_mode == SPG243_BATMAN) + + if (index == 2) { - if(index == 0) - { - uint16_t temp = m_io_p1->read(); - what |= (temp & 0x0001) ? 0x8000 : 0; - what |= (temp & 0x0002) ? 0x4000 : 0; - what |= (temp & 0x0004) ? 0x2000 : 0; - what |= (temp & 0x0008) ? 0x1000 : 0; - what |= (temp & 0x0010) ? 0x0800 : 0; - what |= (temp & 0x0020) ? 0x0400 : 0; - what |= (temp & 0x0040) ? 0x0200 : 0; - what |= (temp & 0x0080) ? 0x0100 : 0; - } + // TODO: what is here? + } - if(index == 2) - { - } + return what; +} + +uint16_t spg2xx_game_state::do_spg240_rad_skat_io(uint16_t what, int index) +{ + // have not checked for outputs yet. + + if (index == 0) + { + what = m_io_p1->read(); } - else if (m_spg243_mode == SPG243_VSMILE) + else if (index == 1) { - // TODO: find out how vsmile accesses these GPIO regs! + what = m_io_p2->read(); } - else if (m_spg243_mode == SPG243_WIRELESS60) + else if (index == 2) { - if(index == 0) - { - switch(what & 0x300) - { - case 0x300: - m_w60_controller_input = -1; - break; - - case 0x200: - m_w60_controller_input++; - break; - - default: - uint16_t temp1 = m_io_p1->read(); - uint16_t temp2 = m_io_p2->read(); - uint16_t temp3 = 1 << m_w60_controller_input; - if (temp1 & temp3) what ^= 0x400; - if (temp2 & temp3) what ^= 0x800; - break; - } - } + what = m_io_p3->read(); + } + return what; +} - if(index == 1) +uint16_t spg2xx_game_state::do_spg243_wireless60_io(uint16_t what, int index) +{ + if (index == 0) + { + switch (what & 0x300) { - uint32_t bank = (what & 7); - switch_bank(bank); + case 0x300: + m_w60_controller_input = -1; + break; + + case 0x200: + m_w60_controller_input++; + break; + + default: + uint16_t temp1 = m_io_p1->read(); + uint16_t temp2 = m_io_p2->read(); + uint16_t temp3 = 1 << m_w60_controller_input; + if (temp1 & temp3) what ^= 0x400; + if (temp2 & temp3) what ^= 0x800; + break; } } - m_io_regs[5*index + 1] = what; + if (index == 1) + { + uint32_t bank = (what & 7); + switch_bank(bank); + } + + return what; } -void vii_state::do_i2c() + +void spg2xx_game_state::do_gpio(uint32_t offset) { + uint32_t index = (offset - 1) / 5; + uint16_t buffer = m_io_regs[5 * index + 2]; + uint16_t dir = m_io_regs[5 * index + 3]; + uint16_t attr = m_io_regs[5 * index + 4]; + uint16_t special = m_io_regs[5 * index + 5]; + + uint16_t push = dir; + uint16_t pull = (~dir) & (~attr); + uint16_t what = (buffer & (push | pull)); + what ^= (dir & ~attr); + what &= ~special; + + if (!m_vii_io_rw.isnull()) + what = m_vii_io_rw(what, index); + + m_io_regs[5 * index + 1] = what; } -void vii_state::spg_do_dma(uint32_t len) +void spg2xx_game_state::do_i2c() +{ +} + +void spg2xx_game_state::spg_do_dma(uint32_t len) { address_space &mem = m_maincpu->space(AS_PROGRAM); @@ -700,225 +759,230 @@ void vii_state::spg_do_dma(uint32_t len) uint32_t dst = m_io_regs[0x103] & 0x3fff; uint32_t j; - for(j = 0; j < len; j++) - mem.write_word(dst+j, mem.read_word(src+j)); + for (j = 0; j < len; j++) + mem.write_word(dst + j, mem.read_word(src + j)); m_io_regs[0x102] = 0; } -READ16_MEMBER( vii_state::io_r ) +READ16_MEMBER(spg2xx_game_state::io_r) { + logerror("io_r %04x\n", offset); + static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" }; static const char gpioports[] = { 'A', 'B', 'C' }; uint16_t val = m_io_regs[offset]; - switch(offset) + switch (offset) { - case 0x01: case 0x06: case 0x0b: // GPIO Data Port A/B/C - do_gpio(offset); - verboselog(3, "io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask); - val = m_io_regs[offset]; - break; - - case 0x02: case 0x03: case 0x04: case 0x05: - case 0x07: case 0x08: case 0x09: case 0x0a: - case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Other GPIO regs - verboselog(3, "io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask); - break; - - case 0x1c: // Random - val = machine().rand() & 0x00ff; - verboselog(3, "io_r: Random = %04x (%04x)\n", val, mem_mask); - break; - - case 0x21: // IRQ Control - verboselog(3, "io_r: Controller IRQ Control = %04x (%04x)\n", val, mem_mask); - break; - - case 0x22: // IRQ Status - verboselog(3, "io_r: Controller IRQ Status = %04x (%04x)\n", val, mem_mask); - break; - - case 0x2c: case 0x2d: // Timers? - val = machine().rand() & 0x0000ffff; - verboselog(3, "io_r: Unknown Timer %d Register = %04x (%04x)\n", offset - 0x2c, val, mem_mask); - break; - - case 0x2f: // Data Segment - val = m_maincpu->state_int(UNSP_SR) >> 10; - verboselog(3, "io_r: Data Segment = %04x (%04x)\n", val, mem_mask); - break; - - case 0x31: // Unknown, UART Status? - verboselog(3, "io_r: Unknown (UART Status?) = %04x (%04x)\n", 3, mem_mask); - val = 3; - break; - - case 0x36: // UART RX Data - val = m_controller_input[m_uart_rx_count]; - m_uart_rx_count = (m_uart_rx_count + 1) % 8; - verboselog(3, "io_r: UART RX Data = %04x (%04x)\n", val, mem_mask); - break; - - case 0x59: // I2C Status - verboselog(3, "io_r: I2C Status = %04x (%04x)\n", val, mem_mask); - break; - - case 0x5e: // I2C Data In - verboselog(3, "io_r: I2C Data In = %04x (%04x)\n", val, mem_mask); - break; - - default: - verboselog(3, "io_r: Unknown register %04x\n", 0x3d00 + offset); - break; + case 0x01: case 0x06: case 0x0b: // GPIO Data Port A/B/C + do_gpio(offset); + verboselog(3, "io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask); + val = m_io_regs[offset]; + break; + + case 0x02: case 0x03: case 0x04: case 0x05: + case 0x07: case 0x08: case 0x09: case 0x0a: + case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Other GPIO regs + verboselog(3, "io_r: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], m_io_regs[offset], mem_mask); + break; + + case 0x1c: // Random + val = machine().rand() & 0x00ff; + verboselog(3, "io_r: Random = %04x (%04x)\n", val, mem_mask); + break; + + case 0x21: // IRQ Control + verboselog(3, "io_r: Controller IRQ Control = %04x (%04x)\n", val, mem_mask); + break; + + case 0x22: // IRQ Status + verboselog(3, "io_r: Controller IRQ Status = %04x (%04x)\n", val, mem_mask); + break; + + case 0x2b: + return 0x0000; + + case 0x2c: case 0x2d: // Timers? + val = machine().rand() & 0x0000ffff; + verboselog(3, "io_r: Unknown Timer %d Register = %04x (%04x)\n", offset - 0x2c, val, mem_mask); + break; + + case 0x2f: // Data Segment + val = m_maincpu->state_int(UNSP_SR) >> 10; + verboselog(3, "io_r: Data Segment = %04x (%04x)\n", val, mem_mask); + break; + + case 0x31: // Unknown, UART Status? + verboselog(3, "io_r: Unknown (UART Status?) = %04x (%04x)\n", 3, mem_mask); + val = 3; + break; + + case 0x36: // UART RX Data + val = m_controller_input[m_uart_rx_count]; + m_uart_rx_count = (m_uart_rx_count + 1) % 8; + verboselog(3, "io_r: UART RX Data = %04x (%04x)\n", val, mem_mask); + break; + + case 0x59: // I2C Status + verboselog(3, "io_r: I2C Status = %04x (%04x)\n", val, mem_mask); + break; + + case 0x5e: // I2C Data In + verboselog(3, "io_r: I2C Data In = %04x (%04x)\n", val, mem_mask); + break; + + default: + verboselog(3, "io_r: Unknown register %04x\n", 0x3d00 + offset); + break; } return val; } -WRITE16_MEMBER( vii_state::io_w ) +WRITE16_MEMBER(spg2xx_game_state::io_w) { static const char *const gpioregs[] = { "GPIO Data Port", "GPIO Buffer Port", "GPIO Direction Port", "GPIO Attribute Port", "GPIO IRQ/Latch Port" }; static const char gpioports[3] = { 'A', 'B', 'C' }; uint16_t temp = 0; - switch(offset) + switch (offset) { - case 0x00: // GPIO special function select - verboselog(3, "io_w: GPIO Function Select = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x01: case 0x06: case 0x0b: // GPIO data, port A/B/C - offset++; - // Intentional fallthrough - - case 0x02: case 0x03: case 0x04: case 0x05: // Port A - case 0x07: case 0x08: case 0x09: case 0x0a: // Port B - case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Port C - verboselog(3, "io_w: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - do_gpio(offset); - break; - - case 0x10: // timebase control - if ((m_io_regs[offset] & 0x0003) != (data & 0x0003)) { - uint16_t hz = 8 << (data & 0x0003); - verboselog(3, "*** TMB1 FREQ set to %dHz\n", hz); - m_tmb1->adjust(attotime::zero, 0, attotime::from_hz( hz )); - } - if ((m_io_regs[offset] & 0x000c) != (data & 0x000c)) { - uint16_t hz = 128 << ((data & 0x000c) >> 2); - verboselog(3, "*** TMB2 FREQ set to %dHz\n", hz); - m_tmb2->adjust(attotime::zero, 0, attotime::from_hz( hz )); - } - COMBINE_DATA(&m_io_regs[offset]); - break; - case 0x21: // IRQ Enable - verboselog(3, "io_w: Controller IRQ Control = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&VII_CTLR_IRQ_ENABLE); - if(!VII_CTLR_IRQ_ENABLE) - { - m_maincpu->set_input_line(UNSP_IRQ3_LINE, CLEAR_LINE); - } - break; - - case 0x22: // IRQ Acknowledge - verboselog(3, "io_w: Controller IRQ Acknowledge = %04x (%04x)\n", data, mem_mask); - m_io_regs[0x22] &= ~data; - if(!m_io_regs[0x22]) - { - m_maincpu->set_input_line(UNSP_IRQ3_LINE, CLEAR_LINE); - } - break; - - case 0x2f: // Data Segment - temp = m_maincpu->state_int(UNSP_SR); - m_maincpu->set_state_int(UNSP_SR, (temp & 0x03ff) | ((data & 0x3f) << 10)); - verboselog(3, "io_w: Data Segment = %04x (%04x)\n", data, mem_mask); - break; - - case 0x31: // Unknown UART - verboselog(3, "io_w: Unknown UART = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x32: // UART Reset - verboselog(3, "io_w: UART Reset\n"); - break; - - case 0x33: // UART Baud Rate - verboselog(3, "io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (m_io_regs[0x34] << 8) - data)); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x35: // UART TX Data - verboselog(3, "io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (data << 8) - m_io_regs[0x33])); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5a: // I2C Access Mode - verboselog(3, "io_w: I2C Access Mode = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5b: // I2C Device Address - verboselog(3, "io_w: I2C Device Address = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5c: // I2C Sub-Address - verboselog(3, "io_w: I2C Sub-Address = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5d: // I2C Data Out - verboselog(3, "io_w: I2C Data Out = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5e: // I2C Data In - verboselog(3, "io_w: I2C Data In = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x5f: // I2C Controller Mode - verboselog(3, "io_w: I2C Controller Mode = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x58: // I2C Command - verboselog(3, "io_w: I2C Command = %04x (%04x)\n", data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - do_i2c(); - break; - - case 0x59: // I2C Status / IRQ Acknowledge(?) - verboselog(3, "io_w: I2C Status / Ack = %04x (%04x)\n", data, mem_mask); - m_io_regs[offset] &= ~data; - break; - - case 0x100: // DMA Source (L) - case 0x101: // DMA Source (H) - case 0x103: // DMA Destination - COMBINE_DATA(&m_io_regs[offset]); - break; - - case 0x102: // DMA Length - spg_do_dma(data); - break; + case 0x00: // GPIO special function select + verboselog(3, "io_w: GPIO Function Select = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x01: case 0x06: case 0x0b: // GPIO data, port A/B/C + offset++; + // Intentional fallthrough + + case 0x02: case 0x03: case 0x04: case 0x05: // Port A + case 0x07: case 0x08: case 0x09: case 0x0a: // Port B + case 0x0c: case 0x0d: case 0x0e: case 0x0f: // Port C + verboselog(3, "io_w: %s %c = %04x (%04x)\n", gpioregs[(offset - 1) % 5], gpioports[(offset - 1) / 5], data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + do_gpio(offset); + break; + + case 0x10: // timebase control + if ((m_io_regs[offset] & 0x0003) != (data & 0x0003)) { + uint16_t hz = 8 << (data & 0x0003); + verboselog(3, "*** TMB1 FREQ set to %dHz\n", hz); + m_tmb1->adjust(attotime::zero, 0, attotime::from_hz(hz)); + } + if ((m_io_regs[offset] & 0x000c) != (data & 0x000c)) { + uint16_t hz = 128 << ((data & 0x000c) >> 2); + verboselog(3, "*** TMB2 FREQ set to %dHz\n", hz); + m_tmb2->adjust(attotime::zero, 0, attotime::from_hz(hz)); + } + COMBINE_DATA(&m_io_regs[offset]); + break; + case 0x21: // IRQ Enable + verboselog(3, "io_w: Controller IRQ Control = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&VII_CTLR_IRQ_ENABLE); + if (!VII_CTLR_IRQ_ENABLE) + { + m_maincpu->set_input_line(UNSP_IRQ3_LINE, CLEAR_LINE); + } + break; - default: - verboselog(3, "io_w: Unknown register %04x = %04x (%04x)\n", 0x3d00 + offset, data, mem_mask); - COMBINE_DATA(&m_io_regs[offset]); - break; + case 0x22: // IRQ Acknowledge + verboselog(3, "io_w: Controller IRQ Acknowledge = %04x (%04x)\n", data, mem_mask); + m_io_regs[0x22] &= ~data; + if (!m_io_regs[0x22]) + { + m_maincpu->set_input_line(UNSP_IRQ3_LINE, CLEAR_LINE); + } + break; + + case 0x2f: // Data Segment + temp = m_maincpu->state_int(UNSP_SR); + m_maincpu->set_state_int(UNSP_SR, (temp & 0x03ff) | ((data & 0x3f) << 10)); + verboselog(3, "io_w: Data Segment = %04x (%04x)\n", data, mem_mask); + break; + + case 0x31: // Unknown UART + verboselog(3, "io_w: Unknown UART = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x32: // UART Reset + verboselog(3, "io_w: UART Reset\n"); + break; + + case 0x33: // UART Baud Rate + verboselog(3, "io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (m_io_regs[0x34] << 8) - data)); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x35: // UART TX Data + verboselog(3, "io_w: UART Baud Rate = %u\n", 27000000 / 16 / (0x10000 - (data << 8) - m_io_regs[0x33])); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5a: // I2C Access Mode + verboselog(3, "io_w: I2C Access Mode = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5b: // I2C Device Address + verboselog(3, "io_w: I2C Device Address = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5c: // I2C Sub-Address + verboselog(3, "io_w: I2C Sub-Address = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5d: // I2C Data Out + verboselog(3, "io_w: I2C Data Out = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5e: // I2C Data In + verboselog(3, "io_w: I2C Data In = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x5f: // I2C Controller Mode + verboselog(3, "io_w: I2C Controller Mode = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x58: // I2C Command + verboselog(3, "io_w: I2C Command = %04x (%04x)\n", data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + do_i2c(); + break; + + case 0x59: // I2C Status / IRQ Acknowledge(?) + verboselog(3, "io_w: I2C Status / Ack = %04x (%04x)\n", data, mem_mask); + m_io_regs[offset] &= ~data; + break; + + case 0x100: // DMA Source (L) + case 0x101: // DMA Source (H) + case 0x103: // DMA Destination + COMBINE_DATA(&m_io_regs[offset]); + break; + + case 0x102: // DMA Length + spg_do_dma(data); + break; + + default: + verboselog(3, "io_w: Unknown register %04x = %04x (%04x)\n", 0x3d00 + offset, data, mem_mask); + COMBINE_DATA(&m_io_regs[offset]); + break; } } /* -WRITE16_MEMBER( vii_state::rowscroll_w ) +WRITE16_MEMBER( spg2xx_game_state::rowscroll_w ) { switch(offset) { @@ -928,7 +992,7 @@ WRITE16_MEMBER( vii_state::rowscroll_w ) } } -WRITE16_MEMBER( vii_state::spriteram_w ) +WRITE16_MEMBER( spg2xx_game_state::spriteram_w ) { switch(offset) { @@ -939,7 +1003,7 @@ WRITE16_MEMBER( vii_state::spriteram_w ) } */ -static ADDRESS_MAP_START( vii_mem, AS_PROGRAM, 16, vii_state ) +static ADDRESS_MAP_START( vii_mem, AS_PROGRAM, 16, spg2xx_game_state ) AM_RANGE( 0x000000, 0x0027ff ) AM_RAM AM_SHARE("p_ram") AM_RANGE( 0x002800, 0x0028ff ) AM_READWRITE(video_r, video_w) AM_RANGE( 0x002900, 0x002aff ) AM_RAM AM_SHARE("p_rowscroll") @@ -952,73 +1016,106 @@ ADDRESS_MAP_END static INPUT_PORTS_START( vii ) PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Button A") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Button B") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Button C") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Button D") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Button A") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Button B") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Button C") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Button D") INPUT_PORTS_END static INPUT_PORTS_START( batman ) PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Menu") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("B Button") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("X Button") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Menu") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("B Button") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("X Button") INPUT_PORTS_END static INPUT_PORTS_START( vsmile ) PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Menu") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("B Button") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("X Button") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Menu") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("B Button") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("X Button") INPUT_PORTS_END static INPUT_PORTS_START( walle ) PORT_START("P1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("B Button") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("B Button") INPUT_PORTS_END static INPUT_PORTS_START( wirels60 ) PORT_START("P1") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("B Button") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Menu") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Start") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_NAME("Joypad Up") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_NAME("Joypad Down") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_NAME("Joypad Left") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_NAME("Joypad Right") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("A Button") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("B Button") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Menu") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Start") + PORT_START("P2") - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_NAME("Joypad Up") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_NAME("Joypad Down") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_NAME("Joypad Left") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_NAME("Joypad Right") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("A Button") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("B Button") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("Menu") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("Start") + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_NAME("Joypad Up") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_NAME("Joypad Down") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_NAME("Joypad Left") + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_NAME("Joypad Right") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("A Button") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("B Button") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("Menu") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("Start") INPUT_PORTS_END +static INPUT_PORTS_START( rad_skat ) + PORT_START("P1") + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Full Left") + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Full Right") + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Slight Left") // you have to use this for the menus (eg trick lists) + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("Slight Right") + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Front") + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Back") + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) + // there only seem to be 3 buttons on the pad part, so presumably all the above are the skateboard, and below are the pad? + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("M Button") + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("X Button") + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("O Button") + PORT_BIT( 0xf800, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("P2") + PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED ) // read but unused? + + + PORT_START("P3") // PAL/NTSC flag + PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_SPECIAL ) +INPUT_PORTS_END -void vii_state::test_centered(uint8_t *ROM) +static INPUT_PORTS_START( rad_skatp ) + PORT_INCLUDE(rad_skat) + + PORT_MODIFY("P3") // PAL/NTSC flag + PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) +INPUT_PORTS_END + + + +void spg2xx_game_state::test_centered(uint8_t *ROM) { if (ROM[0x3cd808] == 0x99 && ROM[0x3cd809] == 0x99 && @@ -1033,46 +1130,33 @@ void vii_state::test_centered(uint8_t *ROM) } } -DEVICE_IMAGE_LOAD_MEMBER( vii_state, vii_cart ) -{ - uint32_t size = m_cart->common_get_size("rom"); - - if (size < 0x800000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - return image_init_result::FAIL; - } - - m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - test_centered(m_cart->get_rom_base()); - return image_init_result::PASS; -} -DEVICE_IMAGE_LOAD_MEMBER( vii_state, vsmile_cart ) +TIMER_CALLBACK_MEMBER(spg2xx_game_state::tmb1_tick) { - uint32_t size = m_cart->common_get_size("rom"); - - m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); - m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); - - return image_init_result::PASS; + m_io_regs[0x22] |= 1; } - -TIMER_CALLBACK_MEMBER(vii_state::tmb1_tick) +TIMER_CALLBACK_MEMBER(spg2xx_game_state::tmb2_tick) { - m_io_regs[0x22] |= 1; + m_io_regs[0x22] |= 2; } -TIMER_CALLBACK_MEMBER(vii_state::tmb2_tick) +void spg2xx_cart_state::machine_start() { - m_io_regs[0x22] |= 2; + spg2xx_game_state::machine_start(); + + // if there's a cart, override the standard banking + if (m_cart && m_cart->exists()) + { + std::string region_tag; + m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); + m_bank->configure_entries(0, ceilf((float)m_cart_rom->bytes() / 0x800000), m_cart_rom->base(), 0x800000); + m_bank->set_entry(0); + } } -void vii_state::machine_start() +void spg2xx_game_state::machine_start() { memset(m_video_regs, 0, 0x100 * sizeof(uint16_t)); memset(m_io_regs, 0, 0x100 * sizeof(uint16_t)); @@ -1084,44 +1168,28 @@ void vii_state::machine_start() m_controller_input[7] = 0; m_w60_controller_input = -1; - if (m_cart && m_cart->exists()) - { - std::string region_tag; - m_cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); - m_bank->configure_entries(0, ceilf((float)m_cart_rom->bytes()/0x800000), m_cart_rom->base(), 0x800000 ); - m_bank->set_entry(0); - } - else if (m_spg243_mode == SPG243_VII || m_spg243_mode == SPG243_WIRELESS60) // Vii bios is banked - { - m_bank->configure_entries(0, ceilf((float)m_bios_rom->bytes()/0x800000), m_bios_rom->base(), 0x800000 ); - m_bank->set_entry(0); - } - else - { - m_bank->configure_entries(0, ceilf((float)memregion("maincpu")->bytes()/0x800000), memregion("maincpu")->base(), 0x800000 ); - m_bank->set_entry(0); - } - m_video_regs[0x36] = 0xffff; m_video_regs[0x37] = 0xffff; - m_tmb1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vii_state::tmb1_tick),this)); - m_tmb2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vii_state::tmb2_tick),this)); + m_tmb1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_game_state::tmb1_tick), this)); + m_tmb2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(spg2xx_game_state::tmb2_tick), this)); m_tmb1->reset(); m_tmb2->reset(); + + m_bank->configure_entries(0, ceilf((float)memregion("maincpu")->bytes() / 0x800000), memregion("maincpu")->base(), 0x800000); + m_bank->set_entry(0); } -void vii_state::machine_reset() +void spg2xx_game_state::machine_reset() { } -INTERRUPT_GEN_MEMBER(vii_state::vii_vblank) +INTERRUPT_GEN_MEMBER(spg2xx_game_state::vii_vblank) { uint32_t x = machine().rand() & 0x3ff; uint32_t y = machine().rand() & 0x3ff; uint32_t z = machine().rand() & 0x3ff; - m_controller_input[0] = m_io_p1->read(); m_controller_input[1] = (uint8_t)x; m_controller_input[2] = (uint8_t)y; @@ -1137,17 +1205,17 @@ INTERRUPT_GEN_MEMBER(vii_state::vii_vblank) m_uart_rx_count = 0; VII_VIDEO_IRQ_STATUS = VII_VIDEO_IRQ_ENABLE & 1; - if(VII_VIDEO_IRQ_STATUS) + if (VII_VIDEO_IRQ_STATUS) { verboselog(0, "Video IRQ\n"); m_maincpu->set_input_line(UNSP_IRQ0_LINE, ASSERT_LINE); } -// { -// verboselog(0, "audio 1 IRQ\n"); -// m_maincpu->set_input_line(UNSP_IRQ1_LINE, ASSERT_LINE); -// } - if(m_io_regs[0x22] & m_io_regs[0x21] & 0x0c00) + // { + // verboselog(0, "audio 1 IRQ\n"); + // m_maincpu->set_input_line(UNSP_IRQ1_LINE, ASSERT_LINE); + // } + if (m_io_regs[0x22] & m_io_regs[0x21] & 0x0c00) { verboselog(0, "timerA, timer B IRQ\n"); m_maincpu->set_input_line(UNSP_IRQ2_LINE, ASSERT_LINE); @@ -1155,205 +1223,216 @@ INTERRUPT_GEN_MEMBER(vii_state::vii_vblank) //if(m_io_regs[0x22] & m_io_regs[0x21] & 0x2100) // For now trigger always if any enabled - if(VII_CTLR_IRQ_ENABLE) + if (VII_CTLR_IRQ_ENABLE) { verboselog(0, "UART, ADC IRQ\n"); m_maincpu->set_input_line(UNSP_IRQ3_LINE, ASSERT_LINE); } -// { -// verboselog(0, "audio 4 IRQ\n"); -// m_maincpu->set_input_line(UNSP_IRQ4_LINE, ASSERT_LINE); -// } + // { + // verboselog(0, "audio 4 IRQ\n"); + // m_maincpu->set_input_line(UNSP_IRQ4_LINE, ASSERT_LINE); + // } - if(m_io_regs[0x22] & m_io_regs[0x21] & 0x1200) + if (m_io_regs[0x22] & m_io_regs[0x21] & 0x1200) { verboselog(0, "External IRQ\n"); m_maincpu->set_input_line(UNSP_IRQ5_LINE, ASSERT_LINE); } - if(m_io_regs[0x22] & m_io_regs[0x21] & 0x0070) + if (m_io_regs[0x22] & m_io_regs[0x21] & 0x0070) { verboselog(0, "1024Hz, 2048HZ, 4096HZ IRQ\n"); m_maincpu->set_input_line(UNSP_IRQ6_LINE, ASSERT_LINE); } - if(m_io_regs[0x22] & m_io_regs[0x21] & 0x008b) + if (m_io_regs[0x22] & m_io_regs[0x21] & 0x008b) { verboselog(0, "TMB1, TMB2, 4Hz, key change IRQ\n"); m_maincpu->set_input_line(UNSP_IRQ7_LINE, ASSERT_LINE); } +} + + + +DEVICE_IMAGE_LOAD_MEMBER(spg2xx_cart_state, vii_cart) +{ + uint32_t size = m_cart->common_get_size("rom"); + + if (size < 0x800000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return image_init_result::FAIL; + } + + m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + + test_centered(m_cart->get_rom_base()); + return image_init_result::PASS; } -MACHINE_CONFIG_START(vii_state::vii) +DEVICE_IMAGE_LOAD_MEMBER(spg2xx_cart_state, vsmile_cart) +{ + uint32_t size = m_cart->common_get_size("rom"); + + m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + return image_init_result::PASS; +} + +MACHINE_CONFIG_START(spg2xx_game_state::spg2xx_base) MCFG_CPU_ADD( "maincpu", UNSP, XTAL(27'000'000)) MCFG_CPU_PROGRAM_MAP( vii_mem ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vii_state, vii_vblank) - + MCFG_CPU_VBLANK_INT_DRIVER("screen", spg2xx_game_state, vii_vblank) MCFG_SCREEN_ADD( "screen", RASTER ) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_SIZE(320, 240) MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) - MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii) + MCFG_SCREEN_UPDATE_DRIVER(spg2xx_game_state, screen_update_vii) MCFG_PALETTE_ADD("palette", 32768) +MACHINE_CONFIG_END - MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vii_cart") - MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_LOAD(vii_state, vii_cart) +MACHINE_CONFIG_DERIVED(spg2xx_game_state::spg2xx_basep, spg2xx_base) - MCFG_SOFTWARE_LIST_ADD("vii_cart","vii") + MCFG_SCREEN_MODIFY( "screen" ) + MCFG_SCREEN_REFRESH_RATE(50) MACHINE_CONFIG_END -MACHINE_CONFIG_START(vii_state::vsmile) - - MCFG_CPU_ADD( "maincpu", UNSP, XTAL(27'000'000)) - MCFG_CPU_PROGRAM_MAP( vii_mem ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vii_state, vii_vblank) +MACHINE_CONFIG_DERIVED(spg2xx_cart_state::vii, spg2xx_base) + MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vii_cart") + MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) + MCFG_GENERIC_LOAD(spg2xx_cart_state, vii_cart) - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(320, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) - MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii) - MCFG_PALETTE_ADD("palette", 32768) + MCFG_SOFTWARE_LIST_ADD("vii_cart","vii") +MACHINE_CONFIG_END +MACHINE_CONFIG_DERIVED(spg2xx_cart_state::vsmile, spg2xx_base) MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "vsmile_cart") MCFG_GENERIC_WIDTH(GENERIC_ROM16_WIDTH) - MCFG_GENERIC_LOAD(vii_state, vsmile_cart) + MCFG_GENERIC_LOAD(spg2xx_cart_state, vsmile_cart) MCFG_SOFTWARE_LIST_ADD("cart_list","vsmile_cart") MACHINE_CONFIG_END -MACHINE_CONFIG_START(vii_state::batman) - - MCFG_CPU_ADD( "maincpu", UNSP, XTAL(27'000'000)) - MCFG_CPU_PROGRAM_MAP( vii_mem ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vii_state, vii_vblank) - - +MACHINE_CONFIG_DERIVED(spg2xx_game_state::batman, spg2xx_base) MCFG_I2CMEM_ADD("i2cmem") MCFG_I2CMEM_DATA_SIZE(0x200) - - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(320, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) - MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii) - MCFG_PALETTE_ADD("palette", 32768) MACHINE_CONFIG_END -MACHINE_CONFIG_START(vii_state::wirels60) - - MCFG_CPU_ADD( "maincpu", UNSP, XTAL(27'000'000)) - MCFG_CPU_PROGRAM_MAP( vii_mem ) - MCFG_CPU_VBLANK_INT_DRIVER("screen", vii_state, vii_vblank) - - MCFG_SCREEN_ADD( "screen", RASTER ) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(320, 240) - MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1) - MCFG_SCREEN_UPDATE_DRIVER(vii_state, screen_update_vii) - MCFG_PALETTE_ADD("palette", 32768) -MACHINE_CONFIG_END +DRIVER_INIT_MEMBER(spg2xx_cart_state, vii) +{ + m_vii_io_rw = vii_io_rw_delegate(&spg2xx_cart_state::do_spg243_vii_io, this); + m_centered_coordinates = 1; +} -DRIVER_INIT_MEMBER(vii_state,vii) +DRIVER_INIT_MEMBER(spg2xx_cart_state, vsmile) { - m_spg243_mode = SPG243_VII; + m_vii_io_rw = vii_io_rw_delegate(&spg2xx_cart_state::do_spg243_vsmile_io, this); m_centered_coordinates = 1; } -DRIVER_INIT_MEMBER(vii_state,batman) +DRIVER_INIT_MEMBER(spg2xx_game_state, batman) { - m_spg243_mode = SPG243_BATMAN; + m_vii_io_rw = vii_io_rw_delegate(&spg2xx_game_state::do_spg243_batman_io, this); m_centered_coordinates = 1; } -DRIVER_INIT_MEMBER(vii_state,vsmile) +DRIVER_INIT_MEMBER(spg2xx_game_state, rad_skat) { - m_spg243_mode = SPG243_VSMILE; + m_vii_io_rw = vii_io_rw_delegate(&spg2xx_game_state::do_spg240_rad_skat_io, this); m_centered_coordinates = 1; } -DRIVER_INIT_MEMBER(vii_state,walle) +DRIVER_INIT_MEMBER(spg2xx_game_state, walle) { - m_spg243_mode = SPG243_BATMAN; + m_vii_io_rw = vii_io_rw_delegate(&spg2xx_game_state::do_spg243_batman_io, this); m_centered_coordinates = 0; } -DRIVER_INIT_MEMBER(vii_state,wirels60) +DRIVER_INIT_MEMBER(spg2xx_game_state, wirels60) { - m_spg243_mode = SPG243_WIRELESS60; + m_vii_io_rw = vii_io_rw_delegate(&spg2xx_game_state::do_spg243_wireless60_io, this); m_centered_coordinates = 1; } ROM_START( vii ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ - - ROM_REGION( 0x2000000, "bios", 0 ) - ROM_LOAD( "vii.bin", 0x0000, 0x2000000, CRC(04627639) SHA1(f883a92d31b53c9a5b0cdb112d07cd793c95fc43)) + ROM_REGION( 0x2000000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD16_WORD_SWAP( "vii.bin", 0x0000, 0x2000000, CRC(04627639) SHA1(f883a92d31b53c9a5b0cdb112d07cd793c95fc43)) ROM_END ROM_START( batmantv ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) ROM_LOAD16_WORD_SWAP( "batman.bin", 0x000000, 0x400000, CRC(46f848e5) SHA1(5875d57bb3fe0cac5d20e626e4f82a0e5f9bb94c) ) ROM_END ROM_START( vsmile ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) ROM_LOAD( "vsmilebios.bin", 0x000000, 0x200000, CRC(11f1b416) SHA1(11f77c4973d29c962567390e41879c86a759c93b) ) ROM_END ROM_START( vsmileg ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) ROM_LOAD16_WORD_SWAP( "bios german.bin", 0x000000, 0x200000, CRC(205c5296) SHA1(7fbcf761b5885c8b1524607aabaf364b4559c8cc) ) ROM_END ROM_START( vsmilef ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) ROM_LOAD16_WORD_SWAP( "sysrom_france", 0x000000, 0x200000, CRC(0cd0bdf5) SHA1(5c8d1eada1b6b545555b8d2b09325d7127681af8) ) ROM_END ROM_START( vsmileb ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) ROM_LOAD( "vbabybios.bin", 0x000000, 0x800000, CRC(ddc7f845) SHA1(2c17d0f54200070176d03d44a40c7923636e596a) ) ROM_END ROM_START( walle ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) ROM_LOAD16_WORD_SWAP( "walle.bin", 0x000000, 0x400000, BAD_DUMP CRC(bd554cba) SHA1(6cd06a036ab12e7b0e1fd8003db873b0bb783868) ) // Alternate dump, we need to decide which one is correct. //ROM_LOAD16_WORD_SWAP( "walle.bin", 0x000000, 0x400000, CRC(6bc90b16) SHA1(184d72de059057aae7800da510fcf05ed1da9ec9)) ROM_END ROM_START( zone60 ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ - - ROM_REGION( 0x4000000, "bios", 0 ) - ROM_LOAD( "zone60.bin", 0x0000, 0x4000000, CRC(4cb637d1) SHA1(1f97cbdb4299ac0fbafc2a3aa592066cb0727066)) + ROM_REGION( 0x4000000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD16_WORD_SWAP( "zone60.bin", 0x0000, 0x4000000, CRC(4cb637d1) SHA1(1f97cbdb4299ac0fbafc2a3aa592066cb0727066)) ROM_END ROM_START( wirels60 ) - ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) /* dummy region for u'nSP */ + ROM_REGION( 0x4000000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD16_WORD_SWAP( "wirels60.bin", 0x0000, 0x4000000, CRC(b4df8b28) SHA1(00e3da542e4bc14baf4724ad436f66d4c0f65c84)) +ROM_END + +ROM_START( rad_skat ) + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD16_WORD_SWAP( "skateboarder.bin", 0x000000, 0x400000, CRC(08b9ab91) SHA1(6665edc4740804956136c68065890925a144626b) ) +ROM_END - ROM_REGION( 0x4000000, "bios", 0 ) - ROM_LOAD( "wirels60.bin", 0x0000, 0x4000000, CRC(b4df8b28) SHA1(00e3da542e4bc14baf4724ad436f66d4c0f65c84)) +ROM_START( rad_skatp ) // rom was dumped from the NTSC version, but region comes from an io port, so ROM is probably the same + ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD16_WORD_SWAP( "skateboarder.bin", 0x000000, 0x400000, CRC(08b9ab91) SHA1(6665edc4740804956136c68065890925a144626b) ) ROM_END -// YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS +// YEAR NAME PARENT COMPAT MACHINE INPUT STATE INIT COMPANY FULLNAME FLAGS // VTech systems -CONS( 2005, vsmile, 0, 0, vsmile, vsmile, vii_state, vsmile, "VTech", "V.Smile (US)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) -CONS( 2005, vsmileg, vsmile, 0, vsmile, vsmile, vii_state, vsmile, "VTech", "V.Smile (Germany)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) -CONS( 2005, vsmilef, vsmile, 0, vsmile, vsmile, vii_state, vsmile, "VTech", "V.Smile (France)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) -CONS( 2005, vsmileb, 0, 0, vsmile, vsmile, vii_state, vsmile, "VTech", "V.Smile Baby (US)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) +CONS( 2005, vsmile, 0, 0, vsmile, vsmile, spg2xx_cart_state, vsmile, "VTech", "V.Smile (US)", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) +CONS( 2005, vsmileg, vsmile, 0, vsmile, vsmile, spg2xx_cart_state, vsmile, "VTech", "V.Smile (Germany)", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) +CONS( 2005, vsmilef, vsmile, 0, vsmile, vsmile, spg2xx_cart_state, vsmile, "VTech", "V.Smile (France)", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) +CONS( 2005, vsmileb, 0, 0, vsmile, vsmile, spg2xx_cart_state, vsmile, "VTech", "V.Smile Baby (US)", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // Jungle Soft TV games -CONS( 2007, vii, 0, 0, vii, vii, vii_state, vii, "Jungle Soft / KenSingTon / Chintendo / Siatronics", "Vii", MACHINE_NO_SOUND | MACHINE_NOT_WORKING ) // some games run, others crash -CONS( 2010, zone60, 0, 0, wirels60, wirels60, vii_state, wirels60, "Jungle Soft / Ultimate Products (HK) Ltd", "Zone 60", MACHINE_NO_SOUND ) -CONS( 2010, wirels60, 0, 0, wirels60, wirels60, vii_state, wirels60, "Jungle Soft / Kids Station Toys Inc", "Wireless 60", MACHINE_NO_SOUND ) +CONS( 2007, vii, 0, 0, vii, vii, spg2xx_cart_state, vii, "Jungle Soft / KenSingTon / Chintendo / Siatronics", "Vii", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // some games run, others crash + +CONS( 2010, zone60, 0, 0, spg2xx_base, wirels60, spg2xx_game_state, wirels60, "Jungle Soft / Ultimate Products (HK) Ltd", "Zone 60", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2010, wirels60, 0, 0, spg2xx_base, wirels60, spg2xx_game_state, wirels60, "Jungle Soft / Kids Station Toys Inc", "Wireless 60", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS ) // JAKKS Pacific Inc TV games -CONS( 2004, batmantv, 0, 0, batman, batman, vii_state, batman, "JAKKS Pacific Inc / HotGen Ltd", "The Batman", MACHINE_NO_SOUND ) -CONS( 2008, walle, 0, 0, batman, walle, vii_state, walle, "JAKKS Pacific Inc", "Wall-E", MACHINE_NO_SOUND ) +CONS( 2004, batmantv, 0, 0, batman, batman, spg2xx_game_state, batman, "JAKKS Pacific Inc / HotGen Ltd", "The Batman", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2008, walle, 0, 0, batman, walle, spg2xx_game_state, walle, "JAKKS Pacific Inc", "Wall-E", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS ) + +// Radica TV games +CONS( 2006, rad_skat, 0, 0, spg2xx_base, rad_skat, spg2xx_game_state, rad_skat, "Radica", "Play TV Skateboarder (NTSC)", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS ) +CONS( 2006, rad_skatp, rad_skat,0, spg2xx_basep,rad_skatp,spg2xx_game_state, rad_skat, "Radica", "Connectv Skateboarder (PAL)", MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/includes/asteroid.h b/src/mame/includes/asteroid.h index 302a2742677..a805fe794c8 100644 --- a/src/mame/includes/asteroid.h +++ b/src/mame/includes/asteroid.h @@ -8,6 +8,7 @@ #include "sound/discrete.h" #include "video/avgdvg.h" +#include "machine/74153.h" class asteroid_state : public driver_device { @@ -17,6 +18,8 @@ public: m_maincpu(*this, "maincpu"), m_dvg(*this, "dvg"), m_discrete(*this, "discrete"), + m_dsw1(*this, "DSW1"), + m_dsw_sel(*this, "dsw_sel"), m_ram1(*this, "ram1"), m_ram2(*this, "ram2") { } @@ -24,6 +27,8 @@ public: required_device<cpu_device> m_maincpu; required_device<dvg_device> m_dvg; required_device<discrete_device> m_discrete; + required_ioport m_dsw1; + required_device<ttl153_device> m_dsw_sel; /* memory banks */ optional_memory_bank m_ram1; diff --git a/src/mame/includes/fmtowns.h b/src/mame/includes/fmtowns.h index f610d10a600..e380f88cca9 100644 --- a/src/mame/includes/fmtowns.h +++ b/src/mame/includes/fmtowns.h @@ -17,6 +17,7 @@ #include "machine/upd71071.h" #include "machine/wd_fdc.h" #include "machine/i8251.h" +#include "machine/msm58321.h" #include "sound/2612intf.h" #include "sound/cdda.h" #include "sound/rf5c68.h" @@ -106,6 +107,7 @@ class towns_state : public driver_device m_i8251(*this, "i8251"), m_rs232(*this, "rs232c"), m_screen(*this, "screen"), + m_rtc(*this, "rtc58321"), m_nvram(*this, "nvram"), m_nvram16(*this, "nvram16"), m_ctrltype(*this, "ctrltype"), @@ -144,6 +146,7 @@ class towns_state : public driver_device required_device<i8251_device> m_i8251; required_device<rs232_port_device> m_rs232; required_device<screen_device> m_screen; + required_device<msm58321_device> m_rtc; ram_device* m_messram; cdrom_image_device* m_cdrom; cdda_device* m_cdda; @@ -174,8 +177,6 @@ class towns_state : public driver_device uint8_t m_towns_srom_reset; uint8_t m_towns_rtc_select; uint8_t m_towns_rtc_data; - uint8_t m_towns_rtc_reg[16]; - emu_timer* m_towns_rtc_timer; uint8_t m_towns_timer_mask; uint16_t m_towns_machine_id; // default is 0x0101 uint8_t m_towns_kb_status; @@ -312,11 +313,16 @@ class towns_state : public driver_device DECLARE_READ8_MEMBER(towns_serial_r); DECLARE_WRITE8_MEMBER(towns_serial_w); + DECLARE_WRITE_LINE_MEMBER(rtc_d0_w); + DECLARE_WRITE_LINE_MEMBER(rtc_d1_w); + DECLARE_WRITE_LINE_MEMBER(rtc_d2_w); + DECLARE_WRITE_LINE_MEMBER(rtc_d3_w); + DECLARE_WRITE_LINE_MEMBER(rtc_busy_w); + RF5C68_SAMPLE_END_CB_MEMBER(towns_pcm_irq); void towns_update_video_banks(address_space&); void init_serial_rom(); - void init_rtc(); void kb_sendcode(uint8_t scancode, int release); uint8_t speaker_get_spk(); void speaker_set_spkrdata(uint8_t data); @@ -344,7 +350,6 @@ class towns_state : public driver_device void townshr(machine_config &config); void townssj(machine_config &config); private: - static const device_timer_id TIMER_RTC = 0; static const device_timer_id TIMER_FREERUN = 1; static const device_timer_id TIMER_INTERVAL2 = 2; static const device_timer_id TIMER_KEYBOARD = 3; @@ -352,7 +357,6 @@ private: static const device_timer_id TIMER_WAIT = 5; static const device_timer_id TIMER_CDSTATUS = 6; static const device_timer_id TIMER_CDDA = 7; - void rtc_second(); void freerun_inc(); void intervaltimer2_timeout(); void poll_keyboard(); @@ -364,6 +368,11 @@ private: void towns_cdrom_read(cdrom_image_device* device); void towns_cd_status_ready(); void towns_delay_cdda(cdrom_image_device* dev); + + u8 m_rtc_d; + bool m_rtc_busy; + u8 m_vram_mask[4]; + u8 m_vram_mask_addr; public: INTERRUPT_GEN_MEMBER(towns_vsync_irq); TIMER_CALLBACK_MEMBER(towns_cdrom_read_byte); @@ -397,8 +406,6 @@ public: void towns_cdrom_set_irq(int line,int state); uint8_t towns_cd_get_track(); DECLARE_READ16_MEMBER(towns_cdrom_dma_r); - void rtc_hour(); - void rtc_minute(); DECLARE_READ16_MEMBER(towns_scsi_dma_r); DECLARE_WRITE16_MEMBER(towns_scsi_dma_w); }; diff --git a/src/mame/includes/namcos1.h b/src/mame/includes/namcos1.h index 7fde1de7881..e63ffec4542 100644 --- a/src/mame/includes/namcos1.h +++ b/src/mame/includes/namcos1.h @@ -4,6 +4,7 @@ #include "sound/dac.h" #include "sound/namco.h" #include "video/namco_c116.h" +#include "machine/74157.h" class namcos1_state : public driver_device { @@ -27,7 +28,9 @@ public: m_rom(*this, "user1"), m_soundbank(*this, "soundbank"), m_mcubank(*this, "mcubank"), - m_io_dipsw(*this, "DIPSW") { } + m_io_dipsw(*this, "DIPSW"), + m_dsw_sel(*this, "dsw_sel") + { } required_device<cpu_device> m_maincpu; required_device<cpu_device> m_subcpu; @@ -50,6 +53,7 @@ public: required_memory_bank m_mcubank; required_ioport m_io_dipsw; + required_device<ls157_device> m_dsw_sel; int m_key_id; int m_key_reg; diff --git a/src/mame/machine/asteroid.cpp b/src/mame/machine/asteroid.cpp index 43154e8dc46..80eebff4c2f 100644 --- a/src/mame/machine/asteroid.cpp +++ b/src/mame/machine/asteroid.cpp @@ -84,13 +84,24 @@ READ8_MEMBER(asteroid_state::asteroid_IN1_r) READ8_MEMBER(asteroid_state::asteroid_DSW1_r) { - int res; - int res1; + // 765432-- not used + // ------1- ls253 dsw selector 2y + // -------0 ls253 dsw selector 1y - res1 = ioport("DSW1")->read(); + uint8_t val = m_dsw1->read(); - res = 0xfc | ((res1 >> (2 * (3 - (offset & 0x3)))) & 0x3); - return res; + m_dsw_sel->i3a_w(BIT(val, 0)); + m_dsw_sel->i3b_w(BIT(val, 1)); + m_dsw_sel->i2a_w(BIT(val, 2)); + m_dsw_sel->i2b_w(BIT(val, 3)); + m_dsw_sel->i1a_w(BIT(val, 4)); + m_dsw_sel->i1b_w(BIT(val, 5)); + m_dsw_sel->i0a_w(BIT(val, 6)); + m_dsw_sel->i0b_w(BIT(val, 7)); + + m_dsw_sel->s_w(space, 0, offset & 0x03); + + return 0xfc | (m_dsw_sel->zb_r() << 1) | m_dsw_sel->za_r(); } diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 98c098f9217..41d22ffa5bc 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -1079,6 +1079,7 @@ asma2k // asmapro // @source:alphatpx.cpp +alphatp1 alphatp2 alphatp2u alphatp3 // 1982 Triumph-Adler @@ -37792,6 +37793,8 @@ vsmileg // walle // wirels60 // Wireless 60 zone60 // Zone 60 +rad_skat // +rad_skatp // @source:vsmilepro.cpp vsmilpro diff --git a/src/mame/video/fmtowns.cpp b/src/mame/video/fmtowns.cpp index af8064cad43..5be149f0e4b 100644 --- a/src/mame/video/fmtowns.cpp +++ b/src/mame/video/fmtowns.cpp @@ -137,7 +137,9 @@ READ8_MEMBER( towns_state::towns_gfx_high_r ) WRITE8_MEMBER( towns_state::towns_gfx_high_w ) { - m_towns_gfxvram[offset] = data; + u8 mask = m_vram_mask[offset & 3]; + u8 mem = m_towns_gfxvram[offset]; + m_towns_gfxvram[offset] = (mem & ~mask) | (data & mask); } READ8_MEMBER( towns_state::towns_gfx_r ) @@ -414,6 +416,14 @@ READ8_MEMBER(towns_state::towns_video_440_r) case 0x12: if(LOG_VID) logerror("SPR: reading register %i (0x452) [%02x]\n",m_video.towns_sprite_sel,m_video.towns_sprite_reg[m_video.towns_sprite_sel]); return m_video.towns_sprite_reg[m_video.towns_sprite_sel]; + case 0x18: + return m_vram_mask_addr; + case 0x1a: + case 0x1b: + { + int idx = (m_vram_mask_addr << 1) + offset - 0x1a; + return m_vram_mask[idx]; + } //default: //if(LOG_VID) logerror("VID: read port %04x\n",offset+0x440); } @@ -453,6 +463,16 @@ WRITE8_MEMBER(towns_state::towns_video_440_w) logerror("SPR: writing register %i (0x452) [%02x]\n",m_video.towns_sprite_sel,data); m_video.towns_sprite_reg[m_video.towns_sprite_sel] = data; break; + case 0x18: + m_vram_mask_addr = data & 1; + break; + case 0x1a: + case 0x1b: + { + int idx = (m_vram_mask_addr << 1) + offset - 0x1a; + m_vram_mask[idx] = data; + break; + } default: if(LOG_VID) logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0x440); } diff --git a/src/mame/video/intv.cpp b/src/mame/video/intv.cpp index cf1bf324777..32478790473 100644 --- a/src/mame/video/intv.cpp +++ b/src/mame/video/intv.cpp @@ -37,7 +37,7 @@ uint32_t intv_state::screen_update_intvkbd(screen_device &screen, bitmap_ind16 & { for(int x=0;x<40;x++) { - if ((cursor_row == current_row) && (cursor_col == x+1)) { + if ((cursor_row == y) && (cursor_col == x+1)) { /* draw the cursor as a solid white block */ m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, 191, /* a block */ |