[Assembly language] Introduction to basic knowledge

The focus of the assembly course is how to make use of the programming structure of the hardware system and the effective and flexible control system of the instruction set to work.

Use assembly ideas, C language, Java and other high-level languages ​​to write programs.

Machine language is a collection of machine instructions.
In terms of machine instruction expansion, it is a command that a machine can execute correctly. It is 01010101..., all composed of assembly 0, 1.

The main body of assembly language is assembly instructions. The difference between assembly instructions and machine instructions lies in the way the instructions are expressed. The assembly instruction is a writing format that is easy to remember for machine instructions.
Insert picture description here
Registers are simply devices that can store data in the CPU. There are multiple registers in a CPU.
Insert picture description here
The composition of assembly language:

  1. Assembly instructions (mnemonics for machine code)
  2. Pseudo-instruction (executed by the compiler)
  3. Other symbols (recognized by the compiler)

The core of assembly language is assembly instructions, which determine the characteristics of assembly language.

Memory

The CPU is the core component of the computer. It controls the operation of the entire computer and performs calculations. If you want a CPU to work, you must provide it with instructions and data.

Instructions and data are stored in memory, which is usually called memory.

The role of memory in a PC is second only to CPU.

Without the memory, no matter how good the performance of the CPU is, it cannot interact.

Disk is different from memory. If the data or program on the disk is not read into the memory, it cannot be used by the CPU.

Instructions and data
In the memory or disk, there is no difference between instructions and data. They are all binary information.
The CPU specifies the storage unit through the address bus.

The memory is divided into several storage units, and each storage unit is numbered sequentially starting from 0.
Insert picture description here
If the CPU wants to read and write data, it must interact with external devices (chips) in three types of information.

  • Address information ( address of storage unit)
  • Control information (period selection, read or write command)
  • Data information ( data read or written)

In the computer, there are special wires connecting the CPU and other chips, usually called a bus.

  • Physically: a collection of wires
  • Logically divided into:
    • Address bus
    • Data Bus
    • Control bus
      Insert picture description here

Address bus:

Insert picture description here

Insert picture description here

The CPU can address as many storage units as the address bus can transmit as many different information.

Data Bus:

The data transfer between the CPU and the memory or other periods is carried out through the data bus.

The width of the data bus determines the data transfer speed between the CPU and the outside world.

Control bus

The CPU controls the external devices through the control bus, where the control bus is an assembly, and the control bus is a collection of different control lines.
How many control buses there are, it means how many kinds of control the CPU provides to external devices.
The width of the control bus determines the CPU's ability to control external devices.

The memory read and write commands are issued synthetically by several control lines:

  • The read signal output control line is responsible for transmitting the read signal from the CPU, and the CPU outputs a low level to the control line to indicate that the data will be read;
  • There is a write signal output control line that is responsible for sending write signals to the CPU

summary

  1. Assembly instructions are the mnemonics of machine instructions, which correspond to machine instructions one to one.
  2. Each CPU has its own assembly instruction set.
  3. The information that the CPU can directly use is stored in the memory
  4. There is no difference between instructions and data in the memory, they are all binary information.
  5. The storage units are numbered sequentially starting from 0
  6. A storage unit can store 8 bits, namely 8-bit binary numbers
  7. Every CPU chip has many pins, which are connected to the bus. It can also be said that these pins lead to the bus, and a CPU can lead to three kinds of buses. The width of the bus marks the performance of different aspects of the CPU.
    • The width of the address bus determines the addressing capability of CPu.
    • The width of the data bus determines the amount of data transfer between the CPU and other periods during data transfer
    • The width of the control bus determines the CPu's ability to control other periods in the system

Motherboard : In
every PC, there is a motherboard on which there are core components and some main components.
These devices are connected by bus (address bus, data bus, control bus).
In a computer system, all devices that can be controlled by a program must be controlled by the CPU.

Interface card : The
CPU cannot directly control external devices, such as displays, speakers, and printers. What directly controls these devices to work is the interface card inserted in the expansion slot.

Various types of memory chips :
Read and write attribute classification:
random access memory (RAM) and read-only memory (ROM)

Classification of functions and connections:

  • Random access memory RAM
  • ROM with BIOS
  • RAM on the interface card

BIOS (Basic Input/Output System)
Insert picture description here
memory address space of basic input and output system : The
above-mentioned memory is physically independent device.
But the same in the following two points:

  1. Are connected to the CPU bus
  2. When the CPU reads or writes them, it issues memory read and write commands through the control line

The memory address space allocation of the 8086PC:
Insert picture description here
For the CPU, the storage units in all memories in the system are in a unified logical memory, and its capacity is limited by the addressing ability of the CPU. This logical memory is what we call the memory address space.

Guess you like

Origin blog.csdn.net/weixin_45468845/article/details/108269881