28

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?

user1861499
  • 311
  • 1
  • 3
  • 3

3 Answers3

22

Yes, a byte is always 8 bits in modern computing.

The book uses Words, not bytes

In the book, the word and the size of the word is explicitly mentioned, while there is not a word (haha) about bytes. Look at the phrase ..is represented in RAM by 32 consecutive 16-bit words.. The whole size is expressed in (16 bit) words rather than bytes.

Therefore, 8K refers to 8 Kilowords. 8 kilobytes would formally be written as 8KB, if that notation is used at all in this book.

Words are quite important when it comes to processor architecture. Words in programming languages are usually 2 bytes (or 16 bits), but in processor architecture they can be 8 or 32 bits as well, and they refer to the natural size of the data units with which a processor works, so it makes sense that the book uses words rather than bytes, since the text seems very hardware oriented.

To see how bytes and words are related, please read this answer.

Different byte sizes

Wikipedia describes how a byte was originally (1960s) based on the size of information it needed to hold, so a 6 bit byte could be used for (English) characters, while bytes of other sizes would be used for different number formats. It started out as 6 bits for English characters, grew to 7 bits to support ASCII, and eventually the popularity of the 8 bit IBM System/360 caused the global acceptance of 8 bit bytes.

A byte is a software unit representing an amount of data, while a word is more tied to the processor/memory architecture and represents work units (registers) in the processor and the addressable units in memory. Nowadays though, a byte is always considered to be 8 bits, and words are a multiple of that. There are still processors around that have a different word size, but those are special purpose processors. Normal hardware, from PCs to phones and game consoles follows the standard.

Community
  • 1
  • 1
GolezTrol
  • 114,394
  • 18
  • 182
  • 210
  • 1
    No one has ever had 7 or 9 bit words. Word widths are almost always powers of two, perhaps allowing for parity or excluding the parity bit. A nine-bit wide memory did not have 9 bits, the extra bit automatically computed parity, so only 8 were usable. And when there were only 7 accessible bits, it was because one of the bits in an 8-bit byte was fixed to compute parity. These are still eight-bit bytes. – Jon Jay Obermark Aug 26 '14 at 20:33
  • 10
    @JonJayObermark - You are quite wrong. Just about every possible word length has been used at one time or another. And parity was a luxury that few could afford until ca 1970. – Hot Licks Aug 26 '14 at 20:49
  • For example... Give me a real machine that had words (not collections of bits, but addressed words) and chose to make them an odd number of bits long. Also parity is almost irrelevant now, but it was important because of the low quality of memory in the past. Every machine I have used from the 70's, even handheld video games, had built-in parity. Before integrated circuits we are not talking about words in the same sense. – Jon Jay Obermark Aug 26 '14 at 21:14
  • *"Before the mid-1960s, characters were most often stored in six bits; this allowed no more than 64 characters, so alphabetics were limited to upper case. Since it is efficient in time and space to have the word size be a multiple of the character size, word sizes in this period were usually multiples of 6 bits (in binary machines). A common choice then was the 36-bit word, which is also a good size for the numeric properties of a floating point format."* -- [Wikipedia](http://en.wikipedia.org/wiki/Word_(computer_architecture)#Word_size_choice) – GolezTrol Aug 27 '14 at 07:57
  • OK, so in the PDP-8 era it was six and twelve, still no support for seven or nine as computer word sizes. I have used Techtronix machines with six-bit words, that is why I said ALMOST. But looking at memory that is really eight bits wide with parity as though it were intentionally seven or nine bits wide is misconstruing the intention and the design. – Jon Jay Obermark Aug 27 '14 at 13:35
  • Also, I did not object to 6, it is not a misunderstanding, and not an odd number. But 7 and 9 bit bytes are from later in time, and to think of them as real, intentional, word lengths is a misunderstanding. – Jon Jay Obermark Aug 27 '14 at 14:47
  • Phew, fortunately there is still the 6 bit one, so the core of the answer: "No it has not always been 8" is at least true. By 'odd' I meant 'other than the usual 8', but that wasn't the most practical term to use, I admit. You have made me curious about how to fit a 9 bit word with parity into an 8 bit byte, though. – GolezTrol Aug 27 '14 at 14:53
  • There are nine physical bits, but only eight of them are delivered in response to a memory read. If the ninth does not match those in parity, an interrupt ensues. The combination is still called a byte, because it does not really contain nine bits. But you have to buy nine-bit memory for it. You can also rig up eight-bit memory to have the high bit act as the parity bit, usually on machines that just process ASCII text. – Jon Jay Obermark Aug 27 '14 at 15:19
  • I still think the word would have died an early death if it had not also been convenient to read 1Kx8 as 'one Kilobyte' rather than 'one Kiloword by eight' – Jon Jay Obermark Aug 27 '14 at 15:25
  • And, in some sense the six-bit example is from before byte meant what you are even talking about. In the PDP-series sense, multiple 6-bit words were part of a larger 'byte' of memory which was processed as a chunk. The six-bit word itself was not meant to be a byte. (Just so there is some interesting content here and not just quibbling.) We seem to have totally inverted their usage in modern usage, where a 32-bit operand is not a byte, but made up of them. – Jon Jay Obermark Aug 27 '14 at 17:02
  • 6
    @JonJayObermark - I worked with two different micros inside IBM ca 1975. One had 15-bit words (so there could be a parity bit in 16 bits) and the other had 17-bit words (to efficiently use 9-bit "byte" RAM and have 1 bit parity). – Hot Licks Aug 27 '14 at 17:27
  • I am glad nothing that stingy actually gained a foothold. Normal humans would deal with the 15, no one needs the high-bit on characters anyway. But the 17 could make text processing kind of weird. To transmit something on RS-232 or something, you would have to keep skipping one bit on every pair. – Jon Jay Obermark Aug 27 '14 at 18:10
  • 3
    @JonJayObermark - This was back when everyone and his brother was designing a micro, and the push was to squeeze the most function possible out of the available gates. Mostly micros in this range were viewed as supporting emulators, and in an emulator an extra bit can often be quite powerful. – Hot Licks Aug 28 '14 at 21:52
4

In modern terms there are always 8 bits to a byte. This has been since 1993 IIRC. ISO/IEC 2382-1:1993.

There have however also been systems with other bit counts to a byte 6 bits/7bits have been common. There are however other more obscure ones.

At the end of the day I think it would be rare to find a machine today that was not based on 8 bits to a byte.

Greg Young
  • 2,513
  • 1
  • 21
  • 13
-6

Except perhaps for a brief period after its coinage, a byte has always been eight bits.

The phrase 'one kilobyte' got popularized as 'one kilo by eight', in the sense that you would have a kilo-word (1024 addressable pieces) of memory that was eight bits 'wide', in that each addressable piece was eight bits.

The word was not always eight bits, but when it was not, it was never referred to as 'by eight', it was 'by four' or 'by sixteen', or in the egregious example of some Burroughs bookkeeping machines 'by one-hundred-twenty-eight'. At the other extreme, Honeywell machines originally were organized so that every individual bit in storage had a unique address, so they would have so-many 'kilo by one' memory packages.

In the case of the machine you are talking about it would have "8 kilo by 16" memory, thus an 8K memory map, specifically 8Kx16, where there are only 8192 addresses, and each is 16 bits wide.

It was cheapest, given ASCII and EBCDIC, to have eight-bit address boundaries, for efficient text processing, even when your machine's registers were wider. Machines with narrower registers simply went extinct.

So, yes a byte IS always eight bits, and almost always has been.

  • 11
    Do you have a reference for *"The phrase 'one kilobyte' originates as 'one kilo by eight'"* Sounds good, but researching the etymology of byte suggests this is BS, not CS! – weston Aug 27 '14 at 08:20
  • It is hearsay, from I think, "The Hacker's Dictionary". We know it was originally 'bite', and the spelling was changed by someone at IBM on purpose to avoid confusion. But why would one hear 'bite' to begin with? – Jon Jay Obermark Aug 27 '14 at 14:32
  • I guess the argument is that if this is not the influence, why were six-bit words not also called 'bites'? And you did (perhaps do, I have done no hardware since 1987) specify memory this way: 16Kx9, for a block of parity memory that used to go in a small machine. – Jon Jay Obermark Aug 27 '14 at 14:50
  • 2
    It means 8 bits now, but I can find plenty of evidence that at one time it was an ambiguous, platform dependent term. – weston Aug 27 '14 at 14:54
  • OK, I guess that as officially coined by Buchholz this is not eight bits. But I am still betting there is an influence here. – Jon Jay Obermark Aug 27 '14 at 14:58
  • Well he's still around, 91, maybe he's on twitter and you can ask him! – weston Aug 27 '14 at 15:07
  • @JonJayObermark Please note that this whole byte size discussion should be merely a side note in the discussion. OP asked because the text they read suggested a 16 bit byte, but that was a misunderstanding of the text, which was about words rather than bytes. I just referred to the early period of non-standardized byte size for trivia, and I never meant this to be an extensive discussion about which-byte-sizes-could-(not)-have-existed-in-which-period-and-why. – GolezTrol Aug 27 '14 at 15:11
  • @weston Words arise out of a confluence of multiple interactions. His personal thinking on the issue, as the defined source, matters less than the thinking of the people that popularized the usage. E.g. Clearly 'meme' does not now mean what Dawkins meant when he originated it. (It now means something much dumber.) Asking Dawkins about it wouldn't help. – Jon Jay Obermark Aug 27 '14 at 15:28
  • Maybe it is just literally a bite out of the information. As in 'bite size chunks'. – GolezTrol Aug 27 '14 at 15:33
  • 1
    You can't say the word originates from by-eight unless the guy who coined it says so. Other people may come up with that later as a handy way to remember, but that can't change the origin. – weston Aug 27 '14 at 15:36
  • That may have been his initial thought. I will temper my ALWAYS. But without the extra etymology I bet we would not have the word. So I am not deleting the post. – Jon Jay Obermark Aug 27 '14 at 15:37
  • "a brief period"? Term coined in 1956. Random example machine I found, the [PDP-10](http://en.wikipedia.org/wiki/PDP-10) **first** produced in 1966. – weston Aug 27 '14 at 15:41
  • By the way I'm not a downvoter and I don't want you to remove the post. It's an interesting point. – weston Aug 27 '14 at 15:47
  • But that use of the word is not the same as this one. That kind of operation is the exact opposite of for instance byte operations on a x86, where we do not address an arbitrary sequence of bits as a whole, but instead a given number of characters individually. If that word and this one are even the same word, the meaning is different. That use would not help any discussion, for instance, of memory maps, at all. – Jon Jay Obermark Aug 27 '14 at 16:07
  • We surely do not mean by 'byte' any contiguous set of bits that may be addressed as a whole. We mean the boundaries in an address space. In that model, those are very strangely related. That setup is more like the 128-bit word example above, where you cannot address the bytes that represent individual characters, you have to treat any sub-128-bit-address chunk as work on the whole word. – Jon Jay Obermark Aug 27 '14 at 16:14
  • Perhaps the modern usage began as a mal-appropriation of the word. – Jon Jay Obermark Aug 27 '14 at 17:06
  • *bini* → *binarius* → binary ; *digitus* → digit ; binary-digit → bit → bite → byte ; half-byte → nibble/nybble – voices Aug 21 '18 at 14:03