- DATA SEGMENT
- BUFFER DB 100
- DB ?
- DB 100 DUP(?)
- CHARS DB 'INPUT:$'
- DATA ENDS
- CODE SEGMENT
- ASSUME CS:CODE,DS:DATA
- MAIN PROC FAR
- PUSH DS
- SUB AX,AX
- PUSH AX
- MOV AX,DATA
- MOV DS,AX
- START: MOV DX,OFFSET CHARS
- MOV AH,9
- INT 21H
- MOV DX,OFFSET BUFFER
- MOV AH,0AH
- INT 21H
- MOV DL,0AH
- MOV AH,2
- INT 21H
- MOV DL,0DH
- MOV AH,2
- INT 21H
- MOV SI,OFFSET BUFFER
- INC SI
- MOV AL,[SI]
- INC SI
- MOV DL,[SI]
- MOV DH,[SI]
- MOV DI,SI
- MOV CL,AL
- MOV CH,0
- MOV BL,1
- MOV BH,0
- DEC CL
- GO1: INC SI
- CMP DL,[SI]
- JNE TO1
- INC BL
- TO1: LOOP GO1
- CALL OUTPUT
- MOV BL,1
- TO5: INC DI
- DEC AL
- CMP AL,1
- JE TO3
- CMP DH,[DI]
- JE TO5
- MOV DL,[DI]
- MOV SI,DI
- MOV CL,AL
- MOV CH,0
- DEC CL
- GO2: INC SI
- CMP [SI],DL
- JNE TO2
- INC BL
- MOV [SI],DH
- TO2: LOOP GO2
- CALL OUTPUT
- MOV BL,1
- JMP TO5
- TO3: CMP DH,[DI]
- JE TO4
- MOV DL,[DI]
- MOV BL,1
- CALL OUTPUT
- TO4: RET
- MAIN ENDP
- ;?-------------------------
- OUTPUT PROC
- PUSH AX
- PUSH CX
- PUSHF
- MOV AH,2
- INT 21H
- MOV DL,20H
- MOV AH,2
- INT 21H
- MOV AL,BL
- MOV AH,0
- MOV CL,10
- DIV CL
- ADD AH,30H
- ADD AL,30H
- MOV CH,AH
- MOV DL,AL
- MOV AH,2
- INT 21H
- MOV DL,CH
- MOV AH,2
- INT 21H
- MOV DL,0AH
- MOV AH,2
- INT 21H
- MOV DL,0DH
- MOV AH,2
- INT 21H
- POPF
- POP CX
- POP AX
- RET
- OUTPUT ENDP
- CODE ENDS
- END MAIN
- ;?-----------------