Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/simulator.asm @ 439:b9cf06de8aca
BUGFIX: Decoplanner accumulates CNS during ascent (bug #55)
author | JeanDo |
---|---|
date | Tue, 09 Aug 2011 18:10:27 +0200 |
parents | f36b93f2fbed |
children | a17b85b0fbcc |
comparison
equal
deleted
inserted
replaced
438:ec28f64bfeff | 439:b9cf06de8aca |
---|---|
405 call deco_calc_hauptroutine ; Reset table + sim one minute for descent. | 405 call deco_calc_hauptroutine ; Reset table + sim one minute for descent. |
406 call deco_calc_CNS_fraction ; Also calculate CNS (in 1min loop) | 406 call deco_calc_CNS_fraction ; Also calculate CNS (in 1min loop) |
407 movlb b'00000001' ; rambank 1 selected | 407 movlb b'00000001' ; rambank 1 selected |
408 | 408 |
409 decf sim_btm_time,F ; One minute done. | 409 decf sim_btm_time,F ; One minute done. |
410 bz simulator_calc_deco_loop_end | |
410 | 411 |
411 ; Loop for bottom time duration | 412 ; Loop for bottom time duration |
412 simulator_calc_deco_loop2: | 413 simulator_calc_deco_loop2: |
413 call PLED_simulator_data ; Update display of bottom time. | 414 call PLED_simulator_data ; Update display of bottom time. |
414 | 415 |
418 ostc_debug 'C' ; Sends debug-information to screen if debugmode active | 419 ostc_debug 'C' ; Sends debug-information to screen if debugmode active |
419 | 420 |
420 decfsz sim_btm_time,F ; Decrement bottom time, | 421 decfsz sim_btm_time,F ; Decrement bottom time, |
421 bra simulator_calc_deco_loop2 ; and loop while not finished. | 422 bra simulator_calc_deco_loop2 ; and loop while not finished. |
422 | 423 |
423 ; No the bottom time is finish, restart a full ascent simulation, | 424 ; Now the bottom time is finish, restart a full ascent simulation: |
425 simulator_calc_deco_loop_end: | |
424 movlw d'0' | 426 movlw d'0' |
425 movff WREG,char_I_step_is_1min ; Back to 2 second deco mode | 427 movff WREG,char_I_step_is_1min ; Back to 2 second deco mode |
426 | 428 |
427 clrf timeout_counter2 ; timeout used as maxloop here | 429 clrf timeout_counter2 ; timeout used as maxloop here |
428 movff char_I_bottom_depth,char_O_deco_last_stop | 430 movff char_I_bottom_depth,char_O_deco_last_stop |
441 iorwf WREG ; deco_status=0 if decompression calculation done | 443 iorwf WREG ; deco_status=0 if decompression calculation done |
442 bnz simulator_calc_deco2 ; Not finished | 444 bnz simulator_calc_deco2 ; Not finished |
443 | 445 |
444 ; Finished | 446 ; Finished |
445 simulator_calc_deco3: | 447 simulator_calc_deco3: |
448 call deco_calc_CNS_planning ; Compute cNS after full ascent. | |
446 movff char_O_CNS_fraction,sim_CNS ; Save calculated CNS. | 449 movff char_O_CNS_fraction,sim_CNS ; Save calculated CNS. |
447 rcall simulator_restore_tissue_data ; Restore CNS & 32 floats "pre_tissue" from vault | 450 rcall simulator_restore_tissue_data ; Restore CNS & 32 floats "pre_tissue" from vault |
448 | 451 |
449 bcf simulatormode_active ; normal simulator mode | 452 bcf simulatormode_active ; normal simulator mode |
450 bcf standalone_simulator ; Standalone Simulator active | 453 bcf standalone_simulator ; Standalone Simulator active |
459 movff char_I_bottom_time,sim_btm_time ; Restore bottom time, | 462 movff char_I_bottom_time,sim_btm_time ; Restore bottom time, |
460 movff char_I_bottom_depth,sim_btm_depth ; and depth. | 463 movff char_I_bottom_depth,sim_btm_depth ; and depth. |
461 | 464 |
462 clrf timeout_counter2 ; Restart menu timeout. | 465 clrf timeout_counter2 ; Restart menu timeout. |
463 bra simulator_show_decoplan ; Done. | 466 bra simulator_show_decoplan ; Done. |
467 | |
468 ;============================================================================= | |
464 | 469 |
465 simulator_save_tissue_data: | 470 simulator_save_tissue_data: |
466 bsf restore_deco_data ; Set restore flag | 471 bsf restore_deco_data ; Set restore flag |
467 ostc_debug 'S' ; Sends debug-information to screen if debugmode active | 472 ostc_debug 'S' ; Sends debug-information to screen if debugmode active |
468 call deco_push_tissues_to_vault | 473 call deco_push_tissues_to_vault |
469 movlb 0x01 ; Back to RAM Bank1 | 474 movlb 0x01 ; Back to RAM Bank1 |
470 ostc_debug 'T' ; Sends debug-information to screen if debugmode active | 475 ostc_debug 'T' ; Sends debug-information to screen if debugmode active |
471 return | 476 return |
472 | 477 |
478 ;============================================================================= | |
479 | |
473 simulator_restore_tissue_data: | 480 simulator_restore_tissue_data: |
474 bcf restore_deco_data ; clear restore flag | 481 bcf restore_deco_data ; clear restore flag |
475 ostc_debug 'S' ; Sends debug-information to screen if debugmode active | 482 ostc_debug 'S' ; Sends debug-information to screen if debugmode active |
476 call deco_pull_tissues_from_vault ; Restore CNS too... | 483 call deco_pull_tissues_from_vault ; Restore CNS too... |
477 movlb 0x01 ; Back to RAM Bank1 | 484 movlb 0x01 ; Back to RAM Bank1 |