微机原理答案Word文档下载推荐.docx
《微机原理答案Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《微机原理答案Word文档下载推荐.docx(18页珍藏版)》请在冰豆网上搜索。
0800H
JMPSHORTOBJ
0801H
所以当前的IP为0800H
JMPSHORTOBJ为段内直接短转移指令,IP←IP+D8,转移范围不能超过-128—+127
转向地址=位移量+IP
(1)OBJ=80H+0800H=0880H
(2)OBJ=0AH+0800H=080AH
(3)OBJ=6BH+0800H=086BH
4.解:
可以先写如下程序段
MOVAX,8000H
MOVBX,0F79H
PUSHAX
PUSHBX
POPCX
下图为执行完程序第四行处堆栈区示意图(栈顶地址为00FFH:
009FH)
SS:
SP
00FFH:
00A0H
009FH
AX
00H
0FH
BX
79H
下图为执行完程序第五行处堆栈区示意图(栈顶地址为00FFH:
SS:
而CX=0F79H
5.解:
DATASEGMENT
DAT1DW2
XDD?
YDD?
ZDD?
WDD?
DATAENDS
CODESEGMENT
ASSUMECS:
CODE,DS:
DATA
START:
MOVAX,DATA
MOVDS,AX
MOVAX,WORDPTRZ
MULDAT1
MOVCX,DX
MOVBX,AX
MOVAX,WORDPTRZ+2
MULDAT1
ADDAX,BX
ADCDX,CX
ADDAX,WORDPTRY
ADCDX,WORDPTRY+2
ADDAX,WORDPTRX
ADCDX,WORDPTRX+2
MOVWORDPTRW,AX
MOVWORDPTRW+2,DX
MOVAX,4C00H
INT21H
CODEENDS
ENDSTART
6.解:
XDW1/?
YDW1000H/?
ZDW1000H/?
VDW1000H/?
DATDW?
DAT2DW?
DAT3DW?
MOVAX,X
MOVBX,Y
IMULBX
MOVAX,V
CWD
SUBDX,CX
SBBAX,BX
MOVDAT,AX
MOVCX,DX
MOVAX,Z
MOVBX,2
IMULBX
ADDAX,DAT
SUBAX,100H
SBBDX,0
IDIVX
MOVDAT2,AX;
数据存放在变量中便于观测
MOVDAT3,DX
7.解:
XDW?
YDW?
RESULTDW?
CMPX,100
JAT0
JMPTI
T0:
MOVAX,X
SUBAX,Y
JMPQUIT
T1:
MOVAX,Y
SUBAX,X
QUIT:
MOVRESULTAX
8.解:
N=10,数据存放在变量中便于观测
ARRAYDB0H,12H,0F5H,01H,06H,99H,12H,0F5H,00H,00H
ZERODB?
FSDW?
ZSDW?
MOVBX,0
MOVDI,0
MOVSI,OFFSETARRAY
AGAIN:
MOVAL,[SI]
INCSI
CMPSI,10
JAQUIT
CMPAL,0
JET0;
数据为0
TESTAL,80H
JET1;
数据为正数
JMPT2;
数据为负数
INCZERO
JMPAGAIN
INCBX
JMPAGAIN
T2:
INCDI
MOVZS,BX
MOVFS,DI
9.解:
参看教材77页
10.解:
密码字可以理解为是相应字符的ASCII码
BUFINDB20H,20HDUP(?
)
BUFFERDB10DUP(?
MIMAZIDB43H,47H,48H,46H,59H,44H,5AH,58H,56H,57H
LEADX,BUFIN
MOVAH,0AH
LEADI,BUFFER
LEASI,BUFIN
MOVCL,10
ANDAL,0FH
MOVBX,OFFSETMIMAZI
XLAT
MOV[DI],AL
LOOPAGAIN
11.解:
假设DX寄存器低字节有数据
提示:
若DX寄存器中的高低字节都有数据,用同样的办法做
CLRDB?
MOVDX,00F5H
MOVAX,DX
MOVCH,16
DIVCH
MOVBL,AH
CMPAL,9
JACHULI
ADDAL,30H
JMPSHUCHU
CHULI:
ADDAL,37H
SHUCHU:
MOVDL,AL
MOVAH,2
MOVAL,BL
JACHULI1
JMPSHUCHU1
CHULI1:
SHUCHU1:
12.解:
此答案作为参考
;
.....将BUF中的10个数据中的0抹掉并更新长度.......;
.....BUF中的第一个元素为缓冲区长度.......;
BUFDB0AH,1,0,3,0,2,5,8,9,0,7
COUNTDB?
ASSUMECS:
LEASI,BUF
MOVBL,[SI]
XORBH,BH
MOVCOUNT,0
INCSI
CMPAL,0
JZCHULI
CMPSI,10
JAQUIT
INCCOUNT
PUSHSI
PUSHBX
SUBBX,SI
MOVCL,BL
L:
MOVAH,[SI+1]
MOV[SI],AH
LOOPL
POPBX
POPSI
QUIT:
SUBBL,COUNT
MOVSI,0
MOVBUF[SI],BL
MOVAH,4CH
INT21H
13.解:
参看实验指导书或教材
14.解:
思路为11题的逆过程
2456
BUFINDB20H,20DUP(?
CLRDB0DH,0AH,'
$'
DATDB?
?
CS1DW4096
MOVDX,OFFSETBUFIN
MOVDX,OFFSETCLR
MOVAH,9
LEADI,DAT
MOVCL,4
CMPAL,39H
JATT
SUBAL,30H
JMPT1
TT:
SUBAL,37H
MOVDX,0
MOVAH,0
MOVAL,[DI]
ADDDX,AX
DECDI
MOVCL,16
MULCL
MOVBX,DX
MOVAH,0
MOVCX,256
MULCX
ADCDX,0
MOVBX,AX
MULCS1
XIANSHI:
SHLBX,1
JCNEXT
MOVDL,30H
JMPT0
NEXT:
MOVDL,31H
MOVAH,2
INT21H
LOOPXIANSHI
15.解:
dsegSEGMENT
numdw76,69,84,90,73,88,99,63,100,80
ndw10
s6dw?
s7dw?
s8dw?
s9dw?
s10dw?
dsegENDS
codesegment
mainprocfar
dseg
pushds
subax,ax
pushax
movax,dseg
movds,ax
callsub1
ret
mainendp
sub1procnear
pushbx
pushcx
pushsi
movsi,0
movcx,n
next:
movax,num[si]
movbx,10
divbl
movbl,al
cbw
subbx,6
salbx,1
incs6[bx]
addsi,2
loopnext
popsi
popcx
popbx
popax
ret
sub1endp
codeends
endstart
16.解:
要使用BIOS调用,暂时不解。
17.解:
输入数据如果为221210代表意思为2010-12-22,在DATE查看数据
STR1DB'
Whatisthedatetoday?
'
0DH,0AH,'
DATEDB?
LEADX,STR1
LEADI,DATE
MOVSI,OFFSETBUFIN
MOVCL,3
SHLAL,1
MOVAH,[SI]
SUBAH,30H
ADDAL,AH