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?

4

4 Answers 4

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.

14
  • 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. Commented Aug 26, 2014 at 20:33
  • 12
    @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
    Commented Aug 26, 2014 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. Commented Aug 26, 2014 at 21:14
  • 9
    @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
    Commented Aug 27, 2014 at 17:27
  • 4
    @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
    Commented Aug 28, 2014 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.

0

The 8 bit byte came into being with the IBM System 360. It was announced 60 years ago today, on April 7, 1964. The new computer’s name derived from the fact that its architecture encompassed both commercial and scientific processing, so comprised all 360 degrees of the circle. Each 8 bit byte was able to form an addressable character i.e. a digit, letter or special character. The CPU could do decimal arithmetic. But it was also a word machine able to process 32 bit words for floating point computations.

Before that time, commercial computers were based on 6 or 7 bit addressable bytes, sometimes called characters, coded in BCD, binary coded decimal. Scientific comouters were word machines with varying number of bits per word.

As far as I know, most present day comouters still use the 8-bit byte. The use of hexadecimal was a convenient way to represent byte contents, with two hex digits used for each byte. At 4 bits each, hex was much easier to write than the binary notation. Thus the contents of a single byte representing the number “3” is shown on a memory dump as: F3 which in binary is 11110011

-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.

17
  • 13
    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
    Commented Aug 27, 2014 at 8: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? Commented Aug 27, 2014 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. Commented Aug 27, 2014 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
    Commented Aug 27, 2014 at 14:54
  • 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
    Commented Aug 27, 2014 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.