inputting two variables to user in tasm 8086

623 Views Asked by At

I am writing a program on tasm 8086 on windows xp to evaluate a Mathematical algebra that requires the user to input two variables x and y. Please how can I get the program to ask the user for Y after he inputs x ? this is what i've done so far;

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
1

There are 1 best solutions below

0
On

Please how can I get the program to ask the user for Y after he inputs x ?

You are not even doing an input into X!!! After displaying messages MasExit and MasEnterX you could write the following:

mov ah,0Ah
mov dx,temp
int 21h ; Buffered input

Your instruction lea dx, dump + 1 should be lea si, dump + 1
The rest of the code still needs much attention...