MYCODE SEGMENT 'CODE'
 ASSUME CS:MYCODE,DS:MYCODE
 alf DB '0123456789ABCDEF'
 Stud DB "Vorjeva V.I. IU5-42 Var_4$"
 Vyhod DB "To exit enter '*'$"
 str db 256 dup(0)
 START:
	 PUSH CS
	 POP DS
	 PUSH DS
	 POP ES
	 CALL ClrScr
	 MOV DX,offset Stud
	 MOV AH,09
	 INT 21h
	 CALL CLRF
	 Cycle1:
	 	MOV DI,0
	 Cycle2:
		 @char:
			 MOV AH,08
			 INT 21h
			 cmp AL,21h
			 jb @char
		 MOV str[di],AL
		 CMP AL, '$'
		 JNE ENIF
	 	 JMP ENDEF
	 		ENIF:
		 		MOV DL,AL
		 		CALL PutCh
	 		ENDEF:
		 		INC DI
		 		CMP AL,'$'
		 		JNE Cycle2
		 		MOV DL, '='
		 		CALL PutCh
		 		MOV DI, 0
	 Cycle3:
		 MOV DL,str[di]
		 PUSH DX
		 CMP DL, '$'
	 	 JNE Hexing
	 	 JMP G1
	 		Hexing:
			 	CALL Hex
			 	INC DI
			 	MOV DL, ' '
			 	CALL PutCh
	 		G1:
	 	 		POP DX
	 	 		CMP DL, '$'
	 	 		JNE Cycle3
	 	 CALL Clrf
	 	 MOV DX, offset Vyhod
	 	 MOV AH,09
	 	 INT 21h
	 	 MOV AH,08h
	 	 INT 21h
	 	 PUSH AX
	 	 CALL Clrf
	 	 POP AX
	 	 CMP AL, '*'
		 JNE Cycle1
	 	 CALL Clrf
	 	 CALL GetCh
	 	 CALL ClrScr
	 MOV AL,0
	 MOV AH,4ch
	 int 21h
 	Hex PROC
		 MOV AX,DX
		 PUSH AX
		 shr AL,1
		 shr AL,1
		 shr AL,1
		 shr AL,1
		 MOV BX, offset alf
		 XLAT
		 MOV DL,AL
		 CALL PutCh
		 POP AX
		 and AL,00001111b
		 XLAT
		 MOV DL,AL
		 CALL PutCh
		 ret
 	Hex ENDP
 	PutCh Proc
		 MOV AH,02h
		 INT 21h
		 ret
 	PutCh ENDP
	ClrScr PROC
		 MOV AH,00
		 MOV AL,03
		 INT 10h
		 ret
	ClrScr ENDP
	GetCh PROC
		 MOV AH,01H
		 INT 021H
		 RET
	GetCh ENDP
 	Clrf PROC
		 MOV AH,02
		 MOV DL,13
		 INT 21H
		 MOV AH,02
		 MOV DL,10
		 INT 21H
		 RET
 	Clrf ENDP
 MYCODE ENDS
 END START