Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/simulator.asm @ 681:6e456a6398e0
Hardware4 support
author | heinrichsweikamp |
---|---|
date | Fri, 25 Jan 2013 18:00:49 +0100 |
parents | 9c13bf8a3033 |
children | 8aaacf6eee3f |
comparison
equal
deleted
inserted
replaced
680:c6220d340684 | 681:6e456a6398e0 |
---|---|
43 movwf menupos | 43 movwf menupos |
44 clrf WREG ; Interval | 44 clrf WREG ; Interval |
45 movff WREG,char_I_dive_interval | 45 movff WREG,char_I_dive_interval |
46 | 46 |
47 menu_simulator1: | 47 menu_simulator1: |
48 call PLED_brightness_full ;max. brightness | 48 call DISP_brightness_full ;max. brightness |
49 call PLED_ClearScreen | 49 call DISP_ClearScreen |
50 call PLED_simulator_mask | 50 call DISP_simulator_mask |
51 | 51 |
52 menu_simulator2: | 52 menu_simulator2: |
53 call menu_pre_loop_common ; Clear some menu flags, timeout and switches | 53 call menu_pre_loop_common ; Clear some menu flags, timeout and switches |
54 call PLED_simulator_data | 54 call DISP_simulator_data |
55 call PLED_menu_cursor | 55 call DISP_menu_cursor |
56 | 56 |
57 menu_simulator_loop: | 57 menu_simulator_loop: |
58 call check_switches_menu | 58 call check_switches_menu |
59 menu_simulator_loop2: | 59 menu_simulator_loop2: |
60 btfsc onesecupdate | 60 btfsc onesecupdate |
173 | 173 |
174 ;============================================================================= | 174 ;============================================================================= |
175 ; Show decoplanning result. | 175 ; Show decoplanning result. |
176 ; | 176 ; |
177 simulator_show_decoplan: | 177 simulator_show_decoplan: |
178 call PLED_ClearScreen | 178 call DISP_ClearScreen |
179 call PLED_simdata_screen | 179 call DISP_simdata_screen |
180 call divemenu_see_decoplan | 180 call divemenu_see_decoplan |
181 | 181 |
182 WIN_LEFT .0 | 182 WIN_LEFT .0 |
183 call PLED_standard_color | 183 call DISP_standard_color |
184 | 184 |
185 ; Display TTS, if any... | 185 ; Display TTS, if any... |
186 movff int_O_ascenttime+0,lo | 186 movff int_O_ascenttime+0,lo |
187 movff int_O_ascenttime+1,hi | 187 movff int_O_ascenttime+1,hi |
188 movf lo,W | 188 movf lo,W |
203 incf sim_CNS,W ; Detect CNS simulation overflow. | 203 incf sim_CNS,W ; Detect CNS simulation overflow. |
204 bz simulator_decoplan_cns_1 | 204 bz simulator_decoplan_cns_1 |
205 | 205 |
206 movlw .100 ; Detect if CNS > 100% | 206 movlw .100 ; Detect if CNS > 100% |
207 cpfslt sim_CNS | 207 cpfslt sim_CNS |
208 call PLED_warnings_color ; Yes: draw in red ! | 208 call DISP_warnings_color ; Yes: draw in red ! |
209 | 209 |
210 STRCPY TXT_CNS4 | 210 STRCPY TXT_CNS4 |
211 movff char_O_CNS_fraction,lo ; Current CNS, before dive. | 211 movff char_O_CNS_fraction,lo ; Current CNS, before dive. |
212 output_8 | 212 output_8 |
213 STRCAT "%\x92" ; Right-arrow | 213 STRCAT "%\x92" ; Right-arrow |
216 output_8 ; CNS after dive. | 216 output_8 ; CNS after dive. |
217 STRCAT_PRINT "%" | 217 STRCAT_PRINT "%" |
218 bra simulator_decoplan_cns_2 | 218 bra simulator_decoplan_cns_2 |
219 | 219 |
220 simulator_decoplan_cns_1: | 220 simulator_decoplan_cns_1: |
221 call PLED_warnings_color ; Yes: draw in red ! | 221 call DISP_warnings_color ; Yes: draw in red ! |
222 STRCPY_PRINT TXT_CNSGR10 | 222 STRCPY_PRINT TXT_CNSGR10 |
223 | 223 |
224 simulator_decoplan_cns_2: | 224 simulator_decoplan_cns_2: |
225 call PLED_standard_color ; Back to normal. | 225 call DISP_standard_color ; Back to normal. |
226 WIN_INVERT .1 ; Init new Wordprocessor | 226 WIN_INVERT .1 ; Init new Wordprocessor |
227 DISPLAYTEXT .188 ; Sim. Results: | 227 DISPLAYTEXT .188 ; Sim. Results: |
228 WIN_INVERT .0 ; Init new Wordprocessor | 228 WIN_INVERT .0 ; Init new Wordprocessor |
229 | 229 |
230 simulator_show_decoplan1: | 230 simulator_show_decoplan1: |
253 simulator_show_decoplan5: | 253 simulator_show_decoplan5: |
254 incf decoplan_page,F | 254 incf decoplan_page,F |
255 btfsc last_ceiling_gf_shown ; last ceiling shown? | 255 btfsc last_ceiling_gf_shown ; last ceiling shown? |
256 bra simulator_show_decoplan5_0 ; All done, clear and return | 256 bra simulator_show_decoplan5_0 ; All done, clear and return |
257 | 257 |
258 call PLED_decoplan ; Re-Draw Current page of GF Decoplan | 258 call DISP_decoplan ; Re-Draw Current page of GF Decoplan |
259 bra simulator_show_decoplan1 | 259 bra simulator_show_decoplan1 |
260 | 260 |
261 ;---- In OCR mode, show the gas Usage special page --------------------------- | 261 ;---- In OCR mode, show the gas Usage special page --------------------------- |
262 simulator_show_decoplan5_0: | 262 simulator_show_decoplan5_0: |
263 btfss display_see_deco ; Already displayed ? | 263 btfss display_see_deco ; Already displayed ? |
284 movwf waitms_temp ; Row for gas list is .10+.25 | 284 movwf waitms_temp ; Row for gas list is .10+.25 |
285 clrf wait_temp ; Gas counter | 285 clrf wait_temp ; Gas counter |
286 lfsr FSR0,int_O_gas_volumes ; Initialize indexed addressing. | 286 lfsr FSR0,int_O_gas_volumes ; Initialize indexed addressing. |
287 | 287 |
288 WIN_LEFT .90 ; Set column | 288 WIN_LEFT .90 ; Set column |
289 call PLED_standard_color | 289 call DISP_standard_color |
290 | 290 |
291 simulator_show_decoplan5_loop: | 291 simulator_show_decoplan5_loop: |
292 incf wait_temp,F ; Increment gas # | 292 incf wait_temp,F ; Increment gas # |
293 | 293 |
294 movlw .25 | 294 movlw .25 |
303 | 303 |
304 movf lo,W ; == 65535 (saturated ?) | 304 movf lo,W ; == 65535 (saturated ?) |
305 andwf hi,W | 305 andwf hi,W |
306 incf WREG | 306 incf WREG |
307 bnz simulator_show_decoplan5_2 | 307 bnz simulator_show_decoplan5_2 |
308 call PLED_warnings_color | 308 call DISP_warnings_color |
309 STRCPY_PRINT "= xxxx.x" | 309 STRCPY_PRINT "= xxxx.x" |
310 call PLED_standard_color | 310 call DISP_standard_color |
311 bra simulator_show_decoplan5_1 | 311 bra simulator_show_decoplan5_1 |
312 | 312 |
313 simulator_show_decoplan5_2: | 313 simulator_show_decoplan5_2: |
314 STRCPY "= " | 314 STRCPY "= " |
315 | 315 |
374 addwfc xC+1,F ; add 1000mbar | 374 addwfc xC+1,F ; add 1000mbar |
375 | 375 |
376 movff xC+0,sim_pressure+0 | 376 movff xC+0,sim_pressure+0 |
377 movff xC+1,sim_pressure+1 | 377 movff xC+1,sim_pressure+1 |
378 | 378 |
379 call PLED_topline_box | 379 call DISP_topline_box |
380 WIN_INVERT .1 | 380 WIN_INVERT .1 |
381 DISPLAYTEXT .12 ; "Wait..." | 381 DISPLAYTEXT .12 ; "Wait..." |
382 WIN_INVERT .0 | 382 WIN_INVERT .0 |
383 | 383 |
384 ; This override is done in ISR too, but do it right now also: | 384 ; This override is done in ISR too, but do it right now also: |
434 decf sim_btm_time,F ; One minute done. | 434 decf sim_btm_time,F ; One minute done. |
435 bz simulator_calc_deco_loop_end | 435 bz simulator_calc_deco_loop_end |
436 | 436 |
437 ; Loop for bottom time duration | 437 ; Loop for bottom time duration |
438 simulator_calc_deco_loop2: | 438 simulator_calc_deco_loop2: |
439 call PLED_simulator_data ; Update display of bottom time. | 439 call DISP_simulator_data ; Update display of bottom time. |
440 | 440 |
441 call deco_calc_tissue ; JUST calc tissue (faster). | 441 call deco_calc_tissue ; JUST calc tissue (faster). |
442 call deco_calc_CNS_fraction ; Also calculate CNS (in 1min loop) | 442 call deco_calc_CNS_fraction ; Also calculate CNS (in 1min loop) |
443 movlb b'00000001' ; rambank 1 selected | 443 movlb b'00000001' ; rambank 1 selected |
444 ostc_debug 'C' ; Sends debug-information to screen if debugmode active | 444 ostc_debug 'C' ; Sends debug-information to screen if debugmode active |
457 simulator_calc_deco2: | 457 simulator_calc_deco2: |
458 call deco_calc_hauptroutine ; calc_tissue | 458 call deco_calc_hauptroutine ; calc_tissue |
459 movlb b'00000001' ; rambank 1 selected | 459 movlb b'00000001' ; rambank 1 selected |
460 | 460 |
461 movff char_O_deco_last_stop,sim_btm_depth | 461 movff char_O_deco_last_stop,sim_btm_depth |
462 call PLED_simulator_data ; Animate ascent simu. | 462 call DISP_simulator_data ; Animate ascent simu. |
463 | 463 |
464 dcfsnz timeout_counter2,F ; Abort loop (max. 256 tries)? | 464 dcfsnz timeout_counter2,F ; Abort loop (max. 256 tries)? |
465 bra simulator_calc_deco3 ; Yes... | 465 bra simulator_calc_deco3 ; Yes... |
466 | 466 |
467 movff char_O_deco_status,WREG | 467 movff char_O_deco_status,WREG |