Chapter Three

3.1. Computer Basics

At this point, i'm afraid we have to get a little more technical. No, STOP! Don't start turning the page! It won't be that bad! However, some of these concepts are a bit strange at first, but don't worry if you don't pick it up straight away, just aim at becoming familiar with the jargon. It doesn't really matter whether you understand it or not, you can always come back to it and have another look later, it might mean more when you've got a more solid context to put it into.

The basic unit of information that computers work with is called a "Binary digIT" - almost always known as a "bit". One bit on it's own can represent the values '0' or '1' (or 'off' or 'on') (or 'yes' or 'no'). For pretty well all purposes they are referred to as '0' and '1'.

Inside the computer these values are represented by two different electrical voltages. But mostly, when the computer takes in or puts out data, they are represented in a different way. This is because these electrical voltages don't travel very far down wires, you can't put them onto disks and of course they mean fuck all to humans!

So for sending down phone lines etc, they have to be converted into sounds similar to tone dialling in a telephone. For storing on disks, which are basically the same material as audio tape, they have to be converted into something similar to sound, but higher pitched. And of course, for communicating with people they get converted to and from text (via keyboard, screen and printer), graphics or sounds.

When the computer is working with text (letters, numbers etc) it's represented by groups of bits. Each character has its own code and it's these codes that the computer actually manipulates.

3.2. ASCII

The most common system of character codes is called ASCII (this stands for American Standard Code for Information Interchange). There are others, but you're pretty unlikely to ever come across them.

Ascii codes are made up of 7 bits. There are 128 possible combinations of 7 bits. Therefore, standard ascii has 128 characters. This includes 10 digits (0-9), 26 capital letters and 26 lower case letters, as well as the other normal symbols you find on a keyboard, e.g. &,$,!,@ etc. The rest of the character set consists of control characters which are used for special (and often different) purposes by software.

It's important to bear in mind that these characters have no significance whatever to the hardware, which always works with the binary codes for them and never sees anything other than collections of 1s and 0s.

The next most basic unit of information that computers work with is called a "byte". A byte is a group of 8 bits. there are 256 possible combinations of 8 bits. A byte can be viewed as a number and its maximum value can be 255 (as one of the combinations equals zero). That is a byte can have any value from 0-255.

As the byte is a pretty well universal form of data, this means that if you use a byte for each character (which is normal) you *could* have 256 characters instead of the 128 which ascii has. IBM-type computers make use of this possibility by having an extended form of ascii which allows an extra 128 characters. However, as not all computers use the whole 256 characters and the ones that do use the extra 128 in different ways, this extended code isn't a lot of use for communicating with other computers.

The extra 128 characters are known as IBM codes and it's best to avoid using them in a network setup.

It's important to remember that bytes are used to represent other things than characters too. Computer programs are stored in exactly the same format. Only here, the bytes represent the codes for processor operations and addresses of data and software. As well as this, they can also be used to represent their numerical value for mathematical operations within the computer. It's also possible to allocate an on/off meaning to each bit and this could be used to convey all sorts of things from one bit of software to another.

So if you try and look at a software file as if it was a text file, you'll get completely meaningless nonsense. Or if you try and get the computer to run a text file as if it was software, completely unpredictable things will happen and the computer will almost certainly crash.

In the system used by DOS for naming files, this is taken care of to a certain extent. DOS file names have the form: <filename>.<extension>

e.g: thisfile.txt

'thisfile' is its name and 'txt' (the extension) indicates what type of file it is. txt = text (that is, straight ascii usually).

other file types inclued:

.com
program file
.exe
program file
.bat
batch file (instructions for DOS to use almost like a program)
.bin
binary (could be program or data)
.doc
document (usually word processor format)
.asc
ascii
.sys
system files
.zip
file compressed with PKZIP compression
.arj
file compressed with ARJ compression
.lha
file compressed with LHARC compression
etc.

The last three will need to be uncompressed with the correct uncompression program.

For text files it's always best to use an extension of .txt or .asc , although you will find text files with all sorts of extensions.

3.3. Binary

So what is this "binary" shit, anyway? Well, in decimal, every digit represents a value from 0 to 9 and every time you move one digit to the left, its value is multiplied by 10. In binary, every digit represents the value 0 or 1 and every time you move one digit to the left its value is multiplied by 2.

In decimal notation this means the value of the digits (from right to left) is as follows:

1s, 10s, 100s, 1000s, 10000s etc

In binary notation the values are:

1s, 2s, 4s, 8s, 16s, 32s, 64s, 128s etc

Put the right way round, that means:

128, 64, 32, 16, 8, 4, 2, 1

That is what the eight bits of a byte represent.

Examples

Any binary value can be converted to decimal by working out and adding up the values of all the 1s. e.g.:

10110010 = 128+32+16+2 = 178

I'm afraid that's as good as i can explain it. If it doesn't make sense, you'll have to keep trying or get someone else to explain it differently. It's important to understand this stuff, although it's possible to get by without it. The more of these basics you understand, the easier it will be to sort out problems later.

And if you thought that was weird, have a look at this:

3.4. Hexadecimal

Because of the need to work with these binary values and because binary numbers are so long and hard to remember and express, a shorthand notation is used. This is called hexadecimal (because each digit can represent 16 different values).

In the way that in decimal each digit can have values from 0-9, in hexadecimal each digit can have a value from 0-15. The digits from 10-15 are represented by the letters A-F. So the complete range of hex digits is:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f.

Right, what's all this got to do with binary? Well, if you group binary values in chunks of four bits, each four bits can have 16 different combinations and therefore numerically can represent values from 0-15. The same as each hex digit! Hey!

Therefore, a byte can either be represented as 8 binary digits or 2 hex digits. Or, of course, 3 decimal digits. As hex is more handy than binary, while still being really easy to convert to binary, and decimal is really difficult to convert to binary, hex is very commonly used in all fields of computing.

Here are the binary and decimal equivalents of the 16 hex digits:

        binary  hex  dec
        ------  ---  ---

        0000     0    0
        0001     1    1
        0010     2    2
        0011     3    3
        0100     4    4
        0101     5    5
        0110     6    6
        0111     7    7
        1000     8    8
        1001     9    9
        1010     A   10
        1011     B   11
        1100     C   12
        1101     D   13
        1110     E   14
        1111     F   15

So 10110010 = B2 (hex) = 178 (decimal)

click here to go to chapter four