view code_part1/OSTC_code_asm_part1/spbrgselect.inc @ 124:4f9f477bb452

Rewrite display of decoplan: * Common stuff - fix clearing bottom of list, for fleecker-free updates. - fix "Wait..." topline_box while computing deco in planning - fix 'No Deco" std color and mark last page. - Allow stops up to 240' * ZHL-16c model: - 6 lines max (sim or dive) - Print exceed stops as "add: ddd'" * GF model - 6 lines in divemode, 8 in planning. - any suitable number of pages. - "more..." when not the last page displayed. - fix displaying special depth for last stop (CF#29). - fix 0-time stops: just skip display. - fix end of list when reached the deepest stop. - fix no need to buffer decoplan twice.
author JeanDo
date Sat, 01 Jan 2011 01:57:50 +0100
parents 96a35aeda5f2
children
line wrap: on
line source

RoundResult SET 0				; Rounding function.  RoundResult = Round(aa/bb)

Round	macro aa,bb

	LOCAL rr = aa/bb

	LOCAL d1 = aa - rr*bb

	LOCAL d2 = (rr+1)*bb - aa

RoundResult = rr

	if d1 >= d2

RoundResult++

	endif

	endm



AbsResult SET 0

Abs		macro nr

	if nr>=0

AbsResult = nr

	else

AbsResult = -nr

	endif

	endm

		

	Round xtal,(16*baud)

spbrg_value EQU RoundResult-1



	Round xtal,(16*(spbrg_value+1))

baud_real EQU RoundResult

	Abs(baud_real-baud)

errpercent EQU AbsResult*100/baud

	if errpercent > 4

		ERROR big error in baudrate: #v(errpercent)%

	endif

	if errpercent >= 2

		messg baudrate not exact: #v(errpercent)%

	endif