diff code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 304:ed08d441ed26

Backed out changeset: 9c39cedb662b
author heinrichsweikamp
date Sat, 30 Apr 2011 14:09:38 +0200
parents 9c39cedb662b
children 77c70898c7aa
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sat Apr 30 14:07:44 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sat Apr 30 14:09:38 2011 +0200
@@ -3082,15 +3082,47 @@
 	bra		PLED_show_end_ead_divemode3	; No, show CC EAD and END
 
 PLED_show_end_ead_divemode2:			; Show OC EAD and END
-; EAD and END: ToDo...
-
-; Show EAD
+; Show EAD: char_I_N2_ratio/0.79*rel_pressure:2*10 -> char_I_N2_ratio*rel_pressure:2/7900 -> EAD in m
 	WIN_LEFT	.125
 	WIN_TOP		.192
-
-; Show END 
+	movff	char_I_N2_ratio,xA+0
+	clrf	xA+1
+	movff	rel_pressure+0,xB+0
+	movff	rel_pressure+1,xB+1
+	call	mult16x16                   ; xA*xB=xC
+	movlw	LOW		d'7900'
+	movwf	xB+0
+	movlw	HIGH	d'7900'
+	movwf	xB+1
+	call	div32x16  ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	movff	xC+0,lo
+	movff	xC+1,hi						; lo:hi now hold EAD in m
+	lfsr	FSR2,letter
+	output_16_3							; Display only full meters
+	STRCAT_PRINT  "m"					; Display EAD
+
 	WIN_LEFT	.125
 	WIN_TOP		.216
+; Show END = rel_pressure × (100 - char_I_He_ratio)/10000 -> Result in m
+	movff	char_I_He_ratio,lo			; temp
+	movlw	d'100'
+	bsf		STATUS,C	
+	subfwb	lo,W
+	movwf	xA+0
+	clrf	xA+1
+	movff	rel_pressure+0,xB+0
+	movff	rel_pressure+1,xB+1
+	call	mult16x16                   ; xA*xB=xC
+	movlw	LOW		d'10000'
+	movwf	xB+0
+	movlw	HIGH	d'10000'
+	movwf	xB+1
+	call	div32x16  ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	movff	xC+0,lo
+	movff	xC+1,hi						; lo:hi now hold END in m
+	lfsr	FSR2,letter
+	output_16_3
+	STRCAT_PRINT  "m"					; Display END
 	return
 
 PLED_show_end_ead_divemode3:			; Show CC EAD, END and pO2[Diluent]
@@ -3138,14 +3170,6 @@
 	STRCAT_PRINT  " "					;  Display ppO2[Diluent]
 
 ; EAD and END: ToDo...
-
-; Show EAD
-	WIN_LEFT	.125
-	WIN_TOP		.192
-
-; Show END 
-	WIN_LEFT	.125
-	WIN_TOP		.216
 	return