Skip to content

Commit 7617bdf

Browse files
committed
agat: use gameio bus; change CPU clock so that writes to diskii work.
1 parent 9553c00 commit 7617bdf

1 file changed

Lines changed: 29 additions & 23 deletions

File tree

src/mame/agat/agat.cpp

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
#include "bus/a2bus/agat840k_hle.h"
8181
#include "bus/a2bus/agat_fdc.h"
8282
#include "bus/a2bus/nippelclock.h"
83+
#include "bus/a2gameio/gameio.h"
8384
#include "cpu/m6502/m6502.h"
84-
#include "cpu/m6502/r65c02.h"
8585
#include "imagedev/cassette.h"
8686
#include "machine/bankdev.h"
8787
#include "machine/timer.h"
@@ -110,11 +110,7 @@ class agat_base_state : public driver_device
110110
, m_maincpu(*this, A7_CPU_TAG)
111111
, m_ram(*this, RAM_TAG)
112112
, m_a2bus(*this, "a2bus")
113-
, m_joy1x(*this, "joystick_1_x")
114-
, m_joy1y(*this, "joystick_1_y")
115-
, m_joy2x(*this, "joystick_2_x")
116-
, m_joy2y(*this, "joystick_2_y")
117-
, m_joybuttons(*this, "joystick_buttons")
113+
, m_gameio(*this, "gameio")
118114
, m_speaker(*this, A7_SPEAKER_TAG)
119115
, m_cassette(*this, A7_CASSETTE_TAG)
120116
, m_upperbank(*this, A7_UPPERBANK_TAG)
@@ -159,7 +155,7 @@ class agat_base_state : public driver_device
159155
required_device<cpu_device> m_maincpu;
160156
required_device<ram_device> m_ram;
161157
required_device<a2bus_device> m_a2bus;
162-
required_ioport m_joy1x, m_joy1y, m_joy2x, m_joy2y, m_joybuttons;
158+
required_device<apple2_gameio_device> m_gameio;
163159
required_device<speaker_sound_device> m_speaker;
164160
required_device<cassette_image_device> m_cassette;
165161
required_device<address_map_bank_device> m_upperbank;
@@ -544,31 +540,37 @@ void agat_base_state::interrupts_off_w(uint8_t data)
544540

545541
uint8_t agat_base_state::flags_r(offs_t offset)
546542
{
543+
const u8 uFloatingBus7 = read_floatingbus() & 0x7f;
544+
547545
switch (offset)
548546
{
549547
case 0: // cassette in
550548
return m_cassette->input() > 0.0 ? 0x80 : 0;
551549

552550
case 1: // button 0
553-
return (m_joybuttons->read() & 0x10) ? 0x80 : 0;
551+
return (m_gameio->sw0_r() ? 0x80 : 0) | uFloatingBus7;
554552

555553
case 2: // button 1
556-
return (m_joybuttons->read() & 0x20) ? 0x80 : 0;
554+
return (m_gameio->sw1_r() ? 0x80 : 0) | uFloatingBus7;
557555

558556
case 3: // meta key
559557
return m_meta ? 0 : 0x80;
560558

561-
case 4: // joy 1 X axis
562-
return (machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0;
559+
case 4: // joy 1 X axis
560+
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
561+
return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | uFloatingBus7;
563562

564-
case 5: // joy 1 Y axis
565-
return (machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0;
563+
case 5: // joy 1 Y axis
564+
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
565+
return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | uFloatingBus7;
566566

567567
case 6: // joy 2 X axis
568-
return (machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0;
568+
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
569+
return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | uFloatingBus7;
569570

570571
case 7: // joy 2 Y axis
571-
return (machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0;
572+
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;
573+
return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | uFloatingBus7;
572574
}
573575

574576
// this is never reached
@@ -587,19 +589,19 @@ void agat_base_state::controller_strobe_w(uint8_t data)
587589
// 555 monostable one-shot timers; a running timer cannot be restarted
588590
if (machine().time().as_double() >= m_joystick_x1_time)
589591
{
590-
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_joy1x->read();
592+
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r();
591593
}
592594
if (machine().time().as_double() >= m_joystick_y1_time)
593595
{
594-
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_joy1y->read();
596+
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r();
595597
}
596598
if (machine().time().as_double() >= m_joystick_x2_time)
597599
{
598-
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_joy2x->read();
600+
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r();
599601
}
600602
if (machine().time().as_double() >= m_joystick_y2_time)
601603
{
602-
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_joy2y->read();
604+
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
603605
}
604606

605607
}
@@ -1231,7 +1233,7 @@ static void agat9_cards(device_slot_interface &device)
12311233

12321234
void agat7_state::agat7(machine_config &config)
12331235
{
1234-
M6502(config, m_maincpu, XTAL(14'300'000) / 14);
1236+
M6502(config, m_maincpu, 1021800);
12351237
m_maincpu->set_addrmap(AS_PROGRAM, &agat7_state::agat7_map);
12361238
m_maincpu->set_vblank_int(A7_VIDEO_TAG ":a7screen", FUNC(agat_base_state::agat_vblank));
12371239

@@ -1248,6 +1250,8 @@ void agat7_state::agat7(machine_config &config)
12481250
/* /INH banking */
12491251
ADDRESS_MAP_BANK(config, m_upperbank).set_map(&agat7_state::inhbank_map).set_options(ENDIANNESS_LITTLE, 8, 32, 0x3000);
12501252

1253+
APPLE2_GAMEIO(config, m_gameio, apple2_gameio_device::joystick_options, nullptr);
1254+
12511255
agat_keyboard_device &keyboard(AGAT_KEYBOARD(config, "keyboard", 0));
12521256
keyboard.out_callback().set(FUNC(agat_base_state::kbd_put));
12531257
keyboard.out_meta_callback().set(FUNC(agat_base_state::kbd_meta));
@@ -1277,7 +1281,7 @@ void agat7_state::agat7(machine_config &config)
12771281

12781282
void agat9_state::agat9(machine_config &config)
12791283
{
1280-
R65C02(config, m_maincpu, XTAL(14'300'000) / 14);
1284+
M6502(config, m_maincpu, 1021800);
12811285
m_maincpu->set_addrmap(AS_PROGRAM, &agat9_state::agat9_map);
12821286
m_maincpu->set_vblank_int(A9_VIDEO_TAG ":a9screen", FUNC(agat_base_state::agat_vblank));
12831287

@@ -1294,6 +1298,8 @@ void agat9_state::agat9(machine_config &config)
12941298
/* /INH banking */
12951299
ADDRESS_MAP_BANK(config, m_upperbank).set_map(&agat9_state::inhbank_map).set_options(ENDIANNESS_LITTLE, 8, 32, 0x10000);
12961300

1301+
APPLE2_GAMEIO(config, m_gameio, apple2_gameio_device::joystick_options, nullptr);
1302+
12971303
agat_keyboard_device &keyboard(AGAT_KEYBOARD(config, "keyboard", 0));
12981304
keyboard.out_callback().set(FUNC(agat_base_state::kbd_put));
12991305
keyboard.out_meta_callback().set(FUNC(agat_base_state::kbd_meta));
@@ -1370,5 +1376,5 @@ ROM_END
13701376

13711377

13721378
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
1373-
COMP( 1983, agat7, apple2, 0, agat7, agat7, agat7_state, empty_init, "Agat", "Agat-7", MACHINE_IMPERFECT_GRAPHICS)
1374-
COMP( 1988, agat9, apple2, 0, agat9, agat7, agat9_state, empty_init, "Agat", "Agat-9", MACHINE_NOT_WORKING)
1379+
COMP( 1983, agat7, 0, 0, agat7, agat7, agat7_state, empty_init, "Agat", "Agat-7", MACHINE_IMPERFECT_GRAPHICS)
1380+
COMP( 1988, agat9, 0, 0, agat9, agat7, agat9_state, empty_init, "Agat", "Agat-9", MACHINE_NOT_WORKING)

0 commit comments

Comments
 (0)