资源描述:
《微机原理与接口技术复习题(计科2012级)22 - 副本》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、一、把一个字节类型的无符号数乘以20,乘积保存到字类型的变量中,要求采用加法和移位指令完成该乘法运算,不能使用MUL指令。DATASEGMENTX1DBX2DW?DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATABEGIN:MOVAX,DATAMOVDS,AXMOVAL,DBMOVAH,0SALAX,1SALAX,1MOVBX,AXSALAX,1SALAX,1ADDAX,BXMOVX2,AXMOVAH,4CHINT21HCODEENDSENDBEGIN二、对字节变量X1和X2
2、分别进行初始化,然后求它们的无符号乘积和带符号乘积,并将运算结果分别存入字变量S1和S2中。DATASEGMENTX1DBX2DBS1DW?S2DW?DATAENDSASSUMECS:CODE,DS:DATABEGIN:MOVAX,DATAMOVDS,AXMOVAL,X1MOVAH,0MULX2MOVS1,AXMOVAL,X1MOVAH,0IMULX2MOVS2,AXMOVAH,4CHINT21HCODEENDSENDBEGIN三、定义一个带符号的字节数组,数组的长度(元素个数)至少为10,然后求该数组各
3、元素的和,结果保存到字类型的变量中。DATASEGMENTARRAY1DB2,2,2,2,2,2,2,2,2,2,2C1EQU$-ARRAY1X1DB?DATAENDSCODESEGMENTASSUMEAS:DATA,DADATAMAIN:MOVAX,DATAMOVDS,AXLEASI,ARRAY1MOVCX,C1MOVDX,0CALLSUMMOVX1,DXMOVAH,4CHINT21HSUMPROCGOON:ADDDX,[SI]INCSILOOPGOONRETSUMENDPCODEENDSENDMAIN
4、四、定义两个字节类型的数组,统计既属于第一个数组又属于第二个数组的元素个数,统计结果保存到变量RESULT中。DATASEGMENTARY1DB1,2,21,19,7,32C1EQU(ARY1-$)ARY2DB3,8,7,5,19C2EQU(ARY2-$)RESULTDB?CODESEGMENTASSUMECS:CODE,DS:DATABEGIN:MOVAX,DATAMOVDS,AXMOVDX,0LEABX,ARY1MOVDI,C1LOOP:MOVCX,C2LEASI,ARY2MOVAL,[BX]LOOP
5、2:CMPAL,[BX]JNENOSAMEINCDXJMPSSNOSAME:INCSILOOPLOOP2SS:INCBXDECDIJNELOOP1MOVRESULTDLMOVAH,4CHINT21HCODEENDSENDBEGIN五、定义两个字节类型的数组,统计只属于第一个数组不属于第二个数组的元素个数,统计结果保存到变量RESULT中。DATASEGMENTARY1DB1,2,21,19,7,32C1EQU(ARY1-$)ARY2DB3,8,7,5,19C2EQU(ARY2-$)RESULTDB?COD
6、ESEGMENTASSUMECS:CODE,DS:DATABEGIN:MOVAX,DATAMOVDS,AXMOVDX,0LEABX,ARY1MOVDI,C1LOOP1:MOVCX,C2LEASI,ARY2MOVAX,[BX]LOOP2:CMPAX,[SI]JELOOP1CMPCX,1JNEGOONINCDXGOON:INCSILOOPLOOP2MOVDL,C1SUBDL,RESULTMOVAH4CHINT21HCODEENDSENDBEGIN六、编写程序,用某个十进制数对无符号字节变量VALUE初始化,然
7、后在屏幕上显示与该变量等值的二进制数。DATASEGMENTVALUEDW?DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATABEGIN:MOVAX,DATAMOVDS,AXMOVBX,0MOVCX,4GOON:MOVAH,7INT21HCMPAL,0DHJMPSTOPCMPAL,'0'JBGOONCMPAL,'9'JAGOONMOVDL,ALMOVAH,2INT21HSUBAL,30HCALLSKIPMOVAH,0MOVBX,AXLOOPGOONSTOP:MOVVALUE,
8、BXMOVAH,4CHINT21HSKIPPROCPUSHDXSALBX,1MOVDX,BXSALBX,1SALBX,1ADDBX,DXPOPDXRETSKIPENDPCODEENDSENDBEGIN七、对无符号字变量X1和X2分别进行初始化,然后采用辗转相除法求它们的最大公约数,结果保存到字变量RESULT中。DATASEGMENTX1DW60X2DW75RESULTDW?DATAENDSCODESEGMENTASSUMEC