资源描述:
《微机原理上机作业》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、微型计算机原理汇编程序上机作业:1、验证求平均值的程序(x赋值1,y赋值3)第13页共13页微型计算机原理汇编程序原始程序:DATAHESEGMENTXDB1YDB3ZDB?DATAHEENDSCODEHESEGMENTASSUMECS:CODEHE,DS:DATAHESTART:PUSHDSMOVAX,0PUSHAXMOVAX,DATAHEMOVDS,AXMOVAL,XADDAL,YMOVAH,00HADCAH,00HMOVBL,02HDIVBLMOVZ,ALRETCODEHEENDSENDSTART有输出:DATAHESEGMENTXDB1YDB3ZDB?DATAHE
2、ENDSCODEHESEGMENTASSUMECS:CODEHE,DS:DATAHESTART:PUSHDSMOVAX,0PUSHAXMOVAX,DATAHEMOVDS,AXMOVAL,XADDAL,YMOVAH,00HADCAH,00HMOVBL,02HDIVBLMOVZ,ALADDZ,30HMOVDL,ZMOVAH,2INT21HRETCODEHEENDSENDSTART第13页共13页微型计算机原理汇编程序1、验证查表求ASCII程序第13页共13页微型计算机原理汇编程序原始程序:DATASEGMENTTABLEDB30H,31H,32H,33H,34H,35HDB3
3、6H,37H,38H,39H,41H,42HDB43H,44H,45H,46HHEXDB4ASCIDB?DATAENDSCOSEGSEGMENTASSUMECS:COSEG,DS:DATASTART:MOVAX,DATAMOVDS,AXLEABX,TABLEXORAH,AHMOVAL,HEXADDBX,AXMOVAL,[BX]MOVASCI,ALMOVAH,4CHINT21HCOSEGENDSENDSTART有输出:DATASEGMENTTABLEDB30H,31H,32H,33H,34H,35HDB36H,37H,38H,39H,41H,42HDB43H,44H,45H,
4、46HHEXDB4ASCIDB?DATAENDSCOSEGSEGMENTASSUMECS:COSEG,DS:DATASTART:MOVAX,DATAMOVDS,AXLEABX,TABLEXORAH,AHMOVAL,HEXADDBX,AXMOVAL,[BX]MOVASCI,ALADDAL,30HMOVDL,ALMOVAH,2INT21HMOVAH,4CHINT21HCOSEGENDSENDSTART第13页共13页微型计算机原理汇编程序第13页共13页微型计算机原理汇编程序编程求将键盘输入的小写字母转换为大写字母输出CODESEGMENTASSUMECS:CODESTART:
5、MOVAX,DATAMOVDS,AXMOVAH,01HINT21HCMPAL,‘a’JBEXITCMPAL,‘z’JAEXITSUBAL,20HMOVDL,ALMOVAH,2INT21HJMPSTARTEXIT:MOVAH,4CHINT21HCODEENDSENDSTART第13页共13页微型计算机原理汇编程序验证符号函数例题1)验证例程的正确性,利用debug调试程序2)将变量Y输出(利用2号中断)第13页共13页微型计算机原理汇编程序原始程序:DATAXSEGMENTXDB-25YDB?DATAXENDSCODEXSEGMENTASSUMECS:CODEX,DS:DAT
6、AXSTART:PUSHDSMOVAX,0PUSHAXMOVAX,DATAXMOVDS,AXMOVAL,XCMPAL,0JGELOOP1MOVAL,0FFHMOVY,ALRETLOOP1:JELOOP2MOVAL,1MOVY,ALRETLOOP2:MOVAL,0MOVY,ALRETCODEXENDSENDSTART有输出:(当x<0时,y的值为2)DATAXSEGMENTXDB-25YDB?DATAXENDSCODEXSEGMENTASSUMECS:CODEX,DS:DATAXSTART:MOVAX,DATAXMOVDS,AXMOVAL,XCMPAL,0JGELOOP1M
7、OVAL,2MOVY,ALJMPPRLOOP1:JELOOP2MOVAL,1MOVY,ALJMPPRLOOP2:MOVAL,0MOVY,ALPR:ADDAL,30HMOVDL,ALMOVAH,2INT21HMOVAH,4CHINT21HCODEXENDSENDSTART第13页共13页微型计算机原理汇编程序第13页共13页微型计算机原理汇编程序验证程序DATASEGMENTORG1111HTABLEDW1234HDATAENDSCODESEGMENTASSUMEDS:DATA,CS:CODESTART:MOVAX,