΢»úÔ­ÀíÓë½Ó¿Ú¼¼Êõ ¹ËêÍ Ï°Ìâ²Î¿¼´ð°¸ ÏÂÔر¾ÎÄ

ÄÚÈÝ·¢²¼¸üÐÂʱ¼ä : 2024/12/24 9:33:58ÐÇÆÚÒ» ÏÂÃæÊÇÎÄÕµÄÈ«²¿ÄÚÈÝÇëÈÏÕæÔĶÁ¡£

CMP AX,0 JNS CHG NEG AX

MOV BYTE PTR [DI],'-' JMP NEXT CHG: N5: MOV AL,AH MOV AH,0 MOV CL,10 DIV CL CMP BX,0 JNZ N6 CMP AL,0 JZ N7 MOV BX,2

15. ´ð£º 16. ´ð£º 17. ´ð£ºÂÔ¡£ 18. ´ð£ºÂÔ¡£ CODE SEGMENT ASSUME CS:CODE START: MOV AH,1 INT 21H CMP AL,'a' JB NOCHG CMP AL,'z' JA NOCHG SUB AL,20H NOCHG: MOV DL,AL MOV AH,2 INT 21H EXIT:

MOV AH,4CH INT 21H CODE ENDS END START

;¼üÅÌÊäÈëµÄ³É¼¨ÒÔ¶ººÅ·Ö¸î ;ÊäÈëÍê±Ï°´»Ø³µ½áÊø DSEG SEGMENT

STRING DB 40,?,40 DUP(?) CJ DB 10 DUP(?)

25

S6 DB ? S7 DB ? S8 DB ? S9 DB ? S10 DB ? DSEG ENDS CODE SEGMENT

ASSUME CS:CODE,DS:DSEG START: MOV AX,DSEG MOV DS,AX LEA DX,STRING MOV AH,10 INT 21H LEA DI,CJ LEA SI,STRING+2 MOV BH,0 MOV AL,0 AGAIN: MOV BL,[SI] CMP BL,',' JZ NEXT CMP BL,0DH JZ NEXT SUB BL,30H MOV CL,10 MUL CL ADD AL,BL INC SI JMP AGAIN NEXT: MOV [DI],AL INC DI MOV AL,0 INC BH INC SI CMP BL,0DH JNZ AGAIN TJ: LEA DI,CJ TJ1: MOV AL,[DI] CMP AL,100 JZ ADDS10

26

CMP AL,90 JAE ADDS9 CMP AL,80 JAE ADDS8 CMP AL,70 JAE ADDS7 CMP AL,60 JAE ADDS6 ADDS10: INC S10 JMP TJNEXT ADDS9: INC S9 JMP TJNEXT ADDS8: INC S8 JMP TJNEXT ADDS7: INC S7 JMP TJNEXT ADDS6: INC S6 TJNEXT: INC DI DEC BH JNZ TJ1 EXIT: MOV AH,4CH INT 21H CODE ENDS END START

24

19. ´ð£º 20. ´ð£º 21. ´ð£º 22. ´ð£º MOV BX,X CMP BX,Y JG SET1 JZ SET0 MOV AL,-1 JMP EXIT

SET1: MOV AL,1 JMP EXIT

27

SET0: MOV AL,0 EXIT: ¡­ LEA SI,STR1 LEA DI,STR2 MOV CX,COUNT

NEXT: MOV BX,[SI] CMP BX,[DI] JNZ NOEQ INC SI INC DI LOOP NEXT MOV AX,0FFFFH JMP EXIT

NOEQ: MOV AX,SI EXIT: ¡­

DATA SEGMENT

LINTAB DW 12,-5,33,21,9 COUNT DW ($-LINTAB)/2 KEYBUF DW 21 ADDR DW ? DATA ENDS CODE SEGMENT

ASSUME CS:CODE,DS:DATA,ES:DATA START: MOV AX,DATA MOV DS,AX MOV ES,AX LEA DI,LINTAB MOV CX,COUNT MOV AX,KEYBUF REPNZ SCASW JNZ SET1 SUB DI,2 MOV ADDR,DI JMP EXIT

SET1: MOV ADDR,0FFFFH EXIT: MOV AX,4C00H INT 21H CODE ENDS END START DATA SEGMENT BUF DB 100 COUNT DB ? DB 100 DUP(?)

MESS1 DB 'NUMBER:$'

28