comparison code_part1/OSTC_code_asm_part1/outputs.asm @ 681:6e456a6398e0

Hardware4 support
author heinrichsweikamp
date Fri, 25 Jan 2013 18:00:49 +0100
parents code_part1/OSTC_code_asm_part1/pled_outputs.asm@3927bc5019c9
children 8aaacf6eee3f
comparison
equal deleted inserted replaced
680:c6220d340684 681:6e456a6398e0
1
2 ; OSTC - diving computer code
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR
4
5 ; This program is free software: you can redistribute it and/or modify
6 ; it under the terms of the GNU General Public License as published by
7 ; the Free Software Foundation, either version 3 of the License, or
8 ; (at your option) any later version.
9
10 ; This program is distributed in the hope that it will be useful,
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; GNU General Public License for more details.
14
15 ; You should have received a copy of the GNU General Public License
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
19 ; routines for display outputs
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
21 ; written: 15/01/05
22 ;
23 ; History:
24 ; 2008-06-06 [MH] last updated
25 ; 2010-12-31 [jDG] Multi-page display for GF decoplan
26 ; 2011-01-04 [jDG] Saturation graphs in customview divemode
27 ;
28 ; known bugs:
29 ; ToDo: More comments
30
31 global DISP_divemask_color
32 DISP_divemask_color:
33 GETCUSTOM8 d'36' ; Divemask output color
34 bra DISP_standard_color_0
35
36 global DISP_warnings_color
37 DISP_warnings_color:
38 GETCUSTOM8 d'37' ; Warnings output color
39 bra DISP_standard_color_0
40
41 global DISP_standard_color
42 DISP_standard_color:
43 GETCUSTOM8 d'35' ; Standard output color
44 DISP_standard_color_0: ; Common entry point
45 movwf DISPLAY1_temp ; copy
46 movlw d'0'
47 cpfseq DISPLAY1_temp
48 bra DISP_standard_color_1
49 bra DISP_standard_color2
50 DISP_standard_color_1:
51 movlw d'4'
52 cpfseq DISPLAY1_temp
53 bra DISP_standard_color_2
54 bra DISP_standard_color2
55 DISP_standard_color_2:
56 movlw d'8'
57 cpfseq DISPLAY1_temp
58 bra DISP_standard_color_3
59 bra DISP_standard_color2
60 DISP_standard_color_3:
61 movlw d'192'
62 cpfseq DISPLAY1_temp
63 bra DISP_standard_color_4
64 bra DISP_standard_color2
65 DISP_standard_color_4:
66 movlw d'196'
67 cpfseq DISPLAY1_temp
68 bra DISP_standard_color_5
69 bra DISP_standard_color2
70 DISP_standard_color_5:
71 movlw d'200'
72 cpfseq DISPLAY1_temp
73 bra DISP_standard_color_6
74 bra DISP_standard_color2
75 DISP_standard_color_6:
76 movf DISPLAY1_temp,W ; Color should be OK...
77 call DISP_set_color
78 return
79 DISP_standard_color2:
80 movlw 0xFF ; Force full white.
81 call DISP_set_color
82 return
83
84 DISP_color_code macro color_code_temp
85 movlw color_code_temp
86 call DISP_color_code1
87 endm
88
89 DISP_color_code1: ; Color-codes the output, if required
90 dcfsnz WREG
91 bra DISP_color_code_depth ; CF43 [mbar], 16Bit
92 dcfsnz WREG
93 bra DISP_color_code_cns ; CF44 [%]
94 dcfsnz WREG
95 bra DISP_color_code_gf ; CF45 [%]
96 dcfsnz WREG
97 bra DISP_color_code_ppo2 ; CF46 [cbar]
98 dcfsnz WREG
99 bra DISP_color_code_velocity ; CF47 [m/min]
100 dcfsnz WREG
101 bra DISP_color_code_ceiling ; Show warning if CF41=1 and current depth>shown ceiling
102 dcfsnz WREG
103 bra DISP_color_code_gaslist ; Color-code current row in Gaslist (%O2 in "EEDATA")
104
105
106 DISP_color_code_gaslist: ; %O2 in "EEDATA"
107 ; Check very high ppO2 manually
108 SAFE_2BYTE_COPY amb_pressure,xA
109 movlw d'10'
110 movwf xB+0
111 clrf xB+1
112 call div16x16 ; xC=p_amb/10
113 movff xC+0,xA+0
114 movff xC+1,xA+1
115 movff EEDATA,xB+0
116 clrf xB+1
117 call mult16x16 ; EEDATA * p_amb/10
118
119 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
120 bra DISP_color_code_gaslist1 ; Yes, warn in warning color
121 ; Check if ppO2>3,30bar
122 btfsc xC+1,7
123 bra DISP_color_code_gaslist1 ; Yes, warn in warning color
124
125 movff xC+0,sub_a+0
126 movff xC+1,sub_a+1
127 GETCUSTOM8 d'46' ; color-code ppO2 warning [cbar]
128 mullw d'100' ; ppo2_warning_high*100
129 movff PRODL,sub_b+0
130 movff PRODH,sub_b+1
131 call sub16 ; sub_c = sub_a - sub_b
132 btfss neg_flag
133 bra DISP_color_code_gaslist1; too high -> Warning Color!
134 call DISP_standard_color
135 return
136
137 DISP_color_code_gaslist1:
138 call DISP_warnings_color
139 return
140
141 DISP_color_code_ceiling:
142 GETCUSTOM8 d'40' ; =1: Warn at all?
143 movwf lo
144 movlw d'1'
145 cpfseq lo ; =1?
146 bra DISP_color_code_ceiling1 ; No, Set to default color
147
148 SAFE_2BYTE_COPY rel_pressure, lo
149 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
150 movff hi,xA+1
151 movff lo,xA+0
152 movff char_O_first_deco_depth,lo ; Ceiling in m
153 decf lo,F ; -1
154 movlw LOW d'100'
155 movwf xB+0
156 clrf xB+1 ; Devide/100 -> xC+0 = Depth in m
157 call div16x16 ; xA/xB=xC with xA as remainder
158 movf xC+0,W ; Depth in m
159 subwf lo,W
160 btfsc STATUS,C
161 bra DISP_color_code_ceiling2 ; Set to warning color
162 DISP_color_code_ceiling1:
163 call DISP_standard_color
164 return
165 DISP_color_code_ceiling2:
166 call DISP_warnings_color
167 return
168
169 DISP_color_code_depth:
170 movff hi,hi_temp
171 movff lo,lo_temp
172 SAFE_2BYTE_COPY rel_pressure, lo
173 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
174 movff lo,sub_a+0
175 movff hi,sub_a+1
176 GETCUSTOM15 d'43' ; Depth warn [mbar]
177 movff lo,sub_b+0
178 movff hi,sub_b+1
179 call sub16 ; sub_c = sub_a - sub_b
180 btfss neg_flag
181 bra DISP_color_code_depth2; Set to warning color
182 call DISP_standard_color
183 movff hi_temp,hi
184 movff lo_temp,lo ; Restore hi, lo
185 return
186 DISP_color_code_depth2:
187 call DISP_warnings_color
188 movff hi_temp,hi
189 movff lo_temp,lo ; Restore hi, lo
190 return
191
192 DISP_color_code_cns:
193 movff char_O_CNS_fraction,lo
194 GETCUSTOM8 d'44' ; CNS Warn [%]
195 subwf lo,W
196 btfsc STATUS,C
197 bra DISP_color_code_cns2 ; Set to warning color
198 call DISP_standard_color
199 return
200 DISP_color_code_cns2:
201 call DISP_warnings_color
202 return
203
204 DISP_color_code_gf:
205 movff char_O_gradient_factor,lo ; gradient factor
206 GETCUSTOM8 d'45' ; GF Warn [%]
207 subwf lo,W
208 btfsc STATUS,C
209 bra DISP_color_code_gf2 ; Set to warning color
210 call DISP_standard_color
211 return
212 DISP_color_code_gf2:
213 call DISP_warnings_color
214 return
215
216 DISP_color_code_ppo2:
217 ; Check if ppO2>6,55bar
218 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
219 bra DISP_color_code_ppo22 ; Yes, warn in warning color
220 ; Check if ppO2>3,30bar
221 btfsc xC+1,7
222 bra DISP_color_code_ppo22 ; Yes, warn in warning color
223
224 movff xC+0,sub_a+0
225 movff xC+1,sub_a+1
226 GETCUSTOM8 d'46' ; color-code ppO2 warning [cbar]
227 mullw d'100'
228 movff PRODL,sub_b+0
229 movff PRODH,sub_b+1
230 call sub16 ; sub_c = sub_a - sub_b
231 btfss neg_flag
232 bra DISP_color_code_ppo22; Set to warning color
233 call DISP_standard_color
234 return
235 DISP_color_code_ppo22:
236 call DISP_warnings_color
237 return
238
239 DISP_color_code_velocity:
240 btfss neg_flag ; Ignore for ascend!
241 bra DISP_color_code_velocity1 ; Skip check!
242 movff divA+0,lo
243 GETCUSTOM8 d'47' ; Velocity warn [m/min]
244 subwf lo,W
245 btfsc STATUS,C
246 bra DISP_color_code_velocity2 ; Set to warning color
247 DISP_color_code_velocity1:
248 call DISP_standard_color
249 return
250 DISP_color_code_velocity2:
251 call DISP_warnings_color
252 return
253
254 ostc_debug macro value
255 movlw value
256 call ostc_debug1
257 endm
258
259 ostc_debug1:
260 movff debug_char+4,debug_char+5 ; Save for background debugger
261 movff debug_char+3,debug_char+4
262 movff debug_char+2,debug_char+3
263 movff debug_char+1,debug_char+2
264 movff debug_char+0,debug_char+1
265 movff WREG,debug_char+0
266
267 btfss debug_mode ; Are we in debugmode?
268 return ; No, return!
269
270 WIN_TOP .192
271 WIN_LEFT .100
272 WIN_FONT FT_SMALL
273 WIN_INVERT .0 ; Init new Wordprocessor
274 call DISP_standard_color
275 lfsr FSR2,letter
276 movf debug_char+0,W
277 movwf POSTINC2
278 movf debug_char+1,W
279 movwf POSTINC2
280 movf debug_char+2,W
281 movwf POSTINC2
282 movf debug_char+3,W
283 movwf POSTINC2
284 movf debug_char+4,W
285 movwf POSTINC2
286 movf debug_char+5,W
287 movwf POSTINC2
288
289 STRCAT_PRINT " "
290 return
291
292 ;=============================================================================
293 ; BlueScreen function.
294 ;
295 DISP_resetdebugger:
296 global DISP_resetdebugger
297 global temp10
298
299 movlb 1 ; For C-code calls
300 call DISPLAY_boot ; DISP boot
301 call DISP_standard_color
302 WIN_INVERT .0 ; Init new Wordprocessor
303
304 DISPLAYTEXT .133
305 DISPLAYTEXT .134
306 DISPLAYTEXT .135
307 DISPLAYTEXT .136 ; Display Debug intro
308
309 WIN_TOP .100
310 WIN_LEFT .10
311
312 lfsr FSR2,letter
313 movff temp10+0,lo ; Code-stack point at crash time.
314 movff temp10+1,hi ; Code-stack point at crash time.
315 output_16
316 movlw ' '
317 movwf POSTINC2
318 movf debug_char+0,W
319 movwf POSTINC2
320 movf debug_char+1,W
321 movwf POSTINC2
322 movf debug_char+2,W
323 movwf POSTINC2
324 movf debug_char+3,W
325 movwf POSTINC2
326 movf debug_char+4,W
327 movwf POSTINC2
328 movf debug_char+5,W
329 movwf POSTINC2
330 STRCAT ". "
331 movff flag1,lo
332 output_8
333 PUTC ' '
334 movff flag2,lo
335 output_8
336 call word_processor
337
338 WIN_TOP .125
339
340 lfsr FSR2,letter
341 movff flag3,lo
342 output_8
343 PUTC ' '
344 movff flag4,lo
345 output_8
346 PUTC ' '
347 movff flag5,lo
348 output_8
349 PUTC ' '
350 movff flag6,lo
351 output_8
352 PUTC ' '
353 movff flag7,lo
354 output_8
355 call word_processor
356
357 WIN_TOP .150
358
359 lfsr FSR2,letter
360 movff flag8,lo
361 output_8
362 PUTC ' '
363 movff flag9,lo
364 output_8
365 PUTC ' '
366 movff flag10,lo
367 output_8
368 PUTC ' '
369 movff flag11,lo
370 output_8
371 PUTC ' '
372 movff flag12,lo
373 output_8
374 call word_processor
375
376 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
377 DISP_resetdebugger_loop:
378 bcf LED_blue ; Blink blue led every seconds..
379 btfss secs,0
380 bsf LED_blue
381
382 btfss switch_left
383 bra DISP_resetdebugger_loop ; Loop
384
385 bcf LED_blue
386 call wait_switches ; Waits until switches are released, resets flag if button stays pressed!
387 return
388
389 DISP_divemode_mask: ; Displays mask in Dive-Mode
390 call DISP_divemask_color ; Set Color for Divemode mask
391 DISPLAYTEXTH .267 ; Max.
392 DISPLAYTEXT .86 ; Divetime
393 DISPLAYTEXT .87 ; Depth
394 call DISP_standard_color
395 return
396
397 DISP_clear_customview_divemode:
398 WIN_BOX_BLACK .168, .239, .90, .159 ;top, bottom, left, right
399 return
400
401 DISP_clear_customview_surfmode:
402 WIN_BOX_BLACK .25, .121, .82, .159 ;top, bottom, left, right
403 return
404
405 DISP_clear_decoarea:
406 WIN_BOX_BLACK .54, .168, .90, .159 ;top, bottom, left, right
407 return
408
409 DISP_display_ndl_mask:
410 ; Clears Gradient Factor
411 movlw d'8'
412 movwf temp1
413 WIN_TOP .145
414 WIN_LEFT .0
415 call DISP_display_clear_common_y1
416
417 btfsc menubit ; Divemode menu active?
418 return ; Yes, return
419
420 ; Clear Dekostop and Dekosum
421 rcall DISP_clear_decoarea
422 call DISP_divemask_color ; Set Color for Divemode mask
423 DISPLAYTEXT d'84' ; NoStop
424 call DISP_standard_color
425 return
426
427 DISP_display_ndl:
428 GETCUSTOM8 d'66' ; Always show GF?
429 decfsz WREG,F ; WREG=1?
430 bra DISP_display_ndl2 ; No
431 rcall DISP_display_gf ; Show GF (If GF > CF08)
432
433 DISP_display_ndl2:
434 btfsc menubit ; Divemode menu active?
435 return ; Yes, return
436
437 ostc_debug 'z' ; Sends debug-information to screen if debugmode active
438
439 WIN_TOP .136
440 WIN_LEFT .119
441 WIN_FONT FT_MEDIUM
442 WIN_INVERT .0 ; Init new Wordprocessor
443 call DISP_standard_color
444
445 lfsr FSR2,letter
446 movff char_O_nullzeit,lo ; NDL in minutes
447 output_8
448 STRCAT_PRINT "'"
449 WIN_FONT FT_SMALL
450 return
451
452 DISP_display_deko_mask:
453 btfsc menubit ; Divemode menu active?
454 return ; Yes, return
455
456 rcall DISP_clear_decoarea
457 ; total deco time word
458 bcf show_safety_stop ; Clear safety stop flag
459 call DISP_divemask_color ; Set Color for Divemode mask
460 DISPLAYTEXT d'85' ; TTS
461 DISPLAYTEXT d'82' ; DEKOSTOP
462 call DISP_standard_color
463 return
464
465 DISP_display_deko:
466 btfsc menubit ; Divemode menu active?
467 bra DISP_display_deko1 ; Yes, do not display deco, only GF (if required)
468
469 ostc_debug 'y' ; Sends debug-information to screen if debugmode active
470 WIN_TOP .80
471 WIN_LEFT .94
472 WIN_FONT FT_MEDIUM
473 WIN_INVERT .0 ; Init new Wordprocessor
474 bcf leftbind
475 DISP_color_code warn_ceiling ; Color-code Output
476 btfsc decoplan_invalid ; The decoplan needs to updated...
477 call DISP_grey ; .. so set the color to grey
478 lfsr FSR2,letter
479 movff char_O_first_deco_depth,lo ; Ceiling in m
480 output_99
481 PUTC TXT_METER_C
482 movff char_O_first_deco_time,lo ; length of first stop in m
483 output_99
484 STRCAT_PRINT "'"
485 WIN_FONT FT_SMALL
486
487 ostc_debug 'x' ; Sends debug-information to screen if debugmode active
488
489 WIN_TOP .136
490 WIN_LEFT .140 - 6*7 - 4 ; let space for sign + 5 digits + '
491 WIN_FONT FT_MEDIUM
492 WIN_INVERT .0 ; Init new Wordprocessor
493
494 call DISP_standard_color
495 btfsc decoplan_invalid ; The decoplan needs to updated...
496 call DISP_grey ; .. so set the color to grey
497 lfsr FSR2,letter
498 movff int_O_ascenttime+0,lo ; TTS
499 movff int_O_ascenttime+1,hi ; on 16bits
500 output_16
501 STRCAT_PRINT "'"
502 call DISP_standard_color
503
504 DISP_display_deko1:
505 rcall DISP_display_gf ; Show GF (If GF > CF08)
506 return ; Done.
507
508 DISP_display_gf:
509 movff char_O_gradient_factor,lo ; gradient factor
510 GETCUSTOM8 d'8' ; threshold for display
511 cpfslt lo ; show value?
512 bra DISP_display_deko2 ; Yes
513 ; No
514 ; Clears Gradient Factor
515 movlw d'8'
516 movwf temp1
517 WIN_TOP .145
518 WIN_LEFT .0
519 call DISP_display_clear_common_y1
520 return
521
522 DISP_display_deko2:
523 ostc_debug 'w' ; Sends debug-information to screen if debugmode active
524 ;GF
525 WIN_TOP .145
526 WIN_LEFT .0
527 WIN_FONT FT_SMALL
528 DISP_color_code warn_gf ; Color-code Output
529
530 STRCPY TXT_GF3
531 movff char_O_gradient_factor,lo ; gradient factor
532 output_8
533 STRCAT_PRINT "% "
534 call DISP_standard_color
535 return
536
537 DISP_show_safety_stop:
538 tstfsz safety_stop_countdown ; Countdown at zero?
539 bra DISP_show_safety_stop2 ; No, show stop
540
541 bcf show_safety_stop ; Clear flag
542
543 btfsc safety_stop_active ; Displayed?
544 rcall DISP_clear_decoarea ; Yes, Clear stop
545 bcf safety_stop_active ; Clear flag
546 bra DISP_display_ndl_mask ; Show NDL again
547
548 DISP_show_safety_stop2:
549 btfsc safety_stop_active ; Displayed?
550 bra DISP_show_safety_stop3 ; Yes.
551
552 bsf safety_stop_active ; Set flag
553
554 btfsc menubit ; Divemode menu active?
555 bra DISP_show_safety_stop3 ; Yes, do not display now but countdown
556
557 call DISP_divemask_color ; Set Color for Divemode mask
558 DISPLAYTEXT d'227' ; Safety stop
559
560 DISP_show_safety_stop3:
561 decf safety_stop_countdown,F ; Reduce countdown
562 btfsc menubit ; Divemode menu active?
563 return ; Yes, do not show
564 movff safety_stop_countdown,lo
565 call DISP_standard_color
566 WIN_TOP .80
567 WIN_LEFT .104
568 WIN_FONT FT_MEDIUM
569 WIN_INVERT .0 ; Init new Wordprocessor
570 lfsr FSR2,letter
571 clrf hi
572 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo)
573 movf hi,W
574 movff lo,hi
575 movwf lo ; exchange lo and hi
576 output_99
577 PUTC ':'
578 movff hi,lo
579 output_99x
580 STRCAT_PRINT ""
581 WIN_FONT FT_SMALL
582 call DISP_standard_color
583 return
584
585 ;=============================================================================
586 ; Update simulator menu with time/depth
587 ; Note: because translations might change a bit the string length, we reprint
588 ; that part of the mask to be sure the numbers fit in the right places.
589 DISP_simulator_data:
590 WIN_LEFT .20
591 WIN_FONT FT_SMALL
592 call DISP_standard_color
593
594 ;---- Updates interval line ----------------------------------------------
595 WIN_TOP .35
596 lfsr FSR2,letter
597 OUTPUTTEXTH .307 ; Interval:
598
599 movff char_I_dive_interval,lo
600 movf lo,W
601 bnz DISP_simulator_data_1
602 OUTPUTTEXTH .308 ; Now
603 clrf POSTINC2 ; End buffer.
604 bra DISP_simulator_data_2
605
606 DISP_simulator_data_1:
607 bsf leftbind
608 output_8
609 STRCAT TXT_0MIN5
610
611 DISP_simulator_data_2:
612 call word_processor
613
614 ;---- Updates bottom time line -------------------------------------------
615 WIN_TOP .95
616 lfsr FSR2,letter
617 OUTPUTTEXTH .277 ; Bottom Time:
618
619 movff sim_btm_time,lo
620 bsf leftbind
621 output_8
622 STRCAT_PRINT TXT_MIN4
623
624 ;---- Updates depth line -------------------------------------------------
625 WIN_TOP .125
626 lfsr FSR2,letter
627 OUTPUTTEXTH .278 ; Max. Depth:
628
629 movff sim_btm_depth,lo
630 bsf leftbind
631 output_8
632 STRCAT_PRINT TXT_METER3
633
634 bcf leftbind
635 return
636
637 ;=============================================================================
638
639 DISP_divemode_timeout2:
640 WIN_TOP .54
641 WIN_LEFT .112
642 WIN_FONT FT_SMALL
643 WIN_INVERT .1
644 call DISP_warnings_color
645 STRCPY 0x94 ; "End of dive" icon
646 movff timeout_counter, lo
647 movff timeout_counter2, hi
648 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo)
649 movf hi,W
650 movff lo,hi
651 movwf lo ; exchange lo and hi
652 output_99x
653 PUTC ':'
654 movff hi,lo
655 output_99x
656 STRCAT_PRINT " "
657 bsf timeout_display ; Set Flag
658 call DISP_standard_color
659 WIN_INVERT .0
660 return
661
662 DISP_divemode_timeout:
663 WIN_TOP .54
664 WIN_LEFT .112
665 WIN_FONT FT_SMALL
666 call DISP_standard_color
667 STRCPY 0x94 ; "End of dive" icon
668 GETCUSTOM15 d'2' ; diveloop_timeout
669 movff lo,sub_a+0
670 movff hi,sub_a+1
671 movff timeout_counter, sub_b+0
672 movff timeout_counter2, sub_b+1 ; Divemode timeout
673 call sub16 ; sub_c = sub_a - sub_b
674 movff sub_c+0,lo
675 movff sub_c+1,hi
676 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo)
677 movf hi,W
678 movff lo,hi
679 movwf lo ; exchange lo and hi
680 output_99x
681 PUTC ':'
682 movff hi,lo
683 output_99x
684 STRCAT_PRINT " "
685 bsf timeout_display ; Set Flag
686 return
687
688 DISP_divemode_timeout_clear:
689 btfsc dekostop_active ; Is a deco stop displayed?
690 call DISP_display_deko_mask ; Yes, redraw mask
691
692 WIN_TOP .54
693 WIN_LEFT .112
694 movlw d'6'
695 movwf temp1
696 bcf timeout_display ; Clear flag
697 bra DISP_display_clear_common_y1
698
699 DISP_display_velocity_graph_clr:
700 WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display
701 bra DISP_display_velocity ; Continue with normal output
702
703 DISP_display_velocity_graphical:
704 btfss neg_flag
705 bra DISP_display_velocity_graph_clr
706 bsf DISP_velocity_display
707 ; divA+0 holding the ascend speed in m/min
708 movff divA+0,hi ; Copy
709 WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display
710 GETCUSTOM8 d'36' ; Divemode mask
711 WIN_FRAME_COLOR .20, .90, .65, .75 ; Outer frame
712 GETCUSTOM8 d'36' ; Divemode mask
713 WIN_FRAME_COLOR .20+.10, .90-.10, .65, .75 ; Inner frames
714 GETCUSTOM8 d'36' ; Divemode mask
715 WIN_FRAME_COLOR .20+.20, .90-.20, .65, .75 ;
716 GETCUSTOM8 d'36' ; Divemode mask
717 WIN_FRAME_COLOR .20+.30, .90-.30, .65, .75 ;
718
719 GETCUSTOM8 d'47' ; color_warn_celocity_mmin
720 movwf xA+0
721 clrf xA+1
722 movlw .5
723 movwf xB+0 ; Threshold for color warning (5 color normal + 2 color warning)
724 clrf xB+1
725 call div16x16 ;xA/xB=xC with xA as remainder
726 ; xC+0 holds stepsize in m/min (e.g. =3 for 15m/min warning treshold)
727 movff hi,xA+0 ; Velocity in m/min
728 clrf xA+1
729 movff xC+0,xB+0 ; Step size
730 clrf xB+1
731 call div16x16 ;xA/xB=xC with xA as remainder
732 ; xC+0 now holds amount of segments to show
733
734 movff hi,divA+0 ; Copy back for numeric output
735 movlw d'7'
736 cpfslt xC+0
737 bra DISP_graph_vel_7
738 movlw d'6'
739 cpfslt xC+0
740 bra DISP_graph_vel_6
741 movlw d'5'
742 cpfslt xC+0
743 bra DISP_graph_vel_5
744 movlw d'4'
745 cpfslt xC+0
746 bra DISP_graph_vel_4
747 movlw d'3'
748 cpfslt xC+0
749 bra DISP_graph_vel_3
750 movlw d'2'
751 cpfslt xC+0
752 bra DISP_graph_vel_2
753 movlw d'1'
754 cpfslt xC+0
755 bra DISP_graph_vel_1
756 bra DISP_graph_vel_0 ; Should not happen...
757
758 DISP_graph_vel_7:
759 GETCUSTOM8 d'37' ; Color warning
760 WIN_BOX_COLOR .22, .22+.6, .67, .73 ; Fill box
761 DISP_graph_vel_6:
762 GETCUSTOM8 d'37' ; Color warning
763 WIN_BOX_COLOR .32, .32+.6, .67, .73 ; Fill box
764 DISP_graph_vel_5:
765 WIN_BOX_STD .42, .42+.6, .67, .73 ; Fill box
766 DISP_graph_vel_4:
767 WIN_BOX_STD .52, .52+.6, .67, .73 ; Fill box
768 DISP_graph_vel_3:
769 WIN_BOX_STD .62, .62+.6, .67, .73 ; Fill box
770 DISP_graph_vel_2:
771 WIN_BOX_STD .72, .72+.6, .67, .73 ; Fill box
772 DISP_graph_vel_1:
773 WIN_BOX_STD .82, .82+.6, .67, .73 ; Fill box
774 DISP_graph_vel_0:
775
776 DISP_display_velocity:
777 ostc_debug 'v' ; Sends debug-information to screen if debugmode active
778 WIN_TOP .90
779 WIN_LEFT .0
780 WIN_FONT FT_SMALL
781 DISP_color_code warn_velocity ; Color code output
782 lfsr FSR2,letter
783 movlw '-'
784 btfsc neg_flag
785 movlw '+'
786 movwf POSTINC2
787 movff divA+0,lo
788 output_99
789 OUTPUTTEXT d'83' ; m/min
790 call word_processor
791 call DISP_standard_color
792 bsf DISP_velocity_display
793 return
794
795 DISP_display_velocity_clear:
796 GETCUSTOM8 d'60' ; use graphic velocity (=1)?
797 movwf lo
798 movlw d'1'
799 cpfseq lo ; =1?
800 bra DISP_display_velocity_clear1 ; No, clear text display
801 WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display
802
803 DISP_display_velocity_clear1:
804 movlw d'8'
805 movwf temp1
806 WIN_TOP .90
807 WIN_LEFT .0
808 bcf DISP_velocity_display
809 bra DISP_display_clear_common_y1
810
811 DISP_display_wait_clear:
812 WIN_BOX_BLACK .0, .25, .0, .159 ;top, bottom, left, right
813 return
814
815 DISP_display_clear_common_y2: ; Clears with y-scale=2
816 WIN_FONT FT_MEDIUM
817 bra DISP_display_clear_common1
818
819 DISP_display_clear_common_y1: ; Clears with y-scale=1
820 WIN_FONT FT_SMALL
821 DISP_display_clear_common1:
822 lfsr FSR2,letter
823 DISP_display_clear_common2:
824 PUTC ' '
825 decfsz temp1,F
826 bra DISP_display_clear_common2
827 call word_processor
828 WIN_FONT FT_SMALL
829 return
830
831
832 DISP_diveclock:
833 call DISP_divemask_color ; Set Color for Divemode mask
834 DISPLAYTEXT d'255' ; Clock
835 call DISP_standard_color
836
837 DISP_diveclock2:
838 WIN_TOP .192
839 WIN_LEFT .123
840 WIN_FONT FT_SMALL
841 WIN_INVERT .0 ; Init new Wordprocessor
842 call DISP_standard_color
843 lfsr FSR2,letter
844 movff hours,lo
845 output_99x
846 PUTC ':'
847 movff mins,lo
848 output_99x
849 call word_processor
850 return
851
852 DISP_clock:
853 ostc_debug 'c'
854 WIN_TOP .50
855 WIN_LEFT .1
856 WIN_FONT FT_SMALL
857 WIN_INVERT .0 ; Init new Wordprocessor
858 call DISP_standard_color
859 lfsr FSR2,letter
860 movff hours,lo
861 output_99x
862 PUTC ':'
863 movff mins,lo
864 output_99x
865 PUTC ':'
866 movff secs,lo
867 output_99x
868 STRCAT_PRINT " "
869 return
870
871 DISP_interval:
872 WIN_TOP .75
873 WIN_LEFT .90
874 WIN_FONT FT_SMALL
875 WIN_INVERT .0 ; Init new Wordprocessor
876 call DISP_standard_color
877 lfsr FSR2,letter
878
879 movff surface_interval+0,lo
880 movff surface_interval+1,hi
881 call convert_time ; lo=mins, hi=hours
882
883 movf hi,W
884 movff lo,hi
885 movwf lo ; exchange lo and hi
886 output_99x
887 PUTC ':'
888 movff hi,lo
889 output_99x
890 STRCAT_PRINT " "
891 return
892
893 DISP_show_gf_customview:
894 WIN_LEFT .93
895 WIN_FONT FT_SMALL
896 WIN_INVERT .0 ; Init new Wordprocessor
897 call DISP_divemask_color ; Set Color for Divemode mask
898 DISPLAYTEXTH .268 ;"Gradient Factors"
899
900 GETCUSTOM8 d'64' ; Set to grey
901 call DISP_set_color
902 btfss use_aGF
903 call DISP_standard_color
904
905 WIN_TOP .192
906 STRCPY TXT_GF3 ; "GF:"
907 GETCUSTOM8 d'32' ; GF_lo
908 movwf lo
909 bsf leftbind
910 output_8
911 STRCAT "/"
912 GETCUSTOM8 d'33' ; GF_hi
913 movwf lo
914 output_8
915 STRCAT_PRINT ""
916
917 GETCUSTOM8 d'64' ; Set to grey
918 call DISP_set_color
919 btfsc use_aGF
920 call DISP_standard_color
921
922 WIN_TOP .216
923 STRCPY TXT_aGF4 ; "aGF:"
924 GETCUSTOM8 d'67' ; aGF_lo
925 movwf lo
926 bsf leftbind
927 output_8
928 STRCAT "/"
929 GETCUSTOM8 d'68' ; aGF_hi
930 movwf lo
931 output_8
932 STRCAT_PRINT ""
933 bcf leftbind
934
935 call DISP_standard_color
936 return
937
938 DISP_show_cf11_cf12_cf29:; Display saturations/desaturation multiplier and last deco in the customview field
939 WIN_TOP .25
940 WIN_LEFT .90
941 WIN_FONT FT_SMALL
942 WIN_INVERT .0 ; Init new Wordprocessor
943 call DISP_standard_color
944 STRCPY TXT_BSAT5
945
946 GETCUSTOM8 d'11'
947 movwf lo
948 bsf leftbind
949 output_8
950 STRCAT_PRINT "%"
951
952 WIN_TOP .50
953 STRCPY TXT_BDES5
954
955 GETCUSTOM8 d'12'
956 movwf lo
957 bsf leftbind
958 output_8
959 STRCAT_PRINT "%"
960
961 DISP_show_cf11_cf12_cf29_2:
962 WIN_TOP .75
963 STRCPY TXT_LAST5
964 GETCUSTOM8 d'29'
965 movwf lo
966 bsf leftbind
967 output_8
968 STRCAT_PRINT TXT_METER1
969
970 bcf leftbind
971 return
972
973 DISP_show_cf32_cf33_cf62_cf63: ; Display GF_LOW, GF_HIGH, pSCR ratio and drop in the customview field
974 WIN_TOP .25
975 WIN_LEFT .90
976 WIN_FONT FT_SMALL
977 WIN_INVERT .0 ; Init new Wordprocessor
978 call DISP_standard_color
979 GETCUSTOM8 d'32' ; GF_lo
980 movwf lo
981 STRCPY TXT_GFLO6
982 bsf leftbind
983 output_8
984 STRCAT_PRINT "%"
985
986 WIN_TOP .50
987 GETCUSTOM8 d'33' ; GF_hi
988 movwf lo
989 STRCPY TXT_GFHI6
990 bsf leftbind
991 output_8
992 STRCAT_PRINT "%"
993
994 WIN_TOP .75
995 lfsr FSR2,letter
996 GETCUSTOM8 d'62' ; O2 Drop in percent
997 movwf lo
998 bsf leftbind
999 output_8
1000
1001 STRCAT "% 1/"
1002 GETCUSTOM8 d'63' ; Counter lung ratio in 1/X
1003 movwf lo
1004 output_8
1005 bcf leftbind
1006 STRCAT_PRINT ""
1007 return
1008
1009
1010
1011 DISP_show_cf32_cf33_cf29:; Display GF_LOW, GF_HIGH and last deco in the customview field
1012 WIN_TOP .25
1013 WIN_LEFT .90
1014 WIN_FONT FT_SMALL
1015 WIN_INVERT .0 ; Init new Wordprocessor
1016 call DISP_standard_color
1017 GETCUSTOM8 d'32' ; GF_lo
1018 movwf lo
1019
1020 STRCPY TXT_GFLO6
1021 bsf leftbind
1022 output_8
1023 STRCAT_PRINT "%"
1024
1025 WIN_TOP .50
1026 GETCUSTOM8 d'33' ; GF_hi
1027 movwf lo
1028 STRCPY TXT_GFHI6
1029 bsf leftbind
1030 output_8
1031 STRCAT_PRINT "%"
1032
1033 bra DISP_show_cf11_cf12_cf29_2 ; Display CF29 in the third row and RETURN
1034
1035
1036 DISP_logbook_cursor:
1037
1038 DISP_menu_cursor:
1039 WIN_BOX_BLACK .35, .239, .0, .16 ;top, bottom, left, right
1040
1041 WIN_LEFT .0
1042 WIN_FONT FT_SMALL
1043 WIN_INVERT .0 ; Init new Wordprocessor
1044 call DISP_standard_color
1045
1046 movff menupos,temp1
1047 dcfsnz temp1,F
1048 movlw d'35'
1049 dcfsnz temp1,F
1050 movlw d'65'
1051 dcfsnz temp1,F
1052 movlw d'95'
1053 dcfsnz temp1,F
1054 movlw d'125'
1055 dcfsnz temp1,F
1056 movlw d'155'
1057 dcfsnz temp1,F
1058 movlw d'185'
1059
1060 movff WREG,win_top
1061 STRCPY_PRINT "\xB7"
1062 return
1063
1064 DISP_menu_mask:
1065 call DISP_topline_box
1066 WIN_INVERT .1 ; Init new Wordprocessor
1067 DISPLAYTEXT .5 ; Menu:
1068 WIN_INVERT .0 ; Init new Wordprocessor
1069 DISPLAYTEXT .6 ; Logbook
1070 DISPLAYTEXT .7 ; Gas Setup
1071 DISPLAYTEXT .9 ; Reset all
1072 DISPLAYTEXT .10 ; Setup...
1073 DISPLAYTEXT .142 ; More...
1074 DISPLAYTEXT .11 ; Exit
1075
1076 ; Write OSTC serial in Main Menu
1077 WIN_TOP .215
1078 WIN_LEFT .47
1079 GETCUSTOM8 d'64' ; Write header in blue when
1080 call DISP_set_color ; compiled in DEBUG mode...
1081 lfsr FSR2,letter
1082 OUTPUTTEXTH d'262' ; "OSTC "
1083 clrf EEADRH
1084 clrf EEADR ; Get Serial number LOW
1085 call read_eeprom ; read byte
1086 movff EEDATA,lo
1087 incf EEADR,F ; Get Serial number HIGH
1088 call read_eeprom ; read byte
1089 movff EEDATA,hi
1090 bsf leftbind
1091 output_16
1092 call word_processor
1093 call DISP_standard_color
1094 return
1095
1096 DISP_setup_menu_mask:
1097 call DISP_topline_box
1098 WIN_INVERT .1 ; Init new Wordprocessor
1099 DISPLAYTEXT .98 ; Setup Menu:
1100 WIN_INVERT .0 ; Init new Wordprocessor
1101 DISPLAYTEXT .99 ; Custom FunctionsI
1102 DISPLAYTEXT .153 ; Custom FunctionsII
1103 DISPLAYTEXTH .295 ; Custom FunctionsIII
1104 DISPLAYTEXT .100 ; Decotype:
1105 DISPLAYTEXT .142 ; More...
1106 DISPLAYTEXT .11 ; Exit
1107 return
1108
1109 DISP_ccr_setup_menu_mask:
1110 call DISP_topline_box
1111 WIN_INVERT .1 ; Init new Wordprocessor
1112 DISPLAYTEXT .111 ; CCR Setup Menu
1113 WIN_INVERT .0 ; Init new Wordprocessor
1114 DISPLAYTEXT .229 ; Diluent Setup
1115 DISPLAYTEXT .230 ; Setpoint Setup
1116 DISPLAYTEXT .11 ; Exit
1117 return
1118
1119
1120 DISP_more_setup_menu_mask:
1121 call DISP_topline_box
1122 WIN_INVERT .1 ; Init new Wordprocessor
1123 DISPLAYTEXTH .258 ; Setup Menu 2:
1124 WIN_INVERT .0 ; Init new Wordprocessor
1125 DISPLAYTEXTH .257 ; Date format:
1126 DISPLAYTEXT .129 ; Debug:
1127 DISPLAYTEXT .187 ; Show License
1128 DISPLAYTEXTH .276 ; Salinity:
1129 DISPLAYTEXTH .280 ; Brightness:
1130 DISPLAYTEXT .11 ; Exit
1131 return
1132
1133 DISP_more_menu_mask:
1134 call DISP_topline_box
1135 WIN_INVERT .1 ; Init new Wordprocessor
1136 DISPLAYTEXT .144 ; Menu 2:
1137 WIN_INVERT .0 ; Init new Wordprocessor
1138 DISPLAYTEXT .8 ; Set Time
1139 DISPLAYTEXT .110 ; Const. ppO2 Setup
1140 DISPLAYTEXT .113 ; Battery Info
1141 DISPLAYTEXT .247 ; Simulator
1142 DISPLAYTEXTH .287 ; Altimeter
1143 DISPLAYTEXT .11 ; Exit
1144 return
1145
1146 DISP_reset_menu_mask:
1147 call DISP_topline_box
1148 WIN_INVERT .1 ; Init new Wordprocessor
1149 DISPLAYTEXT .28 ; Reset Menu
1150 WIN_INVERT .0 ; Init new Wordprocessor
1151 DISPLAYTEXT .21 ; Cancel Reset
1152 DISPLAYTEXT .245 ; Reset CF,Gases & Deco
1153 DISPLAYTEXTH .284 ; Reset Logbook
1154 DISPLAYTEXTH .285 ; Reboot OSTC
1155 DISPLAYTEXTH .286 ; Reset Decodata
1156 DISPLAYTEXT .11 ; Exit
1157 return
1158
1159 DISP_simulator_mask:
1160 call DISP_topline_box
1161 WIN_INVERT .1 ; Init new Wordprocessor
1162 DISPLAYTEXT .248 ; OSTC Simulator
1163 WIN_INVERT .0 ; Init new Wordprocessor
1164 DISPLAYTEXTH .307 ; Interval:
1165 DISPLAYTEXT .249 ; Start Dive
1166 DISPLAYTEXTH .277 ; Bottom Time:
1167 DISPLAYTEXTH .278 ; Max. Depth:
1168 DISPLAYTEXTH .279 ; Calculate Deco
1169 DISPLAYTEXT .11 ; Exit
1170 return
1171
1172 DISP_temp_surfmode:
1173 ostc_debug 'e'
1174 SAFE_2BYTE_COPY temperature, last_temperature
1175 WIN_TOP .100
1176 WIN_LEFT .1
1177 WIN_FONT FT_SMALL
1178 WIN_INVERT .0 ; Init new Wordprocessor
1179 call DISP_standard_color
1180
1181 movff last_temperature+1,hi
1182 movff last_temperature+0,lo
1183 lfsr FSR2,letter
1184 call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1185 movlw d'3'
1186 movwf ignore_digits
1187 bsf leftbind ; left orientated output
1188 output_16dp d'2'
1189 bcf leftbind
1190 STRCAT_PRINT "°C "
1191 return
1192
1193 DISP_temp_divemode:
1194 ostc_debug 'u' ; Sends debug-information to screen if debugmode active
1195
1196 ; temperature
1197 SAFE_2BYTE_COPY temperature, last_temperature
1198
1199 WIN_TOP .216
1200 WIN_LEFT .50
1201 WIN_FONT FT_SMALL
1202 WIN_INVERT .0 ; Init new Wordprocessor
1203 call DISP_standard_color
1204
1205 movff last_temperature+1,hi
1206 movff last_temperature+0,lo
1207
1208 lfsr FSR2,letter
1209 call DISP_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
1210 movlw d'3'
1211 movwf ignore_digits
1212 bsf leftbind ; left orientated output
1213 output_16dp d'2'
1214 bcf leftbind
1215 STRCAT "° "
1216 clrf WREG ; Allow up to 5 chars to avoid
1217 movff WREG,letter+5 ; collision with sat graphs
1218 call word_processor
1219 return
1220
1221 DISP_show_ppO2: ; Show ppO2 (ppO2 stored in xC)
1222 ostc_debug 't' ; Sends debug-information to screen if debugmode active
1223 WIN_TOP .117
1224 WIN_LEFT .0
1225 WIN_FONT FT_SMALL
1226 DISP_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC)
1227 STRCPY TXT_PPO2_5
1228
1229 ; Check very high ppO2 manually
1230 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
1231 bra DISP_show_ppO2_3 ; Yes, display fixed Value!
1232
1233 movff xC+0,lo
1234 movff xC+1,hi
1235 bsf ignore_digit4
1236 output_16dp d'1'
1237 bcf ignore_digit4
1238 DISP_show_ppO2_2:
1239 STRCAT_PRINT " "
1240 call DISP_standard_color
1241 return
1242
1243 DISP_show_ppO2_3:
1244 STRCAT ">6.6"
1245 bra DISP_show_ppO2_2
1246
1247 DISP_show_ppO2_clear: ; Clear ppO2
1248 movlw d'10'
1249 movwf temp1
1250 WIN_TOP .117
1251 WIN_LEFT .0
1252 call DISP_display_clear_common_y1
1253 return
1254
1255 DISP_active_gas_clear: ; clears active gas!
1256 WIN_TOP .192
1257 WIN_LEFT .50
1258 movlw d'5'
1259 movwf temp1
1260 bra DISP_display_clear_common_y1; also returns!
1261
1262 DISP_active_gas_divemode: ; Displays current gas (e.g. 40/20) if a) He>0 or b) O2>Custom9
1263 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode
1264 return
1265
1266 WIN_INVERT .0 ; Init new Wordprocessor
1267 call DISP_active_gas_divemode_show ; Show gas (Non-Inverted in all cases)
1268
1269 btfss better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
1270 return ; Done.
1271
1272 ; Check if Gas Output should blink when a better gas is available...
1273 GETCUSTOM8 d'42' ; =1 if gas should blink
1274 movwf lo
1275 movlw d'1'
1276 cpfseq lo ; =1?
1277 return ; No, Done.
1278
1279 btg blinking_better_gas ; Toggle blink bit...
1280 btfss blinking_better_gas ; blink now?
1281 return ; No, Done.
1282 movlw color_yellow ; Blink in yellow
1283 call DISP_set_color
1284 WIN_INVERT .1 ; Init new Wordprocessor
1285 call DISP_active_gas_divemode_show1 ; Show gas (Non-Inverted in all cases)
1286 WIN_INVERT .0 ; Init new Wordprocessor
1287 call DISP_standard_color
1288 return ; Done.
1289
1290 DISP_active_gas_divemode_show:
1291 call DISP_standard_color
1292 DISP_active_gas_divemode_show1:
1293 ostc_debug 's' ; Sends debug-information to screen if debugmode active
1294 ; gas
1295 WIN_TOP .192
1296 WIN_LEFT .50
1297 WIN_FONT FT_SMALL
1298
1299 movlw d'100' ; 100% in the tank
1300 movff char_I_N2_ratio,lo ; minus N2
1301 bsf STATUS,C ; set borrow bit
1302 subfwb lo,W
1303 movff char_I_He_ratio,lo ; minus He
1304 bsf STATUS,C ; set borrow bit
1305 subfwb lo,F ; =% O2
1306 GETCUSTOM8 d'9' ; get oxygen treshold
1307 movff char_I_He_ratio,hi ; He ratio
1308 cpfsgt lo
1309 bra DISP_active_gas_divemode2 ; Check He
1310 bra DISP_active_gas_divemode3 ; Skip He check, display gas
1311
1312 DISP_active_gas_divemode2:
1313 tstfsz hi ; He = 0 %
1314 bra DISP_active_gas_divemode3 ; display gas
1315
1316 call DISP_warnings_color ; O2 below treshold, He=0 : Bad stuff !
1317 bra DISP_active_gas_divemode4
1318
1319 DISP_active_gas_divemode3:
1320 movlw d'21'
1321 cpfseq lo ; Air? (O2=21%)
1322 bra DISP_active_gas_divemode4 ; No!
1323 tstfsz hi ; Air? (He=0%)
1324 bra DISP_active_gas_divemode4 ; No!
1325
1326 ; Yes, display "Air" instead of 21/0
1327 lfsr FSR2,letter
1328 OUTPUTTEXTH d'264' ;"Air "
1329 PUTC ' '
1330 clrf WREG ; Allow up to 5 chars to avoid
1331 movff WREG,letter+5 ; collision with sat graphs
1332 bcf leftbind
1333 call word_processor
1334 DISP_active_better_gas:
1335 WIN_TOP .192
1336 WIN_LEFT .43
1337 WIN_FONT FT_SMALL
1338 lfsr FSR2,letter
1339 movlw ' '
1340 btfsc better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
1341 movlw '*'
1342 movwf POSTINC2
1343 call word_processor
1344 return
1345
1346 DISP_active_gas_divemode4:
1347 lfsr FSR2,letter
1348 bsf leftbind ; left orientated output
1349 output_8 ; O2 ratio is still in "lo"
1350 PUTC '/'
1351 movff char_I_He_ratio,lo ; copy He ratio into lo
1352 output_8
1353 PUTC ' '
1354 clrf WREG ; Allow up to 5 chars to avoid
1355 movff WREG,letter+5 ; collision with sat graphs
1356 bcf leftbind
1357 call word_processor
1358 rcall DISP_active_better_gas ; show *, if required
1359 call DISP_standard_color ; Back to normal (if O2<21 and He=0)
1360 return
1361
1362 ;-----------------------------------------------------------------------------
1363 ; Set color to grey when gas is inactive
1364 ; Inputs: WREG : gas# (0..4)
1365 ; Trashes: lo
1366 ; New v1.44se
1367 DISP_grey_inactive_gas:
1368 movwf lo ; copy gas number 0-4
1369 incf lo,F ; 1-5
1370
1371 read_int_eeprom d'33' ; Get First gas (1-5)
1372 movf EEDATA,W
1373 subwf lo,W ; Compare with current
1374 bz DISP_white_gas ; First is always on.
1375
1376 movlw .28-1 ; Depth for gas# is at idx+28
1377 addwf lo,W
1378 movwf EEADR ; address in EEPROM.
1379 call read_eeprom ; Read depth
1380 clrf WREG
1381 cpfsgt EEDATA ; is depth > 0 ?
1382 bra DISP_grey_gas
1383
1384 clrf EEADRH ; Lower page of EEPROM.
1385 read_int_eeprom d'27' ; read flag register
1386 DISP_grey_inactive_gas1:
1387 rrcf EEDATA ; roll flags into carry
1388 decfsz lo,F ; max. 5 times...
1389 bra DISP_grey_inactive_gas1
1390
1391 bnc DISP_grey_gas ; test carry
1392
1393 DISP_white_gas:
1394 GETCUSTOM8 d'35' ;movlw color_white
1395 goto DISP_set_color ; grey out inactive gases!
1396 ; return
1397
1398 DISP_grey_gas:
1399 DISP_grey:
1400 GETCUSTOM8 d'64' ;movlw color_grey
1401 goto DISP_set_color ; grey out inactive gases!
1402 ; return
1403
1404 ;-----------------------------------------------------------------------------
1405 ; Display Pre-Dive Screen
1406
1407 DISP_pre_dive_screen:
1408 ; List active gases/Setpoints
1409
1410 btfsc FLAG_const_ppO2_mode ; in ppO2 mode?
1411 bra DISP_pre_dive_screen3 ; Yes, display SetPoint/Sensor result list
1412
1413 DISP_pre_dive_screen2:
1414 ostc_debug 'm' ; Sends debug-information to screen if debugmode active
1415
1416 WIN_LEFT .90
1417 WIN_FONT FT_SMALL
1418 bsf leftbind
1419
1420 movlw d'2'
1421 movwf wait_temp ; here: stores eeprom address for gas list
1422 movlw d'0'
1423 movwf waitms_temp ; here: stores row for gas list
1424 clrf hi ; here: Gas counter
1425
1426 DISP_pre_dive_screen2_loop:
1427 incf hi,F ; Increase Gas
1428 movlw d'4'
1429 addwf wait_temp,F ; Increase eeprom address for gas list
1430
1431 STRCPY TXT_GAS1
1432 movff hi,lo ; copy gas number
1433 output_8 ; display gas number
1434 STRCAT ": "
1435 movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM
1436 call read_eeprom ; get byte (stored in EEDATA)
1437 movff EEDATA,lo ; copy to lo
1438 output_8 ; outputs into Postinc2!
1439 PUTC '/'
1440 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM
1441 call read_eeprom ; get byte (stored in EEDATA)
1442 movff EEDATA,lo ; copy to lo
1443 output_8 ; outputs into Postinc2!
1444
1445 decf hi,W ; Gas # in 0..4
1446 call DISP_grey_inactive_gas
1447
1448 read_int_eeprom d'33' ; Read start gas (1-5)
1449 movf EEDATA,W
1450 cpfseq hi ; Current Gas the active gas?
1451 bra DISP_pre_dive_screen2a
1452 bra DISP_pre_dive_screen2b
1453
1454 DISP_pre_dive_screen2a:
1455 movlw d'25'
1456 addwf waitms_temp,F ; Increase row
1457 WIN_LEFT .90
1458 movff waitms_temp,win_top ; Set Row
1459 call word_processor ; No, display gas
1460
1461 DISP_pre_dive_screen2b:
1462 movlw d'5' ; list all four (remaining) gases
1463 cpfseq hi ; All gases shown?
1464 bra DISP_pre_dive_screen2_loop ; No
1465
1466 return ; No, return (OC mode)
1467
1468 DISP_pre_dive_screen3:
1469 WIN_LEFT .90
1470 WIN_FONT FT_SMALL
1471 bsf leftbind
1472 call DISP_standard_color
1473
1474 ; list three SP in Gaslist
1475 movlw d'35' ; 36 = current SP position in EEPROM
1476 movwf wait_temp ; here: stores eeprom address for gas list
1477 movlw d'0'
1478 movwf waitms_temp ; here: stores row for gas list
1479 clrf apnoe_mins ; here: SP counter
1480
1481 DISP_pre_dive_screen3_loop:
1482 incf wait_temp,F ; EEPROM address
1483 incf apnoe_mins,F ; Increase SP
1484
1485 movlw d'25'
1486 addwf waitms_temp,F ; Increase row
1487 WIN_LEFT .90
1488 movff waitms_temp,win_top ; Set Row
1489
1490 STRCPY TXT_SP2
1491 movff apnoe_mins,lo ; copy gas number
1492 output_8 ; display gas number
1493 STRCAT ": "
1494 movff wait_temp, EEADR ; SP #hi position
1495 call read_eeprom ; get byte (stored in EEDATA)
1496 movff EEDATA,lo ; copy to lo
1497 clrf hi
1498 output_16dp d'3' ; outputs into Postinc2!
1499 call word_processor
1500
1501 movlw d'3' ; list all three SP
1502 cpfseq apnoe_mins ; All gases shown?
1503 bra DISP_pre_dive_screen3_loop ;no
1504
1505
1506 call get_first_diluent ; Read first diluent into lo(O2) and hi(He)
1507 WIN_LEFT .90
1508 WIN_TOP .100
1509 STRCPY TXT_DIL4
1510 output_8 ; O2 Ratio
1511 PUTC '/'
1512 movff hi,lo
1513 output_8 ; He Ratio
1514 call word_processor
1515
1516 bcf leftbind
1517 return ; Return (CC Mode)
1518
1519 DISP_active_gas_surfmode: ; Displays start gas/SP 1
1520 ostc_debug 'q' ; Sends debug-information to screen if debugmode active
1521
1522 btfsc FLAG_apnoe_mode ; In Apnoe mode?
1523 return ; Yes, return
1524
1525 btfsc gauge_mode ; In Gauge mode?
1526 return ; Yes, return
1527
1528 btfss FLAG_const_ppO2_mode ; are we in const. ppO2 mode?
1529 bra DISP_active_gas_surfmode2 ; No, display gases
1530
1531 ; In CC Mode
1532 WIN_TOP .135
1533 WIN_LEFT .90
1534 WIN_FONT FT_SMALL
1535 WIN_INVERT .0 ; Init new Wordprocessor
1536 call DISP_standard_color
1537
1538 lfsr FSR2,letter
1539 read_int_eeprom d'36'
1540 movff EEDATA,lo ; copy to lo
1541 clrf hi
1542 output_16dp d'3' ; outputs into Postinc2!
1543 bcf leftbind
1544
1545 STRCAT_PRINT TXT_BAR3
1546 return ; Done.
1547
1548 DISP_active_gas_surfmode2:
1549 WIN_TOP .130
1550 WIN_LEFT .100
1551 WIN_FONT FT_MEDIUM
1552 WIN_INVERT .0 ; Init new Wordprocessor
1553 call DISP_standard_color
1554
1555 read_int_eeprom d'33' ; Read byte (stored in EEDATA)
1556 movff EEDATA,active_gas ; Read start gas (1-5)
1557
1558 decf active_gas,W ; Gas 0-4
1559 mullw d'4'
1560 movf PRODL,W
1561 addlw d'7' ; = address for He ratio
1562 movwf EEADR
1563 call read_eeprom ; Read He ratio
1564 movff EEDATA,char_I_He_ratio ; And copy into hold register
1565
1566 decf active_gas,W ; Gas 0-4
1567 mullw d'4'
1568 movf PRODL,W
1569 addlw d'6' ; = address for O2 ratio
1570 movwf EEADR
1571 call read_eeprom ; Read O2 ratio
1572 movff EEDATA, char_I_O2_ratio ; O2 ratio
1573 movff char_I_He_ratio, wait_temp ; copy into bank1 register
1574 bsf STATUS,C ; Borrow bit
1575 movlw d'100' ; 100%
1576 subfwb wait_temp,W ; minus He
1577 bsf STATUS,C ; Borrow bit
1578 subfwb EEDATA,F ; minus O2
1579 movff EEDATA, char_I_N2_ratio ; = N2!
1580
1581 movlw d'100' ; 100% in the tank
1582 movff char_I_N2_ratio,lo ; minus N2
1583 bsf STATUS,C ; set borrow bit
1584 subfwb lo,W
1585 movff char_I_He_ratio,lo ; minus He
1586 bsf STATUS,C ; set borrow bit
1587 subfwb lo,F ; =% O2
1588
1589 movff char_I_He_ratio,hi ; Copy into Bank1 register
1590
1591 movlw d'21'
1592 cpfseq lo ; Air? (O2=21%)
1593 bra DISP_active_gas_surfmode4 ; No!
1594 tstfsz hi ; Air? (He=0%)
1595 bra DISP_active_gas_surfmode4 ; No!
1596
1597 ; Yes, display "Air" instead of 21/0
1598 DISPLAYTEXTH d'265' ;"Air ", y-scale=2
1599 return ; Done.
1600
1601 DISP_active_gas_surfmode4:
1602 lfsr FSR2,letter
1603 bsf leftbind ; left orientated output
1604 output_99 ; O2 ratio is still in "lo"
1605 movff char_I_He_ratio,lo ; copy He ratio into lo
1606 tstfsz lo ; He>0?
1607 bra DISP_active_gas_surfmode5 ; Yes.
1608 bra DISP_active_gas_surfmode6 ; No, skip He
1609 DISP_active_gas_surfmode5:
1610 PUTC '/'
1611 output_99
1612 DISP_active_gas_surfmode6:
1613 bcf leftbind
1614 call word_processor
1615
1616 rcall DISP_mainscreen_show_nx
1617 tstfsz lo ; He>0?
1618 rcall DISP_mainscreen_show_tx ; Yes
1619 return ; Done.
1620
1621 DISP_mainscreen_show_tx:
1622 WIN_LEFT .85
1623 WIN_FONT FT_SMALL
1624 WIN_INVERT .0 ; Init new Wordprocessor
1625 WIN_TOP .127
1626
1627 STRCPY_PRINT TXT_TX1
1628 WIN_TOP .148
1629 STRCPY_PRINT TXT_TX2
1630 return
1631 DISP_mainscreen_show_nx:
1632 WIN_LEFT .85
1633 WIN_TOP .127
1634 WIN_FONT FT_SMALL
1635 WIN_INVERT .0 ; Init new Wordprocessor
1636
1637 STRCPY_PRINT TXT_NX1
1638 WIN_TOP .148
1639 STRCPY_PRINT TXT_NX2
1640 return
1641
1642
1643 DISP_confirmbox:
1644 WIN_BOX_BLACK .68, .146, .34, .101 ;top, bottom, left, right
1645 WIN_FRAME_STD .70, .144, .35, .100
1646
1647 DISPLAYTEXT .143 ; Confirm:
1648 DISPLAYTEXT .145 ; Cancel
1649 DISPLAYTEXT .146 ; OK!
1650
1651 movlw d'1'
1652 movwf menupos
1653
1654 DISP_confirmbox2:
1655 WIN_BOX_BLACK .96, .143, .39, .51 ;top, bottom, left, right
1656
1657 movff menupos,temp1
1658 movlw d'96'
1659 dcfsnz temp1,F
1660 movlw d'96'
1661 dcfsnz temp1,F
1662 movlw d'120'
1663 movff WREG,win_top
1664 WIN_LEFT .39
1665 WIN_FONT FT_SMALL
1666 WIN_INVERT .0 ; Init new Wordprocessor
1667 call DISP_standard_color
1668
1669 STRCPY_PRINT "\xB7" ; Cursor
1670
1671 bcf sleepmode ; clear some flags
1672 bcf menubit2
1673 bcf menubit3
1674 bcf switch_right
1675 bcf switch_left
1676 clrf timeout_counter2
1677 WAITMS d'100'
1678
1679 DISP_confirmbox_loop:
1680 call check_switches_logbook
1681
1682 btfsc menubit3 ; SET/MENU?
1683 bra DISP_confirmbox_move_cursor; Move Cursor
1684 btfsc menubit2 ; ENTER?
1685 bra DISP_confirmbox_menu_do ; Do task
1686
1687 btfsc onesecupdate
1688 call timeout_surfmode ; timeout
1689
1690 btfsc onesecupdate
1691 call set_dive_modes ; check, if divemode must be entered
1692 bcf onesecupdate ; one second update
1693
1694 btfsc sleepmode ; Timeout?
1695 bra DISP_confirmbox_cancel ; back with cancel
1696 btfsc divemode
1697 bra DISP_confirmbox_cancel ; back with cancel
1698
1699 bra DISP_confirmbox_loop ; wait for something to do
1700
1701 DISP_confirmbox_cancel:
1702 retlw .0
1703 DISP_confirmbox_ok:
1704 retlw .1
1705
1706 DISP_confirmbox_menu_do:
1707 dcfsnz menupos,F
1708 bra DISP_confirmbox_cancel
1709 dcfsnz menupos,F
1710 bra DISP_confirmbox_ok
1711 bra DISP_confirmbox_cancel
1712
1713 DISP_confirmbox_move_cursor:
1714 incf menupos,F
1715 movlw d'3' ; number of menu options+1
1716 cpfseq menupos ; =limit?
1717 bra DISP_confirmbox_move_cursor2 ; No!
1718 movlw d'1' ; Yes, reset to position 1!
1719 movwf menupos
1720 DISP_confirmbox_move_cursor2:
1721 bra DISP_confirmbox2 ; Return to Profile Menu, also updates cursor
1722
1723
1724 DISP_depth:
1725 ; ostc_debug 'r' ; Sends debug-information to screen if debugmode active
1726 SAFE_2BYTE_COPY rel_pressure, lo
1727 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
1728
1729 movlw .039
1730 cpfslt hi
1731 bra depth_greater_99_84mtr
1732
1733 btfsc depth_greater_100m ; Was depth>100m during last call
1734 call DISP_clear_depth ; Yes, clear depth area
1735 bcf depth_greater_100m ; Do this once only...
1736
1737 lfsr FSR2,letter
1738
1739 movlw HIGH d'1000'
1740 movwf sub_a+1
1741 movlw LOW d'1000'
1742 movwf sub_a+0
1743 movff hi,sub_b+1
1744 movff lo,sub_b+0
1745 incf sub_b+0,F
1746 movlw d'0'
1747 addwfc sub_b+1,F ; Add 1mbar offset
1748 call sub16 ; sub_c = sub_a - sub_b
1749 btfss neg_flag ; Depth lower then 10m?
1750 rcall depth_less_10mtr ; Yes, add extra space
1751
1752 WIN_TOP .24
1753 WIN_LEFT .0
1754 WIN_FONT FT_LARGE
1755 WIN_INVERT .0 ; Init new Wordprocessor
1756 DISP_color_code warn_depth ; Color-code the output
1757
1758 movlw HIGH d'99'
1759 movwf sub_a+1
1760 movlw LOW d'99'
1761 movwf sub_a+0
1762 movff hi,sub_b+1
1763 movff lo,sub_b+0
1764 call sub16 ; sub_c = sub_a - sub_b
1765 btfss neg_flag ; Depth lower then 1m?
1766 bra DISP_depth2 ; Yes, display manual Zero
1767
1768 bsf leftbind
1769 bsf ignore_digit4
1770 output_16 ; Full meters in Big font
1771 bcf leftbind
1772 bra DISP_depth3
1773
1774 DISP_depth2:
1775 PUTC '0'
1776
1777 DISP_depth3:
1778 call word_processor
1779 bcf ignore_digit4
1780
1781 WIN_FONT FT_MEDIUM
1782 WIN_TOP .50
1783 WIN_LEFT .40
1784 DISP_color_code warn_depth ; Color-code the output
1785
1786 SAFE_2BYTE_COPY rel_pressure, lo
1787 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
1788
1789 STRCPY "."
1790
1791 movlw HIGH d'20' ; Display 0.0m if lower then 20cm
1792 movwf sub_a+1
1793 movlw LOW d'20'
1794 movwf sub_a+0
1795 movff hi,sub_b+1
1796 movff lo,sub_b+0
1797 call sub16 ; sub_c = sub_a - sub_b
1798 btfss neg_flag ; Depth lower then 0.3m?
1799 bra DISP_depth4 ; Yes, display manual Zero
1800
1801 movlw d'4'
1802 movwf ignore_digits
1803 bsf ignore_digit5
1804 output_16dp d'0'
1805 bra DISP_depth5
1806
1807 DISP_depth4:
1808 PUTC '0'
1809
1810 DISP_depth5:
1811 call word_processor ; decimeters in medium font
1812 bcf ignore_digit5
1813 WIN_FONT FT_SMALL
1814 return
1815
1816 depth_greater_99_84mtr: ; Display only in full meters
1817 btfss depth_greater_100m ; Is depth>100m already?
1818 call DISP_clear_depth ; No, clear depth area and set flag
1819 ; Depth is already in hi:lo
1820 ; Show depth in Full meters
1821 ; That means ignore figure 4 and 5
1822 lfsr FSR2,letter
1823 WIN_TOP .24
1824 WIN_LEFT .0
1825 WIN_FONT FT_LARGE
1826 WIN_INVERT .0 ; Init new Wordprocessor
1827 DISP_color_code warn_depth ; Color-code the output
1828
1829 bsf ignore_digit4
1830 bsf leftbind
1831 output_16
1832 bcf leftbind
1833 call word_processor
1834 bcf ignore_digit4
1835 WIN_FONT FT_SMALL
1836 return
1837
1838 depth_less_10mtr:
1839 PUTC ' '
1840 return
1841
1842 DISP_clear_depth ; No, clear depth area and set flag
1843 WIN_BOX_BLACK .24, .90, .0, .90 ;top, bottom, left, right
1844 bsf depth_greater_100m ; Set Flag
1845 return
1846
1847 DISP_desaturation_time:
1848 movff int_O_desaturation_time+0,lo
1849 movff int_O_desaturation_time+1,hi ; Copy
1850 tstfsz lo ; =0?
1851 bra DISP_desaturation_time2 ; No!
1852 tstfsz hi ; =0?
1853 bra DISP_desaturation_time2 ; No!
1854 return ; Do not display Desat
1855
1856 DISP_desaturation_time2:
1857 ostc_debug 'h'
1858 WIN_TOP .150
1859 WIN_LEFT .1
1860 WIN_FONT FT_SMALL
1861 WIN_INVERT .0 ; Init new Wordprocessor
1862 call DISP_standard_color
1863
1864 lfsr FSR2,letter
1865 OUTPUTTEXT d'14' ; Desat
1866 PUTC ' '
1867 movff desaturation_time_buffer+0,lo ; divide by 60...
1868 movff desaturation_time_buffer+1,hi
1869
1870 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo)
1871 bsf leftbind
1872 movf lo,W
1873 movff hi,lo
1874 movwf hi ; exchange lo and hi...
1875 output_8 ; Hours
1876 PUTC ':'
1877 movff hi,lo ; Minutes
1878 output_99x
1879 bcf leftbind
1880 PUTC ' '
1881 ; clrf WREG ; Allow up to 5 chars to avoid
1882 ; movff WREG,letter+6 ; collision with decotype letters
1883 call word_processor
1884 return
1885
1886 DISP_nofly_time:
1887 movf nofly_time+0,W ; Is nofly null ?
1888 iorwf nofly_time+1,W
1889 bnz DISP_nofly_time2 ; No...
1890 return
1891
1892 DISP_nofly_time2:
1893 ostc_debug 'g'
1894 WIN_TOP .125
1895 WIN_LEFT .1
1896 WIN_FONT FT_SMALL
1897 WIN_INVERT .0 ; Init new Wordprocessor
1898 call DISP_standard_color
1899
1900 lfsr FSR2,letter
1901 OUTPUTTEXT d'35' ; NoFly
1902 PUTC ' '
1903 movff nofly_time+0,lo ; divide by 60...
1904 movff nofly_time+1,hi
1905 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo)
1906 bsf leftbind
1907 movf lo,W
1908 movff hi,lo
1909 movwf hi ; exchange lo and hi...
1910 output_8 ; Hours
1911 PUTC ':'
1912 movff hi,lo ; Minutes
1913 output_99x
1914 bcf leftbind
1915 PUTC ' '
1916 ; clrf WREG ; Allow up to 5 chars to avoid
1917 ; movff WREG,letter+6 ; collision with decotype letters
1918 call word_processor
1919 return
1920
1921
1922 update_surf_press:
1923 btfsc premenu ; Do not update when "Menu?" is displayed!
1924 return
1925
1926 ostc_debug 'b' ; Sends debug-information to screen if debugmode active
1927 WIN_TOP .25
1928 WIN_LEFT .1
1929 WIN_FONT FT_SMALL
1930 WIN_INVERT .0 ; Init new Wordprocessor
1931
1932 ; btfss high_altitude_mode ; In high altitude mode?
1933 call DISP_standard_color ; No
1934 ; btfsc high_altitude_mode ; In high altitude mode?
1935 ; call DISP_warnings_color ; Yes, display ambient pressure in red
1936
1937 SAFE_2BYTE_COPY amb_pressure, lo
1938 lfsr FSR2,letter
1939
1940 movff lo,sub_a+0
1941 movff hi,sub_a+1
1942 movff last_surfpressure_30min+0,sub_b+0
1943 movff last_surfpressure_30min+1,sub_b+1
1944 call sub16 ; sub_c = sub_a - sub_b
1945 btfsc neg_flag ; Pressure lower?
1946 rcall update_surf_press2 ; Yes, test threshold
1947
1948 tstfsz sub_c+1 ; >255mbar difference?
1949 bra update_surf_press_common; Yes, display!
1950 movlw d'5'
1951 subwf sub_c+0,W
1952 btfsc STATUS,C
1953 bra update_surf_press_common; Yes, display!
1954 ; PUTC '+' ; For debug only
1955 SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value...
1956
1957 update_surf_press_common:
1958 bsf leftbind
1959 output_16
1960 bcf leftbind
1961 STRCAT_PRINT TXT_MBAR5
1962 call DISP_standard_color ; Reset color
1963 return
1964
1965 update_surf_press2:
1966 movff lo,sub_b+0
1967 movff hi,sub_b+1
1968 movff last_surfpressure_30min+0,sub_a+0
1969 movff last_surfpressure_30min+1,sub_a+1
1970 call sub16 ; sub_c = sub_a - sub_b
1971 ; PUTC '-' ; For debug only
1972 return
1973
1974 update_batt_voltage_divemode:
1975 call DISP_warnings_color
1976 DISPLAYTEXT d'246' ; LowBatt!
1977 call DISP_standard_color
1978 return
1979
1980 update_batt_voltage:
1981 ostc_debug 'f'
1982
1983 GETCUSTOM8 d'31' ; =1 if battery voltage should be visible
1984 movwf lo
1985 movlw d'1'
1986 cpfseq lo ; =1?
1987 bra update_batt_voltage2 ; No, show symbol
1988
1989 WIN_TOP .175
1990 WIN_LEFT .1
1991 WIN_FONT FT_SMALL
1992 WIN_INVERT .0 ; Init new Wordprocessor
1993 call DISP_standard_color
1994
1995 lfsr FSR2,letter
1996 movff batt_voltage+0,lo
1997 movff batt_voltage+1,hi
1998 movlw d'1'
1999 movwf ignore_digits
2000 bsf ignore_digit5 ; do not display mV
2001 bsf leftbind
2002 output_16dp d'2' ; e.g. 3.45V
2003 bcf leftbind
2004 STRCAT_PRINT TXT_VOLT2
2005 return
2006
2007 update_batt_voltage2:
2008 WIN_FRAME_STD .174, .194, .1, .32
2009
2010 ; 4100-Vbatt
2011 movlw LOW d'4100'
2012 movwf sub_a+0
2013 movlw HIGH d'4100'
2014 movwf sub_a+1
2015 movff batt_voltage+0,sub_b+0
2016 movff batt_voltage+1,sub_b+1
2017 call sub16 ; sub_c = sub_a - sub_b
2018 ; Battery full (>4100mV?
2019 btfsc neg_flag
2020 bra update_batt_voltage2_full
2021
2022 ; Vbatt-3500
2023 movlw LOW d'3500'
2024 movwf sub_b+0
2025 movlw HIGH d'3500'
2026 movwf sub_b+1
2027 movff batt_voltage+0,sub_a+0
2028 movff batt_voltage+1,sub_a+1
2029 call sub16 ; sub_c = sub_a - sub_b
2030 ; Battery lower then 3500mV?
2031 btfsc neg_flag
2032 bra update_batt_voltage2_empty
2033
2034 ; Battery is between 3500 and 4100mV
2035 ; sub_c:2 is between 0 and 600
2036 movff sub_c+0,xA+0
2037 movff sub_c+1,xA+1
2038 movlw d'20'
2039 movwf xB+0
2040 clrf xB+1
2041 call div16x16 ;xA/xB=xC with xA as remainder
2042 ; xC is between 0 and 30
2043 movff xC+0,wait_temp ;save value
2044 incf wait_temp,F ; +1
2045
2046 movlw d'3'
2047 cpfsgt wait_temp
2048 movwf wait_temp ; Minimum = 3
2049
2050 update_batt_voltage2a:
2051 WIN_BOX_STD .181, .187, .32, .34 ; Battery nose
2052
2053 update_batt_voltage3:
2054 GETCUSTOM8 d'34' ; Color battery
2055 btfsc cc_active
2056 movlw color_yellow ; CC active
2057 btfsc charge_done
2058 movlw color_green ; Charge done.
2059 call DISP_set_color
2060
2061 movlw .175
2062 movff WREG,win_top ; row top (0-239)
2063 movlw .19
2064 movff WREG,win_height
2065 movlw .2
2066 movff WREG,win_leftx2 ; column left (0-159)
2067 movff wait_temp,win_width ; column right (0-159)
2068 call DISP_box
2069 call DISP_standard_color
2070 return
2071
2072 update_batt_voltage2_empty:
2073 movlw d'1'
2074 movwf wait_temp
2075 bra update_batt_voltage2a
2076
2077 update_batt_voltage2_full:
2078 movlw d'30'
2079 movwf wait_temp
2080 bra update_batt_voltage2a
2081
2082 DISP_convert_signed_temperature:
2083 btfss hi,7 ; Negative temperature ?
2084 return ; No, return
2085 ; Yes, negative temperature!
2086 PUTC '-' ; Display "-"
2087 comf hi ; Then, 16bit sign changes.
2088 negf lo
2089 btfsc STATUS,C
2090 incf hi
2091 return ; and return
2092
2093 DISP_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
2094 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
2095 tstfsz EEDATA
2096 bra DISP_convert_date1
2097
2098 ; Use MMDDYY
2099 movff convert_value_temp+0,lo ;month
2100 bsf leftbind
2101 output_99x
2102 bcf leftbind
2103 PUTC '.'
2104 movff convert_value_temp+1,lo ;day
2105 bra DISP_convert_date1_common ;year
2106
2107 DISP_convert_date1:
2108 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
2109 decfsz EEDATA,F
2110 bra DISP_convert_date2
2111
2112 ; Use DDMMYY
2113 movff convert_value_temp+1,lo ;day
2114 bsf leftbind
2115 output_99x
2116 bcf leftbind
2117 PUTC '.'
2118 movff convert_value_temp+0,lo ;month
2119
2120 DISP_convert_date1_common:
2121 bsf leftbind
2122 output_99x
2123 bcf leftbind
2124 PUTC '.'
2125 movff convert_value_temp+2,lo ;year
2126 bsf leftbind
2127 output_99x
2128 return
2129
2130 DISP_convert_date2:
2131 ; Use YYMMDD
2132 movff convert_value_temp+2,lo ;year
2133 bsf leftbind
2134 output_99x
2135 bcf leftbind
2136 PUTC '.'
2137 movff convert_value_temp+0,lo ;month
2138 bsf leftbind
2139 output_99x
2140 bcf leftbind
2141 PUTC '.'
2142 movff convert_value_temp+1,lo ;day
2143 bsf leftbind
2144 output_99x
2145 return
2146
2147 DISP_convert_date_short: ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2
2148 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
2149 tstfsz EEDATA
2150 bra DISP_convert_date_short1
2151
2152 ; Use MMDDYY
2153 DISP_convert_date_short_common:
2154 movff convert_value_temp+0,lo ;month
2155 bsf leftbind
2156 output_99x
2157 bcf leftbind
2158 PUTC '.'
2159 movff convert_value_temp+1,lo ;day
2160 bsf leftbind
2161 output_99x
2162 bcf leftbind
2163 return
2164
2165 DISP_convert_date_short1:
2166 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
2167 decfsz EEDATA,F
2168 bra DISP_convert_date_short_common ; Use YYMMDD
2169
2170 ; Use DDMMYY
2171 movff convert_value_temp+1,lo ;day
2172 bsf leftbind
2173 output_99x
2174 bcf leftbind
2175 PUTC '.'
2176 movff convert_value_temp+0,lo ;month
2177 bsf leftbind
2178 output_99x
2179 bcf leftbind
2180 return
2181
2182 update_date:
2183 ostc_debug 'd'
2184 WIN_TOP .75
2185 WIN_LEFT .1
2186 WIN_FONT FT_SMALL
2187 WIN_INVERT .0 ; Init new Wordprocessor
2188 call DISP_standard_color
2189
2190 lfsr FSR2,letter
2191
2192 movff month,convert_value_temp+0
2193 movff day,convert_value_temp+1
2194 movff year,convert_value_temp+2
2195 call DISP_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
2196 call word_processor
2197 return
2198
2199 DISP_menu_clear:
2200 WIN_BOX_BLACK .0, .26, .50, .100 ;top, bottom, left, right
2201 return
2202
2203 DISP_max_pressure:
2204 ostc_debug 'p' ; Sends debug-information to screen if debugmode active
2205 movff max_pressure+0,lo
2206 movff max_pressure+1,hi
2207 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2208
2209 movlw .039
2210 cpfslt hi
2211 bra maxdepth_greater_99_84mtr
2212
2213 ; Display normal "xx.y"
2214 lfsr FSR2,letter
2215 call DISP_standard_color
2216 WIN_TOP .207
2217 WIN_LEFT .0
2218 WIN_FONT FT_MEDIUM
2219 WIN_INVERT .0 ; Init new Wordprocessor
2220 bsf leftbind
2221 bsf ignore_digit5 ; do not display 1cm depth
2222 output_16dp d'3'
2223 bcf leftbind
2224 bcf show_last3
2225 call word_processor
2226 WIN_FONT FT_SMALL
2227 return
2228
2229 maxdepth_greater_99_84mtr: ; Display only in full meters
2230 btfss maxdepth_greater_100m ; Is max.depth>100m already?
2231 call DISP_clear_maxdepth ; No, clear maxdepth area and set flag
2232 ; max Depth is already in hi:lo
2233 ; Show max depth in Full meters
2234 ; That means ignore figure 4 and 5
2235 lfsr FSR2,letter
2236 call DISP_standard_color
2237 WIN_TOP .207
2238 WIN_LEFT .0
2239 WIN_FONT FT_MEDIUM
2240 WIN_INVERT .0 ; Init new Wordprocessor
2241
2242 bsf ignore_digit4
2243 bsf leftbind
2244 output_16
2245 bcf leftbind
2246 call word_processor
2247 bcf ignore_digit4
2248 WIN_FONT FT_SMALL
2249 return
2250
2251 DISP_clear_maxdepth:
2252 WIN_BOX_BLACK .207, .239, .0, .41 ;top, bottom, left, right
2253 bsf maxdepth_greater_100m ; Set Flag
2254 return
2255
2256 DISP_divemins:
2257 btfsc menubit ; Divemode menu active?
2258 return ; Yes, do not update divetime
2259
2260 ostc_debug 'A' ; Sends debug-information to screen if debugmode active
2261
2262 btfsc gauge_mode ; different display in gauge mode
2263 bra DISP_divemins_gauge
2264
2265 btfsc FLAG_apnoe_mode ; different display in apnoe mode
2266 bra DISP_divemins_apnoe
2267
2268 GETCUSTOM8 d'38' ; Show seconds (=1?)
2269 movwf lo
2270 movlw d'1'
2271 cpfseq lo ; =1?
2272 bra DISP_divemins2 ; No, minutes only
2273 bra DISP_divemins_gauge ; Yes, use Gauge routine
2274
2275 DISP_divemins2:
2276 movff divemins+0,lo
2277 movff divemins+1,hi
2278 bcf leftbind
2279 lfsr FSR2,letter
2280 output_16_3 ; displays only last three figures from a 16Bit value (0-999)
2281 WIN_TOP .20
2282 WIN_LEFT .120
2283 WIN_FONT FT_MEDIUM
2284 call DISP_standard_color
2285 call word_processor
2286 WIN_FONT FT_SMALL
2287 return
2288
2289 DISP_display_apnoe_surface:
2290 btfsc menubit ; Divemode menu active?
2291 return ; Yes, do not display surface mode timeout
2292
2293 call DISP_divemask_color ; Set Color for Divemode mask
2294 DISPLAYTEXT d'140' ; "SURFACE"
2295 call DISP_standard_color
2296
2297 WIN_TOP .85
2298 WIN_LEFT .90
2299 WIN_FONT FT_MEDIUM
2300 call DISP_standard_color
2301
2302
2303 movff apnoe_surface_mins,lo
2304 bcf leftbind
2305 lfsr FSR2,letter
2306 output_8
2307 PUTC ':'
2308 movff apnoe_surface_secs,lo
2309 output_99x
2310 call word_processor
2311 WIN_FONT FT_SMALL
2312 return
2313
2314 DISP_apnoe_clear_surface:
2315 ; Clear Surface timer....
2316 WIN_BOX_BLACK .60, .119, .90, .159 ;top, bottom, left, right
2317 return
2318
2319
2320 DISP_display_apnoe_descent:
2321 btfsc menubit ; Divemode menu active?
2322 return ; Yes, do not display/update descent time
2323
2324 call DISP_divemask_color ; Set Color for Divemode mask
2325 DISPLAYTEXT d'139' ; "Descent"
2326 call DISP_standard_color
2327
2328
2329 WIN_TOP .145
2330 WIN_LEFT .90
2331 WIN_FONT FT_MEDIUM
2332 call DISP_standard_color
2333
2334
2335 movff apnoe_mins,lo
2336 lfsr FSR2,letter
2337 output_8
2338 PUTC ':'
2339 movff apnoe_secs,lo
2340 output_99x
2341 call word_processor
2342 WIN_FONT FT_SMALL
2343 return
2344
2345 DISP_divemins_apnoe:
2346
2347 DISP_divemins_gauge:
2348 movff divemins+0,lo
2349 movff divemins+1,hi
2350 bcf leftbind
2351 bsf show_last3
2352 lfsr FSR2,letter
2353 output_16_3 ;Displays only 0...999
2354 PUTC ':'
2355 movff divesecs,lo
2356 output_99x
2357 WIN_TOP .20
2358 WIN_LEFT .90
2359 WIN_FONT FT_MEDIUM
2360 call DISP_standard_color
2361
2362 call word_processor
2363 bcf show_last3
2364 WIN_FONT FT_SMALL
2365 return
2366
2367 DISP_stopwatch_show:
2368 ; Stopwatch
2369 call DISP_divemask_color ; Set Color for Divemode mask
2370 DISPLAYTEXTH d'283' ; Stopwatch
2371
2372 DISP_stopwatch_show2:
2373 call DISP_standard_color
2374 ostc_debug 'V' ; Sends debug-information to screen if debugmode active
2375 WIN_TOP .192
2376 WIN_LEFT .110
2377 WIN_FONT FT_SMALL
2378 call DISP_standard_color
2379
2380 lfsr FSR2,letter
2381 movff average_divesecs+0,lo ; Stopwatch
2382 movff average_divesecs+1,hi ; Stopwatch
2383 movlw d'2'
2384 subwf lo,F
2385 movlw d'0'
2386 subwfb hi,F ; Subtract 2 seconds
2387
2388 call convert_time ; converts hi:lo in seconds to mins (hi) and secs (lo)
2389
2390 movff lo,wait_temp
2391 movff hi,lo
2392 clrf hi
2393
2394 movlw d'0'
2395 bcf leftbind
2396 bsf show_last3
2397 output_16_3 ;Displays only 0...999
2398 PUTC ':'
2399 movff wait_temp,lo
2400 output_99x
2401 call word_processor
2402
2403 ostc_debug 'U' ; Sends debug-information to screen if debugmode active
2404
2405 WIN_TOP .216
2406 WIN_LEFT .110
2407 WIN_FONT FT_SMALL
2408 call DISP_standard_color
2409
2410 lfsr FSR2,letter
2411 movff avr_rel_pressure+0,lo
2412 movff avr_rel_pressure+1,hi
2413 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2414 bsf ignore_digit5 ; do not display 1cm depth
2415 output_16dp d'3'
2416 bcf leftbind
2417 STRCAT_PRINT TXT_METER1
2418 return
2419
2420 DISP_stopwatch_show_gauge:
2421 btfsc menubit ; Divemode menu active?
2422 return ; Yes, return
2423 ; BIG Stopwatch
2424 call DISP_divemask_color ; Set Color for Divemode mask
2425 DISPLAYTEXTH d'310' ; Stopwatch
2426 DISPLAYTEXTH d'309' ; Average
2427 call DISP_standard_color
2428 ostc_debug 'V' ; Sends debug-information to screen if debugmode active
2429 WIN_TOP .80
2430 WIN_LEFT .90
2431 WIN_FONT FT_MEDIUM
2432 call DISP_standard_color
2433
2434 lfsr FSR2,letter
2435 movff average_divesecs+0,lo ; Stopwatch
2436 movff average_divesecs+1,hi ; Stopwatch
2437 movlw d'2'
2438 subwf lo,F
2439 movlw d'0'
2440 subwfb hi,F ; Subtract 2 seconds
2441 call convert_time ; converts hi:lo in seconds to mins (hi) and secs (lo)
2442 movff lo,wait_temp
2443 movff hi,lo
2444 clrf hi
2445 movlw d'0'
2446 bcf leftbind
2447 bsf show_last3
2448 output_16_3 ;Displays only 0...999
2449 PUTC ':'
2450 movff wait_temp,lo
2451 output_99x
2452 call word_processor
2453
2454 ostc_debug 'U' ; Sends debug-information to screen if debugmode active
2455 WIN_TOP .136
2456 WIN_LEFT .90
2457 WIN_FONT FT_MEDIUM
2458 call DISP_standard_color
2459 lfsr FSR2,letter
2460 movff avr_rel_pressure+0,lo
2461 movff avr_rel_pressure+1,hi
2462 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2463 bsf ignore_digit5 ; do not display 1cm depth
2464 output_16dp d'3'
2465 bcf leftbind
2466 STRCAT_PRINT TXT_METER1
2467 WIN_FONT FT_SMALL ; Reset...
2468 return
2469
2470
2471 DISP_total_average_show:
2472 ; Non-Resettable Average
2473 call DISP_divemask_color ; Set Color for Divemode mask
2474 DISPLAYTEXTH d'281' ; Avr.Depth
2475
2476 DISP_total_average_show2:
2477 WIN_TOP .192
2478 WIN_LEFT .110
2479 WIN_FONT FT_SMALL
2480 call DISP_standard_color
2481
2482 lfsr FSR2,letter
2483 movff avr_rel_pressure_total+0,lo
2484 movff avr_rel_pressure_total+1,hi
2485 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2486 bsf ignore_digit5 ; do not display 1cm depth
2487 bcf leftbind
2488 output_16dp d'3'
2489 STRCAT_PRINT TXT_METER1
2490 return
2491
2492 ;=============================================================================
2493 ; Writes OSTC #Serial and Firmware version in surfacemode
2494 ;
2495 DISP_serial:
2496 ostc_debug 'a' ; Sends debug-information to screen if debugmode active
2497 WIN_TOP .0
2498 WIN_LEFT .1
2499 WIN_FONT FT_SMALL
2500 WIN_INVERT .0 ; Init new Wordprocessor
2501
2502 ifdef __DEBUG
2503 GETCUSTOM8 d'64' ; Write header in blue when
2504 call DISP_set_color ; compiled in DEBUG mode...
2505 else
2506 call DISP_standard_color
2507 endif
2508
2509 lfsr FSR2,letter
2510 read_int_eeprom d'34' ; Read deco data
2511 tstfsz EEDATA
2512 bra show_decotype_mainscreen2
2513 OUTPUTTEXT .101 ; ZH-L16 OC =0
2514 bra show_decotype_mainscreen8 ; Done.
2515 show_decotype_mainscreen2:
2516 decfsz EEDATA,F
2517 bra show_decotype_mainscreen3
2518 OUTPUTTEXT .102 ; Gauge =1
2519 bra show_decotype_mainscreen8 ; Done.
2520 show_decotype_mainscreen3:
2521 decfsz EEDATA,F
2522 bra show_decotype_mainscreen4
2523 OUTPUTTEXT .104 ; ZH-L16 CC =2
2524 bra show_decotype_mainscreen8 ; Done.
2525 show_decotype_mainscreen4:
2526 decfsz EEDATA,F
2527 bra show_decotype_mainscreen5
2528 OUTPUTTEXT .138 ; Apnoe =3
2529 bra show_decotype_mainscreen8 ; Done.
2530 show_decotype_mainscreen5:
2531 decfsz EEDATA,F
2532 bra show_decotype_mainscreen6
2533 OUTPUTTEXT .152 ; L16-GF OC =4
2534 bra show_decotype_mainscreen8 ; Done.
2535 show_decotype_mainscreen6:
2536 decfsz EEDATA,F
2537 bra show_decotype_mainscreen7
2538 OUTPUTTEXT .236 ; L16-GF CC =5
2539 bra show_decotype_mainscreen8 ; Done.
2540 show_decotype_mainscreen7:
2541 decfsz EEDATA,F
2542 bra show_decotype_mainscreen8 ; Done.
2543 OUTPUTTEXT .226 ; pSCR-GF =6
2544 show_decotype_mainscreen8:
2545 STRCAT " \x90\x91 V" ; Scribble logo...
2546 movlw softwareversion_x
2547 movwf lo
2548 bsf leftbind
2549 output_8
2550 PUTC '.'
2551 movlw softwareversion_y
2552 movwf lo
2553 bsf leftbind
2554 output_99x
2555 bcf leftbind
2556
2557 ifdef __DEBUG
2558 STRCAT_PRINT "-Dbg"
2559 else
2560 call word_processor
2561
2562 movlw softwareversion_beta ; =1: Beta, =0: Release
2563 decfsz WREG,F
2564 return ; Release version -> Return
2565
2566 call DISP_warnings_color
2567 DISPLAYTEXT d'243' ; beta
2568 call DISP_standard_color
2569 endif
2570
2571 return
2572
2573 ;=============================================================================
2574
2575 DISP_divemode_menu_mask_first: ; Write Divemode menu1 mask
2576 ostc_debug 'o' ; Sends debug-information to screen if debugmode active
2577 call DISP_menu_clear ; clear "Menu?"
2578 call DISP_standard_color
2579
2580 btfsc FLAG_const_ppO2_mode ; are we in ppO2 mode?
2581 bra DISP_divemode_menu_mask_first2
2582
2583 ; in OC Mode
2584 DISPLAYTEXT .32 ;"Gaslist"
2585 DISPLAYTEXT .31 ;"Decoplan"
2586 bra DISP_divemode_menu_mask_first3
2587
2588 DISP_divemode_menu_mask_first2:
2589 ; in CC Mode
2590 DISPLAYTEXT .238 ;"SetPoint"
2591 DISPLAYTEXT .31 ;"Decoplan"
2592
2593 DISP_divemode_menu_mask_first3:
2594 ; In all modes
2595 call customview_menu_entry3 ; Show customview-dependent menu entry
2596 DISPLAYTEXT .241 ;"Display"
2597 DISPLAYTEXT .34 ;"Exit"
2598 return
2599
2600 DISP_divemode_set_xgas: ; Displayes the "Set Gas" menu
2601 WIN_LEFT .100
2602 WIN_TOP .0
2603 WIN_FONT FT_SMALL
2604 call DISP_standard_color
2605
2606 STRCPY TXT_G6_3
2607 read_int_eeprom d'24' ; Get Gas6 %O2
2608 movff EEDATA,lo
2609 bcf leftbind
2610 output_99 ; outputs into Postinc2!
2611 PUTC '/'
2612 read_int_eeprom d'25' ; Get Gas6 %He
2613 movff EEDATA,lo
2614 output_99 ; outputs into Postinc2!
2615 call word_processor
2616 DISPLAYTEXT .123 ; O2 +
2617 DISPLAYTEXT .124 ; O2 -
2618 DISPLAYTEXT .125 ; He +
2619 DISPLAYTEXT .126 ; He -
2620 DISPLAYTEXTH d'300' ; Active? (Enable/Disable Gas underwater)
2621 return
2622
2623 DISP_divemode_simulator_mask:
2624 call DISP_standard_color
2625 DISPLAYTEXT .254 ; Close
2626 DISPLAYTEXT .250 ; + 1m
2627 DISPLAYTEXT .251 ; - 1m
2628 DISPLAYTEXT .252 ; +10m
2629 DISPLAYTEXT .253 ; -10m
2630 DISPLAYTEXTH .306 ; Quit Sim
2631 return
2632
2633 ;-----------------------------------------------------------------------------
2634 ; Draw a stop of the deco plan (simulator or dive).
2635 ; Inputs: lo = depth. Range 3m...93m
2636 ; + 80 if this is a switch-gas stop.
2637 ; hi = minutes. range 1'..240'.
2638 ; win_top = line to draw on screen.
2639 ; Trashed: hi, lo, win_height, win_leftx2, win_width, win_color*,
2640 ; WREG, PROD, TBLPTR TABLAT.
2641 ;
2642 DISP_decoplan_show_stop:
2643 ;---- Print depth ----------------------------------------------------
2644 WIN_LEFT .100
2645
2646 btfss lo,7 ; Bit set ?
2647 bra DISP_decoplan_std_stop ; No : Just an usual stop
2648
2649 bcf lo,7 ; cleanup depth
2650
2651 GETCUSTOM8 d'55' ; Load gas switch [min] in wreg
2652 tstfsz WREG ; =0?
2653 bra DISP_decoplan_show_stop1; No: Show gas switch stop
2654 bra DISP_decoplan_std_stop ; Yes: Just an usual stop
2655
2656 DISP_decoplan_show_stop1:
2657 movlw color_yellow
2658 call DISP_set_color ; Show in yellow for gas switch
2659 bra DISP_decoplan_nstd_stop
2660
2661 DISP_decoplan_std_stop:
2662 call DISP_standard_color
2663
2664 DISP_decoplan_nstd_stop:
2665 lfsr FSR2,letter
2666 bsf leftbind
2667 output_8 ; outputs into Postinc2!
2668 STRCAT_PRINT TXT_METER2
2669
2670 ;---- Print duration -------------------------------------------------
2671 WIN_LEFT .140
2672 lfsr FSR2,letter
2673
2674 movf lo,W ; Swap hi & lo
2675 movff hi,lo
2676 movwf hi
2677
2678 output_8 ; Allow up to 240'
2679 STRCAT_PRINT "' " ; 1 to 3 chars for depth.
2680
2681 movf lo,W ; Swap back hi & lo
2682 movff hi,lo
2683 movwf hi
2684
2685 ;---------------------------------------------------------------------
2686 ; Draw the bar graph used for deco stops (decoplan in simulator or dive).
2687 movff win_top,WREG ; Increment win_top (BANK SAFE)
2688 incf WREG
2689 movff WREG,win_top
2690 movlw d'18'+1 ; 19 --> height (bank safe !)
2691 movff WREG,win_height
2692 movlw .122
2693 movff WREG,win_leftx2 ; column left (0-159)
2694 movlw .16
2695 movff WREG,win_width ; column max width.
2696
2697 ; Draw used area (hi = minutes):
2698 movlw d'16' ; Limit length (16min)
2699 cpfslt hi
2700 movwf hi
2701 movff hi,win_bargraph ; Active width, the rest is cleared.
2702 call DISP_box
2703
2704 ; Restore win_top
2705 call DISP_standard_color
2706 movff win_top,WREG ; decf win_top (BANK SAFE)
2707 decf WREG
2708 movff WREG,win_top
2709 return
2710
2711 ;-----------------------------------------------------------------------------
2712 ; Clear unused area belw last stop
2713 ; Inputs: win_top : last used area...
2714 DISP_decoplan_clear_bottom:
2715 movff win_top,WREG ; Get back from bank0
2716 btfsc divemode ; In dive mode ?
2717 sublw .168 ; Yes: bottom row in divemode
2718 btfss divemode ; In dive mode ?
2719 sublw .240 ; No: bottom row in planning
2720 movff WREG,win_height
2721
2722 WIN_LEFT .85 ; Full divemenu width
2723 movlw .160-.85+1
2724 movff WREG,win_width
2725
2726 clrf WREG ; Fill with black
2727 movff WREG,win_color1
2728 movff WREG,win_color2
2729
2730 goto DISP_box
2731
2732 ;-----------------------------------------------------------------------------
2733 ; Display the decoplan (simulator or divemode) for GF model
2734 ; Inputs: char_O_deco_table (array of stop times, in minutes)
2735 ; decoplan_page = page number. Displays 5 stop by page.
2736 ;
2737 #define decoplan_index apnoe_mins ; within each page
2738 #define decoplan_gindex apnoe_secs ; global index
2739 #define decoplan_last apnoe_max_pressure ; Depth of last stop (CF#29)
2740 #define decoplan_max apnoe_max_pressure+1; Number of lines per page. 7 in planning, 5 in diving.
2741
2742 DISP_decoplan:
2743 ostc_debug 'n' ; Sends debug-information to screen if debugmode active
2744
2745 WIN_INVERT 0
2746
2747 ;---- Is there deco stops ? ------------------------------------------
2748 movff char_O_first_deco_depth,WREG
2749 iorwf WREG
2750 bnz DISP_decoplan_1
2751
2752 ;---- No Deco --------------------------------------------------------
2753 call DISP_standard_color
2754 DISPLAYTEXT d'239' ;"No Deco"
2755 bsf last_ceiling_gf_shown
2756 return
2757
2758 DISP_decoplan_1:
2759 lfsr FSR0,char_O_deco_depth ; Initialize indexed addressing.
2760 lfsr FSR1,char_O_deco_time
2761
2762 movlw .8 ; 8 lines/page in decoplan
2763 btfsc divemode
2764 movlw .6 ; 6 lines/page in divemode.
2765 movwf decoplan_max
2766
2767 clrf decoplan_index ; Start with index = 0
2768 clrf WREG
2769 movff WREG,win_top ; and row = 0
2770
2771 ; Read stop parameters, indexed by decoplan_index and decoplan_page
2772 movf decoplan_page,W ; decoplan_gindex = 6*decoplan_page + decoplan_index
2773 mulwf decoplan_max
2774 movf decoplan_index,W
2775 addwf PRODL,W
2776 movwf decoplan_gindex ; --> decoplan_gindex
2777
2778 bcf last_ceiling_gf_shown ; Not finished yet...
2779
2780 DISP_decoplan_2:
2781 btfsc decoplan_gindex,5 ; Reached table length (32) ?
2782 bra DISP_decoplan_99 ; YES: finished...
2783
2784 ; Read stop parameters, indexed by decoplan_index
2785 movf decoplan_gindex,W ; index
2786 movff PLUSW1,hi ; char_O_deco_time [gindex] --> hi
2787 movff PLUSW0,lo ; char_O_deco_depth[gindex]
2788 movf lo,W
2789 bz DISP_decoplan_99 ; depth == 0 : finished.
2790
2791 ; Display the stop line
2792 call DISP_decoplan_show_stop
2793
2794 ; Next
2795 movff win_top,WREG ; row: += 24
2796 addlw .24
2797 movff WREG,win_top
2798 incf decoplan_index,F ; local index += 1
2799 incf decoplan_gindex,F ; global index += 1
2800
2801 ; Max number of lines/page reached ?
2802 movf decoplan_max,W ; index+1 == max ?
2803 cpfseq decoplan_index
2804 bra DISP_decoplan_2 ; NO: loop
2805
2806 ; Check if next stop if end-of-list ?
2807 movf decoplan_gindex,W
2808 movff PLUSW0,WREG ; char_O_deco_depth[gindex]
2809 iorwf WREG
2810 bz DISP_decoplan_99 ; End of list...
2811
2812 ; Display the message "more..."
2813 bcf last_ceiling_gf_shown ; More page to display...
2814
2815 rcall DISP_decoplan_clear_bottom ; Clear from next line
2816
2817 WIN_LEFT .130 - 7*3
2818 call DISP_standard_color
2819 lfsr FSR2,letter
2820 OUTPUTTEXT .142 ; More...
2821 goto word_processor
2822
2823 DISP_decoplan_99:
2824 bsf last_ceiling_gf_shown ; Nothing more in table to display.
2825 rcall DISP_decoplan_clear_bottom ; Clear from next line
2826 return
2827 ;-----------------------------------------------------------------------------
2828 ; Toggle gas activity flag during dive.
2829 ;
2830 ; Input: gaslist_active
2831 ; Gaslist from eeprom[2...]
2832 ;
2833 ; Output: gaslist_active
2834 ;
2835 ; Note: Gas with a zero depth cannot be used in deco simulation, hence
2836 ; should not be displayed as selected here...
2837 ;
2838 DISP_de_activelist: ; show (de)active gaslist
2839 call DISP_standard_color
2840 DISPLAYTEXT .254 ; Close
2841
2842 WIN_LEFT .100
2843 WIN_FONT FT_SMALL
2844 bsf leftbind
2845
2846 movlw d'2'
2847 movwf wait_temp ; here: stores eeprom address for gas list
2848 movlw d'0'
2849 movwf waitms_temp ; here: stores row for gas list
2850 clrf hi ; here: Gas counter
2851
2852 DISP_de_activelist_loop:
2853 incf hi,F ; Increase Gas
2854 movlw d'4'
2855 addwf wait_temp,F ; Increase eeprom address for gas list
2856 movlw d'25'
2857 addwf waitms_temp,F ; Increase row
2858 WIN_LEFT .100
2859 movff waitms_temp,win_top ; Set Row
2860
2861 lfsr FSR2,letter
2862 movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM
2863 call read_eeprom ; get byte (stored in EEDATA)
2864 movff EEDATA,lo ; copy to lo
2865 output_8 ; outputs into Postinc2!
2866 PUTC '/'
2867 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM
2868 call read_eeprom ; get byte (stored in EEDATA)
2869 movff EEDATA,lo ; copy to lo
2870 output_8 ; outputs into Postinc2!
2871 PUTC '@'
2872
2873 movlw d'27'
2874 addwf hi,W
2875 movwf EEADR ; Point to Change depth
2876
2877 call read_eeprom ; get byte (stored in EEDATA)
2878 movff EEDATA,lo ; copy to lo
2879 output_8 ; outputs into Postinc2!
2880
2881 movf lo,w ; Gas with a zero depth
2882 bz DISP_de_activelist_grey ; should be displayed inactive.
2883
2884 ; Check if gas needs to be greyed-out (inactive)
2885 movff gaslist_active,EEDATA ; Get flag register
2886 movff hi,lo ; copy gas number
2887 DISP_de_activelist_loop1:
2888 rrcf EEDATA ; roll flags into carry
2889 decfsz lo,F ; max. 5 times...
2890 bra DISP_de_activelist_loop1
2891 bc DISP_de_activelist_white
2892
2893 DISP_de_activelist_grey: ; grey out inactive gases!
2894 GETCUSTOM8 d'64' ;movlw color_grey
2895 call DISP_set_color
2896
2897 DISP_de_activelist_white:
2898 call word_processor
2899 call DISP_standard_color
2900
2901 movlw d'5' ; list all five gases
2902 cpfseq hi ; All gases shown?
2903 bra DISP_de_activelist_loop ; No
2904
2905 return ; return
2906
2907 DISP_show_change_depth: ; Yes, show change depth for gas #menupos
2908 btfsc display_set_setpoint ; In Setpoint list?
2909 return ; Yes, return.
2910 movlw color_yellow ; Blink in yellow
2911 call DISP_set_color
2912 WIN_LEFT .95
2913 WIN_TOP .148
2914 WIN_FONT FT_SMALL
2915
2916 movlw .6
2917 cpfslt menupos ; <6?
2918 bra DISP_show_change_depth_clear ; Yes!
2919
2920 bsf leftbind
2921 STRCPY TXT_GAS1
2922 movff menupos,lo
2923 output_8 ; Show gas number
2924 STRCAT TXT_AT4 ; " at "
2925 decf menupos,W
2926 addlw d'28' ; offset in memory
2927 movwf EEADR
2928 call read_eeprom ; Low-value
2929 movff EEDATA,lo
2930 output_8 ; Show gas number
2931 STRCAT_PRINT TXT_METER2 ; "m "
2932 bcf leftbind
2933 call DISP_standard_color
2934 return
2935
2936 DISP_show_change_depth_clear:
2937 STRCPY_PRINT " "
2938 return
2939
2940 DISP_diluent_list:
2941 ostc_debug 'm' ; Sends debug-information to screen if debugmode active
2942 WIN_LEFT .100
2943 WIN_FONT FT_SMALL
2944 bsf leftbind
2945 movlw d'94'
2946 movwf wait_temp ; here: stores eeprom address for diluent list (96-2)
2947 movlw d'231'
2948 movwf waitms_temp ; here: stores row for gas list
2949 clrf hi ; here: Diluent counter
2950
2951 DISP_diluent_list_loop:
2952 incf hi,F ; Increase Diluent
2953 movlw .2
2954 addwf wait_temp,F ; Increase eeprom address for gas list
2955 movlw d'25'
2956 addwf waitms_temp,F ; Increase row
2957 WIN_LEFT .100
2958 movff waitms_temp,win_top ; Set Row
2959 STRCPY TXT_DIL_C
2960 movff hi,lo ; copy dil number
2961 output_8 ; display dil number
2962 PUTC ':'
2963 movff wait_temp, EEADR; Dil #hi: %O2 - Set address in internal EEPROM
2964 call read_eeprom ; get byte (stored in EEDATA)
2965 movff EEDATA,lo ; copy to lo
2966 output_8 ; outputs into Postinc2!
2967 PUTC '/'
2968 incf EEADR,F ; Dil #hi: %He - Set address in internal EEPROM
2969 call read_eeprom ; get byte (stored in EEDATA)
2970 movff EEDATA,lo ; copy to lo
2971 output_8 ; outputs into Postinc2!
2972
2973 decf EEADR,F ; Dil #hi: %O2 - Set address in internal EEPROM
2974 call read_eeprom ; get byte (stored in EEDATA)
2975 DISP_color_code warn_gas_in_gaslist ; Color-code output (%O2 in "EEDATA")
2976
2977 call word_processor
2978 call DISP_standard_color
2979
2980 movlw d'5' ; list all five Diluents
2981 cpfseq hi ; All diluents shown?
2982 bra DISP_diluent_list_loop ; No
2983 return ; return
2984
2985
2986 DISP_gas_list:
2987 ostc_debug 'm' ; Sends debug-information to screen if debugmode active
2988
2989 WIN_LEFT .100
2990 WIN_FONT FT_SMALL
2991 bsf leftbind
2992
2993 movlw d'2'
2994 movwf wait_temp ; here: stores eeprom address for gas list
2995 movlw d'231'
2996 movwf waitms_temp ; here: stores row for gas list
2997 clrf hi ; here: Gas counter
2998
2999 DISP_gas_list_loop:
3000 incf hi,F ; Increase Gas
3001 movlw d'4'
3002 addwf wait_temp,F ; Increase eeprom address for gas list
3003 movlw d'25'
3004 addwf waitms_temp,F ; Increase row
3005 WIN_LEFT .100
3006 movff waitms_temp,win_top ; Set Row
3007 STRCPY TXT_GAS1
3008 movff hi,lo ; copy gas number
3009 output_8 ; display gas number
3010 PUTC ':'
3011 movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM
3012 call read_eeprom ; get byte (stored in EEDATA)
3013 movff EEDATA,lo ; copy to lo
3014 output_8 ; outputs into Postinc2!
3015 PUTC '/'
3016 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM
3017 call read_eeprom ; get byte (stored in EEDATA)
3018 movff EEDATA,lo ; copy to lo
3019 output_8 ; outputs into Postinc2!
3020
3021 decf EEADR,F ; Gas #hi: %O2 - Set address in internal EEPROM
3022 call read_eeprom ; get byte (stored in EEDATA)
3023 DISP_color_code warn_gas_in_gaslist ; Color-code output (%O2 in "EEDATA")
3024
3025 ; Check if the "better gas" should be highlighted
3026
3027 WIN_INVERT .0 ; Init new Wordprocessor
3028 movf better_gas_number,W ; better gas 1-5?
3029 cpfseq hi ; compare with gas#
3030 bra DISP_gas_list_loop2 ; No equal, skip
3031
3032 movlw color_yellow ; Blink in yellow
3033 call DISP_set_color
3034 WIN_INVERT .1 ; Init new Wordprocessor
3035
3036 DISP_gas_list_loop2:
3037 ; Check if gas needs to be greyed-out (inactive)
3038 movff gaslist_active, EEDATA ; Work with sorted list
3039 movff hi,lo ; copy gas number
3040 DISP_gas_list_loop1:
3041 rrcf EEDATA ; roll flags into carry
3042 decfsz lo,F ; max. 5 times...
3043 bra DISP_gas_list_loop1
3044
3045 btfss STATUS,C ; test carry
3046 rcall DISP_gas_list_grey
3047
3048 call word_processor
3049 call DISP_standard_color
3050
3051 movlw d'5' ; list all five gases
3052 cpfseq hi ; All gases shown?
3053 bra DISP_gas_list_loop ; No
3054
3055 DISPLAYTEXT d'122' ; More
3056 return ; return (OC mode)
3057
3058 DISP_gas_list_grey:
3059 GETCUSTOM8 d'64' ;movlw color_grey
3060 call DISP_set_color ; grey out inactive gases!
3061 return
3062
3063 DISP_splist_start:
3064 WIN_LEFT .100
3065 WIN_FONT FT_SMALL
3066 bsf leftbind
3067 call DISP_standard_color
3068
3069 ; list three SP in Gaslist
3070 movlw d'35' ; 36 = current SP position in EEPROM
3071 movwf wait_temp ; here: stores eeprom address for gas list
3072 movlw d'0'
3073 movwf waitms_temp ; here: stores row for gas list
3074 clrf decoplan_index ; here: SP counter
3075
3076 DISP_splist_loop:
3077 incf wait_temp,F ; EEPROM address
3078 incf decoplan_index,F ; Increase SP
3079
3080 movlw d'25'
3081 addwf waitms_temp,F ; Increase row
3082 movff waitms_temp,win_top ; Set Row
3083 WIN_LEFT .100
3084
3085 STRCPY TXT_SP2
3086 movff decoplan_index,lo ; copy gas number
3087 output_8 ; display gas number
3088 PUTC ':'
3089 movff wait_temp, EEADR; SP #hi position
3090 call read_eeprom ; get byte (stored in EEDATA)
3091 movff EEDATA,lo ; copy to lo
3092 clrf hi
3093 output_16dp d'3' ; outputs into Postinc2!
3094 call word_processor
3095
3096 movlw d'3' ; list all three SP
3097 cpfseq decoplan_index ; All gases shown?
3098 bra DISP_splist_loop ; No
3099
3100 bcf leftbind
3101 return ; no, return
3102
3103 DISP_clear_divemode_menu:
3104 WIN_BOX_BLACK .0, .168, .85, .160 ;top, bottom, left, right
3105 return
3106
3107 DISP_divemenu_cursor:
3108 ostc_debug 'l' ; Sends debug-information to screen if debugmode active
3109
3110 WIN_BOX_BLACK .0, .150, .85, .95 ;top, bottom, left, right
3111
3112 WIN_TOP .0
3113 WIN_LEFT .85
3114 WIN_FONT FT_SMALL
3115 WIN_INVERT .0 ; Init new Wordprocessor
3116 call DISP_standard_color
3117
3118 movff menupos,temp1
3119 movlw d'0'
3120 dcfsnz temp1,F
3121 movlw d'0'
3122 dcfsnz temp1,F
3123 movlw d'25'
3124 dcfsnz temp1,F
3125 movlw d'50'
3126 dcfsnz temp1,F
3127 movlw d'75'
3128 dcfsnz temp1,F
3129 movlw d'100'
3130 dcfsnz temp1,F
3131 movlw d'125'
3132
3133 movff WREG,win_top
3134 STRCPY_PRINT "\xB7" ; Cursor
3135 return
3136
3137
3138 ;=============================================================================
3139 ; Draw saturation graph, is surface mode or in dive mode.
3140 ;
3141 DISP_tissue_saturation_graph:
3142 ostc_debug 'i' ; Sends debug-information to screen if debugmode active
3143
3144 ;---- Draw Frame ---------------------------------------------------------
3145 btfsc divemode
3146 bra DISP_tsg_1
3147
3148 WIN_FRAME_STD .25, .120, .82, .159 ; Surfmode
3149 bra DISP_tsg_2
3150 DISP_tsg_1:
3151 WIN_FRAME_STD .169, .239, .90, .159 ; Divemode
3152 DISP_tsg_2:
3153
3154 ;---- Draw grid ----------------------------------------------------------
3155 btfss divemode
3156 bra DISP_no_graph_grid
3157
3158 GETCUSTOM8 d'64' ;movlw color_grey
3159 call DISP_set_color
3160
3161 movlw .169+.1 ; divemode
3162 movff WREG,win_top
3163 movlw .239-.169-.1 ; divemode
3164 movff WREG,win_height
3165
3166 movlw 1
3167 movff WREG,win_width
3168
3169 movlw .122
3170 movff WREG,win_leftx2
3171 call DISP_box
3172 movlw .131
3173 movff WREG,win_leftx2
3174 call DISP_box
3175 movlw .140
3176 movff WREG,win_leftx2
3177 call DISP_box
3178 movlw .149
3179 movff WREG,win_leftx2
3180 call DISP_box
3181 DISP_no_graph_grid:
3182
3183 ;---- Draw N2 Tissues ----------------------------------------------------
3184 lfsr FSR2, char_O_tissue_N2_saturation
3185 movlw d'16'
3186 movwf wait_temp ; 16 tissues
3187 clrf waitms_temp ; Row offset
3188
3189 movlw .1
3190 movff WREG,win_height ; row bottom (0-239)
3191 movlw .82+.18 ; surfmode
3192 btfsc divemode
3193 movlw .90+.18 ; divemode
3194 movff WREG,win_leftx2 ; column left (0-159)
3195 movlw .57 ; surfmode: max width 57pix
3196 btfsc divemode
3197 movlw .57-8 ; divemode: 8pix less...
3198 movff WREG,win_width
3199
3200 DISP_tissue_saturation_graph3:
3201 call DISP_standard_color ; Reset color foreach iteration
3202
3203 movlw .25+3 ; surfmode: 3pix below top border
3204 btfsc divemode
3205 movlw .169+3 ; divemode
3206 addwf waitms_temp,W
3207 movff WREG,win_top ; row top (0-239)
3208
3209 incf waitms_temp,F
3210 incf waitms_temp,F
3211
3212 movf POSTINC2,W
3213 bcf STATUS,C ; Clear carry
3214 rrcf WREG ; And divide by 4
3215 bcf STATUS,C
3216 rrcf WREG
3217 movwf temp1
3218
3219 movff win_width,WREG ; Max width.
3220 cpfslt temp1 ; skip if 57 (WREG) < win_width
3221 movwf temp1
3222 movff temp1,win_bargraph
3223
3224 call DISP_box
3225
3226 decfsz wait_temp,F
3227 bra DISP_tissue_saturation_graph3
3228
3229 ;---- Draw He Tissues ----------------------------------------------------
3230 lfsr FSR2, char_O_tissue_He_saturation
3231 movlw d'16'
3232 movwf wait_temp ; 16 tissues
3233 clrf waitms_temp ; Row offset
3234
3235 DISP_tissue_saturation_graph2:
3236 call DISP_standard_color ; Reset color foreach iteration
3237
3238 movlw .120-.33 ; surfmode : 33pix above bottom border
3239 btfsc divemode
3240 movlw .239-.33 ; divemode
3241 addwf waitms_temp,W
3242 movff WREG,win_top ; row top (0-239)
3243
3244 incf waitms_temp,F
3245 incf waitms_temp,F
3246
3247 movf POSTINC2,W
3248 bcf STATUS,C ; Clear carry
3249 rrcf WREG ; And divide by 4
3250 bcf STATUS,C
3251 rrcf WREG
3252 movwf temp1
3253
3254 movff win_width,WREG ; Max width.
3255 cpfslt temp1 ; skip if 57 (WREG) < win_width
3256 movwf temp1
3257 movff temp1,win_bargraph
3258
3259 call DISP_box
3260
3261 decfsz wait_temp,F
3262 bra DISP_tissue_saturation_graph2
3263
3264 ;---- Draw N2/He Text ----------------------------------------------------
3265 call DISP_standard_color ; Reset color after last iterarion.
3266
3267 movlw .82+2 ; surfmode: 2pix right of left border
3268 btfsc divemode
3269 movlw .90+2 ; divemode
3270 movff WREG,win_leftx2
3271
3272 movlw .25+7 ; surfmode: 7pix below top border
3273 btfsc divemode
3274 movlw .169+7 ; divemode
3275 movff WREG,win_top
3276 STRCPY_PRINT TXT_N2_2
3277
3278 movlw .120-.30 ; surfmode: 30pix above bottom border
3279 btfsc divemode
3280 movlw .239-.30 ; divemode
3281 movff WREG,win_top
3282 STRCPY_PRINT TXT_HE2
3283
3284 ;---- Draw scale and O2[16]% ---------------------------------------------
3285 btfsc divemode
3286 return
3287
3288 movff char_O_gtissue_no,wait_temp ; used as temp
3289
3290 lfsr FSR1,char_O_tissue_N2_saturation
3291 movf wait_temp,W ; W <- 0-15
3292 movff PLUSW1,lo ; lo <- FSR1[W]
3293
3294 WIN_TOP .62
3295 WIN_FONT FT_SMALL
3296 lfsr FSR2,letter
3297 bsf leftbind
3298 output_8
3299 bcf leftbind
3300
3301 STRCAT_PRINT "% "
3302
3303 ;---- Draw Scale ---------------------------------------------------------
3304 WIN_BOX_STD .73, .74, .121, .157
3305 WIN_BOX_STD .61, .84, .121, .122
3306 WIN_BOX_STD .65, .80, .130, .131
3307 WIN_BOX_STD .65, .80, .139, .140
3308 WIN_BOX_STD .65, .80, .148, .149
3309 WIN_BOX_STD .61, .84, .157, .158
3310 return
3311
3312 ;=============================================================================
3313
3314 DISP_startupscreen1:
3315 call DISP_topline_box
3316 WIN_INVERT .1 ; Init new Wordprocessor
3317 DISPLAYTEXT d'3' ; "HeinrichsWeikamp"
3318 WIN_INVERT .0 ; Init new Wordprocessor
3319 DISPLAYTEXT .68 ; Licence 1/2
3320 DISPLAYTEXT .69
3321 DISPLAYTEXT .70
3322 DISPLAYTEXT .71
3323 DISPLAYTEXT .72
3324 DISPLAYTEXT .73
3325 DISPLAYTEXT .74
3326 return
3327
3328 DISP_startupscreen2:
3329 call DISP_topline_box
3330 WIN_INVERT .1 ; Init new Wordprocessor
3331 DISPLAYTEXT d'3' ; "HeinrichsWeikamp"
3332 WIN_INVERT .0 ; Init new Wordprocessor
3333 DISPLAYTEXT .75 ; Licence 2/2
3334 DISPLAYTEXT .76
3335 DISPLAYTEXT .77
3336 DISPLAYTEXT .78
3337 DISPLAYTEXT .79
3338 DISPLAYTEXT .80
3339 DISPLAYTEXT .81
3340 return
3341
3342 DISP_new_cf_warning:
3343 call DISP_topline_box
3344 WIN_INVERT .1 ; Init new Wordprocessor
3345 DISPLAYTEXTH .271 ; New CF added!
3346 WIN_INVERT .0 ; Init new Wordprocessor
3347 DISPLAYTEXTH .272 ; New CustomFunctions
3348 DISPLAYTEXTH .273 ; were added! Check
3349 DISPLAYTEXTH .274 ; CF I and CF II Menu
3350 DISPLAYTEXTH .275 ; for Details!
3351 return
3352
3353 DISP_const_ppO2_value:
3354 ostc_debug 'j' ; Sends debug-information to screen if debugmode active
3355
3356 WIN_TOP .168
3357 WIN_LEFT .50
3358 WIN_FONT FT_SMALL
3359 WIN_INVERT .0 ; Init new Wordprocessor
3360
3361 lfsr FSR2,letter
3362 movff char_I_const_ppO2,lo
3363
3364 tstfsz lo ; In Bailout mode (char_I_const_ppO2=0)?
3365 bra DISP_const_ppO2_value2 ; No, display Setpoint
3366
3367 ; Yes, Display "Bail"
3368 call DISP_standard_color
3369 OUTPUTTEXTH d'263' ;"Bail "
3370 call word_processor
3371 return
3372
3373 DISP_const_ppO2_value2: ; Display SetPoint
3374 ;Show fixed SP value
3375 SAFE_2BYTE_COPY amb_pressure, xA
3376
3377 movlw d'10'
3378 movwf xB+0
3379 clrf xB+1
3380 ;xA/xB=xC with xA as remainder
3381 call div16x16 ; xC+0=p_amb/10
3382
3383 ; char_I_const_ppO2 > p_amb/10 -> Not physically possible! -> Display actual value!
3384 tstfsz xC+1 ; xC>255
3385 setf xC+0 ; Yes, set xC+0 to 2,55bar ppO2
3386
3387 movff ppO2_setpoint_store,WREG
3388 cpfslt xC+0 ; Setpoint value possible?
3389 bra DISP_const_ppO2_value1 ; Yes
3390
3391 clrf hi ; Reset hi
3392 movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value
3393 bra DISP_const_ppO2_value1a
3394
3395 DISP_const_ppO2_value1:
3396 ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value!
3397 SAFE_2BYTE_COPY amb_pressure, xA
3398 movlw d'10'
3399 movwf xB+0
3400 clrf xB+1
3401 call div16x16 ; xC=p_amb/10
3402 movff xC+0,xA+0
3403 movff xC+1,xA+1
3404 movff char_I_O2_ratio,xB+0
3405 clrf xB+1
3406 call mult16x16 ; xC:2=char_I_O2_ratio * p_amb/10
3407
3408 movff xC+0,sub_b+0
3409 movff xC+1,sub_b+1
3410 movff ppO2_setpoint_store,WREG; Setpoint
3411 mullw d'100' ; Setpoint*100
3412 movff PRODL,sub_a+0
3413 movff PRODH,sub_a+1
3414 call sub16 ; sub_c = sub_a - sub_b
3415
3416 btfss neg_flag
3417 bra DISP_const_ppO2_value11 ; Value in range (lower then fix Setpoint)
3418
3419 ; char_I_const_ppO2 < ppO2[Diluent] -> Not physically possible! -> Display actual value!
3420
3421 movff xC+0,xA+0 ; xC=p_amb/10
3422 movff xC+1,xA+1
3423 movlw d'100'
3424 movwf xB+0
3425 clrf xB+1
3426 call div16x16 ;xA/xB=xC with xA as remainder
3427
3428 movff xC+0,char_I_const_ppO2 ; No, Overwrite with actual value
3429 movff xC+1,hi ; For test if ppO2>2,55bar
3430
3431 GETCUSTOM8 d'39' ; Adjust fixed SP?
3432 dcfsnz WREG,F
3433 bra DISP_const_ppO2_value1a ; Yes!
3434 ; Do not adjust -> restore original SetPoint
3435
3436 DISP_const_ppO2_value11:
3437 ; Setpoint in possible limits
3438 movff ppO2_setpoint_store,char_I_const_ppO2 ; Restore Setpoint
3439 clrf hi
3440
3441 DISP_const_ppO2_value1a:
3442 movff char_I_const_ppO2,lo
3443
3444 movff lo,WREG ; copy to WREG
3445 mullw .100
3446 movff PRODH,xC+1
3447 movff PRODL,xC+0 ; For color code
3448 DISP_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC)
3449
3450 tstfsz hi ; >2,55bar?
3451 rcall DISP_const_ppO2_too_hi ; Yes
3452
3453 bsf leftbind
3454 output_16dp d'3'
3455 bcf leftbind
3456 STRCAT_PRINT " " ; Display Setpoint with trailing zero
3457 call DISP_standard_color ; Reset color
3458 return
3459
3460 DISP_const_ppO2_too_hi:
3461 PUTC '>'
3462 setf lo ; show ">2.55"
3463 clrf hi ; clear hi
3464 call DISP_warnings_color ; Set Warning color
3465 return
3466
3467 ;=============================================================================
3468 ; Display EAD/END computed in calc_hauptroutine_update_tissues() every 2sec.
3469 ;
3470 DISP_show_end_ead_divemode:
3471 call DISP_divemask_color ; Set Color for Divemode mask
3472
3473 WIN_FONT FT_SMALL
3474 WIN_LEFT .95
3475 WIN_TOP .192
3476 lfsr FSR2,letter
3477 OUTPUTTEXTH .299 ; EAD:
3478 call word_processor
3479
3480 WIN_TOP .216
3481 lfsr FSR2,letter
3482 OUTPUTTEXTH .298 ; END:
3483 call word_processor
3484
3485 call DISP_standard_color ; Back to white.
3486 WIN_LEFT .125
3487 WIN_TOP .192
3488 lfsr FSR2,letter
3489 movff char_O_EAD,lo
3490 bsf leftbind
3491 output_8 ; Print EAD w/o leading space.
3492 STRCAT_PRINT TXT_METER2
3493
3494 WIN_TOP .216
3495 lfsr FSR2,letter
3496 movff char_O_END,lo
3497 output_8 ; Print END w/o leading space.
3498 bcf leftbind
3499 STRCAT_PRINT TXT_METER2
3500
3501 ; Show ppO2[Flush] iff in CCR mode & not in Bailout:
3502 btfsc is_bailout ; In bailout mode?
3503 return ; Yes: done.
3504
3505 btfss FLAG_const_ppO2_mode ; In (true) CCR mode ?
3506 return ; No: done.
3507
3508 WIN_LEFT .95
3509 WIN_TOP .168
3510 call DISP_divemask_color ; Set Color for Divemode mask
3511 STRCPY_PRINT TXT_PPO2_5 ; ppO2 of diluent
3512
3513 movff char_O_flush_ppO2,WREG ; copy to WREG
3514 mullw .100
3515 movff PRODH,xC+1
3516 movff PRODL,xC+0 ; For color code
3517 DISP_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC)
3518
3519 WIN_LEFT .130
3520 WIN_TOP .168
3521
3522 movff char_O_flush_ppO2, lo
3523 incf lo,W ; ppO2 == 2.55 ?
3524 bnz DISP_show_end_ead_divemode_1
3525
3526 STRCPY_PRINT "----" ; YES: mark overflow.
3527 goto DISP_standard_color ; Back to white.
3528
3529 DISP_show_end_ead_divemode_1:
3530 lfsr FSR2,letter
3531 clrf hi
3532 bsf leftbind
3533 output_16dp d'3' ; Show ppO2 w/o leading zero
3534 bcf leftbind
3535 STRCAT_PRINT " " ; Display ppO2[Diluent]
3536 goto DISP_standard_color ; Back to white.
3537
3538 ;=============================================================================
3539 ; Display TTS after extra time at the same depth.
3540 ;
3541 DISP_show_@5:
3542 WIN_FONT FT_SMALL
3543 WIN_LEFT .160-.70 ; 10 chars aligned right.
3544 WIN_TOP .170
3545 call DISP_divemask_color ; Set Color for Divemode mask
3546 lfsr FSR2,letter
3547
3548 OUTPUTTEXTH .305 ; "Future TTS"
3549 call word_processor
3550
3551 WIN_LEFT .97
3552 WIN_TOP .194
3553 STRCPY "@"
3554 GETCUSTOM8 d'58'
3555 movwf lo
3556 bsf leftbind
3557 output_8
3558 bcf leftbind
3559 STRCAT_PRINT "': "
3560
3561 WIN_LEFT .97+7*5 ; "@10':" is 5 chars long
3562 call DISP_standard_color
3563 lfsr FSR2,letter
3564
3565 movff int_O_extra_ascenttime+0,lo
3566 movff int_O_extra_ascenttime+1,hi
3567 movf lo,W
3568 iorwf hi,W ; extra_ascenttime == 0 ?
3569 bz DISP_show_@5_nodeco
3570 movf lo,W ; extra_ascenttime == 0xFFFF ?
3571 andwf hi,W
3572 incf WREG,w
3573 bz DISP_show_@5_wait
3574
3575 bsf leftbind
3576 output_16
3577 bcf leftbind
3578 STRCAT_PRINT "' " ; From "none" to "1'" we need 2 trailing spaces
3579 return
3580
3581 DISP_show_@5_nodeco:
3582 DISP_show_@5_wait:
3583 STRCPY_PRINT "--- "
3584 return
3585
3586 ;=============================================================================
3587
3588 compute_pscr_ppo2:
3589 ; (Pressure[mbar]*char_I_O2_ratio)-(100-char_I_O2_ratio)*CF61*CF62*10
3590 movff char_I_O2_ratio,WREG
3591 sublw .100 ; 100-char_I_O2_ratio -> WREG
3592 mullw .10 ; (100-char_I_O2_ratio)*10 -> PROD:2
3593 movff PRODL,xA+0
3594 movff PRODH,xA+1
3595 GETCUSTOM8 d'62' ; O2 Drop
3596 movff WREG,xB+0
3597 clrf xB+1
3598 call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61
3599 movff xC+0,xA+0
3600 movff xC+1,xA+1
3601 GETCUSTOM8 d'63' ; Lung ratio
3602 movff WREG,xB+0
3603 clrf xB+1
3604 call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61*CF62
3605
3606 movlw .10
3607 movwf xB+0
3608 clrf xB+1
3609 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
3610 ; store xC:2 in lo:hi
3611 movff xC+0,lo
3612 movff xC+1,hi
3613
3614 SAFE_2BYTE_COPY amb_pressure, xA
3615 movff char_I_O2_ratio,xB+0
3616 clrf xB+1
3617 call mult16x16 ;xA*xB=xC -> xC:4 = Pressure[mbar]*char_I_O2_ratio
3618
3619 movlw .10
3620 movwf xB+0
3621 clrf xB+1
3622 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
3623
3624 ; store xC:2 in sub_a
3625 movff xC+0,sub_a+0
3626 movff xC+1,sub_a+1
3627 ; reload result from lo:hi
3628 movff lo,sub_b+0
3629 movff hi,sub_b+1
3630
3631 call subU16 ;sub_c = sub_a - sub_b (with UNSIGNED values)
3632 return
3633
3634 ; Display pSCR ppO2
3635 DISP_show_pSCR_ppO2:
3636 WIN_FONT FT_SMALL
3637 WIN_LEFT .160-.63 ; 9 chars aligned right.
3638 WIN_TOP .170
3639 call DISP_divemask_color ; Set Color for Divemode mask
3640 lfsr FSR2,letter
3641 OUTPUTTEXTH .266 ; "pSCR Info"
3642 call word_processor ; pCCR
3643
3644 rcall compute_pscr_ppo2 ; pSCR ppO2 into sub_c:2
3645
3646 WIN_FONT FT_SMALL
3647 WIN_LEFT .95
3648 WIN_TOP .192
3649 lfsr FSR2,letter
3650 STRCPY_PRINT TXT_PPO2_5 ; ppO2:
3651
3652 movff sub_c+0,xC+0
3653 movff sub_c+1,xC+1
3654 clrf xC+2
3655 clrf xC+3 ; For color coding
3656 DISP_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC)
3657 WIN_LEFT .130
3658 WIN_TOP .192
3659 lfsr FSR2,letter
3660 movff xC+0,lo
3661 movff xC+1,hi
3662 bsf ignore_digit4
3663 output_16dp d'1'
3664 bcf ignore_digit4
3665 STRCAT_PRINT " "
3666 call DISP_standard_color ; Back to white.
3667 ; Show O2 drop and counter lung ration in second row
3668 WIN_LEFT .98
3669 WIN_TOP .216
3670 lfsr FSR2,letter
3671 GETCUSTOM8 d'62' ; O2 Drop in percent
3672 movwf lo
3673 bsf leftbind
3674 output_8
3675 STRCAT "% 1/"
3676 GETCUSTOM8 d'63' ; Counter lung ratio in 1/X
3677 movwf lo
3678 output_8
3679 bcf leftbind
3680 STRCAT_PRINT " " ; Trailing space needed when changing the O2 drop
3681 return
3682
3683 ;=============================================================================
3684 ; Display cave consomation prediction (and warning).
3685 ;
3686 DISP_show_cave_bailout:
3687 WIN_FONT FT_SMALL
3688 WIN_LEFT .160-.70 ; 10 chars aligned right.
3689 WIN_TOP .170
3690 call DISP_divemask_color ; Set Color for Divemode mask
3691 lfsr FSR2,letter
3692
3693 OUTPUTTEXTH .311 ; "Cave Bail."
3694 call word_processor
3695
3696 ; WIN_TOP .240 - 24 ; DO NOT display liter units, as this
3697 ; WIN_LEFT .160 - 7 ; can be Bars also...
3698 ; STRCPY_PRINT "l"
3699
3700 WIN_FONT FT_MEDIUM
3701 WIN_LEFT .90
3702 WIN_TOP .201 ; 170 + 24 + 14/2 + 32 + 14/2 = 240.
3703 call DISP_standard_color
3704 lfsr FSR2,letter
3705
3706 ;---- Retrieve divetime in seconds (since last reset)
3707 movff average_divesecs+0,xA+0
3708 movff average_divesecs+1,xA+1
3709
3710 ;---- Multiply by SAC, and divide by 60 (SAC inliters per minutes)
3711 GETCUSTOM8 d'56' ; Get bottom SAC
3712 movwf xB+0
3713 clrf xB+1
3714 call mult16x16 ; xC:4=xA:2*xB:2
3715
3716 movlw LOW(.60)
3717 movwf xB+0
3718 movlw HIGH(.60)
3719 movwf xB+1
3720 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
3721
3722 ;---- Multiply by average pressure [absolute, in bar]
3723 movff xC+0,xA+0 ; Get result (in xC+0, noy xC+2 !) into xA
3724 movff xC+1,xA+1
3725
3726 movf avr_rel_pressure+0,W ; Add surface pressure to get absolute pressure
3727 addwf last_surfpressure_30min+0,W
3728 movwf xB+0
3729 movf avr_rel_pressure+1,W
3730 addwfc last_surfpressure_30min+1,W
3731 movwf xB+1 ; --> Into xB
3732
3733 call mult16x16 ; xC:4=xA:2*xB:2
3734
3735 movlw LOW(.1000) ; Pressure was in milibar, so divide by 1000.
3736 movwf xB+0
3737 movlw HIGH(.1000)
3738 movwf xB+1
3739 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
3740
3741 ;---- Go RED when limit is exceeded
3742 movff xC+0,sub_a+0
3743 movff xC+1,sub_a+1
3744 GETCUSTOM15 d'59' ; Get Cave bailout alarm threshold
3745 movff lo, sub_b+0
3746 movff hi, sub_b+1
3747 call sub16 ; Computes prediction - limit
3748 btfss neg_flag ; Negativ ?
3749 call DISP_warnings_color ; NO: go RED.
3750
3751 ;---- Then display...
3752 movff xC+0,lo
3753 movff xC+1,hi
3754
3755 bcf leftbind
3756 output_16
3757 call word_processor
3758 WIN_FONT FT_SMALL
3759 return
3760
3761 ;=============================================================================
3762
3763 DISP_show_leading_tissue:
3764 call DISP_divemask_color ; Set Color for Divemode mask
3765 DISPLAYTEXTH .282 ; L. Tissue:
3766 DISP_show_leading_tissue_2:
3767 call deco_calc_desaturation_time ; calculate desaturation time
3768 movlb b'00000001' ; select ram bank 1
3769
3770 STRCPY "#"
3771 movff char_O_gtissue_no,lo
3772 movff char_O_gtissue_no,wait_temp ; used as temp
3773 bsf leftbind
3774 output_8
3775 STRCAT " ("
3776
3777 movlw d'16'
3778 cpfslt wait_temp
3779 bra DISP_show_leading_tissue_he
3780 STRCAT TXT_N2_2
3781 bra DISP_show_leading_tissue2
3782
3783 DISP_show_leading_tissue_he:
3784 STRCAT TXT_HE2
3785
3786 DISP_show_leading_tissue2:
3787 WIN_LEFT .95
3788 WIN_TOP .192
3789 WIN_FONT FT_SMALL
3790 call DISP_standard_color
3791
3792 STRCAT_PRINT ") "
3793
3794 lfsr FSR1,char_O_tissue_N2_saturation
3795 movf wait_temp,W ; W <- 0-15
3796 movff PLUSW1,lo ; lo <- FSR1[W]
3797
3798 WIN_LEFT .95
3799 WIN_TOP .216
3800 WIN_FONT FT_SMALL
3801
3802 lfsr FSR2,letter
3803 output_8
3804 STRCAT_PRINT "% "
3805 bcf leftbind
3806 return
3807
3808 DISP_marker_set:
3809 WIN_LEFT .105
3810 WIN_TOP .170
3811 WIN_FONT FT_SMALL
3812 WIN_INVERT .0 ; Init new Wordprocessor
3813 call DISP_divemask_color ; Set Color for Divemode mask
3814 SAFE_2BYTE_COPY marker_depth, lo
3815 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
3816 lfsr FSR2,letter
3817 bsf leftbind
3818 bsf ignore_digit5 ; do not display 1cm depth
3819 output_16dp d'3'
3820 PUTC TXT_METER_C
3821 bcf show_last3
3822 call word_processor
3823
3824 WIN_LEFT .105
3825 WIN_TOP .192
3826 WIN_INVERT .0 ; Init new Wordprocessor
3827 movff marker_time+0,lo
3828 movff marker_time+1,hi
3829 bsf leftbind
3830 lfsr FSR2,letter
3831 output_16_3 ; displays only last three figures from a 16Bit value (0-999)
3832 PUTC ':'
3833 movff marker_time+2,lo
3834 output_99x
3835 call word_processor
3836 bcf leftbind
3837 call DISP_standard_color
3838 return
3839
3840 DISP_topline_box_clear: ; Writes an empty box
3841 movlw .0
3842 bra DISP_topline_box2
3843 DISP_topline_box: ; Writes a filled box...
3844 GETCUSTOM8 d'35' ; ... with the standard color
3845 DISP_topline_box2:
3846 WIN_BOX_COLOR .0, .26, .0, .159
3847 call DISP_standard_color ; Reset to standard color in case of unreadable color
3848 return
3849
3850 DISP_display_cns:
3851 btfsc gauge_mode ; Do not display in gauge mode
3852 return
3853
3854 btfsc FLAG_apnoe_mode ; Do not display in apnoe mode
3855 return
3856
3857 btfsc DISP_velocity_display ; Is velocity displayed?`
3858 return ; Yes, do not overwrite until DISP_velocity_clear was called
3859
3860 ostc_debug 'k' ; Sends debug-information to screen if debugmode active
3861
3862 WIN_TOP .090
3863 WIN_LEFT .0
3864 WIN_FONT FT_SMALL
3865 DISP_color_code warn_cns ; Color-code CNS output
3866
3867 STRCPY TXT_CNS4
3868 movff char_O_CNS_fraction,lo
3869 bsf leftbind
3870 output_8
3871 bcf leftbind
3872 STRCAT_PRINT "%"
3873 return
3874
3875 ;-----------------------------------------------------------------------------
3876 ;
3877 DISP_display_cns_surface:
3878 ; Check if CNS should be displayed
3879 movff char_O_CNS_fraction,lo ; copy into bank1
3880 GETCUSTOM8 d'15' ; cns_display_high_surfacemode
3881 subwf lo,W
3882 btfss STATUS,C
3883 return ; Do not show...
3884 ; Show CNS
3885
3886 ostc_debug 'W' ; Sends debug-information to screen if debugmode active
3887
3888 WIN_TOP .175
3889 WIN_LEFT .45
3890 WIN_FONT FT_SMALL
3891 WIN_INVERT .0 ; Init new Wordprocessor
3892 DISP_color_code warn_cns ; Color-code CNS output
3893
3894 STRCPY TXT_CNS4
3895 movff char_O_CNS_fraction,lo
3896 bsf leftbind
3897 output_8
3898 bcf leftbind
3899 STRCAT_PRINT "% "
3900 return
3901
3902 ;-----------------------------------------------------------------------------
3903 ; Display GF at furface, if > CF8.
3904 ;
3905 DISP_display_gf_surface:
3906 movff char_O_gradient_factor,lo ; gradient factor
3907 GETCUSTOM8 d'8' ; threshold for display
3908 cpfslt lo ; show value?
3909 bra DISP_display_gf_surf_1 ; YES: do it.
3910 return
3911
3912 DISP_display_gf_surf_1:
3913 WIN_TOP .175
3914 WIN_LEFT .45
3915 WIN_FONT FT_SMALL
3916 DISP_color_code warn_gf ; Color-code Output
3917
3918 STRCPY TXT_GF3
3919 movff char_O_gradient_factor,lo ; gradient factor
3920 output_8
3921 STRCAT_PRINT "% "
3922 goto DISP_standard_color
3923
3924 ;-----------------------------------------------------------------------------
3925
3926 DISP_custom_text:
3927 read_int_eeprom d'64'
3928 movlw d'1'
3929 cpfseq EEDATA ; Custom text active?
3930 bra DISP_custom_text_serial ; No, show serial instead
3931 WIN_TOP .200
3932 WIN_LEFT .0
3933 WIN_FONT FT_SMALL
3934 WIN_INVERT .0 ; Init new Wordprocessor
3935 call DISP_divemask_color ; Set Color for Divemode mask
3936
3937 lfsr FSR2,letter
3938 movlw d'64'
3939 movwf lo
3940 movlw d'24'
3941 movwf hi ; counter
3942
3943 DISP_custom_text1:
3944 incf lo,F
3945 call DISP_get_custom_letter ; Get one letter for the custom text
3946 movlw '}' ; End marker found?
3947 cpfseq EEDATA
3948 bra DISP_custom_text2 ; No
3949 bra DISP_custom_text3
3950 DISP_custom_text2:
3951 movff EEDATA,POSTINC2 ; Copy into Postinc
3952
3953 decfsz hi,F ; Max. numbers?
3954 bra DISP_custom_text1 ; No, get next letters
3955
3956 DISP_custom_text3:
3957 call word_processor
3958 call DISP_standard_color
3959 return
3960
3961 DISP_get_custom_letter:
3962 movff lo,EEADR ; Address for next custom text letter
3963 call read_eeprom ; Read letter
3964 return
3965
3966 DISP_custom_text_serial:
3967 WIN_TOP .200
3968 WIN_LEFT .50
3969 WIN_FONT FT_SMALL
3970 WIN_INVERT .0 ; Init new Wordprocessor
3971 call DISP_divemask_color ; Set Color for Divemode mask
3972
3973 lfsr FSR2,letter
3974 OUTPUTTEXTH d'262' ; "OSTC "
3975 clrf EEADRH
3976 clrf EEADR ; Get Serial number LOW
3977 call read_eeprom ; read byte
3978 movff EEDATA,lo
3979 incf EEADR,F ; Get Serial number HIGH
3980 call read_eeprom ; read byte
3981 movff EEDATA,hi
3982 bsf leftbind
3983 output_16
3984 call word_processor
3985 call DISP_standard_color
3986 return
3987
3988 DISP_simdata_screen: ;Display Pre-Dive Screen
3989 ; List active gases/Setpoints
3990 btfsc FLAG_const_ppO2_mode ; in ppO2 mode?
3991 bra DISP_simdata_screen3 ; Yes, display SetPoint/Sensor result list
3992
3993 DISP_simdata_screen2:
3994 ostc_debug 'm' ; Sends debug-information to screen if debugmode active
3995
3996 WIN_LEFT .0
3997 WIN_FONT FT_SMALL
3998 bsf leftbind
3999
4000 movlw d'2'
4001 movwf wait_temp ; here: stores eeprom address for gas list
4002 movlw d'10'
4003 movwf waitms_temp ; here: stores row for gas list
4004 clrf hi ; here: Gas counter
4005
4006 DISP_simdata_screen2_loop:
4007 incf hi,F ; Increase Gas
4008 movlw d'4'
4009 addwf wait_temp,F ; Increase eeprom address for gas list
4010
4011 STRCPY TXT_GAS1
4012 movff hi,lo ; copy gas number
4013 output_8 ; display gas number
4014 PUTC ':'
4015 movff wait_temp, EEADR ; Gas #hi: %O2 - Set address in internal EEPROM
4016 call read_eeprom ; get byte (stored in EEDATA)
4017 movff EEDATA,lo ; copy to lo
4018 output_8 ; outputs into Postinc2!
4019 PUTC '/'
4020 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM
4021 call read_eeprom ; get byte (stored in EEDATA)
4022 movff EEDATA,lo ; copy to lo
4023 output_8 ; outputs into Postinc2!
4024 PUTC ' '
4025 movf hi,W ; Gas number
4026 addlw d'27' ; -> Adress of change depth register
4027 call read_int_eeprom_1
4028 movff EEDATA,lo ; Change depth in m
4029 movff lo,divemins ; Store for grey-out
4030 output_99 ; outputs into Postinc2!
4031 PUTC TXT_METER_C
4032
4033 ; Check if gas is first gas ?
4034 read_int_eeprom d'33' ; First gas (1-5)?
4035 movf hi,W ; Current gas in WREG
4036 cpfseq EEDATA ; Is equal first gas?
4037 bra DISP_simdata_screen2_loop2 ; No : more tests...
4038
4039 bra DISP_simdata_white ; Yes
4040
4041 DISP_simdata_screen2_loop2:
4042 ; Check if gas is inactive ?
4043 read_int_eeprom d'27' ; read flag register
4044 movff hi,lo ; copy gas number
4045 DISP_simdata_screen2_loop1:
4046 rrcf EEDATA ; roll flags into carry
4047 decfsz lo,F ; max. 5 times...
4048 bra DISP_simdata_screen2_loop1
4049
4050 btfss STATUS,C ; test inactive flag
4051 bra DISP_simdata_grey ; Is inactive!
4052
4053 tstfsz divemins ; Test change depth=0?
4054 bra DISP_simdata_white ; Is not zero
4055
4056 DISP_simdata_grey:
4057 GETCUSTOM8 d'64' ;movlw color_grey
4058 call DISP_set_color ; grey out inactive gases!
4059 bra DISP_simdata_color_done
4060
4061 DISP_simdata_white:
4062 call DISP_standard_color
4063
4064 DISP_simdata_color_done:
4065 movlw d'25'
4066 addwf waitms_temp,F ; Increase row
4067 WIN_LEFT .0
4068 movff waitms_temp,win_top ; Set Row
4069 call word_processor ; display gas
4070
4071 DISP_simdata_screen2b:
4072 call DISP_standard_color
4073
4074 movlw d'5' ; list all five gases
4075 cpfseq hi ; All gases shown?
4076 bra DISP_simdata_screen2_loop ; No
4077
4078 return ; No, return (OC mode)
4079
4080 DISP_simdata_screen3:
4081 WIN_LEFT .0
4082 WIN_FONT FT_SMALL
4083 bsf leftbind
4084
4085 ; list three SP in Gaslist
4086 movlw d'35' ; 36 = current SP position in EEPROM
4087 movwf wait_temp ; here: stores eeprom address for gas list
4088 movlw d'10'
4089 movwf waitms_temp ; here: stores row for gas list
4090 clrf decoplan_index ; here: SP counter
4091
4092 DISP_simdata_screen3_loop:
4093 incf wait_temp,F ; EEPROM address
4094 incf decoplan_index,F ; Increase SP
4095
4096 movlw d'25'
4097 addwf waitms_temp,F ; Increase row
4098 WIN_LEFT .0
4099 movff waitms_temp,win_top ; Set Row
4100
4101 STRCPY TXT_SP2
4102 movff decoplan_index,lo ; copy gas number
4103 output_8 ; display gas number
4104 STRCAT ": "
4105 movff wait_temp, EEADR; SP #hi position
4106 call read_eeprom ; get byte (stored in EEDATA)
4107 movff EEDATA,lo ; copy to lo
4108 clrf hi
4109 output_16dp d'3' ; outputs into Postinc2!
4110 call word_processor
4111
4112 movlw d'3' ; list all three SP
4113 cpfseq decoplan_index ; All gases shown?
4114 bra DISP_simdata_screen3_loop ;no
4115
4116 ; Show Diluent
4117 call get_first_diluent ; Read first diluent into lo(O2) and hi(He)
4118 WIN_LEFT .0
4119 WIN_TOP .110
4120 STRCPY TXT_DIL4
4121 output_8 ; O2 Ratio
4122 STRCAT "/"
4123 movff hi,lo
4124 output_8 ; He Ratio
4125 call word_processor
4126
4127 bcf leftbind
4128 return ; Return (CC Mode)
4129
4130 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar]
4131
4132 btfsc simulatormode_active ; Do apply salinity in Simulatormode
4133 return
4134
4135 read_int_eeprom d'26' ; Read Salinity from EEPROM
4136 movff EEDATA, wait_temp ; salinity
4137
4138 movlw d'105' ; 105% ?
4139 cpfslt wait_temp ; Salinity higher limit
4140 return ; Out of limit, do not adjust lo:hi
4141
4142 movlw d'99' ; 99% ?
4143 cpfsgt wait_temp ; Salinity lower limit
4144 return ; Out of limit, do not adjust lo:hi
4145
4146 movff lo,xA+0
4147 movff hi,xA+1
4148
4149 movlw d'102' ; 0,98bar/10m
4150 movwf xB+0
4151 clrf xB+1
4152
4153 call mult16x16 ;xA*xB=xC (lo:hi * 100)
4154
4155 movff wait_temp,xB+0 ; Salinity
4156 clrf xB+1
4157
4158 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
4159
4160 movff xC+0,lo
4161 movff xC+1,hi ; restore lo and hi with updated value
4162
4163 return