comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 169:e26f49674956

Merge decoplan display for both GF and Buhlmann models. + Add CF(54) to reverse deco plan display order. + Clean state machine to faster redisplay in divemode. Fix don't flip screen for soft emulation.
author JeanDo
date Wed, 26 Jan 2011 19:19:02 +0100
parents 494587193f5d
children 29ff788487fc
comparison
equal deleted inserted replaced
168:494587193f5d 169:e26f49674956
141 movwf lo 141 movwf lo
142 movlw d'1' 142 movlw d'1'
143 cpfseq lo ; =1? 143 cpfseq lo ; =1?
144 bra PLED_color_code_ceiling1 ; No, Set to default color 144 bra PLED_color_code_ceiling1 ; No, Set to default color
145 145
146 movff char_O_array_decodepth+0,lo ; Ceiling in m 146 movff char_O_first_deco_depth,lo ; Ceiling in m
147 decf lo,F ; -1 147 decf lo,F ; -1
148 movff rel_pressure+1,xA+1 148 movff rel_pressure+1,xA+1
149 movff rel_pressure+0,xA+0 149 movff rel_pressure+0,xA+0
150 movlw LOW d'100' 150 movlw LOW d'100'
151 movwf xB+0 151 movwf xB+0
152 clrf xB+1 ; Devide/100 -> xC+0 = Depth in m 152 clrf xB+1 ; Devide/100 -> xC+0 = Depth in m
453 call PLED_standard_color 453 call PLED_standard_color
454 454
455 WIN_TOP .80 455 WIN_TOP .80
456 WIN_LEFT .94 456 WIN_LEFT .94
457 WIN_FONT FT_MEDIUM 457 WIN_FONT FT_MEDIUM
458 WIN_INVERT .0 ; Init new Wordprocessor 458 WIN_INVERT .0 ; Init new Wordprocessor
459 PLED_color_code warn_ceiling ; Color-code Output 459 PLED_color_code warn_ceiling ; Color-code Output
460 lfsr FSR2,letter 460 lfsr FSR2,letter
461 movff char_O_array_decodepth+0,lo ; Ceiling in m 461 movff char_O_first_deco_depth,lo ; Ceiling in m
462 output_99 462 output_99
463 PUTC 'm' 463 PUTC 'm'
464 movff char_O_array_decotime,lo ; length of first stop in m 464 movff char_O_first_deco_time,lo ; length of first stop in m
465 output_99 465 output_99
466 STRCAT_PRINT "'" 466 STRCAT_PRINT "'"
467 WIN_FONT FT_SMALL 467 WIN_FONT FT_SMALL
468 468
469 ;PLED_display_deko1: 469 ;PLED_display_deko1:
528 bcf leftbind 528 bcf leftbind
529 STRCAT_PRINT "m " 529 STRCAT_PRINT "m "
530 return 530 return
531 531
532 PLED_display_velocity: 532 PLED_display_velocity:
533 btfsc multi_gf_display ; Is the Multi-GF Table displayed? 533 ; btfsc multi_gf_display ; Is the Multi-GF Table displayed?
534 return ; Yes, No update and return! 534 ; return ; Yes, No update and return!
535 535
536 ostc_debug 'v' ; Sends debug-information to screen if debugmode active 536 ostc_debug 'v' ; Sends debug-information to screen if debugmode active
537 WIN_TOP .90 537 WIN_TOP .90
538 WIN_LEFT .0 538 WIN_LEFT .0
539 WIN_FONT FT_SMALL 539 WIN_FONT FT_SMALL
833 bcf leftbind 833 bcf leftbind
834 STRCAT_PRINT "°C " 834 STRCAT_PRINT "°C "
835 return 835 return
836 836
837 PLED_temp_divemode: 837 PLED_temp_divemode:
838 btfsc multi_gf_display ; Is the Multi-GF Table displayed? 838 ; btfsc multi_gf_display ; Is the Multi-GF Table displayed?
839 return ; Yes, No update and return! 839 ; return ; Yes, No update and return!
840 840
841 ostc_debug 'u' ; Sends debug-information to screen if debugmode active 841 ostc_debug 'u' ; Sends debug-information to screen if debugmode active
842 842
843 ; temperature 843 ; temperature
844 movff temperature+0,last_temperature+0 844 movff temperature+0,last_temperature+0
911 911
912 PLED_active_gas_divemode: ; Displays current gas (e.g. 40/20) if a) He>0 or b) O2>Custom9 912 PLED_active_gas_divemode: ; Displays current gas (e.g. 40/20) if a) He>0 or b) O2>Custom9
913 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode 913 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode
914 return 914 return
915 915
916 btfsc multi_gf_display ; Is the Multi-GF Table displayed? 916 ; btfsc multi_gf_display ; Is the Multi-GF Table displayed?
917 return ; Yes, No update and return! 917 ; return ; Yes, No update and return!
918 918
919 WIN_INVERT .0 ; Init new Wordprocessor 919 WIN_INVERT .0 ; Init new Wordprocessor
920 call PLED_active_gas_divemode_show ; Show gas (Non-Inverted in all cases) 920 call PLED_active_gas_divemode_show ; Show gas (Non-Inverted in all cases)
921 921
922 btfss better_gas_available ;=1: A better gas is available and a gas change is advised in divemode 922 btfss better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
2189 ; Inputs: lo = depth. Range 3m...93m 2189 ; Inputs: lo = depth. Range 3m...93m
2190 ; hi = minutes. range 1'..240'. 2190 ; hi = minutes. range 1'..240'.
2191 ; win_top = line to draw on screen. 2191 ; win_top = line to draw on screen.
2192 ; Trashed: hi, lo, win_height, win_leftx2, win_width, win_color*, 2192 ; Trashed: hi, lo, win_height, win_leftx2, win_width, win_color*,
2193 ; WREG, PROD, TBLPTR TABLAT. 2193 ; WREG, PROD, TBLPTR TABLAT.
2194 2194 ;
2195 PLED_decoplan_show_stop: 2195 PLED_decoplan_show_stop:
2196 ;---- Print depth ---------------------------------------------------- 2196 ;---- Print depth ----------------------------------------------------
2197 WIN_LEFT .100 2197 WIN_LEFT .100
2198 call PLED_standard_color 2198 call PLED_standard_color
2199 lfsr FSR2,letter 2199 lfsr FSR2,letter
2271 #define decoplan_index apnoe_mins ; within each page 2271 #define decoplan_index apnoe_mins ; within each page
2272 #define decoplan_gindex apnoe_secs ; global index 2272 #define decoplan_gindex apnoe_secs ; global index
2273 #define decoplan_last apnoe_max_pressure ; Depth of last stop (CF#29) 2273 #define decoplan_last apnoe_max_pressure ; Depth of last stop (CF#29)
2274 #define decoplan_max apnoe_max_pressure+1; Number of lines per page. 7 in planning, 5 in diving. 2274 #define decoplan_max apnoe_max_pressure+1; Number of lines per page. 7 in planning, 5 in diving.
2275 2275
2276 PLED_decoplan_gf: 2276 PLED_decoplan:
2277 ostc_debug 'n' ; Sends debug-information to screen if debugmode active 2277 ostc_debug 'n' ; Sends debug-information to screen if debugmode active
2278 2278
2279 WIN_INVERT 0 2279 WIN_INVERT 0
2280 2280
2281 ;---- Is there deco stops ? ------------------------------------------ 2281 ;---- Is there deco stops ? ------------------------------------------
2282 lfsr FSR1,char_O_deco_table 2282 movff char_O_first_deco_depth,WREG
2283 movlw .1 2283 iorwf WREG
2284 movf PLUSW1,W ; char_O_deco_table[1] --> WREG 2284 bnz PLED_decoplan_1
2285 bnz PLED_decoplan_gf_1 2285
2286
2287 ;---- No Deco -------------------------------------------------------- 2286 ;---- No Deco --------------------------------------------------------
2288 call PLED_standard_color 2287 call PLED_standard_color
2289 DISPLAYTEXT d'239' ;"No Deco" 2288 DISPLAYTEXT d'239' ;"No Deco"
2290 bsf last_ceiling_gf_shown 2289 bsf last_ceiling_gf_shown
2291 return 2290 return
2292 2291
2293 PLED_decoplan_gf_1: 2292 PLED_decoplan_1:
2294 GETCUSTOM8 d'29' ; Last decostop depth, in m 2293 lfsr FSR0,char_O_deco_depth ; Initialize indexed addressing.
2295 movwf decoplan_last ; --> decoplan_last 2294 lfsr FSR1,char_O_deco_time
2296 2295
2297 movlw .8 ; 8 lines/page in decoplan 2296 movlw .8 ; 8 lines/page in decoplan
2298 btfsc divemode 2297 btfsc divemode
2299 movlw .6 ; 6 lines/page in divemode. 2298 movlw .6 ; 6 lines/page in divemode.
2300 movwf decoplan_max 2299 movwf decoplan_max
2301 2300
2302 movlw .1 2301 clrf decoplan_index ; Start with index = 0
2303 movwf decoplan_index ; Start with index = 1
2304 clrf WREG 2302 clrf WREG
2305 movff WREG,win_top ; and row = 0 2303 movff WREG,win_top ; and row = 0
2306 2304
2307 ; Read stop parameters, indexed by decoplan_index and decoplan_page 2305 ; Read stop parameters, indexed by decoplan_index and decoplan_page
2308 movf decoplan_page,W ; decoplan_gindex = 6*decoplan_page + decoplan_index 2306 movf decoplan_page,W ; decoplan_gindex = 6*decoplan_page + decoplan_index
2311 addwf PRODL,W 2309 addwf PRODL,W
2312 movwf decoplan_gindex ; --> decoplan_gindex 2310 movwf decoplan_gindex ; --> decoplan_gindex
2313 2311
2314 bcf last_ceiling_gf_shown ; Not finished yet... 2312 bcf last_ceiling_gf_shown ; Not finished yet...
2315 2313
2316 PLED_decoplan_gf_2: 2314 PLED_decoplan_2:
2317 btfsc decoplan_gindex,5 ; Reached table length (32) ? 2315 btfsc decoplan_gindex,5 ; Reached table length (32) ?
2318 bra PLED_decoplan_gf_99 ; YES: finished... 2316 bra PLED_decoplan_99 ; YES: finished...
2319 2317
2320 ; Compute new depth 2318 ; Read stop parameters, indexed by decoplan_index
2321 movf decoplan_gindex,W ; depth = 3 * (global index)
2322 mullw .3 ; --> PROD
2323 movf decoplan_last,W ; depth < decoplan_last (CF#29) ?
2324 cpfslt PRODL
2325 movf PRODL,W ; NO: take depth, else keep decoplan_last.
2326 movwf lo ; --> lo
2327
2328 ; Read deepest depth from other bank.
2329 movff char_O_array_decodepth,WREG
2330 xorwf lo,W ; This is last stop ?
2331 btfsc STATUS,Z
2332 bsf last_ceiling_gf_shown ; YES: mark for latter...
2333
2334 ; Read stop duration
2335 movf decoplan_gindex,W ; index 2319 movf decoplan_gindex,W ; index
2336 movff PLUSW1,hi ; char_O_deco_table[index] --> hi 2320 movff PLUSW1,hi ; char_O_deco_time [gindex] --> hi
2337 movf hi,W ; time = zero ? 2321 movff PLUSW0,lo ; char_O_deco_depth[gindex]
2338 bz PLED_decoplan_gf_4 ; Do not display it: continue. 2322 movf lo,W
2323 bz PLED_decoplan_99 ; depth == 0 : finished.
2339 2324
2340 ; Display the stop line 2325 ; Display the stop line
2341 call PLED_decoplan_show_stop 2326 call PLED_decoplan_show_stop
2342 2327
2343 ; Next 2328 ; Next
2344 movff win_top,WREG ; row: += 24 2329 movff win_top,WREG ; row: += 24
2345 addlw .24 2330 addlw .24
2346 movff WREG,win_top 2331 movff WREG,win_top
2347 incf decoplan_index,F ; local index += 1 2332 incf decoplan_index,F ; local index += 1
2348 PLED_decoplan_gf_4:
2349 incf decoplan_gindex,F ; global index += 1 2333 incf decoplan_gindex,F ; global index += 1
2350 2334
2351 btfsc last_ceiling_gf_shown ; Last one done ?
2352 bra PLED_decoplan_gf_99 ; YES: finished...
2353
2354 ; Max number of lines/page reached ? 2335 ; Max number of lines/page reached ?
2355 incf decoplan_max,W ; index+1 == max+1 ? 2336 movf decoplan_max,W ; index+1 == max ?
2356 cpfseq decoplan_index 2337 cpfseq decoplan_index
2357 bra PLED_decoplan_gf_2 ; NO: loop 2338 bra PLED_decoplan_2 ; NO: loop
2358 2339
2359 ; Check if next stop if end-of-list ? 2340 ; Check if next stop if end-of-list ?
2360 movlw .3 ; Next stop is lo + 3m 2341 movf decoplan_gindex,W
2361 addwf lo,W 2342 movff PLUSW0,WREG ; char_O_deco_depth[gindex]
2362 xorwf decoplan_last,W ; == last stop ? 2343 iorwf WREG
2363 bz PLED_decoplan_gf_99 ; End of list... 2344 bz PLED_decoplan_99 ; End of list...
2364 2345
2365 ; Display the message "more..." 2346 ; Display the message "more..."
2366 rcall PLED_decoplan_clear_bottom ; Clear from next line 2347 rcall PLED_decoplan_clear_bottom ; Clear from next line
2367 2348
2368 WIN_LEFT .130 - 7*3 2349 WIN_LEFT .130 - 7*3
2369 call PLED_standard_color 2350 call PLED_standard_color
2370 STRCPY_PRINT "more..." 2351 STRCPY_PRINT "more..."
2371 bcf last_ceiling_gf_shown ; More page to display... 2352 bcf last_ceiling_gf_shown ; More page to display...
2372 return 2353 return
2373 2354
2374 PLED_decoplan_gf_99: 2355 PLED_decoplan_99:
2375 bsf last_ceiling_gf_shown ; Nothing more in table to display. 2356 bsf last_ceiling_gf_shown ; Nothing more in table to display.
2376 rcall PLED_decoplan_clear_bottom ; Clear from next line 2357 rcall PLED_decoplan_clear_bottom ; Clear from next line
2377 return 2358 return
2378
2379 ;-----------------------------------------------------------------------------
2380 ; Display the decoplan (simulator or divemode) for ZH-L16 model
2381 PLED_decoplan:
2382 ostc_debug 'n' ; Sends debug-information to screen if debugmode active
2383
2384 WIN_INVERT 0
2385
2386 ;---- Is there deco information --------------------------------------
2387 lfsr FSR0,char_O_array_decodepth
2388 lfsr FSR1,char_O_array_decotime
2389
2390 movf INDF0,W
2391 bnz PLED_decoplan1
2392
2393 ;---- No Deco --------------------------------------------------------
2394 call PLED_standard_color
2395 DISPLAYTEXT d'239' ;"No Deco"
2396 bsf last_ceiling_gf_shown
2397 return
2398
2399 PLED_decoplan1:
2400 GETCUSTOM8 d'29' ; Last decostop depth, in m
2401 movwf decoplan_last ; --> decoplan_last
2402
2403 movlw .6 ; Max 6 lines in all modes.
2404 movwf decoplan_max
2405
2406 clrf decoplan_index ; Starts with index = 0
2407 clrf WREG
2408 movff WREG,win_top ; and row = 0
2409
2410 PLED_decoplan2:
2411 ; Read stop parameters, indexed by decoplan_index
2412 movf decoplan_index,W
2413 movff PLUSW0,lo ; array_decodepth[index]
2414 movff PLUSW1,hi ; array_decotime[index]
2415
2416 ; 0 time == end-of-table.
2417 movf hi,w
2418 bz PLED_decoplan_0
2419
2420 call PLED_decoplan_show_stop
2421
2422 movff win_top,WREG ; row += 24
2423 addlw .24
2424 movff WREG,win_top
2425 incf decoplan_index,F ; index += 1
2426
2427 ; 6 Stops max...
2428 movf decoplan_max,W
2429 cpfseq decoplan_index
2430 bra PLED_decoplan2
2431
2432 ;---- Additional time in the decoplan ? ------------------------------
2433 movf decoplan_max,W ; Read array_decotime[6]
2434 movf PLUSW1,W ; set Z flag
2435 movwf lo ; and copy to lo
2436 btfsc STATUS,Z ; Zero: nothing to add.
2437 return
2438
2439 WIN_LEFT .100
2440 call PLED_standard_color
2441
2442 STRCPY "add:"
2443 output_8
2444 STRCAT_PRINT "'"
2445 return
2446
2447 PLED_decoplan_0:
2448 ;---- Plan not finished to compute ? ---------------------------------
2449 decf decoplan_index,W
2450 movf PLUSW0,W ; array_decodepth[index-1]
2451 subwf decoplan_last,W ; == last stop depth ?
2452 bz PLED_decoplan_99
2453
2454 WIN_LEFT .100
2455 call PLED_standard_color
2456 STRCPY_PRINT "..."
2457
2458 PLED_decoplan_99:
2459 return
2460
2461 ;----------------------------------------------------------------------------- 2359 ;-----------------------------------------------------------------------------
2462 PLED_gas_list: 2360 PLED_gas_list:
2463 ostc_debug 'm' ; Sends debug-information to screen if debugmode active 2361 ostc_debug 'm' ; Sends debug-information to screen if debugmode active
2464 2362
2465 WIN_LEFT .100 2363 WIN_LEFT .100
2814 DISPLAYTEXTH .274 ; CF I and CF II Menu 2712 DISPLAYTEXTH .274 ; CF I and CF II Menu
2815 DISPLAYTEXTH .275 ; for Details! 2713 DISPLAYTEXTH .275 ; for Details!
2816 return 2714 return
2817 2715
2818 PLED_const_ppO2_value: 2716 PLED_const_ppO2_value:
2819 btfsc multi_gf_display ; Is the Multi-GF Table displayed? 2717 ; btfsc multi_gf_display ; Is the Multi-GF Table displayed?
2820 return ; Yes, No update and return! 2718 ; return ; Yes, No update and return!
2821 2719
2822 ostc_debug 'j' ; Sends debug-information to screen if debugmode active 2720 ostc_debug 'j' ; Sends debug-information to screen if debugmode active
2823 2721
2824 WIN_TOP .168 2722 WIN_TOP .168
2825 WIN_LEFT .50 2723 WIN_LEFT .50
2971 PLED_topline_box2: 2869 PLED_topline_box2:
2972 WIN_BOX_COLOR .0, .26, .0, .159 2870 WIN_BOX_COLOR .0, .26, .0, .159
2973 return 2871 return
2974 2872
2975 PLED_display_cns: 2873 PLED_display_cns:
2976 btfsc multi_gf_display ; Is the Multi-GF Table displayed? 2874 ; btfsc multi_gf_display ; Is the Multi-GF Table displayed?
2977 return ; Yes, No update and return! 2875 ; return ; Yes, No update and return!
2978 2876
2979 btfsc gauge_mode ; Do not display in gauge mode 2877 btfsc gauge_mode ; Do not display in gauge mode
2980 return 2878 return
2981 2879
2982 btfsc FLAG_apnoe_mode ; Do not display in apnoe mode 2880 btfsc FLAG_apnoe_mode ; Do not display in apnoe mode