Files
Operating-System/Experiment/asm-exp/实验三/code/EX3_7_SignFunction.asm
2026-06-25 00:09:09 +08:00

30 lines
433 B
NASM
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
; 实验三-7符号函数程序
; 功能计算符号函数Y
; Y = 1 (X>0), Y = 0 (X=0), Y = -1 (X<0)
DATA SEGMENT
X DW 5
Y DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
MOV AX, X
CMP AX, 0
JG POSITIVE
JL NEGATIVE
MOV Y, 0
JMP EXIT
POSITIVE:
MOV Y, 1
JMP EXIT
NEGATIVE:
MOV Y, -1
EXIT:
MOV AH, 4CH
INT 21H
CODE ENDS
END START