comparison code_part1/OSTC_code_asm_part1/simulator.asm @ 592:cda5b45b953f

NEW: Deco mode "pSCR-GF": Computes deco and CNS based on pSCR parameters (CF62/63)
author heinrichsweikamp
date Mon, 28 May 2012 17:54:43 +0200
parents ab2686087bce
children 46e9ccd0eca7
comparison
equal deleted inserted replaced
591:2966548fbe70 592:cda5b45b953f
383 call divemode_check_decogases ; Checks for decogases and sets the gases 383 call divemode_check_decogases ; Checks for decogases and sets the gases
384 call divemode_prepare_flags_for_deco 384 call divemode_prepare_flags_for_deco
385 call set_first_gas ; Set current N2/He/O2 ratios. 385 call set_first_gas ; Set current N2/He/O2 ratios.
386 call set_actual_ppo2 ; Then configure char_I_actual_ppO2 386 call set_actual_ppo2 ; Then configure char_I_actual_ppO2
387 387
388 read_int_eeprom d'34' ; Read deco data
389 movlw .6
390 cpfseq EEDATA
391 bra simulator_calc_deco1
392 ; in PSCR mode, compute fO2 into char_I_O2_ratio
393 call compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2
394 movff sub_c+0,xA+0
395 movff sub_c+1,xA+1
396 movlw LOW .10
397 movwf xB+0
398 movlw HIGH .10
399 movwf xB+1
400 call mult16x16 ;xA*xB=xC -> xC:4 = ppO2*1000
401
402 tstfsz xA+1 ; Is ppO2 > 2.55bar ?
403 setf xA+0 ; yes: bound to 2.55... better than wrap around.
404 movff xA+0, char_I_actual_ppO2 ; copy last ppO2 to buffer register
405
406 SAFE_2BYTE_COPY amb_pressure, xB
407 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
408 ; xC+0 has O2 in percent
409 movff xC+0,char_I_O2_ratio
410
411 simulator_calc_deco1:
388 ; First minute is special: init everything. 412 ; First minute is special: init everything.
389 movlw d'3' ; Begin of deco cycle (reset table). 413 movlw d'3' ; Begin of deco cycle (reset table).
390 movff WREG,char_O_deco_status ; Reset Deco module. 414 movff WREG,char_O_deco_status ; Reset Deco module.
391 415
392 movlw d'1' 416 movlw d'1'