The Misunderstanding: Assembly Language is Faster than C Language

The Misunderstanding: Assembly Language is Faster than C Language

First of all, this is a fallacy (are you feeling the urge to argue with me? Please hold on, let me explain slowly). No matter what language is used, the program ultimately runs on the CPU, and only the CPU can execute the program. The CPU does not know what assembly language, C language, or … Read more

Analysis of Answers for Assembly Language Experiment 10-2

Analysis of Answers for Assembly Language Experiment 10-2

“Assembly Language”, 3rd Edition by Wang Shuang Chapter 10: CALL and RET Instructions Experiment 10: Writing Subroutines (Page 206) ———————————— Note: Since Experiment 10 has three questions, and each question is more complex than previous experiments with longer code, it is divided into three articles. This is the reference answer for Question 2. ———————————– 2. … Read more

Assembly Language and C: A Closer Look at Low-Level Embedded Development

Assembly Language and C: A Closer Look at Low-Level Embedded Development

This article introduces the C language and assembly language, which are closer to the hardware level, and explains how the CPU executes code. High-Level vs Low-Level Languages Learning to program is essentially learning a language to communicate with computers. Since computers do not understand human languages, a compiler translates the code written by humans into … Read more

Understanding the Call and Ret Instructions in Assembly Language

Understanding the Call and Ret Instructions in Assembly Language

Overview of Ret and Retf Instructions In 8086 assembly language, <span>call</span> and <span>ret</span> instructions are crucial for implementing subroutine (procedure) calls. They achieve control flow transfer by modifying the IP or simultaneously modifying both CS and IP, utilizing the stack to save and restore the return address. Principle of the Ret Instruction <span>ret</span> instruction is … Read more

Analysis of Answers for Assembly Language Experiment 10-1

Analysis of Answers for Assembly Language Experiment 10-1

“Assembly Language”, 3rd Edition by Wang Shuang Chapter 10: CALL and RET Instructions Experiment 10: Writing Subroutines (Page 206) ———————————— Note: Since Experiment 10 has three questions, and each question is more complex than previous experiments with longer code, it is divided into three articles. This is the reference answer for Question 1. ——————————- In … Read more

Limitations of Jump Instructions in Assembly Language

Limitations of Jump Instructions in Assembly Language

Principle of Limitations on Jump Instructions In 8086 assembly language, displacement-based jump instructions (such as <span>jmp short</span>, <span>jmp near ptr</span>, <span>jcxz</span>, <span>loop</span>, etc.) share a common characteristic: their jump range is limited by the displacement value. This limitation arises because the machine code for these instructions contains only a one-byte or two-byte displacement, rather than … Read more

The Principle of Displacement in Assembly Language Jump Instructions

The Principle of Displacement in Assembly Language Jump Instructions

The Mechanism of Displacement in Jump Instructions In 8086 assembly language, various jump instructions use relative displacement instead of absolute addresses to achieve jumps, providing great flexibility for the program’s memory layout. Core Principle The machine code of jump instructions contains the offset of the target address from the current instruction position, rather than the … Read more

Detailed Explanation of the JCXZ Instruction in Assembly Language

Detailed Explanation of the JCXZ Instruction in Assembly Language

Overview of the JCXZ Instruction JCXZ is a conditional jump instruction in the 8086 assembly language, which determines whether to jump based on the value of the CX register. This instruction is a short jump instruction, with a jump range limited to -128 to 127 bytes. Instruction Format and Functionality Instruction Format: <span>jcxz label</span> Functionality: … Read more

Detailed Explanation of the LOOP Instruction in Assembly Language

Detailed Explanation of the LOOP Instruction in Assembly Language

Overview of the LOOP Instruction The LOOP instruction is a loop control instruction in 8086 assembly language, combining the functionality of decrementing a counter and conditional branching. This instruction is a short jump instruction, with a jump range limited to -128 to 127 bytes. Instruction Format and Functionality Instruction Format: <span>loop label</span> Functionality: First, decrement … Read more

Overview of Transfer Instructions in Assembly Language

Overview of Transfer Instructions in Assembly Language

Overview of Transfer Instructions In 8086 assembly language, transfer instructions are a key mechanism for controlling the execution flow of a program. They can modify the Instruction Pointer (IP) or simultaneously modify both the Code Segment (CS) register and the Instruction Pointer (IP), thereby changing the location of code execution by the CPU. Classification of … Read more