comparison code_part1/OSTC_code_asm_part1/dive_icons.asm @ 110:8aa8acada0fd

Display deco-type icon in surface mode.
author JeanDo
date Wed, 22 Dec 2010 03:23:55 +0100
parents
children e0f29e20bd24
comparison
equal deleted inserted replaced
109:6e635bf5b7a7 110:8aa8acada0fd
1 ;=============================================================================
2 ;
3 ; File dive_icons.asm
4 ;
5 ; Draw Air/Nitrox/Trimix colored icon on surface mode.
6 ;
7 ; This program is free software: you can redistribute it and/or modify
8 ; it under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
11 ;
12 ; This program is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
16 ;
17 ; You should have received a copy of the GNU General Public License
18 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
19 ;
20 ; Copyright (c) 2010, JD Gascuel.
21 ;=============================================================================
22 ; HISTORY
23 ; 2010-12-21 : [jDG] Creation
24 ;
25 ; RATIONALS: Enabled gazes are used to predict TTS in divemode, hence they
26 ; are a critical aspect that should be double-checked before dive.
27 ;
28 ;=============================================================================
29 ; Display either Air, Nitrox, or Trimix icon (in surface mode).
30 ; Inputs: None: explore the gaz list.
31 ; Ouputs: None.
32 ; Trashed: hi:lo, PROD, and registers trashed by color_processor.asm
33 dive_type_icons:
34 ;---- Common setup -----------------------------------------------
35 movlw .170
36 movff WREG, img_top
37 movlw .110
38 movff WREG, img_left
39 movlw UPPER(dive_air_block)
40 movwf TBLPTRU
41
42 ;---- Explore gazlist --------------------------------------------
43 ; EEADR+0 = O2%
44 ; EEADR+1 = He%
45 ; EEADR+4 = next gaz O2%
46
47 read_int_eeprom d'27' ; read gas flag register --> hi
48 movff EEDATA,hi
49 movlw 5 ; Number of gas to check --> lo
50 movwf lo
51 movlw 6-4 ; Gas list start in eeprom.
52 movwf EEADR
53 clrf PRODL ; =0 : no nitrox found yet.
54
55 dive_type_loop:
56 movlw 4 ; Advance to next gas data in EEPROM.
57 addwf EEADR,F
58 rrcf hi ; Check next enabled flag ?
59 bnc dive_type_loop_9 ; Disabled.
60
61 call read_eeprom ; Read O2 %
62 movlw .21
63 cpfseq EEDATA ; O2 == 21% ?
64 setf PRODL ; NO: not simple air !
65
66 incf EEADR ; Read He %
67 call read_eeprom
68 decf EEADR
69 clrf WREG ; H2 == 0% ?
70 cpfseq EEDATA
71 bra dive_trimix_icon ; No: go for the Tx icon, now.
72
73 dive_type_loop_9:
74 decfsz lo ; More gas ?
75 bra dive_type_loop ; YES: loop...
76
77 btfsc PRODL,0 ; Did we find a nitrox gaz ?
78 bra dive_nitrox_icon ; YES: display nitrox icon.;.
79
80 ;---- Draw air ---------------------------------------------------
81 dive_air_icon:
82 movlw HIGH(dive_air_block)
83 movwf TBLPTRH
84 movlw LOW(dive_air_block)
85 movwf TBLPTRL
86 bra dive_gaz_99
87
88 dive_nitrox_icon:
89 movlw HIGH(dive_nitrox_block)
90 movwf TBLPTRH
91 movlw LOW(dive_nitrox_block)
92 movwf TBLPTRL
93 bra dive_gaz_99
94
95 dive_trimix_icon:
96 movlw HIGH(dive_trimix_block)
97 movwf TBLPTRH
98 movlw LOW(dive_trimix_block)
99 movwf TBLPTRL
100
101 dive_gaz_99:
102 rcall color_image
103 movlb 1 ; Back to bank 1.
104 return
105
106 ;=============================================================================
107
108 #include dive_air.inc
109 #include dive_nitrox.inc
110 #include dive_trimix.inc
111