comparison code_part1/OSTC_code_asm_part1/simulator.asm @ 197:f15e804ff67f

Gas switch delay + New CF#55 for additional delay in decoplan for gas switch. + BUGFIX compute integration at full ascent, not half (or the formula is wrong). + BUGFIX minor typo in 2sec exposition factors.
author JeanDo
date Sun, 13 Feb 2011 17:27:43 +0100
parents 016c45a0caaf
children 0a3ca358c684
comparison
equal deleted inserted replaced
196:e185b3b028af 197:f15e804ff67f
244 bsf simulatormode_active ; normal simulator mode 244 bsf simulatormode_active ; normal simulator mode
245 bsf standalone_simulator ; Standalone Simulator active 245 bsf standalone_simulator ; Standalone Simulator active
246 246
247 movff logbook_temp1,logbook_temp3 ; store bottom time 247 movff logbook_temp1,logbook_temp3 ; store bottom time
248 248
249 movff logbook_temp2,xA+0 249 movff logbook_temp2,xA+0 ; Bottom depth.
250 clrf xA+1 250 clrf xA+1
251 movlw d'100' 251 movlw d'100'
252 movwf xB+0 252 movwf xB+0
253 clrf xB+1 253 clrf xB+1
254 call mult16x16 ;xA*xB=xC ; Depth in m*100 254 call mult16x16 ;xA*xB=xC ; Depth in m*100
262 movff xC+1,sim_pressure+1 262 movff xC+1,sim_pressure+1
263 263
264 movff sim_pressure+0,amb_pressure+0 ; override readings with simulator values 264 movff sim_pressure+0,amb_pressure+0 ; override readings with simulator values
265 movff sim_pressure+1,amb_pressure+1 265 movff sim_pressure+1,amb_pressure+1
266 266
267 call simulator_save_tissue_data ; Stores 32 floats "pre_tissue" into bank3 267 call simulator_save_tissue_data ; Stores 32 floats "pre_tissue" into bank3
268 268
269 call PLED_topline_box 269 call PLED_topline_box
270 WIN_INVERT .1 270 WIN_INVERT .1
271 DISPLAYTEXT .12 ;" Wait.." 271 DISPLAYTEXT .12 ; "Wait..."
272 WIN_INVERT .0 272 WIN_INVERT .0
273 273
274 call divemode_check_decogases ; Checks for decogases and sets the gases
275 call divemode_prepare_flags_for_deco
276 movlw d'0' ; Begin of deco cycle (init sim tissues)
277 movff WREG,char_O_deco_status ; Reset Deco module.
278
274 simulator_calc_deco_loop1: 279 simulator_calc_deco_loop1:
275 call divemode_check_decogases ; Checks for decogases and sets the gases 280 call deco_calc_hauptroutine ; calc_tissue
276 call divemode_prepare_flags_for_deco 281 movlb b'00000001' ; rambank 1 selected
277
278 call deco_calc_hauptroutine ; calc_tissue
279 movlb b'00000001' ; rambank 1 selected
280 282
281 movff char_O_deco_status,WREG 283 movff char_O_deco_status,WREG
282 tstfsz WREG ; deco_status=0 if decompression calculation done 284 tstfsz WREG ; deco_status=0 if decompression calculation done
283 bra simulator_calc_deco_loop1 ; Not finished 285 bra simulator_calc_deco_loop1 ; Not finished
284 286
285 movlw d'1' 287 movlw d'1'
286 movff WREG,char_I_step_is_1min ; 1 minute mode 288 movff WREG,char_I_step_is_1min ; 1 minute mode
287
288 movlw d'2'
289 movff WREG,char_O_deco_status ; Reset Deco module
290 289
291 simulator_calc_deco_loop2: 290 simulator_calc_deco_loop2:
292
293 call PLED_simulator_data 291 call PLED_simulator_data
294 292 btg LED_red
295 btg LED_red 293
296 294 call divemode_check_decogases ; Checks for decogases and sets the gases
297 call divemode_check_decogases ; Checks for decogases and sets the gases
298 call divemode_prepare_flags_for_deco 295 call divemode_prepare_flags_for_deco
299 296
300 call deco_calc_hauptroutine ; calc_tissue 297 call deco_calc_hauptroutine ; calc_tissue
301 movlb b'00000001' ; rambank 1 selected 298 movlb b'00000001' ; rambank 1 selected
302 ostc_debug 'C' ; Sends debug-information to screen if debugmode active 299 ostc_debug 'C' ; Sends debug-information to screen if debugmode active
303 300
304 decfsz logbook_temp1,F 301 decfsz logbook_temp1,F ; Decrement bottom time.
305 bra simulator_calc_deco_loop2 302 bra simulator_calc_deco_loop2
306 303
307 movlw d'0' 304 movlw d'0'
308 movff WREG,char_I_step_is_1min ; 2 second deco mode 305 movff WREG,char_I_step_is_1min ; 2 second deco mode
309 306
310 movlw d'2' 307 simulator_calc_deco2:
311 movff WREG,char_O_deco_status ; Reset Deco module 308 call divemode_check_decogases ; Checks for decogases and sets the gases
312 309 call divemode_prepare_flags_for_deco
313 bra simulator_calc_deco2 ; Not finished 310
314 311 call deco_calc_hauptroutine ; calc_tissue
315 simulator_calc_deco3: 312 movlb b'00000001' ; rambank 1 selected
313
314 movff char_O_deco_status,WREG
315 tstfsz WREG ; deco_status=0 if decompression calculation done
316 bra simulator_calc_deco2 ; Not finished
317
318 ; Finished
316 bsf LED_red 319 bsf LED_red
317 320
318 call simulator_restore_tissue_data ; Restore 32 floats "pre_tissue" from bank3 321 call simulator_restore_tissue_data ; Restore 32 floats "pre_tissue" from bank3
319 322
320 bcf simulatormode_active ; normal simulator mode 323 bcf simulatormode_active ; normal simulator mode
321 bcf standalone_simulator ; Standalone Simulator active 324 bcf standalone_simulator ; Standalone Simulator active
322 325
323 WAITMS d'250' 326 WAITMS d'250'
324 WAITMS d'250' 327 WAITMS d'250'
325 WAITMS d'250' ; Wait for Pressure Sensor to get real pressure again... 328 WAITMS d'250' ; Wait for Pressure Sensor to get real pressure again...
326 329
327 bcf LED_red 330 bcf LED_red
328 331
329 movlw d'1' 332 movlw d'1'
330 movwf logbook_temp1 ; Bottom time>0! 333 movwf logbook_temp1 ; Bottom time>0!
331 334
332 movlw d'5' ; Pre-Set Cursor to "Show Decoplan" 335 movlw d'5' ; Pre-Set Cursor to "Show Decoplan"
333 movwf menupos 336 movwf menupos
334 movff logbook_temp3,logbook_temp1 ; restore bottom time 337 movff logbook_temp3,logbook_temp1 ; restore bottom time
335 bra menu_simulator1 ; Done. 338 bra menu_simulator1 ; Done.
336
337 simulator_calc_deco2:
338 call divemode_check_decogases ; Checks for decogases and sets the gases
339 call divemode_prepare_flags_for_deco
340
341 call deco_calc_hauptroutine ; calc_tissue
342 movlb b'00000001' ; rambank 1 selected
343
344 movff char_O_deco_status,WREG
345 tstfsz WREG ; deco_status=0 if decompression calculation done
346 bra simulator_calc_deco2 ; Not finished
347 bra simulator_calc_deco3 ; finished!
348 339
349 340
350 simulator_save_tissue_data: 341 simulator_save_tissue_data:
351 bsf restore_deco_data ; Set restore flag 342 bsf restore_deco_data ; Set restore flag
352 ostc_debug 'S' ; Sends debug-information to screen if debugmode active 343 ostc_debug 'S' ; Sends debug-information to screen if debugmode active