Searching \ for '?32 bits generic division?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/method/math.htm?key=division
Search entire site for: '?32 bits generic division?'.

Truncated match.
PICList Thread
'?32 bits generic division?'
1998\03\18@134158 by Alvaro Deibe Diaz

flavicon
face
  Well, I wrote this code just yesterday, so it isn't tested yet, but I think
it must run fine. Any comments?

; Rutina para division.
; Divide  c = a / b  donde:
;         |   |   +--- 16 bits (b1,b0)
;         |   +------- 32 bits (a3 a2 a1 a0)
;         +----------- 32 bits (c3 c2 c1 c0)
; Utiliza dos variables intermedias de 8 bits: aux y cont
; y una de 16 bits: d (d1 d0)
;
       movlw  32h               ; Inicializa cont
       movwf  cont              ; (32 bits)
;
buc     bcf    STATUS,C          ; Carry = 0;
;
       rlf    a0,F
       rlf    a1,F
       rlf    a2,F
       rlf    a3,F
       rlf    d0,F
       rlf    d1,F
;
       movf   b0,W              ; ? d >= a ?
       subwf  d0,W
       movf   b1,W
       btfss  STATUS,C
       incf   b1,W
       subwf  d1,W
       btfss  STATUS,C
       goto   sigue             ; No. Salta a sigue
;
       movf   b0,W              ; Si.  d <- d - b;
       subwf  d0,F
       movf   b1,W
       btfss  STATUS,C
       incf   b1,W
       subwf  d1,F
       bsf    STATUS,C          ; Carry <- 1;
;
sigue   rlf    c0,F
       rlf    c1,F
       rlf    c2,F
       rlf    c3,F
       decfsz cont,F
       goto   buc
;
fin


-----Mensaje original-----
De:     Manuel Castro Caamano [SMTP:spam_OUTmanuel.castroTakeThisOuTspamMX3.REDESTB.ES]
Enviado el:     miercoles 18 de marzo de 1998 11:28
Para:   .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
Asunto: ?32 bits generic division?

First many tnx to all who reply my last question about 32 bit to bcd
convert.
(Mike Keitz, Ron Kreymborg, Bob Fehrenbach, etc...)

Now, i must to divide my 32 bits binary by a 16 bits binary number, with no
decimals, ?does anyone know the faster routines to do this?



Investimento e Investigacisn Industrial, S.L.
Av. Galicia 51-53
32300 Barco de Valdeorras (Orense)
Spain
TLF.   : (+34)(9) 88 327370
FAX    : (+34)(9) 88 327338
E-MAIL: manuel.castrospamKILLspammx3.redestb.es

1998\03\18@171636 by Andrew Warren

face
flavicon
face
Alvaro Deibe Diaz <.....PICLISTKILLspamspam.....MITVMA.MIT.EDU> wrote:

> Well, I wrote this code just yesterday, so it isn't tested yet, but
> I think it must run fine. Any comments?
> ....
>         movf   b0,W              ; ? d >= a ?
>         subwf  d0,W
>         movf   b1,W
>         btfss  STATUS,C
>         incf   b1,W
>         subwf  d1,W
>         btfss  STATUS,C
>         goto   sigue             ; No. Salta a sigue
> ;
>         movf   b0,W              ; Si.  d <- d - b;
>         subwf  d0,F
>         movf   b1,W
>         btfss  STATUS,C
>         incf   b1,W
>         subwf  d1,F

Alvaro:

In the portion of the code that I've quoted, you must change the INCF
instructions to INCFSZ.

En la porcion del programa que he cotizado, usted debe cambiar las
instrucciones de INCF a INCFSZ.

-Andy

=== Andrew Warren - EraseMEfastfwdspam_OUTspamTakeThisOuTix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...