zas	segment	stack 'stack'
	dw  64 dup (?)
zas ends
dat 	segment 
	buf db 100 dup (0)
	vstup db dup 15 (0)
	pocet db 00h
	minus	db 00h
	sub_chyba	db 'Nastala nejaka chyba so suborom...',13,10,'$'
	subor	db 'c:\vstup.tgg',0
	handle1	dw 0000h
dat ends
cod     segment 
assume	ss:zas,ds:dat,cs:cod
start:
	mov ax,seg buf
	mov ds,ax

	mov dx,offset subor
	mov ah,3Dh
	xor al,al			;subor len na citanie
	int 21h				;otvorenie suboru "vstup.tgg"
	jnc sub_not_error
	jmp sub_error
sub_not_error:
	mov [handle1],ax		;ulozime si file handler
	mov bx,ax
	mov ah,3Fh
	mov dx,offset buf
	mov cx,100
	int 21h				;nacitame si do buf zo suboru
	jnc sub_not_error2
	mov
	jmp sub_error
sub_not_error2:
	mov ah,3Eh
	mov bx,[handle1]
	int 21h				;zavrieme si subor
	jnc sub_not_error3
	jmp sub_error
sub_not_error3:
	mov [pocet],al			;pocet nacitanych znakov
	mov cx,ax
	xor si,si
prevod_loop:
	cmp [buf+si],'-'
	jnz prevod_loop2
	mov [minus],1
	dec cx
	inc si
	jmp prevod_loop
prevod_loop2:
	
	jmp koniec
sub_error:
	mov dx,offset sub_chyba
	mov ah,09h
	int 21h
koniec:
	mov ax,4c00h
	int 21h	
cod ends

end start

;doplnkovy kod:
;		10 =  00001010
;		-10 = 11110101 + 1 = 11110110
;				     00001010
;				     00000000