Introduction to Assembly Language: A Machine-Oriented Programming Language

Introduction to Assembly Language: A Machine-Oriented Programming Language

Assembly language is a low-level language used for electronic computers, microprocessors, microcontrollers, or other programmable devices, also known as symbolic language. In assembly language, mnemonics replace the operation codes of machine instructions, and address symbols or labels replace the addresses of instructions or operands. Assembly language corresponds to different machine language instruction sets on different devices, converted into machine instructions through the assembly process. Generally speaking, a specific assembly language corresponds one-to-one with a specific machine language instruction set, making it non-portable across different platforms.

Many assembly programs provide additional support mechanisms for program development, assembly control, and debugging. Some assembly language programming tools often provide macros, which are also known as macro assemblers.

Assembly language is not widely used in programming like most other programming languages. In practical applications today, it is typically used in low-level hardware operations and high-demand program optimization scenarios. Device drivers, embedded operating systems, and real-time programs all require assembly language.

To talk about the emergence of assembly language, we must first discuss machine language. Machine language is a collection of machine instructions. Machine instructions are commands that a machine can execute correctly. The machine instructions of an electronic computer are a series of binary numbers. The computer converts them into a series of high and low voltage levels, driving the computer’s electronic components to perform calculations.

The computer referred to here is one that can execute machine instructions and perform calculations. This is an early concept of computers. In our commonly used PCs, there is a chip that performs the functions of the computer mentioned above. This chip is what we commonly call the CPU (Central Processing Unit). Each microprocessor requires different voltage pulses to control its operation due to differences in hardware design and internal structure. Therefore, each microprocessor has its own machine instruction set, which is the machine language.

Early programming used machine language. Programmers would write program codes composed of 0s and 1s on paper tape or cards, with 1 representing a hole and 0 representing no hole, and then input the program into the computer via tape readers or card readers for calculations. This machine language, composed purely of 0s and 1s, is very complex, difficult to read and modify, and prone to errors. Programmers quickly discovered the troubles caused by using machine language; it was hard to identify and remember, which hindered the development of the entire industry, leading to the emergence of assembly language.

The main body of assembly language consists of assembly instructions. The difference between assembly instructions and machine instructions lies in their representation. Assembly instructions are a more memorable format for writing machine instructions.

Introduction to Assembly Language: A Machine-Oriented Programming Language

After that, programmers wrote source programs using assembly instructions. However, computers can only understand machine instructions. So how can we make computers execute the programs written by programmers in assembly instructions? At this point, a translation program that can convert assembly instructions into machine instructions is needed, which we call a compiler. Programmers write source programs in assembly language and then use the assembly compiler to compile them into machine code for final execution by the computer.

Introduction to Assembly Language: A Machine-Oriented Programming LanguageWorking Process

In the practice of embedded programming, the actual use of assembly language is quite limited. Especially with ARM, which uses address space to operate registers, most of the code can be completed in C language, with assembly mainly used for:

  • Reading BootLoader code: Basically, apart from the core part of the OS, a portion of the boot loader is generally completed in assembly code, and understanding this code is very helpful for understanding the architecture and the device startup process.

  • Problem analysis: Nowadays, compilers are highly optimized, and the generated code sometimes does not strictly correspond to the C code, so when stepping through certain issues, it is necessary to understand some assembly statements to analyze the actual execution flow of the program.

  • Performance: Most of the time, the optimization of the compiler is sufficient, and hand-written assembly may not be more efficient, but in some specific scenarios, we can optimize by calling the CPU’s specialized hardware instructions through assembly.

Introduction to Assembly Language: A Machine-Oriented Programming LanguageAssembly Language IDE Installation

Long press to identify the QR code to follow

Introduction to Assembly Language: A Machine-Oriented Programming LanguageContact Email: [email protected]

University Computer Basics Public Account

Relying on the University Computer Basics Course, reporting the latest and most comprehensive technology news, pushing produced micro-course and bilingual computer courses. Utilizing the combination of mobile technology and computer technology, this platform serves as an interactive learning platform for prospective college students (junior high school and high school students), current college students, and computer enthusiasts in society.

| – We Are Taking Action, Please Like and Support – |

Leave a Comment