mpu4.cpp, ticket.cpp Added proper hopper communications to ticket.cpp (#10404)

* Clones promoted to working

----------------------------
The Crystal Maze (v1.3 alt) (MPU4 Video)

* ticket.cpp: Add a devcb_line for output handling to communicate with hardware

mpu4.cpp: Fixed hopper hookup to use the ticket dispense handler

* mpu4.cpp Updated base map to remove DUART hack
This commit is contained in:
James Wallace 2022-10-16 08:58:21 +01:00 committed by GitHub
parent 385b0efe1b
commit c209b455ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 25 deletions

View File

@ -54,6 +54,7 @@ ticket_dispenser_device::ticket_dispenser_device(const machine_config &mconfig,
, m_power(0)
, m_timer(nullptr)
, m_output(*this, tag) // TODO: change to "tag:status"
, m_dispense_handler(*this) // TODO: can we use m_output for this?
{
}
@ -141,6 +142,8 @@ void ticket_dispenser_device::device_start()
m_output.resolve();
m_dispense_handler.resolve_safe();
save_item(NAME(m_status));
save_item(NAME(m_power));
}
@ -181,6 +184,10 @@ TIMER_CALLBACK_MEMBER(ticket_dispenser_device::update_output_state)
// update output status
m_output = m_status == m_ticketdispensed;
if (m_hopper_type)
{
m_dispense_handler(m_status);
}
// if we just dispensed, increment global count
if (m_status == m_ticketdispensed)
{

View File

@ -61,6 +61,8 @@ public:
m_hopper_type = hopper_type;
}
auto dispense_handler() { return m_dispense_handler.bind(); }
// read/write handlers
DECLARE_READ_LINE_MEMBER( line_r );
DECLARE_WRITE_LINE_MEMBER( motor_w );
@ -89,6 +91,7 @@ protected:
bool m_power;
emu_timer *m_timer;
output_finder<> m_output;
devcb_write_line m_dispense_handler;
};
class hopper_device : public ticket_dispenser_device
@ -102,6 +105,9 @@ public:
set_senses(motor_sense, status_sense, true);
}
hopper_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
private:
};
#endif // MAME_MACHINE_TICKET_H

View File

@ -2083,7 +2083,6 @@ void mpu4_state::mpu4_memmap(address_map &map)
// map(0x0800, 0x081f) // optional protection device lives here, see other maps
map(0x0850, 0x0850).rw(FUNC(mpu4_state::bankswitch_r), FUNC(mpu4_state::bankswitch_w)); /* write bank (rom page select) */
map(0x08e0, 0x08ef).rw(m_duart68681, FUNC(mc68681_device::read), FUNC(mc68681_device::write)); //Runs hoppers
map(0x08ed, 0x08ed).r(FUNC(mpu4_state::hack_duart_r)); // hack until the hopper is hooked up to the duart in games wanting that setup (eg m4ready)
map(0x0900, 0x0907).rw(m_6840ptm, FUNC(ptm6840_device::read), FUNC(ptm6840_device::write));/* PTM6840 IC2 */
map(0x0a00, 0x0a03).rw(m_pia3, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); /* PIA6821 IC3 */
map(0x0b00, 0x0b03).rw(m_pia4, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); /* PIA6821 IC4 */
@ -2238,16 +2237,20 @@ void mpu4_state::tr_ht(machine_config &config)
void mpu4_state::tr_hda(machine_config &config)
{
m_hopper_type = HOPPER_DUART_A;
m_hopper1->dispense_handler().set("duart68681", FUNC(mc68681_device::ip5_w));
}
void mpu4_state::tr_hdb(machine_config &config)
{
m_hopper_type = HOPPER_DUART_B;
m_hopper1->dispense_handler().set("duart68681", FUNC(mc68681_device::ip5_w));
}
void mpu4_state::tr_hdc(machine_config &config)
{
m_hopper_type = HOPPER_DUART_C;
m_hopper1->dispense_handler().set("duart68681", FUNC(mc68681_device::ip5_w));
m_hopper2->dispense_handler().set("duart68681", FUNC(mc68681_device::ip6_w));
}
void mpu4_state::tr_hna(machine_config &config)

View File

@ -421,29 +421,6 @@ protected:
DECLARE_WRITE_LINE_MEMBER(dataport_rxd);
//The DUART hoppers connect via the standard IP
//Hopper 1 opto connects to IP5, hopper 2 to IP6
//TODO: Configure this correctly via lines
uint8_t hack_duart_r()
{
if (m_hack_duart_fixed_low)
{
return 0x00;
}
else
{
int duart_data = 0;
if (m_hopper1->line_r() && m_hopper1_opto)
{
duart_data |= 0x10;
}
if (m_hopper2->line_r() && m_hopper2_opto)
{
duart_data |= 0x20;
}
return duart_data;
}
}
uint8_t bootleg806_r(address_space &space, offs_t offset);
required_device<cpu_device> m_maincpu;

View File

@ -8718,7 +8718,7 @@ GAME( 199?, v4bios, 0, mod2(), mpu4vid, mpu4_state, init_
GAMEL( 1993, v4cmaze, v4bios, crmaze, crmaze, mpu4vid_state, init_crmaze, ROT0, "Barcrest","The Crystal Maze (v1.3) (MPU4 Video)",GAME_FLAGS_OK,layout_crmaze2p )//SWP 0.9
GAMEL( 1993, v4cmazedat, v4cmaze, crmaze, crmaze, mpu4vid_state, init_crmaze, ROT0, "Barcrest","The Crystal Maze (v1.3, Datapak) (MPU4 Video)",GAME_FLAGS,layout_crmaze2p )//SWP 0.9D
GAMEL( 1993, v4cmazeb, v4cmaze, crmaze, crmaze, mpu4vid_state, init_crmaze, ROT0, "Barcrest","The Crystal Maze (v1.2) (MPU4 Video)",GAME_FLAGS_OK,layout_crmaze2p )//SWP 0.9
GAMEL( 1993, v4cmazec, v4cmaze, crmaze, crmaze, mpu4vid_state, init_crmaze, ROT0, "Barcrest","The Crystal Maze (v1.3 alt) (MPU4 Video)",GAME_FLAGS,layout_crmaze2p )//SWP 0.9
GAMEL( 1993, v4cmazec, v4cmaze, crmaze, crmaze, mpu4vid_state, init_crmaze, ROT0, "Barcrest","The Crystal Maze (v1.3 alt) (MPU4 Video)",GAME_FLAGS_OK,layout_crmaze2p )//SWP 0.9
GAMEL( 1993, v4cmazed, v4cmaze, crmaze, crmaze, mpu4vid_state, init_crmaze, ROT0, "Barcrest","The Crystal Maze (v1.1) (MPU4 Video)",GAME_FLAGS_OK,layout_crmaze2p )//SWP 0.6
GAMEL( 1993, v4cmaze_amld, v4cmaze, crmaze, crmaze, mpu4vid_state, init_crmaze, ROT0, "Barcrest","The Crystal Maze (v0.1, AMLD) (MPU4 Video)",GAME_FLAGS_OK,layout_crmaze2p )//SWP 0.9 (actually newer than the 1.1 set then??)