# 2.11BSD#431 - /usr/src/ucb/pascal/px/30io.s

##### Functions

    _WRIT8            X

       1: /
       2: / IO operations
       3: /
       4: _GET:
       5:         jsr     pc,get
       6:         jsr     pc,iosync
       7:         return
       8: _PUT:
       9:         jsr     pc,put
      10:         return
      11: _MESSAGE:
      12:         mov     $_unit2,r0
      13:         jsr     pc,unit
      14:         mov     fchain,r2       / flush all files
      15: 1:
      16:         beq     2f
      17:         bit     $FWRITE,FUNIT(r2)
      18:         beq     3f
      19:         mov     FBUF(r2),-(sp)
      20:         jsr     pc,_fflush
      21:         tst     (sp)+
      22: 3:
      23:         mov     FCHAIN(r2),r2
      24:         br      1b
      25: 2:
      26:         mov     $_unit1,r2
      27:         mov     FBUF(r2),-(sp)
      28:         jsr     pc,_fflush
      29:         tst     (sp)+
      30:         return
      31: _FNIL:
      32:         mov     (sp),r0
      33:         mov     _file,-(sp)
      34:         mov     buf,-(sp)
      35:         jsr     pc,unit
      36:         jsr     pc,iosync
      37:         mov     (sp)+,buf
      38:         mov     (sp)+,_file
      39:         return
      40: _BUFF:
      41:         mov     r3,bufopt
      42:         return
      43: _EOF:
      44:         mov     (sp)+,r0
      45:         mov     _file,-(sp)
      46:         mov     buf,-(sp)
      47:         mov     $EOF,-(sp)
      48:         br      1f
      49: _EOLN:
      50:         mov     (sp)+,r0
      51:         mov     _file,-(sp)
      52:         mov     buf,-(sp)
      53:         mov     $EOF+EOLN,-(sp)
      54: 1:
      55:         jsr     pc,unit
      56:         cmp     buf,$_unit0
      57:         bne     1f
      58:         cmp     bufopt,$1
      59:         bne     1f
      60:         mov     $u1buf,-(sp)
      61:         jsr     pc,_fflush
      62:         tst     (sp)+
      63: 1:
      64:         mov     (sp)+,r1
      65:         clr     -(sp)
      66:         mov     buf,r2
      67:         bit     $EOF,FUNIT(r2)
      68:         bne     2f
      69:         jsr     pc,iosync
      70:         bit     r1,FUNIT(r2)
      71:         beq     1f
      72: 2:
      73:         mov     $1,(sp)
      74: 1:
      75:         mov     (sp)+,r0
      76:         mov     (sp)+,buf
      77:         mov     (sp)+,_file
      78:         mov     r0,-(sp)
      79:         return
      80: _RESET:
      81:         bne     1f              / branch if name given
      82:         cmp     *(sp),$_unit0
      83:         bne     1f
      84:         tst     _unit0+FNAME
      85:         bne     1f
      86:         clr     -(sp)
      87:         clr     -(sp)
      88:         clr     -(sp)
      89:         clr     -(sp)
      90:         jsr     pc,_lseek
      91:         add     $8.,sp
      92:         tst     r0
      93:         bmi     9f
      94:         tst     (sp)+
      95:         tst     (lc)+
      96:         bic     $EOF+EOLN,_unit0+FUNIT
      97:         bis     $SYNC,_unit0+FUNIT
      98:         return
      99: 9:
     100:         mov     $stdin,_file
     101:         mov     $ESEEK,_perrno
     102:         error   ESEEK
     103: 1:
     104:         jsr     pc,getname
     105:         mov     r0,r1
     106:         mov     PFNAME(r1),_file
     107:         clr     -(sp)
     108:         mov     FNAME(r1),-(sp)
     109:         jsr     pc,_open
     110:         cmp     (sp)+,(sp)+
     111:         tst     r0
     112:         bmi     eopen
     113:         mov     r0,*FBUF(r1)
     114:         bis     $SYNC|FREAD,r0
     115:         bis     r0,FUNIT(r1)
     116:         return
     117: ecreat:
     118:         mov     $ECREATE,_perrno
     119:         error   ECREATE
     120: eopen:
     121:         mov     $EOPEN,_perrno
     122:         error   EOPEN
     123: _REWRITE:
     124:         jsr     pc,getname
     125:         mov     r0,r1
     126:         mov     PFNAME(r1),_file
     127:         mov     $0644,-(sp)
     128:         mov     FNAME(r1),-(sp)
     129:         jsr     pc,_creat
     130:         cmp     (sp)+,(sp)+
     131:         tst     r0
     132:         bmi     ecreat
     133:         mov     r0,-(sp)
     134:         jsr     pc,_close
     135:         tst     (sp)+
     136:         mov     $1,-(sp)
     137:         mov     FNAME(r1),-(sp)
     138:         jsr     pc,_open
     139:         cmp     (sp)+,(sp)+
     140:         tst     r0
     141:         bmi     eopen
     142:         mov     r0,*FBUF(r1)
     143:         bis     $EOF|FWRITE,r0
     144:         bis     r0,FUNIT(r1)
     145:         return
     146: _REMOVE:
     147:         bne     1f
     148:         mov     (lc)+,r3
     149: 1:
     150:         mov     sp,r1
     151:         mov     r3,r2
     152:         inc     r2
     153:         bic     $1,r2
     154:         add     r2,sp
     155:         add     r3,r1
     156:         mov     r1,r0
     157:         movb    (r1),r2
     158:         clrb    (r1)
     159: 1:
     160:         cmpb    -1(r1),$'
     161:         bne     1f
     162:         clrb    -(r1)
     163:         dec     r3
     164:         bne     1b
     165: 1:
     166:         sub     r3,r1
     167:         mov     r1,_file
     168:         mov     r1,-(sp)
     169:         jsr     pc,_unlink
     170:         tst     (sp)+
     171:         tst     r0
     172:         bmi     9f
     173:         movb    r2,(r0)
     174:         return
     175: 9:
     176:         mov     _file,sp
     177:         mov     $EREMOVE,_perrno
     178:         error   EREMOVE
     179: _UNITINP:
     180:         cmp     bufopt,$2
     181:         bge     1f                      / bufopt >= 2, don't flush on read
     182:         cmp     $512.,u1cnt
     183:         beq     1f
     184:         mov     $u1buf,-(sp)
     185:         jsr     pc,_fflush
     186:         tst     (sp)+
     187: 1:
     188:         mov     $_unit0,buf
     189:         mov     $stdin,_file
     190:         return
     191: _UNITOUT:
     192:         mov     $_unit1,buf
     193:         mov     $stdout,_file
     194:         return
     195: _UNIT:
     196:         mov     (sp)+,r0
     197:         cmp     r0,$_unit0
     198:         beq     _UNITINP
     199:         jsr     pc,unit
     200:         return
     201: _READ8:
     202:         sub     $32.,sp
     203: /	mov	sp,-(sp)	This doen't work on all 11's
     204:         mov     sp,r0
     205:         mov     r0,-(sp)
     206:         mov     $32.,-(sp)
     207:         mov     $1,-(sp)
     208:         jsr     pc,_preadn
     209:         bcs     1f
     210:         add     $6,sp
     211: /	mov	sp,-(sp)	This doen't work on all 11's
     212:         mov     sp,r0
     213:         mov     r0,-(sp)
     214:         jsr     pc,_atof
     215:         add     $34.,sp
     216:         movf    fr0,-(sp)
     217:         return
     218: 1:
     219:         add     $38.,sp
     220:         clrf    -(sp)
     221:         return
     222: _READ4:
     223:         sub     $20.,sp
     224: /	mov	sp,-(sp)	This doen't work on all 11's
     225:         mov     sp,r0
     226:         mov     r0,-(sp)
     227:         mov     $20.,-(sp)
     228:         clr     -(sp)
     229:         jsr     pc,_preadn
     230:         bcs     1f
     231:         add     $6.,sp
     232: /	mov	sp,-(sp)	This doen't work on all 11's
     233:         mov     sp,r0
     234:         mov     r0,-(sp)
     235:         jsr     pc,_atol
     236:         add     $22.,sp
     237:         mov     r1,-(sp)
     238:         mov     r0,-(sp)
     239:         return
     240: 1:
     241:         add     $26.,sp
     242:         clr     -(sp)
     243:         sxt     -(sp)
     244:         return
     245: _READC:
     246:         jsr     pc,iosync
     247:         clr     -(sp)
     248:         movb    *buf,(sp)
     249:         jsr     pc,get
     250:         return
     251: _READLN:
     252:         jsr     pc,iosync
     253:         mov     buf,r0
     254:         bit     $EOLN+EOF,FUNIT(r0)
     255:         bne     1f
     256:         jsr     pc,get
     257:         br      _READLN
     258: 1:
     259:         jsr     pc,get
     260:         return
     261: _PAGE:
     262:         mov     $14,-(sp)
     263:         br      1f
     264: _WRITC:
     265:         beq     1f
     266:         mov     $323,r0
     267:         br      pwriteit
     268: 1:
     269:         movb    (sp)+,*buf
     270:         jsr     pc,put
     271:         tst     bufopt
     272:         beq     2f
     273:         return
     274: _WRITLN:
     275:         mov     $327,r0
     276:         mov     $'\n,-(sp)
     277:         mov     $1,r2
     278:         cmp     buf,$_unit1
     279:         bne     1f
     280:         cmp     bufopt,$1
     281:         bgt     1f
     282:         clr     r2
     283:         br      1f
     284: _WRITG:
     285:         mov     $325,r0
     286:         mov     (lc)+,-(sp)
     287:         br      pwriteit
     288: _WRHEX2:
     289:         mov     $267,r0
     290:         br      3f
     291: _WRHEX4:
     292:         mov     $277,r0
     293:         br      3f
     294: _WROCT2:
     295:         mov     $330,r0
     296:         br      3f
     297: _WROCT4:
     298:         mov     $331,r0
     299:         br      3f
     300: _WRIT2:
     301:         mov     $320,r0
     302:         br      3f
     303: _WRIT4:
     304:         mov     $321,r0
     305:         br      3f
     306: .globl _WRIT8
     307: _WRIT8:
     308:         mov     $324,r0
     309:         br      3f
     310: _WRITB:
     311:         mov     $322,r0
     312:         br      3f
     313: _WRIT82:
     314:         mov     $326,r0
     315: 3:
     316: pwriteit:
     317:         mov     bufopt,r2
     318: 1:
     319:         mov     r3,-(sp)
     320:         mov     r0,-(sp)
     321:         seti
     322:         jsr     pc,_pwrite
     323:         setl
     324:         mov     r0,sp
     325:         tst     r2
     326:         bne     1f
     327: 2:
     328:         cmp     buf,$_unit1
     329:         bne     1f
     330:         mov     buf,r0
     331:         mov     FBUF(r0),-(sp)
     332:         jsr     pc,_fflush
     333:         tst     (sp)+
     334: 1:
     335:         return
     336: _DEFNAME:
     337:         jsr     pc,getname
     338:         bis     $100000,FUNIT(r0)
     339:         return
     340: _FLUSH:
     341:         mov     (sp)+,r0
     342:         jsr     pc,unit
     343:         mov     buf,r0
     344:         bit     $FWRITE,FUNIT(r0)
     345:         beq     1f
     346:         mov     FBUF(r0),-(sp)
     347:         jsr     pc,_fflush
     348:         tst     (sp)+
     349: 1:
     350:         return

#### Defined functions

_BUFF defined in line 40; never used
_DEFNAME defined in line 336; never used
_EOF defined in line 43; never used
_EOLN defined in line 49; never used
_FLUSH defined in line 340; never used
_FNIL defined in line 31; never used
_GET defined in line 4; never used
_MESSAGE defined in line 11; never used
_PAGE defined in line 261; never used
_PUT defined in line 8; never used
_READ4 defined in line 222; never used
_READ8 defined in line 201; never used
_READC defined in line 245; never used
_READLN defined in line 251; used 1 times

- in line 257

_REMOVE defined in line 146; never used
_RESET defined in line 80; never used
_REWRITE defined in line 123; never used
_UNIT defined in line 195; never used
_UNITINP defined in line 179; used 1 times

- in line 198

_UNITOUT defined in line 191; never used
_WRHEX2 defined in line 288; never used
_WRHEX4 defined in line 291; never used
_WRIT2 defined in line 300; never used
_WRIT4 defined in line 303; never used
_WRIT8 declared in line 306; defined in line 307; used 2 times

- in line 306
- in /usr/src/ucb/pascal/px/opcode.s line 86

_WRIT82 defined in line 313; never used
_WRITB defined in line 310; never used
_WRITC defined in line 264; never used
_WRITG defined in line 284; never used
_WRITLN defined in line 274; never used
_WROCT2 defined in line 294; never used
_WROCT4 defined in line 297; never used
ecreat defined in line 117; used 1 times

- in line 132

eopen defined in line 120; used 2 times

- in line 112, 141

pwriteit defined in line 316; used 2 times

- in line 267, 287

Last modified: 1987-03-13 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1137 |