当前位置:网站首页>"Final review" 16/32-bit microprocessor (8086) basic register
"Final review" 16/32-bit microprocessor (8086) basic register
2022-07-03 03:56:00 【Starry Luli】
Author's brief introduction : One likes to write , Sophomore rookie of planning major
Personal home page :starry Lu Li
First date :2022 year 7 month 2 Saturday, Sunday
Last article :『 Final review 』 A term commonly used in computers
Subscription column :『 Microcomputer principle and interface technology 』
If the article helps you, remember to praise + Collect and support

『 Final review 』16/32 Bit microprocessor (8086) Basic register
1.8086 Programming structure ( Leave a suspense )
8086 have 16 Bit microprocessor ,16 Data line and 20 Root address line . Because available 20 Bit address , So the addressable address space can reach 2^20 Byte is (1MB)
Functionally ,8086 In two parts , namely Bus interface unit (BIU bus interface unit) and Executive parts (EU execution unit )
I'm learning 8086 First understand the programming structure of 16/32 Bit microprocessor basic register
2.16/32 Bit microprocessor basic register
On the whole, it can be divided into 3 class :
General registers (8 individual )
Segment register (4 individual )
Instruction pointer and flag register (2 individual )
2.1 General registers
General register function : It can store operands and addresses for logical operations and arithmetic operations .
Pointer and index register functions : Those who participate in the address operation are mainly in the pointer and index register group 4 A register SP/BP/SI/DI, Generally used to store the offset of the address .
32 The bit register is 16 The bit register name is prefixed with E, Such as EAX, Expanded 16~31 position
Why are general registers classified as high 8 Bit and low 8 position ?
For example, data storage starts from the low order , Our calculation only uses low 8 When a , high 8 Bits can also participate in the calculation , Not idle waste , Such fine division improves memory utilization ; Such a 16 Bit registers can be used as 2 individual 8 Bit register use
( shorthand :ABCDX BSP SDI )

AX It's called an accumulator (Accumulator)
Most frequently used , For arithmetic 、 Logic operation and transmitting information with peripherals
BX It's called the base register (Base address Register)
Commonly used as the offset address of the storage address , Used to store base addresses in indirect addressing
CX It's called a counter (Counter)
As Loop and string operations Wait for the counter in the instruction , Number of storage cycles or repetitions
DX It's called a data register (Data register)
The height commonly used to store double word length data 16 position , Or in indirectly addressed I/O Store... In the instruction I/O Port address .
SP/ESP Stack pointer register
Used to indicate the address of the current top of the stack in the stack segment . Push (PUSH) And out of the stack (POP) Instructions from SP Give the offset address of the top of the stack . Therefore, it is necessary to register with stack segment SS In combination with , To point to the storage unit at the top of the stack .
BP/EBP Base pointer register
Indicate the base address of the data to be processed in the stack segment , Therefore, it is called base pointer register . You can also store the offset of the address at the top of the stack , At this time, the default segment is stack segment SS.
SP and BP Register and SS Segment registers are used together to determine the address of the storage unit in the stack segment
BX And BP Similarities and differences in application
As a general register , Both can be used to store data ;
As a base register ,BX Usually used to address data segments DS;
BP Is usually used to address stack segments SS. BX The base register is generally the same as DS or
SI Is the source address register (Source Index)
Point to the unit where the source data is located
DI Is the destination address register (Destination Index)
But with SI/ESI( Source index register ) In combination with , Point to the unit where the destination data is located ;
except Stack pointer register SP/ESP Cannot be used as an index register , The other seven general registers can be used for address calculation Used to store the operands involved in the operation
2.2 Segment register
Alias : Segment selector , Others call it Segment selector .
The register storing the high-order address is called segment register , low 16 Bit addresses are called offsets , Put it in the general register , Such as base register BX
4 A basic segment register , Used to divide memory space into different segments
among ES,FS,GS, Are called additional segment registers ,FS,GS yes 32 A new addition to bit microprocessors
Why is there a general register , Also design segment registers ?
The segment register is designed for convenience CPU Secondary addressing , Because the memory space is very large , If there are only general registers , When there's a lot of data ,CPU Efficiency will decrease when accessing data , Segment space with segment register ,CPU When addressing, you can first find the segment register , Then look for the data stored in the general register

Code segment CS(code segment)
It is used to store the currently running program . The segment address of the segment where the current execution program is stored , Move its contents to the left 4 Bit plus IP The content of the pointer is the address of the next execution instruction .
Data segment DS(data segment)
Used to store the data used in the program ( Such as numerical value 、 character 、 Address ). The segment address where the current data segment is stored , Move its contents to the left 4 To add the calculated offset address is to read the specified unit of the data segment / Write the address .
stack segment SS(stack segment)
It is a special storage area opened up in memory , Used to temporarily save the data in the register . The segment address where the current stack segment is stored , Move its contents to the left 4 Bit plus SP The content of is Top address
Additional segment ES(extra segment)
Is additional data , Used to store the destination operand in a string operation instruction
Stack stack , What's the difference between a heap and a stack ??? The heap determines the memory size at run time , The stack determines the memory size at compile time
The difference between heap and stack - Fat hair - Blog Garden (cnblogs.com)
Rules for using segment registers :

2.3 Flag and instruction pointer registers
EIP/IP Instruction pointer register
be used for The offset of the address of the unit where the instruction is stored , And code segment register CS In combination with , In order to get the address of the unit where the instruction is located .IP The address is constantly changing , Until the end of the program .(cs and ip I'm a good brother )
EFR/FR(EFLAGS/FLAGS) Flag register
16 Only one of them is used 9 position , For storing the system Status flag and Control signs .
Status flag : yes CPU Generated during the execution of instructions .
1) sign indicator SF(sign flag) Value is equal to the highest bit of the operation result
2) Zero mark ZF (zero flag) The result of operation is 0, The value is 1; Otherwise, it's worth 0
3) Parity mark PF (parity flag) The operation result is low 8 There are even numbers of bits 1 Then the value is 1
4) Carry mark CF (carry flag) Addition makes the highest bit carry or subtraction makes the highest bit borrow , Then the value is 1
5) Auxiliary carry flag AF (auxiliary flag) 8 Bit binary addition operation makes 3 In the first place 4 Bits have carry or subtract operations to make the th 3 In the first place 4 There is a borrowed space , Then the value is 1; Also known as the semi carry flag
6) Overflow sign OF (overflow flag) Overflow during operation , Then the value is 1: Use Double sign bitwise exclusive or evaluation
Control signs : It is used to control the operation of the microprocessor and the working mode of the system
1) Direction signs DF (direction flag) : If IF Set up “1”, be CPU Maskable interrupt requests can be accepted ; conversely , be CPU Maskable interrupt requests cannot be accepted .
2) Interrupt allow flag IF (interrupt enable flag)
3) Tracking signs TF (trap flag) Also known as trap sign
Example : There may be exam questions here , So we should remember each symbol bit and its meaning

3. Q & A
Rules for using segment registers ?
8086CPU Yes 20 Root address line , The maximum addressable memory space is 1MB. and 8086 The only registers of are 16 position . use 16 Address addressing of bits 1MB Space is impossible . So we need to segment the memory , That is the 1MB Space is divided into 24 , namely 16 Segments , Each paragraph does not exceed 64KB(2^16,16 Bit data lines can be addressed ).
But the segment register is still 16 Bit , Its content represents the height of the segment base 16 position , This 16 Add... After the address of bit 4 individual 0 It constitutes 20 Segment base address of bit . And the original 16 The offset in the address segment is only the bit . such , A complete physical memory address consists of two parts , high 16 Segment base address and low bit 16 In segment offset of bit , Of course they have 12 Bits overlap , Their two parts are added together , To form a complete physical address .
4. View of
1. Please name three kinds of buses in the computer and their respective functions ?
data bus : The data bus is CPU And memory 、CPU And I/O Interface device To transmit between Various Instruction data information Bus of , These signals go back and forth through the data bus , therefore , The information on the data bus is Two way transmission Of .
Address bus : What is transmitted on the address bus is CPU To memory 、I/O Interface device Address information sent , Addressing capability is CPU Unique function , Address information is only provided by CPU issue , therefore , The information on the address bus is One way transmission Of .
Control bus : The control bus transmits various control signals , Yes CPU To memory 、I/O Of interface equipment Control signals , Yes I/O The interface is sent to CPU Of Answer signal 、 Request signal , therefore , The information on the control bus is Two way transmission Of .
2. Say the rules of using registers in the microprocessor ?
CS and IP Use it with :CS It is used to store the currently running program . The segment address of the segment where the current execution program is stored ,IP be used for The offset of the address of the unit where the instruction is stored ,** take CS Its content moves left 4 Bit plus IP The content of the pointer is the address of the next execution instruction .**IP The address is constantly changing , Until the end of the program .(cs and ip I'm a good brother )
SS and SP Use it with :SS It is a special storage area opened up in memory , Used to temporarily save the data in the register . The segment address where the current stack segment is stored ,SP Give the offset address of the top of the stack , take SS Move content left 4 Bit plus SP The content of is Top address
3. The known logical address is 1F02H:38A0H How to calculate its corresponding physical address ?
1 F 0 2 0 H
+ 3 8 A 0 H
---------------
2 2 8 C 0 H
4. Please draw Pentium Register and name of processor ( General registers 、 Segment register 、 Instruction pointer and flag register )

边栏推荐
- What is the correct way to compare ntext columns with constant values- What's the right way to compare an NTEXT column with a constant value?
- eth入门之简介
- Captura下载安装及在Captura配置FFmpeg
- IPv6 transition technology-6to4 manual tunnel configuration experiment -- Kuige of Shangwen network
- QSAR model establishment script based on pytoch and rdkit
- [Apple Push] IMessage group sending condition document (push certificate) development tool pushnotification
- 学会pytorch能干什么?
- leetcode:297. 二叉树的序列化与反序列化
- 简易版 微信小程序开发之页面跳转、数据绑定、获取用户信息、获取用户位置信息
- Ffmpeg one / more pictures synthetic video
猜你喜欢

npm : 无法将“npm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
![[Apple Photo Album push] IMessage group anchor local push](/img/a7/6a27d646ecba0d7c93f8dac38492a2.jpg)
[Apple Photo Album push] IMessage group anchor local push

Makefile demo

2022 polymerization process examination questions and polymerization process examination skills

递归:快速排序,归并排序和堆排序

ffmpeg下载安装教程及介绍

MPLS setup experiment
![[Apple Push] IMessage group sending condition document (push certificate) development tool pushnotification](/img/30/c840e28c0ef7c8ce574dcde4363863.jpg)
[Apple Push] IMessage group sending condition document (push certificate) development tool pushnotification

Esp32 series (3): GPIO learning (take simple GPIO input and output, ADC, DAC as examples)

【刷题篇】 找出第 K 小的数对距离
随机推荐
Appium自动化测试框架
Without sxid, suid & sgid will be in danger- Shangwen network xUP Nange
Role of JS No
[embedded module] OLED display module
【刷题篇】多数元素(超级水王问题)
[mathematical logic] propositional logic (equivalent calculus | idempotent law | exchange law | combination law | distribution law | De Morgan law | absorption rate | zero law | identity | exclusion l
Advanced redis applications [password protection, data persistence, master-slave synchronization, sentinel mode, transactions] [not completed yet (semi-finished products)]
Captura下载安装及在Captura配置FFmpeg
Wechat applet + Alibaba IOT platform + Hezhou air724ug build a serverless IOT system (III) -- wechat applet is directly connected to Alibaba IOT platform aliiot
pytorch怎么下载?pytorch在哪里下载?
MySQL MAC download and installation tutorial
[Yu Yue education] reference materials of political communication science of Communication University of China
Cnopendata China Customs Statistics
递归:深度优先搜索
JMeter starts from zero (III) -- simple use of regular expressions
Applet (continuous update)
[mathematical logic] propositions and connectives (propositions | propositional symbolization | truth connectives | no | conjunction | disjunction | non truth connectives | implication | equivalence)
Some preliminary preparations for QQ applet development: make an appointment for a development account, download and install developer tools, and create QQ applet
毕设-基于SSM宠物领养中心
2022年已过半,得抓紧