# HG changeset patch # User JeanDo # Date 1307484113 -7200 # Node ID d4ca9196e8305f45fa33df3c24a63cf01fc9f421 # Parent 91352bb698cfc4dfa9cc5c20f5558affb900eb70 Added 1/10/100 steps for CF menu. * Displays steps formated with type. * Special 0:01, 0:10, 1:00 steps for mm:ss type. * * * * * * diff -r 91352bb698cf -r d4ca9196e830 code_part1/OSTC_code_asm_part1/changelog.txt --- a/code_part1/OSTC_code_asm_part1/changelog.txt Tue Jun 07 19:10:49 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Wed Jun 08 00:01:53 2011 +0200 @@ -1,7 +1,9 @@ New in 1.91 beta: BETA Version - Do NOT use for diving! BUGFIX: Ignore depths>130m in PC simulation -BUGFIX: Avoid spurious CF55 stops with 3 gas or more. +BUGFIX: Avoid spurious CF55 stops with 3 gas or more +NEW: Allow -2:00 to +2:00 adjustement per day (CF48). +NEW: 1/10/100 steps in CF menu New in 1.90 Stable: Stable release diff -r 91352bb698cf -r d4ca9196e830 code_part1/OSTC_code_asm_part1/menu_custom.asm --- a/code_part1/OSTC_code_asm_part1/menu_custom.asm Tue Jun 07 19:10:49 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_custom.asm Wed Jun 08 00:01:53 2011 +0200 @@ -66,14 +66,20 @@ ; CF_INT15 EQU 0x80; Default display. Flag for 15bit, typeless values. -; Overlay our tmp data with some unused variables. But use more -; meaningfull labels... -#define cf32_x4 divemins+0 ; CF# modulus 32, time 4. -#define cf_type divemins+1 ; Type of the edited CF -#define cf_value divesecs -#define cf_min apnoe_mins -#define cf_max apnoe_secs - +;============================================================================= +; Overlay our tmp data in ACCESS0 bank + CBLOCK 0x010 ; Keep space for aa_wordprocessor module. + cf32_x4 ; CF# modulus 32, time 4. + cf_type ; Type of the edited CF + cf_default:2 + cf_value:2 + cf_min + cf_max + cf_step ; Value ad add/substract: 1, 10, 100 + ENDC + +;============================================================================= + GETCUSTOM8 macro custom8 movlw custom8 call getcustom8_1 @@ -164,7 +170,8 @@ clrf decodata+0 ; here: # of CustomFunction clrf cf32_x4 ; here: # of CustomFunction*4 bcf first_FA ; here: =1: -, =0: + - bcf second_FA ; here: =1: stepsize 1, =0: stepsize 10 + movlw 1 ; Stepsize: 1, 10, or 100. + movwf cf_step call PLED_topline_box WIN_INVERT .1 ; Init new Wordprocessor @@ -239,39 +246,42 @@ call word_processor WIN_TOP .95 - STRCPY "1/10: 1" - movlw '0' - btfsc second_FA - movwf POSTINC2 - STRCAT_PRINT " " + STRCPY "Step:" + clrf hi + movff cf_step,lo + call display_formated ; Typed display, w/o fill line. + STRCAT_PRINT " " ; 2 spaces for "0.01"->"1" menu_custom_functions10b: WIN_LEFT .20 WIN_TOP .125 lfsr FSR2,letter - OUTPUTTEXT d'89' ;"Default:" + OUTPUTTEXT d'89' ; "Default:" - call display_customfunction ; Typed display. + movff cf_default+0,lo + movff cf_default+1,hi + call display_customfunction ; Typed display. WIN_LEFT .20 WIN_TOP .155 lfsr FSR2,letter - OUTPUTTEXT d'97' ; "Current:" + OUTPUTTEXT d'97' ; "Current:" movf cf32_x4,W addlw 0x82 movwf EEADR call read_eeprom ; Lowbyte - movff EEDATA,lo - movff EEDATA, cf_value ; Backup low 8bit value. + movff EEDATA,cf_value+0 movf cf32_x4,W addlw 0x83 movwf EEADR call read_eeprom ; Highbyte - movff EEDATA,hi + movff EEDATA,cf_value+1 call PLED_standard_color ; Changed by color swatches, but trash EEADRH... + movff cf_value+0,lo + movff cf_value+1,hi call display_customfunction ; End of mask: min/max and the exit line... @@ -336,7 +346,7 @@ ; Read default value, type, and constraints ; ; Input: customfunction_page, cf32_x4 -; Output: hi:lo, cf_type, cf_min, cf_max. +; Output: cf_default, cf_type, cf_min, cf_max. ; Trashes: TBLPTR cf_read_default: @@ -356,12 +366,12 @@ addwfc TBLPTRH,F ; Propagate to 16bit (but not 24bits). tblrd*+ - movff TABLAT,lo ; Low byte --> lo + movff TABLAT,cf_default+0 ; Low byte tblrd*+ - movff TABLAT,hi ; High byte --> hi - btfss hi,7 ; 15bit ? - clrf hi ; NO: clear extra type flags - bcf hi,7 ; clear 15bit flag + movff TABLAT,cf_default+1 ; High byte + btfss cf_default+1,7 ; 15bit ? + clrf cf_default+1 ; NO: clear extra type flags + bcf cf_default+1,7 ; clear 15bit flag movff TABLAT,cf_type ; type (high byte) --> cf_type @@ -481,7 +491,7 @@ cf_max_unsigned: movf cf_value,W ; Retrieve current max bound subwf cf_max,W ; Compute (max-lo) - bc cf_max_passed ; Ok if no carry, ie. max <= lo + bc cf_max_passed ; Ok if no carry, ie. max <= lo cf_max_failed: call PLED_warnings_color @@ -598,8 +608,13 @@ cf_type_07: ; Type == 7 is CF_COLOR swatch. bcf leftbind ; Keep leading space (better alignement) output_8 + + movff win_top,WREG ; Is it the step value ? + xorlw .95 ; Line for "Step:" + btfsc STATUS,Z + retlw -1 ; YES : return + STRCAT_PRINT " " - movf lo,W ; Get color. call PLED_set_color movlw .23 @@ -686,7 +701,30 @@ ;----------------------------------------------------------------------------- toggle_oneorten: - btg second_FA + movlw .10 ; Multiply step by 10, + mulwf cf_step ; Result in PROD low. + + movf PRODH,W ; Check 1000 + bz toggle_oneorten_1 ; HIGH(new step) null == no overflow + movlw .1 ; Cycle to 1. + movwf cf_step + bra toggle_oneorten_3 + +toggle_oneorten_1: ; Special case for mm:ss + movf cf_type,W ; Get type + andlw CF_TYPES ; w/o min/max/neg flags. + xorlw CF_SEC ; Check for mm:ss ? + bnz toggle_oneorten_2 ; no: continue + movlw .100 ; Step = 100 ? + xorwf PRODL,W + bnz toggle_oneorten_2 ; no: continue + movlw .60 ; yes: replace by 1:00 + movff WREG,cf_step + bra toggle_oneorten_3 ; Done. + +toggle_oneorten_2: + movff PRODL,cf_step ; Just keep result. +toggle_oneorten_3: movlw d'3' movwf menupos bra menu_custom_functions1 ; also debounces switches @@ -694,17 +732,17 @@ ;----------------------------------------------------------------------------- restore_cfn_value: - rcall cf_read_default ; hi:lo is trashed by min/max display. - movf cf32_x4,W ; store default value addlw 0x82 movwf EEADR - movff lo,EEDATA + movff cf_default+0,EEDATA + movff cf_default+0,cf_value+0 call write_eeprom ; Lowbyte movf cf32_x4,W addlw 0x83 movwf EEADR - movff hi,EEDATA + movff cf_default+1,EEDATA + movff cf_default+1,cf_value+1 call write_eeprom ; Highbyte movlw d'4' @@ -733,9 +771,7 @@ bra adjust_cfn_value3 ; Store result adjust_cfn_value1: - movlw d'1' - btfsc second_FA ; -10? - movlw d'10' + movf cf_step,W ; 1, 10, 100 ? btfss first_FA ; Minus? bra adjust_cfn_value2 ; No, Plus @@ -833,7 +869,7 @@ ; Check one CF value --------------------------------------------------------- check_one_cf: - rcall cf_read_default ; Sets hi:lo, cf_type, cf_min, cf_max. + rcall cf_read_default ; Sets cf_value, cf_type, cf_min, cf_max. btfsc cf_type,7 ; A 15bit type ? bra check_cf_check ; Then we have to check it... @@ -887,7 +923,7 @@ ; Uses 16bit sub for checking signed min value. movff lo,sub_a+0 ; A <- value clrf sub_a+1 - btfsc cf_value,7 ; extend sign if value < 0 + btfsc lo,7 ; extend sign if value < 0 setf sub_a+1 movff cf_min,sub_b+0 ; B <- min (with signed extend) @@ -916,7 +952,7 @@ movff lo,sub_b+0 ; B <- value clrf sub_b+1 - btfsc cf_value,7 ; extend sign if value < 0 + btfsc lo,7 ; extend sign if value < 0 setf sub_b+1 call sub16 ; Compute (A-B)