From b6792dd1f6935d352f6aa29dd0ba84648ccb938e Mon Sep 17 00:00:00 2001 From: arbee Date: Sun, 1 Dec 2024 21:52:50 -0500 Subject: apple/macadb.cpp: Updates [R. Belmont] - Added ADB power key callback - Added "any key down" callback used in PowerBooks - Removed the last bits of the old adb_vblank() service routine. apple/pseudovia.cpp: Added support for SCSI IRQs. [R. Belmont] apple/macprtb.cpp: Support sleep and wake-up for Macintosh Portable and PowerBook 100. [R. Belmont] apple/macpwrbk030.cpp: Updates [R. Belmont] - Fixed issues with Shut Down and Restart functionality - Support sleep and wake-up for all supported models - Cleanups and save state support Systems promoted to working --------------------------- Macintosh PowerBook 140 [R. Belmont] Macintosh PowerBook 160 [R. Belmont] Macintosh PowerBook 180c [R. Belmont] Clones promoted to working -------------------------- Macintosh PowerBook 145 [R. Belmont] Macintosh PowerBook 145B [R. Belmont] Macintosh PowerBook 165 [R. Belmont] Macintosh PowerBook 165c [R. Belmont] Macintosh PowerBook 170 [R. Belmont] Macintosh PowerBook 180 [R. Belmont] --- src/mame/apple/mac128.cpp | 14 ----- src/mame/apple/macadb.cpp | 17 ++++++ src/mame/apple/macadb.h | 6 ++- src/mame/apple/maciici.cpp | 9 ---- src/mame/apple/macprtb.cpp | 80 +++++++++++++++++++-------- src/mame/apple/macpwrbk030.cpp | 116 +++++++++++++++++++++++++++++++--------- src/mame/apple/macquadra700.cpp | 11 ---- src/mame/apple/pseudovia.cpp | 24 +++++++-- src/mame/apple/pseudovia.h | 1 + 9 files changed, 192 insertions(+), 86 deletions(-) diff --git a/src/mame/apple/mac128.cpp b/src/mame/apple/mac128.cpp index 376ca15d8d3..a09b36d2a39 100644 --- a/src/mame/apple/mac128.cpp +++ b/src/mame/apple/mac128.cpp @@ -201,7 +201,6 @@ private: void scc_mouse_irq( int x, int y ); void set_via_interrupt(int value); void field_interrupts(); - void vblank_irq(); void mouse_callback(); uint16_t ram_r(offs_t offset); @@ -415,14 +414,6 @@ void mac128_state::set_via_interrupt(int value) field_interrupts(); } -void mac128_state::vblank_irq() -{ - if (m_macadb) - { - m_macadb->adb_vblank(); - } -} - void mac128_state::update_volume() { /* LS161 audio PWM counters TC (SND) -> LS04 inverter (/SND) -> @@ -461,11 +452,6 @@ TIMER_CALLBACK_MEMBER(mac128_state::mac_scanline) { const int scanline = param; - if (scanline == 0) - { - vblank_irq(); - } - /* video beam in display (! VBLANK && ! HBLANK basically) */ if (scanline >= 28) { diff --git a/src/mame/apple/macadb.cpp b/src/mame/apple/macadb.cpp index d5e4797a7ab..c2b4549878e 100644 --- a/src/mame/apple/macadb.cpp +++ b/src/mame/apple/macadb.cpp @@ -13,6 +13,7 @@ #define LOG_STATE (1U << 2) #define LOG_LINESTATE (1U << 3) #define VERBOSE (0) +#define LOG_OUTPUT_FUNC osd_printf_info #include "logmacro.h" @@ -238,6 +239,8 @@ macadb_device::macadb_device(const machine_config &mconfig, const char *tag, dev m_keys(*this, "KEY%u", 0), write_adb_data(*this), write_adb_irq(*this), + write_adb_power(*this), + write_adb_akd(*this), m_waiting_cmd(false), m_datasize(0), m_command(0), @@ -313,6 +316,7 @@ static char const *const adb_statenames[4] = { "NEW", "EVEN", "ODD", "IDLE" }; bool macadb_device::adb_pollkbd(int update) { int report, codes[2]; + int akd = 0; bool result; codes[0] = codes[1] = 0xff; // key up @@ -344,6 +348,10 @@ bool macadb_device::adb_pollkbd(int update) { codes[report] |= 0x80; } + else + { + akd = 1; + } // update modifier state if (update) @@ -426,10 +434,12 @@ bool macadb_device::adb_pollkbd(int update) if (codes[0] == 0x5d) { codes[0] = codes[1] = 0x7f; + write_adb_power(ASSERT_LINE); } else if (codes[0] == 0xdd) { codes[0] = codes[1] = 0xff; + write_adb_power(CLEAR_LINE); } // figure out if there was a change @@ -453,9 +463,16 @@ bool macadb_device::adb_pollkbd(int update) } } + write_adb_akd(akd); + return result; } +void macadb_device::portable_update_keyboard() +{ + adb_pollkbd(0); +} + bool macadb_device::adb_pollmouse() { s32 NewX, NewY, NewButton; diff --git a/src/mame/apple/macadb.h b/src/mame/apple/macadb.h index 02b6910d4ef..9399bf8a1a1 100644 --- a/src/mame/apple/macadb.h +++ b/src/mame/apple/macadb.h @@ -21,14 +21,16 @@ public: auto adb_data_callback() { return write_adb_data.bind(); } auto adb_irq_callback() { return write_adb_irq.bind(); } + auto adb_power_callback() { return write_adb_power.bind(); } + auto adb_akd_callback() { return write_adb_akd.bind(); } required_ioport m_mouse0, m_mouse1, m_mouse2; required_ioport_array<8> m_keys; - devcb_write_line write_adb_data, write_adb_irq; + devcb_write_line write_adb_data, write_adb_irq, write_adb_power, write_adb_akd; void adb_linechange_w(int state); - void adb_vblank() {} + void portable_update_keyboard(); protected: // device-level overrides diff --git a/src/mame/apple/maciici.cpp b/src/mame/apple/maciici.cpp index eac97889ade..7ecf3e9089c 100644 --- a/src/mame/apple/maciici.cpp +++ b/src/mame/apple/maciici.cpp @@ -177,14 +177,6 @@ private: else m_fdc->write((offset >> 8) & 0xf, data >> 8); } - - void write_6015(int state) - { - if (state) - { - m_macadb->adb_vblank(); - } - } }; void maciici_state::machine_start() @@ -607,7 +599,6 @@ void maciici_state::maciixi_base(machine_config &config) RBV(config, m_rbv, C15M); m_rbv->via6015_callback().set(m_via1, FUNC(via6522_device::write_ca1)); - m_rbv->via6015_callback().append(FUNC(maciici_state::write_6015)); m_rbv->irq_callback().set(FUNC(maciici_state::set_via2_interrupt)); /* internal ram */ diff --git a/src/mame/apple/macprtb.cpp b/src/mame/apple/macprtb.cpp index 54e5cb12a72..0e9d8264268 100644 --- a/src/mame/apple/macprtb.cpp +++ b/src/mame/apple/macprtb.cpp @@ -2,7 +2,7 @@ // copyright-holders:R. Belmont /**************************************************************************** - drivers/macprtb.cpp + macprtb.cpp Mac Portable / PowerBook 100 emulation By R. Belmont @@ -21,6 +21,9 @@ (CMDμ G65SC22PE-2, not the "6523" variant normally used in ADB Macs) and an M50753 microcontroller "PMU" handles power management, ADB, and clock/PRAM. + These machines didn't have a power switch, so you can press any key after + shutting them down and they'll reboot. No other Apple portables did that. + VIA connections: Port A: 8-bit bidirectional data bus to the PMU Port B: 0: PMU REQ @@ -147,12 +150,14 @@ public: m_last_taken_interrupt(-1), m_ca1_data(0), m_overlay(false), + m_pmu_blank_display(true), m_pmu_to_via(0), m_pmu_from_via(0), m_pmu_ack(0), m_pmu_req(0), m_pmu_p0(0x80), - m_adb_line(1) + m_adb_line(1), + m_adb_akd(0) { } @@ -202,6 +207,7 @@ private: u8 pmu_comms_r(); void pmu_comms_w(u8 data); void set_adb_line(int state); + void set_adb_anykeydown(int state); u8 pmu_adb_r(); void pmu_adb_w(u8 data); u8 pmu_in_r(); @@ -235,10 +241,10 @@ private: s32 m_via_cycles, m_via_interrupt, m_scc_interrupt, m_asc_interrupt, m_last_taken_interrupt; s32 m_ca1_data; - bool m_overlay; + bool m_overlay, m_pmu_blank_display; u8 m_pmu_to_via, m_pmu_from_via, m_pmu_ack, m_pmu_req, m_pmu_p0; - s32 m_adb_line; + s32 m_adb_line, m_adb_akd; }; void macportable_state::nvram_default() @@ -369,7 +375,7 @@ void macportable_state::pmu_p0_w(u8 data) u8 macportable_state::pmu_p1_r() { - return 0x08; // indicate on charger power + return 0x08 | (m_adb_akd << 1); // indicate on charger power } u8 macportable_state::pmu_data_r() @@ -389,6 +395,17 @@ u8 macportable_state::pmu_comms_r() void macportable_state::pmu_comms_w(u8 data) { + if (!BIT(data, 1)) + { + address_space &space = m_maincpu->space(AS_PROGRAM); + const u32 memory_size = std::min((u32)0x3fffff, m_rom_size); + const u32 memory_end = memory_size - 1; + offs_t memory_mirror = memory_end & ~(memory_size - 1); + space.unmap_readwrite(0x00000000, memory_end); + space.install_rom(0x00000000, memory_end & ~memory_mirror, memory_mirror, m_rom_ptr); + m_overlay = true; + } + m_maincpu->set_input_line(INPUT_LINE_RESET, BIT(data, 1) ? CLEAR_LINE : ASSERT_LINE); m_via1->write_ca2(BIT(data, 4)); // 1 second interrupt @@ -401,6 +418,11 @@ void macportable_state::set_adb_line(int state) m_adb_line = state; } +void macportable_state::set_adb_anykeydown(int state) +{ + m_adb_akd = state; +} + u8 macportable_state::pmu_adb_r() { return (m_adb_line << 1); @@ -409,6 +431,8 @@ u8 macportable_state::pmu_adb_r() void macportable_state::pmu_adb_w(u8 data) { m_macadb->adb_linechange_w((data & 1) ^ 1); + + m_pmu_blank_display = BIT(data, 2) ^ 1; } u8 macportable_state::pmu_in_r() @@ -463,7 +487,14 @@ void macportable_state::machine_start() save_item(NAME(m_last_taken_interrupt)); save_item(NAME(m_ca1_data)); save_item(NAME(m_overlay)); + save_item(NAME(m_pmu_blank_display)); save_item(NAME(m_pmu_to_via)); + save_item(NAME(m_pmu_from_via)); + save_item(NAME(m_pmu_ack)); + save_item(NAME(m_pmu_req)); + save_item(NAME(m_pmu_p0)); + save_item(NAME(m_adb_line)); + save_item(NAME(m_adb_akd)); m_6015_timer = timer_alloc(FUNC(macportable_state::mac_6015_tick), this); m_6015_timer->adjust(attotime::never); @@ -480,6 +511,8 @@ void macportable_state::machine_reset() // start 60.15 Hz timer m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); + + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); } void macportable_state::init_macprtb() @@ -488,6 +521,13 @@ void macportable_state::init_macprtb() u32 macportable_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { + // is the display enabled? + if (m_pmu_blank_display) + { + bitmap.fill(0, cliprect); + return 0; + } + u16 const *const video_ram = (const u16 *) m_vram.target(); for (int y = 0; y < 400; y++) @@ -542,21 +582,18 @@ void macportable_state::via_irq_w(int state) u16 macportable_state::rom_switch_r(offs_t offset) { // disable the overlay - if (!machine().side_effects_disabled()) + if (m_overlay && !machine().side_effects_disabled()) { - if ((m_overlay) && (offset == 0x67f)) - { - address_space &space = m_maincpu->space(AS_PROGRAM); - const u32 memory_end = m_ram->size() - 1; - void *memory_data = m_ram->pointer(); - offs_t memory_mirror = memory_end & ~memory_end; + address_space &space = m_maincpu->space(AS_PROGRAM); + const u32 memory_end = m_ram->size() - 1; + void *memory_data = m_ram->pointer(); + offs_t memory_mirror = memory_end & ~memory_end; - space.install_ram(0x00000000, memory_end & ~memory_mirror, memory_mirror, memory_data); - m_overlay = false; - } + space.install_ram(0x00000000, memory_end & ~memory_mirror, memory_mirror, memory_data); + m_overlay = false; } - return m_rom_ptr[offset & ((m_rom_size - 1)>>2)]; + return m_rom_ptr[offset & ((m_rom_size - 1)>>1)]; } TIMER_CALLBACK_MEMBER(macportable_state::mac_6015_tick) @@ -566,7 +603,7 @@ TIMER_CALLBACK_MEMBER(macportable_state::mac_6015_tick) m_via1->write_ca1(m_ca1_data); m_pmu->set_input_line(m50753_device::M50753_INT1_LINE, ASSERT_LINE); - m_macadb->adb_vblank(); + m_macadb->portable_update_keyboard(); } u16 macportable_state::scsi_r(offs_t offset, u16 mem_mask) @@ -592,8 +629,7 @@ void macportable_state::scsi_berr_w(u8 data) void macportable_state::macprtb_map(address_map &map) { - map(0x000000, 0x1fffff).r(FUNC(macportable_state::rom_switch_r)); - map(0x900000, 0x93ffff).rom().region("bootrom", 0).mirror(0x0c0000); + map(0x900000, 0x93ffff).r(FUNC(macportable_state::rom_switch_r)).mirror(0x0c0000); map(0xf60000, 0xf6ffff).rw(FUNC(macportable_state::iwm_r), FUNC(macportable_state::iwm_w)); map(0xf70000, 0xf7ffff).rw(FUNC(macportable_state::via_r), FUNC(macportable_state::via_w)); map(0xf90000, 0xf9ffff).rw(FUNC(macportable_state::scsi_r), FUNC(macportable_state::scsi_w)); @@ -612,7 +648,7 @@ u8 macportable_state::via_in_a() u8 macportable_state::via_in_b() { - return 0x80 | 0x04 | ((m_pmu_ack & 1)<<1); + return 0x80 | 0x04 | ((m_pmu_ack & 1)<<1) | m_pmu_req; } void macportable_state::via_out_a(u8 data) @@ -702,6 +738,7 @@ void macportable_state::macprtb(machine_config &config) MACADB(config, m_macadb, 15.6672_MHz_XTAL); m_macadb->adb_data_callback().set(FUNC(macportable_state::set_adb_line)); + m_macadb->adb_akd_callback().set(FUNC(macportable_state::set_adb_anykeydown)); SWIM1(config, m_swim, 15.6672_MHz_XTAL); m_swim->phases_cb().set(FUNC(macportable_state::phases_w)); @@ -759,11 +796,12 @@ void macportable_state::macprtb(machine_config &config) m_ram->set_default_size("1M"); m_ram->set_extra_options("2M,4M,5M,6M,7M,8M,9M"); + SOFTWARE_LIST(config, "hdd_list").set_original("mac_hdd"); + SOFTWARE_LIST(config, "cd_list").set_original("mac_cdrom").set_filter("MC68000"); SOFTWARE_LIST(config, "flop_mac35_orig").set_original("mac_flop_orig"); SOFTWARE_LIST(config, "flop_mac35_clean").set_original("mac_flop_clcracked"); SOFTWARE_LIST(config, "flop35_list").set_original("mac_flop"); SOFTWARE_LIST(config, "flop35hd_list").set_original("mac_hdflop"); - SOFTWARE_LIST(config, "hdd_list").set_original("mac_hdd"); } ROM_START(macprtb) diff --git a/src/mame/apple/macpwrbk030.cpp b/src/mame/apple/macpwrbk030.cpp index d478dff50f0..2124c39ad5c 100644 --- a/src/mame/apple/macpwrbk030.cpp +++ b/src/mame/apple/macpwrbk030.cpp @@ -2,12 +2,12 @@ // copyright-holders:R. Belmont /**************************************************************************** - drivers/macpwrbk030.cpp + macpwrbk030.cpp Mac PowerBooks with a 68030 CPU and M50753 PMU By R. Belmont These are basically late-period Mac IIs without NuBus and with - Egret/Cuda replaced with the PMU. + Egret/Cuda replaced by the PMU. Generation 1: PowerBook 140: 16 MHz 68030, 2 MiB RAM, no FPU, passive-matrix screen @@ -29,11 +29,11 @@ identifies all models (except the 145B is shown as a 145; Apple documents this as also occuring on hardware). - 165c/180c use of a VGA GPIO feature bit to determine the correct model is supported. + - Sleep/suspend and wake-up works on all models. Driver TODOs: - - Shutting down or restarting from Finder freezes the machine. Something related - to power management presumably, but the cause is not clear. This is why the driver is MACHINE_NOT_WORKING. - - External video interface on 160/165/165c/180/180c. + - External video interface on 160/165/165c/180/180c. Need to make this a slot interface + because MAME doesn't otherwise support optionally adding a screen. ============================================================================ Technical info @@ -96,7 +96,7 @@ Port 1: 0: CCFL PWR CNTL 1: AKD (input, works like the high bit of $C000 on the Apple II, except includes the modifiers) 2: STOP CLK - 3: CHRG ON (input, 1 = charger is on, 7.1.1 Battery applet shows charging symbol on ) + 3: CHRG ON (input, 1 = charger is on, 7.1.1 Battery applet shows charging symbol) 4: KBD RST (output, resets keyboard M50740) 5: HICHG (output) 6: RING DETECT @@ -256,7 +256,7 @@ private: int m_via_interrupt, m_via2_interrupt, m_scc_interrupt, m_last_taken_interrupt; int m_ca1_data; - int m_adb_line; + int m_adb_line, m_adb_akd; bool m_overlay; @@ -276,6 +276,7 @@ private: u32 screen_update_ddc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); u32 screen_update_gsc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_vga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); u16 via_r(offs_t offset); void via_w(offs_t offset, u16 data, u16 mem_mask); @@ -333,6 +334,7 @@ private: u8 pmu_comms_r(); void pmu_comms_w(u8 data); void set_adb_line(int state); + void set_adb_anykeydown(int state); u8 pmu_p4_r(); void pmu_p4_w(u8 data); u8 pmu_in_r(); @@ -380,6 +382,26 @@ void macpb030_state::machine_start() this->m_ponti_snd_ctl |= 0x08; // indicate sound chip write so power management knows not to sleep } }); + + save_item(NAME(m_via_interrupt)); + save_item(NAME(m_via2_interrupt)); + save_item(NAME(m_scc_interrupt)); + save_item(NAME(m_last_taken_interrupt)); + save_item(NAME(m_ca1_data)); + save_item(NAME(m_adb_line)); + save_item(NAME(m_adb_akd)); + save_item(NAME(m_overlay)); + save_item(NAME(m_hdsel)); + save_item(NAME(m_pmu_blank_display)); + save_item(NAME(m_pmu_from_via)); + save_item(NAME(m_pmu_to_via)); + save_item(NAME(m_pmu_ack)); + save_item(NAME(m_pmu_req)); + save_item(NAME(m_pangola_data)); + save_item(NAME(m_ponti_modem_ctl)); + save_item(NAME(m_ponti_snd_ctl)); + save_item(NAME(m_ponti_SPI_SR)); + save_item(NAME(m_ponti_backlight_ctl)); } void macpb030_state::machine_reset() @@ -662,6 +684,8 @@ void macpb030_state::ext_video_w(offs_t offset, u8 data) { // 0 = DAC color number // 1 = DAC color write (write R, then G, then B, like usual) + // 8 = depth (0=1bpp, 1=2bpp, 2=4bpp, 3=8bpp, 4=16bpp) + // 60+61 = visible vertical area (LSB in 60, MSB in 61) } u8 macpb030_state::pmu_in_r() @@ -698,8 +722,18 @@ void macpb030_state::set_adb_line(int state) m_adb_line = state; } +void macpb030_state::set_adb_anykeydown(int state) +{ + m_adb_akd = state; +} + u8 macpb030_state::pmu_p1_r() { + if (m_adb_akd) + { + return 0x88 | 0x02; + } + return 0x88; } @@ -718,8 +752,24 @@ u8 macpb030_state::pmu_comms_r() return (m_pmu_req << 7); } +u8 last_comms = 0xff; void macpb030_state::pmu_comms_w(u8 data) { + if (!BIT(data, 1)) + { + address_space &space = m_maincpu->space(AS_PROGRAM); + const u32 memory_size = std::min((u32)0x3fffff, m_rom_size); + const u32 memory_end = memory_size - 1; + offs_t memory_mirror = memory_end & ~(memory_size - 1); + + space.unmap_write(0x00000000, memory_end); + space.install_rom(0x00000000, memory_end & ~memory_mirror, memory_mirror, m_rom_ptr); + m_overlay = true; + } + if ((data & 3) != (last_comms & 3)) + { + last_comms = data; + } m_maincpu->set_input_line(INPUT_LINE_HALT, BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE); m_maincpu->set_input_line(INPUT_LINE_RESET, BIT(data, 1) ? CLEAR_LINE : ASSERT_LINE); @@ -874,7 +924,7 @@ u32 macpb030_state::screen_update_ddc(screen_device &screen, bitmap_ind16 &bitma // is the display enabled? if (m_pmu_blank_display) { - bitmap.fill(0, cliprect); + bitmap.fill(1, cliprect); return 0; } @@ -903,7 +953,7 @@ u32 macpb030_state::screen_update_gsc(screen_device &screen, bitmap_ind16 &bitma // is the display enabled? if (!(m_gsc_regs[4] & 0x20) || m_pmu_blank_display) { - bitmap.fill(0, cliprect); + bitmap.fill(0xf, cliprect); return 0; } @@ -962,6 +1012,17 @@ u32 macpb030_state::screen_update_gsc(screen_device &screen, bitmap_ind16 &bitma return 0; } +u32 macpb030_state::screen_update_vga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + if (m_pmu_blank_display) + { + bitmap.fill(0, cliprect); + return 0; + } + + return m_vga->screen_update(screen, bitmap, cliprect); +} + u16 macpb030_state::via_r(offs_t offset) { u16 data; @@ -1026,8 +1087,7 @@ void macpb030_state::via2_irq_w(int state) u32 macpb030_state::rom_switch_r(offs_t offset) { - // disable the overlay - if (m_overlay) + if (m_overlay && !machine().side_effects_disabled()) { address_space& space = m_maincpu->space(AS_PROGRAM); const u32 memory_end = m_ram->size() - 1; @@ -1048,6 +1108,7 @@ TIMER_CALLBACK_MEMBER(macpb030_state::mac_6015_tick) m_via1->write_ca1(m_ca1_data); m_pmu->set_input_line(m50753_device::M50753_INT1_LINE, ASSERT_LINE); + m_macadb->portable_update_keyboard(); } u16 macpb030_state::scsi_r(offs_t offset, u16 mem_mask) @@ -1124,7 +1185,7 @@ u8 macpb030_state::gsc_r(offs_t offset) return 5; } - return 0; + return m_gsc_regs[offset & 0x1f]; } void macpb030_state::gsc_w(offs_t offset, u8 data) @@ -1152,7 +1213,9 @@ void macpb030_state::macpb140_map(address_map &map) map(0x50024000, 0x50027fff).r(FUNC(macpb030_state::buserror_r)).mirror(0x01f00000); // bus error here to make sure we aren't mistaken for another decoder map(0x50080000, 0x500bffff).rw(FUNC(macpb030_state::jaws_r), FUNC(macpb030_state::jaws_w)).mirror(0x01f00000); - map(0xfee08000, 0xfeffffff).ram().share("vram"); + // Video uses the mirror at fee08000, but the Power Manager stashes some sleep data in the + // lower 32K, so this *must* be mirrored + map(0xfee00000, 0xfee07fff).ram().share("vram").mirror(0x00008000); } void macpb030_state::macpb160_map(address_map &map) @@ -1262,7 +1325,10 @@ u8 macpb030_state::via2_in_a() u8 macpb030_state::via2_in_b() { - return ((m_pmu_ack & 1) << 1); + // Must also return the pmu_req state here or bset/bclr operations on other + // bits in this port will accidentally clear pmu_req and cause CPU/PMU comms + // problems! The ROM code for sleeping on all of these machines does that. + return ((m_pmu_ack & 1) << 1) | (m_pmu_req << 2); } void macpb030_state::via2_out_a(u8 data) @@ -1320,6 +1386,7 @@ void macpb030_state::macpb140(machine_config &config) MACADB(config, m_macadb, 31.3344_MHz_XTAL/2); m_macadb->adb_data_callback().set(FUNC(macpb030_state::set_adb_line)); + m_macadb->adb_akd_callback().set(FUNC(macpb030_state::set_adb_anykeydown)); RTC3430042(config, m_rtc, 32.768_kHz_XTAL); m_rtc->cko_cb().set(m_via1, FUNC(via6522_device::write_ca2)); @@ -1346,6 +1413,7 @@ void macpb030_state::macpb140(machine_config &config) NSCSI_CONNECTOR(config, "scsi:6", mac_scsi_devices, "harddisk"); NSCSI_CONNECTOR(config, "scsi:7").option_set("ncr5380", NCR53C80).machine_config([this](device_t *device) { ncr53c80_device &adapter = downcast(*device); + adapter.irq_handler().set(m_pseudovia, FUNC(pseudovia_device::scsi_irq_w)); adapter.drq_handler().set(m_scsihelp, FUNC(mac_scsi_helper_device::drq_w)); }); @@ -1451,7 +1519,7 @@ void macpb030_state::macpb165c(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &macpb030_state::macpb165c_map); m_screen->set_raw(25.175_MHz_XTAL, 800, 0, 640, 524, 0, 480); - m_screen->set_screen_update("vga", FUNC(wd90c26_vga_device::screen_update)); + m_screen->set_screen_update(FUNC(macpb030_state::screen_update_vga)); m_screen->set_no_palette(); WD90C26(config, m_vga, 0); @@ -1524,15 +1592,15 @@ ROM_END } // anonymous namespace -COMP(1991, macpb140, 0, 0, macpb140, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 140", MACHINE_NOT_WORKING) -COMP(1991, macpb170, macpb140, 0, macpb170, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 170", MACHINE_NOT_WORKING) -COMP(1992, macpb145, macpb140, 0, macpb145, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 145", MACHINE_NOT_WORKING) -COMP(1993, macpb145b, macpb140, 0, macpb145b, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 145B", MACHINE_NOT_WORKING) -COMP(1992, macpb160, 0, 0, macpb160, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 160", MACHINE_NOT_WORKING) -COMP(1993, macpb165, macpb160, 0, macpb165, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 165", MACHINE_NOT_WORKING) -COMP(1993, macpb165c, macpb180c, 0, macpb165c, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 165c", MACHINE_NOT_WORKING) -COMP(1992, macpb180, macpb160, 0, macpb180, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 180", MACHINE_NOT_WORKING) -COMP(1993, macpb180c, 0, 0, macpb180c, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 180c", MACHINE_NOT_WORKING) +COMP(1991, macpb140, 0, 0, macpb140, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 140", MACHINE_SUPPORTS_SAVE) +COMP(1991, macpb170, macpb140, 0, macpb170, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 170", MACHINE_SUPPORTS_SAVE) +COMP(1992, macpb145, macpb140, 0, macpb145, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 145", MACHINE_SUPPORTS_SAVE) +COMP(1993, macpb145b, macpb140, 0, macpb145b, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 145B", MACHINE_SUPPORTS_SAVE) +COMP(1992, macpb160, 0, 0, macpb160, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 160", MACHINE_SUPPORTS_SAVE) +COMP(1993, macpb165, macpb160, 0, macpb165, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 165", MACHINE_SUPPORTS_SAVE) +COMP(1993, macpb165c, macpb180c, 0, macpb165c, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 165c", MACHINE_SUPPORTS_SAVE) +COMP(1992, macpb180, macpb160, 0, macpb180, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 180", MACHINE_SUPPORTS_SAVE) +COMP(1993, macpb180c, 0, 0, macpb180c, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook 180c", MACHINE_SUPPORTS_SAVE) // PowerBook Duos (probably will not belong in this driver ultimately) COMP(1992, macpd210, 0, 0, macpd210, macadb, macpb030_state, empty_init, "Apple Computer", "Macintosh PowerBook Duo 210", MACHINE_NOT_WORKING) diff --git a/src/mame/apple/macquadra700.cpp b/src/mame/apple/macquadra700.cpp index b412a15f20a..45afe2ac6f3 100644 --- a/src/mame/apple/macquadra700.cpp +++ b/src/mame/apple/macquadra700.cpp @@ -155,8 +155,6 @@ private: emu_timer *m_6015_timer; int m_via2_ca1_hack, m_nubus_irq_state; int m_via_interrupt, m_via2_interrupt, m_scc_interrupt, m_last_taken_interrupt; - - TIMER_CALLBACK_MEMBER(mac_6015_tick); }; class spike_state : public quadrax00_state @@ -280,9 +278,6 @@ void quadrax00_state::machine_start() m_via_interrupt = m_via2_interrupt = m_scc_interrupt = 0; m_last_taken_interrupt = -1; - m_6015_timer = timer_alloc(FUNC(quadrax00_state::mac_6015_tick), this); - m_6015_timer->adjust(attotime::never); - save_item(NAME(m_via2_ca1_hack)); save_item(NAME(m_nubus_irq_state)); save_item(NAME(m_adb_irq_pending)); @@ -554,12 +549,6 @@ u8 quadrax00_state::ethernet_mac_r(offs_t offset) return 0; } -TIMER_CALLBACK_MEMBER(quadrax00_state::mac_6015_tick) -{ - /* handle ADB keyboard/mouse */ - m_macadb->adb_vblank(); -} - /*************************************************************************** ADDRESS MAPS ***************************************************************************/ diff --git a/src/mame/apple/pseudovia.cpp b/src/mame/apple/pseudovia.cpp index 4aa5837b892..92743e229f8 100644 --- a/src/mame/apple/pseudovia.cpp +++ b/src/mame/apple/pseudovia.cpp @@ -36,8 +36,11 @@ pseudovia_device::pseudovia_device(const machine_config &mconfig, const char *ta m_out_a_handler(*this), m_out_b_handler(*this), m_out_config_handler(*this), - m_out_video_handler(*this) + m_out_video_handler(*this), + m_pseudovia_ier(0), + m_pseudovia_ifr(0) { + std::fill_n(m_pseudovia_regs, 256, 0); } void pseudovia_device::device_start() @@ -45,13 +48,10 @@ void pseudovia_device::device_start() save_item(NAME(m_pseudovia_regs)); save_item(NAME(m_pseudovia_ier)); save_item(NAME(m_pseudovia_ifr)); - - m_pseudovia_ier = m_pseudovia_ifr = 0; } void pseudovia_device::device_reset() { - std::fill_n(m_pseudovia_regs, 256, 0); m_pseudovia_regs[2] = 0x7f; } @@ -97,7 +97,7 @@ void pseudovia_device::asc_irq_w(int state) { if (state == ASSERT_LINE) { - m_pseudovia_regs[3] |= 0x10; // any VIA 2 interrupt | sound interrupt + m_pseudovia_regs[3] |= 0x10; // any VIA 2 interrupt | CB1 interrupt pseudovia_recalc_irqs(); } else @@ -107,6 +107,20 @@ void pseudovia_device::asc_irq_w(int state) } } +void pseudovia_device::scsi_irq_w(int state) +{ + if (state == ASSERT_LINE) + { + m_pseudovia_regs[3] |= 0x08; // any VIA 2 interrupt | CB2 interrupt + pseudovia_recalc_irqs(); + } + else + { + m_pseudovia_regs[3] &= ~0x08; + pseudovia_recalc_irqs(); + } +} + void pseudovia_device::pseudovia_recalc_irqs() { // check slot interrupts and bubble them down to IFR diff --git a/src/mame/apple/pseudovia.h b/src/mame/apple/pseudovia.h index d31b90699b5..5887162736e 100644 --- a/src/mame/apple/pseudovia.h +++ b/src/mame/apple/pseudovia.h @@ -29,6 +29,7 @@ public: void vbl_irq_w(int state); void scc_irq_w(int state); void asc_irq_w(int state); + void scsi_irq_w(int state); protected: // device-level overrides -- cgit v1.2.3-70-g09d2