.model small
.code
org 100h
start:	
        mov ah, 0Ah
	mov dx,	offset isize
	int 21h

	mov di,	offset iinp
	mov si,	offset num1

loop3:	cmp byte ptr [di], ' '
	je num1end1
	cmp byte ptr [di], '+'
	je num1end2
	cmp byte ptr [di], '-'
	je num1end2
	cmp byte ptr [di], '*'
	je num1end2
	cmp byte ptr [di], '/'
	je num1end2

	mov al, [di]
        mov [si], al
	inc si
	inc di
	jmp loop3
num1end1:
	inc di
	cmp byte ptr [di], '+'
	je num1end2
	cmp byte ptr [di], '-'
	je num1end2
	cmp byte ptr [di], '*'
	je num1end2
	cmp byte ptr [di], '/'
	je num1end2

num1end2:
	mov byte ptr [si], 0
	mov si,	offset deyst
	mov al,	[di]
	mov [si], al
	inc di

loop4:	cmp byte ptr [di], ' '
	jne num2beg
	inc di
	jmp loop4
num2beg:mov si,	offset num2
loop5:	mov al, [di]
        mov [si], al
	inc si
	inc di
	cmp byte ptr [di], 0Dh
	je rends
	jmp loop5
rends:	mov byte ptr [si], 0
	mov si,	offset num2
	call StrToByte
	PUSH ax
	mov si,	offset num1
	call StrToByte
	POP BX
;---------------------------------------
	mov di,	offset deyst
	cmp byte ptr [di],'*'
	je umnoch
	cmp byte ptr [di],'+'
	je plus
	cmp byte ptr [di],'-'
	je minus
	mov ah,	0
	div bl
	mov dl,	al
	jmp prints
umnoch: mul bl
	mov dl,	al
	jmp prints

plus:	add al, bl
	mov dl,	al
	jmp prints

minus:	sub al, bl
	mov dl,	al

prints:	PUSH	dx
	mov ah,	02h
	mov dl,	0dh
	int 21h
	mov ah,	02h
	mov dl,	0ah
	int 21h
	POP dx
	call print_dec
	int 20h
;print_char
	print_char	proc	near
	mov ah, 02h
	int 21h
	ret
	endp
;print_dec	
	print_dec	proc	near

	mov di,	offset outp
	mov al, dl
	mov ah, 0
	mov bl,	100
	mov cx,	2

loop1:	div bl
	PUSH ax
	cmp al,	0
	je dontadd

	mov dl, al
	mov dh,	0
	add dx, '0'
	mov byte ptr [di], dl
	inc di

dontadd:
	mov dl,	10
	mov ah,	0
	mov al,	bl
	div dl
	mov bl,	al
	POP ax
	mov al,	ah
	mov ah, 0
	loop loop1 

	mov dl, al
	mov dh,	0
	add dx, '0'
	mov byte ptr [di], dl
	inc di
	mov byte ptr [di], '$'
	mov ah,	09h
	mov dx,	offset outp
	int 21h
	ret
	endp
;StrToByte
	StrToByte	proc	near
	mov bl,	0
	mov al,	[si]
	sub al,	'0'
loop2:  PUSH ax
	mov al,	10
	mul bl
	mov bl, al
	POP ax
	add bl, al
	inc si
	mov al,	[si]
        cmp al,	0
	je fends
	sub al,	'0'
	jmp loop2
fends:  mov al, bl
	ret
	endp

outp 	db 4 dup (?)
isize	db 10
ireal	db ?
iinp	db 10 dup (?)
num1	db 4 dup (?)
num2	db 4 dup (?)
deyst	db ?
end start