org 100h
DATA SEGMENT
BUFFER DW 10
GREATZ DW ? ;正數
ZERO DW ? ;零
LITTLEZ DW ? ;負數
DATA ENDS
START:
MOV AX,DATA
MOV DS,AX
XOR AX,AX ;AX清零
MOV GREATZ,AX
MOV ZERO,AX
MOV LITTLEZ,AX
LEA SI,BUFFER ;取第一個資料
MOV CX,[SI]
ADD SI,2
ST_COUNT:
MOV AX,[SI]
AND AX,AX
JLE COUNT1 ;小於等於0則跳轉
INC GREATZ
JMP COUNT3
COUNT1:
JL COUNT2 ;小於0則跳轉
INC ZERO
COUNT2:
INC LITTLEZ
COUNT3:
DEC CX
JNZ ST_COUNT
CODE ENDS
END START
org 100h
DATA SEGMENT
BUFFER DW 10
GREATZ DW ? ;正數
ZERO DW ? ;零
LITTLEZ DW ? ;負數
DATA ENDS
START:
MOV AX,DATA
MOV DS,AX
XOR AX,AX ;AX清零
MOV GREATZ,AX
MOV ZERO,AX
MOV LITTLEZ,AX
LEA SI,BUFFER ;取第一個資料
MOV CX,[SI]
ADD SI,2
ST_COUNT:
MOV AX,[SI]
ADD SI,2
AND AX,AX
JLE COUNT1 ;小於等於0則跳轉
INC GREATZ
JMP COUNT3
COUNT1:
JL COUNT2 ;小於0則跳轉
INC ZERO
JMP COUNT3
COUNT2:
INC LITTLEZ
COUNT3:
DEC CX
JNZ ST_COUNT
CODE ENDS
END START