23

I've read the term screen holes many times in the context of Apple II graphics.

From what I understand, it has something to do with the interleaving storage of graphics (or was it text) and that some programmers use this space for other things.

However, I can't seem to find an explanation of what they really are, why they are used or how important they are (if at all).

Can someone explain what they are or at least point me to a good reference?

Thanks

3
  • 5
    The super-overview: the display uses addresses extending over a range larger than the number of bytes it is interested in. So the difference between the highest address used and the lowest address used is greater than the amount of content. So some bytes in the range are unused. Those are the screen holes, and they're used instead for non-graphic data when small pockets of storage are needed. This is exactly as much as I know, but I think insufficient to answer the question as I can't speak as to real-life uses, importance or supply a good reference.
    – Tommy
    Commented Mar 22, 2017 at 18:38
  • 3
    I've never used Apple II, but I did some reading for the subject. What I understood: Apple II bitmap data is in 128 byte blocks. Each block stores bitmap data for 3 raster lines. On the other hand Apple II screen is 40 columns. This means only 40*3=120 bytes are required. 8 bytes at the end of each block is left unused. Those are called as memory holes. This remained me the unused upper nibbles in Commodore 64 color ram. But with a difference. Wikipedia says this graphic holes are used for firmware or expansion cards and should not be touched.
    – wizofwor
    Commented Mar 22, 2017 at 20:03
  • A similar thing on the PMD-85: The raster line is 48 bytes of memory. To simplify hardware, these are spaced 64 bytes apart. So there are 16 unused bytes of memory per raster line, which the programmer may use for any other purpose. Commented Sep 27, 2022 at 11:35

2 Answers 2

25

1. What are screen holes?

The Apple II video architecture is based around a text display of 40 columns by 24 rows. Woz had already built an ARPANET terminal for a TV, and said in his book iWoz that "Forty columns was the limit of American TVs".

To map those 40 column rows into memory sequentially would for various reasons have increased the chip count - something Woz strove to minimize. He could have mapped 40 columns to 64 bytes and wasted 24 bytes per row, but every byte was precious back then. As a compromise he mapped 3 rows to each 128 byte block, leaving 8 bytes unused in each of the 8 blocks - the screen holes.

This decision wasn't made in isolation. The larger design includes the video scanner which reads this memory (refreshing DRAM in the process) and passes it to the video generation circuit. The logic of the scanner imposes further order on the mapping: each of the three rows in one 128-byte block resides on a different third of the screen. Figure 5.4 from Sather's Understanding the Apple //e:

128-byte video memory segments consist of three 40-byte sections, each mapped into a different part (third) of the video screen

Sather's books have an excellent discussion on the how the bytes in memory map to the display for each video mode. Here are the address ranges for TEXT/LORES page 1 memory from Figure 5.5.

      TOP/         MIDDLE/      BOTTOM/      (SCREEN HOLES)
BASE  FIRST 40     SECOND 40    THIRD 40     UNUSED 8
ADDR  #  RANGE     #  RANGE     #  RANGE     RANGE
$400  00 $400-427  08 $428-44F  16 $450-477  $478-47F
$480  01 $480-4A7  09 $4A8-4CF  17 $4D0-4F7  $4F8-4FF
$500  02 $500-527  10 $528-54F  18 $550-577  $578-57F
$580  03 $580-5A7  11 $5A8-5CF  19 $5D0-5F7  $5F8-5FF
$600  04 $600-627  12 $628-64F  20 $650-677  $678-67F
$680  05 $680-6A7  13 $6A8-6CF  21 $6D0-6F7  $6F8-6FF
$700  06 $700-727  14 $728-74F  22 $750-777  $778-77F
$780  07 $780-7A7  15 $7A8-7CF  23 $7D0-7F7  $7F8-7FF

TEXT/LORES page 2 follows the same pattern - just add $400 to the addresses. In fact HIRES pages 1 and 2 also follow exactly the same pattern, but repeated 8 times each from $2000 and $4000.

In summary, screen holes are sections of video memory that are not displayed. Technically they exist in all video modes and in both Main and Auxilliary memory, but the term "screen holes" usually refers to those in Main TEXT page 1, which have special significance as discussed next.

2. What are screen holes used for?

Early Apple II's didn't always have 64k of RAM, and so low memory was special because it was always present. The 8 screen holes in TEXT page 1 must have seemed a natural fit for use by cards in the 8 expansion slots. The 1979 version of The Apple II Reference Manual has the following section reserving the screen hole locations for exclusive use by the system and expansion card firmware:

PERIPHERAL SLOT SCRATCHPAD RAM

Each of the eight peripheral slots has reserved for it 8 locations in ihe Apple's RAM memory. These 64 locations are actually in memory pages $04 through $07, inside the area reserved for the Text and Low-Resolution Graphics video display. The contents of these locations, however, are not displayed on the screen, and their contents are not changed by normal screen operations The peripheral cards can use these locations for temporary storage of data while the cards are in operation. These "scratchpad" locations have the following addresses:

Table 26: I/O Scratchpad RAM Addresses

Base  Slot Number
Addr  1     2     3     4     5     6     7
$0478 $0479 $047A $047B $047C $047D $047E $047F
$04F8 $04F9 $04FA $04FB $04FC $04FD $04FE $04FF
$0578 $0579 $057A $057B $057C $057D $057E $057F
$05F8 $05F9 $05FA $05FB $05FC $05FD $0SFE $05FF
$0678 $0679 $067A $067B $067C $067D $067E $067F
$06F8 $06F9 $06FA $06FB $06FC $06FD $06FE $06FF
$0778 $0779 $077A $077B $077C $077D $077E $077F
$07F8 $07F9 $07FA $07FB $07FC $07FD $07FE $07FF

Slot 0 does not have any scratchpad RAM addresses reserved for it. The Base Address locations are used by Apple DOS 3.2 and are also shared by all peripheral cards.

Both the Apple //c and the Apple IIgs firmware for built-in devices uses the screen holes. In addition the Apple //c uses several areas in Auxilliary memory including the Aux TEXT page 1 screen hole at $0478-$047F as documented in Table B-4 of The Apple IIc Technical Reference Manual.

4
  • 2
    I suppose this is an opinion but I never saw those "holes" as any kind of positive design. The Atari 800/400 had an arguably much better designed system, no holes, multiple modes, every scan line could be pointed to different video memory or even repeat the same memory, could have 48, 40, or 32 characters across (or rather 384, 320, 256 pixels). 48 handled overscan (covering the entire CRT instead of just a "safe" area). Not really trying to start an Atari vs Apple war. Only pointing out the holes are arguably just bad design.
    – gman
    Commented Mar 24, 2017 at 9:46
  • 5
    @gman: Sure, the screen holes were not a good thing. As I said, it was a compromise to reduce the chip count. Woz designed this whole computer by himself in 74 series chips. There's not much point in comparing that to a design in LSI chips that came out 2 years later. ; - ) Each computer system obviously reflects the experience and aim of the designer. Joe Decuir et al had a different goal. Commented Mar 24, 2017 at 11:06
  • 1
    @gman: The Apple design avoids the need to have a refresh mechanism separate from (and gobbling cycles in addition to) the video fetches. One problem with using a more flexible addressing scheme is that code which switched back and forth between video modes at particular times could cause some rows of the DRAM to be starved of refresh cycles.
    – supercat
    Commented Nov 22, 2019 at 23:23
  • @gman: BTW, while I don't fault the Apple II design for having 64 bytes that aren't used by the text screen, I do fault it for using them to hold I/O card status. Even on a 16K machine, allowing cards to request multiples of 256 bytes of RAM for scratchpad, and then having 7 bytes in low memory to say where each card's scratchpad lived, would have been a cleaner design, especially since cards could use the scratchpad to hold code that's tweaked for each card's I/O address and scratchpad location.
    – supercat
    Commented Nov 12, 2020 at 1:36
15

The book Inside the Apple //e by Gary B. Little provides excellent explanations for why "screenholes" exist in the Apple II memory map, and how they are used, by convention.

The memory for each page of the display is a 1024-byte block, but each character on the 40x24 text display uses 1-byte, for a total of 960 bytes. This leaves an unused 64 bytes in the display memory block. These unused (for display data) "screenholes" are dispersed across the 1024-byte block as 8 separate 8-byte holes. The base addresses for the 8 holes are $478, $4F8, $578, $5F8, $678, $6F8, $778, and $7F8.

By convention, each of these holes may be utilized as "scratch pad" RAM by each of the 7 peripheral cards. The convention is necessary so that other software does not stomp on these memory addresses. It is specifically set aside as peripheral "scratch pad" where each card gets 8 bytes, plus there is 8 bytes taken for DOS use. The addresses available to each card are based on which slot it occupies, and the 8 addresses assigned to the card are computed using, 's' as the slot number, thusly: $478 + s, $4F8 + s, $578 + s, $5F8 + s, $678 + s, $6F8 + s, $778 + s, and $7F8 + s.

5
  • 1
    Iirc you've only got the addresses for the first graphics page in your answer. What was the convention for the other pages?
    – wizzwizz4
    Commented Mar 22, 2017 at 21:58
  • 3
    If I understand it correctly, only the screenholes in main memory, page 1, have any convention. The usage of page 2 memory, and whether it is used at all, is left to the application. Also, AppleSoft programs normally overwrite page 2, so it doesn't even "exist" as display memory, unless you program specifically for it.
    – Brian H
    Commented Mar 22, 2017 at 22:11
  • 3
    @BrianH: The Apple //c used at least one Aux screen hole. Also, here's a better link to Inside the Apple IIe where people can download the whole book. Commented Mar 23, 2017 at 11:48
  • Unless these books are out of print it would be good to link to the authors page for them for copyright reasons. They did a bunch of research to provide their texts and should receive compensation for that. Commented Mar 23, 2017 at 13:35
  • 8
    @RowanHawkins: Unsurprisingly, all Gary's books from the 80's are out of print. He made plenty of money back in the day during an interesting and varied career and is now a real estate agent. In this interview (around 1:32:00) he said he was happy about his books being scanned and still used. In fact he downloaded a copy himself. Commented Mar 23, 2017 at 23:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .