free software resistance
the cost of computing freedom is eternal vigilance
### tcoyc-what-even-is-a-computer
*originally posted:* nov 2023
fundamentally, a computer is a calculating machine- it processes data in numeric form.
all information that comes out of the machine will be numeric before that, and all information that goes into the machine has to be made numeric before the computer can use it.
the point of having a computer is that it works with the numbers for you- you can, when it suits you, get your hands dirty and work with numbers directly- for the most part though, you dont want to do that and neither do i.
you might think it would get confusing for everything to be a number, i mean if you give a number to every colour and a number to every letter of the alphabet, how are you supposed to do anything else with those numbers? if 1 is red and a is 97, whats 98, red-colour a?
our own numbering system gives us a hint:
we have ten digits, 0 through 9. sadly, none of these digits can express how many there are: the most we can count to with a digit is 9!
fortunately, it was figured out a long time ago that 1 could also be ten, with a little help from 0:
10
so isnt it confusing that one is also ten? not really, because it depends on the LOCATION of the 1. if its in the ones place, it means one. if its in the tens place, it means ten- and so on.
when you (or more often, a program) put numeric information into the computer, what it represents depends on where that number is. most of this context isnt hard-wired into the machine, rather different areas are set up to do certain things, and then when a program goes back to that area its expecting information in a certain context.
we can drastically oversimplify this by having you imagine a value representing the "data mode" of the computer: if the mode is 1, numbers are just numbers; if the mode is 2, numbers represent colour. mode 3 would represent special things the computer does to information- instructions.
but even though the computer is very complex, and the "mode" explanation is just a metaphor, the computer is really just constantly moving numeric information around and doing calculations with it.
your computer screen has a million or so little lights on it, each one of those lights is made of 3 smaller lights, and those 3 lights are lit at one of 256 different intensities to make each possible colour. the computer isnt designed to care which colour it is, just to make sure the light is lit at whatever level of brightness is represented by the relevant number.
sound works by measuring voltage thousands of times every second. these voltage levels are normalised into specific numeric ranges, so the computer can process sound mathematically. and "a" really is represented by the number 97, but only since the 1960s when that was made a standard. there was a different standard before that, used by electronic typewriters that work over radio or phone lines.
it is rare that you will need to know that "a" is 97. it follows that "b" is 98, and it is- but obviously if you were typing this line of text you wouldnt put in numbers for every letter, you would press the key that says "a" and it would show up on the screen. similarly, if youre writing program code that uses the letter a, most often you would just use the letter itself- the computer will convert it to 97 for you.
all of this came out of the effort to make machines that sort information and do calculations. even instructions for operating the computer are numeric, but thanks to a woman named grace hopper, we can instruct the computer in an almost english-like language.
this predates the sort of translation you see on computers today, where english can become korean and vice versa, and doesnt require the computer to know english at all. instead, the simplest computer instructions (which just move numbers around) are combined to do more sophisticated tasks, and these tasks are given simple names which are then given a sort of index.
when you give the computer an instruction that looks like english, such as "print"- the computer uses this index to find the instructions associated with that command- it then runs or stores those instructions, then it moves to the next command.
because of this, we can instruct the computer to do something very simple and arguably pointless, like say hello:
```
echo "hello"
```
and maybe you wonder- whats the point of telling the computer to say hello if you have to type it yourself? why not just write "hello" by typing it?
for a computer to do things for you, its useful for it to be able to receive and also give instructions, and there are times you want the computer to be able to ask the user to clarify what they want. the answer will generally be preset to do something specific as a response to specific things the user does- such as clicking "ok" or typing "yes".
when the computer moves to a different part of the program code than just running every command consecutively, this is called branching. "input" from a user can result in the computer branching to a first, second or other location of the program, depending on what the user does.
when the computer does things based on certain criteria that may vary, its called a conditional instruction.
grace hopper didnt invent coding, but she did make it much easier for most people. before her work on programming languages, programming was based largely on numbers and other symbols- hoppers innovation was to move to full english phrases.
one phrase always did the same thing, its meaning was not discerned based on english comprehension but a simple dictionary lookup- one phrase always implied one group of simple commands the computer could understand. "translation" was as simple as looking up a name from a table, going to a certain location- and running the commands located there.
in terms of usage, hoppers system was unpleasantly verbose, but revolutionary. most languages today, rather than being based wholly on english, are based on a mix of single words, terse abbreviations, and the symbols that hopper worked hard to make optional. it is still possible to write in cobol, a language based directly on hoppers ideas and software- but most people prefer to work with a "language" somewhere between english and symbols.
for those not familiar:
a file with many lines of code for doing a particular task is called a program.
programs and program code are called software.
software designed to run and manage other software while interfacing with the machine directly on behalf of other programs is called an operating system.
and programs that translate more abstract code into things the computer can understand are called compilers, or interpreters.
the difference between them is a compiler takes code and outputs more code that is translated. an interpreter translates code and runs it, rather than simply outputting it to another file.
it isnt necessary to know all of these concepts, as if you were memorising them for a quiz. they are useful for discussing how computers work- for example if you do not have an operating system, it is most likely going to be very tedious to do anything with your computer.
mostly, its good to know the genesis of modern computing- to help understand modern computing. everything you do on the computer today, is built on the concepts mentioned in this chapter.
license: 0-clause bsd
```
# 2019, 2020, 2021, 2022, 2023
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```
=> https://freesoftwareresistance.neocities.org