微机原理期末编程Word文档格式.docx
- 文档编号:20886395
- 上传时间:2023-01-26
- 格式:DOCX
- 页数:12
- 大小:40.47KB
微机原理期末编程Word文档格式.docx
《微机原理期末编程Word文档格式.docx》由会员分享,可在线阅读,更多相关《微机原理期末编程Word文档格式.docx(12页珍藏版)》请在冰豆网上搜索。
beginprocfar
assumess:
stack,cs:
code,ds:
data
pushds
subax,ax
pushax
movax,data
movds,ax
MOVDX,OFFSETIBUF
MOVAH,10
INT21H
MOVDL,0AH
MOVAH,2
MOVCL,IBUF+1
MOVCH,0
MOVSI,OFFSETIBUF+2
CMPBYTEPTR[SI],'
-'
PUSHF
JNESININC
INCSI
DECCX
SININC:
MOVAX,0
AGAIN:
MOVDX,10
MULDX
ANDBYTEPTR[SI],0FH
ADDAL,[SI]
ADCAH,0
LOOPAGAIN
POPF
JNZNNEG
NEGAX
NNEG:
MOVCX,404H
MOVSI,4
MOVWORDPTROBUF[SI],'
$H'
AG:
MOVDL,0FH
ANDDL,AL
ADDDL,30H
CMPDL,3AH
JCNOAD7
ADDDL,7
NOAD7:
DECSI
MOVOBUF[SI],DL
SHRAX,CL
DECCH
JNZAG
callcrlf;
回车换行
MOVBX,OFFSETOBUF-1
COUNT:
INCBX
CMPBYTEPTR[BX],'
0'
JECOUNT
MOVDX,BX
MOVDX,BX
MOVAH,9
Ret
beginendp
crlfprocnear
movdl,0dh
movah,2
int21h
movdl,0ah
ret
crlfendp
codeends
endbegin
第二题
buf1dw320,210,160,120,36,10
buf2dw813,260,180,93,22,11,2
buf3db100dup(?
),'
$'
tmpdb100dup(?
assumecs:
START:
movdi,0
movsi,0
movbx,0
STEP:
cmpsi,14
jeSTEPA
cmpdi,12
jeSTEPB
movax,buf1[di]
cmpax,buf2[si]
jaSTEPA
movax,buf2[si]
cmpax,buf1[di]
jaSTEPB
STEPA:
jeexit
movax,0
movbp,0
chgA:
movcx,10
movdx,0
divcx
adddx,30h
movcx,dx
movtmp[bp],cl
incbp
cmpax,0
jeexitA
jmpchgA
exitA:
decbp
movcl,tmp[bp]
movbuf3[bx],cl
incbx
cmpbp,0
jelastA
jmpexitA
lastA:
movbuf3[bx],'
'
adddi,2
jmpSTEP
STEPB:
jeexit
chgB:
jeexitB
jmpchgB
exitB:
jelastB
jmpexitB
lastB:
addsi,2
exit:
leadx,buf3
movah,9
MOVAH,4CH
ENDSTART
第三题
arraydb10dup(?
)
Buf1db4,?
4dup(?
flagdb0
stacksegmentstack
dw32dup(?
assumeds:
data,cs:
code,ss:
stack
BEGIN:
movax,data
movds,ax
movcx,10
leabx,array
Input:
leadx,Buf1
movah,0ah
callbint
mov[bx],al
loopInput
;
排序
movcx,9
OuterSort:
pushcx
leasi,array
InterSort:
moval,[si]
cmpal,[si+1]
jaeNext
xchgal,[si+1]
mov[si],al
Next:
incsi
loopInterSort
popcx
loopOuterSort
输出
movcx,10
Output:
xorah,ah
moval,[bx]
callstart
loopOutput
movah,04ch
bintproc
movax,0
pushbx
movcl,10
leasi,Buf1+2
Loop1:
movbl,[si]
cmpbl,0dh
jeCalcDone
subbl,'
mulcl
addal,bl
jmpLoop1
CalcDone:
popbx
bintendp
startproc
movflag,0
leasi,Buf1
movdl,100
Loop2:
divdl
cmpal,0
jneNext2
cmpflag,0
jeNext3
Next2:
movflag,1
addbyteptr[si],'
Next3:
moval,dl
divcl
movdl,al
popax
moval,ah
cmpdl,0
jneLoop2
movbyteptr[si],'
'
movbyteptr[si+1],'
movah,9
startendp
endBEGIN
第四题
CODESEGMENT
ASSUMECS:
CODE
MOVCX,3;
控制外循环
MOVBX,5;
控制*号个数
S:
PUSHBX
SYM:
MOVAH,02H
MOVDL,'
*'
DECBX
JNZSYM
POPBX
SUBBX,2;
每行*号之间相差两个
CALLCRLF;
回车换行
LOOPS
MOVAX,4C00H
CRLF:
MOVAH,02H
MOVDL,0DH
RET
CODEENDS
ENDSTART
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 微机 原理 期末 编程
![提示](https://static.bdocx.com/images/bang_tan.gif)