当前位置:网站首页>Register of assembly language by Wang Shuang
Register of assembly language by Wang Shuang
2022-07-07 08:09:00 【Huaze flowers】
Register concept
The register is CPU The main components in , yes CPU Parts that programmers can read and write in . The programmer changes the contents of various registers to achieve the goal of CPU The control of .
Different CPU, The number of registers 、 The structure is different .8086CPU Yes 14 A register , Each register has a name . These registers are :AX、BX、CX、SI、DI、SP、BP、IP、CS、SS、DS、ES、PSW.
General registers
8086CPU All the registers of are 16 Bit , It can hold two bytes .AX、AB、CX、DX this 4 Registers are usually used to store general data , It's called a general register .

One 16 The bit register can store a 16 A data .
8086CPU The last generation of CPU The registers in are 8 Bit , To ensure compatibility , Based on the previous generation CPU The program can run in with a little modification 8086 above ,8086CPU Of AX、BX、CX、DX this 4 Each register can be divided into two independent 8 Bit register to use :
- AX Can be divided into AH and AL;
- BX Can be divided into BH and BL;
- CX Can be divided into CH and CL;
- DX Can be divided into DH and DL;

AX It's low 8 position (0 position ~7 position ) Constitute the AL register , high 8 position (8 position ~15 position ) Constitute the AH register .AH and AL Registers can be used independently 8 Bit register .

The storage of words in registers
For compatibility reasons .8086CPU The following two sizes of data can be processed at one time .
- byte : Write it down as byte, One byte by 8 individual bit form , Can exist 8 Bit register .
- word : Write it down as word, A word consists of two bytes , These two bytes become the upper byte and the lower byte of the word respectively .

A word can have a 16 Bit register . The upper and lower bytes of this word naturally exist The height of this register 8 Bit register and low 8 Bit register , Pictured 2.4, A font data 20000, There is AX In the register , stay AH Its low... Is stored in 8 position .AH and AL Data in , That is, it can be regarded as the height of a font data 8 Bit and low 8 position , The size of this font data is 20000, It can also be regarded as two independent byte data , Their sizes are 78 and 32.
Several assembly instructions
| Assembly instruction | control CPU Completed operation | Use the syntax of high-level language to describe |
|---|---|---|
| mov ax,18 | take 18 Into the register AX | AX=18 |
| mov ah,78 | take 78 Into the register AH | AH=78 |
| add ax,8 | Register AX Add... To the number in 8 | AX=AX+8 |
| mov ax,bx | Register BX The data in is sent to the register AX | AX=BX |
| add ax,bx | take AX and BX Add the values in , The result is AX in | AX=AX+BX |
Be careful , In order to make readers with high-level language foundation better understand the meaning of instructions , Sometimes the meaning of an assembly instruction is described in two ways: text description and high-level language description . Case insensitive when writing an assembly instruction or the name of a register . Such as :mov ax,18 and MOV AX,18 It means the same thing ;bx and BX It means the same thing .
PS: If the data size exceeds the register size , Then the highest data will not be stored . If you will 16 Bit register AX As two 8 Bit register AH and AL, So when doing the operation , Will be AL or AH As 1 Independent 8 Bit register , It's going on add The data size exceeds 8 position , Then the highest bit is lost ( The lost here , It means that the carry value cannot be in 8 Save... In bit register , But when CPU This carry value is not really discarded .)
In data transmission or computation , Note that the number of bits of the two operands of the instruction should be the same .
Address adders
The address adder uses Physical address = Segment address x16+ offset The physical address is composed of segment address and offset address . for example ,8086CPU The address to access is 123C8H The memory unit of , here , The operation of the address adder is shown in the figure 2.7 Shown :

“ Segment address x16” A more common expression is shift left 4 position .“ Move left 4 position ” In the middle , It refers to binary bits .
| Shift left digit | Binary system | Hexadecimal | Decimal system |
| 0 | 10B | 2H | 2 |
| 1 | 100B | 4H | 4 |
| 2 | 1000B | 8H | 8 |
| 3 | 10000B | 10H | 16 |
| 4 | 100000B | 20H | 32 |
- The binary form of a data is shifted left 1 position , It is equivalent to multiplying the data by 2;
- The binary form of a data is shifted left N position , It is equivalent to multiplying the data by 2 Of N Power ;
- Address segment x16 Arithmetic , Is to move the address segment stored in binary form to the left 4 position .
further , It is not difficult for us to get a left shift of Hexadecyl lactone form of data , Equivalent to times 16; The decimal form of a data is shifted one bit to the left , Equivalent to times 10; One X The hexadecimal data is shifted one bit to the left , Equivalent to times X.
边栏推荐
- 让Livelink初始Pose与动捕演员一致
- [quick start of Digital IC Verification] 17. Basic grammar of SystemVerilog learning 4 (randomization)
- Roulette chart 2 - writing of roulette chart code
- 快解析内网穿透为文档加密行业保驾护航
- Fast parsing intranet penetration escorts the document encryption industry
- Explore dry goods! Apifox construction ideas
- Jmeter 的使用
- Relevant data of current limiting
- 贝叶斯定律
- LeetCode简单题之判断一个数的数字计数是否等于数位的值
猜你喜欢

Uniapp mobile terminal forced update function

LeetCode简单题之判断一个数的数字计数是否等于数位的值

青龙面板-今日头条

Linux server development, MySQL transaction principle analysis

Empire CMS collection Empire template program general

Real time monitoring of dog walking and rope pulling AI recognition helps smart city

复杂网络建模(一)

2022 National latest fire-fighting facility operator (primary fire-fighting facility operator) simulation questions and answers

【数字IC验证快速入门】15、SystemVerilog学习之基本语法2(操作符、类型转换、循环、Task/Function...内含实践练习)

Linux server development, detailed explanation of redis related commands and their principles
随机推荐
基于Pytorch 框架手动完成线性回归
padavan手动安装php
JS cross browser parsing XML application
太真实了,原来自己一直没有富裕起来是有原因的
Recursive method to verify whether a tree is a binary search tree (BST)
这5个摸鱼神器太火了!程序员:知道了快删!
青龙面板-今日头条
青龙面板--整理能用脚本
MySQL multi column index (composite index) features and usage scenarios
【數字IC驗證快速入門】15、SystemVerilog學習之基本語法2(操作符、類型轉換、循環、Task/Function...內含實踐練習)
game攻防世界逆向
【数字IC验证快速入门】14、SystemVerilog学习之基本语法1(数组、队列、结构体、枚举、字符串...内含实践练习)
JS复制图片到剪切板 读取剪切板
Introduction à l'objet blob
These five fishing artifacts are too hot! Programmer: I know, delete it quickly!
LeetCode中等题之我的日程安排表 I
【踩坑系列】uniapp之h5 跨域的问题
2022年全国最新消防设施操作员(初级消防设施操作员)模拟题及答案
Network learning (II) -- Introduction to socket
Linux server development, detailed explanation of redis related commands and their principles