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