diff code_part1/OSTC_code_asm_part1/menu_gassetup.asm @ 105:64109f6fb3d1

added END to GasSetup, small fixes
author heinrichsweikamp
date Sun, 19 Dec 2010 14:27:30 +0100
parents 6f8e3a08011e
children 50a06adabc67
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/menu_gassetup.asm	Wed Dec 15 11:01:35 2010 +0100
+++ b/code_part1/OSTC_code_asm_part1/menu_gassetup.asm	Sun Dec 19 14:27:30 2010 +0100
@@ -409,8 +409,75 @@
 	movwf	POSTINC2
 	movlw	' '
 	movwf	POSTINC2
+	movlw	'('
+	movwf	POSTINC2
+	movlw	'E'
+	movwf	POSTINC2
+	movlw	'N'
+	movwf	POSTINC2
+	movlw	'D'
+	movwf	POSTINC2
+	movlw	':'
+	movwf	POSTINC2
+
+; Show END in m
+	GETCUSTOM8 .18				; ppO2 warnvalue in WREG
+	mullw	d'10'
+	movff	PRODL,xA+0
+	movff	PRODH,xA+1			; ppO2 in [0.01Bar] * 10
+	movf	divemins+0,W
+	addlw	0x06
+	movwf	EEADR
+	call	read_eeprom			; O2 value
+	movff	EEDATA,xB+0
+	clrf	xB+1
+	call	div16x16			;xA/xB=xC with xA as remainder
+	movlw	d'10'
+	subwf	xC+0,F				; Subtract 10m...
+	movff	xC+0,lo
+	movlw	d'0'
+	subwfb	xC+1,F
+	movff	xC+1,hi				; lo:hi holding MOD in meters
+	movlw	d'10'
+	addwf	lo,F
+	movlw	d'0'
+	addwfc	hi,F				; lo:hi holding MOD+10m
+
+	movf	divemins+0,W
+	addlw	0x07
+	movwf	EEADR
+	call	read_eeprom		; He value in % -> EEDATA
+	movlw	d'100'
+	movwf	xA+0
+	movf	EEDATA,W		; He value in % -> EEDATA
+	subwf	xA+0,F			; xA+0 = 100 - He Value in %
+	clrf	xA+1
+	movff	lo,xB+0
+	movff	hi,xB+1			; Copy MOD+10
+	call	mult16x16		;xA*xB=xC
+	movff	xC+0,xA+0
+	movff	xC+1,xA+1
+	movlw	d'100'
+	movwf	xB+0
+	clrf	xB+1
+	call	div16x16		;xA/xB=xC with xA as remainder 	
+	;	xC:2 = ((MOD+10) * 100 - HE Value in %) / 100
+	movlw	d'10'
+	subwf	xC+0,F				; Subtract 10m...
+	movff	xC+0,lo
+	movlw	d'0'
+	subwfb	xC+1,F
+	movff	xC+1,hi
+	output_16
+	movlw	'm'
+	movwf	POSTINC2
+	movlw	')'
+	movwf	POSTINC2
 	movlw	' '
 	movwf	POSTINC2
+	movlw	' '
+	movwf	POSTINC2
+
 	call	word_processor		
 
 	WIN_TOP		.125