changeset 110:8aa8acada0fd

Display deco-type icon in surface mode.
author JeanDo
date Wed, 22 Dec 2010 03:23:55 +0100
parents 6e635bf5b7a7
children ed7826c740a0
files code_part1/OSTC_code_asm_part1/MAIN.ASM code_part1/OSTC_code_asm_part1/color_processor.asm code_part1/OSTC_code_asm_part1/dive_air.inc code_part1/OSTC_code_asm_part1/dive_icons.asm code_part1/OSTC_code_asm_part1/dive_nitrox.inc code_part1/OSTC_code_asm_part1/dive_trimix.inc code_part1/OSTC_code_asm_part1/surfmode.asm
diffstat 7 files changed, 494 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/MAIN.ASM	Tue Dec 21 09:39:23 2010 +0100
+++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM	Wed Dec 22 03:23:55 2010 +0100
@@ -129,6 +129,11 @@
   endif
 
 ;=============================================================================
+; (should be after aa_wordprocessor)
+#include    color_processor.asm ; Color image drawing.
+#include    dive_icons.asm      ; Draw dive type icons in surface mode.
+
+;=============================================================================
 p2_deco	code	0x0C000			; Mark segment name into the .map file
 #include	p2_deco_main_v110d.txt
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/code_part1/OSTC_code_asm_part1/color_processor.asm	Wed Dec 22 03:23:55 2010 +0100
@@ -0,0 +1,182 @@
+;=============================================================================
+;
+;    File color_processor.asm
+;
+;    Decompress and draw an image.
+;
+;    This program is free software: you can redistribute it and/or modify
+;    it under the terms of the GNU General Public License as published by
+;    the Free Software Foundation, either version 3 of the License, or
+;    (at your option) any later version.
+;
+;    This program is distributed in the hope that it will be useful,
+;    but WITHOUT ANY WARRANTY; without even the implied warranty of
+;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;    GNU General Public License for more details.
+;
+;    You should have received a copy of the GNU General Public License
+;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;
+;    Copyright (c) 2010, JD Gascuel.
+;=============================================================================
+; HISTORY
+;  2010-12-13 : [jDG] Creation
+;
+; RATIONALS: The OSTC have a nice color screen, and a std geek attitude impose
+;            to show off ... ;-)
+;
+; Inputs: TBLPTR points to the image description block.
+;         win_top, win_leftx2 the Top/Leftx2 corner here to put the image.
+; Ouputs: None.
+; Trashed: TBLPTR, TABLAT, FSR2, PROD, aa_width, aa_height
+;
+; ImageBloc:
+;       db  widthx2, height
+;       db  nbColors, 0     ; Unused yet... Should be 0 to keep packing happy.
+;       dw  color0, color1, color2, color3, ...
+;       db  ...packed pixels...
+;
+; Limitations:
+; * nbColors should be <= 15.
+; * image width should be even.
+; * image left border should be on even position too.
+; Compressed format:
+; - Upper nibble = color, lower nibble = count-1.
+; - All bytes F* accumulates to make count larger than 16.
+; Eg. 00          is 1 pixel  color 0
+;     07          is 8 pixels color 0
+;     70          is 1 pixel  color 7
+;     bf          is 16 pixels of color .11
+;     F1 F2 F3 04 is 0x1235 pixels of color 0.
+;
+;Temporary overlay (in bank 0)
+img_width   equ aa_width
+img_height  equ aa_height
+img_top     equ win_top
+img_left    equ win_leftx2
+img_pixelsL equ aa_start+0
+img_pixelsH equ aa_start+1
+img_pixelsU equ aa_end+0
+img_countL  equ aa_end+1
+img_countH  equ aa_colorDiv+0
+img_colors  equ aa_colorDiv+1
+colorTable  equ letter
+
+;-----------------------------------------------------------------------------
+; Make an entry in the link map.
+color_processor code
+
+;-----------------------------------------------------------------------------
+color_image:
+        movlb   HIGH(img_width)         ; Switch to bank 0.
+
+        ;---- Get image parameters -------------------------------------------
+        tblrd*+                     
+        movff   TABLAT,img_width
+        tblrd*+
+        movff   TABLAT,img_height
+        tblrd*+
+        movff   TABLAT,img_colors
+        tblrd*+
+        ;---- Copy color table -----------------------------------------------
+        movf    img_colors,W
+        lfsr    FSR2,colorTable
+get_colors_loop:                    
+        tblrd*+
+        movff   TABLAT,POSTINC2
+        tblrd*+
+        movff   TABLAT,POSTINC2
+        decfsz  WREG
+        bra     get_colors_loop
+
+        ; Compute width * height * 2 : the number of pixels to write.
+        clrf    img_pixelsU
+        movf    img_width,W             ; Compute number of pixels to draw
+        mulwf   img_height              ; 0 .. 160x240
+        bcf     STATUS,C                ; BEWARE: milw does not reset carry flag !
+        rlcf    PRODL                   ; x2 --> 0 .. 320x240, might by > 0xFFFF
+        rlcf    PRODH
+        movff   PRODL, img_pixelsL
+        movff   PRODH, img_pixelsH
+        rlcf    img_pixelsU             ; Get the upper bit in place.
+
+        ;---- Send window command --------------------------------------------
+        clrf    img_width+1             ; x2 on width, for the true box size.
+        rlcf    img_width+0
+        rlcf    img_width+1
+        call    aa_box_cmd
+        AA_CMD_WRITE 0x22
+
+        ;---- Decode pixels --------------------------------------------------
+color_image_loop_xy:
+        ; Get pixel count
+        clrf    img_countL
+        clrf    img_countH
+
+color_image_loop_count:
+        tblrd*+                         ; Get one byte
+
+        movlw   0x0F                    ; Get count bits
+        andwf   TABLAT,W
+        swapf   WREG                    ; On top-4 bits of W
+        rlcf    WREG                    ; Push topmost bit into img_count:2
+        rlcf    img_countL
+        rlcf    img_countH
+        rlcf    WREG                    ; Push topmost bit into img_count:2
+        rlcf    img_countL
+        rlcf    img_countH
+        rlcf    WREG                    ; Push topmost bit into img_count:2
+        rlcf    img_countL
+        rlcf    img_countH
+        rlcf    WREG                    ; Push topmost bit into img_count:2
+        rlcf    img_countL
+        rlcf    img_countH
+
+        movf    TABLAT,W                ; Does the color-bits mark a big-count ?
+        andlw   0xF0
+        xorlw   0xF0
+        bz      color_image_loop_count  ; YES: loop for more count bits.
+
+        ; Get pixel color into PROD
+        xorlw   0xF0                    ; Get back index.
+        swapf   WREG                    ; Get color index to lower bits.
+        addwf   WREG                    ; x2
+        addlw   LOW(letter)             ; 0x60 + 2 * .15 < 0x80.
+        movff   WREG,FSR2L
+        movff   POSTINC2,PRODL
+        movff   POSTINC2,PRODH
+        
+        ; Substract count-1 from the number of pixel we should do.
+        movf    img_countL,W            ; Make a 24bit substraction.
+        subwf   img_pixelsL,F
+        movf    img_countH,W
+        subwfb  img_pixelsH,F
+        movlw   0
+        subwfb  img_pixelsU,F
+
+        incf    img_countL              ; Get back the true count.
+        addwfc  img_countH
+
+        ; Loop sending pixel color
+        incf    img_countH              ; Because we decrement first, should add one here !
+color_image_loop_pixel:
+        AA_DATA_WRITE_PROD
+        decfsz  img_countL
+        bra     color_image_loop_pixel
+        decfsz  img_countH
+        bra     color_image_loop_pixel
+        
+        ; And count (on a 17bit counter)
+        clrf    WREG                    ; Make a 24bit decrement.
+        decf    img_pixelsL
+        subwfb  img_pixelsH,F
+        subwfb  img_pixelsU,F
+        
+        movf    img_pixelsL,W           ; Test if img_pixels == 0
+        iorwf   img_pixelsH,W
+        iorwf   img_pixelsU,W
+        bnz     color_image_loop_xy     ; NO: loop...
+
+        ;---- Closeup --------------------------------------------------------
+        AA_CMD_WRITE 0x00
+        return
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/code_part1/OSTC_code_asm_part1/dive_air.inc	Wed Dec 22 03:23:55 2010 +0100
@@ -0,0 +1,69 @@
+dive_air_width    equ .78
+dive_air_height   equ .26
+dive_air_block:
+    db  .39, .26
+    db  .5, 0
+    dw  0x0000 ; rgb=(0,0,0)
+    dw  0x31a6 ; rgb=(53,53,53)
+    dw  0x7bcf ; rgb=(122,122,122)
+    dw  0xbdd7 ; rgb=(185,185,185)
+    dw  0xffff ; rgb=(255,255,255)
+;
+    db  0x07, 0x49, 0x0f, 0x49, 0x0f, 0x41, 0x05, 0x41
+    db  0x0f, 0x41, 0x05, 0x41, 0x0e, 0x20, 0x41, 0x05
+    db  0x41, 0x20, 0x0b, 0x10, 0x30, 0x42, 0x05, 0x42
+    db  0x30, 0x10, 0x08, 0x20, 0x42, 0x20, 0x10, 0x05
+    db  0x10, 0x20, 0x42, 0x20, 0x06, 0x20, 0x41, 0x30
+    db  0x0b, 0x30, 0x41, 0x20, 0x04, 0x20, 0x41, 0x20
+    db  0x0d, 0x20, 0x41, 0x20, 0x02, 0x10, 0x41, 0x20
+    db  0x0f, 0x20, 0x41, 0x10, 0x01, 0x30, 0x40, 0x30
+    db  0xf1, 0x01, 0x30, 0x40, 0x30, 0x00, 0x10, 0x41
+    db  0x10, 0xf1, 0x01, 0x10, 0x41, 0x10, 0x20, 0x40
+    db  0x30, 0xf1, 0x03, 0x30, 0x40, 0x20, 0x30, 0x40
+    db  0x20, 0xf1, 0x03, 0x20, 0x40, 0x30, 0x41, 0x10
+    db  0xf1, 0x03, 0x10, 0x43, 0xf1, 0x05, 0x43, 0xf1
+    db  0x05, 0x43, 0xf1, 0x05, 0x43, 0xf1, 0x05, 0x43
+    db  0xf1, 0x05, 0x43, 0xf1, 0x05, 0x43, 0xf1, 0x05
+    db  0x43, 0xf1, 0x05, 0x43, 0x0f, 0x11, 0x03, 0x43
+    db  0x0b, 0x10, 0x20, 0x30, 0x41, 0x20, 0x03, 0x43
+    db  0x08, 0x10, 0x30, 0x45, 0x20, 0x03, 0x43, 0x04
+    db  0x10, 0x20, 0x30, 0x45, 0x20, 0x10, 0x05, 0x43
+    db  0x02, 0x10, 0x45, 0x30, 0x20, 0x41, 0x07, 0x43
+    db  0x02, 0x20, 0x43, 0x20, 0x02, 0x41, 0x07, 0x43
+    db  0x02, 0x20, 0x45, 0x30, 0x20, 0x41, 0x07, 0x43
+    db  0x02, 0x10, 0x30, 0x48, 0x20, 0x10, 0x05, 0x43
+    db  0x05, 0x10, 0x20, 0x30, 0x47, 0x20, 0x03, 0x43
+    db  0x09, 0x10, 0x30, 0x44, 0x20, 0x03, 0x43, 0x0c
+    db  0x10, 0x20, 0x30, 0x40, 0x20, 0x03, 0x43, 0xf1
+    db  0x00, 0x10, 0x03, 0x43, 0xf1, 0x05, 0x43, 0x06
+    db  0x30, 0x40, 0x10, 0x0b, 0x43, 0x06, 0x30, 0x40
+    db  0x10, 0x0b, 0x43, 0x06, 0x30, 0x40, 0x10, 0x0b
+    db  0x43, 0x01, 0x10, 0x21, 0x10, 0x00, 0x30, 0x40
+    db  0x30, 0x26, 0x10, 0x03, 0x43, 0x01, 0x20, 0x41
+    db  0x20, 0x00, 0x30, 0x48, 0x20, 0x03, 0x43, 0x01
+    db  0x20, 0x41, 0x20, 0x00, 0x30, 0x48, 0x20, 0x03
+    db  0x43, 0x01, 0x10, 0x21, 0x10, 0x00, 0x29, 0x10
+    db  0x03, 0x43, 0xf1, 0x05, 0x43, 0xf1, 0x05, 0x43
+    db  0xf1, 0x05, 0x43, 0xf1, 0x05, 0x43, 0x06, 0x20
+    db  0x38, 0x20, 0x03, 0x43, 0x06, 0x30, 0x48, 0x20
+    db  0x03, 0x43, 0x06, 0x30, 0x48, 0x20, 0x03, 0x43
+    db  0x07, 0x30, 0x41, 0x10, 0x09, 0x43, 0x06, 0x20
+    db  0x41, 0x10, 0x0a, 0x43, 0x06, 0x41, 0x30, 0x0b
+    db  0x43, 0x06, 0x42, 0x20, 0x0a, 0x43, 0x06, 0x42
+    db  0x30, 0x0a, 0x43, 0x06, 0x23, 0x0a, 0x43, 0xf1
+    db  0x05, 0x43, 0xf1, 0x05, 0x43, 0xf1, 0x05, 0x43
+    db  0xf1, 0x05, 0x43, 0xf1, 0x05, 0x43, 0xf1, 0x05
+    db  0x43, 0xf1, 0x05, 0x43, 0xf1, 0x05, 0x43, 0xf1
+    db  0x05, 0x43, 0xf1, 0x05, 0x43, 0x10, 0xf1, 0x03
+    db  0x10, 0x41, 0x30, 0x40, 0x10, 0xf1, 0x03, 0x10
+    db  0x40, 0x30, 0x20, 0x40, 0x30, 0xf1, 0x03, 0x30
+    db  0x40, 0x20, 0x10, 0x41, 0xf1, 0x03, 0x41, 0x10
+    db  0x00, 0x30, 0x40, 0x20, 0xf1, 0x01, 0x20, 0x40
+    db  0x30, 0x01, 0x10, 0x41, 0x10, 0x0f, 0x10, 0x41
+    db  0x10, 0x02, 0x30, 0x41, 0x10, 0x0d, 0x10, 0x41
+    db  0x30, 0x04, 0x30, 0x41, 0x10, 0x0b, 0x10, 0x41
+    db  0x30, 0x06, 0x30, 0x41, 0x20, 0x09, 0x20, 0x41
+    db  0x30, 0x08, 0x30, 0x42, 0x30, 0x11, 0x01, 0x11
+    db  0x30, 0x42, 0x30, 0x0a, 0x10, 0x30, 0x49, 0x30
+    db  0x10, 0x0d, 0x10, 0x20, 0x30, 0x43, 0x30, 0x20
+    db  0x10, 0x07
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/code_part1/OSTC_code_asm_part1/dive_icons.asm	Wed Dec 22 03:23:55 2010 +0100
@@ -0,0 +1,111 @@
+;=============================================================================
+;
+;    File dive_icons.asm
+;
+;    Draw Air/Nitrox/Trimix colored icon on surface mode.
+;
+;    This program is free software: you can redistribute it and/or modify
+;    it under the terms of the GNU General Public License as published by
+;    the Free Software Foundation, either version 3 of the License, or
+;    (at your option) any later version.
+;
+;    This program is distributed in the hope that it will be useful,
+;    but WITHOUT ANY WARRANTY; without even the implied warranty of
+;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;    GNU General Public License for more details.
+;
+;    You should have received a copy of the GNU General Public License
+;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;
+;    Copyright (c) 2010, JD Gascuel.
+;=============================================================================
+; HISTORY
+;  2010-12-21 : [jDG] Creation
+;
+; RATIONALS: Enabled gazes are used to predict TTS in divemode, hence they
+;            are a critical aspect that should be double-checked before dive.
+;
+;=============================================================================
+; Display either Air, Nitrox, or Trimix icon (in surface mode).
+; Inputs:  None: explore the gaz list.
+; Ouputs:  None.
+; Trashed: hi:lo, PROD, and registers trashed by color_processor.asm
+dive_type_icons:
+            ;---- Common setup -----------------------------------------------
+            movlw   .170
+            movff   WREG, img_top
+            movlw   .110
+            movff   WREG, img_left
+            movlw   UPPER(dive_air_block)
+            movwf   TBLPTRU
+
+            ;---- Explore gazlist --------------------------------------------
+            ; EEADR+0 = O2%
+            ; EEADR+1 = He%
+            ; EEADR+4 = next gaz O2%
+            
+          	read_int_eeprom		d'27'	; read gas flag register --> hi
+          	movff   EEDATA,hi
+          	movlw   5                   ; Number of gas to check --> lo
+          	movwf   lo
+          	movlw	6-4                 ; Gas list start in eeprom.
+	        movwf	EEADR
+	        clrf    PRODL               ; =0 : no nitrox found yet.
+
+dive_type_loop:
+            movlw   4                   ; Advance to next gas data in EEPROM.
+            addwf   EEADR,F
+            rrcf    hi                  ; Check next enabled flag ?
+            bnc     dive_type_loop_9    ; Disabled.
+            
+            call    read_eeprom         ; Read O2 %
+            movlw   .21
+            cpfseq  EEDATA              ; O2 == 21% ?
+            setf    PRODL               ; NO: not simple air !
+
+            incf    EEADR               ; Read He %
+            call    read_eeprom
+            decf    EEADR
+            clrf    WREG                ; H2 == 0% ?
+            cpfseq  EEDATA
+            bra     dive_trimix_icon    ; No: go for the Tx icon, now.
+            
+dive_type_loop_9:
+            decfsz  lo                  ; More gas ?
+            bra     dive_type_loop      ; YES: loop...
+	        
+	        btfsc   PRODL,0             ; Did we find a nitrox gaz ?
+	        bra     dive_nitrox_icon    ; YES: display nitrox icon.;.
+
+            ;---- Draw air ---------------------------------------------------
+dive_air_icon:
+            movlw   HIGH(dive_air_block)
+            movwf   TBLPTRH
+            movlw   LOW(dive_air_block)
+            movwf   TBLPTRL
+            bra     dive_gaz_99
+
+dive_nitrox_icon:
+            movlw   HIGH(dive_nitrox_block)
+            movwf   TBLPTRH
+            movlw   LOW(dive_nitrox_block)
+            movwf   TBLPTRL
+            bra     dive_gaz_99
+
+dive_trimix_icon:
+            movlw   HIGH(dive_trimix_block)
+            movwf   TBLPTRH
+            movlw   LOW(dive_trimix_block)
+            movwf   TBLPTRL
+
+dive_gaz_99:
+            rcall   color_image
+            movlb   1                   ; Back to bank 1.
+            return
+
+;=============================================================================
+
+#include    dive_air.inc
+#include    dive_nitrox.inc
+#include    dive_trimix.inc
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/code_part1/OSTC_code_asm_part1/dive_nitrox.inc	Wed Dec 22 03:23:55 2010 +0100
@@ -0,0 +1,58 @@
+dive_nitrox_width    equ .78
+dive_nitrox_height   equ .26
+dive_nitrox_block:
+    db  .39, .26
+    db  .4, 0
+    dw  0x0000 ; rgb=(0,0,0)
+    dw  0x04c0 ; rgb=(0,154,0)
+    dw  0x07e0 ; rgb=(0,254,0)
+    dw  0x01e0 ; rgb=(0,62,0)
+;
+    db  0xf0, 0x07, 0x29, 0x0f, 0x29, 0x0f, 0x29, 0x0f
+    db  0x29, 0x0e, 0x30, 0x29, 0x30, 0x0b, 0x30, 0x2d
+    db  0x30, 0x08, 0x30, 0x2f, 0x10, 0x06, 0x10, 0xf1
+    db  0x21, 0x10, 0x04, 0x30, 0x22, 0x1c, 0x23, 0x30
+    db  0x03, 0x22, 0x10, 0x0c, 0x10, 0x23, 0x02, 0x10
+    db  0x22, 0x10, 0x04, 0x37, 0x10, 0x23, 0x10, 0x01
+    db  0x23, 0x10, 0x04, 0x30, 0x10, 0x2b, 0x00, 0x10
+    db  0x25, 0x10, 0x04, 0x30, 0x10, 0x29, 0x11, 0x27
+    db  0x10, 0x04, 0x30, 0x28, 0x10, 0x2a, 0x30, 0x04
+    db  0x30, 0xf1, 0x24, 0x30, 0x04, 0x10, 0x2a, 0x10
+    db  0x0c, 0x10, 0x2a, 0x10, 0x0c, 0x10, 0xf4, 0x22
+    db  0x11, 0xf1, 0x27, 0x30, 0x00, 0x10, 0xf1, 0x26
+    db  0x30, 0x00, 0x10, 0xf1, 0x26, 0x30, 0x00, 0x10
+    db  0xf1, 0x21, 0x10, 0x01, 0x10, 0x20, 0x30, 0x08
+    db  0x10, 0x29, 0x10, 0x01, 0x10, 0x20, 0x30, 0x08
+    db  0x10, 0x29, 0x10, 0x01, 0x10, 0x20, 0x30, 0x08
+    db  0x10, 0xf7, 0x26, 0x10, 0x00, 0x10, 0xf1, 0x26
+    db  0x10, 0x00, 0x10, 0xf1, 0x23, 0x10, 0x09, 0x30
+    db  0x10, 0x2c, 0x10, 0x0b, 0x10, 0x2b, 0x10, 0x0b
+    db  0x30, 0x2e, 0x10, 0x00, 0x10, 0x24, 0x30, 0x00
+    db  0x30, 0x2e, 0x10, 0x00, 0x10, 0x24, 0x10, 0x00
+    db  0x30, 0x2e, 0x10, 0x00, 0x10, 0x24, 0x30, 0x00
+    db  0x30, 0x2e, 0x12, 0x24, 0x31, 0x10, 0xf4, 0x23
+    db  0x18, 0x2f, 0x30, 0x08, 0x10, 0x2e, 0x30, 0x08
+    db  0x10, 0x2e, 0x10, 0x30, 0x01, 0x30, 0x15, 0x2e
+    db  0x10, 0x01, 0x30, 0xf1, 0x25, 0x30, 0x01, 0xf1
+    db  0x26, 0x01, 0x30, 0xf1, 0x26, 0x02, 0x30, 0xf1
+    db  0x25, 0x02, 0x30, 0xf3, 0x21, 0x11, 0x32, 0x10
+    db  0xf1, 0x22, 0x10, 0x06, 0x10, 0x2f, 0x10, 0x08
+    db  0x2f, 0x30, 0x01, 0x13, 0x30, 0x01, 0x10, 0x2e
+    db  0x01, 0x10, 0x24, 0x10, 0x00, 0x30, 0x2e, 0x01
+    db  0x25, 0x10, 0x00, 0x30, 0x2e, 0x01, 0x10, 0x24
+    db  0x30, 0x00, 0x30, 0x2e, 0x30, 0x02, 0x30, 0x10
+    db  0x30, 0x02, 0x10, 0x2f, 0x07, 0x30, 0xf1, 0x21
+    db  0x05, 0x30, 0xf1, 0x23, 0x13, 0xf1, 0x22, 0x10
+    db  0x27, 0x11, 0x2e, 0x30, 0x00, 0x10, 0x24, 0x30
+    db  0x00, 0x10, 0x2e, 0x30, 0x01, 0x10, 0x22, 0x30
+    db  0x01, 0x10, 0x2e, 0x30, 0x03, 0x10, 0x02, 0x10
+    db  0x26, 0x10, 0x28, 0x30, 0x05, 0x27, 0x11, 0x29
+    db  0x10, 0x04, 0x10, 0x26, 0x10, 0x30, 0x28, 0x10
+    db  0x06, 0x10, 0x25, 0x30, 0x00, 0x10, 0x26, 0x10
+    db  0x02, 0x11, 0x03, 0x10, 0x23, 0x10, 0x01, 0x30
+    db  0x26, 0x30, 0x00, 0x30, 0x23, 0x30, 0x01, 0x10
+    db  0x23, 0x30, 0x02, 0x10, 0x25, 0x30, 0x10, 0x25
+    db  0x10, 0x00, 0x10, 0x22, 0x10, 0x04, 0x2f, 0x10
+    db  0x22, 0x06, 0xf1, 0x21, 0x08, 0x10, 0x2d, 0x10
+    db  0x0a, 0x30, 0x2b, 0x30, 0x0d, 0x30, 0x11, 0x23
+    db  0x11, 0x30, 0x07
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/code_part1/OSTC_code_asm_part1/dive_trimix.inc	Wed Dec 22 03:23:55 2010 +0100
@@ -0,0 +1,68 @@
+dive_trimix_width    equ .78
+dive_trimix_height   equ .26
+dive_trimix_block:
+    db  .39, .26
+    db  .10, 0
+    dw  0x0000 ; rgb=(0,0,0)
+    dw  0x2800 ; rgb=(47,0,0)
+    dw  0x8000 ; rgb=(129,0,0)
+    dw  0xc000 ; rgb=(199,0,0)
+    dw  0xf800 ; rgb=(255,0,0)
+    dw  0xf8e3 ; rgb=(255,31,31)
+    dw  0xfbef ; rgb=(255,127,127)
+    dw  0xf9e7 ; rgb=(255,62,62)
+    dw  0xffff ; rgb=(255,255,255)
+    dw  0xfe18 ; rgb=(255,195,195)
+;
+    db  0xf0, 0x07, 0x49, 0x0f, 0x49, 0x0f, 0x49, 0x0f
+    db  0x49, 0x0e, 0x20, 0x49, 0x20, 0x0b, 0x10, 0x30
+    db  0x4b, 0x30, 0x10, 0x08, 0x20, 0x4f, 0x20, 0x06
+    db  0x20, 0x40, 0x50, 0x70, 0x50, 0x4d, 0x20, 0x04
+    db  0x20, 0x41, 0x60, 0x80, 0x60, 0x4e, 0x20, 0x02
+    db  0x10, 0x42, 0x60, 0x80, 0x60, 0x4f, 0x10, 0x01
+    db  0x20, 0x42, 0x60, 0x80, 0x60, 0x4f, 0x20, 0x00
+    db  0x10, 0x43, 0x60, 0x80, 0x90, 0x6a, 0x70, 0x44
+    db  0x10, 0x20, 0x43, 0x60, 0x8c, 0x60, 0x44, 0x20
+    db  0x30, 0x43, 0x60, 0x8c, 0x60, 0x44, 0x31, 0x43
+    db  0x60, 0x80, 0x90, 0x6a, 0x70, 0x4a, 0x60, 0x80
+    db  0x60, 0xf1, 0x46, 0x60, 0x80, 0x60, 0xf1, 0x46
+    db  0x60, 0x80, 0x60, 0xf1, 0x46, 0x70, 0x60, 0x70
+    db  0xf3, 0x44, 0x69, 0x70, 0x4e, 0x90, 0x88, 0x60
+    db  0x4e, 0x90, 0x88, 0x60, 0x4e, 0x70, 0x90, 0x81
+    db  0x60, 0x74, 0x50, 0x4e, 0x60, 0x81, 0x70, 0xf1
+    db  0x45, 0x90, 0x80, 0x90, 0xf1, 0x46, 0x81, 0x90
+    db  0x70, 0xf1, 0x45, 0x82, 0x90, 0xf1, 0x45, 0x92
+    db  0x60, 0xf4, 0x49, 0x60, 0x90, 0x70, 0xf1, 0x46
+    db  0x90, 0x80, 0x70, 0xf1, 0x46, 0x90, 0x80, 0x70
+    db  0xf1, 0x41, 0x50, 0x71, 0x50, 0x40, 0x90, 0x80
+    db  0x60, 0x76, 0x50, 0x49, 0x60, 0x81, 0x60, 0x40
+    db  0x90, 0x88, 0x60, 0x49, 0x60, 0x81, 0x60, 0x40
+    db  0x90, 0x88, 0x60, 0x49, 0x70, 0x61, 0x70, 0x40
+    db  0x69, 0x70, 0xf5, 0x4c, 0x60, 0x98, 0x60, 0x4e
+    db  0x90, 0x88, 0x60, 0x4e, 0x60, 0x90, 0x80, 0x90
+    db  0x65, 0x70, 0x4e, 0x60, 0x81, 0x76, 0x50, 0x4e
+    db  0x89, 0x60, 0x4e, 0x90, 0x88, 0x60, 0x4e, 0x70
+    db  0x90, 0x80, 0x60, 0x75, 0x50, 0x4e, 0x82, 0x66
+    db  0x70, 0x4e, 0x89, 0x60, 0x4e, 0x70, 0x98, 0x60
+    db  0xf4, 0x42, 0x60, 0x90, 0x70, 0xf1, 0x46, 0x90
+    db  0x80, 0x70, 0xf1, 0x46, 0x90, 0x80, 0x70, 0xf1
+    db  0x41, 0x50, 0x71, 0x50, 0x40, 0x90, 0x80, 0x60
+    db  0x76, 0x50, 0x49, 0x60, 0x81, 0x60, 0x40, 0x90
+    db  0x88, 0x60, 0x49, 0x60, 0x81, 0x60, 0x40, 0x90
+    db  0x88, 0x60, 0x49, 0x70, 0x61, 0x70, 0x40, 0x69
+    db  0x70, 0xf4, 0x4c, 0x50, 0x4e, 0x60, 0x70, 0x46
+    db  0x90, 0x60, 0x4e, 0x90, 0x80, 0x60, 0x43, 0x70
+    db  0x90, 0x80, 0x60, 0x4e, 0x90, 0x81, 0x90, 0x70
+    db  0x40, 0x60, 0x82, 0x70, 0x4e, 0x60, 0x83, 0x90
+    db  0x81, 0x90, 0x70, 0x46, 0x30, 0x48, 0x60, 0x84
+    db  0x90, 0x47, 0x30, 0x20, 0x49, 0x60, 0x84, 0x60
+    db  0x46, 0x20, 0x10, 0x48, 0x60, 0x86, 0x90, 0x70
+    db  0x44, 0x10, 0x00, 0x30, 0x46, 0x90, 0x81, 0x90
+    db  0x40, 0x50, 0x90, 0x82, 0x60, 0x43, 0x30, 0x01
+    db  0x10, 0x46, 0x90, 0x80, 0x60, 0x43, 0x60, 0x81
+    db  0x60, 0x43, 0x10, 0x02, 0x20, 0x45, 0x60, 0x70
+    db  0x45, 0x50, 0x90, 0x60, 0x42, 0x20, 0x04, 0x30
+    db  0x4e, 0x50, 0x41, 0x30, 0x06, 0x30, 0x4f, 0x30
+    db  0x08, 0x20, 0x4d, 0x30, 0x0a, 0x10, 0x30, 0x49
+    db  0x30, 0x10, 0x0d, 0x10, 0x20, 0x30, 0x43, 0x30
+    db  0x20, 0x10, 0x07
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm	Tue Dec 21 09:39:23 2010 +0100
+++ b/code_part1/OSTC_code_asm_part1/surfmode.asm	Wed Dec 22 03:23:55 2010 +0100
@@ -130,6 +130,7 @@
 	call    check_customfunctions       ; Checks CF functions and displays warning symbol if something critical is wrong
 	call	PLED_display_decotype_surface	; Show deco mode
 	call	surfcustomview_second		; Do every-second tasks for the custom view area
+	call    dive_type_icons             ; Draw Air/Nitrox/Trimix color icon.
 	btfsc	enter_error_sleep			; Enter Fatal Error Routine?
 	call	fatal_error_sleep			; Yes (In Sleepmode.asm!)
 	bcf		onesecupdate				; every second tasks done