diff --git a/src/mame/drivers/apple2.cpp b/src/mame/drivers/apple2.cpp index eb7701abd7a..00aa48f9f02 100644 --- a/src/mame/drivers/apple2.cpp +++ b/src/mame/drivers/apple2.cpp @@ -803,14 +803,11 @@ void apple2_state::inh_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 +// 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() { enum { - // scanner types - kScannerNone = 0, kScannerApple2, kScannerApple2e, - // scanner constants kHBurstClock = 53, // clock when Color Burst starts kHBurstClocks = 4, // clocks per Color Burst duration @@ -855,8 +852,7 @@ uint8_t apple2_state::read_floatingbus() // ScanCycles = ScanLines * kHClocks; // calculate horizontal scanning state - // - h_clock = i % kHClocks; // which horizontal scanning clock + h_clock = (i + 63) % kHClocks; // which horizontal scanning clock h_state = kHClock0State + h_clock; // H state bits if (h_clock >= kHPresetClock) // check for horizontal preset { @@ -922,15 +918,14 @@ uint8_t apple2_state::read_floatingbus() { // N: text, so no higher address bits unless Apple ][, not Apple //e // - if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) - (kHPEClock <= h_clock) && // Y: HBL? + if ((kHPEClock <= h_clock) && // Y: HBL? (h_clock <= (kHClocks - 1))) { address |= 1 << 12; // Y: a12 (add $1000 to address!) } } - return m_ram_ptr[address % m_ram_size]; // FIX: this seems to work, but is it right!? + return m_ram_ptr[address % m_ram_size]; } /*************************************************************************** diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index ad384566eff..6831a79c7f7 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -271,6 +271,13 @@ public: m_ds1315(*this, "nsc") { m_accel_laser = false; + m_isiic = false; + m_isiicplus = false; + m_iscec = false; + m_iscecm = false; + m_iscec2000 = false; + m_spectrum_text = false; + m_pal = false; } required_device m_maincpu; @@ -402,10 +409,12 @@ public: void cec(machine_config &config); void mprof3(machine_config &config); void apple2e(machine_config &config); + void apple2epal(machine_config &config); void apple2ep(machine_config &config); void apple2c(machine_config &config); void tk3000(machine_config &config); void apple2ee(machine_config &config); + void apple2eepal(machine_config &config); void apple2c_map(address_map &map); void apple2c_memexp_map(address_map &map); void apple2e_map(address_map &map); @@ -425,6 +434,7 @@ public: void spectred_keyb_map(address_map &map); void init_128ex(); void init_spect(); + void init_pal(); bool m_35sel, m_hdsel, m_intdrive; @@ -466,7 +476,7 @@ private: bool m_mockingboard4c; bool m_intc8rom; - bool m_isiic, m_isiicplus, m_iscec, m_iscecm, m_iscec2000, m_spectrum_text; + 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; @@ -1105,6 +1115,11 @@ void apple2e_state::init_spect() m_spectrum_text = true; } +void apple2e_state::init_pal() +{ + m_pal = true; +} + void apple2e_state::raise_irq(int irq) { m_irqmask |= (1 << irq); @@ -2362,7 +2377,7 @@ void apple2e_state::update_iic_mouse() { int new_mx, new_my; - // read the axes + // read the axes and check for changes new_mx = m_mousex->read(); new_my = m_mousey->read(); @@ -2372,10 +2387,10 @@ void apple2e_state::update_iic_mouse() int diff = new_mx - last_mx; /* check for wrap */ - if (diff > 0x80) - diff = 0x100-diff; - if (diff < -0x80) - diff = -0x100-diff; + if (diff > 0x80) + diff -= 0x100; + else if (diff < -0x80) + diff += 0x100; count_x += diff; last_mx = new_mx; @@ -2895,14 +2910,11 @@ void apple2e_state::lc_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 +// 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() { enum { - // scanner types - kScannerNone = 0, kScannerApple2, kScannerApple2e, - // scanner constants kHBurstClock = 53, // clock when Color Burst starts kHBurstClocks = 4, // clocks per Color Burst duration @@ -2919,9 +2931,10 @@ uint8_t apple2e_state::read_floatingbus() kVLine0State = 0x100, // V[543210CBA] = 100000000 kVPresetLine = 256, // line when V state presets kVSyncLines = 4, // lines per VSync duration - kClocksPerVSync = kHClocks * kNTSCScanLines // FIX: NTSC only? }; + const int kClocksPerVSync = kHClocks * (m_pal ? kPALScanLines : kNTSCScanLines); + // vars // int i, Hires, Mixed, Page2, _80Store, ScanLines, /* VSyncLine, ScanCycles,*/ @@ -2941,14 +2954,11 @@ uint8_t apple2e_state::read_floatingbus() _80Store = m_80store ? 1 : 0; // calculate video parameters according to display standard - // - ScanLines = 1 ? kNTSCScanLines : kPALScanLines; // FIX: NTSC only? - // VSyncLine = 1 ? kNTSCVSyncLine : kPALVSyncLine; // FIX: NTSC only? - // ScanCycles = ScanLines * kHClocks; + // we call this "PAL", but it's also for SECAM + ScanLines = m_pal ? kPALScanLines : kNTSCScanLines; // calculate horizontal scanning state - // - h_clock = i % kHClocks; // which horizontal scanning clock + h_clock = (i + 63) % kHClocks; // which horizontal scanning clock h_state = kHClock0State + h_clock; // H state bits if (h_clock >= kHPresetClock) // check for horizontal preset { @@ -3010,19 +3020,8 @@ uint8_t apple2e_state::read_floatingbus() address |= (1 ^ (Page2 & (1 ^ _80Store))) << 13; // a13 address |= (Page2 & (1 ^ _80Store)) << 14; // a14 } - else - { - // N: text, so no higher address bits unless Apple ][, not Apple //e - // - if ((1) && // Apple ][? // FIX: check for Apple ][? (FB is most useful in old games) - (kHPEClock <= h_clock) && // Y: HBL? - (h_clock <= (kHClocks - 1))) - { - address |= 1 << 12; // Y: a12 (add $1000 to address!) - } - } - return m_ram_ptr[address % m_ram_size]; // FIX: this seems to work, but is it right!? + return m_ram_ptr[address % m_ram_size]; } /*************************************************************************** @@ -4633,6 +4632,12 @@ void apple2e_state::apple2e(machine_config &config) m_cassette->add_route(ALL_OUTPUTS, "mono", 0.05); } +void apple2e_state::apple2epal(machine_config &config) +{ + apple2e(config); + m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 312, 0, 192); +} + void apple2e_state::mprof3(machine_config &config) { apple2e(config); @@ -4650,6 +4655,12 @@ void apple2e_state::apple2ee(machine_config &config) m_maincpu->set_dasm_override(FUNC(apple2e_state::dasm_trampoline)); } +void apple2e_state::apple2eepal(machine_config &config) +{ + apple2ee(config); + m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 312, 0, 192); +} + void apple2e_state::spectred(machine_config &config) { apple2e(config); @@ -5344,12 +5355,12 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */ COMP( 1983, apple2e, 0, apple2, apple2e, apple2e, apple2e_state, empty_init, "Apple Computer", "Apple //e", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, apple2euk, apple2e, 0, apple2e, apple2euk, apple2e_state, empty_init, "Apple Computer", "Apple //e (UK)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, apple2ees, apple2e, 0, apple2e, apple2ees, apple2e_state, empty_init, "Apple Computer", "Apple //e (Spain)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, apple2euk, apple2e, 0, apple2epal, apple2euk, apple2e_state, init_pal, "Apple Computer", "Apple //e (UK)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, apple2ees, apple2e, 0, apple2epal, apple2ees, apple2e_state, init_pal, "Apple Computer", "Apple //e (Spain)", MACHINE_SUPPORTS_SAVE ) COMP( 1983, mprof3, apple2e, 0, mprof3, apple2e, apple2e_state, empty_init, "Multitech", "Microprofessor III", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) COMP( 1985, apple2ee, apple2e, 0, apple2ee, apple2e, apple2e_state, empty_init, "Apple Computer", "Apple //e (enhanced)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, apple2eeuk, apple2e, 0, apple2ee, apple2euk, apple2e_state, empty_init, "Apple Computer", "Apple //e (enhanced, UK)", MACHINE_SUPPORTS_SAVE ) -COMP( 1985, apple2eefr, apple2e, 0, apple2ee, apple2efr, apple2e_state, empty_init, "Apple Computer", "Apple //e (enhanced, France)", MACHINE_SUPPORTS_SAVE ) +COMP( 1985, apple2eeuk, apple2e, 0, apple2eepal, apple2euk, apple2e_state, init_pal, "Apple Computer", "Apple //e (enhanced, UK)", MACHINE_SUPPORTS_SAVE ) +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 ) diff --git a/src/mame/video/apple2.cpp b/src/mame/video/apple2.cpp index 54fc6ba9493..5079b7fc449 100644 --- a/src/mame/video/apple2.cpp +++ b/src/mame/video/apple2.cpp @@ -193,8 +193,7 @@ WRITE_LINE_MEMBER(a2_video_device::an2_w) m_an2 = state; } -void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +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) { @@ -220,7 +219,7 @@ void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int yp } /* look up the character data */ - uint8_t const *const chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; for (int y = 0; y < 8; y++) { @@ -236,8 +235,7 @@ void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int yp } } -void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int 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) { @@ -263,7 +261,7 @@ void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, i } /* look up the character data */ - uint8_t const *const chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; for (int y = 0; y < 8; y++) { @@ -279,8 +277,7 @@ void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, i } } -void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +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)) { @@ -297,7 +294,7 @@ void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, i } /* look up the character data */ - uint8_t const *const chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; for (int y = 0; y < 8; y++) { @@ -313,8 +310,7 @@ void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, i } } -void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) { if ((code >= 0x40) && (code <= 0x7f)) { @@ -337,7 +333,7 @@ void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, } /* look up the character data */ - uint8_t const *const chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; for (int y = 0; y < 8; y++) { @@ -353,8 +349,7 @@ void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, } } -void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) { if ((code >= 0x40) && (code <= 0x7f)) { @@ -366,7 +361,7 @@ void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, i } /* look up the character data */ - uint8_t const *const chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; for (int y = 0; y < 8; y++) { @@ -382,8 +377,7 @@ void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, i } } -void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, - const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) +void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, int fg, int bg) { if (!m_altcharset) { @@ -404,7 +398,7 @@ void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int } /* look up the character data */ - uint8_t const *const chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &m_char_ptr[(code * 8)]; for (int y = 0; y < 8; y++) { @@ -768,9 +762,9 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c 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], - m_char_ptr, m_char_size, fg, bg); + fg, bg); plot_text_character(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); + fg, bg); } } else @@ -786,8 +780,7 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c bg = tmp & 0xf; } - plot_text_character(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); + plot_text_character(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } @@ -823,8 +816,7 @@ void a2_video_device::text_update_orig(screen_device &screen, bitmap_ind16 &bitm { /* 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], - m_char_ptr, m_char_size, fg, bg); + plot_text_character_orig(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } @@ -857,8 +849,7 @@ void a2_video_device::text_update_spectrum(screen_device &screen, bitmap_ind16 & { /* 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], - m_char_ptr, m_char_size, bg, fg); + plot_text_character_orig(bitmap, col * 14, row, 2, m_ram_ptr[address], bg, fg); } } } @@ -891,8 +882,7 @@ void a2_video_device::text_update_dodo(screen_device &screen, bitmap_ind16 &bitm { /* 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], - m_char_ptr, m_char_size, fg, bg); + plot_text_character_dodo(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } @@ -925,8 +915,7 @@ void a2_video_device::text_update_jplus(screen_device &screen, bitmap_ind16 &bit { /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_jplus(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); + plot_text_character_jplus(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } @@ -959,8 +948,7 @@ void a2_video_device::text_update_ultr(screen_device &screen, bitmap_ind16 &bitm { /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_character_ultr(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, fg, bg); + plot_text_character_ultr(bitmap, col * 14, row, 2, m_ram_ptr[address], fg, bg); } } } @@ -1026,7 +1014,7 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co case 0: for (int b = 0; b < 7; b++) { - if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) < cliprect.right())) + if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) <= cliprect.right())) { uint16_t const v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; @@ -1050,7 +1038,7 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { uint16_t const v = (w & 1); w >>= 1; - if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) < cliprect.right())) + if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) <= cliprect.right())) { *(p++) = v ? WHITE : BLACK; *(p++) = v ? WHITE : BLACK; @@ -1077,7 +1065,7 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { uint16_t const v = (w & 1); w >>= 1; - if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) < cliprect.right())) + if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) <= cliprect.right())) { *(p++) = v ? GREEN : BLACK; *(p++) = v ? GREEN : BLACK; @@ -1104,7 +1092,7 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { uint16_t const v = (w & 1); w >>= 1; - if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) < cliprect.right())) + if ((((col*14) + b) >= cliprect.left()) && (((col*14) + b) <= cliprect.right())) { *(p++) = v ? ORANGE : BLACK; *(p++) = v ? ORANGE : BLACK; @@ -1716,10 +1704,8 @@ void a2_video_device::text_updateGS(screen_device &screen, bitmap_ind16 &bitmap, /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_characterGS(bitmap, col * 14, row, 1, aux_page[address], - m_char_ptr, m_char_size, m_GSfg, m_GSbg); - plot_text_characterGS(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], - m_char_ptr, m_char_size, m_GSfg, m_GSbg); + plot_text_characterGS(bitmap, col * 14, row, 1, aux_page[address], m_GSfg, m_GSbg); + plot_text_characterGS(bitmap, col * 14 + 7, row, 1, m_ram_ptr[address], m_GSfg, m_GSbg); } } else @@ -1728,8 +1714,7 @@ void a2_video_device::text_updateGS(screen_device &screen, bitmap_ind16 &bitmap, { /* calculate address */ address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); - plot_text_characterGS(bitmap, col * 14, row, 2, m_ram_ptr[address], - m_char_ptr, m_char_size, m_GSfg, m_GSbg); + plot_text_characterGS(bitmap, col * 14, row, 2, m_ram_ptr[address], m_GSfg, m_GSbg); } } }