当前位置:网站首页>2021.11.10 compilation examination
2021.11.10 compilation examination
2022-07-06 12:24:00 【Vigorous waist Nuo dance】
Just make a note of it , It's more fragmented
Catalog
- The difference between memory addressing methods
- Two symbolic extension instructions
- db Instruction definition string
- Take out the segment address of a segment
- SF and OF Sign a
- Subtraction instruction with borrow sbb
- The first of the registers x Which bit refers to
- The difference between immediate addressing and direct addressing
- Segment registers and mov Cooperation of instructions
- dosbox What do you think of the flag bit in
- The influence of some common instructions on flag bits
- Differences in addressing of various instructions
- Stack pass parameter considerations
The difference between memory addressing methods
2. Instructions MOV AX, [BX+DI] The addressing mode of the source operand in is :( d )(5 branch )
A. Register indirection
B. Register addressing
C. Register Relative Addressing
D. Base addressing
① For memory addressing
The registers that can be addressed are
Base register :bp and bx
Index register : bi and si
Two index registers cannot be used at the same time
② Register indirection means that only the contents of registers are used as offset addresses :[bx]
③ In register addressing “ relative ” Addressing means adding an offset to the register :[bx+666]
Two symbolic extension instructions
3. Execution instruction “MOV AL, 85H” and “CBW” after ,AX The contents of the register are :( c )(5 branch )
A. 85H
B. 0085H
C. FF85H
D. 85F0H
① There are two symbolic extension instructions :cbw and cwd
According to my own understanding
cbw:convert Byte to Word
This command can put al This number extends to ax
cwd:convert Word to Double
This command can put ax This number extends to dx.ax
therefore , The essence of symbolic extension instruction is actually type conversion
② The symbol bit expansion method is relatively simple , Look directly at the binary encoding mode in this register , If the highest order is 1, Just expand 1,0 Just 0
db Instruction definition string
4. Define a variable in the data segment VAR DB ‘12345678H’, Execution instruction “MOV CL,VAR+3” after ,CL The contents of the register are :(b)(5 branch )
A. 12H
B. 34H
C. 56H
D. 78H
①db If you want to define numbers later , The size cannot be greater than one byte . If you define a string , Then the string will be in the order from left to right , Store characters from low address to high address , One byte per character , that ,var+3 after , Just pointing ’4’ This character , This is the time , Check it out ascii surface , Symbol ‘4’ Corresponding ascii Code is 34h
Take out the segment address of a segment
6. What can be used as a programmer's custom identifier in assembly language is :( a )(5 branch )
A. done
B. idiv
C. xlat
D. @data
@data Get the segment address of the data segment . such as ,mov ax,@data
A more general approach is
adopt mov bx,offset var1 Get the offset address
adopt mov ds,seg var1 Get segment address
SF and OF Sign a
7. if AX=1234H, Execution instruction “ADD AX,7802H” after ,AX Register contents and flag bits CF,SF,ZF,OF The state of is :(b)(5 branch )
A. AX=8A36H CF=0 SF=1 ZF=1 OF=0
B. AX=8A36H CF=0 SF=1 ZF=0 OF=1
C. AX=9036H CF=0 SF=1 ZF=1 OF=0
D. AX=9036H CF=0 SF=1 ZF=0 OF=1
①OF: overflow flag. When considering this flag bit , You need to treat the addend and the addend as signed numbers , in other words , Both the addend and the addend exist in the form of complement , After adding , The result is beyond 16 The largest positive number of bit complement :0fff, It means overflow ,OF Set to 1. in other words , When considering the value of a flag bit , It needs to be considered from the perspective of the computer rather than the practical significance of the data you store .
②SF:sign flag sign indicator . What is the highest result ,SF What is it?
③SF and OF It is meaningful when performing symbolic operations , But there will also be value transformation when performing unsigned operations .
④PF: Parity flag bit ,PF This flag bit will be combined with 1 The number of is odd , That is, if there are odd numbers in the operation result 1, be pf by 0
Subtraction instruction with borrow sbb
12. if AX=1020H, BX=1200H, CF=1, Then the command “SBB AX, BX” The execution result of is :(b)(5 branch )
A. 0FE20H
B. 0FE1FH
C. 0FE21H
D. 01DFH
sbb The instruction needs to take into account the borrowing left in the last calculation , meanwhile , This calculation also needs to be modified if it is borrowed CF Value . Theoretically , The result is ax-bx-cf, however ax Not enough to reduce , So we have to borrow again , namely (F+1)020-1200-1=FE1F. Because this calculation borrowed , After that , set up cf=1
The first of the registers x Which bit refers to
14. It is known that (AL)=56H, If the AL Of the 0, 2, 6 Bit changes, but other bits remain unchanged , Then use the command ( ) AL, BL; among (BL)=( a ).(5 branch )
A. XOR 45H
B. OR 45H
C. XOR 0A2H
D. AND 0BBH
From right to left, the first is 0 position
The difference between immediate addressing and direct addressing
① Immediate addressing means that a number is stored directly in the instruction
② Direct addressing is a kind of memory addressing , Directly locate the memory unit by a symbol or offset , such as ,mov ax,var perhaps mov ax,[var]
Segment registers and mov Cooperation of instructions
① In the textbook , The abbreviation of segment register is seg
② In assembly language , The segment register has s Various registers at the end ds cs ss es
③ stay mov In the instruction , Segment registers cannot be combined with immediate addressing , That is, not allowed :mov seg,imm
dosbox What do you think of the flag bit in
Post it here in the experiment report
The influence of some common instructions on flag bits
① Memory of circular instructions ,rcl There is one of them. c, On behalf of this instruction, we need to consider CF, That is, this is a left loop instruction with carry
②rcl perhaps rol These loop instructions all affect CF, The numbers squeezed out of the cycle will be stored in CF in
③ Bit operation instruction and,or,xor These instructions will directly of and cf Set up 0, Cause unknown , The main reason is that different instructions have specific purposes when they are designed , The influence ability on the flag bit is different , So remember first , Prepare for the exam
④mov The instruction does not affect the flag bit , Mainly used to transmit data
⑤ utilize test The instruction tests whether a number is negative , Or judge whether it is zero . for example ,test ax,ax. because test The essence of instruction is and Instructions , The difference lies in test Instruction operands , But the impact zf and sf Sign a ,test ax,ax The result is ax In itself , If ax It's zero , Then it will be set zf=1, If ax It's a negative number , Then it will be set sf=1
Differences in addressing of various instructions
① Intuitively distinguish from data addressing , Namely , The instructions involved in data addressing are mov, The instructions involved in instruction addressing are various jump statements jmp loop wait
② The purpose of instruction addressing is to jump to a specific location , In essence, they are all modifications cs:ip The data of (cs:ip The content of is the address of the next instruction ), As modified cs:ip The way , It can be divided into near transfer , Short transfer , Far away
③ According to whether to modify cs The content of , It is also divided into intra segment addressing and inter segment addressing
④ Near transfer is called relative addressing , It is also an intra segment addressing , for example jmp labl1(labl1 It's a label , such as labl1:mov ax,1) Or is it jmp near ptr lablq, Or is it loop Instructions , The practice of near transfer is in the current ip Add a displacement to the value , The limitation is that the displacement is in +127~-128 byte
⑤ Short transfers may be direct addressing or register indirection or memory indirection , It is also an intra segment addressing , for example jmp short ptr labl1 perhaps jmp ax perhaps jmp [ax], The method of short transfer is to directly label labl1 The effective address of or the contents of the register are assigned to ip
⑥ The method of far transfer is to modify at the same time cs:ip, It is an inter segment addressing , for example jmp far ptr labl1
⑦ The basis of various classifications is different , In fact, when you remember, you don't have to re classify in a classification , Just remember the basis , The above is just to deepen our understanding
Stack pass parameter considerations
① You want to add some entry parameters before calling a subroutine , It's calling call Use... Before the command push Instructions , It should be noted that ,call The instruction itself pushes something into the stack , The return address
② Generally speaking , We use in subroutines ret The command returns to the main program , What this instruction does for us is , Pop up return address , Use this return address to set cs:ip, But don't forget at this time , The top of the stack is still the entry parameter put in before , So generally speaking , When using the stack to pass parameters , Need to use ret i16 Command to return , This instruction is equivalent to ,ret after ,sp+i16, That is, lower the pointer at the top of the stack to the position where no entry parameter is added
边栏推荐
- Esp8266 connect onenet (old mqtt mode)
- I2C bus timing explanation
- JS regular expression basic knowledge learning
- GCC compilation options
- [leetcode622]设计循环队列
- map文件粗略分析
- Feature of sklearn_ extraction. text. CountVectorizer / TfidVectorizer
- JS Title: input array, exchange the largest with the first element, exchange the smallest with the last element, and output array.
- Arm pc=pc+8 is the most understandable explanation
- Arduino gets the length of the array
猜你喜欢
Cannot change version of project facet Dynamic Web Module to 2.3.
Postman 中级使用教程【环境变量、测试脚本、断言、接口文档等】
Mp3mini playback module Arduino < dfrobotdfplayermini H> function explanation
Navigator object (determine browser type)
Redis cache update strategy, cache penetration, avalanche, breakdown problems
Redis 缓存更新策略,缓存穿透、雪崩、击穿问题
(三)R语言的生物信息学入门——Function, data.frame, 简单DNA读取与分析
基於Redis的分布式ID生成器
【ESP32学习-2】esp32地址映射
level16
随机推荐
Time slice polling scheduling of RT thread threads
关于Gateway中使用@Controller的问题
RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED
Arduino gets the length of the array
Pytoch implements simple linear regression demo
Talking about the startup of Oracle Database
VSCode基础配置
By v$rman_ backup_ job_ Oracle "bug" caused by details
Stm32f1+bc20+mqtt+freertos system is connected to Alibaba cloud to transmit temperature and humidity and control LED lights
Esp8266 uses Arduino to connect Alibaba cloud Internet of things
HCIP Day 12
Analysis of charging architecture of glory magic 3pro
Embedded startup process
数据库课程设计:高校教务管理系统(含代码)
Pat 1097 duplication on a linked list (25 points)
Programmers can make mistakes. Basic pointers and arrays of C language
基于Redis的分布式ID生成器
ARM PC=PC+8 最便于理解的阐述
單片機藍牙無線燒錄
Cannot change version of project facet Dynamic Web Module to 2.3.