Skip to content

Commit e81c49b

Browse files
authored
apple: fix C06x softswitches (#14459)
Invert C060 cassette input (and SW3) and C063 PB2, to match behavior verified across various hardware. Fixes MT#8917 shift key mod behavior, and improves cassette LOAD.
1 parent fd2ee37 commit e81c49b

File tree

3 files changed

+30
-31
lines changed

3 files changed

+30
-31
lines changed

src/mame/apple/apple2.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -468,22 +468,17 @@ u8 apple2_state::flags_r(offs_t offset)
468468
// Y output of 74LS251 at H14 read as D7
469469
switch (offset)
470470
{
471-
case 0: // cassette in (accidentally read at $C068 by ProDOS to attempt IIgs STATE register)
472-
return (m_cassette->input() > 0.0 ? 0x80 : 0) | uFloatingBus7;
471+
case 0: // cassette in, inverted (accidentally read at $C068 by ProDOS to attempt IIgs STATE register)
472+
return (m_cassette->input() > 0.0 ? 0 : 0x80) | uFloatingBus7;
473473

474474
case 1: // button 0
475475
return (m_gameio->sw0_r() ? 0x80 : 0) | uFloatingBus7;
476476

477477
case 2: // button 1
478478
return (m_gameio->sw1_r() ? 0x80 : 0) | uFloatingBus7;
479479

480-
case 3: // button 2
481-
// check if SHIFT key mod configured
482-
if (m_sysconfig->read() & 0x04)
483-
{
484-
return ((m_gameio->sw2_r() || (m_kbspecial->read() & 0x06)) ? 0x80 : 0) | uFloatingBus7;
485-
}
486-
return (m_gameio->sw2_r() ? 0x80 : 0) | (read_floatingbus() & 0x7f);
480+
case 3: // button 2, inverted (or SHIFT key, with SHIFT key mod)
481+
return ((m_gameio->sw2_r() || ((m_sysconfig->read() & 0x04) && (m_kbspecial->read() & 0x06))) ? 0 : 0x80) | uFloatingBus7;
487482

488483
case 4: // joy 1 X axis
489484
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;

src/mame/apple/apple2e.cpp

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
1212
IIe: base of this driver. 64K RAM, slot 0 language card emulation without the double-read requirement,
13-
lowercase and SHIFT key on button 2, Open and Solid Apple buttons on joy buttons 0 and 1,
13+
lowercase, Open and Solid Apple buttons on joy buttons 0 and 1,
1414
auxiliary slot, built-in 80 column support if extra RAM added.
1515
1616
Physical slot 0 was eliminated thanks to the built-in language card.
@@ -36,11 +36,12 @@
3636
3737
IIe enhanced: 65C02 CPU with more instructions, MouseText in the character generator.
3838
39-
IIe platinum: Like enhanced but with added numeric keypad and extended 80-column card
40-
included in the box. Keypad CLEAR generates ESC by default, one hardware mod
41-
made it generate CTRL-X instead. (new keyboard encoder ROM?)
39+
IIe Platinum: Like enhanced but with added numeric keypad and extended 80-column card
40+
included in the box. SHIFT key on button 2, keypad CLEAR generates ESC by default,
41+
one hardware mod made it generate CTRL-X instead. (new keyboard encoder ROM?)
4242
43-
NOTE: On real IIe and IIe enhanced h/w, pressing SHIFT and paddle button 2 will
43+
NOTE: On IIe Platinum h/w (or IIe and IIe enhanced, if pad X6 on the motherboard
44+
is soldered to enable the SHIFT key mod), pressing SHIFT and paddle button 2 will
4445
short out the power supply and cause a safety shutdown. (We don't emulate
4546
this "feature", and it was relatively rare in real life as Apple joysticks only
4647
had buttons 0 and 1 normally).
@@ -251,8 +252,6 @@ class apple2e_state : public driver_device
251252
m_printer_conn(*this, "parallel"),
252253
m_printer_out(*this, "laserprnout")
253254
{
254-
m_accel_laser = false;
255-
m_has_laser_mouse = false;
256255
m_isiic = false;
257256
m_isiicplus = false;
258257
m_iscec = false;
@@ -262,8 +261,11 @@ class apple2e_state : public driver_device
262261
m_isace2200 = false;
263262
m_ace2200_axxx_bank = false;
264263
m_pal = false;
264+
m_shift_key_mod = false;
265265
m_cur_floppy = nullptr;
266266
m_devsel = 0;
267+
m_has_laser_mouse = false;
268+
m_accel_laser = false;
267269
m_laser_speed = 0;
268270
m_laser_fdc_on = false;
269271
}
@@ -459,20 +461,21 @@ class apple2e_state : public driver_device
459461
bool m_intc8rom;
460462
bool m_reset_latch;
461463

462-
bool m_isiic, m_isiicplus, m_iscec, m_iscecm, m_iscec2000, m_pal;
464+
bool m_isiic, m_isiicplus, m_iscec, m_iscecm, m_iscec2000;
465+
bool m_pal, m_shift_key_mod;
463466
u8 m_migram[0x800];
464467
u16 m_migpage;
465468

466469
bool m_isace500, m_isace2200, m_ace_cnxx_bank, m_ace2200_axxx_bank;
467470
u16 m_ace500rombank;
468471

472+
bool m_has_laser_mouse;
473+
bool m_laser_fdc_on;
474+
bool m_accel_laser;
469475
bool m_accel_unlocked;
470476
bool m_accel_fast;
471477
bool m_accel_present;
472478
bool m_accel_temp_slowdown;
473-
bool m_accel_laser;
474-
bool m_has_laser_mouse;
475-
bool m_laser_fdc_on;
476479
int m_accel_stage;
477480
u32 m_accel_speed;
478481
u8 m_accel_slotspk, m_accel_gameio, m_laser_speed;
@@ -2059,11 +2062,11 @@ u8 apple2e_state::c000_r(offs_t offset)
20592062
}
20602063
break;
20612064

2062-
case 0x60: // cassette in
2065+
case 0x60: // cassette in, inverted
20632066
case 0x68:
20642067
if (m_cassette)
20652068
{
2066-
return (m_cassette->input() > 0.0 ? 0x80 : 0) | uFloatingBus7;
2069+
return (m_cassette->input() > 0.0 ? 0 : 0x80) | uFloatingBus7;
20672070
}
20682071
return uFloatingBus7;
20692072

@@ -2075,9 +2078,9 @@ u8 apple2e_state::c000_r(offs_t offset)
20752078
case 0x6a:
20762079
return ((m_gameio->sw1_r() || (m_kbspecial->read() & 0x20)) ? 0x80 : 0) | uFloatingBus7;
20772080

2078-
case 0x63: // button 2 or SHIFT key
2081+
case 0x63: // button 2, inverted (or SHIFT key, on IIe Platinum)
20792082
case 0x6b:
2080-
return ((m_gameio->sw2_r() || (m_kbspecial->read() & 0x06)) ? 0x80 : 0) | uFloatingBus7;
2083+
return ((m_gameio->sw2_r() || ((m_shift_key_mod) && (m_kbspecial->read() & 0x06))) ? 0 : 0x80) | uFloatingBus7;
20812084

20822085
case 0x64: // joy 1 X axis
20832086
case 0x6c:
@@ -2167,7 +2170,7 @@ u8 apple2e_state::c000_iic_r(offs_t offset)
21672170
case 0x60: // 40/80 column switch (IIc and Franklin ACE 500 only)
21682171
return ((m_sysconfig.read_safe(0) & 0x40) ? 0x80 : 0) | uFloatingBus7;
21692172

2170-
case 0x63: // mouse button 2 (no other function on IIc)
2173+
case 0x63: // mouse button 2, inverted (no other function on IIc)
21712174
case 0x6b:
21722175
return (m_mouseb->read() ? 0 : 0x80) | uFloatingBus7;
21732176

@@ -3767,7 +3770,7 @@ INPUT_PORTS_END
37673770
*/
37683771

37693772
/*
3770-
Apple IIe platinum key matrix
3773+
Apple IIe Platinum key matrix
37713774
37723775
| Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 | Y8 | Y9 |
37733776
| | | | | | | | | | |
@@ -5005,11 +5008,12 @@ void apple2e_state::tk3000(machine_config &config)
50055008
void apple2e_state::apple2ep(machine_config &config)
50065009
{
50075010
apple2ee(config);
5011+
m_shift_key_mod = true; // see Apple IIe Technical Note #9
50085012
}
50095013

50105014
void apple2e_state::apple2eppal(machine_config &config)
50115015
{
5012-
apple2ee(config);
5016+
apple2ep(config);
50135017
m_maincpu->set_clock(1016966);
50145018
m_screen->set_raw(1016966 * 14, (65 * 7) * 2, 0, (40 * 7) * 2, 312, 0, 192);
50155019
}

src/mame/apple/apple2gs.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,8 +1696,8 @@ u8 apple2gs_state::c000_r(offs_t offset)
16961696
case 0x46: // INTFLAG
16971697
return (m_an3 ? INTFLAG_AN3 : 0x00) | m_intflag;
16981698

1699-
case 0x60: // button 3 on IIgs
1700-
return (m_gameio->sw3_r() ? 0x80 : 0x00) | uFloatingBus7;
1699+
case 0x60: // button 3 on IIgs, inverted
1700+
return (m_gameio->sw3_r() ? 0 : 0x80) | uFloatingBus7;
17011701

17021702
case 0x61: // button 0 or Open Apple
17031703
// HACK/TODO: the 65816 loses a race to the microcontroller on reset
@@ -1707,8 +1707,8 @@ u8 apple2gs_state::c000_r(offs_t offset)
17071707
case 0x62: // button 1 or Option
17081708
return ((m_gameio->sw1_r() || (m_adb_p3_last & 0x10)) ? 0x80 : 0) | uFloatingBus7;
17091709

1710-
case 0x63: // button 2 or SHIFT key
1711-
return (m_gameio->sw2_r() ? 0x80 : 0x00) | uFloatingBus7;
1710+
case 0x63: // button 2, inverted (no shift key mod)
1711+
return (m_gameio->sw2_r() ? 0 : 0x80) | uFloatingBus7;
17121712

17131713
case 0x64: // joy 1 X axis
17141714
if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7;

0 commit comments

Comments
 (0)