苏州大学汇编复习2

更新时间:2023-12-04 08:48:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

汇编

一、Questions and Problems. (5道×2') 在以下题中选五道。 1. The extended BX register is addressed as EBX 。 2.2.Which microprocessors(微处理器) contain an FS segment register(段处理器)? 答: 80386及以上版本。 3.Determine the memory location addressed by the following real mode 80286 register

combinations:(通过以下的寄存器组合确定内存寻址) (a) DS=1000H and DI=2000H 答: (a): 12000H (b) DS=2000H and SI=1002H (b): 21002H (c) SS=2300H and BP=3200H (c): 26200H 4.What are the IA-32 processor’s (处理器)three basic mode of operation(基本操作模式)? 答:保护虚地址模式、实地址模式、虚拟 答:EAX 8086模式 5.Name all eight 32-bit general-purpose registers. (8个31位通用寄存器名称) P315 、EBX、ECX、EDX、ESP、EBP、ESI、EDI

K(Kilo) bytes. 6.A computer GB(Giga Bytes) is equal to 1GB=KB 、 1TB=KB 、 1PB=TB 7.7.If the DS register contains 0030H in a protect mode system, which table,entry and privilege level are selected? P370 答: Index=6 TI=0 RpL=0 bytes of memory . P370 bytes of memory . 8.The 80386DX addresses 9. The 8086 addresses 10、What are the three basic types of operand? 答:立即数操作数、寄存器操作数、存储器操作数 11、11、(True/False):The destination operand of a MOV instruction cannot be a segment register. (mov指令的目的操作数不能是段寄存器) 答:F. 12、12、(True/False):The EIP register cannot be the destination operand of a MOV instruction. (EIP寄存器不能作为mov指令的目的操作数) 答:T. 13、13、In the operation notation(system of signs or symbols) used by Intel,what does 壹

汇编

r/mem32 indicate?(r/mem32指什么)

答:32位内存操作数。

14、14、Write one or more instructions that subtract VAL4 from VAL2. (写出从VAL2中减去VAL4) 答:MOV

AX VAL4

SUB VAL2 AX

15、15、(Yes/No):Is it possible for both the Sign and Zero flags to be set at the same time? (符号位和零标志位可以同时被设置吗?)

答:NO

16、(Yes/N):Will the Overflow flag be set if you add a negative integer to a negative integer and produce a positive result?

答:YES

17、17、(True/False):Any 16-bit general-purpose register can be used as an indirect operand. (任何16位通用寄存器都可以作为间接操作数。)

答:F 只能用SI、DI、BX或BP寄存器,应尽量避免BP。BP常用来做寻址堆栈而不是数据段。

18、(True/False):The BX register is usually reserved for addressing the stack. (BX寄存器通常作为堆栈寻址。)

答:F 应该是BP。

19、Why is the stack called a LIFO structure?

答:堆栈遵循先进后出的原则。

20、20、Which instruction pushes all of the 32-bit general purpose registers on the stack? (哪个指令可以在堆栈中输出所有32位通用目的寄存器。) 答:PUSHAD

*若是16位应该是PUSHD

21、21、Which instruction pops the stack into the EFLAGS register?

答:POPFD *若是FLAGS就应该是POPF。

22、22、Write a single instruction that reverses all the bits in EAX(do not use the NOT

instruction).(写一个指令使EAX置反,不要使用不指令)

答:XOR EAX,0FFFFFFFFH

23、23、Write instructions that set the Zero flag if the 32-bit value in EAX is even,and clear

the Zero flag if EAX is odd. 答:TEST

EAX,1 或 AND EAX,1

24、Implement the following pseudocode in assembly language :

汇编

if (dx <= cx) X=1; else X=2; 25、25、(True/False):A code label is followed by a colon(:),but a data label does not have a colon. 答:T答: CMP DX,CX JNBE B MOV X,1 JMP EXIT B :MOV X,2 JMP EXIT 26、26、Why would it not be a good idea to use numeric addresses when writing instructions that access variables? (为什么写编写访问变量指令时使用数字变量不好?) 答:数字地址可读性不好,容易混淆。 27、27、(true/False):When a program’s source code is modified,it must be assembled and linked again before it can be executed with the changes. (当一个程序源代码被修改时,在他执行前必须再次编译。) 答:F 目标代码改变时,必须重新编译;而源代码修改不影响目标代码。 28、28、Declare a string variable containing the word “TEST” repeated 500 times. 答:STR DB,500 DUP(“TEST”) 29、29、Create an uninitialized data declaration for a 16-bit integer. (为一个16位的整数创建一个未初始化的数据声明。) 答:STR DW ,? 三、简答题 (4道×5’) 1、判断错误: (1)MOV [SP],AX 错:栈指针不能作为存储器指针引用的寄存器;作为存储器指针和间接寻址的寄存器,80X86只有4个:[BX]、[BP]、[SI]、[DI]。 (2)PUSH CS 对

汇编

(3)POP CS 错:POP目的操作数可以是通用寄存器和

段寄存器,但CS例外。 (4)MOV [BP],BX 对 (5)ADD ECX,[ESP] 对

(6)JMP BX+100 错:不能有+100 (7)JMP CX 对 (8)ADD [BX],BX 对

(9)AND AX,DS 错:段寄存器不能参与AND运算 (10)MOV AX,DS 对,DS只能作为源操作数 (11)MUL 16 错:操作源不能是立即数 (12)ADD AL,[SI+DI] 错:SI、DI不能组合 (13)SUB [BP+DI-1000],AL 对 (14)ADD BH,[BL-3] 错

(15)XCHG [BP],ES 错:ES不能作为源操作数 (16)XCHG AL,ES:[BP] 对 (17)LEA DI,[BX+DI] 对 (18)ROL CX,CL 对

(19)ADD CX,CL 错:CL不能作为源操作数 (20)MOV AL,300 错:AL是8位,最多255

(21) SUB DL,CF 错:CF为进位标志,不能作为操作数

(22)SUB [SI],[DI] 错:不能同时为段寄存器 (23)MOV IP,AX 错:指针IP既不能作为源操作数,也不能作为目的操作数

2、执行结果:熟悉MOV指令、算术指令、loop指令、逻辑、移位 3、~~~~~

四、阅读程序 10分

实验题目:①求和、②堆栈平衡方法、③计算字符串长度

、五、写程序 45分

四个程序

其中有:两个试验中的完整程序、从C语言翻译为汇编语言

汇编

其余习题:

1、请给出使标志CF清0的三种方法(用一条汇编语言实现)

XOR BX,BX AND BX,0 OR DX,DX

1、2、请给出使寄存器AX清0的三种方法(用一条汇编语言实现) MOV

AL,0

XOR BX,BX SUB AX,AX

2、3、写出执行计算如下表达式的值:(W*X-3)/Y的指令段,假设X、Y、W均为16位无符号数,分别存放在名为AAA、BBB和CCC的变量存储单元中,表达式的结果将存放在名为DDD(商)和RRR(余数)的变量存储单元中。 MOV

AX,AAA MUL CCC SUB AX,3 SBB DX,0 MOV CX,BBB DIV CX

MOV DDD,AX MOV RRR,DX

4、求出以下各十六进制数与十六进制数62A0的和,并根据结果设置标志位SF、CF、ZF和OF。

(1)9D60 (2)4321 (3)CFA0 答:(1)、10000

SF=0、CF=1、CF=1、OF=0 (2)、A5C1 SF=1、CF=0、CF=0、OF=1 (3)、13240 SF=0、CF=1、CF=0、OF=0

5、5、试用80X86汇编语言编制程序段完成如下所示的C++语言编写的函数 _fastcall test(int x,int y)

{

Return (5*X+9*Y+300); }

MOV EBX,ECX LEA ECX,[ECX*4] ADD ECX,EBX

本文来源:https://www.bwwdw.com/article/sdwt.html

Top