machine language
Machine language is a collection of machine instructions
Machine language is a command that a machine can execute correctly
Command: 01010000 (PUSH AX)
Assembly language
Machine instruction: 1000100111011000
Operation: Send the content of register BX to AX
Assembly instruction: MOV AX,BX
This way of writing is easy to read and remember
The composition of assembly language
Assembly language consists of the following 3 categories
Assembly instructions (mnemonics for machine code)
Directives (executed by the compiler)
other symbols (enforced by the compiler)
The core of assembly language is assembly instruction, which determines the characteristics of assembly language
memory
The CPU is the core component of a computer. It controls the operation of the entire computer and performs calculations. In order for the CPU to operate, instructions and data must be provided to it.
Instructions and data are stored in memory, which is usually called memory
The role of memory in a PC is second only to the CPU
The disk is different from the 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
Instructions and data are applied concepts
In memory or disk, there is no difference between instructions and data, it is all binary information
1000100111011000 -> 35288 -> 89D8H (data)
1000100111011000 -> MOV AX,BX (instruction)
storage unit
The memory is divided into several storage units, and each storage unit is numbered sequentially from 0
Capacity unit:
1KB = 1024B
1MB = 1024KB
1GB = 1024MB
1TB = 1024GB
CPU reads and writes to memory
If the CPU wants to read and write data, it must interact with external devices (chips) for three types of information:
The address of the storage unit (address information)
Device selection, read or write commands (control information)
Read or write data (data information)
In a computer there are dedicated 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
For 8086CPU, the following machine code can complete reading data from unit 3
Machine code: 101000000000001100000000
Meaning: read data from unit 3 and send it to register AX
address bus
The CPU specifies the storage unit through the address bus
How many different information can be transmitted on the address bus, and how many storage units can be addressed by the CPU
The number of address buses is the number of bits in the computer (32 bits, 64 bits)
To achieve 64-bit speed, you have to have
64-bit CPU
64-bit operating system
64-bit software
If a CPU has N address buses, it can be said that the width of the address bus of this CPU is N
Such a CPU can seek up to 2 to the Nth power of memory cells
Data Bus
Data transfer between CPU and memory or other devices 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. The control bus is a general term here, and the control bus is a collection of different control lines
How many control buses there are means how many kinds of control the CPU provides for external devices
memory address space
The address line width of a CPU is 10, so 1024 memory units can be addressed, and these 1024 addressable memory units constitute the memory address space of the CPU
motherboard
In every PC, there is a main board, on which there are core components and some main components
These devices are connected by a bus
interface card
In a computer system, all devices whose operation can be controlled by programs must be controlled by the CPU
The CPU cannot directly control external devices, such as monitors, audio, etc. It is the interface card inserted in the expansion slot that directly controls the operation of these devices.
Various memory chips
From the perspective of reading and writing properties, it can be divided into two categories:
random access memory (RAM)
read-only memory (ROM)
Classification from function and connection:
RAM
ROM with BIOS
RAM on the interface card
The above memories are physically separate, but they are identical in two respects:
are connected to the bus of the CPU
When the CPU reads and writes them, it sends memory read and write commands through the control line.
Treat each type of memory as a logical memory:
All physical memory is seen as a logical memory consisting of several storage units
Each physical memory occupies an address segment in this logical memory, that is, an address space
When the CPU reads and writes data in this address space, it actually reads and writes data in the corresponding physical memory.
The memory address space allocation of different computer systems is different
Memory address space:
It is the CPU that ultimately runs the program. When programming, you must consider the problem from the perspective of the CPU.