资源描述:
《南邮微机原理试验一二》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、1.1程序修改.486DATASEGMENTUSE16SUMDB?,?MESGDB'25+9='DB0,0,'$'N1DB9,0F0HN2DB25DATAENDSCODESEGMENTUSE16ASSUMECS:CODE,DS:DATABEG:MOVAX,DATAMOVDS,AXMOVBX,OFFSETSUMMOVAH,N1MOVAL,N2ADDAH,ALMOV[BX],AHCALLCHANGMOVAH,9MOVDX,OFFSETMESGINT21HMOVAH,4CHINT21HCHANGPROCLAST: CMP BYTE PTR [BX],10
2、 JC NEXT SUB BYTE PTR[BX],10 INC BYTE PTR [BX+7] MOV AH, BYTE PTR[BX] JMP LASTNEXT:MOVDX,WORDPTRSUMADD[BX+8],DXADDBYTEPTR[BX+7],30HADDBYTEPTR[BX+8],30HRETCHANGENDPCODEENDSENDBEG2.3.4从数据段NUM单元开始存有9个有符号数,并编写一个程序实现:找出最
3、小值存放到数据段MIN单元,并将负数的个数以十进制的形式显示在屏幕上。 .486 DATA SEGMENT USE16 NUM DB -8,-44,-88,-37,2,-1,8,-26,-18MIN DB ? AB DB '0' DATA ENDS CODE SEGMENT USE16 ASSUME CS:CODE , DS:DATA BEG: MOV AX,DATAMOV DS,AX MOV BX,OFFSET NUM MOV CH,0 MOV CL,9 AGAIN: CMP BYTE PTR [BX] ,0 JG NEXT1 INC AB CMP BYTE P
4、TR [BX], CH JG NEXT1 MOV CH,BYTE PTR [BX] NEXT1: INCBYTE PTR BX DEC CL JNE AGAIN MOV MIN,CH MOV AH,2 MOV DL,AB INT 21H MOV AH,4CH INT 21H CODE ENDS END BEG.486DATASEGMENTUSE16BUF1DB'123456'BUF2DB'000000'BUF3DB'Pleaseinputcommunicationwords:',0DH,0AH,'$'BUF4DB3OUT1DB'ERRORS',0DH,0A
5、H,'$'OUT2DB'RIGHT',0DH,0AH,'$'OUT3DB'*','$'OUT4DB0DH,0AH,'$'DATAENDSCODESEGMENTUSE16ASSUMECS:CODE,DS:DATA,ES:DATABEG:MOVAX,DATAMOVDS,AXMOVES,AXMOVAH,00HMOVAL,3INT10HLAST1:LEASI,BUF1LEADI,BUF2MOVBX,OFFSETBUF2MOVCX,6MOVAH,09HLEADX,BUF3INT21HLAST:MOVAH,07HINT21HMOVBYTEPTR[BX],ALINCBXMOVA
6、H,09HMOVDX,OFFSETOUT3INT21HLOOPLASTMOVAH,09HLEADX,OUT4INT21HMOVCX,6CLDREPECMPSBJZEXITMOVAH,09HLEADX,OUT1INT21HDECBUF4JZLAST2JMPLAST1EXIT:MOVAH,09HLEADX,OUT2INT21HLAST2:MOVAH,4CHINT21HCODEENDSENDBEG