Write an assembly program to search the unsigned array for the unsigned number input from the keyboard, if it exists, output the position of the number in the array and the number, and if it does not exist, output an error message.

Reminder: The following is the text of this article, the following case is for reference

Reminder: The following is the text of this article, the following case is for reference

The code is as follows (example):

DATA SEGMENT
    data1 dw 0,1,2,3233,4,5,6,7,8,9
    INPUTTIPS DB 'Please input score,divided with " ":$'
ERRORTIPS DB 'input ERROR!, please try again! $'
tips DB 'not find$'
sii1 dB 0

ENDTIPS DB 'results:$'

DATA ENDS

STACK SEGMENT
       DB 200 DUP (0)
STACK ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA,SS:STACK
START:
    MOV AX, DATA
              MOV DS,AX
              MOV AX, STACK
              MOV SS,AX
        CALL BEGIN
            

            
            
            CALL INPUT; display results
                
            CALL NEXT
            call PRINT
    
    ;Enter snippet code here
    MOV AH,4CH
    INT 21H

;========================== BEGIN========================= =====
BEGIN PROC NEAR
 
                                MOV DX,OFFSET INPUTTIPS ;Display prompt input
                                MOV AH,09H ;09h means display string
                                INT 21H ; call dos
 
                                XOR AX,AX
                                XOR BX,BX
                                XOR CX,CX
                                XOR SI,SI
                                XOR DI, DI ; register clear
 
                       
                RET
BEGIN ENDP
;=========================== INPUT======================== ====
INPUT PROC NEAR
                MOV AH,1 ; keyboard input and echo al is equal to the input character
                                INT 21H ; input data from keyboard
                                CMP AL,0DH ;Enter key is 0DH
                                JZ ENDINPUT ; zf (zero flag) = 1 jump, whether it is the enter key
                               
 
               CMP AL,30H
                                JB ERROR; left is less than right jump
               CMP AL,39H
               JA ERROR; jump left greater than right, the ascii code of 0-9 is 30h to 39h
 
                                SUB AL,30H ; become true number
                                MOV CL,4
                                SHL BX, CL ; Shift four bits to the left. Change to BCD code (binary code decimal) four-bit binary means 1-digit decimal
                                ADD BL,AL
                                JMP INPUT
ENDINPUT:
 
                                MOV DX,OFFSET ENDTIPS ;Display output prompts
                                MOV AH,09H
                                INT 21H ; DI gets the number, DI remains unchanged
                JMP INPUTEND
ERROR: mov dx, offset ERRORTIPS
                mov ah,09h
                int 21h
                CALL NEXT
                jmp START
              
    
INPUTEND: RET
INPUT ENDP
;========================== PRINT=========================
PRINT PROC NEAR
            MOV SI,0
            ADD sii1,1
            
            call BCD_TO_HEN
            MOV CX,10
            
            
            mov si,offset data1

    LMAX:
            
            
            CMP BX,[si]
            
                    JE NEXT1
                ADD sii1,1
                ADD SI,2
            LOOP LMAX
    NEXT1:
            ;ADD SI,1
            ;LOOP LMAX
            ;XOR BX,BX
            ;MOV bx,sii1
               ; CALL PRINTINT
                ;MOV AL,sii1
                ;ADD AL,30H
              ;call PRINTINT
                
               
              call PRINTINT
                add sii1,30H
                CMP sii1,30H
                                JB next2; left less than right jump
               CMP sii1,39H
               JA next2; left is greater than right jump, the ascii code of 0-9 is 30h to 39h
               MOV DL, sii1
               MOV AH,02h
               INT 21h
            
            
            RET
next2:
        
        mov dx, offset tips
        mov AH,09h
        int 21h
        ret
PRINT ENDP

              
;=========================== Line break ==========================
NEXT:
    mov dl,0ah; newline corresponds to ASCII code
    mov ah,02h
    int 21h
    mov dl,0dh; ASCII code corresponding to carriage return
    mov ah,02h; output DL content
    int 21h
    ret
;==========

;========================== BCD to HEX ==================== ======
BCD_TO_HEN PROC NEAR
 
        PUSH CX
        PUSH AX
        PUSH DX
        PUSH SI
        PUSH DI
        XOR DX, DX
        
        MOV AX, BX
        PUSH AX
        AND AX,0F000H; Take thousands digit
        MOV CL, 4 ; Shift out ten digits
        SHR AX, CL
        MOV DH, AH
        POP AX
        
        PUSH AX
        AND AX, 0F00H ; take hundreds digit
        MOV DL, AH
        POP AX
        
        PUSH AX
        MOV AX, DX
        AAD
        MOV DI, 100 ; multiply by 100
        MULDI
        MOV SI, AX
        POP AX
        
        PUSH AX
        MOV CL, 4 ; Shift out ten digits
        SHR AX, CL
        AND AX, 000FH
        MOV DH, AL
        POP AX
        
        PUSH AX
        AND AX, 000FH ; Take the lower four digits of AL, single digits
        MOV DL, AL
        POP AX
        
        MOV AX, DX
        AAD
        ADD AX, SI
        
        MOV BX, AX ; Convert result to BX
        
        POP DI
        POP SI
        POP DX
        POP AX
        POP CX
        RET
BCD_TO_HENENDP
;=============================================================================================================================== ========
HEN_TO_BCD PROC NEAR
        PUSH AX
                PUSH CX
        PUSH DX
        XOR DX,DX
        MOV AX,BX
        MOV BX,0000H
                MOV CX, 1000
                DIV CX
        
        
        MOV CL,4
        AND AX,000FH
        ADD BX,AX
        ROL BX,CL
        
       
                MOV AX,DX ; put the remainder in AX
                MOV CL,100
                DIV CL
        PUSH AX
                AND AX,000FH
        ADD BX,AX
        MOV CL,4
        ROL BX,CL
        POP AX
 
                MOV AL,AH; divide the remainder by 10
                AND AX,00FFH
                MOV CL,10
                DIV CL
               AND AL,0FH
        ADD BL,AL
        MOV CL,4
        ROL BX,CL
 
                ADD BL,AH
 
              POP DX
                POP CX
                POP AX
         RET
HEN_TO_BCDENDP

;====================== Print the hexadecimal number as a BCD integer ======================
PRINTINT PROC NEAR
            PUSH BX
            PUSH CX
                PUSH AX
                PUSH DX
 
            MOV AX,BX
            CALL HEN_TO_BCD ; The result is converted to BCD code
             MOV DL,BH
             MOV CL,4
                        SHR DL,CL
                        ADD DL,30H
                        CMP DL,30H
                        JZ l1
                        MOV AH,02H; output thousands digit
                        INT 21H
        
l1: MOV DL, BH ; output hundreds
                       AND DL,0FH
                       ADD DL,30H
                       CMP DL,30H
                        JZ l2
                       MOV AH,02H
                       INT 21H
l2: MOV DL, BL ; output tens digit
                            MOV CL,4
                            SHR DL,CL
                            ADD DL,30H
                            CMP DL,30H
                        JZ l3
                           MOV AH,02H
                            INT 21H
l3: MOV DL, BL
                        and dl,0FH ; output a single digit
                            ADD DL,30H
                            MOV AH,02H
                            INT 21H
        MOV DL,20H ; output space
                                MOV AH,02H
                                INT 21H
            
 
            POP DX
            POP AX
                    POP CX
            POP BX
                    RET
PRINTINT ENDP




CODE ENDS
    END START