用汇编语言 计算下列函数值

来源:百度知道 编辑:UC知道 时间:2024/05/30 01:46:01
2x,x<0
y= 3x,0≥x≤10
4x,x>10

; 本程序在MASMPlus 1.2集成环境下通过编译,经过调试,运行正确。
Code Segment
Assume CS:Code,DS:Code
x db ? ;自变量
y db ? ;因变量
Press_Key db 7,13,10,13,10,'The complated. Press any key to exit...$'
; -------------------------------------
Start: push cs
pop ds
push cs
pop es
mov al,x
test x,80h ;<0?
jz @@Positive
shl al,1 ;y=2x
mov y,al
jmp Exit_Proc
@@Positive: cmp al,10 ;<10?
jg @@Great10
mov y,al
shl al,1
add y,al ;y=3x
jmp Exit_Proc
@@Great10: shl al,1
shl al,1 ;y=4x
mov y,al
; -------------------------------------
Exit_Proc: lea dx,Press_Key ;提示操作完成,按任意键结束程序
mov ah,9
int 21h
mov ah,1
int 21h
mov ah,4ch ;结束程序
int 21h
Code ENDS
END Start ;编译到此结束

条件不充足,不能解答。