Binary is a Base-2 number system, and is the lowest level language a computer can read. Binary is composed entirely of 1''s and 0's. Every number in Binary is a bit, every four is a nibble, and every eight is a byte. Binary is read from right to left, with each instance of the number 1 representing a number. For example:
8 | 4 | 2 | 1 |
0 | 1 | 0 | 0 |
This is the number 4, as there is a 1 in the 4 position.
Binary addition is best done vertically. To add two binary numbers, write them out, one above the other. From left to right, if there is a single 1 in a column, then there will be a 1 in the same column in the answer. If there is no 1, it will be 0 in the column. If there is two 1's, there will be 0 in the column, and the one will carry over to the next column. If there is 3 1's, (two in the columns and a carryover) the answer will be 1 and it will carry over. If a number ends up being repeatedly carried until the end of the byte, until there is nothing left to carry it to, an extra number is added on the left which will be 1. Here is a picture showing binary addition:
Hex
Hex is a Base-16 number system. The first number represents a multiple of 16, e.g. if the firsay
t number is 5, it means 5 * 16. The second number is added onto the first, so 52 would be: 16 * 5 + 2. Hex also uses letters, after going from 0 - 9, it goes from A - F, giving 16 usable numbers. Therefore, A = 10, B = 11 ... F = 15, so 9A would be: 9 * 16 + 10 = 154.
A Bin - Hex - Dec conversion table. |
ASCII
ASCII stands for American Standard Code for Information Interchange, and is a set of 127 codes that are used to represent standard and commonly used characters in text, or a Character Set. There are 52 codes for al alphabetic symbols, upper and lower case, 10 codes for numeric symbols (0 - 9), 33 codes for punctuation, space, and other symbols, and 32 for non-printable control codes. As there are 127 codes, and 01111111 = 127, the entire ASCII Character Set is only 7 bits.
When 8-bit computers became more common, ASCII was updated to use 8-bits, adding an extra 128 characters. The Unicode system uses 32 bits (4 bytes) and allows more than 4 billion values.
Instruction Set
An instruction set is all the instructions a CPU can execute, in a form more readable by us. Instructions include things such as Arithmetic (addition, subtraction, etc); logic and logic gates (and, or, not); data instructions, such as move, store, load, save, etc; and control flow instructions like goto, call and return.
Instruction Sets are different depending on the processor, however most AMD and Intel 32-bit processors will have extremely similar instruction sets, with many of the same instructions to avoid certain programs having incompatibilities on some processors. ARM processors will usually have a completely different instruction set as they are more focused on smaller devices such as phones, tablets, portable games consoles and more.
An example of there being major differences between instructions sets was in the competition between 64-bit architectures for CPU's. Intel's Itanium CPU's were competing with AMD's x86-64, and both worked very differently. AMD opted to use 32-bit instruction sets with 64-bit instructions added in, while Intel went only with 64-bit instructions. Ultimately, AMD won and Intel switched to their 64-bit architecture, as it still supported x86 instructions, but added x64 ones, however Intel still introduced a few differences.
Data Sizes
Bit = 1 unit
Nibble = 4 units
Byte = 8 units
Kilobyte = kB = 1024 bits
Megabyte = MB = 1024 kilobytes
Gigabyte = GB = 1024 megabytes
Terabyte = 1024 Terabytes
Images - I love penis
Images are represented with binary numbers. The Metadata located at the start of the image files gives information such as the resolution, colour depth, width and height. Without this, the image might appear as just a string of 1's and 0's with no shape. Colour Depth is the number of colours that can be displayed in the image. For example, a colour depth of 1 bit can represent 2 colours, 1 and 0, often used to show black and white. A depth of 2 bits allows 4 colours and so on. This is how a bitmap image is stored. A vector image is stored as a formulae and won't lose quality when being resized, as it recalculates all the points, lines and curves of the image, instead of enlarging each pixel like with bitmap.
Sound
Sound is an analogue format. T store it on a computer we need to convert it into a digital format. To do this we measure the frequency/loudness at regular intervals. These are called samples. The bit rate is the number of bits sampled in a given time. Sound files are often quite large, this means we have to compress them into a format like MP3, which is compressed using an algorithm that removes unnecessary sounds.
Compilers
Instruction Set
An instruction set is all the instructions a CPU can execute, in a form more readable by us. Instructions include things such as Arithmetic (addition, subtraction, etc); logic and logic gates (and, or, not); data instructions, such as move, store, load, save, etc; and control flow instructions like goto, call and return.
Instruction Sets are different depending on the processor, however most AMD and Intel 32-bit processors will have extremely similar instruction sets, with many of the same instructions to avoid certain programs having incompatibilities on some processors. ARM processors will usually have a completely different instruction set as they are more focused on smaller devices such as phones, tablets, portable games consoles and more.
An example of there being major differences between instructions sets was in the competition between 64-bit architectures for CPU's. Intel's Itanium CPU's were competing with AMD's x86-64, and both worked very differently. AMD opted to use 32-bit instruction sets with 64-bit instructions added in, while Intel went only with 64-bit instructions. Ultimately, AMD won and Intel switched to their 64-bit architecture, as it still supported x86 instructions, but added x64 ones, however Intel still introduced a few differences.
Data Sizes
Bit = 1 unit
Nibble = 4 units
Byte = 8 units
Kilobyte = kB = 1024 bits
Megabyte = MB = 1024 kilobytes
Gigabyte = GB = 1024 megabytes
Terabyte = 1024 Terabytes
Images - I love penis
Images are represented with binary numbers. The Metadata located at the start of the image files gives information such as the resolution, colour depth, width and height. Without this, the image might appear as just a string of 1's and 0's with no shape. Colour Depth is the number of colours that can be displayed in the image. For example, a colour depth of 1 bit can represent 2 colours, 1 and 0, often used to show black and white. A depth of 2 bits allows 4 colours and so on. This is how a bitmap image is stored. A vector image is stored as a formulae and won't lose quality when being resized, as it recalculates all the points, lines and curves of the image, instead of enlarging each pixel like with bitmap.
Sound
Sound is an analogue format. T store it on a computer we need to convert it into a digital format. To do this we measure the frequency/loudness at regular intervals. These are called samples. The bit rate is the number of bits sampled in a given time. Sound files are often quite large, this means we have to compress them into a format like MP3, which is compressed using an algorithm that removes unnecessary sounds.
Development Software
To develop software, a variety of tools can be used. An Editor is the most necessary, it's like a text editor that doesn't save formatting. Some editors will have extra features such as "Pretty Printing", which indents colour codes things in your code like loops, variables and functions for easy identification. Editors will often add line numbers to the side of the editor, so you can easily pinpoint exactly where a problem is during debugging. Editors with expanded features that are often more focused towards one language are called IDE's, or Integrated Development Environments.
Sublime Text, a popular code/text editor |
Compilers convert high-level source code (high-level being programming languages designed to read more like English, like C++ or Java) into machine code that can then be run by the CPU. Compilers are available for practically every language, and often come integrated into more feature-rich editors (Such as Microsoft Visual Studio and Eclipse).
Code::Blocks, a C/C++ editor that includes several different compilers to use. |
Interpreters
Interpreters also translate high-level code into machine code, however they do it a line at a time, executing the code as it comes. This makes them useful for debugging as they spot errors immediately. The downside to this is that the interpreter has to be on the users machine when the program is run, which in turn uses up more RAM and means that the program can only be run if you have the correct interpreter.
Assemblers
Assembly Language is a way to write low-level programs without using Binary Bit Patterns. Assembly language, along with machine code are both low-level and allow the programmer to control the CPU's operations directly. Assembly Language is specific to the processor and will vary by manufacturer, for example, Intel uses a completely different assembly language to Samsung. Each assembly instruction translates to one machine instruction, and they have to be translated into machine code before they can be run. This is what the assembler is used for.
Linkers
Programs are often made from different sub-programs, and are often made by different people using different tools. A Linker is a piece of software that merges these applications together into a finished program.
Assemblers
Assembly Language is a way to write low-level programs without using Binary Bit Patterns. Assembly language, along with machine code are both low-level and allow the programmer to control the CPU's operations directly. Assembly Language is specific to the processor and will vary by manufacturer, for example, Intel uses a completely different assembly language to Samsung. Each assembly instruction translates to one machine instruction, and they have to be translated into machine code before they can be run. This is what the assembler is used for.
Linkers
Programs are often made from different sub-programs, and are often made by different people using different tools. A Linker is a piece of software that merges these applications together into a finished program.
No comments:
Post a Comment