LIST P = 16C54, n = 66 ; ;******************************************************************* ; 8x8 Software Multiplier ; ( Fast Version : Straight Line Code ) ;******************************************************************* ; ; The 16 bit result is stored in 2 bytes ; ; Before calling the subroutine " mpy ", the multiplier should ; be loaded in location " mulplr ", and the multiplicand in ; " mulcnd " . The 16 bit result is stored in locations ; H_byte & L_byte. ; ; Performance : ; Program Memory : 35 locations ; # of cycles : 37 ; Scratch RAM : 0 locations ; ; ; Program: MULT8x8F.ASM ; Revision Date: ; 1-13-97 Compatibility with MPASMWIN 1.40 ; ; This routine is optimized for speed efficiency ( straight line code ) ; For code efficiency, refer to "mult8x8S.asm" ( looped code ) ;******************************************************************* ; mulcnd equ 09 ; 8 bit multiplicand mulplr equ 10 ; 8 bit multiplier H_byte equ 12 ; High byte of the 16 bit result L_byte equ 13 ; Low byte of the 16 bit result ; ; include "p16c5x.inc" Same equ 1 ; ;**** Define a macro for adding & right shifting ** ; mult MACRO bit ; Begin macro snb mulplr.bit add H_byte, W rr H_byte rr L_byte ENDM ; End of macro ; ; ***************************** Begin Multiplier Routine mpy_F clr H_byte clr L_byte mov W, mulcnd ; move the multiplicand to W reg. clrb C ; Clear the carry bit in the status Reg. mult 0 mult 1 mult 2 mult 3 mult 4 mult 5 mult 6 mult 7 ; retw #0 ; ;******************************************************************** ; Test Program ;********************************************************************* main mov W, #0FF mov mulplr, W ; multiplier (in mulplr) = 0FF mov W, #0FF mov mulcnd, W ; multiplicand(in mulcnd ) = 0FF ; call mpy_F ; The result 0FF*0FF = FE01 is in locations ; ; H_byte & L_byte ; self jmp self ; org 01FF jmp main ; END
file: /Techref/scenix/lib/math/mul/8x8u_sx.htm, 2KB, , updated: 2004/6/10 13:40, local time: 2024/12/28 11:52,
3.133.155.48:LOG IN
|
©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://sxlist.com/Techref/scenix/lib/math/mul/8x8u_sx.htm"> PIC Microcontroller Math Method Multiply 8 x 8 bits</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.