Mercurial > public > mk2
diff code_part1/OSTC_code_asm_part1/math.asm @ 476:7779bfa89171
Cave bailout prediction.
author | JeanDo |
---|---|
date | Sun, 09 Oct 2011 23:37:59 +0200 |
parents | 07f5b0baaa57 |
children | 56da3e962e98 |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/math.asm Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/math.asm Sun Oct 09 23:37:59 2011 +0200 @@ -88,6 +88,8 @@ return +;============================================================================= + mult16x16: ;xA*xB=xC clrf xC+2 ; Clear the High-Order Bits clrf xC+3 @@ -119,6 +121,7 @@ addwfc xC+3, f return +;============================================================================= div16x16: ;xA/xB=xC with xA as remainder ;uses divB as temp variable @@ -177,6 +180,8 @@ bra div16x16_2 ; Next bit. +;============================================================================= + div32x16: ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder ; Setup movlw .32 ; setup shift counter @@ -206,12 +211,12 @@ movf xB+1,W subwf sub_b+1,W ; check if a>d btfss STATUS,Z - goto div32x16_3 + bra div32x16_3 movf xB+0,W subwf sub_b+0,W ; if msb equal then check lsb div32x16_3 btfss STATUS,C ; carry set if d>a - goto div32x16_4 + bra div32x16_4 movf xB+0,W ; d-a into d subwf sub_b+0,F btfss STATUS,C @@ -225,7 +230,7 @@ rlcf xC+2,F rlcf xC+3,F decfsz divB,F ; loop until all bits checked - goto div32x16_2 + bra div32x16_2 return ;=============================================================================