Mercurial > public > hwos_code
comparison src/gaslist.asm @ 628:cd58f7fc86db
3.05 stable work
author | heinrichsweikamp |
---|---|
date | Thu, 19 Sep 2019 12:01:29 +0200 |
parents | c40025d8e750 |
children | 185ba2f91f59 |
comparison
equal
deleted
inserted
replaced
627:bf5fee575701 | 628:cd58f7fc86db |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File gaslist.asm combined next generation V3.03.2 | 3 ; File gaslist.asm combined next generation V3.03.5 |
4 ; | 4 ; |
5 ; Managing OSTC gas list | 5 ; Managing OSTC gas list |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
425 | 425 |
426 | 426 |
427 gaslist_strcat_gas_type: | 427 gaslist_strcat_gas_type: |
428 lfsr FSR1,opt_gas_type ; load base address of gas types | 428 lfsr FSR1,opt_gas_type ; load base address of gas types |
429 movf gaslist_gas,W ; load index to WREG (0-4 for gases, 5-9 for diluents) | 429 movf gaslist_gas,W ; load index to WREG (0-4 for gases, 5-9 for diluents) |
430 decf PLUSW1,W ; read gas/dil type into WREG and... | 430 decf PLUSW1,W ; get and decrement gas type (-1 for disabled, 0 for first, 1 for work/normal, 2 for deco) |
431 ; ...decrement by 1 (-1 for disabled, 0 for first, 1 for travel/normal, 2 for deco) | 431 bnz gaslist_strcat_gas_type_1 ; type = first? NO - continue with checking for work and deco gas |
432 bnz gaslist_strcat_gas_type_1 ; type = first? NO - continue with checking for deco gas | |
433 PUTC "*" ; YES - print "*" for first | 432 PUTC "*" ; YES - print "*" for first |
434 return ; - done | 433 return ; - done |
435 gaslist_strcat_gas_type_1: | 434 gaslist_strcat_gas_type_1: |
436 decf WREG,W ; decrement gas type (-2 for disabled, -1 for first, 0 for travel/normal, 1 for deco) | 435 decf WREG,W ; decrement gas type (-2 for disabled, -1 for first, 0 for work/normal, 1 for deco) |
437 decf WREG,W ; decrement gas type (-3 for disabled, -2 for first, -1 for travel/normal, 0 for deco) | 436 bnz gaslist_strcat_gas_type_2 ; type = work? NO - continue with checking for deco gas |
438 bnz gaslist_strcat_gas_type_2 ; type = deco? NO - neither first nor deco | 437 PUTC "\xb8" ; YES - print down-arrow for a work gas |
438 return ; - done | |
439 gaslist_strcat_gas_type_2: | |
440 decf WREG,W ; decrement gas type (-3 for disabled, -2 for first, -1 for work/normal, 0 for deco) | |
441 bnz gaslist_strcat_gas_type_3 ; type = deco? NO - neither first nor deco | |
439 PUTC "=" ; YES - print "=" for a deco gas | 442 PUTC "=" ; YES - print "=" for a deco gas |
440 return ; - done | 443 return ; - done |
441 gaslist_strcat_gas_type_2: | 444 gaslist_strcat_gas_type_3: |
442 PUTC " " ; neither first nor deco, print a space | 445 PUTC " " ; neither first nor deco, print a space |
443 return | 446 return |
444 | 447 |
445 | 448 |
446 ;---------------------------------------------------------------------------- | 449 ;---------------------------------------------------------------------------- |
823 | 826 |
824 ;============================================================================= | 827 ;============================================================================= |
825 | 828 |
826 | 829 |
827 ;---------------------------------------------------------------------------- | 830 ;---------------------------------------------------------------------------- |
828 ; Compute MOD from char_I_ppO2_max_work/char_I_ppO2_max_deco and current O2 ratio | 831 ; Compute MOD from O2 ratio and char_I_ppO2_max_work / char_I_ppO2_max_deco |
832 ; Compute MOD from O2 ratio and char_I_ppO2_max_deco | |
829 ; | 833 ; |
830 ; Input: gaslist_gas = current gas index. | 834 ; Input: gaslist_gas = current gas index. |
831 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio | 835 ; opt_gas_O2_ratio[gaslist_gas] = current O2 ratio |
832 ; Output: WREG = MOD [m] | 836 ; Output: WREG = MOD [m] |
833 ; | 837 ; |
834 gaslist_calc_mod: | 838 gaslist_calc_mod: |
839 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type | |
835 movf gaslist_gas,W ; load index (0...9) | 840 movf gaslist_gas,W ; load index (0...9) |
841 movff PLUSW1,xA+0 ; read gas/dil type into xA+0 (used as temp here) | |
842 movff char_I_ppO2_max_work,xB+1 ; get max ppO2 for deco into xB+1 (used as temp here) | |
843 movlw .3 ; type code for deco gases | |
844 cpfslt xA+0 ; is it a deco gas? | |
845 gaslist_calc_mod_deco: | |
846 movff char_I_ppO2_max_deco,xB+1 ; YES - overwrite/get ppO2 max with/for work | |
836 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio | 847 lfsr FSR1,opt_gas_O2_ratio ; load base address of opt_gas_O2_ratio |
848 movf gaslist_gas,W ; load index (0...9) | |
837 movff PLUSW1,xB+0 ; read O2 ratio into xB+0 | 849 movff PLUSW1,xB+0 ; read O2 ratio into xB+0 |
838 lfsr FSR1,opt_gas_type ; load base address of opt_gas_type | 850 movf xB+1,W ; copy ppO2 max into WREG |
839 movff PLUSW1,xA+0 ; read gas/dil type into xA+0 (used as temp here) | |
840 movff char_I_ppO2_max_deco,xB+1 ; get max ppO2 for deco into xB+1 (used as temp here) | |
841 movlw .3 ; type code for deco gases | |
842 cpfseq xA+0 ; is it a deco gas? | |
843 movff char_I_ppO2_max_work,xB+1 ; NO - overwrite ppO2 max with working phase max | |
844 movf xB+1,W ; copy resulting ppO2 max into WREG | |
845 clrf xB+1 ; clear xB+1 for div16x16 operation | 851 clrf xB+1 ; clear xB+1 for div16x16 operation |
846 mullw .10 ; multiply ppO2 max value with 10 | 852 mullw .10 ; multiply ppO2 max value with 10 |
847 MOVII PROD,xA ; copy result to xA | 853 MOVII PROD,xA ; copy result to xA |
848 call div16x16 ; xC = xA / xB with xA as remainder | 854 call div16x16 ; xC = xA / xB with xA as remainder |
849 movf xC+0,W ; copy low byte of the result to WREG | 855 movf xC+0,W ; copy low byte of the result to WREG |
850 addlw -.10 ; subtract 10 cbar | 856 addlw -.10 ; subtract 10 cbar |
851 return ; return with final result [in meters] in WREG | 857 return ; return with final result [in meters] in WREG |
852 | 858 |
853 ;---------------------------------------------------------------------------- | 859 ;---------------------------------------------------------------------------- |
854 | 860 |
923 | 929 |
924 ; print change depth of gas in gaslist_gas (0-9), use warning color if > MOD | 930 ; print change depth of gas in gaslist_gas (0-9), use warning color if > MOD |
925 ; | 931 ; |
926 global gaslist_reset_mod_title | 932 global gaslist_reset_mod_title |
927 gaslist_reset_mod_title: | 933 gaslist_reset_mod_title: |
928 STRCAT_TEXT tDepthReset | 934 STRCAT_TEXT tDepthReset ; print "Reset to MOD:" |
929 rcall gaslist_calc_mod ; compute MOD into WREG | 935 PUTC " " ; add a space char |
930 movwf lo ; copy result to lo | |
931 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change | 936 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change |
932 movf gaslist_gas,W ; load index (0-9) | 937 movf gaslist_gas,W ; load index (0-9) |
933 movf PLUSW1,W ; read change depth into WREG | 938 movff PLUSW1,hi ; read change depth into hi |
939 rcall gaslist_calc_mod ; compute MOD for ppO2 max work/deco dependent on gas type into WREG | |
940 movwf lo ; copy (true) MOD to lo | |
941 movf hi,W ; copy change depth to WREG | |
934 cpfslt lo ; change depth > MOD ? | 942 cpfslt lo ; change depth > MOD ? |
935 bra gaslist_strcat_depth ; NO - return | 943 bra gaslist_strcat_depth ; NO - print MOD from value in lo |
936 call TFT_warning_color ; YES - use red color | 944 call TFT_attention_color ; YES - use attention color |
937 bra gaslist_strcat_depth ; - return | 945 rcall gaslist_calc_mod_deco ; - compute MOD for ppO2 max deco into WREG |
946 movwf up ; - copy result to up | |
947 movf hi,W ; - copy change depth to WREG again | |
948 cpfslt up ; - change depth > MOD deco ? | |
949 bra gaslist_strcat_depth ; NO - print MOD from value in lo, keeping attention color | |
950 call TFT_warning_color ; YES - switch to warning color | |
951 bra gaslist_strcat_depth ; - print MOD from value in lo | |
938 | 952 |
939 | 953 |
940 ; set change depth of gas in gaslist_gas (0-9) to its MOD | 954 ; set change depth of gas in gaslist_gas (0-9) to its MOD |
941 ; | 955 ; |
942 global gaslist_reset_mod | 956 global gaslist_reset_mod |