chiark / gitweb /
Initial revision
[ssr] / StraySrc / Libraries / Sapphire / sail / sh / divide
1 ;
2 ; divide.sh
3 ;
4 ; Various routines of a division-related nature (MDW/TMA)
5 ;
6 ; © 1994 Straylight
7 ;
8
9 ;----- Overview -------------------------------------------------------------
10 ;
11 ; Functions provided:
12 ;
13 ;  divide
14 ;  div_unsigned
15
16                 [       :LNOT::DEF:divide__dfn
17                 GBLL    divide__dfn
18
19 ; --- divide ---
20 ;
21 ; On entry:     R0 == dividend
22 ;               R1 == divisor
23 ;
24 ; On exit:      R0 == quotient
25 ;               R1 == remainder
26 ;
27 ; Use:          A standard divide routine.  Fairly speedy, hopefully.
28 ;               The results are always such that
29 ;
30 ;                       |quotient| <= |(divisor/dividend)|,
31 ;
32 ;                       |remainder| < |divisor|
33 ;
34 ;               and
35 ;
36 ;                       quotient * divisor + remainder == dividend
37
38                 IMPORT  divide
39
40 ; --- div_unsigned ---
41 ;
42 ; On entry:     R0 == dividend
43 ;               R1 == divisor
44 ;
45 ; On exit:      R0 == quotient
46 ;               R1 == remainder
47 ;
48 ; Use:          As for divide, except that it considers its operands to be
49 ;               unsigned.
50
51                 IMPORT  div_unsigned
52
53                 ]
54
55 ;----- That's all, folks ----------------------------------------------------
56
57                 END