您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 华电保定微机原理汇编实验
实验一、数据块传送1.将数据段中2000H单元开始存放的10个数(8位数)传送到3000H开始的10个字节中。源程序:DATASSEGMENT;此处输入数据段代码ORG2000HDATA1DB1,2,3,4,5,6,7,8,9,10ORG3000HDATA2DB10DUP(0)DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码MOVSI,2000HMOVDI,3000HMOVCX,10NEXT:MOVAL,[SI]MOV[DI],ALINCSIINCDIDECCXJNZNEXTMOVAH,4CHINT21HCODESENDSENDSTART运行结果:2.将数据段中2000H单元开始存放的10个数(16位数)传送到3000H开始的10个字中。源程序:DATASSEGMENT;此处输入数据段代码ORG2000HDATA1DW1,2,3,4,5,6,7,8,9,10ORG3000HDATA2DW10DUP(0)DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码MOVSI,2000HMOVDI,3000HMOVCX,10NEXT:MOVAX,[SI]MOV[DI],AXADDSI,2ADDDI,2DECCXJNZNEXTMOVAH,4CHINT21HCODESENDSENDSTART运行后:3.将数据DATA1中的10个字节数据传送到数据段DATA2中源数据:DATASSEGMENT;此处输入数据段代码DATA1DB1,2,3,4,5,6,7,8,9,10ORG1000HDATA2DB10DUP(0)DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码LEASI,DATA1LEADI,DATA2MOVCX,10NEXT:MOVAL,[SI]MOV[DI],ALINCSIINCDIDECCXJNZNEXTMOVAH,4CHINT21HCODESENDSENDSTART初始值:运行后:4.将数据段中2000H开始的20个数据传送到2010H开始的20个单元中。源程序:DATASSEGMENT;此处输入数据段代码ORG2000HDATA1DB5DUP(1,2,3,4,5,6)DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码MOVSI,2000HMOVDI,2100HMOVCX,20NEXT1:MOVAL,[SI]MOV[DI],ALINCSIINCDIDECCXJNZNEXT1MOVSI,2100HMOVDI,2010HMOVCX,20NEXT2:MOVAL,[SI]MOV[DI],ALINCSIINCDIDECCXJNZNEXT2MOVAH,4CHINT21HCODESENDSENDSTART运行结果:实验二查表实验目的:熟悉实验环境;熟练掌握查表程序1.已知0~15的平方值表,查表求X的平方值,送到Y单元,用两种方法DATASSEGMENT;此处输入数据段代码TABLEDB0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,255XDB3YDB0DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码LEABX,TABLEMOVAL,XMOVAH,0ADDBX,AXMOVAL,[BX]MOVY,ALMOVAH,4CHINT21HCODESENDSENDSTART运行结果:方法二:源程序:DATASSEGMENT;此处输入数据段代码TABLEDB0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,255XDB3YDB0DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码LEABX,TABLEMOVAL,XXLATMOVY,ALMOVAH,4CHINT21HCODESENDSENDSTART运行结果2.2已知0~255的平方值表,查表求X的平方值,送到Y单元源程序DATASSEGMENT;此处输入数据段代码TABLEDW0,1,4,9,16,25,250DUP(0)XDW3YDW?DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码LEASI,TABLEMOVAX,XADDAX,AXADDBX,AXMOVAX,[BX]MOVY,AXMOVAH,4CHINT21HCODESENDSENDSTART运行结果实验三、计算1.计算1234F000H+98765000H的和源程序:DATASSEGMENT;此处输入数据段代码DATA1DD1234F000HDATA2DD98765000HDATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码LEASI,DATA1LEADI,DATA2MOVAX,[SI]ADDAX,[DI]MOV[SI],AXMOVAX,[SI+2]ADCAX,[DI+2]MOV[SI+2],AXMOVAH,4CHINT21HCODESENDSENDSTART运行结果2.计算8字节数据1122334455667788H与99AABBCCDDEEFF00H的和源程序:DATASSEGMENT;此处输入数据段代码DATA1DQ1122334455667788HDATA2DQ99AABBCCDDEEFF00HDATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码LEASI,DATA1LEADI,DATA2MOVCX,4CLCNEXT:MOVAX,[SI]ADCAX,[DI]MOV[SI],AXADDSI,2ADDDI,2DECCXJNZNEXTMOVAH,4CHINT21HCODESENDSENDSTART运行结果3.计算8字节的BCD码十进制数1122334455667788H与9988776655443322H的和源程序:DATASSEGMENT;此处输入数据段代码DATA1DB88H,77H,66H,55H,44H,33H,22H,11HDATA2DB22H,33H,44H,55H,66H,77H,88H,99HDATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码LEASI,DATA1LEADI,DATA2CLCMOVCX,8NEXT:MOVAL,[SI]ADCAL,[DI]DAAMOV[SI],ALINCSIINCDIDECCXJNZNEXTMOVAH,4CHINT21HCODESENDSENDSTART运行结果4.计算10个字节数据的和(数据自己定义)源程序:DATASSEGMENT;此处输入数据段代码DATA1DB1,2,3,4,5,6,7,8,9,10SUMDB0DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码LEASI,DATA1LEADI,SUMMOVCX,10CLCNEXT:MOVAL,[SI]ADCSUM,ALADDSI,1DECCXJNZNEXTMOVAH,4CHINT21HCODESENDSENDSTART运行结果5.计算10个字数据的和(数据自己定义)源程序:DATASSEGMENT;此处输入数据段代码DATA1DW1,2,3,4,5,6,7,8,9,10SUMDW0DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码LEASI,DATA1LEADI,SUMMOVCX,10CLCNEXT:MOVAX,[SI]ADCSUM,AXADDSI,2DECCXJNZNEXTMOVAH,4CHINT21HCODESENDSENDSTART运行结果实验四、计算表达式的值1.计算表达式)2/()7*)((YYXZ的值,已知X=10,Y=5。DATASSEGMENT;此处输入数据段代码XDB10YDB5ZDB?DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码MOVAL,XSUBAL,YMOVBL,7MULBLCBWMOVBL,YADDBL,2IDIVBLMOVZ,ALMOVAH,4CHINT21HCODESENDSENDSTART实验五、找最大、最小数1.找出2040H单元和2041H单元的大数,送2042H单元(数据自己定义)DATASSEGMENT;此处输入数据段代码ORG2040HDATA1DB11DATA2DB12DATA3DB?DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码MOVAL,DATA1CMPAL,DATA2JGGREATMOVAL,DATA2GREAT:MOVDATA3,ALMOVAH,4CHINT21HCODESENDSENDSTART2.找出10个数(8位数)里的最大数(数据自己定义)DATASSEGMENT;此处输入数据段代码DATADB1,2,3,6,5,4,10,9,8,7MAXDB?DATASENDSSTACKSSEGMENT;此处输入堆栈段代码STACKSENDSCODESSEGMENTASSUMECS:CODES,DS:DATAS,SS:STACKSSTART:MOVAX,DATASMOVDS,AX;此处输入代码段代码LEABX,DATAMOV
本文标题:华电保定微机原理汇编实验
链接地址:https://www.777doc.com/doc-4798736 .html