2
$\begingroup$

I'm no cs student, I'm a programmer. I have a couple of questions and a few assumptions that I will make here (correct me if I'm wrong please).

From my understanding is that all the sequences of 1 and 0's that computers execute are just representations of actual data or instructions that tell other hardware on a system what to do like telling a graphic card to change a pixels color on the monitor.

01100001 being the representation of the letter "a" and that this sequence of bits has been chosen by the fathers of computing/ascii or what have you to represent that letter, it could just as well have been some other sequence right?

All computer systems have agreed that those bits mean the letter "a" for all of the computers around the globe to be interoperable, if there were no standards in place for this the internet would be a mess.

What I want to know is: where is the information stored on a computer that tells it that these sequences of bits here mean/represent the character "a"? Is it in the OS or directly on the motherboard or am I just completely wrong?

$\endgroup$
5
$\begingroup$

It isn't stored anywhere. 01100001 could represent anything. It could be the ASCII character "a" or it could be the integer 97 or it could even be something different entirely. It's up to the programmer to tell the computer what to do with 01100001, for instance by supplying a font file that tells it how to map binary sequences to the instructions to draw a character on the screen. Often this is taken care of in libraries but the OS and motherboard have no idea that 01100001 represents "a".

$\endgroup$
  • $\begingroup$ Interesting, do you happen to know a book/books that teaches this knowledge? $\endgroup$ – Larry Lawless Sep 5 '15 at 9:43
  • $\begingroup$ @LarryLawless You'd need a book on computer architecture. $\endgroup$ – Tom van der Zanden Sep 5 '15 at 14:55
4
$\begingroup$

The computer as is doesn't handle text, just numbers. The interpretation of the numbers computed is up to other pieces of hardware, i.e., your keyboard sends a number into the machine when you press "a", your terminal paints a image on the screen (which is defined by a memory in the terminal) which you read as "a", and so on. Take a look at the assembly language of your preferred machine. You'll see instructions to handle strings of bytes, but nothing as such that "knows" the characters are e.g. letters or say an "*". If some bits are used in an arithmetic operation, they are a number; if sent to a screen or printer, probably (part of) a character or perhaps some instruction (blank the screen, perhaps). Interpretation is up to the recipient.

In modern machines the input process is more complex, and the image painted on the screen is also the result of a much more complex process, but the basic idea is the same.

$\endgroup$
3
$\begingroup$

There are many places where the semantics of a are (implicitly) stored. Here are a few examples:

  • Fonts map the ASCII code of a to its graphic representation.

  • Dictionaries used for spell-checking contain lists of words, in which the ASCII code of a is used to represent the letter a.

  • DNS servers convert domain names to IP addresses. Some domain names include the letter a, so the databases maintained by these servers give meaning to the ASCII code of a.

  • Compilers have rules for identifier names that often mention alphanumeric characters, and in particular a. Even more, some reserved words could include the letter a.

$\endgroup$
1
$\begingroup$

The mapping between what you type on the keyboard, the ASCII letter A, and the character drawn on the screen, is stored in many places explicitly as code.

  • Fundamentally, when you first boot a computer, the BIOS code (or "the motherboard") has code to translate what comes from the keyboard (scancodes) into ASCII, and the Video BIOS (also part of the motherboard or video card) has code the draw that ascii code as the letter 'A' on the screen.

  • This mapping is repeated at the OS level, to support additional character sets beyond ASCII and additional keyboard types. For an example, see the Linux keyboard driver, where a scancode for "A" on a standard ATA keyboard is mapped to an OS-internal definition of the letter "A" (called KEY_A, see http://lxr.free-electrons.com/source/drivers/input/keyboard/atakbd.c#L113), and then the Linux kernel maps that to the ASCII code for A (see http://lxr.free-electrons.com/source/drivers/tty/vt/defkeymap.map#L75)

Only standards define these character mappings; a notable alternative is EBCDIC used on mainframes.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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