mirror of
https://github.com/holub/mame
synced 2025-04-16 05:24:54 +03:00
some jpmimpct.cpp refactoring (#7645)
- jpmimpct.cpp: Various changes. [David Haywood] * Refactored driver to use emulated DUARTs for both the primary and the touchscreen (fixes video corruption in cluedo intro). * Fixed bugs in the non-video hookups, including incorrect shifts on addresses and data. * Hooked up BACTA_DATALOGGER so that the 'protocol' sets boot. * Hooked up actual Bt477 device for palette in the video-based games. * Started giving non-video games usable default inputs (jackpot / stake keys). * Fixed some ROM loading. * Reparented some sets based on analysis, as some were mishandled due to incorrect source information.
This commit is contained in:
parent
007031a552
commit
ae0bb17dc3
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -10,94 +10,104 @@
|
||||
#include "machine/steppers.h"
|
||||
#include "machine/timer.h"
|
||||
#include "cpu/tms34010/tms34010.h"
|
||||
#include "video/bt47x.h"
|
||||
#include "machine/i8255.h"
|
||||
#include "machine/mc68681.h"
|
||||
#include "sound/upd7759.h"
|
||||
#include "diserial.h"
|
||||
#include "machine/bacta_datalogger.h"
|
||||
#include "emupal.h"
|
||||
|
||||
struct duart_t
|
||||
|
||||
|
||||
|
||||
class jpmtouch_device : public device_t,
|
||||
public device_serial_interface
|
||||
{
|
||||
uint8_t MR1A, MR2A;
|
||||
uint8_t SRA, CSRA;
|
||||
uint8_t CRA;
|
||||
uint8_t RBA, TBA;
|
||||
public:
|
||||
jpmtouch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
|
||||
uint8_t IPCR;
|
||||
uint8_t ACR;
|
||||
uint8_t ISR, IMR;
|
||||
auto rxd_handler() { return m_rxd_handler.bind(); }
|
||||
|
||||
union
|
||||
{
|
||||
uint8_t CUR, CLR;
|
||||
uint16_t CR;
|
||||
};
|
||||
union
|
||||
{
|
||||
uint8_t CTUR, CTLR;
|
||||
uint16_t CT;
|
||||
};
|
||||
DECLARE_WRITE_LINE_MEMBER( output_rxd ) { m_rxd_handler(state); }
|
||||
|
||||
int tc;
|
||||
void touched(uint8_t x, uint8_t y);
|
||||
|
||||
uint8_t MR1B, MR2B;
|
||||
uint8_t SRB, CSRB;
|
||||
uint8_t CRB;
|
||||
uint8_t RBB, TBB;
|
||||
protected:
|
||||
jpmtouch_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
uint8_t IVR;
|
||||
uint8_t IP;
|
||||
uint8_t OP;
|
||||
uint8_t OPR;
|
||||
uint8_t OPCR;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual void tra_callback() override;
|
||||
virtual void tra_complete() override;
|
||||
|
||||
private:
|
||||
void tx_queue();
|
||||
|
||||
devcb_write_line m_rxd_handler;
|
||||
int8_t m_sending;
|
||||
uint8_t m_touch_data[3];
|
||||
uint8_t m_sendpos;
|
||||
};
|
||||
|
||||
struct bt477_t
|
||||
{
|
||||
uint8_t address;
|
||||
uint8_t addr_cnt;
|
||||
uint8_t pixmask;
|
||||
uint8_t command;
|
||||
rgb_t color;
|
||||
};
|
||||
DECLARE_DEVICE_TYPE(JPM_TOUCHSCREEN, jpmtouch_device)
|
||||
|
||||
class jpmimpct_state : public driver_device
|
||||
{
|
||||
public:
|
||||
jpmimpct_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_duart_1_timer(*this, "duart_1_timer")
|
||||
, m_vfd(*this, "vfd")
|
||||
, m_vram(*this, "vram")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_upd7759(*this, "upd")
|
||||
, m_palette(*this, "palette")
|
||||
, m_dsp(*this, "dsp")
|
||||
, m_reel(*this, "reel%u", 0U)
|
||||
, m_meters(*this, "meters")
|
||||
, m_datalogger(*this, "datalogger")
|
||||
, m_testdemo(*this, "TEST_DEMO")
|
||||
, m_digits(*this, "digit%u", 0U)
|
||||
, m_ppi(*this, "ppi8255")
|
||||
, m_duart(*this, "main_duart")
|
||||
, m_vfd(*this, "vfd")
|
||||
, m_upd7759(*this, "upd")
|
||||
, m_reel(*this, "reel%u", 0U)
|
||||
, m_lamp_output(*this, "lamp%u", 0U)
|
||||
{ }
|
||||
|
||||
void impctawp(machine_config &config);
|
||||
void jpmimpct(machine_config &config);
|
||||
void impact_nonvideo(machine_config &config);
|
||||
|
||||
protected:
|
||||
void base(machine_config &config);
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<meters_device> m_meters;
|
||||
required_device<bacta_datalogger_device> m_datalogger;
|
||||
required_ioport m_testdemo;
|
||||
output_finder<300> m_digits;
|
||||
|
||||
uint16_t jpmio_r();
|
||||
|
||||
uint16_t unk_r();
|
||||
void unk_w(uint16_t data);
|
||||
|
||||
void common_map(address_map &map);
|
||||
|
||||
int m_lamp_strobe;
|
||||
|
||||
void set_duart_1_hack_ip(bool state);
|
||||
|
||||
void jpm_draw_lamps(uint16_t data, int lamp_strobe);
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(duart_set_ip5);
|
||||
|
||||
virtual void update_irqs();
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
private:
|
||||
template <unsigned N> DECLARE_WRITE_LINE_MEMBER(reel_optic_cb) { if (state) m_optic_pattern |= (1 << N); else m_optic_pattern &= ~(1 << N); }
|
||||
uint16_t duart_1_r(offs_t offset);
|
||||
void duart_1_w(offs_t offset, uint16_t data);
|
||||
uint16_t duart_2_r(offs_t offset);
|
||||
void duart_2_w(uint16_t data);
|
||||
uint16_t inputs1_r(offs_t offset);
|
||||
uint16_t unk_r();
|
||||
void unk_w(uint16_t data);
|
||||
uint16_t jpmio_r();
|
||||
void jpmio_w(offs_t offset, uint16_t data);
|
||||
uint16_t inputs1awp_r(offs_t offset);
|
||||
uint16_t optos_r();
|
||||
uint16_t prot_1_r();
|
||||
uint16_t prot_0_r();
|
||||
void jpmioawp_w(offs_t offset, uint16_t data);
|
||||
uint16_t ump_r();
|
||||
void jpmimpct_bt477_w(offs_t offset, uint16_t data);
|
||||
uint16_t jpmimpct_bt477_r(offs_t offset);
|
||||
void volume_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
void upd7759_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
uint16_t upd7759_r(offs_t offset, uint16_t mem_mask = ~0);
|
||||
@ -105,26 +115,20 @@ private:
|
||||
uint8_t hopper_c_r();
|
||||
void payen_a_w(uint8_t data);
|
||||
void display_c_w(uint8_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER(tms_irq);
|
||||
TMS340X0_TO_SHIFTREG_CB_MEMBER(to_shiftreg);
|
||||
TMS340X0_FROM_SHIFTREG_CB_MEMBER(from_shiftreg);
|
||||
TMS340X0_SCANLINE_RGB32_CB_MEMBER(scanline_update);
|
||||
DECLARE_MACHINE_START(jpmimpct);
|
||||
DECLARE_MACHINE_RESET(jpmimpct);
|
||||
DECLARE_VIDEO_START(jpmimpct);
|
||||
DECLARE_MACHINE_START(impctawp);
|
||||
DECLARE_MACHINE_RESET(impctawp);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(duart_1_timer_event);
|
||||
void awp68k_program_map(address_map &map);
|
||||
void m68k_program_map(address_map &map);
|
||||
void tms_program_map(address_map &map);
|
||||
|
||||
uint8_t m_tms_irq;
|
||||
uint8_t m_duart_1_irq;
|
||||
struct duart_t m_duart_1;
|
||||
uint8_t m_touch_cnt;
|
||||
uint8_t m_touch_data[3];
|
||||
int m_lamp_strobe;
|
||||
void pwrled_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
void reels_0123_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
void reels_45_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
void slides_non_video_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
void lamps_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
void digits_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
void lampstrobe_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
|
||||
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(duart_irq_handler);
|
||||
void impact_non_video_map(address_map &map);
|
||||
|
||||
uint8_t m_Lamps[256];
|
||||
int m_optic_pattern;
|
||||
int m_payen;
|
||||
@ -133,19 +137,60 @@ private:
|
||||
int m_slidesout;
|
||||
int m_hopper[3];
|
||||
int m_motor[3];
|
||||
struct bt477_t m_bt477;
|
||||
void jpm_draw_lamps(int data, int lamp_strobe);
|
||||
void update_irqs();
|
||||
|
||||
required_device<timer_device> m_duart_1_timer;
|
||||
required_device<i8255_device> m_ppi;
|
||||
required_device<mc68681_device> m_duart;
|
||||
optional_device<s16lf01_device> m_vfd;
|
||||
optional_shared_ptr<uint16_t> m_vram;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<upd7759_device> m_upd7759;
|
||||
optional_device<palette_device> m_palette;
|
||||
optional_device<tms34010_device> m_dsp;
|
||||
optional_device_array<stepper_device, 6> m_reel;
|
||||
required_device<meters_device> m_meters;
|
||||
output_finder<300> m_digits;
|
||||
output_finder<256> m_lamp_output;
|
||||
};
|
||||
|
||||
class jpmimpct_video_state : public jpmimpct_state
|
||||
{
|
||||
public:
|
||||
jpmimpct_video_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: jpmimpct_state(mconfig, type, tag)
|
||||
, m_vidduart(*this, "vid_duart")
|
||||
, m_touch(*this, "touch")
|
||||
, m_dsp(*this, "dsp")
|
||||
, m_vram(*this, "vram")
|
||||
, m_ramdac(*this, "ramdac")
|
||||
, m_touchx(*this, "TOUCH_X")
|
||||
, m_touchy(*this, "TOUCH_Y")
|
||||
{
|
||||
}
|
||||
|
||||
void impact_video(machine_config &config);
|
||||
void impact_video_touch(machine_config &config);
|
||||
|
||||
DECLARE_INPUT_CHANGED_MEMBER(touch_port_changed);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
void impact_video_map(address_map &map);
|
||||
|
||||
void slides_video_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
|
||||
void tms_program_map(address_map &map);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(tms_irq);
|
||||
TMS340X0_TO_SHIFTREG_CB_MEMBER(to_shiftreg);
|
||||
TMS340X0_FROM_SHIFTREG_CB_MEMBER(from_shiftreg);
|
||||
TMS340X0_SCANLINE_RGB32_CB_MEMBER(scanline_update);
|
||||
uint8_t m_tms_irq;
|
||||
|
||||
virtual void update_irqs() override;
|
||||
|
||||
protected:
|
||||
required_device<mc68681_device> m_vidduart;
|
||||
optional_device<jpmtouch_device> m_touch;
|
||||
private:
|
||||
optional_device<tms34010_device> m_dsp;
|
||||
optional_shared_ptr<uint16_t> m_vram;
|
||||
required_device<bt477_device> m_ramdac;
|
||||
optional_ioport m_touchx;
|
||||
optional_ioport m_touchy;
|
||||
};
|
||||
|
@ -17364,11 +17364,11 @@ monspdr // Money Spider (Ace)
|
||||
scrabble // (c) 1997
|
||||
scrabbled // (c) 1997
|
||||
snlad // (c) 199?
|
||||
tqst // (c) ACE?
|
||||
tqst // (c) Ace
|
||||
tqstp // (c) Ace
|
||||
trivialp // (c) 1996
|
||||
trivialpd // (c) 1996
|
||||
trivialpo // (c) 1996
|
||||
jpmreno
|
||||
|
||||
@source:jpmimpctsw.cpp
|
||||
j6aceclb // Ace Of Clubs (Crystal)
|
||||
|
@ -10,90 +10,18 @@
|
||||
#include "cpu/tms34010/tms34010.h"
|
||||
#include "includes/jpmimpct.h"
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Brooktree Bt477 RAMDAC
|
||||
*
|
||||
*************************************/
|
||||
|
||||
|
||||
/*
|
||||
* 0 0 0 Address register (RAM write mode)
|
||||
* 0 0 1 Color palette RAMs
|
||||
* 0 1 0 Pixel read mask register
|
||||
* 0 1 1 Address register (RAM read mode)
|
||||
* 1 0 0 Address register (overlay write mode)
|
||||
* 1 1 1 Address register (overlay read mode)
|
||||
* 1 0 1 Overlay register
|
||||
* 1 1 0 Command register
|
||||
*/
|
||||
|
||||
void jpmimpct_state::jpmimpct_bt477_w(offs_t offset, uint16_t data)
|
||||
{
|
||||
uint8_t val = data & 0xff;
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case 0x0:
|
||||
{
|
||||
m_bt477.address = val;
|
||||
m_bt477.addr_cnt = 0;
|
||||
break;
|
||||
}
|
||||
case 0x1:
|
||||
{
|
||||
uint8_t *addr_cnt = &m_bt477.addr_cnt;
|
||||
rgb_t *color = &m_bt477.color;
|
||||
|
||||
color[*addr_cnt] = val;
|
||||
|
||||
if (++*addr_cnt == 3)
|
||||
{
|
||||
m_palette->set_pen_color(m_bt477.address, rgb_t(color[0], color[1], color[2]));
|
||||
*addr_cnt = 0;
|
||||
|
||||
/* Address register increments */
|
||||
m_bt477.address++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x2:
|
||||
{
|
||||
m_bt477.pixmask = val;
|
||||
break;
|
||||
}
|
||||
case 0x6:
|
||||
{
|
||||
m_bt477.command = val;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
popmessage("Bt477: Unhandled write access (offset:%x, data:%x)", offset, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t jpmimpct_state::jpmimpct_bt477_r(offs_t offset)
|
||||
{
|
||||
popmessage("Bt477: Unhandled read access (offset:%x)", offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* VRAM shift register callbacks
|
||||
*
|
||||
*************************************/
|
||||
|
||||
TMS340X0_TO_SHIFTREG_CB_MEMBER(jpmimpct_state::to_shiftreg)
|
||||
TMS340X0_TO_SHIFTREG_CB_MEMBER(jpmimpct_video_state::to_shiftreg)
|
||||
{
|
||||
memcpy(shiftreg, &m_vram[address >> 4], 512 * sizeof(uint16_t));
|
||||
}
|
||||
|
||||
TMS340X0_FROM_SHIFTREG_CB_MEMBER(jpmimpct_state::from_shiftreg)
|
||||
TMS340X0_FROM_SHIFTREG_CB_MEMBER(jpmimpct_video_state::from_shiftreg)
|
||||
{
|
||||
memcpy(&m_vram[address >> 4], shiftreg, 512 * sizeof(uint16_t));
|
||||
}
|
||||
@ -105,7 +33,7 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(jpmimpct_state::from_shiftreg)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
TMS340X0_SCANLINE_RGB32_CB_MEMBER(jpmimpct_state::scanline_update)
|
||||
TMS340X0_SCANLINE_RGB32_CB_MEMBER(jpmimpct_video_state::scanline_update)
|
||||
{
|
||||
uint16_t const *const vram = &m_vram[(params->rowaddr << 8) & 0x3ff00];
|
||||
uint32_t *const dest = &bitmap.pix(scanline);
|
||||
@ -114,25 +42,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(jpmimpct_state::scanline_update)
|
||||
for (int x = params->heblnk; x < params->hsblnk; x += 2)
|
||||
{
|
||||
uint16_t const pixels = vram[coladdr++ & 0xff];
|
||||
dest[x + 0] = m_palette->pen(pixels & 0xff);
|
||||
dest[x + 1] = m_palette->pen(pixels >> 8);
|
||||
dest[x + 0] = m_ramdac->palette_lookup(pixels & 0xff);
|
||||
dest[x + 1] = m_ramdac->palette_lookup(pixels >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video emulation start
|
||||
*
|
||||
*************************************/
|
||||
|
||||
VIDEO_START_MEMBER(jpmimpct_state,jpmimpct)
|
||||
{
|
||||
memset(&m_bt477, 0, sizeof(m_bt477));
|
||||
|
||||
save_item(NAME(m_bt477.address));
|
||||
save_item(NAME(m_bt477.addr_cnt));
|
||||
save_item(NAME(m_bt477.pixmask));
|
||||
save_item(NAME(m_bt477.command));
|
||||
save_item(NAME(m_bt477.color));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user