1: /
   2: /
   3: 
   4: / io4 -- numeric output conversion
   5: 
   6: qicv:
   7: hicv:
   8:         jsr     r5,rerr; 999.
   9:         sys     exit
  10: 
  11: xicv:
  12:         jsr     r5,fgetc
  13:         rts     r5
  14: 
  15: gocv:
  16:         mov     pc,gflg
  17:         jsr     r5,getarg
  18:         mov     ndig,_ndigit
  19:         jsr     pc,ecvt
  20:         tst     r2
  21:         bmi     eocv
  22:         cmp     r2,ndig
  23:         bgt     eocv
  24:         sub     r2,ndig
  25:         sub     $4,width
  26:         jsr     r5,focv
  27:         add     $4,width
  28:         add     $4,nspace
  29:         rts     r5
  30: 
  31: eocv:
  32:         mov     $'e,-(sp)
  33:         br      1f
  34: 
  35: docv:
  36:         mov     $'d,-(sp)
  37: 1:
  38:         tst     gflg
  39:         bne     1f
  40:         jsr     r5,getarg
  41: 1:
  42:         mov     ndig,r1
  43:         add     $6,r1
  44:         add     nflg,r1
  45:         sub     width,r1
  46:         bge     2f
  47:         sub     r1,nspace
  48: 2:
  49:         tst     nflg
  50:         beq     2f
  51:         mov     $'-,r0
  52:         jsr     r5,fputcc
  53: 2:
  54:         mov     ndig,r1
  55:         mov     scale,r0
  56:         bgt     2f
  57:         add     r0,r1
  58:         br      3f
  59: 2:
  60:         inc     r1
  61: 3:
  62:         mov     r1,_ndigit
  63:         jsr     pc,ecvt
  64:         mov     r0,r1
  65:         mov     r2,-(sp)
  66:         mov     scale,r2
  67:         sub     r2,(sp)
  68:         tst     r2
  69:         bgt     2f
  70:         mov     $'0,r0
  71:         jsr     r5,fputcc
  72:         br      3f
  73: 2:
  74:         movb    (r1)+,r0
  75:         dec     _ndigit
  76:         jsr     r5,fputcc
  77:         sob     r2,2b
  78: 3:
  79:         mov     $'.,r0
  80:         jsr     r5,fputcc
  81:         neg     r2
  82:         ble     2f
  83: 3:
  84:         mov     $'0,r0
  85:         jsr     r5,fputcc
  86:         sob     r2,3b
  87: 2:
  88:         mov     _ndigit,r2
  89:         ble     2f
  90: 3:
  91:         movb    (r1)+,r0
  92:         jsr     r5,fputcc
  93:         sob     r2,3b
  94: 2:
  95:         mov     2(sp),r0
  96:         jsr     r5,fputcc
  97:         mov     (sp)+,r1
  98:         bge     2f
  99:         mov     $'-,r0
 100:         jsr     r5,fputcc
 101:         neg     r1
 102:         br      3f
 103: 2:
 104:         mov     $'+,r0
 105:         jsr     r5,fputcc
 106: 3:
 107:         clr     r0
 108:         div     $10.,r0
 109:         add     $'0,r0
 110:         jsr     r5,fputcc
 111:         mov     r1,r0
 112:         add     $'0,r0
 113:         jsr     r5,fputcc
 114:         tst     (sp)+
 115:         rts     r5
 116: 
 117: iocv:
 118:         clr     -(sp)
 119:         clr     ndig
 120:         br      1f
 121: 
 122: focv:
 123:         mov     $1,-(sp)
 124: 1:
 125:         clr     -(sp)
 126:         tst     gflg
 127:         bne     1f
 128:         jsr     r5,getarg
 129:         tst     2(sp)
 130:         beq     1f
 131:         mov     scale,(sp)
 132: 1:
 133:         mov     ndig,_ndigit
 134:         add     (sp)+,_ndigit
 135:         jsr     pc,fcvt
 136:         mov     r0,r1
 137:         tst     (sp)
 138:         beq     1f
 139:         tst     gflg
 140:         bne     1f
 141:         add     scale,r2
 142: 1:
 143:         mov     ndig,r0
 144:         add     (sp),r0
 145:         add     nflg,r0
 146:         tst     r2
 147:         ble     1f
 148:         add     r2,r0
 149:         br      2f
 150: 1:
 151:         inc     r0
 152: 2:
 153:         sub     width,r0
 154:         bge     1f
 155:         sub     r0,nspace
 156: 1:
 157:         tst     nflg
 158:         beq     1f
 159:         mov     $'-,r0
 160:         jsr     r5,fputcc
 161: 1:
 162:         tst     r2
 163:         bgt     1f
 164:         mov     $'0,r0
 165:         jsr     r5,fputcc
 166:         br      2f
 167: 1:
 168:         movb    (r1)+,r0
 169:         jsr     r5,fputcc
 170:         sob     r2,1b
 171: 2:
 172:         tst     (sp)+
 173:         beq     1f
 174:         mov     $'.,r0
 175:         jsr     r5,fputcc
 176: 1:
 177:         mov     ndig,-(sp)
 178:         ble     1f
 179:         tst     r2
 180:         bge     1f
 181:         neg     r2
 182: 2:
 183:         mov     $'0,r0
 184:         jsr     r5,fputcc
 185:         dec     ndig
 186:         ble     1f
 187:         sob     r2,2b
 188: 1:
 189:         mov     ndig,r2
 190:         ble     2f
 191: 1:
 192:         movb    (r1)+,r0
 193:         jsr     r5,fputcc
 194:         sob     r2,1b
 195: 2:
 196:         mov     (sp)+,ndig
 197:         rts     r5
 198: 
 199: getarg:
 200:         clr     nflg
 201:         setd
 202:         cmpb    itype,$'r
 203:         beq     1f
 204:         seti
 205:         cmpb    ilen,$4
 206:         bne     2f
 207:         setl
 208: 2:
 209:         cmpb    ilen,$1
 210:         beq     3f
 211:         movif   *ilval,r0
 212:         br      2f
 213: 3:
 214:         movb    *ilval,r0
 215:         movif   r0,fr0
 216:         br      2f
 217: 1:
 218:         cmpb    ilen,$4
 219:         bne     1f
 220:         movof   *ilval,r0
 221:         br      2f
 222: 1:
 223:         movf    *ilval,r0
 224: 2:
 225:         cfcc
 226:         bge     1f
 227:         absf    r0
 228:         mov     $1,nflg
 229: 1:
 230:         rts     r5

Defined functions

docv defined in line 35; never used
eocv defined in line 31; used 2 times
focv defined in line 122; used 1 times
  • in line 26
getarg defined in line 199; used 3 times
gocv defined in line 15; never used
hicv defined in line 7; never used
iocv defined in line 117; never used
qicv defined in line 6; never used
xicv defined in line 11; never used
Last modified: 1975-07-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 411
Valid CSS Valid XHTML 1.0 Strict