.MODEL SMALL
.DATA
INFOR DB 13, 10, "INPUT X: $"
CC DB 13, 10, "INPUT Y: $"
ZZ DB 13, 10, "Z = (X + 20) / 6 - 4Y = $"
.STACK 100H
.CODE
START:
MOV AX, @DATA
MOV DS, AX
MOV DX, OFFSET INFOR
MOV AH, 9
INT 21H
MOV AH, 1
SUB AL, 30H
ADD AL, 20
MOV AH, 0
MOV BL, 6
DIV BL
MOV BX, AX
;
MOV DX, OFFSET CC
MOV DL, 4
MUL DL
SUB BX, AX
MOV DX, OFFSET ZZ
MOV AX, BX
CMP AX, 32768
JB NEXT
NEG AX ;(AX)
MOV AH, 2
MOV DL, "-"
NEXT:
AAM
ADD AX, 3030H
MOV DX, AX
XCHG DL, DH
MOV DL, DH
MOV AH, 4CH
END START
.MODEL SMALL
.DATA
INFOR DB 13, 10, "INPUT X: $"
CC DB 13, 10, "INPUT Y: $"
ZZ DB 13, 10, "Z = (X + 20) / 6 - 4Y = $"
.STACK 100H
.CODE
START:
MOV AX, @DATA
MOV DS, AX
MOV DX, OFFSET INFOR
MOV AH, 9
INT 21H
MOV AH, 1
INT 21H
SUB AL, 30H
ADD AL, 20
MOV AH, 0
MOV BL, 6
DIV BL
MOV AH, 0
MOV BX, AX
;
MOV DX, OFFSET CC
MOV AH, 9
INT 21H
MOV AH, 1
INT 21H
SUB AL, 30H
MOV AH, 0
MOV DL, 4
MUL DL
SUB BX, AX
MOV DX, OFFSET ZZ
MOV AH, 9
INT 21H
;
MOV AX, BX
CMP AX, 32768
JB NEXT
NEG AX ;(AX)
MOV BX, AX
MOV AH, 2
MOV DL, "-"
INT 21H
MOV AX, BX
NEXT:
AAM
ADD AX, 3030H
MOV DX, AX
MOV AH, 2
XCHG DL, DH
INT 21H
MOV DL, DH
INT 21H
MOV AH, 4CH
INT 21H
END START