内容发布更新时间 : 2024/12/23 17:58:39星期一 下面是文章的全部内容请认真阅读。
四、完成下列练习
1、1000H,5000H,8000H 2、答案:
(1) CMP CX,DX
JNB HIEQU : :
HIEQU:
(2) CMP AX,BX
JG GREAT : :
GREAT:
(3) CMP CX,0
JZ ZERO : :
ZERO:
(4) CMP AX,BX
JLE SMAEQU : :
SMAEQU:
(5) CMP CX,DX
JBE LOWEQU : :
LOWEQU:
(6) CMP AX,0
JS NEGAT : :
NEGAT:
(7) TEST AX,AX
JP IMAGE : :
IMAGE:
3、答案:
(1)MOV DS,SEG SOURCE MOV ES,SEGT DEST
MOV SI,OFFSET SOURCE MOV DI,OFFEST DEST MOV CX,N
41
AGAIN: MOV AL,[SI]
MOV ES:[DI],AL INC SI INC DI
LOOP AGAIN
(2)MOV DS,SEG SOURCE
MOV SI,OFFSET SOURCE
MOV CX,N AGAIN: MOV AL,[SI] INC SI
LOOP AGAIN
(3) MOV ES,SEGT DEST
MOV DI,OFFEST DEST MOV CX,N
AGAIN: MOV ES:[DI],AL INC DI
LOOP AGAIN
(4) MOV ES,SEGT DEST
MOV DI,OFFEST DEST
MOV CX,N
AGAIN: CMP AL,ES:[DI] INC DI
LOOP AGAIN
五、是非判断题
(1)A(2)B(3)B(4)A(5)B(6)A(7)A(8)A(9)A(10)A 六、请阅读下列程序,分析其功能或结果
1、读取键盘输入,并显示在显示器上。 2、 在打印机一输出字符‘B’,并回车。
3、屏幕初始化,左上角行号为2,左上角列号为5,右下角行号为22,右下角列号为38,使用整个空白窗口。
4、在屏幕上输出PRESS ANY KEY并换行回车。 5、在屏幕上输出1 七、编写程序
1、答案: abc: mov ah,1 int 21h cmp al,’a’ jb stop cmp al,’z’ ja stop sub al,20h mov dl,al mov ah,2 int 21h
42
jmp abc stop: ret 2、答案:
datarea segment string1 db ‘asfioa’ string2 db ‘xcviyoaf’ mess1 db ‘MATCH’,’$’ mess2 db ‘NO MATCH’,’$’ datarea ends prognam segment main proc far assume cs:prognam,ds:datarea start: push ds sub ax,ax push ax mov ax,datarea mov ds,ax mov es,ax begin: mov cx, string2-string1 mov bx, mess1-string2 cmp bx,cx jnz dispno lea dx,addr lea si,string1 lea di,string2 repe cmpsb jne dispno mov ah,9 lea dx,mess1 int 21h ret dispno: mov ah, 9 lea dx, mess2 int 21h ret main endp prognam ends end start 3、答案: data segment array dw 3 dup(?)
43
data ends code segment main proc far assume cs:code,ds:data start: push ds sub ax,ax push ax mov ax,data mov ds,ax mov cx,3 lea si,array begin: push cx mov cl,4 mov di,4 mov dl, ‘ ‘ mov ah,02 int 21h mov dx,0 input: mov ah,01 int 21h and al,0fh shl dx,cl or dl,al dec di jne input mov [si],dx add si,2 pop cx loop begin comp: lea si,array mov dl,0 mov ax,[si] mov bx,[si+2] cmp ax,bx jne next1 add dl,2 next1: cmp [si+4],ax jne next2 add dx,2
44
next2: cmp [si+4],bx jne num add dl,2 num: cmp dx,3 jl disp mov dl,3 disp: mov ah,2 add dl,30h int 21h ret
main endp code ends end start 4、答案: dseg segment a dw ? b dw ? dseg ends cseg segment mainproc far
assume cs:cseg,ds:dseg start:push ds sub ax,ax push ax mov ax,dseg mov ds,ax begin: mov ax,a mov bx,b xor ax,bx test ax,0001 jz class test bx,0001 jz exit xchg bx,a mov b,bx jmp exit class: test bx,0001 jz exit inc b inc a exit: ret
45