org 256

	mov cx, 423
	mov bx, array
	
cykl	xor ax, ax
	mov al, [bx]
	
	xor dx, dx
	mov dl, [min]
	cmp al, dl
	ja vetsi     		;cislo neni mensi nebo rovno minimu
	mov [min], al		;je mensi nebo stejne  tak ulozim
	mov [imin], cx
	
vetsi	mov dl, [max]
	cmp al, dl
	jb mensi		;neni to max	
	mov [max], al
	mov [imax], cx		;zde je v CX neco jineho nez ma byt
	
mensi	inc bx
	loop cykl

	xor ax, ax
	mov al, [max]
	call vypis
	call crlf

	xor ax, ax
	mov al, [min]
	call vypis
	call crlf
	
	mov dx, [imin]
	mov ax, 424
	sub ax, dx
	call vypis
	call crlf
	
	mov dx, [imax]
	mov ax, 424
	sub ax, dx
	call vypis
	call crlf
	
	ret

vypis:	mov BX, 10
	xor CX, CX

loop1:	xor DX, DX
	div BX
	push DX
	inc CX
	cmp AX, 0
	jnz loop1

loop2:	pop DX
	add DX, 48
	mov AH, 2
	int 21h
	loop loop2

	ret

crlf:	mov DX, 10
	mov AH, 2
	int 21h
	mov DX, 13
	mov AH, 2
	int 21h
	ret

min	db 0ffh
max	db 0h

imin	dw 0h
imax	dw 0h



array	db 0ffh,04bh,003h,004h,014h,000h,002h,000h,008h,000h,04ah,0bdh
	db 042h,02bh,04ah,0b9h,0fah,07eh,02fh,001h,000h,000h,085h,002h
	db 000h,000h,00bh,000h,000h,000h,055h,04ch,04fh,048h,041h,05fh
	db 031h,02eh,041h,053h,04dh,075h,052h,0cbh,04eh,0c4h,030h,00ch
	db 03ch,0b7h,052h,0ffh,0c1h,0b7h,05eh,0b2h,0abh,0eeh,0c2h,005h
	db 071h,082h,0dfh,040h,01ch,0b2h,04dh,0b6h,0c9h,02ah,04dh,04ah
	db 092h,0a2h,0c0h,0d7h,063h,027h,07dh,080h,0b4h,048h,03dh,0d8h
	db 09eh,019h,067h,06ch,0b7h,072h,07eh,080h,053h,0d7h,0a9h,0a6h
	db 0aeh,082h,01ch,046h,069h,023h,01ch,0a3h,04ch,0b1h,0a9h,09bh
	db 0fah,0f9h,070h,038h,0c0h,02bh,045h,046h,0dah,021h,02ah,000h
	db 0f9h,031h,0c3h,0e3h,0f9h,081h,04ah,0d5h,0e8h,03eh,0e1h,092h
	db 018h,0f7h,09eh,07fh,02dh,069h,09fh,058h,061h,062h,03eh,0cdh
	db 041h,021h,0beh,051h,045h,062h,0ddh,0f5h,08ah,048h,090h,0dch
	db 0f7h,0aah,0eah,0c7h,009h,084h,061h,06fh,097h,0f4h,08eh,08ch
	db 05bh,00fh,0d6h,0c5h,051h,0dbh,095h,0bdh,021h,094h,005h,0cdh
	db 0a8h,053h,061h,064h,025h,081h,04ch,0a8h,05dh,0c9h,0d3h,0aah
	db 054h,0bfh,095h,062h,057h,0f2h,054h,069h,0dbh,067h,04bh,095h
	db 071h,06eh,082h,062h,004h,033h,0fch,092h,0f3h,0c0h,071h,098h
	db 0b5h,00bh,037h,0a5h,07bh,09eh,0e2h,04fh,0d5h,060h,0dch,073h
	db 063h,060h,0f2h,0dah,046h,0a2h,060h,0abh,0cch,0b8h,05fh,0b5h
	db 072h,028h,0c1h,0deh,08ah,00bh,041h,08fh,005h,0fdh,0afh,068h
	db 061h,008h,04dh,0ebh,0cbh,068h,021h,08ah,079h,09ch,0f6h,00dh
	db 03dh,061h,088h,010h,09ch,04fh,064h,0d5h,0cbh,0fdh,068h,02fh
	db 014h,011h,079h,03dh,0cbh,0a9h,06bh,06ah,03eh,070h,0dch,01eh
	db 04dh,08ah,0b7h,010h,0f4h,08ch,0d0h,004h,0d2h,07bh,056h,06ch
	db 0e3h,0dfh,0beh,041h,026h,01dh,057h,0c7h,062h,01bh,02dh,0ebh
	db 017h,097h,054h,025h,056h,059h,08bh,062h,0e7h,0c5h,034h,0bah
	db 06ah,0bbh,0f6h,09eh,0afh,0fch,09fh,0d0h,005h,02eh,0dah,042h
	db 01bh,0dch,02dh,017h,08eh,098h,0b5h,03fh,050h,04bh,001h,002h
	db 014h,000h,014h,000h,002h,000h,008h,000h,04ah,0bdh,042h,02bh
	db 04ah,0b9h,0fah,07eh,02fh,001h,000h,000h,085h,002h,000h,000h
	db 00bh,000h,000h,000h,000h,000h,000h,000h,001h,000h,020h,000h
	db 000h,000h,000h,000h,000h,000h,055h,04ch,04fh,048h,041h,05fh
	db 031h,02eh,041h,053h,04dh,050h,04bh,005h,006h,000h,000h,000h
	db 000h,001h,000h,001h,000h,039h,000h,000h,000h,058h,001h,000h
	db 000h,000h,000h

