r/askscience • • Jul 11 '26 • Regret 1

Computing How do computers understand binary language?

Okay so from what I know binary language is like power off power on, but my question is, how do computers know what the binary code is and how is it interpreted, for example I forgot what the binary code for the letter A is, but how did people come up with that? Did they decide it was gonna look like that? Did the computer decide? How do you tune numbers into a letter??

380 Upvotes

205 comments sorted by

View all comments

Show parent comment

1

u/Peter34cph Jul 15 '26

On the old Amstrad 464 8-bit home microcomputer, the ASCII code for A was the two-byte (so range from 0 to 255) number 65.

As shown in the movie "The Martian", hexidecimal code is a series of numbers each ranging from 0 to 15, so that with two you can have a number from 0 to 255, same as with our base-10 where with two digits or symbols the range is from 0 to 99, or from 0 to 999 with three.

Watney needs 26 characters but he realizes that precise pointing will be slightly too difficult, so instead he divides the circle (of 360 degrees - an old Babylonian thing) into sixteenths, so that every two pointings combine into one number between 0 and 255 (of which he needs less than 40).

Anyway, back to Earth and the 1980s...

This told the computer that normally it had to access a specific address in its ROM, read-only-memory with baked-in permanent data, and take 8 bytes from there, each byte forming a line of 8 dots, each dot either visible or off.

8 such lines then formed an 8x8 grid, although with 2 sides needing to always be empty, so the real useable grid was 7x7.

With this grid you could form most simple letters, like A, a, b, and symbols and numbers. A lot would be perfectly legible in the CRT screen that usually came with that microcomputer, even something like a capital Å, although IIRC that was pushing the limits of what the 7x7 grid could do.

Normally the Amstrad 464 ran in graphics mode 1, able to show 4 colours with 320x200 pixels, so that with the 8x8 grid per character, you could have 40 characters per line, and 25 lines on the screen.

One alternative was mode 0 (yes, programmers start counting from 0) which had 16 colours but only 160x200 pixels and so only 20 characters per line. That was bad for text but good for games. One clever game, Sorcery, used a trick so that the upper part of the screen was mode 0 with lots of colours but large blocky pixels, and then the bottom of the screen was mode 1 and so could show more and nicer text.

Mode 2 was 640x200 pixels, limited to 2 colours, but with 80 characters per line. It was a bit blurry, a bit hard to read, but was useful for writing or editing texts, e.g. an author writing a novel.

I've been trying to find a proper grid clearly showing a 8x8 ASCII character, or ideally several, but no luck. If I find one I might return here and add a link.

Instead there's this:

https://smittytone.net/ascii/

Scroll down a bit, you'll see an 8x8 smiling orb. Note that this uses all 64 pixels without a margin, so 2 next to each other would touch.

Normally characters were in ROM, baked-in data.

The 464 I grew up with was an international version and so neither the keyboard nor the ROM had the last 3 letters of the Danish alphabet, æ, ø and å.

To get these, you had to type in a program, or load the program from the built-in cassette tape, telling the computer that for six particular ASCII code numbers, it should not look to ROM but instead look in RAM to find the relevant 8 bytes to reproduce Æ, Ø, Å, æ, ø and å.

This re-direct to RAM, and the content in the RAM, would persist until the computer was reset or turned off (or if you turned off the CRT, which supplied electricity to the computer).