diff code_part1/OSTC_code_asm_part1/simulator.asm @ 593:46e9ccd0eca7

pSCR CNS in simulator
author heinrichsweikamp
date Mon, 28 May 2012 18:02:07 +0200
parents cda5b45b953f
children d7eeaffd8fc1
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/simulator.asm	Mon May 28 17:54:43 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/simulator.asm	Mon May 28 18:02:07 2012 +0200
@@ -383,7 +383,7 @@
 	call	divemode_check_decogases    ; Checks for decogases and sets the gases
 	call	divemode_prepare_flags_for_deco
 	call    set_first_gas               ; Set current N2/He/O2 ratios.
-    call    set_actual_ppo2             ; Then configure char_I_actual_ppO2
+    call    set_actual_ppo2             ; Then configure char_I_actual_ppO2 (For CNS)
 
 	read_int_eeprom d'34'				; Read deco data
 	movlw		.6	
@@ -391,6 +391,10 @@
 	bra			simulator_calc_deco1
 	; in PSCR mode, compute fO2 into char_I_O2_ratio
 	call		compute_pscr_ppo2		; pSCR ppO2 into sub_c:2
+;    tstfsz      sub_c+1                 ; Is ppO2 > 2.55bar ? mH
+;    setf        sub_c+0                 ; yes: bound to 2.55... better than wrap around.
+    movff		sub_c+0,char_I_actual_ppO2	; copy last ppO2 to buffer register
+
 	movff		sub_c+0,xA+0
 	movff		sub_c+1,xA+1
 	movlw		LOW		.10
@@ -399,15 +403,12 @@
 	movwf		xB+1
 	call		mult16x16		;xA*xB=xC	-> xC:4 = ppO2*1000
 
-    tstfsz      xA+1                    	; Is ppO2 > 2.55bar ?
-    setf        xA+0                    	; yes: bound to 2.55... better than wrap around.
-    movff		xA+0, char_I_actual_ppO2	; copy last ppO2 to buffer register
-
 	SAFE_2BYTE_COPY amb_pressure, xB
 	call		div32x16	 	; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
 	; xC+0 has O2 in percent
 	movff	xC+0,char_I_O2_ratio
 
+
 simulator_calc_deco1:
     ; First minute is special: init everything.
 	movlw	d'3'                        ; Begin of deco cycle (reset table).