Mercurial > public > hwos_code
comparison src/options.asm @ 628:cd58f7fc86db
3.05 stable work
author | heinrichsweikamp |
---|---|
date | Thu, 19 Sep 2019 12:01:29 +0200 |
parents | c40025d8e750 |
children | 185ba2f91f59 |
comparison
equal
deleted
inserted
replaced
627:bf5fee575701 | 628:cd58f7fc86db |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File options.asm next combined generation V3.03-1 | 3 ; File options.asm next combined generation V3.04.3 |
4 ; | 4 ; |
5 ; Manage all options data. | 5 ; Manage all options data. |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
101 option_check_all_3: | 101 option_check_all_3: |
102 bsf is_diluent_menu ; setup checking diluents | 102 bsf is_diluent_menu ; setup checking diluents |
103 call gaslist_cleanup_list ; check and correct multiple or none First diluent | 103 call gaslist_cleanup_list ; check and correct multiple or none First diluent |
104 bcf is_diluent_menu ; setup checking gases | 104 bcf is_diluent_menu ; setup checking gases |
105 call gaslist_cleanup_list ; check and correct multiple or none First gas | 105 call gaslist_cleanup_list ; check and correct multiple or none First gas |
106 IFNDEF _gauge_mode | |
107 call option_cleanup_gauge ; check and correct Gauge mode | |
108 ENDIF | |
106 IFDEF _ccr_pscr | 109 IFDEF _ccr_pscr |
107 call option_cleanup_oCCRMode ; check and correct CCR / pSCR mode | 110 call option_cleanup_oCCRMode ; check and correct CCR / pSCR mode |
108 ENDIF | 111 ENDIF |
109 call option_cleanup_GF ; check and correct GFlow <= GFhigh | 112 call option_cleanup_GF ; check and correct GFlow <= GFhigh |
110 return ; all done | 113 return ; all done |
225 ;============================================================================= | 228 ;============================================================================= |
226 ; Save all options to EEPROM | 229 ; Save all options to EEPROM |
227 ; | 230 ; |
228 global option_save_all ; save options to EEPROM | 231 global option_save_all ; save options to EEPROM |
229 option_save_all: | 232 option_save_all: |
233 bcf PIR3,RC2IE | |
230 ;---- Save option serial into EEPROM to detect reset and new version | 234 ;---- Save option serial into EEPROM to detect reset and new version |
231 movlw LOW(eeprom_serial_save) | 235 movlw LOW(eeprom_serial_save) |
232 movwf EEADR | 236 movwf EEADR |
233 movlw HIGH(eeprom_serial_save) | 237 movlw HIGH(eeprom_serial_save) |
234 movwf EEADRH | 238 movwf EEADRH |
251 cpfseq FSR0L | 255 cpfseq FSR0L |
252 bra option_save_all_2 ; not yet done... | 256 bra option_save_all_2 ; not yet done... |
253 movlw HIGH(option_table_end) | 257 movlw HIGH(option_table_end) |
254 cpfseq FSR0H | 258 cpfseq FSR0H |
255 bra option_save_all_2 ; not yet done... | 259 bra option_save_all_2 ; not yet done... |
260 bsf PIR3,RC2IE | |
256 return ; all done | 261 return ; all done |
257 option_save_all_2: | 262 option_save_all_2: |
258 rcall option_save ; save one option... | 263 rcall option_save ; save one option... |
259 bra option_save_all_1 ; ...and loop | 264 bra option_save_all_1 ; ...and loop |
260 | 265 |
478 movf INDF1,W ; YES - get option value: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR | 483 movf INDF1,W ; YES - get option value: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR |
479 xorlw .1 ; in CCR mode? | 484 xorlw .1 ; in CCR mode? |
480 bnz option_inc_enum8_3a ; NO - in some other mode | 485 bnz option_inc_enum8_3a ; NO - in some other mode |
481 IFNDEF _ccr_pscr | 486 IFNDEF _ccr_pscr |
482 incf INDF1,f ; YES - no CCR mode compiled in, advance to gauge mode | 487 incf INDF1,f ; YES - no CCR mode compiled in, advance to gauge mode |
483 bra option_inc_enum8_3_exit ; - done | 488 bra option_inc_enum8_3a ; - check if gauge mode is available |
484 ENDIF ; _ccr_pscr | 489 ENDIF ; _ccr_pscr |
485 IFDEF _rx_functions | 490 IFDEF _rx_functions |
486 global option_cleanup_oTrMode_CCR ; embedded clean-up entry-point | 491 global option_cleanup_oTrMode_CCR ; embedded clean-up entry-point |
487 option_cleanup_oTrMode_CCR: ; entry point from cleanup during restart | 492 option_cleanup_oTrMode_CCR: ; entry point from cleanup during restart |
488 movff opt_TR_mode,WREG ; get TR mode | 493 movff opt_TR_mode,WREG ; get TR mode |
489 xorlw .2 ; mode = 2 (ind.double)? | 494 xorlw .2 ; mode = 2 (ind.double)? |
490 bnz option_inc_enum8_3_exit ; NO - done | 495 bnz option_inc_enum8_3_exit ; NO - done |
491 bra option_inc_enum8_3_reset ; YES - revert mode to 1 (on) | 496 bra option_inc_enum8_3_reset ; YES - revert mode to 1 (on) |
492 ENDIF ; _rx_functions | 497 ENDIF ; _rx_functions |
493 option_inc_enum8_3a: ; any mode other than CCR | 498 option_inc_enum8_3a: ; any mode other than CCR |
499 IFNDEF _gauge_mode | |
500 movf INDF1,W ; get option value: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR | |
501 xorlw .2 ; in Gauge mode? | |
502 bnz option_inc_enum8_3b ; NO - in some other mode | |
503 incf INDF1,f ; YES - no Gauge mode compiled in, advance to Apnea mode | |
504 bra option_inc_enum8_3_exit ; - done (Apnea mode is always available) | |
505 ENDIF ; _gauge_mode | |
506 option_inc_enum8_3b: | |
494 IFNDEF _ccr_pscr | 507 IFNDEF _ccr_pscr |
495 movf INDF1,W ; get option value: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR | 508 movf INDF1,W ; get option value: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR |
496 xorlw .4 ; in pSCR mode? | 509 xorlw .4 ; in pSCR mode? |
497 bnz option_inc_enum8_3b ; NO - in some other mode | 510 bnz option_inc_enum8_3c ; NO - in some other mode |
498 clrf INDF1 ; YES - no pSCR mode compiled in, advance to 0 "OC" | 511 clrf INDF1 ; YES - no pSCR mode compiled in, advance to 0 "OC" |
499 bra option_inc_enum8_3_exit ; - done | 512 bra option_inc_enum8_3_exit ; - done |
500 ENDIF ; _ccr_pscr | 513 ENDIF ; _ccr_pscr |
501 option_inc_enum8_3b: | 514 option_inc_enum8_3c: |
502 global option_cleanup_oTrMode_no_CCR ; embedded clean-up entry-point | 515 global option_cleanup_oTrMode_no_CCR ; embedded clean-up entry-point |
503 option_cleanup_oTrMode_no_CCR: ; entry point from cleanup during restart | 516 option_cleanup_oTrMode_no_CCR: ; entry point from cleanup during restart |
504 movff opt_TR_mode,WREG ; get TR mode | 517 movff opt_TR_mode,WREG ; get TR mode |
505 xorlw .3 ; mode = 3 (CCR Dil+O2)? | 518 xorlw .3 ; mode = 3 (CCR Dil+O2)? |
506 bnz option_inc_enum8_3_exit ; NO - done | 519 bnz option_inc_enum8_3_exit ; NO - done |
507 option_inc_enum8_3_reset: ; YES - revert to mode 1 (on) | 520 option_inc_enum8_3_reset: ; YES - revert to mode 1 (on) |
508 movlw .1 ; load coding of mode "on" | 521 movlw .1 ; load coding of mode "on" |
509 movff WREG,opt_TR_mode ; write to option | 522 movff WREG,opt_TR_mode ; write to option |
510 option_inc_enum8_3_exit: | 523 option_inc_enum8_3_exit: |
511 return ; done | 524 return ; done |
525 | |
512 option_inc_enum8_4: | 526 option_inc_enum8_4: |
513 IFDEF _rx_functions | 527 IFDEF _rx_functions |
514 ; Now some rather crude hack to advance opt_TR_mode in dependency of opt_dive_mode | 528 ; Now some rather crude hack to advance opt_TR_mode in dependency of opt_dive_mode |
515 movlw .222 ; EEPROM address of option opt_TR_mode | 529 movlw .222 ; EEPROM address of option opt_TR_mode |
516 cpfseq opt_eeprom ; editing opt_TR_mode right now? | 530 cpfseq opt_eeprom ; editing opt_TR_mode right now? |
535 return | 549 return |
536 | 550 |
537 | 551 |
538 option_inc_string: ; no editing available | 552 option_inc_string: ; no editing available |
539 return | 553 return |
554 | |
555 | |
556 IFNDEF _gauge_mode | |
557 option_cleanup_gauge: | |
558 movff opt_dive_mode,WREG ; get dive mode into WREG (0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR) | |
559 xorlw .2 ; in Gauge mode? | |
560 bnz option_cleanup_gauge_1 ; NO - done | |
561 banksel opt_dive_mode ; YES - setting not allowed, select options bank | |
562 clrf opt_dive_mode ; - reset to OC mode | |
563 banksel common ; - back to bank common | |
564 option_cleanup_gauge_1: | |
565 return ; done | |
566 ENDIF | |
540 | 567 |
541 | 568 |
542 IFDEF _ccr_pscr | 569 IFDEF _ccr_pscr |
543 global option_cleanup_oCCRMode | 570 global option_cleanup_oCCRMode |
544 global option_cleanup_oCCRMode_pSCR | 571 global option_cleanup_oCCRMode_pSCR |
663 goto strcat_text | 690 goto strcat_text |
664 | 691 |
665 | 692 |
666 ;---- Draw an enumerated value (set of translated strings) | 693 ;---- Draw an enumerated value (set of translated strings) |
667 option_draw_enum8: | 694 option_draw_enum8: |
668 movf INDF1,W ; get current value | 695 movff INDF1,lo ; memorize current value |
669 cpfsgt opt_max ; bound value | 696 movf INDF1,W ; copy current value to WREG |
670 clrf WREG | 697 cpfsgt opt_max ; max value (= highest usable value + 1) > current value? |
671 addwf WREG ; *= 2 | 698 clrf WREG ; NO - to avoid printing rubbish, reset to first value |
672 addwf opt_inc,W ; base text + 2 * value | 699 addwf WREG ; current value *= 2 |
673 movwf FSR1L | 700 addwf opt_inc,W ; base text + 2 * current value |
674 movlw .0 | 701 movwf FSR1L ; load FSR0 |
675 addwfc opt_min,W ; propagate carry... | 702 movlw .0 ; propagate carry... |
703 addwfc opt_min,W ; ... | |
676 movwf FSR1H ; ...into FSR1 | 704 movwf FSR1H ; ...into FSR1 |
677 goto strcat_text | 705 call strcat_text ; print text |
706 movf opt_default,W ; get default value | |
707 cpfseq lo ; compare with memorized current value, equal? | |
708 bra option_draw_enum8_1 ; NO - not default, add * | |
709 return ; YES - default, done | |
710 option_draw_enum8_1: | |
711 PUTC "*" ; print "*" | |
712 return ; done | |
713 | |
678 | 714 |
679 ;----------------------------------------------------------------------------- | 715 ;----------------------------------------------------------------------------- |
680 | 716 |
681 END | 717 END |