阅读下列汇编语言程序,写出程序执行后指定单元的内容和寄存器的内容。
1、Datasegmentat2000HOrg0100HArrayDB0FEH,86H,95H,21H,79H,05H,53H,47HCOUNTEQU$-ARRAYDAT...
1、 Data segment at 2000H
Org 0100H
Array DB 0FEH,86H,95H,21H,79H,05H,53H,47H
COUNT EQU $-ARRAY
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
BEGIN:MOV AX,DATA
MOV DS,AX
MOV DX,2
LOP1: MOV CX,COUNT
MOV BX,CX
MOV SI,CX
LOP2: MOV AL,ARRAY[SI-1]
CMP AL,ARRAY[SI-2]
JGE NEXT
XCHG AL,ARRAY[SI-2]
MOV ARRAY[SI-1],AL
MOV BX,CX
NEXT: DEC SI
DEC CX
CMP CX,DX
JGE LOP2
CMP BX,COUNT
JE DONE
INC DX
JMP LOP1
DONE:HLT
CODE ENDS
END BEGIN
程序执行结果:(20100H)=_________,
(20107H)=_________;
BX=______________;
CX=______________;
DX=______________。
2、设某数据区定义如下:
ORG 0100H
NEME DB ‘TOM’,20
DB ‘ROSE’,25
DB ‘KATE’,22
下列各组指令,若为合法指令,请写出执行结果,若为非法指则写出错误原因。
(1) MOV SI,5
LEA DI,NAMES[SI+6]
MOV AL,[DI]
(AL)=________________
(2) MOV SI, 4
LEA BX, NAMES
CMP [BI] [SI], BYTE PTR NAMES+10
(SF)=___________________
3、设初值(AX)=4321H,(DX)=8765H,则
MOV CL, 04H
SHL DX, CL
MOV BL, AH
SHL AX, CL
SHR BL, CL
OR DL, BL
上述程序执行后(DX)=__________;(AX)=________________.
4、设已知附加数据段中字数组DATA1中定义如下:
DATA1 DW, 123 -4, -1024 FFFFH, 0
DW, 666, 888, ‘A’, -1, ABCDH
执行下列程序段,试问结果(AX)=_____________;(BX)=_____________.
TEST1: MOV CX,10
DEC CX
LEA DI,DATA1
MOV AX,BX
CHKMIN: ADD DI,2
CMP ES:[DI], BX
JAE CHKMAX
MOV BX,ES:[DI]
JMP SHORT NEXT
CHKMAX: CMP ES:DI,AX
JBE NEXT
MOV AX, ES:[DI]
NEXT: LOOP CHKMIN 展开
Org 0100H
Array DB 0FEH,86H,95H,21H,79H,05H,53H,47H
COUNT EQU $-ARRAY
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
BEGIN:MOV AX,DATA
MOV DS,AX
MOV DX,2
LOP1: MOV CX,COUNT
MOV BX,CX
MOV SI,CX
LOP2: MOV AL,ARRAY[SI-1]
CMP AL,ARRAY[SI-2]
JGE NEXT
XCHG AL,ARRAY[SI-2]
MOV ARRAY[SI-1],AL
MOV BX,CX
NEXT: DEC SI
DEC CX
CMP CX,DX
JGE LOP2
CMP BX,COUNT
JE DONE
INC DX
JMP LOP1
DONE:HLT
CODE ENDS
END BEGIN
程序执行结果:(20100H)=_________,
(20107H)=_________;
BX=______________;
CX=______________;
DX=______________。
2、设某数据区定义如下:
ORG 0100H
NEME DB ‘TOM’,20
DB ‘ROSE’,25
DB ‘KATE’,22
下列各组指令,若为合法指令,请写出执行结果,若为非法指则写出错误原因。
(1) MOV SI,5
LEA DI,NAMES[SI+6]
MOV AL,[DI]
(AL)=________________
(2) MOV SI, 4
LEA BX, NAMES
CMP [BI] [SI], BYTE PTR NAMES+10
(SF)=___________________
3、设初值(AX)=4321H,(DX)=8765H,则
MOV CL, 04H
SHL DX, CL
MOV BL, AH
SHL AX, CL
SHR BL, CL
OR DL, BL
上述程序执行后(DX)=__________;(AX)=________________.
4、设已知附加数据段中字数组DATA1中定义如下:
DATA1 DW, 123 -4, -1024 FFFFH, 0
DW, 666, 888, ‘A’, -1, ABCDH
执行下列程序段,试问结果(AX)=_____________;(BX)=_____________.
TEST1: MOV CX,10
DEC CX
LEA DI,DATA1
MOV AX,BX
CHKMIN: ADD DI,2
CMP ES:[DI], BX
JAE CHKMAX
MOV BX,ES:[DI]
JMP SHORT NEXT
CHKMAX: CMP ES:DI,AX
JBE NEXT
MOV AX, ES:[DI]
NEXT: LOOP CHKMIN 展开
1个回答
展开全部
1、
程序功能为升序排序
程序执行结果:(20100H)=05H,
(20107H)=0FEH;
BX=0008H;
CX=0001H;
DX=0002H。
2、
NEMES DB ‘TOM’,20
(1) (AL)=54H
(2) CMP [BX] [SI], BYTE PTR NAMES+10
(SF)=0
3、(DX)=7654H;(AX)=3210H.
4、附加数据段中字数组DATA1中定义如下:
DATA1 DW 123,-4,-1024,0FFFFH,0
DW 666,888,'A',-1,-0ABCDH;应该为半角
执行下列程序段,结果(AX)=0FFFFH,即最大值;(BX)=0,即最小值.
TEST1: MOV CX,10
DEC CX
LEA DI,DATA1
MOV BX,[DI];应该填上这条指令
MOV AX,BX
程序功能为升序排序
程序执行结果:(20100H)=05H,
(20107H)=0FEH;
BX=0008H;
CX=0001H;
DX=0002H。
2、
NEMES DB ‘TOM’,20
(1) (AL)=54H
(2) CMP [BX] [SI], BYTE PTR NAMES+10
(SF)=0
3、(DX)=7654H;(AX)=3210H.
4、附加数据段中字数组DATA1中定义如下:
DATA1 DW 123,-4,-1024,0FFFFH,0
DW 666,888,'A',-1,-0ABCDH;应该为半角
执行下列程序段,结果(AX)=0FFFFH,即最大值;(BX)=0,即最小值.
TEST1: MOV CX,10
DEC CX
LEA DI,DATA1
MOV BX,[DI];应该填上这条指令
MOV AX,BX
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询