Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/math.asm @ 74:a1ccb92b59cd
1.72beta release
author | heinrichsweikamp |
---|---|
date | Mon, 15 Nov 2010 15:19:24 +0100 |
parents | 96a35aeda5f2 |
children | eff0da5cb975 |
comparison
equal
deleted
inserted
replaced
73:2227459e8ef2 | 74:a1ccb92b59cd |
---|---|
65 | 65 |
66 | 66 |
67 sub16: | 67 sub16: |
68 ; sub_c = sub_a - sub_b | 68 ; sub_c = sub_a - sub_b |
69 bcf neg_flag | 69 bcf neg_flag |
70 movf sub_b+0, w ; Get Value to be subtracted | 70 movf sub_b+0, W ; Get Value to be subtracted |
71 subwf sub_a+0, w ; Do the High Byte | 71 subwf sub_a+0, W ; Do the High Byte |
72 movwf sub_c+0 | 72 movwf sub_c+0 |
73 movf sub_b+1, w ; Get the Value to be Subbed | 73 movf sub_b+1, W ; Get the Value to be Subbed |
74 subwfb sub_a+1, w | 74 subwfb sub_a+1, W |
75 movwf sub_c+1 | 75 movwf sub_c+1 |
76 btfss STATUS,N | 76 btfsc STATUS,C |
77 return ; result positve | 77 return ; result positve |
78 ; sub_c = sub_a - sub_b | 78 ; sub_c = sub_a - sub_b |
79 bsf neg_flag ; result negative | 79 bsf neg_flag ; result negative |
80 movff sub_c+0,sub_b+0 | 80 movff sub_c+0,sub_b+0 |
81 movff sub_c+1,sub_b+1 | 81 movff sub_c+1,sub_b+1 |
82 setf sub_a | 82 setf sub_a |
83 setf sub_a+1 | 83 setf sub_a+1 |
84 movf sub_b+0, w ; Get Value to be subtracted | 84 movf sub_b+0, W ; Get Value to be subtracted |
85 subwf sub_a+0, w ; Do the High Byte | 85 subwf sub_a+0, W ; Do the High Byte |
86 movwf sub_c+0 | 86 movwf sub_c+0 |
87 movf sub_b+1, w ; Get the Value to be Subbed | 87 movf sub_b+1, W ; Get the Value to be Subbed |
88 subwfb sub_a+1, w | 88 subwfb sub_a+1, W |
89 movwf sub_c+1 | 89 movwf sub_c+1 |
90 return | 90 return |
91 | 91 |
92 | 92 |
93 mult16x16: | 93 mult16x16: |
270 subwf isr_sub_a+0, w ; Do the High Byte | 270 subwf isr_sub_a+0, w ; Do the High Byte |
271 movwf isr_sub_c+0 | 271 movwf isr_sub_c+0 |
272 movf isr_sub_b+1, w ; Get the Value to be Subbed | 272 movf isr_sub_b+1, w ; Get the Value to be Subbed |
273 subwfb isr_sub_a+1, w | 273 subwfb isr_sub_a+1, w |
274 movwf isr_sub_c+1 | 274 movwf isr_sub_c+1 |
275 btfss STATUS,N | 275 btfsc STATUS,C |
276 return ; result positve | 276 return ; result positve |
277 ; sub_c = sub_a - sub_b | 277 ; sub_c = sub_a - sub_b |
278 bsf neg_flag_isr ; result negative | 278 bsf neg_flag_isr ; result negative |
279 movff isr_sub_c+0,isr_sub_b+0 | 279 movff isr_sub_c+0,isr_sub_b+0 |
280 movff isr_sub_c+1,isr_sub_b+1 | 280 movff isr_sub_c+1,isr_sub_b+1 |