Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 552:44e9b961f156
Compute ppO2 for pSCR diving
author | heinrichsweikamp |
---|---|
date | Sat, 04 Feb 2012 18:23:36 +0100 |
parents | f5a06b9e2fef |
children | 880e98ecf1ea |
comparison
equal
deleted
inserted
replaced
551:c67bf1ca73ef | 552:44e9b961f156 |
---|---|
3463 PLED_show_@5_wait: | 3463 PLED_show_@5_wait: |
3464 STRCPY_PRINT "--- " | 3464 STRCPY_PRINT "--- " |
3465 return | 3465 return |
3466 | 3466 |
3467 ;============================================================================= | 3467 ;============================================================================= |
3468 ; Display pSCR ppO2 | |
3469 ; (Pressure[mbar]*char_I_O2_ratio)-(100-char_I_O2_ratio)*CF61*CF62*10 | |
3470 PLED_show_pSCR_ppO2: | |
3471 WIN_FONT FT_SMALL | |
3472 WIN_LEFT .160-.63 ; 9 chars aligned right. | |
3473 WIN_TOP .170 | |
3474 call PLED_divemask_color ; Set Color for Divemode mask | |
3475 lfsr FSR2,letter | |
3476 OUTPUTTEXTH .266 ; "pSCR Info" | |
3477 call word_processor; pCCR | |
3478 | |
3479 movff char_I_O2_ratio,WREG | |
3480 sublw .100 ; 100-char_I_O2_ratio -> WREG | |
3481 mullw .10 ; (100-char_I_O2_ratio)*10 -> PROD:2 | |
3482 movff PRODL,xA+0 | |
3483 movff PRODH,xA+1 | |
3484 GETCUSTOM8 d'62' ; O2 Drop | |
3485 movff WREG,xB+0 | |
3486 clrf xB+1 | |
3487 call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61 | |
3488 movff xC+0,xA+0 | |
3489 movff xC+1,xA+1 | |
3490 GETCUSTOM8 d'63' ; Lung ratio | |
3491 movff WREG,xB+0 | |
3492 clrf xB+1 | |
3493 call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61*CF62 | |
3494 | |
3495 movlw .10 | |
3496 movwf xB+0 | |
3497 clrf xB+1 | |
3498 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3499 ; store xC:2 in lo:hi | |
3500 movff xC+0,lo | |
3501 movff xC+1,hi | |
3502 | |
3503 SAFE_2BYTE_COPY amb_pressure, xA | |
3504 movff char_I_O2_ratio,xB+0 | |
3505 clrf xB+1 | |
3506 call mult16x16 ;xA*xB=xC -> xC:4 = Pressure[mbar]*char_I_O2_ratio | |
3507 | |
3508 movlw .10 | |
3509 movwf xB+0 | |
3510 clrf xB+1 | |
3511 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3512 | |
3513 ; store xC:2 in sub_a | |
3514 movff xC+0,sub_a+0 | |
3515 movff xC+1,sub_a+1 | |
3516 ; reload result from lo:hi | |
3517 movff lo,sub_b+0 | |
3518 movff hi,sub_b+1 | |
3519 | |
3520 call subU16 ;sub_c = sub_a - sub_b (with UNSIGNED values) | |
3521 | |
3522 WIN_FONT FT_SMALL | |
3523 WIN_LEFT .95 | |
3524 WIN_TOP .192 | |
3525 lfsr FSR2,letter | |
3526 STRCPY_PRINT TXT_PPO2_5 ; ppO2: | |
3527 | |
3528 movff sub_c+0,xC+0 | |
3529 movff sub_c+1,xC+1 | |
3530 clrf xC+2 | |
3531 clrf xC+3 ; For color coding | |
3532 PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) | |
3533 WIN_LEFT .130 | |
3534 WIN_TOP .192 | |
3535 lfsr FSR2,letter | |
3536 movff xC+0,lo | |
3537 movff xC+1,hi | |
3538 bsf ignore_digit4 | |
3539 output_16dp d'1' | |
3540 bcf ignore_digit4 | |
3541 STRCAT_PRINT " " | |
3542 call PLED_standard_color ; Back to white. | |
3543 ; Show O2 drop and counter lung ration in second row | |
3544 WIN_LEFT .98 | |
3545 WIN_TOP .216 | |
3546 lfsr FSR2,letter | |
3547 GETCUSTOM8 d'62' ; O2 Drop in percent | |
3548 movwf lo | |
3549 bsf leftbind | |
3550 output_8 | |
3551 STRCAT "% 1/" | |
3552 GETCUSTOM8 d'63' ; Counter lung ratio in 1/X | |
3553 movwf lo | |
3554 output_8 | |
3555 bcf leftbind | |
3556 STRCAT_PRINT " " ; Trailing space needed when changing the O2 drop | |
3557 return | |
3558 | |
3559 ;============================================================================= | |
3468 ; Display cave consomation prediction (and warning). | 3560 ; Display cave consomation prediction (and warning). |
3469 ; | 3561 ; |
3470 PLED_show_cave_bailout: | 3562 PLED_show_cave_bailout: |
3471 WIN_FONT FT_SMALL | 3563 WIN_FONT FT_SMALL |
3472 WIN_LEFT .160-.70 ; 10 chars aligned right. | 3564 WIN_LEFT .160-.70 ; 10 chars aligned right. |