diff code_part1/OSTC_code_asm_part1/divemode.asm @ 281:f8f865c70a0d

no more sorted gaslist...
author heinrichsweikamp
date Tue, 19 Apr 2011 09:54:33 +0200
parents a728b4a1b660
children 5351d47ee28a
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Apr 19 07:37:56 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Apr 19 09:54:33 2011 +0200
@@ -335,9 +335,9 @@
 
 divemode_check_decogases:					; CALLed from Simulator
 ; Copy active gases to char_I_deco_N2_ratio and char_I_deco_He_ratio
-	read_int_eeprom		d'97'			; Read He ratio
+	read_int_eeprom		d'5'			; Read He ratio
 	movff	EEDATA,char_I_deco_He_ratio+4	; And copy into hold register
-	read_int_eeprom		d'96'			; Read O2 ratio
+	read_int_eeprom		d'4'			; Read O2 ratio
 	movff	char_I_deco_He_ratio+4, wait_temp			; copy into bank1 register
 	bsf		STATUS,C					; 
 	movlw	d'100'						; 100%
@@ -345,9 +345,9 @@
 	subfwb	EEDATA,F					; minus O2
 	movff	EEDATA, char_I_deco_N2_ratio+4; = N2!
 
-	read_int_eeprom		d'101'			; Read He ratio
+	read_int_eeprom		d'9'			; Read He ratio
 	movff	EEDATA,char_I_deco_He_ratio+3	; And copy into hold register
-	read_int_eeprom		d'100'			; Read O2 ratio
+	read_int_eeprom		d'8'			; Read O2 ratio
 	movff	char_I_deco_He_ratio+3, wait_temp			; copy into bank1 register
 	bsf		STATUS,C					; 
 	movlw	d'100'						; 100%
@@ -355,9 +355,9 @@
 	subfwb	EEDATA,F					; minus O2
 	movff	EEDATA, char_I_deco_N2_ratio+3; = N2!
 
-	read_int_eeprom		d'105'			; Read He ratio
+	read_int_eeprom		d'13'			; Read He ratio
 	movff	EEDATA,char_I_deco_He_ratio+2	; And copy into hold register
-	read_int_eeprom		d'104'			; Read O2 ratio
+	read_int_eeprom		d'12'			; Read O2 ratio
 	movff	char_I_deco_He_ratio+2, wait_temp			; copy into bank1 register
 	bsf		STATUS,C					; 
 	movlw	d'100'						; 100%
@@ -365,9 +365,9 @@
 	subfwb	EEDATA,F					; minus O2
 	movff	EEDATA, char_I_deco_N2_ratio+2; = N2!
 
-	read_int_eeprom		d'109'			; Read He ratio
+	read_int_eeprom		d'17'			; Read He ratio
 	movff	EEDATA,char_I_deco_He_ratio+1	; And copy into hold register
-	read_int_eeprom		d'108'			; Read O2 ratio
+	read_int_eeprom		d'16'			; Read O2 ratio
 	movff	char_I_deco_He_ratio+1, wait_temp			; copy into bank1 register
 	bsf		STATUS,C					; 
 	movlw	d'100'						; 100%
@@ -375,9 +375,9 @@
 	subfwb	EEDATA,F					; minus O2
 	movff	EEDATA, char_I_deco_N2_ratio+1; = N2!
 
-	read_int_eeprom		d'113'			; Read He ratio
+	read_int_eeprom		d'21'			; Read He ratio
 	movff	EEDATA,char_I_deco_He_ratio+0; And copy into hold register
-	read_int_eeprom		d'112'			; Read O2 ratio
+	read_int_eeprom		d'20'			; Read O2 ratio
 	movff	char_I_deco_He_ratio+0, wait_temp			; copy into bank1 register
 	bsf		STATUS,C					; 
 	movlw	d'100'						; 100%
@@ -385,32 +385,108 @@
 	subfwb	EEDATA,F					; minus O2
 	movff	EEDATA, char_I_deco_N2_ratio+0; = N2!
 
-; Now, set change depth. Inactive gases have depth=0!
-	read_int_eeprom		d'118'				; read gas_change_depth Gas1
+	read_int_eeprom		d'28'				; read gas_change_depth Gas1
 	btfss	sorted_gaslist_active,0			; Apply depth?
 	clrf	EEDATA							; No, clear!
 	movff	EEDATA,char_I_deco_gas_change+4	; Yes!
 
-	read_int_eeprom		d'119'				; read gas_change_depth Gas2
+	read_int_eeprom		d'29'				; read gas_change_depth Gas2
 	btfss	sorted_gaslist_active,1			; Apply depth?
 	clrf	EEDATA							; No, clear!
 	movff	EEDATA,char_I_deco_gas_change+3	; Yes!
 
-	read_int_eeprom		d'120'				; read gas_change_depth Gas3
+	read_int_eeprom		d'30'				; read gas_change_depth Gas3
 	btfss	sorted_gaslist_active,2			; Apply depth?
 	clrf	EEDATA							; No, clear!
 	movff	EEDATA,char_I_deco_gas_change+2	; Yes!
 
-	read_int_eeprom		d'121'				; read gas_change_depth Gas4
+	read_int_eeprom		d'31'				; read gas_change_depth Gas4
 	btfss	sorted_gaslist_active,3			; Apply depth?
 	clrf	EEDATA							; No, clear!
 	movff	EEDATA,char_I_deco_gas_change+1	; Yes!
 
-	read_int_eeprom		d'122'				; read gas_change_depth Gas5
+	read_int_eeprom		d'32'				; read gas_change_depth Gas5
 	btfss	sorted_gaslist_active,4			; Apply depth?
 	clrf	EEDATA							; No, clear!
 	movff	EEDATA,char_I_deco_gas_change+0	; Yes!
 
+
+;	read_int_eeprom		d'97'			; Read He ratio
+;	movff	EEDATA,char_I_deco_He_ratio+4	; And copy into hold register
+;	read_int_eeprom		d'96'			; Read O2 ratio
+;	movff	char_I_deco_He_ratio+4, wait_temp			; copy into bank1 register
+;	bsf		STATUS,C					; 
+;	movlw	d'100'						; 100%
+;	subfwb	wait_temp,W					; minus He
+;	subfwb	EEDATA,F					; minus O2
+;	movff	EEDATA, char_I_deco_N2_ratio+4; = N2!
+;
+;	read_int_eeprom		d'101'			; Read He ratio
+;	movff	EEDATA,char_I_deco_He_ratio+3	; And copy into hold register
+;	read_int_eeprom		d'100'			; Read O2 ratio
+;	movff	char_I_deco_He_ratio+3, wait_temp			; copy into bank1 register
+;	bsf		STATUS,C					; 
+;	movlw	d'100'						; 100%
+;	subfwb	wait_temp,W					; minus He
+;	subfwb	EEDATA,F					; minus O2
+;	movff	EEDATA, char_I_deco_N2_ratio+3; = N2!
+;
+;	read_int_eeprom		d'105'			; Read He ratio
+;	movff	EEDATA,char_I_deco_He_ratio+2	; And copy into hold register
+;	read_int_eeprom		d'104'			; Read O2 ratio
+;	movff	char_I_deco_He_ratio+2, wait_temp			; copy into bank1 register
+;	bsf		STATUS,C					; 
+;	movlw	d'100'						; 100%
+;	subfwb	wait_temp,W					; minus He
+;	subfwb	EEDATA,F					; minus O2
+;	movff	EEDATA, char_I_deco_N2_ratio+2; = N2!
+;
+;	read_int_eeprom		d'109'			; Read He ratio
+;	movff	EEDATA,char_I_deco_He_ratio+1	; And copy into hold register
+;	read_int_eeprom		d'108'			; Read O2 ratio
+;	movff	char_I_deco_He_ratio+1, wait_temp			; copy into bank1 register
+;	bsf		STATUS,C					; 
+;	movlw	d'100'						; 100%
+;	subfwb	wait_temp,W					; minus He
+;	subfwb	EEDATA,F					; minus O2
+;	movff	EEDATA, char_I_deco_N2_ratio+1; = N2!
+;
+;	read_int_eeprom		d'113'			; Read He ratio
+;	movff	EEDATA,char_I_deco_He_ratio+0; And copy into hold register
+;	read_int_eeprom		d'112'			; Read O2 ratio
+;	movff	char_I_deco_He_ratio+0, wait_temp			; copy into bank1 register
+;	bsf		STATUS,C					; 
+;	movlw	d'100'						; 100%
+;	subfwb	wait_temp,W					; minus He
+;	subfwb	EEDATA,F					; minus O2
+;	movff	EEDATA, char_I_deco_N2_ratio+0; = N2!
+;
+; Now, set change depth. Inactive gases have depth=0!
+;	read_int_eeprom		d'118'				; read gas_change_depth Gas1
+;	btfss	sorted_gaslist_active,0			; Apply depth?
+;	clrf	EEDATA							; No, clear!
+;	movff	EEDATA,char_I_deco_gas_change+4	; Yes!
+;
+;	read_int_eeprom		d'119'				; read gas_change_depth Gas2
+;	btfss	sorted_gaslist_active,1			; Apply depth?
+;	clrf	EEDATA							; No, clear!
+;	movff	EEDATA,char_I_deco_gas_change+3	; Yes!
+;
+;	read_int_eeprom		d'120'				; read gas_change_depth Gas3
+;	btfss	sorted_gaslist_active,2			; Apply depth?
+;	clrf	EEDATA							; No, clear!
+;	movff	EEDATA,char_I_deco_gas_change+2	; Yes!
+;
+;	read_int_eeprom		d'121'				; read gas_change_depth Gas4
+;	btfss	sorted_gaslist_active,3			; Apply depth?
+;	clrf	EEDATA							; No, clear!
+;	movff	EEDATA,char_I_deco_gas_change+1	; Yes!
+;
+;	read_int_eeprom		d'122'				; read gas_change_depth Gas5
+;	btfss	sorted_gaslist_active,4			; Apply depth?
+;	clrf	EEDATA							; No, clear!
+;	movff	EEDATA,char_I_deco_gas_change+0	; Yes!
+
 ; Debugger
 ;	call	enable_rs232	
 ;	movff	char_I_deco_He_ratio+4,TXREG
@@ -946,7 +1022,8 @@
 	call	div16x16				; compute depth in full m -> result in xC+0
 
 check_gas_change1:					; check gas1 
-	read_int_eeprom		d'27'		; read flag register
+;	read_int_eeprom		d'27'		; read flag register
+	movff	sorted_gaslist_active,EEDATA	; Get flag register
 	btfss	EEDATA,0				; check active flag
 	bra		check_gas_change2		; skip inactive gases!
 	movlw	d'1'
@@ -967,7 +1044,8 @@
 	bsf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
 
 check_gas_change2:					; check gas2
-	read_int_eeprom		d'27'		; read flag register
+;	read_int_eeprom		d'27'		; read flag register
+	movff	sorted_gaslist_active,EEDATA	; Get flag register
 	btfss	EEDATA,1				; check active flag
 	bra		check_gas_change3		; skip inactive gases!
 	movlw	d'2'
@@ -988,7 +1066,8 @@
 	bsf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
 
 check_gas_change3:					; check gas3
-	read_int_eeprom		d'27'		; read flag register
+;	read_int_eeprom		d'27'		; read flag register
+	movff	sorted_gaslist_active,EEDATA	; Get flag register
 	btfss	EEDATA,2				; check active flag
 	bra		check_gas_change4		; skip inactive gases!
 	movlw	d'3'
@@ -1009,7 +1088,8 @@
 	bsf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
 
 check_gas_change4:					; check gas4
-	read_int_eeprom		d'27'		; read flag register
+;	read_int_eeprom		d'27'		; read flag register
+	movff	sorted_gaslist_active,EEDATA	; Get flag register
 	btfss	EEDATA,3				; check active flag
 	bra		check_gas_change5		; skip inactive gases!
 	movlw	d'4'
@@ -1030,7 +1110,8 @@
 	bsf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
 
 check_gas_change5:					; check gas5
-	read_int_eeprom		d'27'		; read flag register
+;	read_int_eeprom		d'27'		; read flag register
+	movff	sorted_gaslist_active,EEDATA	; Get flag register
 	btfss	EEDATA,4				; check active flag
 	bra		check_gas_change6		; skip inactive gases!
 	movlw	d'5'
@@ -1775,24 +1856,31 @@
 	movff	EEDATA, char_I_N2_ratio		; = N2!
 
 ; Configure sorted_gaslist_active flag register
-	clrf	sorted_gaslist_active	; Clear all flags
-	read_int_eeprom		d'118'		; read gas_change_depth Gas1
-	tstfsz	EEDATA					; =0m?
-	bsf		sorted_gaslist_active,0	; No, Set Flag for Gas1
+	read_int_eeprom	d'27'
+	movff	EEDATA, sorted_gaslist_active
+	return
 
-	read_int_eeprom		d'119'		; read gas_change_depth Gas2
-	tstfsz	EEDATA					; =0m?
-	bsf		sorted_gaslist_active,1	; No, Set Flag for Gas2
 
-	read_int_eeprom		d'120'		; read gas_change_depth Gas3
-	tstfsz	EEDATA					; =0m?
-	bsf		sorted_gaslist_active,2	; No, Set Flag for Gas3
-
-	read_int_eeprom		d'121'		; read gas_change_depth Gas4
-	tstfsz	EEDATA					; =0m?
-	bsf		sorted_gaslist_active,3	; No, Set Flag for Gas4
-
-	read_int_eeprom		d'122'		; read gas_change_depth Gas5
-	tstfsz	EEDATA					; =0m?
-	bsf		sorted_gaslist_active,4	; No, Set Flag for Gas5
-	return
+;
+;	clrf	sorted_gaslist_active	; Clear all flags
+;	read_int_eeprom		d'118'		; read gas_change_depth Gas1
+;	tstfsz	EEDATA					; =0m?
+;	bsf		sorted_gaslist_active,0	; No, Set Flag for Gas1
+;
+;	read_int_eeprom		d'119'		; read gas_change_depth Gas2
+;	tstfsz	EEDATA					; =0m?
+;	bsf		sorted_gaslist_active,1	; No, Set Flag for Gas2
+;
+;	read_int_eeprom		d'120'		; read gas_change_depth Gas3
+;	tstfsz	EEDATA					; =0m?
+;	bsf		sorted_gaslist_active,2	; No, Set Flag for Gas3
+;
+;	read_int_eeprom		d'121'		; read gas_change_depth Gas4
+;	tstfsz	EEDATA					; =0m?
+;	bsf		sorted_gaslist_active,3	; No, Set Flag for Gas4
+;
+;	read_int_eeprom		d'122'		; read gas_change_depth Gas5
+;	tstfsz	EEDATA					; =0m?
+;	bsf		sorted_gaslist_active,4	; No, Set Flag for Gas5
+;	return
+;
\ No newline at end of file