The Apple II uses non-linear frame buffers for text and graphics. Rather than storing each line in sequence at
lines 0-23: $400, $428, $450, $480,¹ ..., $7D0
lines 0- 7: $400, $480, $500, $580, ..., $780
lines 8-15: $428, $4A8, $528, $5A8, ..., $7A8
lines 16-23: $450, $4D0, $550, $5D0, ..., $7D0
In other words, if you write linearly to the frame buffer, your data will appear first on the top line of the screen, then on a line a third of the way down, then on a line two thirds of the way down, then on the second line of the screen, and so on.²
In the answers and comments for What is DRAM refresh and why is the weird Apple II video memory layout affected by it?, there is extensive debate about whether this non-linear arrangement has anything to do with DRAM refresh. One answer says probably or yes, two say no, and one has no comment on the issue; comments on all answers that take a position argue it back and forth.
It doesn't look as if a clear answer to this is coming out of that question (which is asking about a lot more than the layout, anyway) so I'm creating this question to try to get a definitive answer on just this issue.
If the frame buffer were linear, would there be any way software could do something such that any DRAM row could be made to refresh less often than it would with the current non-linear frame buffer? If so, what would that way be?
Answers should either:
- Clearly describe a program that on a linear frame buffer, but not on the current layout, would cause some DRAM rows to be refreshed at significantly longer intervals than they would be in usual operation; or
- Explain why it's not possible to produce such a program.
¹ You might note that each third row in memory is 8 bytes longer than the other two, $30 instead of $28 bytes. Three rows of 40 characters (or 40 groups of 7 pixels plus a color bit in hires) sums to 120 bytes of storage; the extra 8 are padding to make the next row line up nicely. This is not just aesthetic, but helps with the hardware design.)
² The addresses above are for the first page of text and low-res graphics; the high-res frame buffer starting at $2000 is the same arrangement with eight times as many rows. The Apple II Technical Reference Manual includes more detailed diagrams giving maps of the text, low-resolution graphics and high resolution graphics frame buffers.)