1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-30 22:29:56 +00:00

Fix Apple II/II+/IIe vbl rows read addresses

See #1180
This commit is contained in:
Ryan Schmidt 2023-10-22 04:38:52 -05:00
parent 14851f407c
commit 577b01e80b

View File

@ -147,8 +147,13 @@ template <class BusHandler, bool is_iie> class Video: public VideoBase {
// Apply carry into the row counter. // Apply carry into the row counter.
int mapped_row = row_ + (mapped_column / 65); int mapped_row = row_ + (mapped_column / 65);
mapped_column %= 65;
mapped_row %= 262; mapped_row %= 262;
mapped_column %= 65;
// Vertical blanking rows read eight bytes earlier.
if(mapped_row >= 192) {
mapped_column -= 8;
}
// Apple out-of-bounds row logic. // Apple out-of-bounds row logic.
if(mapped_row >= 256) { if(mapped_row >= 256) {
@ -168,20 +173,20 @@ template <class BusHandler, bool is_iie> class Video: public VideoBase {
@returns @c true if the display will be within vertical blank at now + @c offset; @c false otherwise. @returns @c true if the display will be within vertical blank at now + @c offset; @c false otherwise.
*/ */
bool get_is_vertical_blank(Cycles offset) { bool get_is_vertical_blank(Cycles offset) {
// Map that backwards from the internal pixels-at-start generation to pixels-at-end // Determine column at offset.
// (so what was column 0 is now column 25).
int mapped_column = column_ + int(offset.as_integral()); int mapped_column = column_ + int(offset.as_integral());
// Map that backwards from the internal pixels-at-start generation to pixels-at-end // Map that backwards from the internal pixels-at-start generation to pixels-at-end
// (so what was column 0 is now column 25). // (so what was column 0 is now column 25).
mapped_column += 25; mapped_column += 25;
// Apply carry into the row counter and test it for location. // Apply carry into the row counter.
int mapped_row = row_ + (mapped_column / 65); int mapped_row = row_ + (mapped_column / 65);
mapped_row %= 262;
// Per http://www.1000bit.it/support/manuali/apple/technotes/iigs/tn.iigs.040.html // Per http://www.1000bit.it/support/manuali/apple/technotes/iigs/tn.iigs.040.html
// "on the IIe, the screen is blanked when the bit is low". // "on the IIe, the screen is blanked when the bit is low".
return (mapped_row % 262) < 192; return mapped_row < 192;
} }
private: private: