南邮微机原理试验一二

1.1 程序修改 .486

DATA SEGMENT USE16 SUM DB ?,? MESG DB '25+9=' DB 0,0,'$' N1 DB 9,0F0H N2 DB 25 DATA ENDS

CODE SEGMENT USE16 ASSUME CS:CODE,DS:DATA BEG: MOV AX,DATA MOV DS,AX

MOV BX,OFFSET SUM MOV AH,N1 MOV AL,N2 ADD AH,AL MOV [BX],AH CALL CHANG MOV AH,9

MOV DX,OFFSET MESG INT 21H MOV AH,4CH INT 21H

精选

CHANG PROC

LAST: CMP BYTE PTR [BX],10 JC NEXT

SUB BYTE PTR[BX],10 INC BYTE PTR [BX+7] MOV AH, BYTE PTR[BX] JMP LAST

NEXT: MOV DX,WORD PTR SUM ADD [BX+8],DX

ADD BYTE PTR [BX+7],30H ADD BYTE PTR [BX+8],30H RET CHANG ENDP CODE ENDS END BEG

精选

2.3.4从数据段NUM单元开始存有9个有符号数,并编写一个程序实现:找出最小值存放到数据段MIN单元,并将负数的个数以十进制的形式显示在屏幕上。 .486

DATA SEGMENT USE16

NUM DB -8,-44,-88,-37,2,-1,8,-26,-18 MIN DB ? AB DB '0' DATA ENDS

CODE SEGMENT USE16 ASSUME CS:CODE , DS:DATA BEG: MOV AX,DATA MOV DS,AX MOV BX,OFFSET NUM

精选

MOV CH,0 MOV CL,9

AGAIN: CMP BYTE PTR [BX] ,0 JG NEXT1 INC AB

CMP BYTE PTR [BX], CH JG NEXT1

MOV CH,BYTE PTR [BX] NEXT1: INC BYTE 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

精选

.486

DATA SEGMENT USE16 BUF1 DB '123456' BUF2 DB '000000'

BUF3 DB 'Please input communication words:',0DH,0AH,'$' BUF4 DB 3

OUT1 DB 'ERRORS',0DH,0AH,'$' OUT2 DB 'RIGHT',0DH,0AH,'$' OUT3 DB '*','$' OUT4 DB 0DH,0AH,'$'

精选

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4