I am writing a beautiful basic program in the PIC18 assembly. This requires that I write substrateine to multiply two 16-bit numbers. This is what I still have:
; **************************************************************************************************** ************* ********************************************************************* **************************************************************************************************** ******* Mul_16bit: The substrin that multiplies in two 16-bit numbers; Address mul_16ptr1, mul_16ptr1 + 1 and mul_16ptr2, mul_16ptr2 + 1and; 32-bit results in addresses return mul_16res1 + 3 mul_16res1; ********************************************************************************************** ********************* mul_16bit: MOVF mul_16ptr2, W, by less bytes mulwf mul_16ptr1, W Molfif Prodah, Mulaisirs + 1 Muff Prodl, Mul_l6res Momfil Mul_l6ptr2 + 1, W; Times the upper bytes Mulvf Muli_l6 ptr1 + 1, W Mugf Prodah, Muli_l6 + 3 Muff Prodel, Muli_l6res + 2 Movie Muyul_l6 ptr2, W; Number 2 less byte number 2 mulwf mul_16ptr1 +1, W; And the upper byte of number 1 MOVF PRODL, addwf mul_16res W + 1, F MOVF PRODH, W addwfc mul_16res + 2, F movlw 0; Carrie addwfc adding mul_16res + 3, F MOVF mul_16ptr2 + 1, W, multiplied by byte; Number 1 and mulwf mul_16ptr1, W less; NUM2 byte MOVF PRODL, W ... MOVF PRODH, W; Addwf mul_16res + 1, F mul_16res add results for ... addwfc mul_16res + 2, f, ... movlw 0; Add Carrie addwfc mul_16res + 3, F return
is
The way I wrote that this mentioned in the first note recorded in 4 registers them and stores the stored number multiplied Comment . It is well if it works I only once or twice need to multiply this, that I can say something just like:
mul_16ptr1 0x45 mul_16ptr2 set 0x47 mul_16res 0x50 Call Set To multiply set mul_16bit
0x45
and0x47
and store it in0x50
. The problem is that when I have to call different numbers on different numbers, because the assembler will not let me set the "hint" twice. I've tried using indirect access (ie LFSR1, LFSR2, and using LFSR0 Multiplicands and results to the store), but then I just get a big mess etc. POSTINC0 that this event is a good call Is there any way to make it? In
normaly under the PIC18 using dedicated input variables such as Riga, RegB and regr. So there are declarated: Calling looks like a function like this:
Riga Race 2; ResB Race 2 on 16bit; ResR Race 4 on 16bit; 32bit on
; Continuous announcement operand set set 1234 operandab set 7777; ; ; Prepare a movlw lower operandA movwf Riga movlw calling the operandA movwf Riga +1; MullAB_16bit call function; Operation B movlw less OperandB movwf RegB + 0 movlw High OperandB movwf RegB +1 Calling Results Resr in
Comments
Post a Comment