当前位置:网站首页>[assembly language 01] basic knowledge
[assembly language 01] basic knowledge
2022-07-25 21:58:00 【Fighting_ hawk】
Catalog
1 Preface
1.1 Language development
- course : machine language → assembly language → High-level language
- machine language : People complete their tasks or projects in order to control computers , Can only write “0”、“ 1” Such a string of binary digits to control the computer , In fact, it is to control the high and low levels or open circuits of computer hardware , This language is machine language .
- assembly language : Machine language as a programming language , flexibility 、 Poor readability , In order to reduce the maladjustment brought by machine language to software engineers , People have upgraded and improved machine language : Replace specific instructions with abbreviations that are easy to understand and remember .
- High-level language : To solve the portability of the program , We need to design one that does not depend on computer hardware , Programs that can run on different machines . This can avoid a lot of repeated programming process , Increase of efficiency , At the same time, this language is close to mathematical language or human natural language .
1.2 characteristic
- advantage
(1) You can easily read the memory status and hardware I/O Interface condition
(2) The code is written because there are many less compilation Links , Can be executed accurately
(3) As a low-level language , High scalability - shortcoming
(1) Because the code is very monotonous , Special instruction characters are few , Therefore, the code is lengthy and difficult to write
(2) Because the assembler still needs to call the memory to store data , It's easy to show up BUG, And it's not easy to debug
(3) Even if you finish a program , Later maintenance also takes a lot of time .
(4) Because of the particularity of the machine, there is a defect of poor code compatibility .
1.3 Why learn assembly language
Assembly language is a language that trains students to understand hardware resources , It is the basis for learning and understanding other high-level programming languages , Is the principle of computer composition 、 Interface and communication technology 、 Computer control technology and data acquisition are the leading courses of many professional courses , Is the necessary basic knowledge , Play a connecting role .
1.4 Learning focus
The research focuses on how to use the programming structure and instruction set of the hardware system to work effectively and flexibly .
2 Basic concepts of assembly language
The content of this chapter is mainly to understand the basic concepts , More knowledge points will be supplemented in the following places .
2.1 The composition of assembly language
- Assembly instruction ( Mnemonics for machine codes ): The core of assembly language is assembly instruction , It determines the characteristics of assembly language .
- Pseudo instruction ( By compiler ): There is no corresponding machine instruction , Its main function is to control the assembly process .
- Other symbols ( Recognized by compiler ): Add, subtract, multiply, divide, etc .
2.2 Assembly instruction
- The main body of assembly language is assembly instruction , Assembly instructions are mnemonics for machine instructions .
- The difference between assembly instructions and machine instructions lies in the representation of instructions , Assembly instruction is a writing format that is easy to memorize .
- Example :
Operations to be implemented : register BX To AX in
Machine instructions : 1000100111011000
Assembly instruction :MOV AX,BX - register : Simply put, yes CPU A device that can store data in , One CPU There are multiple registers in .
2.3 Instructions and data
- Instructions and data are applied concepts . On memory or disk , There is no difference between instructions and data , It's all binary information , Specifically as instructions or data , It is decided by the procedure .
- Example :
binary data :1000100111011000
As data :89D8H(H For hexadecimal )
Treat as instruction :MOV AX,BX
2.4 Memory
2.4.1 Memory introduction
- The function of memory :
CPU It's the core component of a computer . It controls the operation of the whole computer and performs calculations , If you want a CPU Work , You have to give it instructions and data . Instructions and data are stored in memory , That's what we usually call memory - The status of memory :
At one PC The role of memory in the machine is second only to CPU. Out of memory , The best performance CPU Can't work . - Memory and disk :
Disk is different from memory , If the data or program on disk is not read into memory , You can't be CPU Use .
2.4.2 Storage unit
- The memory is divided into several storage units , Each storage unit starts from 0 Start sequence number . Suppose a memory has 128 Storage unit , Then the number is from 0~127.
- Each storage unit can store 1 Bytes Byte, namely 8 individual bit. Suppose a memory has 128 Storage unit , You can store 128B The content of .
2.4.3 classification
- From the reading and writing properties, it can be divided into two categories :
(1) Ram (RAM)
(2) read-only memory (ROM) - Classify from function and connection :
(1) Ram RAM
(2) Equipped with BIOS Of ROM
(3) On the interface card RAM
2.4.4 Logical connection of various memories
The logical connection diagram of various memories is as follows , Although all kinds of memory on the motherboard are physically independent devices , But they are the same in two ways :
(1) And all CPU Bus connection of .
(2)CPU When reading or writing to them, the command of memory reading and writing is issued through the control line .
2.5 CPU Read and write to memory
- CPU To read and write data , It has to be with external devices ( The standard way of saying is chip ) Interact with three types of information :
(1) Address of the storage unit ( Address information )
(2) Device selection , Read or write command ( Control information )
(3) Read or write data ( Data and information ) - that CPU By what will the address 、 Data and control information are transferred to the memory chip ?
Computer can handle 、 All the information transmitted is electrical signals , Of course, electrical signals should be transmitted by wires . In the computer, there are special connections CPU And the wires of other chips , Commonly referred to as a bus . - understand CPU The process of reading and writing data into memory .
2.6 Bus
2.6.1 Bus Overview
- Physically : A collection of wires ;
- Logically divided into :
(1) Address bus
(2) data bus
(3) Control bus
2.6.2 Address bus
- CPU It is through the address bus to specify the storage unit .
- How many different messages can be transmitted on the address bus ,CPU How many memory units can be addressed .
- One CPU Yes N Root address bus , It can be said that CPU The address bus width of is N. In this way CPU At most, you can look for 2 Of N Next memory unit .
2.6.3 data bus
- CPU Data transfer between memory and other devices is carried out through data bus .
- The width of the data bus determines CPU And external data transmission speed ,8 The root data bus can 1 Secondary transmission 8 Bit data , namely 1 Bytes ,16 The root data bus can 1 Secondary transmission 16 Bit data , namely 2 Bytes .


2.6.4 Control bus
- CPU The control of external devices is carried out through the control bus . Control information sent on the control bus .
- Here, the control bus is a general term , A control bus is a collection of different control lines . How many control buses are there , Means CPU How many controls are provided for external devices . therefore , The width of the control bus determines CPU The ability to control external devices .
2.7 a main board
At every station PC In flight , There's a motherboard , There are core devices and some major devices on the motherboard . These devices go through the bus ( Address bus 、 data bus 、 Control bus ) Connected to a .
2.8 Interface card
In a computer system , All devices that can be programmed to control their operation , Must be subject to CPU The control of .CPU Cannot directly control external equipment , Like a display 、 Loudspeaker box 、 Printers, etc . Directly controlling these devices is the interface card inserted in the expansion slot .
2.9 Memory address space
- Memory address space : One CPU The width of the address line is 10, So you can address 1024 Memory units , this 1024 The memory units that can be found constitute this CPU Memory address space of .
- Memory and memory address space :CPU When operating each memory , Treat them as memory , They are generally regarded as a logical memory composed of several storage units , This logical memory is what we call memory address space .
(1) All physical memory is regarded as a logical memory composed of several storage units ;
(2) Each physical memory occupies an address segment in this logical memory , It's an address space ;
(3)CPU Read and write data in this address space , In fact, it is to read and write data in the corresponding physical memory .
3 Summary
- Assembly instructions are mnemonics for machine instructions , One to one correspondence with machine instructions .
- Each of these CPU Each has its own assembly instruction set .
- CPU Information that can be used directly is stored in memory .
- There is no difference between instruction and data in memory , It's all binary information .
- Storage units are numbered sequentially from zero .
- A storage unit can store 8 individual bit ( Written as a unit “b”), namely 8 Bit binary number , namely 1 Bytes .
- every last CPU Chips have lots of pins , These pins are connected to the bus . It can also be said that , These pins lead to the bus . One CPU The width of three kinds of buses marks this CPU Different aspects of performance :
(1) The width of the address bus determines CPU The ability to address ;
(2) The width of the data bus determines CPU The amount of data transferred at a time when data is transmitted with other devices ;
(3) The width of the control bus determines CPU The ability to control other devices in the system . - Core thinking : The final thing to run the program is CPU, When we use assembly programming , It must be from CPU Point of view .
Yes CPU Speaking of , All memory units in the system are in a unified logical memory , Its capacity is limited by CPU Limitation of addressing capability . This logical memory is what we call the memory address space .
reference
- 《 assembly language ( The first 3 edition ) 》 Wang Shuang , Main reference books and learning routes .
Baidu cloud :https://pan.baidu.com/s/1TE1Egc0ZmeJfLP5zvamo0Q
Extraction code :3y72 - 《 Encyclopedia of assembly language 》
- 《 Assembly language foundation 01》 Little turtle zero basic video course
- 《 Assembly language foundation 02》 Little turtle zero basic video course
- 《 Assembly language foundation 03》 Little turtle zero basic video course
- 《 Assembly language foundation 04》 Little turtle zero basic video course
- 《 Assembly language foundation 05》 Little turtle zero basic video course
- 《 Assembly language learning notes 》
边栏推荐
- 狗粮的成分
- How to quickly build a picture server [easy to understand]
- I/o case practice
- [JS] the problem pointed by this
- Is there any document for synchronizing from Oracle to ODPs?
- IJCAI2022开会了! 微软等《领域泛化Domain Generalization》教程
- Web3 entrepreneurship has all the elements of explosive growth of innovation
- FAW red flag "King fried" is listed, which is safe and comfortable
- 2022 love analysis ― bank digitalization practice report
- 如何实现一个App应用程序,限制用户时间使用?
猜你喜欢

如何实现一个App应用程序,限制用户时间使用?

自动化测试岗花20K招人,到最后居然没一个合适的,招两个应届生都比他们强吧

PE format: analyze and implement IATHOOK

2022最新软件测试八股文,能不能拿心仪Offer就看你背得怎样了

Lichuang EDA -- creation of devices 01 resistance (II)

Bitcoin.com:USDD代表了真正去中心化稳定币

Guiding principles of information security construction

突破性思维在测试工作中的应用

8000 word super detailed custom structure type
![[redis underlying parsing] string type](/img/a6/47083b033125195ebaf80090919fe2.png)
[redis underlying parsing] string type
随机推荐
2年功能测试,却感觉自己什么都不会,2022我该何去何从?
C语言左值和右值说明[通俗易懂]
How to solve the problem of using the download Plug-in for export?
6-17漏洞利用-反序列化远程命令执行漏洞
Summary of function test points of wechat sending circle of friends on mobile terminal
Animation curves are used every day. Can you make one by yourself? After reading this article, you will!
自动化测试岗花20K招人,到最后居然没一个合适的,招两个应届生都比他们强吧
Redisv6.0为何引入多线程?
在腾讯干软件测试3年,7月无情被辞,想给划水的兄弟提个醒...
Jmeter--- set proxy recording request
C语言:随机生成数+选择排序
The file cannot be saved (what if the folder is damaged and cannot be read)
What are the application characteristics of NTU general database gbase Bi?
[51nod1676 undirected graph isomorphism] undirected graph hash [easy to understand]
Redis configuration
Special class design
In Oracle 19C version, logminer package continuous_ The outdated function of mine leads to CDC failure
动画曲线天天用,你能自己整一个吗?看完这篇你就会了!
磁盘空间的三种分配方式
Dovecot set mailbox quota