from Anonymous Author
;As a thank you for all the code, here is a 32x16 bit Mult. ;Unsigned 32 bit by 16 bit multiplication ;This routine will take a4:a3:a2:a1*b2:b1 -> a6:a5:a4:a3:a2:a1 mult_32_16: banksel EECON1 ; Begin rearrange code nop movf a4,w movwf a6 movf a3,w movwf a5 movf a2,w movwf a4 movf a1,w movwf a3 ; End rearrange code CLRF a2 ; clear partial product CLRF a1 MOVF a6,W MOVWF c4 MOVF a5,W MOVWF c3 MOVF a4,W MOVWF c2 MOVF a3,W MOVWF c1 MOVLW 0x08 MOVWF bitcnt LOOPUM3216A: RRF b1, F BTFSC STATUS, C GOTO ALUM3216NAP DECFSZ bitcnt, F GOTO LOOPUM3216A MOVWF bitcnt LOOPUM3216B: RRF b2, F BTFSC STATUS, C GOTO BLUM3216NAP DECFSZ bitcnt, F GOTO LOOPUM3216B CLRF a6 CLRF a5 CLRF a4 CLRF a3 RETLW 0x00 BLUM3216NAP: BCF STATUS, C GOTO BLUM3216NA ALUM3216NAP: BCF STATUS, C GOTO ALUM3216NA ALOOPUM3216: RRF b1, F BTFSS STATUS, C GOTO ALUM3216NA MOVF c1,W ADDWF a3, F MOVF c2,W BTFSC STATUS, C INCFSZ c2,W ADDWF a4, F MOVF c3,W BTFSC STATUS, C INCFSZ c3,W ADDWF a5, F MOVF c4,W BTFSC STATUS, C INCFSZ c4,W ADDWF a6, F ALUM3216NA: RRF a6, F RRF a5, F RRF a4, F RRF a3, F RRF a2, F DECFSZ bitcnt, f GOTO ALOOPUM3216 MOVLW 0x08 MOVWF bitcnt BLOOPUM3216: RRF b2, F BTFSS STATUS, C GOTO BLUM3216NA MOVF c1,W ADDWF a3, F MOVF c2,W BTFSC STATUS, C INCFSZ c2,W ADDWF a4, F MOVF c3,W BTFSC STATUS, C INCFSZ c3,W ADDWF a5, F MOVF c4,W BTFSC STATUS, C INCFSZ c4,W ADDWF a6, F BLUM3216NA RRF a6, F RRF a5, F RRF a4, F RRF a3, F RRF a2, F RRF a1, F DECFSZ bitcnt, F GOTO BLOOPUM3216 nop return
file: /Techref/microchip/math/mul/32x16-a.htm, 3KB, , updated: 2010/3/30 07:19, local time: 2024/11/8 14:32,
3.135.190.224:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/microchip/math/mul/32x16-a.htm"> PIC Microcontoller Math Method 32x16 multiplication </A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.