		.model		small
		.386
		.stack		100h

	if1
		include		mymacs.inc	; Get the file with the macros
	endif

		.data
start	db		"These are my results",0
highs	dd		45, 50, 49, 56, 53, 60, 44, 34, 38, 50
lows	dd		33, 30, 38, 40, 35, 44, 30, 29, 30, 31
diffs	dd		10 dup(?)
highest	dd		?
total	dd		?
tlabel	db		"Total differences ",0
hlabel	db		"The highest temperature is ", 0
llabel	db		"The lowest temperature is ", 0
dlabel	db		"The differences are:",0
header	db		100 dup(?)
		.code
		extern		Writestring:proc, Writelong:proc, crlf:proc
main	proc
		gmov	ds, @data
		gmov	cx, 10
		gmov	highest, highs		; Init highest
		gmov	eax, lows			; Init lowest
		gmov	total, 0			; Init difference total
		gmov	si, 0				; Init array position
top:
		sub3	diffs[si], highs[si], lows[si]	; Get difference
		add2	total, diffs[si]		; Add to total
		gcmp	highs[si], highest		; Check for new high
		jng		skip
		gmov	highest, highs[si]
skip:
		gcmp	lows[si], eax			; Check for new low
		jnl		hop
		gmov	eax, lows[si]
hop:
		add2	si, 4				; On to next entries
		loop	top
		smov	header, start
		showstring	header			; Display heading
		newline
		showstring	tlabel			; Display total differences
		shownumber	total
		newline
		showstring	hlabel			; Display highest temperature
		shownumber	highest
		newline
		showstring	llabel			; Display lowest temperature
		shownumber	eax
		newline
		showstring	dlabel			; Display all differences
		newline
		gmov	cx, 10
		gmov	si, 0
round:
		shownumber	diffs[si]		; One difference per line
		newline
		add2	si, 4
		loop	round
		gmov	ax, 4c00h
		int		21h
main endp

end	main

