Compare each input digit to the value
1
and if it is greater then put a message and ask for it again. You could simplify things by creating a subroutine to do the collecting of the numbers which you call by:
LEA DX, PROMPT_2 ; load and display the string PROMPT_2
CALL @GETNUM ; get the number
; ...
; ... repeat for second number
; ... do compares and diplay results etc ...
And the actual subroutine would be something like:
; this subroutine displays the prompt pointed to by DX
; and gets a binary number in AX
@GETNUM:
MOV AH, 9
INT 21H
MOV CX, 8 ; initialize loop counter
MOV AH, 1 ; set input function
@NUMLOOP: ; loop label
INT 21H ; read a character
CMP AL, 0DH ; compare AL with CR
JE @EXIT_LOOP ; jump to label @EXIT_LOOP_2
AND AL, 0FH ; convert ascii into decimal code
;
; add code here to test for valid input
;
SHL BH, 1 ; shift BH towards left by 1 position
OR BH, AL ; set the LSB of BH with LASB of AL
LOOP @NUMLOOP ; jump to label @LOOP_2 if CX!=0
@EXIT_LOOP:
XOR AX,AX
OR AL,BH
RET ; return result in AX
You could also improve your code slightly by writing:
CMP AL, 0DH ; compare AL with CR
JE @EXIT_LOOP_2 ; CR character, jump to label @EXIT_LOOP_2
rather than
CMP AL, 0DH ; compare AL with CR
JNE @SKIP_2 ; jump to label @SKIP_2 if AL!=0DH
JMP @EXIT_LOOP_2 ; jump to label @EXIT_LOOP_2
@SKIP_2: ; jump label