Skip to content

Commit

Permalink
-igs/igs027a.cpp: Started encapsulating IGS 027A onboard peripherals.
Browse files Browse the repository at this point in the history
-igs/igs_m027.cpp: Improved I/O:
* Hooked up inputs, hopper and counters for mgcs3.
* Hooked up mahjong keyboard for lhzb4.
* Added more RAM for extradrw.

-Bumped GitHub CI to three simuataneous jobs for Windows and Linux -
 this should be OK with 16GB RAM.

-Added out-of-line destructors to various device classes that aren't
 templates and aren't in anonymous namespaces.
  • Loading branch information
cuavas committed Sep 12, 2024
1 parent 98d6cb7 commit 21a89d5
Show file tree
Hide file tree
Showing 29 changed files with 394 additions and 224 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
ARCHOPTS: ${{ matrix.archopts }}
SUBTARGET: ${{ matrix.subtarget }}
TOOLS: 1
run: make -j2
run: make -j3
- name: Validate
run: ./${{ matrix.executable }} -validate
- name: Reconcile driver list
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
ARCHOPTS: "-fuse-ld=lld"
SUBTARGET: ${{ matrix.subtarget }}
TOOLS: 1
run: make -j2
run: make -j3
- name: Validate
run: ./${{ matrix.executable }}.exe -validate
- uses: actions/upload-artifact@master
Expand Down
16 changes: 14 additions & 2 deletions src/devices/cpu/arm7/arm7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,17 @@ arm7_cpu_device::arm7_cpu_device(const machine_config &mconfig, const char *tag,
{
}

arm7_cpu_device::arm7_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t archRev, uint32_t archFlags, endianness_t endianness)
arm7_cpu_device::arm7_cpu_device(
const machine_config &mconfig,
device_type type,
const char *tag, device_t *owner,
uint32_t clock,
uint8_t archRev,
uint32_t archFlags,
endianness_t endianness,
address_map_constructor internal_map)
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", endianness, 32, 32, 0)
, m_program_config("program", endianness, 32, 32, 0, internal_map)
, m_prefetch_word0_shift(endianness == ENDIANNESS_LITTLE ? 0 : 16)
, m_prefetch_word1_shift(endianness == ENDIANNESS_LITTLE ? 16 : 0)
, m_endian(endianness)
Expand Down Expand Up @@ -113,6 +121,10 @@ arm7_cpu_device::arm7_cpu_device(const machine_config &mconfig, device_type type
m_actual_log = 0;
}

arm7_cpu_device::~arm7_cpu_device()
{
}


arm7_be_cpu_device::arm7_be_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: arm7_cpu_device(mconfig, ARM7_BE, tag, owner, clock, 4, ARCHFLAG_T, ENDIANNESS_BIG)
Expand Down
12 changes: 11 additions & 1 deletion src/devices/cpu/arm7/arm7.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class arm7_cpu_device : public cpu_device, public arm7_disassembler::config
public:
// construction/destruction
arm7_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~arm7_cpu_device();

void set_high_vectors() { m_vectorbase = 0xffff0000; }

Expand Down Expand Up @@ -113,7 +114,16 @@ class arm7_cpu_device : public cpu_device, public arm7_disassembler::config
ARM9_COPRO_ID_MFR_INTEL = 0x69 << 24
};

arm7_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t archRev, uint32_t archFlags, endianness_t endianness);
arm7_cpu_device(
const machine_config &mconfig,
device_type type,
const char *tag,
device_t *owner,
uint32_t clock,
uint8_t archRev,
uint32_t archFlags,
endianness_t endianness,
address_map_constructor internal_map = address_map_constructor());

void postload();

Expand Down
4 changes: 4 additions & 0 deletions src/devices/machine/2812fifo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ fifo2812_device::fifo2812_device(machine_config const &mconfig, char const *tag,
std::fill(std::begin(m_data), std::end(m_data), 0U);
}

fifo2812_device::~fifo2812_device()
{
}


void fifo2812_device::mr_w(int state)
{
Expand Down
1 change: 1 addition & 0 deletions src/devices/machine/2812fifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class fifo2812_device : public device_t
public:
// standard constructor
fifo2812_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0);
virtual ~fifo2812_device();

// callbacks
auto q_cb() { return m_q_cb.bind(); }
Expand Down
12 changes: 12 additions & 0 deletions src/devices/machine/at_keybc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ at_kbc_device_base::at_kbc_device_base(machine_config const &mconfig, device_typ
{
}

at_kbc_device_base::~at_kbc_device_base()
{
}

void at_kbc_device_base::device_start()
{
save_item(NAME(m_hot_res));
Expand Down Expand Up @@ -376,6 +380,10 @@ at_keyboard_controller_device::at_keyboard_controller_device(machine_config cons
{
}

at_keyboard_controller_device::~at_keyboard_controller_device()
{
}

tiny_rom_entry const *at_keyboard_controller_device::device_rom_region() const
{
return ROM_NAME(at_kbc);
Expand Down Expand Up @@ -452,6 +460,10 @@ ps2_keyboard_controller_device::ps2_keyboard_controller_device(machine_config co
{
}

ps2_keyboard_controller_device::~ps2_keyboard_controller_device()
{
}

tiny_rom_entry const *ps2_keyboard_controller_device::device_rom_region() const
{
return ROM_NAME(ps2_kbc);
Expand Down
4 changes: 4 additions & 0 deletions src/devices/machine/at_keybc.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
class at_kbc_device_base : public device_t
{
public:
virtual ~at_kbc_device_base();

// outputs to host
auto hot_res() { return m_hot_res_cb.bind(); }
auto gate_a20() { return m_gate_a20_cb.bind(); }
Expand Down Expand Up @@ -83,6 +85,7 @@ class at_keyboard_controller_device : public at_kbc_device_base
public:
// standard constructor
at_keyboard_controller_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
virtual ~at_keyboard_controller_device();

protected:
// device_t implementation
Expand Down Expand Up @@ -120,6 +123,7 @@ class ps2_keyboard_controller_device : public at_kbc_device_base

// standard constructor
ps2_keyboard_controller_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
virtual ~ps2_keyboard_controller_device();

protected:
// device_t implementation
Expand Down
3 changes: 2 additions & 1 deletion src/devices/machine/input_merger.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
class input_merger_device : public device_t
{
public:
virtual ~input_merger_device() override;

// configuration
auto output_handler() { return m_output_handler.bind(); }

Expand All @@ -38,7 +40,6 @@ class input_merger_device : public device_t
u32 initval,
u32 xorval,
int active);
virtual ~input_merger_device() override;

// device-level overrides
virtual void device_start() override;
Expand Down
4 changes: 4 additions & 0 deletions src/devices/machine/keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ generic_keyboard_device::generic_keyboard_device(
{
}

generic_keyboard_device::~generic_keyboard_device()
{
}


generic_keyboard_device::generic_keyboard_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
: generic_keyboard_device(mconfig, GENERIC_KEYBOARD, tag, owner, clock)
Expand Down
1 change: 1 addition & 0 deletions src/devices/machine/keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class generic_keyboard_device : public device_t, protected device_matrix_keyboar
const char *tag,
device_t *owner,
u32 clock);
virtual ~generic_keyboard_device();

template <typename... T>
void set_keyboard_callback(T &&... args)
Expand Down
4 changes: 4 additions & 0 deletions src/devices/machine/micomxe1a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ micom_xe_1a_device::micom_xe_1a_device(
{
}

micom_xe_1a_device::~micom_xe_1a_device()
{
}


u8 micom_xe_1a_device::out_r()
{
Expand Down
1 change: 1 addition & 0 deletions src/devices/machine/micomxe1a.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class micom_xe_1a_device : public device_t
{
public:
micom_xe_1a_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0) ATTR_COLD;
virtual ~micom_xe_1a_device();

auto buttons_handler() { return m_buttons_callback.bind(); }
auto analog_handler() { return m_analog_callback.bind(); }
Expand Down
4 changes: 4 additions & 0 deletions src/devices/machine/s2350.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ s2350_device::s2350_device(const machine_config &mconfig, const char *tag, devic
{
}

s2350_device::~s2350_device()
{
}

void s2350_device::device_start()
{
save_item(NAME(m_transmit_buffer_empty));
Expand Down
1 change: 1 addition & 0 deletions src/devices/machine/s2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class s2350_device : public device_t
{
public:
s2350_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual ~s2350_device();

// transmit bits
auto tx_handler() { return m_tx_cb.bind(); }
Expand Down
4 changes: 4 additions & 0 deletions src/devices/machine/s2636.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ s2636_device::s2636_device(const machine_config &mconfig, const char *tag, devic
for (auto &elem : m_obj_dup) elem = false;
}

s2636_device::~s2636_device()
{
}

//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/devices/machine/s2636.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class s2636_device : public device_t,
{
public:
s2636_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~s2636_device();

void set_offsets(int y_offset, int x_offset) { m_x_offset = x_offset; m_y_offset = y_offset; }

Expand Down
8 changes: 8 additions & 0 deletions src/devices/machine/sdlc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ device_sdlc_consumer_interface::device_sdlc_consumer_interface(machine_config co
{
}

device_sdlc_consumer_interface::~device_sdlc_consumer_interface()
{
}

void device_sdlc_consumer_interface::interface_post_start()
{
device().save_item(NAME(m_line_active));
Expand Down Expand Up @@ -139,6 +143,10 @@ sdlc_logger_device::sdlc_logger_device(machine_config const &mconfig, char const
{
}

sdlc_logger_device::~sdlc_logger_device()
{
}

void sdlc_logger_device::clock_w(int state)
{
if (bool(state) != bool(m_current_clock))
Expand Down
2 changes: 2 additions & 0 deletions src/devices/machine/sdlc.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class device_sdlc_consumer_interface : public device_interface

protected:
device_sdlc_consumer_interface(machine_config const &mconfig, device_t &device);
virtual ~device_sdlc_consumer_interface();

virtual void interface_post_start() override;

Expand Down Expand Up @@ -55,6 +56,7 @@ class sdlc_logger_device : public device_t, public device_sdlc_consumer_interfac
{
public:
sdlc_logger_device(machine_config const &mconfig, char const *tag, device_t *owner, std::uint32_t clock);
virtual ~sdlc_logger_device();

// input signals
void data_w(int state) { m_current_data = state ? 1U : 0U; }
Expand Down
4 changes: 4 additions & 0 deletions src/devices/sound/qsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ qsound_device::qsound_device(machine_config const &mconfig, char const *tag, dev
{
}

qsound_device::~qsound_device()
{
}


void qsound_device::qsound_w(offs_t offset, u8 data)
{
Expand Down
1 change: 1 addition & 0 deletions src/devices/sound/qsound.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class qsound_device : public device_t, public device_sound_interface, public dev
public:
// default 60MHz clock (divided by 2 for DSP core clock, and then by 1248 for sample rate)
qsound_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 60'000'000);
virtual ~qsound_device();

void qsound_w(offs_t offset, u8 data);
u8 qsound_r();
Expand Down
8 changes: 8 additions & 0 deletions src/devices/video/dl1416.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ dl1414_device::dl1414_device(
{
}

dl1414_device::~dl1414_device()
{
}

dl1416_device::dl1416_device(
machine_config const &mconfig,
device_type type,
Expand All @@ -208,6 +212,10 @@ dl1416_device::dl1416_device(
{
}

dl1416_device::~dl1416_device()
{
}

//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
Expand Down
6 changes: 5 additions & 1 deletion src/devices/video/dl1416.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ DECLARE_DEVICE_TYPE(DL1416T, dl1416_device)
class dl1414_device : public device_t
{
public:
virtual ~dl1414_device();

auto update() { return m_update_cb.bind(); }

// signal-level interface
Expand All @@ -51,7 +53,7 @@ class dl1414_device : public device_t
device_t *owner,
u32 clock);

// device-level overrides
// device_t implementation
virtual void device_start() override;
virtual void device_reset() override;

Expand All @@ -76,6 +78,8 @@ class dl1414_device : public device_t
class dl1416_device : public dl1414_device
{
public:
virtual ~dl1416_device();

virtual void wr_w(int state) override;
void ce_w(int state); // chip enable (active low)
void cu_w(int state); // cursor enable (active low)
Expand Down
Loading

4 comments on commit 21a89d5

@cuavas
Copy link
Member Author

@cuavas cuavas commented on 21a89d5 Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet more games with slightly different I/O arrangements even when the controls are mostly the same. This makes mgcs3 fully playable with mahjong keyboard or joystick controls, and adds the previously missing mahjong keyboard controls to lhzb4.

I’ve started encapsulating the IGS027A peripherals. I haven’t got to the sound banking yet, but I haven’t forgotten.

@HappyASR does the IGS027A have dedicated GPIO ports, or do the games use some external chip for GPIO? If they’re a feature of the IGS027A, do you know how many of them there are, how wide each of them is, and where they’re mapped in the address space?

@HappyASR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there are dedicated I/O pins on the chip, with 5 output pins and 20 input pins separately. The direction of these pins cannot be changed. They can be accessed via reg_0x40000018[4:0] for output and reg_0x4000000c[22:3] for input. The reg_0x4000000c[2:0] is mapped to the FIRQ/IRQ/UART_RX pin state.

All addresses with bit 27 (0x08000000) cleared are mapped to internal/on-chip peripherals and should remain consistent across all games. Only addresses with bit 27 set are mapped to external memory banks, which can be connected to different off-chip devices depending on the game.

@cuavas
Copy link
Member Author

@cuavas cuavas commented on 21a89d5 Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooking up the timers has made jking02 run slowly (i.e. the emulated game is running slowly, the emulation still runs at 100% easily). The reels are roulette are much slower than they should be. It sets the timer rates to 0x56 and 0x2b.

@HappyASR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope that #12759 will fix the slowdown issue in jking02.

Please sign in to comment.