answersLogoWhite

0

What is code formatting?

Updated: 9/22/2023
User Avatar

Wiki User

11y ago

Best Answer

There is no single format. Binary code is merely the representation of numeric information encoded in binary. Humans use the symbols 0 and 1 to symbolise the binary digits (bits), but computers have no notion of a number let alone the intelligence to interpret the difference between a 1 or a 0. However, binary information can be encoded in many different ways.

In the early days of computers, the computer was programmed through a front panel of switches. The computer had several modes of operation which could be configured by turning these individual switches on or off. Once a configuration was set it could be committed to the computer's memory, which effectively copied the state of these switches to a much larger set of switches laid out in a large array, where each element in the array represented a separate instruction. Once all instructions were stored, they could be executed by copying them one after the other to the instruction register, another series of switches that actually set the mode of operation. By rapidly switching from one mode to the next, the computer was able execute a sequence of very simple instructions extremely quickly.

In order to encode these instructions so that the programmer could configure the input switches correctly, the instructions were encoded in binary notation using 1s and 0s, where a 1 meant the switch was on while a 0 meant the switch was off. The early computers didn't have many instructions -- they were only capable of a handful of very simple operations -- so there were very few switches. With 4 switches we can configure the machine in exactly 16 different ways:

0000 0001 0010 0011

0100 0101 0110 0111

1000 1001 1010 1011

1100 1101 1110 1111

Each additional switch doubles the number of configurations thus if the computer has 17 to 32 instructions we would use at least 5 switches while 33 to 64 instructions would require at least 6 switches, and so on.

Each binary digit (bit) represents an increasing power of 2 where the least significant bit represents 2^0, followed by 2^1, 2^2, 2^3 and so on. This is no different to decimal notation where each digit represents an increasing power of 10 (10^0, 10^1, 10^2, 10^3 and so on). Knowing this we can easily convert from binary to decimal, such that 1101 means (from least significant to most significant digit):

1 = 1x(2^0) = 1x1 = 1

0 = 0x(2^1) = 0x2 = 0

1 = 1x(2^2) = 1x4 = 4

1 = 1x(2^3) = 1x8 = 8

1+0+4+8 = 13

Thus 1101 is the binary equivalent of 13 decimal.

If we say that 1101 represents a specific machine instruction, then we really mean instruction 13. What that instruction means to the machine depends on the machine itself -- it is a machine code and machine codes are always machine-dependent (only machines of the same type will understand what instruction 13 means). Since it represents a specific machine instruction then we call it an operation code, or an opcode for short.

Opcode 13 may require operands (one or more inputs). For instance, if opcode 13 were one of the machine's move instructions, it will need two operands: a source and a destination. These must also be encoded in binary and these codes will either represent a memory address or a CPU register, depending on the operand types expected by the opcode.

CPU registers are a bank of switches that are used to specify the inputs and outputs required by the instruction register (which is also a CPU register). Two special registers are used to keep track of the current and the next instruction. Normally, the next instruction is the one that immediately follows the current instruction in memory. However, if the current instruction is a jump instruction, the encoding in the next instruction register may change, thus allowing the computer to a make decision and possibly jump to the appropriate instruction code when the next instruction becomes the current instruction.

Of course, today, we do not program machines through a series of front panel switches. But just as we can encode the state of these switches from a numeric binary notation, we can also convert to any other binary encoding. On magnetic media we use the flux transitions between positively and negatively charged particle clusters upon a ferromagnetic material. These transitions can be "read" by a computer and decoded into a series of alternating electrical impulses which can then be encoded within an array of accumulators with high or low electrical charges each of which can be maintained by a transistor that can also independently switch the state of the accumulator.

There are no actual numbers inside a computer, of course, they are all merely the encoded representations of numbers that must be encoded, decoded and shunted from one location to another according to the machine's current opcode. For humans it is obviously easier to record the machine's "state" using numeric binary values, but this is merely an abstraction. The machine has no more concept of a number than it does of a what a human is. It is a machine -- it has no actual intelligence. It simply has a number of modes that we can configure, nothing more and nothing less. But because its native "language" is binary, we use numeric binary notation as a human convenience. It allows us to instruct the computer in the only language it knows -- including the instructions necessary to translate binary encoded information into information we can understand, whether it is decimal numbers, written words, a picture, a movie or a sound.

User Avatar

Cedrick Hirthe

Lvl 10
1y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is code formatting?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the code for formatting in Nokia n72?

tell me code


What is the code for formatting phone memory of black berry?

just type:blackberryalwayshang


What is the code for formatting phone memory of sumsung gt-c3312 phone?

*2767*3855#


Which Layer of the OSI model provides data representation and code formatting?

presentation layer


Which layer of the osi model is responsible for code formatting and coversion and graphic standards?

Presentation Layer


Which layer of the the osi model handles data translation code formatting and data encryption?

Presentation


What toolbar in word contains commands related to changing the appearance of text in a document?

The formatting toolbar.The formatting toolbar.The formatting toolbar.The formatting toolbar.The formatting toolbar.The formatting toolbar.The formatting toolbar.The formatting toolbar.The formatting toolbar.The formatting toolbar.The formatting toolbar.


What is erasing format in Microsoft Excel?

It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.It is removing normal formatting on a cell. The Clear All formatting option is often used to do this.


What is the term to apply formatting that appears only when the value in a cell meets conditions that you specify?

Conditional Formatting


What is the process of changing the way characters appear both on screen and in print to improve document readability?

In typesetting computers or initialising printers yes you could call it character formatting or print formatting


What formatting is used to highlight cells that meet specific criteria?

Conditional Formatting


Does a conditional format in Excel make negative numbers red and positive numbers black?

Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.Not necessarily. You can use one of the standard formatting options to that. There would be no need to use Conditional Formatting. You can get Conditional Formatting to do it, but you can use it do change positive and negative numbers to whatever colours you want or apply other formatting to them.