diff options
-rw-r--r-- | src/mame/drivers/apple2.cpp | 131 | ||||
-rw-r--r-- | src/mame/drivers/apple2e.cpp | 394 | ||||
-rw-r--r-- | src/mame/drivers/apple2gs.cpp | 944 |
3 files changed, 867 insertions, 602 deletions
diff --git a/src/mame/drivers/apple2.cpp b/src/mame/drivers/apple2.cpp index db440fd7a35..bda37f67a43 100644 --- a/src/mame/drivers/apple2.cpp +++ b/src/mame/drivers/apple2.cpp @@ -158,33 +158,33 @@ public: virtual void machine_start() override; virtual void machine_reset() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_jp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_dodo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - uint8_t ram_r(offs_t offset); - void ram_w(offs_t offset, uint8_t data); - uint8_t keyb_data_r(); - uint8_t keyb_strobe_r(); - void keyb_strobe_w(uint8_t data); - uint8_t cassette_toggle_r(); - void cassette_toggle_w(uint8_t data); - uint8_t speaker_toggle_r(); - void speaker_toggle_w(uint8_t data); - uint8_t utility_strobe_r(); - void utility_strobe_w(uint8_t data); - uint8_t switches_r(offs_t offset); - uint8_t flags_r(offs_t offset); - uint8_t controller_strobe_r(); - void controller_strobe_w(uint8_t data); - uint8_t c080_r(offs_t offset); - void c080_w(offs_t offset, uint8_t data); - uint8_t c100_r(offs_t offset); - void c100_w(offs_t offset, uint8_t data); - uint8_t c800_r(offs_t offset); - void c800_w(offs_t offset, uint8_t data); - uint8_t inh_r(offs_t offset); - void inh_w(offs_t offset, uint8_t data); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_jp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_dodo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + u8 ram_r(offs_t offset); + void ram_w(offs_t offset, u8 data); + u8 keyb_data_r(); + u8 keyb_strobe_r(); + void keyb_strobe_w(u8 data); + u8 cassette_toggle_r(); + void cassette_toggle_w(u8 data); + u8 speaker_toggle_r(); + void speaker_toggle_w(u8 data); + u8 utility_strobe_r(); + void utility_strobe_w(u8 data); + u8 switches_r(offs_t offset); + u8 flags_r(offs_t offset); + u8 controller_strobe_r(); + void controller_strobe_w(u8 data); + u8 c080_r(offs_t offset); + void c080_w(offs_t offset, u8 data); + u8 c100_r(offs_t offset); + void c100_w(offs_t offset, u8 data); + u8 c800_r(offs_t offset); + void c800_w(offs_t offset, u8 data); + u8 inh_r(offs_t offset); + void inh_w(offs_t offset, u8 data); DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); @@ -201,23 +201,20 @@ public: void apple2p(machine_config &config); void apple2_map(address_map &map); void inhbank_map(address_map &map); + private: - int m_speaker_state; - int m_cassette_state; + int m_speaker_state, m_cassette_state; - double m_joystick_x1_time; - double m_joystick_y1_time; - double m_joystick_x2_time; - double m_joystick_y2_time; + double m_joystick_x1_time, m_joystick_y1_time, m_joystick_x2_time, m_joystick_y2_time; - uint16_t m_lastchar, m_strobe; - uint8_t m_transchar; + u16 m_lastchar, m_strobe; + u8 m_transchar; bool m_anykeydown; int m_inh_slot; int m_cnxx_slot; - uint8_t *m_ram_ptr; + u8 *m_ram_ptr; int m_ram_size; int m_inh_bank; @@ -226,7 +223,7 @@ private: device_a2bus_card_interface *m_slotdevice[8]; - uint8_t read_floatingbus(); + u8 read_floatingbus(); offs_t dasm_trampoline(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer ¶ms); }; @@ -405,7 +402,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2_state::apple2_interrupt) } -uint32_t apple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 apple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // always update the flash timer here so it's smooth regardless of mode switches m_video->m_flash = ((machine().time() * 4).seconds() & 1) ? true : false; @@ -466,7 +463,7 @@ uint32_t apple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap return 0; } -uint32_t apple2_state::screen_update_jp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 apple2_state::screen_update_jp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // always update the flash timer here so it's smooth regardless of mode switches m_video->m_flash = ((machine().time() * 4).seconds() & 1) ? true : false; @@ -506,7 +503,7 @@ uint32_t apple2_state::screen_update_jp(screen_device &screen, bitmap_ind16 &bit return 0; } -uint32_t apple2_state::screen_update_dodo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 apple2_state::screen_update_dodo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // always update the flash timer here so it's smooth regardless of mode switches m_video->m_flash = ((machine().time() * 4).seconds() & 1) ? true : false; @@ -550,75 +547,75 @@ uint32_t apple2_state::screen_update_dodo(screen_device &screen, bitmap_ind16 &b I/O ***************************************************************************/ -uint8_t apple2_state::keyb_data_r() +u8 apple2_state::keyb_data_r() { // keyboard latch return m_transchar | m_strobe; } -uint8_t apple2_state::keyb_strobe_r() +u8 apple2_state::keyb_strobe_r() { // reads any key down, clears strobe - uint8_t rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); + u8 rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); if (!machine().side_effects_disabled()) m_strobe = 0; return rv; } -void apple2_state::keyb_strobe_w(uint8_t data) +void apple2_state::keyb_strobe_w(u8 data) { // clear keyboard latch m_strobe = 0; } -uint8_t apple2_state::cassette_toggle_r() +u8 apple2_state::cassette_toggle_r() { if (!machine().side_effects_disabled()) cassette_toggle_w(0); return read_floatingbus(); } -void apple2_state::cassette_toggle_w(uint8_t data) +void apple2_state::cassette_toggle_w(u8 data) { m_cassette_state ^= 1; m_cassette->output(m_cassette_state ? 1.0f : -1.0f); } -uint8_t apple2_state::speaker_toggle_r() +u8 apple2_state::speaker_toggle_r() { if (!machine().side_effects_disabled()) speaker_toggle_w(0); return read_floatingbus(); } -void apple2_state::speaker_toggle_w(uint8_t data) +void apple2_state::speaker_toggle_w(u8 data) { m_speaker_state ^= 1; m_speaker->level_w(m_speaker_state); } -uint8_t apple2_state::utility_strobe_r() +u8 apple2_state::utility_strobe_r() { if (!machine().side_effects_disabled()) utility_strobe_w(0); return read_floatingbus(); } -void apple2_state::utility_strobe_w(uint8_t data) +void apple2_state::utility_strobe_w(u8 data) { // low pulse on pin 5 of game I/O connector m_gameio->strobe_w(0); m_gameio->strobe_w(1); } -uint8_t apple2_state::switches_r(offs_t offset) +u8 apple2_state::switches_r(offs_t offset) { if (!machine().side_effects_disabled()) m_softlatch->write_bit((offset & 0x0e) >> 1, offset & 0x01); return read_floatingbus(); } -uint8_t apple2_state::flags_r(offs_t offset) +u8 apple2_state::flags_r(offs_t offset) { u8 uFloatingBus7 = read_floatingbus() & 0x7f; @@ -659,14 +656,14 @@ uint8_t apple2_state::flags_r(offs_t offset) return 0; } -uint8_t apple2_state::controller_strobe_r() +u8 apple2_state::controller_strobe_r() { if (!machine().side_effects_disabled()) controller_strobe_w(0); return read_floatingbus(); } -void apple2_state::controller_strobe_w(uint8_t data) +void apple2_state::controller_strobe_w(u8 data) { m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r(); m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r(); @@ -674,7 +671,7 @@ void apple2_state::controller_strobe_w(uint8_t data) m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r(); } -uint8_t apple2_state::c080_r(offs_t offset) +u8 apple2_state::c080_r(offs_t offset) { if(!machine().side_effects_disabled()) { @@ -692,7 +689,7 @@ uint8_t apple2_state::c080_r(offs_t offset) return read_floatingbus(); } -void apple2_state::c080_w(offs_t offset, uint8_t data) +void apple2_state::c080_w(offs_t offset, u8 data) { int slot; @@ -705,7 +702,7 @@ void apple2_state::c080_w(offs_t offset, uint8_t data) } } -uint8_t apple2_state::c100_r(offs_t offset) +u8 apple2_state::c100_r(offs_t offset) { int slotnum; @@ -724,7 +721,7 @@ uint8_t apple2_state::c100_r(offs_t offset) return read_floatingbus(); } -void apple2_state::c100_w(offs_t offset, uint8_t data) +void apple2_state::c100_w(offs_t offset, u8 data) { int slotnum; @@ -741,11 +738,11 @@ void apple2_state::c100_w(offs_t offset, uint8_t data) } } -uint8_t apple2_state::c800_r(offs_t offset) +u8 apple2_state::c800_r(offs_t offset) { if (offset == 0x7ff) { - uint8_t rv = 0xff; + u8 rv = 0xff; if ((m_cnxx_slot != -1) && (m_slotdevice[m_cnxx_slot] != nullptr)) { @@ -768,7 +765,7 @@ uint8_t apple2_state::c800_r(offs_t offset) return read_floatingbus(); } -void apple2_state::c800_w(offs_t offset, uint8_t data) +void apple2_state::c800_w(offs_t offset, u8 data) { if ((m_cnxx_slot != -1) && (m_slotdevice[m_cnxx_slot] != nullptr)) { @@ -786,7 +783,7 @@ void apple2_state::c800_w(offs_t offset, uint8_t data) } } -uint8_t apple2_state::inh_r(offs_t offset) +u8 apple2_state::inh_r(offs_t offset) { if (m_inh_slot != -1) { @@ -797,7 +794,7 @@ uint8_t apple2_state::inh_r(offs_t offset) return read_floatingbus(); } -void apple2_state::inh_w(offs_t offset, uint8_t data) +void apple2_state::inh_w(offs_t offset, u8 data) { if ((m_inh_slot != -1) && (m_slotdevice[m_inh_slot] != nullptr)) { @@ -806,7 +803,7 @@ void apple2_state::inh_w(offs_t offset, uint8_t data) } // floating bus code from old machine/apple2: now works reasonably well with French Touch and Deater "vapor lock" stuff -uint8_t apple2_state::read_floatingbus() +u8 apple2_state::read_floatingbus() { enum { @@ -934,7 +931,7 @@ uint8_t apple2_state::read_floatingbus() ADDRESS MAP ***************************************************************************/ -uint8_t apple2_state::ram_r(offs_t offset) +u8 apple2_state::ram_r(offs_t offset) { if (offset < m_ram_size) { @@ -944,7 +941,7 @@ uint8_t apple2_state::ram_r(offs_t offset) return 0xff; } -void apple2_state::ram_w(offs_t offset, uint8_t data) +void apple2_state::ram_w(offs_t offset, u8 data) { if (offset < m_ram_size) { @@ -1000,7 +997,7 @@ READ_LINE_MEMBER(apple2_state::ay3600_control_r) return CLEAR_LINE; } -static const uint8_t a2_key_remap[0x32][4] = +static const u8 a2_key_remap[0x32][4] = { /* norm shft ctrl both */ { 0x33,0x23,0x33,0x23 }, /* 3 # 00 */ diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 94ba9109099..318446fd07a 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -324,73 +324,73 @@ public: virtual void machine_start() override; virtual void machine_reset() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - uint8_t ram0000_r(offs_t offset); - void ram0000_w(offs_t offset, uint8_t data); - uint8_t ram0200_r(offs_t offset); - void ram0200_w(offs_t offset, uint8_t data); - uint8_t ram0400_r(offs_t offset); - void ram0400_w(offs_t offset, uint8_t data); - uint8_t ram0800_r(offs_t offset); - void ram0800_w(offs_t offset, uint8_t data); - uint8_t ram2000_r(offs_t offset); - void ram2000_w(offs_t offset, uint8_t data); - uint8_t ram4000_r(offs_t offset); - void ram4000_w(offs_t offset, uint8_t data); - uint8_t cec4000_r(offs_t offset); - uint8_t cec8000_r(offs_t offset); - void ram8000_w(offs_t offset, uint8_t data); - uint8_t auxram0000_r(offs_t offset); - void auxram0000_w(offs_t offset, uint8_t data); - uint8_t auxram0200_r(offs_t offset); - void auxram0200_w(offs_t offset, uint8_t data); - uint8_t auxram0400_r(offs_t offset); - void auxram0400_w(offs_t offset, uint8_t data); - uint8_t auxram0800_r(offs_t offset); - void auxram0800_w(offs_t offset, uint8_t data); - uint8_t auxram2000_r(offs_t offset); - void auxram2000_w(offs_t offset, uint8_t data); - uint8_t auxram4000_r(offs_t offset); - void auxram4000_w(offs_t offset, uint8_t data); - uint8_t c000_r(offs_t offset); - void c000_w(offs_t offset, uint8_t data); - void c000_laser_w(offs_t offset, uint8_t data); - uint8_t c000_iic_r(offs_t offset); - void c000_iic_w(offs_t offset, uint8_t data); - uint8_t c080_r(offs_t offset); - void c080_w(offs_t offset, uint8_t data); - uint8_t c100_r(offs_t offset); - uint8_t c100_int_r(offs_t offset); - uint8_t c100_int_bank_r(offs_t offset); - uint8_t c100_cec_r(offs_t offset); - uint8_t c100_cec_bank_r(offs_t offset); - void c100_w(offs_t offset, uint8_t data); - uint8_t c300_r(offs_t offset); - uint8_t c300_int_r(offs_t offset); - uint8_t c300_int_bank_r(offs_t offset); - uint8_t c300_cec_r(offs_t offset); - uint8_t c300_cec_bank_r(offs_t offset); - void c300_w(offs_t offset, uint8_t data); - uint8_t c400_r(offs_t offset); - uint8_t c400_int_r(offs_t offset); - uint8_t c400_int_bank_r(offs_t offset); - uint8_t c400_cec_r(offs_t offset); - uint8_t c400_cec_bank_r(offs_t offset); - void c400_w(offs_t offset, uint8_t data); - void c400_cec_w(offs_t offset, uint8_t data); - uint8_t c800_r(offs_t offset); - uint8_t c800_int_r(offs_t offset); - uint8_t c800_cec_r(offs_t offset); - uint8_t c800_cec_bank_r(offs_t offset); - uint8_t c800_b2_int_r(offs_t offset); - void c800_w(offs_t offset, uint8_t data); - uint8_t inh_r(offs_t offset); - void inh_w(offs_t offset, uint8_t data); - uint8_t lc_r(offs_t offset); - void lc_w(offs_t offset, uint8_t data); - uint8_t lc_romswitch_r(offs_t offset); - void lc_romswitch_w(offs_t offset, uint8_t data); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + u8 ram0000_r(offs_t offset); + void ram0000_w(offs_t offset, u8 data); + u8 ram0200_r(offs_t offset); + void ram0200_w(offs_t offset, u8 data); + u8 ram0400_r(offs_t offset); + void ram0400_w(offs_t offset, u8 data); + u8 ram0800_r(offs_t offset); + void ram0800_w(offs_t offset, u8 data); + u8 ram2000_r(offs_t offset); + void ram2000_w(offs_t offset, u8 data); + u8 ram4000_r(offs_t offset); + void ram4000_w(offs_t offset, u8 data); + u8 cec4000_r(offs_t offset); + u8 cec8000_r(offs_t offset); + void ram8000_w(offs_t offset, u8 data); + u8 auxram0000_r(offs_t offset); + void auxram0000_w(offs_t offset, u8 data); + u8 auxram0200_r(offs_t offset); + void auxram0200_w(offs_t offset, u8 data); + u8 auxram0400_r(offs_t offset); + void auxram0400_w(offs_t offset, u8 data); + u8 auxram0800_r(offs_t offset); + void auxram0800_w(offs_t offset, u8 data); + u8 auxram2000_r(offs_t offset); + void auxram2000_w(offs_t offset, u8 data); + u8 auxram4000_r(offs_t offset); + void auxram4000_w(offs_t offset, u8 data); + u8 c000_r(offs_t offset); + void c000_w(offs_t offset, u8 data); + void c000_laser_w(offs_t offset, u8 data); + u8 c000_iic_r(offs_t offset); + void c000_iic_w(offs_t offset, u8 data); + u8 c080_r(offs_t offset); + void c080_w(offs_t offset, u8 data); + u8 c100_r(offs_t offset); + u8 c100_int_r(offs_t offset); + u8 c100_int_bank_r(offs_t offset); + u8 c100_cec_r(offs_t offset); + u8 c100_cec_bank_r(offs_t offset); + void c100_w(offs_t offset, u8 data); + u8 c300_r(offs_t offset); + u8 c300_int_r(offs_t offset); + u8 c300_int_bank_r(offs_t offset); + u8 c300_cec_r(offs_t offset); + u8 c300_cec_bank_r(offs_t offset); + void c300_w(offs_t offset, u8 data); + u8 c400_r(offs_t offset); + u8 c400_int_r(offs_t offset); + u8 c400_int_bank_r(offs_t offset); + u8 c400_cec_r(offs_t offset); + u8 c400_cec_bank_r(offs_t offset); + void c400_w(offs_t offset, u8 data); + void c400_cec_w(offs_t offset, u8 data); + u8 c800_r(offs_t offset); + u8 c800_int_r(offs_t offset); + u8 c800_cec_r(offs_t offset); + u8 c800_cec_bank_r(offs_t offset); + u8 c800_b2_int_r(offs_t offset); + void c800_w(offs_t offset, u8 data); + u8 inh_r(offs_t offset); + void inh_w(offs_t offset, u8 data); + u8 lc_r(offs_t offset); + void lc_w(offs_t offset, u8 data); + u8 lc_romswitch_r(offs_t offset); + void lc_romswitch_w(offs_t offset, u8 data); DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); @@ -398,9 +398,9 @@ public: DECLARE_READ_LINE_MEMBER(ay3600_control_r); DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w); DECLARE_WRITE_LINE_MEMBER(ay3600_ako_w); - uint8_t memexp_r(offs_t offset); - void memexp_w(offs_t offset, uint8_t data); - uint8_t nsc_backing_r(offs_t offset); + u8 memexp_r(offs_t offset); + void memexp_w(offs_t offset, u8 data); + u8 nsc_backing_r(offs_t offset); void apple2cp(machine_config &config); void laser128ex2(machine_config &config); @@ -441,21 +441,16 @@ public: bool m_35sel, m_hdsel, m_intdrive; private: - int m_speaker_state; - int m_cassette_state, m_cassette_out; + int m_speaker_state, m_cassette_state, m_cassette_out; - double m_joystick_x1_time; - double m_joystick_y1_time; - double m_joystick_x2_time; - double m_joystick_y2_time; + double m_joystick_x1_time, m_joystick_y1_time, m_joystick_x2_time, m_joystick_y2_time; - uint16_t m_lastchar, m_strobe; - uint8_t m_transchar; + u16 m_lastchar, m_strobe; + u8 m_transchar; bool m_anykeydown; int m_repeatdelay; - int m_inh_slot; - int m_cnxx_slot; + int m_inh_slot, m_cnxx_slot; bool m_page2; bool m_an0, m_an1, m_an2, m_an3; @@ -479,8 +474,8 @@ private: bool m_intc8rom; bool m_isiic, m_isiicplus, m_iscec, m_iscecm, m_iscec2000, m_spectrum_text, m_pal; - uint8_t m_migram[0x800]; - uint16_t m_migpage; + u8 m_migram[0x800]; + u16 m_migpage; bool m_accel_unlocked; bool m_accel_fast; @@ -489,14 +484,14 @@ private: bool m_accel_laser; int m_accel_stage; u32 m_accel_speed; - u8 m_accel_slotspk; + u8 m_accel_slotspk, m_accel_gameio; - uint8_t *m_ram_ptr, *m_rom_ptr, *m_cec_ptr; + u8 *m_ram_ptr, *m_rom_ptr, *m_cec_ptr; int m_ram_size; int m_cec_bank; - uint8_t *m_aux_ptr, *m_aux_bank_ptr; + u8 *m_aux_ptr, *m_aux_bank_ptr; int m_inh_bank; @@ -507,19 +502,19 @@ private: int m_irqmask; - uint8_t m_exp_bankhior; + u8 m_exp_bankhior; int m_exp_addrmask; - uint8_t m_exp_regs[0x10]; - uint8_t *m_exp_ram; + u8 m_exp_regs[0x10]; + u8 *m_exp_ram; int m_exp_wptr, m_exp_liveptr; void do_io(int offset, bool is_iic); - uint8_t read_floatingbus(); + u8 read_floatingbus(); void update_slotrom_banks(); void lc_update(int offset, bool writing); - uint8_t read_slot_rom(int slotbias, int offset); - void write_slot_rom(int slotbias, int offset, uint8_t data); - uint8_t read_int_rom(int slotbias, int offset); + u8 read_slot_rom(int slotbias, int offset); + void write_slot_rom(int slotbias, int offset, u8 data); + u8 read_int_rom(int slotbias, int offset); void auxbank_update(); void cec_lcrom_update(); void raise_irq(int irq); @@ -529,10 +524,10 @@ private: void accel_normal_speed(); void accel_slot(int slot); - uint8_t m_cec_remap[0x40000]; + u8 m_cec_remap[0x40000]; - uint8_t mig_r(uint16_t offset); - void mig_w(uint16_t offset, uint8_t data); + u8 mig_r(u16 offset); + void mig_w(u16 offset, u8 data); offs_t dasm_trampoline(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer ¶ms); }; @@ -543,7 +538,7 @@ offs_t apple2e_state::dasm_trampoline(std::ostream &stream, offs_t pc, const uti return m_a2common->dasm_override(stream, pc, opcodes, params); } -uint8_t apple2e_state::mig_r(uint16_t offset) +u8 apple2e_state::mig_r(u16 offset) { //printf("mig_r @ %x\n", offset + 0xc00); // MIG RAM window @@ -555,7 +550,7 @@ uint8_t apple2e_state::mig_r(uint16_t offset) // increment MIG RAM window and return previous value if ((offset >= 0x220) && (offset < 0x240)) { - uint8_t rv = m_migram[m_migpage + offset]; + u8 rv = m_migram[m_migpage + offset]; m_migpage += 0x20; m_migpage &= 0x7ff; return rv; @@ -582,7 +577,7 @@ uint8_t apple2e_state::mig_r(uint16_t offset) return read_floatingbus(); } -void apple2e_state::mig_w(uint16_t offset, uint8_t data) +void apple2e_state::mig_w(u16 offset, u8 data) { //printf("mig_w %x @ %x\n", data, offset + 0xc00); @@ -707,9 +702,9 @@ WRITE_LINE_MEMBER(apple2e_state::a2bus_inh_w) } } -uint8_t apple2e_state::memexp_r(offs_t offset) +u8 apple2e_state::memexp_r(offs_t offset) { - uint8_t retval = m_exp_regs[offset]; + u8 retval = m_exp_regs[offset]; if (!m_exp_ram) { @@ -735,7 +730,7 @@ uint8_t apple2e_state::memexp_r(offs_t offset) return retval; } -void apple2e_state::memexp_w(offs_t offset, uint8_t data) +void apple2e_state::memexp_w(offs_t offset, u8 data) { if (!m_exp_ram) { @@ -923,7 +918,7 @@ void apple2e_state::machine_start() // remap cec gfx1 rom // for ALTCHARSET - uint8_t *rom = m_video->m_char_ptr; + u8 *rom = m_video->m_char_ptr; for(int i=0; i<0x1000; i++) { rom[i+0x1000] = rom[i]; @@ -1006,6 +1001,7 @@ void apple2e_state::machine_start() save_item(NAME(m_accel_fast)); save_item(NAME(m_accel_present)); save_item(NAME(m_accel_slotspk)); + save_item(NAME(m_accel_gameio)); save_item(NAME(m_accel_temp_slowdown)); save_item(NAME(m_accel_laser)); save_item(NAME(m_accel_speed)); @@ -1041,6 +1037,7 @@ void apple2e_state::machine_reset() m_accel_unlocked = false; m_accel_stage = 0; m_accel_slotspk = 0x41; // speaker and slot 6 slow + m_accel_gameio = 0x40; // paddle delay on m_accel_present = false; m_accel_temp_slowdown = false; m_accel_fast = false; @@ -1178,7 +1175,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2e_state::apple2_interrupt) } } -uint32_t apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bool old_page2 = m_video->m_page2; @@ -1764,6 +1761,14 @@ void apple2e_state::do_io(int offset, bool is_iic) lower_irq(IRQ_VBL); } + // Zip paddle flag + if ((m_accel_present) && (BIT(m_accel_gameio, 6))) + { + m_accel_temp_slowdown = true; + m_acceltimer->adjust(attotime::from_msec(5)); + accel_normal_speed(); + } + m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r(); m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r(); m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r(); @@ -1776,7 +1781,7 @@ void apple2e_state::do_io(int offset, bool is_iic) } } -uint8_t apple2e_state::c000_r(offs_t offset) +u8 apple2e_state::c000_r(offs_t offset) { if(machine().side_effects_disabled()) return read_floatingbus(); const u8 uFloatingBus7 = read_floatingbus() & 0x7f; @@ -1790,7 +1795,7 @@ uint8_t apple2e_state::c000_r(offs_t offset) { case 0x10: // read any key down, reset keyboard strobe { - uint8_t rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); + u8 rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); m_strobe = 0; return rv; } @@ -1885,9 +1890,25 @@ uint8_t apple2e_state::c000_r(offs_t offset) default: do_io(offset, false); - if ((offset == 0x5c) && (m_accel_unlocked)) + if (m_accel_unlocked) { - return m_accel_slotspk; + if (offset == 0x5b) + { + // bit 7 is a 1.0035 millisecond clock; the value changes every 0.50175 milliseconds + const int time = machine().time().as_ticks(1.0f / 0.00050175f); + if (time & 1) + { + return 0x03; + } + else + { + return 0x83; + } + } + else if (offset == 0x5c) + { + return m_accel_slotspk; + } } break; } @@ -1895,7 +1916,7 @@ uint8_t apple2e_state::c000_r(offs_t offset) return read_floatingbus(); } -void apple2e_state::c000_laser_w(offs_t offset, uint8_t data) +void apple2e_state::c000_laser_w(offs_t offset, u8 data) { if ((m_accel_laser) && (offset == 0x74)) { @@ -1926,7 +1947,7 @@ void apple2e_state::c000_laser_w(offs_t offset, uint8_t data) } } -void apple2e_state::c000_w(offs_t offset, uint8_t data) +void apple2e_state::c000_w(offs_t offset, u8 data) { if(machine().side_effects_disabled()) return; @@ -2069,6 +2090,13 @@ void apple2e_state::c000_w(offs_t offset, uint8_t data) } break; + case 0x5f: // Zip game I/O flags + if (m_accel_unlocked) + { + m_accel_gameio = data; + } + break; + case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: if (m_auxslotdevice) @@ -2093,7 +2121,7 @@ void apple2e_state::c000_w(offs_t offset, uint8_t data) } } -uint8_t apple2e_state::c000_iic_r(offs_t offset) +u8 apple2e_state::c000_iic_r(offs_t offset) { if(machine().side_effects_disabled()) return read_floatingbus(); u8 uFloatingBus7 = read_floatingbus() & 0x7f; @@ -2107,7 +2135,7 @@ uint8_t apple2e_state::c000_iic_r(offs_t offset) { case 0x10: // read any key down, reset keyboard strobe { - uint8_t rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); + u8 rv = m_transchar | (m_anykeydown ? 0x80 : 0x00); m_strobe = 0; return rv; } @@ -2224,7 +2252,7 @@ uint8_t apple2e_state::c000_iic_r(offs_t offset) return read_floatingbus(); } -void apple2e_state::c000_iic_w(offs_t offset, uint8_t data) +void apple2e_state::c000_iic_w(offs_t offset, u8 data) { if(machine().side_effects_disabled()) return; @@ -2483,7 +2511,7 @@ void apple2e_state::update_iic_mouse() } } -uint8_t apple2e_state::c080_r(offs_t offset) +u8 apple2e_state::c080_r(offs_t offset) { if(!machine().side_effects_disabled()) { @@ -2525,7 +2553,7 @@ uint8_t apple2e_state::c080_r(offs_t offset) return read_floatingbus(); } -void apple2e_state::c080_w(offs_t offset, uint8_t data) +void apple2e_state::c080_w(offs_t offset, u8 data) { int slot; @@ -2573,7 +2601,7 @@ void apple2e_state::c080_w(offs_t offset, uint8_t data) } } -uint8_t apple2e_state::read_slot_rom(int slotbias, int offset) +u8 apple2e_state::read_slot_rom(int slotbias, int offset) { int slotnum = ((offset>>8) & 0xf) + slotbias; @@ -2591,7 +2619,7 @@ uint8_t apple2e_state::read_slot_rom(int slotbias, int offset) return read_floatingbus(); } -void apple2e_state::write_slot_rom(int slotbias, int offset, uint8_t data) +void apple2e_state::write_slot_rom(int slotbias, int offset, u8 data) { int slotnum = ((offset>>8) & 0xf) + slotbias; @@ -2627,23 +2655,23 @@ void apple2e_state::write_slot_rom(int slotbias, int offset, uint8_t data) } } -uint8_t apple2e_state::read_int_rom(int slotbias, int offset) +u8 apple2e_state::read_int_rom(int slotbias, int offset) { //return m_rom_ptr[slotbias + offset]; return m_ds1315->read(slotbias + offset); } -uint8_t apple2e_state::nsc_backing_r(offs_t offset) { return m_rom_ptr[offset]; } +u8 apple2e_state::nsc_backing_r(offs_t offset) { return m_rom_ptr[offset]; } -uint8_t apple2e_state::c100_r(offs_t offset) { accel_slot(1 + ((offset >> 8) & 0x7)); return read_slot_rom(1, offset); } -uint8_t apple2e_state::c100_int_r(offs_t offset) { accel_slot(1 + ((offset >> 8) & 0x7)); return read_int_rom(0x100, offset); } -uint8_t apple2e_state::c100_int_bank_r(offs_t offset) { accel_slot(1 + ((offset >> 8) & 0x7)); return read_int_rom(0x4100, offset); } -uint8_t apple2e_state::c100_cec_r(offs_t offset) { return m_rom_ptr[0xc100 + offset]; } -uint8_t apple2e_state::c100_cec_bank_r(offs_t offset) { return m_rom_ptr[0x4100 + offset]; } -void apple2e_state::c100_w(offs_t offset, uint8_t data) { accel_slot(1); write_slot_rom(1, offset, data); } -uint8_t apple2e_state::c300_r(offs_t offset) { accel_slot(3 + ((offset >> 8) & 0x7)); return read_slot_rom(3, offset); } +u8 apple2e_state::c100_r(offs_t offset) { accel_slot(1 + ((offset >> 8) & 0x7)); return read_slot_rom(1, offset); } +u8 apple2e_state::c100_int_r(offs_t offset) { accel_slot(1 + ((offset >> 8) & 0x7)); return read_int_rom(0x100, offset); } +u8 apple2e_state::c100_int_bank_r(offs_t offset) { accel_slot(1 + ((offset >> 8) & 0x7)); return read_int_rom(0x4100, offset); } +u8 apple2e_state::c100_cec_r(offs_t offset) { return m_rom_ptr[0xc100 + offset]; } +u8 apple2e_state::c100_cec_bank_r(offs_t offset) { return m_rom_ptr[0x4100 + offset]; } +void apple2e_state::c100_w(offs_t offset, u8 data) { accel_slot(1); write_slot_rom(1, offset, data); } +u8 apple2e_state::c300_r(offs_t offset) { accel_slot(3 + ((offset >> 8) & 0x7)); return read_slot_rom(3, offset); } -uint8_t apple2e_state::c300_int_r(offs_t offset) +u8 apple2e_state::c300_int_r(offs_t offset) { accel_slot(3 + ((offset >> 8) & 0x7)); if ((!m_slotc3rom) && !machine().side_effects_disabled()) @@ -2654,7 +2682,7 @@ uint8_t apple2e_state::c300_int_r(offs_t offset) return read_int_rom(0x300, offset); } -uint8_t apple2e_state::c300_int_bank_r(offs_t offset) +u8 apple2e_state::c300_int_bank_r(offs_t offset) { accel_slot(3 + ((offset >> 8) & 0x7)); if ((!m_slotc3rom) && !machine().side_effects_disabled()) @@ -2665,7 +2693,7 @@ uint8_t apple2e_state::c300_int_bank_r(offs_t offset) return read_int_rom(0x4300, offset); } -void apple2e_state::c300_w(offs_t offset, uint8_t data) +void apple2e_state::c300_w(offs_t offset, u8 data) { accel_slot(3 + ((offset >> 8) & 0x7)); if ((!m_slotc3rom) && !machine().side_effects_disabled()) @@ -2677,11 +2705,11 @@ void apple2e_state::c300_w(offs_t offset, uint8_t data) write_slot_rom(3, offset, data); } -uint8_t apple2e_state::c300_cec_r(offs_t offset) { return m_rom_ptr[0xc300 + offset]; } -uint8_t apple2e_state::c300_cec_bank_r(offs_t offset) { return m_rom_ptr[0x4300 + offset]; } +u8 apple2e_state::c300_cec_r(offs_t offset) { return m_rom_ptr[0xc300 + offset]; } +u8 apple2e_state::c300_cec_bank_r(offs_t offset) { return m_rom_ptr[0x4300 + offset]; } -uint8_t apple2e_state::c400_r(offs_t offset) { accel_slot(4 + ((offset >> 8) & 0x7)); return read_slot_rom(4, offset); } -uint8_t apple2e_state::c400_int_r(offs_t offset) +u8 apple2e_state::c400_r(offs_t offset) { accel_slot(4 + ((offset >> 8) & 0x7)); return read_slot_rom(4, offset); } +u8 apple2e_state::c400_int_r(offs_t offset) { accel_slot(4 + ((offset >> 8) & 0x7)); if ((offset < 0x100) && (m_mockingboard4c)) @@ -2692,7 +2720,7 @@ uint8_t apple2e_state::c400_int_r(offs_t offset) return read_int_rom(0x400, offset); } -uint8_t apple2e_state::c400_int_bank_r(offs_t offset) +u8 apple2e_state::c400_int_bank_r(offs_t offset) { accel_slot(4 + ((offset >> 8) & 0x7)); if ((offset < 0x100) && (m_mockingboard4c)) @@ -2703,7 +2731,7 @@ uint8_t apple2e_state::c400_int_bank_r(offs_t offset) return read_int_rom(0x4400, offset); } -void apple2e_state::c400_w(offs_t offset, uint8_t data) +void apple2e_state::c400_w(offs_t offset, u8 data) { accel_slot(4 + ((offset >> 8) & 0x7)); if ((m_isiic) && (offset < 0x100)) @@ -2714,10 +2742,10 @@ void apple2e_state::c400_w(offs_t offset, uint8_t data) write_slot_rom(4, offset, data); } -uint8_t apple2e_state::c400_cec_r(offs_t offset) { return m_rom_ptr[0xc400 + offset]; } -uint8_t apple2e_state::c400_cec_bank_r(offs_t offset) { return m_rom_ptr[0x4400 + offset]; } +u8 apple2e_state::c400_cec_r(offs_t offset) { return m_rom_ptr[0xc400 + offset]; } +u8 apple2e_state::c400_cec_bank_r(offs_t offset) { return m_rom_ptr[0x4400 + offset]; } -void apple2e_state::c400_cec_w(offs_t offset, uint8_t data) +void apple2e_state::c400_cec_w(offs_t offset, u8 data) { if ((m_iscecm)) { @@ -2725,11 +2753,11 @@ void apple2e_state::c400_cec_w(offs_t offset, uint8_t data) } } -uint8_t apple2e_state::c800_r(offs_t offset) +u8 apple2e_state::c800_r(offs_t offset) { if ((offset == 0x7ff) && !machine().side_effects_disabled()) { - uint8_t rv = 0xff; + u8 rv = 0xff; if ((m_cnxx_slot > 0) && (m_slotdevice[m_cnxx_slot] != nullptr)) { @@ -2749,7 +2777,7 @@ uint8_t apple2e_state::c800_r(offs_t offset) return read_floatingbus(); } -uint8_t apple2e_state::c800_int_r(offs_t offset) +u8 apple2e_state::c800_int_r(offs_t offset) { if ((offset == 0x7ff) && !machine().side_effects_disabled()) { @@ -2766,7 +2794,7 @@ uint8_t apple2e_state::c800_int_r(offs_t offset) return m_rom_ptr[0x800 + offset]; } -uint8_t apple2e_state::c800_b2_int_r(offs_t offset) +u8 apple2e_state::c800_b2_int_r(offs_t offset) { if ((m_isiicplus) && (m_romswitch) && (((offset >= 0x400) && (offset < 0x500)) || ((offset >= 0x600) && (offset < 0x700)))) { @@ -2783,7 +2811,7 @@ uint8_t apple2e_state::c800_b2_int_r(offs_t offset) return m_rom_ptr[0x4800 + offset]; } -void apple2e_state::c800_w(offs_t offset, uint8_t data) +void apple2e_state::c800_w(offs_t offset, u8 data) { if ((m_isiicplus) && (m_romswitch) && (((offset >= 0x400) && (offset < 0x500)) || ((offset >= 0x600) && (offset < 0x700)))) { @@ -2807,10 +2835,10 @@ void apple2e_state::c800_w(offs_t offset, uint8_t data) } } -uint8_t apple2e_state::c800_cec_r(offs_t offset) { return m_rom_ptr[0xc800 + offset]; } -uint8_t apple2e_state::c800_cec_bank_r(offs_t offset) { return m_rom_ptr[0x4800 + offset]; } +u8 apple2e_state::c800_cec_r(offs_t offset) { return m_rom_ptr[0xc800 + offset]; } +u8 apple2e_state::c800_cec_bank_r(offs_t offset) { return m_rom_ptr[0x4800 + offset]; } -uint8_t apple2e_state::inh_r(offs_t offset) +u8 apple2e_state::inh_r(offs_t offset) { if (m_inh_slot != -1) { @@ -2821,7 +2849,7 @@ uint8_t apple2e_state::inh_r(offs_t offset) return read_floatingbus(); } -void apple2e_state::inh_w(offs_t offset, uint8_t data) +void apple2e_state::inh_w(offs_t offset, u8 data) { if (m_inh_slot != -1) { @@ -2829,17 +2857,17 @@ void apple2e_state::inh_w(offs_t offset, uint8_t data) } } -uint8_t apple2e_state::lc_romswitch_r(offs_t offset) +u8 apple2e_state::lc_romswitch_r(offs_t offset) { return m_rom_ptr[0x5000 + offset]; } -void apple2e_state::lc_romswitch_w(offs_t offset, uint8_t data) +void apple2e_state::lc_romswitch_w(offs_t offset, u8 data) { lc_w(offset, data); } -uint8_t apple2e_state::lc_r(offs_t offset) +u8 apple2e_state::lc_r(offs_t offset) { if ((m_altzp) && (!m_iscec)) { @@ -2882,7 +2910,7 @@ uint8_t apple2e_state::lc_r(offs_t offset) } } -void apple2e_state::lc_w(offs_t offset, uint8_t data) +void apple2e_state::lc_w(offs_t offset, u8 data) { if (!m_lcwriteenable) { @@ -2929,7 +2957,7 @@ void apple2e_state::lc_w(offs_t offset, uint8_t data) } // floating bus code from old machine/apple2: now works reasonably well with French Touch and Deater "vapor lock" stuff -uint8_t apple2e_state::read_floatingbus() +u8 apple2e_state::read_floatingbus() { enum { @@ -3046,26 +3074,26 @@ uint8_t apple2e_state::read_floatingbus() ADDRESS MAP ***************************************************************************/ -uint8_t apple2e_state::ram0000_r(offs_t offset) { return m_ram_ptr[offset]; } -void apple2e_state::ram0000_w(offs_t offset, uint8_t data) { m_ram_ptr[offset] = data; } -uint8_t apple2e_state::ram0200_r(offs_t offset) { return m_ram_ptr[offset+0x200]; } -void apple2e_state::ram0200_w(offs_t offset, uint8_t data) { m_ram_ptr[offset+0x200] = data; } -uint8_t apple2e_state::ram0400_r(offs_t offset) { return m_ram_ptr[offset+0x400]; } -void apple2e_state::ram0400_w(offs_t offset, uint8_t data) { m_ram_ptr[offset+0x400] = data; } -uint8_t apple2e_state::ram0800_r(offs_t offset) { return m_ram_ptr[offset+0x800]; } -void apple2e_state::ram0800_w(offs_t offset, uint8_t data) { m_ram_ptr[offset+0x800] = data; } -uint8_t apple2e_state::ram2000_r(offs_t offset) { return m_ram_ptr[offset+0x2000]; } -void apple2e_state::ram2000_w(offs_t offset, uint8_t data) { m_ram_ptr[offset+0x2000] = data; } -uint8_t apple2e_state::ram4000_r(offs_t offset) { return m_ram_ptr[offset+0x4000]; } -void apple2e_state::ram4000_w(offs_t offset, uint8_t data) { m_ram_ptr[offset+0x4000] = data; } -void apple2e_state::ram8000_w(offs_t offset, uint8_t data) { m_ram_ptr[offset+0x8000] = data; } -uint8_t apple2e_state::cec4000_r(offs_t offset) +u8 apple2e_state::ram0000_r(offs_t offset) { return m_ram_ptr[offset]; } +void apple2e_state::ram0000_w(offs_t offset, u8 data) { m_ram_ptr[offset] = data; } +u8 apple2e_state::ram0200_r(offs_t offset) { return m_ram_ptr[offset+0x200]; } +void apple2e_state::ram0200_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x200] = data; } +u8 apple2e_state::ram0400_r(offs_t offset) { return m_ram_ptr[offset+0x400]; } +void apple2e_state::ram0400_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x400] = data; } +u8 apple2e_state::ram0800_r(offs_t offset) { return m_ram_ptr[offset+0x800]; } +void apple2e_state::ram0800_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x800] = data; } +u8 apple2e_state::ram2000_r(offs_t offset) { return m_ram_ptr[offset+0x2000]; } +void apple2e_state::ram2000_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x2000] = data; } +u8 apple2e_state::ram4000_r(offs_t offset) { return m_ram_ptr[offset+0x4000]; } +void apple2e_state::ram4000_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x4000] = data; } +void apple2e_state::ram8000_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x8000] = data; } +u8 apple2e_state::cec4000_r(offs_t offset) { //printf("cec4000_r: ofs %x\n", offset); return m_cec_remap[((m_cec_bank & 0xf) << 14) + offset]; } -uint8_t apple2e_state::cec8000_r(offs_t offset) +u8 apple2e_state::cec8000_r(offs_t offset) { //printf("cec8000_r: ofs %x\n", offset); if (m_cec_bank & 0x20) @@ -3078,18 +3106,18 @@ uint8_t apple2e_state::cec8000_r(offs_t offset) } } -uint8_t apple2e_state::auxram0000_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset]; } else { return read_floatingbus(); } } -void apple2e_state::auxram0000_w(offs_t offset, uint8_t data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset] = data; } } -uint8_t apple2e_state::auxram0200_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x200]; } else { return read_floatingbus(); } } -void apple2e_state::auxram0200_w(offs_t offset, uint8_t data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x200] = data; } } -uint8_t apple2e_state::auxram0400_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x400]; } else { return read_floatingbus(); } } -void apple2e_state::auxram0400_w(offs_t offset, uint8_t data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x400] = data; } } -uint8_t apple2e_state::auxram0800_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x800]; } else { return read_floatingbus(); } } -void apple2e_state::auxram0800_w(offs_t offset, uint8_t data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x800] = data; } } -uint8_t apple2e_state::auxram2000_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x2000]; } else { return read_floatingbus(); } } -void apple2e_state::auxram2000_w(offs_t offset, uint8_t data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x2000] = data; } } -uint8_t apple2e_state::auxram4000_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x4000]; } else { return read_floatingbus(); } } -void apple2e_state::auxram4000_w(offs_t offset, uint8_t data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x4000] = data; } } +u8 apple2e_state::auxram0000_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset]; } else { return read_floatingbus(); } } +void apple2e_state::auxram0000_w(offs_t offset, u8 data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset] = data; } } +u8 apple2e_state::auxram0200_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x200]; } else { return read_floatingbus(); } } +void apple2e_state::auxram0200_w(offs_t offset, u8 data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x200] = data; } } +u8 apple2e_state::auxram0400_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x400]; } else { return read_floatingbus(); } } +void apple2e_state::auxram0400_w(offs_t offset, u8 data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x400] = data; } } +u8 apple2e_state::auxram0800_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x800]; } else { return read_floatingbus(); } } +void apple2e_state::auxram0800_w(offs_t offset, u8 data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x800] = data; } } +u8 apple2e_state::auxram2000_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x2000]; } else { return read_floatingbus(); } } +void apple2e_state::auxram2000_w(offs_t offset, u8 data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x2000] = data; } } +u8 apple2e_state::auxram4000_r(offs_t offset) { if (m_aux_bank_ptr) { return m_aux_bank_ptr[offset+0x4000]; } else { return read_floatingbus(); } } +void apple2e_state::auxram4000_w(offs_t offset, u8 data) { if (m_aux_bank_ptr) { m_aux_bank_ptr[offset+0x4000] = data; } } void apple2e_state::apple2e_map(address_map &map) { @@ -3304,8 +3332,8 @@ WRITE_LINE_MEMBER(apple2e_state::ay3600_data_ready_w) { if (state == ASSERT_LINE) { - uint8_t *decode = m_kbdrom->base(); - uint16_t trans; + u8 *decode = m_kbdrom->base(); + u16 trans; // if the user presses a valid key to start the driver from the info screen, // we will see that key. ignore keys in the first 25,000 cycles (in my tests, @@ -4768,7 +4796,7 @@ void apple2e_state::apple2c(machine_config &config) m_ram->set_default_size("128K").set_extra_options("128K"); } -static void apple2cp_set_lines(device_t *device, uint8_t lines) +static void apple2cp_set_lines(device_t *device, u8 lines) { apple2e_state *state = device->machine().driver_data<apple2e_state>(); @@ -4802,7 +4830,7 @@ static void apple2cp_set_enable_lines(device_t *device,int enable_mask) } } -static uint8_t apple2cp_read_data(device_t *device) +static u8 apple2cp_read_data(device_t *device) { apple2e_state *state = device->machine().driver_data<apple2e_state>(); @@ -4818,7 +4846,7 @@ static uint8_t apple2cp_read_data(device_t *device) return 0; } -static void apple2cp_write_data(device_t *device, uint8_t data) +static void apple2cp_write_data(device_t *device, u8 data) { apple2e_state *state = device->machine().driver_data<apple2e_state>(); diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp index 0dcb3c76e21..e9a4e40f864 100644 --- a/src/mame/drivers/apple2gs.cpp +++ b/src/mame/drivers/apple2gs.cpp @@ -34,6 +34,18 @@ A17C = fail 1 A0F1 = fail 2 + ZipGS notes: + $C059 is the GS settings register + bit 3: CPS Follow + bit 4: Counter Delay + bit 5: AppleTalk Delay + bit 6: Joystick Delay (reverse logic: 0 = delay is ON) + bit 7: C/D cache disable + + $C05D is the speed percentage: + $F0 = 6%, $E0 = 12%, $D0 = 18%, $C0 = 25%, $B0 = 31%, $A0 = 37%, $90 = 43%, $80 = 50%, + $70 = 56%, $60 = 62%, $50 = 68%, $40 = 75%, $30 = 81%, $20 = 87%, $10 = 93%, $00 = 100% + ***************************************************************************/ #define RUN_ADB_MICRO (0) @@ -155,16 +167,6 @@ #define A2GS_B02000_TAG "b0r20bank" #define A2GS_B04000_TAG "b0r40bank" -#define A2GS_KBD_Y0_TAG "Y0" -#define A2GS_KBD_Y1_TAG "Y1" -#define A2GS_KBD_Y2_TAG "Y2" -#define A2GS_KBD_Y3_TAG "Y3" -#define A2GS_KBD_Y4_TAG "Y4" -#define A2GS_KBD_Y5_TAG "Y5" -#define A2GS_KBD_Y6_TAG "Y6" -#define A2GS_KBD_Y7_TAG "Y7" -#define A2GS_KBD_Y8_TAG "Y8" -#define A2GS_KBD_Y9_TAG "Y9" #define A2GS_KBD_SPEC_TAG "keyb_special" #define CNXX_UNCLAIMED -1 @@ -175,67 +177,60 @@ class apple2gs_state : public driver_device public: apple2gs_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, A2GS_CPU_TAG), - m_screen(*this, "screen"), - m_scantimer(*this, "scantimer"), - m_adbmicro(*this, A2GS_ADBMCU_TAG), - m_ram(*this, RAM_TAG), - m_rom(*this, "maincpu"), - m_docram(*this, "docram"), - m_nvram(*this, "nvram"), - m_video(*this, A2GS_VIDEO_TAG), - m_a2bus(*this, A2GS_BUS_TAG), - m_a2common(*this, "a2common"), -// m_a2host(*this, "a2host"), - m_gameio(*this, "gameio"), - m_speaker(*this, A2GS_SPEAKER_TAG), - m_upperbank(*this, A2GS_UPPERBANK_TAG), - m_upperaux(*this, A2GS_AUXUPPER_TAG), - m_upper00(*this, A2GS_00UPPER_TAG), - m_upper01(*this, A2GS_01UPPER_TAG), - m_c100bank(*this, A2GS_C100_TAG), - m_c300bank(*this, A2GS_C300_TAG), - m_c400bank(*this, A2GS_C400_TAG), - m_c800bank(*this, A2GS_C800_TAG), - m_b0_0000bank(*this, A2GS_B00000_TAG), - m_b0_0200bank(*this, A2GS_B00200_TAG), - m_b0_0400bank(*this, A2GS_B00400_TAG), - m_b0_0800bank(*this, A2GS_B00800_TAG), - m_b0_2000bank(*this, A2GS_B02000_TAG), - m_b0_4000bank(*this, A2GS_B04000_TAG), - m_lcbank(*this, A2GS_LCBANK_TAG), - m_lcaux(*this, A2GS_LCAUX_TAG), - m_lc00(*this, A2GS_LC00_TAG), - m_lc01(*this, A2GS_LC01_TAG), - m_bank0_atc(*this, A2GS_B0CXXX_TAG), - m_bank1_atc(*this, A2GS_B1CXXX_TAG), - m_scc(*this, SCC_TAG), - m_doc(*this, A2GS_DOC_TAG), - m_iwm(*this, A2GS_IWM_TAG), - m_ky0(*this, A2GS_KBD_Y0_TAG), - m_ky1(*this, A2GS_KBD_Y1_TAG), - m_ky2(*this, A2GS_KBD_Y2_TAG), - m_ky3(*this, A2GS_KBD_Y3_TAG), - m_ky4(*this, A2GS_KBD_Y4_TAG), - m_ky5(*this, A2GS_KBD_Y5_TAG), - m_ky6(*this, A2GS_KBD_Y6_TAG), - m_ky7(*this, A2GS_KBD_Y7_TAG), - m_ky8(*this, A2GS_KBD_Y8_TAG), - m_ky9(*this, A2GS_KBD_Y9_TAG), - m_kbspecial(*this, A2GS_KBD_SPEC_TAG), - m_ay3600(*this, "ay3600"), - m_kbdrom(*this, "keyboard"), - m_adb_mousex(*this, "adb_mouse_x"), - m_adb_mousey(*this, "adb_mouse_y") + m_maincpu(*this, A2GS_CPU_TAG), + m_screen(*this, "screen"), + m_scantimer(*this, "scantimer"), + m_acceltimer(*this, "acceltimer"), + m_adbmicro(*this, A2GS_ADBMCU_TAG), + m_ram(*this, RAM_TAG), + m_rom(*this, "maincpu"), + m_docram(*this, "docram"), + m_nvram(*this, "nvram"), + m_video(*this, A2GS_VIDEO_TAG), + m_a2bus(*this, A2GS_BUS_TAG), + m_a2common(*this, "a2common"), + // m_a2host(*this, "a2host"), + m_gameio(*this, "gameio"), + m_speaker(*this, A2GS_SPEAKER_TAG), + m_upperbank(*this, A2GS_UPPERBANK_TAG), + m_upperaux(*this, A2GS_AUXUPPER_TAG), + m_upper00(*this, A2GS_00UPPER_TAG), + m_upper01(*this, A2GS_01UPPER_TAG), + m_c100bank(*this, A2GS_C100_TAG), + m_c300bank(*this, A2GS_C300_TAG), + m_c400bank(*this, A2GS_C400_TAG), + m_c800bank(*this, A2GS_C800_TAG), + m_b0_0000bank(*this, A2GS_B00000_TAG), + m_b0_0200bank(*this, A2GS_B00200_TAG), + m_b0_0400bank(*this, A2GS_B00400_TAG), + m_b0_0800bank(*this, A2GS_B00800_TAG), + m_b0_2000bank(*this, A2GS_B02000_TAG), + m_b0_4000bank(*this, A2GS_B04000_TAG), + m_lcbank(*this, A2GS_LCBANK_TAG), + m_lcaux(*this, A2GS_LCAUX_TAG), + m_lc00(*this, A2GS_LC00_TAG), + m_lc01(*this, A2GS_LC01_TAG), + m_bank0_atc(*this, A2GS_B0CXXX_TAG), + m_bank1_atc(*this, A2GS_B1CXXX_TAG), + m_scc(*this, SCC_TAG), + m_doc(*this, A2GS_DOC_TAG), + m_iwm(*this, A2GS_IWM_TAG), + m_kbd(*this, "Y%d", 0), + m_kbspecial(*this, A2GS_KBD_SPEC_TAG), + m_sysconfig(*this, "a2_config"), + m_ay3600(*this, "ay3600"), + m_kbdrom(*this, "keyboard"), + m_adb_mousex(*this, "adb_mouse_x"), + m_adb_mousey(*this, "adb_mouse_y") { } required_device<g65816_device> m_maincpu; required_device<screen_device> m_screen; - required_device<timer_device> m_scantimer; + required_device<timer_device> m_scantimer, m_acceltimer; required_device<m5074x_device> m_adbmicro; required_device<ram_device> m_ram; - required_region_ptr<uint8_t> m_rom; - required_shared_ptr<uint8_t> m_docram; + required_region_ptr<u8> m_rom; + required_shared_ptr<u8> m_docram; required_device<nvram_device> m_nvram; required_device<a2_video_device> m_video; required_device<a2bus_device> m_a2bus; @@ -250,8 +245,8 @@ public: required_device<z80scc_device> m_scc; required_device<es5503_device> m_doc; required_device<applefdc_base_device> m_iwm; - optional_ioport m_ky0, m_ky1, m_ky2, m_ky3, m_ky4, m_ky5, m_ky6, m_ky7, m_ky8, m_ky9; - required_ioport m_kbspecial; + optional_ioport_array<10> m_kbd; + required_ioport m_kbspecial, m_sysconfig; optional_device<ay3600_device> m_ay3600; required_memory_region m_kbdrom; required_ioport m_adb_mousex, m_adb_mousey; @@ -380,12 +375,13 @@ public: address_space *m_maincpu_space; TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt); + TIMER_DEVICE_CALLBACK_MEMBER(accel_timer); virtual void machine_start() override; virtual void machine_reset() override; void palette_init(palette_device &palette); - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void apple2gs(machine_config &config); void apple2gsr1(machine_config &config); @@ -418,81 +414,81 @@ public: // temp old IWM hookup int apple2_fdc_has_35(); int apple2_fdc_has_525(); - void apple2_iwm_setdiskreg(uint8_t data); + void apple2_iwm_setdiskreg(u8 data); - uint8_t m_diskreg; // move into private when we can + u8 m_diskreg; // move into private when we can void rom1_init() { m_is_rom3 = false; } void rom3_init() { m_is_rom3 = true; } private: - uint8_t ram0000_r(offs_t offset); - void ram0000_w(offs_t offset, uint8_t data); - uint8_t auxram0000_r(offs_t offset); - void auxram0000_w(offs_t offset, uint8_t data); - uint8_t b0ram0000_r(offs_t offset); - void b0ram0000_w(offs_t offset, uint8_t data); - uint8_t b0ram0200_r(offs_t offset); - void b0ram0200_w(offs_t offset, uint8_t data); - uint8_t b0ram0400_r(offs_t offset); - void b0ram0400_w(offs_t offset, uint8_t data); - uint8_t b0ram0800_r(offs_t offset); - void b0ram0800_w(offs_t offset, uint8_t data); - uint8_t b0ram2000_r(offs_t offset); - void b0ram2000_w(offs_t offset, uint8_t data); - uint8_t b0ram4000_r(offs_t offset); - void b0ram4000_w(offs_t offset, uint8_t data); - uint8_t b1ram0000_r(offs_t offset); - void b1ram0000_w(offs_t offset, uint8_t data); - uint8_t b1ram0200_r(offs_t offset); - void b1ram0200_w(offs_t offset, uint8_t data); - uint8_t b1ram0400_r(offs_t offset); - void b1ram0400_w(offs_t offset, uint8_t data); - uint8_t b1ram0800_r(offs_t offset); - void b1ram0800_w(offs_t offset, uint8_t data); - uint8_t b1ram2000_r(offs_t offset); - void b1ram2000_w(offs_t offset, uint8_t data); - uint8_t b1ram4000_r(offs_t offset); - void b1ram4000_w(offs_t offset, uint8_t data); - uint8_t c000_r(offs_t offset); - void c000_w(offs_t offset, uint8_t data); - uint8_t c080_r(offs_t offset); - void c080_w(offs_t offset, uint8_t data); - uint8_t c100_r(offs_t offset); - uint8_t c100_int_r(offs_t offset); - void c100_w(offs_t offset, uint8_t data); - uint8_t c300_r(offs_t offset); - uint8_t c300_int_r(offs_t offset); - void c300_w(offs_t offset, uint8_t data); - uint8_t c400_r(offs_t offset); - uint8_t c400_int_r(offs_t offset); - void c400_w(offs_t offset, uint8_t data); - uint8_t c800_r(offs_t offset); - uint8_t c800_int_r(offs_t offset); - void c800_w(offs_t offset, uint8_t data); - uint8_t inh_r(offs_t offset); - void inh_w(offs_t offset, uint8_t data); - uint8_t lc_r(offs_t offset); - void lc_w(offs_t offset, uint8_t data); - uint8_t lc_aux_r(offs_t offset); - void lc_aux_w(offs_t offset, uint8_t data); - uint8_t lc_00_r(offs_t offset); - void lc_00_w(offs_t offset, uint8_t data); - uint8_t lc_01_r(offs_t offset); - void lc_01_w(offs_t offset, uint8_t data); - uint8_t bank0_c000_r(offs_t offset); - void bank0_c000_w(offs_t offset, uint8_t data); - uint8_t bank1_0000_r(offs_t offset); - void bank1_0000_sh_w(offs_t offset, uint8_t data); - uint8_t bank1_c000_r(offs_t offset); - void bank1_c000_w(offs_t offset, uint8_t data); + u8 ram0000_r(offs_t offset); + void ram0000_w(offs_t offset, u8 data); + u8 auxram0000_r(offs_t offset); + void auxram0000_w(offs_t offset, u8 data); + u8 b0ram0000_r(offs_t offset); + void b0ram0000_w(offs_t offset, u8 data); + u8 b0ram0200_r(offs_t offset); + void b0ram0200_w(offs_t offset, u8 data); + u8 b0ram0400_r(offs_t offset); + void b0ram0400_w(offs_t offset, u8 data); + u8 b0ram0800_r(offs_t offset); + void b0ram0800_w(offs_t offset, u8 data); + u8 b0ram2000_r(offs_t offset); + void b0ram2000_w(offs_t offset, u8 data); + u8 b0ram4000_r(offs_t offset); + void b0ram4000_w(offs_t offset, u8 data); + u8 b1ram0000_r(offs_t offset); + void b1ram0000_w(offs_t offset, u8 data); + u8 b1ram0200_r(offs_t offset); + void b1ram0200_w(offs_t offset, u8 data); + u8 b1ram0400_r(offs_t offset); + void b1ram0400_w(offs_t offset, u8 data); + u8 b1ram0800_r(offs_t offset); + void b1ram0800_w(offs_t offset, u8 data); + u8 b1ram2000_r(offs_t offset); + void b1ram2000_w(offs_t offset, u8 data); + u8 b1ram4000_r(offs_t offset); + void b1ram4000_w(offs_t offset, u8 data); + u8 c000_r(offs_t offset); + void c000_w(offs_t offset, u8 data); + u8 c080_r(offs_t offset); + void c080_w(offs_t offset, u8 data); + u8 c100_r(offs_t offset); + u8 c100_int_r(offs_t offset); + void c100_w(offs_t offset, u8 data); + u8 c300_r(offs_t offset); + u8 c300_int_r(offs_t offset); + void c300_w(offs_t offset, u8 data); + u8 c400_r(offs_t offset); + u8 c400_int_r(offs_t offset); + void c400_w(offs_t offset, u8 data); + u8 c800_r(offs_t offset); + u8 c800_int_r(offs_t offset); + void c800_w(offs_t offset, u8 data); + u8 inh_r(offs_t offset); + void inh_w(offs_t offset, u8 data); + u8 lc_r(offs_t offset); + void lc_w(offs_t offset, u8 data); + u8 lc_aux_r(offs_t offset); + void lc_aux_w(offs_t offset, u8 data); + u8 lc_00_r(offs_t offset); + void lc_00_w(offs_t offset, u8 data); + u8 lc_01_r(offs_t offset); + void lc_01_w(offs_t offset, u8 data); + u8 bank0_c000_r(offs_t offset); + void bank0_c000_w(offs_t offset, u8 data); + u8 bank1_0000_r(offs_t offset); + void bank1_0000_sh_w(offs_t offset, u8 data); + u8 bank1_c000_r(offs_t offset); + void bank1_c000_w(offs_t offset, u8 data); DECLARE_WRITE_LINE_MEMBER(a2bus_irq_w); DECLARE_WRITE_LINE_MEMBER(a2bus_nmi_w); DECLARE_WRITE_LINE_MEMBER(a2bus_inh_w); DECLARE_WRITE_LINE_MEMBER(doc_irq_w); DECLARE_WRITE_LINE_MEMBER(scc_irq_w); - uint8_t doc_adc_read(); - uint8_t apple2gs_read_vector(offs_t offset); + u8 doc_adc_read(); + u8 apple2gs_read_vector(offs_t offset); #if !RUN_ADB_MICRO DECLARE_READ_LINE_MEMBER(ay3600_shift_r); @@ -502,35 +498,31 @@ private: TIMER_DEVICE_CALLBACK_MEMBER(ay3600_repeat); #endif - uint8_t keyglu_mcu_read(uint8_t offset); - void keyglu_mcu_write(uint8_t offset, uint8_t data); - uint8_t keyglu_816_read(uint8_t offset); - void keyglu_816_write(uint8_t offset, uint8_t data); + u8 keyglu_mcu_read(u8 offset); + void keyglu_mcu_write(u8 offset, u8 data); + u8 keyglu_816_read(u8 offset); + void keyglu_816_write(u8 offset, u8 data); void keyglu_regen_irqs(); - uint8_t adbmicro_p0_in(); - uint8_t adbmicro_p1_in(); - uint8_t adbmicro_p2_in(); - uint8_t adbmicro_p3_in(); - void adbmicro_p0_out(uint8_t data); - void adbmicro_p1_out(uint8_t data); - void adbmicro_p2_out(uint8_t data); - void adbmicro_p3_out(uint8_t data); + u8 adbmicro_p0_in(); + u8 adbmicro_p1_in(); + u8 adbmicro_p2_in(); + u8 adbmicro_p3_in(); + void adbmicro_p0_out(u8 data); + void adbmicro_p1_out(u8 data); + void adbmicro_p2_out(u8 data); + void adbmicro_p3_out(u8 data); offs_t dasm_trampoline(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer ¶ms); - void wdm_trampoline(offs_t offset, uint8_t data) { }; //m_a2host->wdm_w(space, offset, data); } + void wdm_trampoline(offs_t offset, u8 data) { }; //m_a2host->wdm_w(space, offset, data); } private: bool m_is_rom3; int m_speaker_state; - double m_joystick_x1_time; - double m_joystick_y1_time; - double m_joystick_x2_time; - double m_joystick_y2_time; + double m_joystick_x1_time, m_joystick_y1_time, m_joystick_x2_time, m_joystick_y2_time; - int m_inh_slot; - int m_cnxx_slot; + int m_inh_slot, m_cnxx_slot; bool m_page2; bool m_an0, m_an1, m_an2, m_an3; @@ -547,24 +539,24 @@ private: bool m_lcram, m_lcram2, m_lcprewrite, m_lcwriteenable; bool m_ioudis; - uint8_t m_shadow, m_speed, m_textcol; - uint8_t m_motors_active, m_slotromsel, m_intflag, m_vgcint, m_inten; + u8 m_shadow, m_speed, m_textcol; + u8 m_motors_active, m_slotromsel, m_intflag, m_vgcint, m_inten; bool m_last_speed; // Sound GLU variables - uint8_t m_sndglu_ctrl; + u8 m_sndglu_ctrl; int m_sndglu_addr; int m_sndglu_dummy_read; // Key GLU variables - uint8_t m_glu_regs[12], m_glu_bus, m_glu_sysstat; + u8 m_glu_regs[12], m_glu_bus, m_glu_sysstat; bool m_glu_mcu_read_kgs, m_glu_816_read_dstat, m_glu_mouse_read_stat; int m_glu_kbd_y; - uint8_t *m_ram_ptr; + u8 *m_ram_ptr; int m_ram_size; - uint8_t m_megaii_ram[0x20000]; // 128K of "slow RAM" at $E0/0000 + u8 m_megaii_ram[0x20000]; // 128K of "slow RAM" at $E0/0000 int m_inh_bank; @@ -574,73 +566,132 @@ private: device_a2bus_card_interface *m_slotdevice[8]; - uint32_t m_slow_counter; + u32 m_slow_counter; // clock/BRAM - uint8_t m_clkdata, m_clock_control, m_clock_read, m_clock_reg1; + u8 m_clkdata, m_clock_control, m_clock_read, m_clock_reg1; apple2gs_clock_mode m_clock_mode; - uint32_t m_clock_curtime; + u32 m_clock_curtime; seconds_t m_clock_curtime_interval; - uint8_t m_clock_bram[256]; + u8 m_clock_bram[256]; int m_clock_frame; // ADB simulation #if !RUN_ADB_MICRO adbstate_t m_adb_state; - uint8_t m_adb_command; - uint8_t m_adb_mode; - uint8_t m_adb_kmstatus; - uint8_t m_adb_latent_result; - int32_t m_adb_command_length; - int32_t m_adb_command_pos; - uint8_t m_adb_response_length; - int32_t m_adb_response_pos; - uint8_t m_adb_command_bytes[8]; - uint8_t m_adb_response_bytes[8]; - uint8_t m_adb_memory[0x100]; + u8 m_adb_command; + u8 m_adb_mode; + u8 m_adb_kmstatus; + u8 m_adb_latent_result; + s32 m_adb_command_length; + s32 m_adb_command_pos; + u8 m_adb_response_length; + s32 m_adb_response_pos; + u8 m_adb_command_bytes[8]; + u8 m_adb_response_bytes[8]; + u8 m_adb_memory[0x100]; int m_adb_address_keyboard; int m_adb_address_mouse; - uint16_t m_lastchar, m_strobe; - uint8_t m_transchar; + u16 m_lastchar, m_strobe; + u8 m_transchar; bool m_anykeydown; int m_repeatdelay; - uint8_t adb_read_datareg(); - uint8_t adb_read_kmstatus(); - uint8_t adb_read_memory(uint32_t address); - void adb_write_memory(uint32_t address, uint8_t data); - void adb_set_mode(uint8_t mode); - void adb_set_config(uint8_t b1, uint8_t b2, uint8_t b3); - void adb_post_response(const uint8_t *bytes, size_t length); - void adb_post_response_1(uint8_t b); - void adb_post_response_2(uint8_t b1, uint8_t b2); + u8 adb_read_datareg(); + u8 adb_read_kmstatus(); + u8 adb_read_memory(u32 address); + void adb_write_memory(u32 address, u8 data); + void adb_set_mode(u8 mode); + void adb_set_config(u8 b1, u8 b2, u8 b3); + void adb_post_response(const u8 *bytes, size_t length); + void adb_post_response_1(u8 b); + void adb_post_response_2(u8 b1, u8 b2); void adb_do_command(); - void adb_write_datareg(uint8_t data); - void adb_write_kmstatus(uint8_t data); - uint8_t adb_read_mousedata(); - int8_t seven_bit_diff(uint8_t v1, uint8_t v2); + void adb_write_datareg(u8 data); + void adb_write_kmstatus(u8 data); + u8 adb_read_mousedata(); + s8 seven_bit_diff(u8 v1, u8 v2); void adb_check_mouse(); #endif - uint8_t m_mouse_x; - uint8_t m_mouse_y; - int8_t m_mouse_dx; - int8_t m_mouse_dy; + u8 m_mouse_x; + u8 m_mouse_y; + s8 m_mouse_dx; + s8 m_mouse_dy; void do_io(int offset); - uint8_t read_floatingbus(); + u8 read_floatingbus(); void update_slotrom_banks(); void lc_update(int offset, bool writing); - uint8_t read_slot_rom(int slotbias, int offset); - void write_slot_rom(int slotbias, int offset, uint8_t data); - uint8_t read_int_rom(int slotbias, int offset); + u8 read_slot_rom(int slotbias, int offset); + void write_slot_rom(int slotbias, int offset, u8 data); + u8 read_int_rom(int slotbias, int offset); void auxbank_update(); void raise_irq(int irq); void lower_irq(int irq); void update_speed(); int get_vpos(); void process_clock(); + + // ZipGS stuff + bool m_accel_unlocked; + bool m_accel_fast; + bool m_accel_present; + bool m_accel_temp_slowdown; + int m_accel_stage; + u32 m_accel_speed; + u8 m_accel_slotspk, m_accel_gsxsettings, m_accel_percent; + + void accel_full_speed() + { + bool isfast = false; + + if (m_speed & SPEED_HIGH) + { + isfast = true; + } + + if ((m_motors_active & (m_speed & 0x0f)) != 0) + { + isfast = false; + } + + if (isfast) + { + m_maincpu->set_unscaled_clock(m_accel_speed); + } + else + { + m_maincpu->set_unscaled_clock(1021800); + } + } + + void accel_normal_speed() + { + bool isfast = false; + + if (m_speed & SPEED_HIGH) + { + isfast = true; + } + + if ((m_motors_active & (m_speed & 0x0f)) != 0) + { + isfast = false; + } + + if (isfast) + { + m_maincpu->set_unscaled_clock(A2GS_14M/5); + } + else + { + m_maincpu->set_unscaled_clock(1021800); + } + } + + void accel_slot(int slot); }; // FF6ACF is speed test routine in ROM 3 @@ -740,7 +791,7 @@ WRITE_LINE_MEMBER(apple2gs_state::a2bus_inh_w) // FPI/CYA chip is connected to the VPB output of the 65816. // this facilitates the documented behavior from the Firmware Reference. -uint8_t apple2gs_state::apple2gs_read_vector(offs_t offset) +u8 apple2gs_state::apple2gs_read_vector(offs_t offset) { // when IOLC shadowing is enabled, vector fetches always go to ROM, // regardless of the language card config. @@ -783,17 +834,26 @@ WRITE_LINE_MEMBER(apple2gs_state::ay3600_data_ready_w) { if (state == ASSERT_LINE) { - uint8_t *decode = m_kbdrom->base(); - uint16_t trans; + u8 *decode = m_kbdrom->base(); + u16 trans; // if the user presses a valid key to start the driver from the info screen, // we will see that key. ignore keys in the first 25,000 cycles (in my tests, // the unwanted key shows up at 17030 cycles) - if (m_maincpu->total_cycles() < 25000) + if (m_sysconfig->read() & 0x01) + { // bump the cycle count way up for a 16 Mhz ZipGS + if (m_maincpu->total_cycles() < 700000) + { + return; + } + } + else { - return; + if (m_maincpu->total_cycles() < 25000) + { + return; + } } - m_lastchar = m_ay3600->b_r(); trans = m_lastchar & ~(0x1c0); // clear the 3600's control/shift stuff @@ -836,7 +896,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2gs_state::ay3600_repeat) } } -uint8_t apple2gs_state::adb_read_memory(uint32_t address) +u8 apple2gs_state::adb_read_memory(u32 address) { if (address < ARRAY_LENGTH(m_adb_memory)) return m_adb_memory[address]; @@ -844,23 +904,23 @@ uint8_t apple2gs_state::adb_read_memory(uint32_t address) return 0x00; } -void apple2gs_state::adb_write_memory(uint32_t address, uint8_t data) +void apple2gs_state::adb_write_memory(u32 address, u8 data) { if (address < ARRAY_LENGTH(m_adb_memory)) m_adb_memory[address] = data; } -void apple2gs_state::adb_set_mode(uint8_t mode) +void apple2gs_state::adb_set_mode(u8 mode) { m_adb_mode = mode; } -void apple2gs_state::adb_set_config(uint8_t b1, uint8_t b2, uint8_t b3) +void apple2gs_state::adb_set_config(u8 b1, u8 b2, u8 b3) { /* ignore for now */ } -void apple2gs_state::adb_post_response(const uint8_t *bytes, size_t length) +void apple2gs_state::adb_post_response(const u8 *bytes, size_t length) { assert(length < ARRAY_LENGTH(m_adb_response_bytes)); memcpy(m_adb_response_bytes, bytes, length); @@ -870,14 +930,14 @@ void apple2gs_state::adb_post_response(const uint8_t *bytes, size_t length) m_adb_response_pos = 0; } -void apple2gs_state::adb_post_response_1(uint8_t b) +void apple2gs_state::adb_post_response_1(u8 b) { adb_post_response(&b, 1); } -void apple2gs_state::adb_post_response_2(uint8_t b1, uint8_t b2) +void apple2gs_state::adb_post_response_2(u8 b1, u8 b2) { - uint8_t b[2]; + u8 b[2]; b[0] = b1; b[1] = b2; adb_post_response(b, 2); @@ -886,8 +946,8 @@ void apple2gs_state::adb_post_response_2(uint8_t b1, uint8_t b2) void apple2gs_state::adb_do_command() { int device; - uint32_t address; - uint8_t val; + u32 address; + u8 val; m_adb_state = ADBSTATE_IDLE; if (LOG_ADB) @@ -975,9 +1035,9 @@ void apple2gs_state::adb_do_command() m_adb_kmstatus |= 0x20; } -uint8_t apple2gs_state::adb_read_datareg() +u8 apple2gs_state::adb_read_datareg() { - uint8_t result; + u8 result; switch(m_adb_state) { @@ -1002,7 +1062,7 @@ uint8_t apple2gs_state::adb_read_datareg() return result; } -void apple2gs_state::adb_write_datareg(uint8_t data) +void apple2gs_state::adb_write_datareg(u8 data) { if (LOG_ADB) logerror("adb_write_datareg(): data=0x%02x\n", data); @@ -1126,13 +1186,13 @@ void apple2gs_state::adb_write_datareg(uint8_t data) // real rom 3 h/w reads 0x90 when idle, 0x98 when key pressed // current MESS reads back 0xb0 when idle -uint8_t apple2gs_state::adb_read_kmstatus() +u8 apple2gs_state::adb_read_kmstatus() { return m_adb_kmstatus; } -void apple2gs_state::adb_write_kmstatus(uint8_t data) +void apple2gs_state::adb_write_kmstatus(u8 data) { m_adb_kmstatus &= ~0x54; m_adb_kmstatus |= data & 0x54; @@ -1140,11 +1200,11 @@ void apple2gs_state::adb_write_kmstatus(uint8_t data) -uint8_t apple2gs_state::adb_read_mousedata() +u8 apple2gs_state::adb_read_mousedata() { - uint8_t result = 0x00; - uint8_t absolute; - int8_t delta; + u8 result = 0x00; + u8 absolute; + s8 delta; if (m_adb_kmstatus & 0x80) // mouse register full { @@ -1173,7 +1233,7 @@ uint8_t apple2gs_state::adb_read_mousedata() } -int8_t apple2gs_state::seven_bit_diff(uint8_t v1, uint8_t v2) +s8 apple2gs_state::seven_bit_diff(u8 v1, u8 v2) { v1 -= v2; if (v1 & 0x40) @@ -1187,7 +1247,7 @@ int8_t apple2gs_state::seven_bit_diff(uint8_t v1, uint8_t v2) void apple2gs_state::adb_check_mouse() { - uint8_t new_mouse_x, new_mouse_y; + u8 new_mouse_x, new_mouse_y; /* read mouse values */ if ((m_adb_kmstatus & 0x80) == 0x00) @@ -1268,6 +1328,10 @@ void apple2gs_state::machine_start() m_video->m_char_size = memregion("gfx1")->bytes(); m_video->m_8bit_graphics = std::make_unique<bitmap_ind16>(560, 192); + m_textcol = 0xf2; + m_video->m_GSfg = (m_textcol >> 4) & 0xf; + m_video->m_GSbg = m_textcol & 0xf; + m_inh_slot = -1; m_cnxx_slot = CNXX_UNCLAIMED; @@ -1364,6 +1428,15 @@ void apple2gs_state::machine_start() save_item(m_mouse_y, "MY"); save_item(m_mouse_dx, "MDX"); save_item(m_mouse_dy, "MDY"); + save_item(NAME(m_accel_unlocked)); + save_item(NAME(m_accel_stage)); + save_item(NAME(m_accel_fast)); + save_item(NAME(m_accel_present)); + save_item(NAME(m_accel_slotspk)); + save_item(NAME(m_accel_gsxsettings)); + save_item(NAME(m_accel_percent)); + save_item(NAME(m_accel_temp_slowdown)); + save_item(NAME(m_accel_speed)); } void apple2gs_state::machine_reset() @@ -1484,6 +1557,27 @@ void apple2gs_state::machine_reset() // with all the banking reset, now reset the CPU m_maincpu->reset(); + + // Setup ZipGS + m_accel_unlocked = false; + m_accel_stage = 0; + m_accel_slotspk = 0x41; // speaker and slot 6 slow + m_accel_gsxsettings = 0; + m_accel_percent = 0; // 100% speed + m_accel_present = false; + m_accel_temp_slowdown = false; + m_accel_fast = false; + + // is Zip enabled? + if (m_sysconfig->read() & 0x01) + { + static const int speeds[4] = { 7000000, 8000000, 12000000, 16000000 }; + m_accel_present = true; + int idxSpeed = (m_sysconfig->read() >> 1); + m_accel_speed = speeds[idxSpeed]; + m_accel_fast = true; + accel_full_speed(); + } } void apple2gs_state::raise_irq(int irq) @@ -1540,11 +1634,38 @@ void apple2gs_state::update_speed() // prevent unnecessary reschedules by only setting this if it changed if (isfast != m_last_speed) { - m_maincpu->set_unscaled_clock(isfast ? A2GS_14M/5 : A2GS_1M); + if ((m_accel_present) && (isfast)) + { + accel_full_speed(); + } + else + { + m_maincpu->set_unscaled_clock(isfast ? A2GS_14M / 5 : A2GS_1M); + } m_last_speed = isfast; } } +void apple2gs_state::accel_slot(int slot) +{ + if ((m_accel_present) && (m_accel_slotspk & (1 << slot))) + { + m_accel_temp_slowdown = true; + m_acceltimer->adjust(attotime::from_msec(52)); + accel_normal_speed(); + } +} + +TIMER_DEVICE_CALLBACK_MEMBER(apple2gs_state::accel_timer) +{ + if (m_accel_fast) + { + accel_full_speed(); + } + m_accel_temp_slowdown = false; + m_acceltimer->adjust(attotime::never); +} + /*************************************************************************** VIDEO ***************************************************************************/ @@ -1564,7 +1685,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2gs_state::apple2_interrupt) /* check scanline interrupt bits if we're in super hi-res and the current scanline is within the active display area */ if ((m_video->m_newvideo & 0x80) && (scanline >= (BORDER_TOP-1)) && (scanline < (200+BORDER_TOP-1))) { - uint8_t scb; + u8 scb; scb = m_megaii_ram[0x19d00 + scanline - BORDER_TOP + 1]; @@ -1667,7 +1788,7 @@ void apple2gs_state::palette_init(palette_device &palette) } } -uint32_t apple2gs_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +u32 apple2gs_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return m_video->screen_update_GS(screen, bitmap, cliprect); } @@ -1870,6 +1991,13 @@ void apple2gs_state::do_io(int offset) { m_speaker->level_w(0); } + + if ((m_accel_present) && (m_accel_slotspk & 1)) + { + m_accel_temp_slowdown = true; + m_acceltimer->adjust(attotime::from_msec(5)); + accel_normal_speed(); + } break; case 0x50: // graphics mode @@ -1956,6 +2084,14 @@ void apple2gs_state::do_io(int offset) // trigger joypad read case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: + // Zip paddle slowdown (does ZipGS also use the old Zip flag?) + if ((m_accel_present) && !BIT(m_accel_gsxsettings, 6)) + { + m_accel_temp_slowdown = true; + m_acceltimer->adjust(attotime::from_msec(5)); + accel_normal_speed(); + } + m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r(); m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r(); m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r(); @@ -1974,7 +2110,7 @@ void apple2gs_state::do_io(int offset) int apple2gs_state::get_vpos() { int result, scan; - static const uint8_t top_border_vert[BORDER_TOP] = + static const u8 top_border_vert[BORDER_TOP] = { 0xfa, 0xfa, 0xfa, 0xfa, 0xfb, 0xfb, 0xfb, 0xfb, 0xfc, 0xfc, 0xfc, 0xfd, 0xfd, 0xfe, 0xfe, 0xff, @@ -1997,7 +2133,7 @@ int apple2gs_state::get_vpos() void apple2gs_state::process_clock() { - uint8_t operation; + u8 operation; switch(m_clock_mode) { @@ -2089,9 +2225,9 @@ void apple2gs_state::process_clock() } } -uint8_t apple2gs_state::c000_r(offs_t offset) +u8 apple2gs_state::c000_r(offs_t offset) { - uint8_t ret; + u8 ret; // allow ROM window at C07x to be debugger-visible if ((offset < 0x70) || (offset > 0x7f)) @@ -2209,7 +2345,7 @@ uint8_t apple2gs_state::c000_r(offs_t offset) case 0x25: // KEYMODREG ret = 0; { - uint8_t temp = m_kbspecial->read(); + u8 temp = m_kbspecial->read(); if (temp & 1) // capslock { ret |= 4; @@ -2407,13 +2543,42 @@ uint8_t apple2gs_state::c000_r(offs_t offset) default: do_io(offset); + + if (m_accel_unlocked) + { + if (offset == 0x59) + { + return m_accel_gsxsettings; + } + else if (offset == 0x5a) + { + return m_accel_percent | 0x0f; + } + else if (offset == 0x5b) + { + // bit 7 is a 1.0035 millisecond clock; the value changes every 0.50175 milliseconds + const int time = machine().time().as_ticks(1.0f / 0.00050175f); + if (time & 1) + { + return 0x03; + } + else + { + return 0x83; + } + } + else if (offset == 0x5c) + { + return m_accel_slotspk; + } + } break; } return read_floatingbus(); } -void apple2gs_state::c000_w(offs_t offset, uint8_t data) +void apple2gs_state::c000_w(offs_t offset, u8 data) { if(machine().side_effects_disabled()) return; @@ -2705,7 +2870,66 @@ void apple2gs_state::c000_w(offs_t offset, uint8_t data) lower_irq(IRQS_QTRSEC); break; - case 0x68: // STATEREG + case 0x59: // Zip GS-specific settings + if (m_accel_unlocked) + { + m_accel_gsxsettings = data & 0xf8; + m_accel_gsxsettings |= 0x01; // indicate this is a GS + } + break; + + case 0x5a: // Zip accelerator unlock + if (m_sysconfig->read() & 0x01) + { + if (data == 0x5a) + { + m_accel_stage++; + if (m_accel_stage == 4) + { + m_accel_unlocked = true; + } + } + else if (data == 0xa5) + { + // lock + m_accel_unlocked = false; + m_accel_stage = 0; + } + else if (m_accel_unlocked) + { + // disable acceleration + accel_normal_speed(); + m_accel_unlocked = false; + m_accel_stage = 0; + } + } + do_io(offset); + break; + + case 0x5b: // Zip full speed + if (m_accel_unlocked) + { + accel_full_speed(); + } + do_io(offset); + break; + + case 0x5c: // Zip slot/speaker flags + if (m_accel_unlocked) + { + m_accel_slotspk = data; + } + do_io(offset); + break; + + case 0x5d: // Zip speed percentage + if (m_accel_unlocked) + { + m_accel_percent = data; + } + break; + + case 0x68: // STATEREG m_altzp = (data & 0x80); m_page2 = (data & 0x40); m_ramrd = (data & 0x20); @@ -2734,24 +2958,38 @@ void apple2gs_state::c000_w(offs_t offset, uint8_t data) } break; - case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: - case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: - do_io(offset); // make sure it also side-effect resets the paddles as documented + case 0x70: + case 0x71: + case 0x72: + case 0x73: + case 0x74: + case 0x75: + case 0x76: + case 0x77: + case 0x78: + case 0x79: + case 0x7a: + case 0x7b: + case 0x7c: + case 0x7d: + do_io(offset); // make sure it also side-effect resets the paddles as documented break; - case 0x7e: // SETIOUDIS - m_ioudis = true; break; + case 0x7e: // SETIOUDIS + m_ioudis = true; + break; - case 0x7f: // CLRIOUDIS - m_ioudis = false; break; + case 0x7f: // CLRIOUDIS + m_ioudis = false; + break; default: do_io(offset); break; - } + } } -uint8_t apple2gs_state::c080_r(offs_t offset) +u8 apple2gs_state::c080_r(offs_t offset) { if (!machine().side_effects_disabled()) { @@ -2768,6 +3006,11 @@ uint8_t apple2gs_state::c080_r(offs_t offset) } else { + if (m_accel_present) + { + accel_slot(slot); + } + if (slot >= 4) { if ((offset & 0xf) == 0x9) @@ -2803,7 +3046,7 @@ uint8_t apple2gs_state::c080_r(offs_t offset) return read_floatingbus(); } -void apple2gs_state::c080_w(offs_t offset, uint8_t data) +void apple2gs_state::c080_w(offs_t offset, u8 data) { int slot; @@ -2850,7 +3093,7 @@ void apple2gs_state::c080_w(offs_t offset, uint8_t data) } } -uint8_t apple2gs_state::read_slot_rom(int slotbias, int offset) +u8 apple2gs_state::read_slot_rom(int slotbias, int offset) { int slotnum = ((offset>>8) & 0xf) + slotbias; @@ -2871,7 +3114,7 @@ uint8_t apple2gs_state::read_slot_rom(int slotbias, int offset) return read_floatingbus(); } -void apple2gs_state::write_slot_rom(int slotbias, int offset, uint8_t data) +void apple2gs_state::write_slot_rom(int slotbias, int offset, u8 data) { int slotnum = ((offset>>8) & 0xf) + slotbias; @@ -2889,7 +3132,7 @@ void apple2gs_state::write_slot_rom(int slotbias, int offset, uint8_t data) } } -uint8_t apple2gs_state::read_int_rom(int slotbias, int offset) +u8 apple2gs_state::read_int_rom(int slotbias, int offset) { if ((m_cnxx_slot == CNXX_UNCLAIMED) && (!machine().side_effects_disabled())) { @@ -2900,12 +3143,14 @@ uint8_t apple2gs_state::read_int_rom(int slotbias, int offset) return m_rom[slotbias + offset]; } -uint8_t apple2gs_state::c100_r(offs_t offset) +u8 apple2gs_state::c100_r(offs_t offset) { int slot = ((offset>>8) & 0xf) + 1; slow_cycle(); + accel_slot(slot); + // SETSLOTCXROM is disabled, so the $C02D SLOT register controls what's in each slot if (!(m_slotromsel & (1 << slot))) { @@ -2915,10 +3160,12 @@ uint8_t apple2gs_state::c100_r(offs_t offset) return read_slot_rom(1, offset); } -void apple2gs_state::c100_w(offs_t offset, uint8_t data) +void apple2gs_state::c100_w(offs_t offset, u8 data) { int slot = ((offset>>8) & 0xf) + 1; + accel_slot(slot); + slow_cycle(); if ((m_slotromsel & (1 << slot))) @@ -2927,16 +3174,18 @@ void apple2gs_state::c100_w(offs_t offset, uint8_t data) } } -uint8_t apple2gs_state::c100_int_r(offs_t offset) { slow_cycle(); return read_int_rom(0x3c100, offset); } -uint8_t apple2gs_state::c300_int_r(offs_t offset) { slow_cycle(); return read_int_rom(0x3c300, offset); } -uint8_t apple2gs_state::c400_int_r(offs_t offset) { slow_cycle(); return read_int_rom(0x3c400, offset); } -uint8_t apple2gs_state::c300_r(offs_t offset) { slow_cycle(); return read_slot_rom(3, offset); } -void apple2gs_state::c300_w(offs_t offset, uint8_t data) { slow_cycle(); write_slot_rom(3, offset, data); } +u8 apple2gs_state::c100_int_r(offs_t offset) { accel_slot(1 + ((offset >> 8) & 0x7)); slow_cycle(); return read_int_rom(0x3c100, offset); } +u8 apple2gs_state::c300_int_r(offs_t offset) { accel_slot(3 + ((offset >> 8) & 0x7)); slow_cycle(); return read_int_rom(0x3c300, offset); } +u8 apple2gs_state::c400_int_r(offs_t offset) { accel_slot(4 + ((offset >> 8) & 0x7)); slow_cycle(); return read_int_rom(0x3c400, offset); } +u8 apple2gs_state::c300_r(offs_t offset) { accel_slot(3 + ((offset >> 8) & 0x7)); slow_cycle(); return read_slot_rom(3, offset); } +void apple2gs_state::c300_w(offs_t offset, u8 data) { accel_slot(3 + ((offset >> 8) & 0x7)); slow_cycle(); write_slot_rom(3, offset, data); } -uint8_t apple2gs_state::c400_r(offs_t offset) +u8 apple2gs_state::c400_r(offs_t offset) { int slot = ((offset>>8) & 0xf) + 4; + accel_slot(slot); + slow_cycle(); if (!(m_slotromsel & (1 << slot))) @@ -2947,10 +3196,12 @@ uint8_t apple2gs_state::c400_r(offs_t offset) return read_slot_rom(4, offset); } -void apple2gs_state::c400_w(offs_t offset, uint8_t data) +void apple2gs_state::c400_w(offs_t offset, u8 data) { int slot = ((offset>>8) & 0xf) + 1; + accel_slot(slot); + slow_cycle(); if ((m_slotromsel & (1 << slot))) @@ -2959,13 +3210,13 @@ void apple2gs_state::c400_w(offs_t offset, uint8_t data) } } -uint8_t apple2gs_state::c800_r(offs_t offset) +u8 apple2gs_state::c800_r(offs_t offset) { slow_cycle(); if ((offset == 0x7ff) && !machine().side_effects_disabled()) { - uint8_t rv = 0xff; + u8 rv = 0xff; if ((m_cnxx_slot > 0) && (m_slotdevice[m_cnxx_slot] != nullptr)) { rv = m_slotdevice[m_cnxx_slot]->read_c800(offset&0xfff); @@ -2984,7 +3235,7 @@ uint8_t apple2gs_state::c800_r(offs_t offset) return read_floatingbus(); } -uint8_t apple2gs_state::c800_int_r(offs_t offset) +u8 apple2gs_state::c800_int_r(offs_t offset) { slow_cycle(); @@ -3003,7 +3254,7 @@ uint8_t apple2gs_state::c800_int_r(offs_t offset) return read_floatingbus(); } -void apple2gs_state::c800_w(offs_t offset, uint8_t data) +void apple2gs_state::c800_w(offs_t offset, u8 data) { slow_cycle(); @@ -3020,7 +3271,7 @@ void apple2gs_state::c800_w(offs_t offset, uint8_t data) } } -uint8_t apple2gs_state::inh_r(offs_t offset) +u8 apple2gs_state::inh_r(offs_t offset) { if (m_inh_slot != -1) { @@ -3031,7 +3282,7 @@ uint8_t apple2gs_state::inh_r(offs_t offset) return read_floatingbus(); } -void apple2gs_state::inh_w(offs_t offset, uint8_t data) +void apple2gs_state::inh_w(offs_t offset, u8 data) { if (m_inh_slot != -1) { @@ -3039,7 +3290,7 @@ void apple2gs_state::inh_w(offs_t offset, uint8_t data) } } -uint8_t apple2gs_state::lc_r(offs_t offset) +u8 apple2gs_state::lc_r(offs_t offset) { slow_cycle(); if (offset < 0x1000) @@ -3057,7 +3308,7 @@ uint8_t apple2gs_state::lc_r(offs_t offset) return m_megaii_ram[(offset & 0x1fff) + 0xe000]; } -void apple2gs_state::lc_w(offs_t offset, uint8_t data) +void apple2gs_state::lc_w(offs_t offset, u8 data) { slow_cycle(); if (!m_lcwriteenable) @@ -3081,7 +3332,7 @@ void apple2gs_state::lc_w(offs_t offset, uint8_t data) m_megaii_ram[(offset & 0x1fff) + 0xe000] = data; } -uint8_t apple2gs_state::lc_aux_r(offs_t offset) +u8 apple2gs_state::lc_aux_r(offs_t offset) { slow_cycle(); if (offset < 0x1000) @@ -3099,7 +3350,7 @@ uint8_t apple2gs_state::lc_aux_r(offs_t offset) return m_megaii_ram[(offset & 0x1fff) + 0x1e000]; } -void apple2gs_state::lc_aux_w(offs_t offset, uint8_t data) +void apple2gs_state::lc_aux_w(offs_t offset, u8 data) { slow_cycle(); if (!m_lcwriteenable) @@ -3123,7 +3374,7 @@ void apple2gs_state::lc_aux_w(offs_t offset, uint8_t data) m_megaii_ram[(offset & 0x1fff) + 0x1e000] = data; } -uint8_t apple2gs_state::lc_00_r(offs_t offset) +u8 apple2gs_state::lc_00_r(offs_t offset) { if (m_altzp) { @@ -3159,7 +3410,7 @@ uint8_t apple2gs_state::lc_00_r(offs_t offset) } } -void apple2gs_state::lc_00_w(offs_t offset, uint8_t data) +void apple2gs_state::lc_00_w(offs_t offset, u8 data) { if (!m_lcwriteenable) { @@ -3202,7 +3453,7 @@ void apple2gs_state::lc_00_w(offs_t offset, uint8_t data) } } -uint8_t apple2gs_state::lc_01_r(offs_t offset) +u8 apple2gs_state::lc_01_r(offs_t offset) { if (offset < 0x1000) { @@ -3219,7 +3470,7 @@ uint8_t apple2gs_state::lc_01_r(offs_t offset) return m_ram_ptr[(offset & 0x1fff) + 0x1e000]; } -void apple2gs_state::lc_01_w(offs_t offset, uint8_t data) +void apple2gs_state::lc_01_w(offs_t offset, u8 data) { if (!m_lcwriteenable) { @@ -3243,7 +3494,7 @@ void apple2gs_state::lc_01_w(offs_t offset, uint8_t data) } // floating bus code from old machine/apple2: needs to be reworked based on real beam position to enable e.g. Bob Bishop's screen splitter -uint8_t apple2gs_state::read_floatingbus() +u8 apple2gs_state::read_floatingbus() { enum { @@ -3376,10 +3627,10 @@ uint8_t apple2gs_state::read_floatingbus() ADDRESS MAP ***************************************************************************/ -uint8_t apple2gs_state::ram0000_r(offs_t offset) { slow_cycle(); return m_megaii_ram[offset]; } -void apple2gs_state::ram0000_w(offs_t offset, uint8_t data) { slow_cycle(); m_megaii_ram[offset] = data; } -uint8_t apple2gs_state::auxram0000_r(offs_t offset) { slow_cycle(); return m_megaii_ram[offset+0x10000]; } -void apple2gs_state::auxram0000_w(offs_t offset, uint8_t data) +u8 apple2gs_state::ram0000_r(offs_t offset) { slow_cycle(); return m_megaii_ram[offset]; } +void apple2gs_state::ram0000_w(offs_t offset, u8 data) { slow_cycle(); m_megaii_ram[offset] = data; } +u8 apple2gs_state::auxram0000_r(offs_t offset) { slow_cycle(); return m_megaii_ram[offset+0x10000]; } +void apple2gs_state::auxram0000_w(offs_t offset, u8 data) { slow_cycle(); m_megaii_ram[offset+0x10000] = data; @@ -3395,12 +3646,12 @@ void apple2gs_state::auxram0000_w(offs_t offset, uint8_t data) } } -uint8_t apple2gs_state::b0ram0000_r(offs_t offset) { return m_ram_ptr[offset]; } -void apple2gs_state::b0ram0000_w(offs_t offset, uint8_t data) { m_ram_ptr[offset] = data; } -uint8_t apple2gs_state::b0ram0200_r(offs_t offset) { return m_ram_ptr[offset+0x200]; } -void apple2gs_state::b0ram0200_w(offs_t offset, uint8_t data) { m_ram_ptr[offset+0x200] = data; } -uint8_t apple2gs_state::b0ram0400_r(offs_t offset) { return m_ram_ptr[offset+0x400]; } -void apple2gs_state::b0ram0400_w(offs_t offset, uint8_t data) +u8 apple2gs_state::b0ram0000_r(offs_t offset) { return m_ram_ptr[offset]; } +void apple2gs_state::b0ram0000_w(offs_t offset, u8 data) { m_ram_ptr[offset] = data; } +u8 apple2gs_state::b0ram0200_r(offs_t offset) { return m_ram_ptr[offset+0x200]; } +void apple2gs_state::b0ram0200_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x200] = data; } +u8 apple2gs_state::b0ram0400_r(offs_t offset) { return m_ram_ptr[offset+0x400]; } +void apple2gs_state::b0ram0400_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x400] = data; if (!(m_shadow & SHAD_TXTPG1)) @@ -3409,8 +3660,8 @@ void apple2gs_state::b0ram0400_w(offs_t offset, uint8_t data) m_megaii_ram[offset+0x0400] = data; } } -uint8_t apple2gs_state::b0ram0800_r(offs_t offset) { return m_ram_ptr[offset+0x800]; } -void apple2gs_state::b0ram0800_w(offs_t offset, uint8_t data) +u8 apple2gs_state::b0ram0800_r(offs_t offset) { return m_ram_ptr[offset+0x800]; } +void apple2gs_state::b0ram0800_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x800] = data; @@ -3423,8 +3674,8 @@ void apple2gs_state::b0ram0800_w(offs_t offset, uint8_t data) } } } -uint8_t apple2gs_state::b0ram2000_r(offs_t offset) { return m_ram_ptr[offset+0x2000]; } -void apple2gs_state::b0ram2000_w(offs_t offset, uint8_t data) +u8 apple2gs_state::b0ram2000_r(offs_t offset) { return m_ram_ptr[offset+0x2000]; } +void apple2gs_state::b0ram2000_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x2000] = data; if (!(m_shadow & SHAD_HIRESPG1)) @@ -3433,8 +3684,8 @@ void apple2gs_state::b0ram2000_w(offs_t offset, uint8_t data) m_megaii_ram[offset+0x2000] = data; } } -uint8_t apple2gs_state::b0ram4000_r(offs_t offset) { return m_ram_ptr[offset+0x4000]; } -void apple2gs_state::b0ram4000_w(offs_t offset, uint8_t data) +u8 apple2gs_state::b0ram4000_r(offs_t offset) { return m_ram_ptr[offset+0x4000]; } +void apple2gs_state::b0ram4000_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x4000] = data; if (offset < 0x2000) @@ -3447,12 +3698,12 @@ void apple2gs_state::b0ram4000_w(offs_t offset, uint8_t data) } } -uint8_t apple2gs_state::b1ram0000_r(offs_t offset) { return m_ram_ptr[offset+0x10000]; } -void apple2gs_state::b1ram0000_w(offs_t offset, uint8_t data) { m_ram_ptr[offset+0x10000] = data; } -uint8_t apple2gs_state::b1ram0200_r(offs_t offset) { return m_ram_ptr[offset+0x10200]; } -void apple2gs_state::b1ram0200_w(offs_t offset, uint8_t data) { m_ram_ptr[offset+0x10200] = data; } -uint8_t apple2gs_state::b1ram0400_r(offs_t offset) { return m_ram_ptr[offset+0x10400]; } -void apple2gs_state::b1ram0400_w(offs_t offset, uint8_t data) +u8 apple2gs_state::b1ram0000_r(offs_t offset) { return m_ram_ptr[offset+0x10000]; } +void apple2gs_state::b1ram0000_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x10000] = data; } +u8 apple2gs_state::b1ram0200_r(offs_t offset) { return m_ram_ptr[offset+0x10200]; } +void apple2gs_state::b1ram0200_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x10200] = data; } +u8 apple2gs_state::b1ram0400_r(offs_t offset) { return m_ram_ptr[offset+0x10400]; } +void apple2gs_state::b1ram0400_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x10400] = data; if (!(m_shadow & SHAD_TXTPG1)) @@ -3461,8 +3712,8 @@ void apple2gs_state::b1ram0400_w(offs_t offset, uint8_t data) m_megaii_ram[offset+0x10400] = data; } } -uint8_t apple2gs_state::b1ram0800_r(offs_t offset) { return m_ram_ptr[offset+0x10800]; } -void apple2gs_state::b1ram0800_w(offs_t offset, uint8_t data) +u8 apple2gs_state::b1ram0800_r(offs_t offset) { return m_ram_ptr[offset+0x10800]; } +void apple2gs_state::b1ram0800_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x10800] = data; if (offset < 0x400) @@ -3471,8 +3722,8 @@ void apple2gs_state::b1ram0800_w(offs_t offset, uint8_t data) m_megaii_ram[offset+0x10800] = data; } } -uint8_t apple2gs_state::b1ram2000_r(offs_t offset) { return m_ram_ptr[offset+0x12000]; } -void apple2gs_state::b1ram2000_w(offs_t offset, uint8_t data) +u8 apple2gs_state::b1ram2000_r(offs_t offset) { return m_ram_ptr[offset+0x12000]; } +void apple2gs_state::b1ram2000_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x12000] = data; if ((!(m_shadow & SHAD_HIRESPG1) && !(m_shadow & SHAD_AUXHIRES)) || (!(m_shadow & SHAD_SUPERHIRES))) @@ -3480,8 +3731,8 @@ void apple2gs_state::b1ram2000_w(offs_t offset, uint8_t data) auxram0000_w(offset+0x2000, data); } } -uint8_t apple2gs_state::b1ram4000_r(offs_t offset) { return m_ram_ptr[offset+0x14000]; } -void apple2gs_state::b1ram4000_w(offs_t offset, uint8_t data) +u8 apple2gs_state::b1ram4000_r(offs_t offset) { return m_ram_ptr[offset+0x14000]; } +void apple2gs_state::b1ram4000_w(offs_t offset, u8 data) { m_ram_ptr[offset+0x14000] = data; if (offset < 0x2000) @@ -3500,7 +3751,7 @@ void apple2gs_state::b1ram4000_w(offs_t offset, uint8_t data) } } -uint8_t apple2gs_state::bank0_c000_r(offs_t offset) +u8 apple2gs_state::bank0_c000_r(offs_t offset) { if (offset & 0x2000) { @@ -3515,7 +3766,7 @@ uint8_t apple2gs_state::bank0_c000_r(offs_t offset) return m_ram_ptr[offset + 0xc000]; } -void apple2gs_state::bank0_c000_w(offs_t offset, uint8_t data) +void apple2gs_state::bank0_c000_w(offs_t offset, u8 data) { if (offset & 0x2000) { @@ -3531,10 +3782,10 @@ void apple2gs_state::bank0_c000_w(offs_t offset, uint8_t data) m_ram_ptr[offset + 0xc000] = data; } -uint8_t apple2gs_state::bank1_0000_r(offs_t offset) { return m_ram_ptr[offset + 0x10000]; } -uint8_t apple2gs_state::bank1_c000_r(offs_t offset) { if (offset & 0x2000) offset ^= 0x1000; return m_ram_ptr[offset + 0x1c000]; } -void apple2gs_state::bank1_c000_w(offs_t offset, uint8_t data) { if (offset & 0x2000) offset ^= 0x1000; m_ram_ptr[offset + 0x1c000] = data; } -void apple2gs_state::bank1_0000_sh_w(offs_t offset, uint8_t data) +u8 apple2gs_state::bank1_0000_r(offs_t offset) { return m_ram_ptr[offset + 0x10000]; } +u8 apple2gs_state::bank1_c000_r(offs_t offset) { if (offset & 0x2000) offset ^= 0x1000; return m_ram_ptr[offset + 0x1c000]; } +void apple2gs_state::bank1_c000_w(offs_t offset, u8 data) { if (offset & 0x2000) offset ^= 0x1000; m_ram_ptr[offset + 0x1c000] = data; } +void apple2gs_state::bank1_0000_sh_w(offs_t offset, u8 data) { m_ram_ptr[offset + 0x10000] = data; @@ -3794,44 +4045,22 @@ void apple2gs_state::a2gs_es5503_map(address_map &map) http://www.llx.com/~nparker/a2/adb.html ***************************************************************************/ -uint8_t apple2gs_state::adbmicro_p0_in() +u8 apple2gs_state::adbmicro_p0_in() { return m_glu_bus; } -uint8_t apple2gs_state::adbmicro_p1_in() +u8 apple2gs_state::adbmicro_p1_in() { #if RUN_ADB_MICRO - switch (m_glu_kbd_y) - { - case 0: - return m_ky0->read(); - case 1: - return m_ky1->read(); - case 2: - return m_ky2->read(); - case 3: - return m_ky3->read(); - case 4: - return m_ky4->read(); - case 5: - return m_ky5->read(); - case 6: - return m_ky6->read(); - case 7: - return m_ky7->read(); - case 8: - return m_ky8->read(); - case 9: - return m_ky9->read(); - } + return m_kbd[m_glu_kbd_y]->read(); #endif return 0xff; } -uint8_t apple2gs_state::adbmicro_p2_in() +u8 apple2gs_state::adbmicro_p2_in() { - uint8_t rv = 0; + u8 rv = 0; rv |= 0x40; // no reset rv |= (m_adb_line) ? 0x00 : 0x80; @@ -3839,11 +4068,11 @@ uint8_t apple2gs_state::adbmicro_p2_in() return rv; } -uint8_t apple2gs_state::adbmicro_p3_in() +u8 apple2gs_state::adbmicro_p3_in() { - uint8_t rv = 0; + u8 rv = 0; #if RUN_ADB_MICRO - uint8_t special = m_kbspecial->read(); + u8 special = m_kbspecial->read(); rv |= (special & 0x06) ? 0x00 : 0x01; rv |= (special & 0x08) ? 0x00 : 0x02; @@ -3856,16 +4085,16 @@ uint8_t apple2gs_state::adbmicro_p3_in() return rv; } -void apple2gs_state::adbmicro_p0_out(uint8_t data) +void apple2gs_state::adbmicro_p0_out(u8 data) { m_glu_bus = data; } -void apple2gs_state::adbmicro_p1_out(uint8_t data) +void apple2gs_state::adbmicro_p1_out(u8 data) { } -void apple2gs_state::adbmicro_p2_out(uint8_t data) +void apple2gs_state::adbmicro_p2_out(u8 data) { if (!(data & 0x10)) { @@ -3884,7 +4113,7 @@ void apple2gs_state::adbmicro_p2_out(uint8_t data) } } -void apple2gs_state::adbmicro_p3_out(uint8_t data) +void apple2gs_state::adbmicro_p3_out(u8 data) { if (((data & 0x08) == 0x08) != m_adb_line) { @@ -3895,9 +4124,9 @@ void apple2gs_state::adbmicro_p3_out(uint8_t data) } } -uint8_t apple2gs_state::keyglu_mcu_read(uint8_t offset) +u8 apple2gs_state::keyglu_mcu_read(u8 offset) { - uint8_t rv = m_glu_regs[offset]; + u8 rv = m_glu_regs[offset]; // printf("MCU reads reg %x\n", offset); @@ -3919,7 +4148,7 @@ uint8_t apple2gs_state::keyglu_mcu_read(uint8_t offset) return rv; } -void apple2gs_state::keyglu_mcu_write(uint8_t offset, uint8_t data) +void apple2gs_state::keyglu_mcu_write(u8 offset, u8 data) { m_glu_regs[offset] = data; @@ -3981,13 +4210,13 @@ void apple2gs_state::keyglu_mcu_write(uint8_t offset, uint8_t data) C027 KMSTATUS = GLU system status register */ -uint8_t apple2gs_state::keyglu_816_read(uint8_t offset) +u8 apple2gs_state::keyglu_816_read(u8 offset) { switch (offset) { case GLU_C000: { - uint8_t rv; + u8 rv; rv = m_glu_regs[GLU_KEY_DATA] & 0x7f; if (m_glu_regs[GLU_KG_STATUS] & KGS_KEYSTROBE) { @@ -3999,7 +4228,7 @@ uint8_t apple2gs_state::keyglu_816_read(uint8_t offset) case GLU_C010: { - uint8_t rv; + u8 rv; rv = m_glu_regs[GLU_KEY_DATA] & 0x7f; if (m_glu_regs[GLU_KG_STATUS] & KGS_KEYSTROBE) { @@ -4064,7 +4293,7 @@ uint8_t apple2gs_state::keyglu_816_read(uint8_t offset) return 0xff; } -void apple2gs_state::keyglu_816_write(uint8_t offset, uint8_t data) +void apple2gs_state::keyglu_816_write(u8 offset, u8 data) { if (offset < GLU_C000) { @@ -4118,7 +4347,7 @@ WRITE_LINE_MEMBER(apple2gs_state::doc_irq_w) } } -uint8_t apple2gs_state::doc_adc_read() +u8 apple2gs_state::doc_adc_read() { return 0x80; } @@ -4135,7 +4364,7 @@ int apple2gs_state::apple2_fdc_has_525() return 1; //apple525_get_count(machine) > 0; } -static void apple2_fdc_set_lines(device_t *device, uint8_t lines) +static void apple2_fdc_set_lines(device_t *device, u8 lines) { apple2gs_state *state = device->machine().driver_data<apple2gs_state>(); if (state->m_diskreg & 0x40) @@ -4180,10 +4409,10 @@ static void apple2_fdc_set_enable_lines(device_t *device,int enable_mask) } } -static uint8_t apple2_fdc_read_data(device_t *device) +static u8 apple2_fdc_read_data(device_t *device) { apple2gs_state *state = device->machine().driver_data<apple2gs_state>(); - uint8_t result = 0x00; + u8 result = 0x00; if (state->m_diskreg & 0x40) { @@ -4204,7 +4433,7 @@ static uint8_t apple2_fdc_read_data(device_t *device) return result; } -static void apple2_fdc_write_data(device_t *device, uint8_t data) +static void apple2_fdc_write_data(device_t *device, u8 data) { apple2gs_state *state = device->machine().driver_data<apple2gs_state>(); if (state->m_diskreg & 0x40) @@ -4249,7 +4478,7 @@ static int apple2_fdc_read_status(device_t *device) return result; } -void apple2gs_state::apple2_iwm_setdiskreg(uint8_t data) +void apple2gs_state::apple2_iwm_setdiskreg(u8 data) { if (apple2_fdc_has_35()) { @@ -4537,6 +4766,14 @@ INPUT_PORTS_START( apple2gs ) PORT_START("adb_mouse_y") PORT_BIT( 0x7f, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 0") + + PORT_START("a2_config") + PORT_CONFNAME(0x07, 0x00, "CPU type") + PORT_CONFSETTING(0x00, "Standard") + PORT_CONFSETTING(0x01, "7 MHz ZipGS") + PORT_CONFSETTING(0x03, "8 MHz ZipGS") + PORT_CONFSETTING(0x05, "12 MHz ZipGS") + PORT_CONFSETTING(0x07, "16 MHz ZipGS") INPUT_PORTS_END static void apple2_cards(device_slot_interface &device) @@ -4572,8 +4809,8 @@ static void apple2_cards(device_slot_interface &device) device.option_add("ultraterm", A2BUS_ULTRATERM); /* Videx UltraTerm (original) */ device.option_add("ultratermenh", A2BUS_ULTRATERMENH); /* Videx UltraTerm (enhanced //e) */ device.option_add("aevm80", A2BUS_AEVIEWMASTER80); /* Applied Engineering ViewMaster 80 */ - device.option_add("parprn", A2BUS_PARPRN); /* Apple II Parallel Printer Interface Card */ - device.option_add("parallel", A2BUS_PIC); /* Apple II Parallel Interface Card */ + device.option_add("parprn", A2BUS_PARPRN); /* Apple II Parallel Printer Interface Card */ + device.option_add("parallel", A2BUS_PIC); /* Apple Parallel Interface Card */ device.option_add("grapplerplus", A2BUS_GRAPPLERPLUS); /* Orange Micro Grappler+ Printer Interface card */ device.option_add("corvus", A2BUS_CORVUS); /* Corvus flat-cable HDD interface (see notes in a2corvus.c) */ device.option_add("mcms1", A2BUS_MCMS1); /* Mountain Computer Music System, card 1 of 2 */ @@ -4608,6 +4845,9 @@ void apple2gs_state::apple2gs(machine_config &config) m_maincpu->wdm_handler().set(FUNC(apple2gs_state::wdm_trampoline)); TIMER(config, m_scantimer, 0); m_scantimer->configure_scanline(FUNC(apple2gs_state::apple2_interrupt), "screen", 0, 1); + + TIMER(config, m_acceltimer, 0).configure_generic(FUNC(apple2gs_state::accel_timer)); + config.set_maximum_quantum(attotime::from_hz(60)); M50741(config, m_adbmicro, A2GS_MASTER_CLOCK/8); |