我正在windows xp上编写tasm 8086上的程序,以评估需要用户输入两个变量x和y的数学代数。 请问如何在输入x后让程序向用户询问Y? 这是我到目前为止所做的事情;
stseg segment para stack "stack"
db 64 dup (' ')
stseg ends
dseg segment para public "data"
point db '.$'
masEnterx db 10,13,' Enter integer number(X): $'
masX db 10,13,' X=$'
masEntery db 10,13,' Enter integer number(Y): $'
masY db 10,13,' Y=$'
masExit db 10,13,'For exit press "enter" without input any symbols.',10,13,'$'
masAnswer db 10,13,'Z=$'
erro db 10,13,'Error! Invalid input.$'
first db 10,13,'Z(x,y)=1$'
secon db 10,13,'Z(x,y)=3*(X^2)$'
thir db 10,13,'z(x,y)=X/(2*Y)$'
fourt db 10, 13, 'Z(x,y)=(X^3)/Y$'
num dw -23567
num1 dw -23567
dump db 5,?, 5 dup ("*")
dseg ends
cseg segment para public "code"
main proc far
assume cs:cseg, ds:dseg, ss:stseg
push ds
xor ax,ax
push ax
;
mov ax, dseg
mov ds,ax
start:
lea dx, masExit
mov ah,9
int 21h
lea dx, masEnterX
mov ah,9
int 21h
mov num,0
xor bx, bx
mov bx, 0ah
lea dx, dump + 1
mov cx, [si];
inc si
mov ch, 0
cmp byte ptr [si],"-";
je minus
cmp byte ptr [si], "+";
je minus
mov ax, [si]; unsigned data
cmp al, 13
je exitmy
cmp al, '0'; Validation of input
jl er
cmp al, '9'
ja er
sub al, 30h; conversion of 16-10
mov ah, 0
mov num, ax
xor ax, ax
答案 0 :(得分:0)
请问如何在输入x后让程序向用户询问Y?
你甚至没有对X进行输入!显示消息MasExit和MasEnterX后,您可以编写以下内容:
mov ah,0Ah
mov dx,temp
int 21h ; Buffered input
您的指示lea dx, dump + 1
应为lea si, dump + 1
其余的代码仍然需要很多关注......