i made a code to generate Fibonacci sequence elements based on the number given by user and it works fine but i want to make the user input a number in range of [1-25] and if the user enter any other number, it should gives him like a warning to re-enter a suitable number in this range .. so that i made this part of code to proceed this but i still have the problem that whatever the number is, bigger or less than 25 the code works anyways .. here is the part of my code to implement this :
main proc
mov ax,@data ; set up data segment
mov ds,ax
mov ah,9 ; send message with instructions for user
mov dx,offset msg1
int 21h
call keyin ;gets user input
SUB AL, 48 ;changes ASCII value into numeric value for further processing
MOV AH,0
MOV num1 , AX ;saves user input to variable num1
call keyin ;gets user input
SUB AL, 48 ;changes ASCII value into numeric value for further processing
MOV AH,0
MOV num2 , AX ;saves user input to variable num2, so now we have both digits
CHECKINPUT:
CMP AX,25
JAE WARNING
JMP STEP1
WARNING:
mov ah,09
mov dx,offset msg4
int 21h
JMP CHECKINPUT
- BTW am using emu8086
- here is my code if needed
Thanks