1: /* @(#)fltpr.s 2.1 SCCS id keyword */ 2: / C library-- floating output 3: 4: .globl pfloat 5: .globl pscien 6: .globl pgen 7: .globl fltused 8: 9: .globl _ecvt 10: .globl _fcvt 11: .globl _gcvt 12: 13: fltused: / force loading 14: 15: pgen: 16: mov r3,-(sp) 17: mov r0,-(sp) 18: tst r2 19: bne 1f 20: mov $6,(sp) 21: 1: 22: movf (r4)+,fr0 23: movf fr0,-(sp) 24: jsr pc,_gcvt 25: add $8+2+2,sp 26: 1: 27: tstb (r3)+ 28: bne 1b 29: dec r3 30: rts pc 31: 32: pfloat: 33: mov $sign,-(sp) 34: mov $decpt,-(sp) 35: tst r2 36: bne 1f 37: mov $6,r0 38: 1: 39: mov r0,-(sp) 40: mov r0,ndigit 41: movf (r4)+,fr0 42: movf fr0,-(sp) 43: jsr pc,_fcvt 44: add $8+2+2+2,sp 45: tst sign 46: beq 1f 47: movb $'-,(r3)+ 48: 1: 49: mov decpt,r2 50: bgt 1f 51: movb $'0,(r3)+ 52: 1: 53: mov r2,r1 54: ble 1f 55: 2: 56: movb (r0)+,(r3)+ 57: sob r1,2b 58: 1: 59: mov ndigit,r1 60: beq 1f 61: movb $'.,(r3)+ 62: 1: 63: neg r2 64: ble 1f 65: 2: 66: dec r1 67: blt 1f 68: movb $'0,(r3)+ 69: sob r2,2b 70: 1: 71: tst r1 72: ble 2f 73: 1: 74: movb (r0)+,(r3)+ 75: sob r1,1b 76: 2: 77: rts pc 78: 79: pscien: 80: mov $sign,-(sp) 81: mov $decpt,-(sp) 82: mov r0,-(sp) 83: mov r0,ndigit 84: tst r2 85: bne 1f 86: mov $6,(sp) 87: 1: 88: movf (r4)+,fr0 89: movf fr0,-(sp) 90: jsr pc,_ecvt 91: add $8+2+2+2,sp 92: tst sign 93: beq 1f 94: movb $'-,(r3)+ 95: 1: 96: cmpb (r0),$'0 97: bne 1f 98: inc decpt 99: 1: 100: movb (r0)+,(r3)+ 101: movb $'.,(r3)+ 102: mov ndigit,r1 103: dec r1 104: ble 1f 105: 2: 106: movb (r0)+,(r3)+ 107: sob r1,2b 108: 1: 109: movb $'e,(r3)+ 110: mov decpt,r2 111: dec r2 112: mov r2,r1 113: bge 1f 114: movb $'-,(r3)+ 115: neg r1 116: br 2f 117: 1: 118: movb $'+,(r3)+ 119: 2: 120: clr r0 121: div $10.,r0 122: add $'0,r0 123: movb r0,(r3)+ 124: add $'0,r1 125: movb r1,(r3)+ 126: rts pc 127: .data 128: sign: .=.+2 129: ndigit: .=.+2 130: decpt: .=.+2