changeset 279:8514588eb6a2

Mark gas-switch stops for decoplans, displayed in yellow.
author JeanDo
date Tue, 19 Apr 2011 03:12:22 +0200
parents 17aab4ca0547
children ce6f861d4e3e
files code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_asm_part1/simulator.asm code_part1/OSTC_code_c_part2/p2_deco.c code_part1/OSTC_code_c_part2/p2_deco.o
diffstat 4 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Apr 19 02:26:41 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Apr 19 03:12:22 2011 +0200
@@ -2348,6 +2348,7 @@
 ;-----------------------------------------------------------------------------
 ; Draw a stop of the deco plan (simulator or dive).
 ; Inputs: lo      = depth. Range 3m...93m
+;                 + 80 if this is a switch-gas stop.
 ;         hi      = minutes. range 1'..240'.
 ;         win_top = line to draw on screen.
 ; Trashed: hi, lo, win_height, win_leftx2, win_width, win_color*,
@@ -2356,7 +2357,19 @@
 PLED_decoplan_show_stop:
         ;---- Print depth ----------------------------------------------------
         WIN_LEFT .100
+        
+        btfss   lo,7                    ; Bit set ?
+        bra     PLED_decoplan_std_stop  ; No : Just an usual stop.
+
+        movlw   b'11111101'             ; Yellow.
+        call    PLED_set_color
+        bcf     lo,7                    ; and cleanup depth.
+        bra     PLED_decoplan_nstd_stop
+
+PLED_decoplan_std_stop:
 	    call    PLED_standard_color
+
+PLED_decoplan_nstd_stop:        
 	    lfsr	FSR2,letter
 	    bsf     leftbind
 	    output_8					    ; outputs into Postinc2!
@@ -2390,7 +2403,6 @@
         movff	WREG,win_width    		; column max width.
 
         ; Draw used area (hi = minutes):
-        call    PLED_standard_color
         movlw	d'16'                   ; Limit length (16min)
         cpfslt	hi
         movwf	hi
@@ -2398,6 +2410,7 @@
         call	PLED_box
 
         ; Restore win_top
+        call    PLED_standard_color
         movff   win_top,WREG            ; decf win_top (BANK SAFE)
         decf    WREG
         movff   WREG,win_top
--- a/code_part1/OSTC_code_asm_part1/simulator.asm	Tue Apr 19 02:26:41 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/simulator.asm	Tue Apr 19 03:12:22 2011 +0200
@@ -151,6 +151,9 @@
 	ostc_debug	'P'							; Sends debug-information to screen if debugmode active
 	goto	diveloop						; Start Divemode
 
+;=============================================================================
+; Show decoplanning result.
+;
 simulator_show_decoplan:
         call	PLED_ClearScreen
         call	PLED_simdata_screen
@@ -168,7 +171,7 @@
         
         WIN_TOP .160
         lfsr    FSR2, letter
-        OUTPUTTEXT .85                  ; TTS (for translation).
+        OUTPUTTEXT .85                  ; TTS
         STRCAT  ": "
         bsf		leftbind
         output_16
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Tue Apr 19 02:26:41 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Tue Apr 19 03:12:22 2011 +0200
@@ -829,7 +829,7 @@
 {
     // Copy depth of the first (deepest) stop, because when reversing
     // order, it will be hard to find...    
-    char_O_first_deco_depth = internal_deco_depth[0];
+    char_O_first_deco_depth = internal_deco_depth[0] & 0x7F;
     char_O_first_deco_time  = internal_deco_time [0];
 
     if( read_custom_function(54) & 1 ) //---- Should we reverse table ? ------
@@ -1836,7 +1836,7 @@
         // Make sure deco-stops are recorded in order:
         assert( !internal_deco_depth[x] || temp_depth_limit <= internal_deco_depth[x] );
 
-        if( internal_deco_depth[x] == temp_depth_limit )
+        if( (internal_deco_depth[x] & 0x7F) == temp_depth_limit )
         {
             // Do not overflow (max 255')
 	        if( internal_deco_time[x] < 255 )
@@ -1850,6 +1850,9 @@
         if( internal_deco_depth[x] == 0 )
         {
             internal_deco_depth[x] = temp_depth_limit;
+            if( sim_gas_delay > sim_dive_mins )
+                internal_deco_depth[x] |= 0x80;
+
             internal_deco_time[x]  = 1;
             return;
         }
Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed