|
|
1.1 ! root 1: /* Kcvtlf.s 1.3 86/01/05 */ ! 2: ! 3: #include "../tahoemath/fp.h" ! 4: #include "../tahoemath/Kfp.h" ! 5: #include "../tahoe/SYS.h" ! 6: ! 7: .text ! 8: ENTRY(Kcvtlf, R5|R4|R3|R2) ! 9: clrl r1 ! 10: clrl r4 # r4 - negative flag. ! 11: clrl r2 # r2 - exponent. ! 12: movl 12(fp),r0 # fetch operand. ! 13: movl r0,r5 # need another copy. ! 14: jeql retzero # return zero. ! 15: jgtr positive ! 16: mnegl r0,r0 ! 17: jvs retmin # return minimum integer. ! 18: incl r4 # remember it was negative. ! 19: movl r0,r5 # remember the negated value. ! 20: # ! 21: #Compute exponent: ! 22: # ! 23: positive: ! 24: ffs r0,r1 ! 25: incl r1 ! 26: addl2 r1,r2 ! 27: shrl r1,r0,r0 ! 28: jneq positive # look for more set bits. ! 29: # ! 30: #we have the exponent in r2. ! 31: # ! 32: movl r5,r0 # r0 will hold the resulting f.p. number. ! 33: # ! 34: #Shift the fraction part to its proper place: ! 35: # ! 36: subl3 r2,$HID_POS,r3 ! 37: jlss shiftr # if less then zero we have to shift right. ! 38: shll r3,r0,r0 # else we shift left. ! 39: jmp shifted ! 40: shiftr: ! 41: mnegl r3,r3 ! 42: shrl r3,r0,r0 ! 43: shifted: ! 44: andl2 $CLEARHID,r0 # clear the hidden bit. ! 45: shal $EXPSHIFT,r2,r2 # shift the exponent to its proper place. ! 46: orl2 $EXPSIGN,r2 # set the exponent sign bit(to bias it). ! 47: orl2 r2,r0 # combine exponent & fraction. ! 48: bbc $0,r4,sign_ok # do we have to set the sign bit? ! 49: orl2 $SIGNBIT,r0 # yes... ! 50: sign_ok: ! 51: ret ! 52: ! 53: retzero: ! 54: clrl r0 ! 55: ret ! 56: ! 57: retmin: ! 58: movl $0xd0000000,r0 ! 59: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.