comparison code_part1/OSTC_code_asm_part1/menu_custom.asm @ 99:39d325b2a5f9

FIX bad warning for 15bits CF values
author JeanDo
date Sun, 12 Dec 2010 16:47:32 +0100
parents dc349e4264bb
children db4a20b413df
comparison
equal deleted inserted replaced
98:6f8e3a08011e 99:39d325b2a5f9
1
2 ; OSTC - diving computer code 1 ; OSTC - diving computer code
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR 2 ; Copyright (C) 2008 HeinrichsWeikamp GbR
4 3
5 ; This program is free software: you can redistribute it and/or modify 4 ; This program is free software: you can redistribute it and/or modify
6 ; it under the terms of the GNU General Public License as published by 5 ; it under the terms of the GNU General Public License as published by
421 ;----------------------------------------------------------------------------- 420 ;-----------------------------------------------------------------------------
422 ; Display optional min/max values. 421 ; Display optional min/max values.
423 ; Inputs: cf_value, cf_min, cf_max (and cf_type to display min/max). 422 ; Inputs: cf_value, cf_min, cf_max (and cf_type to display min/max).
424 ; Trashed: hi:lo while display min and max values. 423 ; Trashed: hi:lo while display min and max values.
425 display_minmax: 424 display_minmax:
425 ; Min/max unsupported for 15bit values yet...
426 btfsc cf_type,7 ; A 15bit value ?
427 return
428
426 movff EEADRH, FSR1H ; Backup... 429 movff EEADRH, FSR1H ; Backup...
427 430
428 ; Display min line 431 ; Display min line
429 WIN_TOP .65 432 WIN_TOP .65
430 WIN_LEFT .100 433 WIN_LEFT .100
754 ; Output: Pop warning with the first CF number if bad. 757 ; Output: Pop warning with the first CF number if bad.
755 ; cf_checker_counter incremented. 758 ; cf_checker_counter incremented.
756 ; Trashes: TBLPTR, EEADR, PROD 759 ; Trashes: TBLPTR, EEADR, PROD
757 760
758 check_customfunctions: 761 check_customfunctions:
762 ; rcall check_next_cf ; Check 5 at a time...
763 ; rcall check_next_cf
764 ; rcall check_next_cf
765 ; rcall check_next_cf
766 ;
767 ;check_next_cf:
768
759 movf cf_checker_counter,W ; Get current CF to ckeck 769 movf cf_checker_counter,W ; Get current CF to ckeck
760 770
761 ; Setup cf32_x4 and cf page bit: 771 ; Setup cf32_x4 and cf page bit:
762 rlcf WREG ; x4 772 rlcf WREG ; x4
763 rlcf WREG 773 rlcf WREG
803 movwf TABLAT ; saved to return error, if any. 813 movwf TABLAT ; saved to return error, if any.
804 814
805 btfss cf_type,7 ; 15 or 8 bit value ? 815 btfss cf_type,7 ; 15 or 8 bit value ?
806 bra cf_check_8bit 816 bra cf_check_8bit
807 817
808 ; Do a 15bit check 818 ; Implement the 15bit check, even if not displayed...
809 rcall getcustom15_1 ; Read into hi:lo 819 rcall getcustom15_1 ; Read into hi:lo
810 820
811 movf cf_min,W ; Compute (bound-value) -> hi:lo 821 movf cf_min,W ; Compute (bound-value) -> hi:lo
812 subwf lo,F 822 subwf lo,F
813 movf cf_max,W 823 movf cf_max,W
824 bcf WREG,7 ; Clear min or max bit
814 subwfb hi,F 825 subwfb hi,F
815 826
816 movf lo,W ; Is it a 0 result ? 827 movf lo,W ; Is it a 0 result ?
817 iorwf hi,W 828 iorwf hi,W
818 bnz cf_15_not_equal ; NO: check sign. 829 bnz cf_15_not_equal ; NO: check sign.
819 retlw -1 ; YES: then it is ok. 830 retlw -1 ; YES: then it is ok.
820 831
821 cf_15_not_equal: 832 cf_15_not_equal:
822 btfss cf_type,CF_MIN_BIT ; Checking min or max ? 833 btfss cf_max,7 ; Checking min or max ?
823 btg hi,6 ; exchange wanted sign 834 btg hi,6 ; exchange wanted sign
824 835
825 setf WREG ; -1 for return w/o error 836 setf WREG ; -1 for return w/o error
826 btfss hi,6 ; Is sign correct ? 837 btfss hi,6 ; Is sign correct ?
827 movf TABLAT,W ; NO: get back failed CF number 838 movf TABLAT,W ; NO: get back failed CF number