汇编刷题:判断十个数,如果是正数输出1,如果是负数,输出-1,如果是0,输出0

DATA SEGMENT

INFO DB 12H,00H,92H,01H,0H,0H,45H,0A5H,0FEH,0DAH

DATA ENDS

 

CODE SEGMENT

ASSUME CS:CODE,DS:DATA

START:

MOV AX,DATA

MOV DS,AX

 

MOV CX,0AH

LEA BX,INFO

DEC BX

MOV AH,02H

SIGN:

INC BX

TEST BYTE PTR [BX],0FFH

JZ ZERO_NUM

TEST BYTE PTR [BX],80H

JZ PLUS_NUM

JMP NEG_NUM

NEXT:

MOV DL,0dH

INT 21H

MOV DL,0aH

INT 21H

LOOP SIGN

 

MOV AH,4CH

INT 21H

 

ZERO_NUM:

MOV DL,30H

INT 21H

JMP NEXT

 

PLUS_NUM:

MOV DL,31H

INT 21H

JMP NEXT

 

NEG_NUM:

MOV DL,'-'

INT 21H

MOV DL,31H

INT 21H

JMP NEXT

 

CODE ENDS

END START

posted @ 2019-03-03 17:33  IT蓝月  阅读(504)  评论(0编辑  收藏  举报
Live2D