From d7c71b77887a416d532e5dd4bc8384f0f178d083 Mon Sep 17 00:00:00 2001 From: arbee Date: Sun, 28 Nov 2021 22:17:34 -0500 Subject: apple2: updates and cleanups [R. Belmont] - Laser and Franklin key names now are correct: "Triangle"/"F" instead of "Apple". - Massive text drawing cleanup, removing a lot of copy/paste code and moving some runtime decisions to compile-time for better performance. - Ace 500 now uses a Franklin character set ROM so the "F" shows in MouseText. Machines promoted to WORKING ---------------------------- Franklin Ace 500 [R. Belmont] --- src/mame/drivers/apple2.cpp | 75 +++++----- src/mame/drivers/apple2e.cpp | 127 ++++++++++------- src/mame/video/apple2.cpp | 322 ++++++++++--------------------------------- src/mame/video/apple2.h | 11 +- 4 files changed, 198 insertions(+), 337 deletions(-) diff --git a/src/mame/drivers/apple2.cpp b/src/mame/drivers/apple2.cpp index f3449541fa7..699edc41482 100644 --- a/src/mame/drivers/apple2.cpp +++ b/src/mame/drivers/apple2.cpp @@ -163,9 +163,15 @@ public: virtual void machine_start() override; virtual void machine_reset() override; + template 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); + u32 screen_update_ultr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + u32 screen_update_ff(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return screen_update(screen, bitmap, cliprect); } + u32 screen_update_ft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return screen_update(screen, bitmap, cliprect); } + u32 screen_update_tf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return screen_update(screen, bitmap, cliprect); } + u32 screen_update_tt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return screen_update(screen, bitmap, cliprect); } u8 ram_r(offs_t offset); void ram_w(offs_t offset, u8 data); @@ -203,6 +209,8 @@ public: void apple2(machine_config &config); void space84(machine_config &config); void dodo(machine_config &config); + void albert(machine_config &config); + void ivelultr(machine_config &config); void apple2p(machine_config &config); void apple2_map(address_map &map); void inhbank_map(address_map &map); @@ -408,7 +416,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2_state::apple2_interrupt) } } - +template 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 @@ -421,14 +429,7 @@ u32 apple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con if (m_video->m_mix) { m_video->hgr_update(screen, bitmap, cliprect, 0, 159); - if (!strcmp(machine().system().name, "ivelultr")) - { - m_video->text_update_ultr(screen, bitmap, cliprect, 160, 191); - } - else - { - m_video->text_update_orig(screen, bitmap, cliprect, 160, 191); - } + m_video->text_update(screen, bitmap, cliprect, 160, 191); } else { @@ -440,14 +441,7 @@ u32 apple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con if (m_video->m_mix) { m_video->lores_update(screen, bitmap, cliprect, 0, 159); - if (!strcmp(machine().system().name, "ivelultr")) - { - m_video->text_update_ultr(screen, bitmap, cliprect, 160, 191); - } - else - { - m_video->text_update_orig(screen, bitmap, cliprect, 160, 191); - } + m_video->text_update(screen, bitmap, cliprect, 160, 191); } else { @@ -457,14 +451,7 @@ u32 apple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con } else { - if (!strcmp(machine().system().name, "ivelultr")) - { - m_video->text_update_ultr(screen, bitmap, cliprect, 0, 191); - } - else - { - m_video->text_update_orig(screen, bitmap, cliprect, 0, 191); - } + m_video->text_update(screen, bitmap, cliprect, 0, 191); } return 0; @@ -510,7 +497,7 @@ u32 apple2_state::screen_update_jp(screen_device &screen, bitmap_ind16 &bitmap, return 0; } -u32 apple2_state::screen_update_dodo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 apple2_state::screen_update_ultr(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; @@ -522,19 +509,19 @@ u32 apple2_state::screen_update_dodo(screen_device &screen, bitmap_ind16 &bitmap if (m_video->m_mix) { m_video->hgr_update(screen, bitmap, cliprect, 0, 159); - m_video->text_update_dodo(screen, bitmap, cliprect, 160, 191); + m_video->text_update_ultr(screen, bitmap, cliprect, 160, 191); } else { m_video->hgr_update(screen, bitmap, cliprect, 0, 191); } } - else // lo-res + else // lo-res { if (m_video->m_mix) { m_video->lores_update(screen, bitmap, cliprect, 0, 159); - m_video->text_update_dodo(screen, bitmap, cliprect, 160, 191); + m_video->text_update_ultr(screen, bitmap, cliprect, 160, 191); } else { @@ -544,7 +531,7 @@ u32 apple2_state::screen_update_dodo(screen_device &screen, bitmap_ind16 &bitmap } else { - m_video->text_update_dodo(screen, bitmap, cliprect, 0, 191); + m_video->text_update_ultr(screen, bitmap, cliprect, 0, 191); } return 0; @@ -1380,7 +1367,7 @@ void apple2_state::apple2_common(machine_config &config) SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192); - m_screen->set_screen_update(FUNC(apple2_state::screen_update)); + m_screen->set_screen_update(FUNC(apple2_state::screen_update_tt)); m_screen->set_palette(m_video); /* sound hardware */ @@ -1481,7 +1468,19 @@ void apple2_state::apple2jp(machine_config &config) void apple2_state::dodo(machine_config &config) { apple2p(config); - m_screen->set_screen_update(FUNC(apple2_state::screen_update_dodo)); + m_screen->set_screen_update(FUNC(apple2_state::screen_update_tf)); +} + +void apple2_state::albert(machine_config &config) +{ + apple2p(config); + m_screen->set_screen_update(FUNC(apple2_state::screen_update_ft)); +} + +void apple2_state::ivelultr(machine_config &config) +{ + apple2p(config); + m_screen->set_screen_update(FUNC(apple2_state::screen_update_ultr)); } #if 0 @@ -1852,15 +1851,15 @@ COMP( 1982, uniap2en, apple2, 0, apple2p, apple2p, apple2_state, empty_ini COMP( 1982, uniap2pt, apple2, 0, apple2p, apple2p, apple2_state, empty_init, "Unitron Eletronica", "Unitron AP II (in Brazilian Portuguese)", MACHINE_SUPPORTS_SAVE ) COMP( 1984, uniap2ti, apple2, 0, apple2p, apple2p, apple2_state, empty_init, "Unitron Eletronica", "Unitron AP II+ (Teclado Inteligente)", MACHINE_SUPPORTS_SAVE ) COMP( 1982, craft2p, apple2, 0, apple2p, apple2p, apple2_state, empty_init, "Craft", "Craft II+", MACHINE_SUPPORTS_SAVE ) -// reverse font direction -\/ -COMP( 1984, ivelultr, apple2, 0, apple2p, apple2p, apple2_state, empty_init, "Ivasim", "Ivel Ultra", MACHINE_SUPPORTS_SAVE ) +// reverse font direction + wider character cell -\/ +COMP( 1984, ivelultr, apple2, 0, ivelultr, apple2p, apple2_state, empty_init, "Ivasim", "Ivel Ultra", MACHINE_SUPPORTS_SAVE ) COMP( 1985, prav8m, apple2, 0, apple2p, apple2p, apple2_state, empty_init, "Pravetz", "Pravetz 8M", MACHINE_SUPPORTS_SAVE ) COMP( 1985, space84, apple2, 0, space84, apple2p, apple2_state, empty_init, "ComputerTechnik/IBS", "Space 84", MACHINE_NOT_WORKING ) COMP( 1985, am64, apple2, 0, space84, apple2p, apple2_state, empty_init, "ASEM", "AM 64", MACHINE_SUPPORTS_SAVE ) //COMP( 19??, laba2p, apple2, 0, laba2p, apple2p, apple2_state, empty_init, "", "Lab equipment Apple II Plus clone", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, laser2c, apple2, 0, space84, apple2p, apple2_state, empty_init, "Milmar", "Laser //c", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, laser2c, apple2, 0, ivelultr, apple2p, apple2_state, empty_init, "Milmar", "Laser //c", MACHINE_SUPPORTS_SAVE ) COMP( 1982, basis108, apple2, 0, apple2, apple2p, apple2_state, empty_init, "Basis", "Basis 108", MACHINE_SUPPORTS_SAVE ) COMP( 1984, hkc8800a, apple2, 0, apple2p, apple2p, apple2_state, empty_init, "China HKC", "HKC 8800A", MACHINE_SUPPORTS_SAVE ) -COMP( 1984, albert, apple2, 0, apple2p, apple2p, apple2_state, empty_init, "Albert Computers, Inc.", "Albert", MACHINE_SUPPORTS_SAVE ) +COMP( 1984, albert, apple2, 0, albert, apple2p, apple2_state, empty_init, "Albert Computers, Inc.", "Albert", MACHINE_SUPPORTS_SAVE ) COMP( 198?, am100, apple2, 0, apple2p, apple2p, apple2_state, empty_init, "ASEM S.p.A.", "AM100", MACHINE_SUPPORTS_SAVE ) -COMP( 198?, dodo, apple2, 0, dodo, apple2p, apple2_state, empty_init, "GTAC", "Do-Do", MACHINE_SUPPORTS_SAVE ) +COMP( 198?, dodo, apple2, 0, ivelultr, apple2p, apple2_state, empty_init, "GTAC", "Do-Do", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 6e53c57bf3c..86da332723b 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -302,8 +302,6 @@ public: m_iscecm = false; m_iscec2000 = false; m_isace500 = false; - m_spectrum_text = false; - m_inverse_text = false; m_pal = false; #if IICP_NEW_IWM m_cur_floppy = nullptr; @@ -360,8 +358,14 @@ public: virtual void machine_start() override; virtual void machine_reset() override; + template u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_ff(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return screen_update(screen, bitmap, cliprect); } + u32 screen_update_ft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return screen_update(screen, bitmap, cliprect); } + u32 screen_update_tf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return screen_update(screen, bitmap, cliprect); } + u32 screen_update_tt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return screen_update(screen, bitmap, cliprect); } + u8 ram0000_r(offs_t offset); void ram0000_w(offs_t offset, u8 data); u8 ram0200_r(offs_t offset); @@ -484,7 +488,6 @@ public: void spectred_keyb_map(address_map &map); void init_laser128(); void init_128ex(); - void init_spect(); void init_pal(); void init_ace500(); @@ -523,7 +526,7 @@ private: bool m_mockingboard4c; bool m_intc8rom; - bool m_isiic, m_isiicplus, m_iscec, m_iscecm, m_iscec2000, m_spectrum_text, m_inverse_text, m_pal; + bool m_isiic, m_isiicplus, m_iscec, m_iscecm, m_iscec2000, m_pal; u8 m_migram[0x800]; u16 m_migpage; @@ -1038,8 +1041,19 @@ void apple2e_state::machine_start() for (int adr = 0; adr < ram_size; adr += 2) { - m_ram_ptr[adr] = 0; - m_ram_ptr[adr+1] = 0xff; + // invert the fill pattern order on the ACE 500, as it interacts with + // Franklin's monitor not returning the same values as Apple's plus some + // bugs in DOS 3.3. + if (m_isace500) + { + m_ram_ptr[adr] = 0xff; + m_ram_ptr[adr+1] = 0; + } + else + { + m_ram_ptr[adr] = 0; + m_ram_ptr[adr + 1] = 0xff; + } if (m_ram_size >= (128*1024)) { @@ -1301,17 +1315,10 @@ void apple2e_state::init_128ex() { m_accel_laser = true; m_has_laser_mouse = true; - m_inverse_text = true; -} - -void apple2e_state::init_spect() -{ - m_spectrum_text = true; } void apple2e_state::init_laser128() { - m_inverse_text = true; m_has_laser_mouse = true; } @@ -1336,7 +1343,6 @@ void apple2e_state::raise_irq(int irq) } } - void apple2e_state::lower_irq(int irq) { m_irqmask &= ~(1 << irq); @@ -1391,6 +1397,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2e_state::apple2_interrupt) } } +template u32 apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bool old_page2 = m_video->m_page2; @@ -1419,18 +1426,7 @@ u32 apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co m_video->hgr_update(screen, bitmap, cliprect, 0, 159); } - if (m_spectrum_text) - { - m_video->text_update_spectrum(screen, bitmap, cliprect, 160, 191); - } - else if (m_inverse_text) - { - m_video->text_update_inverse(screen, bitmap, cliprect, 160, 191); - } - else - { - m_video->text_update(screen, bitmap, cliprect, 160, 191); - } + m_video->text_update(screen, bitmap, cliprect, 160, 191); } else { @@ -1444,7 +1440,7 @@ u32 apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co } } } - else // lo-res + else // lo-res { if (m_video->m_mix) { @@ -1457,7 +1453,7 @@ u32 apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co m_video->lores_update(screen, bitmap, cliprect, 0, 159); } - m_video->text_update(screen, bitmap, cliprect, 160, 191); + m_video->text_update(screen, bitmap, cliprect, 160, 191); } else { @@ -1474,18 +1470,7 @@ u32 apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co } else { - if (m_spectrum_text) - { - m_video->text_update_spectrum(screen, bitmap, cliprect, 0, 191); - } - else if (m_inverse_text) - { - m_video->text_update_inverse(screen, bitmap, cliprect, 0, 191); - } - else - { - m_video->text_update(screen, bitmap, cliprect, 0, 191); - } + m_video->text_update(screen, bitmap, cliprect, 0, 191); } m_video->m_page2 = old_page2; @@ -4123,7 +4108,9 @@ static INPUT_PORTS_START( apple2e_common ) PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END +static INPUT_PORTS_START( apple2e_special ) PORT_START("keyb_special") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) @@ -4475,11 +4462,13 @@ INPUT_PORTS_END static INPUT_PORTS_START( apple2e ) PORT_INCLUDE( apple2e_common ) + PORT_INCLUDE( apple2e_special ) PORT_INCLUDE( apple2_sysconfig ) INPUT_PORTS_END static INPUT_PORTS_START( apple2c ) PORT_INCLUDE( apple2e_common ) + PORT_INCLUDE( apple2e_special ) PORT_INCLUDE( apple2c_sysconfig ) PORT_START(MOUSE_BUTTON_TAG) /* Mouse - button */ @@ -4496,6 +4485,38 @@ static INPUT_PORTS_START( laser128 ) PORT_INCLUDE( apple2e_common ) PORT_INCLUDE( laser128_sysconfig ) + PORT_START("keyb_special") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Triangle") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Triangle") PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) + + PORT_START(MOUSE_BUTTON_TAG) /* Mouse - button */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) + + PORT_START(MOUSE_XAXIS_TAG) /* Mouse - X AXIS */ + PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(20) PORT_KEYDELTA(0) PORT_PLAYER(1) + + PORT_START(MOUSE_YAXIS_TAG) /* Mouse - Y AXIS */ + PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(20) PORT_KEYDELTA(0) PORT_PLAYER(1) +INPUT_PORTS_END + +static INPUT_PORTS_START( ace500 ) + PORT_INCLUDE( apple2e_common ) + PORT_INCLUDE( laser128_sysconfig ) + + PORT_START("keyb_special") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open F") PORT_CODE(KEYCODE_LALT) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid F") PORT_CODE(KEYCODE_RALT) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) + PORT_START(MOUSE_BUTTON_TAG) /* Mouse - button */ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1) @@ -4508,6 +4529,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( apple2cp ) PORT_INCLUDE( apple2e_common ) + PORT_INCLUDE( apple2e_special ) PORT_INCLUDE( apple2cp_sysconfig ) PORT_START(MOUSE_BUTTON_TAG) /* Mouse - button */ @@ -5103,7 +5125,7 @@ void apple2e_state::apple2e(machine_config &config) SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192); - m_screen->set_screen_update(FUNC(apple2e_state::screen_update)); + m_screen->set_screen_update(FUNC(apple2e_state::screen_update_ff)); m_screen->set_palette(m_video); /* sound hardware */ @@ -5247,9 +5269,10 @@ void apple2e_state::spectred(machine_config &config) apple2e(config); i8035_device &keyb_mcu(I8035(config, "keyb_mcu", XTAL(4'000'000))); /* guessed frequency */ keyb_mcu.set_addrmap(AS_PROGRAM, &apple2e_state::spectred_keyb_map); + m_screen->set_screen_update(FUNC(apple2e_state::screen_update_ft)); - //TODO: implement the actual interfacing to this 8035 MCU and - // and then remove the keyb CPU inherited from apple2e + // TODO: implement the actual interfacing to this 8035 MCU and + // and then remove the keyb CPU inherited from apple2e } void apple2e_state::tk3000(machine_config &config) @@ -5491,6 +5514,8 @@ void apple2e_state::laser128(machine_config &config) M65C02(config.replace(), m_maincpu, 1021800); m_maincpu->set_addrmap(AS_PROGRAM, &apple2e_state::laser128_map); + m_screen->set_screen_update(FUNC(apple2e_state::screen_update_tf)); + LEGACY_APPLEFDC(config, m_laserudc, &fdc_interface); FLOPPY_APPLE(config, FLOPPY_0, &floppy_interface, 15, 16); FLOPPY_APPLE(config, FLOPPY_1, &floppy_interface, 15, 16); @@ -5520,6 +5545,8 @@ void apple2e_state::laser128o(machine_config &config) M65C02(config.replace(), m_maincpu, 1021800); m_maincpu->set_addrmap(AS_PROGRAM, &apple2e_state::laser128_map); + m_screen->set_screen_update(FUNC(apple2e_state::screen_update_tf)); + LEGACY_APPLEFDC(config, m_laserudc, &fdc_interface); FLOPPY_APPLE(config, FLOPPY_0, &floppy_interface, 15, 16); FLOPPY_APPLE(config, FLOPPY_1, &floppy_interface, 15, 16); @@ -5550,6 +5577,8 @@ void apple2e_state::laser128ex2(machine_config &config) M65C02(config.replace(), m_maincpu, 1021800); m_maincpu->set_addrmap(AS_PROGRAM, &apple2e_state::laser128_map); + m_screen->set_screen_update(FUNC(apple2e_state::screen_update_tf)); + LEGACY_APPLEFDC(config, m_laserudc, &fdc_interface); FLOPPY_APPLE(config, FLOPPY_0, &floppy_interface, 15, 16); FLOPPY_APPLE(config, FLOPPY_1, &floppy_interface, 15, 16); @@ -5579,6 +5608,9 @@ void apple2e_state::ace500(machine_config &config) M65C02(config.replace(), m_maincpu, 1021800); m_maincpu->set_addrmap(AS_PROGRAM, &apple2e_state::ace500_map); + m_screen->set_screen_update(FUNC(apple2e_state::screen_update_tf)); + m_screen->set_screen_update(FUNC(apple2e_state::screen_update_tt)); + CENTRONICS(config, m_printer_conn, centronics_devices, "printer"); m_printer_conn->busy_handler().set(FUNC(apple2e_state::busy_w)); OUTPUT_LATCH(config, m_printer_out); @@ -6041,8 +6073,9 @@ ROM_END ROM_START(ace500) ROM_REGION(0x2000,"gfx1",0) - ROM_LOAD ( "341-0265-a.chr", 0x0000, 0x1000, CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) - ROM_LOAD ( "341-0265-a.chr", 0x1000, 0x1000, CRC(2651014d) SHA1(b2b5d87f52693817fc747df087a4aa1ddcdb1f10)) + // not sure if the 500 and 2000 have the same character set. First 4K is normal charset, second 4K is MouseText + ROM_LOAD("franklin_ace2000_videorom.bin", 0x1000, 0x1000, CRC(545bdeea) SHA1(26ebc4b0d3080311f550090bc1b29807cb22d083)) + ROM_CONTINUE(0x0000, 0x1000) ROM_REGION(0x10000,"maincpu",0) ROM_LOAD("franklin500-rom.bin", 0x004000, 0x004000, CRC(376c9104) SHA1(7f82706adc0bfb5f60c207c81271eb0ba8510a11)) @@ -6065,7 +6098,7 @@ COMP( 1985, apple2eeuk, apple2e, 0, apple2eepal, apple2euk, apple2e_state, COMP( 1985, apple2eefr, apple2e, 0, apple2eepal, apple2efr, apple2e_state, init_pal, "Apple Computer", "Apple //e (enhanced, France)", MACHINE_SUPPORTS_SAVE ) COMP( 1987, apple2ep, apple2e, 0, apple2ep, apple2ep, apple2e_state, empty_init, "Apple Computer", "Apple //e (Platinum)", MACHINE_SUPPORTS_SAVE ) COMP( 1984, apple2c, 0, apple2, apple2c, apple2c, apple2e_state, empty_init, "Apple Computer", "Apple //c" , MACHINE_SUPPORTS_SAVE ) -COMP( 1985?,spectred, apple2e, 0, spectred, apple2e, apple2e_state, init_spect, "Scopus/Spectrum", "Spectrum ED" , MACHINE_SUPPORTS_SAVE ) +COMP( 1985?,spectred, apple2e, 0, spectred, apple2e, apple2e_state, empty_init, "Scopus/Spectrum", "Spectrum ED" , MACHINE_SUPPORTS_SAVE ) COMP( 1986, tk3000, apple2c, 0, tk3000, apple2e, apple2e_state, empty_init, "Microdigital", "TK3000//e" , MACHINE_SUPPORTS_SAVE ) COMP( 1989, prav8c, apple2e, 0, apple2e, apple2e, apple2e_state, empty_init, "Pravetz", "Pravetz 8C", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) COMP( 1987, laser128, apple2c, 0, laser128, laser128, apple2e_state, init_laser128, "Video Technology", "Laser 128", MACHINE_SUPPORTS_SAVE ) @@ -6082,4 +6115,4 @@ COMP( 1989, cecm, 0, apple2, cec, cecm, apple2e_state, COMP( 1991, cec2000, 0, apple2, cec, ceci, apple2e_state, empty_init, "Shaanxi Province Computer Factory", "China Education Computer 2000", MACHINE_SUPPORTS_SAVE ) COMP( 1989, zijini, 0, apple2, cec, zijini, apple2e_state, empty_init, "Nanjing Computer Factory", "Zi Jin I", MACHINE_SUPPORTS_SAVE ) COMP( 1988, apple2cp, apple2c, 0, apple2cp, apple2cp, apple2e_state, empty_init, "Apple Computer", "Apple //c Plus", MACHINE_SUPPORTS_SAVE ) -COMP( 1986, ace500, apple2c, 0, ace500, apple2c, apple2e_state, init_ace500,"Franklin Computer", "ACE 500", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE) +COMP( 1986, ace500, apple2c, 0, ace500, ace500, apple2e_state, init_ace500,"Franklin Computer", "ACE 500", MACHINE_SUPPORTS_SAVE) diff --git a/src/mame/video/apple2.cpp b/src/mame/video/apple2.cpp index 683002f8bb9..49bc86d8687 100644 --- a/src/mame/video/apple2.cpp +++ b/src/mame/video/apple2.cpp @@ -193,114 +193,82 @@ WRITE_LINE_MEMBER(a2_video_device::an2_w) m_an2 = state; } +template void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) { - if (!m_altcharset) + if (iie) // IIe/IIc/IIgs { - if ((code >= 0x40) && (code <= 0x7f)) + if (!m_altcharset) { - code &= 0x3f; - - if (m_flash) + if ((code >= 0x40) && (code <= 0x7f)) { - using std::swap; - swap(fg, bg); + code &= 0x3f; + + if (m_flash) + { + using std::swap; + swap(fg, bg); + } } } - } - else - { - if ((code >= 0x60) && (code <= 0x7f)) - { - code |= 0x80; // map to lowercase normal - using std::swap;// and flip the color - std::swap(fg, bg); - } - } - - /* look up the character data */ - uint8_t const *const chardata = &m_char_ptr[(code * 8)]; - - for (int y = 0; y < 8; y++) - { - for (int x = 0; x < 7; x++) + else { - uint16_t const color = (chardata[y] & (1 << x)) ? bg : fg; - - for (int i = 0; i < xscale; i++) + if ((code >= 0x60) && (code <= 0x7f)) { - bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; + code |= 0x80; // map to lowercase normal + using std::swap; // and flip the color + std::swap(fg, bg); } } } -} - -void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) -{ - if (!m_altcharset) + else // original II and II Plus { if ((code >= 0x40) && (code <= 0x7f)) { - code &= 0x3f; - if (m_flash) { using std::swap; swap(fg, bg); } } - } - else - { - if ((code >= 0x60) && (code <= 0x7f)) + else if (code < 0x40) // inverse: flip FG and BG { - code |= 0x80; // map to lowercase normal - using std::swap;// and flip the color + using std::swap; swap(fg, bg); } } /* look up the character data */ - uint8_t const *const chardata = &m_char_ptr[(code * 8)]; + u8 const *const chardata = &m_char_ptr[(code * 8)]; for (int y = 0; y < 8; y++) { for (int x = 0; x < 7; x++) { - uint16_t const color = (chardata[y] & (1 << (x+1))) ? fg : bg; - - for (int i = 0; i < xscale; i++) + u16 color; + // flip and invert are template parameters, so the compiler will boil this down appropriately + if (flip) { - bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; + if (invert) + { + color = (chardata[y] & (1 << (6 - x))) ? fg : bg; + } + else + { + color = (chardata[y] & (1 << (6 - x))) ? bg : fg; + } + } + else + { + if (invert) + { + color = (chardata[y] & (1 << x)) ? fg : bg; + } + else + { + color = (chardata[y] & (1 << x)) ? bg : fg; + } } - } - } -} - -void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) -{ - if ((code >= 0x40) && (code <= 0x7f)) - { - if (m_flash) - { - using std::swap; - swap(fg, bg); - } - } - else if (code < 0x40) // inverse: flip FG and BG - { - using std::swap; - swap(fg, bg); - } - - /* look up the character data */ - uint8_t const *const chardata = &m_char_ptr[(code * 8)]; - - for (int y = 0; y < 8; y++) - { - for (int x = 0; x < 7; x++) - { - uint16_t const color = (chardata[y] & (1 << (6-x))) ? fg : bg; for (int i = 0; i < xscale; i++) { @@ -726,6 +694,7 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, } } +template void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { uint8_t const *const aux_page = m_aux_ptr ? m_aux_ptr : m_ram_ptr; @@ -740,91 +709,40 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c const int startcol = (cliprect.left() / 14); const int stopcol = ((cliprect.right() / 14) + 1); - //printf("TXT: row %d startcol %d stopcol %d left %d right %d\n", beginrow, startcol, stopcol, cliprect.left(), cliprect.right()); - - int fg = 0; - int bg = 0; - switch (m_sysconfig & 0x03) - { - case 0: case 4: fg = WHITE; break; - case 1: fg = WHITE; break; - case 2: fg = GREEN; break; - case 3: fg = ORANGE; break; - } - - for (int row = startrow; row < stoprow; row += 8) - { - if (m_80col) - { - for (int col = startcol; col < stopcol; col++) - { - /* calculate address */ - uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - - plot_text_character(bitmap, col * 14, row, 1, aux_page[address], - fg, bg); - plot_text_character(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], - fg, bg); - } - } - else - { - for (int col = startcol; col < stopcol; col++) - { - /* calculate address */ - uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - if (((m_sysconfig & 7) == 4) && (m_dhires)) - { - u8 tmp = aux_page[address]; - fg = tmp>>4; - bg = tmp & 0xf; - } - - plot_text_character(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); - } - } - } -} - -void a2_video_device::text_update_inverse(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - uint8_t const *const aux_page = m_aux_ptr ? m_aux_ptr : m_ram_ptr; - - uint32_t const start_address = m_page2 ? 0x800 : 0x400; - - beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); - endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - - const int startrow = (beginrow / 8) * 8; - const int stoprow = ((endrow / 8) + 1) * 8; - const int startcol = (cliprect.left() / 14); - const int stopcol = ((cliprect.right() / 14) + 1); - - //printf("TXT: row %d startcol %d stopcol %d left %d right %d\n", beginrow, startcol, stopcol, cliprect.left(), cliprect.right()); + // printf("TXT: row %d startcol %d stopcol %d left %d right %d\n", beginrow, startcol, stopcol, cliprect.left(), cliprect.right()); int fg = 0; int bg = 0; switch (m_sysconfig & 0x03) { - case 0: case 4: bg = WHITE; break; - case 1: bg = WHITE; break; - case 2: bg = GREEN; break; - case 3: bg = ORANGE; break; + case 0: + case 4: + fg = WHITE; + break; + case 1: + fg = WHITE; + break; + case 2: + fg = GREEN; + break; + case 3: + fg = ORANGE; + break; } for (int row = startrow; row < stoprow; row += 8) { - if (m_80col) + if ((iie) && (m_80col)) { for (int col = startcol; col < stopcol; col++) { /* calculate address */ - uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row / 8) & 0x07) << 7) | (((row / 8) & 0x18) * 5 + col)); - plot_text_character(bitmap, col * 14, row, 1, aux_page[address], - fg, bg); - plot_text_character(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], - fg, bg); + plot_text_character(bitmap, col * 14, row, 1, aux_page[address], + fg, bg); + plot_text_character(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], + fg, bg); } } else @@ -832,119 +750,31 @@ void a2_video_device::text_update_inverse(screen_device &screen, bitmap_ind16 &b for (int col = startcol; col < stopcol; col++) { /* calculate address */ - uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row / 8) & 0x07) << 7) | (((row / 8) & 0x18) * 5 + col)); if (((m_sysconfig & 7) == 4) && (m_dhires)) { u8 tmp = aux_page[address]; - fg = tmp>>4; + fg = tmp >> 4; bg = tmp & 0xf; } - plot_text_character(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); + plot_text_character(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } } -void a2_video_device::text_update_orig(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - int row, col; - uint32_t start_address = m_page2 ? 0x800 : 0x400; - uint32_t address; - int fg = 0; - int bg = 0; - - beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); - endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - - const int startrow = (beginrow / 8) * 8; - const int stoprow = ((endrow / 8) + 1) * 8; - const int startcol = (cliprect.left() / 14); - const int stopcol = ((cliprect.right() / 14) + 1); - - switch (m_sysconfig & 0x03) - { - case 0: case 4: fg = WHITE; break; - case 1: fg = WHITE; break; - case 2: fg = GREEN; break; - case 3: fg = ORANGE; break; - } - - for (row = startrow; row <= stoprow; row += 8) - { - for (col = startcol; col < stopcol; col++) - { - /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_orig(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); - } - } -} - -void a2_video_device::text_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) -{ - int row, col; - uint32_t start_address = m_page2 ? 0x800 : 0x400; - uint32_t address; - int fg = 0; - int bg = 0; - - beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); - endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - - const int startrow = (beginrow / 8) * 8; - const int stoprow = ((endrow / 8) + 1) * 8; - - switch (m_sysconfig & 0x03) - { - case 0: fg = WHITE; break; - case 1: fg = WHITE; break; - case 2: fg = GREEN; break; - case 3: fg = ORANGE; break; - } - - for (row = startrow; row <= stoprow; row += 8) - { - for (col = 0; col < 40; col++) - { - /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_orig(bitmap, col * 14, row, 2, m_ram_ptr[address], bg, fg); - } - } -} - -void a2_video_device::text_update_dodo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) +// this function forces all of the template versions to be created, otherwise there's a link error +void a2_video_device::hackery(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col; - uint32_t start_address = m_page2 ? 0x800 : 0x400; - uint32_t address; - int fg = 0; - int bg = 0; - - beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); - endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - - const int startrow = (beginrow / 8) * 8; - const int stoprow = ((endrow / 8) + 1) * 8; - - switch (m_sysconfig & 0x03) - { - case 0: fg = WHITE; break; - case 1: fg = WHITE; break; - case 2: fg = GREEN; break; - case 3: fg = ORANGE; break; - } - - for (row = startrow; row <= stoprow; row += 8) - { - for (col = 0; col < 40; col++) - { - /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_dodo(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); - } - } + text_update(screen, bitmap, cliprect, beginrow, endrow); + text_update(screen, bitmap, cliprect, beginrow, endrow); + text_update(screen, bitmap, cliprect, beginrow, endrow); + text_update(screen, bitmap, cliprect, beginrow, endrow); + text_update(screen, bitmap, cliprect, beginrow, endrow); + text_update(screen, bitmap, cliprect, beginrow, endrow); + text_update(screen, bitmap, cliprect, beginrow, endrow); + text_update(screen, bitmap, cliprect, beginrow, endrow); } void a2_video_device::text_update_jplus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) diff --git a/src/mame/video/apple2.h b/src/mame/video/apple2.h index 70af5a1d986..80087708661 100644 --- a/src/mame/video/apple2.h +++ b/src/mame/video/apple2.h @@ -50,12 +50,10 @@ public: DECLARE_WRITE_LINE_MEMBER(dhires_w); DECLARE_WRITE_LINE_MEMBER(an2_w); + template void text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void text_update_inverse(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); + void text_update_ultr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void text_update_orig(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void text_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); - void text_update_dodo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); void text_update_jplus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); void text_updateGS(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); void lores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); @@ -75,12 +73,13 @@ protected: void init_palette(); private: + template void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); void plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); - void plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); void plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); - void plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); void plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg); + + void hackery(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow); }; // device type definition -- cgit v1.2.3