Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 35:d4f0c097a7fa
preparations for new gaslist
author | heinrichsweikamp |
---|---|
date | Tue, 25 May 2010 21:42:23 +0200 |
parents | 6e5db85382a2 |
children | 8ece4837a642 |
comparison
equal
deleted
inserted
replaced
34:5dbdc08e5460 | 35:d4f0c097a7fa |
---|---|
360 read_int_eeprom d'31' ; read gas_change_depth Gas1 | 360 read_int_eeprom d'31' ; read gas_change_depth Gas1 |
361 movlw d'0' | 361 movlw d'0' |
362 btfsc hi,4 ; Skip if clear -> Skip if inactive | 362 btfsc hi,4 ; Skip if clear -> Skip if inactive |
363 movf EEDATA,W | 363 movf EEDATA,W |
364 movff WREG,char_I_deco_gas_change2 | 364 movff WREG,char_I_deco_gas_change2 |
365 | |
366 return | 365 return |
367 | 366 |
368 copy_decogas_info: | 367 copy_decogas_info: |
369 movf hi,W ; Gas 1-4 | 368 movf hi,W ; Gas 1-4 |
370 mullw d'4' ; times 4... | 369 mullw d'4' ; times 4... |
387 subfwb wait_temp,W ; minus He | 386 subfwb wait_temp,W ; minus He |
388 subfwb EEDATA,F ; minus O2 | 387 subfwb EEDATA,F ; minus O2 |
389 movff EEDATA, POSTDEC1 ; = N2! | 388 movff EEDATA, POSTDEC1 ; = N2! |
390 return | 389 return |
391 | 390 |
392 ;; 1. Find active gas with deepest change depth < current depth | |
393 ;; 2. Set Decogas | |
394 ; | |
395 ; movff rel_pressure+0,xA+0 | |
396 ; movff rel_pressure+1,xA+1 | |
397 ; movlw d'100' | |
398 ; movwf xB+0 | |
399 ; clrf xB+1 | |
400 ; call div16x16 ; compute depth in full m -> result in xC+0 | |
401 ; clrf lo ; clear depth for comparison | |
402 ; | |
403 ;; check gas1 | |
404 ; read_int_eeprom d'27' ; read flag register | |
405 ; btfss EEDATA,0 ; check active flag | |
406 ; bra check_decogas2 ; skip inactive gases! | |
407 ; read_int_eeprom d'28' ; read gas_change_depth | |
408 ; movf xC+0,W ; load depth in m into WREG | |
409 ; cpfslt EEDATA ; gas_change_depth > current depth? | |
410 ; bra check_decogas2 ; W < EEDATA -> current depth lower then gas_change_depth | |
411 ; | |
412 ; movff EEDATA,lo ; deepest gas_change_depth in lo | |
413 ; movlw d'1' | |
414 ; movwf hi ; Decogas # in hi (1-5) | |
415 ; | |
416 ;check_decogas2: | |
417 ; read_int_eeprom d'27' ; read flag register | |
418 ; btfss EEDATA,1 ; check active flag | |
419 ; bra check_decogas3 ; skip inactive gases! | |
420 ; read_int_eeprom d'29' ; read gas_change_depth | |
421 ; movf xC+0,W ; load depth in m into WREG | |
422 ; cpfslt EEDATA ; gas_change_depth > current depth? | |
423 ; bra check_decogas3 ; W < EEDATA -> current depth lower then gas_change_depth | |
424 ; | |
425 ; read_int_eeprom d'29' ; read gas_change_depth | |
426 ; movf lo,W ; load current gas_change_depth into WREG | |
427 ; cpfsgt EEDATA ; last gas_change_depth > current gas_change_depth ? | |
428 ; bra check_decogas3 ; W < lo -> last gas_change_depth > current gas_change_depth | |
429 ; movff EEDATA,lo ; deepest gas_change_depth in lo | |
430 ; movlw d'2' | |
431 ; movwf hi ; Decogas # in hi (1-5) | |
432 ; | |
433 ;check_decogas3: | |
434 ; read_int_eeprom d'27' ; read flag register | |
435 ; btfss EEDATA,2 ; check active flag | |
436 ; bra check_decogas4 ; skip inactive gases! | |
437 ; read_int_eeprom d'30' ; read gas_change_depth | |
438 ; movf xC+0,W ; load depth in m into WREG | |
439 ; cpfslt EEDATA ; gas_change_depth > current depth? | |
440 ; bra check_decogas4 ; W < EEDATA -> current depth lower then gas_change_depth | |
441 ; | |
442 ; read_int_eeprom d'30' ; read gas_change_depth | |
443 ; movf lo,W ; load current gas_change_depth into WREG | |
444 ; cpfsgt EEDATA ; last gas_change_depth > current gas_change_depth ? | |
445 ; bra check_decogas4 ; W < lo -> last gas_change_depth > current gas_change_depth | |
446 ; movff EEDATA,lo ; deepest gas_change_depth in lo | |
447 ; movlw d'3' | |
448 ; movwf hi ; Decogas # in hi (1-5) | |
449 ; | |
450 ;check_decogas4: | |
451 ; read_int_eeprom d'27' ; read flag register | |
452 ; btfss EEDATA,3 ; check active flag | |
453 ; bra check_decogas5 ; skip inactive gases! | |
454 ; read_int_eeprom d'31' ; read gas_change_depth | |
455 ; movf xC+0,W ; load depth in m into WREG | |
456 ; cpfslt EEDATA ; gas_change_depth > current depth? | |
457 ; bra check_decogas5 ; W < EEDATA -> current depth lower then gas_change_depth | |
458 ; | |
459 ; read_int_eeprom d'31' ; read gas_change_depth | |
460 ; movf lo,W ; load current gas_change_depth into WREG | |
461 ; cpfsgt EEDATA ; last gas_change_depth > current gas_change_depth ? | |
462 ; bra check_decogas5 ; W < lo -> last gas_change_depth > current gas_change_depth | |
463 ; movff EEDATA,lo ; deepest gas_change_depth in lo | |
464 ; movlw d'4' | |
465 ; movwf hi ; Decogas # in hi (1-5) | |
466 ; | |
467 ;check_decogas5: | |
468 ; read_int_eeprom d'27' ; read flag register | |
469 ; btfss EEDATA,4 ; check active flag | |
470 ; bra check_decogas_done ; skip inactive gases! | |
471 ; read_int_eeprom d'32' ; read gas_change_depth | |
472 ; movf xC+0,W ; load depth in m into WREG | |
473 ; cpfslt EEDATA ; gas_change_depth > current depth? | |
474 ; bra check_decogas_done ; W < EEDATA -> current depth lower then gas_change_depth | |
475 ; | |
476 ; read_int_eeprom d'32' ; read gas_change_depth | |
477 ; movf lo,W ; load current gas_change_depth into WREG | |
478 ; cpfsgt EEDATA ; last gas_change_depth > current gas_change_depth ? | |
479 ; bra check_decogas_done ; W < lo -> last gas_change_depth > current gas_change_depth | |
480 ; movff EEDATA,lo ; deepest gas_change_depth in lo | |
481 ; movlw d'5' | |
482 ; movwf hi ; Decogas # in hi (1-5) | |
483 ; | |
484 ;check_decogas_done: | |
485 ; ostc_debug 'E' ; Sends debug-information to screen if debugmode active | |
486 ; | |
487 ; decf hi,F ; Gas 0-4 | |
488 ; movff lo, char_I_deco_gas_change ; copy change_depth | |
489 ; | |
490 ; movf hi,W ; Gas 0-4 | |
491 ; mullw d'4' | |
492 ; movf PRODL,W | |
493 ; addlw d'7' ; = address for He ratio | |
494 ; movwf EEADR | |
495 ; call read_eeprom ; Read He ratio | |
496 ; movff EEDATA,char_I_deco_He_ratio ; And copy into hold register | |
497 ; | |
498 ; | |
499 ; movf hi,W ; Gas 0-4 | |
500 ; mullw d'4' | |
501 ; movf PRODL,W | |
502 ; addlw d'6' ; = address for O2 ratio | |
503 ; movwf EEADR | |
504 ; call read_eeprom ; Read O2 ratio | |
505 ; | |
506 ; movff char_I_deco_He_ratio, wait_temp ; copy into bank1 register | |
507 ; bsf STATUS,C ; Borrow bit | |
508 ; movlw d'100' ; 100% | |
509 ; subfwb wait_temp,W ; minus He | |
510 ; bsf STATUS,C ; Borrow bit | |
511 ; subfwb EEDATA,F ; minus O2 | |
512 ; movff EEDATA, char_I_deco_N2_ratio ; = N2! | |
513 ; bra skip_decompression_gases | |
514 ; | |
515 reset_decompression_gases: ; reset the deco gas while in NDL | 391 reset_decompression_gases: ; reset the deco gas while in NDL |
516 ostc_debug 'F' ; Sends debug-information to screen if debugmode active | 392 ostc_debug 'F' ; Sends debug-information to screen if debugmode active |
517 clrf lo | 393 clrf lo |
518 movff lo, char_I_deco_gas_change ; clear | 394 movff lo, char_I_deco_gas_change ; clear |
519 movff lo, char_I_deco_N2_ratio ; clear | 395 movff lo, char_I_deco_N2_ratio ; clear |
520 movff lo, char_I_deco_He_ratio ; clear | 396 movff lo, char_I_deco_He_ratio ; clear |
521 skip_decompression_gases: | |
522 ;call PLED_gaschange_DEBUG | 397 ;call PLED_gaschange_DEBUG |
523 return | 398 return |
524 | 399 |
525 calc_deko_divemode2: | 400 calc_deko_divemode2: |
526 bcf twosecupdate | 401 bcf twosecupdate |