DATA SEGMENT

ORG 2000H

INFO DB 1,2,3,4,5,70H,71H,72H,80H,92H

N_NUMS DB 00H

P_NUMS DB 00H

DATA ENDS

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START:

MOV AX,DATA

MOV DS,AX

MOV CX,10

MOV BX,2000H

DEC BX

SIGN:

INC BX

TEST BYTE PTR [BX],80H

JNZ NEG_NUM

INC P_NUMS

NEXT:

LOOP SIGN

MOV DL,P_NUMS

ADD DL,30H

MOV AH,02H

INT 21H

MOV DL,0AH

INT 21H

MOV DL,N_NUMS

ADD DL,30H

INT 21H

MOV AH,4CH

INT 21H

NEG_NUM:

INC N_NUMS

JMP NEXT

CODE ENDS

END START

汇编刷题:统计2000H开始的正负数的个数-LMLPHP

05-12 06:08