I'm working through The Elements of Computing Systems when I read the following excerpt:
The Hack computer includes a black-and-white screen organized as 256 rows of 512 pixels per row. The screen's contents are represented by an 8K memory map that starts at RAM address 16384 (0x400). Each row in the physical screen, starting at the screen's top left corner, is represented in RAM by 32 consecutive 16-bit words. Thus the pixel at row r from the top and column c from the left is mapped on the c%16 bit (counting from LSB to MSB) of the word located at RAM[16384 + r * 32 + c%16]. To write or read a pixel of the physical screen, one reads or writes the corresponding bit in the RAM-resident memory map (1 = black, 0 = white).
So, if the screen is 256 rows of 512 pixels, and each pixel is a single bit, how is that an 8K memory map for the whole screen?
256 rows * 512 bits = 131072 / 8 bits per byte / 1024 bytes per K = 16K
Wouldn't that be a 16K memory map?
The only thing I can think of is that because the word size is 16 bits, maybe this plays a factor? I have always known "byte" to mean 8 bits, but if its definition is dependent on the word size of the computer, maybe that would solve this mystery for me. Can someone explain to me how the screen described in that paragraph is represented with an 8K memory map and not 16K?