汇编刷题:内存 MEM 单元开始存放着 10 个带符号字节数据, 编写完整程序求其中正数、 零和负数的个 数, 并分别将它们存于 PLUS、 ZERO 和 NEGO 3 个单元

DATA SEGMENT

MEM DB 12H,91H,73H,64H,20H,0A5H,0D1H,91H,0A2H,00H

PLUS DB 00H

ZERO DB 00H

NEGO DB 00H

DATA ENDS

 

STACK SEGMENT

STACK ENDS

 

CODE SEGMENT

ASSUME CS:CODE,DS:DATA,SS:STACK

START:

MOV AX,DATA

MOV DS,AX

 

MOV CX,10

LEA BX,MEM

DEC BX

 

SIGN:

INC BX

MOV DX,[BX]

TEST DX,0FFH

JZ ZERO_NUM

TEST DX,80H

JZ PLUS_NUM

INC NEGO

NEXT:

LOOP SIGN

 

MOV DL,PLUS

ADD DL,30H

MOV AH,02H

INT 21H

 

MOV DL,ZERO

ADD DL,30H

INT 21H

 

MOV DL,NEGO

ADD DL,30H

INT 21H

 

MOV AH,4CH

INT 21H

 

 

ZERO_NUM:

INC ZERO

JMP NEXT

 

PLUS_NUM:

INC PLUS

JMP NEXT

 

 

 

CODE ENDS

END START

posted @ 2019-02-28 21:30  IT蓝月  阅读(589)  评论(0编辑  收藏  举报
Live2D