comparison code_part1/OSTC_code_asm_part1/simulator.asm @ 49:cd5b650920f6

1.70...
author heinrichsweikamp
date Wed, 28 Jul 2010 15:40:03 +0200
parents 56aea9fcdd8f
children c97c5514b165
comparison
equal deleted inserted replaced
48:ebc5abda180d 49:cd5b650920f6
33 33
34 menu_simulator1: 34 menu_simulator1:
35 clrf timeout_counter2 35 clrf timeout_counter2
36 bsf menubit 36 bsf menubit
37 bsf cursor 37 bsf cursor
38 call PLED_brightness_full ;max. brightness
38 call PLED_ClearScreen 39 call PLED_ClearScreen
39 call PLED_simulator_mask 40 call PLED_simulator_mask
40 41
41 menu_simulator2: 42 menu_simulator2:
42 bcf switch_left 43 bcf switch_left
145 146
146 bsf divemode ; Set divemode flag 147 bsf divemode ; Set divemode flag
147 ostc_debug 'P' ; Sends debug-information to screen if debugmode active 148 ostc_debug 'P' ; Sends debug-information to screen if debugmode active
148 goto diveloop ; Start Divemode 149 goto diveloop ; Start Divemode
149 150
150 simulator_save_tissue_data:
151 bsf restore_deco_data ; Set restore flag
152 ostc_debug 'S' ; Sends debug-information to screen if debugmode active
153 call main_push_tissues_to_vault
154 movlb 0x01 ; Back to RAM Bank1
155 ostc_debug 'T' ; Sends debug-information to screen if debugmode active
156 return
157
158 simulator_restore_tissue_data:
159 bcf restore_deco_data ; clear restore flag
160 ostc_debug 'S' ; Sends debug-information to screen if debugmode active
161 call main_pull_tissues_from_vault
162 movlb 0x01 ; Back to RAM Bank1
163 ostc_debug 'T' ; Sends debug-information to screen if debugmode active
164
165 ostc_debug 'G' ; Sends debug-information to screen if debugmode active
166 call deco_main_calc_desaturation_time ; calculate desaturation time
167 movlb b'00000001' ; select ram bank 1
168 call calculate_noflytime ; Calc NoFly time
169 ostc_debug 'H' ; Sends debug-information to screen if debugmode active
170
171 ; Calculate CNS
172 call main_calc_CNS_fraction ; calculate CNS
173 movlb b'00000001' ; rambank 1 selected
174 return
175
176 simulator_show_decoplan: 151 simulator_show_decoplan:
177 call PLED_ClearScreen 152 call PLED_ClearScreen
178 call PLED_simdata_screen 153 call PLED_simdata_screen
179 call divemenu_see_decoplan 154 call divemenu_see_decoplan
180 155
281 movff WREG,char_O_deco_status ; Reset Deco module 256 movff WREG,char_O_deco_status ; Reset Deco module
282 257
283 simulator_calc_deco_loop2: 258 simulator_calc_deco_loop2:
284 call PLED_simulator_data 259 call PLED_simulator_data
285 260
261 ; Debugger
262 call enable_rs232
263 ; movff char_I_deco_He_ratio5,TXREG
264 ; call rs232_wait_tx ; wait for UART
265 ; movff char_I_deco_N2_ratio5,TXREG
266 ; call rs232_wait_tx ; wait for UART
267 ; movff char_I_deco_He_ratio4,TXREG
268 ; call rs232_wait_tx ; wait for UART
269 ; movff char_I_deco_N2_ratio4,TXREG
270 ; call rs232_wait_tx ; wait for UART
271 ; movff char_I_deco_He_ratio3,TXREG
272 ; call rs232_wait_tx ; wait for UART
273 ; movff char_I_deco_N2_ratio3,TXREG
274 ; call rs232_wait_tx ; wait for UART
275 ; movff char_I_deco_He_ratio2,TXREG
276 ; call rs232_wait_tx ; wait for UART
277 ; movff char_I_deco_N2_ratio2,TXREG
278 ; call rs232_wait_tx ; wait for UART
279 ; movff char_I_deco_He_ratio,TXREG
280 ; call rs232_wait_tx ; wait for UART
281 ; movff char_I_deco_N2_ratio,TXREG
282 ; call rs232_wait_tx ; wait for UART
283 movff char_I_deco_gas_change5,TXREG
284 call rs232_wait_tx ; wait for UART
285 movff char_I_deco_gas_change4,TXREG
286 call rs232_wait_tx ; wait for UART
287 movff char_I_deco_gas_change3,TXREG
288 call rs232_wait_tx ; wait for UART
289 movff char_I_deco_gas_change2,TXREG
290 call rs232_wait_tx ; wait for UART
291 movff char_I_deco_gas_change,TXREG
292 call rs232_wait_tx ; wait for UART
293 ;
294
286 btg LED_red 295 btg LED_red
287 296
288 call divemode_check_decogases ; Checks for decogases and sets the gases 297 call divemode_check_decogases ; Checks for decogases and sets the gases
289 call divemode_prepare_flags_for_deco 298 call divemode_prepare_flags_for_deco
290 299
333 342
334 movff char_O_deco_status,deco_status ; 343 movff char_O_deco_status,deco_status ;
335 tstfsz deco_status ; deco_status=0 if decompression calculation done 344 tstfsz deco_status ; deco_status=0 if decompression calculation done
336 bra simulator_calc_deco2 ; Not finished 345 bra simulator_calc_deco2 ; Not finished
337 bra simulator_calc_deco3 ; finished! 346 bra simulator_calc_deco3 ; finished!
347
348
349 simulator_save_tissue_data:
350 bsf restore_deco_data ; Set restore flag
351 ostc_debug 'S' ; Sends debug-information to screen if debugmode active
352 call main_push_tissues_to_vault
353 movlb 0x01 ; Back to RAM Bank1
354 ostc_debug 'T' ; Sends debug-information to screen if debugmode active
355 return
356
357 simulator_restore_tissue_data:
358 bcf restore_deco_data ; clear restore flag
359 ostc_debug 'S' ; Sends debug-information to screen if debugmode active
360 call main_pull_tissues_from_vault
361 movlb 0x01 ; Back to RAM Bank1
362 ostc_debug 'T' ; Sends debug-information to screen if debugmode active
363
364 ostc_debug 'G' ; Sends debug-information to screen if debugmode active
365 call deco_main_calc_desaturation_time ; calculate desaturation time
366 movlb b'00000001' ; select ram bank 1
367 call calculate_noflytime ; Calc NoFly time
368 ostc_debug 'H' ; Sends debug-information to screen if debugmode active
369
370 ; Calculate CNS
371 call main_calc_CNS_fraction ; calculate CNS
372 movlb b'00000001' ; rambank 1 selected
373 return