comparison code_part1/OSTC_code_asm_part1/math.asm @ 544:56da3e962e98

show start of dive in internal logbook (for dives made with logbook version 0x21 or later)
author heinrichsweikamp
date Sat, 14 Jan 2012 22:06:28 +0100
parents 7779bfa89171
children 44e9b961f156
comparison
equal deleted inserted replaced
543:0def530863c2 544:56da3e962e98
42 rrcf divA 42 rrcf divA
43 decfsz divB 43 decfsz divB
44 bra div16 44 bra div16
45 return 45 return
46 46
47 sub16: 47 sub16: ; sub_c = sub_a - sub_b (with signed values)
48 ; sub_c = sub_a - sub_b (with signed values)
49 bcf neg_flag 48 bcf neg_flag
50 movf sub_b+0, W ; Get Value to be subtracted 49 movf sub_b+0, W ; Get Value to be subtracted
51 subwf sub_a+0, W ; Do the High Byte 50 subwf sub_a+0, W ; Do the High Byte
52 movwf sub_c+0 51 movwf sub_c+0
53 movf sub_b+1, W ; Get the Value to be Subbed 52 movf sub_b+1, W ; Get the Value to be Subbed
64 btfsc STATUS,C ; Carry to propagate ? 63 btfsc STATUS,C ; Carry to propagate ?
65 incf sub_c+1,F ; YES: do it. 64 incf sub_c+1,F ; YES: do it.
66 65
67 return 66 return
68 67
69 subU16: 68 subU16: ; sub_c = sub_a - sub_b (with UNSIGNED values)
70 ; sub_c = sub_a - sub_b (with UNSIGNED values)
71 bcf neg_flag 69 bcf neg_flag
72 movf sub_b+0, W ; Get Value to be subtracted 70 movf sub_b+0, W ; Get Value to be subtracted
73 subwf sub_a+0, W ; Do the High Byte 71 subwf sub_a+0, W ; Do the High Byte
74 movwf sub_c+0 72 movwf sub_c+0
75 movf sub_b+1, W ; Get the Value to be Subbed 73 movf sub_b+1, W ; Get the Value to be Subbed