comparison code_part1/OSTC_code_asm_part1/simulator.asm @ 271:5c17b2b4b9dd

Minor comments
author JeanDo
date Wed, 13 Apr 2011 00:05:19 +0200
parents fda90f19486a
children 17aab4ca0547
comparison
equal deleted inserted replaced
270:fda90f19486a 271:5c17b2b4b9dd
324 DISPLAYTEXTH .301 ; OCR Gas Usage: 324 DISPLAYTEXTH .301 ; OCR Gas Usage:
325 WIN_INVERT 0 325 WIN_INVERT 0
326 326
327 bra simulator_show_decoplan1 327 bra simulator_show_decoplan1
328 328
329 ;=============================================================================
330 ; OSTC Simulator: compute a new runtime
331 ;
329 simulator_show_decoplan4: 332 simulator_show_decoplan4:
330 movlw d'5' 333 movlw d'5'
331 movwf menupos 334 movwf menupos
332 bra menu_simulator1 335 bra menu_simulator1
333 336
334
335 simulator_calc_deco: 337 simulator_calc_deco:
336 call simulator_save_tissue_data ; Stores 32 floats "pre_tissue" into bank3 338 call simulator_save_tissue_data ; Stores 32 floats "pre_tissue" into bank3
337 339
338 bsf simulatormode_active ; normal simulator mode 340 bsf simulatormode_active ; normal simulator mode
339 bsf standalone_simulator ; Standalone Simulator active 341 bsf standalone_simulator ; Standalone Simulator active
340 bsf no_sensor_int ; Disable sensor interrupt 342 bsf no_sensor_int ; Disable sensor interrupt
341 clrf T3CON 343 clrf T3CON ; Restart time3 counter,
342 clrf TMR3L 344 clrf TMR3L ; so the simu won't stop right away.
343 clrf TMR3H 345 clrf TMR3H
344 346
345 call diveloop_boot ; configure gases, etc. 347 call diveloop_boot ; configure gases, etc.
346
347 348
348 ; Save dive parameters for gas volume estimation: 349 ; Save dive parameters for gas volume estimation:
349 movff logbook_temp2,char_I_bottom_depth 350 movff logbook_temp2,char_I_bottom_depth
350 movff logbook_temp1,char_I_bottom_time 351 movff logbook_temp1,char_I_bottom_time
351
352 352
353 movff logbook_temp2,xA+0 ; Bottom depth. 353 movff logbook_temp2,xA+0 ; Bottom depth.
354 clrf xA+1 354 clrf xA+1
355 movlw d'100' 355 movlw d'100'
356 movwf xB+0 356 movwf xB+0
363 addwfc xC+1,F ; add 1000mBar 363 addwfc xC+1,F ; add 1000mBar
364 364
365 movff xC+0,sim_pressure+0 365 movff xC+0,sim_pressure+0
366 movff xC+1,sim_pressure+1 366 movff xC+1,sim_pressure+1
367 367
368 ; movff sim_pressure+0,amb_pressure+0 ; override readings with simulator values
369 ; movff sim_pressure+1,amb_pressure+1
370
371 call PLED_topline_box 368 call PLED_topline_box
372 WIN_INVERT .1 369 WIN_INVERT .1
373 DISPLAYTEXT .12 ; "Wait..." 370 DISPLAYTEXT .12 ; "Wait..."
374 WIN_INVERT .0 371 WIN_INVERT .0
375 372
376 movff sim_pressure+0,amb_pressure+0 ; override readings with simulator values 373 movff sim_pressure+0,amb_pressure+0 ; override readings with simulator values
377 movff sim_pressure+1,amb_pressure+1 374 movff sim_pressure+1,amb_pressure+1
378 375
381 378
382 movlw d'3' ; Begin of deco cycle (reset table). 379 movlw d'3' ; Begin of deco cycle (reset table).
383 movff WREG,char_O_deco_status ; Reset Deco module. 380 movff WREG,char_O_deco_status ; Reset Deco module.
384 381
385 movlw d'0' 382 movlw d'0'
386 movff WREG,char_I_step_is_1min ; 2 second deco mode 383 movff WREG,char_I_step_is_1min ; 2 second deco mode for descent.
387 384
388 simulator_calc_deco_loop1: 385 simulator_calc_deco_loop1:
389 call deco_calc_hauptroutine ; calc_tissue 386 call deco_calc_hauptroutine ; calc_tissue
390 movlb b'00000001' ; rambank 1 selected 387 movlb b'00000001' ; rambank 1 selected
391 388
392 movff char_O_deco_status,WREG 389 movff char_O_deco_status,WREG
393 tstfsz WREG ; deco_status=0 if decompression calculation done 390 tstfsz WREG ; deco_status=0 if decompression calculation done
394 bra simulator_calc_deco_loop1 ; Not finished 391 bra simulator_calc_deco_loop1 ; Not finished
395 392
396 movlw d'1' 393 movlw d'1'
397 movff WREG,char_I_step_is_1min ; 1 minute mode 394 movff WREG,char_I_step_is_1min ; 1 minute mode for bottom time.
398 395
399 simulator_calc_deco_loop2: 396 simulator_calc_deco_loop2:
400 call PLED_simulator_data 397 call PLED_simulator_data
401
402 ; call divemode_check_decogases ; Checks for decogases and sets the gases
403 ; call divemode_prepare_flags_for_deco
404 398
405 call deco_calc_hauptroutine ; calc_tissue 399 call deco_calc_hauptroutine ; calc_tissue
406 movlb b'00000001' ; rambank 1 selected 400 movlb b'00000001' ; rambank 1 selected
407 ostc_debug 'C' ; Sends debug-information to screen if debugmode active 401 ostc_debug 'C' ; Sends debug-information to screen if debugmode active
408 402
410 bra simulator_calc_deco_loop2 404 bra simulator_calc_deco_loop2
411 405
412 movlw d'0' 406 movlw d'0'
413 movff WREG,char_I_step_is_1min ; 2 second deco mode 407 movff WREG,char_I_step_is_1min ; 2 second deco mode
414 408
415 movlw d'255' 409 clrf timeout_counter2 ; timeout used as maxloop here
416 movwf timeout_counter2 ; timeout used as temp here
417 simulator_calc_deco2: 410 simulator_calc_deco2:
418 ; call divemode_check_decogases ; Checks for decogases and sets the gases
419 ; call divemode_prepare_flags_for_deco
420 411
421 call deco_calc_hauptroutine ; calc_tissue 412 call deco_calc_hauptroutine ; calc_tissue
422 movlb b'00000001' ; rambank 1 selected 413 movlb b'00000001' ; rambank 1 selected
423 414
424 dcfsnz timeout_counter2,F ; Abort loop (max. 255 tries)? 415 dcfsnz timeout_counter2,F ; Abort loop (max. 256 tries)?
425 bra simulator_calc_deco3 ; Yes... 416 bra simulator_calc_deco3 ; Yes...
426 417
427 movff char_O_deco_status,WREG 418 movff char_O_deco_status,WREG
428 tstfsz WREG ; deco_status=0 if decompression calculation done 419 tstfsz WREG ; deco_status=0 if decompression calculation done
429 bra simulator_calc_deco2 ; Not finished 420 bra simulator_calc_deco2 ; Not finished