汇编符号函数编程y={x+1 (x
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/26 08:45:34
汇编符号函数编程y={x+1 (x
汇编符号函数编程
y={x+1 (x
汇编符号函数编程y={x+1 (x
DATAS SEGMENT
x dw 11 ;此处变换X的取值
y dw ?
DATAS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS
START:
MOV AX,DATAS
MOV DS,AX
mov ax,x
cmp ax,0
jl let1
cmp ax,10
jg let2
mov bx,3
add ax,bx
mov y,ax
jmp over
let1:
mov bx,1
add ax,bx
mov y,ax
jmp over
let2:
mov bx,5
add ax,bx
mov y,ax
jmp over
over: ;输出Y的值
mov ax,y
MOV CX,0
MOV BX,10
SHUCHU2:
MOV DX,0
INC CX
IDIV BX
PUSH DX
CMP AX,0
JNZ SHUCHU2
SHUCHU3:
POP AX
ADD AX,0030H
MOV DL,AL
MOV AH,2
INT 21H
LOOP SHUCHU3
MOV AH,4CH
INT 21H
CODES ENDS
END START