Annotation of cci/sys/tahoe/Kcvtfl.x, revision 1.1.1.1

1.1       root        1: #include       "fp.h"
                      2: 
                      3:        .text
                      4:        .globl  _Kcvtfl
                      5: _Kcvtfl:       .word   0x003c          # we use r2,r3,r4,r5
                      6: 
                      7:  #
                      8:  #Some initializations:
                      9:  #
                     10:        clrl    r1
                     11:        clrl    r4              # r4 - negative flag.
                     12:        clrl    r2              # r2 - exponent.
                     13:        movl    4(fp),r0        # fetch operand.
                     14:        movl    r0,r5           # need another copy.
                     15:        jeql    retzero         # return zero.
                     16:        jgtr    positive
                     17:        mnegl   r0,r0
                     18:        jvs     retmin          # return minimum integer.
                     19:        incl    r4              # remember it was negative.
                     20:        movl    r0,r5           # remember the negated value.
                     21:  #
                     22:  #Compute exponent:
                     23:  #
                     24: positive:
                     25:        ffs     r0,r1
                     26:        incl    r1
                     27:        addl2   r1,r2
                     28:        shrl    r1,r0,r0
                     29:        jneq    positive        # look for more set bits.
                     30:  #
                     31:  #we have the exponent in r2.
                     32:  #
                     33:        movl    r5,r0           # r0 will hold the resulting f.p. number.
                     34:  #
                     35:  #Shift the fraction part to its proper place:
                     36:  #
                     37:        subl3   r2,$HID_POS,r3
                     38:        jlss    shiftr          # if less then zero we have to shift right.
                     39:        shll    r3,r0,r0        # else we shift left.
                     40:        jmp     shifted
                     41: shiftr:
                     42:        mnegl   r3,r3
                     43:        shrl    r3,r0,r0
                     44: shifted:
                     45:        andl2   $CLEARHID,r0    # clear the hidden bit.
                     46:        shal    $EXPSHIFT,r2,r2 # shift the exponent to its proper place.
                     47:        orl2    $EXPSIGN,r2     # set the exponent sign bit(to bias it).
                     48:        orl2    r2,r0           # combine exponent & fraction.
                     49:        bbc     $0,r4,sign_ok   # do we  have to set the sign bit?
                     50:        orl2    $SIGNBIT,r0     # yes...
                     51: sign_ok:
                     52:        ret
                     53: 
                     54: retzero:
                     55:        clrl    r0
                     56:        ret
                     57: 
                     58: retmin:
                     59:        movl    $0xd0000000,r0
                     60:        ret
                     61: 
                     62: 
                     63:        

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.