Home > Common Problem > What is a program written in binary sequence called?

What is a program written in binary sequence called?

WBOY
Release: 2022-07-25 11:39:50
Original
4528 people have browsed it

A program written in a binary sequence is called a "machine language program", which is the only low-level language that a computer can directly recognize and execute; machine language is a computer language directly expressed in binary code instructions, and the instructions are 0 and 1 A string of codes, 64 0s and 1s, can be formed into various permutations and combinations, and turned into electrical signals through wires, allowing the computer to perform various operations.

What is a program written in binary sequence called?

The operating environment of this tutorial: Windows 10 system, DELL G3 computer.

What is a program written in binary sequences called?

A program written in binary sequences is called a machine language program. It is the only low-level language that a computer can directly recognize and execute.

Machine language is a computer language directly expressed in binary code instructions. The instructions are a string of codes composed of 0 and 1. They have a certain number of digits and are divided into several segments. The encoding of each segment Represents different meanings. For example, the word length of a certain computer is 64 bits (bit), that is, there are 64 binary numbers that make up an instruction or other information. 64 0s and 1s can be formed into various permutations and combinations and turned into electrical signals through wires, allowing the computer to perform various operations.

Machine language refers to a collection of instructions that can be directly recognized by computer hardware. It is the earliest computer language. Machine language is subordinate to the hardware device. Different computer devices have different machine languages, so machine language is a machine-oriented language.

The instructions in the computer instruction system are codes composed of two symbols, "0" and "1", and can be directly understood and executed by the machine. They are called machine instructions. The set of machine instructions of a computer constitutes the machine language of the computer, that is, the language that the computer can directly accept and understand.

A brief introduction to machine language

Programming language is a formal language used to define computer programs and to issue instructions to the computer. There are many computer languages, and a large number of new programming languages ​​are created every year. According to levels, programming languages ​​can be divided into three categories: machine language, assembly language and high-level language. Machine language consists of a set of machine instructions that can be directly executed by the machine. Programs written in machine language have problems that are difficult to read and remember. Assembly language essentially operates directly on hardware. Due to the use of mnemonics, it is more convenient to write and read than machine language. In high-level languages, multiple assembler statements are merged into more concise programming statements, and at the same time, some tasks such as stack and register allocation management are automatically completed, making it more convenient for programmers to develop programs.

Machine language is a set of machine instructions represented by binary code that a computer can directly recognize and execute. It is the operating function given to the computer by the computer designer through the computer's hardware structure. Machine language has the characteristics of flexibility, direct execution and high speed. The machine languages ​​of different types of computers are incompatible. A program compiled according to the machine instructions of one type of computer cannot be executed on another type of computer.

An instruction is a statement in machine language. It is a set of meaningful binary codes. The basic format of the instruction is such as the operation code field and the address code field. The operation code specifies the operation nature and function of the instruction. , the address code gives the operand or the address of the operand.

To write programs in machine language, programmers must first memorize all the instruction codes of the computer used and the meaning of the codes. When hand-programming, programmers have to handle the storage allocation and input and output of each instruction and data by themselves, and they also have to remember the state of the work unit used in each step of the programming process. This is a very tedious job. The time it takes to write a program is often dozens or hundreds of times longer than the actual running time. Moreover, the programs compiled are all instruction codes of 0s and 1s, which are not intuitive and prone to errors. Except for professionals from computer manufacturers, the vast majority of programmers no longer learn machine language.

Instruction format

Machine language instruction is a binary code consisting of two parts: operation code and operand. The opcode specifies the operation of the instruction. It is a keyword in the instruction and cannot be defaulted. The operand represents the operand of the instruction. [2] The instruction format of a computer has a great relationship with the machine's word length, memory capacity and instruction function. From the perspective of facilitating program design, increasing parallelism of basic operations, and improving instruction functionality, instructions should contain a variety of information. However, in some instructions, because part of the information may be useless, this will waste the storage space occupied by the instruction and increase the number of memory accesses, which may actually affect the speed. Therefore, how to design the instruction format reasonably and scientifically so that the instruction can not only give enough information, but also make its length match the word length of the machine as much as possible, so as to save storage space, shorten the value time, and improve the performance of the machine. This is an important issue in instruction format design.

Computers process various data by executing instructions. In order to indicate the source of the data, the destination of the operation results, and the operation performed, an instruction must contain the following information:

(1)Operation code. It specifies the nature and function of the operation. A computer may have dozens to hundreds of instructions, each instruction has a corresponding operation code, and the computer completes different operations by recognizing the operation code.

(2) The address of the operand. The CPU can obtain the required operands through this address.

(3) Storage address of the operation result. The result of processing the operand is saved at this address for reuse.

(4) The address of the next instruction. When executing a program, most instructions are fetched from the main memory in order and executed. Only when a transfer instruction is encountered, the execution order of the program will change. In order to compress the length of the instruction, a program counter (ProgramCounter, PC) can be used to store the instruction address. Every time an instruction is executed, the instruction address of the PC is automatically set to 1 (assuming that the instruction only occupies one main memory unit), indicating the address of the next instruction to be executed. When a transfer instruction is encountered, the transfer address is used to modify the contents of the PC. Due to the use of PC, the address of the next instruction to be executed does not need to be explicitly given in the instruction.

An instruction actually includes two kinds of information, namely operation code and address code. The operation code (OperationCode, OP) is used to represent the operation to be completed by the instruction (such as addition, subtraction, multiplication, division, data transfer, etc.). Its length depends on the number of instructions in the instruction system. The address code is used to describe the operand of the instruction. It either directly gives the operand, or indicates the memory address or register address of the operand (that is, the register name).

The instruction includes two parts: the opcode field and the address field. According to the number of addresses involved in the address field, the common instruction formats are as follows.

  • Three address instructions: A1 and A2 in the general address field determine the first and second operand addresses respectively, and A3 determines the result address. The address of the next instruction is usually given sequentially by the program counter.

  • Two address instructions: A1 in the address field determines the first operand address, and A2 determines the second operand address and the result address at the same time.

  • Single address instruction: A in the address field determines the address of the first operand. Fixed use of a certain register to store the second operand and operation result. Their addresses are therefore implicit in the instructions.

  • Zero address instruction: In a stack computer, the operands are generally stored in the two units on the top of the push-down stack, and the result is placed on the top of the stack. The addresses are all implicit, so Most instructions only have opcodes and no address fields.

  • Variable address number instructions: The number of addresses involved in the address field changes with the operation definition. For example, the number of addresses in the instructions of some computers can be as few as 0 and as many as 6.

For more related knowledge, please visit the FAQ column!

The above is the detailed content of What is a program written in binary sequence called?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template