一、填空题(毎空1分,共15分)
1.汇编语言程序/汇编语言源程序,ASM,平展(flat) 2.执行性语句(硬指令),说明性语句(伪指令) 3.立即数,寄存器,存储器 4.导入,动态连接 5.PUSH EBX 6.嵌入汇编,模块连接 7.8,6,16
二、判断题(每题1分,共10分)
1.错 2.对 3.对 4.对 5.错 6.对 7.对 8.错 9.对 10.错
三、按下面要求写出相应的数据定义语句或汇编指令(变量名可任意指定)(每小题2分,共12分)
1. string byte ‘assembly language’ 2. var word 20 dup (?)
3. str equ 4. dvar dword 14h 5. add [ebx+esi],eax
6. xor eax,eax 或sub eax,eax
四、程序分析与阅读题 1.(每空1分,共8分)
EAX=87654321h EBX=12345678h
EAX=876543a9h CF=1 OF=0 ZF=0 SF=1 PF=1
2.(每小题2分,共8分)每一小题指出错误得1分,写出正确指令得1分 ① 操作数类型不一致 add eax,ebx 或add ax,bx ② 两个操作数同时是内存单元的数 mov eax,var2 mov var1,eax ③ push指令不支持字节操作 push ax 或 push eax ④ 两个操作数类型不明确 mov byte ptr [ebx],100 或mov word ptr [ebx],100 或mov dword ptr [ebx],100 3.(每小题2分,共4分)
① xchg ebx,[edi] 或 xchg [edi],ebx ② movsb
4.(每空2分,共8分) dec edx
cmp al,[edi] jmp L3
共 8 页 第 6 页
inc edi
五、编程题(共35分) 1.(5分)
readstring macro,:msg
lea eax,msg call readmsg mov ecx,eax
endm
2.(8分) .686
.model flat,stdcall option casemap:none includelib bin\\kernel32.lib ExitProcess
proto,:dword
WriteConsole equ
msg byte 'Hello, Assembly!',13,10 outsize dword ? .code start:
invoke GetStdHandle,
STD_OUTPUT_HANDLE ;获得输出句柄
invoke WriteConsole,eax,
addr msg,sizeof msg,addr outsize,0 ;
invoke ExitProcess,0 ;退出 end start
GetStdHandle proto,:dword WriteConsoleA
proto,:dword,:
dword,:dword,:dword,:dword
3.(10分) .model small .686 .stack .data
msg byte ‘Input number:0~9’,’$’ .code start:
mov ax,@data mov ds,ax mov ah,9 mov dx,offset msg int 21h again:mov ah,1
共 8 页 第 7 页
int 21h cmp al,30h jb next cmp al,39h jbe done next:jmp again done:mov ax,4c00h
int 21h end start 4. (12分) include io32.inc .data
msg byte ‘Are you sure you can pass in
the Assembly exam?’,13,10,0
.code start:
mov eax,sizeof msg push eax
mov eax,offset msg push eax call zhuanhuan add esp,8
mov eax,offset msg call dispmsg exit 0 zhuanhuan proc
push ebp mov ebp,esp push ebx push ecx
mov ebx,[ebp+8] mov ecx,[ebp+12] again:mov al,[ebx]
cmp al,’A’ jb next cmp al,’Z’ jbe next1 cmp al,’a’ jb next cmp al,’z’
ja next
next1:xor al,20h
mov [ebx],al
next:inc ebx
loop again
pop ecx
pop ebx mov esp,ebp pop ebp ret
zhuanhuan endp end start
共 8 页 第 8 页