当前位置:网站首页>第四章 指令系统
第四章 指令系统
2022-07-16 21:16:00 【codefan※】
指令系统
指令格式
指令(机器指令)是指示计算机执行某种操作的命令
一台计算机的所有指令的集合构成该机的指令系统,也称指令集
指令的基本格式
指令 = 操作码字段 + 地址码字段
指令字长取决于操作码的长度、操作数地址码的长度和操作数地址的个数。与机器字长没有固定的关系
(单字长指令、半字长指令、双字长指令)
(定长指令字结构、变长指令字结构)
(指令字长一般都是字节的整数倍)
零地址指令: OP
1)不需要操作数的指令:空操作指令、停机指令、关中断指令
2)零地址的运算类指令仅用在堆栈计算机中一地址指令:OP A1
1)只有目的操作数的单操作数指令
2)隐含约定目的地址的双操作数指令
OP(A1) → A1二地址指令:OP A1 A2
(A1)OP(A2) → A1三地址指令:OP A1 A2 A3(结果)
(A1)OP(A2) → A3四地址指令:OP A1 A2 A3(结果) A4(下址)
(A1)OP(A2) → A3,A4 = 下一条将要执行指令的地址
扩展操作码指令格式
不允许短码是长码的前缀,即短操作码不能与长操作码的前面部分的代码相同
各指令的操作码一定不能重复
指令的操作类型

指令的寻址方式

程序的机器级代码表示
常用汇编指令介绍


// X86汇编指令
// 1. 数据传送指令
MOV 复制 不能用于直接从内存复制到内存
PUSH 压栈
POP 出栈
// 2. 算术和逻辑运算指令
ADD/SUB 加/减 结果保存到第一个操作数
INC/DEC 自加1、自减1
IMUL 带符号整数乘法 操作数有两个和三个两种,第一个操作数必须为寄存器,结果保存在第一个操作数
IDIV 带符号整数除法
AND/OR/XOR 与、或、异或 结果保存到第一个操作数
NOT 位翻转
NEG 取负
shl/shr 逻辑左移/逻辑右移 第一个操作数表示操作数,第二个操作数表示移位的位数
// 3. 控制流指令
JMP
jcondition
CMP/TEST
CALL/RET
过程调用的机器级表示
选择语句的机器级表示
循环语句的机器级表示
CISC和RISC的基本概念

边栏推荐
- Only 22 years old! This "Post-00" doctor plans to work in 985 universities!
- Developers must see | devweekly issue 1: what is time complexity?
- Siemens module 6dd1661-0ae1
- 2022 soft test network administrator preparation guide
- 3D point cloud course (II) -- nearest neighbor problem
- Robotics xm430-w350 pan tilt motor usage record
- Sklearn linear regression completes the fitting of multiple term function and sine function
- 11(2).结构体的存储方式,结构体变量和结构体变量指针作为函数参数传递的问题,指针的优点
- "Interface automation" software tests the core skills of salary increase and increases salary by 200%
- [C language] explanation and Simulation Implementation of strlen function
猜你喜欢

【决策樹】使用决策樹進行乳腺癌的診斷

单元测试界的高富帅,Pytest框架 (完) 测试报告篇

Why is SaaS so important for enterprise digital transformation?

Tableqa technology of Ali Dharma academy makes tables speak

Introduction to sqlmap syntax

Nosklattack tool installation and use problem solving

Please check that you have a list of Alibaba pioneer open source projects

Original Rexroth proportional valve 4wrba10w64-2x/g24n9z4/m

Enjoy yourself (VIII) Jenkins learning (to be updated)

关于产品 | 要怎么进行产品规划?
随机推荐
3D point cloud course (III) -- clustering
(pytorch advanced road IV) vision transformer
过拟合 欠拟合
Configure SSH login for Huawei switches
Developers must see | devweekly issue 1: what is time complexity?
The best way to practice Animation: cover transition
Progress [detailed summary]
[CVPR2019] On Stabilizing Generative Adversarial Training with Noise
3D point cloud course (I) -- Introduction to point cloud Foundation
C # network application programming, Experiment 5: data flow exercise
开发者必看 | DevWeekly 第1期:什么是时间复杂度?
MySQL forgot password reset
Concept of Lun
20220715 domestic CONDA does not FQ the method of installing the latest version of pytoch
3大场景带你了解单元测试
10 minutes to customize the pedestrian analysis system, detection and tracking, behavior recognition, human attributes all in one
ImportError: cannot import name ‘Imputer‘ from ‘sklearn.preprocessing‘
[remote desktop] rustdesk open source remote desktop, a substitute for TeamViewer and sunflower
Learning record: FSMC - extended external SRAM
No cl.exe solution found