From: Ken Thompson Date: Thu, 15 Feb 1973 20:49:36 +0000 (-0500) Subject: Research V3 release X-Git-Tag: Research-V3^0 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/fb7e11aff8d2286fbfdc4cfb597d8d55bb2c8697?hp=3965a509b5fae308341189af39793d1cc4190ac9 Research V3 release Snapshot of the completed development branch Synthesized-from: v3 --- diff --git a/c/c00.c b/c/c00.c new file mode 100644 index 0000000000..dde755eebf --- /dev/null +++ b/c/c00.c @@ -0,0 +1,777 @@ +/* C compiler + +Copyright 1972 Bell Telephone Laboratories, Inc. + +*/ + +init(s, t) +char s[]; { + extern symbuf, namsiz; + char symbuf[], sp[]; + int np[], i; + + i = namsiz; + sp = symbuf; + while(i--) + if ((*sp++ = *s++)=='\0') --s; + np = lookup(); + *np++ = 1; + *np = t; +} + +main(argc, argv) +int argv[]; { + extern extdef, eof; + extern fout, fin, nerror, tmpfil, xdflg; + + if(argc<4) { + error("Arg count"); + exit(1); + } + if((fin=open(argv[1],0))<0) { + error("Can't find %s", argv[1]); + exit(1); + } + if((fout=creat(argv[2], 017))<0) { + error("Can't create %s", argv[2]); + exit(1); + } + tmpfil = argv[3]; + xdflg++; + init("int", 0); + init("char", 1); + init("float", 2); + init("double", 3); + init("struct", 4); + init("auto", 5); + init("extern", 6); + init("static", 7); + init("goto", 10); + init("return", 11); + init("if", 12); + init("while", 13); + init("else", 14); + init("switch", 15); + init("case", 16); + init("break", 17); + init("continue", 18); + init("do", 19); + init("default", 20); + xdflg = 0; + while(!eof) { + extdef(); + blkend(); + } + flush(); + flshw(); + exit(nerror!=0); +} + +lookup() { + extern hshtab, hshsiz, pssiz, symbuf, xdflg; + int hshtab[], symbuf[]; + extern hshlen, hshused, nwps; + auto i, j, np[], sp[], rp[]; + + i = 0; + sp = symbuf; + j = nwps; + while(j--) + i =+ *sp++ & 077577; + if (i<0) i = -i; + i =% hshsiz; + i =* pssiz; + while(*(np = &hshtab[i+4])) { + sp = symbuf; + j = nwps; + while(j--) + if ((*np++&077577) != *sp++) goto no; + return(&hshtab[i]); +no: if ((i =+ pssiz) >= hshlen) i = 0; + } + if(++hshused > hshsiz) { + error("Symbol table overflow"); + exit(1); + } + rp = np = &hshtab[i]; + sp = symbuf; + j = 4; + while(j--) + *np++ = 0; + j = nwps; + while(j--) + *np++ = *sp++; + *np = 0; + if (xdflg) + rp[4] =| 0200; /* mark non-deletable */ + return(rp); +} + +symbol() { + extern peeksym, peekc, eof, line; + extern csym, symbuf, namsiz, lookup, ctab, cval; + int csym[]; + extern isn, mosflg, xdflg; + auto b, c; + char symbuf[], sp[], ctab[]; + + if (peeksym>=0) { + c = peeksym; + peeksym = -1; + if (c==20) + mosflg = 0; + return(c); + } + if (peekc) { + c = peekc; + peekc = 0; + } else + if (eof) + return(0); else + c = getchar(); +loop: + switch(ctab[c]) { + + case 125: /* newline */ + line++; + + case 126: /* white space */ + c = getchar(); + goto loop; + + case 0: /* EOF */ + eof++; + return(0); + + case 40: /* + */ + return(subseq(c,40,30)); + + case 41: /* - */ + return(subseq(c,subseq('>',41,50),31)); + + case 80: /* = */ + if (subseq(' ',0,1)) return(80); + c = symbol(); + if (c>=40 & c<=49) + return(c+30); + if (c==80) + return(60); + peeksym = c; + return(80); + + case 63: /* < */ + if (subseq(c,0,1)) return(46); + return(subseq('=',63,62)); + + case 65: /* > */ + if (subseq(c,0,1)) return(45); + return(subseq('=',65,64)); + + case 34: /* ! */ + return(subseq('=',34,61)); + + case 43: /* / */ + if (subseq('*',1,0)) + return(43); +com: + c = getchar(); +com1: + if (c=='\0') { + eof++; + error("Nonterminated comment"); + return(0); + } + if (c=='\n') + line++; + if (c!='*') + goto com; + c = getchar(); + if (c!='/') + goto com1; + c = getchar(); + goto loop; + + case 120: /* . */ + case 124: /* number */ + peekc = c; + switch(c=getnum(c=='0'? 8:10)) { + case 25: /* float 0 */ + c = 23; + break; + + case 23: /* float non 0 */ + cval = isn++; + } + return(c); + + case 122: /* " */ + return(getstr()); + + case 121: /* ' */ + return(getcc()); + + case 123: /* letter */ + sp = symbuf; + if (mosflg) { + *sp++ = '.'; + mosflg = 0; + } + while(ctab[c]==123 | ctab[c]==124) { + if (sp= 0) + printf("%o,", c); + printf("0;.even;%s\n", (strflg?d:t)); + return(22); +} + +getcc() +{ + extern cval, ncpw; + auto c, cc; + char cp[]; + + cval = 0; + cp = &cval; + cc = 0; + while((c=mapch('\'')) >= 0) + if(cc++ < ncpw) + *cp++ = c; + if(cc>ncpw) + error("Long character constant"); + return(21); +} + +mapch(c) +{ + extern peekc, line; + auto a; + + if((a=getchar())==c) + return(-1); + switch(a) { + + case '\n': + case 0: + error("Nonterminated string"); + peekc = a; + return(-1); + + case '\\': + switch (a=getchar()) { + + case 't': + return('\t'); + + case 'n': + return('\n'); + + case '0': + return('\0'); + + case 'r': + return('\r'); + + case '\n': + line++; + return('\n'); + } + + } + return(a); +} + +tree() { + extern csym, ctyp, isn, fcval, peeksym, opdope, cp, cmst; + int csym[], opdope[], cp[], cmst[]; + extern space, cval, ossiz, cmsiz, mosflg, osleft; + double fcval; + int space[]; + + int op[], opst[20], pp[], prst[20], andflg, o, + p, ps, os; + + osleft = ossiz; + space = 0; + *space++ = 0; + op = opst; + pp = prst; + cp = cmst; + *op = 200; /* stack EOF */ + *pp = 06; + andflg = 0; + +advanc: + switch (o=symbol()) { + + /* name */ + case 20: + if (*csym==0) + if((peeksym=symbol())==6) { /* ( */ + *csym = 6; /* extern */ + csym[1] = 020; /* int() */ + } else { + csym[1] = 030; /* array */ + if (csym[2]==0) + csym[2] = isn++; + } + *cp++ = block(2,20,csym[1],csym[3],*csym,0); + if (*csym==6) { /* external */ + o = 3; + while(++o<8) { + pblock(csym[o]); + if ((csym[o]&077400) == 0) + break; + } + } else + pblock(csym[2]); + goto tand; + + /* short constant */ + case 21: + case21: + *cp++ = block(1,21,ctyp,0,cval); + goto tand; + + /* floating constant */ + case 23: + *cp++ = block(1,23,3,0,cval); + if (cval) /* non-0 */ + printf(".data;L%d:%o;%o;%o;%o;.text\n",cval,fcval); + goto tand; + + /* string constant: fake a static char array */ + case 22: + *cp++ = block(3, 20, 031, 1, 7, 0, cval); + +tand: + if(cp>=cmst+cmsiz) { + error("Expression overflow"); + exit(1); + } + if (andflg) + goto syntax; + andflg = 1; + goto advanc; + + /* ++, -- */ + case 30: + case 31: + if (andflg) + o =+ 2; + goto oponst; + + /* ! */ + case 34: + /* ~ */ + case 38: + if (andflg) + goto syntax; + goto oponst; + + /* - */ + case 41: + if (!andflg) { + peeksym = symbol(); + if (peeksym==21) { + peeksym = -1; + cval = -cval; + goto case21; + } + o = 37; + } + andflg = 0; + goto oponst; + + /* & */ + /* * */ + case 47: + case 42: + if (andflg) + andflg = 0; else + if(o==47) + o = 35; + else + o = 36; + goto oponst; + + /* ( */ + case 6: + if (andflg) { + o = symbol(); + if (o==7) + o = 101; else { + peeksym = o; + o = 100; + andflg = 0; + } + } + goto oponst; + + /* ) */ + /* ] */ + case 5: + case 7: + if (!andflg) + goto syntax; + goto oponst; + + case 39: /* . */ + mosflg++; + break; + + } + /* binaries */ + if (!andflg) + goto syntax; + andflg = 0; + +oponst: + p = (opdope[o]>>9) & 077; +opon1: + ps = *pp; + if (p>ps | p==ps & (opdope[o]&0200)!=0) { /* right-assoc */ +putin: + switch (o) { + + case 6: /* ( */ + case 4: /* [ */ + case 100: /* call */ + p = 04; + } + if(op>=opst+20) { /* opstack size */ + error("expression overflow"); + exit(1); + } + *++op = o; + *++pp = p; + goto advanc; + } + --pp; + switch (os = *op--) { + + /* EOF */ + case 200: + peeksym = o; + return(*--cp); + + /* call */ + case 100: + if (o!=7) + goto syntax; + build(os); + goto advanc; + + /* mcall */ + case 101: + *cp++ = block(0,0,0,0); /* 0 arg call */ + os = 100; + goto fbuild; + + /* ( */ + case 6: + if (o!=7) + goto syntax; + goto advanc; + + /* [ */ + case 4: + if (o!=5) + goto syntax; + build(4); + goto advanc; + } +fbuild: + build(os); + goto opon1; + +syntax: + error("Expression syntax"); + errflush(o); + return(0); +} + +scdeclare(kw) +{ + extern csym, paraml, parame, peeksym; + int csym[], paraml[], parame[]; + int o; + + while((o=symbol())==20) { /* name */ + if(*csym>0 & *csym!=kw) + redec(); + *csym = kw; + if(kw==8) { /* parameter */ + *csym = -1; + if (paraml==0) + paraml = csym; + else + *parame = csym; + parame = csym; + } + if ((o=symbol())!=9) /* , */ + break; + } + if(o==1 & kw!=8 | o==7 & kw==8) + return; +syntax: + decsyn(o); +} + +tdeclare(kw, offset, mos) +{ + int o, elsize, ds[]; + extern xdflg, peeksym, mosflg, defsym, csym; + int csym[], ssym[]; + + if (kw == 4) { /* struct */ + ssym = 0; + ds = defsym; + mosflg = mos; + if ((o=symbol())==20) { /* name */ + ssym = csym; + o = symbol(); + } + mosflg = mos; + if (o != 6) { /* ( */ + if (ssym==0) + goto syntax; + if (*ssym!=8) /* class structname */ + error("Bad structure name"); + if (ssym[3]==0) { /* no size yet */ + kw = 5; /* deferred MOS */ + elsize = ssym; + } else + elsize = ssym[3]; + peeksym = o; + } else { + if (ssym) { + if (*ssym) + redec(); + *ssym = 8; + ssym[3] = 0; + } + elsize = declist(4); + if ((elsize&01) != 0) + elsize++; + defsym = ds; + if ((o = symbol()) != 7) /* ) */ + goto syntax; + if (ssym) + ssym[3] = elsize; + } + } + mosflg = mos; + if ((peeksym=symbol()) == 1) { /* ; */ + peeksym = -1; + mosflg = 0; + return(offset); + } + do { + offset =+ t1dec(kw, offset, mos, elsize); + if (xdflg & !mos) + return; + } while ((o=symbol()) == 9); /* , */ + if (o==1) + return(offset); +syntax: + decsyn(o); +} + +t1dec(kw, offset, mos, elsize) +{ + int type, nel, defsym[], t1; + extern defsym, mosflg; + + nel = 0; + mosflg = mos; + if ((t1=getype(&nel)) < 0) + goto syntax; + type = 0; + do + type = type<<2 | (t1 & 03); + while(t1 =>> 2); + t1 = type<<3 | kw; + if (defsym[1] & defsym[1]!=t1) + redec(); + defsym[1] = t1; + defsym[3] = elsize; + elsize = length(defsym); + if (mos) { + if (*defsym) + redec(); + else + *defsym = 4; + if ((offset&1)!=0 & elsize!=1) + offset++; + defsym[2] = offset; + } else + if (*defsym == 0) + *defsym = -2; /* default auto */ + if (nel==0) + nel = 1; + defsym[8] = nel; +syntax: + return(nel*elsize); +} + +getype(pnel) +int pnel[]; +{ + int o, type; + extern cval, peeksym, xdflg, defsym, csym, pssiz; + int defsym[], csym[]; + + switch(o=symbol()) { + + case 42: /* * */ + return(getype(pnel)<<2 | 01); + + case 6: /* ( */ + type = getype(pnel); + if ((o=symbol()) != 7) /* ) */ + goto syntax; + goto getf; + + case 20: /* name */ + defsym = csym; + type = 0; + getf: + switch(o=symbol()) { + + case 6: /* ( */ + if (xdflg) { + xdflg = 0; + o = defsym; + scdeclare(8); + defsym = o; + xdflg++; + } else + if ((o=symbol()) != 7) /* ) */ + goto syntax; + type = type<<2 | 02; + goto getf; + + case 4: /* [ */ + if ((o=symbol()) != 5) { /* ] */ + if (o!=21) /* const */ + goto syntax; + *pnel = cval; + if ((o=symbol())!=5) + goto syntax; + } + type = type<<2 | 03; + goto getf; + } + peeksym = o; + return(type); + } +syntax: + decsyn(o); + return(-1); +} + +decsyn(o) +{ + error("Declaration syntax"); + errflush(o); +} + +redec() +{ + extern csym; + int csym[]; + + error("%p redeclared", &csym[4]); +} + +/* storage */ + +regtab 0; +efftab 1; +cctab 2; +sptab 3; +symbuf[4]; +pssiz 9; +namsiz 8; +nwps 4; +hshused; +hshsiz 100; +hshlen 900; /* 9*hshsiz */ +hshtab[900]; +space; +cp; +cmsiz 40; +cmst[40]; +ctyp; +isn 1; +swsiz 120; +swtab[120]; +swp; +contlab; +brklab; +deflab; +nreg 4; +nauto; +stack; +peeksym 0177777; +peekc; +eof; +line 1; +defsym; +xdflg; +csym; +cval; +fcval 0; /* a double number */ +fc1 0; +fc2 0; +fc3 0; +ncpw 2; +nerror; +paraml; +parame; +tmpfil; +strflg; +ossiz 250; +osleft; +mosflg; +debug 0; + diff --git a/c/c01.c b/c/c01.c new file mode 100644 index 0000000000..3e7b6d6337 --- /dev/null +++ b/c/c01.c @@ -0,0 +1,369 @@ +build(op) { + extern cp[], cvtab, opdope[], maprel[]; + auto p1[], t1, d1, p2[], t2, d2, p3[], t3, d3, t; + auto d, dope, leftc, cvn, pcvn; + char cvtab[]; + + if (op==4) { /* [] */ + build(40); /* + */ + op = 36; /* * */ + } + dope = opdope[op]; + if ((dope&01)!=0) { /* binary */ + p2 = disarray(*--cp); + t2 = p2[1]; + chkfun(p2); + d2 = p2[2]; + if (*p2==20) + d2 = 0; + } + p1 = disarray(*--cp); + if (op!=100 & op!=35) /* call, * */ + chkfun(p1); + t1 = p1[1]; + d1 = p1[2]; + if (*p1==20) + d1 = 0; + pcvn = 0; + switch (op) { + + /* : */ + case 8: + if (t1!=t2) + error("Type clash in conditional"); + t = t1; + goto nocv; + + /* , */ + case 9: + *cp++ = block(2, 9, 0, 0, p1, p2); + return; + + /* ? */ + case 90: + if (*p2!=8) + error("Illegal conditional"); + t = t2; + goto nocv; + + /* call */ + case 100: + if ((t1&030) != 020) + error("Call of non-function"); + *cp++ = block(2,100,decref(t1),24,p1,p2); + return; + + /* * */ + case 36: + if (*p1==35 | *p1==29) { /* & unary */ + *cp++ = p1[3]; + return; + } + if (*p1!=20 & d1==0) + d1 = 1; + if ((t1&030) == 020) /* function */ + error("Illegal indirection"); + *cp++ = block(1,36,decref(t1),d1,p1); + return; + + /* & unary */ + case 35: + if (*p1==36) { /* * */ + *cp++ = p1[3]; + return; + } + if (*p1==20) { + *cp++ = block(1,p1[3]==5?29:35,incref(t1),1,p1); + return; + } + error("Illegal lvalue"); + break; + + case 43: /* / */ + case 44: /* % */ + case 73: /* =/ */ + case 74: /* =% */ + d1++; + d2++; + + case 42: /* * */ + case 72: /* =* */ + d1++; + d2++; + break; + + case 30: /* ++ -- pre and post */ + case 31: + case 32: + case 33: + chklval(p1); + *cp++ = block(2,op,t1,max(d1,1),p1,plength(p1)); + return; + + case 39: /* . (structure ref) */ + case 50: /* -> (indirect structure ref) */ + if (p2[0]!=20 | p2[3]!=4) /* not mos */ + error("Illegal structure ref"); + *cp++ = p1; + t = t2; + if ((t&030) == 030) /* array */ + t = decref(t); + setype(p1, t); + if (op==39) /* is "." */ + build(35); /* unary & */ + *cp++ = block(1,21,7,0,p2[5]); + build(40); /* + */ + if ((t2&030) != 030) /* not array */ + build(36); /* unary * */ + return; + } + if ((dope&02)!=0) /* lvalue needed on left? */ + chklval(p1); + if ((dope&020)!=0) /* word operand on left? */ + chkw(p1); + if ((dope&040)!=0) /* word operand on right? */ + chkw(p2); + if ((dope&01)==0) { /* unary op? */ + *cp++ = block(1,op,t1,max(d1,1),p1); + return; + } + if (t2==7) { + t = t1; + p2[1] = 0; /* no int cv for struct */ + t2 = 0; + goto nocv; + } + cvn = cvtab[11*lintyp(t1)+lintyp(t2)]; + leftc = cvn&0100; + t = leftc? t2:t1; + if (op==80 & t1!=4 & t2!=4) { /* = */ + t = t1; + if (leftc | cvn!=1) + goto nocv; + } + if (cvn =& 077) { + if (cvn==077) { + illcv: + error("Illegal conversion"); + goto nocv; + } + if (cvn>4 & cvn<10) { /* ptr conv */ + t = 0; /* integer result */ + cvn = 0; + if ((dope&04)!=0) /* relational? */ + goto nocv; + if (op!=41) /* - */ + goto illcv; + pcvn = cvn; + goto nocv; + } + if (leftc) { + if ((dope&010) != 0) { /* =op */ + if (cvn == 1) { + leftc = 0; + cvn = 8; + t = t1; + goto rcvt; + } else + goto illcv; + } + d1 = (p1=convert(p1, t, d1, cvn, plength(p2)))[2]; + } else { + rcvt: + d2 = (p2=convert(p2, t, d2, cvn, plength(p1)))[2]; + } +nocv:; } + if (d1==d2) + d = d1+1; else + d = max(d1,d2); + if ((dope&04)!=0) { /* relational? */ + if (op>61 & t>=010) + op =+ 4; /* ptr relation */ + t = 0; /* relational is integer */ + } + *cp++ = optim(block(2,op,t,d,p1,p2)); + if (pcvn) { + p1 = *--cp; + *cp++ = block(1,50+pcvn,0,d,p1); + } + return; + *cp++ = block(1,op,t1,d1==0?1:d1,p1); +} + +setype(p, t) +int p[]; +{ + int p1[]; + + if ((p[1]&07) != 4) /* not structure */ + return; + p[1] = t; + switch(*p) { + + case 29: /* & */ + case 35: + setype(p[3], decref(t)); + return; + + case 36: /* * */ + setype(p[3], incref(t)); + return; + + case 40: /* + */ + setype(p[4], t); + } +} + +chkfun(p) +int p[]; +{ + if ((p[1]&030)==020) /* func */ + error("Illegal use of function"); +} + +optim(p) +int p[]; +{ + int p1[], p2[], t; + + if (*p != 40) /* + */ + return(p); + p1 = p[3]; + p2 = p[4]; + if (*p1==21) { /* const */ + t = p1; + p1 = p2; + p2 = t; + } + if (*p2 != 21) /* const */ + return(p); + if ((t=p2[3]) == 0) /* const 0 */ + return(p1); + if (*p1!=35 & *p1!=29) /* not & */ + return(p); + p2 = p1[3]; + if (*p2!=20) { /* name? */ + error("C error (optim)"); + return(p); + } + p2[4] =+ t; + return(p1); +} + +disarray(p) +int p[]; +{ + extern cp; + int t, cp[]; + + if (((t = p[1]) & 030)!=030 | p[0]==20&p[3]==4) /* array & not MOS */ + return(p); + p[1] = decref(t); + *cp++ = p; + build(35); /* add & */ + return(*--cp); +} + +convert(p, t, d, cvn, len) +int p[]; +{ + int c, p1[]; + + if (*p==21) { /* constant */ + c = p[3]; + switch(cvn) { + + case 4: /* int -> double[] */ + c =<< 1; + + case 3: /* int -> float[] */ + c =<< 1; + + case 2: /* int -> int[] */ + c =<< 1; + p[3] = c; + return(p); + + case 10: /* i -> s[] */ + p[3] = c*len; + return(p); + } + } + if (cvn==10) /* i -> s[]; retrun i*len */ + return(block(2,42,t,d+2,p,block(1,21,0,0,len))); + return(block(1, 50+cvn, t, max(1,d), p)); +} + +chkw(p) +int p[]; { + extern error; + auto t; + + if ((t=p[1])>1 & t<=07) + error("Integer operand required"); + return; +} + +lintyp(t) +{ + if (t<=07) + return(t); + if ((t&037)==t) + return((t&07)+5); + return(10); +} + +error(s, p1, p2, p3, p4, p5, p6) { + extern line, fout, nerror; + int f; + + nerror++; + flush(); + f = fout; + fout = 1; + printf("%d: ", line); + printf(s, p1, p2, p3, p4, p5, p6); + putchar('\n'); + fout = f; +} + +block(n, op, t, d, p1,p2,p3) +int p1[],p2[],p3[]; { + int p[], ap[], space[]; + extern space; + + ap = &op; + n =+ 3; + p = space; + while(n--) + pblock(*ap++); + return(p); +} + +pblock(p) +{ + extern space, osleft; + int space[]; + + *space++ = p; + if (--osleft<=0) { + error("Expression overflow"); + exit(1); + } +} + +chklval(p) +int p[]; { + extern error; + + if (*p!=20 & *p !=36) + error("Lvalue required"); +} + +max(a, b) +{ + if (a>b) + return(a); + return(b); +} + diff --git a/c/c02.c b/c/c02.c new file mode 100644 index 0000000000..93bd35406c --- /dev/null +++ b/c/c02.c @@ -0,0 +1,505 @@ +extdef() { + extern eof, cval, defsym; + extern csym, strflg, xdflg, peeksym, fcval; + int o, c, cs[], type, csym[], width, nel, ninit, defsym[]; + char s[]; + float sf; + double fcval; + + if(((o=symbol())==0) | o==1) /* EOF */ + return; + type = 0; + if (o==19) { /* keyword */ + if ((type=cval)>4) + goto syntax; /* not type */ + } else { + if (o==20) + csym[4] =| 0200; /* remember name */ + peeksym = o; + } + defsym = 0; + xdflg++; + tdeclare(type, 0, 0); + if (defsym==0) + return; + *defsym = 6; + cs = &defsym[4]; + printf(".globl %p\n", cs); + strflg = 1; + xdflg = 0; + type = defsym[1]; + if ((type&030)==020) { /* a function */ + printf(".text\n%p:\nmov r5,-(sp); mov sp,r5\n", cs); + declist(0); + strflg = 0; + c = 0; + if ((peeksym=symbol())!=2) { /* { */ + blkhed(); + c++; + } + statement(1); + retseq(); + if (c) + blkend(); + return; + } + width = length(defsym); + if ((type&030)==030) /* array */ + width = plength(defsym); + nel = defsym[8]; + ninit = 0; + if ((peeksym=symbol()) == 1) { /* ; */ + printf(".comm %p,%o\n", &defsym[4], nel*width); + peeksym = -1; + return; + } + printf(".data\n%p:", &defsym[4]); +loop: { + ninit++; + switch(o=symbol()) { + + case 22: /* string */ + if (width!=2) + bxdec(); + printf("L%d\n", cval); + break; + + case 41: /* - const */ + if ((o=symbol())==23) { /* float */ + fcval = -fcval; + goto case23; + } + if (o!=21) + goto syntax; + cval = -cval; + + case 21: /* const */ + if (width==1) + printf(".byte "); + if (width>2) { + fcval = cval; + goto case23; + } + printf("%o\n", cval); + break; + + case 20: /* name */ + if (width!=2) + bxdec(); + printf("%p\n", &csym[4]); + break; + + case 23: + case23: + if (width==4) { + sf = fcval; + printf("%o;%o\n", sf); + break; + } + if (width==8) { + printf("%o;%o;%o;%o\n", fcval); + break; + } + bxdec(); + break; + + default: + goto syntax; + + } + } if ((o=symbol())==9) goto loop; /* , */ + if (o==1) { /* ; */ + done: + if (ninit=swtab+swsiz) { + error("Switch table overflow"); + } else { + *swp++ = isn; + *swp++ = cval; + label(isn++); + } + goto stmt; + + /* switch */ + case 15: + o1 = brklab; + brklab = isn++; + np = pexpr(); + if (np[1]>1 & np[1]<07) + error("Integer required"); + rcexpr(block(1,110,0,0,np), regtab); + pswitch(); + brklab = o1; + return; + + /* default */ + case 20: + if (swp==0) + error("Default not in switch"); + if ((o=symbol())!=8) /* : */ + goto syntax; + deflab = isn++; + label(deflab); + goto stmt; + } + + error("Unknown keyword"); + goto syntax; + + /* name */ + case 20: + if (peekc==':') { + peekc = 0; + if (csym[0]>0) { + error("Redefinition"); + goto stmt; + } + csym[0] = 7; + csym[1] = 030; /* int[] */ + if (csym[2]==0) + csym[2] = isn++; + label(csym[2]); + goto stmt; + } + } + + peeksym = o; + rcexpr(tree(), efftab); + goto semi; + +semi: + if ((o=symbol())!=1) /* ; */ + goto syntax; + return; + +syntax: + error("Statement syntax"); + errflush(o); + goto stmt; +} + +pexpr() +{ + auto o, t; + + if ((o=symbol())!=6) /* ( */ + goto syntax; + t = tree(); + if ((o=symbol())!=7) /* ) */ + goto syntax; + return(t); +syntax: + error("Statement syntax"); + errflush(o); + return(0); +} + +pswitch() { + extern swp[], isn, swtab[], printf, deflab, statement, brklab; + extern label; + int sswp[], dl, cv, swlab; + + sswp = swp; + if (swp==0) + swp = swtab; + swlab = isn++; + printf("jsr pc,bswitch; l%d\n", swlab); + dl = deflab; + deflab = 0; + statement(0); + if (!deflab) { + deflab = isn++; + label(deflab); + } + printf("L%d:.data;L%d:", brklab, swlab); + while(swp>sswp & swp>swtab) { + cv = *--swp; + printf("%o; l%d\n", cv, *--swp); + } + printf("L%d; 0\n.text\n", deflab); + deflab = dl; + swp = sswp; +} + +blkhed() +{ + extern symbol, cval, peeksym, paraml[], parame[]; + extern error, rlength, setstk, defvec, isn, defstat; + extern stack, hshtab[], hshsiz, pssiz; + int al, pl, cs[], hl, t[]; + + declist(0); + stack = al = 0; + pl = 4; + while(paraml) { + *parame = 0; + paraml = *(cs = paraml); + if (cs[1]==2) /* float args -> double */ + cs[1] = 3; + cs[2] = pl; + *cs = 10; + if ((cs[1]&030) == 030) /* array */ + cs[1] =- 020; /* set ref */ + pl =+ rlength(cs); + } + cs = hshtab; + hl = hshsiz; + while(hl--) { + if (cs[4]) { + if (cs[0]>1 & (cs[1]&07)==05) { /* referred structure */ + t = cs[3]; + cs[3] = t[3]; + cs[1] = cs[1]&077770 | 04; + } + switch(cs[0]) { + + /* sort unmentioned */ + case -2: + cs[0] = 5; /* auto */ + + /* auto */ + case 5: + al =- trlength(cs); + cs[2] = al; + break; + + /* parameter */ + case 10: + cs[0] = 5; + break; + + /* static */ + case 7: + cs[2] = isn; + printf(".bss; L%d: .=.+%o; .text\n", + isn++, trlength(cs)); + break; + + } + } + cs = cs+pssiz; + } + setstk(al); +} + +blkend() { + extern hshtab[], hshsiz, pssiz, hshused, debug; + auto i, hl; + + i = 0; + hl = hshsiz; + while(hl--) { + if(hshtab[i+4]) { +if (debug) +if (hshtab[i]!=1) +error("%p %o %o %o %o %o", + &hshtab[i+4], + hshtab[i], + hshtab[i+1], + hshtab[i+2], + hshtab[i+3], + hshtab[i+8]); + if (hshtab[i]==0) + error("%p undefined", &hshtab[i+4]); + if((hshtab[i+4]&0200)==0) { /* not top-level */ + hshtab[i+4] = 0; + hshused--; + } + } + i =+ pssiz; + } +} + +errflush(o) { + extern symbol, peeksym, eof; + + while(o>3) /* ; { } */ + o = symbol(); + peeksym = o; +} + +declist(mosflg) +{ + extern peeksym, csym[], cval; + auto o, offset; + + offset = 0; + while((o=symbol())==19 & cval<10) + if (cval<=4) + offset = tdeclare(cval, offset, mosflg); + else + scdeclare(cval); + peeksym = o; + return(offset); +} + +easystmt() +{ + extern peeksym, peekc, cval; + + if((peeksym=symbol())==20) /* name */ + return(peekc!=':'); /* not label */ + if (peeksym==19) { /* keyword */ + switch(cval) + + case 10: /* goto */ + case 11: /* return */ + case 17: /* break */ + case 18: /* continue */ + return(1); + return(0); + } + return(peeksym!=2); /* { */ +} + +branch(lab) +{ + printf("br L%d\n", lab); +} + diff --git a/c/c03.c b/c/c03.c new file mode 100644 index 0000000000..4ca078c124 --- /dev/null +++ b/c/c03.c @@ -0,0 +1,251 @@ +retseq() +{ + printf("jmp retrn\n"); +} + +decref(t) +{ + + if ((t & 077770) == 0) { + error("Illegal indirection"); + return(t); + } + return((t>>2) & 077770 | t&07); +} + +incref(t) +{ + return((t<<2)&077740 | (t&07) | 010); +} + +jumpc(tree, lbl, cond) +int tree[]; +{ + extern cctab, block, rcexpr; + + rcexpr(block(1,easystmt()+103,tree,lbl,cond),cctab); +} + +rcexpr(tree, table) +int tree[], table; +{ + extern space, putwrd, putchar, line; + int c, sp[]; + + if (tree == 0) + return; + putchar('#'); + c = space; + c =/ 2; /* # addresses per word */ + sp = 0; + putwrd(c); + putwrd(tree); + putwrd(table); + putwrd(line); + while(c--) + putwrd(*sp++); +} + +jump(lab) { + extern printf; + + printf("jmp\tl%d\n", lab); +} + +label(l) { + extern printf; + + printf("L%d:", l); +} + +setstk(a) { + extern printf, stack; + auto ts; + + ts = a-stack; + stack = a; + switch(ts) { + + case 0: + return; + + case 0177776: /* -2 */ + printf("tst -(sp)\n"); + return; + + case 0177774: /* -4 */ + printf("cmp -(sp),-(sp)\n"); + return; + } + printf("add $%o,sp\n", ts); +} + +plength(p) +int p[]; +{ + int t, l; + + if (((t=p[1])&077770) == 0) /* not a reference */ + return(1); + p[1] = decref(t); + l = length(p); + p[1] = t; + return(l); +} + +length(cs) +int cs[]; +{ + extern hshtab[]; + int t; + + t = cs[1]; + if ((t&030) == 030) /* array */ + t = decref(t); + if (t>=010) + return(2); + switch(t&07) { + + case 0: /* int */ + return(2); + + case 1: /* char */ + return(1); + + case 2: /* float */ + return(4); + + case 3: /* double */ + return(8); + + case 4: /* structure */ + if (cs>=hshtab) /* in namelist */ + return(cs[3]); + return(getlen(cs)); + + case 5: + error("Bad structure"); + return(0); + } + error("Compiler error (length)"); +} + +getlen(p) +int p[]; +{ + int p1[]; + + switch(*p) { + + case 20: /* name */ + return(p[2]); + + case 35: + case 29: /* & */ + case 36: /* * */ + case 100: /* call */ + case 41: /* - */ + return(getlen(p[3])); + + case 40: /* + */ + p1 = p[4]; + if ((p1[1]&07) == 04) + return(getlen(p1)); + return(getlen(p[3])); + } + error("Unimplemented pointer conversion"); + return(0); +} + +rlength(cs) +int cs[]; +{ + auto l; + + if (((l=length(cs))&01) != 0) + l++; + return(l); +} + +tlength(cs) +int cs[]; +{ + int nel; + + if ((nel = cs[8]) == 0) + nel = 1; + return(length(cs)*nel); +} + +trlength(cs) +int cs[]; +{ + int l; + + if (((l=tlength(cs))&01) != 0) + l++; + return(l); +} + +printn(n,b) { + extern putchar; + auto a; + + if(a=n/b) /* assignment, not test for equality */ + printn(a, b); /* recursive */ + putchar(n%b + '0'); +} + +printf(fmt,x1,x2,x3,x4,x5,x6,x7,x8,x9) +char fmt[]; { + extern printn, putchar, namsiz, ncpw; + char s[]; + auto adx[], x, c, i[]; + + adx = &x1; /* argument pointer */ +loop: + while((c = *fmt++) != '%') { + if(c == '\0') + return; + putchar(c); + } + x = *adx++; + switch (c = *fmt++) { + + case 'd': /* decimal */ + case 'o': /* octal */ + if(x < 0) { + x = -x; + if(x<0) { /* - infinity */ + if(c=='o') + printf("100000"); + else + printf("-32767"); + goto loop; + } + putchar('-'); + } + printn(x, c=='o'?8:10); + goto loop; + + case 's': /* string */ + s = x; + while(c = *s++) + putchar(c); + goto loop; + + case 'p': + s = x; + putchar('_'); + c = namsiz; + while(c--) + if (*s) + putchar((*s++)&0177); + goto loop; + } + putchar('%'); + fmt--; + adx--; + goto loop; +} + diff --git a/c/c10.c b/c/c10.c new file mode 100644 index 0000000000..e8a451d888 --- /dev/null +++ b/c/c10.c @@ -0,0 +1,588 @@ +/* + + C compiler, part 2 + + Copyright 1972 Bell Telephone Laboratories, Inc. + +*/ + +waste() /* waste space */ +{ + waste(waste(waste),waste(waste),waste(waste)); + waste(waste(waste),waste(waste),waste(waste)); + waste(waste(waste),waste(waste),waste(waste)); + waste(waste(waste),waste(waste),waste(waste)); + waste(waste(waste),waste(waste),waste(waste)); + waste(waste(waste),waste(waste),waste(waste)); + waste(waste(waste),waste(waste),waste(waste)); + waste(waste(waste),waste(waste),waste(waste)); +} +main(argc, argv) +char argv[][]; +{ + extern fout, fin, nerror, line; + extern getwrd, rcexpr, tmpfil; + extern cctab[], regtab[], efftab[], sptab[]; + int sp[], c, table[], tabtab[3][], tree; + + if (argc<4) { + error("Arg count"); + exit(1); + } + if((fin=open(argv[1],0))<0) { + error("Cant't find %s", argv[1]); + exit(1); + } + if((fout=creat(argv[3],017))<0) { + error("Can't create %s", argv[3]); + exit(1); + } + tmpfil = argv[2]; + + tabtab[0] = regtab; + tabtab[1] = efftab; + tabtab[2] = cctab; + tabtab[3] = sptab; + while(c=getchar()) { + if(c=='#') { + sp = 0; + c = getwrd(); + tree = getwrd(); + table = tabtab[getwrd()]; + line = getwrd(); + while(c--) + *sp++ = getwrd(); + rcexpr(tree, table, 0); + } else + putchar(c); + } + flush(); + exit(nerror!=0); +} + +match(tree, table, nreg) +int tree[], table[]; { + extern opdope[], cctab, maprel; + int op, d1, d2, t1, t2, p1[], p2[], dope, cctab[]; + int maprel[]; + char mp[]; + + if (tree==0) + return(0); + op = *tree; + if (op>=29) /* if not leaf */ + p1 = tree[3]; + else + p1 = tree; + t1 = p1[1]; + d1 = dcalc(p1, nreg); + if (((dope=opdope[op])&01)!=0) { /* binary? */ + p2 = tree[4]; + t2 = p2[1]; + d2 = dcalc(p2, nreg); + if (d2>d1 & (dope&0100)!=0) /* commute? */ + if (table!=cctab | (op!=47&op!=48)) { /* commute? */ + if ((dope&04)!=0) /* relation? */ + *tree = op = maprel[op-60]; + dope = t1; + t1 = t2; + t2 = dope; + dope = p1; + tree[3] = p1 = p2; + tree[4] = p2 = dope; + dope = d1; + d1 = d2; + d2 = dope; + dope = t1; + t1 = t2; + t2 = dope; + } + } + while(*table) { + if (*table++ == op) goto foundop; + table++; + } + return(0); +foundop: + table = *table; +nxtry: + mp = table; + if (*mp == 0) + return(0); + if (d1 > (*mp&077) | (*mp>=0100)&(*p1!=36)) + goto notyet; + if (notcompat(t1, mp[1])) + goto notyet; + if ((opdope[op]&01)!=0 & p2!=0) { + if (d2 > (mp[2]&077) | (mp[2]>=0100)&(*p2!=36)) + goto notyet; + if (notcompat(t2,mp[3])) + goto notyet; + } +now: + return(table[2]); +notyet: + table = table+3; + goto nxtry; +} + +rcexpr(tree, table, reg) +int tree[]; { + extern cexpr, regtab, cctab, sptab, printf, error; + extern jumpc, cbranch; + int r, modf; + + if(tree==0) + return(0); + if(*tree == 103 | *tree==104) { + (*tree==103?jumpc:cbranch)(tree[1],tree[2],tree[3],0); + return(0); + } + modf = isfloat(tree)? 'f':0; + if (*tree == 110) { /* force r0 */ + if((r=rcexpr(tree[3], table, reg)) != 0) + printf("mov%c r%d,r0\n", modf, r); + return(0); + } + if ((r=cexpr(tree, table, reg))>=0) + return(r); + if (table!=regtab) + if((r=cexpr(tree, regtab, reg))>=0) { + if (table==sptab) + printf("mov%c r%d,-(sp)\n", modf, r); + if (table==cctab) { + if (modf=='f') + printf("cfcc\n"); + printf("tst%c r%d\n", modf, r); + } + return(0); + } + error("No match for op %d", *tree); +} + +cexpr(tree, table, reg) +int tree[][], table[]; { + extern match, nreg, printf, pname, putchar, regtab; + extern sptab, cctab, rcexpr, prins, rlength, popstk; + extern collcon, isn, label, branch, cbranch; + extern maprel[]; + int p1[], p2[], c, r, p[], otable[], ctable[], regtab[], cctab[]; + int sptab[]; + char string[], match[]; + int reg1, rreg; + + if ((c = *tree)==100) { /* call */ + p1 = tree[3]; + p2 = tree[4]; + r = 0; + if(*p2) { + while (*p2==9) { /* comma */ + rcexpr(p2[4], sptab, 0); + r =+ arlength((p=p2[4])[1]); + p2 = p2[3]; + } + rcexpr(p2, sptab, 0); + r =+ arlength(p2[1]); + } + *tree = 101; + tree[2] = r; /* save arg length */ + } + if(c==90) { /* ? */ + cbranch(tree[3], c=isn++, 0, reg); + rcexpr(tree[4][3], table, reg); + branch(r=isn++, 0); + label(c); + reg = rcexpr(tree[4][4], table, reg); + label(r); + goto retrn; + } + reg = oddreg(tree, reg); + reg1 = reg+1; + if ((string=match(tree, table, nreg-reg))==0) + return(-1); + p1 = tree[3]; + p2 = tree[4]; +loop: + switch(c = *string++) { + + case '\0': + p = tree; + if (*p==101) { + if (p[2]>0) + popstk(p[2]); + reg = 0; + } +retrn: + c = isfloat(tree); + if (table==cctab & c) + printf("cfcc\n"); + if (!c) + if ((c = *tree)==43 | c==73) + reg--; + return(reg); + + /* A1 */ + case 'A': + p = tree[3]; + goto adr; + + /* A2 */ + case 'B': + p = tree[4]; + goto adr; + + /* A */ + case 'O': + p = tree; + adr: + pname(p); + goto loop; + + /* I */ + case 'M': + if ((c = *string)=='\'') + string++; else + c = 0; + prins(*tree, c); + goto loop; + + /* B1 */ + case 'C': + if ((c = *tree)<28) + p = tree; + else + p = tree[3]; + goto pbyte; + + /* BF */ + case 'P': + p = tree; + goto pb1; + + /* B2 */ + case 'D': + p = tree[4]; + pbyte: + if (p[1]==1) /* char type? */ + putchar('b'); + pb1: + if (isfloat(p)) + putchar('f'); + goto loop; + + /* BE */ + case 'L': + if (tree[3][1]==1 | tree[4][1]==1) + putchar('b'); + p = tree; + goto pb1; + + /* C1 */ + case 'E': + p = p1[3]; + goto const; + + /* C2 */ + case 'F': + p = p2[3]; + const: + printf("%o", p); + goto loop; + + /* F */ + case 'G': + p = p1; + goto subtre; + + /* S */ + case 'K': + p = p2; + goto subtre; + + /* H */ + case 'H': + p = tree; + + subtre: + ctable = regtab; + r = reg; + c = *string++ - 'A'; + if ((c&02)!=0) + ctable = sptab; + if ((c&04)!=0) + ctable = cctab; + if((c&010)!=0) + r = reg1; + if((c&01)!=0) + if(*p==36) { + p = p[3]; + if(collcon(p) & ctable!=sptab) + p = p[3]; + } + rreg = rcexpr(p, ctable, r); + if (rreg==r | ctable!=regtab) + goto loop; + if (string[-2]=='G') /* left operand */ + if (oddreg(tree, 0)==1) { + printf("mov r%d,r%d\n", rreg, r); + goto loop; + } + if (r==reg) { + reg = rreg; + reg1 = rreg+1; + } else + reg1 = rreg; + goto loop; + + /* R */ + case 'I': + r = reg; + if (*string=='-') { + string++; + r--; + } + goto preg; + + /* R1 */ + case 'J': + r = reg1; + preg: + if (r>=5) + error("Register overflow: simplify expression"); + printf("r%d", r); + goto loop; + + case '#': + p = p1[3]; + goto nmbr; + + case '"': + p = p2[3]; + goto nmbr; + + case '~': + p = tree[3]; + + nmbr: + if(collcon(p)) { + if (*p==41) /* - */ + putchar('-'); + switch (*(p = p[4])) { + + case 21: /* number */ + if (p[3]) + printf("%d.", p[3]); + break; + + case 35: /* & name */ + pname(p[3]); + break; + + } + } + goto loop; + + /* V */ + case 'V': + tree[0] = maprel[(c=tree[0])-60]; + goto loop; + + /* Z */ + case 'Z': + printf("$%o", p1[5]+p1[4]); + goto loop; + + case '^': /* for ++ -- */ + printf("%o", tree[4]); + goto loop; + } + putchar(c); + goto loop; +} + +pname(p) +int p[][]; { + char np[]; + int i; + +loop: + switch(*p) { + + case 21: /* const */ + printf("$%o", p[3]); + return; + + case 23: /* float const */ + printf("L%d", p[3]); + return; + + casename: + case 20: /* name */ + if (i=p[4]) + printf("%d.+", i); + switch(p[3]) { + + case 5: /* auto, param */ + printf("%d.(r5)", p[5]); + return; + + /* extern */ + case 6: + printf("%p", &p[5]); + return; + + case 4: + error("Illegal structure reference"); + printf("$0"); + return; + + } + printf("L%d", p[5]); + return; + + case 35: /* & */ + putchar('$'); + p = p[3]; + goto loop; + + case 36: /* * */ + putchar('*'); + p = p[3]; + goto loop; + + } + error("pname called illegally"); +} + +dcalc(p, nreg) +int p[]; { + int op, t, p1[], p2[]; + + if (p==0) + return(0); + op = *p; + switch (op) { + + case 20: /* name */ + case 35: /* & (non-automatic) */ + return(12); + + case 21: /* short constant */ + return(p[3]==0? 4:8); + + case 23: /* float const */ + return(p[3]==0? 4:12); + + case 36: /* * */ + p1 = p[3]; + if (*p1==20) /* name or offset name */ + return(12); + } + +def: + return(p[2]<=nreg? 20: 24); +} + +notcompat(at, st) { + + if (st==0) /* word, byte */ + return(at>1 & at<=07); + if (st==1) /* word */ + return(at>0 & at<=07); + st =- 2; + if ((at&077740) != 0) + at = 020; /* *int for **stuff */ + if ((at&077770) != 0) + at = at&07 | 020; + if (st==2 & at==3) + at = 2; + return(st != at); +} + +prins(op, c) { + extern instab[], printf; + int insp[]; + + insp = instab; + while(*insp) { + if (*insp++ == op) { + if ((c = insp[c!=0])==0) + goto err; + printf("%s", c); + return; + } else + insp = insp + 2; + } +err: + error("No match' for op %d", op); +} + +collcon(p) +int p[]; { + int p1[], t[]; + + if(*p==40 | *p==41) { + if(*(p1=p[4])==21) { /* number */ + return(1); + } + if (*p1==35) + return(1); + if (*(p1=p[3])==35) { + p1 = p[3]; + p[3] = p[4]; + p[4] = p1; + return(1); + } + } + return(0); +} + +isfloat(t) +int t[]; +{ + extern opdope[]; + int rt; + + if ((opdope[t[0]]&04)!=0) /* relational */ + t = t[3]; + if ((rt=t[1])>=2 & rt<=3) + return(rt); + return(0); +} + +nreg 3; +isn 10000; +namsiz 8; +line; +tmpfil; +nerror; + +oddreg(t, reg) +int t[]; +{ + if (!isfloat(t)) + switch(*t) { + case 43: /* / */ + case 44: /* % */ + case 73: /* =/ */ + case 74: /* =% */ + reg++; + + case 42: /* * */ + case 72: /* =* */ + return(reg|1); + } + return(reg); +} + +arlength(t) +{ + int arl; + + if ((arl=rlength(t)) == 4) + return(8); + return(arl); +} + +maprel[] 60, 61, 64, 65, 62, 63, 68, 69, 66, 67; + diff --git a/c/c11.c b/c/c11.c new file mode 100644 index 0000000000..948b3c7a24 --- /dev/null +++ b/c/c11.c @@ -0,0 +1,261 @@ +jumpc(tree, lbl, cond) +int tree[]; { + extern jump, cctab[], rcexpr, isn, label, branch, cbranch; + int l1, l2; + + if (tree==0) + return; + switch(*tree) { + + /* & */ + case 47: + if (cond) { + cbranch(tree[3], l1=isn++, 0, 0); + cbranch(tree[4], l1, 0, 0); + jump(lbl); + label(l1); + } else { + cbranch(tree[3], l1=isn++, 0, 0); + cbranch(tree[4], l2=isn++, 1, 0); + label(l1); + jump(lbl); + label(l2); + } + return; + + /* | */ + case 48: + if (cond) { + cbranch(tree[3], l1=isn++, 1, 0); + cbranch(tree[4], l2=isn++, 0, 0); + label(l1); + jump(lbl); + label(l2); + } else { + cbranch(tree[3], l1=isn++, 1, 0); + cbranch(tree[4], l1, 1, 0); + jump(lbl); + label(l1); + } + return; + + /* ! */ + case 34: + jumpc(tree[3], lbl, !cond); + return; + } + rcexpr(tree, cctab, 0); + branch(l1=isn++, *tree, cond); + jump(lbl); + label(l1); + return; +} + +cbranch(tree, lbl, cond, reg) +int tree[]; { + extern branch, cctab[], rcexpr, isn, label; + int l1; + + if (tree==0) + return; + switch(*tree) { + + /* & */ + case 47: + if (cond) { + cbranch(tree[3], l1=isn++, 0, reg); + cbranch(tree[4], lbl, 1, reg); + label(l1); + } else { + cbranch(tree[3], lbl, 0, reg); + cbranch(tree[4], lbl, 0, reg); + } + return; + + /* | */ + case 48: + if (cond) { + cbranch(tree[3], lbl, 1, reg); + cbranch(tree[4], lbl, 1, reg); + } else { + cbranch(tree[3], l1=isn++, 1, reg); + cbranch(tree[4], lbl, 0, reg); + label(l1); + } + return; + + /* ! */ + case 34: + cbranch(tree[3], lbl, !cond, reg); + return; + } + rcexpr(tree, cctab, reg); + branch(lbl, *tree, !cond); + return; +} + + +branch(lbl, op, c) { + extern printf, prins, opdope[]; + + if(op) { + if((opdope[op]&04)==0) + op = 61; + prins(op,c); + } else + printf("br"); + printf("\tl%d\n", lbl); +} + +jump(lab) { + extern printf; + + printf("jmp\tl%d\n", lab); +} + +label(l) { + extern printf; + + printf("l%d:", l); +} + + +popstk(a) { + extern printf; + + switch(a) { + + case 0: + return; + + case 2: + printf("tst (sp)+\n"); + return; + + case 4: + printf("cmp (sp)+,(sp)+\n"); + return; + } + printf("add $%o,sp\n", a); +} + +length(t) { + + if (t>=010) + return(2); + switch(t) { + + case 0: + return(2); + + case 1: + return(1); + + case 2: + return(4); + + case 3: + return(8); + + case 4: + return(4); + + } + return(1024); +} + +rlength(c) { + extern length; + auto l; + + return((l=length(c))==1? 2: l); +} + +printd(n) { + int a; + + if(a=n/10) + printd(a); + putchar(n%10 + '0'); +} + +printo(n) +{ + int a; + if (a = (n>>3) & 017777) + printo(a); + putchar((n&07) + '0'); +} + +printf(fmt,x1,x2,x3,x4,x5,x6,x7,x8,x9) +char fmt[]; { + extern namsiz, ncpw; + char s[]; + auto adx[], x, c, i[]; + + adx = &x1; /* argument pointer */ +loop: + while((c = *fmt++) != '%') { + if(c == '\0') + return; + putchar(c); + } + x = *adx++; + switch (c = *fmt++) { + + case 'o': + printo(x); + goto loop; + + case 'd': /* decimal */ + if(x < 0) { + x = -x; + if(x<0) { /* - infinity */ + printf("-32768"); + goto loop; + } + putchar('-'); + } + printd(x); + goto loop; + + case 'c': + if (x) + putchar(x); + goto loop; + + case 's': /* string */ + s = x; + while(c = *s++) + putchar(c); + goto loop; + + case 'p': + s = x; + putchar('_'); + c = namsiz; + while(c--) + if(*s) + putchar((*s++)&0177); + goto loop; + } + putchar('%'); + fmt--; + adx--; + goto loop; +} + +error(s, p1, p2) { + extern printf, line, fout, flush, putchar, nerror; + int f; + + nerror++; + flush(); + f = fout; + fout = 1; + printf("%d: ", line); + printf(s, p1, p2); + putchar('\n'); + fout = f; +} + diff --git a/c/cctab.s b/c/cctab.s deleted file mode 100644 index 97886397e8..0000000000 --- a/c/cctab.s +++ /dev/null @@ -1,118 +0,0 @@ -/ c code tables-- set condition codes - -.globl _cctab - -_cctab=.;.+2 - 20.; rest - 21.; rest - 22.; rest - 30.; rest - 31.; rest - 34.; rest - 35.; rest - 36.; rest - 37.; rest - 40.; rest - 41.; rest - 42.; rest - 43.; rest - 44.; rest - 45.; rest - 46.; rest - 47.; rest - 48.; rest - 60.; cc60 - 61.; cc60 - 62.; cc60 - 63.; cc60 - 64.; cc60 - 65.; cc60 - 66.; cc60 - 67.; cc60 - 68.; cc60 - 69.; cc60 - 70.; rest - 71.; rest - 72.; rest - 73.; rest - 74.; rest - 75.; rest - 76.; rest - 77.; rest - 78.; rest - 79.; rest - 80.; rest - -/ relationals -cc60: -%a,z - tstB1 A1 - -%n*,z - F* - tstB1 #1(R) - -%n,z - F - tst R - -%a,a - cmpBE A1,A2 - -%n*,a - F* - cmpBE #1(R),A2 - -%n,a - F - cmpB2 R,A2 - -%n*,e* - F* - S1* - cmpBE #1(R),#2(R1) - -%n*,e - F* - S1 - cmpB1 #1(R),R1 - -%n,e* - F - S1* - cmpB2 R,#2(R1) - -%n,e - F - S1 - cmp R,R1 - -%n*,n* - FS* - S* - cmpBE (sp)+,#2(R) - -%n*,n - FS* - S - cmpB1 *(sp)+,R - -%n,n* - FS - S* - cmpB2 (sp)+,#2(R) - -%n,n - FS - S - cmp (sp)+,R - -/ set codes right -rest: -%n,n - H - -.data -.even -.text - diff --git a/c/cvopt.c b/c/cvopt.c deleted file mode 100644 index 63224ce371..0000000000 --- a/c/cvopt.c +++ /dev/null @@ -1,357 +0,0 @@ -main() { -/* - A1 -> A - A2 B - A O - B1 C - B2 D - BE L - BF P - C1 E - C2 F - F G - H H - R I - R1 J - S K - I M - M N - - * +1 - S +2 - C +4 - 1 +8 - - z -> 4 - c 10 - a 14 - e 20 - n 63 - * +0100 -*/ - - extern putchar,getc,peekc,printf,flag,flush; - - auto c,snlflg,nlflg,t,smode,m,ssmode; - - smode = nlflg = snlflg = ssmode = 0; -loop: - c = getc(); - if (c!='\n' & c!='\t') nlflg = 0; - if (ssmode!=0 & c!='%') { - ssmode = 0; - printf(".data\n1:<"); - } - switch(c) { - - case '\0': - printf(".text; 0\n"); - flush(); - return; - - case ':': - if (!smode) - printf("=.+2; 0"); else - putchar(':'); - goto loop; - - case 'A': - if ((c=getc())=='1' | c=='2') { - putchar(c+'A'-'1'); - goto loop; - } - putchar('O'); - peekc = c; - goto loop; - - case 'B': - switch (getc()) { - - case '1': - putchar('C'); - goto loop; - - case '2': - putchar('D'); - goto loop; - - case 'E': - putchar('L'); - goto loop; - - case 'F': - putchar('P'); - goto loop; - } - putchar('?'); - goto loop; - - case 'C': - putchar(getc()+'E'-'1'); - goto loop; - - case 'F': - putchar('G'); - goto subtre; - - case 'R': - if ((c=getc()) == '1') - putchar('J'); else { - putchar('I'); - peekc = c; - } - goto loop; - - case 'H': - putchar('H'); - goto subtre; - - case 'I': - putchar('M'); - goto loop; - - case 'M': - putchar('N'); - snlflg++; - goto loop; - - case 'S': - putchar('K'); -subtre: - snlflg = 1; - t = 'A'; -l1: - switch (c=getc()) { - - case '*': - t++; - goto l1; - - case 'S': - t =+ 2; - goto l1; - - case 'C': - t =+ 4; - goto l1; - - case '1': - t =+ 8; - goto l1; - } - peekc = c; - putchar(t); - goto loop; - - case '#': - if(getc()=='1') - putchar('#'); else - putchar('"'); - goto loop; - - case '%': - if (smode) - printf(".text;"); -loop1: - switch (c=getc()) { - - case 'a': - m = 16; - t = flag(); - goto pf; - - case ',': - putchar(';'); - goto loop1; - - case 'i': - m = 12; - t = flag(); - goto pf; - case 'z': - m = 4; - t = 0; - goto pf; - - case 'c': - t = 0; - m = 8; - goto pf; - - case 'e': - t = flag(); - m = 20; - goto pf; - - case 'n': - t = flag(); - m = 63; -pf: - if ((c=getc())=='*') - m =+ 0100; else - peekc = c; - printf(".byte %o,%o", m, t); - goto loop1; - - case '\n': - printf(";1f\n"); - ssmode = 1; - nlflg = 1; - smode = 1; - goto loop; - } - putchar(c); - goto loop1; - - case '\t': - if (nlflg) { - nlflg = 0; - goto loop; - } - putchar('\t'); - goto loop; - - case '\n': - if (!smode) { - putchar('\n'); - goto loop; - } - if (nlflg) { - nlflg = 0; - printf("\\0>\n.text\n"); - smode = 0; - goto loop; - } - if (!snlflg) - printf("\\n"); - snlflg = 0; - printf(">\n<"); - nlflg = 1; - goto loop; - } - putchar(c); - goto loop; -} - -getc() { - extern getchar, peekc, nofloat; - auto t, ifcnt; - - ifcnt = 0; -gc: - if (peekc) { - t = peekc; - peekc = 0; - } else - t = getchar(); - if (t==0) - return(0); - if (t=='{') { - ifcnt++; - t = getchar(); - } - if (t=='}') { - t = getc(); - if (--ifcnt==0) - if (t=='\n') - t = getc(); - } - if (ifcnt & nofloat) - goto gc; - return(t); -} - -flag() { - extern getc, peekc; - auto c, f; - - f = 0; -l1: - switch(c=getc()) { - - case 'w': - f = 1; - goto l1; - - case 'i': - f = 2; - goto l1; - - case 'b': - f = 3; - goto l1; - - case 'f': - f = 4; - goto l1; - - case 'd': - f = 5; - goto l1; - - case 'p': - f =+ 16; - goto l1; - } - peekc = c; - return(f); -} - -peekc 0; - -putchar(c) { - extern flush, oubuf, ouptr; - char ouptr[], oubuf[]; - auto c1; - - goto init; -init: - ouptr = oubuf; - init = init1; -init1: - if(c1 = c>>8) { - *ouptr++ = c1; - if(ouptr >= oubuf+512) - flush(); - } - if(c =& 0377) { - *ouptr++ = c; - if(ouptr >= oubuf+512) - flush(); - } -} - -flush() { - extern ouptr, oubuf, fout, write; - char ouptr[], oubuf[]; - - write(fout, oubuf, ouptr-oubuf); - ouptr = oubuf; -} - -getcha() { - extern read, incnt, fin, inbuf, inptr; - char inbuf[], inptr[]; - - goto init; -init: - inptr = inbuf; - init = init1; -init1: - if(inptr >= inbuf+incnt) { - inptr = inbuf; - incnt = read(fin, inbuf, 512); - if(!incnt) - return('\0'); - } - return(*inptr++); -} - -inbuf[256]; -oubuf[256]; -inptr 0; -incnt 0; -ouptr 0; -fin 0; -fout 1; -nofloat 0; diff --git a/c/efftab.s b/c/efftab.s deleted file mode 100644 index ada71c3363..0000000000 --- a/c/efftab.s +++ /dev/null @@ -1,215 +0,0 @@ -/ c code tables - -.globl _efftab - -_efftab=.;.+2 - 30.; ci30 - 31.; ci30 - 32.; ci30 / same as 30 - 33.; ci30 / same as 31 - 80.; ci80 - 70.; ci70 - 71.; ci70 / - like + - 77.; ci77 - 78.; ci78 - 0 - -/ ++ prefix -ci30: -%ai,n -%abp,n -%ab,n - IB1 A1 - -%aip,n - I' $2,A1 - -%nbp*,n -%ni*,n -%nb*,n - F* - IB1 #1(R) - -%nip*,n - F* - I' $2,#1(R) - -/ = -ci80: -%a,z - clrB1 A1 - -%n*,z - F* - clrB1 #1(R) - -%a,aw - movB1 A2,A1 - -%a,nw* - S* - movB1 #2(R),A1 - -%a,n - S - movB1 R,A1 - -%n*,aw - F* - movB1 A2,#1(R) - -%n*,ew* - F* - S1* - movB1 #2(R1),#1(R) - -%n*,e - F* - S1 - movB1 R1,#1(R) - -%e*,nw* - S* - F1* - movB1 #2(R),#1(R1) - -%e*,n - S - F1* - movB1 R,#1(R1) - -%n*,nw* - FS* - S* - movB1 #2(R),*(sp)+ - -%n*,n - FS* - S - movB1 R,*(sp)+ - -/ =| i -ci78: -%a,a - bisBE A2,A1 - -%a,n - S - bisB1 R,A1 - -%n*,a - F* - bisBE A2,#1(R) - -%e*,n* - S* - F1* - bisBE #2(R),#1(R1) - -%e*,n - S - F1* - bisBE R,#1(R1) - -%n*,e* - F* - S1* - bisBE #2(R1),#1(R) - -%n*,e - F* - S1 - bisBE R1,#1(R) - -%n*,n* - FS* - S* - bisBE #2(R),*(sp)+ - -%n*,n - FS* - S - bisBE R,*(sp)+ - -/ =& i -ci77: -%a,c - bicB1 $!C2,A1 - -%a,n - S - com R - bicB1 R,A1 - -%e*,n - S - F1* - com R - bicB1 R,#1(R1) - -%n*,c - F* - bicB1 $!C2,#1(R) - -%n*,e - F* - S1 - com R1 - bicB1 R1,#1(R) - -%n*,n - FS* - S - com R - bicB1 R,*(sp)+ - -/ =+ -ci70: -%aw,aw - I A2,A1 - -%aw,nw* - S* - I #2(R),A1 - -%aw,n - S - I R,A1 - -%ew*,nw* - S* - F1* - I #2(R),#1(R1) - -%a,nw* - S* - movB1 A1,R1 - I #2(R),R1 - movB1 R1,#2(R) - -%a,n - S - movB1 A1,R1 - I R1,R - movB1 R,A1 - -%ew*,n - S - F1* - I R,#1(R1) - -%nw*,n - SS - F* - I (sp)+,#1(R) - -%n*,n - SS - F* - movB1 #1(R),R1 - I (sp)+,R1 - movB1 R1,#1(R) - -.data -.even - diff --git a/c/fptab.s b/c/fptab.s deleted file mode 100644 index f7ddc9f787..0000000000 --- a/c/fptab.s +++ /dev/null @@ -1,846 +0,0 @@ - -/ c code tables-- compile to register - -.globl _regtab - -_regtab=.; .+2 - 20.; cr20 - 21.; cr20 - 22.; cr20 - 30.; cr30 - 31.; cr30 - 32.; cr32 - 33.; cr32 - 34.; cr34 - 35.; cr35 - 29.; cr29 - 36.; cr36 - 37.; cr37 - 38.; cr38 - 101.; cr100 - 80.; cr80 - 40.; cr40 - 41.; cr40 / - like + - 42.; cr42 - 43.; cr43 - 44.; cr43 - 45.; cr45 - 46.; cr45 - 47.; cr47 - 48.; cr48 - 60.; cr60 - 61.; cr60 - 62.; cr60 - 63.; cr60 - 64.; cr60 - 65.; cr60 - 66.; cr60 - 67.; cr60 - 68.; cr60 - 69.; cr60 - 70.; cr70 - 71.; cr70 - 72.; cr72 - 73.; cr73 - 74.; cr73 - 75.; cr75 - 76.; cr75 - 77.; cr77 - 78.; cr78 - 102.; cr102 - 97.; cr97 -{ 84.; cr84 - 85.; cr84 - 86.; cr86 - 87.; cr87 - 88.; cr88 - 89.; cr87 - 94.; cr84 - 95.; cr84 - 96.; cr87} - 0 - -/ goto -cr102: -%i,n - jmp *A1 - -%n*,n - F* - jmp *#1(R) - -%n,n - F - jmp (R) - -/ call -cr100: -%n*,n - F* - jsr pc,*#1(R) - -%a,n - jsr pc,*A1 - -%n,n - F - jsr pc,(R) - -/ name, constant -cr20: -%z,n -{ M} - clrB1 R - -%aw,n - mov A,R - -%ab,n - movb A,R - -{%af,n - M - movf A,R} - -/++,-- prefix -cr30: -%ai,n -%abp,n -%ab,n - IB1 A1 - movB1 A1,R - -%a,n - I' $2,A1 - mov A1,R - -%nbp*,n -%ni*,n -%nb*,n - F* - IB1 #1(R) - movB1 #1(R),R - -%n*,n - F* - I' $2,#1(R) - mov #1(R),R - -{%af,n - M - movfi $1,R - I'f R,A1 - movf A1,R - -%nf*,n - F* - M - movfi $1,R - I'f R,#1(R) - movf #1(R),R} - -/ ++,-- postfix -cr32: -%ai,n -%abp,n -%ab,n - movB1 A1,R - IB1 A1 - -%a,n - mov A1,R - I' $2,A1 - -%nbp*,n -%nb*,n -%ni*,n - F* - movB1 #1(R),-(sp) - IB1 #1(R) - movB1 (sp)+,R - -%n*,n - F* - mov #1(R),-(sp) - I' $2,#1(R) - mov (sp)+,R - -{%af,n - M - movf A1,R - movf R,-(sp) - movif $1,R - I'f R,A1 - movf (sp)+,R - -%nf*,n - F* - M - movf #1(R),R - movf R,-(sp) - movif $1,R - I'f R,#1(R) - movf (sp)+,R} - -/ ! -cr34: -%n,n - FC - beq 1f - clr R - br 2f -1: mov $1,R -2: - -/ &unary -cr35: -%a,n -%af,n - mov $A1,R - -/ & unary of auto -cr29: -%e,n -%ef,n - mov r5,R - add Z,R - -/ *unary -cr36: -%abp*,n - F - movb (R),R - -%a*,n - F - mov (R),R - -%abp,n - movb *A1,R - -%a,n - mov *A1,R - -%nbp*,n - F* - movb *#1(R),R - -%n*,n - F* - mov *#1(R),R - -%nbp,n - H* - movb ~(R),R - -%n,n - H* - mov ~(R),R - -/ - unary -cr37: -%n,n - F - neg R - -{%nf,n - F - negf R} - -/ ~ -cr38: -%n,n - F - com R - -/ = -cr80: -%a,n -{%af,nf} - S - movB1 R,A1 - -%n*,a -{%nf*,af} - F* -{ M} - movB1 A2,#1(R) - movB1 #1(R),R - -%n*,e -{%nf*,ef} - F* - S1 - movB1 R1,#1(R) - movB1 R1,R - -%n*,n -{%nf*,nf} - FS* - S - movB1 R,*(sp)+ - -/ | -cr48: -%n,a - F - bisB2 A2,R - -%n,e* - F - S1* - bisB2 #2(R1),R - -%n,e - F - S1 - bis R1,R - -%n,n - FS - S - bis (sp)+,R - -/ & -cr47: -%n,c - F - bic $!C2,R - -%n,e - F - S1 - com R1 - bic R1,R - -%n,n - FS - S - com (sp) - bic (sp)+,R - -/ relationals -cr60: -%n,n - HC - I 2f - clr R - br 1f -2: mov $1,R -1: - -/ >>, << -cr45: -%a,aw - movB1 A1,I' - I A2,lsh - movB1 I',R - -%n*,aw - F* - movB1 #1(R),I' - I A2,lsh - movB1 I',R - -%n,aw - F - mov R,I' - I A2,lsh - mov I',R - -%a,nw* - S* - movB1 A1,(r4) - I #2(R),lsh - mov (r4),R - -%a,n - S - movB1 A1,I' - I R,lsh - mov I',R - -%n,n - FS - S - mov (sp)+,I' - I R,lsh - mov I',R - -/ +, - -cr40: -%n,aw -{%nf,af} - F - IB1 A2,R - -%n,ew* -{%nf,ef*} - F - S1* - IB2 #2(R1),R - -%n,e -{%nf,ef} - F - S1 - IBF R1,R - -%n,nw* -{%nf,nf*} - SS* - F - IBF *(sp)+,R - -%n,n -{%nf,nf} - SS - F - IBF (sp)+,R - -/ * -cr42: -%aw,a - mov A1,(r4)+ - movB2 A2,(r4) - mov -(r4),R - -%n,a - F - mov R,(r4)+ - movB2 A2,(r4) - mov -(r4),R - -%n,e - F - S1 - mov R,(r4)+ - mov R1,(r4) - mov -(r4),R - -%n,n - FS - S - mov (sp)+,(r4)+ - mov R,(r4) - mov -(r4),R - -{%nf,af - F - mulf A2,R - -%nf,ef* - F - S1* - mulf #2(R1),R - -%nf,ef - F - S1 - mulf R1,R - -%nf,nf - FS - S - mulf (sp)+,R} - -/ /; mod -cr43: -%a,a - movB1 A1,(r4) - movB2 A2,div - mov I,R - -%a,n - S - movB1 A1,(r4) - mov R,div - mov I,R - -%n,a - F - mov R,(r4) - movB2 A2,div - mov I,R - -%n,e - F - S1 - mov R,(r4) - mov R1,div - mov I,R - -%e,n - S - F1 - mov R1,(r4) - mov R,div - mov I,R - -%n,n - FS - S - mov (sp)+,(r4) - mov R,div - mov I,R - -{%nf,af - F - I' A1,R - -%nf,ef* - F - S1* - I' #2(R1),R - -%nf,ef - F - S1 - I' R1,R - -%nf,nf - SS - F - I' (sp)+,R} - -/ =* -cr72: -%a,a - movB1 A1,(r4) - movB2 A2,mul - movB1 (r4),A1 - mov (r4),R - -%a,n - S - mov R,(r4)+ - movB1 A1,(r4) - mov -(r4),R - movB1 R,A1 - -%n*,a - F* - movB1 #1(R),(r4) - movB2 A2,mul - movB1 (r4),#1(R) - mov (r4),R - -%n*,e - F* - S1 - movB1 #1(R),(r4) - mov R1,mul - movB1 (r4),#1(R) - mov (r4),R - -%e*,n - S - F1* - movB1 #1(R1),(r4) - mov R,mul - movB1 (r4),#1(R1) - mov (r4),R - -%n*,n - FS* - S - movB1 *(sp),(r4) - mov R,mul - movB1 (r4),*(sp)+ - mov (r4),R - -/ =mod, =/ -cr73: -%a,a - movB1 A1,(r4) - movB2 A2,div - movB1 I,A1 - mov I,R - -%a,n - S - movB1 A1,(r4) - mov R,div - mov I,R - movB1 R,A1 - -%n*,a - F* - movB1 #1(R),(r4) - movB2 A2,div - movB1 I,#1(R) - mov I,R - -%n*,e - F* - S1 - movB1 #1(R),(r4) - mov R1,div - movB1 I,#1(R) - mov I,R - -%e*,n - S - F1* - movB1 #1(R1),(r4) - mov R,div - movB1 I,#1(R1) - mov I,R - -%n*,n - FS* - S - movB1 *(sp),(r4) - mov R,div - movB1 I,*(sp)+ - mov I,R - -/ =| -cr78: -%a,a - bisBE A2,A1 - movB1 A1,R - -%a,n - S - bisB1 R,A1 - movB1 A1,R - -%n*,a - F* - bisBE A2,#1(R) - movB1 #1(R),R - -%e*,n* - S* - F1* - bisBE #1(R1),#2(R) - movB1 #2(R),R - -%e*,n - S - F1* - bisBE R,#1(R1) - movB1 #1(R1),R - -%n*,e* - F* - S1* - bisBE #2(R1),#1(R) - movB1 #1(R),R - -%n*,e - F* - S1 - bisBE R1,#1(R) - movB2 #1(R),R - -%n*,n* - FS* - S* - bisBE #2(R),*(sp) - movB2 *(sp)+,R - -%n*,n - FS* - S - bisBE R,*(sp) - mov *(sp)+,R - -/ =& -cr77: -%a,c - bicB1 $!C2,A1 - movB2 A1,R - -%a,n - S - com R - bicB1 R,A1 - movB1 A1,R - -%e*,n - S - F1* - com R - bicB1 R,#1(R1) - movB1 #1(R1),R - -%n*,e - F* - S1 - com R1 - bicB1 R1,#1(R) - movB1 #1(R),R - -%n*,n - FS* - S - com R - bicB1 R,*(sp) - movB1 *(sp)+,R - -/ =>>, =<< -cr75: -%a,aw - movB1 A1,I' - I A2,lsh - movB1 I',A1 - movB1 I',R - -%a,n - S - movB1 A1,I' - I R,lsh - movB1 I',A1 - movB1 I',R - -%n*,e - F* - S1 - movB1 #1(R),I' - I R1,lsh - movB1 I',#1(R) - movB1 I',R - -%e*,n - S - F1* - movB1 #1(R1),I' - I R,lsh - movB I',#1(R1) - movB1 I',R - -%n*,n - FS* - S - movB1 *(sp),I' - I R,lsh - movB1 I',*(sp)+ - movB1 I',R - -/ =+ -cr70: -%aw,aw - I A2,A1 - mov A1,R - -%aw,nw* - S* - I #2(R),A1 - mov A1,R - -%aw,n - S - I R,A1 - mov A1,R - -%ew*,nw* - S* - F1* - I #2(R),#1(R1) - mov #1(R1),R - -%a,nw* - S* - movB1 A1,R1 - I #2(R),R1 - movB1 R1,#2(R) - mov R1,R - -%a,n - S - movB1 A1,R1 - I R1,R - movB1 R,A1 - -%ew*,n - S - F1* - I R,#1(R1) - mov #1(R1),R - -%nw*,n - SS - F* - I (sp)+,#1(R) - mov #1(R),R - -%n*,n - SS - F* - movB1 #1(R),R1 - I (sp)+,R1 - movB1 R1,#1(R) - mov R1,R - -/ int -> int[] -cr97: -%n,n - F - asl R - -{/ int -> float -cr84: -%a,n - M - movif A1,R - -%n*,n - F* - M - movif #1(R),R - -%n,n - F - movif R,R - -/ float -> double -cr87: -%af,n - M - movof A1,R - -%nf*,n - F* - M - movof #1(R),R - -%nf,n - F - movof R,R - -/ float -> int -cr86: -%af,n - M2 - movfi A1,R - -%nf*,n - F* - M2 - movfi \$1(R),R - -%nf,n - F - movfi R,R - -/ double -> int -cr88: -%ad,n - M4 - movfi A1,R - -%nd*,n - F* - M4 - movfi #1(R),R - -%nd,n - F - movfi R,R - -.data -.even -.text - diff --git a/c/nc0/c00.c b/c/nc0/c00.c deleted file mode 100644 index 66226686b2..0000000000 --- a/c/nc0/c00.c +++ /dev/null @@ -1,581 +0,0 @@ -/* C compiler - -Copyright 1972 Bell Telephone Laboratories, Inc. - -*/ - -ossiz 250; -ospace() {} /* fake */ - -init(s, t) -char s[]; { - extern lookup, symbuf, namsiz; - char symbuf[], sp[]; - int np[], i; - - i = namsiz; - sp = symbuf; - while(i--) - if ((*sp++ = *s++)=='\0') --s; - np = lookup(); - *np++ = 1; - *np = t; -} - -main(argc, argv) -int argv[]; { - extern init, flush; - extern extdef, eof, open, creat; - extern fout, fin, error, exit, nerror, tmpfil; - - if(argc<4) { - error("Arg count"); - exit(1); - } - if((fin=open(argv[1],0))<0) { - error("Can't find %s", argv[1]); - exit(1); - } - if((fout=creat(argv[2], 017))<0) { - error("Can't create %s", argv[2]); - exit(1); - } - tmpfil = argv[3]; - init("int", 0); - init("char", 1); - init("float", 2); - init("double", 3); -/* init("long", 4); */ - init("auto", 5); - init("extern", 6); - init("static", 7); - init("goto", 10); - init("return", 11); - init("if", 12); - init("while", 13); - init("else", 14); - init("switch", 15); - init("case", 16); - init("break", 17); - init("continue", 18); - init("do", 19); - init("default", 20); - while(!eof) { - extdef(); - blkend(); - } - flush(); - flshw(); - exit(nerror!=0); -} - -lookup() { - extern hshtab[], hshsiz, pssiz, symbuf[]; - extern hshlen, hshused, exit, error, nwps; - auto i, j, np[], sp[], rp[]; - - i = 0; - sp = symbuf; - j = nwps; - while(j--) - i =+ *sp++; - if (i<0) i = -i; - i =% hshsiz; - i =* pssiz; - while(*(np = &hshtab[i+4])) { - sp = symbuf; - j = nwps; - while(j--) - if (*np++ != *sp++) goto no; - return(&hshtab[i]); -no: if ((i =+ pssiz) >= hshlen) i = 0; - } - if(hshused++ > hshsiz) { - error("Symbol table overflow"); - exit(1); - } - rp = np = &hshtab[i]; - sp = symbuf; - j = 4; - while(j--) - *np++ = 0; - j = nwps; - while(j--) - *np++ = *sp++; - return(rp); -} - -symbol() { - extern peeksym, peekc, eof, getchar, subseq, error, line; - extern csym[], getstr, symbuf, namsiz, lookup[], ctab, cval; - auto b, c; - char symbuf[], sp[], ctab[]; - - if (peeksym>=0) { - c = peeksym; - peeksym = -1; - return(c); - } - if (peekc) { - c = peekc; - peekc = 0; - } else - if (eof) - return(0); else - c = getchar(); -loop: - switch(ctab[c]) { - - case 125: /* newline */ - line++; - - case 126: /* white space */ - c = getchar(); - goto loop; - - case 0: /* EOF */ - eof++; - return(0); - - case 40: /* + */ - return(subseq(c,40,30)); - - case 41: /* - */ - return(subseq(c,41,31)); - - case 80: /* = */ - if (subseq(' ',0,1)) return(80); - c = symbol(); - if (c>=40 & c<=49) - return(c+30); - if (c==80) - return(60); - peeksym = c; - return(80); - - case 63: /* < */ - if (subseq(c,0,1)) return(46); - return(subseq('=',63,62)); - - case 65: /* > */ - if (subseq(c,0,1)) return(45); - return(subseq('=',65,64)); - - case 34: /* ! */ - return(subseq('=',34,61)); - - case 43: /* / */ - if (subseq('*',1,0)) - return(43); -com: - c = getchar(); -com1: - if (c=='\0') { - eof++; - error("Nonterminated comment"); - return(0); - } - if (c=='\n') - line++; - if (c!='*') - goto com; - c = getchar(); - if (c!='/') - goto com1; - c = getchar(); - goto loop; - - case 124: /* number */ - cval = 0; - if (c=='0') - b = 8; else - b = 10; - while(ctab[c]==124) { - cval = cval*b + c -'0'; - c = getchar(); - } - peekc = c; - return(21); - - case 122: /* " */ - return(getstr()); - - case 121: /* ' */ - return(getcc()); - - case 123: /* letter */ - sp = symbuf; - while(ctab[c]==123 | ctab[c]==124) { - if (sp= 0) - printf("%o,", c); - printf("0;.even;.text\n"); - return(22); -} - -getcc() -{ - extern cval, ncpw; - auto c, cc; - char cp[]; - - cval = 0; - cp = &cval; - cc = 0; - while((c=mapch('\'')) >= 0) - if(cc++ < ncpw) - *cp++ = c; - if(cc>ncpw) - error("Long character constant"); - return(21); -} - -mapch(c) -{ - extern peekc, line; - auto a; - - if((a=getchar())==c) - return(-1); - switch(a) { - - case '\n': - case 0: - error("Nonterminated string"); - peekc = a; - return(-1); - - case '\\': - switch (a=getchar()) { - - case 't': - return('\t'); - - case 'n': - return('\n'); - - case '0': - return('\0'); - - case 'r': - return('\r'); - - case '\n': - line++; - return('\n'); - } - - } - return(a); -} - -tree() { - extern symbol, block, csym[], ctyp, isn, - peeksym, opdope[], build, error, cp[], cmst[], - space, ospace, cval, ossiz, exit, errflush, cmsiz; - - auto op[], opst[20], pp[], prst[20], andflg, o, - p, ps, os; - - space = ospace; - op = opst; - pp = prst; - cp = cmst; - *op = 200; /* stack EOF */ - *pp = 06; - andflg = 0; - -advanc: - switch (o=symbol()) { - - /* name */ - case 20: - if (*csym==0) - if((peeksym=symbol())==6) - *csym = 6; /* extern */ - else { - if(csym[2]==0) /* unseen so far */ - csym[2] = isn++; - } - if(*csym==6) /* extern */ - *cp++ = block(5,20,csym[1],0,*csym, - csym[4],csym[5],csym[6],csym[7]); - else - *cp++ = block(2,20,csym[1],0,*csym,csym[2]); - goto tand; - - /* short constant */ - case 21: - case21: - *cp++ = block(1,21,ctyp,0,cval); - goto tand; - - /* string constant */ - case 22: - *cp++ = block(1,22,17,0,cval); - -tand: - if(cp>=cmst+cmsiz) { - error("Expression overflow"); - exit(1); - } - if (andflg) - goto syntax; - andflg = 1; - goto advanc; - - /* ++, -- */ - case 30: - case 31: - if (andflg) - o =+ 2; - goto oponst; - - /* ! */ - case 34: - if (andflg) - goto syntax; - goto oponst; - - /* - */ - case 41: - if (!andflg) { - peeksym = symbol(); - if (peeksym==21) { - peeksym = -1; - cval = -cval; - goto case21; - } - o = 37; - } - andflg = 0; - goto oponst; - - /* & */ - /* * */ - case 47: - case 42: - if (andflg) - andflg = 0; else - if(o==47) - o = 35; - else - o = 36; - goto oponst; - - /* ( */ - case 6: - if (andflg) { - o = symbol(); - if (o==7) - o = 101; else { - peeksym = o; - o = 100; - andflg = 0; - } - } - goto oponst; - - /* ) */ - /* ] */ - case 5: - case 7: - if (!andflg) - goto syntax; - goto oponst; - } - - /* binaries */ - if (!andflg) - goto syntax; - andflg = 0; - -oponst: - p = (opdope[o]>>9) & 077; -opon1: - ps = *pp; - if (p>ps | p==ps & (opdope[o]&0200)!=0) { /* right-assoc */ -putin: - switch (o) { - - case 6: /* ( */ - case 4: /* [ */ - case 100: /* call */ - p = 04; - } - if(op>=opst+20) { /* opstack size */ - error("expression overflow"); - exit(1); - } - *++op = o; - *++pp = p; - goto advanc; - } - --pp; - switch (os = *op--) { - - /* EOF */ - case 200: - peeksym = o; - return(*--cp); - - /* call */ - case 100: - if (o!=7) - goto syntax; - build(os); - goto advanc; - - /* mcall */ - case 101: - *cp++ = 0; /* 0 arg call */ - os = 100; - goto fbuild; - - /* ( */ - case 6: - if (o!=7) - goto syntax; - goto advanc; - - /* [ */ - case 4: - if (o!=5) - goto syntax; - build(4); - goto advanc; - } -fbuild: - build(os); - goto opon1; - -syntax: - error("Expression syntax"); - errflush(o); - return(0); -} - -declare(kw) { - extern csym[], symbol, paraml[], parame[]; - extern error, cval, errflush, peeksym, exit; - int t[], n, o; - - while((o=symbol())==20) { /* name */ - if(kw>=5) { /* type or sort? */ - if(*csym>0) - error("%p redeclared", csym[4]); - *csym = kw; - } else { - if ((csym[1]&017)!=0) - error("%p redeclared", &csym[4]); - csym[1] =| csym[1]&0760 | kw; - if (*csym==0) - *csym = -2; - } - while((o=symbol())==4) { /* [ */ - if((o=symbol())==21) { /* const */ - if(csym[1]>=020) - error("Bad vector"); - csym[3] = cval; - o = symbol(); - } - if (o!=5) /* ] */ - goto syntax; - csym[1] =+ 020; - } - if(kw==8) { /* parameter */ - *csym = -1; - if (paraml==0) - paraml = csym; - else - *parame = csym; - parame = csym; - } - if (o!=9) /* , */ - break; - } - if(o==1 & kw!=8 | o==7 & kw==8) - return; -syntax: - error("Declaration syntax"); - errflush(o); -} - -/* storage */ - -regtab 0; -efftab 1; -cctab 2; -sptab 3; -symbuf[4]; -pssiz 8; -namsiz 8; -nwps 4; -hshused 0; -hshsiz 100; -hshlen 800; /* 8*hshsiz */ -hshtab[800]; -space 0; -cp 0; -cmsiz 40; -cmst[40]; -ctyp 0; -isn 1; -swsiz 120; -swtab[120]; -swp 0; -contlab 0; -brklab 0; -deflab 0; -nreg 4; -maprel[] 60,61,64,65,62,63,68,69,66,67; -nauto 0; -stack 0; -peeksym 0177777; -peekc 0; -eof 0; -line 1; -csym 0; -cval 0; -ncpw 2; -nerror 0; -paraml; -parame; -tmpfil; - diff --git a/c/nc0/c01.c b/c/nc0/c01.c deleted file mode 100644 index 35f3f36430..0000000000 --- a/c/nc0/c01.c +++ /dev/null @@ -1,210 +0,0 @@ -build(op) { - extern cp[], error, block, opdope[], maprel[], chklval; - extern chkw, cvtab, lintyp, dcalc; - auto p1[], t1, d1, p2[], t2, d2, p3[], t3, d3, t; - auto d, dope, lr, cvn; - char cvtab[]; - - if (op==4) { /* [] */ - build(40); /* + */ - op = 36; - } - dope = opdope[op]; - if ((dope&01)!=0) { - p2 = *--cp; - t2 = p2[1]; - d2 = p2[2]; - } - p1 = *--cp; - t1 = p1[1]; - d1 = p1[2]; - switch (op) { - - /* , */ - case 9: - *cp++ = block(2, 9, 0, 0, p1, p2); - return; - - /* ? */ - case 90: - if (*p2!=8) - error("Illegal conditional"); - goto goon; - - /* call */ - case 100: - *cp++ = block(2,100,t1,24,p1,p2); - return; - - /* * */ - case 36: - if ((t1 =- 16)<0) { - error("Illegal indirection"); - t1 =+ 16; - } - if (*p1!=20 & d1==0) - d1 = 1; - *cp++ = block(1,36,t1,d1,p1); - return; - - /* & unary */ - case 35: - if (*p1 == 36) { /* * */ - *cp++ = p1[3]; - return; - } - if (*p1 == 20) { - *cp++ = block(1,p1[3]==5?29:35,t1+16,1,p1); - return; - } - error("Illegal lvalue"); - } -goon: - if ((dope&02)!=0) /* lvalue needed on left? */ - chklval(p1); - if ((dope&020)!=0) /* word operand on left? */ - chkw(p1); - if ((dope&040)!=0) /* word operand on right? */ - chkw(p2); - if ((dope&01)!=0) { /* binary op? */ - cvn = cvtab[9*lintyp(t1)+lintyp(t2)]; - if ((dope&010)!=0) { /* assignment? */ - t = t1; - lr = 1; - cvn =& 07; - } else { - t = (cvn&0100)!=0? t2:t1; - lr = cvn&0200; - cvn = (cvn>>3)&07; - } - if (cvn) { - if (cvn==07) { - error("Illegal conversion"); - goto nocv; - } - cvn =+ (dope&010)!=0? 83:93; - if (lr) { - t2 = t; - d2 = (p2=convert(p2, t, d2, cvn))[2]; - } else { - t1 = t; - d1 = (p1=convert(p1, t, d1, cvn))[2]; - } -nocv:; } - if (d2>d1 & (dope&0100)!=0) { /* flip commutative? */ - if ((dope&04)!=0) /* relational? */ - op = maprel[op-60]; - d = d1; - d1 = d2; - d2 = d; - d = p1; - p1 = p2; - p2 = d; - d = t1; - t1 = t2; - t2 = d; - } - if (d1==d2) - d = d1+1; else - d = max(d1,d2); - if ((dope&04)!=0) - t = 0; /* relational is integer */ - *cp++ = block(2,op,t,d,p1,p2); - return; - } - *cp++ = block(1,op,t1,d1==0?1:d1,p1); -} - -convert(p, t, d, cvn) -int p[]; -{ - auto c; - if (*p==21) { /* constant */ - c = p[3]; - switch(cvn) { - - case 99: /* c18 */ - c =<< 1; - - case 98: /* c14 */ - c =<< 1; - - case 97: /* c12 */ - c =<< 1; - - p[3] = c; - return(p); - } - } - return(block(1, cvn, t, max(1,d), p)); -} - -chkw(p) -int p[]; { - extern error; - auto t; - - if ((t=p[1])>1 & t<16) - error("Integer operand required"); - return; -} - -lintyp(t) { - return(t<16? t:(t<32? t-12: 8)); -} - -error(s, p1, p2) { - extern printf, line, fout, flush, putchar, nerror; - int f; - - nerror++; - flush(); - f = fout; - fout = 1; - printf("%d: ", line); - printf(s, p1, p2); - putchar('\n'); - fout = f; -} - -block(n, op, t, d, p1,p2,p3) -int p1[],p2[],p3[]; { - extern space[], error, exit, ossiz, ospace[]; - auto p[], ap[]; - - p = space; - ap = &op; - n =+ 3; - if(space+n >= ospace+ossiz) { - error("Expression overflow"); - exit(1); - } - while(n--) - *space++ = *ap++; - return(p); -} - -chklval(p) -int p[]; { - extern error; - if (*p!=20) - if (*p!=36) - error("Lvalue required"); -} - -notcompat(at, st) { - - if (st==0) /* word, byte */ - return(at>1 & at<16); - if (st==1) /* word */ - return(at>0 & at<16); - return((st-2) != at); -} - -max(a, b) -{ - if (a>b) - return(a); - return(b); -} - diff --git a/c/nc0/c02.c b/c/nc0/c02.c deleted file mode 100644 index 58ddcedc16..0000000000 --- a/c/nc0/c02.c +++ /dev/null @@ -1,436 +0,0 @@ -function() { - extern declare, blkhed, blkend; - extern printf, statement, peeksym, cval, symbol, retseq; - extern paraml; - auto o; - - printf(".text; 1:mov r5,-(sp); mov sp,r5\n"); - declare(8); - declist(); - statement(1); - retseq(); -} - -extdef() { - extern eof, function, cval; - extern symbol, block, printf, pname, errflush, csym[]; - extern error; - auto o, c, cs[]; - char s[]; - - if(((o=symbol())==0) | o==1) /* EOF */ - return; - if(o!=20) - goto syntax; - csym[0] = 6; - cs = &csym[4]; - printf(".globl %p\n", cs); - s = ".data; %p:1f\n"; - switch(o=symbol()) { - - case 6: /* ( */ - printf(s, cs); - function(); - return; - - case 21: /* const */ - printf(".data; %p: %o\n", cs, cval); - if((o=symbol())!=1) /* ; */ - goto syntax; - return; - - case 1: /* ; */ - printf(".bss; %p: .=.+2\n", cs); - return; - - case 4: /* [ */ - c = 0; - if((o=symbol())==21) { /* const */ - c = cval<<1; - o = symbol(); - } - if(o!=5) /* ] */ - goto syntax; - printf(s, cs); - if((o=symbol())==1) { /* ; */ - printf(".bss; 1:.=.+%o\n", c); - return; - } - printf("1:"); - while(o==21) { /* const */ - printf("%o\n", cval); - c =- 2; - if((o=symbol())==1) /* ; */ - goto done; - if(o!=9) /* , */ - goto syntax; - else - o = symbol(); - } - goto syntax; - done: - if(c>0) - printf(".=.+%o\n", c); - return; - - case 0: /* EOF */ - return; - } - -syntax: - error("External definition syntax"); - errflush(o); - statement(0); -} - -statement(d) { - extern symbol, error, blkhed, eof, peeksym; - extern blkend, csym[], rcexpr, block[], tree[], regtab[]; - extern retseq, jumpc, jump, label, contlab, brklab, cval; - extern swp[], isn, pswitch, peekc, slabel; - extern efftab[], declare, deflab, errflush, swtab[], swsiz, branch; - - int o, o1, o2, o3, np[]; - -stmt: - switch(o=symbol()) { - - /* EOF */ - case 0: - error("Unexpected EOF"); - /* ; */ - case 1: - /* } */ - case 3: - return; - - /* { */ - case 2: { - if(d) - blkhed(); - while (!eof) { - if ((o=symbol())==3) /* } */ - goto bend; - peeksym = o; - statement(0); - } - error("Missing '}'"); - bend: - return; - } - - /* keyword */ - case 19: - switch(cval) { - - /* goto */ - case 10: - o1 = block(1,102,0,0,tree()); - rcexpr(o1, regtab); - goto semi; - - /* return */ - case 11: - if((peeksym=symbol())==6) /* ( */ - rcexpr(pexpr(), regtab); - retseq(); - goto semi; - - /* if */ - case 12: - jumpc(pexpr(), o1=isn++, 0); - statement(0); - if ((o=symbol())==19 & cval==14) { /* else */ - o2 = isn++; - (easystmt()?branch:jump)(o2); - label(o1); - statement(0); - label(o2); - return; - } - peeksym = o; - label(o1); - return; - - /* while */ - case 13: - o1 = contlab; - o2 = brklab; - label(contlab = isn++); - jumpc(pexpr(), brklab=isn++, 0); - o3 = easystmt(); - statement(0); - (o3?branch:jump)(contlab); - label(brklab); - contlab = o1; - brklab = o2; - return; - - /* break */ - case 17: - if(brklab==0) - error("Nothing to break from"); - jump(brklab); - goto semi; - - /* continue */ - case 18: - if(contlab==0) - error("Nothing to continue"); - jump(contlab); - goto semi; - - /* do */ - case 19: - o1 = contlab; - o2 = brklab; - contlab = isn++; - brklab = isn++; - label(o3 = isn++); - statement(0); - label(contlab); - contlab = o1; - if ((o=symbol())==19 & cval==13) { /* while */ - jumpc(tree(), o3, 1); - label(brklab); - brklab = o2; - goto semi; - } - goto syntax; - - /* case */ - case 16: - if ((o=symbol())!=21) /* constant */ - goto syntax; - if ((o=symbol())!=8) /* : */ - goto syntax; - if (swp==0) { - error("Case not in switch"); - goto stmt; - } - if(swp>=swtab+swsiz) { - error("Switch table overflow"); - } else { - *swp++ = isn; - *swp++ = cval; - label(isn++); - } - goto stmt; - - /* switch */ - case 15: - o1 = brklab; - brklab = isn++; - np = pexpr(); - if (np[1]>1 & np[1]<16) - error("Integer required"); - rcexpr(np, regtab); - pswitch(); - brklab = o1; - return; - - /* default */ - case 20: - if (swp==0) - error("Default not in switch"); - if ((o=symbol())!=8) /* : */ - goto syntax; - deflab = isn++; - label(deflab); - goto stmt; - } - - error("Unknown keyword"); - goto syntax; - - /* name */ - case 20: - if (peekc==':') { - peekc = 0; - if (csym[0]>0) { - error("Redefinition"); - goto stmt; - } - csym[0] = 2; - csym[1] = 020; /* int[] */ - if (csym[2]==0) - csym[2] = isn++; - slabel(); - goto stmt; - } - } - - peeksym = o; - rcexpr(tree(), efftab); - goto semi; - -semi: - if ((o=symbol())!=1) /* ; */ - goto syntax; - return; - -syntax: - error("Statement syntax"); - errflush(o); - goto stmt; -} - -pexpr() -{ - auto o, t; - - if ((o=symbol())!=6) /* ( */ - goto syntax; - t = tree(); - if ((o=symbol())!=7) /* ) */ - goto syntax; - return(t); -syntax: - error("Statement syntax"); - errflush(o); - return(0); -} - -pswitch() { - extern swp[], isn, swtab[], printf, deflab, statement, brklab; - extern label; - int sswp[], dl, cv, swlab; - - sswp = swp; - if (swp==0) - swp = swtab; - swlab = isn++; - printf("jsr pc,bswitch; l%d\n", swlab); - dl = deflab; - deflab = 0; - statement(0); - if (!deflab) { - deflab = isn++; - label(deflab); - } - printf("L%d:.data;L%d:", brklab, swlab); - while(swp>sswp & swp>swtab) { - cv = *--swp; - printf("%o; l%d\n", cv, *--swp); - } - printf("L%d; 0\n.text\n", deflab); - deflab = dl; - swp = sswp; -} - -blkhed() -{ - extern symbol, cval, declare, peeksym, paraml[], parame[]; - extern error, length, rlength, setstk, defvec, isn, defstat; - extern stack, hshtab[], hshsiz, pssiz; - int o, al, pl, cs[], hl; - - declist(); - stack = al = -2; - pl = 4; - while(paraml) { - *parame = 0; - paraml = *(cs = paraml); - cs[2] = pl; - *cs = 10; - pl =+ rlength(cs[1]); - } - cs = hshtab; - hl = hshsiz; - while(hl--) { - if (cs[4]) - switch(cs[0]) { - - /* sort unmentioned */ - case 0177776: /* -2 */ - cs[0] = 5; /* auto */ - - /* auto */ - case 5: - if (cs[3]) { /* vector */ - al =- (cs[3]*length(cs[1]-020)+1) & 077776; - setstk(al); - defvec(al); - } - cs[2] = al; - al =- rlength(cs[1]); - goto loop; - - /* parameter */ - case 10: - cs[0] = 5; - goto loop; - - /* static */ - case 7: - cs[2] = isn++; - defstat(cs); - goto loop; - - loop:; - } - cs = cs+pssiz; - } - setstk(al); -} - -blkend() { - extern hshtab[], hshsiz, pssiz, hshused; - auto i, hl; - - i = 0; - hl = hshsiz; - while(hl--) { - if(hshtab[i+4]) - if (hshtab[i]==0) - error("%p undefined", &hshtab[i+4]); - if(hshtab[i]!=1) { /* not keyword */ - hshused--; - hshtab[i+4] = 0; - } - i =+ pssiz; - } -} - -errflush(o) { - extern symbol, peeksym, eof; - - while(o>3) /* ; { } */ - o = symbol(); - peeksym = o; -} - -declist() -{ - extern peeksym, peekc, csym[], cval; - auto o; - - while((o=symbol())==19 & cval<10) - declare(cval); - peeksym = o; -} - -easystmt() -{ - extern peeksym, peekc, cval; - - if((peeksym=symbol())==20) /* name */ - return(peekc!=':'); /* not label */ - if (peeksym==19) { /* keyword */ - switch(cval) - - case 10: /* goto */ - case 11: /* return */ - case 17: /* break */ - case 18: /* continue */ - return(1); - return(0); - } - return(peeksym!=2); /* { */ -} - -branch(lab) -{ - printf("br L%d\n", lab); -} - diff --git a/c/nc0/c03.c b/c/nc0/c03.c deleted file mode 100644 index 204967214b..0000000000 --- a/c/nc0/c03.c +++ /dev/null @@ -1,189 +0,0 @@ -jumpc(tree, lbl, cond) -int tree[]; -{ - extern cctab, block, rcexpr; - - rcexpr(block(1,easystmt()+103,tree,lbl,cond),cctab); -} - -rcexpr(tree, table) -int tree[], table; -{ - extern space, ospace, putwrd, putchar, line; - int c, sp[]; - - putchar('#'); - c = space-ospace; - c =/ 2; /* # addresses per word */ - sp = ospace; - - putwrd(c); - putwrd(tree); - putwrd(table); - putwrd(line); - while(c--) - putwrd(*sp++); -} - -jump(lab) { - extern printf; - - printf("jmp\tl%d\n", lab); -} - -label(l) { - extern printf; - - printf("l%d:", l); -} - -retseq() { - extern printf; - - printf("jmp\tretrn\n"); -} - -slabel() { - extern csym[], printf; - - printf(".data; l%d: 1f; .text; 1:\n", csym[2]); -} - -setstk(a) { - extern printf, stack; - auto ts; - - ts = a-stack; - stack = a; - switch(ts) { - - case 0: - return; - - case 0177776: /* -2 */ - printf("tst -(sp)\n"); - return; - - case 0177774: /* -4 */ - printf("cmp -(sp),-(sp)\n"); - return; - } - printf("add $%o,sp\n", ts); -} - -defvec() { - extern printf, stack; - - printf("mov\tsp,r0\nmov\tr0,-(sp)\n"); - stack =- 2; -} - -defstat(s) -int s[]; { - extern printf, length; - int len; - - len = length(s[1]); - if (s[3]) - printf(".data; l%d:1f; .bss; 1:.=.+%o; .even; .text\n", s[2], - s[3]*len); - else - printf(".bss; l%d:.=.+%o; .even; .text\n", s[2], len); -} - -length(t) { - - if (t<0) - t =+ 020; - if (t>=020) - return(2); - switch(t) { - - case 0: - return(2); - - case 1: - return(1); - - case 2: - return(4); - - case 3: - return(8); - - case 4: - return(4); - - } - return(1024); -} - -rlength(c) { - extern length; - auto l; - - return((l=length(c))==1? 2: l); -} - -printn(n,b) { - extern putchar; - auto a; - - if(a=n/b) /* assignment, not test for equality */ - printn(a, b); /* recursive */ - putchar(n%b + '0'); -} - -printf(fmt,x1,x2,x3,x4,x5,x6,x7,x8,x9) -char fmt[]; { - extern printn, putchar, namsiz, ncpw; - char s[]; - auto adx[], x, c, i[]; - - adx = &x1; /* argument pointer */ -loop: - while((c = *fmt++) != '%') { - if(c == '\0') - return; - putchar(c); - } - x = *adx++; - switch (c = *fmt++) { - - case 'd': /* decimal */ - case 'o': /* octal */ - if(x < 0) { - x = -x; - if(x<0) { /* - infinity */ - if(c=='o') - printf("100000"); - else - printf("-32767"); - goto loop; - } - putchar('-'); - } - printn(x, c=='o'?8:10); - goto loop; - - case 's': /* string */ - s = x; - while(c = *s++) - putchar(c); - goto loop; - - case 'p': - s = x; - putchar('_'); - c = namsiz; - while(c--) - if(*s) - putchar(*s++); - goto loop; - } - putchar('%'); - fmt--; - adx--; - goto loop; -} - diff --git a/c/nc0/c0t.s b/c/nc0/c0t.s deleted file mode 100644 index b3addb4cc5..0000000000 --- a/c/nc0/c0t.s +++ /dev/null @@ -1,264 +0,0 @@ -/ word I/O - -.globl _putwrd - -.globl _tmpfil -.globl putw -.globl fcreat -.globl flush - -.data -_putwrd: 1f -.text -1: - tst buf - bne 1f - mov _tmpfil,r0 - jsr r5,fcreat; buf - bec 1f - mov $1,r0 - sys write; botch; ebotch-botch - sys exit -1: - mov 2(sp),r0 - jsr r5,putw; buf - rts pc -.globl _flshw -.data -_flshw: 1f -.text -1: - jsr r5,flush; buf - rts pc - -botch: ; ebotch: -.even - -.bss -buf: .=.+518. -.text - -/ C operator and conversion tables - -.globl _opdope -.globl _cvtab - -_opdope:.+2 - 00000 / EOF - 00000 / ; - 00000 / { - 00000 / } - 36000 / [ - 02000 / ] - 36000 / ( - 02000 / ) - 14201 / : - 07001 / , - 00000 / 10 - 00000 / 11 - 00000 / 12 - 00000 / 13 - 00000 / 14 - 00000 / 15 - 00000 / 16 - 00000 / 17 - 00000 / 18 - 00000 / 19 - 00000 / name - 00000 / short constant - 00000 / string - 00000 / float - 00000 / double - 00000 / 25 - 00000 / 26 - 00000 / 27 - 00000 / 28 - 00000 / 29 - 34202 / ++pre - 34202 / --pre - 34202 / ++post - 34202 / --post - 34220 / !un - 34202 / &un - 34220 / *un - 34200 / -un - 34220 / ~un - 00000 / 39 - 30101 / + - 30001 / - - 32101 / * - 32001 / / - 32001 / % - 26061 / >> - 26061 / << - 20161 / & - 16161 / | - 16161 / ^ - 00000 / 50 - 00000 / 51 - 00000 / 52 - 00000 / 53 - 00000 / 54 - 00000 / 55 - 00000 / 56 - 00000 / 57 - 00000 / 58 - 00000 / 59 - 22105 / == - 22105 / != - 24105 / <= - 24105 / < - 24105 / >= - 24105 / > - 24105 /

p - 24105 / >=p - 12213 / =+ - 12213 / =- - 12213 / =* - 12213 / =/ - 12213 / =% - 12253 / =>> - 12253 / =<< - 12253 / =& - 12253 / =| - 12253 / =^ - 12213 / = - 00000 / 81 - 00000 / 82 - 00000 / 83 - 00000 / int -> float - 00000 / int -> double - 00000 / float -> int - 00000 / float -> double - 00000 / double -> int - 00000 / double -> float - 14201 / ? - 00000 / 91 - 00000 / 92 - 00000 / 93 - 00000 / int -> float - 00000 / int -> double - 00000 / float -> double - 00000 / int -> int[] - 00000 / int -> float[] - 00000 / int -> double[] - 36001 / call - 36001 / mcall - -_cvtab: .+2 - .byte 000 / i:i - .byte 000 / i:c - .byte 113 / i:f - .byte 125 / i:d - .byte 140 / i:i[] - .byte 100 / i:c[] - .byte 150 / i:f[] - .byte 160 / i:d[] - .byte 140 / i:[][] - - .byte 100 / c:i - .byte 100 / c:c - .byte 113 / c:f - .byte 125 / c:d - .byte 140 / c:i[] - .byte 100 / c:c[] - .byte 150 / c:f[] - .byte 160 / c:d[] - .byte 140 / c[][] - - .byte 211 / f:i - .byte 211 / f:c - .byte 000 / f:f - .byte 136 / f:d - .byte 211 / f:i[] - .byte 211 / f:c[] - .byte 211 / f:f[] - .byte 211 / f:d[] - .byte 211 / f:[][] - - .byte 222 / d:i - .byte 222 / d:c - .byte 234 / d:f - .byte 000 / d:d - .byte 222 / d:i[] - .byte 222 / d:c[] - .byte 222 / d:f[] - .byte 222 / d:d[] - .byte 222 / d:[][] - - .byte 240 / i[]:i - .byte 240 / i[]:c - .byte 113 / i[]:f - .byte 125 / i[]:d - .byte 000 / i[]:i[] - .byte 000 / i[]:c[] - .byte 100 / i[]:f[] - .byte 100 / i[]:d[] - .byte 100 / i[]:[][] - - .byte 000 / c[]:i - .byte 000 / c[]:c - .byte 113 / c[]:f - .byte 125 / c[]:d - .byte 200 / c[]:i[] - .byte 000 / c[]:c[] - .byte 200 / c[]:f[] - .byte 200 / c[]:d[] - .byte 200 / c[]:[][] - - .byte 250 / f[]:i - .byte 250 / f[]:c - .byte 113 / f[]:f - .byte 125 / f[]:d - .byte 000 / f[]:i[] - .byte 000 / f[]:c[] - .byte 000 / f[]:f[] - .byte 100 / f[]:d[] - .byte 000 / f[]:[][] - - .byte 260 / d[]:i - .byte 260 / d[]:c - .byte 113 / d[]:f - .byte 125 / d[]:d - .byte 000 / d[]:i[] - .byte 000 / d[]:c[] - .byte 000 / d[]:f[] - .byte 000 / d[]:d[] - .byte 000 / d[]:[][] - - .byte 240 / [][]:i - .byte 240 / [][]:c - .byte 113 / [][]:f - .byte 125 / [][]:d - .byte 000 / [][]:i[] - .byte 000 / [][]:c[] - .byte 100 / [][]:f[] - .byte 100 / [][]:d[] - .byte 000 / [][]:[][] - -.even - -/ character type table - -.globl _ctab - -_ctab: .+2 - .byte 000.,127.,127.,127.,127.,127.,127.,127. - .byte 127.,126.,125.,127.,127.,127.,127.,127. - .byte 127.,127.,127.,127.,127.,127.,127.,127. - .byte 127.,127.,127.,127.,127.,127.,127.,127. - .byte 126.,034.,122.,127.,127.,044.,047.,121. - .byte 006.,007.,042.,040.,009.,041.,127.,043. - .byte 124.,124.,124.,124.,124.,124.,124.,124. - .byte 124.,124.,008.,001.,063.,080.,065.,090. - .byte 127.,123.,123.,123.,123.,123.,123.,123. - .byte 123.,123.,123.,123.,123.,123.,123.,123. - .byte 123.,123.,123.,123.,123.,123.,123.,123. - .byte 123.,123.,123.,004.,127.,005.,049.,127. - .byte 127.,123.,123.,123.,123.,123.,123.,123. - .byte 123.,123.,123.,123.,123.,123.,123.,123. - .byte 123.,123.,123.,123.,123.,123.,123.,123. - .byte 123.,123.,123.,002.,048.,003.,127.,127. - diff --git a/c/nc1/c10.c b/c/nc1/c10.c deleted file mode 100644 index ad02520f53..0000000000 --- a/c/nc1/c10.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - - C compiler, part 2 - - Copyright 1972 Bell Telephone Laboratories, Inc. - -*/ - -ospace() {} /* fake */ - -waste() /* waste space */ -{ - waste(waste(waste),waste(waste),waste(waste)); - waste(waste(waste),waste(waste),waste(waste)); - waste(waste(waste),waste(waste),waste(waste)); - waste(waste(waste),waste(waste),waste(waste)); - waste(waste(waste),waste(waste),waste(waste)); - waste(waste(waste),waste(waste),waste(waste)); - waste(waste(waste),waste(waste),waste(waste)); - waste(waste(waste),waste(waste),waste(waste)); -} -main(argc, argv) -char argv[][]; -{ - extern fout, fin, nerror, line; - extern getwrd, rcexpr, ospace, tmpfil; - extern cctab[], regtab[], efftab[], sptab[]; - int sp[], c, table[], tabtab[3][], tree; - - if (argc<4) { - error("Arg count"); - exit(1); - } - if((fin=open(argv[1],0))<0) { - error("Cant't find %s", argv[1]); - exit(1); - } - if((fout=creat(argv[3],017))<0) { - error("Can't create %s", argv[3]); - exit(1); - } - tmpfil = argv[2]; - - tabtab[0] = regtab; - tabtab[1] = efftab; - tabtab[2] = cctab; - tabtab[3] = sptab; - while(c=getchar()) { - if(c=='#') { - sp = ospace; - c = getwrd(); - tree = getwrd(); - table = tabtab[getwrd()]; - line = getwrd(); - while(c--) - *sp++ = getwrd(); - rcexpr(tree, table, 0); - } else - putchar(c); - } - flush(); - exit(nerror!=0); -} - -match(tree, table, nreg) -int tree[], table[]; { - extern opdope[], dcalc, notcompat; - int op, d1, d2, t1, t2, p1[], p2[]; - char mp[]; - - if (tree==0) - return(0); - op = *tree; - if (op>=29) /* if not leaf */ - p1 = tree[3]; - else - p1 = tree; - t1 = p1[1]; - d1 = dcalc(p1, nreg); - if ((opdope[op]&01)!=0) { /* binary? */ - p2 = tree[4]; - t2 = p2[1]; - d2 = dcalc(p2, nreg); - } - while(*table) { - if (*table++ == op) goto foundop; - table++; - } - return(0); -foundop: - table = *table; -nxtry: - mp = table; - if (*mp == 0) - return(0); - if (d1 > (*mp&077) | (*mp>=0100)&(*p1!=36)) - goto notyet; - if (notcompat(t1, mp[1])) - goto notyet; - if ((opdope[op]&01)!=0 & p2!=0) { - if (d2 > (mp[2]&077) | (mp[2]>=0100)&(*p2!=36)) - goto notyet; - if (notcompat(t2,mp[3])) - goto notyet; - } -now: - return(table[2]); -notyet: - table = table+3; - goto nxtry; -} - -rcexpr(tree, table, reg) -int tree[]; { - extern cexpr, regtab, cctab, sptab, printf, error; - extern jumpc, cbranch; - - if(tree==0) - return; - if(*tree >= 103) { - (*tree==103?jumpc:cbranch)(tree[1],tree[2],tree[3],0); - return; - } - if (cexpr(tree, table, reg)) - return; - if (table!=regtab) - if(cexpr(tree, regtab, reg)) { - if (table==sptab) - printf("mov r%d,-(sp)\n", reg); - if (table==cctab) - printf("tst r%d\n", reg); - return; - } - error("No match for op %d", *tree); -} - -cexpr(tree, table, reg) -int tree[][], table[]; { - extern match, nreg, printf, pname, putchar, regtab; - extern sptab, cctab, rcexpr, prins, rlength, popstk; - extern collcon, isn, label, branch, cbranch, fltmod; - int p1[], p2[], c, r, p[], otable[], ctable[], regtab[], cctab[]; - char string[], match[]; - - if ((c = *tree)==100) { /* call */ - p1 = tree[3]; - p2 = tree[4]; - r = 0; - if(p2) { - while (*p2==9) { /* comma */ - rcexpr(p2[4], sptab, 0); - r =+ rlength((p=p2[4])[1]); - p2 = p2[3]; - } - rcexpr(p2, sptab, 0); - r =+ rlength(p2[1]); - } - *tree = 101; - tree[2] = r; /* save arg length */ - } - if(c==90) { /* ? */ - cbranch(tree[3], c=isn++, 0, reg); - rcexpr(tree[4][3], table, reg); - branch(r=isn++, 0); - label(c); - rcexpr(tree[4][4], table, reg); - label(r); - return(1); - } - if ((string=match(tree, table, nreg-reg))==0) - return(0); - p1 = tree[3]; - p2 = tree[4]; -loop: - switch(c = *string++) { - - case '\0': - p = tree; - if (*p==101 & p[2]>0) { - popstk(p[2]); - } - return(1); - - /* A1 */ - case 'A': - p = tree[3]; - goto adr; - - /* A2 */ - case 'B': - p = tree[4]; - goto adr; - - /* A */ - case 'O': - p = tree; - adr: - pname(p); - goto loop; - - /* I */ - case 'M': - if ((c = *string)=='\'') - string++; else - c = 0; - prins(*tree, c); - goto loop; - - /* B1 */ - case 'C': - p = tree[3]; - goto pbyte; - - /* BF */ - case 'P': - p = tree; - goto pb1; - - /* B2 */ - case 'D': - p = tree[4]; - pbyte: - if (p[1]==1) /* char type? */ - putchar('b'); -pb1: - if (isfloat(p)) - putchar('f'); - goto loop; - - /* BE */ - case 'L': - if (tree[3][1]==1 | tree[4][1]==1) - putchar('b'); - goto loop; - - /* C1 */ - case 'E': - p = p1[3]; - goto const; - - /* C2 */ - case 'F': - p = p2[3]; - const: - printf("%o", p); - goto loop; - - /* F */ - case 'G': - p = p1; - goto subtre; - - /* S */ - case 'K': - p = p2; - goto subtre; - - /* H */ - case 'H': - p = tree; - - subtre: - ctable = regtab; - r = reg; - c = *string++ - 'A'; - if ((c&02)!=0) - ctable = sptab; - if ((c&04)!=0) - ctable = cctab; - if((c&010)!=0) - r = reg+1; - if((c&01)!=0) - if(*p==36) { - p = p[3]; - if(collcon(p) & ctable!=sptab) - p = p[3]; - } - rcexpr(p, ctable, r); - goto loop; - - /* R */ - case 'I': - r = reg; - goto preg; - - /* R1 */ - case 'J': - r = reg+1; - preg: - printf("r%d", r); - goto loop; - - case '#': - p = p1[3]; - goto nmbr; - - case '"': - p = p2[3]; - goto nmbr; - case '~': - p = tree[3]; - - nmbr: - if(collcon(p)) { - c = *p; - if(r = (p=p[4])[3]) - printf("%o", c==40?r:-r); - } - goto loop; - - /* M */ - case 'N': - if ((c=isfloat(tree, &string))==fltmod) - goto loop; - printf((fltmod=c)==2?"setf\n":"setd\n"); - goto loop; - - /* Z */ - case 'Z': - printf("$%o", p1[4]); - goto loop; - } - putchar(c); - goto loop; -} - -pname(p) -int p[][][]; { - extern putchar, printf, error; - char np[]; - int i; - -loop: - switch(*p) { - - case 21: /* const */ - printf("$%o", p[3]); - return; - - case 22: /* string */ - printf("$l%d", p[3]); - return; - - case 20: /* name */ - switch(p[3]) { - - case 5: /* auto, param */ - printf("%o(r5)", p[4]); - return; - - /* extern */ - case 6: - printf("%p", &p[4]); - return; - - } - printf("L%d", p[4]); - return; - - case 35: /* & */ - putchar('$'); - p = p[3]; - goto loop; - - case 36: /* * */ - putchar('*'); - p = p[3]; - goto loop; - } - error("pname called illegally"); -} - -dcalc(p, nreg) -int p[]; { - int op, t; - - if (p==0) - return(0); - op = *p; - switch (op) { - - case 20: /* name */ - case 22: /* string */ - case 23: /* float */ - case 24: /* double */ - return(12); - - case 21: /* short constant */ - return(p[3]==0? 4:8); - - case 35: /* & */ - return(12); - - case 36: /* * */ - if ((op=dcalc(p[3], nreg))<16) - return(16); - } - -def: - return(p[2]<=nreg? 20: 24); -} - -notcompat(at, st) { - - if (st==0) /* word, byte */ - return(at>1 & at<16); - if (st==1) /* word */ - return(at>0 & at<16); - st =- 2; - if (st==2 & at==3) - at = 2; - return(st != at); -} - -prins(op, c) { - extern instab[], printf; - int insp[]; - - insp = instab; - while(*insp) { - if (*insp++ == op) { - if ((c = insp[c!=0])==0) - goto err; - printf("%s", c); - return; - } else - insp = insp + 2; - } -err: - error("No match' for op %d", op); -} - -collcon(p) -int p[]; { - int p1[]; - - if(*p==40 | *p==41) - if(*(p1=p[4])==21) - return(1); - return(0); -} - -isfloat(t, s) -int t[]; -char s[][]; -{ - extern opdope[]; - int rt; - - rt = **s - '0'; - if (rt==2 | rt==4) { - (*s)++; - return(rt>2?3:2); - } - if ((opdope[t[0]]&010)!=0) /* relational */ - t = t[3]; - if ((rt=t[1])>=2 & rt<=3) - return(rt); - return(0); -} - -nreg 4; -isn 10000; -namsiz 8; -line; -tmpfil; -nerror; -fltmod; - diff --git a/c/nc1/c11.c b/c/nc1/c11.c deleted file mode 100644 index 1733ad3241..0000000000 --- a/c/nc1/c11.c +++ /dev/null @@ -1,251 +0,0 @@ -jumpc(tree, lbl, cond) -int tree[]; { - extern jump, cctab[], rcexpr, isn, label, branch, cbranch; - int l1, l2; - - if (tree==0) - return; - switch(*tree) { - - /* & */ - case 47: - if (cond) { - cbranch(tree[3], l1=isn++, 0, 0); - cbranch(tree[4], l1, 0, 0); - jump(lbl); - label(l1); - } else { - cbranch(tree[3], l1=isn++, 0, 0); - cbranch(tree[4], l2=isn++, 1, 0); - label(l1); - jump(lbl); - label(l2); - } - return; - - /* | */ - case 48: - if (cond) { - cbranch(tree[3], l1=isn++, 1, 0); - cbranch(tree[4], l2=isn++, 0, 0); - label(l1); - jump(lbl); - label(l2); - } else { - cbranch(tree[3], l1=isn++, 1, 0); - cbranch(tree[4], l1, 1, 0); - jump(lbl); - label(l1); - } - return; - - /* ! */ - case 34: - jumpc(tree[3], lbl, !cond); - return; - } - rcexpr(tree, cctab, 0); - branch(l1=isn++, *tree, cond); - jump(lbl); - label(l1); - return; -} - -cbranch(tree, lbl, cond, reg) -int tree[]; { - extern branch, cctab[], rcexpr, isn, label; - int l1; - - if (tree==0) - return; - switch(*tree) { - - /* & */ - case 47: - if (cond) { - cbranch(tree[3], l1=isn++, 0, reg); - cbranch(tree[4], lbl, 1, reg); - label(l1); - } else { - cbranch(tree[3], lbl, 0, reg); - cbranch(tree[4], lbl, 0, reg); - } - return; - - /* | */ - case 48: - if (cond) { - cbranch(tree[3], lbl, 1, reg); - cbranch(tree[4], lbl, 1, reg); - } else { - cbranch(tree[3], l1=isn++, 1, reg); - cbranch(tree[4], lbl, 0, reg); - label(l1); - } - return; - - /* ! */ - case 34: - cbranch(tree[3], lbl, !cond, reg); - return; - } - rcexpr(tree, cctab, reg); - branch(lbl, *tree, !cond); - return; -} - - -branch(lbl, op, c) { - extern printf, prins, opdope[]; - - if(op) { - if((opdope[op]&04)==0) - op = 61; - prins(op,c); - } else - printf("br"); - printf("\tl%d\n", lbl); -} - -jump(lab) { - extern printf; - - printf("jmp\tl%d\n", lab); -} - -label(l) { - extern printf; - - printf("l%d:", l); -} - - -popstk(a) { - extern printf; - - switch(a) { - - case 0: - return; - - case 2: - printf("tst (sp)+\n"); - return; - - case 4: - printf("cmp (sp)+,(sp)+\n"); - return; - } - printf("add $%o,sp\n", a); -} - -length(t) { - - if (t<0) - t =+ 020; - if (t>=020) - return(2); - switch(t) { - - case 0: - return(2); - - case 1: - return(1); - - case 2: - return(4); - - case 3: - return(8); - - case 4: - return(4); - - } - return(1024); -} - -rlength(c) { - extern length; - auto l; - - return((l=length(c))==1? 2: l); -} - -printn(n,b) { - extern putchar; - auto a; - - if(a=n/b) /* assignment, not test for equality */ - printn(a, b); /* recursive */ - putchar(n%b + '0'); -} - -printf(fmt,x1,x2,x3,x4,x5,x6,x7,x8,x9) -char fmt[]; { - extern printn, putchar, namsiz, ncpw; - char s[]; - auto adx[], x, c, i[]; - - adx = &x1; /* argument pointer */ -loop: - while((c = *fmt++) != '%') { - if(c == '\0') - return; - putchar(c); - } - x = *adx++; - switch (c = *fmt++) { - - case 'd': /* decimal */ - case 'o': /* octal */ - if(x < 0) { - x = -x; - if(x<0) { /* - infinity */ - if(c=='o') - printf("100000"); - else - printf("-32767"); - goto loop; - } - putchar('-'); - } - printn(x, c=='o'?8:10); - goto loop; - - case 's': /* string */ - s = x; - while(c = *s++) - putchar(c); - goto loop; - - case 'p': - s = x; - putchar('_'); - c = namsiz; - while(c--) - if(*s) - putchar(*s++); - goto loop; - } - putchar('%'); - fmt--; - adx--; - goto loop; -} - -error(s, p1, p2) { - extern printf, line, fout, flush, putchar, nerror; - int f; - - nerror++; - flush(); - f = fout; - fout = 1; - printf("%d: ", line); - printf(s, p1, p2); - putchar('\n'); - fout = f; -} - diff --git a/c/nc1/c1t.s b/c/nc1/c1t.s deleted file mode 100644 index f0fa30d8ac..0000000000 --- a/c/nc1/c1t.s +++ /dev/null @@ -1,171 +0,0 @@ -/ C operator tables - -.globl _getwrd - -.globl getw -.globl fopen -.globl _tmpfil - -.data -_getwrd: 1f -.text -1: - tst buf - bne 1f - mov _tmpfil,r0 - jsr r5,fopen; buf - bes botchp -1: - jsr r5,getw; buf - bes botchp - rts pc -botchp: - mov $1,r0 - sys write; botch; ebotch-botch - sys exit -botch: - ; ebotch: -.even -.bss -buf: .=.+518. -.text -.globl _opdope -.globl _instab - -_instab:.+2 - 40.; 1f; 1f; .data; 1:; .text - 70.; 1b; 1b - 41.; 2f; 2f; .data; 2:; .text - 71.; 2b; 2b - 30.; 3f; 1b; .data; 3:; .text - 31.; 4f; 2b; .data; 4:; .text - 32.; 3b; 1b - 33.; 4b; 2b - - 45.; 2b; 5f; .data; 5:; .text - 46.; 6f; 7f; .data; 6:; 7:<(r4)\0>; .text - 75.; 2b; 5b - 76.; 6b; 7b - 43.; 7b; 1f; .data; 1:; .text - 44.; 5b; 0 - 73.; 7b; 1b - 74.; 5b; 0 - - 60.; 0f; 1f; .data; 0:; 1:; .text - 61.; 1b; 0b - 62.; 2f; 5f; .data; 2:; 5:; .text - 63.; 3f; 4f; .data; 3:; 4:; .text - 64.; 4b; 3b - 65.; 5b; 2b - 66.; 6f; 9f; .data; 6:; 9:; .text - 67.; 7f; 8f; .data; 7:; 8:; .text - 68.; 8b; 7b - 69.; 9b; 6b - 0 - .data - .even - .text - -_opdope:.+2 - 00000 / EOF - 00000 / ; - 00000 / { - 00000 / } - 36000 / [ - 02000 / ] - 36000 / ( - 02000 / ) - 02000 / : - 07001 / , - 00000 / 10 - 00000 / 11 - 00000 / 12 - 00000 / 13 - 00000 / 14 - 00000 / 15 - 00000 / 16 - 00000 / 17 - 00000 / 18 - 00000 / 19 - 00000 / name - 00000 / short constant - 00000 / string - 00000 / float - 00000 / double - 00000 / 25 - 00000 / 26 - 00000 / 27 - 00000 / 28 - 00000 / 29 - 34002 / ++pre - 34002 / --pre - 34002 / ++post - 34002 / --post - 34020 / !un - 34002 / &un - 34020 / *un - 34000 / -un - 34020 / ~un - 00000 / 39 - 30101 / + - 30001 / - - 32101 / * - 32001 / / - 32001 / % - 26061 / >> - 26061 / << - 20161 / & - 16161 / | - 16161 / ^ - 00000 / 50 - 00000 / 51 - 00000 / 52 - 00000 / 53 - 00000 / 54 - 00000 / 55 - 00000 / 56 - 00000 / 57 - 00000 / 58 - 00000 / 59 - 22105 / == - 22105 / != - 24105 / <= - 24105 / < - 24105 / >= - 24105 / > - 24105 /

p - 24105 / >=p - 12013 / =+ - 12013 / =- - 12013 / =* - 12013 / =/ - 12013 / =% - 12053 / =>> - 12053 / =<< - 12053 / =& - 12053 / =| - 12053 / =^ - 12013 / = - 00000 / 81 - 00000 / 82 - 00000 / 83 - 00000 / int -> float - 00000 / int -> double - 00000 / float -> int - 00000 / float -> double - 00000 / double -> int - 00000 / double -> float - 14001 / ? - 00000 / 91 - 00000 / 92 - 00000 / 93 - 00000 / int -> float - 00000 / int -> double - 00000 / float -> double - 00000 / int -> int[] - 00000 / int -> float[] - 00000 / int -> double[] - 36001 / call - 36001 / mcall diff --git a/c/nc1/t.c b/c/nc1/t.c deleted file mode 100644 index 85fcac1473..0000000000 --- a/c/nc1/t.c +++ /dev/null @@ -1,19 +0,0 @@ -main() { - extern a, b, c, i; - float a, b; - double c; - int i; - - a = b; - a = b*c; - a = b*c/a; - a = c; - c = a; - a = c*c+a; - a = 1; - a = a+1; - i = a; - i = c; - a++; - c++; -} diff --git a/c/ncc.c b/c/ncc.c deleted file mode 100644 index 5af14536ad..0000000000 --- a/c/ncc.c +++ /dev/null @@ -1,193 +0,0 @@ -/* C command */ - -main(argc, argv) -char argv[][]; { - extern callsys, printf, unlink, link, nodup; - extern getsuf, setsuf, copy; - extern tsp; - extern tmp0, tmp1, tmp2, tmp3; - char tmp0[], tmp1[], tmp2[], tmp3[]; - char glotch[100][], clist[50][], llist[50][], ts[500]; - char tsp[], av[50][], t[]; - auto nc, nl, cflag, i, j, c; - - tmp0 = tmp1 = tmp2 = tmp3 = "//"; - tsp = ts; - i = nc = nl = cflag = 0; - while(++i < argc) { - if(*argv[i] == '-' & argv[i][1]=='c') - cflag++; - else { - t = copy(argv[i]); - if((c=getsuf(t))=='c') { - clist[nc++] = t; - llist[nl++] = setsuf(copy(t)); - } else { - if (nodup(llist, t)) - llist[nl++] = t; - } - } - } - if(nc==0) - goto nocom; - tmp0 = copy("/tmp/ctm0a"); - while((c=open(tmp0, 0))>=0) { - close(c); - tmp0[9]++; - } - while((creat(tmp0, 012))<0) - tmp0[9]++; - intr(delfil); - (tmp1 = copy(tmp0))[8] = '1'; - (tmp2 = copy(tmp0))[8] = '2'; - (tmp3 = copy(tmp0))[8] = '3'; - i = 0; - while(i1) - printf("%s:\n", clist[i]); - av[0] = "c0"; - av[1] = clist[i]; - av[2] = tmp1; - av[3] = tmp2; - av[4] = 0; - if (callsys("/usr/lib/c0", av)) { - cflag++; - goto loop; - } - av[0] = "c1"; - av[1] = tmp1; - av[2] = tmp2; - av[3] = tmp3; - av[4] = 0; - if(callsys("/usr/lib/c1", av)) { - cflag++; - goto loop; - } - av[0] = "as"; - av[1] = "-"; - av[2] = tmp3; - av[3] = 0; - callsys("/bin/as", av); - t = setsuf(clist[i]); - unlink(t); - if(link("a.out", t) | unlink("a.out")) { - printf("move failed: %s\n", t); - cflag++; - } -loop:; - i++; - } -nocom: - if (cflag==0 & nl!=0) { - i = 0; - av[0] = "ld"; - av[1] = "/usr/lib/crt0.o"; - j = 2; - while(i2 & *s++=='.' & *s=='c') - return('c'); - return(0); -} - -setsuf(s) -char s[]; -{ - char os[]; - - os = s; - while(*s++); - s[-2] = 'o'; - return(os); -} - -callsys(f, v) -char f[], v[][]; { - - extern fork, execv, wait, printf; - auto t, status; - - if ((t=fork())==0) { - execv(f, v); - printf("Can't find %s\n", f); - exit(1); - } else - if (t == -1) { - printf("Try again\n"); - return(1); - } - while(t!=wait(&status)); - if ((t=(status&0377)) != 0) { - if (t!=9) /* interrupt */ - printf("Fatal error in %s\n", f); - dexit(); - } - return((status>>8) & 0377); -} - -copy(s) -char s[]; { - extern tsp; - char tsp[], otsp[]; - - otsp = tsp; - while(*tsp++ = *s++); - return(otsp); -} - -nodup(l, s) -char l[][], s[]; { - - char t[], os[], c; - - os = s; - while(t = *l++) { - s = os; - while(c = *s++) - if (c != *t++) goto ll; - if (*t++ == '\0') return (0); -ll:; - } - return(1); -} - -tsp; -tmp0; -tmp1; -tmp2; -tmp3; - diff --git a/c/regtab.s b/c/regtab.s deleted file mode 100644 index 9402684697..0000000000 --- a/c/regtab.s +++ /dev/null @@ -1,696 +0,0 @@ -/ c code tables-- compile to register - -fp = 1 / enable floating-point - -.globl _regtab - -_regtab=.; .+2 - 20.; cr20 - 21.; cr20 - 22.; cr20 - 30.; cr30 - 31.; cr30 - 32.; cr32 - 33.; cr32 - 34.; cr34 - 35.; cr35 - 29.; cr29 - 36.; cr36 - 37.; cr37 - 38.; cr38 - 101.; cr100 - 80.; cr80 - 40.; cr40 - 41.; cr40 / - like + - 42.; cr42 - 43.; cr43 - 44.; cr43 - 45.; cr45 - 46.; cr45 - 47.; cr47 - 48.; cr48 - 60.; cr60 - 61.; cr60 - 62.; cr60 - 63.; cr60 - 64.; cr60 - 65.; cr60 - 66.; cr60 - 67.; cr60 - 68.; cr60 - 69.; cr60 - 70.; cr70 - 71.; cr70 - 72.; cr72 - 73.; cr73 - 74.; cr73 - 75.; cr75 - 76.; cr75 - 77.; cr77 - 78.; cr78 - 102.; cr102 - 97.; cr97 - 0 - -/ goto -cr102: -%i,n - jmp *A1 - -%n*,n - F* - jmp *#1(R) - -%n,n - F - jmp (R) - -/ call -cr100: -%n*,n - F* - jsr pc,*#1(R) - -%a,n - jsr pc,*A1 - -%n,n - F - jsr pc,(R) - -/ name, constant -cr20: -%z,n - clr R - -%aw,n - mov A,R - -%ab,n - movb A,R - -.if fp -%af,n - M - movf A,R - -.endif - -/++,-- prefix -cr30: -%ai,n -%abp,n -%ab,n - IB1 A1 - movB1 A1,R - -%a,n - I' $2,A1 - mov A1,R - -%nbp*,n -%ni*,n -%nb*,n - F* - IB1 #1(R) - movB1 #1(R),R - -%n*,n - F* - I' $2,#1(R) - mov #1(R),R - -/ ++,-- postfix -cr32: -%ai,n -%abp,n -%ab,n - movB1 A1,R - IB1 A1 - -%a,n - mov A1,R - I' $2,A1 - -%nbp*,n -%nb*,n -%ni*,n - F* - movB1 #1(R),-(sp) - IB1 #1(R) - movB1 (sp)+,R - -%n*,n - F* - mov #1(R),-(sp) - I' $2,#1(R) - mov (sp)+,R - -/ ! -cr34: -%n,n - FC - beq 1f - clr R - br 2f -1: mov $1,R -2: - -/ &unary -cr35: -%a,n - mov $A1,R - -/ & unary of auto -cr29: -%e,n - mov r5,R - add Z,R - -/ *unary -cr36: -%abp*,n - F - movb (R),R - -%a*,n - F - mov (R),R - -%abp,n - movb *A1,R - -%a,n - mov *A1,R - -%nbp*,n - F* - movb *#1(R),R - -%n*,n - F* - mov *#1(R),R - -%nbp,n - H* - movb ~(R),R - -%n,n - H* - mov ~(R),R - -/ - unary -cr37: -%n,n - F - neg R - -/ ~ -cr38: -%n,n - F - com R - -/ = -cr80: -%a,n - S - movB1 R,A1 - -%n*,a - F* - movB1 A2,#1(R) - movB1 #1(R),R - -%n*,e - F* - S1 - movB1 R1,#1(R) - mov R1,R - -%n*,n - FS* - S - movB1 R,*(sp)+ - -/ | -cr48: -%n,a - F - bisB2 A2,R - -%n,e* - F - S1* - bisB2 #2(R1),R - -%n,e - F - S1 - bis R1,R - -%n,n - FS - S - bis (sp)+,R - -/ & -cr47: -%n,c - F - bic $!C2,R - -%n,e - F - S1 - com R1 - bic R1,R - -%n,n - FS - S - com (sp) - bic (sp)+,R - -/ relationals -cr60: -%n,n - HC - I 2f - clr R - br 1f -2: mov $1,R -1: - -/ >>, << -cr45: -%a,aw - movB1 A1,I' - I A2,lsh - movB1 I',R - -%n*,aw - F* - movB1 #1(R),I' - I A2,lsh - movB1 I',R - -%n,aw - F - mov R,I' - I A2,lsh - mov I',R - -%a,nw* - S* - movB1 A1,(r4) - I #2(R),lsh - mov (r4),R - -%a,n - S - movB1 A1,I' - I R,lsh - mov I',R - -%n,n - FS - S - mov (sp)+,I' - I R,lsh - mov I',R - -/ +, - -cr40: -%n,aw - F - I A2,R - -%n,ew* - F - S1* - I #2(R1),R - -%n,e - F - S1 - I R1,R - -%n,nw* - SS* - F - I *(sp)+,R - -%n,n - SS - F - I (sp)+,R - -/ * -cr42: -%aw,a - mov A1,(r4)+ - movB2 A2,(r4) - mov -(r4),R - -%n,a - F - mov R,(r4)+ - movB2 A2,(r4) - mov -(r4),R - -%n,e - F - S1 - mov R,(r4)+ - mov R1,(r4) - mov -(r4),R - -%n,n - FS - S - mov (sp)+,(r4)+ - mov R,(r4) - mov -(r4),R - -/ /; mod -cr43: -%a,a - movB1 A1,(r4) - movB2 A2,div - mov I,R - -%a,n - S - movB1 A1,(r4) - mov R,div - mov I,R - -%n,a - F - mov R,(r4) - movB2 A2,div - mov I,R - -%n,e - F - S1 - mov R,(r4) - mov R1,div - mov I,R - -%e,n - S - F1 - mov R1,(r4) - mov R,div - mov I,R - -%n,n - FS - S - mov (sp)+,(r4) - mov R,div - mov I,R - -/ =* -cr72: -%a,a - movB1 A1,(r4) - movB2 A2,mul - movB1 (r4),A1 - mov (r4),R - -%a,n - S - mov R,(r4)+ - movB1 A1,(r4) - mov -(r4),R - movB1 R,A1 - -%n*,a - F* - movB1 #1(R),(r4) - movB2 A2,mul - movB1 (r4),#1(R) - mov (r4),R - -%n*,e - F* - S1 - movB1 #1(R),(r4) - mov R1,mul - movB1 (r4),#1(R) - mov (r4),R - -%e*,n - S - F1* - movB1 #1(R1),(r4) - mov R,mul - movB1 (r4),#1(R1) - mov (r4),R - -%n*,n - FS* - S - movB1 *(sp),(r4) - mov R,mul - movB1 (r4),*(sp)+ - mov (r4),R - -/ =mod, =/ -cr73: -%a,a - movB1 A1,(r4) - movB2 A2,div - movB1 I,A1 - mov I,R - -%a,n - S - movB1 A1,(r4) - mov R,div - mov I,R - movB1 R,A1 - -%n*,a - F* - movB1 #1(R),(r4) - movB2 A2,div - movB1 I,#1(R) - mov I,R - -%n*,e - F* - S1 - movB1 #1(R),(r4) - mov R1,div - movB1 I,#1(R) - mov I,R - -%e*,n - S - F1* - movB1 #1(R1),(r4) - mov R,div - movB1 I,#1(R1) - mov I,R - -%n*,n - FS* - S - movB1 *(sp),(r4) - mov R,div - movB1 I,*(sp)+ - mov I,R - -/ =| -cr78: -%a,a - bisBE A2,A1 - movB1 A1,R - -%a,n - S - bisB1 R,A1 - movB1 A1,R - -%n*,a - F* - bisBE A2,#1(R) - movB1 #1(R),R - -%e*,n* - S* - F1* - bisBE #1(R1),#2(R) - movB1 #2(R),R - -%e*,n - S - F1* - bisBE R,#1(R1) - movB1 #1(R1),R - -%n*,e* - F* - S1* - bisBE #2(R1),#1(R) - movB1 #1(R),R - -%n*,e - F* - S1 - bisBE R1,#1(R) - movB2 #1(R),R - -%n*,n* - FS* - S* - bisBE #2(R),*(sp) - movB2 *(sp)+,R - -%n*,n - FS* - S - bisBE R,*(sp) - mov *(sp)+,R - -/ =& -cr77: -%a,c - bicB1 $!C2,A1 - movB2 A1,R - -%a,n - S - com R - bicB1 R,A1 - movB1 A1,R - -%e*,n - S - F1* - com R - bicB1 R,#1(R1) - movB1 #1(R1),R - -%n*,e - F* - S1 - com R1 - bicB1 R1,#1(R) - movB1 #1(R),R - -%n*,n - FS* - S - com R - bicB1 R,*(sp) - movB1 *(sp)+,R - -/ =>>, =<< -cr75: -%a,aw - movB1 A1,I' - I A2,lsh - movB1 I',A1 - movB1 I',R - -%a,n - S - movB1 A1,I' - I R,lsh - movB1 I',A1 - movB1 I',R - -%n*,e - F* - S1 - movB1 #1(R),I' - I R1,lsh - movB1 I',#1(R) - movB1 I',R - -%e*,n - S - F1* - movB1 #1(R1),I' - I R,lsh - movB I',#1(R1) - movB1 I',R - -%n*,n - FS* - S - movB1 *(sp),I' - I R,lsh - movB1 I',*(sp)+ - movB1 I',R - -/ =+ -cr70: -%aw,aw - I A2,A1 - mov A1,R - -%aw,nw* - S* - I #2(R),A1 - mov A1,R - -%aw,n - S - I R,A1 - mov A1,R - -%ew*,nw* - S* - F1* - I #2(R),#1(R1) - mov #1(R1),R - -%a,nw* - S* - movB1 A1,R1 - I #2(R),R1 - movB1 R1,#2(R) - mov R1,R - -%a,n - S - movB1 A1,R1 - I R1,R - movB1 R,A1 - -%ew*,n - S - F1* - I R,#1(R1) - mov #1(R1),R - -%nw*,n - SS - F* - I (sp)+,#1(R) - mov #1(R),R - -%n*,n - SS - F* - movB1 #1(R),R1 - I (sp)+,R1 - movB1 R1,#1(R) - mov R1,R - -/ int -> int[] -cr97: -%n,n - F - asl R - -.data -.even -.text - diff --git a/c/sptab.s b/c/sptab.s deleted file mode 100644 index f359f702d8..0000000000 --- a/c/sptab.s +++ /dev/null @@ -1,167 +0,0 @@ -/ c code tables-- expression to -(sp) - -.globl _sptab - -_sptab=.;.+2 - 20.; cs20 - 21.; cs21 - 22.; cs21 - 30.; cs30 - 31.; cs30 - 32.; cs32 - 33.; cs32 - 35.; cs35 - 36.; cs36 - 40.; cs40 - 41.; cs40 - 42.; cs42 - 47.; cs47 - 48.; cs48 - 0 - - -/ name -cs20: -%aw,n - mov A,-(sp) - -/ constant -cs21: -%z,n - clr -(sp) - -%a,n - mov A,-(sp) - -/ ++,-- prefix -cs30: -%ai,n -%abp,n - I A1 - mov A1,-(sp) - -%aw,n - I' $2,A1 - mov A1,-(sp) - -%nbp*,n -%ni*,n - F* - I #1(R) - mov #1(R),-(sp) - -%nip*,n - F* - mov #1(R),-(sp) - I' $2,#1(R) - -/ ++,-- postfix -cs32: -%ai,n -%abp,n - mov A1,-(sp) - I A1 - -%aip,n - mov A1,-(sp) - I' $2,A1 - -%nbp*,n -%ni*,n - F* - mov #1(R),-(sp) - I #1(R) - -%nip*,n - F* - mov #1(R),-(sp) - I' $2,#1(R) - -/ & unary -cs35: -%i,n - mov $A1,-(sp) - -/ * unary -cs36: -%aw,n - mov *A1,-(sp) - -%nw*,n - F* - mov #1(R),-(sp) - -/ + -cs40: -%n,aw - FS - I A2,(sp) - -%n,nw* - FS - S* - I #2(R),(sp) - -%n,n - FS - S - I R,(sp) - -/ * -cs42: -%aw,a - mov A1,(r4)+ - movB2 A2,(r4) - mov -(r4),-(sp) - -%n,a - F - mov R,(r4)+ - movB2 A2,(r4) - mov -(r4),-(sp) - -%n,nw* - FS - S* - mov (sp)+,(r4)+ - mov #2(R),(r4) - mov -(r4),-(sp) - -%n,n - FS - S - mov (sp)+,(r4)+ - mov R,(r4) - mov -(r4),-(sp) - -/ & -cs47: -%n,c - FS - bic $!C2,(sp) - -%n,n - FS - S - com R - bic R,(sp) - -/ | -cs48: -%n,a - FS - bisB2 A2,(sp) - -%n,n* - FS - S* - bisB2 #2(R),(sp) - -%n,n - FS - S - bis R,(sp) - -.data -.even -.text diff --git a/c/src b/c/src deleted file mode 100644 index 45889d1d62..0000000000 --- a/c/src +++ /dev/null @@ -1,2 +0,0 @@ -/usr/lib/c0 $1.c c.tmp0 c.tmp1 -/usr/lib/c1 c.tmp0 c.tmp1 $1.s diff --git a/cmd/a1.s b/cmd/a1.s deleted file mode 100644 index ea0f49f992..0000000000 --- a/cmd/a1.s +++ /dev/null @@ -1,143 +0,0 @@ -/ a1 -- pdp-11 assembler pass 1 - - -main: -ecore = main+8192. - jmp start -go: - jsr pc,assem - movb pof,r0 - sys write; outbuf; 512. - movb pof,r0 - sys close - movb fbfil,r0 - sys close - tstb errflg - bne aexit - jsr r5,fcreat; a.tmp3 - mov $txtsiz,r1 / even up - inc (r1) - bic $1,(r1)+ - inc (r1) - bic $1,(r1)+ - inc (r1) - bic $1,(r1)+ - mov r0,r1 - sys write; txtsiz; 6 - mov symend,0f - sub $usymtab,0f - mov r1,r0 - sys write; usymtab; 0:.. - mov r1,r0 - sys close - sys exec; 2f; 1f - -aexit: - sys unlink; a.tmp1 - sys unlink; a.tmp2 - sys unlink; a.tmp3 - sys exit -1: - 2f - a.tmp1 - a.tmp2 - a.tmp3 -unglob: - 3f - 0 -2: - -3: - <-g\0> - .even - -filerr: - mov r4,-(sp) - mov (r5)+,r4 - mov r4,0f - clr r0 -1: - tstb (r4)+ - beq 1f - inc r0 - br 1b -1: - mov r0,1f - mov $1,r0 - sys write; 0:0; 1:0 - mov r5,0f - mov $1,r0 - sys write; 0:0; 2 - tst (r5)+ - mov (sp)+,r4 - rts r5 - -fcreat: - mov r4,-(sp) - mov (r5)+,r4 - mov r4,0f -1: - sys creat; 0:..; 12 - bes 2f - mov (sp)+,r4 - rts r5 -2: - incb 9.(r4) - cmpb 9.(r4),$'z - blos 1b - mov 0b,0f - jsr r5,filerr; 0:..; "?\n - sys exit -unlink; a.tmp3 - sys exit -1: - 2f - a.tmp1 - a.tmp2 - a.tmp3 -unglob: - 3f - 0 -2: - -3: - <-g\0> - .even - -filerr: - mov r4,-(sp) - mov (r5)+,r4 - mov r4,0f - clr r0 -1: - tstb (r4)+ - beq 1f - inc r0 - br 1b -1: - mov r0,1f - mov $1,r0 - sys write; 0:0; 1:0 - mov r5,0f - mov $1,r0 - sys write; 0:0; 2 - tst (r5)+ - mov (sp)+,r4 - rts r5 - -fcreat: - mov r4,-(sp) - mov (r5)+,r4 - mov r4,0f -1: - sys creat; 0:..; 12 - bes 2f - mov (sp)+,r4 - rts r5 -2: - incb 9.(r4) - cmpb 9.(r4),$'z - blos 1b - mov 0b,0f - jsr r5,filerr; 0:..; "?\n - sys \ No newline at end of file diff --git a/cmd/a2.s b/cmd/a2.s deleted file mode 100644 index 98b27abf71..0000000000 --- a/cmd/a2.s +++ /dev/null @@ -1,98 +0,0 @@ -/ a2 -- pdp-11 assembler pass 1 - -error: - incb errflg - mov r0,-(sp) - mov r1,-(sp) - mov (r5)+,r0 - mov *curarg,0f - beq 1f - clr *curarg - mov r0,-(sp) - jsr r5,filerr; 0:0; '\n - mov (sp)+,r0 -1: - mov r2,-(sp) - mov r3,-(sp) - mov line,r3 - movb r0,1f - mov $1f+6,r0 - mov $4,r1 -2: - clr r2 - dvd $10.,r2 - add $'0,r3 - movb r3,-(r0) - mov r2,r3 - sob r1,2b - mov $1,r0 - sys write; 1f; 7 - mov (sp)+,r3 - mov (sp)+,r2 - mov (sp)+,r1 - mov (sp)+,r0 - rts r5 - -1: - .even - -betwen: - cmp r0,(r5)+ - blt 1f - cmp (r5)+,r0 - blt 2f -1: - tst (r5)+ -2: - rts r5 - -putw: - tst ifflg - beq 1f - cmp r4,$'\n - bne 2f -1: - jsr pc,putc1 - swab r4 - jsr pc,putc1 - swab r4 -2: - rts pc - -putc: - tst ifflg - bne 1f -putc1: - movb r4,*obufp - inc obufp - cmp obufp,$outbuf+512. - blo 1f - mov $outbuf,obufp - movb pof,r0 - sys write; outbuf; 512. -1: - rts pc - -2 - add $'0,r3 - movb r3,-(r0) - mov r2,r3 - sob r1,2b - mov $1,r0 - sys write; 1f; 7 - mov (sp)+,r3 - mov (sp)+,r2 - mov (sp)+,r1 - mov (sp)+,r0 - rts r5 - -1: - .even - -betwen: - cmp r0,(r5)+ - blt 1f - cmp (r5)+,r0 - blt 2f -1: - t \ No newline at end of file diff --git a/cmd/a21.s b/cmd/a21.s deleted file mode 100644 index ff2c8271c3..0000000000 --- a/cmd/a21.s +++ /dev/null @@ -1,205 +0,0 @@ -/ a21 -- pdp-11 assembler pass 2 - -main: - sys intr; aexit - jmp start - -/ set up sizes and origins - -go: - jsr pc,getw - mov r4,txtsiz - mov r4,r1 - jsr pc,getw - mov r4,datsiz - mov r4,r2 - jsr pc,getw - mov r4,bsssiz - mov r1,r3 - mov r3,datbase / txtsiz - mov r3,savdot+2 - add r2,r3 - mov r3,bssbase / txtsiz+datsiz - mov r3,savdot+4 - asl r3 - add $20,r3 - mov r3,symseek / 2*txtsiz+2*datsiz+20 - sub r2,r3 - mov r3,drelseek / 2*txtsiz+datsiz - sub r1,r3 - mov r3,trelseek / txtsiz+datsiz+20 - sub r2,r3 - mov r3,datseek / txtsiz+20 - -/ read in symbol table itself - - mov $usymtab,r1 -1: - jsr pc,getw - bvs 1f - add $14,symsiz / count symbols - jsr pc,getw - jsr pc,getw - bic $!377,r4 - bne 2f - mov defund,r4 / (perhaps) globalize undef. -2: - mov r4,(r1)+ - jsr r5,doreloc - jsr pc,getw - add r3,r4 - mov r4,(r1)+ - jsr pc,setbrk - br 1b -1: - -/ read in f-b definitions - - mov r1,fbbufp - movb fbfil,fin - clr ibufc -1: - jsr pc,getw - bvs 1f - mov r4,(r1)+ - swab r4 - jsr r5,doreloc - jsr pc,getw - add r3,r4 - mov r4,(r1)+ - jsr pc,setbrk - br 1b -1: - mov $-1,(r1)+ - -/ set up input text file; initialize f-b table - - mov txtfil,fin - clr ibufc - clr r4 -1: - jsr pc,fbadv - tstb (r4)+ - cmp r4,$10. - blt 1b - -/ go - - clr r0 - jsr r5,oset; txtp - mov trelseek,r0 - jsr r5,oset; relp - mov $8.,r2 - mov $txtmagic,r1 -1: - mov (r1)+,r0 - jsr r5,putw; txtp - dec r2 - bne 1b - jsr pc,assem - -/polish off text and relocation - - jsr r5,flush; txtp - jsr r5,flush; relp - -/ append full symbol table - - mov symf,r0 - mov r0,fin - clr ibufc - sys seek; 6; 0 - mov symseek,r0 - jsr r5,oset; txtp - mov $usymtab,r1 -1: - jsr pc,getw - bvs 1f - jsr pc,convs - jsr pc,getw - jsr pc,convs - jsr pc,getw - mov r4,r0 - als $-10.,r0 - bic $!77,r0 - movb chartab(r0),r0 - jsr r5,putw; txtp - mov (r1)+,r0 - jsr r5,putw; txtp - jsr pc,getw - mov (r1)+,r0 - jsr r5,putw; txtp - br 1b -1: - jsr r5,flush; txtp - -aexit: - mov a.tmp1,0f - sys unlink; 0:.. - mov a.tmp2,0f - sys unlink; 0:.. - mov a.tmp3,0f - sys unlink; 0:.. - sys chmod; a.out; outmod: 37 - sys exit - -filerr: - mov *(r5),r5 -1: - movb (r5)+,ch - beq 1f - mov $1,r0 - sys write; ch; 1 - br 1b -1: - mov $1,r0 - sys write; qnl; 2 - br aexit - -doreloc: - clr r3 - bic $!37,r4 - cmp r4,$5 - bhis 1f - cmp r4,$3 - blo 1f - beq 2f - mov bssbase,r3 - br 1f -2: - mov datbase,r3 -1: - rts r5 - -setbrk: - mov r1,-(sp) - add $20,r1 - cmp r1,0f - blo 1f - add $512.,0f - sys break; 0: end -1: - mov (sp)+,r1 - rts pc - - - mov a.tmp1,0f - sys unlink; 0:.. - mov a.tmp2,0f - sys unlink; 0:.. - mov a.tmp3,0f - sys unlink; 0:.. - sys chmod; a.out; outmod: 37 - sys exit - -filerr: - mov *(r5),r5 -1: - movb (r5)+,ch - beq 1f - mov $1,r0 - sys write; ch; 1 - br 1b -1: - mov $1,r0 - sys write; \ No newline at end of file diff --git a/cmd/a3.s b/cmd/a3.s deleted file mode 100644 index 656277aaf0..0000000000 --- a/cmd/a3.s +++ /dev/null @@ -1,140 +0,0 @@ -/ a3 -- pdp-11 assembler pass 1 - -assem: - jsr pc,readop - jsr pc,checkeos - br ealoop - tst ifflg - beq 3f - cmp r4,$200 - blos assem - cmpb (r4),$21 /if - bne 2f - inc ifflg -2: - cmpb (r4),$22 /endif - bne assem - dec ifflg - br assem -3: - mov r4,-(sp) - jsr pc,readop - cmp r4,$'= - beq 4f - cmp r4,$': - beq 1f - mov r4,savop - mov (sp)+,r4 - jsr pc,opline -dotmax: - movb dotrel,r0 - asl r0 - cmp dot,txtsiz-4(r0) - blos ealoop - mov dot,txtsiz-4(r0) - br ealoop -1: - mov (sp)+,r4 - cmp r4,$200 - bhis 1f - cmp r4,$1 - beq 3f - jsr r5,error; 'x - br assem -1: - bitb $37,(r4) - beq 1f - jsr r5,error; 'm -1: - bisb dot-2,(r4) - mov dot,2(r4) - br assem -3: - mov numval,r0 - jsr pc,fbcheck - movb dotrel,curfbr(r0) - asl r0 - movb dotrel,nxtfb+1 - mov dot,nxtfb+2 - movb r0,nxtfb - mov dot,curfb(r0) - movb fbfil,r0 - sys write; nxtfb; 4 - br assem -4: - jsr pc,readop - jsr pc,expres - mov (sp)+,r1 - cmp r1,$200 - bhis 1f - jsr r5,error; 'x - br ealoop -1: - cmp r1,$dotrel - bne 2f - bic $40,r3 - cmp r3,dotrel - bne 1f -2: - bicb $37,(r1) - bic $!37,r3 - bne 2f - clr r2 -2: - bisb r3,(r1) - mov r2,2(r1) - br dotmax -1: - jsr r5,error; '. - movb $2,dotrel -ealoop: - cmp r4,$'; - beq assem1 - cmp r4,$'\n - bne 1f - inc line - br assem1 -1: - cmp r4,$'\e - bne 2f - tst ifflg - beq 1f - jsr r5,error; 'x -1: - rts pc -2: - jsr r5,error; 'x -2: - jsr pc,checkeos - br assem1 - jsr pc,readop - br 2b -assem1: - jmp assem - -fbcheck: - cmp r0,$9. - bhi 1f - rts pc -1: - jsr r5,error; 'f - clr r0 - rts pc - -checkeos: - cmp r4,$'\n - beq 1f - cmp r4,$'; - beq 1f - cmp r4,$'\e - beq 1f - add $2,(sp) -1: - rts pc - -,r3 - bne 2f - clr r2 -2: - bisb r3,(r1) - \ No newline at end of file diff --git a/cmd/a4.s b/cmd/a4.s deleted file mode 100644 index 48a309759e..0000000000 --- a/cmd/a4.s +++ /dev/null @@ -1,234 +0,0 @@ -/ a4 -- pdp-11 assembler pass1 - -rname: - mov r1,-(sp) - mov r2,-(sp) - mov r3,-(sp) - mov $2,r5 - mov $symbol,r2 - clr -(sp) -1: - jsr pc,rnch - mov r3,r1 - mpy $40.,r1 - jsr pc,rnch - add r3,r1 - mpy $40.,r1 - jsr pc,rnch - add r1,r3 - add r3,(sp) - mov r3,(r2)+ - sob r5,1b - jsr pc,rnch - mov r3,r1 - add r3,(sp) - als $10.,r1 - mov r1,(r2) -1: - jsr pc,rnch - tst r3 - bne 1b - mov (sp)+,r1 - clr r0 - dvd $hshsiz,r0 - mov r1,r0 - asl r0 - add $hshtab,r0 -1: - cmp r0,$hshtab - bhi 2f - mov $2*hshsiz+hshtab,r0 -2: - mov $symbol,r2 - mov -(r0),r4 - beq 3f - cmp (r2)+,(r4)+ - bne 1b - cmp (r2)+,(r4)+ - bne 1b - cmpb 1(r4),1(r2) - bne 1b - br 1f -3: - mov symend,r4 - mov r4,(r0) - mov r4,-(sp) - add $20,r4 - cmp r4,0f - blos 4f - add $512.,0f - sys break; 0:end -4: - mov (sp)+,r4 - mov (r2)+,(r4)+ - mov (r2)+,(r4)+ - mov (r2)+,(r4)+ - clr (r4)+ - mov r4,symend - sub $4,r4 -1: - mov r4,-(sp) - sub $symtab-374,r4 - asr r4 - jsr pc,putw - mov (sp)+,r4 - mov (sp)+,r3 - mov (sp)+,r2 - tst (sp)+ - mov (sp)+,r1 - rts pc - -rnch: - jsr pc,rch - movb chartab(r0),r3 - ble 1f - rts pc -1: - movb r0,ch - clr r3 - rts pc - -number: - mov r2,-(sp) - mov r3,-(sp) - mov r5,-(sp) - clr r1 - clr r5 -1: - jsr pc,rch - jsr r5,betwen; '0; '9 - br 1f - sub $'0,r0 - mpy $10.,r5 - add r0,r5 - als $3,r1 - add r0,r1 - br 1b -1: - cmp r0,$'b - beq 1f - cmp r0,$'f - beq 1f - cmp r0,$'. - bne 2f - mov r5,r1 - clr r0 -2: - movb r0,ch - mov r1,r0 - mov (sp)+,r5 - mov (sp)+,r3 - mov (sp)+,r2 - rts pc -1: - mov r0,r3 - mov r5,r0 - jsr pc,fbcheck - add $141,r0 - cmp r3,$'b - beq 1f - add $10.,r0 -1: - mov r0,r4 - mov (sp)+,r5 - mov (sp)+,r3 - mov (sp)+,r2 - add $2,(sp) - rts pc - -rch: - movb ch,r0 - beq 1f - clrb ch - rts pc -1: - dec inbfcnt - blt 2f - movb *inbfp,r0 - inc inbfp - bic $!177,r0 - beq 1b - rts pc -2: - movb fin,r0 - beq 3f - sys read; inbuf;512. - bcs 2f - tst r0 - beq 2f - mov r0,inbfcnt - mov $inbuf,inbfp - br 1b -2: - movb fin,r0 - clrb fin - sys close -3: - decb nargs - bgt 2f - mov $'\e,r0 - rts pc -2: - tst ifflg - beq 2f - jsr r5,error; 'i - jmp aexit -2: - mov curarg,r0 - tst (r0)+ - mov (r0),0f - mov r0,curarg - incb fileflg - sys open; 0:0; 0 - bec 2f - mov 0b,0f - jsr r5,filerr; 0:0; - jmp aexit -2: - movb r0,fin - mov $1,line - mov r4,-(sp) - mov r1,-(sp) - mov $5,r4 - jsr pc,putw - mov *curarg,r1 -2: - movb (r1)+,r4 - beq 2f - jsr pc,putw - br 2b -2: - mov $-1,r4 - jsr pc,putw - mov (sp)+,r1 - mov (sp)+,r4 - br 1b - - - mov $inbuf,inbfp - br 1b -2: - movb fin,r0 - clrb fin - sys close -3: - decb nargs - bgt 2f - mov $'\e,r0 - rts pc -2: - tst ifflg - beq 2f - jsr r5,error; 'i - jmp aexit -2: - mov curarg,r0 - tst (r0)+ - mov (r0),0f - mov r0,curarg - incb fileflg - sys open; 0:0; 0 - bec 2f - mov 0b,0f - jsr r5,filerr; 0:0; - jmp aexi \ No newline at end of file diff --git a/cmd/a5.s b/cmd/a5.s deleted file mode 100644 index f286c92934..0000000000 --- a/cmd/a5.s +++ /dev/null @@ -1,216 +0,0 @@ -/ a5 -- pdp-11 assembler pass 1 - -readop: - mov savop,r4 - beq 1f - clr savop - rts pc -1: - jsr pc,8f - jsr pc,putw - rts pc - -8: - jsr pc,rch - mov r0,r4 - movb chartab(r0),r1 - bgt rdname - jmp *1f-2(r1) - - fixor - escp - 8b - retread - dquote - garb - squote - rdname - skip - rdnum - retread - string -1: - -escp: - jsr pc,rch - mov $esctab,r1 -1: - cmpb r0,(r1)+ - beq 1f - tstb (r1)+ - bne 1b - rts pc -1: - movb (r1),r4 - rts pc - -esctab: - .byte '/, '/ - .byte '\<, 035 - .byte '>, 036 - .byte '%, 037 - .byte 0, 0 - -fixor: - mov $037,r4 -retread: - rts pc - -rdname: - movb r0,ch - cmp r1,$26. - ble 1f - cmp r1,$37. - blt rdnum -1: - jmp rname - -rdnum: - jsr pc,number - br 1f - rts pc - -squote: - jsr pc,rsch - br 1f -dquote: - jsr pc,rsch - mov r0,-(sp) - jsr pc,rsch - swab r0 - bis (sp)+,r0 -1: - mov r0,numval - mov $1,r4 - jsr pc,putw - mov numval,r4 - jsr pc,putw - mov $1,r4 - tst (sp)+ - rts pc - -skip: - jsr pc,rch - mov r0,r4 - cmp r0,$'\e - beq 1f - cmp r0,$'\n - bne skip -1: - rts pc - -garb: - jsr r5,error; 'g - br 8b - -string: - mov $'<,r4 - jsr pc,putw - clr numval -1: - jsr pc,rsch - tst r1 - bne 1f - mov r0,r4 - bis $400,r4 - jsr pc,putw - inc numval - br 1b -1: - mov $-1,r4 - jsr pc,putw - mov $'<,r4 - tst (sp)+ - rts pc - -rsch: - jsr pc,rch - cmp r0,$'\e - beq 4f - cmp r0,$'\n - beq 4f - clr r1 - cmp r0,$'\\ - bne 3f - jsr pc,rch - mov $schar,r2 -1: - cmpb (r2)+,r0 - beq 2f - tstb (r2)+ - bpl 1b - rts pc -2: - movb (r2)+,r0 - clr r1 - rts pc -3: - cmp r0,$'> - bne 1f - inc r1 -1: - rts pc -4: - jsr r5,error; '< - jmp aexit - -schar: - .byte 'n, 012 - .byte 't, 011 - .byte 'e, 004 - .byte '0, 000 - .byte 'r, 015 - .byte 'a, 006 - .byte 'p, 033 - .byte 0, -1 - - bis $400,r4 - jsr pc,putw - inc numval - br 1b -1: - mov $-1,r4 - jsr pc,putw - mov $'<,r4 - tst (sp)+ - rts pc - -rsch: - jsr pc,rch - cmp r0,$'\e - beq 4f - cmp r0,$'\n - beq 4f - clr r1 - cmp r0,$'\\ - bne 3f - jsr pc,rch - mov $schar,r2 -1: - cmpb (r2)+,r0 - beq 2f - tstb (r2)+ - bpl 1b - rts pc -2: - movb (r2)+,r0 - clr r1 - rts pc -3: - cmp r0,$'> - bne 1f - inc r1 -1: - rts pc -4: - jsr r5,error; '< - jmp aexit - -schar: - .byte 'n, 012 - .byte 't, 011 - .byte 'e, 004 - .byte '0, 000 - .byte 'r, 015 - .byte 'a, 006 - .byte 'p, 033 \ No newline at end of file diff --git a/cmd/a6.s b/cmd/a6.s deleted file mode 100644 index ccffdd6c29..0000000000 --- a/cmd/a6.s +++ /dev/null @@ -1,309 +0,0 @@ -/ a6 -- pdp-11 assembler pass 1 - -opline: - mov r4,r0 - jsr r5,betwen; 0; 200 - br 1f - cmp r0,$'< - bne xpr - jmp opl17 -xpr: - jsr pc,expres - add $2,dot - rts pc -1: - movb (r4),r0 - cmp r0,$24 - beq xpr - jsr r5,betwen; 5; 32 - br xpr - mov r0,-(sp) - jsr pc,readop - mov (sp)+,r0 - asl r0 - jmp *1f-12(r0) - -1: - opl13 / map fop freg,fdst to double - opl6 - opl7 - opl10 - opl11 - opl13 / map fld/fst to double - opl13 - opl13 / map fop fsrc,freg to double - opl15 - opl16 - opl17 - opl20 - opl21 - opl22 - opl23 - xpr - opl25 - opl26 - opl27 - opl13 / map mul s,r to double - opl31 - opl32 - -/double -opl13: -opl7: - jsr pc,addres -op2: - cmp r4,$', - beq 1f - jsr pc,errora - rts pc -1: - jsr pc,readop -opl15: / single operand - jsr pc,addres - add $2,dot - rts pc - -opl31: / sob - jsr pc,expres - cmp r4,$', - beq 1f - jsr pc,errora -1: - jsr pc,readop - -/branch -opl6: -opl10: -opl11: - jsr pc,expres - add $2,dot - rts pc - -/ .byte -opl16: - jsr pc,expres - inc dot - cmp r4,$', - bne 1f - jsr pc,readop - br opl16 -1: - rts pc - -/ < (.ascii) -opl17: - add numval,dot - jsr pc,readop - rts pc - -/.even -opl20: - inc dot - bic $1,dot - rts pc - -/.if -opl21: - jsr pc,expres - tst r3 - bne 1f - jsr r5,error; 'U -1: - tst r2 - bne opl22 - inc ifflg -opl22: /endif - rts pc - -/.globl -opl23: - cmp r4,$200 - blo 1f - bisb $40,(r4) - jsr pc,readop - cmp r4,$', - bne 1f - jsr pc,readop - br opl23 -1: - rts pc - -opl25: -opl26: -opl27: - mov dotrel,r1 - asl r1 - mov dot,savdot-4(r1) - mov savdot-52(r0),dot - asr r0 - sub $25-2,r0 - mov r0,dotrel - rts pc - -/ .common -opl32: - cmp r4,$200 - blo 1f - bis $40,(r4) - jsr pc,readop - cmp r4,$', - bne 1f - jsr pc,readop - jsr pc,expres - rts pc -1: - jsr r5,error; 'x - rts pc - -addres: - cmp r4,$'( - beq alp - cmp r4,$'- - beq amin - cmp r4,$'$ - beq adoll - cmp r4,$'* - beq astar -getx: - jsr pc,expres - cmp r4,$'( - bne 2f - jsr pc,readop - jsr pc,expres - jsr pc,checkreg - jsr pc,checkrp - add $2,dot - clr r0 - rts pc -2: - cmp r3,$24 / register type - bne 1f - jsr pc,checkreg - clr r0 - rts pc -1: - add $2,dot - clr r0 - rts pc - -alp: - jsr pc,readop - jsr pc,expres - jsr pc,checkrp - jsr pc,checkreg - cmp r4,$'+ - bne 1f - jsr pc,readop - clr r0 - rts pc -1: - mov $2,r0 - rts pc - -amin: - jsr pc,readop - cmp r4,$'( - beq 1f - mov r4,savop - mov $'-,r4 - br getx -1: - jsr pc,readop - jsr pc,expres - jsr pc,checkrp - jsr pc,checkreg - clr r0 - rts pc - -adoll: - jsr pc,readop - jsr pc,expres - add $2,dot - clr r0 - rts pc - -astar: - jsr pc,readop - cmp r0,$'* - beq 1f - jsr pc,addres - add r0,dot - rts pc -2: - jsr r5,error; '* - rts pc - -errora: - jsr r5,error; 'a - rts pc - -checkreg: - cmp r2,$7 - bhi 1f - cmp r3,$1 - beq 2f - cmp r3,$4 - bhi 2f -1: - jsr pc,errora -2: - rts pc - -errore: - jsr r5,error; 'e - rts pc - -checkrp: - cmp r4,$') - beq 1f - jsr r5,error; ') - rts pc -1: - jsr pc,readop - rts pc - -r getx -1: - jsr pc,readop - jsr pc,expres - jsr pc,checkrp - jsr pc,checkreg - clr r0 - rts pc - -adoll: - jsr pc,readop - jsr pc,expres - add $2,dot - clr r0 - rts pc - -astar: - jsr pc,readop - cmp r0,$'* - beq 1f - jsr pc,addres - add r0,dot - rts pc -2: - jsr r5,error; '* - rts pc - -errora: - jsr r5,error; 'a - rts pc - -checkreg: - cmp r2,$7 - bhi 1f - cmp r3,$1 - beq 2f - cmp r3,$4 - bhi 2f -1: - jsr pc,errora -2: - rts pc - -errore: - jsr r5,error; 'e \ No newline at end of file diff --git a/cmd/a7.s b/cmd/a7.s deleted file mode 100644 index 6a5a02a5eb..0000000000 --- a/cmd/a7.s +++ /dev/null @@ -1,255 +0,0 @@ -/ a7 -- pdp-11 assembler pass 1 - -expres: - mov r5,-(sp) - mov $'+,-(sp) - clr opfound - clr r2 - mov $1,r3 - br 1f -advanc: - jsr pc,readop -1: - mov r4,r0 - jsr r5,betwen; 0; 177 - br .+4 - br 7f - movb (r4),r0 - mov 2(r4),r1 - br oprand -7: - cmp r4,$141 - blo 1f - cmp r4,$141+10. - bhis 2f - movb curfbr-141(r4),r0 - asl r4 - mov curfb-[2*141](r4),r2 - bpl oprand - jsr r5,error; 'f - br oprand -2: - clr r3 - clr r2 - br oprand -1: - mov $esw1,r1 -1: - cmp (r1)+,r4 - beq 1f - tst (r1)+ - bne 1b - tst opfound - bne 2f - jsr pc,errore -2: - tst (sp)+ - mov (sp)+,r5 - rts pc -1: - jmp *(r1) - -esw1: - '+; binop - '-; binop - '*; binop - '/; binop - '&; binop - 037; binop - 035; binop - 036; binop - '%; binop - '[; brack - '^; binop - 1; exnum - '!; binop - 0; 0 - -binop: - cmpb (sp),$'+ - beq 1f - jsr pc,errore -1: - movb r4,(sp) - br advanc - -exnum: - mov numval,r1 - mov $1,r0 - br oprand - -brack: - mov r2,-(sp) - mov r3,-(sp) - jsr pc,readop - jsr pc,expres - cmp r4,$'] - beq 1f - jsr r5,error; '] -1: - mov r3,r0 - mov r2,r1 - mov (sp)+,r3 - mov (sp)+,r2 - -oprand: - inc opfound - mov $exsw2,r5 -1: - cmp (sp),(r5)+ - beq 1f - tst (r5)+ - bne 1b - br eoprnd -1: - jmp *(r5) - -exsw2: - '+; exadd - '-; exsub - '*; exmul - '/; exdiv - 037; exor - '&; exand - 035;exlsh - 036;exrsh - '%; exmod - '!; exnot - '^; excmbin - 0; 0 - -excmbin: - mov r0,r3 / give left flag of right - br eoprnd - -exrsh: - neg r1 - beq exlsh - inc r1 - clc - ror r2 -exlsh: - jsr r5,combin; 0 - als r1,r2 - br eoprnd - -exmod: - jsr r5,combin; 0 - mov r1,-(sp) - mov r2,r1 - clr r0 - dvd (sp)+,r0 - mov r1,r2 - br eoprnd - -exadd: - jsr r5,combin; 0 - add r1,r2 - br eoprnd - -exsub: - jsr r5,combin; 1 - sub r1,r2 - br eoprnd - -exand: - jsr r5,combin; 0 - com r1 - bic r1,r2 - br eoprnd - -exor: - jsr r5,combin; 0 - bis r1,r2 - br eoprnd - -exmul: - jsr r5,combin; 0 - mpy r2,r1 - mov r1,r2 - br eoprnd - -exdiv: - jsr r5,combin; 0 - mov r1,-(sp) - mov r2,r1 - clr r0 - dvd (sp)+,r0 - mov r0,r2 - br eoprnd - -exnot: - jsr r5,combin; 0 - com r1 - add r1,r2 - br eoprnd - -eoprnd: - mov $'+,(sp) - jmp advanc - -combin: - mov r0,-(sp) - bis r3,(sp) - bic $!40,(sp) - bic $!37,r0 - bic $!37,r3 - cmp r0,r3 - ble 1f - mov r0,-(sp) - mov r3,r0 - mov (sp)+,r3 -1: - tst r0 - beq 1f - tst (r5)+ - beq 2f - cmp r0,r3 - bne 2f - mov $1,r3 - br 2f -1: - tst (r5)+ - clr r3 -2: - bis (sp)+,r3 - rts r5 - -r eoprnd - -exmul: - jsr r5,combin; 0 - mpy r2,r1 - mov r1,r2 - br eoprnd - -exdiv: - jsr r5,combin; 0 - mov r1,-(sp) - mov r2,r1 - clr r0 - dvd (sp)+,r0 - mov r0,r2 - br eoprnd - -exnot: - jsr r5,combin; 0 - com r1 - add r1,r2 - br eoprnd - -eoprnd: - mov $'+,(sp) - jmp advanc - -combin: - mov r0,-(sp) - bis r3,(sp) - bic $!40,(sp) - bic $!37,r0 - bic $!37,r3 - cmp r0,r3 - ble 1f - mov r0,-(sp) - mov r3,r0 - m \ No newline at end of file diff --git a/cmd/a8.s b/cmd/a8.s deleted file mode 100644 index 47f682e78e..0000000000 --- a/cmd/a8.s +++ /dev/null @@ -1,81 +0,0 @@ -/ a8 -- pdp-11 assembler pass 1 - -chartab: - .byte -14,-14,-14,-14,-02,-14,-14,-14 - .byte -14,-22, -2,-14,-14,-22,-14,-14 - .byte -14,-14,-14,-14,-14,-14,-14,-14 - .byte -14,-14,-14,-14,-14,-14,-14,-14 - .byte -22,-20,-16,-14,-20,-20,-20,-12 - .byte -20,-20,-20,-20,-20,-20,38.,-06 - .byte 27.,28.,29.,30.,31.,32.,33.,34. - .byte 35.,36.,-20,-02,-00,-20,-14,-14 - .byte -14,01.,02.,03.,04.,05.,06.,07. - .byte 08.,09.,10.,11.,12.,13.,14.,15. - .byte 16.,17.,18.,19.,20.,21.,22.,23. - .byte 24.,25.,26.,-20,-24,-20,-20,37. - .byte -14,01.,02.,03.,04.,05.,06.,07. - .byte 08.,09.,10.,11.,12.,13.,14.,15. - .byte 16.,17.,18.,19.,20.,21.,22.,23. - .byte 24.,25.,26.,-14,-26,-14,-14,-14 - -errflg: .byte 0 -namedone: .byte 0 -ch: .byte 0 -a.tmp1: -a.tmp2: -a.tmp3: -qi: -.even - -curfb: - -1;-1;-1;-1;-1;-1;-1;-1;-1;-1 -obufp: outbuf -symend: usymtab -txtsiz: .=.+2 -datsiz: .=.+2 -bsssiz: .=.+2 -curfbr: .=.+10. -savdot: .=.+6 -bufcnt: .=.+2 -hshsiz = 1000. -hshtab: .=2*hshsiz+. -pof: .=.+1 -wordf: .=.+1 -fin: .=.+1 -fbfil: .=.+1 -fileflg: .=.+1 -.even -symbol: .=.+6 -inbuf: .=.+512. -obufc: .=.+2 -outbuf: .=.+512. -line: .=.+2 -inbfcnt: .=.+2 -ifflg: .=.+2 -inbfp: .=.+2 -nargs: .=.+2 -curarg: .=.+2 -opfound: .=.+2 -savop: .=.+2 -numval: .=.+2 -nxtfb: .=.+4 -2: -a.tmp3: -qi: -.even - -curfb: - -1;-1;-1;-1;-1;-1;-1;-1;-1;-1 -obufp: outbuf -symend: usymtab -txtsiz: .=.+2 -datsiz: .=.+2 -bsssiz: .=.+2 -curfbr: .=.+10. -savdot: .=.+6 -bufcnt: .=.+2 -hshsiz = 1000. -hshtab: .=2*hshsiz+. -pof: .=.+1 -wordf: .=.+1 -fin: .=.+1 diff --git a/cmd/a9.s b/cmd/a9.s deleted file mode 100644 index e79ea4b9c2..0000000000 --- a/cmd/a9.s +++ /dev/null @@ -1,364 +0,0 @@ -/ a9 -- pdp-11 assembler pass 1 - -eae = 0 - -/ key to types - -/ 0 undefined -/ 1 absolute -/ 2 text -/ 3 data -/ 4 bss -/ 5 flop freg,dst (movfo, = stcfd) -/ 6 branch -/ 7 jsr -/ 10 rts -/ 11 sys -/ 12 movf (=ldf,stf) -/ 13 double operand (mov) -/ 14 flop fsrc,freg (addf) -/ 15 single operand (clr) -/ 16 .byte -/ 17 string (.ascii, "<") -/ 20 .even -/ 21 .if -/ 22 .endif -/ 23 .globl -/ 24 register -/ 25 .text -/ 26 .data -/ 27 .bss -/ 30 mul,div, etc -/ 31 sob -/ 32 .comm - -symtab: - -/ special variables - -166600; 000000; dotrel: 02; dot:000000 /. -171560; 000000; 01; dotdot:000000 /.. - -/ register - -072270;000000;24;000000 /r0 -072340;000000;24;000001 /r1 -072410;000000;24;000002 /r2 -072460;000000;24;000003 /r3 -072530;000000;24;000004 /r4 -072600;000000;24;000005 /r5 -074500;000000;24;000006 /sp -062170;000000;24;000007 /pc - -.if eae - -/eae & switches - -012717;000000;01;177570 /csw -015176;000000;01;177300 /div -003270;000000;01;177302 /ac -051750;000000;01;177304 /mq -052224;000000;01;177306 /mul -073470;000000;01;177310 /sc -074620;000000;01;177311 /sr -054752;000000;01;177312 /nor -047000;000000;01;177314 /lsh -004500;000000;01;177316 /ash - -.endif - -/ system calls - -021411;076400;01;0000001 /exit -023752;042300;01;0000002 /fork -070511;014400;01;0000003 /read -111231;076710;01;0000004 /write -060105;053600;01;0000005 /open -012257;073610;01;0000006 /close -107761;076400;01;0000007 /wait -012625;004540;01;0000010 /creat -046166;042300;01;0000011 /link -102574;035173;01;0000012 /unlink -021405;011300;01;0000013 /exec -012004;035420;01;0000014 /chdir -077165;017500;01;0000015 /time -050563;015172;01;0000016 /makdir -012015;057140;01;0000017 /chmod -012017;110760;01;0000020 /chown -007525;003770;01;0000021 /break -074741;076400;01;0000022 /stat -073615;042300;01;0000023 /seek -076724;045400;01;0000024 /tell -051655;055240;01;0000025 /mount -102527;102604;01;0000026 /umount -073634;102254;01;0000027 /setuid -026234;102254;01;0000030 /getuid -074751;051010;01;0000031 /stime -066621;076400;01;0000032 /quit -035204;070200;01;0000033 /intr -024214;004540;01;0000034 /fstat -011625;076400;01;0000035 /cemt -050741;076710;01;0000036 /mdate -074764;116100;01;0000037 /stty -027364;116100;01;0000040 /gtty -035047;035203;01;0000041 /ilgins -054353;017500;01;0000042 /nice - -/ double operand - -051656;000000;13;0010000 /mov -051656;006200;13;0110000 /movb -012330;000000;13;0020000 /cmp -012330;006200;13;0120000 /cmpb -006774;000000;13;0030000 /bit -006774;006200;13;0130000 /bitb -006753;000000;13;0040000 /bic -006753;006200;13;0140000 /bicb -006773;000000;13;0050000 /bis -006773;006200;13;0150000 /bisb -003344;000000;13;0060000 /add -075012;000000;13;0160000 /sub - -/ branch - -007520;000000;06;0000400 /br -007265;000000;06;0001000 /bne -006531;000000;06;0001400 /beq -006635;000000;06;0002000 /bge -007164;000000;06;0002400 /blt -006654;000000;06;0003000 /bgt -007145;000000;06;0003400 /ble -007414;000000;06;0100000 /bpl -007221;000000;06;0100400 /bmi -006711;000000;06;0101000 /bhi -007157;073300;06;0101400 /blos -007763;000000;06;0102000 /bvc -010003;000000;06;0102400 /bvs -006711;073300;06;0103000 /bhis -006513;000000;06;0103000 /bec -006373;000000;06;0103000 /bcc -007157;000000;06;0103400 /blo -006413;000000;06;0103400 /bcs -006533;000000;06;0103400 /bes - -/ single operand - -012262;000000;15;0005000 /clr -012262;006200;15;0105000 /clrb -012445;000000;15;0005100 /com -012445;006200;15;0105100 /comb -035163;000000;15;0005200 /inc -035163;006200;15;0105200 /incb -014713;000000;15;0005300 /dec -014713;006200;15;0105300 /decb -054117;000000;15;0005400 /neg -054117;006200;15;0105400 /negb -003343;000000;15;0005500 /adc -003343;006200;15;0105500 /adcb -073423;000000;15;0005600 /sbc -073423;006200;15;0105600 /sbcb -100014;000000;15;0005700 /tst -100014;006200;15;0105700 /tstb -071352;000000;15;0006000 /ror -071352;006200;15;0106000 /rorb -071344;000000;15;0006100 /rol -071344;006200;15;0106100 /rolb -004512;000000;15;0006200 /asr -004512;006200;15;0106200 /asrb -004504;000000;15;0006300 /asl -004504;006200;15;0106300 /aslb -040230;000000;15;0000100 /jmp -075131;006200;15;0000300 /swab - -/ jsr - -040612;000000;07;0004000 /jsr - -/ rts - -071663;000000;010;000200 /rts - -/ simple operand - -075273;000000;011;104400 /sys - -/ flag-setting - -012243;000000;01;0000241 /clc -012266;000000;01;0000242 /clv -012272;000000;01;0000244 /clz -012256;000000;01;0000250 /cln -073613;000000;01;0000261 /sec -073636;000000;01;0000262 /sev -073642;000000;01;0000264 /sez -073626;000000;01;0000270 /sen - -/ floating point ops - -011663;011300;01;170000 / cfcc -073634;022600;01;170001 / setf -073634;014400;01;170011 / setd -073634;034100;01;170002 / seti -073634;045400;01;170012 / setl -012262;022600;15;170400 / clrf -054117;022600;15;170700 / negf -003243;022600;15;170600 / absf -100014;022600;15;170500 / tstf -051656;022600;12;172400 / movf -051656;034460;14;177000 / movif -051656;023350;05;175400 / movfi -051656;057260;14;177400 / movof -051656;023730;05;176000 / movfo -003344;022600;14;172000 / addf -075012;022600;14;173000 / subf -052224;022600;14;171000 / mulf -015176;022600;14;174400 / divf -012330;022600;14;173400 / cmpf -051634;022600;14;171400 / modf -024153;000000;24;000000 / fr0 -024154;000000;24;000001 / fr1 -024155;000000;24;000002 / fr2 -024156;000000;24;000003 / fr3 -024157;000000;24;000004 / fr4 -024160;000000;24;000005 / fr5 -/ 11/45 operations - -004063;000000;30;072000 /als (ash) -004063;011300;30;073000 /alsc (ashc) -051731;000000;30;070000 /mpy -.if eae-1 -052224;000000;30;070000 /mul (=mpy) -015176;000000;30;071000 / div (=dvd) -004500;000000;30;072000 / ash (=als) -004500;011300;30;073000 / ashc -.endif -016164;000000;30;071000 /dvd -114152;000000;07;074000 /xor -075224;000000;15;006700 /sxt -050572;042300;11;006400 /mark -074432;000000;31;077000 /sob - -/ specials - -166751;076710;16;000000 /.byte -167136;020560;20;000000 /.even -167356;000000;21;000000 /.if -167126;015156;22;000000 /.endif -167244;057034;23;000000 /.globl -170245;114440;25;000000 /.text -167041;076450;26;000000 /.data -166743;073300;27;000000 /.bss -167007;051510;32;000000 /.comm - -usymtab: -0;0;0;0 - -start: - sys intr; aexit - mov sp,r5 - mov (r5)+,r0 - cmpb *2(r5),$'- - bne 1f - tst (r5)+ - dec r0 - br 2f -1: - clr unglob -2: - movb r0,nargs - mov r5,curarg - jsr r5,fcreat; a.tmp1 - movb r0,pof - jsr r5,fcreat; a.tmp2 - movb r0,fbfil - jsr pc,setup - mov $1,r0 - sys write; qi; 2 - jmp go - -setup: - mov $symtab,r1 -1: - mov $symbol,r0 - mov (r1)+,(r0)+ - beq 3f - mov (r1)+,(r0)+ - mov (r1)+,r2 - bic $37,r2 - mov r2,(r0)+ - mov r1,-(sp) - jsr pc,slot - mov (sp)+,r1 - mov r1,(r0) - sub $6,(r0) - tst (r1)+ - br 1b -3: - rts pc - -slot: - mov symbol,r1 - add symbol+2,r1 - add symbol+4,r1 - clr r0 - dvd $hshsiz,r0 - asl r1 - add $hshtab,r1 -1: - cmp r1,$hshtab - bhi 2f - mov $2*hshsiz+hshtab,r1 -2: - mov -(r1),r2 - beq 3f - mov $symbol,r3 - cmp (r2)+,(r3)+ - bne 1b - cmp (r2)+,(r3)+ - bne 1b - mov (r2)+,r0 - bic $37,r0 - cmp r0,(r3)+ - bne 1b -3: - mov r1,r0 - rts pc - -end: - -symbol,r0 - mov (r1)+,(r0)+ - beq 3f - mov (r1)+,(r0)+ - mov (r1)+,r2 - bic $37,r2 - mov r2,(r0)+ - mov r1,-(sp) - jsr pc,slot - mov (sp)+,r1 - mov r1,(r0) - sub $6,(r0) - tst (r1)+ - br 1b -3: - rts pc - -slot: - mov symbol,r1 - add symbol+2,r1 - add symbol+4,r1 - clr r0 - dvd $hshsiz,r0 - asl r1 - add $hshtab,r1 -1: - cmp r1,$hshtab - bhi 2f - mov $2*hshsiz+hshtab,r1 -2: - mov -(r1),r2 - beq 3f - mov $symbol,r3 - cmp (r2)+,(r3)+ - bne 1b - cmp (r \ No newline at end of file diff --git a/cmd/acct.s b/cmd/acct.s deleted file mode 100644 index 8e6f1e3551..0000000000 --- a/cmd/acct.s +++ /dev/null @@ -1,424 +0,0 @@ -/ acct -- time accounting - -.globl mesg, qsort, fopen, getw - - mov (sp)+,r5 - tst (sp)+ - -1: - cmp r5,$2 - blt 1f - mov (sp),r0 - cmpb (r0),$'- - bne 1f - cmpb 1(r0),$'d - bne 2f - inc byday - dec r5 - tst (sp)+ - br 1b -2: - cmpb 1(r0),$'p - bne 2f - inc pflg - dec r5 - tst (sp)+ - br 1b -2: - cmpb 1(r0),$'w - bne 1f - dec r5 - tst (sp)+ - cmp r5,$2 - blt 1b - dec r5 - mov (sp)+,filnam - br 1b - -1: - dec r5 - mov r5,argc - mov sp,argp - mov filnam,r0 - jsr r5,fopen; fbuf - bec 1f - jsr r5,mesg - ; .even - sys exit - -1: - setd - -1: - mov $ibuf,r1 -2: - jsr r5,getw; fbuf - bes 1f - mov r0,(r1)+ - cmp r1,$ibuf+16. - blo 2b - jsr pc,loop - br 1b -1: - sys time - mov r0,i.time - mov r1,i.time+2 - clr ibuf - mov $'x,i.tty - jsr pc,loop - jsr pc,print - sys exit - -loop: - clc - ror i.time - ror i.time+2 - setl - movif i.time,fr0 - tst byday - beq 1f - cmpf midnight,fr0 - cfcc - bgt 1f - movf fr0,-(sp) - movf midnight,fr0 - jsr pc,upall - jsr pc,print - jsr pc,clru - movf (sp)+,fr0 - jsr pc,newday -1: - movb i.tty,r0 - mov $ttyf,r1 - cmp r0,$'x - bne 1f - jsr pc,upall - jsr pc,clrt - rts pc -1: - cmp r0,(r1) - beq 1f - add $18.,r1 - cmp r1,$et - blo 1b - br 2f -1: - jsr pc,update - clr (r1) -2: - cmp ibuf,$"\0\0 - bne 1f - rts pc -1: - mov $ttyf,r1 -1: - tst (r1) - beq 1f - add $18.,r1 - br 1b -1: - mov r0,(r1)+ - mov ibuf,(r1)+ - mov ibuf+2,(r1)+ - mov ibuf+4,(r1)+ - mov ibuf+6,(r1)+ - movf fr0,(r1)+ - rts pc - -clrt: - mov $ttyf,r1 -1: - clr (r1)+ - cmp r1,$et - blo 1b - rts pc - -clru: - mov $usrf,r1 -1: - clr (r1)+ - cmp r1,$eu - blo 1b - rts pc - -print: - jsr pc,upall - mov $usrf,r1 - mov r1,r2 - mov $16.,r3 -1: - tst (r2) - beq 1f - add r3,r2 - br 1b -1: - jsr pc,qsort - clrf fr0 - jsr r5,select; 1f - tstf fr0 - cfcc - beq 3f - jsr pc,pdate - mov $total,r2 - jsr pc,ptime - tst pflg - beq 3f - jsr r5,select; 2f -3: - rts pc - -1: - addf 8(r2),fr0 - rts pc - -2: - movf 8(r2),fr0 - jsr pc,pblank - jsr pc,ptime - rts pc - -pdate: - tst byday - bne 1f - rts pc -1: - mov r2,-(sp) - movf fr0,-(sp) - movf midnight,fr0 - divf day,fr0 - seti - movfi fr0,r0 - mov $montab,r1 -1: - sub (r1)+,r0 - bgt 1b - add -(r1),r0 - cmp r1,$montab+24. - blt 1f - sub $24.,r1 -1: - sub $montab,r1 - mov r1,-(sp) - asr r1 - add (sp)+,r1 - add $monasc,r1 - mov $obuf,r2 - movb (r1)+,(r2)+ - movb (r1)+,(r2)+ - movb (r1)+,(r2)+ - movb $' ,(r2)+ - mov r0,r1 - clr r0 - dvd $10.,r0 - tst r0 - beq 1f - add $'0,r0 - movb r0,(r2)+ -1: - add $'0,r1 - movb r1,(r2)+ - movb $'\t,(r2)+ - sub $obuf,r2 - mov r2,0f - mov $1,r0 - sys write; obuf; 0:.. - movf (sp)+,fr0 - mov (sp)+,r2 - rts pc - -pblank: - tst byday - beq 1f - mov $1,r0 - sys write; blank; 1 -1: - rts pc - -upall: - mov $ttyf,r1 -1: - mov (r1),r0 - beq 1f - jsr pc,update - add $18.,r1 - br 1b -1: - rts pc - -update: - mov r1,-(sp) - mov $usrf,r2 -1: - mov (sp),r1 - tst (r1)+ - tst (r2) - beq 1f - cmp (r1)+,(r2) - bne 2f - cmp (r1)+,2(r2) - bne 2f - cmp (r1)+,4(r2) - bne 2f - cmp (r1)+,6(r2) - beq 1f -2: - add $16.,r2 - br 1b -1: - mov (sp),r1 - tst (r1)+ - mov (r1)+,(r2)+ - mov (r1)+,(r2)+ - mov (r1)+,(r2)+ - mov (r1)+,(r2)+ - movf fr0,fr1 - subf (r1),fr1 - cfcc - blt 1f - cmpf maxpd,fr1 - cfcc - blt 1f - addf (r2),fr1 - movf fr1,(r2)+ -1: - movf fr0,(r1)+ - mov (sp)+,r1 - rts pc - -newday: - movf midnight,fr1 -1: - cmpf fr0,fr1 - cfcc - blt 1f - addf day,fr1 - br 1b -1: - movf fr1,midnight - rts pc - -select: - mov $usrf,r2 -1: - tst (r2) - beq 1f - mov argc,r1 - beq 2f - mov argp,r3 -3: - mov r2,r0 - mov (r3)+,r4 -4: - cmpb (r0)+,(r4)+ - beq 4b - tstb -(r4) - bne 4f - cmpb -(r0),$' / - beq 2f -4: - sob r1,3b - br 3f -2: - jsr pc,*(r5) -3: - add $16.,r2 - br 1b -1: - tst (r5)+ - rts r5 - -ptime: - mov $obuf,r1 - mov r2,r0 -1: - movb (r0)+,(r1) - cmpb (r1)+,$' / - bne 1b - movb $'\t,-1(r1) - mov r1,-(sp) - seti - divf thous,fr0 - jsr pc,digit - jsr pc,digit - jsr pc,digit - jsr pc,digit - movb $':,(r1)+ - mulf sixth,fr0 - jsr pc,digit - jsr pc,digit - movb $'\n,(r1)+ - sub $obuf,r1 - mov r1,0f - mov (sp)+,r1 -1: - cmpb (r1),$'0 - bne 1f - movb $' ,(r1)+ - br 1b -1: - cmpb (r1),$': - bne 1f - movb $'0,-(r1) -1: - mov $1,r0 - sys write; obuf; 0:.. - rts pc - -digit: - modf ten,fr0 - movfi fr1,r0 - add $'0,r0 - movb r0,(r1)+ - rts pc - -filnam: wtmp -montab: - 31.; 28.; 31.; 30.; 31.; 30.; 31.; 31.; 30.; 31.; 30.; 31. - 31.; 29.; 31.; 30.; 31.; 30.; 31.; 31.; 30.; 31.; 30.; 31. -monasc: - - - - - - - - - - - - -day: 45436;32000;0;0 -thous: 47600;137374;0;0 -maxpd: 45636;032001;0;0 -sixth: 40031;114631;114631;114631 -ten: 41040;0;0;0 -total: -blank: < > -wtmp: -.even -.bss -midnight:.=.+8. -byday: .=.+2 -argc: .=.+2 -argp: .=.+2 -ibuf: .=.+16. -fbuf: .=.+520. -i.tty = ibuf+8. -i.time = ibuf+10. -fi: .=.+2 -ttyf: .=.+[20.*18.]; et: -usrf: .=.+[200.*16.]; eu: -obuf: .=.+20. -pflg: .=.+2 -0.; 31.; 31.; 30.; 31.; 30.; 31. -monasc: - - - - - - - - - - .even - -putc: - movb r0,ch - mov $1,r0 - sys write; ch; 1 - rts r5 - -print: - movb (r1)+,r0 - beq 1f - jsr r5,putc - br print -1: - rts r5 - -diag: - mov r5,r1 - jsr r5,print - tst tfo - beq 1f - sys unlink; tfil -1: - sys exit - -getaf: - mov arglst,0f - sys open; 0:..; 0 - bes 1f - mov r0,afi - sys read; buf; 2 - cmp buf,magic - bne magerr - tst (r5)+ -1: - rts r5 - -magerr: - mov arglst,r1 - jsr r5,print - jsr r5,diag - < -- not in archive format\n\0> - .even - -mktmp: - sys stat; tfil; buf - bes 1f - incb tfil+8 - cmpb tfil+8,$'z - blo mktmp - br tferr -1: - sys intr; done - sys creat; tfil; 14 - bes tferr - mov r0,tfo - sys open; tfil; 0 - bes tferr - mov r0,tfi - rts r5 - -tferr: - jsr r5,diag - - .even - -getdir: - mov afi,r0 - sys read; dir; 16. - cmp r0,$16. - bne 1f - jsr r5,mvname - tst (r5)+ -1: - rts r5 - -mvname: - mov name,rname - mov name+2,rname+2 - mov name+4,rname+4 - mov name+6,rname+6 - rts r5 - -skip: - mov size,r0 - inc r0 - bic $1,r0 - mov r0,0f - mov afi,r0 - sys seek; 0:..; 1 - rts r5 - -trim: - mov r0,r2 -1: - tstb (r0) - beq 1f - cmpb (r0)+,$'/ - beq trim - br 1b -1: - rts r5 - -match: - mov $arglst+2,r1 -1: - mov (r1)+,r0 - beq 1f - blt 1b - jsr r5,trim - mov $name,r0 -2: - cmp r0,$name+8. - beq 2f - cmpb (r0),(r2)+ - bne 1b - tstb (r0)+ - bne 2b -2: - cmp (r5)+,-(r1) -1: - rts r5 - -mvfil: - mov (r1),9f - mov (r1),0f - sys stat; 0:..; buf - bes operr - sys open; 9:..; 0 - bes operr - mov r0,fio - mov (r1),r0 - mov $-1,(r1) - jsr r5,trim - mov $name,r0 -1: - cmp r0,$name+8. - beq 1f - movb (r2)+,(r0)+ - bne 1b -1: - mov buf+28.,mtim - mov buf+30.,mtim+2 - movb buf+5,ouid - movb buf+2,mode - mov buf+6,size - mov tfo,r0 - sys write; dir; 16. - mov size,r2 -1: - mov fio,r0 - sys read; buf; 512. - sub r0,r2 - mov r0,0f - beq 1f - mov tfo,r0 - sys write; buf; 0:.. - br 1b -1: - tst r2 - bne phserr - bit $1,size - beq 1f - mov tfo,r0 - sys seek; 1; 1 -1: - mov fio,r0 - sys close - jsr r5,mvname - rts r5 - -operr: - mov 9b,r1 - jsr r5,print - jsr r5,diag - < -- cannot open\n\0> - .even - -phserr: - mov 9b,r1 - jsr r5,print - jsr r5,diag - < -- phase error\n\0> - .even - -copyfl: - mov tfo,r0 - sys write; dir; 16. - mov size,r1 - mov $rname,9b -1: - mov r1,0f - beq 1f - cmp r1,$512. - blo 2f - mov $512.,0f -2: - mov afi,r0 - sys read; buf; 0:.. - sub r0,r1 - mov r0,0f - beq phserr - mov tfo,r0 - sys write; buf; 0:.. - br 1b -1: - bit $1,size - beq 1f - mov afi,r0 - sys seek; 1; 1 - mov tfo,r0 - sys seek; 1; 1 -1: - rts r5 - -xtract: - movb mode,0f - sys creat; rname; 0:.. - bes noxerr - mov r0,fio - mov size,r1 - mov $rname,9b -1: - mov r1,0f - beq 1f - cmp r1,$512. - blo 2f - mov $512.,0f -2: - mov afi,r0 - sys read; buf; 0:.. - sub r0,r1 - mov r0,0f - beq phserr - mov fio,r0 - sys write; buf; 0:.. - br 1b -1: - mov fio,r0 - sys close - bit $1,size - beq 1f - mov afi,r0 - sys seek; 1; 1 -1: - mov r0,-(sp) - mov r1,-(sp) - mov mtim+2,r1 - mov mtim,r0 - sys mdate - mov (sp)+,r1 - mov (sp)+,r1 - rts r5 - -noxerr: - mov $rname,r1 - jsr r5,print - jsr r5,diag - < -- cannot create\n\0> - .even - -table: - mov $rname,r1 - jsr r5,print - mov $'\n,r0 - jsr r5,putc - rts r5 - -mesg: - mov r1,-(sp) - mov (r5)+,r0 - tstb vflg - beq 1f - jsr r5,putc - mov $' ,r0 - jsr r5,putc - mov $rname,r1 - jsr r5,print - mov $'\n,r0 - jsr r5,putc -1: - mov (sp)+,r1 - rts r5 - -oldnew: - sys stat; rname; buf - bes 1f - cmp buf+28.,mtim - blo 1f - bhi 2f - cmp buf+30.,mtim+2 - blos 1f -2: - tst (r5)+ - mov $rname,tname - mov $tname,r1 -1: - rts r5 - -comr: - jsr r5,mktmp - jsr r5,getaf - br copfl -1: - jsr r5,getdir - br copfl - jsr r5,match - br 2f - jsr r5,mesg; 'r - jsr r5,skip - jsr r5,mvfil - br 1b -2: - jsr r5,copyfl - jsr r5,mesg; 'c - br 1b - -comu: - jsr r5,mktmp - jsr r5,getaf - br noaf -1: - jsr r5,getdir - br copfl - tst arglst+2 - beq 2f - jsr r5,match - br 3f - mov $-1,(r1) -2: - jsr r5,oldnew - br 3f - jsr r5,mesg; 'r - jsr r5,skip - jsr r5,mvfil - br 1b -3: - jsr r5,copyfl - jsr r5,mesg; 'c - br 1b - -comd: - jsr r5,mktmp - jsr r5,getaf - br noaf -1: - jsr r5,getdir - br 1f - jsr r5,match - br 2f - mov $-1,(r1) - jsr r5,skip - jsr r5,mesg; 'd - br 1b -2: - jsr r5,copyfl - jsr r5,mesg; 'c - br 1b -1: - jsr r5,nfound - br copfl - -noaf: - jsr r5,diag - - .even - -crterr: - jsr r5,diag - - .even - -copfl: - mov $arglst,r1 - mov (r1)+,0f -1: - tst (r1)+ - beq 1f - blt 1b - tst -(r1) - jsr r5,mvfil - jsr r5,mesg; 'a - br 1b -1: - sys intr; 0 / no interrups during copy back - sys creat; 0:..; 17 - bes crterr - mov r0,afo - sys write; magic; 2 -1: - mov tfi,r0 - sys read; buf; 512. - mov r0,0f - beq done - mov afo,r0 - sys write; buf; 0:.. - br 1b - -done: - jsr r5,diag - <\0> - .even - -comx: - jsr r5,getaf - br noaf -1: - jsr r5,getdir - br 1f - tst arglst+2 - beq 3f - jsr r5,match - br 2f -3: - mov $-1,(r1) - jsr r5,xtract - jsr r5,mesg; 'x - br 1b -2: - jsr r5,skip - br 1b -1: - jsr r5,nfound - br done - -comt: - jsr r5,getaf - br noaf -1: - jsr r5,getdir - br 1f - tst arglst+2 - beq 2f - jsr r5,match - br 3f - mov $-1,(r1) -2: - jsr r5,table -3: - jsr r5,skip - br 1b -1: - jsr r5,nfound - br done - -nfound: - mov $arglst+2,r2 -1: - mov (r2)+,r1 - beq 1f - blt 1b - mov $-1,-(r2) - jsr r5,print - mov $notfnd,r1 - jsr r5,print - br 1b -1: - rts r5 - -notfnd: - < -- not found\n\0> - .even - -tfil: - .even -magic: -147. - - .bss - -afi: .=.+2 -afo: .=.+2 -tfi: .=.+2 -tfo: .=.+2 -fio: .=.+2 -rname: .=.+9. -ch: .=.+1 -vflg: .=.+1 - .even -tname: .=.+2 -dir: - name: .=.+8. - mtim: .=.+4 - ouid: .=.+1 - mode: .=.+1 - size: .=.+2 -arglst: .=.+200. -buf: .=.+512. - --1,(r1) -2: - jsr r5,table -3: - jsr r5,skip - br 1b -1: - jsr r5,nfound - br done - -nfound: - mov $arglst+2,r2 -1: - mov (r2)+,r1 - beq 1f - blt 1b - mov $-1,-(r2) - jsr r5,print - mov $notfnd,r1 - jsr r5,print - br 1b -1: - rts r5 - -notfnd: - < -- not found\n\0> - .even - -tfil: - .even -magic: -147. - - .bss - -afi: .=.+2 -afo: .=.+2 -tfi: .=.+2 -tfo: .=.+2 -fio: .=.+2 -rname: .=.+9. -ch: .=.+1 -vflg: .=.+1 - .even -tname: .=.+2 -dir: - name: .=.+8. - mtim: .=.+4 - ouid: .=.+1 - mode.globl getchar -.globl lookchar -.globl fsfile -.globl seekchar -.globl backspace -.globl putchar -.globl alterchar -.globl move -.globl rewind -.globl create -.globl zero -.globl allocate -.globl release -.globl collect -.globl w, r, a, l -/ - cmp (sp)+,$2 - blo 1f - tst (sp)+ - mov (sp)+,0f - sys open; 0:.=.+2; 0 - bec 2f - mov $1,r0 - sys write; 4f; 5f-4f - sys exit -/ -4: -5: .even -/ -2: - mov r0,source -1: - sys intr; case177 - clr delflag - mov $pdl,r5 -/ - clr r0 - jsr pc,allocate - mov r1,basptr - mov $10.,r0 - jsr pc,putchar - mov $1,r0 - jsr pc,allocate - mov r1,inbas - mov $10.,r0 - jsr pc,putchar - mov $1,r0 - jsr pc,allocate - mov $10.,r0 - jsr pc,putchar - mov r1,tenptr - clr r0 - jsr pc,allocate - mov r1,chptr - clr r0 - jsr pc,allocate - mov r1,strptr - clr r0 - jsr pc,allocate - mov $1,r0 - jsr pc,putchar - mov r1,kptr - mov $1,r0 - jsr pc,allocate - mov $2,r0 - jsr pc,putchar - mov r1,sqtemp - clr r0 - jsr pc,allocate - mov r1,divxyz -loop: - tst delflag - bne in177 - mov sp,errstack - jsr pc,readc - mov $casetab,r1 -1: tst (r1)+ - beq 2f - cmp r0,(r1)+ - bne 1b - jmp *-4(r1) -2: jmp eh -/ -/ -/ case for new line (which is special for apl box) -/ -case012: - br loop -/ -/ -/ case q for quit -/ -case161: - cmp readptr,$readstack+2 - blos 1f - mov *readptr,r1 - beq 2f - jsr pc,release -2: - sub $2,readptr - mov *readptr,r1 - beq 2f - jsr pc,release -2: - sub $2,readptr - jmp loop -1: - sys exit -/ -/ -/ case of delete character -/ -case177: - mov $1,delflag - mov r0,-(sp) - mov 2(sp),r0 - cmp -6(r0),$sys+read - bne 1f - sub $6,2(sp) - clr delflag -1: - mov (sp)+,r0 - 2 /rti -/ -in177: - mov $' ,ch - mov $1,r0 - sys write; 1f; 1 - clr delflag - jmp eh -/ -delflag: .=.+2 -1: <\n> - .even -/ -/ -/ case digit -/ -case060: - movb r0,savec - jsr pc,readin - jsr pc,push - br loop -/ -/ -/ case _ for negative numbers -/ -case137: - jsr pc,readin - jsr pc,chsign - jsr pc,push - br loop -/ -/ -/ case screamer -/ -case041: - jsr pc,in041 - br loop -/ -in041: - sys fork - br 9f - sys wait - mov $1,r0 - sys write; screamer; 2 - rts pc -9: sys exec; 7f; 8f - 4 -8: 7f; 0 -7: -screamer: - .even -/ -/ -/ case d for duplicate -/ -case144: - cmp r5,$pdl - bne 9f; jmp eh; 9: - clr r0 - jsr pc,allocate - mov -2(r5),r0 - jsr pc,move - jsr pc,push - br loop -/ -/ -/ case z for stack size -/ -case172: - clr r0 - jsr pc,allocate - mov r5,r3 - sub $pdl,r3 - asr r3 -2: - beq 2f - clr r2 - dvd $100.,r2 - mov r3,r0 - jsr pc,putchar - mov r2,r3 - br 2b -2: - jsr pc,push - jmp loop -/ -/ -/ case c for flush -/ -case143: -2: jsr pc,pop - bec 9f; jmp loop; 9: - jsr pc,release - br 2b -/ -/ case s for save -/ -case163: - jsr pc,readc - cmp r5,$pdl - bne 2f - movb $'s,ch - jmp eh -2: - cmpb r0,$128. - blo 9f; jmp err; 9: - asl r0 - mov stable(r0),r1 - beq 2f - jsr pc,release -2: - jsr pc,pop - mov r1,stable(r0) - jmp loop -/ -/ -/ case l for load -/ -case154: - jsr pc,in154 - jmp loop -/ -in154: - jsr pc,readc - cmp r0,$128. - blo 9f; jmp err; 9: - asl r0 - mov stable(r0),r1 - beq 1f - mov r1,-(sp) - jsr pc,length - jsr pc,allocate - mov (sp)+,r0 - jsr pc,move - jsr pc,push - rts pc -1: - clr r0 - jsr pc,allocate - jsr pc,push - rts pc -/ -/ -/ case - for subtract -/ -case055: - jsr pc,in055 - jmp loop -/ -in055: - jsr pc,pop - bec 9f; jmp eh; 9: - jsr pc,chsign - jsr pc,push - br in053 -/ -/ -/ case + for add -/ -case053: - jsr pc,in053 - jmp loop -/ -in053: - mov $add3,r0 - jsr pc,binop - rts pc -/ -/ -/ case * for multiply -/ -case052: - mov $mul3,r0 - jsr pc,binop - tst k - beq 1f - jsr pc,pop - mov r1,r3 - mov kptr,r2 - jsr pc,div3 - jsr pc,push - mov r3,r1 - jsr pc,release - mov r4,r1 - jsr pc,release -1: jmp loop -/ -/ case / for divide -/ -case057: - mov $1f,r0 - jsr pc,binop - mov r4,r1 - jsr pc,release - jmp loop -1: - tst k - beq 1f - mov r2,-(sp) - mov kptr,r2 - jsr pc,mul3 - mov r1,-(sp) - mov r3,r1 - jsr pc,release - mov (sp)+,r3 - mov (sp)+,r2 -1: jsr pc,div3 - rts pc -/ -/ -/ case % for remaindering -/ -case045: - mov $div3,r0 - jsr pc,binop - jsr pc,pop - jsr pc,release - mov r4,r1 - jsr pc,push - jmp loop -/ -/ -binop: - jsr pc,pop - bec 9f; jmp eh; 9: - mov r1,r2 - jsr pc,pop - bec 9f; jmp eh; 9: - mov r1,r3 - jsr pc,(r0) - jsr pc,push - mov r2,r1 - jsr pc,release - mov r3,r1 - jsr pc,release - rts pc -/ -/ -/ case i for input base -/ -case151: - jsr pc,in151 - jmp loop -/ -in151: - jsr pc,pop - bec 9f; jmp eh; 9: - mov r1,-(sp) - mov inbas,r1 - mov (sp)+,inbas - jsr pc,release - rts pc -/ -inbas: .=.+2 -/ -/ -/ case o for output base -/ -case157: - jsr pc,in157 - jmp loop -/ -in157: - jsr pc,pop - bec 9f; jmp eh; 9: - mov r1,-(sp) - mov basptr,r1 - jsr pc,release - mov (sp),basptr -/ -/ set field widths for output -/ and set output digit handling routines -/ - mov (sp),r1 - mov $bigout,outdit - jsr pc,length - cmp r0,$1. - bne 2f - jsr pc,fsfile - jsr pc,backspace - cmp r0,$16. - bhi 2f - mov $hexout,outdit -2: - jsr pc,length - jsr pc,allocate - mov (sp),r0 - jsr pc,move - clr (sp) - jsr pc,fsfile - jsr pc,backspace - bpl 2f - add $1.,(sp) - jsr pc,chsign -2: - mov r1,r2 - mov $1,r0 - jsr pc,allocate - mov $-1,r0 - jsr pc,putchar - mov r1,r3 - jsr pc,add3 - jsr pc,length - asl r0 - add r0,(sp) - jsr pc,fsfile - jsr pc,backspace - cmp r0,$9. - blos 2f - add $1,(sp) -2: - jsr pc,release - mov r2,r1 - jsr pc,release - mov r3,r1 - jsr pc,release - mov (sp)+,fw - cmp outdit,$hexout - bne 2f - mov $1,fw -2: - mov $60.,ll - cmp fw,$60. - blo 9f; rts pc; 9: - mov $60.,r1 - clr r0 - dvd fw,r0 - mov r0,r1 - mpy fw,r1 - mov r1,ll - rts pc -/ -fw: 1 /field width for digits -ll: 60. /line length -/ -/ -/ case k for skale factor -/ -case153: - jsr pc,pop - bec 9f; jmp eh; 9: - mov w(r1),r0 - sub a(r1),r0 - cmp r0,$1 - blos 9f; jmp eh; 9: - jsr pc,rewind - jsr pc,getchar - bpl 9f; jmp eh; 9: - mov r0,k - mov r0,r2 - jsr pc,release - mov kptr,r1 - jsr pc,create - clr r0 -2: cmp r2,$2 - blo 2f - jsr pc,putchar - sub $2,r2 - br 2b -2: mov $1,r0 - cmp r2,$1 - blo 2f - mov $10.,r0 -2: jsr pc,putchar -1: jmp loop -/ -/ -/ case ^ for exponentiation -/ -case136: - jsr pc,pop - bec 9f; jmp eh; 9: - mov r1,r3 - jsr pc,pop - bec 9f; jmp eh; 9: - mov r1,r2 - jsr pc,exp3 - jsr pc,push - mov r2,r1 - jsr pc,release - mov r3,r1 - jsr pc,release - jmp loop -/ -/ -/ case v for square root -/ -case166: - jsr pc,pop - bec 9f; jmp eh; 9: -/ -/ multiply argument by skale factor -/ - mov r1,r2 - mov kptr,r3 - jsr pc,mul3 - mov r1,r3 - mov r2,r1 - jsr pc,release -/ -/ check for zero or negative -/ - mov w(r3),r2 - sub a(r3),r2 - tst r2 - bne 9f; jmp sqz; 9: -/ -/ look at the top one or two digits -/ - mov r3,r1 - jsr pc,fsfile - jsr pc,backspace - mov r0,r4 - bpl 9f; jmp eh; 9: - bit $1,r2 - bne 2f - mov r4,r1 - mul $100.,r1 - mov r1,r4 - mov r3,r1 - jsr pc,backspace - add r0,r4 -2: -/ -/ allocate space for result -/ - inc r2 - asr r2 - mov r2,r0 - jsr pc,allocate - jsr pc,zero - mov r2,r0 - jsr pc,seekchar - mov r1,r2 -/ -/ get high order digit of arg and square root it -/ - mov $1,r0 -2: sub r0,r4 - blt 2f - add $2,r0 - br 2b -2: inc r0 - asr r0 - mov r0,r4 - mov r2,r1 - jsr pc,fsfile - jsr pc,backspace - mov r4,r0 - jsr pc,alterchar - mov r1,-(sp) - mov r3,-(sp) -/ -/ get successive approx. from Newton -/ -1: mov (sp),r3 /arg - mov 2(sp),r2 /approx - jsr pc,div3 - mov r1,r3 - jsr pc,add3 - mov r1,-(sp) - mov r3,r1 - jsr pc,release - mov r4,r1 - jsr pc,release - mov (sp)+,r1 - mov sqtemp,r2 - mov r1,r3 - jsr pc,div3 - mov r1,-(sp) - mov r3,r1 - jsr pc,release - mov r4,r1 - jsr pc,release - mov (sp)+,r3 - mov 2(sp),r1 - jsr pc,length - jsr pc,allocate - mov 2(sp),r0 - jsr pc,move - jsr pc,chsign - mov r1,r2 - jsr pc,add3 - jsr pc,fsfile - jsr pc,backspace - jsr pc,release - mov r2,r1 - jsr pc,release - tst r0 - bpl 2f -/ -/ loop if new < old -/ - mov 2(sp),r1 - jsr pc,release - mov r3,2(sp) - br 1b -/ -2: - mov r3,r1 - jsr pc,release - mov 2(sp),r1 - jsr pc,push - mov (sp),r1 - jsr pc,release - tst (sp)+ - tst (sp)+ - jmp loop -/ -sqz: clr r0 - jsr pc,allocate - jsr pc,push - mov r3,r1 - jsr pc,release - jmp loop -sqtemp: .=.+2 -/ -/ -/ case [ for subroutine definition -/ -case133: - clr -(sp) - clr r0 - jsr pc,allocate - jsr pc,push -1: jsr pc,readc - cmp r0,$'] - bne 3f - tst (sp) - beq 1f - dec (sp) - br 2f -3: - cmp r0,$'[ - bne 2f - inc (sp) -2: - jsr pc,putchar - br 1b -/ -1: tst (sp)+ - jmp loop -/ -/ -/ case x for execute top of stack -/ -case170: - jsr pc,in170 - jmp loop -/ -in170: - jsr pc,pop - bec 9f; jmp eh; 9: - mov r1,-(sp) - tst *readptr - beq 1f - mov *readptr,r1 - cmp r(r1),w(r1) - bne 1f - jsr pc,release - br 2f -1: - add $2,readptr - cmp readptr,$readtop - bhis 1f -2: mov (sp)+,r1 - mov r1,*readptr - beq 2f - jsr pc,rewind - rts pc -2: - jsr pc,readc - cmp r0,$'\n - beq 3f - mov r0,savec -3: - rts pc -1: -nderr: - mov $1,r0 - sys write; 1f; 2f-1f - sys exit -1: -2: .even -/ -readptr: readstack - .bss -readstack: .=.+100. -readtop: - .text -/ -/ case ? for apl box function -/ -case077: - add $2,readptr - cmp readptr,$readtop - bhis nderr - clr *readptr -in077: - mov source,-(sp) - clr source - jsr pc,readc - cmp r0,$'! - bne 1f - jsr pc,in041 - mov (sp)+,source - br in077 -1: - mov r0,savec - clr r0 - jsr pc,allocate - jsr pc,readc - jsr pc,putchar -1: - jsr pc,readc - jsr pc,putchar - cmp r0,$'\n - bne 1b - mov (sp)+,source - mov r1,*readptr - jmp loop -/ -/ -/ case < for conditional execution -/ -case074: - jsr pc,in055 /go subtract - jsr pc,pop - jsr pc,length - tst r0 - beq 1f - jsr pc,fsfile - jsr pc,backspace - tst r0 - bmi 1f - jsr pc,release - jsr pc,in154 /load from register - br case170 -/ -1: - jsr pc,release - jsr pc,readc - jmp loop -/ -/ -/ case = for conditional execution -/ -case075: - jsr pc,in055 /go subtract - jsr pc,pop - jsr pc,length - tst r0 - beq 1f /is zero - jsr pc,release - jsr pc,readc - jmp loop -1: - jsr pc,release - jsr pc,in154 /load from register - jmp case170 /go to execute code -/ -/ -/ case > for conditional execution -/ -case076: - jsr pc,in055 /go subtract - jsr pc,pop - jsr pc,length - tst r0 - beq 1f - jsr pc,fsfile - jsr pc,backspace - tst r0 - bpl 1f - jsr pc,release - jsr pc,in154 /load from register - jmp case170 /go to execute code -1: - jsr pc,release - jsr pc,readc - jmp loop -err: 4 -/ -eh: - movb ch,1f+2 - mov $1,r0 - sys write; 1f; 2f-1f - mov $readstack,readptr - mov errstack,sp - jmp loop -1: <( ) ?\n> -2: .even -/ -/ -/ routine to read and convert a number from the -/ input stream. Numbers beginnig with 0 are -/ converted as octal. Routine converts -/ up to next nonnumeric. -/ -/ -readin: - clr r0 - jsr pc,allocate - mov r1,-(sp) - mov strptr,r1 - jsr pc,create - jsr pc,readc -1: - cmpb ch,$'0 - blt 1f - cmpb ch,$'9 - bgt 1f - mov ch,r0 - sub $'0,r0 - mov chptr,r1 - jsr pc,create - tst r0 - beq 2f - jsr pc,putchar -2: mov r1,chptr - mov (sp),r3 - mov inbas,r2 - jsr pc,mul3 - mov r1,(sp) - mov r3,r1 - jsr pc,release - mov (sp),r3 - mov chptr,r2 - jsr pc,add3 - mov r1,(sp) - mov r3,r1 - jsr pc,release - jsr pc,readc - mov r0,ch - br 1b -1: - mov ch,savec - mov (sp)+,r1 - rts pc -/ -/ -/ routine to read another character from the input -/ stream. If the caller does not want the character, -/ it is to be placed in the cell savec. -/ The routine exits to the system on end of file. -/ Character is returned in r0. -/ -/ jsr pc,readc -/ movb r0,... -/ -/ -readc: - tst savec - beq 1f - movb savec,r0 - clr savec - rts pc -1: - tst *readptr - bne 1f -2: mov source,r0 - sys read; ch; 1 - bes eof - tst r0 - beq eof - movb ch,r0 - rts pc -1: - mov r1,-(sp) - mov *readptr,r1 - jsr pc,getchar - bes eof1 - mov r0,ch - mov (sp)+,r1 - rts pc -/ -eof: - tst source - beq 1f - clr source - br 2b -1: - sys exit -/ -eof1: - mov *readptr,r1 - beq 2f - jsr pc,release -2: - sub $2,readptr - mov (sp)+,r1 - jmp readc -/ -/ -/ case p for print -/ -case160: - cmp r5,$pdl - bne 9f; jmp eh; 9: - jsr pc,in160 - jmp loop -/ -/ -in160: - mov $1,r0 - sys write; sphdr; 4 - br 1f -/ -sphdr: < > - .even -/ -1: cmp r5,$pdl - bne 1f - mov $1,r0 - sys write; qm; 1 - mov $1,r0 - sys write; nl; 1 - rts pc -/ -/ do the conversion -/ -1: - mov -2(r5),r1 - jsr pc,printf - rts pc -/ -/ -/ case f for print the stack -/ -case146: - mov r5,-(sp) -1: - cmp r5,$pdl - beq 2f -1: - jsr pc,in160 - jsr pc,pop - cmp r5,$pdl - bne 1b -2: - mov $stable-2,r0 -1: - tst (r0)+ - cmp r0,$stable+254. - bhi 1f -/ - mov (r0),r1 - beq 1b - mov r0,-(sp) - sub $stable,r0 - asr r0 - movb r0,7f+1 - mov $1,r0 - sys write; 7f; 8f-7f - jsr pc,printf - mov (sp)+,r0 - br 1b -1: - mov (sp)+,r5 - jmp loop -/ -7: <" " > -8: .even -/ -/ -/ routine to convert to decimal and print the -/ top element of the stack. -/ -/ jsr pc,printf -/ -/ -printf: - mov r2,-(sp) - mov r1,-(sp) - mov r0,-(sp) - clr -(sp) - jsr pc,rewind -2: - jsr pc,getchar - bes 2f - cmp r0,$143 - blos 2b - cmp r0,$-1 - beq 2b - bis $1,(sp) - br 2b -2: - tst (sp)+ - beq 2f - jsr pc,length - mov r0,0f - mov a(r1),3f - mov $1,r0 - sys write; 3:.=.+2; 0:.=.+2 - br prout -2: - jsr pc,fsfile - jsr pc,backspace - bec 1f - mov $1,r0 - sys write; blank; 1 - mov $1,r0 - sys write; asczero; 1 - br prout -1: - jsr pc,length - mov r1,-(sp) - jsr pc,allocate - mov (sp),r0 - mov r1,(sp) - jsr pc,move - mov ll,count - inc count - jsr pc,fsfile - jsr pc,backspace - cmpb r0,$-1 - bne 2f - mov basptr,r1 - jsr pc,fsfile - jsr pc,backspace - cmp r0,$-1 - beq 2f - mov (sp),r1 - jsr pc,chsign - mov $'-,ch - jsr pc,wrchar - br 1f -2: - mov $' ,ch - jsr pc,wrchar -1: - mov strptr,r1 - jsr pc,create - mov basptr,r1 - jsr pc,length - cmp r0,$1 - blo dingout - bne 1f - jsr pc,rewind - jsr pc,getchar - cmp r0,$1. - beq unout - cmp r0,$-1 - beq dingout -1: - mov (sp),r3 - mov basptr,r2 - jsr pc,div3 - mov r1,r2 - mov (sp),r1 - jsr pc,release - mov r2,(sp) - mov r4,r1 - jsr pc,*outdit - mov (sp),r1 - jsr pc,length - bne 1b -/ - mov strptr,r1 - jsr pc,fsfile -1: - jsr pc,backspace - bes 1f - mov r0,ch - jsr pc,wrchar - br 1b -1: - mov (sp)+,r1 - jsr pc,release -/ -/ cleanup, print new line and return -/ -prout: mov $1,r0 - sys write; nl; 1 - mov (sp)+,r0 - mov (sp)+,r1 - mov (sp)+,r2 - rts pc -/ -/ -dingout: - clr -(sp) - br 1f -unout: - mov $1,-(sp) -1: - mov strptr,r1 - jsr pc,create - mov $-1,r0 - jsr pc,putchar - mov r1,r3 -1: - mov 2(sp),r1 - jsr pc,length - beq 1f - mov r1,r2 - jsr pc,add3 - mov r1,2(sp) - mov r2,r1 - jsr pc,release - mov $1,r0 - tst (sp) - beq 2f - mov $'1,ch - jsr pc,wrchar - br 1b -2: - tst delflag - beq 9f; jmp in177; 9: - sys write; ding; 3 - br 1b -1: - tst (sp)+ - mov (sp)+,r1 - jsr pc,release - br prout -/ -ding: < > / -blank: < > -sp5: <\n > -minus: <-> -one: <1> - .even -count: .=.+2 -/ -bigout: - mov r1,-(sp) /big digit - mov strptr,r1 - jsr pc,length - add fw,r0 - dec r0 - mov r0,-(sp) /end of field - clr -(sp) /negative - mov 4(sp),r1 - jsr pc,length - bne 2f - mov strptr,r1 - mov $'0,r0 - jsr pc,putchar - br 1f -2: - mov 4(sp),r1 /digit - jsr pc,fsfile - jsr pc,backspace - bpl 2f - mov $1,(sp) /negative - jsr pc,chsign -2: - mov 4(sp),r3 /digit - mov r3,r1 - jsr pc,length - beq 1f - mov tenptr,r2 - jsr pc,div3 - mov r1,4(sp) /digit - mov r3,r1 - jsr pc,release - mov r4,r1 - jsr pc,rewind - jsr pc,getchar - jsr pc,release - add $'0,r0 - mov strptr,r1 - jsr pc,putchar - br 2b -1: - mov strptr,r1 - jsr pc,length - cmp r0,2(sp) /end of field - bhis 1f - mov $'0,r0 - jsr pc,putchar - br 1b -1: - tst (sp) /negative - beq 1f - mov $'-,r0 - mov strptr,r1 - dec w(r1) - jsr pc,putchar -1: - mov $' ,r0 - jsr pc,putchar - tst (sp)+ - tst (sp)+ - mov (sp)+,r1 - jsr pc,release - rts pc -/ -tenptr: .=.+2 -/ -/ -/ -hexout: - mov r1,-(sp) - jsr pc,rewind - jsr pc,getchar - add $60,r0 - cmp r0,$'9 - blos 2f - add $'A-'9-1,r0 -2: - mov strptr,r1 - jsr pc,putchar - mov (sp)+,r1 - jsr pc,release - rts pc -/ -/ -wrchar: - tst delflag - beq 9f; jmp in177; 9: - mov $1,r0 - tst count - bne 7f - sys write; sp5; 6 - mov ll,count - mov $1,r0 -7: - dec count - sys write; ch; 1 - rts pc -/ -/ -/ here for unimplemented stuff -/ -junk: - movb r0,1f - mov $1,r0 - sys write; 1f; 2f-1f - jmp loop -1: <0 not in switch.\n> -2: .even -/ -/ -/ -/ routine to place one word onto the pushdown list -/ Error exit to system on overflow. -/ -/ -push: - mov r1,(r5)+ - cmp r5,$pdltop - bhis pdlout - rts pc -/ -pdlout: - mov $1,r0 - sys write; 1f; 2f-1f - 4 -1: -2: .even -/ -/ -/ routine to remove one word from the pushdown list -/ carry bit set on empty stack -/ -/ -/ jsr pc,pop -/ -pop: - cmp r5,$pdl - bhi 1f - clr r1 - sec - rts pc -1: mov -(r5),r1 - clc - rts pc -/ -/ -/ -/ -outdit: hexout -source: .=.+2 -savec: .=.+2 -ch: .=.+2 -nl: <\n> -asczero: <0> -qm: - .even -/ -chptr: .=.+2 -strptr: .=.+2 -basptr: .=.+2 -errstack:.=.+2 -/ - .bss -stable: .=.+256. - .text -casetab: - case012; 012 /nl - loop; 040 /sp - case041; 041 /! - case045; 045 /% - case052; 052 /* - case053; 053 /+ - case055; 055 /- - junk; 056 /. - case057; 057 // - case060; 060 /0 - case060; 061 /1 - case060; 062 /2 - case060; 063 /3 - case060; 064 /4 - case060; 065 /5 - case060; 066 /6 - case060; 067 /7 - case060; 070 /8 - case060; 071 /9 - case074; 074 /< - case075; 075 /= - case076; 076 /> - case077; 077 /? - case143; 103 /C - case144; 104 /D - case146; 106 /F - case151; 111 /I - case153; 113 /K - case154; 114 /L - case157; 157 /O - case160; 120 /P - case161; 121 /Q - case163; 123 /S - case166; 126 /V - case170; 130 /X - case172; 132 /Z - case133; 133 /[ - case136; 136 /^ - case137; 137 /_ - case143; 143 /c - case144; 144 /d - case146; 146 /f - case151; 151 /i - case153; 153 /k - case154; 154 /l - case157; 157 /o - case160; 160 /p - case161; 161 /q - case163; 163 /s - case166; 166 /v - case170; 170 /x - case172; 172 /z - 0;0 -/ - .bss -pdl: .=.+100. -pdltop: - .text -4; 104 /D - case146; 106 /F - case151; 111 /I - case153; 113 /K - case154; 114 /L - case157; 157 /O - case160; 120 /P - case161; 121 /Q - case163; 123 /S - case166; 126 /V - case170; 130 /X - case172; 132 /Z - case133; 133 /[ - case136; 136 /^ - case137; 137 /_ - case143; 143 /c - case144; 144 /d - case146; 146 /f - case151; 151 /i - case153; 153 /k - case154; 154 /l - case157; 157 /o - case160; 160 /p - case161; 161 /q - case163; 163 /s - case166; 166 /v - case170; 170 /x - case172; 172 /z - 0;0 -/ \ No newline at end of file diff --git a/cmd/as25.s b/cmd/as25.s deleted file mode 100644 index c03b8d76dd..0000000000 --- a/cmd/as25.s +++ /dev/null @@ -1,53 +0,0 @@ -/ as25 is empty -ts r5 - -uids: - - .bss -ubuf: .=.+518. -buf - cmpb r0,$': - bne 3b - jsr r5,cvnum; getc -do: - sub $2,r4 - mov r1,0f+2 - tst (r5)+ -1: - mov (r5)+,0f - sys chown; 0:..; 0 - bec 2f - mov 0b,r0 - mov r0,0f - clr 0f+2 -3: - tstb (r0)+ - beq 3f - inc 0f+2 - br 3b -3: - mov $1,r0 - sys write; 0:..; .. - jsr r5,mesg; ; .even -2: - dec r4 - bgt 1b - sys exit - -cvnum: - clr r1 -1: - jsr r5,*(r5); ubuf - bcs 1f - sub $'0,r0 - cmp r0,$9. - bhi 1f - mpy $10.,r1 - add r0,r1 - br 1b -1: - tst (r5)+ - rts r5 - -geta: - movb (r3)+, \ No newline at end of file diff --git a/cmd/as8.s b/cmd/as8.s deleted file mode 100644 index 596ea522e9..0000000000 --- a/cmd/as8.s +++ /dev/null @@ -1,83 +0,0 @@ -/ as8 -- PDP-11 assembler pass 2 - -chartab: - <\0abcdefg> - - - - <6789_.> - -qnl: -qii: - -a.out: -badfil: / a file which should never exist - -.even -a.outp: a.out -a.tmp1: badfil -a.tmp2: badfil -a.tmp3: badfil - -tseekp: txtseek -rseekp: trelseek - -txtmagic: - br .+20 -txtsiz: .=.+2 -datsiz: .=.+2 -bsssiz: .=.+2 -symsiz: .=.+2 -stksiz: .=.+2 -exorig: .=.+2 - .=.+2 - -txtseek: 20 -datseek: .=.+2 - .=.+2 -trelseek: .=.+2 -drelseek: .=.+2 - .=.+2 -symseek: .=.+2 - -fbbufp: .=.+2 -defund: .=.+2 -savdot: .=.+6 -datbase: .=.+2 -bssbase: .=.+2 -fbfil: .=.+2 -fin: .=.+2 -ibufc: .=.+2 -txtfil: .=.+2 -symf: .=.+2 -adrbuf: .=.+12. -xsymbol: .=.+2 -fout: .=.+2 -ch: .=.+2 -wordf: .=.+2 -argb: .=.+22. -line: .=.+2 -savop: .=.+2 -curfb: .=.+20. -nxtfb: .=.+20. -nxtfbp: .=.+20. -curfbr: .=.+10. -nxtfbr: .=.+10. -numval: .=.+2 -maxtyp: .=.+2 -relfil: .=.+2 -ibufp: .=.+2 -inbuf: .=.+512. -txtp: .=.+6+512. -relp: .=.+6+512. -swapf: .=.+2 -rlimit: .=.+2 - -.=.+2 -trelseek: .=.+2 -drelseek: .=.+2 - .=.+2 -symseek: .=.+2 - -fbbufp: .=.+2 -d \ No newline at end of file diff --git a/cmd/as9.s b/cmd/as9.s deleted file mode 100644 index 7824cb2ead..0000000000 --- a/cmd/as9.s +++ /dev/null @@ -1,301 +0,0 @@ -/ as9 -- PDP-11 assembler pass 2 - -eae = 0 - -symtab = .-200 - -/ special variables - - 02; dot:000000 /. - 01; dotdot:000000 /.. - -/ register - -24;000000 /r0 -24;000001 /r1 -24;000002 /r2 -24;000003 /r3 -24;000004 /r4 -24;000005 /r5 -24;000006 /sp -24;000007 /pc - - -.if eae -/eae & switches - -01;177570 /csw -01;177300 /div -01;177302 /ac -01;177304 /mq -01;177306 /mul -01;177310 /sc -01;177311 /sr -01;177312 /nor -01;177314 /lsh -01;177316 /ash - -.endif - -/ system calls - -01;0000001 /exit -01;0000002 /fork -01;0000003 /read -01;0000004 /write -01;0000005 /open -01;0000006 /close -01;0000007 /wait -01;0000010 /creat -01;0000011 /link -01;0000012 /unlink -01;0000013 /exec -01;0000014 /chdir -01;0000015 /time -01;0000016 /makdir -01;0000017 /chmod -01;0000020 /chown -01;0000021 /break -01;0000022 /stat -01;0000023 /seek -01;0000024 /tell -01;0000025 /mount -01;0000026 /umount -01;0000027 /setuid -01;0000030 /getuid -01;0000031 /stime -01;0000032 /quit -01;0000033 /intr -01;0000034 /fstat -01;0000035 /cemt -01;0000036 /mdate -01;0000037 /stty -01;0000040 /gtty -01;0000041 /ilgins -01;0000042 /nice - -/ double operand - -13;0010000 /mov -13;0110000 /movb -13;0020000 /cmp -13;0120000 /cmpb -13;0030000 /bit -13;0130000 /bitb -13;0040000 /bic -13;0140000 /bicb -13;0050000 /bis -13;0150000 /bisb -13;0060000 /add -13;0160000 /sub - -/ branch - -06;0000400 /br -06;0001000 /bne -06;0001400 /beq -06;0002000 /bge -06;0002400 /blt -06;0003000 /bgt -06;0003400 /ble -06;0100000 /bpl -06;0100400 /bmi -06;0101000 /bhi -06;0101400 /blos -06;0102000 /bvc -06;0102400 /bvs -06;0103000 /bhis -06;0103000 /bec -06;0103000 /bcc -06;0103400 /blo -06;0103400 /bcs -06;0103400 /bes - -/ single operand - -15;0005000 /clr -15;0105000 /clrb -15;0005100 /com -15;0105100 /comb -15;0005200 /inc -15;0105200 /incb -15;0005300 /dec -15;0105300 /decb -15;0005400 /neg -15;0105400 /negb -15;0005500 /adc -15;0105500 /adcb -15;0005600 /sbc -15;0105600 /sbcb -15;0005700 /tst -15;0105700 /tstb -15;0006000 /ror -15;0106000 /rorb -15;0006100 /rol -15;0106100 /rolb -15;0006200 /asr -15;0106200 /asrb -15;0006300 /asl -15;0106300 /aslb -15;0000100 /jmp -15;0000300 /swab - -/ jsr - -07;0004000 /jsr - -/ rts - -10;000200 /rts - -/ simple operand - -11;104400 /sys - -/ flag-setting - -01;0000241 /clc -01;0000242 /clv -01;0000244 /clz -01;0000250 /cln -01;0000261 /sec -01;0000262 /sev -01;0000264 /sez -01;0000270 /sen - -/ floating point ops - -01;170000 / cfcc -01;170001 / setf -01;170011 / setd -01;170002 / seti -01;170012 / setl -15;170400 / clrf -15;170700 / negf -15;170600 / absf -15;170500 / tstf -12;172400 / movf -14;177000 / movif -05;175400 / movfi -14;177400 / movof -05;176000 / movfo -14;172000 / addf -14;173000 / subf -14;171000 / mulf -14;174400 / divf -14;173400 / cmpf -14;171400 / modf -24;000000 / fr0 -24;000001 / fr1 -24;000002 / fr2 -24;000003 / fr3 -24;000004 / fr4 -24;000005 / fr5 - -/ 11/45 operations - -30;072000 /als (ash) -30;073000 /alsc (ashc) -30;070000 /mpy -.if eae-1 -30;070000/ mul -30;071000 / div -30;072000 / ash -30;073000 /ashc -.endif -30;071000 /dvd -07;074000 /xor -15;006700 /sxt -11;006400 /mark -31;077000 /sob - -/ specials - -16;000000 /.byte -20;000000 /.even -21;000000 /.if -22;000000 /.endif -23;000000 /.globl -25;000000 /.text -26;000000 /.data -27;000000 /.bss -32;000000 /.comm - -usymtab: -start: - mov $1,r0 - sys write; qii; 3 - cmp (sp),$4 - bge 1f - jmp aexit -1: - cmp (sp)+,$5 - blt 1f - mov $40,defund / globalize all undefineds -1: - tst (sp)+ - mov (sp)+,a.tmp1 - mov (sp)+,a.tmp2 - mov (sp)+,a.tmp3 - jsr r5,ofile; a.tmp1 - movb r0,txtfil - jsr r5,ofile; a.tmp2 - movb r0,fbfil - jsr r5,ofile; a.tmp3 - movb r0,symf - movb r0,fin - sys creat; a.out; 12 - bec 1f - jsr r5,filerr; a.outp -1: - movb r0,fout - jmp go - -ofile: - mov *(r5),0f - sys open; 0:..; 0 - bes 1f - tst (r5)+ - rts r5 -1: - jmp filerr - -end: - -omm - -usymtab: -start: - mov $1,r0 - sys write; qii; 3 - cmp (sp),$4 - bge 1f - jmp aexit -1: - cmp (sp)+,$5 - blt 1f - mov $40,defund / globalize all undefineds -1: - tst (sp)+ - mov (sp)+,a.tmp1 - mov (sp)+,a.tmp2 - mov (sp)+,a.tmp3 - jsr r5,ofile; a.tmp1 - movb r0,txtfil - jsr r5,ofile; a.tmp2 - movb r0,fbfil - jsr r5,ofile; a.tmp3 - movb r0,symf - movb r0,fin - sys creat; a.out; 12 - bec 1f - jsr r5,filerr; a.outp -1: - movb r0,fout - jmp go - -ofile: - mov *(r5),0f - sys open; 0:..; 0 - bes 1f - \ No newline at end of file diff --git a/cmd/bas0.s b/cmd/bas0.s deleted file mode 100644 index a02f992b11..0000000000 --- a/cmd/bas0.s +++ /dev/null @@ -1,391 +0,0 @@ -/ bas0 -- basic - -.globl main -.globl sin, cos, log, exp, atan, pow -.globl atoi, atof, ftoa, ftoo -.globl rand, srand - -one = 40200 - -main: - setd - sys time - mov r1,r0 - mov r0,randx - jsr pc,srand - sys intr; intrup - mov sp,gsp - clr seeka - mov $'a,r1 -1: - movb r1,tmpf+8 - sys stat; tmpf; line - bes 1f - inc r1 - cmp r1,$'z - blos 1b - br 2f -1: - sys creat; tmpf; 14 - bes 2f - mov r0,tfo - sys open; tmpf; 0 - bec 1f -2: - mov $3f,r0 - jsr pc,print - sys exit -3: - ; .even -1: - mov r0,tfi - jsr pc,isymtab - cmp (sp),$2 - blt loop - mov 4(sp),0f - sys open; 0:..; 0 - bes 1f - mov r0,fi - br loop -1: - mov $1f,r0 - jsr pc,print - br loop -1: - ; .even - -intrup: - mov $'\n,r0 - jsr r5,putc - jsr r5,error - ; .even - -loop: - mov gsp,sp - clr lineno - jsr pc,rdline - mov $line,r3 -1: - movb (r3),r0 - jsr pc,digit - br 1f - jsr r5,atoi; nextc - cmp r0,$' / - bne 1f - mov $lintab,r3 - mov r1,r0 - bgt 2f - jsr pc,serror -2: - cmp r0,(r3) - beq 2f - tst (r3) - beq 2f - add $6,r3 - br 2b -2: - cmp r3,$elintab-12. - blo 2f - jsr r5,error - ; .even -2: - mov r0,(r3)+ - mov seeka,(r3)+ - mov tfo,r0 - sys seek; seeka:..; 0 - mov $line,r0 - jsr pc,size - inc r0 - add r0,seeka - mov r0,0f - mov tfo,r0 - sys write; line; 0:.. - br loop -1: - mov $line,r3 - jsr pc,singstat - br loop - -nextc: - movb (r3)+,r0 - rts r5 - -size: - clr -(sp) -1: - inc (sp) - cmpb (r0)+,$'\n - bne 1b - mov (sp)+,r0 - rts pc - -rdline: - mov $line,0f -1: - mov fi,r0 - sys read; 0:..; 1 - bes 2f - tst r0 - beq 2f - cmp 0b,$line+99. - bhis 2f / bad check, but a check - movb *0b,r0 - inc 0b - cmp r0,$'\n - bne 1b - clrb *0b - rts pc -2: - mov fi,r0 - beq 1f - sys close - clr fi - br 1b -1: - jmp _done - -error: - tst fi - beq 1f - sys close - clr fi -1: - tst lineno - beq 1f - jsr pc,nextlin - br 1f - mov $line,r0 - jsr pc,print -1: - mov r5,r0 - jsr pc,print - jmp loop - -serror: - dec r3 - tst fi - beq 1f - sys close - clr fi -1: - mov $line,r1 -1: - cmp r1,r3 - bne 2f - mov $'_,r0 - jsr r5,putc - mov $10,r0 - jsr r5,putc -2: - movb (r1),r0 - jsr r5,putc - cmpb (r1)+,$'\n - bne 1b - jmp loop - -print: - mov r0,0f - jsr pc,size - mov r0,0f+2 - mov $1,r0 - sys write; 0:..; .. - rts pc - -digit: - cmp r0,$'0 - blo 1f - cmp r0,$'9 - bhi 1f - add $2,(sp) -1: - rts pc - -alpha: - cmp r0,$'a - blo 1f - cmp r0,$'z - bhi 1f - add $2,(sp) -1: - rts pc - -name: - mov $nameb,r1 - clr (r1) - clr 2(r1) -1: - cmp r1,$nameb+4 - bhis 2f - movb r0,(r1)+ -2: - movb (r3)+,r0 - jsr pc,alpha - br 2f - br 1b -2: - jsr pc,digit - br 2f - br 1b -2: - mov $resnam,r1 -1: - cmp nameb,(r1) - bne 2f - cmp nameb+2,2(r1) - bne 2f - sub $resnam,r1 - asr r1 - add $2,(sp) - rts pc -2: - add $4,r1 - cmp r1,$eresnam - blo 1b - mov $symtab,r1 -1: - tst (r1) - beq 1f - cmp nameb,(r1) - bne 2f - cmp nameb+2,2(r1) - bne 2f - rts pc -2: - add $14.,r1 - br 1b -1: - cmp r1,$esymtab-28. - blo 1f - jsr r5,error - ; .even -1: - mov nameb,(r1) - mov nameb+2,2(r1) - clr 4(r1) - clr 14.(r1) - rts pc - -skip: - cmp r0,$' / - bne 1f - movb (r3)+,r0 - br skip -1: - rts pc - -putc: - tstb drflg - beq 1f - jsr pc,drput - rts r5 -1: - mov r0,ch - mov $1,r0 - sys write; ch; 1 - rts r5 - -nextlin: - clr -(sp) - mov $lintab,r1 -1: - tst (r1) - beq 1f - cmp lineno,(r1) - bhi 2f - mov (sp),r0 - beq 3f - cmp (r0),(r1) - blos 2f -3: - mov r1,(sp) -2: - add $6,r1 - br 1b -1: - mov (sp)+,r1 - beq 1f - mov (r1)+,lineno - mov (r1)+,0f - mov tfi,r0 - sys seek; 0:..; 0 - mov tfi,r0 - sys read; line; 100. - add $2,(sp) -1: - rts pc - -getloc: - mov $lintab,r1 -1: - tst (r1) - beq 1f - cmp r0,(r1) - beq 2f - add $6,r1 - br 1b -1: - jsr r5,error - -qnl: - <\n> - .even -magic: - br .+20 - -.bss -argc: .=.+2 -symbol: .=.+14 -ibuf: .=.+518. -obuf: .=.+518. -ch: .=.+2 - -; 1 - br 1b -1: - mov $1,r0 - sys write; qnl; 1 - rts \ No newline at end of file diff --git a/cmd/getty.s b/cmd/getty.s deleted file mode 100644 index 37b76546b4..0000000000 --- a/cmd/getty.s +++ /dev/null @@ -1,196 +0,0 @@ -/ getty -- get name and tty mode -/ for initialization - -/ cycle through speeds and "login:" messages -/ summarized in itab - -stty = 31. - - sys quit; 0 - sys intr; 0 -0: - jsr r5,nextspeed -1: - mov $name,r5 -2: - jsr r5,getc - cmp r0,$174 - beq 5f - cmp r0,$176 - beq 5f - cmp r0,$'\n - beq 1f - cmp r0,$'\r - beq 4f - cmp r0,$'@ - beq 1b - cmp r0,$'# - bne 3f - cmp r5,$name - blos 2b - dec r5 - br 2b -3: - movb r0,(r5)+ - br 2b -4: - bis $20,flags /cr bit - mov $1,r0 - sys write; nl; 1 - br 2f -5: - mov $tab2741,itabp - inc nowr - br 0b -1: - mov $1,r0 - sys write; cr; 1 -2: - clrb (r5)+ - -/ determine whether terminal is upper-case only - - cmp r5,$name+1 - bhi 1f - bic $4,flags /no data-assume lc -1: - mov $name,r5 -1: - movb (r5)+,r0 - beq 1f - cmp r0,$'A - blo 2f - cmp r0,$'Z - bhi 2f - add $40,r0 / map to lc - movb r0,-1(r5) - br 1b -2: - cmp r0,$'a - blo 1b - cmp r0,$'z - bhi 1b - bic $4,flags - br 1b -1: - clr r0 - mov fstate,r4 - bis flags,4(r4) - sys stty; fstate: .. - -go: - sys exec; login; loginp - sys exit - -getc: - clr r0 - sys read; ch; 1 - tst r0 - beq done - mov ch,r2 - beq 1f -getc1: - cmp r2,$174 - bhis 3f - tst nowr - bne 3f - mov $1,r0 - sys write; ch; 1 -3: - mov r2,r0 - rts r5 -1: - dec $0 / wait a while - bne 1b - mov $name,(sp) - jsr r5,nextspeed -2: - clr r0 / flush nulls - sys read; ch; 1 - tst r0 - beq done - movb ch,r2 - beq 2b - br getc1 - -done: - sys exit - -nextspeed: - mov itabp,r1 - mov (r1)+,0f - bne 1f - mov $itab,itabp - br nextspeed -1: - clr r0 - sys stty; 0:.. - bes go - mov (r1)+,-(sp) - mov (r1)+,fstate - mov r1,itabp - mov (sp)+,r1 -1: - movb (r1)+,ch - beq 1f - mov $1,r0 - sys write; ch; 1 - br 1b -1: - rts r5 - -itabp: itab -loginp: login - name - 0 - -itab: - itty37; ttymes; tty37 - itn300; tnmes; tn300 -tab2741: i2741; m2741; f2741 - 0 - -itty37: 511; 511; 340 / any parity, raw, 150 baud -tty37: 511; 511; 210 / 37 parity, echo, 150 baud -itn300: 521; 521; 340 / any parity, raw, cr, 300 baud -tn300: 521; 521; 310 / any parity, echo, 300 baud -i2741: 1501; 501; 100540 /134 bits, 2741, raw, first time -f2741: 1501; 501; 500 /134 bps, 2741 - - 0 -m2741: <\nlogin: \0> - -ttymes: - <\n\r\p:\alogin: \0> -tnmes: - <\n\r\p;login: \0> - -login: - .even - -nl: <\n> -cr: <\r> - -flags: 004 / upper case map - - .bss -ch: .=.+2 -nowr: .=.+2 -name: .=.+32. -f2741 - 0 - -itty37: 511; 511; 340 / any parity, raw, 150 baud -tty37: 511; 511; 210 / 37 parity, echo, 150 baud -itn300: 521; 521; 340 / any parity, raw, cr, 300 baud -tn300: 521; 521; 310 / any parity, echo, 300 baud -i2741: 1501; 501; 100540 /134 bits, 2741, raw, first time -f2741: 1501; 501; 500 /134 bps, 2741 - - 0 -m2741: <\nlogin: \0> - -ttymes: - <\n\r\p:\alogin: \0> -tnmes: - <\n\r\p;log \ No newline at end of file diff --git a/cmd/glob.c b/cmd/glob.c deleted file mode 100644 index aa4ac6b09c..0000000000 --- a/cmd/glob.c +++ /dev/null @@ -1,202 +0,0 @@ -/* global command -- - - glob params - - "*" in params matches r.e ".*" - "?" in params matches r.e. "." - "[...]" in params matches character class - "[...a-z...]" in params matches a through z. - - perform command with argument list - constructed as follows: - if param does not contain "*", "[", or "?", use it as is - if it does, find all files in current directory - which match the param, sort them, and use them - - prepend the command name with "/bin" or "/usr/bin" - as required. -*/ - -char ab[2000]; /* generated characters */ -char *ava[200]; /* generated arguments */ -char **av ava; -char *string ab; - -main(argc, argv) -char *argv[]; -{ - int i, j, c; - int inode, dirf, ap; - int fb[5], sb[17]; - char *cp, *cpo; - - if (argc < 3) { - write(1, "Arg count\n", 10); - return; - } - ap = 0; - av++; - fb[4] = 0; -loop: - cpo = cp = *++argv; - while(c = *cp++) if (c=='*' | c=='?' | c=='[') goto compl; - av[ap++] = copy(cpo); - if (--argc>=2) goto loop; - goto donow; - -compl: - if(*--cp == '/') { - *cp = '\0'; - if((dirf=open(cp==cpo? "/" : cpo, 0))<0) - goto oper; - *cp++ = '/'; - goto compl1; - } - if(cp != cpo) goto compl; - if((dirf=open(".",0)) >= 0) goto compl1; -oper: - write(1, "No directory\n", 13); - return; -compl1: - j = ap; -l2: - while (read(dirf, &inode, 2)>0) { - read(dirf, fb, 8); - if (inode==0) goto l2; - if (match(fb, cp)) { - c = *cp; - *cp = '\0'; - av[ap++] = cat(cpo, fb); - *cp = c; - } - } - close(dirf); - i = j; - while(i=2) goto loop; -donow: - if (ap<=1) { - write(1, "No match\n", 9); - return; - } - av[ap] = 0; - execv(av[0], av); - i = cat("/bin/", av[0]); - execv(i, av); - i = cat("/usr", i); - execv(i, av); - if (stat(i, sb) == 0) { - *av = i; - *--av = "/bin/sh"; - execv(av[0], av); - } - write(1, "No command\n", 11); -} - -match(s, p) -char *s, *p; { - if (*s=='.' & *p!='.') return(0); - return(amatch(s, p)); -} - -amatch(s, p) -char *s, *p; -{ - int c, cc, ok, lc, scc; - - scc = *s; - lc = 077777; - switch (c = *p) { - - case '[': - ok = 0; - while (cc = *++p) { - switch (cc) { - - case ']': - if (ok) - return(amatch(++s, ++p)); - else - return(0); - - case '-': - ok =| lc <= scc & scc <= (cc=p[1]); - } - if (scc==(lc=cc)) ok++; - } - return(0); - - case '?': - caseq: - if(scc) return(amatch(++s, ++p)); - return(0); - case '*': - return(umatch(s, ++p)); - case 0: - return(!scc); - } - if (c==scc) goto caseq; - return(0); -} - -umatch(s, p) -char *s, *p; -{ - if(*p==0) return(1); - while(*s) - if (amatch(s++,p)) return(1); - return(0); -} - -compar(s1,s2) -char *s1, *s2; -{ - int c1,c2; - -loop: - if ((c1 = *s1++)==0) return(0); - if ((c2 = *s2++)==0) return(1); - if (c1==c2) goto loop; - return(c1>c2); -} - -copy(s1) -char *s1; -{ - char *ts; - - ts = string; - while(*string++ = *s1++); - return(ts); -} - -cat(s1, s2) -char *s1, *s2; -{ - char *ts; - - ts = string; - while(*string++ = *s1++); - string--; - while(*string++ = *s2++); - return(ts); -} -seq; - return(0); -} - -umatch(s, p) -char *s, *p; -{ - if(*p==0) return(1); - while(* \ No newline at end of file diff --git a/cmd/if.c b/cmd/if.c deleted file mode 100644 index 0ce05f3215..0000000000 --- a/cmd/if.c +++ /dev/null @@ -1,168 +0,0 @@ -/* if command */ - -int ap; -int ac; -char **av; - -main(argc, argv) -char *argv[]; -{ - int np, i, c; - char *nargv[50], *ncom, *na, *nxtarg(); - - ac = argc; - av = argv; - if (ac<2) return; - ap = 1; - if (exp()) { - np = 0; - while (na=nxtarg()) - nargv[np++] = na; - nargv[np] = 0; - if (np==0) return; - execv(nargv[0], nargv, np); - i = 0; - ncom = "/usr/bin/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; - while(c=nargv[0][i]) { - ncom[9+i++] = c; - } - ncom[9+i] = '\0'; - execv(ncom+4, nargv, np); - execv(ncom, nargv, np); - write(1, "no command\n", 11); - seek(0, 0, 2); - } -} - -char *nxtarg() { - - if (ap>ac) return(0*ap++); - return(av[ap++]); -} - -exp(s) { - int p1; - - p1 = e1(); - if (eq(nxtarg(), "-o")) return(p1 | exp()); - ap--; - return(p1); -} - -e1() { - int p1; - - p1 = e2(); - if (eq(nxtarg(), "-a")) return (p1 & e1()); - ap--; - return(p1); -} - -e2() { - if (eq(nxtarg(), "!")) - return(!e3()); - ap--; - return(e3()); -} - -e3() { - int p1; - char *a; - - if ((a=nxtarg())==0) goto err; - if(eq(a, "(")) { - p1 = exp(); - if(!eq(nxtarg(), ")")) goto err; - return(p1); - } - - if(eq(a, "-r")) - return(tio(nxtarg(), 0)); - - if(eq(a, "-w")) - return(tio(nxtarg(), 1)); - - if(eq(a, "-c")) - return(tcreat(nxtarg())); - - p1 = nxtarg(); - if (p1==0) goto err; - if(eq(p1, "=")) - return(eq(a, nxtarg())); - - if(eq(p1, "!=")) - return(!eq(a, nxtarg())); -err: - write(1, "if error\n", 9); - exit(); -} - -tio(a, f) { - - a = open(a, f); - if (a>=0) { - close(a); - return(1); - } - return(0); -} - -tcreat(a) { - return(1); -} - -eq(a, b) -char *a, *b; -{ - int i; - - i = 0; -l: - if(a[i] != b[i]) - return(0); - if(a[i++] == '\0') - return(1); - goto l; -} -targ(), 0)); - - if(eq(a, "-w")) - return(tio(nxtarg(), 1)); - - if(eq(a, "-c")) - return(tcreat(nxtarg())); - - p1 = nxtarg(); - if (p1==0) goto err; - if(eq(p1, "=")) - return(eq(a, nxtarg())); - - if(eq(p1, "!=")) - return(!eq(a, nxtarg())); -err: - write(1, "if error\n", 9); - exit(); -} - -tio(a, f) { - - a = open(a, f); - if (a>=0) { - close(a); - return(1); - } - return(0); -} - -tcreat(a) { - return(1); -} - -eq(a, b) -char *a, *b; -{ - int i; - - i = 0; -l: - if(a[i] != b[i]) diff --git a/cmd/init.s b/cmd/init.s deleted file mode 100644 index 6c74930063..0000000000 --- a/cmd/init.s +++ /dev/null @@ -1,212 +0,0 @@ -/ init -- process control initialization - - - - sys intr; 0 - sys quit; 0 - sys 38. / get console switches - cmp r0,$173030 - bne 1f -help: - clr r0 - sys close - mov $1,r0 - sys close - sys open; ctty; 0 - sys open; ctty; 1 - sys exec; shell; shellp - br help -1: - sys mount; rk1; usr - sys mount; rk2; ssys - sys mount; rk3; crp - mov $'0,r1 -1: - movb r1,tapx+8 - sys chmod; tapx; 17 - inc r1 - cmp r1,$'8 - blo 1b - sys creat; utmp; 16 - sys close - sys unlink; dpdlock - sys fork - br daemon - sys fork - br dirass - sys fork - br dds - movb $'x,zero+8. - jsr pc,wtmprec - mov $itab,r1 - br 1f - -daemon: - sys exec; etcdpd; etcdpdp - sys exit - -dirass: - sys chdir; usrmel - sys exec; melda; meldap - sys exit - -dds: - sys exec; usrdd; usrddp - sys exit - -/ create shell processes - -1: - mov (r1)+,r0 - beq pwait - movb r0,ttyx+8 - jsr pc,dfork - mov r0,(r1)+ - br 1b - -/ wait for process to die - -pwait: - sys wait - mov $itab,r1 - -/ search for process id - -2: - tst (r1)+ - beq pwait - cmp r0,(r1)+ - bne 2b - -/ take name out of utmp - - sub $4,r1 - mov r1,-(sp) - mov (r1),r1 - sub $'0,r1 - cmp r1,$'a-'0 - blo 2f - sub $'a-'0-10.,r1 / map a-z into 10. on -2: - asl r1 - asl r1 - asl r1 - asl r1 - mov r1,0f - mov $zero,r1 -2: - clr (r1)+ - cmp r1,$zero+16. - blo 2b - sys open; utmp; 1 - bes 2f - mov r0,r1 - sys seek; 0:..; 0 - mov r1,r0 - sys write; zero; 16. - mov r1,r0 - sys close - -/ re-create user process - -2: - mov (sp)+,r1 - mov (r1)+,r0 - movb r0,ttyx+8 - movb r0,zero+8. - jsr pc,wtmprec - jsr pc,dfork - mov r0,(r1)+ - br pwait - -dfork: - sys fork - br 1f - bes dfork - rts pc -1: - sys quit; 0 - sys intr; 0 - sys chown; ttyx; 0 - sys chmod; ttyx; 15 - sys open; ttyx; 0 - bes help1 - sys open; ttyx; 1 - bes help1 - sys exec; getty; gettyp - sys exit / HELP! - -help1: - jmp help - -wtmprec: - mov r1,-(sp) - sys time - mov r0,zero+10. - mov r1,zero+12. - sys open; wtmp; 1 - bes 2f - mov r0,r2 - sys seek; 0; 2 - mov r2,r0 - sys write; zero; 16. - mov r2,r0 - sys close -2: - mov (sp)+,r1 - rts pc - -etcdpdp: - etcdpd; 0 -meldap: - melda; 0 -usrddp: - usrdd; 0 -usrdd: -melda: -usrmel: -rk1: -rk2: -rk3: -usr: -ssys: -crp: -ctty: -shell: -shellm: <-\0> -dpdlock: - -etcdpd: - -tapx: -utmp: -wtmp: -ttyx: -getty: - .even - -shellp: shellm - 0 -gettyp: getty - 0 -itab: - '0; .. - '1; .. - '2; .. - '3; .. - '4; .. - '5; .. - '6; .. - '7; .. - '8; .. - 'a; .. - 'b; .. - 0 - - .bss -offset: .=.+2 -zero: .=.+8.; .=.+6; .=.+2. - -srmel: -rk1: -rk2: -l.out: - -undmes: - -movemes: - -norel: - -toomany: - -multi: - -locovflo: - -relerr: - -premeof: - -outfile: - -fnotfound: - -format: - -snotfound: - -mulent: - - -libfil: - -wlib: - - <.a\0> -qnl: - <\n> -qsemi: - <;> - - .even - -dotdot: .. -zero: 0 -rlistp: rlist -esymp: symtab - -reltab: - zero - txtorg - datorg - bssorg - -arcmagic: - -147. - -magic: - br .+20 -txtsiz: .=.+2 -datsiz: .=.+2 -bsssiz: .=.+2 -symsiz: .=.+2 -stksiz: .=.+2 -exorig: .=.+2 -relflg: 1 - - .bss - -libflg: .=.+2 -sqflg: .=.+2 -entptr: .=.+2 -entry: .=.+2 -xtflg: .=.+2 -txtorg: .=.+2 -datorg: .=.+2 -bssorg: .=.+2 -fdatorg: .=.+2 -fbssorg: .=.+2 - -ctxtorg:.=.+2 -ctxtsiz:.=.+2 -cdatorg:.=.+2 -cdatsiz:.=.+2 -cbsssiz: .=.+2 -ctrelorg:.=.+2 -ctrelsiz:.=.+2 -cdrelorg:.=.+2 -cdrelsiz:.=.+2 -csymorg: .=.+2 -csymsiz: .=.+2 - -arcmag: .=.+42 - -argc: .=.+2 -argp: .=.+2 -oattpt: .=.+2 -locp: .=.+2 -locsymsiz:.=.+2 -fout: .=.+2 -fin: .=.+2 -reopened:.=.+2 -ndef: .=.+2 -ch: .=.+2 -filnam: .=.+2 -relbas: .=.+2 -libnxt: .=.+2 -symbol: .=.+14 - -txtp: .=.+10+512. -relp: .=.+10+512. -otxtp: .=.+6+512. -odatp: .=.+6+512. -osymp: .=.+6+512. -otrelp: .=.+6+512. -odrelp: .=.+6+512. - -rlist: .=.+512. -rliste: - -local: .=.+1024. -elocal: - -hshsiz = 1000. -hshtab: .=2*hshsiz+. - -symtab: -esymtab = orig+16384.-300. - -relorg:.=.+2 -cdrelsiz:.=.+2 -csymorg: .=.+2 -csymsiz: .=.+2 - -arcmag: .=.+42 - -argc: .=.+2 -argp: .=.+2 -oattpt: .=.+2 -locp: .=.+2 -locsymsiz:.=.+2 -fout: .=.+2 -fin: .=.+2 -reopened:.=.+2 -ndef: .=.+2 -ch: .=.+2 -filnam: .=.+2 -relbas: .=.+2 -libnxt: .=.+2 -symbol: .=.+14 - -txtp: .=.+10+512. -relp: .=.+10+512. -otxtp: .=.+6+512. -odatp: .=.+6+512. -osymp: .=.+6+512. -otrelp: .=.+6+512. -odrelp: .=.+6+512. - -rlist: .=.+512. -rliste: - -local: .=.+1024. -elocal: - -hshsiz = 1000. -hshtab: .=2*hshsiz+. - -symtab: -esymtab = orig+163 \ No newline at end of file diff --git a/cmd/ln.s b/cmd/ln.s deleted file mode 100644 index ed44eb7ecd..0000000000 --- a/cmd/ln.s +++ /dev/null @@ -1,55 +0,0 @@ -/ link command - -ln: - mov sp,r5 - cmp (r5)+,$2 - bhis 1f - sys exit -1: - beq 1f - tst (r5)+ - mov (r5)+,0f - mov (r5),0f+2 - br 2f -1: - tst (r5)+ - mov (r5),0f - mov (r5),r4 -1: - tstb (r4)+ - bne 1b -1: - cmpb -(r4),$'/ - beq 1f - cmp (r5),r4 - bne 1b - br err -1: - inc r4 - mov r4,0f+2 -2: - mov 0f,2f - sys stat; 2:..; stbuf - bes err - bit $40000,stbuf+2 - bne err - sys link; 0:..; .. - bes err - sys exit - -err: - mov $1,r0 - sys write; quest; 2 - sys exit - -quest: - - -.bss -stbuf: .=.+40. - -X - -reltm2: - .byte 0, 0, 0, 0, 0, 0 - .byte 0, M, \ No newline at end of file diff --git a/cmd/login.s b/cmd/login.s deleted file mode 100644 index 1cb388c3db..0000000000 --- a/cmd/login.s +++ /dev/null @@ -1,299 +0,0 @@ -/ login -- enter new user - -.globl ttyn -.globl crypt -.globl fopen -.globl getc -.globl mesg - - sys quit; 0 - sys intr; 0 - jsr pc,ttyn - movb r0,ttyx+8. - sub $'0,r0 - cmp r0,$'a-'0 - blo 1f - sub $'a-'0-10.,r0 / map a-z into 10. on -1: - asl r0 - asl r0 - asl r0 - asl r0 - mov r0,offset - mov (sp)+,r5 - tst (sp)+ - dec r5 - ble login - mov (sp)+,r4 - mov $uname,r1 -2: - movb (r4)+,(r1)+ - bne 2b - dec r5 - ble login - mov (sp)+,r4 - mov $passwd,r1 -2: - movb (r4)+,(r1)+ - bne 2b -login: - clrb uname+8. - mov $passwdf,r0 - jsr r5,fopen; pbuf - bec 1f - jsr r5,mesg; ; .even - sys exit -1: - jsr pc,guname -1: - jsr r5,compar; uname - br .+4 - br 2f -3: - jsr r5,getc; pbuf - bes sorry - cmp r0,$'\n - bne 3b - br 1b -sorry: - jsr r5,mesg; ; .even - mov pbuf,r0 - sys close - clr uname - clr passwd - br login -2: - jsr r5,getc; pbuf - cmp r0,$': - beq 2f - mov r0,-(sp) - jsr pc,gpasswd - cmpb (r0)+,(sp)+ - bne sorry - mov r0,0f - jsr r5,compar; 0:.. - br sorry -2: - clr r1 -2: - jsr r5,getc; pbuf - cmp r0,$': - beq 2f - mpy $10.,r1 - sub $'0,r0 - add r0,r1 - br 2b -2: - mov r1,0f - sys chown; ttyx; 0:.. - mov r1,uid -1: - jsr r5,getc; pbuf - cmp r0,$': - bne 1b / skip ident field - mov $dirbuf,r1 -1: - jsr r5,getc; pbuf - cmpb r0,$': - beq 1f - movb r0,(r1)+ - br 1b -1: - clrb (r1) - sys chdir; dirbuf - bec 1f - jsr r5,mesg; ; .even - br sorry -1: - mov $uname+8.,r1 -1: - tstb -(r1) - bne 1f - movb $' ,(r1) - br 1b -1: - cmpb ttyx+8.,$'x - beq 1f - sys open; utmp; 1 - bes 1f - mov r0,r2 - sys seek; offset:..; 0 - movb ttyx+8.,uname+8. - sys time - mov r0,uname+10. - mov r1,uname+12. - mov r2,r0 - sys write; uname; 16. - mov r2,r0 - sys close -1: - cmpb ttyx+8.,$'x - beq 1f - sys open; wtmp; 1 - bes 1f - mov r0,r1 - sys seek; 0; 2 - sys write; uname; 16. - mov r1,r0 - sys close -1: - jsr r5,getc; pbuf - cmp r0,$'\n - beq 1f - mov $shell,r1 -2: - movb r0,(r1)+ - jsr r5,getc; pbuf - cmp r0,$'\n - bne 2b - clrb (r1) -1: - mov pbuf,r0 - sys close - mov $motd,r0 - jsr r5,fopen; pbuf - bes 1f -2: - jsr r5,getc; pbuf - bes 1f - mov r0,uname - mov $1,r0 - sys write; uname; 1 - br 2b -1: - mov pbuf,r0 - sys close - sys stat; mailf; pbuf - bes 1f - tst pbuf+6 - beq 1f - jsr r5,mesg; ; .even -1: - mov uid,r0 - sys setuid - sys exec; shell; shellp - jsr r5,mesg; ; .even - sys exit - -gpasswd: - mov $passwd,r1 - tstb (r1) - bne 3f - clr r0 - sys gtty; ttyb - bic $10,ttyb+4 / turn off echo - clr r0 - sys stty; ttyb - jsr r5,mesg; ; .even -2: - jsr pc,tgetc - movb r0,(r1)+ - beq 1f - cmp r1,$passwd+9. - blo 2b - dec r1 - br 2b -1: - bis $10,ttyb+4 / turn on echo - clr r0 - sys stty; ttyb - jsr r5,mesg; <\n\0>; .even -3: - mov $passwd,r0 - jsr pc,crypt - clrb 8(r0) - rts pc - -guname: - mov $uname,r1 - tstb (r1) - bne 1f - clr (r1)+ - clr (r1)+ - clr (r1)+ - clr (r1)+ - mov $uname,r1 - jsr r5,mesg; ; .even -2: - jsr pc,tgetc - movb r0,(r1)+ - beq 1f - cmp r1,$uname+9. - blo 2b - dec r1 - br 2b -1: - rts pc - -compar: - mov (r5)+,r4 -1: - jsr r5,getc; pbuf - bes 2f - cmpb r0,(r4)+ - beq 1b - cmp r0,$': - bne 1f - tstb -(r4) - bne 1f - tst (r5)+ -1: - rts r5 -2: - tst (sp)+ - jmp sorry - -tgetc: - clr r0 - sys read; ch; 1 - tst r0 - bne 1f - sys exit -1: - mov ch,r0 - cmp r0,$'\n - bne 1f - clr r0 -1: - rts pc - -shellp: - mshell - 0 -utmp: -wtmp: -shell: ; .=shell+32. -mshell: <-\0> -motd: -mailf: -passwdf: -ttyx: -.even -.bss -uname: .=.+16. -passwd: .=.+8. -dirbuf: .=.+32. -shbuf: .=.+32. -ttyb: .=.+6 -uid: .=.+2 -ch: .=.+2 -pbuf: .=.+518. - -b - cmp r0,$': - bne 1f - tstb -(r4) - bne 1f - tst (r5)+ -1: - rts r5 -2: - tst (sp)+ - jmp sorry - -tgetc: - clr r0 - sys read; ch; 1 - tst r0 - bne 1f - sys exit diff --git a/cmd/ls.s b/cmd/ls.s deleted file mode 100644 index 1051ba2dbb..0000000000 --- a/cmd/ls.s +++ /dev/null @@ -1,633 +0,0 @@ -/ ls -- list file or directory - -.globl flush -.globl fopen -.globl getw -.globl getc -.globl putc -.globl ctime -.globl end - - sys break; end+512. - mov $1,obuf - mov sp,r5 - mov (r5)+,count - tst (r5)+ - dec count - mov count,ocount - bgt loop - mov $dotp,r5 -loop: - mov (r5)+,r4 - cmpb (r4)+,$'- - bne 1f - dec ocount -3: - movb (r4)+,r0 - beq eloop - cmp r0,$'l - bne 4f - inc longf - br 3b -4: - cmpb r0,$'t - bne 4f - mov $14.,sortoff - br 3b -4: - cmpb r0,$'a - bne 4f - inc allflg - br 3b -4: - cmpb r0,$'s - bne 4f - incb longf+1 - br 3b -4: - cmpb r0,$'d - bne 3b - inc dirflg - br 3b -1: - dec r4 - jsr pc,do -eloop: - dec count - bgt loop - tst dnp - bne 1f - mov $dotp,r5 - br loop -1: - jsr r5,flush; obuf - sys exit - -do: - clr tblocks - mov $end,r1 - mov $filnam,r3 - mov r4,dnp - clr isadir - tst dirflg - bne nondir - sys stat; dnp: 0; statb - bec 1f - jsr r5,questf; < nonexistent\n\0>; .even - rts pc -1: - bit $40000,statb+2 /test directory - beq nondir - inc isadir - mov r4,r0 - jsr r5,fopen; dbuf - bcc 1f - jsr r5,questf; < unreadable\n\0>; .even - rts pc -1: - movb (r4)+,(r3)+ - bne 1b - dec r3 - cmpb -1(r3),$'/ - beq 1f - movb $'/,(r3)+ -1: - jsr r5,getw; dbuf - bcs pass2 - mov $4,-(sp) - tst r0 - bne 2f -3: - jsr r5,getw; dbuf - dec (sp) - bne 3b - tst (sp)+ - br 1b -2: - mov r3,r2 -2: - jsr r5,getw; dbuf - mov r0,(r1)+ - movb r0,(r2)+ - swab r0 - movb r0,(r2)+ - dec (sp) - bne 2b - tst (sp)+ - clrb (r2)+ - tst allflg - bne 2f - cmpb (r3),$'. - bne 2f - sub $8.,r1 - br 1b -2: - jsr r5,gstat - br 1b -nondir: - mov r3,r2 -1: - movb (r4)+,(r2)+ - bne 1b -1: - cmp r2,r3 - blos 1f - cmpb -(r2),$'/ - bne 1b - inc r2 -1: - mov $8.,-(sp) -1: - movb (r2)+,(r1)+ - bne 2f - dec r2 -2: - dec (sp) - bne 1b - jsr r5,gstat - tst (sp)+ - -pass2: - mov dbuf,r0 - sys close - mov $end,r2 - cmp r1,r2 - bne 1f - rts pc -1: - mov r5,-(sp) - mov r1,-(sp) - add sortoff,r2 -1: - mov r2,(r1)+ - add $20.,r2 - cmp r2,(sp) - blo 1b - mov (sp),r2 - tst -(r1) -1: - mov r2,r3 -2: - tst (r3)+ - cmp r3,r1 - bhi 2f - mov (r2),r4 - mov (r3),r5 - tst sortoff - beq 4f - cmp (r4)+,(r5)+ - blo 3f - bhi 2b - cmp (r4)+,(r5)+ - blo 3f - br 2b -4: -4: - cmpb (r4)+,(r5)+ - bhi 3f - blo 2b - dec r0 - br 4b -3: - mov (r2),-(sp) - mov (r3),(r2) - mov (sp)+,(r3) - br 2b -2: - tst (r2)+ - cmp r2,r1 - blo 1b -1: - mov (sp)+,r2 - mov (sp)+,r5 - -pass3: - cmp ocount,$1 - ble 1f - tst isadir - beq 2f - mov dnp,0f - jsr r5,pstring; 0:.. - jsr r5,pstring; colon -1: - tst longf - beq 1f - jsr r5,pstring; totmes - mov tblocks,r0 - jsr r5,decimal; 4 - jsr r5,pstring; nl -2: - tstb longf - beq 1f - mov $passwd,r0 - jsr r5,fopen; iobuf - bes 1f - mov $uidbuf,r3 -3: -2: - jsr r5,getc; iobuf - bes 3f - movb r0,(r3)+ - cmpb r0,$': - bne 2b -2: - jsr r5,getc; iobuf - cmpb r0,$': - bne 2b -2: - jsr r5,getc; iobuf - cmpb r0,$': - beq 2f - movb r0,(r3)+ - br 2b -2: - movb $'\n,(r3)+ - cmp r3,$euidbuf - bhis 3f -2: - jsr r5,getc; iobuf - cmpb r0,$'\n - bne 2b - br 3b -3: - mov r3,euids - sys close -1: - cmp r2,r1 - bhi 1f - mov (r2)+,r3 - sub sortoff,r3 - jsr r5,pentry - mov $8.,-(sp) -2: - movb (r3)+,r0 - beq 2f - jsr r5,putc; obuf - dec (sp) - bne 2b -2: - tst (sp)+ - jsr r5,pstring; nl - br 1b -1: - cmp ocount,$1 - ble 1f - tst isadir - beq 1f - jsr r5,pstring; nl -1: - rts pc - -pentry: - mov r2,-(sp) - tstb longf - bne listl - tstb longf+1 - bne 2f - mov (sp)+,r2 - rts r5 -2: - mov 12.(r3),r0 - jsr r5,calcb - jsr r5,decimal; 3 - jsr r5,pstring; space - mov (sp)+,r2 - rts r5 -pstring: - mov r5,-(sp) - mov (r5),r5 -1: - movb (r5)+,r0 - beq 1f - jsr r5,putc; obuf - br 1b -1: - mov (sp)+,r5 - tst (r5)+ - rts r5 - -questf: - mov r4,0f - jsr r5,pstring; 0:.. - mov r5,0f - jsr r5,pstring; 0:.. -1: - tstb (r5)+ - bne 1b - inc r5 - bic $1,r5 - rts r5 -listl: - mov 18.(r3),r0 / inode - jsr r5,decimal; 4 - jsr r5,pstring; space - mov r3,r4 - add $8.,r4 / get to flags - bit $10000,(r4) /large - beq 2f - jsr r5,mode; 'l - br 3f -2: - jsr r5,mode; 's -3: - bit $40000,(r4) /directory - beq 2f - jsr r5,mode; 'd - br 3f -2: - bit $40,(r4) /set uid - beq 2f - jsr r5,mode; 'u - br 3f -2: - bit $20,(r4) /executable - beq 2f - jsr r5,mode; 'x - br 3f -2: - jsr r5,mode; '- -3: - bit $10,(r4) /read owner - beq 2f - jsr r5,mode; 'r - br 3f -2: - jsr r5, mode; '- -3: - bit $4,(r4) /write owner - beq 2f - jsr r5,mode; 'w - br 3f -2: - jsr r5,mode; '- -3: - bit $2,(r4) /read non-owner - beq 2f - jsr r5,mode; 'r - br 3f -2: - jsr r5,mode; '- -3: - bit $1,(r4)+ /write non-owner - beq 2f - jsr r5,mode; 'w - br 3f -2: - jsr r5,mode; '- -3: - jsr r5,pstring; space - movb (r4)+,r0 - jsr r5,decimal; 2 - movb (r4)+,r2 - jsr pc,puid - mov (r4)+,r0 - jsr r5,decimal; 5 - jsr r5,pstring; space - mov r1,-(sp) - mov (r4)+,r0 - mov (r4)+,r1 - sub $16.,sp - mov sp,r2 - jsr pc,ctime - mov sp,r2 - mov $15.,-(sp) -1: - movb (r2)+,r0 - jsr r5,putc; obuf - dec (sp) - bne 1b - add $18.,sp - mov (sp)+,r1 - jsr r5,pstring; space - mov (sp)+,r2 - rts r5 - -puid: - mov r1,-(sp) - mov $uidbuf,r1 -1: - cmp r1,euids - bhis 1f - mov r1,0f -2: - tstb (r1)+ - beq 3f - cmpb -1(r1),$': - bne 2b - clrb -1(r1) -3: - clr -(sp) -3: - movb (r1)+,r0 - sub $'0,r0 - cmp r0,$9. - bhi 3f - mov r1,-(sp) - mov 2(sp),r1 - mpy $10.,r1 - add r0,r1 - mov r1,2(sp) - mov (sp)+,r1 - br 3b -3: - mov (sp)+,r0 - cmp r0,r2 - bne 1b - jsr r5,pstring; space - jsr r5,pstring; 0:.. - mov 0b,r1 - mov $6,-(sp) -3: - tstb (r1)+ - beq 3f - dec (sp) - br 3b -3: - jsr r5,pstring; space - dec (sp) - bgt 3b - tst (sp)+ - mov (sp)+,r1 - rts pc -1: - jsr r5,pstring; space - mov r2,r0 - jsr r5,decimal; 3 - jsr r5,pstring; space3 - mov (sp)+,r1 - rts pc - -mode: - mov (r5)+,r0 - jsr r5,putc; obuf - rts r5 - - -gstat: - mov r1,-(sp) - add $512.,r1 - cmp r1,0f - blo 1f - mov r1,0f - sys break; 0: end+512. -1: - mov (sp)+,r1 - tst longf - bne 2f - tst sortoff - beq 1f -2: - sys stat; filnam; statb - bec 2f - mov r4,-(sp) - mov $filnam,r4 - jsr r5,questf; < unstatable\n\0>; .even - mov (sp)+,r4 - add $12.,r1 - rts r5 -2: - mov $statb+2,r0 - mov (r0)+,(r1)+ /flags - mov (r0)+,(r1)+ /nlinks, uid - mov r0,-(sp) - mov (r0),r0 - jsr r5,calcb - add r0,tblocks - mov (sp)+,r0 - mov (r0)+,(r1)+ /size - add $20.,r0 /dska, ctim - mov (r0)+,(r1)+ /mtim - mov (r0)+,(r1)+ - mov statb,(r1)+ /inode - rts r5 -1: - add $12.,r1 - rts r5 - -decimal: - mov r1,-(sp) - mov r2,-(sp) - mov r3,-(sp) - mov $6,r2 - mov $numbuf+6,r3 -1: - mov r0,r1 - clr r0 - dvd $10.,r0 - add $'0,r1 - movb r1,-(r3) - sob r2,1b -1: - cmp r3,$numbuf+5 - beq 1f - cmpb (r3),$'0 - bne 1f - movb $' ,(r3)+ - br 1b -1: - mov $numbuf+6,r1 - sub (r5),r1 - mov (r5)+,-(sp) -1: - movb (r1)+,r0 - jsr r5,putc; obuf - dec (sp) - bne 1b - tst (sp)+ - mov (sp)+,r3 - mov (sp)+,r2 - mov (sp)+,r1 - rts r5 - -calcb: - add $511.,r0 - clrb r0 - swab r0 - asr r0 - cmp r0,$8 - blo 1f - inc r0 -1: -1: - rts r5 - - -dotp: dot -euids: uidbuf - -dot: <.\0> -nl: <\n\0> -totmes: -space3: < > -space: < \0> -passwd: -colon: <:\n\0> - .even - -.bss - -count: .=.+2 -ocount: .=.+2 -longf: .=.+2 -sortoff: .=.+2 -allflg: .=.+2 -dirflg: .=.+2 -isadir: .=.+2 -filnam: .=.+32. -statb: .=.+34. -dbuf: .=.+518. -obuf: .=.+518. -numbuf: .=.+6 -tblocks: .=.+2 -uidbuf: .=.+1024. -euidbuf: -iobuf: .=.+518. - -(sp)+,r3 - mov (sp)+,r2 - mov (sp)+,r1 - rts r5 - -calcb: - add $511.,r0 - clrb r0 - swab r0 - asr r0 - cmp r0,$8 - blo 1f - inc r0 -1: -1: - rts r5 - - -dotp: dot -euids: uidbuf - -dot: <.\0> -nl: <\n\0> -totmes: -space3: < > -space: < \0> -passwd: -colon: <:\n\0> - .even - -.bss - -count: .=.+2 -ocount: .=.+2 -longf: .=.+2 -sortoff: .=.+2 -allflg: .=.+2 -dirflg: .=.+2 -isadir: .=.+2 -filnam: .=.+32. -statb: .=.+34. -dbuf: .=.+518. -obuf: .=.+518. -numbuf: .=.+6 -tblocks: .=.+2 -uidbuf: .=.+1024. -euidbuf: -iobuf: .=.+518. \ No newline at end of file diff --git a/lib/bsw.s b/lib/bsw.s deleted file mode 100644 index 9e6e0ca89d..0000000000 --- a/lib/bsw.s +++ /dev/null @@ -1,223 +0,0 @@ -/ crt -- c runtime routines - -.globl retrn -.globl bswitch -.globl _getchar -.globl _putchar -.globl _flush -.globl _fin -.globl _fout - -.globl _main -.globl getc -.globl putc -.globl flush - -start: - mov $mq,r4 - mov sp,r0 - mov (r0),-(sp) - tst (r0)+ - mov r0,2(sp) - jsr pc,*_main - clr r0 - sys exit - -retrn: - mov r5,sp - mov (sp)+,r5 - rts pc - -_getchar:.+2 -1: - jsr r5,getc; _fin - bcs 1f - tst r0 - beq 1b - rts pc -1: - clr r0 - rts pc - -_putchar:.+2 - mov 2(sp),r0 - tst _fout - bne 1f - mov $1,_fout -1: - jsr r5,putc; _fout - movb 3(sp),r0 - beq 1f - jsr r5,putc; _fout -1: - cmp _fout,$1 - bne 1f - jsr r5,flush; _fout -1: - mov 2(sp),r0 - rts pc - -_flush: - .+2 - jsr r5,flush; _fout - rts pc - -bswitch: - mov *(sp),r1 - mov r1,base - mov (r1),r2 / low - mov (r1)+,r3 / hi - mov $1,-(sp) / n - tst (r1)+ - bne 1f - 4 / n = 0 -1: - tst 2(r1) - beq 1f - cmp (r1),r2 - bhis 2f - mov (r1),r2 -2: - cmp (r1)+,r3 - blo 2f - mov -2(r1),r3 -2: - tst (r1)+ - inc (sp) - br 1b -1: - sub r2,r3 / spread - asl (sp) - inc r3 - cmp r3,(sp) - blo initd / if spread < 2*ncase direct - -initb: - clr (sp) / flag - mov base,r2 - mov r2,r3 - add $4,r3 -1: - cmp r3,r1 - bhis 1f - cmp (r2)+,(r3)+ - blos 2f - mov -(r2),-(sp) - mov -(r3),(r2)+ - mov (sp)+,(r3)+ - mov (r2),-(sp) - mov (r3),(r2) - mov (sp)+,(r3) - inc (sp) -2: - cmp (r2)+,(r3)+ - br 1b -1: - tst (sp) - bne initb - cmp (sp)+,(r1)+ - mov r1,-(sp) -1: - mov -(r1),2(r1) - cmp r1,base - bhi 1b - mov (sp)+,(r1) - mov $binary+4,r3 - br init - -initd: - mov (sp)+,r3 - mov r3,twon - mov r3,twona - mov r2,-(sp) / low - mov r3,-(sp) / 2*n -1: - mov base,r3 -2: - cmp (r3)+,r2 - beq 2f - tst (r3)+ - cmp r3,r1 - blo 2b - mov (r1),-(sp) / no match, default - br 3f -2: - mov (r3),-(sp) / match -3: - inc r2 - dec twon - bne 1b - add $4,r1 - add $2,twona -1: - mov (sp)+,-(r1) - dec twona - bne 1b - mov $direct+4,r3 - -init: - mov (sp)+,r2 - mov -(r3),-(r2) - mov -(r3),-(r2) - jmp (r2) - -direct: - jsr pc,*$1f - - -/ lowval; nval -/ l1; l2; ...; ln -/ ld - -1: - mov *(sp)+,r1 - sub (r1)+,r0 / low limit - cmp r0,(r1)+ / n cases - blo 1f - mov -(r1),r0 / default -1: - asl r0 - add r0,r1 - jmp *(r1)+ - -binary: - jsr pc,*$1f - -/ end -/ v1;l1; v2;l2; ...; vn;ln -/end: ld - -1: - mov *(sp)+,r1 / low - mov (r1)+,r2 / high - mov (r2),-(sp) / default - br 1f - -llo: - mov r3,r2 - br 1f -lhi: - mov r3,r1 - add $4,r1 -1: - mov r2,r3 - sub r1,r3 - beq 1f - asr r3 - bic $3,r3 - add r1,r3 - cmp r0,(r3) - bhi lhi - blo llo - tst (sp)+ - jmp *2(r3) -1: - rts pc - -.bss -base: .=.+2 -twon: .=.+2 -twona: .=.+2 -_fin: .=.+518. -_fout: .=.+518. - diff --git a/lib/chdir.s b/lib/chdir.s deleted file mode 100644 index 8d8e91e83a..0000000000 --- a/lib/chdir.s +++ /dev/null @@ -1,17 +0,0 @@ -/ C library -- chdir - -/ error = chdir(string); - - .globl _chdir - -.data -_chdir: - 1f -.text -1: - mov 2(sp),0f - clr r0 - sys chdir; 0:.. - adc r0 - rts pc - diff --git a/lib/chmod.s b/lib/chmod.s deleted file mode 100644 index eb3f2e71ed..0000000000 --- a/lib/chmod.s +++ /dev/null @@ -1,18 +0,0 @@ -/ C library -- chmod - -/ error = chmod(string, mode); - - .globl _chmod - -.data -_chmod: - 1f -.text -1: - mov 2(sp),0f - mov 4(sp),0f+2 - clr r0 - sys chmod; 0:..; .. - adc r0 - rts pc - diff --git a/lib/chown.s b/lib/chown.s deleted file mode 100644 index c8c71c7337..0000000000 --- a/lib/chown.s +++ /dev/null @@ -1,18 +0,0 @@ -/ C library -- chown - -/ error = chown(string, owner); - - .globl _chown - -.data -_chown: - 1f -.text -1: - mov 2(sp),0f - mov 4(sp),0f+2 - clr r0 - sys chown; 0:..; .. - adc r0 - rts pc - diff --git a/lib/close.s b/lib/close.s deleted file mode 100644 index a5463fab81..0000000000 --- a/lib/close.s +++ /dev/null @@ -1,18 +0,0 @@ -/ C library -- close - -/error = close(file); - - .globl _close - -.data -_close: - 1f -.text -1: - mov 2(sp),r0 - clr r1 - sys close - adc r1 - mov r1,r0 - rts pc - diff --git a/lib/creat.s b/lib/creat.s deleted file mode 100644 index 36fa040820..0000000000 --- a/lib/creat.s +++ /dev/null @@ -1,21 +0,0 @@ -/ C library -- creat - -/ file = creat(string, mode); -/ -/ file == -1 if error - - .globl _creat - -.data -_creat: - 1f -.text -1: - mov 2(sp),0f - mov 4(sp),0f+2 - sys creat; 0:..; .. - bec 1f - mov $-1,r0 -1: - rts pc - diff --git a/lib/crt0.s b/lib/crt0.s deleted file mode 100644 index c049e36000..0000000000 --- a/lib/crt0.s +++ /dev/null @@ -1,21 +0,0 @@ -/ C runtime startoff - -.globl retrn - -.globl _main - -start: - mov $mq,r4 - mov sp,r0 - mov (r0),-(sp) - tst (r0)+ - mov r0,2(sp) - jsr pc,*_main - clr r0 - sys exit - -retrn: - mov r5,sp - mov (sp)+,r5 - rts pc - diff --git a/lib/ctime.s b/lib/ctime.s deleted file mode 100644 index dd5d125bdb..0000000000 --- a/lib/ctime.s +++ /dev/null @@ -1,26 +0,0 @@ -/ C library -- ctime - -/ ctime(v1, v2); -/ v1 is input time [2] -/ v2 is char[16] ascii time -/ format is 0123456789012345 -/ Mmm dd hh:mm:sse -/ - -.globl _ctime -.globl ctime - -.data -_ctime: - 1f -.text -1: - mov 2(sp),r0 - mov (r0)+,-(sp) - mov (r0)+,mq - mov (sp)+,ac - mov 4(sp),r0 - clrb 15.(r0) - jsr pc,ctime - rts pc - diff --git a/lib/execl.s b/lib/execl.s deleted file mode 100644 index 8aafd4401e..0000000000 --- a/lib/execl.s +++ /dev/null @@ -1,19 +0,0 @@ -/ C library -- execl - -/ execl(file, arg1, arg2, ... , 0); -/ -/ - .globl _execl - -.data -_execl: - 1f -.text -1: - mov 2(sp),0f - mov sp,r0 - add $4,r0 - mov r0,0f+2 - sys exec; 0:..; .. - rts pc - diff --git a/lib/execv.s b/lib/execv.s deleted file mode 100644 index 0a48fd4abf..0000000000 --- a/lib/execv.s +++ /dev/null @@ -1,19 +0,0 @@ -/ C library -- execv - -/ execv(file, argv); -/ -/ where argv is a vector argv[0] ... argv[x], 0 -/ last vector element must be 0 -/ - .globl _execv - -.data -_execv: - 1f -.text -1: - mov 2(sp),0f - mov 4(sp),0f+2 - sys exec; 0:..; .. - rts pc - diff --git a/lib/exit.s b/lib/exit.s deleted file mode 100644 index 4c146e4c5a..0000000000 --- a/lib/exit.s +++ /dev/null @@ -1,15 +0,0 @@ -/ C library -- exit - -/ exit(code) -/ code is return in r0 to system - -.globl _exit - -.data -_exit: - 1f -.text -1: - mov 2(sp),r0 - sys exit - diff --git a/lib/fork.s b/lib/fork.s deleted file mode 100644 index 51a76f0fad..0000000000 --- a/lib/fork.s +++ /dev/null @@ -1,24 +0,0 @@ -/ C library -- fork - -/ pid = fork(); -/ -/ pid == 0 in child process; pid == -1 means error return - - .globl _fork - -.data -_fork: - 1f -.text -1: - sys fork - br 1f - bes 2f - rts pc -2: - mov $-1,r0 - rts pc -1: - clr r0 - rts pc - diff --git a/lib/fstat.s b/lib/fstat.s deleted file mode 100644 index 0fc2f97aea..0000000000 --- a/lib/fstat.s +++ /dev/null @@ -1,25 +0,0 @@ -/ C library -- fstat - -/ error = fstat(file, statbuf); - -/ int statbuf[17] or -/ char statbuf[34] -/ as appropriate - - .globl _fstat - -.data -_fstat: - 1f -.text -1: - mov 2(sp),r0 - mov 4(sp),0f - sys fstat; 0:.. - bec 1f - mov $1,r0 - rts pc -1: - clr r0 - rts pc - diff --git a/lib/getchr.s b/lib/getchr.s deleted file mode 100644 index 2cb4588b82..0000000000 --- a/lib/getchr.s +++ /dev/null @@ -1,24 +0,0 @@ -/ C library -- getchar - -.globl _getchar -.globl _fin - -.globl getc - -.data -_getchar: - 1f -.text -1: - jsr r5,getc; _fin - bcs 1f - tst r0 - beq 1b - rts pc -1: - clr r0 - rts pc - -.bss -_fin: .=.+518. - diff --git a/lib/getuid.s b/lib/getuid.s deleted file mode 100644 index 278e9e48e4..0000000000 --- a/lib/getuid.s +++ /dev/null @@ -1,21 +0,0 @@ -/ C library -- getuid - -/ uid = getuid(); -/ -/ uid == -1 if error - - .globl _getuid - -.data -_getuid: - 1f -.text -1: - sys getuid - bec 1f - mov $-1,r0 - rts pc -1: - bic $!377,r0 - rts pc - diff --git a/lib/gtty.s b/lib/gtty.s deleted file mode 100644 index 6a9d4c56f4..0000000000 --- a/lib/gtty.s +++ /dev/null @@ -1,24 +0,0 @@ -/ C library -- gtty - -/ error = gtty(filep, ttyvec); - -/ filep is descriptor of open tty -/ ttyvec[0, 1, 2] correspond to args of gtty - -.globl _gtty - -.data -_gtty: - 1f -.text -1: - mov 2(sp),r0 - mov 4(sp),0f - sys gtty; 0:.. - bes 1f - clr r0 - rts pc -1: - mov $1,r0 - rts r0 - diff --git a/lib/intr.s b/lib/intr.s deleted file mode 100644 index e39ad5b588..0000000000 --- a/lib/intr.s +++ /dev/null @@ -1,38 +0,0 @@ -/ C library -- intr - -/ intr(0); /* exit on interrupt */ -/ intr(anything_odd); /* ignore interrupts */ -/ intr(label); /* goto label on interrupts */ - - .globl _intr - -.data -_intr: - 1f -.text -1: - mov 2(sp),r0 - beq 1f - bit $1,r0 - beq 2f -1: - bic $1,r0 - mov r0,0f - sys intr; 0:.. - rts pc -2: - mov r5,9f - mov r0,9f+2 - sys intr; 1f - rts pc - -/ here on interrupts - -1: - mov 9f,r5 - jmp *9f+2 - -.bss -9: - .=.+4 - diff --git a/lib/link.s b/lib/link.s deleted file mode 100644 index 8116ee9172..0000000000 --- a/lib/link.s +++ /dev/null @@ -1,19 +0,0 @@ -/ C library -- link - -/ error = link(old-file, new-file); -/ - - .globl _link - -.data -_link: - 1f -.text -1: - mov 2(sp),0f - mov 4(sp),0f+2 - clr r0 - sys link; 0:..; .. - adc r0 - rts pc - diff --git a/lib/makdir.s b/lib/makdir.s deleted file mode 100644 index c925954489..0000000000 --- a/lib/makdir.s +++ /dev/null @@ -1,17 +0,0 @@ -/ C library -- makdir - -/ error = makdir(string); - - .globl _makdir - -.data -_makdir: - 1f -.text -1: - mov 2(sp),0f - clr r0 - sys makdir; 0:.. - adc r0 - rts pc - diff --git a/lib/open.s b/lib/open.s deleted file mode 100644 index 8f829ec458..0000000000 --- a/lib/open.s +++ /dev/null @@ -1,21 +0,0 @@ -/ C library -- open - -/ file = open(string, mode) -/ -/ file == -1 means error - - .globl _open - -.data -_open: - 1f -.text -1: - mov 2(sp),0f - mov 4(sp),0f+2 - sys open; 0:..; .. - bec 1f - mov $-1,r0 -1: - rts pc - diff --git a/lib/printf.c b/lib/printf.c deleted file mode 100644 index aecf96e3bd..0000000000 --- a/lib/printf.c +++ /dev/null @@ -1,58 +0,0 @@ -printn(n,b) { - extern putchar; - auto a; - - if(a=n/b) /* assignment, not test for equality */ - printn(a, b); /* recursive */ - putchar(n%b + '0'); -} - -printf(fmt,x1,x2,x3,x4,x5,x6,x7,x8,x9) - char fmt[]; - { - extern printn, putchar; - char s[]; - auto adx[], x, c; - - adx = &x1; /* argument pointer */ -loop: - while((c = *fmt++) != '%') { - if(c == '\0') - return; - putchar(c); - } - x = *adx++; - switch (c = *fmt++) { - - case 'd': /* decimal */ - case 'o': /* octal */ - if(x < 0) { - x = -x; - if(x<0) { /* is - infinity */ - if(c=='o') - printf("100000"); - else - printf("-32768"); - goto loop; - } - putchar('-'); - } - printn(x, c=='o'?8:10); - goto loop; - - case 'c': /* char */ - putchar(x); - goto loop; - - case 's': /* string */ - s = x; - while(c = *s++) - putchar(c); - goto loop; - } - putchar('%'); - fmt--; - adx--; - goto loop; -} - diff --git a/lib/printf.s b/lib/printf.s deleted file mode 100644 index d15b150115..0000000000 --- a/lib/printf.s +++ /dev/null @@ -1,122 +0,0 @@ -.globl _printn -.data; _printn:1f -.text; 1:mov r5,-(sp); mov sp,r5 -tst -(sp) -mov 4(r5),(r4) -mov 6(r5),div -mov (r4),r0 -mov r0,-2(r5) -bne l2 -jmp l1 -l2:mov 6(r5),-(sp) -mov -2(r5),-(sp) -jsr pc,*_printn -cmp (sp)+,(sp)+ -l1:mov 4(r5),(r4) -mov 6(r5),div -mov ac,r0 -mov r0,-(sp) -add $60,(sp) -jsr pc,*_putchar -tst (sp)+ -jmp retrn -.globl _printf -.data; _printf:1f -.text; 1:mov r5,-(sp); mov sp,r5 -add $-10,sp -mov r5,r0 -add $6,r0 -mov r0,-4(r5) -.data; l3: 1f; .text; 1: -l4:mov 4(r5),r0 -inc 4(r5) -movb (r0),r0 -mov r0,-10(r5) -cmp r0,$45 -bne l6 -jmp l5 -l6:tst -10(r5) -beq l8 -jmp l7 -l8:jmp retrn -l7:mov -10(r5),-(sp) -jsr pc,*_putchar -tst (sp)+ -jmp l4 -l5:mov -4(r5),r0 -add $2,-4(r5) -mov (r0),-6(r5) -mov 4(r5),r0 -inc 4(r5) -movb (r0),r0 -mov r0,-10(r5) -jsr pc,bswitch; l9 -l10:l11:tst -6(r5) -blt l13 -jmp l12 -l13:mov -6(r5),r0 -neg r0 -mov r0,-6(r5) -tst -6(r5) -blt l15 -jmp l14 -l15:cmp -10(r5),$157 -beq l17 -jmp l16 -l17:.data; l18: -.byte 61,60,60,60,60,60,0 -.even;.text -mov $l18,-(sp) -jsr pc,*_printf -tst (sp)+ -jmp l19 -l16:.data; l20: -.byte 55,63,62,67,66,70,0 -.even;.text -mov $l20,-(sp) -jsr pc,*_printf -tst (sp)+ -l19:jmp *l3 -l14:mov $55,-(sp) -jsr pc,*_putchar -tst (sp)+ -l12:cmp -10(r5),$157 -bne l21 -mov $10,-(sp) -br l22 -l21:mov $12,-(sp) -l22:mov -6(r5),-(sp) -jsr pc,*_printn -cmp (sp)+,(sp)+ -jmp *l3 -l23:mov -6(r5),-(sp) -jsr pc,*_putchar -tst (sp)+ -jmp *l3 -l24:mov -6(r5),-2(r5) -l25:mov -2(r5),r0 -inc -2(r5) -movb (r0),r0 -mov r0,-10(r5) -bne l27 -jmp l26 -l27:mov -10(r5),-(sp) -jsr pc,*_putchar -tst (sp)+ -jmp l25 -l26:jmp *l3 -l28:.data -l9:163; l24 -143; l23 -157; l11 -144; l10 -l28; 0 -.text -mov $45,-(sp) -jsr pc,*_putchar -tst (sp)+ -dec 4(r5) -mov -4(r5),r0 -sub $2,-4(r5) -jmp *l3 -jmp retrn diff --git a/lib/putchr.s b/lib/putchr.s deleted file mode 100644 index 627a8def1d..0000000000 --- a/lib/putchr.s +++ /dev/null @@ -1,46 +0,0 @@ -/ C library -- putchar - -/ char = putchar(char) - -/ buffer output if fout is not 1 - -.globl _putchar -.globl _fout -.globl _flush - -.globl putc -.globl flush - -.data -_putchar: - 1f -.text -1: - mov 2(sp),r0 - tst _fout - bne 1f - mov $1,_fout -1: - jsr r5,putc; _fout - movb 3(sp),r0 - beq 1f - jsr r5,putc; _fout -1: - cmp _fout,$1 - bne 1f - jsr r5,flush; _fout -1: - mov 2(sp),r0 - rts pc - -.data -_flush: - 1f -.text -1: - jsr r5,flush; _fout - rts pc - -.bss -_fout: .=.+518. - diff --git a/lib/read.s b/lib/read.s deleted file mode 100644 index d19129f91f..0000000000 --- a/lib/read.s +++ /dev/null @@ -1,22 +0,0 @@ -/ C library -- read - -/ nread = read(file, buffer, count); -/ -/ nread ==0 means eof; nread == -1 means error - - .globl _read - -.data -_read: - 1f -.text -1: - mov 2(sp),r0 - mov 4(sp),0f - mov 6(sp),0f+2 - sys read; 0:..; .. - bec 1f - mov $-1,r0 -1: - rts pc - diff --git a/lib/seek.s b/lib/seek.s deleted file mode 100644 index 17a126f6e3..0000000000 --- a/lib/seek.s +++ /dev/null @@ -1,23 +0,0 @@ -/ C library -- seek - -/ error = seek(file, offset, ptr); - - .globl _seek - -.data -_seek: - 1f -.text -1: - mov 2(sp),r0 - mov 4(sp),0f - mov 6(sp),0f+2 - sys seek; 0:..; .. - bec 1f - mov $1,r0 - rts r0 -1: - clr r0 - rts pc - - diff --git a/lib/setuid.s b/lib/setuid.s deleted file mode 100644 index c781cfab95..0000000000 --- a/lib/setuid.s +++ /dev/null @@ -1,20 +0,0 @@ -/ C library -- setuid - -/ error = setuid(uid); - - .globl _setuid - -.data -_setuid: - 1f -.text -1: - mov 2(sp),r0 - sys setuid - bec 1f - mov $1,r0 - rts pc -1: - clr r0 - rts pc - diff --git a/lib/stat.s b/lib/stat.s deleted file mode 100644 index 28e8d5ccd2..0000000000 --- a/lib/stat.s +++ /dev/null @@ -1,25 +0,0 @@ -/ C library -- stat - -/ error = stat(string, statbuf); - -/ int statbuf[17] or -/ char statbuf[34] -/ as appropriate - - .globl _stat - -.data -_stat: - 1f -.text -1: - mov 2(sp),0f - mov 4(sp),0f+2 - sys stat; 0:..; .. - bec 1f - mov $1,r0 - rts pc -1: - clr r0 - rts pc - diff --git a/lib/stty.s b/lib/stty.s deleted file mode 100644 index a3ba332870..0000000000 --- a/lib/stty.s +++ /dev/null @@ -1,24 +0,0 @@ -/ C library -- stty - -/ error = stty(filep, ttyvec); - -/ filep is descriptor of open tty -/ ttyvec[0, 1, 2] correspond to args of stty - -.globl _stty - -.data -_stty: - 1f -.text -1: - mov 2(sp),r0 - mov 4(sp),0f - sys stty; 0:.. - bes 1f - clr r0 - rts pc -1: - mov $1,r0 - rts pc - diff --git a/lib/switch.s b/lib/switch.s deleted file mode 100644 index 8dbdd819f6..0000000000 --- a/lib/switch.s +++ /dev/null @@ -1,18 +0,0 @@ -/ C library -- switch - -.globl bswitch - -bswitch: - mov *(sp)+,r1 -1: - cmp (r1)+,r0 - beq 1f - tst (r1)+ - bne 1b -2: - mov -4(r1),pc -1: - mov (r1)+,r0 - beq 2b - mov r0,pc - diff --git a/lib/time.s b/lib/time.s deleted file mode 100644 index ce774651b9..0000000000 --- a/lib/time.s +++ /dev/null @@ -1,19 +0,0 @@ -/ C library -- time - -/ tvec = time(tvec); -/ -/ tvec[0], tvec[1] contain the time - - .globl _time - -.data -_time: - 1f -.text -1: - mov 2(sp),r0 - sys time - mov ac,(r0) - mov mq,2(r0) - rts pc - diff --git a/lib/unlink.s b/lib/unlink.s deleted file mode 100644 index 3e0be93e55..0000000000 --- a/lib/unlink.s +++ /dev/null @@ -1,18 +0,0 @@ -/ C library -- unlink - -/ error = unlink(string); -/ - - .globl _unlink - -.data -_unlink: - 1f -.text -1: - mov 2(sp),0f - clr r0 - sys unlink; 0:.. - adc r0 - rts pc - diff --git a/lib/wait.s b/lib/wait.s deleted file mode 100644 index 66ecc310fb..0000000000 --- a/lib/wait.s +++ /dev/null @@ -1,30 +0,0 @@ -/ C library -- wait - -/ pid = wait(); -/ or, -/ pid = wait(&status); -/ -/ pid == -1 if error -/ status idicates fate of process, if given - - .globl _wait - -.data -_wait: - 1f -.text -1: - clr mq - sys wait - bec 1f - mov $-1,r0 - rts pc -1: - cmp *(sp),tstins / arg count - bne 1f - mov mq,*2(sp) / status return -1: - rts pc - -tstins: tst (sp)+ / stack pop for 1 arg - diff --git a/lib/write.s b/lib/write.s deleted file mode 100644 index 24f8b384d5..0000000000 --- a/lib/write.s +++ /dev/null @@ -1,22 +0,0 @@ -/ C library -- write - -/ nwritten = write(file, buffer, count); -/ -/ nwritten == -1 means error - - .globl _write - -.data -_write: - 1f -.text -1: - mov 2(sp),r0 - mov 4(sp),0f - mov 6(sp),0f+2 - sys write; 0:..; .. - bec 1f - mov $-1,r0 -1: - rts pc - diff --git a/man/man0/aa b/man/man0/aa new file mode 100644 index 0000000000..05ebc631e0 --- /dev/null +++ b/man/man0/aa @@ -0,0 +1,4 @@ +.na +.hc  +.in 16 +.fo ''- % -'' diff --git a/man/man0/basinf b/man/man0/basinf new file mode 100644 index 0000000000..461f45c6f1 --- /dev/null +++ b/man/man0/basinf @@ -0,0 +1,389 @@ +.hc  +.na +.fi +.fo ''- % -'' +.bp +.bl 2 +.ce +HOW TO GET STARTED + +This section provides the basic information +you need to get started on UNIX: +how to log in and log out, +how to communicate through your terminal, +and how to run a program. + +.ul +Logging in + +You must call UNIX from an appropriate terminal. +UNIX supports ASCII terminals typified by the TTY 37, +the GE Terminet 300, the Memorex 1240, and various +graphical terminals on the one hand, and IBM 2741-type +terminals on the other. + +To use UNIX, +you must have +a valid UNIX user name, +which may be obtained, together with the telephone number, from the system administrators. + +The same telephone number +serves terminals operating at all the standard speeds. +After a data connection is established, +the login procedure depends on what kind of terminal +you are using. + +.in 5 +.ul +TTY 37 terminal + +UNIX will type out "login: "; you respond with +your user name. +From the TTY 37 terminal, and any other which has the "new-line" +function (combined carriage return and linefeed), terminate each line you type with the +"new line" key (not___ the "return" key). + +.ul +300-baud terminals + +Such terminals include the GE Terminet 300, most display terminals, +Execuport, TI, and certain +Anderson-Jacobson terminals. +These terminals generally have a speed +switch which should be set at "300" (or "30" for +30 characters per second) +and a half/full duplex switch which should be set at +full-duplex. +(Note that this switch will often have to be changed +since MH-TSS requires half-duplex). +When a connection with UNIX is established, a few garbage +characters are typed (the login message at the wrong speed). +Depress the "break" key; +this is a speed-independent signal to UNIX that a 300-baud +terminal is in use. +UNIX will type "login: " at the correct speed; you type your +user name, followed by the "return" key. +Henceforth, the "return", "new line", or "linefeed" keys +will give exactly the same results. +Each line must be terminated with one of these keys; no one +is listening to you until the return is received. + +.ul +Selectric terminals + +From an IBM 2741 or the Anderson-Jacobson Selectric terminal, no message will appear. +After the data connection is established, +press the "return" key. +UNIX should type "login: " as described above. +If the greeting does not appear after a few seconds, +unlock the keyboard by switching the terminal +to local and back to remote, +and type "return". +If necessary, +hang up and try again; something has gone wrong. + +.in 0 +For all these terminals, it is important +that you type your name in lower case if possible; if you type +upper case letters, UNIX +will assume that your terminal cannot generate lower-case +letters and will translate all subsequent upper-case +letters to lower case. + +The evidence that you have successfully +logged in is that a UNIX program, the Shell, +will type a "%" to you. +(The Shell is described below under +"How to run a program". + +For more information, consult +getty(VII), which discusses the login sequence in more +detail, and dc(IV), which discusses typewriter I/O. + +.ul +Logging out + +There are three ways to log out: + +.in 5 +You can simply hang up the phone. +Hanging up is safe if you are at command level, +that is, if the Shell has just typed its prompt +signal "%". +It is also safe if you are in interactive system +programs, for example the editor. +It is unsafe if you are executing +a non-interactive program, or one of your own programs, +which either does not read the typewriter or ignores +the end-of-file indications which will result +from hanging up. +The reason is that UNIX, unlike most systems, does +not terminate a program simply because +it has been hung-up upon. + +You can log out by typing an end-of-file indication +(EOT character, control "d") to the Shell. +The Shell will terminate and the "login: " message +will appear again. + +You can also log in directly as another user +by giving a login command +(login (I)). + +.in 0 +.ul +How to communicate through your terminal + +When you type to UNIX, a gnome deep in the system +is gathering your characters and saving them in a secret +place. +The +characters will not be given to a program +until you type a return, as described above +in +.ul +Logging in. + +UNIX typewriter I/O is full-duplex (except for Selectric +terminals). +It has full read-ahead, which means that you can +type at any time, +even while a program is +typing at you. +Of course, if you type during output, the output will +have the input characters interspersed. +However, whatever you type will be saved +up and interpreted in correct sequence. + +There is a limit to the amount of read-ahead, +but it is generous and not likely to be exceeded unless +the system is in trouble. +When the read-ahead limit is exceeded, the system +stops echoing input characters, +and starts echoing "#" no matter what you typed. +The last character which was echoed correctly will be +received correctly by the program to which you were talking; +subsequent characters have been thrown away. + +On a typewriter input line, the character "@" +kills all the characters typed before it, so typing mistakes +can be repaired on a single line. +Also, the character "#" erases the last character typed. +Successive uses of "#" erase characters back to, but +not beyond, the beginning of the line. +"@" and "#" can be transmitted to a program +by preceding them with "\\". +(So, to erase "\\", you need two "#"s). + +The ASCII "delete" (a.k.a. "rubout") character is not passed to programs +but instead generates +an +.ul +interrupt signal. +This signal +generally causes whatever program +you are running to terminate. +It is typically used to stop a long printout that +you don't want. +However, programs can arrange either to ignore +this signal altogether, +or to be notified when it happens (instead +of being terminated). +The editor, for example, catches interrupts and +stops what it is doing, +instead of terminating, so that an interrupt can +be used to halt an editor printout without +losing the file being edited. + +The quit____ signal is generated +by typing the ASCII FS character. +It not only causes a running program to terminate +but also generates a file with the core image +of the terminated process. +Quit is useful +for debugging. + +Besides adapting to the speed of the terminal, +UNIX tries to be intelligent about whether +you have a terminal with the "new line" function +or whether it must be simulated with carriage-return +and line-feed. +In the latter case, all input carriage returns +are turned to new-line characters (the standard +line delimiter) +and both a carriage return and a line feed +are echoed to the terminal. +If you get into the wrong mode, the stty command +(I) will rescue you. + +Tab characters are used freely in UNIX source programs. +If your terminal does not have the tab function, +you can arrange to have them turned into spaces +during output, and echoed as spaces +during input. +The system assumes +that tabs are set every eight columns. +Again, the stty command (I) +will set or reset this mode. +Also, there is a file which, if printed on TTY 37 +or TermiNet 300 terminals, will set the tab stops +correctly (tabs(VII)). + +Section dc(IV) discusses typewriter I/O more fully. +Section kl(IV) discusses the console typewriter. + +.ul +How to run a program; The Shell + +When you have successfully logged into UNIX, a program +called the Shell is listening to your terminal. +The Shell reads typed-in lines, splits them up +into a command name and arguments, and executes the command. +A command is simply an executable program. +The Shell looks first in your current directory +(see next section) +for a program with the given name, +and if none is there, then in a system directory. +There is nothing special about system-provided +commands except that they are kept in a directory +where the Shell can find them. + +The command name is always the first word on an input line; +it and its arguments are separated from one another by +spaces. + +When a program terminates, the Shell will ordinarily regain control and type +a "%" at you to indicate that it is ready for another command. + +The Shell has many other capabilities, which are described in detail in section +sh(I). + +.ul +The current directory + +UNIX has a file system arranged in a hierarchy of directories. +When the system administrator gave you a user name, +he also created a directory for you (ordinarily +with the same name as your user name). +When you log in, any file +name you type is by default +in this directory. +Since you are the owner of this directory, you have +full permissions to read, write, alter, or destroy +its contents. +Permissions to have your will with other directories +and files will have been granted or denied to you +by their owners. +As a matter of observed fact, few UNIX users +protect their files from destruction, +let alone perusal, by other users. + +To change the +current directory (but not the set of permissions you +were endowed with at login) use chdir(I). + +.ul +Path names + +To reference files not in the current directory, you must +use a path name. + +Full path names begin with "/", the name of the root directory of the +whole file system. +After the slash comes the name of each directory containing the next +sub-directory (followed by a "/") until finally the +file name is reached. +E.g.: "/usr/lem/filex" refers to file "filex" in directory "lem"; "lem" +is itself a sub-directory of "usr"; "usr" springs directly from the root +directory. + +If your current directory has subdirectories, +the path names of files therein begin with +the name of the subdirectory (no prefixed "/"). + +Without important exception, +a path name may be used anywhere a file name is +required. + +Important commands which modify the contents of files +are cp(I), mv(I), and rm(I), +which respectively copy, move (i.e. rename) and remove files. +To find out the status of files or directories, use ls(I) and stat(I). +See mkdir(I) for making directories; rmdir(I) for destroying them. + +For a fuller discussion of the file system, see MM-71-1273-4. +It may also be useful to glance through +section II of this manual, which discusses +system calls, even if you don't intend +to deal with the system at the assembly-language level. + +.ul +Writing a program + +To enter the text of a source program into a UNIX file, use ed(I). +The three principal languages in UNIX are +assembly language (see as(I)), Fortran (see fc(I)), +and C (see cc(I)). +After the program text has been entered through +the editor +and written on a file, you can give the file +to the appropriate language processor as an argument. +The output of the language processor +will be left on a file in the current directory named "a.out". +(If the output is precious, use mv to move it to a less +exposed name soon.) +If you wrote in assembly language, you will probably +need to load the program with library subroutines; see +ld(I). The other two language processors call +the loader automatically. + +When you have finally gone through this entire process +without provoking any diagnostics, the resulting program +can be run by giving its name to the Shell +in response to the "%" prompt. + +The next command you will need is db(I). +As a debugger, db is better than average for +assembly-language programs, +marginally useful for C programs +(when completed, cdb(I) will be a boon), +and virtually useless for Fortran. + +Your programs can receive arguments from the command line +just as system programs do. For assembly language programs, +see exec(II). + +.ul +Text processing + +Almost all text is entered through the editor. +The commands most often used to write text on a terminal are: +cat(I), pr(I), roff(I), or nroff(I). + +The cat command simply dumps ASCII text +on the terminal, with no processing at all. +The pr command paginates the text and supplies headings. +The nroff command is an elaborate text formatting program, +and requires careful forethought +in entering both the text and the formatting commands +into the input file. +The roff command is a somewhat less elaborate formatting +program, and requires somewhat less forethought. + +.ul +Surprises + +Certain commands provide inter-user communication. +Even if you do not plan to use them, it would be +well to learn something about them, because someone else may +aim them at you. + +To communicate with another user currently logged in, +write(I) is used. To leave a message the presence of which will be +announced to another user when he next logs in, mail(I) +is used. +The write-ups in the manual also suggest how to respond to +the two commands if you are a target. + +When you log in, a message-of-the-day may greet you +before the first "%". diff --git a/man/man0/headrc b/man/man0/headrc new file mode 100644 index 0000000000..b994fbc16a --- /dev/null +++ b/man/man0/headrc @@ -0,0 +1,6 @@ +2s/.*/&&/ +s/'[^']*'// +s/'.he // +s/''/'/p +w +q diff --git a/man/man0/index b/man/man0/index new file mode 100644 index 0000000000..3952ebdf50 --- /dev/null +++ b/man/man0/index @@ -0,0 +1,746 @@ + 20boot(VIII): reboot 11/20 system + dp(IV): 201 Dataphone + 20boot(VIII): reboot 11/20 system + greek(VII): extended TTY 37 typebox map + dn(IV): 801 ACU + tm 9-track magtape + :(I): place label + a.out(V): assembler and loader output + chmod(I): change access mode of files + crypt(III): encrypt according to a keyword + wtmp(V): accounting files + acct(VIII): get connect-time accounting + acct(VIII): get connect-time accounting + dn(IV): 801 ACU + getty(VII): adapt to typewriter + chk(VIII): check all file systems + salloc(III): storage allocator + dup(II): duplicate an open file + yacc(VI): yet another compiler-compiler + mail(I): send mail to another user + write(I): write to another user + ar(I): archive (combine) files + archive(V): archive file + archive(V): archive file + atan(III): arctangent + glob(VII): argument expander + echo(I): print command arguments + ar(I): archive (combine) files + sort(I): sort ASCII file + atof(III): convert ASCII to floating + atoi(III): convert ASCII to integer + ascii(VII): map of ASCII + ascii(VII): map of ASCII + ctime(III): convert time to ASCII + convert floating to ASCII...ftoa(III): + itoa(III): convert integer to ASCII + as(I): assembler + a.out(V): assembler and loader output + as(I): assembler + sync(II): assure synchronization + atan(III): arctangent + atof(III): convert ASCII to floating + atoi(III): convert ASCII to integer + bc(VI): compile B program + log(III): logarithm base e + bas(I): BASIC dialect + bas(I): BASIC dialect + bc(VI): compile B program + dli(VIII): load DEC binary paper tapes + remove symbols, relocation bits...strip(I): + bj(VI): blackjack + bj(VI): blackjack + bproc(VIII): boot procedure + boot(II): reboot the system + bproc(VIII): boot procedure + split(I): break a file into pieces + break(II): set program break + break(II): set program break + istat(VIII): file status by i-number + cdb(I): C debugger + cc(I): compile C program + dc(I): desk calculator + cemt(II): catch EMT traps + fpe(II): catch floating exception errors + ilgins(II): catch illegal instruction trap + intr(II): catch or inhibit interrupts + cat(I): concatenate (or print) files + cc(I): compile C program + cdb(I): C debugger + cemt(II): catch EMT traps + chmod(I): change access mode of files + chmod(II): change mode of file + chown(I): change owner of files + chown(II): change owner of file + chdir(I): change working directory + chdir(II): change working directory + pipe(II): open inter process channel + ddsput(III): display character on Picturephone + putc(III): write character or word + getc(III): get character + chdir(I): change working directory + chdir(II): change working directory + chk(VIII): check all file systems + check(VIII): check consistency of file system + system... check(VIII): check consistency of file + chk(VIII): check all file systems + chmod(I): change access mode of files + chmod(II): change mode of file + chown(I): change owner of files + chown(II): change owner of file + clri(VIII): clear file's i-node + close(II): close open file + close(II): close open file + clri(VIII): clear file's i-node + cmp(I): compare file contents + ar(I): archive (combine) files + echo(I): print command arguments + sh(I): command interpreter + exit(I): end command sequence + goto(I): command transfer + if(I): conditional command + gerts(III): communicate with GCOS + tss(I): communicate with MH-TSS (GCOS) + cmp(I): compare file contents + compar(III): string compare for sort + proof(I): compare text files + compar(III): string compare for sort + bc(VI): compile B program + cc(I): compile C program + fc(I): compile Fortran program + sno(I): compile Snobol program + tmg(I): compile tmgl program + yacc(VI): yet another compiler-compiler + hypot(III): compute hypotenuse + cat(I): concatenate (or print) files + if(I): conditional command + acct(VIII): get connect-time accounting + check(VIII): check consistency of file system + csw(II): read the console switches + kl(IV): console typewriter + ls(I): list contents of directory + cmp(I): compare file contents + ecvt(III): edited output conversion + atof(III): convert ASCII to floating + atoi(III): convert ASCII to integer + ftoa(III): convert floating to ASCII + ftoo(III): convert floating to octal + itoa(III): convert integer to ASCII + ctime(III): convert time to ASCII + cp(I): copy file + core(V): core image file + mem(IV): core memory + core(V): core image file + sin(III): sine, cosine + wc(I): get (English) word count + cp(I): copy file + makdir(II): create directory + mkdir(I): create directory + creat(II): create file + fork(II): create new process + creat(II): create file + cref(I): cross reference table + cref(I): cross reference table + crypt(I): encrypt, decrypt a file + crypt(III): encrypt according to a keyword + csw(II): read the console switches + ctime(III): convert time to ASCII + dpd(VII): spawn dataphone daemon + salv(VIII): repair damaged file system + dpd(VII): spawn dataphone daemon + dp(IV): 201 Dataphone + date(I): get date and time of day + mdate(II): set date modified of file + date(I): get date and time of day + date(I): get date and time of day + db(I): symbolic debugger + dcheck(VIII): verify directory hierarchy + dc(I): desk calculator + dc(IV): remote typewriter + Picturephone... ddsput(III): display character on + cdb(I): C debugger + db(I): symbolic debugger + dli(VIII): load DEC binary paper tapes + crypt(I): encrypt, decrypt a file + tap(V): DECtape and magtape format + rew(I): rewind DECtape + save, restore files on DECtape...tap(I): + tc(IV): DECtape + sleep(II): delay execution + dsw(I): delete files interactively + rmdir(I): remove (delete) directory + rm(I): remove (delete) file + unlink(II): remove (delete) file + mesg(I): permit or deny messages + switch(III): transfer depending on value + dc(I): desk calculator + kill(II): destroy process + df(I): find free disk space + bas(I): BASIC dialect + directory(V): directory format + dcheck(VIII): verify directory hierarchy + directory(V): directory format + chdir(I): change working directory + chdir(II): change working directory + ls(I): list contents of directory + makdir(II): create directory + mkdir(I): create directory + rmdir(I): remove (delete) directory + df(I): find free disk space + du(I): find disk usage + rf(IV): RF disk + rk(IV): RK disk + umount(II): dismount file system + ddsput(III): display character on Picturephone + vt(IV): storage-tube display + dli(VIII): load DEC binary paper tapes + dn(IV): 801 ACU + dpd(VII): spawn dataphone daemon + dp(IV): 201 Dataphone + dsw(I): delete files interactively + du(I): find disk usage + od(I): octal dump of file + dup(II): duplicate an open file + dup(II): duplicate an open file + uniq(I): find duplicate lines in a file + echo(I): print command arguments + ecvt(III): edited output conversion + ed(I): text editor + ecvt(III): edited output conversion + ld(I): link editor (loader) + ed(I): text editor + fed(I): form letter editor + cemt(II): catch EMT traps + crypt(III): encrypt according to a keyword + crypt(I): encrypt, decrypt a file + exit(I): end command sequence + wc(I): get (English) word count + catch floating exception errors...fpe(II): + typo(I): find typographic errors + fpe(II): catch floating exception errors + exec(II): execute program file + size(I): get executable program size + exec(II): execute program file + times(II): get execution times + exit(II): terminate execution + sleep(II): delay execution + exit(I): end command sequence + exit(II): terminate execution + glob(VII): argument expander + exp(III): exponential function + exp(III): exponential function + greek(VII): extended TTY 37 typebox map + log(III): logarithm base e + factor(I): factor a number + factor(I): factor a number + fc(I): compile Fortran program + fed(I): form letter editor + cmp(I): compare file contents + split(I): break a file into pieces + opr(I): print file off-line + type(I): print file page-by-page + ov(I): page overlay file print + istat(VIII): file status by i-number + stat(I): get file status + stat(II): get file status + file system(V): file system format + chk(VIII): check all file systems + file system(V): file system format + check consistency of file system...check(VIII): + mount(II): mount file system + mount(VIII): mount removable file system + salv(VIII): repair damaged file system + umount(II): dismount file system + pr(I): print file with headings + clri(VIII): clear file's i-node + dsw(I): delete files interactively + tap(I): save, restore files on DECtape + mt(I): save, restore files on magtape + ar(I): archive (combine) files + concatenate (or print) files...cat(I): + change access mode of files...chmod(I): + chown(I): change owner of files + proof(I): compare text files + reloc(I): relocate object files + wtmp(V): accounting files + archive(V): archive file + chmod(II): change mode of file + chown(II): change owner of file + close(II): close open file + core(V): core image file + cp(I): copy file + creat(II): create file + crypt(I): encrypt, decrypt a file + dup(II): duplicate an open file + exec(II): execute program file + fstat(II): status of open file + link(II): link to file + ln(I): link to file + set date modified of file...mdate(II): + mv(I): move or rename file + od(I): octal dump of file + open(II): open file + passwd(V): password file + read(II): read file + rm(I): remove (delete) file + sort(I): sort ASCII file + sum(I): sum file + find duplicate lines in a file...uniq(I): + unlink(II): remove (delete) file + write(II): write file + du(I): find disk usage + uniq(I): find duplicate lines in a file + df(I): find free disk space + hyphen(I): find hyphenated words + tty(I): find name of terminal + ttyn(III): find teletype name + typo(I): find typographic errors + un(I): find undefined symbols + fpe(II): catch floating exception errors + ftoa(III): convert floating to ASCII + ftoo(III): convert floating to octal + atof(III): convert ASCII to floating + fork(II): create new process + fed(I): form letter editor + forml(I): generate form letters + form(I): generate form letter + nroff(I): format text for printing + roff(I): format text for printing + directory(V): directory format + file system(V): file system format + tap(V): DECtape and magtape format + form(I): generate form letter + forml(I): generate form letters + fc(I): compile Fortran program + fpe(II): catch floating exception errors + df(I): find free disk space + fstat(II): status of open file + ftoa(III): convert floating to ASCII + ftoo(III): convert floating to octal + exp(III): exponential function + communicate with MH-TSS (GCOS)...tss(I): + gerts(III): communicate with GCOS + forml(I): generate form letters + form(I): generate form letter + vs(I): generate voice synthesizer phonemes + pseudo random number generator...rand(III): + gerts(III): communicate with GCOS + getc(III): get character + acct(VIII): get connect-time accounting + date(I): get date and time of day + wc(I): get (English) word count + size(I): get executable program size + times(II): get execution times + stat(I): get file status + stat(II): get file status + ps(VIII): get process status + time(I): get time information + time(II): get time of year + gtty(II): get typewriter mode + getuid(II): get user ID + getc(III): get character + getty(VII): adapt to typewriter + getuid(II): get user ID + glob(VII): argument expander + goto(I): command transfer + greek(VII): extended TTY 37 typebox map + gtty(II): get typewriter mode + pr(I): print file with headings + verify directory hierarchy...dcheck(VIII): + hyphen(I): find hyphenated words + hyphen(I): find hyphenated words + hypot(III): compute hypotenuse + hypot(III): compute hypotenuse + clri(VIII): clear file's i-node + istat(VIII): file status by i-number + getuid(II): get user ID + setuid(II): set user ID + if(I): conditional command + ilgins(II): catch illegal instruction trap + ilgins(II): catch illegal instruction trap + core(V): core image file + uniq(I): find duplicate lines in a file + ptx(VI): permuted index + time(I): get time information + utmp(V): logged-in user information + intr(II): catch or inhibit interrupts + quit(II): inhibit quits + init(VII): initializer process + init(VII): initializer process + ilgins(II): catch illegal instruction trap + itoa(III): convert integer to ASCII + atoi(III): convert ASCII to integer + pipe(II): open inter process channel + dsw(I): delete files interactively + sh(I): command interpreter + intr(II): catch or inhibit interrupts + split(I): break a file into pieces + intr(II): catch or inhibit interrupts + istat(VIII): file status by i-number + itoa(III): convert integer to ASCII + encrypt according to a keyword...crypt(III): + kill(II): destroy process + kill(VIII): terminate a process + kl(IV): console typewriter + :(I): place label + ld(I): link editor (loader) + fed(I): form letter editor + forml(I): generate form letters + form(I): generate form letter + uniq(I): find duplicate lines in a file + ld(I): link editor (loader) + link(II): link to file + ln(I): link to file + link(II): link to file + ls(I): list contents of directory + nlist(III): read name list + ln(I): link to file + dli(VIII): load DEC binary paper tapes + a.out(V): assembler and loader output + ld(I): link editor (loader) + login(I): log on to system + log(III): logarithm base e + utmp(V): logged-in user information + log(III): logarithm base e + passwd(I): set login password + login(I): log on to system + nice(II): set low-priority status + ls(I): list contents of directory + m6(I): macroprocessor + m6(I): macroprocessor + tap(V): DECtape and magtape format + mt(I): save, restore files on magtape + tm 9-track magtape + mail(I): send mail to another user + mail(I): send mail to another user + makdir(II): create directory + man(I): run off manual section + man(I): run off manual section + ascii(VII): map of ASCII + extended TTY 37 typebox map...greek(VII): + mdate(II): set date modified of file + mem(IV): core memory + mem(IV): core memory + mesg(I): permit or deny messages + mesg(III): print string on typewriter + mesg(I): permit or deny messages + tss(I): communicate with MH-TSS (GCOS) + msh(VII): mini Shell + mkdir(I): create directory + chmod(I): change access mode of files + chmod(II): change mode of file + stty(II): set mode of typewriter + stty(I): set typewriter modes + gtty(II): get typewriter mode + mdate(II): set date modified of file + mount(II): mount file system + mount(VIII): mount removable file system + mount(II): mount file system + mount(VIII): mount removable file system + mv(I): move or rename file + seek(II): move read or write pointer + msh(VII): mini Shell + mt(I): save, restore files on magtape + mv(I): move or rename file + nlist(III): read name list + tty(I): find name of terminal + nm(I): print namelist + ttyn(III): find teletype name + fork(II): create new process + nice(II): set low-priority status + nlist(III): read name list + nm(I): print namelist + nroff(I): format text for printing + rand(III): pseudo random number generator + pow(III): take powers of numbers + factor(I): factor a number + reloc(I): relocate object files + od(I): octal dump of file + convert floating to octal...ftoo(III): + od(I): octal dump of file + man(I): run off manual section + opr(I): print file off-line + close(II): close open file + dup(II): duplicate an open file + fstat(II): status of open file + open(II): open file + pipe(II): open inter process channel + open(II): open file + opr(I): print file off-line + cat(I): concatenate (or print) files + ecvt(III): edited output conversion + assembler and loader output...a.out(V): + ov(I): page overlay file print + ov(I): page overlay file print + chown(I): change owner of files + chown(II): change owner of file + ov(I): page overlay file print + type(I): print file page-by-page + dli(VIII): load DEC binary paper tapes + pc(IV): punched paper tape + passwd(I): set login password + passwd(V): password file + passwd(V): password file + passwd(I): set login password + pc(IV): punched paper tape + mesg(I): permit or deny messages + ptx(VI): permuted index + generate voice synthesizer phonemes...vs(I): + vsp(VII): voice synthesizer phonemes + display character on Picturephone...ddsput(III): + split(I): break a file into pieces + pipe(II): open inter process channel + :(I): place label + seek(II): move read or write pointer + pow(III): take powers of numbers + pow(III): take powers of numbers + pr(I): print file with headings + echo(I): print command arguments + opr(I): print file off-line + type(I): print file page-by-page + pr(I): print file with headings + nm(I): print namelist + mesg(III): print string on typewriter + ptime(III): print time + cat(I): concatenate (or print) files + nroff(I): format text for printing + roff(I): format text for printing + ov(I): page overlay file print + bproc(VIII): boot procedure + pipe(II): open inter process channel + ps(VIII): get process status + rele(II): release processor + fork(II): create new process + init(VII): initializer process + kill(II): destroy process + kill(VIII): terminate a process + wait(II): wait for process + break(II): set program break + exec(II): execute program file + size(I): get executable program size + bc(VI): compile B program + cc(I): compile C program + fc(I): compile Fortran program + sno(I): compile Snobol program + tmg(I): compile tmgl program + proof(I): compare text files + rand(III): pseudo random number generator + ps(VIII): get process status + ptime(III): print time + ptx(VI): permuted index + pc(IV): punched paper tape + putc(III): write character or word + qsort(III): quicker sort + qsort(III): quicker sort + quit(II): inhibit quits + quit(II): inhibit quits + rand(III): pseudo random number generator + rand(III): pseudo random number generator + read(II): read file + nlist(III): read name list + seek(II): move read or write pointer + csw(II): read the console switches + read(II): read file + 20boot(VIII): reboot 11/20 system + boot(II): reboot the system + cref(I): cross reference table + rele(II): release processor + rele(II): release processor + reloc(I): relocate object files + strip(I): remove symbols, relocation bits + reloc(I): relocate object files + dc(IV): remote typewriter + mount(VIII): mount removable file system + rmdir(I): remove (delete) directory + rm(I): remove (delete) file + unlink(II): remove (delete) file + strip(I): remove symbols, relocation bits + mv(I): move or rename file + salv(VIII): repair damaged file system + tap(I): save, restore files on DECtape + mt(I): save, restore files on magtape + rew(I): rewind DECtape + rew(I): rewind DECtape + rf(IV): RF disk + rf(IV): RF disk + rk(IV): RK disk + rk(IV): RK disk + rmdir(I): remove (delete) directory + rm(I): remove (delete) file + roff(I): format text for printing + sqrt(III): square root + man(I): run off manual section + salloc(III): storage allocator + salv(VIII): repair damaged file system + tap(I): save, restore files on DECtape + mt(I): save, restore files on magtape + man(I): run off manual section + seek(II): move read or write pointer + mail(I): send mail to another user + speak(I): send words to voice synthesizer + exit(I): end command sequence + mdate(II): set date modified of file + passwd(I): set login password + nice(II): set low-priority status + stty(II): set mode of typewriter + break(II): set program break + stime(II): set system time + tabs(VII): set tab stops on typewriter + stty(I): set typewriter modes + setuid(II): set user ID + setuid(II): set user ID + msh(VII): mini Shell + sh(I): command interpreter + sin(III): sine, cosine + sin(III): sine, cosine + size(I): get executable program size + get executable program size...size(I): + sleep(II): delay execution + sno(I): compile Snobol program + sno(I): compile Snobol program + sort(I): sort ASCII file + sort(I): sort ASCII file + string compare for sort...compar(III): + qsort(III): quicker sort + df(I): find free disk space + dpd(VII): spawn dataphone daemon + speak(I): send words to voice synthesizer + split(I): break a file into pieces + sqrt(III): square root + sqrt(III): square root + stat(I): get file status + stat(II): get file status + istat(VIII): file status by i-number + fstat(II): status of open file + nice(II): set low-priority status + ps(VIII): get process status + stat(I): get file status + stat(II): get file status + stime(II): set system time + tabs(VII): set tab stops on typewriter + salloc(III): storage allocator + vt(IV): storage-tube display + compar(III): string compare for sort + mesg(III): print string on typewriter + strip(I): remove symbols, relocation bits + stty(I): set typewriter modes + stty(II): set mode of typewriter + sum(I): sum file + sum(I): sum file + csw(II): read the console switches + switch(III): transfer depending on value + db(I): symbolic debugger + strip(I): remove symbols, relocation bits + un(I): find undefined symbols + sync(II): assure synchronization + sync(II): assure synchronization + vs(I): generate voice synthesizer phonemes + vsp(VII): voice synthesizer phonemes + speak(I): send words to voice synthesizer + file system(V): file system format + stime(II): set system time + chk(VIII): check all file systems + file system(V): file system format + 20boot(VIII): reboot 11/20 system + boot(II): reboot the system + check consistency of file system...check(VIII): + login(I): log on to system + mount(II): mount file system + mount removable file system...mount(VIII): + repair damaged file system...salv(VIII): + umount(II): dismount file system + who(I): who is on the system + tabs(VII): set tab stops on typewriter + cref(I): cross reference table + tabs(VII): set tab stops on typewriter + pow(III): take powers of numbers + load DEC binary paper tapes...dli(VIII): + pc(IV): punched paper tape + tap(I): save, restore files on DECtape + tap(V): DECtape and magtape format + tc(IV): DECtape + ttyn(III): find teletype name + tty(I): find name of terminal + kill(VIII): terminate a process + exit(II): terminate execution + ed(I): text editor + proof(I): compare text files + nroff(I): format text for printing + roff(I): format text for printing + time(I): get time information + date(I): get date and time of day + time(II): get time of year + ctime(III): convert time to ASCII + time(I): get time information + time(II): get time of year + times(II): get execution times + times(II): get execution times + ptime(III): print time + stime(II): set system time + tm 9-track magtape + tmg(I): compile tmgl program + tmg(I): compile tmgl program + switch(III): transfer depending on value + goto(I): command transfer + cemt(II): catch EMT traps + catch illegal instruction trap...ilgins(II): + tss(I): communicate with MH-TSS (GCOS) + greek(VII): extended TTY 37 typebox map + tty(I): find name of terminal + ttyn(III): find teletype name + greek(VII): extended TTY 37 typebox map + type(I): print file page-by-page + stty(I): set typewriter modes + gtty(II): get typewriter mode + dc(IV): remote typewriter + getty(VII): adapt to typewriter + kl(IV): console typewriter + mesg(III): print string on typewriter + stty(II): set mode of typewriter + tabs(VII): set tab stops on typewriter + typo(I): find typographic errors + typo(I): find typographic errors + umount(II): dismount file system + un(I): find undefined symbols + un(I): find undefined symbols + uniq(I): find duplicate lines in a file + unlink(II): remove (delete) file + du(I): find disk usage + getuid(II): get user ID + setuid(II): set user ID + utmp(V): logged-in user information + mail(I): send mail to another user + write(I): write to another user + utmp(V): logged-in user information + transfer depending on value...switch(III): + dcheck(VIII): verify directory hierarchy + vs(I): generate voice synthesizer phonemes + vsp(VII): voice synthesizer phonemes + speak(I): send words to voice synthesizer + vs(I): generate voice synthesizer phonemes + vsp(VII): voice synthesizer phonemes + vt(IV): storage-tube display + wait(II): wait for process + wait(II): wait for process + wc(I): get (English) word count + who(I): who is on the system + who(I): who is on the system + gerts(III): communicate with GCOS + pr(I): print file with headings + tss(I): communicate with MH-TSS (GCOS) + wc(I): get (English) word count + speak(I): send words to voice synthesizer + hyphen(I): find hyphenated words + putc(III): write character or word + chdir(I): change working directory + chdir(II): change working directory + putc(III): write character or word + write(II): write file + seek(II): move read or write pointer + write(I): write to another user + write(I): write to another user + write(II): write file + wtmp(V): accounting files + yacc(VI): yet another compiler-compiler + time(II): get time of year + yacc(VI): yet another compiler-compiler diff --git a/man/man0/intro b/man/man0/intro new file mode 100644 index 0000000000..06ad6a806a --- /dev/null +++ b/man/man0/intro @@ -0,0 +1,280 @@ +.na +.bl 15 +.tr | +.in 0 +.ce +UNIX PROGRAMMER'S MANUAL + +.ce +Third Edition + + + +.ce 3 +K. Thompson + +D. M. Ritchie + + + + +.ce +February, 1973 +.sp 15 +.ce 7 +Copyright 8c9 1972 +Bell Telephone Laboratories, Inc. + +No part of this document may be reproduced, +or distributed outside the Laboratories, without +the written permission of Bell Telephone Laboratories. +.bp +.fo ''- % -'' +.ro +.bl 2 +.ce 2 +PREFACE +to the Third Edition + + +In the months since the last appearance of this manual, +many changes have occurred +both in the system itself and in the way it is +used. + +Perhaps most obviously, +there have been additions, deletions, and modifications +to the system and its software. +It is these changes, of course, that +caused the appearance of this revised manual. + +Second, the number of people spending +an appreciable amount +of time writing UNIX software has increased. +Credit is due +to L.|L.|Cherry, M.|D.|McIlroy, L.|E.|McMahon, R.|Morris, +J.|F.|Ossanna, +and E.|N.|Pinson +for their contributions. + +Finally, the number of UNIX installations +has grown to 16, with more expected. +None of these has exactly the same complement +of hardware or software. +Therefore, at any particular installation, +it is quite possible that this manual will +give inappropriate information. +.a + +In particular, +.ul 3 +any system which uses a PDP-11/20 +processor will not include all the software described +herein, nor will the software behave the same way. +The second, or even the first, edition +of this manual is likely to be more +appropriate. + +Besides additions, deletions, and +modifications to the writeups in each section, +this manual differs from its predecessors +in two ways: +all the commands used for system maintenance +and not intended for normal users have been moved +to a new section VIII; +and there is a new "How to Get Started" +chapter that gives some elementary facts +and many pointers to other sections. +.bp +.bl 2 +.ce +INTRODUCTION TO THIS MANUAL + + +This manual gives descriptions of the publicly available +features of UNIX. +It provides neither a general +overview (see "The UNIX Time-sharing System" for that) +nor details of the implementation of the system (which +remain to be disclosed). + +Within the area it surveys, this manual attempts +to be as complete and timely as possible. +A conscious +decision was made to describe each program +in exactly the state it was in at the time +its manual section +was prepared. +In particular, the +desire to describe something as it should be, not as it is, +was resisted. +Inevitably, this means that +many sections will soon be out of date. +(The rate of +change of the system is so great that a dismayingly +large number of early sections +had to be modified while the rest were being written. +The unbounded effort required to stay up-to-date +is best indicated by the fact that several of the programs +described were written specifically to aid in preparation +of this manual!) + +This manual is divided into +eight sections: + + I. Commands + II. System calls + III. Subroutines + IV. Special files + V. File formats + VI. User-maintained programs + VII. Miscellaneous + VIII. Maintenance + +Commands are programs intended to be invoked directly by +the user, in contradistinction to subroutines, which are +intended to be called by the user's programs. +Commands generally reside in directory /bin____ (for +bin___ary programs). This directory is searched automatically +by the command line interpreter. Some programs +classified as commands are located elsewhere; this +fact is indicated in the appropriate sections. + +System calls are entries into the UNIX supervisor. +In assembly language, they are coded with the use +of the opcode "sys", a synonym for the +trap____ instruction. + +A small assortment +of subroutines is available; +they are described in section III. +The binary form of most of them is kept in +the system library /usr/lib/liba.a. + +The special files section IV discusses the characteristics of +each system "file" which actually refers to an I/O device. +Unlike previous editions, the names in this +section refer to the DEC device names for the +hardware, +instead of the neames of +the special files themselves. + +The file formats section V documents the structure of particular +kinds of files; for example, the form of the output of the loader and +assembler is given. Excluded are files used by only one command, +for example the assembler's intermediate files. + +User-maintained programs (section VI) are not considered part +of the UNIX system, and the principal reason for +listing them is to indicate their existence without +necessarily giving a complete description. +The author should be consulted for information. + +The miscellaneous section (VII) gathers odds and ends. + +Section VIII discusses commands which are not intended +for use by the ordinary user, +in some cases because they disclose information +in which he is presumably not interested, +and in others because they perform +privileged functions. + + +Each section consists of a number of independent +entries of a page or so each. +The name of the entry is in the upper corners of its pages, +its preparation date in the upper middle. +Entries within each section are +alphabetized. +The page numbers of each entry start at 1. +(The earlier hope for frequent, partial +updates of the manual is clearly in vain, but +in any event it is not feasible to +maintain consecutive page numbering in a document +like this.) + +All entries have a common format. +.sp +.in 5 +The name____ section repeats the entry name and gives +a very short description of its purpose. + +The synopsis________ summarizes the use of the +program being described. +A few conventions are used, particularly in the +Commands section: + +.in 8 +Underlined words are considered literals, and +are typed just as they appear. + +Square brackets ([]) around an argument +indicate that the argument is optional. +When an argument is given as "name", it always +refers to a file name. + +Ellipses "..." are used to show that the previous argument-prototype +may be repeated. + +A final convention is used by the commands themselves. +An argument beginning with a minus sign "-" +is often taken to mean some sort of flag argument +even if it appears in a position where a file name +could appear. Therefore, it is unwise to have files +whose names begin with "-". + +.in 5 +The description___________ section discusses in detail the subject at hand. + +The files_____ section gives the names of files which are +built into the program. + +A see___ also____ section gives pointers to related information. + +A diagnostics___________ +section discusses +the diagnostics that may be produced. +This section tends to be as terse +as the diagnostics themselves. + +The bugs____ section gives +known bugs and sometimes deficiencies. +Occasionally also the suggested fix is +described. + +.in 0 +Previous edition of this manual had +an owner_____ section, which has been dropped from this +edition because the "owners" of many routines became +fairly hard to pin down. +The major contributors to UNIX, +(cast in order of appearance) +together with their login names and most notable contributions, +are + + ken K. Thompson (UNIX, many commands) + dmr D. M. Ritchie (many commands, as, ld, C) + jfo J. F. Ossanna (roff, nroff) + doug M. D. McIlroy (tmg, m6) + rhm R. Morris (dc, much of library) + lem L. E. McMahon (cref) + llc L. L. Cherry (form, fed, salloc) + csr C. S. Roberts (tss) + enp E. N. Pinson (proof) + +At the beginning of this document is a table of contents, +organized by section and alphabetically within each section. +There is also a permuted index derived from the table of contents. +Within each index entry, the title +of the writeup to which +it refers is followed by the appropriate section number in parentheses. +This fact is important because there is considerable +name duplication among the sections, +arising principally from commands which +exist only to exercise a particular system call. + + +This manual was prepared using the UNIX text +editor ed__ and the formatting program roff____. + +The assistance of R. Morris is gratefully acknowledged. diff --git a/man/man0/toc b/man/man0/toc new file mode 100644 index 0000000000..e1556e6dd7 --- /dev/null +++ b/man/man0/toc @@ -0,0 +1,257 @@ +.bp +.tr | +.bl 1 +.nf +.ta 30 +.tc . +.ce +TABLE OF CONTENTS + +I. COMMANDS + +.xx +: place label +ar archive (combine) files +as assembler +bas BASIC dialect +cat concatenate (or print) files +cc compile C program +cdb C debugger +chdir change working directory +chmod change access mode of files +chown change owner of files +cmp compare file contents +cp copy file +cref cross reference table +crypt encrypt, decrypt a file +date get date and time of day +db symbolic debugger +dc desk calculator +df find free disk space +dsw delete files interactively +du find disk usage +echo print command arguments +ed text editor +exit end command sequence +factor factor a number +fc compile Fortran program +fed form letter editor +form generate form letter +forml generate form letters +goto command transfer +hyphen find hyphenated words +if conditional command +ld link editor (loader) +ln link to file +login log on to system +ls list contents of directory +m6 macroprocessor +mail send mail to another user +man run off manual section +mesg permit or deny messages +mkdir create directory +mt save, restore files on magtape +mv move or rename file +nm print namelist +nroff format text for printing +od octal dump of file +opr print file off-line +ov page overlay file print +passwd set login password +pr print file with headings +proof compare text files +reloc relocate object files +rew rewind DECtape +rm remove (delete) file +rmdir remove (delete) directory +roff format text for printing +sh command interpreter +size get executable program size +sno compile Snobol program +sort sort ASCII file +speak send words to voice synthesizer +split break a file into pieces +stat get file status +strip remove symbols, relocation bits +stty set typewriter modes +sum sum file +tap save, restore files on DECtape +time get time information +tmg compile tmgl program +tss communicate with MH-TSS (GCOS) +tty find name of terminal +type print file page-by-page +typo find typographic errors +un find undefined symbols +uniq find duplicate lines in a file +vs generate voice synthesizer phonemes +wc get (English) word count +who who is on the system +write write to another user + + +II. SYSTEM CALLS + +.xx +boot reboot the system +break set program break +cemt catch EMT traps +chdir change working directory +chmod change mode of file +chown change owner of file +close close open file +creat create file +csw read the console switches +dup duplicate an open file +exec execute program file +exit terminate execution +fork create new process +fpe catch floating exception errors +fstat status of open file +getuid get user ID +gtty get typewriter mode +ilgins catch illegal instruction trap +intr catch or inhibit interrupts +kill destroy process +link link to file +makdir create directory +mdate set date modified of file +mount mount file system +nice set low-priority status +open open file +pipe open inter process channel +quit inhibit quits +read read file +rele release processor +seek move read or write pointer +setuid set user ID +sleep delay execution +stat get file status +stime set system time +stty set mode of typewriter +sync assure synchronization +time get time of year +times get execution times +umount dismount file system +unlink remove (delete) file +wait wait for process +write write file + + +III. SUBROUTINES + +.xx +atan arctangent +atof convert ASCII to floating +atoi convert ASCII to integer +compar string compare for sort +crypt encrypt according to a keyword +ctime convert time to ASCII +ddsput display character on Picturephone +ecvt edited output conversion +exp exponential function +ftoa convert floating to ASCII +ftoo convert floating to octal +gerts communicate with GCOS +getc get character +hypot compute hypotenuse +itoa convert integer to ASCII +log logarithm base e +mesg print string on typewriter +nlist read name list +pow take powers of numbers +ptime print time +putc write character or word +qsort quicker sort +rand pseudo random number generator +salloc storage allocator +sin sine, cosine +sqrt square root +switch transfer depending on value +ttyn find teletype name + + +IV. SPECIAL FILES + +.xx +dc remote typewriter +dn 801 ACU +dp 201 Dataphone +kl console typewriter +mem core memory +pc punched paper tape +rf RF disk +rk RK disk +tc DECtape +tm 9-track magtape +vt storage-tube display + + +V. FILE FORMATS + +.xx +a.out assembler and loader output +archive archive file +core core image file +directory directory format +file system file system format +passwd password file +tap DECtape and magtape format +utmp logged-in user information +wtmp accounting files + + +VI. USER MAINTAINED PROGRAMS + +.xx +bc compile B program +bj blackjack +ptx permuted index +yacc yet another compiler-compiler + + +VII. MISCELLANEOUS + +.xx +ascii map of ASCII +dpd spawn dataphone daemon +getty adapt to typewriter +glob argument expander +greek extended TTY 37 typebox map +init initializer process +msh mini Shell +tabs set tab stops on typewriter +vsp voice synthesizer phonemes + + +VIII. SYSTEM MAINTAINANCE + +.xx +20boot reboot 11/20 system +acct get connect-time accounting +bproc boot procedure +check check consistency of file system +chk check all file systems +clri clear file's i-node +dcheck verify directory hierarchy +dli load DEC binary paper tapes +istat file status by i-number +kill terminate a process +mount mount removable file system +ps get process status +salv repair damaged file system +su become super-user +swtmp truncate accounting files +tm get system time information +umount dismount removable file system +.xx +.bp +.bl 1 +.ce +INDEX + + +.nf +.tc +.ta 9 17 25 33 41 49 57 +.nx index diff --git a/man/man0/tocrc b/man/man0/tocrc new file mode 100644 index 0000000000..1163fe5fd5 --- /dev/null +++ b/man/man0/tocrc @@ -0,0 +1,17 @@ +ed toc +/\.xx/;//s/ /(I): / +/\.xx/;//s/ /(II): / +/\.xx/;//s/ /(III): / +/\.xx/;//s/ /(IV): / +/\.xx/;//s/ /(V): / +/\.xx/;//s/ /(VI): / +/\.xx/;//s/ /(VII): / +/\.xx/;//s/ /(VIII): / +g/\.xx/.-4,.d +g/^\./d +g/^$/d +$d +w xtoc +q +ptx xtoc index +rm xtoc diff --git a/man/man0/xx b/man/man0/xx new file mode 100644 index 0000000000..2c4180a77f --- /dev/null +++ b/man/man0/xx @@ -0,0 +1,22 @@ +.pa 1 +.he 'X'Y'X' +.ti 0 +NAME X +.sp +.ti 0 +SYNOPSIS X +.sp +.ti 0 +DESCRIPTION X +.sp +.ti 0 +FILES X +.sp +.ti 0 +SEE ALSO X +.sp +.ti 0 +DIAGNOSTICS X +.sp +.ti 0 +BUGS X diff --git a/man/man1/:.1 b/man/man1/:.1 new file mode 100644 index 0000000000..e4a1e3b81a --- /dev/null +++ b/man/man1/:.1 @@ -0,0 +1,26 @@ +.pa 1 +.he ': (I)'3/15/72': (I)' +.ti 0 +NAME : -- place a label +.sp +.ti 0 +SYNOPSIS :_ [ label ] +.sp +.ti 0 +DESCRIPTION :_ +does nothing. Its only function is to place +a label for the goto____ command. :_ is a command +so the Shell doesn't have to be fixed to ignore lines with +:'s. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO goto(I) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man1/ar.1 b/man/man1/ar.1 new file mode 100644 index 0000000000..9e882a212e --- /dev/null +++ b/man/man1/ar.1 @@ -0,0 +1,83 @@ +.pa 1 +.he 'AR (I)'3/15/72'AR (I)' +.ti 0 +NAME ar -- archive +.sp +.ti 0 +SYNOPSIS ar__ key afile name918 ... +.sp +.ti 0 +DESCRIPTION ar__ +maintains groups of files +combined into a single archive file. +Its main use +is to create and update library files as used by the loader. +It can be used, though, for any similar purpose. +.sp +key___ is one character from the set drtux_____, +optionally concatenated with v_. +afile_____ is the archive file. +The names_____ are constituent files in the archive file. +The meanings of the key___ characters are: +.sp +d_ means delete the named files from the archive file. +.sp +r_ means replace the named files in the archive file. +If the archive file does not exist, r_ will create it. +If the named files are not in the archive file, they are appended. +.sp +t_ prints a table of contents of the archive file. +If no names are given, all files in the archive are tabled. +If names are given, only those files are tabled. +.sp +u_ is similar to r_ except that only those +files that have been modified are replaced. +If no names are given, all files in the archive that +have been modified will be replaced by the modified version. +.sp +x_ will extract the named files. +If no names are given, all files in the archive are +extracted. +In neither case does x_ alter the archive file. +.sp +v_ means verbose. +Under the verbose option, +ar__ gives a file-by-file +description of the making of a +new archive file from the old archive and the constituent files. +The following abbreviations +are used: +.sp + c_ copy + a_ append + d_ delete + r_ replace + x_ extract +.sp +.ti 0 +FILES /tmp/vtm? temporary +.sp +.ti 0 +SEE ALSO ld(I), archive(V) +.sp +.ti 0 +DIAGNOSTICS "Bad usage", +"afile -- not in archive format", +"cannot open temp file", +"name -- cannot open", +"name -- phase error", +"name -- cannot create", +"no archive file", +"cannot create archive file", +"name -- not found". +.sp +.ti 0 +BUGS Option +vt__ should be implemented as a table with more information. +.sp +There should be a way to specify the placement +of a new file in an archive. +Currently, it is placed at the end. + +"ar x" changes the modified-date of the current +directory to a random number. diff --git a/man/man1/as.1 b/man/man1/as.1 new file mode 100644 index 0000000000..0755075cec --- /dev/null +++ b/man/man1/as.1 @@ -0,0 +1,89 @@ +.pa 1 +.he 'AS (I)'1/15/73'AS (I)' +.ti 0 +NAME as -- assembler +.sp +.ti 0 +SYNOPSIS as__ [ -_ ] name918 ... +.sp +.ti 0 +DESCRIPTION as__ +assembles the concatenation of name\d1\u, .... +If the optional first argument +-_ is used, +all undefined symbols in the assembly +are treated as global. + +The output of the assembly is left on the file "a.out". +It is executable if no errors occurred +during the assembly. + +.ti 0 +FILES /etc/as2 pass 2 of the assembler +.br +/tmp/atm1? temporary +.br +/tmp/atm2? temporary +.br +/tmp/atm3? temporary +.br +a.out object +.sp +.ti 0 +SEE ALSO ld(I), +nm(I), +un(I), +db(I), +a.out(V), +"UNIX Assembler Manual". +.sp +.ti 0 +DIAGNOSTICS When +an input file cannot be read, its name +followed by a question mark is typed and assembly +ceases. +When syntactic or semantic errors occur, a single-character diagnostic is typed out +together with the line number and the file name in which it +occurred. Errors in pass 1 cause cancellation of pass 2. +The possible errors are: +.sp +.in +6 +.ti -6 +) parentheses error +.ti -6 +] parentheses error +.ti -6 +< String not terminated properly +.ti -6 +* Indirection ("*_") used illegally +.ti -6 +.li +. Illegal assignment to "." +.ti -6 +A error in A_ddress +.ti -6 +B B_ranch instruction is odd or too remote +.ti -6 +E error in E_xpression +.ti -6 +F error in local ("F_" or "b") type symbol +.ti -6 +G G_arbage (unknown) character +.ti -6 +I End of file inside an If__ +.ti -6 +M M_ultiply defined symbol as label +.ti -6 +O O_dd-- word quantity assembled at odd address +.ti -6 +P P_hase error-- "." different in pass 1 and 2 +.ti -6 +R R_elocation error +.ti -6 +U U_ndefined symbol +.ti -6 +X syntaX_ error +.in -6 +.sp +.ti 0 +BUGS Symbol table overflow is not checked. diff --git a/man/man1/bas.1 b/man/man1/bas.1 new file mode 100644 index 0000000000..2bdaa5b13c --- /dev/null +++ b/man/man1/bas.1 @@ -0,0 +1,312 @@ +.pa 1 +.he 'BAS (I)'1/15/73'BAS (I)' +.ti 0 +NAME bas -- basic +.sp +.ti 0 +SYNOPSIS bas___ [ file ] +.sp +.ti 0 +DESCRIPTION bas___ +is a dialect of basic [1]. +If a file argument is provided, +the file is used for input before the console +is read. +.sp +bas___ accepts lines of the form: +.sp + statement + integer statement +.sp +Integer numbered statements +(known as internal statements) +are stored for later execution. +They are stored in sorted ascending order. +Non-numbered statements are immediately executed. +The result of an immediate expression statement +(that does not have '=' as its highest operator) is printed. +.sp +Statements have the following syntax: +.sp +.in +6 +.ti -3 +expression +.br +The expression is executed for its side +effects (assignment or function call) +or for printing as described above. +.sp +.ti -3 +done____ +.br +Return to system level. +.sp +.ti -3 +draw____ expression expression expression +.br +A line is drawn on the Tektronix 611 display (/dev/vt0) from +the current display position +to the XY co-ordinates specified by the +first two expressions. +(The scale is zero to one in both X and Y directions) +If the third expression +is zero, the line is invisible. +The current display position is set to the end point. +.sp +.ti -3 +display_______ list +.br +The list of expressions and strings is +concatenated and displayed (i.e. printed) on the 611 starting +at the current display position. +The current display position is not changed. +.sp +.ti -3 +erase_____ +.br +The 611 screen is erased. +.sp +.ti -3 +for___ name =_= expression expression statement +.ti -3 +for___ name =_ expression expression +.br +.li +... +.ti -3 +next____ +.br +The for___ statement +repetitively executes a +statement (first form) +or a group of statements (second form) +under control of a named variable. +The variable takes on the value of +the first expression, +then is incremented by one on each loop, +not to exceed the value of +the second expression. +.sp +.ti -3 +goto____ expression +.br +The expression is evaluated, truncated to an integer +and execution goes to the corresponding integer numbered statment. +If executed from immediate mode, +the internal statements are compiled first. +.sp +.ti -3 +if__ expression statement +.br +The statement is executed if the expression evaluates +to non-zero. +.sp +.ti -3 +list____ [expression [expression]] +.br +list____ is used to print out the stored internal statements. +If no arguments are given, all internal statements are printed. +If one argument is given, only that +internal statement is listed. +If two arguments are given, all internal statements +inclusively between the arguments are printed. +.sp +.ti -3 +print_____ list +.br +The list of expressions and strings are concatenated and +printed. +(A string is delimited by " characters.) +.sp +.ti -3 +return______ [expression] +.br +The expression is evaluated and the result is passed +back as the value of a function call. +If no expression is given, zero is returned. +.sp +.ti -3 +run___ +.br +The internal statements are compiled. +The symbol table is re-initialized. +The random number generator is re-set. +Control is passed to the lowest numbered internal +statement. +.sp +.ti -6 +Expressions have the following syntax: +.sp +.ti -3 +name +.br +A name is used to specify a variable. +Names are composed of a letter ('a' - 'z') +followed by letters and digits. +The first four characters of a name are significant. +.sp +.ti -3 +number +.br +A number is used to represent a constant value. +A number is composed of digits, at most one decimal point ('.') +and possibly a scale factor of the form +e_ digits or e-__ digits. +.sp +.ti -3 +(_ expression )_ +.br +Parentheses are used to alter normal order of evaluation. +.sp +.ti -3 +expression operator expression +.br +Common functions of two arguments are abbreviated +by the two arguments separated by an operator denoting the function. +A complete list of operators is given below. +.sp +.ti -3 +expression (_ [expression [,_ expression ...]] )_ +.br +Functions of an arbitrary number of arguments +can be called by an expression followed by the arguments +in parentheses separated by commas. +The expression evaluates to the +line number of the entry of the function in the +internally stored statements. +This causes the internal statements to be compiled. +If the expression evaluates negative, +a builtin function is called. +The list of builtin functions appears below. +.sp +.ti -3 +name [_ expression [,_ expression ...] ]_ +.br +Each expression is truncated to an integer +and used as a specifier for the name. +The result is syntactically identical to a name. +a[1,2] is the same as a[1][2]. +The truncated expressions are restricted to +values between 0 and 32767. +.sp +.ti -6 +The following is the list of operators: +.sp +.ti -3 += +.br += is the assignment operator. +The left operand must be a name or an array element. +The result is the right operand. +Assignment binds right to left, +all other operators bind left to right. +.sp +.ti -3 +& | +.br +&_ (logical and) +has result zero if either of its arguments are zero. +It has result one if both its arguments are non-zero. +|_ (logical or) +has result zero if both of its arguments are zero. +It has result one if either of its arguments are non-zero. +.sp +.ti -3 +< <= > >= == <> +.br +The relational operators +(< less than, <= less than or equal, +> greater than, +>= greater than or equal, +== equal to, +<> not equal to) +return one if their arguments are in the specified +relation. +They return zero otherwise. +Relational operators at the same level extend as follows: +a>b>c is the same as a>b&b>c. +.sp +.ti -3 ++ - +.br +Add and subtract. +.sp +.ti -3 +* / +.br +Multiply and divide. +.sp +.ti -3 +^ +.br +Exponentiation. +.sp +.ti -6 +The following is a list of builtin functions: +.sp +.ti -3 +arg +.br +Arg(i) is the value of the i_th +actual parameter on the current level +of function call. +.sp +.ti -3 +exp +.br +Exp(x) is the exponential function of x. +.sp +.ti -3 +log +.br +Log(x) is the logarithm base e of x. +.sp +.ti -3 +sin +.br +Sin(x) is the sine of x (radians). +.sp +.ti -3 +cos +.br +Cos(x) is the cosine of x (radians). +.sp +.ti -3 +atn +.br +Atn(x) is the arctangent of x. +.sp +.ti -3 +rnd +.br +Rnd() is a uniformly distributed random +number between zero and one. +.sp +.ti -3 +expr +.br +Expr() is the only form of program input. +A line is read from the input and +evaluated as an expression. +The resultant value is returned. +.sp +.ti -3 +int +.br +Int(x) returns x truncated to an integer. +.in -6 +.sp +.ti 0 +FILES /tmp/btm? temporary +.sp +.ti 0 +SEE ALSO [1] DEC-11-AJPB-D +.sp +.ti 0 +DIAGNOSTICS Syntax +errors cause the incorrect line to be typed +with an underscore where the parse failed. +All other diagnostics are self explanatory. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/cat.1 b/man/man1/cat.1 new file mode 100644 index 0000000000..f366ec7c63 --- /dev/null +++ b/man/man1/cat.1 @@ -0,0 +1,44 @@ +.pa 1 +.he 'CAT (I)'1/15/73'CAT (I)' +.ti 0 +NAME cat -- concatenate and print +.sp +.ti 0 +SYNOPSIS cat___ file918 ... +.sp +.ti 0 +DESCRIPTION cat___ +reads each file in sequence +and writes it on the standard output. +Thus: +.sp +.ti +3 +cat___ file____ +.sp +is about the easiest way to print a file. +Also: +.sp +.ti +3 +cat___ file1_____ file2_____ >file3______ +.sp +is about the easiest way to concatenate +files. +.sp +If no input file is given cat___ reads from the standard +input file. +.sp +If the argument "-" is encountered, cat reads from +the standard input file. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO pr(I), cp(I) +.sp +.ti 0 +DIAGNOSTICS none; +if a file cannot be found it is ignored. +.sp +.ti 0 +BUGS cat x y >x and cat x y >y cause strange results. diff --git a/man/man1/cc.1 b/man/man1/cc.1 new file mode 100644 index 0000000000..348a79e5a1 --- /dev/null +++ b/man/man1/cc.1 @@ -0,0 +1,52 @@ +.pa 1 +.he 'CC (I)'3/15/72'CC (I)' +.ti 0 +NAME cc -- C compiler +.sp +.ti 0 +SYNOPSIS cc__ [ -c__ ] sfile\d1\u.c__ ... ofile\d1\u ... +.sp +.ti 0 +DESCRIPTION cc__ +is the UNIX C compiler. +It accepts three types of arguments: + +Arguments whose names end with ".c" are assumed to be +C source programs; they are compiled, and +the object program is left on the file sfile\d1\u.o (i.e. +the file whose name is that of the source with ".o" substituted +for ".c"). + +Other arguments (except for "-c") are assumed +to be either loader flag arguments, or C-compatible +object programs, typically produced by an earlier cc__ run, +or perhaps libraries of C-compatible routines. +These programs, together with the results of any +compilations specified, are loaded (in the order +given) to produce an executable program with name +a.out_____. + +The "-c" argument suppresses the loading phase, as does +any syntax error in any of the routines being compiled. + +.ti 0 +FILES file.c input file +.nf +file.o object file +a.out loaded output +/tmp/ctm? temporary +/lib/c[01] compiler +/lib/crt0.o runtime startoff +/lib/libc.a builtin functions, etc. +/lib/liba.a system library +.fi +.sp +.ti 0 +SEE ALSO C reference manual (in preparation), cdb(I) +.sp +.ti 0 +DIAGNOSTICS Diagnostics +are intended to be self-explanatory. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/cdb.1 b/man/man1/cdb.1 new file mode 100644 index 0000000000..7a32353cc5 --- /dev/null +++ b/man/man1/cdb.1 @@ -0,0 +1,41 @@ +.pa 1 +.he 'CDB (I)'1/15/73'CDB (I)' +.ti 0 +NAME cdb -- C debugger +.sp +.ti 0 +SYNOPSIS cdb___ [ core [ a.out ] ] +.sp +.ti 0 +DESCRIPTION cdb___ +is a debugging program for use with C programs. +It is by no means completed, +and this section is essentially only a placeholder +for the actual description. + +Cdb resembles db__ in many respects, except that +all integers are decimal. + +Even the present cdb___ has one useful feature: +the command + + $ + +will give a stack +trace +of the core image of a terminated C program. +The calls are listed in the order made; +the actual arguments to each routine are given +in octal. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO cc(I), db(I), C Reference Manual +.sp +.ti 0 +DIAGNOSTICS "?" +.sp +.ti 0 +BUGS -- diff --git a/man/man1/chdir.1 b/man/man1/chdir.1 new file mode 100644 index 0000000000..a831350706 --- /dev/null +++ b/man/man1/chdir.1 @@ -0,0 +1,29 @@ +.pa 1 +.he 'CHDIR (I)'3/15/72'CHDIR (I)' +.ti 0 +NAME chdir -- change working directory +.sp +.ti 0 +SYNOPSIS chdir_____ directory +.sp +.ti 0 +DESCRIPTION directory_________ +becomes the new working directory. +.sp +Because a new process is created to execute each command, +chdir_____ would be ineffective if it were written as a +normal command. It is therefore recognized and executed +by the Shell. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO sh(I) +.sp +.ti 0 +DIAGNOSTICS "Bad directory" if the directory cannot +be changed to. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/chmod.1 b/man/man1/chmod.1 new file mode 100644 index 0000000000..c67cfca92d --- /dev/null +++ b/man/man1/chmod.1 @@ -0,0 +1,40 @@ +.pa 1 +.he 'CHMOD (I)'3/15/72'CHMOD (I)' +.ti 0 +NAME chmod -- change mode +.sp +.ti 0 +SYNOPSIS chmod_____ octal file918 ... +.sp +.ti 0 +DESCRIPTION The octal mode +replaces the mode of each of the files. +The mode is constructed from the OR of the +following modes: +.sp +.ti +3 +01 write for non-owner +.ti +3 +02 read for non-owner +.ti +3 +04 write for owner +.ti +3 +10 read for owner +.ti +3 +20 executable +.ti +3 +40 set-UID +.sp +Only the owner of a file may change its mode. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO stat(I), ls(I) +.sp +.ti 0 +DIAGNOSTICS "?" +.sp +.ti 0 +BUGS -- diff --git a/man/man1/chown.1 b/man/man1/chown.1 new file mode 100644 index 0000000000..9262195e9a --- /dev/null +++ b/man/man1/chown.1 @@ -0,0 +1,30 @@ +.pa 1 +.he 'CHOWN (I)'3/15/72'CHOWN (I)' +.ti 0 +NAME chown -- change owner +.sp +.ti 0 +SYNOPSIS chown_____ owner file918 ... +.sp +.ti 0 +DESCRIPTION owner_____ +becomes the new owner of the files. +The owner may be either a decimal UID or +a login name found in the password file. +.sp +Only the owner of a file is allowed to change the owner. +It is illegal to change the owner of a file with the set-user-ID +mode. +.sp +.ti 0 +FILES /etc/passwd +.sp +.ti 0 +SEE ALSO stat(I) +.sp +.ti 0 +DIAGNOSTICS "Who?" if owner cannot be found, +"file?" if file cannot be found. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/cmp.1 b/man/man1/cmp.1 new file mode 100644 index 0000000000..05113c093d --- /dev/null +++ b/man/man1/cmp.1 @@ -0,0 +1,30 @@ +.pa 1 +.he 'CMP (I)'1/15/73'CMP (I)' +.ti 0 +NAME cmp -- compare two files +.sp +.ti 0 +SYNOPSIS cmp___ file918 file928 +.sp +.ti 0 +DESCRIPTION The two files are +compared for identical contents. +Discrepancies are noted +by giving the offset and the differing words, +all in octal. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO proof(I) +.sp +.ti 0 +DIAGNOSTICS Messages +are given for inability to open either argument, premature +EOF on either argument, and incorrect usage. +.sp +.ti 0 +BUGS If +the shorter of the two files is of odd length, +cmp acts as if a null byte had been appended to it. diff --git a/man/man1/cp.1 b/man/man1/cp.1 new file mode 100644 index 0000000000..b1f61d9513 --- /dev/null +++ b/man/man1/cp.1 @@ -0,0 +1,34 @@ +.pa 1 +.he 'CP (I)'1/24/73'CP (I)' +.ti 0 +NAME cp -- copy +.sp +.ti 0 +SYNOPSIS cp__ file918 file928 +.sp +.ti 0 +DESCRIPTION The +first file is copied onto the second. +The mode and owner of the target file +are preserved if it already +existed; the mode of the source file +is used otherwise. +.sp +If file928 is a directory, then the target +file is a file in that directory with the file-name +of file918. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO cat(I), pr(I), mv(I) +.sp +.ti 0 +DIAGNOSTICS Error returns are +checked at every system call, and +appropriate diagnostics are produced. +.sp +.ti 0 +BUGS Copying +a file onto itself destroys its contents. diff --git a/man/man1/cref.1 b/man/man1/cref.1 new file mode 100644 index 0000000000..ffa705bb7c --- /dev/null +++ b/man/man1/cref.1 @@ -0,0 +1,119 @@ +.pa 1 +.he 'CREF (I)'2/5/1973'CREF (I)' +.fi +.in16 +.ti 0 +NAME cref -- make cross reference listing +.sp +.fi +.in16 +.ti 0 +SYNOPSIS cref____ [ -soi____ ] name1 ... +.sp +.fi +.in16 +.ti 0 +DESCRIPTION CREF makes a cross reference listing +of files in assembler format (see AS(I)). The files +named as arguments in the command +line are searched for symbols (defined as a succession +of alphabetics, numerics, '.', or '_', beginning with +an alphabetic, '.', or '_'). +.sp +The output report is in four columns: +.nf +.sp +(1) (2) (3) (4) +symbol file see text as it appears in file + below +.sp +.fi +The third column contains the line number in the file +by default; the -s__ option +will cause the most recent name symbol to appear there +instead. +.sp +CREF uses either an ignore______ file or an only____ file. +If the -i__ option is given, it will take the next +file name to be an ignore______ file; if the -o__ option +is given, the next file name will be taken as an only____ file. +Ignore______ and only____ +files should be lists of symbols separated by new lines. +If an ignore______ file is given, all the symbols in the file +will be ignored in columns (1) and (3) of the output. +If an only____ file is given, only symbols appearing in the +file will appear in column (1), but column (3) +will still contain the most recent name encountered. +Only one of the options -i__ or +-o__ may be used. +The default setting +is -i__; +all symbols predefined in the assembler are ignored, except +system call names, which are collected. +.sp +.fi +.in16 +.ti 0 +FILES Files t.0, t.1, t.2, t.3 are +created (i.e. DESTROYED) in the working +directory of anyone +using cref____. This nuisance will be repaired soon. +The output is left in file s.out_____ in the working directory. +.sp +/usr/lem/s.tab is the default ignore______ file. +.sp +.fi +.in16 +.ti 0 +SEE ALSO as(I) +.sp +.fi +.in16 +.ti 0 +DIAGNOSTICS "line too long" -- input line >131 characters +.nf +.sp +"symbol too long" -- symbol >20 characters +.sp +"too many symbols" -- >10 symbols in line +.sp +"cannot open t.?" -- bug; see LEM +.sp +"cannot fork; examine t.out" -- can't start sort____ +.in 20 +.fi +process; intermediate results are on files t.0___, +t.1___,t.2___,t.3___. These may be sorted independently +and the results concatenated by the user. +.sp +.in 16 +"cannot sort" -- odd response from sort____; examine +.in 20 +intermediate results, as above. +.sp +.in16 +.nf +"impossible situation" -- system bug +.sp +"cannot open" file -- one of the input names +.in 20 +.fi +cannot be opened for reading. +.in16 +.nf +.sp +.fi +.in16 +.ti 0 +BUGS The destruction of +unsuspecting users' files should soon be fixed. +A limitation that may eventually go away is the +restriction to assembler language format. There +should be options for FORTRAN, English, etc., lexical +analysis. +.sp +File names longer than eight characters cause misalignment in +the output if tabs are set at every eighth column. + +It should +write on the standard output, not s.out. diff --git a/man/man1/crypt.1 b/man/man1/crypt.1 new file mode 100644 index 0000000000..1f366e1d6f --- /dev/null +++ b/man/man1/crypt.1 @@ -0,0 +1,41 @@ +.pa 1 +.he 'CRYPT (I)'10/23/71'CRYPT (I)' +.ti 0 +NAME crypt -- encode/decode +.sp +.ti 0 +SYNOPSIS crypt_____ [ password ] +.sp +.ti 0 +DESCRIPTION crypt_____ +is an exact implementation of Boris Hagelin's +cryptographic machine called the M-209 by the U. S. Army [1]. + +crypt_____ reads from the standard input file and writes +on the standard output. +For a given password, the encryption +process is idempotent; +that is, + + crypt znorkle cypher + crypt znorkle (i. e., the character "new line") This command advances +the current location counter "." and prints the resulting +location in the mode last specified by +one of the above requests. +.br +.un 3 + +^ This character decrements "." and prints the +resulting location in the mode last selected +one of the above requests. It is a converse to . + +.un 3 +% Exit. +.sp +.in -6 +Odd addresses to word-oriented commands are rounded +down. +The incrementing and decrementing +of "." done by the and ^ requests is by one or +two depending on whether the last command +was word or byte oriented. +.sp +The address portion of any of the above commands +may be followed by a comma and then by an +expression. In this case that number of sequential +words or bytes specified by the expression is printed. +"." is advanced so that it points at the +last thing printed. +.sp +There are two commands to interpret the value +of expressions. +.sp +.in +6 +.un 3 += When preceded by an expression, the value of the expression +is typed in octal. +When not preceded by an expression, the value of "." is +indicated. +This command does not change the value of ".". +.br +.un 3 + +: An attempt is made to print the given expression +as a symbolic address. If the expression is relocatable, +that symbol is found whose value is nearest +that of the expression, and the symbol is typed, followed by +a sign and the appropriate offset. +If the value of the expression is absolute, a symbol +with exactly the indicated value is sought and +printed if found; if no matching symbol is discovered, the +octal value of the expression is given. +.sp +.in -6 +The following command may be used to patch the file being debugged. +.sp +.in +6 +.un 3 +! This command must be preceded by an expression. +The value of the expression is stored at the location +addressed by the current value of ".". +The opcodes do not appear in the symbol +table, so the user must assemble them by hand. + +.sp +.in -6 +The following command is used after a fault has caused +a core image file to be produced. +.sp +.in +6 +.un 3 +$ causes the fault type and +the contents of the general registers and +several other registers to be printed both in octal and symbolic +format. +The values are as they were at the time of the fault. +.sp +.in -6 +Db__ should not be used to examine special files, +for example disks and tapes, since it reads one byte +at a time. +Use od(I) instead. + +For some purposes, it is important to know how addresses +typed by the user correspond with +locations in the file being debugged. +The mapping algorithm employed by db__ is non-trivial +for two reasons: +First, in an a.out_____ file, there is a 20(8) byte header +which will not appear when the file is loaded into +core for execution. +Therefore, apparent location 0 should correspond +with actual file offset 20. +Second, some systems cause a "squashed" core +image to be written. +In such a core +image, addresses in the stack must be mapped +according to the degree of squashing +which has been employed. +Db__ obeys the following rules: + +If exactly one argument is given, and if it appears +to be an a.out_____ file, the 20-byte header is skipped +during addressing, i.e., 20 is added to all addresses typed. +As a consequence, the header can be examined +beginning at location -20. + +If exactly one argument is given and if the file does +not appear to be an a.out_____ file, no mapping is done. + +If zero or two arguments are given, +the mapping appropriate to a core image file is employed. +This means that locations above the program break +and below the stack +effectively do not exist (and are not, in fact, recorded +in the core file). +Locations above the user's stack pointer are mapped, +in looking at the core file, to +the place where they are really stored. +The per-process data kept by the +system, which is stored in the last 512(10) bytes +of the core file, +can be addressed at apparent locations 160000-160777. + +If one wants to examine +a file which has an associated name list, +but is not a core image file, the last argument "-" +can be used (actually the only purpose of the +last argument is to make the number of +arguments not equal to two). +This feature is used most frequently in +examining the memory file /dev/mem. + +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO as(I), core(V), a.out(V), od(I) +.sp +.ti 0 +DIAGNOSTICS "File not found" if the first argument +cannot be read; otherwise "?". +.sp +.ti 0 +BUGS -- diff --git a/man/man1/dc.1 b/man/man1/dc.1 new file mode 100644 index 0000000000..06e48454b4 --- /dev/null +++ b/man/man1/dc.1 @@ -0,0 +1,196 @@ +.pa 1 +.he 'DC (I)'1/15/73'DC (I)' +.ti 0 +NAME dc -- desk calculator +.sp +.ti 0 +SYNOPSIS dc__ [file] +.sp +.ti 0 +DESCRIPTION dc__ +is an arbitrary precision integer arithmetic package. +The overall structure of dc is +a stacking (reverse Polish) calculator. +The following constructions are recognized +by the calculator: +.sp +.in +3 +.ti -3 +number +.br +The value of the number is pushed on the stack. +A number is an unbroken string of the digits 0-9. +It may be preceded by an underscore (_) to input a +negative number. +.sp +.ti -3 ++_ -_ *_ /_ %_ ^_ +.br +The top two values on the stack are added (+_), +subtracted (-_), multiplied (*_), divided (/_), +remaindered (%_) or exponentiated (^). +The two entries are popped off the stack; +the result is pushed on the stack in their place. +.sp +.ti -3 +s_x +.br +The top of the stack is popped and stored into +a register named x, where x may be any character. +.sp +.ti -3 +l_x +.br +The value in register x is pushed on the stack. +The register x is not altered. +All registers start with zero value. +.sp +.ti -3 +d_ +.br +The top value on the stack is pushed on the stack. +Thus the top value is duplicated. +.sp +.ti -3 +p_ +.br +The top value on the stack is printed. +The top value remains unchanged. +.sp +.ti -3 +f_ +.br +All values on the stack and in registers are printed. +.sp +.ti -3 +.ul 1 +q +.br +exits the program. If executing a string, the nesting level is +popped by two. +.sp +.ti -3 +.ul +x +.br +treats the top element of the stack as a character string +and executes it as a string of dc commands. +.sp +.ti -3 +[...]_____ +.br +puts the bracketed ascii string onto the top of the stack. +.sp +.ti -3 +<_x =_x >_x +.br +The top two elements of the stack are popped and compared. +Register x is executed if they obey the stated +relation. +.sp +.ti -3 +.ul +v +.br +replaces the top element on the stack by its square root. +.sp +.ti -3 +!_ +.br +interprets the rest of the line as a UNIX command. +.sp +.ti -3 +c_ +.br +All values on the stack are popped. +.sp +.ti -3 +i_ +.br +The top value on the stack is popped and used as the +number radix for further input. +.sp +.ti -3 +o_ +.br +the top value on the stack is popped and used as the +number radix for further output. +.sp +.ti -3 +z_ +.br +the stack level is pushed onto the stack. +.sp +.ti -3 +?_ +.br +a line of input is taken from the input source (usually the console) +and executed. +.sp +.ti -3 +new-line +.br +ignored except as the name of a register or to end the +response to a ?_. +.sp +.ti -3 +space +.br +ignored except as the name of a register or to terminate a number. +.br +.sp +.in -3 +If a file name is given, input is taken from that file until +end-of-file, then input is taken from the console. +.sp +An example to +calculate the monthly, weekly and +hourly rates for a $10,000/year salary. +.sp +.nf +.in +3 +10000 +100* (now in cents) +dsa (non-destructive store) +12/ (pennies per month) +la52/ (pennies per week) +d10* (deci-pennies per week) +375/ (pennies per hour) +f (print all results) + 512 + 19230 + 83333 +"a" 1000000 +.sp +.in -3 +An example which prints the first ten values of n! is +.in +3 +[la1+dsa*pla10>x]sx +0sa1 +lxx +.sp +.fi +.in -3 +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO msh(VII), salloc(III) +.sp +.ti 0 +DIAGNOSTICS (x) ? for unrecognized character x. +.br +(x) ? for not enough elements on the stack to do what was asked +by command x. +.br +"Out of space" when the free list is exhausted (too many digits). +.br +"Out of headers" for too many numbers being kept around. +.br +"Out of pushdown" for too many items on the stack. +.br +"Nesting Depth" for too many levels of nested execution. +.sp +.ti 0 +.ti 0 +BUGS -- diff --git a/man/man1/df.1 b/man/man1/df.1 new file mode 100644 index 0000000000..fb1e1ec5b3 --- /dev/null +++ b/man/man1/df.1 @@ -0,0 +1,30 @@ +.pa 1 +.he 'DF (I)'1/20/73'DF (I)' +.ti 0 +NAME df -- disk free +.sp +.ti 0 +SYNOPSIS df__ [ filesystem ] +.sp +.ti 0 +DESCRIPTION df__ +prints out the number of free blocks +available on a file system. +If the file system is unspecified, +the free space on all of +the normally mounted file systems +is printed. +.sp +.ti 0 +FILES /dev/rf?, +/dev/rk?, +/dev/rp? +.sp +.ti 0 +SEE ALSO check(VIII) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man1/dsw.1 b/man/man1/dsw.1 new file mode 100644 index 0000000000..20db63044b --- /dev/null +++ b/man/man1/dsw.1 @@ -0,0 +1,28 @@ +.pa 1 +.he 'DSW (I)'3/15/72'DSW (I)' +.ti 0 +NAME dsw -- delete interactively +.sp +.ti 0 +SYNOPSIS dsw___ [ directory ] +.sp +.ti 0 +DESCRIPTION For +each file in the given directory ("." if not specified) +dsw___ types its name. If "y" is typed, the file is deleted; +if "x", dsw___ exits; if anything else, the file +is not removed. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO rm(I) +.sp +.ti 0 +DIAGNOSTICS "?" +.sp +.ti 0 +BUGS The name "dsw" +is a carryover from the ancient past. Its etymology is +amusing but the name is nonetheless ill-advised. diff --git a/man/man1/du.1 b/man/man1/du.1 new file mode 100644 index 0000000000..4af9382cef --- /dev/null +++ b/man/man1/du.1 @@ -0,0 +1,42 @@ +.pa 1 +.he 'DU (I)'1/20/73'DU (I)' +.ti 0 +NAME du -- summarize disk usage +.sp +.ti 0 +SYNOPSIS du__ [ -s__ ] [ -a__ ] [ name ... ] +.sp +.ti 0 +DESCRIPTION du__ +gives the number of blocks contained in all files +and (recursively) directories within each specified directory or file name____. +If name____ is missing, ._ is used. + +The optional argument -s__ causes only the grand total to +be given. +The optional argument -a__ causes an entry to be generated +for each file. +Absence of either causes an entry to be generated for +each directory only. + +A file which has two links to it is only counted once. +.sp +.ti 0 +FILES . +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS Non-directories +given as arguments (not under -a option) are not listed. +.sp +Removable +file systems do not work correctly +since i-numbers may be repeated while the corresponding +files are distinct. +Du should maintain an i-number list per root directory +encountered. diff --git a/man/man1/echo.1 b/man/man1/echo.1 new file mode 100644 index 0000000000..ba2bdb50de --- /dev/null +++ b/man/man1/echo.1 @@ -0,0 +1,25 @@ +.pa 1 +.he 'ECHO (I)'3/15/72'ECHO (I)' +.ti 0 +NAME echo -- echo arguments +.sp +.ti 0 +SYNOPSIS echo____ [ arg89918 ... ] +.sp +.ti 0 +DESCRIPTION echo____ +writes all its arguments in order as a line on the +standard output file. +It is mainly useful for producing diagnostics in command files. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man1/ed.1 b/man/man1/ed.1 new file mode 100644 index 0000000000..d9a38bb6a9 --- /dev/null +++ b/man/man1/ed.1 @@ -0,0 +1,421 @@ +.pa 1 +.he 'ED (I)'1/15/73'ED (I)' +.tr | +.ti 0 +NAME +.br +ed -- editor +.sp +.ti 0 +SYNOPSIS +.br +ed__ [ name ] +.sp +.ti 0 +DESCRIPTION +.br +.in -8 +ed__ +is the standard text editor. +.sp +If the optional argument is given, ed__ +simulates an e_ command on the named file; that is to say, +the file is read into ed__'s buffer so that it can be edited. +.sp +ed__ operates on a copy of any file it is editing; changes made +in the copy have no effect on the file until a write +(w_) command is given. +The copy of the text being edited resides +in a temporary file called the buffer______. There is only +one buffer. +.sp +Commands to ed__ have a simple and regular structure: zero or +more addresses_________ followed by a single character command_______, possibly +followed by parameters to the command. +These addresses specify one or more lines in the buffer. +Every command which requires addresses has default addresses, +so that the addresses can often be omitted. +.sp +In general, only one command may appear on a line. +Certain commands allow the input of text. +This text is placed in the appropriate place in the buffer. +While ed__ is accepting text, it is said +to be in input_____ mode____. In this mode, no commands are recognized; +all input is merely collected. +Input mode is left by typing a period (.) alone at the +beginning of a line. +.sp +ed__ supports a limited form of regular_______ expression__________ notation. +A regular expression is an expression which specifies +a set of strings of characters. +A member of this set of strings is said to be matched_______ +by the regular expression. +The regular expressions allowed by ed__ are constructed as follows: +.sp +.in +6 +.ti -3 +1. An ordinary character (not one of those discussed below) +is a regular expression and matches that character. +.sp +.ti -3 +2. A circumflex (^) at the beginning of a regular expression +matches the null character at the beginning of a line. +.sp +.ti -3 +3. A currency symbol ($) at the end of a regular expression +matches the null character at the end of a line. +.sp +.ti -3 +4. A period (.) matches any character but a new-line character. + +.ti -3 +5. A regular expression followed by an asterisk (*) +matches any number of adjacent occurrences (including zero) +of the regular expression it follows. + +.ti -3 +6. A string of characters enclosed in square brackets +([]) matches any character in the string but no others. +If, however, the first character of the string is a circumflex +(^) the regular expression matches any character but new-line +and the characters in the string. + +.ti -3 +7. The concatenation of regular expressions is a regular +expression which matches the concatenation of the strings +matched by the components of the regular expression. + +.ti -3 +8. The null regular expression standing alone +is equivalent to the last regular expression encountered. + +.in -6 +Regular expressions are used in addresses to specify +lines and in one command (s_, see below) +to specify a portion of a line which is to be replaced. + +If it is desired to use one of +the regular expression metacharacters as an ordinary +character, that character may be preceded by "\\". +This also applies to the character bounding the regular +expression (often "/") and to "\\" itself. +.sp +Addresses are constructed as follows. +To understand addressing in ed__ +it is necessary to know that at any time there is a current_______ +line____. Generally speaking, the current line is +the last line affected by a command; however, +the exact effect on the current line +by each command is discussed under the description of +the command. + +.in +6 +.ti -3 +1. The character "." addresses the current line. + +.ti-3 +2.|The character "^" addresses the line immediately before the current line. +.sp +.ti -3 +3. The character "$" addresses the last line of the buffer. + +.ti -3 +4. A decimal number n_ addresses the n_th line of the buffer. + +.ti -3 +6. A regular expression enclosed in slashes "/" addresses +the first line found by searching toward the end of the +buffer and stopping at the first line containing a +string matching the regular expression. +If necessary the search wraps around to the beginning of the +buffer. + +.ti -3 +5. A regular expression enclosed in queries "?" addresses +the first line found by searching toward the beginning of +the buffer and stopping at the first line found containing +a string matching the regular expression. If necessary +the search wraps around to the end of the buffer. + +.ti -3 +7. An address followed by a plus sign "+" +or a minus sign "-" followed by a decimal number specifies that address plus +(resp. minus) the indicated number of lines. +The plus sign may be omitted. + +.ti-3 +8.|"'x" addresses the line associated (marked) with the +mark name character "x" +which must be a printable character. +Lines may be marked with the "k" command described below. +.sp +.in -6 +Commands may require zero, one, or two addresses. +Commands which require no addresses regard the presence +of an address as an error. +Commands which accept one or two addresses +assume default addresses when insufficient are given. +If more addresses are given than such a command requires, +the last one or two (depending on what is accepted) are used. + +Addresses are separated from each other typically by a comma +(,). +They may also be separated by a semicolon +(;). In this case the current line "." is set to +the previous address before the next address is interpreted. +This feature can be used to determine the starting +line for forward and backward searches ("/", "?"). +The second address of any two-address sequence +must correspond to a line following the line corresponding to the first address. + +In the following list of ed__ commands, the default addresses +are shown in parentheses. The parentheses are not part of +the address, but are used to show that the given addresses are +the default. + +As mentioned, it is generally illegal for more than one +command to appear on a line. +However, any command may be suffixed by "p" (for "print"). +In that case, the current line is printed after the command +is complete. +.ne 6 + +.in +6 +.ti -3 +(.)a +.ti -3 + +.ti -3 +.li +. +.br +The a_ppend command reads the given text +and appends it after the addressed line. "." is left +on the last line input, if there +were any, otherwise at the addressed line. +Address "0" is legal for this command; text is placed +at the beginning of the buffer. + +.ti -3 +(.,.)c +.ti -3 + +.ti -3 +. +.br +The c_hange +command deletes the addressed lines, then accepts input +text which replaces these lines. +"." is left at the last line input; if there were none, +it is left at the first line not changed. + +.ti -3 +(.,.)d +.br +The d_elete command deletes the addressed lines from the buffer. +The line originally after the last line deleted becomes the current line; +if the lines deleted were originally at the end, +the new last line becomes the current line. + +.ti -3 +e filename +.br +The e_dit +command causes the entire contents of the buffer to be deleted, +and then the named file to be read in. +"." is set to the last line of the buffer. +The number of characters read is typed. +"filename" is remembered for possible use as a default file name +in a subsequent r_ or w_ command. +.sp +.ti-3 +f filename +.br +The f_ilename command prints the currently remembered file name. +If "filename" is given, +the currently remembered file name is changed to "filename". + +.ti -3 +(1,$)g/regular expression/command list +.br +In the g_lobal +command, the first step is to mark every line which matches +the given regular expression. +Then for every such line, the +given command list is executed with "." initially set to that line. +A single command or the first of multiple commands +appears on the same line with the global command. +All lines of a multi-line list except the last line must be ended with "\\". +a_, i_, and c_ commands and associated input are permitted; +the "." terminating input mode may be omitted if it would be on the +last line of the command list. +The (global) commands, g_ and v_, are not permitted in the command list. + +.ti -3 +(.)i +.ti -3 + +.ti -3 +. +.br +This command i_nserts the given text before the addressed line. +"." is left at the last line input; if there were none, +at the addressed line. +This command differs from the a_ command only in the placement of the +text. + +.ti-3 +(.)kx +.br +The mark_ command associates or marks the addressed line with +the single character mark name "x". +The ten most recent mark names are remembered. +The current mark names may be printed with the n_ command. + +.ti -3 +(.,.)mA +.br +The m_ove command will reposition the addressed lines after the line +addressed by "A". +The line originally after the last line moved becomes the current line; +if the lines moved were originally at the end, +the new last line becomes the current line. + +.ti-3 +n +.br +The markn_ames command will print the current mark names. + +.ti -3 +(.,.)p +.br +The p_rint command prints the addressed lines. "." +is left at the last line printed. +The p_ command may___ be placed on the same line after any command. + +.ti -3 +q_ +.br +The q_uit command causes ed__ to exit. No automatic write +of a file is done. + +.ti -3 +($)r filename +.br +The r_ead command +reads in the given file after the addressed line. +If no file name is given, +the remembered file name, if any, is used (see e_ and f_ commands). +The remembered file name is not changed unless +"filename" is the very first file name +mentioned. +Address "0" is legal for r_ and causes the +file to be read at the beginning of the buffer. +If the read is successful, the number of characters +read is typed. +"." is left at the last line read in from the file. + +.ti -3 +(.,.)s/regular expression/replacement/ or, +.ti -3 +(.,.)s/regular expression/replacement/g +.br +The s_ubstitute command searches each addressed +line for an occurrence of the specified regular expression. +On each line in which a match is found, +all matched strings are replaced by the replacement specified, +if the global replacement indicator "g" appears after the command. +If the global indicator does not appear, only the first occurrence +of the matched string is replaced. +It is an error for the substitution to fail on all addressed lines. +Any character other than space or new-line +may be used instead of "/" to delimit the regular expression +and the replacement. +"." is left at the last line substituted. + +The ampersand "&" appearing in the replacement +is replaced by the regular expression that was matched. +The special meaning of "&" in this context may be +suppressed by preceding it by "\\". + +.ti -3 +(1,$)v/regular expression/command list +.br +This command is the same as the g_lobal command +except that the command list is executed +with "." initially set to every line except______ those +matching the regular expression + +.ti -3 +(1,$)w filename +.br +The w_rite command writes the addressed lines onto +the given file. +If the file does not exist, +it is created mode 17 (readable and writeable by everyone). +The remembered file name is not___ changed unless +"filename" is the very first file name mentioned. +If no file name is given, +the remembered file name, if any, is used (see e_ and f_ commands). +"." is unchanged. +If the command is successful, the number of characters written is +typed. + +.ti -3 +($)= +.br +The line number of the addressed line is typed. +"." is unchanged by this command. + +.ti -3 +!UNIX command +.br +The remainder of the line after the "!" is sent +to UNIX to be interpreted as a command. +"." is unchanged. + +.ti -3 +(.+1) +.br +An address alone on a line causes that line to be printed. +A blank line alone is equivalent to ".+1p"; it is useful +for stepping through text. + +.in -6 +If an interrupt signal (ASCII DEL) is sent, +ed__ will print a "?" and return to its command level. + +If invoked with the command name '-', (see init____) +ed__ will sign on with the message "Editing system" +and print "*" as the command level prompt character. +.sp +Ed__ has size limitations on the maximum number of lines that can be edited, +and on the maximum number of characters in a line, +in a global's command list, +and in a remembered file name. +These limitations vary with the physical core size of the PDP11 computer +on which ed__ is being used. +The range of limiting sizes +for the above mentioned items is; +1300|-|4000 lines per file, +256|-|512 characters per line, +63|-|256 characters per global command list, +and +64 characters per file name. +.sp +.ti 0 +.in +8 +FILES +.br +/tmp/etm? temporary +.br +/etc/msh to implement the "!" command. +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS "?" for any error +.sp +.ti 0 +BUGS -- diff --git a/man/man1/exit.1 b/man/man1/exit.1 new file mode 100644 index 0000000000..970eacd6d9 --- /dev/null +++ b/man/man1/exit.1 @@ -0,0 +1,26 @@ +.pa 1 +.he 'EXIT(I)'3/15/72'EXIT(I)' +.ti 0 +NAME exit -- terminate command file +.sp +.ti 0 +SYNOPSIS exit____ +.sp +.ti 0 +DESCRIPTION exit____ +performs a seek____ to the end of its standard input file. +Thus, if it is invoked inside +a file of commands, upon return from exit____ the shell will +discover an end-of-file and terminate. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO if(I), goto(I), sh(I) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man1/factor.1 b/man/man1/factor.1 new file mode 100644 index 0000000000..fb1aa2a5a3 --- /dev/null +++ b/man/man1/factor.1 @@ -0,0 +1,30 @@ +.pa 1 +.he 'FACTOR (I)'1/15/73'FACTOR (I)' +.ti 0 +NAME factor -- discover prime factors of a number +.sp +.ti 0 +SYNOPSIS factor______ +.sp +.ti 0 +DESCRIPTION When factor is invoked, it types +out "Enter:" at you. If you type in a positive +number less than 2^56 (about 7.2E16), it will repeat the number +back at you and then its prime factors each one printed +the proper number of times. Then it says "Enter:" again. +To exit, feed it an EOT or a delete. +.sp +Maximum time to factor is proportional to sqrt(n) and occurs +when n is prime. It takes 1 minute to factor a prime near 10^13. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS "Ouch." for input out of range or for garbage input. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/fc.1 b/man/man1/fc.1 new file mode 100644 index 0000000000..5c33f614b6 --- /dev/null +++ b/man/man1/fc.1 @@ -0,0 +1,292 @@ +.pa 1 +.he 'FC (I)'9/1/72'FC (I)' +.ti 0 +NAME fc -- fortran compiler +.sp +.ti 0 +SYNOPSIS fc__ [ -c__ ] sfile\d1\u.f__ ... ofile\d1\u ... +.sp +.ti 0 +DESCRIPTION fc__ +is the UNIX Fortran compiler. +It accepts three types of arguments: + +Arguments whose names end with ".f" are assumed to be +Fortran source program units; they are compiled, and +the object program is left on the file sfile\d1\u.o (i.e. +the file whose name is that of the source with ".o" substituted +for ".f"). + +Other arguments (except for "-c") are assumed +to be either loader flags, or +object programs, typically produced by an earlier fc__ run, +or perhaps libraries of Fortran-compatible routines. +These programs, together with the results of any +compilations specified, are loaded (in the order +given) to produce an executable program with name +a.out_____. + +The "-c" argument suppresses the loading phase, as does +any syntax error in any of the routines being compiled. + +The following is a list +of differences between fc__ +and ANSI standard Fortran (also see the BUGS section): +.sp +.in +3 +.ti -3 +1. Arbitrary combination of types is allowed +in expressions. Not all combinations are expected to +be supported at runtime. +All of the normal +conversions involving integer, real, double +precision and complex are allowed. +.sp +.ti -3 +2. The 'standard' implicit statement is recognized. +.sp +.ti -3 +3. The types +doublecomplex, logical*1, +integer*2 and real*8 (doubleprecision) +are supported. +.sp +.ti -3 +4. &_ as the first character of a line +signals a continuation card. +.sp +.ti -3 +5. c_ as the first character of a line signals a comment. +.sp +.ti -3 +6. All keywords are recognized in lower case. +.sp +.ti -3 +7. The notion of 'column 7' is not implemented. + +.ti -3 +8. G-format input is free form-- +leading blanks are ignored, the first blank after the start +of the number terminates the field. + +.ti -3 +9. A comma in any numeric or logical input field terminates +the field. + +.ti -4 +10. There is no carriage control on output. +.sp +.in -3 +In I/O statements, only unit numbers 0-19 are supported. +Unit number nn__ corresponds to file "fortnn__;" +(e.g. unit 9 is file "fort09"). +For input, the file must exist; +for output, it will be created. + +Unit 5 is permanently associated with +the standard input file; unit 6 with the +standard output file. +.sp +.ti 0 +FILES file.f input file +.nf +a.out loaded output +f.tmp[123] temporary (deleted) +/usr/fort/fc[1234] compilation phases +/usr/lib/fr0.o runtime startoff +/usr/lib/filib.a interpreter library +/usr/lib/libf.a builtin functions, etc. +/usr/lib/liba.a system library +.fi +.sp +.ti 0 +SEE ALSO ANSI standard +.sp +.ti 0 +DIAGNOSTICS Compile-time diagnostics +are given by number. +If the source code is available, it is +printed with an underline at the current +character pointer. +Errors possible are: + +.in +8 +.ti -8 +1 statement too long +.ti -8 +2 syntax error in type statement +.ti -8 +3 redeclaration +.ti -8 +4 missing ( in array declarator +.ti -8 +5 syntax error in dimension statement +.ti -8 +6 inappropriate or gratuitous array declarator +.ti -8 +7 syntax error in subscript bound +.ti -8 +8 illegal character +.ti -8 +9 common variable is a parameter or already in common +.ti -8 +10 common syntax error +.ti -8 +11 subroutine/blockdata/function not first statement +.ti -8 +12 subroutine/function syntax error +.ti -8 +13 block data syntax error +.ti -8 +14 redeclaration in external +.ti -8 +15 external syntax error +.ti -8 +16 implicit syntax error +.ti -8 +17 subscript on non-array +.ti -8 +18 incorrect subscript count +.ti -8 +19 subscript out of range +.ti -8 +20 subscript syntax error +.ti -8 +22 DATA syntax error +.ti -8 +23 Illegal variable in DATA +.ti -8 +23 equivalence inconsistency +.ti -8 +24 equivalence syntax error +.ti -8 +25 separate common blocks equivalenced +.ti -8 +26 common block illegally extended by equivalence +.ti -8 +27 common inconsistency created by equivalence +.ti -8 +28 DATA table overflow +.ti -8 +29 () imbalance in expression +.ti -8 +30 expression syntax error +.ti -8 +31 illegal variable in equivalence +.ti -8 +32 Storage initialized twice by DATA +.ti -8 +33 non array/function used with subscripts/arguments +.ti -8 +35 goto syntax error +.ti -8 +37 illegal return +.ti -8 +38 continue, return, stop, call, end, or pause syntax error +.ti -8 +39 assign syntax error +.ti -8 +40 if syntax error +.ti -8 +41 I/O syntax error +.ti -8 +42 do or I/O iteration error +.ti -8 +43 do end missing +.ti -8 +50 illegal statement in block data +.ti -8 +51 multiply defined labels +.ti -8 +52 undefined label +.ti -8 +53 dimension mismatch +.ti -8 +54 expression syntax error +.ti -8 +55 end of statement in hollerith constant +.ti -8 +56 array too large +.ti -8 +99 B table overflow +.ti -8 +101 unrecognized statement +.ti -8 + +.ti -8 +Runtime diagnostics: +.ti -8 + +.ti -8 +1 invalid log argument +.ti -8 +2 bad arg count to amod +.ti -8 +3 bad arg count to atan2 +.ti -8 +4 excessive argument to cabs +.ti -8 +5 exp too large in cexp +.ti -8 +6 bad arg count to cmplx +.ti -8 +7 bad arg count to dim +.ti -8 +8 excessive argument to exp +.ti -8 +9 bad arg count to idim +.ti -8 +10 bad arg count to isign +.ti -8 +11 bad arg count to mod +.ti -8 +12 bad arg count to sign +.ti -8 +13 illegal argument to sqrt +.ti -8 +14 assigned/computed goto out of range +.ti -8 +15 subscript out of range +.ti -8 +16 real**real overflow + +.ti -8 +100 illegal I/O unit number +.ti -8 +101 inconsistent use of I/O unit +.ti -8 +102 cannot create output file +.ti -8 +103 cannot open input file +.ti -8 +104 EOF on input file +.ti -8 +105 illegal character in format +.ti -8 +106 format does not begin with ( +.ti -8 +107 no conversion in format but non-empty list +.ti -8 +108 excessive parenthesis depth in format +.ti -8 +109 illegal format specification +.ti -8 +110 illegal character in input field +.ti -8 +111 end of format in hollerith specification +.ti -8 +999 unimplemented input conversion +.sp +.in -8 +.ti 0 +BUGS The following is a list of +those features not yet implemented: +.sp +.br +arithmetic statement functions + +backspace, endfile, rewind runtime + +binary I/O + +no scale factors on input diff --git a/man/man1/fed.1 b/man/man1/fed.1 new file mode 100644 index 0000000000..17413593bc --- /dev/null +++ b/man/man1/fed.1 @@ -0,0 +1,127 @@ +.pa 1 +.he 'FED (I)'1/15/73'FED (I)' +.ti 0 +NAME +.br +fed -- edit associative memory for form letter +.sp +.ti 0 +SYNOPSIS +.br +fe__d_ +.sp +.ti 0 +DESCRIPTION +.br +fed___ is used to edit a form letter associative memory +file, form.m, which consists of named strings. +Commands consist of single letters followed by a list of +string names separated by a single space and ending with a +new line. +The conventions of the Shell with respect to '*' and '?' hold for +all commands but m_ where literal string names are expected. +The commands are: + +.in +5 +.ti -5 +e name918 ... + +e_dit writes the string whose name is name918 onto a temporary file +and executes the system editor ed__. On exit from the system +editor the temporary file is copied back into the associative +memory. Each argument is operated on separately. The sequence of +commands to add the string from 'file' to memory with name +'newname' is as follows: + + e newname + 0 (printed by ed) + r file + 200 + w + 200 + q (get out of ed) + q (get out of fe) + +To dump a string onto a file: + + e name + 200 (printed by ed) + w filename + 200 + q (get out of ed) + q (get out of fe) +.sp2 +.ti -5 +d [ name918 ... ] + +d_eletes a string and its name from the memory. When called with +no arguments d_ operates in a verbose mode typing each string +name and deleting only if a 'y' is typed. A 'q' response returns +to fed's command level. Any other response does nothing. +.sp 2 +.ti -5 +m name918 name928 ... + +(m_ove) changes the name of name918 to name928 and removes previous +string name928 if one exists. Several pairs of arguments may be given. +.sp 2 +.ti -5 +n [ name918 ... ] + +(n_ames) lists the string names in the memory. If called with +the optional arguments, it just lists those requested. +.sp 2 +.ti -5 +p name918 ... + +p_rints the contents of the strings with names given by the arguments. +.sp 2 +.ti -5 +q +(q_uit) returns to the system. +.sp 2 +.ti -5 +c [ p_ ] [ f_ ] + +c_hecks the associative memory file for consistency +and reports the number of free headers and blocks. +The optional arguments do the following: +.sp +.in +5 +.ti -2 +p causes any unaccounted for string to be +printed + +.ti -2 +f fixes broken memories by adding +unaccounted-for headers to free +storage and removing references to +released headers from associative +memory. +.in -5 +.sp +.sp +.in -5 +.ti 0 +FILES /tmp/ftmp? temporary +.br +form.m associative memory +.sp +.ti 0 +SEE ALSO form(I), ed(I), sh(I) +.sp +.ti 0 +DIAGNOSTICS '?' unknown command +.br +'Cannot open temp. file'-- cannot create a temporary file for ed command +.br +'name not in memory.' if string 'name' is not in the associative +memory and is used as an argument for d_ or m_. +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +WARNING It +is legal but an unwise idea to have string names +with blanks, ":" or "?" in them. diff --git a/man/man1/form.1 b/man/man1/form.1 new file mode 100644 index 0000000000..4087d531ce --- /dev/null +++ b/man/man1/form.1 @@ -0,0 +1,84 @@ +.pa 1 +.he 'FORM (I)'6/15/72'FORM (I)' +.ti 0 +NAME +.br +form -- form letter generator +.sp +.ti 0 +SYNOPSIS +.br +form____ proto arg918 ... +.sp +.ti 0 +DESCRIPTION +.br +form____ generates a form letter from a prototype +letter, an associative memory, arguments and in a special case, the +current date. +.sp +If form____ is invoked with the proto_____ argument 'x', the associative memory is +searched for an entry with name 'x' and the contents filed under that name are +used as the prototype. If the search fails, the message "[x]:" is typed on +the console and whatever text is typed in from the console, terminated by +two new lines, is used as the prototype. +.sp +If the prototype argument is missing, '{letter}' is assumed. +.sp +Basically, form____ is a copy process from the prototype to the output file. +If an element of the form [n] (where n_ is a digit from 1 to 9) is encountered, +the n_th argument arg___9n8 is inserted in its place, and that argument is then +rescanned. If [0] is encountered, the current date is inserted. If +the desired argument has not been given, a message of the form "[n]:" is +typed. The response typed in then is used for that argument. +.sp +If an element of the form [name] or {name} is encountered, the name is looked up in the +associative memory. If it is found, the contents of the memory under this +name replaces the original element (again rescanned). If +the name is not found, a message of the form "[name]:" is typed. +The response typed in is used for that element. The response is +entered in the memory under the name if the name is enclosed in []. +The response is not entered in the memory but is remembered for the +duration of the letter if the name is enclosed in {}. +.sp +In both of the above cases, the response is typed in by entering +arbitrary text terminated by two new lines. Only the first of the +two new lines is passed with the text. +.sp +If one of the special characters [{]}\\ is preceded by +a \\, it loses its special character. +.sp +If a file named "forma" already exists in the users directory, "formb" is +used as the output file and so forth to "formz". +.sp +The file "form.m" is created if none exists. Because form.m is +operated on by the disc allocater, it should only be changed by using +fed___, the form letter editor, or form____. +.sp +.fi +.ti 0 +FILES +.br +form.m associative memory +.br +form? output file (read only) +.sp +.fi +.ti 0 +SEE ALSO +.br +fed(I), type(I), roff(I) +.sp +.fi +.ti 0 +DIAGNOSTICS +.br +"cannot open output file" "cannot open memory file" +when the appropriate files cannot be located or created. +.sp +.fi +.ti 0 +BUGS +.br +An unbalanced ] or } acts as an end of file but +may add a few strange entries to the associative memory. diff --git a/man/man1/forml.1 b/man/man1/forml.1 new file mode 100644 index 0000000000..092553b3fb --- /dev/null +++ b/man/man1/forml.1 @@ -0,0 +1,50 @@ +.pa 1 +.he 'FORML (I)'10/24/72'FORML (I)' +.ti 0 +NAME forml -- form letter generator processor +.sp +.ti 0 +SYNOPSIS forml_____ [ name ] ... +.sp +.ti0 +DESCRIPTION A streamlined program for typing form letters. +The names pick out +prestored form letters prepared according to the conventions +of +.ul +form +and +.ul +roff. +The program prompts to get each blank +filled in. +When all the forms are completed, it prompts "Set paper." +It waits for a newline before printing each letter. + +If more than one name is given, the name of +each letter is announced +before the prompts for it begin. +If no names are given, the program asks "Which letter?" before +each. +Respond with the name and a newline, or newline only when done. +.sp +On a 2741 type terminal, the program assumes the +letter is to be typed with a correspondence ball, +and also prompts "Change ball." +Replace the ball at the end. +.sp +.ti0 +FILES form.m (memory), +.br +forma, formb, ... temporaries +.sp +.ti0 +SEE ALSO form(I), fed(I), roff(I) +.br +.sp +.ti0 +DIAGNOSTICS "Try again"--can't get a process +.br +.sp +.ti0 +BUGS -- diff --git a/man/man1/goto.1 b/man/man1/goto.1 new file mode 100644 index 0000000000..64feea781e --- /dev/null +++ b/man/man1/goto.1 @@ -0,0 +1,37 @@ +.pa 1 +.he 'GOTO (I)'3/15/72'GOTO (I)' +.ti 0 +NAME goto -- command transfer +.sp +.ti 0 +SYNOPSIS goto____ label +.sp +.ti 0 +DESCRIPTION goto____ +is only allowed when the Shell +is taking commands from a file. +The file is searched (from the beginning) +for a line beginning with ":" followed by one +or more spaces followed by +the label_____. +If such a line is found, the goto____ command returns. +Since the read pointer in the command file points to the +line after the label, +the effect is to cause the Shell to transfer to the +labelled line. + +":" is a do-nothing +command that only serves to place a label. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO sh(I), :(I) +.sp +.ti 0 +DIAGNOSTICS "goto error", if +the input file is a typewriter; "label not found". +.sp +.ti 0 +BUGS -- diff --git a/man/man1/hyphen.1 b/man/man1/hyphen.1 new file mode 100644 index 0000000000..77daab21c0 --- /dev/null +++ b/man/man1/hyphen.1 @@ -0,0 +1,29 @@ +.pa 1 +.he 'HYPHEN (I)'1/15/73'HYPHEN (I)' +.ti 0 +NAME hyphen -- find hyphenated words +.sp +.ti 0 +SYNOPSIS hyphen______ file\d1\u ... +.sp +.ti 0 +DESCRIPTION It finds all of the words in a +document which are hyphenated across lines +and prints them back at you in a convenient format. + +If no arguments are given, the standard output +is used. +Thus hyphen______ may be used as a filter. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS yes +.sp +.ti 0 +BUGS yes, it gets confused, but with no ill effects other than +spurious extra output. diff --git a/man/man1/if.1 b/man/man1/if.1 new file mode 100644 index 0000000000..917ec74018 --- /dev/null +++ b/man/man1/if.1 @@ -0,0 +1,76 @@ +.pa 1 +.he 'IF (I)'3/15/72'IF (I)' +.ti 0 +NAME if -- conditional command +.sp +.ti 0 +SYNOPSIS if__ expr command [ arg918 ... ] +.sp +.ti 0 +DESCRIPTION if__ +evaluates the expression expr____, and if its value is true____, +executes the given command_______ with the given arguments. + +The following primitives are used to construct +the expr____: + +.in +9 +.ti -4 +-r__ file +.br +true if the file exists and is readable. + +.ti -4 +-w__ file +.br +true if the file exists and is writable + +.ti -4 +s1 =_ s2 +.br +true if the strings s1__ and s2__ are equal. + +.ti -4 +s1 !=__ s2 +.br +true if the strings s1__ and s2__ are not equal. + +.in -9 +These primaries may be combined with the +following operators: + +.in +5 +!_ +.ti +4 +unary negation operator + +-a__ +.ti +4 +binary and___ operator + +-o__ +.ti +4 +binary or__ operator + +(_ expr )_ +.ti +4 +parentheses for grouping. + +.in -5 +-a__ has higher precedence than -o__. +Notice that all the operators and flags are separate +arguments to if__ and hence must be surrounded by spaces. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO sh(I) +.sp +.ti 0 +DIAGNOSTICS "if error", +if the expression has the wrong syntax; +"command not found." +.sp +.ti 0 +BUGS -- diff --git a/man/man1/ld.1 b/man/man1/ld.1 new file mode 100644 index 0000000000..1347d1b622 --- /dev/null +++ b/man/man1/ld.1 @@ -0,0 +1,111 @@ +.pa 1 +.he 'LD (I)'3/15/72'LD (I)' +.ti 0 +NAME ld -- link editor +.sp +.ti 0 +SYNOPSIS ld__ [ -sulxr______ ] name\d1\u ... +.sp +.ti 0 +DESCRIPTION ld__ combines several +object programs into one; resolves external +references; and searches libraries. +In the simplest case the names of several object +programs are given, and ld__ combines them, producing +an object module which can be either executed or +become the input for a further ld__ run. +In the latter case, the "-r" option must be given +to preserve the relocation bits. +.sp +The argument routines are concatenated in the order +specified. The entry point of the output is the +beginning of the first routine. +.sp +If any argument is a library, it is searched exactly once. +Only those routines defining an unresolved external +reference are loaded. +If a routine from a library +references another routine in the library, +the referenced routine must appear after the +referencing routine in the library. +Thus the order of programs within libraries +is important. +.sp +ld__ understands several flag arguments which are written +preceded by a "-": +.sp +.in +6 +.ti -3 +-s "squash" the output, that is, remove the symbol table +and relocation bits to save space (but impair the +usefulness of the debugger). +This information can also be removed by strip_____. +.ti -3 +.sp +-u take the following argument as a symbol and enter +it as undefined in the symbol table. This is useful +for loading wholly from a library, since initially the symbol +table is empty and an unresolved reference is needed +to force the loading of the first routine. +.sp +.ti -3 +-l This option is an abbreviation for a library name. +"-l" alone stands for "/usr/lib/liba.a", which +is the standard system library for assembly language +programs. +"-lx" stands for "/usr/lib/libx.a" where x is any character. +There are libraries for Fortran (x="f"), C (x="c"), Explor (x="e") and B (x="b"). + +.ti -3 +-x Do not preserve local +(non-.globl) symbols in the output symbol table; only enter +external symbols. +This option saves some space in the output file. + +.ti -3 +-r generate relocation bits in the output file +so that it can be the subject of another ld__ run. +.sp +.in -6 +The output of ld__ is left on a.out_____. This file is executable +only if no errors occurred during the load. +.sp +.ti 0 +FILES /usr/lib/lib?.a libraries +.br +a.out output file +.sp +.ti 0 +SEE ALSO as(I), ar(I) +.sp +.ti 0 +DIAGNOSTICS "file +not found"-- bad argument +.sp +"bad format"-- bad argument +.sp +"relocation error"-- bad argument (relocation +bits corrupted) +.sp +"multiply defined"-- same symbol defined twice in same load +.sp +"un"-- stands for "undefined symbol" + +"symbol not found"-- loader bug + +"can't move output file"-- can't move temporary to a.out file + +"no relocation bits"-- an input file lacks relocation information + +"too many symbols"-- too many references to external +symbols in a given routine + +"premature EOF" + +"can't create l.out"-- cannot make temporary file + +"multiple entry point"-- more than one entry point +specified (not possible yet). +.sp +.ti 0 +BUGS -- diff --git a/man/man1/ln.1 b/man/man1/ln.1 new file mode 100644 index 0000000000..80c55e9ea0 --- /dev/null +++ b/man/man1/ln.1 @@ -0,0 +1,34 @@ +.pa 1 +.he 'LN (I)'3/15/72'LN (I)' +.ti 0 +NAME ln -- make a link +.sp +.ti 0 +SYNOPSIS ln__ name\d1\u [ name\d2\u ] +.sp +.ti 0 +DESCRIPTION ln__ creates a link to an existing file name\d1\u. +If name\d2\u is given, the link has that name; +otherwise it is placed in the current directory +and its name is the last component +of name\d1\u. +.sp +It is forbidden to link to a directory +or to link across file systems. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO rm(I) +.sp +.ti 0 +DIAGNOSTICS "?" +.sp +.ti 0 +BUGS There is nothing particularly +wrong with ln__, but links don't work right with respect +to the backup system: one copy is backed up for each link, and +(more serious) in case of a file system reload +both copies are restored and the information that a link was involved +is lost. diff --git a/man/man1/login.1 b/man/man1/login.1 new file mode 100644 index 0000000000..d979e088f1 --- /dev/null +++ b/man/man1/login.1 @@ -0,0 +1,54 @@ +.pa 1 +.he 'LOGIN (I)'3/15/72'LOGIN (I)' +.ti 0 +NAME login -- sign onto UNIX +.sp +.ti 0 +SYNOPSIS login_____ [ username [ password ] ] +.sp +.ti 0 +DESCRIPTION The login_____ command +is used when a user initially +signs onto UNIX, or it may be used at any time to change +from one user to another. +The latter case is the one summarized above and +described here. +See login_____ (VII) for how to dial up initially. + +If login_____ is invoked without an argument, +it will ask for a user name, and, if +appropriate, a password. +Echoing is turned off (if possible) during the typing of the password, +so it will not appear on the written record of the +session. +.sp +After a successful login, +accounting files are updated and +the user is informed of the +existence of mailbox +and message-of-the-day files. + +Login is recognized by the Shell +and executed directly (without forking). +.sp +.ti 0 +FILES /tmp/utmp accounting +.br +/tmp/wtmp accounting +.br +mailbox mail +.br +/etc/motd message-of-the-day +/etc/passwd password file +.sp +.ti 0 +SEE ALSO login(VII), init(VII), getty(VII), mail(I) +.sp +.ti 0 +DIAGNOSTICS "login incorrect", +if the name or the password is bad. +"No Shell,", "cannot open password file," "no directory:" +consult a UNIX programming councilor. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/ls.1 b/man/man1/ls.1 new file mode 100644 index 0000000000..da3548d974 --- /dev/null +++ b/man/man1/ls.1 @@ -0,0 +1,52 @@ +.pa 1 +.he 'LS (I)'3/15/72'LS (I)' +.ti 0 +NAME ls -- list contents of directory +.sp +.ti 0 +SYNOPSIS ls__ [ -_ltasd_____ ] name\d1\u ... +.sp +.ti 0 +DESCRIPTION ls__ +lists the contents of one or more directories under +control of several options: +.sp +.in +5 +.ti -3 +-l list in l_ong format, giving i-number, mode, owner, +size in bytes, and time of last modification +for each file. +(see stat____ for format of the mode) + +.ti -3 +-t sort by time modified (latest first) instead of +by name, as is normal + +.ti -3 +-a list all entries; usually those beginning with "." are +suppressed + +.ti -3 +-s give size in blocks for each entry + +.ti -3 +-d if argument is a directory, list only its name, not +its contents (mostly used with "-l" to get status +on directory) +.sp +.in -5 +If no argument is given, "." is listed. +If an argument is not a directory, its name is given. +.sp +.ti 0 +FILES /etc/passwd to get user ID's for ls -l +.sp +.ti 0 +SEE ALSO stat(I) +.sp +.ti 0 +DIAGNOSTICS "name +nonexistent"; "name unreadable"; "name unstatable." +.sp +.ti 0 +BUGS -- diff --git a/man/man1/m6.1 b/man/man1/m6.1 new file mode 100644 index 0000000000..e36d103731 --- /dev/null +++ b/man/man1/m6.1 @@ -0,0 +1,109 @@ +.pa 1 +.he 'M6 (I)'11/15/72'M6 (I)' +.ti 0 +NAME m6 -- general purpose macro processor +.sp +.ti 0 +SYNOPSIS m6__ +[ -d__ arg1 ] [ arg2 [ arg3 ] ] +.sp +.ti 0 +DESCRIPTION m6__ +takes input from file arg2 (or standard input if arg2 is missing) +and places output on file arg3 (or standard output). +A working file of definitions, "m.def", +is initialized from file arg1 if that is supplied. +M6 differs from the standard [1] in these +respects: +.sp +#trace:, #source: and #end: +are not defined. +.sp +#meta,arg1,arg2: transfers the role of metacharacter +arg1 to character arg2. If two metacharacters become identical +thereby, the outcome of further processing is not guaranteed. +For example, to make []{} play the +roles of #:<> type +.sp +.in+5 +\\\#meta,<\\\#>,[: +.br +[meta,<:>,]: +.br +[meta,[substr,<<>>,1,1;,{] +.br +[meta,[substr,{{>>,2,1;,}] +.in-5 +.sp +#del,arg1: deletes the definition of macro arg1. +.sp +#save: and #rest: save and restore the definition table together with +the current metacharacters on file +m.def. +.sp +#def,arg1,arg2,arg3: works as in the standard with the extension +that an integer may be +supplied to arg3 to cause the new macro to perform the +action of a specified builtin before its replacement text is evaluated. +Thus all builtins +except #def: can be retrieved even after deletion. +Codes for arg3 are: +.sp +.in+5 +.nf +0 - no function +1,2,3,4,5,6 - gt,eq,ge,lt,ne,le +7,8 - seq,sne +9,10,11,12,13 - add,sub,mpy,div,exp +20 - if +21,22 - def,copy +23 - meta +24 - size +25 - substr +26,27 - go,gobk +28 - del +29 - dnl +30,31 - save,rest +.fi +.in-5 +.sp +.ti 0 +FILES m.def--working file of definitions +.br +/usr/lang/mdir/m6a--m6 processor proper (/usr/bin/m6 is only an initializer) +.br +/usr/lang/mdir/m6b--default initialization for m.def +.br +/bin/cp--used for copying initial value of m.def +.sp +.ti 0 +SEE ALSO [1] A. D. Hall, +The M6 Macroprocessor, Bell Telephone Laboratories, 1969 +.sp +.ti 0 +DIAGNOSTICS "err" +-- a bug, an unknown builtin or a bad definition table +.br +"oprd"--can't open input or initial definitions +.br +"opwr"--can't open output +.br +"ova" -- overflow of nested arguments +.br +"ovc" -- overflow of calls +.br +"ovd" -- overflow of definitions +.br +"Try again" -- no process available for copying m.def +.br +.sp +.ti 0 +BUGS Characters in internal tables are stored +one per word. +They really should be packed to improve capacity. +For want of space (and because of unpacked formats) no file arguments +have been provided to #save: or #rest:, +and no check is made on the actual opening of file m.def. +Again to save space, +garbage collection makes calls on #save: and #rest: and so overwrites +m.def. diff --git a/man/man1/mail.1 b/man/man1/mail.1 new file mode 100644 index 0000000000..6b00d12ae4 --- /dev/null +++ b/man/man1/mail.1 @@ -0,0 +1,58 @@ +.pa 1 +.he 'MAIL (I)'10/25/72'MAIL (I)' +.ti 0 +NAME mail -- send mail to another user +.sp +.ti 0 +SYNOPSIS mail____ [ -yn___ ] +.br +.ul +mail +letter person ... +.br +mail____ person +.sp +.ti 0 +DESCRIPTION mail____ +without an argument searches for a file called mailbox_______, prints +it if present, and asks if it should be saved. If the answer +is "y", the mail is renamed mbox____, otherwise it is deleted. +Mail____ with a -yn___ argument works the same way, except +that the answer to the question is supplied by the argument. +.sp +When followed by the names of a letter +and one or more people, +the letter is appended to +each person's mailbox_______. +When a person______ is specified without a letter______, +the letter is taken from the sender's standard input up to an EOT. +Each letter is preceded by the sender's name and a postmark. + +A person______ is either +a user name recognized by login_____, in which case the mail +is sent to the default working directory of that user, +or the path name of a directory, +in which case mailbox_______ in that directory is used. +.sp +When a user logs in he is informed of the presence +of mail. +.sp +.ti 0 +FILES /etc/passwd to identify sender +.br + to locate persons +.br +mailbox input mail +.br +mbox saved mail +.sp +.ti 0 +SEE ALSO login(I) +.sp +.ti 0 +DIAGNOSTICS "Who are you?" +if the user cannot be identified for some reason (a bug). +"Cannot send to user" if mailbox_______ cannot be opened. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/man.1 b/man/man1/man.1 new file mode 100644 index 0000000000..dec4eccec8 --- /dev/null +++ b/man/man1/man.1 @@ -0,0 +1,34 @@ +.pa 1 +.he 'MAN (I)'3/15/72'MAN (I)' +.ti 0 +NAME man -- run off section of UNIX manual +.sp +.ti 0 +SYNOPSIS man___ title [ section ] +.sp +.ti 0 +DESCRIPTION man___ +is a shell command file that will locate +and run off a particular section of this manual. +Title is the the desired +part of the manual. +Section is the section number of the manual. +(In Arabic, not Roman numerals.) +If section is missing, 1_ is assumed. +For example, + + man man + +would reproduce this page. +.sp +.ti 0 +FILES /sys/man/man?/* +.sp +.ti 0 +SEE ALSO sh(I), roff(I) +.sp +.ti 0 +DIAGNOSTICS "File not found", "Usage .." +.sp +.ti 0 +BUGS -- diff --git a/man/man1/mesg.1 b/man/man1/mesg.1 new file mode 100644 index 0000000000..880ab13d47 --- /dev/null +++ b/man/man1/mesg.1 @@ -0,0 +1,27 @@ +.pa 1 +.he 'MESG (I)'3/15/72'MESG (I)' +.ti 0 +NAME mesg -- permit or deny messages +.sp +.ti 0 +SYNOPSIS mesg____ [ n_ ][ y_ ] +.sp +.ti 0 +DESCRIPTION mesg____ n_ +forbids messages via write_____ by revoking non-user +write permission on the user's typewriter. +mesg____ y_ reinstates permission. +mesg____ with no argument reverses the current permission. +In all cases the previous state is reported. +.sp +.ti 0 +FILES /dev/tty? +.sp +.ti 0 +SEE ALSO write(I) +.sp +.ti 0 +DIAGNOSTICS "?" if the standard input file is not a typewriter +.sp +.ti 0 +BUGS -- diff --git a/man/man1/mkdir.1 b/man/man1/mkdir.1 new file mode 100644 index 0000000000..7c1598192f --- /dev/null +++ b/man/man1/mkdir.1 @@ -0,0 +1,25 @@ +.pa 1 +.he 'MKDIR (I)'3/15/72'MKDIR (I)' +.ti 0 +NAME mkdir -- make a directory +.sp +.ti 0 +SYNOPSIS mkdir_____ dirname ... +.sp +.ti 0 +DESCRIPTION mkdir_____ creates specified directories +in mode 17. +.sp +The standard entries "." and ".." are made automatically. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO rmdir(I) +.sp +.ti 0 +DIAGNOSTICS "dirname ?" +.sp +.ti 0 +BUGS -- diff --git a/man/man1/mt.1 b/man/man1/mt.1 new file mode 100644 index 0000000000..e01ec0c5dc --- /dev/null +++ b/man/man1/mt.1 @@ -0,0 +1,124 @@ +.pa 1 +.he 'MT (I)'6/12/72'MT (I)' +.ti 0 +NAME mt -- manipulate magtape +.sp +.ti 0 +SYNOPSIS mt__ [ key ] [ name ... ] +.sp +.ti 0 +DESCRIPTION mt__ +saves and restores selected portions of the file system +hierarchy on magtape. +Its actions are controlled by the key___ argument. +The key is a string of characters containing +at most one function letter and possibly +one or more function modifiers. +Other arguments to the command are file or directory +names specifying which files are to be dumped, restored, +or tabled. + +The function portion of +the key is specified by one of the following letters: + +.in +6 +.ti -3 +r The indicated files and directories, together with +all subdirectories, are dumped +onto the tape. +The old contents of the tape are lost. + +.ti -3 +x extracts the named files from the tape to the file system. +The owner, mode, and date-modified are restored to what they +were when the file was dumped. +If no file argument is given, the entire contents of the +tape are extracted. + +.ti -3 +t lists the names of all files stored on the tape which +are the same as or are hierarchically below +the file arguments. If no file argument is given, +the entire contents of the tape are tabled. + +.ti -3 +l is the same as t_ except that an expanded listing +is produced giving all the available information about the +listed files. + +.in -6 +The following characters may be used in addition to the letter +which selects the function desired. + +.in +6 +.ti -3 +0, ..., 7 This modifier selects the drive on which the tape is mounted. +"0" is the default. + +.ti -3 +v Normally mt__ does its work silently. The v_ (verbose) +option causes it to type the name of each file it treats +preceded by a letter to indicate what is happening. + +.in +2 + a file is being added + x file is being extracted + +.in -2 +The v_ option can be used with r_ and x_ only. + +.ti -3 +f causes +new entries copied on tape to be 'fake' in that +only the entries, not the data associated +with the entries are updated. +Such fake entries cannot be extracted. +Usable only with r_. + +.ti -3 +w causes mt__ to pause before treating each file, type +the indicative letter and the file name (as with v_) +and await the user's response. Response +"y" means "yes", so the file is treated. Null response +means "no", and the file does not take part +in whatever is being done. Response "x" means "exit"; +the mt__ command terminates immediately. In the x_ function, +files previously asked about +have been extracted already. +With r_, no change has been made to the tape. + +.ti -3 +m make (create) directories during an x_ if necessary. +.in -6 +.sp +.ti 0 +FILES /dev/mt? +.sp +.ti 0 +SEE ALSO tap(I), tap(V) +.sp +.ti 0 +DIAGNOSTICS Tape open error +.br +Tape read error +.br +Tape write error +.br +Directory checksum +.br +Directory overflow +.br +Seek error +.br +Tape overflow +.br +Phase error (a file has changed after it was selected for +dumping but before it was dumped) +.br +.sp +.ti 0 +BUGS If, during an "x", +the files are specified in a different order +than they are on the tape, +seek errors will result because the tape +cannot be rewound. diff --git a/man/man1/mv.1 b/man/man1/mv.1 new file mode 100644 index 0000000000..7966ab0ae0 --- /dev/null +++ b/man/man1/mv.1 @@ -0,0 +1,28 @@ +.pa 1 +.he 'MV (I)'2/9/73'MV (I)' +.ti 0 +NAME mv -- move or rename a file +.sp +.ti 0 +SYNOPSIS mv__ name\d1\u name\d2\u +.sp +.ti 0 +DESCRIPTION mv__ +changes the name of name\d1\u to +name\d2\u. +If name\d2\u is a directory, name\d1\u is moved to +that directory with its original file-name. +Directories may only be moved within the same parent +directory (just renamed). +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS yes +.sp +.ti 0 +BUGS -- diff --git a/man/man1/nm.1 b/man/man1/nm.1 new file mode 100644 index 0000000000..6a4bc5be2c --- /dev/null +++ b/man/man1/nm.1 @@ -0,0 +1,33 @@ +.pa 1 +.he 'NM (I)'3/15/72'NM (I)' +.ti 0 +NAME nm -- print name list +.sp +.ti 0 +SYNOPSIS nm__ [ name ] +.sp +.ti 0 +DESCRIPTION nm__ +prints the symbol table from the output file of an +assembler or loader run. +Each symbol name is preceded by its value (blanks if undefined) +and one of the letters "U" (undefined) "A" (absolute) "T" +(text segment symbol), +"D" (data segment symbol), or "B" +(bss segment symbol). +Global symbols have their first character underlined. +The output is sorted alphabetically. +.sp +If no file is given, the symbols in a.out_____ are listed. +.sp +.ti 0 +FILES a.out +.sp +.ti 0 +SEE ALSO as(I), ld(I) +.sp +.ti 0 +DIAGNOSTICS "?" +.sp +.ti 0 +BUGS -- diff --git a/man/man1/nroff.1 b/man/man1/nroff.1 new file mode 100644 index 0000000000..1a770595d5 --- /dev/null +++ b/man/man1/nroff.1 @@ -0,0 +1,191 @@ +.pa 1 +.he 'NROFF (I)'1/15/73'NROFF (I)' +.ti 0 +NAME nroff -- format text +.sp +.ti 0 +.nf +SYNOPSIS nroff_____ [+_N] [-s__] [-h__] [-q__] [-i__] files +.fi +.sp +.ti 0 +DESCRIPTION nroff_____ +formats text according to control lines embedded +in the text files. +The non-file option arguments are interpreted as follows: + +.in +6 +.ti -3 ++N Output will commence at the first page whose page +number is N (independent of whether or not the +page number is being printed). + +.ti -3 +-s Stop between pages. Printing will halt prior to +each page (including the first) to permit paper +loading and changing. Printing is restarted by +typing either a "newline" or "delete" character. + +.ti -3 +-h High-speed output. During output, strings of +space characters are replaced where possible with +tab characters to speed up output. Futhermore, if +the output is directed into a file or a pipe, +this mode effectively reduces the total number of +characters in the file or pipe; this is especially +important in multi-column output where the +temporary file(s) or pipe(s) would otherwise contain +a large number of space characters. + +.ti -3 +-q The prompt names for insertions are not printed +and the bell character is sent instead; in +addition, the insertion is not echoed. This mode +permits insertions during the actual output printing + +.ti -3 +-i Index mode. NROFF creates a file called "index" +containing every word output together with the +line and page number. The format is word, tab, +page, tab, line, newline, etc. Invoking this mode +slows down the execution of NROFF considerably. +.sp +.in -6 +Nroff is more completely described +in [1]. +A condensed Request Summary is included here. +.sp +.ti 0 +FILES /etc/suftab suffix hyphenation tables +.br +/tmp/rtm? temporary +.br +.sp +.ti 0 +SEE ALSO [1] NROFF User's Manual (available as MM-73-1271-2). +.sp +.ti 0 +DIAGNOSTICS none +.sp +.ti 0 +BUGS - +.in 0 +.bp +.cc % +%nf +%ce +REQUEST REFERENCE AND INDEX + +Request Initial If no Cause +Form____ Value_____ Argument________ Break_____ Explanation___________ + +I. Page____ Control_______ + +.pl +_N N=66 N=66 no P_age L_ength. +.bp +_N N=1 - yes B_egin P_age. +.pn +_N N=1 ignored no P_age N_umber. +.po +_N N=0 N=prev no P_age O_ffset. +.ne N - N=1 no NE__ed N lines. + +II. Text____ Filling_______, Adjusting_________, and___ Centering_________ + +.br - - yes BR__eak. +.fi fill - yes FI__ll output lines. +.nf fill - yes N_oF_ill. +.ad c adj,norm adjust no AD__just mode on. +.na adjust - no N_oA_djust. +.ce N off N=1 yes CE__nter N input text lines. + +III. Line____ Spacing_______ and___ Blank_____ Lines_____ + +.ls +_N N=1 N=prev no L_ine S_pacing. +.sp N - N=1 yes SP__ace N lines +.lv N - N=1 no OR- +.sv N - N=1 no S_aV_e N lines. +.os - - no O_utput S_aved lines. +.ns space - no N_o-S_pace mode on. +.rs - - no R_estore S_pacing. +.xh off - no EX_tra-H_alf-line mode on. + +IV. Line____ Length______ and___ Indenting_________ + +.ll +_N N=65 N=prev no L_ine L_ength. +.in +_N N=0 N=prev yes IN__dent. +.ti +_N - N=1 yes T_emporary I_ndent. + +V. Macros______, Diversion_________, and___ Line____ Traps_____ + +.de xx - ignored no DE__fine or redefine a macro. +.rm xx - - no R_eM_ove macro name. +.di xx - end no DI__vert output to macro "xx". +.wh -_N xx - no WH__en; set a line trap. +.ch -_N -_M - no OR- +.ch xx -_M - no OR- +.ch -_N y - no OR- +.ch xx y - no CH__ange trap line. + +VI. Number______ Registers_________ + +.nr a +_N -_M - no OR- +.nr ab +_N -_M - no N_umber R_egister. +.nc c \\n \\n no N_umber C_haracter. +.ar arabic - no Arabic numbers. +.ro arabic - no Roman numbers. +.RO arabic - no ROMAN numbers. + +VII. Input_____ and___ Output______ Conventions___________ and___ Character_________ Translations____________ + +.ta N,M,... none no PseudoTA__bs setting. +.tc c space space no T_ab replacement C_haracter. +.lc c . . no L_eader replacement C_haracter. +.ul N - N=1 no UN__derline input text lines. +.cc c . . no Basic C_ontrol C_haracter. +.c2 c ' ' no Nobreak control character. +.li N - N=1 no Accept input lines LI__terally. +.tr abcd.... - no TR__anslate on output. + +VIII. Hyphenation___________. + +.nh on - no N_o H_yphen. +.hy on - no HY__phenate. +.hc c none none no H_yphenation indicator C_haracter. + +IX. Three_____ Part____ Titles______. + +.tl 'left'center'right' no T_itL_e. +.lt N N=65 N=prev no L_ength of T_itle. + +X. Output______ Line____ Numbering_________. + +.nm +_N M S I off no N_umber M_ode on or off, set parameters. +.np M S I reset no N_umber P_arameters set or reset. + +XI. Conditional___________ Input_____ Line____ Acceptance__________ + +.if c anything - no OR- +.if !c anything - no OR- +.if N anything - no OR- +.if !N anything - no IF__ true accept line of "anything". + +XII. Environment___________ Switching_________. + +.ev N N=0 N=prev no E_nV_ironment switched. + +XIII. Insertions__________ from____ the___ Standard________ Input_____ Stream______ + +.rd prompt bell no R_eaD_ insert. +.ex - - no EX__it. + +XIV. Input_____ File____ Switching _________ + +.so filename - no Switch SO__urce file (push down). +.nx filename - no N_eX_t file. +.sp +XV. Miscellaneous_____________ + +.ig - - no IG__nore. +.fl - - no FL__ush output buffer. +.ab - - no AB__ort. +%cc . +.fi +.in 16 diff --git a/man/man1/od.1 b/man/man1/od.1 new file mode 100644 index 0000000000..114143eebd --- /dev/null +++ b/man/man1/od.1 @@ -0,0 +1,74 @@ +.pa 1 +.he 'OD (I)'1/15/73'OD (I)' +.ti 0 +NAME od -- octal dump +.sp +.ti 0 +SYNOPSIS od__ [ -abcdho_______ ] [ file ] [ [+_]offset[._][b_] ] +.sp +.ti 0 +DESCRIPTION od__ +dumps +file____ +in +one or more formats +as +selected by the first argument. +(If the first argument is missing, -o__ is default.) +The meanings of the format argument characters +are: + +.in +5 +.ti -2 +a_ interprets words as PDP-11 instructions and +dis-assembles the operation code. +Unknown operation codes print as ???. + +.ti -2 +b_ interprets bytes in octal. + +.ti -2 +c_ interprets bytes in ascii. +Unknown ascii characters are printed as \\?. + +.ti -2 +d_ interprets words in decimal. + +.ti -2 +h_ interprets words in hex. + +.ti -2 +o_ interprets words in octal. + +.in -5 +The file argument specifies which file is to be dumped. +If no file argument is specified, +the standard input is used. +Thus od can be used as a filter. + +The offset argument specifies the offset +in the file where dumping is to commence. +This argument is normally interpreted +as octal bytes. +If '.' is appended, the offset is interpreted in +decimal. +If 'b' is appended, the offset is interpreted in blocks. +(A block is 512 bytes.) +If the file argument is omitted, +the offset argument must be preceded by '+'. + +Dumping continues until an end-of-file +condition or until +halted by sending an interrupt signal. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO db(I) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man1/opr.1 b/man/man1/opr.1 new file mode 100644 index 0000000000..0c015ccf59 --- /dev/null +++ b/man/man1/opr.1 @@ -0,0 +1,48 @@ +.pa 1 +.he 'OPR (I)'1/15/73'OPR (I)' +.ti 0 +NAME opr -- off line print +.sp +.ti 0 +SYNOPSIS opr___ [--__] [-_] [+_] [+-__]file918 ... +.sp +.ti 0 +DESCRIPTION opr___ +will arrange to have the +201 data phone daemon submit a job to the +Honeywell 6070 to print the file arguments. +Normally, +the output appears at the GCOS central site. +If the first argument is --__, the output +is remoted to station R1. +(Station R1 has a 1403 printer.) + +Normally, each file is printed in the state it is found +when the data phone daemon reads it. +If a particular file argument is preceded by +_, +or a preceding argument of +_ has been encountered, +then opr___ will make a copy for the daemon to print. +If the file argument is preceded by -_, +or a preceding argument of -_ has been encountered, +then opr will unlink (remove) the file. + +If there are no +arguments except for the optional --__, +then the standard input is read and off-line printed. +Thus opr___ may be used as a filter. +.sp +.ti 0 +FILES /usr/dpd/* spool area +.br +/etc/passwd personal ident cards +.br +/etc/dpd daemon +.sp +.ti 0 +SEE ALSO dpd(I), passwd(V) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man1/ov.1 b/man/man1/ov.1 new file mode 100644 index 0000000000..c3a4bcd303 --- /dev/null +++ b/man/man1/ov.1 @@ -0,0 +1,30 @@ +.pa 1 +.he 'OV (I)'6/12/72'OV (I)' +.ti 0 +NAME ov -- overlay pages +.sp +.ti 0 +SYNOPSIS ov__ [ file ] +.sp +.ti 0 +DESCRIPTION ov__ +is a postprocessor for producing double column formatted +text when using nroff(I). +ov__ +literally overlays successive pairs of 66-line pages. + +If the file argument is missing, +the standard input is used. +Thus ov__ may be used as a filter. +.sp +.ti 0 +FILES none +.sp +.ti 0 +SEE ALSO nroff(I), pr(I) +.sp +.ti 0 +DIAGNOSTICS none +.sp +.ti 0 +BUGS Other page lengths should be permitted. diff --git a/man/man1/passwd.1 b/man/man1/passwd.1 new file mode 100644 index 0000000000..b5e916b224 --- /dev/null +++ b/man/man1/passwd.1 @@ -0,0 +1,30 @@ +.pa 1 +.he 'PASSWD (I)'9/1/72'PASSWD (I)' +.ti 0 +NAME passwd -- set login password +.sp +.ti 0 +SYNOPSIS passwd______ name password +.sp +.ti 0 +DESCRIPTION The +password is placed on the given login name. +This can only be done by the user ID +corresponding to the login name or by the super-user. +An explicit null argument ("") for the password +argument will remove +any password from the login name. +.sp +.ti 0 +FILES /etc/passwd +.sp +.ti 0 +SEE ALSO login(I), passwd(V), crypt(III) +.sp +.ti 0 +DIAGNOSTICS Diagnostics +are given for a non-match of the login name, +lack of permission and for password file format errors. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/pr.1 b/man/man1/pr.1 new file mode 100644 index 0000000000..80bd0dcc1d --- /dev/null +++ b/man/man1/pr.1 @@ -0,0 +1,49 @@ +.pa 1 +.he 'PR (I)'1/15/73'PR (I)' +.ti 0 +NAME pr -- print file +.sp +.ti 0 +SYNOPSIS pr__ [-cm___] [-h__ name] [-_n] [+_n] [file918 ...] +.sp +.ti 0 +DESCRIPTION pr__ +produces a printed listing of one or more files. +The output is separated into pages headed by a date, +the name of the file or a header (if any), and the page number. +If there are no file arguments, pr__ prints the standard +input file, and is thus usable as a filter. + +Options apply to all following files but may be reset +between files: + + -c__ print current date + -m__ print date file last modified (default) +.sp + -_n produce n-column output +.sp + +_n begin printing with page n +.sp + -h__ treats the next argument as a header +.sp +If there is a header in force, it is printed in place of +the file name. +.sp +Interconsole messages via write_____(I) are +forbidden during a pr__. +.sp +.sp +.ti 0 +FILES /dev/tty? +to suspend messages. +.sp +.ti 0 +SEE ALSO cat(I), cp(I) +.sp +.ti 0 +DIAGNOSTICS none (files not found are ignored) +.sp +.ti 0 +BUGS In multi-column +output, non-printing characters other than new-line +cause misalignment. diff --git a/man/man1/proof.1 b/man/man1/proof.1 new file mode 100644 index 0000000000..b817bd9cce --- /dev/null +++ b/man/man1/proof.1 @@ -0,0 +1,41 @@ +.pa 1 +.he 'PROOF (I)'1/15/73'PROOF (I)' +.ti 0 +NAME proof -- compare two text files +.sp +.ti 0 +SYNOPSIS proof_____ +oldfile newfile +.sp +.ti 0 +DESCRIPTION proof_____ +lists +those lines of +.ul +newfile +that differ from corresponding lines in +.ul +oldfile. +The line number in +.ul +newfile +is given. +When changes, insertions or deletions have +been made the program attempts to resynchronize +the text in the two files by finding a sequence of +lines in both files that again agree. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO cmp(I) +.sp +.ti 0 +DIAGNOSTICS yes, +but they are undecipherable, e.g. "?1". +.sp +.ti 0 +BUGS proof_____ +is still evolving. Any bugs discovered or suggestions +should be brought to ENP. diff --git a/man/man1/reloc.1 b/man/man1/reloc.1 new file mode 100644 index 0000000000..a5fcc57257 --- /dev/null +++ b/man/man1/reloc.1 @@ -0,0 +1,45 @@ +.pa 1 +.he 'RELOC (I)'2/7/73'RELOC (I)' +.ti 0 +NAME reloc -- relocate object files +.sp +.ti 0 +SYNOPSIS reloc_____ file [-_]octal [ -_ ] +.sp +.ti 0 +DESCRIPTION reloc_____ +modifies the named object program file so that it will operate correctly +at a different core origin than the one for which +it was assembled or loaded. + +The new core origin is the old origin +increased by +the given octal_____ +number (or decreased if the number has a "-" sign). + +If the object file was generated by the link-editor ld__, +the "-r" ld__ option must have been given to +preserve the relocation information in the file. + +If the optional last argument is given, then any +"setd" instruction at the start of the file +will be replaced by a no-op. + +The purpose of this command is to simplify the +preparation of object programs for systems +which have no relocation hardware. +It is hard to imagine a situation +in which it would be useful to attempt directly to execute +a program treated by reloc_____. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO as(I), ld(I), a.out(V) +.sp +.ti 0 +DIAGNOSTICS As appropriate +.sp +.ti 0 +BUGS -- diff --git a/man/man1/rew.1 b/man/man1/rew.1 new file mode 100644 index 0000000000..d9fb897b94 --- /dev/null +++ b/man/man1/rew.1 @@ -0,0 +1,30 @@ +.pa 1 +.he 'REW (I)'1/15/73'REW (I)' +.ti 0 +NAME rew -- rewind tape +.sp +.ti 0 +SYNOPSIS rew ___ [ [m_]digit ] +.sp +.ti 0 +DESCRIPTION rew___ +rewinds DECtape or magtape drives. The digit is the logical +tape number, and should range from 0 to 7. +If the digit is preceded by 'm', +rew___ applies to magtape rather than DECtape. +A missing digit indicates drive 0. +.sp +.ti 0 +FILES /dev/tap? +.br +/dev/mt? +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS "?" if there is no tape mounted on the indicated +drive or if the file cannot be opened. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/rm.1 b/man/man1/rm.1 new file mode 100644 index 0000000000..dfab84fa96 --- /dev/null +++ b/man/man1/rm.1 @@ -0,0 +1,48 @@ +.pa 1 +.he 'RM (I)'1/20/73'RM (I)' +.ti 0 +NAME rm -- remove (unlink) files +.sp +.ti 0 +SYNOPSIS rm__ [ -f__ ] [ -r__ ] name\d1\u ... +.sp +.ti 0 +DESCRIPTION rm__ +removes the entries for one or more files from a directory. +If an entry was the last link to the file, the file +is destroyed. +Removal of a file requires write permission in its directory, +but neither read nor write permission on the file itself. + +If there is no write permission to a +file designated to be removed, +rm__ will print the file name, its mode and then +read a line from the standard input. +If the line begins with 'y', the file is removed, +otherwise it is not. +The optional argument -f__ prevents the above interaction. + +If a designated file is a directory, +an error comment is printed unless the optional +argument -r__ has been used. +In that case, rm__ recursively deletes the +entire contents of the specified directory. +To remove directories per se see rmdir(I). +.sp +.ti 0 +FILES /etc/glob to implement -r__ flag +.sp +.ti 0 +SEE ALSO rmdir(I) +.sp +.ti 0 +DIAGNOSTICS "name: non existent" +.br +"name: not removed" if cannot remove +.br +"name: try again" error from fork +.sp +.ti 0 +BUGS When +rm__ removes the contents of a directory under the +-r__ flag, full pathnames are not printed in diagnostics. diff --git a/man/man1/rmdir.1 b/man/man1/rmdir.1 new file mode 100644 index 0000000000..1434b05878 --- /dev/null +++ b/man/man1/rmdir.1 @@ -0,0 +1,32 @@ +.pa 1 +.he 'RMDIR (I)'3/15/72'RMDIR (I)' +.ti 0 +NAME rmdir -- remove directory +.sp +.ti 0 +SYNOPSIS rmdir_____ dir\d1\u ... +.sp +.ti 0 +DESCRIPTION rmdir_____ +removes (deletes) directories. +The directory must be empty (except for the standard entries +"." and "..", which rmdir_____ itself removes). +Write permission is required in the +directory in which the directory appears. +.sp +.ti 0 +FILES none +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS "dir?" +is printed if directory dir___ cannot be found, is not a directory, or is not +removable. +.sp +"dir -- directory not empty" is printed if dir___ has entries +other than "." or "..". +.sp +.ti 0 +BUGS -- diff --git a/man/man1/roff.1 b/man/man1/roff.1 new file mode 100644 index 0000000000..24d9e26c7c --- /dev/null +++ b/man/man1/roff.1 @@ -0,0 +1,197 @@ +.pa 1 +.he 'ROFF (I)'6/12/72'ROFF (I)' +.ti 0 +NAME roff -- format text +.sp +.ti 0 +.nf +SYNOPSIS roff____ [ +_number ] [ -s__ ] [ -h__ ] file\d1\u ... +.fi +.sp +.ti 0 +DESCRIPTION roff____ +formats text according to control lines embedded +in the text in file918, ... . +Encountering a nonexistent file terminates printing. +The optional argument "+_number" causes printing +to begin at the first page +with that number. +The optional argument +"-s__" causes printing to stop before each page +including the first +to allow paper manipulation; +printing is resumed upon +receipt of an interrupt signal. +The optional argument +"-h" causes the output to contain +horizontal tabs for two or more spaces +that end on a tab stop. +An interrupt signal received during printing terminates all +printing. +Incoming interconsole messages are turned off during printing, +and the original message acceptance state is restored upon +termination. +.sp +At the present time, there +is no document describing ROFF in full. +A Request Summary is attached. +.sp +.ti 0 +FILES /etc/suftab suffix hyphenation tables +.br +/tmp/rtm? temporary +.br +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS none +.sp +.ti 0 +BUGS - +.bp +.de xx +.ti0 +.li +.. +.tc | +.tr | +.in 0 +.ce +REQUEST SUMMARY +.sp2 +.ul +Request Break Initial Meaning +.in24 +.na +.sp +.xx +.ad yes yes Begin adjusting right margins. +.xx +.ar no arabic Arabic page numbers. +.xx +.br yes - Causes a line break -­ thå filling of +the current line is stopped. +.xx +.bl|n yes - Insert contiguous block of n blank lines. +If necessary, a new page will be +started to accomodate the entire block. +.xx +.bp|+n yes n=1 Begin new page and number it n. +If n is not given, normal sequencing occurs. +.xx +.cc|c no c=. Control character becomes `c'. +.xx +.ce|n yes - Center the next n input lines, +without filling. +.xx +.de|xx no - Define macro named "xx" +(definition ends with a line beginning with ".."). +.xx +.ds yes no Double space; same as ".ls 2". +.xx +.ef|t no t='''' Even foot title becomes t. +.xx +.eh|t no t='''' Even head title becomes t. +.xx +.fi yes yes Begin filling output lines. +.xx +.fo no t='''' All foot titles are t. +.xx +.hc|c no none Hyphenation character set to `c'. +.xx +.he|t no t='''' All head titles are t. +.xx +.hx no - Title lines are suppressed. +.xx +.hy|n no n=1 Hyphenation is done, if n=1; +and is not done, if n=0. +.xx +.ig no - Ignore input lines until and including +a line beginning with "..". +.xx +.in|+n yes - Indent n spaces from left margin. +.xx +.ix +n no - Same as ".in" but without break. +.xx +.li|n no - Literal, treat next n lines as text. +.xx +.ll|+n no n=65 Line length including indent is n characters. +.xx +.ls|+n yes n=1 Line spacing set to n lines per output line. +.xx +.m1|n no n=2 n blank lines are put between the top +of a new page and the head title. +.xx +.m2|n no n=2 n blanks lines put between head title +and beginning of text on page. +.xx +.m3|n no n=1 n blank lines put between the end of +text and the foot title. +.xx +.m4|n no n=3 n blank lines put between the foot title +and the bottom of page. +.xx +.na yes no Stop adjusting the right margin. +.xx +.ne|n no - Begin new page, if n output lines +cannot fit on present page. +.xx +.nn|+n no - The next n output lines are not numbered. +.xx +.n1 no no Output lines are numbered sequentially +beginning with 1 on each new page. +Head and foot titles are not numbered. +.xx +.n2 no no Output lines are numbered sequentially +beginning with 1 on the next output line. +.xx +.ni|+n no n=0 Line numbers are indented n. +.xx +.nf yes no Stop filling output lines. +.xx +.nx|filename - Change to input file "filename". +.xx +.of|t no t='''' Odd foot title becomes t. +.xx +.oh|t no t='''' Odd head title becomes t. +.xx +.pa|+n yes n=1 Same as ".bp". +.xx +.pl|+n no n=66 Total paper length taken to be n lines. +.xx +.po|+n no n=0 Page offset. +All lines are preceded by N spaces. +.xx +.ro no arabic Roman page numbers. +.xx +.sk|n no - n pages with head and foot titles but +otherwise blank will be output beginning +with the next page containing text. +.xx +.sp|n yes - Insert block of n blank lines. +If the bottom of a page is reached, +remaining lines are not___ put on next page. +.xx +.ss yes yes Single space output lines, +equivalent to ".ls 1". +.xx +.ta|N|M|... - Pseudotab settings. +Initial tab settings are columns 9,17,25,... +.xx +.tc|c no c="|" Tab replacement character becomes "c". +.xx +.ti|+n yes - Temporarily indent next output line +n spaces. +.xx +.tr|abcd.. no - Translate a into b, c into d, etc. +.xx +.ul|n no - Underline the letters and numbers on the +next n input lines. +.sp +.in0 +.fi +.tc +.in 16 +.tr || diff --git a/man/man1/sh.1 b/man/man1/sh.1 new file mode 100644 index 0000000000..114920c2d7 --- /dev/null +++ b/man/man1/sh.1 @@ -0,0 +1,386 @@ +.pa 1 +.he 'SH (I)'1/15/73'SH (I)' +.ti 0 +NAME sh -- shell (command interpreter) +.sp +.ti 0 +SYNOPSIS sh__ [ name [ arg\d1\u ... [ arg\d9\u ] ] ] +.sp +.ti 0 +DESCRIPTION +.br +.in 8 +sh__ +is the standard command interpreter. +It is the program which reads and arranges the execution of +the command lines typed by most users. +It may itself be called as a command to interpret +files of commands. +Before discussing the arguments to the shell +used as a command, the structure of command +lines themselves will be given. + +.ul +Command lines +.sp +Command lines are sequences of commands separated by command +delimiters. +Each command is a sequence of non-blank command arguments +separated by blanks. +The +first argument specifies the name of a command to be +executed. Except for certain types of special +arguments discussed below, the arguments +other than the command name are passed +without interpretation to the invoked +command. +.sp +If the first argument is the name of an executable +file, it is invoked; +otherwise the string "/bin/" is prepended to the argument. +(In this way most standard commands, +which reside in "/bin", are found.) +If no such command is found, +the string "/usr" is further prepended +(to give "/usr/bin/command") and another attempt +is made to execute the resulting +file. +(Certain "overflow" commands +live in "/usr/bin".) If +the "/usr/bin" file exists, but is not +executable, it is used by the shell as +a command file. +That is to say it is executed +as though it were typed from the console. +If all attempts fail, a diagnostic is printed. +.sp +The remaining non-special arguments are simply passed to the command +without further interpretation by the shell. +.sp +.ul +Command delimiters + +There are three command delimiters: the new-line, ";", and "&". +The semicolon ";" specifies sequential execution of the commands +so separated; that is, +.sp + coma; comb +.sp +causes the execution first of command coma____, then of comb____. +The ampersand "&" causes simultaneous execution: +.sp + coma & comb +.sp +causes coma____ to be called, +followed immediately by comb____ without waiting for coma____ to finish. +Thus coma____ and comb____ +execute simultaneously. As a special case, +.sp + coma & +.sp +causes coma____ to be executed and the shell immediately +to request another command without waiting for coma____. +.a +.sp +.ul +Termination Reporting +.sp +If a command (not followed by "&") terminates abnormally, +a message is printed. +(All terminations other than exit and interrupt +are considered abnormal.) +The following is a list of the abnormal +termination messages: +.sp + Bus error + Trace/BPT trap + Illegal instruction + IOT trap + Power fail trap + EMT trap + Bad system call + Quit + PIR trap + Floating exception + Memory violation + Killed + User I/O + Error +.sp +If a core image is produced, +" -- Core dumped" is appended to the appropriate message. +.sp +.ul +Redirection of I/O + +Three character sequences cause the immediately following string +to be interpreted as a special argument to the shell itself, not +passed to the command. + +An argument of the form "arg" causes file "arg" to be used +as the standard output file for the given command. +"Arg" is created if it did not exist, and in any case is truncated +at the outset. + +An argument of the form ">>arg" causes file "arg" to be used as the +standard output for the given command. If "arg" +did not exist, it is created; if it did exist, +the command output is appended to the file. + +.ul +Pipes and Filters + +A pipe____ is a channel such that information +can be written into one end of the pipe by one program, +and read at the other end by another program. +(See pipe____ (II)). A +filter______ is a program which reads the standard +input file, performs some transformation, +and writes the result on the standard output file. +By extending the syntax used +for redirection of I/O, a command line can +specify that the output produced by +a command be passed via a pipe +through another command which acts as a filter. +For example: + + command >filter> + +More generally, special arguments of the form + + >f\d1\u>f\d2\u>...> + +specify that output is to be passed successively +through the filters f\d1\u, f\d2\u, ..., +and end up on the standard output stream. +By saying instead + + >f\d1\u>f\d2\u>...>file + +the output finally ends up in file____. (The +last ">" could also have been a ">>" +to specify concatenation onto the end of file____.) + +In exactly analogous manner input filtering can +be specified via one of + + pr> + +produces a listing of the current directory with +page headings, while + + ls >pr>xx + +puts the paginated listing into the file xx. + +If any of the filters needs arguments, quotes can be used +to prevent the required blank characters from +violating the blankless +syntax of filters. +For example: + + ls >"pr -h 'My directory'"> + +uses quotes twice, once to protect the entire pr__ command, +once to protect the heading argument of pr__. +(Quotes are discussed fully below.) + +.ul +Generation of argument lists + +If any argument contains any of the characters "?", +"*" or '[', it is treated specially as follows. +The current directory is searched for files which match_____ +the given argument. + +The character "*" in an argument matches any string of characters +in a file name (including the null string). + +The character "?" matches any +single character in a file name. + +Square brackets "[...]" specify +a class of characters which +matches any single file-name character in the class. +Within the brackets, +each ordinary character is taken +to be a member of the class. +A pair of characters separated by "-" places +in the class +each character lexically greater than or equal to +the first and less than or equal to the second +member of the pair. + +Other characters match only the same character in +the file name. + +For example, "*" matches all file names; +"?" matches all one-character file names; "[ab]*.s" matches +all file names beginning with "a" or "b" and ending with ".s"; +"?[zi-m]" matches all two-character file names ending +with "z" or the letters "i" through "m". + +If the argument with "*" or "?" also contains a "/", a slightly +different procedure is used: instead of the current directory, +the directory used is the one obtained +by taking the argument up to the last "/" before a "*" or "?". +The matching process matches the remainder of the argument +after this "/" against the files in the derived directory. +For example: "/usr/dmr/a*.s" matches +all files in directory "/usr/dmr" which begin +with "a" and end with ".s". + +In any event, a list of names is obtained which match +the argument. This list is sorted into alphabetical order, +and the resulting sequence of arguments replaces the +single argument containing the "*", "[", or "?". +The same process is carried out for each argument +(the resulting lists are not___ merged) +and finally the command is called with the resulting list of +arguments. + +For example: directory /usr/dmr contains the files +a1.s, a2.s, ..., a9.s. From any directory, the command + + as /usr/dmr/a?.s + +calls as__ with arguments +/usr/dmr/a1.s, /usr/dmr/a2.s, ... +/usr/dmr/a9.s +in that order. +.sp +.ul +.ul +Quoting + +The character "\\" causes the immediately following character +to lose any special meaning it may have to the shell; in this +way "<", ">", and other characters meaningful to the +shell may be passed as part of arguments. +A special case of this feature allows the continuation of commands +onto more than one line: a new-line preceded by "\\" is translated +into a blank. +.sp +Sequences of characters enclosed in double (") or single (') +quotes are also taken literally. +.sp +.ul +Argument passing + +When the shell is invoked as a command, it has additional +string processing capabilities. +Recall that the form in which the shell is invoked is + + sh [ name [ arg\d1\u ... [ arg\d9\u ] ] ] + +The name____ is the name of a file which will be read and +interpreted. If not given, this subinstance of the shell +will continue to read the standard input file. + +In command lines in the file +(not in command input), +character sequences of the form "$n", where n_ is a digit 0, ..., 9, +are replaced by the n_th argument to the invocation +of the shell (arg\dn\u). +"$0" is replaced by name____. + +.ul +End of file + +An end-of-file in the shell's input causes it to exit. +A side effect of this fact means that the way to +log out from UNIX is to type an end of file. + +.ul +Special commands + +Two commands are treated specially by the shell. + +"Chdir" is done without +spawning a new process by executing the sys___ chdir_____ +primitive. + +"Login" is done by executing +/bin/login without creating a new process. + +These peculiarities are inexorably imposed +upon the shell by the basic structure +of the UNIX process control system. +It is a rewarding exercise to work +out why. + +.ul +Command file errors; interrupts + +Any shell-detected error, or an interrupt signal, +during the execution of a command file +causes the shell to cease execution of that file. + +.in 16 +.ti 0 +FILES /etc/glob, +which interprets "*", "?", and "[". +.sp +.ti 0 +SEE ALSO "The UNIX Time-sharing System", +which gives the theory of operation of the +shell. +.sp +.ti 0 +DIAGNOSTICS +.br +.in 8 +"Input not found", when a command file is +specified which cannot be read; +.br +"Arg count", if the number of arguments to the chdir pseudo-command +is not exactly 1, +or if "*", "?", or "[" is used inappropriately; +.br +"Bad directory", if the directory given in "chdir" cannot be +switched to; +.br +"Try again", if no new process can be created to execute +the specified command; +.br +""' imbalance", if single or double quotes are not matched; +.br +"Input file", if an argument after "<" cannot be read; +.br +"Output file", if an argument after ">" or ">>" cannot +be written (or created); +.br +"Command not found", if the specified command cannot be executed. +.br +"No match", if no arguments are generated for a command +which contains "*", "?", or "[". +.br +Termination messages described above. +.sp +.in 16 +.ti 0 +BUGS If any argument contains a quoted "*", +"?", or "[", then all instances of these characters +must be quoted. +This is because sh__ calls the glob____ routine whenever +an unquoted "*", "?", or "[" is noticed; +the fact that other instances of these characters occurred +quoted is not noticed by glob____. + +When output is redirected, +particularly through a filter, +diagnostics tend to be +sent down the pipe and are sometimes +lost altogether. diff --git a/man/man1/size.1 b/man/man1/size.1 new file mode 100644 index 0000000000..019a623d54 --- /dev/null +++ b/man/man1/size.1 @@ -0,0 +1,31 @@ +.pa 1 +.he 'SIZE (I)'9/2/72'SIZE (I)' +.ti 0 +NAME size -- size of an object file +.sp +.ti 0 +SYNOPSIS size____ [ object ... ] +.sp +.ti 0 +DESCRIPTION The +size, in bytes, of the +object files are printed. +If no file is given, a.out_____ is default. +The size is printed in octal for the +text, data, and bss portions of each file. +The sum of these is also printed in octal +and decimal. +.sp +.ti 0 +FILES a.out default +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS "object not found" if the input cannot be read. +"bad format: object" if the input file +does not have a valid object header. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/sno.1 b/man/man1/sno.1 new file mode 100644 index 0000000000..e6852120f6 --- /dev/null +++ b/man/man1/sno.1 @@ -0,0 +1,99 @@ +.pa 1 +.he 'SNO (I)'2/9/73'SNO (I)' +.ti 0 +NAME sno -- SNOBOL interpreter +.sp +.ti 0 +SYNOPSIS sno___ [ file ] +.sp +.ti 0 +DESCRIPTION sno___ +is a SNOBOL III (with slight differences) +compiler and interpreter. +sno___ obtains input from the +concatenation of file____ and the standard input. +All input through a statement +containing the label 'end' is +considered program and is compiled. +The rest is available to 'syspit'. + +The following is a list of differences +between sno___ and SNOBOL III: + +.in +3 +There are no unanchored searches. +To get the same effect: + +.ti +3 +a ** b unanchored search for b +.ti +3 +a *x* b = x c unanchored assignment + +No back referencing + +.ti +3 +x = "abc" +.ti +3 +a *x* x unanchored search for "abc" + +Different function declaration. +The function declaration is +done at compile time by the use of the label 'define'. +Thus there is no ability to define functions at run time +and the use of the name 'define' is preempted. +There is also no provision for 'automatic' variables +other than the parameters. + +.ti +3 +define f() +.ti +3 + or +.ti +3 +define f(a,b,c) + +All labels except 'define' (even 'end') +must have a non-empty statement. + +If 'start' is a label in the program, +program execution will start there. +If not, execution begins with the first +executable statement. +('define' is not an executable statement) + +There are no builtin functions + +Variable length patterns +at the end of a pattern match are not treated +specially. +They still match the shortest rather than +longest text. + +Parentheses for arithmetic are not needed. +Normal (eg FORTRAN) precedence applies. +Because of this, the arithmetic +operators '/' and '*' +must be set off by space. + +The right side of assignments +must be non-empty. + +Either ' or " may be used for literal quotes. + +The pseudo-variable 'sysppt' is not available. +.in -3 +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO SNOBOL III manual. +(JACM____; Vol. 11 No. 1; Jan 1964; pp 21) +.sp +.ti 0 +DIAGNOSTICS As appropriate +.sp +.ti 0 +BUGS Runtime +diagnostics give the +last program line number +rather than the executing statement line number. diff --git a/man/man1/sort.1 b/man/man1/sort.1 new file mode 100644 index 0000000000..29157a8f4d --- /dev/null +++ b/man/man1/sort.1 @@ -0,0 +1,44 @@ +.pa 1 +.he 'SORT (I)'9/2/72'SORT (I)' +.ti 0 +NAME sort -- sort a file +.sp +.ti 0 +SYNOPSIS sort____ [ -_ ] [ input [ output ] ] +.sp +.ti 0 +DESCRIPTION sort____ +will sort the input file and write the +sorted file on the output file. +If the output file is not given, +the input file is rewritten. +If the input file is missing, +sort uses the standard input as +input and the standard output for output. +Thus sort____ may be used as a filter. + +The sort is line-by-line in increasing ASCII collating sequence, +except that upper-case letters are considered +the same as the lower-case letters. + +The optional argument -_ will cause a reverse sort. + +sort____ is implemented in such a way that + + sort /dev/mt0 + +works correctly provided the tape is not too big. +.sp +.ti 0 +FILES /tmp/stm? +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS The +largest file that can be +sorted is about 128K bytes. diff --git a/man/man1/speak.1 b/man/man1/speak.1 new file mode 100644 index 0000000000..0c3164714d --- /dev/null +++ b/man/man1/speak.1 @@ -0,0 +1,79 @@ +.pa 1 +.he 'SPEAK (I)'2/1/73'SPEAK (I)' +.ti 0 +NAME speak -- word to voice translator +.sp +.ti 0 +SYNOPSIS speak_____ [ -_ ] [ vocabulary ] +.sp +.ti 0 +DESCRIPTION speak_____ +turns a stream of ascii words +into utterances and outputs them to a voice synthesizer. +It has facilities for maintaining a vocabulary. +It receives, from the standard input + +.in +2 +.ti -2 +- working lines - text of words separated by blanks +.ti -2 +- phonetic lines - strings of phonemes for one word preceded +and separated by commas. +The phonetic code is given in vsp___(VII). +.ti -2 +- empty lines +.ti -2 +- command lines - beginning with !_. The following forms +are recognized: +.in+1 +.in+8 + +.ti-8 +!_r_ file replace coded vocabulary from file +.ti-8 +!_w_ file write coded vocabulary on file +.ti-8 +!_p_ print phonetics for working word +.ti-8 +!_l_ list vocabulary on standard output with phonetics +.ti-8 +!c__ word copy phonetics from working word to +specified word +.ti-8 +!s__ file (save) append working word and phonetics to file +in style of !l__ +.in-8 + +.in-3 +Each working line replaces its predecessor. +Its first word is the "working word". +Each phonetic line replaces the phonetics stored for the +working word. +Each working line, phonetic line or empty line +causes the working line to be uttered. +The process terminates at the end of input. + +Unknown words are spelled +as strings of one-letter words. +Unknown one-letter words burp. + +A phonetic line of comma only will delete the +entry for the working word. + +speak_____ is initialized with a coded vocabulary stored in file +.ul +/etc/speak.m. +The vocabulary option substitutes a different file for speak.m_______. +.sp +The -_ option suppresses all utterances. +.sp +.ti 0 +FILES /etc/speak.m +.sp +.ti 0 +SEE ALSO vsp(VII), speakm(V), vt(IV) +.sp +.ti 0 +BUGS Vocabulary overflow is unchecked. +Excessively long words cause dumps. +Space is not reclaimed from deleted entries. diff --git a/man/man1/split.1 b/man/man1/split.1 new file mode 100644 index 0000000000..907a8fcc37 --- /dev/null +++ b/man/man1/split.1 @@ -0,0 +1,30 @@ +.pa 1 +.he 'SPLIT (I)'1/15/73'SPLIT (I)' +.ti 0 +NAME split -- split a file into pieces +.sp +.ti 0 +SYNOPSIS split [ [ file1 ] file2 ] +.sp +.ti 0 +DESCRIPTION Split reads file1 and writes +it in 1000-line pieces, as many as are necessary, onto +a set of output files. The name of the first output +file is file2 with an "a" appended, and so on +through the alphabet and beyond. If no output name is given, +"x" is default. +.sp +If no input file is given, or the first argument is "-", +then the standard input file is used. +.sp +.ti 0 +FILES - +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS yes +.sp +.ti 0 +BUGS Watch out for 8-character file names. diff --git a/man/man1/stat.1 b/man/man1/stat.1 new file mode 100644 index 0000000000..76418998f1 --- /dev/null +++ b/man/man1/stat.1 @@ -0,0 +1,76 @@ +.pa 1 +.he 'STAT (I)'3/15/72'STAT (I)' +.ti 0 +NAME stat -- get file status +.sp +.ti 0 +SYNOPSIS stat____ name\d1\u ... +.sp +.ti 0 +DESCRIPTION stat____ +gives several kinds of information about one or more +files: +.sp + i-number + access mode + number of links + owner + size in bytes + date and time of last modification + name (useful when several files are named) +.sp +All information is self-explanatory except the mode. +The mode is a six-character string whose characters mean the +following: +.sp +.in +5 +.ti -2 +1 s: file is small (smaller than 4096 bytes) +.br +l: file is large + +.ti -2 +2 d: file is a directory +.br +x: file is executable +.br +u: set user ID on execution +.br +-: none of the above +.ti -2 + +3 r: owner can read +.br +-: owner cannot read + +.ti -2 +4 w: owner can write +.br +-: owner cannot write + +.ti -2 +5 r: non-owner can read +.br +-: non-owner cannot read +.ti -2 + +6 w: non-owner can write +.br +-: non-owner cannot write +.in -5 +.sp +The owner is almost always given in symbolic form; however +if he cannot be found in "/etc/passwd" a number is given. +.sp +If the number of arguments to stat____ is not exactly 1 +a header is generated identifying the fields of the status information. +.sp +.ti 0 +FILES /etc/passwd +.sp +.ti 0 +SEE ALSO istat(I), ls(I) (-l option) +.sp +.ti 0 +DIAGNOSTICS "name?" +for any error. diff --git a/man/man1/strip.1 b/man/man1/strip.1 new file mode 100644 index 0000000000..bffe221a01 --- /dev/null +++ b/man/man1/strip.1 @@ -0,0 +1,36 @@ +.pa 1 +.he 'STRIP (I)'3/15/72'STRIP (I)' +.ti 0 +NAME strip -- remove symbols and relocation bits +.sp +.ti 0 +SYNOPSIS strip_____ name\d1\u ... +.sp +.ti 0 +DESCRIPTION strip_____ removes the symbol +table and relocation bits ordinarily attached to the output +of the assembler and loader. +This is useful to save space after a program has been +debugged. + +The effect of strip_____ is the same as use of the -s__ option +of ld__. +.sp +.ti 0 +FILES /tmp/stm? temporary file +.sp +.ti 0 +SEE ALSO ld(I), as(I) +.sp +.ti 0 +DIAGNOSTICS Diagnostics are given for: +non-existent argument; +.br +inability to create temporary file; +.br +improper format (not an object file); +.br +inability to re-read temporary file. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/stty.1 b/man/man1/stty.1 new file mode 100644 index 0000000000..3e39cb099c --- /dev/null +++ b/man/man1/stty.1 @@ -0,0 +1,49 @@ +.pa 1 +.he 'STTY (I)'6/12/72'STTY (I)' +.ti 0 +NAME stty -- set teletype options +.sp +.ti 0 +SYNOPSIS stty____ option918 ... +.sp +.ti 0 +DESCRIPTION Stty____ +will set certain I/O options on the current output teletype. +The option strings are +selected from the following set: + +.in +3 +.nf +even____ allow even parity. +-even_____ disallow even parity. +odd___ allow odd parity +-odd____ disallow odd parity +raw___ raw mode input + (no erase/kill/interrupt/quit/EOT) +-raw____ negate raw mode +-nl___ allow cr for lf (and echo lf cr) +nl__ allow nl only +echo____ echo back every character typed. +-echo_____ do not echo characters. +lcase_____ map upper case to lower case +-lcase______ do not map case +-tabs_____ replace tabs by spaces +tabs____ preserve tabs +delay_____ calculate cr and tab delays. +-delay______ no cr/tab delays +ebcdic______ ebcdic ball conversion (2741 only) +corres______ correspondence ball conversion (2741 only) +.in -3 +.sp +.fi +.ti 0 +FILES standard output. +.sp +.ti 0 +SEE ALSO stty(II) +.sp +.ti 0 +DIAGNOSTICS "Bad options" +.sp +.ti 0 +BUGS -- diff --git a/man/man1/sum.1 b/man/man1/sum.1 new file mode 100644 index 0000000000..93ac4b3f90 --- /dev/null +++ b/man/man1/sum.1 @@ -0,0 +1,31 @@ +.pa 1 +.he 'SUM (I)'3/15/72'SUM (I)' +.ti 0 +NAME sum -- sum file +.sp +.ti 0 +SYNOPSIS sum___ name\d1\u ... +.sp +.ti 0 +DESCRIPTION sum___ +sums the contents of the bytes (mod 2^16) of +one or more files and prints the answer in octal. +A separate sum is printed for each file specified, +along with the number of whole or partial +512-byte blocks read. + +In practice, sum___ is often used to verify that +all of a special file can be read without error. +.sp +.ti 0 +FILES none +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS "oprd" if the file cannot be +opened; "?" if an error is discovered during the read. +.sp +.ti 0 +BUGS none diff --git a/man/man1/tap.1 b/man/man1/tap.1 new file mode 100644 index 0000000000..14530539f1 --- /dev/null +++ b/man/man1/tap.1 @@ -0,0 +1,147 @@ +.pa 1 +.he 'TAP (I)'3/15/72'TAP (I)' +.ti 0 +NAME tap -- manipulate DECtape +.sp +.ti 0 +SYNOPSIS tap___ [ key ] [ name ... ] +.sp +.ti 0 +DESCRIPTION tap___ +saves and restores selected portions of the file system +hierarchy on DECtape. +Its actions are controlled by the key___ argument. +The key is a string of characters containing +at most one function letter and possibly +one or more function modifiers. +Other arguments to the command are file or directory +names specifying which files are to be dumped, restored, +or tabled. + +The function portion of +the key is specified by one of the following letters: + +.in +6 +.ti -3 +r The indicated files and directories, together with +all subdirectories, are dumped +onto the tape. +If files with the same names +already exist, they are replaced (hence the "r"). +"Same" is determined by string comparison, so +"./abc" can never be the same as "/usr/dmr/abc" even +if "/usr/dmr" is the current directory. +If no file argument is given, "." is the default. + +.ti -3 +u updates the tape. +u_ is the same as r_, but a file is replaced only if its +modification date is later than the date stored on the tape; +that is to say, if it has changed since it was dumped. +u_ is the default command if none is given. + +.ti -3 +d deletes the named files and directories from +the tape. At least one file argument must be given. + +.ti -3 +x extracts the named files from the tape to the file system. +The owner, mode, and date-modified are restored to what they +were when the file was dumped. +If no file argument is given, the entire contents of the +tape are extracted. + +.ti -3 +t lists the names of all files stored on the tape which +are the same as or are hierarchically below +the file arguments. If no file argument is given, +the entire contents of the tape are tabled. + +.ti -3 +l is the same as t_ except that an expanded listing +is produced giving all the available information about the +listed files. + +.in -6 +The following characters may be used in addition to the letter +which selects the function desired. + +.in +6 +.ti -3 +0, ..., 7 This modifier selects the drive on which the tape is mounted. +"0" is the default. + +.ti -3 +v Normally tap___ does its work silently. The v_ (verbose) +option causes it to type the name of each file it treats +preceded by a letter to indicate what is happening. + +.in +2 + r file is being replaced +.nf + a file is being added (not there before) +.fi + x file is being extracted + d file is being deleted + +.in -2 +The v_ option can be used with r_, u_, d_, and x_ only. + +.ti -3 +c means a fresh dump is being created; the tape directory +will be zeroed before beginning. Usable only with r_ and u_. + +.ti -3 +f causes +new entries copied on tape to be 'fake' in that +no data is present for these entries. +Such fake entries cannot be extracted. +Usable only with r_ and u_. + +.ti -3 +w causes tap___ to pause before treating each file, type +the indicative letter and the file name (as with v_) +and await the user's response. Response +"y" means "yes", so the file is treated. Null response +means "no", and the file does not take part +in whatever is being done. Response "x" means "exit"; +the tap___ command terminates immediately. In the x_ function, +files previously asked about +have been extracted already. +With r_, u_, and d_ no change has been made to the tape. + +.ti -3 +m make (create) directories during an x_ if necessary. +.in -6 +.sp +.ti 0 +FILES /dev/tap? +.sp +.ti 0 +SEE ALSO mt(I) +.sp +.ti 0 +DIAGNOSTICS Tape open error +.br +Tape read error +.br +Tape write error +.br +Directory checksum +.br +Directory overflow +.br +Tape overflow +.br +Phase error (a file has changed after it was selected for +dumping but before it was dumped) +.br +.sp +.ti 0 +BUGS Asks +about "fake" entries on "xw", when it should ignore +them. +If a fake entry is extracted, and the file already +exists on disk, the extraction does not take +place (as is correct), but the mode and user ID of the file +are set to 0. diff --git a/man/man1/time.1 b/man/man1/time.1 new file mode 100644 index 0000000000..9b959f2713 --- /dev/null +++ b/man/man1/time.1 @@ -0,0 +1,30 @@ +.pa 1 +.he 'TIME (I)'10/26/72'TIME (I)' +.ti 0 +NAME time -- time a command +.sp +.ti 0 +SYNOPSIS time____ command +.sp +.ti 0 +DESCRIPTION The +given command is timed; after it is complete, +time____ +prints the time spent in the system, waiting for disk, and in execution +of the command. + +The disk I/O time can be variable depending +on other activity in the system. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO tm (VIII) +.sp +.ti 0 +DIAGNOSTICS "?" +.br +"command terminated abnormally" +.br +"Command not found." diff --git a/man/man1/tmg.1 b/man/man1/tmg.1 new file mode 100644 index 0000000000..64c68dd293 --- /dev/null +++ b/man/man1/tmg.1 @@ -0,0 +1,52 @@ +.pa 1 +.he 'TMG (I)'10/21/72'TMG (I)' +.ti 0 +NAME tmg -- compiler compiler +.sp +.ti 0 +SYNOPSIS tmg___ name +.sp +.ti 0 +DESCRIPTION tmg___ +produces a translator for the language whose parsing +and translation rules are described in file name.t__. +The new translator appears +in a.out and may be used thus: +.ce +.sp +a.out_____ input [ output ] +.sp +Except in rare cases input must be a randomly +addressable file. +If no output file is specified, the standard output file +is assumed. +.sp +.ti 0 +FILES /sys/tmg/tmgl.o -- the compiler-compiler +.br +/sys/tmg[abc] -- libraries +.br +alloc.d -- table storage +.sp +.ti 0 +SEE ALSO A Manual for the Tmg Compiler-writing Language, +MM-72-1271-8. +.sp +.ti 0 +DIAGNOSTICS Syntactic errors result in "???" followed by the +offending line. +.br +Situations such as space overflow +with which the Tmg processor or a Tmg-produced +processor can not cope result in a descriptive comment and +a dump. +.sp +.ti 0 +BUGS 9.2 footnote 1 is not enforced, causing trouble. +.br +Restrictions (7.) against mixing bundling primitives +should be lifted. +.br +Certain hidden reserved words exist: gpar, classtab, trans. +.br +Octal digits include 8=10 and 9=11. diff --git a/man/man1/tss.1 b/man/man1/tss.1 new file mode 100644 index 0000000000..bec3e9d990 --- /dev/null +++ b/man/man1/tss.1 @@ -0,0 +1,65 @@ +.pa 1 +.he 'TSS (I)'3/15/72'TSS (I)' +.ti 0 +NAME tss -- interface to Honeywell TSS +.sp +.ti 0 +SYNOPSIS tss___ +.sp +.ti 0 +DESCRIPTION tss___ +will call the Honeywell 6070 on +the 201 data phone. +It will then go into direct access with +TSS. +Output generated by TSS is typed on the standard output and +input requested by TSS is read from the standard input +with UNIX typing conventions. + +An interrupt signal (ASCII DEL) +is transmitted +as a "break" to TSS. + +Input lines beginning with !_ are interpreted as UNIX +commands. +Input lines beginning with ~_ are interpreted as commands +to the interface routine. +.sp +~file deliver tss output to named UNIX file +.sp +~p pop the output file +.sp +~q disconnect from tss (quit) +.sp +~r file receive from HIS routine CSR/DACCOPY +.sp +~s file send file to HIS routine CSR/DACCOPY +.sp +Ascii files may be most efficiently transmitted using +the HIS routine CSR/DACCOPY +in this fashion. +Underlined text comes from TSS. +AFTname is the 6070 file to be dealt with. +.sp + SYSTEM______?_ CSR/DACCOPY (s) AFTname + Send Encoded File_________________ ~s file + + SYSTEM______? CSR/DACCOPY (r) AFTname + Receive Encoded File____________________ ~r file +.sp +.ti 0 +FILES /dev/dn0, +/dev/dp0 +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS DONE when communication is broken. +.sp +.ti 0 +BUGS When +diagnostic problems occur, +tss___ exits rather abruptly. diff --git a/man/man1/tty.1 b/man/man1/tty.1 new file mode 100644 index 0000000000..2027545f21 --- /dev/null +++ b/man/man1/tty.1 @@ -0,0 +1,24 @@ +.pa 1 +.he 'TTY (I)'3/15/72'TTY (I)' +.ti 0 +NAME tty -- get tty name +.sp +.ti 0 +SYNOPSIS tty___ +.sp +.ti 0 +DESCRIPTION tty___ gives the name of the user's typewriter +in the form "ttyn" for n_ a digit. The actual path +name is then "/dev/ttyn". +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS "not a tty" if the standard input file is not a typewriter. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/type.1 b/man/man1/type.1 new file mode 100644 index 0000000000..fe4cdfc26a --- /dev/null +++ b/man/man1/type.1 @@ -0,0 +1,28 @@ +.pa 1 +.he 'TYPE (I)'6/12/72'TYPE (I)' +.ti 0 +NAME type -- type on single sheet paper +.sp +.ti 0 +SYNOPSIS type____ file918 ... +.sp +.ti 0 +DESCRIPTION type____ +copies its input files to the standard output. +Before each new page (66 lines) and before each new file, +type stops and reads the standard input +for a new line character before continuing. +This allows time for insertion of single +sheet paper. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man1/typo.1 b/man/man1/typo.1 new file mode 100644 index 0000000000..f0a9b65ab2 --- /dev/null +++ b/man/man1/typo.1 @@ -0,0 +1,45 @@ +.pa 1 +.he 'TYPO (I)'1/15/73'TYPO (I)' +.ti 0 +NAME typo -- find possible typo's +.sp +.ti 0 +SYNOPSIS typo____ [ -_ ] file\d1\u ... +.sp +.ti 0 +DESCRIPTION typo hunts through a document for unusual +words, typographic errors, and hapax legomena and prints +them on the standard output. +.sp +All words used in the document are printed +out in decreasing order of peculiarity along +with an index of peculiarity. An index of 10 +or more is considered peculiar. Printing of +certain very common English words is suppressed. +.sp +The statistics for judging words are taken from +the document itself; with some help from known +statistics of English. The "-" option suppresses +the help from English and should be used if the +document is written in, for example, Urdu. +.sp +Roff and Nroff control lines are ignored. +Upper case is mapped into lower case. +Quote marks, vertical bars, hyphens, and ampersands are stripped from +within words. +Words hyphenated across lines are put back together. +.sp +.ti 0 +FILES /tmp/ttmp??, /etc/salt, /etc/w2006 +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS yes, lots +.sp +.ti 0 +BUGS Because +of the mapping into lower case and the stripping +of special characters, words +may be hard to locate in the original text. diff --git a/man/man1/un.1 b/man/man1/un.1 new file mode 100644 index 0000000000..aa9634c68d --- /dev/null +++ b/man/man1/un.1 @@ -0,0 +1,29 @@ +.pa 1 +.he 'UN (I)'3/15/72'UN (I)' +.ti 0 +NAME un -- undefined symbols +.sp +.ti 0 +SYNOPSIS un__ [ name ] +.sp +.ti 0 +DESCRIPTION un__ +prints a list of undefined symbols from an assembly +or loader run. +If the file argument is not specified, a.out_____ is the default. +Names are listed alphabetically except that non-global +symbols come first. Undefined global +symbols (unresolved external references) have their +first character underlined. +.sp +.ti 0 +FILES a.out +.sp +.ti 0 +SEE ALSO as(I), ld(I) +.sp +.ti 0 +DIAGNOSTICS "?" if the file cannot be found. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/uniq.1 b/man/man1/uniq.1 new file mode 100644 index 0000000000..a5a620a76d --- /dev/null +++ b/man/man1/uniq.1 @@ -0,0 +1,51 @@ +.pa 1 +.he 'UNIQ (I)'12/1/72'UNIQ (I)' +.ti 0 +NAME uniq -- report repeated lines in a file +.sp +.ti 0 +SYNOPSIS uniq____ [ -ud___ ] [ input [ output ] ] +.sp +.ti 0 +DESCRIPTION uniq____ +reads the input +file comparing adjacent lines. +In the normal case, the second and succeeding copies +of repeated lines are +removed; the remainder is written on the output file. +Note that repeated lines must be adjacent +in order to be found. +(See sort(I)) +If the -u__ flag is used, +just the lines that are not repeated +in the original file are output. +The -d__ option specifies that +one copy of just the repeated lines is to +be written. +Note that the normal mode output is the union of the +-u__ and -d__ mode outputs. +.sp +The following example will print one copy of all +lines in the file a_ that do not occur in b_: +.sp + sort a x + uniq x a1 + sort b x + uniq x b1 + cat a1 b1 >x + sort x + uniq -u x >>a1 + sort a1 + uniq -d a1 +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO sort(I) +.sp +.ti 0 +DIAGNOSTICS "cannot open input", "cannot create output" +.sp +.ti 0 +BUGS -- diff --git a/man/man1/vs.1 b/man/man1/vs.1 new file mode 100644 index 0000000000..383cd8e05f --- /dev/null +++ b/man/man1/vs.1 @@ -0,0 +1,44 @@ +.he 'VS (I)'2/13/73'VS(I)' +.ti0 +NAME vs -- phoneme list to voice synthesizer +.sp +.ti0 +SYNOPSIS vs__ +.sp +.ti0 +DESCRIPTION vs__ +accepts phoneme descriptor lists and translates them into +byte strings suitable for the Federal Screw Works Voice +Synthesizer. +Phoneme descritors should be separated by commas and +have the general form "%NIxx" +where "xx" is a one or two character phoneme name, +"I" is an optional inflection parameter, +and "%N" is an optional count of the number of times +the phoneme is to be repeated (maximum 9). +"I" can have the values 0, 1, 2, 3 representing decreasing +strength (default is 2). +A description of the phonemes and their names can be +found in the file vsp___(VII). +For example, +.in +5 +.sp +a0,o1,t,r,1ai,1ay,d,j,ih,u1,%2s +.sp +.in-5 +will generate the word "outrageous". +The output is buffered; +a newline will cause the buffered output to be +sent to the Voice Synthesizer. +.sp +.ti0 +FILES - +.sp +.ti0 +SEE ALSO vsp(VII), speak(I) +.sp +.ti0 +DIAGONOSTICS - +.sp +.ti0 +BUGS - diff --git a/man/man1/wc.1 b/man/man1/wc.1 new file mode 100644 index 0000000000..6631ae636a --- /dev/null +++ b/man/man1/wc.1 @@ -0,0 +1,36 @@ +.pa 1 +.he 'WC (I)'3/15/72'WC (I)' +.ti 0 +NAME wc -- get (English) word count +.sp +.ti 0 +SYNOPSIS wc__ name918 ... +.sp +.ti 0 +DESCRIPTION wc__ +provides a count of the words, text lines, and control lines for +each argument file. + +A text line is a sequence of characters not beginning with ".", +"!" or "'" +and ended by a new-line. +A control line is a line beginning with ".", +"!" or "'". +A word is a sequence of characters bounded by the beginning +of a line, by the end of a line, or by a blank or a tab. + +When +there is more than one input file, +a grand total is also printed. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO roff(I) +.sp +.ti 0 +DIAGNOSTICS none; arguments not found are ignored. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/who.1 b/man/man1/who.1 new file mode 100644 index 0000000000..61dd392b5e --- /dev/null +++ b/man/man1/who.1 @@ -0,0 +1,42 @@ +.pa 1 +.he 'WHO (I)'3/15/72'WHO (I)' +.ti 0 +NAME who -- who is on the system +.sp +.ti 0 +SYNOPSIS who___ [ who-file ] +.sp +.ti 0 +DESCRIPTION who___, without an argument, +lists the name, typewriter channel, and login time +for each current UNIX user. + +Without an argument, +who___ examines the /tmp/utmp_________ +file to obtain its information. +If a file is given, that file is examined. +Typically the given file will be /tmp/wtmp_________, +which contains a record of all the logins since it +was created. +Then who___ will list +logins, logouts, and crashes since the creation of +the wtmp file. + +Each login is listed with user name, last character +of input device name (with /dev/tty________ suppressed), +date and time. +Certain logouts produce a similar line without a user name. +Reboots produce a line with "x" in the place of the device name, +and a fossil time indicative of when the system went down. +.sp +.ti 0 +FILES /tmp/utmp +.sp +.ti 0 +SEE ALSO login(I), init(VII) +.sp +.ti 0 +DIAGNOSTICS "?" if a named file cannot be read. +.sp +.ti 0 +BUGS -- diff --git a/man/man1/write.1 b/man/man1/write.1 new file mode 100644 index 0000000000..b60ddca4e9 --- /dev/null +++ b/man/man1/write.1 @@ -0,0 +1,62 @@ +.pa 1 +.he 'WRITE (I)'3/15/72'WRITE (I)' +.ti 0 +NAME write -- write to another user +.sp +.ti 0 +SYNOPSIS write_____ user +.sp +.ti 0 +DESCRIPTION write_____ copies lines from your typewriter to that of +another user. When first called, write_____ sends the message +.sp + message from yourname... +.sp +The recipient of the message should write back at this point. +Communication continues until an end of file is +read from the typewriter or an interrupt is sent. +At that point write_____ writes "EOT" on the other terminal. +.sp +Permission to write may be denied or granted by use of the mesg____ +command. +At the outset writing is allowed. +Certain commands, in particular roff____ and pr__, disallow +messages in order to prevent messy output. + +If the character "!" is found at the beginning of a line, +write_____ calls the mini-shell msh___ to execute the rest of the +line as a command. + +The following protocol is suggested for using write_____: +When you first write to another user, wait for him to +write back before starting to send. +Each party should end each message with a distinctive +signal ("(o)" for "over" is conventional) that the other may reply. +"(oo)" (for "over and out") is suggested when conversation +is about to be terminated. + +.ti 0 +FILES /tmp/utmp to find user +.br +/etc/msh to execute ! +.sp +.ti 0 +SEE ALSO mesg(I), msh(VII) +.sp +.ti 0 +DIAGNOSTICS "user not logged in"; "permission denied". +.sp +.ti 0 +BUGS write_____ +should check the mode of the other user's typewriter +and refuse to proceed unless non-user +write permission is given. +Currently it is possible to write to another +person with the same user-ID even though +he has forbidden messages. + +write_____ should also allow specification of +the typewriter name of a user who +is logged in several times instead +of picking out the instance with the +lowest name. diff --git a/man/man2/boot.2 b/man/man2/boot.2 new file mode 100644 index 0000000000..9e93643269 --- /dev/null +++ b/man/man2/boot.2 @@ -0,0 +1,27 @@ +.pa 1 +.he 'BOOT (II)'7/29/72'BOOT (II)' +.ti 0 +NAME boot -- reboot UNIX +.sp +.ti 0 +SYNOPSIS sys boot / boot = 39. not in assembler +.sp +.ti 0 +DESCRIPTION UNIX +will clean up outstanding I\/O, and then execute +the reboot read-only program. +This call is restricted to the super-user. +All users will be logged out. +.sp +.ti 0 +SEE ALSO boot procedures (VII) +.sp +.ti 0 +DIAGNOSTICS the c-bit is set if you are +not the super-user +.sp +.ti 0 +BUGS It +often doesn't work (for unknown reasons). +.br +It depends on switch settings. diff --git a/man/man2/break.2 b/man/man2/break.2 new file mode 100644 index 0000000000..a83826370d --- /dev/null +++ b/man/man2/break.2 @@ -0,0 +1,34 @@ +.pa 1 +.he 'BREAK (II)'3/15/72'BREAK (II)' +.ti 0 +NAME break -- set program break +.sp +.ti 0 +SYNOPSIS sys break; addr / break = 17. +.sp +.ti 0 +DESCRIPTION break_____ +sets the system's idea of the highest location used by the program +to addr____. Locations greater than addr____ and below the stack pointer +are not swapped and are thus liable to unexpected modification. +.sp +An argument of 0 is taken to mean 16K bytes. +If the argument is higher than the stack pointer the +entire user core area is swapped. +.sp +When a program begins execution via exec____ +the break is set at the +highest location defined by the program +and data storage areas. +Ordinarily, therefore, only programs with growing +data areas need to use break_____. +.sp +.ti 0 +SEE ALSO exec(II) +.sp +.ti 0 +DIAGNOSTICS none; strange addresses cause the break to be +set at 16K bytes. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/cemt.2 b/man/man2/cemt.2 new file mode 100644 index 0000000000..4d03c41a41 --- /dev/null +++ b/man/man2/cemt.2 @@ -0,0 +1,30 @@ +.pa 1 +.he 'CEMT (II)'9/4/72'CEMT (II)' +.ti 0 +NAME cemt -- catch emt traps +.sp +.ti 0 +.nf +SYNOPSIS sys cemt; arg / cemt = 29. +.fi +.sp +.ti 0 +DESCRIPTION This call +allows one to catch traps resulting from +the emt___ instruction. +Arg___ is a location within the program; emt___ traps +are sent to that location. +The normal effect of emt___ traps may be restored by giving +an arg___ equal to 0. +.sp +To return after catching the emt___ +trap, execute the rti___ instruction. +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man2/chdir.2 b/man/man2/chdir.2 new file mode 100644 index 0000000000..04beefc4e2 --- /dev/null +++ b/man/man2/chdir.2 @@ -0,0 +1,24 @@ +.pa 1 +.he 'CHDIR (II)'3/15/72'CHDIR (II)' +.ti 0 +NAME chdir -- change working directory +.sp +.ti 0 +SYNOPSIS sys chdir; dirname / chdir = 12. +.sp +.ti 0 +DESCRIPTION dirname_______ +is the address of the pathname of a directory, terminated by a 0 byte. +chdir_____ causes this directory +to become the current working directory. +.sp +.ti 0 +SEE ALSO chdir(I) +.sp +.ti 0 +DIAGNOSTICS The error bit (c-bit) +is set if the given name is not that of a directory +or is not readable. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/chmod.2 b/man/man2/chmod.2 new file mode 100644 index 0000000000..f456bec42a --- /dev/null +++ b/man/man2/chmod.2 @@ -0,0 +1,36 @@ +.pa 1 +.he 'CHMOD (II)'3/15/72'CHMOD (II)' +.ti 0 +NAME chmod -- change mode of file +.sp +.ti 0 +SYNOPSIS sys chmod; name; mode / chmod = 15. +.sp +.ti 0 +DESCRIPTION The file whose name +is given as the null-terminated string pointed to by name____ +has its mode changed to mode____. +Modes are constructed by or__ing together some +combination of the following: +.sp +.in +3 + 01 write, non-owner + 02 read, non-owner + 04 write, owner + 10 read, owner + 20 executable + 40 set user ID on execution +.in -3 +.sp +Only the owner of a file (or the super-user) may change the mode. +.sp +.ti 0 +SEE ALSO chmod(I) +.sp +.ti 0 +DIAGNOSTICS Error bit +(c-bit) set if name____ cannot be found or if current user +is neither the owner of the file nor the super-user. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/chown.2 b/man/man2/chown.2 new file mode 100644 index 0000000000..73702ee973 --- /dev/null +++ b/man/man2/chown.2 @@ -0,0 +1,26 @@ +.pa 1 +.he 'CHOWN (II)'3/15/72'CHOWN (II)' +.ti 0 +NAME chown -- change owner of file +.sp +.ti 0 +SYNOPSIS sys chown; name; owner / chown = 16. +.sp +.ti 0 +DESCRIPTION The file +whose name is given by the null-terminated string pointed +to by name____ has its owner changed to owner_____. +Only the present owner of a file (or the super-user) may +donate the file to another user. Also, one may not +change the owner of a file with the set-user-ID bit +on, otherwise one could create Trojan Horses. +.sp +.ti 0 +SEE ALSO chown(I), uids(V) +.sp +.ti 0 +DIAGNOSTICS The error bit (c-bit) is set +on illegal owner changes. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/close.2 b/man/man2/close.2 new file mode 100644 index 0000000000..b5d74fbd7f --- /dev/null +++ b/man/man2/close.2 @@ -0,0 +1,27 @@ +.pa 1 +.he 'CLOSE (II)'3/15/72'CLOSE (II)' +.ti 0 +NAME close -- close a file +.sp +.ti 0 +SYNOPSIS (file descriptor in r0) +.br +sys close / close = 6. +.sp +.ti 0 +DESCRIPTION Given +a file descriptor such as returned from an open or creat call, +close_____ closes the associated file. +A close of all files is automatic on exit, but since +processes are limited to 10 simultaneously open files, +close_____ is necessary for programs which deal with many files. +.sp +.ti 0 +SEE ALSO creat(II), open(II) +.sp +.ti 0 +DIAGNOSTICS The error bit +(c-bit) is set for an unknown file descriptor. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/creat.2 b/man/man2/creat.2 new file mode 100644 index 0000000000..89025e07a8 --- /dev/null +++ b/man/man2/creat.2 @@ -0,0 +1,45 @@ +.pa 1 +.he 'CREAT (II)'3/15/72'CREAT (II)' +.ti 0 +NAME creat -- create a new file +.sp +.ti 0 +SYNOPSIS sys creat; name; mode / creat = 8. +.br +(file descriptor in r0) +.sp +.ti 0 +DESCRIPTION creat_____ +creates a new file or prepares to rewrite an existing +file called name____; +name____ is the address of a null-terminated string. +If the file did not exist, it is given mode mode____; +if it did exist, its mode and owner remain unchanged +but it is truncated to 0 length. +.sp +The file is also opened for writing, and its file descriptor +is returned in r0. +.sp +The mode____ given is arbitrary; it need not allow +writing. +This feature is used by programs which deal with temporary +files of fixed names. The creation is done with +a mode that forbids writing. Then if a second +instance of the program attempts a creat_____, an error is +returned and the program knows that the name is unusable +for the moment. +.sp +.ti 0 +SEE ALSO write(II), close(II) +.sp +.ti 0 +DIAGNOSTICS The error bit +(c-bit) may be set if: a needed directory is not readable; +the file does not exist and the directory +in which it is to be created is not writable; the file +does exist and is unwritable; +the file is a directory; +there are already 10 files open. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/csw.2 b/man/man2/csw.2 new file mode 100644 index 0000000000..d8f1cf50b3 --- /dev/null +++ b/man/man2/csw.2 @@ -0,0 +1,29 @@ +.pa 1 +.he 'CSW (II)'7/29/72'CSW (II)' +.ti 0 +NAME csw -- read console switches +.sp +.ti 0 +SYNOPSIS sys csw / csw = 38. not in assembler +.br +(value of csw in r0) +.br +(value of buttons in r1) +.sp +.ti 0 +DESCRIPTION The setting of +the console switches is returned in r0. +The setting of the +external buttons is returned in r1. +.a +The return is synced to +a 30 CPS clock for graphical applications. +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS none +.sp +.ti 0 +BUGS Currently the buttons are unavailable. diff --git a/man/man2/dup.2 b/man/man2/dup.2 new file mode 100644 index 0000000000..e8c7c8b288 --- /dev/null +++ b/man/man2/dup.2 @@ -0,0 +1,54 @@ +.pa 1 +.he 'DUP (II)'1/15/73'DUP (II)' +.ti 0 +NAME dup -- duplicate an open file descriptor +.sp +.ti 0 +SYNOPSIS (file descriptor in r0) +.br +sys dup / dup = 41.; not in assembler +.br +(file descriptor in r0) +.sp +.ti 0 +DESCRIPTION Given +a file descriptor returned from +an open or creat call, +dup___ +will allocate another file descriptor +synonymous +with +the original. +The new file descriptor is returned in r0. +.sp +Dup___ +is used more to manipulate the value +of file descriptors +than to genuinely +duplicate a file descriptor. +Since the algorithm to allocate +file descriptors +is known to use the +lowest available +value between 0 and 9, +combinations of dup___ +and close_____ can be +used to +manipulate file descriptors +in a general way. +This is handy for +manipulating standard input and/or +standard output. +.sp +.ti 0 +SEE ALSO creat(II), open(II), close(II) +.sp +.ti 0 +DIAGNOSTICS The +error bit (c-bit) +is set if: +the given file descriptor is invalid; +there are already 10 open files. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/exec.2 b/man/man2/exec.2 new file mode 100644 index 0000000000..949ce26046 --- /dev/null +++ b/man/man2/exec.2 @@ -0,0 +1,88 @@ +.pa 1 +.he 'EXEC (II)'3/15/72'EXEC (II)' +.ti 0 +NAME exec -- execute a file +.sp +.ti 0 +SYNOPSIS sys exec; name; args / exec = 11. +.br +.li +... +.ti -6 +name: <...\\0> +.br +.li +... +.ti -6 +args: arg1; arg2; ...; 0 +.ti -6 +arg1: <...\\0> +.br +.li +... +.sp +.ti 0 +DESCRIPTION exec____ +overlays the calling process with the named file, then +transfers to the +beginning of the core image of the file. +The first argument to exec____ is a pointer to the name of the file +to be executed. +The second is the address of a list of pointers to +arguments to be passed to the file. +Conventionally, the first argument is the name of the +file. +Each pointer addresses a string terminated by a null byte. +.sp +There can be no return from the file; the calling core image +is lost. + +The program break is set from the executed file; see the format +of a.out. + +Once the called file starts execution, the arguments are available +as follows. +The stack pointer points to a word containing the number of arguments. Just above +this number is a list of pointers to the argument strings. + + sp-> nargs + arg1 + ... + argn + + arg1: + ... + argn: + +The arguments are placed as high as possible in core: +just below 57000(8). + +Files remain open across +exec____ calls. However, the illegal instruction, emt___, quit, and interrupt trap +specifications are reset to the standard values. +(See ilgins______, cemt____, quit____, intr____.) + +Each user has a real____ user ID and an effective_________ user ID +(The real ID identifies the person using the system; +the effective ID determines his access privileges.) +exec____ changes the effective user ID to +the owner of the executed file if the file has the "set-user-ID" +mode. The real user ID is not affected. +.sp +.ti 0 +SEE ALSO fork(II) +.sp +.ti 0 +DIAGNOSTICS If +the file cannot be read or if it is not executable, a return +from exec____ constitutes the diagnostic. +The error bit (c-bit) is set. +.sp +.ti 0 +BUGS Very high core and +very low core are used by exec____ +to construct the argument list +for the new core image. +If the original copies of the +arguments reside in these places, +problems can result. diff --git a/man/man2/exit.2 b/man/man2/exit.2 new file mode 100644 index 0000000000..551ffd1502 --- /dev/null +++ b/man/man2/exit.2 @@ -0,0 +1,28 @@ +.pa 1 +.he 'EXIT (II)'3/15/72'EXIT (II)' +.ti 0 +NAME exit -- terminate process +.sp +.ti 0 +SYNOPSIS (status in r0) +.br +sys exit / exit = 1 +.sp +.ti 0 +DESCRIPTION exit____ +is the normal means of terminating a process. +Exit closes all the process' files and notifies the parent process +if it is executing a wait____. +The low byte of r0 +is available as status to the parent process. +.sp +This call can never return. +.sp +.ti 0 +SEE ALSO wait(II) +.sp +.ti 0 +DIAGNOSTICS - +.sp +.ti 0 +BUGS -- diff --git a/man/man2/fork.2 b/man/man2/fork.2 new file mode 100644 index 0000000000..300c1decd7 --- /dev/null +++ b/man/man2/fork.2 @@ -0,0 +1,32 @@ +.pa 1 +.he 'FORK (II)'3/15/72'FORK (II)' +.ti 0 +NAME fork -- spawn new process +.sp +.ti 0 +SYNOPSIS sys fork / fork = 2. +.br +(new process return) +.br +(old process return) +.sp +.ti 0 +DESCRIPTION fork____ +is the only way new processes are created. +The new process's core image is a copy of +that of the caller of fork____; the only distinction +is the return location and the fact +that r0 in the old process contains the process ID +of the new process. +This process ID is used by wait____. +.sp +.ti 0 +SEE ALSO wait(II), exec(II) +.sp +.ti 0 +DIAGNOSTICS The error bit +(c-bit) is set in the old process if a new process +could not be created because of lack of process space. +.sp +.ti 0 +BUGS See wait(II) for a subtile bug in process destruction. diff --git a/man/man2/fpe.2 b/man/man2/fpe.2 new file mode 100644 index 0000000000..1da996846b --- /dev/null +++ b/man/man2/fpe.2 @@ -0,0 +1,34 @@ +.pa 1 +.he 'FPE (II)'9/2/72'FPE (II)' +.ti 0 +NAME fpe -- set floating exception handling +.sp +.ti 0 +SYNOPSIS sys fpe; arg / fpe = 40. not in assembler +.sp +.ti 0 +DESCRIPTION This call +allows one to catch traps resulting from +floating point exceptions. +Arg___ is a location within the program; floating exception traps +are sent to that location. +The normal effect of floating exception traps may be restored by giving +an arg___ equal to 0. +.sp +To return after catching the +fpe___ +trap, execute the rti___ instruction. +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS The +floating point exception (FEC) register +is not saved per process. +Examining this register for possible +remedial action after a floating point +exception trap is not guaranteed to work. diff --git a/man/man2/fstat.2 b/man/man2/fstat.2 new file mode 100644 index 0000000000..d731f755e2 --- /dev/null +++ b/man/man2/fstat.2 @@ -0,0 +1,27 @@ +.pa 1 +.he 'FSTAT (II)'3/15/72'FSTAT (II)' +.ti 0 +NAME fstat -- get status of open file +.sp +.ti 0 +SYNOPSIS (file descriptor in r0) +.br +sys fstat; buf / fstat = 28. +.sp +.ti 0 +DESCRIPTION This +call is identical to stat____, except that it operates +on open files instead of files given by name. +It is most often used to get the status +of the standard input and output files, whose names +are unknown. +.sp +.ti 0 +SEE ALSO stat(II) +.sp +.ti 0 +DIAGNOSTICS The error bit +(c-bit) is set if the file descriptor is unknown. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/getuid.2 b/man/man2/getuid.2 new file mode 100644 index 0000000000..eb3a3dd89a --- /dev/null +++ b/man/man2/getuid.2 @@ -0,0 +1,29 @@ +.pa 1 +.he 'GETUID (II)'3/15/72'GETUID (II)' +.ti 0 +NAME getuid -- get user identification +.sp +.ti 0 +SYNOPSIS sys getuid / getuid = 24. +.br +(user ID in r0) +.sp +.ti 0 +DESCRIPTION getuid______ returns +the real user ID of +the current process. +The real user ID identifies the person who is logged in, +in contradistinction to the effective user ID, which +determines his access permission at each moment. +It is thus useful to programs which operate using +the "set user ID" mode, to find out who invoked them. +.sp +.ti 0 +.ti 0 +SEE ALSO setuid(II) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man2/gtty.2 b/man/man2/gtty.2 new file mode 100644 index 0000000000..0f265f648b --- /dev/null +++ b/man/man2/gtty.2 @@ -0,0 +1,31 @@ +.pa 1 +.he 'GTTY (II)'3/15/72'GTTY (II)' +.ti 0 +NAME gtty -- get typewriter status +.sp +.ti 0 +SYNOPSIS (file descriptor in r0) +.br +sys gtty; arg / gtty = 32. +.br +.li +... +.ti -5 +arg: .=.+6 +.sp +.ti 0 +DESCRIPTION gtty____ +stores in the three words addressed by arg___ the status +of the typewriter whose file descriptor is given in r0. +The format is the same as that passed by stty____. +.sp +.ti 0 +SEE ALSO stty(II) +.sp +.ti 0 +DIAGNOSTICS Error bit +(c-bit) is set if the file descriptor does not refer +to a typewriter. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/ilgins.2 b/man/man2/ilgins.2 new file mode 100644 index 0000000000..5ced8f8716 --- /dev/null +++ b/man/man2/ilgins.2 @@ -0,0 +1,34 @@ +.pa 1 +.he 'ILGINS (II)'3/15/72'ILGINS (II)' +.ti 0 +NAME ilgins -- catch illegal instruction trap +.sp +.ti 0 +SYNOPSIS sys ilgins; arg / ilgins = 33. +.sp +.ti 0 +DESCRIPTION ilgins______ +allows a program to catch illegal instruction traps. +If arg___ +is zero, the normal instruction trap handling is done: +the process is terminated and a core image is produced. +If arg___ +is a location within the program, control +is passed to arg___ when the trap occurs. +.sp +This call is used to implement the floating point simulator, +which catches and interprets 11/45 floating point +instructions. +.sp +To return after catching the +ilgins______ +trap, execute the rti___ instruction. +.sp +.ti 0 +SEE ALSO PDP-11 manual +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man2/intr.2 b/man/man2/intr.2 new file mode 100644 index 0000000000..0cf8a064fa --- /dev/null +++ b/man/man2/intr.2 @@ -0,0 +1,31 @@ +.pa 1 +.he 'INTR (II)'3/15/72'INTR (II)' +.ti 0 +NAME intr -- set interrupt handling +.sp +.ti 0 +SYNOPSIS sys intr; arg / intr = 27. +.sp +.ti 0 +DESCRIPTION When arg___ is 0, +interrupts (ASCII DELETE) are ignored. +When arg___ is 1, +interrupts cause their normal result, that is, force an exit____. +When arg___ is a location within the program, control is +transferred to that location when an interrupt occurs. +.sp +After an interrupt is caught, it is possible to resume +execution by means of an rti___ instruction; however, great +care must be exercised, since +all I/O is terminated abruptly upon an interrupt. +In particular, reads of the typewriter tend to return +with 0 characters read, thus simulating an end of file. +.sp +.ti 0 +SEE ALSO quit(II) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man2/kill.2 b/man/man2/kill.2 new file mode 100644 index 0000000000..e59642b3f9 --- /dev/null +++ b/man/man2/kill.2 @@ -0,0 +1,29 @@ +.pa 1 +.he 'KILL (II)'6/12/72'KILL (II)' +.ti 0 +NAME kill -- destroy process +.sp +.ti 0 +SYNOPSIS (process number in r0) +.br +sys kill / kill = 37.; not in assembler +.sp +.ti 0 +DESCRIPTION kill____ +destroys a process, given its process number. +The process leaves a core image. + +This call is restricted to the super-user, +and is intended only to kill an otherwise +unstoppable process. +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS c-bit set +if user is not the super-user, or if process does not exist. +.sp +.ti 0 +BUGS Under +strange circumstances, kill____ is ineffective. diff --git a/man/man2/link.2 b/man/man2/link.2 new file mode 100644 index 0000000000..bea93604cd --- /dev/null +++ b/man/man2/link.2 @@ -0,0 +1,26 @@ +.pa 1 +.he 'LINK (II)'3/15/72'LINK (II)' +.ti 0 +NAME link -- link to a file +.sp +.ti 0 +SYNOPSIS sys link; name\d1\u; name\d2\u / link = 9. +.sp +.ti 0 +DESCRIPTION A link +to name____\d1\u is created; the link has name name____\d2\u. +Either name may be an arbitrary path name. +.sp +.ti 0 +SEE ALSO link(I), unlink(II) +.sp +.ti 0 +DIAGNOSTICS The error bit +(c-bit) is set when name____\d1\u +cannot be found; when name____\d2\u +already exists; when the directory of name____\d2\u +cannot be written; when +an attempt is made to link to a directory by a user other than the super-user. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/makdir.2 b/man/man2/makdir.2 new file mode 100644 index 0000000000..bd145d6ca2 --- /dev/null +++ b/man/man2/makdir.2 @@ -0,0 +1,27 @@ +.pa 1 +.he 'MAKDIR (II)'3/15/72'MAKDIR (II)' +.ti 0 +NAME makdir -- make a directory +.sp +.ti 0 +SYNOPSIS sys makdir; name; mode / makdir = 14. +.sp +.ti 0 +DESCRIPTION makdir______ creates an empty directory +whose name is the null-terminated string pointed +to by name____. +The mode of the directory is mode____. +The special entries "." and ".." are not present. +.sp +makdir______ may be invoked only by the super-user. +.sp +.ti 0 +SEE ALSO mkdir(I) +.sp +.ti 0 +DIAGNOSTICS Error bit (c-bit) +is set if the directory already exists +or if the user is not the super-user. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/mdate.2 b/man/man2/mdate.2 new file mode 100644 index 0000000000..a6331f6ebe --- /dev/null +++ b/man/man2/mdate.2 @@ -0,0 +1,31 @@ +.pa 1 +.he 'MDATE (II)'3/15/72'MDATE (II)' +.ti 0 +NAME mdate -- set modified date on file +.sp +.ti 0 +SYNOPSIS (time to r0-r1) +.br +.nf +sys mdate; file / mdate = 30. +.fi +.sp +.ti 0 +DESCRIPTION File____ +is the address of a null-terminated string giving the +name of a file. +The modified time of the file is set to the time given in +the r0-r1 registers. +.sp +This call is allowed only to the super-user +or to the owner of the file. +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS Error bit +is set if the user is neither the owner nor the super-user or if the file cannot be found. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/mount.2 b/man/man2/mount.2 new file mode 100644 index 0000000000..7f0a9e0ef1 --- /dev/null +++ b/man/man2/mount.2 @@ -0,0 +1,38 @@ +.pa 1 +.he 'MOUNT (II)'3/15/72'MOUNT (II)' +.ti 0 +NAME mount -- mount file system +.sp +.ti 0 +.nf +SYNOPSIS sys mount; special; name / mount = 21. +.fi +.sp +.ti 0 +DESCRIPTION mount_____ +announces to the system that a removable file system has +been mounted on special file special_______; +from now on, references to file name____ will refer to +the root file on the newly mounted file system. +Special_______ and name____ are pointers to null-terminated strings +containing the appropriate path names. + +Name____ must exist already. If it had contents, +they are inaccessible while the file system +is mounted. +.sp +.ti 0 +SEE ALSO mount(I), umount(II) +.sp +.ti 0 +DIAGNOSTICS Error bit +(c-bit) set if: special_______ is inaccessible; name____ +does not exist; +special_______ is already mounted; +name____ is not on the RF; +there are already four special files mounted. +.sp +.ti 0 +BUGS At most +four removable devices can be mounted at a time. +This call should be restricted to the super-used. diff --git a/man/man2/nice.2 b/man/man2/nice.2 new file mode 100644 index 0000000000..a4fe2bae96 --- /dev/null +++ b/man/man2/nice.2 @@ -0,0 +1,27 @@ +.pa 1 +.he 'NICE (II)'3/15/72'NICE (II)' +.ti 0 +NAME nice -- set program in low priority +.sp +.ti 0 +SYNOPSIS sys nice / nice = 34. +.sp +.ti 0 +DESCRIPTION The +currently executing process is set into +the lowest priority execution queue. +Background jobs that execute a very long +time should do this. +Once done, +there is no way to restore +a process to normal +priority. +.sp +.ti 0 +SEE ALSO formerly known as "hog" +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man2/open.2 b/man/man2/open.2 new file mode 100644 index 0000000000..475eb76a4f --- /dev/null +++ b/man/man2/open.2 @@ -0,0 +1,34 @@ +.pa 1 +.he 'OPEN (II)'3/15/72'OPEN (II)' +.ti 0 +NAME open -- open for reading or writing +.sp +.ti 0 +SYNOPSIS sys open; name; mode / open = 5. +.br +(descriptor in r0) +.sp +.ti 0 +DESCRIPTION open____ opens the file name____ for reading +(if mode____ is 0) or writing (if mode____ is non-zero). +name____ is the address of a string of ASCII characters representing +a path name, terminated by a null character. +.sp +The file descriptor should be saved for subsequent calls +to read (or write) and close. +.sp +In both the read and write case the file pointer +is set to the beginning of the file. +.sp +.ti 0 +SEE ALSO creat(II), read(II), write(II), close(II) +.sp +.ti 0 +DIAGNOSTICS The error bit +(c-bit) is set if the file does not exist, +if one of the necessary directories +does not exist or is unreadable, if the file is not +readable (resp. writable), or if 10 files are open. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/pipe.2 b/man/man2/pipe.2 new file mode 100644 index 0000000000..7c161316e4 --- /dev/null +++ b/man/man2/pipe.2 @@ -0,0 +1,51 @@ +.pa 1 +.he 'PIPE (II)'1/15/73'PIPE (II)' +.ti 0 +NAME pipe -- create a pipe +.sp +.ti 0 +SYNOPSIS sys pipe / pipe = 42.; not in assembler +.br +(file descriptor in r0) +.sp +.ti 0 +DESCRIPTION The +pipe____ +system call +creates an I/O mechanism called a pipe. +The file descriptor returned can +be used in both read and write operations. +When the pipe is written, +the data is buffered up to 504 bytes +at which time the writing process is suspended. +A read on the pipe will pick up the buffered data. +.sp +It is assumed that after the +pipe____ has been set up, +two (or more) +cooperating processes +(created by subsequent fork____ calls) +will pass data through the +pipe with read____ and write_____ calls. + +The shell has a syntax +to set up a linear array of processes +connected by pipes. +.sp +Read calls on an empty +pipe (no buffered data) with only one end +(no synonymous file +descriptors resulting from fork____ or dup___) +return an end-of-file. +Write calls under similar conditions are ignored. + +.ti 0 +SEE ALSO sh(I), read(II), write(II), fork(II) +.sp +.ti 0 +DIAGNOSTICS The error +bit (c-bit) is set if +10 files are already open. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/quit.2 b/man/man2/quit.2 new file mode 100644 index 0000000000..9fe46fc9e2 --- /dev/null +++ b/man/man2/quit.2 @@ -0,0 +1,24 @@ +.pa 1 +.he 'QUIT (II)'3/15/72'QUIT (II)' +.ti 0 +NAME quit -- turn off quit signal +.sp +.ti 0 +SYNOPSIS sys quit; flag / quit = 26. +.sp +.ti 0 +DESCRIPTION When flag____ is 0, this call disables +quit signals from the typewriter (ASCII FS). +When flag____ is non-zero, quits are re-enabled, +and cause execution to cease and a core image to be produced. +.sp +Quits should be turned off only with due consideration. +.sp +.ti 0 +SEE ALSO intr(II) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man2/read.2 b/man/man2/read.2 new file mode 100644 index 0000000000..e06998f427 --- /dev/null +++ b/man/man2/read.2 @@ -0,0 +1,42 @@ +.pa 1 +.he 'READ (II)'3/15/72'READ (II)' +.ti 0 +NAME read -- read from file +.sp +.ti 0 +SYNOPSIS (file descriptor in r0) +.br +sys read; buffer; nbytes / read = 3. +.br +(nread in r0) +.sp +.ti 0 +DESCRIPTION A file descriptor is a word +returned from a successful open____ or creat_____ call. +.sp +Buffer______ is the location of nbytes______ contiguous +bytes into which the input will be placed. It is not guaranteed +that all nbytes______ bytes will be read; for example +if the file refers to a typewriter at most one line +will be returned. +In any event the number of characters read is returned +in r0. +.sp +If r0 returns with value 0, then +end-of-file has been reached. +.sp +.ti 0 +SEE ALSO open(II), creat(II) +.sp +.ti 0 +DIAGNOSTICS As mentioned, +r0 is 0 on return when the end of the file has been reached. +If the read was otherwise unsuccessful +the error bit (c-bit) is set. Many conditions, +can generate an error: +physical I/O errors, bad buffer address, +preposterous nbytes______, file descriptor not that of +an input file. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/rele.2 b/man/man2/rele.2 new file mode 100644 index 0000000000..357e92b465 --- /dev/null +++ b/man/man2/rele.2 @@ -0,0 +1,26 @@ +.pa 1 +.he 'RELE (II)'3/15/72'RELE (II)' +.ti 0 +NAME rele -- release processor +.sp +.ti 0 +SYNOPSIS sys rele / rele = 0; not in assembler +.sp +.ti 0 +DESCRIPTION This call +causes the process to be swapped out immediately if +another process wants to run. +Its main reason for being is internal +to the system, namely to implement timer-runout swaps. +However, it can be used beneficially by programs +which wish to loop for some reason without +consuming more processor time than necessary. +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man2/seek.2 b/man/man2/seek.2 new file mode 100644 index 0000000000..7c6e67092d --- /dev/null +++ b/man/man2/seek.2 @@ -0,0 +1,42 @@ +.pa 1 +.he 'SEEK (II)'3/15/72'SEEK (II)' +.ti 0 +NAME seek -- move read/write pointer +.sp +.ti 0 +SYNOPSIS (file descriptor in r0) +.br +sys seek; offset; ptrname / seek = 19. +.a +.sp +.ti 0 +DESCRIPTION The file +descriptor refers to a file open for reading or writing. +The read (resp. write) pointer for the file is set as follows: +.in +3 +.sp +if ptrname_______ is 0, the pointer is set to offset______. +.sp +if ptrname_______ +is 1, the pointer is set to its current location plus offset______. +.sp +if ptrname_______ is 2, the pointer is set to the size of the +file plus offset______. +.sp +.in -3 +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS The error bit +(c-bit) is set for an undefined file descriptor. +.sp +.ti 0 +BUGS A file +can conceptually be as large +as 2**20 bytes. +Clearly only 2**16 bytes can be addressed by +seek____. +The problem is most acute on the +large special files. diff --git a/man/man2/setuid.2 b/man/man2/setuid.2 new file mode 100644 index 0000000000..640f63354d --- /dev/null +++ b/man/man2/setuid.2 @@ -0,0 +1,26 @@ +.pa 1 +.he 'SETUID (II)'3/15/72'SETUID (II)' +.ti 0 +NAME setuid -- set process ID +.sp +.ti 0 +SYNOPSIS (process ID in r0) +.br +sys setuid / setuid = 23. +.sp +.ti 0 +DESCRIPTION The user ID of the current process is set to +the argument in r0. +Both the effective and the real user ID are set. +This call is only permitted to the super-user +or if r0 is the real user ID. +.sp +.ti 0 +SEE ALSO getuid(II) +.sp +.ti 0 +DIAGNOSTICS Error bit +(c-bit) is set as indicated. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/sleep.2 b/man/man2/sleep.2 new file mode 100644 index 0000000000..d74b8f207b --- /dev/null +++ b/man/man2/sleep.2 @@ -0,0 +1,31 @@ +.pa 1 +.he 'SLEEP (II)'9/4/72'SLEEP (II)' +.ti 0 +NAME sleep -- stop execution for interval +.sp +.ti 0 +SYNOPSIS (seconds in r0) +.br +sys sleep / sleep = 35.; not in assembler +.sp +.ti 0 +DESCRIPTION The +current process is suspended from execution +for the number of seconds specified +by the contents of register 0. +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS Due to the +implementation, +the sleep interval is only +accurate to 256 60ths of a +second (4.26 sec). +Even then, the process is placed +on a low priority queue and must be +scheduled. diff --git a/man/man2/stat.2 b/man/man2/stat.2 new file mode 100644 index 0000000000..d15cca1db7 --- /dev/null +++ b/man/man2/stat.2 @@ -0,0 +1,77 @@ +.pa 1 +.he 'STAT (II)'3/15/72'STAT (II)' +.ti 0 +NAME stat -- get file status +.sp +.ti 0 +SYNOPSIS sys stat; name; buf / stat = 18. +.sp +.ti 0 +DESCRIPTION name____ points to a null-terminated string naming +a file; buf___ is the address of a 34(10) byte buffer +into which information is placed concerning the file. +It is unnecessary to have any +permissions at all with respect to the file, but all directories +leading to the file must be readable. +.sp +After stat____, buf___ has the following format: +.sp +.nf +buf, +1 i-number +.br ++2,+3 flags (see below) +.br ++4 number of links +.br ++5 user ID of owner +.br ++6,+7 size in bytes +.br ++8,+9 first indirect block or contents block +.br +.li +... +.br ++22,+23 eighth indirect block or contents block +.br ++24,+25,+26,+27 creation time +.br ++28,+29,+30,+31 modification time +.br ++32,+33 unused +.fi +.sp +The flags are as follows: +.sp +.in +3 +.nf +100000 used (always on) +040000 directory +.nf +020000 file has been modified (always on) +.fi +010000 large file +.br +000040 set user ID +.br +000020 executable +.br +000010 read, owner +.br +000004 write, owner +.br +000002 read, non-owner +.br +000001 write, non-owner +.sp +.in -3 +.fi +.ti 0 +SEE ALSO stat(I), fstat(II) +.sp +.ti 0 +DIAGNOSTICS Error bit (c-bit) +is set if the file cannot be found. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/stime.2 b/man/man2/stime.2 new file mode 100644 index 0000000000..c9b521d367 --- /dev/null +++ b/man/man2/stime.2 @@ -0,0 +1,24 @@ +.pa 1 +.he 'STIME (II)'3/15/72'STIME (II)' +.ti 0 +NAME stime -- set time +.sp +.ti 0 +SYNOPSIS (time in r0-r1) +.br +sys stime / stime = 25. +.sp +.ti 0 +DESCRIPTION stime_____ +sets the system's idea of the time and date. +Only the super-user may use this call. +.sp +.ti 0 +SEE ALSO date(I), time(II) +.sp +.ti 0 +DIAGNOSTICS Error bit (c-bit) +set if user is not the super-user. +.sp +.ti 0 +BUGS -- diff --git a/man/man2/stty.2 b/man/man2/stty.2 new file mode 100644 index 0000000000..eafb34a5c1 --- /dev/null +++ b/man/man2/stty.2 @@ -0,0 +1,94 @@ +.pa 1 +.he 'STTY (II)'6/12/72'STTY (II)' +.tr | +.ti 0 +NAME stty -- set mode of typewriter +.sp +.ti 0 +SYNOPSIS (file descriptor in r0) +.br +sys stty; arg / stty = 31. +.br +.li +... +.ti -6 +arg: dcrsr; dctsr; mode +.sp +.ti 0 +DESCRIPTION stty____ +sets mode bits for a typewriter whose file descriptor +is passed in r0. +First, the system delays until the typewriter is quiescent. +Then, the argument dcrsr_____ is placed into the typewriter's +receiver control and status register, +and dctsr_____ is placed in the transmitter control and status register. +The DC-11 manual must be consulted for the format of these +words. +For the purpose of this call, the most important ro^le of +these arguments is to adjust to the speed of the typewriter. +.sp +The mode____ argument contains several bits which determine the +system's treatment of the typewriter: +.sp +.in +3 +.nf +200 even parity allowed on input (e. g. for M37s) +100 odd parity allowed on input +040 raw mode: wake up on all characters +020 map CR into LF; echo LF or CR as LF-CR +010 echo (full duplex) +004 map upper case to lower on input (e. g. M33) +002 echo and print tabs as spaces +001 inhibit all function delays (e. g. CRTs) +.fi +.in -3 +.sp +.fi +Characters with the wrong parity, as determined by bits 200 and +100, are ignored. +.sp +In raw mode, every character is passed back immediately +to the program. No erase or kill processing is done; +the end-of-file character (EOT), the interrupt character +(DELETE) and the quit character (FS) are not treated specially. +.sp +Mode 020 causes input carriage returns to be turned into +new-lines; +input of either CR or LF causes LF-CR both to +be echoed +(used for GE TermiNet 300's and other terminals without the newline function). +.sp +Additional bits in the high order byte of the mode argument +are used to indicate that the terminal is an IBM|2741 +and to specify 2741 modes. +These mode bits are: +.sp +.in+8 +.ll+6 +.ti-6 +|400 terminal is an IBM|2741 +.ti-6 +1000 the 2741 has the transmit interrupt feature (currently ignored) +.ti-6 +2000 use correspondence code conversion on output +.ti-6 +4000 use correspondence code conversion on input (currently ignored) +.sp +.in -8 +.ll-6 +Normal input and output code conversion +for 2741s is EBCDIC (e. g. 963 ball and corresponding keyboard). +The presence of the transmit interrupt feature permits +the system to do read-ahead while no output is in progress. +In 2741 mode, the low order bits 331 are ignored. +.ti0 +.sp +SEE ALSO stty(I), gtty(II) +.sp +.ti 0 +DIAGNOSTICS The error bit +(c-bit) is set if the file descriptor does not refer to a typewriter. +.sp +.ti 0 +BUGS This call should be used with care. +.tr || diff --git a/man/man2/sync.2 b/man/man2/sync.2 new file mode 100644 index 0000000000..6a06efb666 --- /dev/null +++ b/man/man2/sync.2 @@ -0,0 +1,27 @@ +.pa 1 +.he 'SYNC (II)'6/12/72'SYNC (II)' +.ti 0 +NAME sync -- update super-block +.sp +.ti 0 +SYNOPSIS sys sync / sync = 36.; not in assembler +.sp +.ti 0 +DESCRIPTION sync____ +causes the super block for all file systems to be written out. +It is only necessary on systems in which +this writing may be delayed +for a long time, i.e., those which +incorporate hardware protection facilities. + +It should be used by programs which examine a file system, +for example check, df, tm, etc. +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man2/time.2 b/man/man2/time.2 new file mode 100644 index 0000000000..ca41e35e76 --- /dev/null +++ b/man/man2/time.2 @@ -0,0 +1,28 @@ +.pa 1 +.he 'TIME (II)'3/15/72'TIME (II)' +.ti 0 +NAME time -- get time of year +.sp +.ti 0 +SYNOPSIS sys time / time = 13. +.br +(time r0-r1) +.sp +.ti 0 +DESCRIPTION time____ +returns the time since 00:00:00, Jan. 1, 1972, measured +in sixtieths of a second. +The high order word is in the r0 register and the low order +is in the r1. +.sp +.ti 0 +SEE ALSO date(I), mdate(II) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS The time +is stored in 32 bits. +This guarantees a crisis every +2.26 years. diff --git a/man/man2/times.2 b/man/man2/times.2 new file mode 100644 index 0000000000..0f8cefe893 --- /dev/null +++ b/man/man2/times.2 @@ -0,0 +1,68 @@ +.pa 1 +.he 'TIMES(II)'2/10/73'TIMES(II)' +.ti 0 +NAME times -- get process times +.sp +.ti 0 +.nf +SYNOPSIS sys times; buffer / times = 43.; not in assembler +.br +.fi +.li +... +.ti -8 +buffer: .=.+[24.*3] +.sp +.ti 0 +DESCRIPTION times_____ +returns time-accounting information +for the system as a whole, for the current process, +and for the terminated child processes +of the current process. +All the times are 2-word (32-bit) numbers, and the +unit of measurement is 1/60 second. + +After the call, the buffer will appear as follows: + +buffer: +.br +system: + .=.+4 / absolute time + .=.+4 / total system time + .=.+4 / total swap time + .=.+4 / other I/O wait time + .=.+4 / idle time + .=.+4 / total user time + +process: + .=.+4 / (ignore) + .=.+4 / time in system + .=.+4 / (ignore) + .=.+4 / I/O wait time + .=.+4 / (ignore) + .=.+4 / processor time + +child: + .=.+24. + +The format of the "child" times is the same as +that for the process times; the numbers are +the sum of the times for all terminated direct +or indirect descendants of the current process. + +The "absolute" time returned is the same as that +given by time(II). +The "total system times" are times since the last cold +boot. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO time(II), time(I) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man2/umount.2 b/man/man2/umount.2 new file mode 100644 index 0000000000..6a2e6aa6ae --- /dev/null +++ b/man/man2/umount.2 @@ -0,0 +1,34 @@ +.pa 1 +.he 'UMOUNT (II)'3/15/72'UMOUNT (II)' +.ti 0 +NAME umount -- dismount file system +.sp +.ti 0 +.nf +SYNOPSIS sys umount; special / umount = 22. +.fi +.sp +.ti 0 +DESCRIPTION umount______ +announces to the system that special +file special_______ is no longer to contain +a removable file system. +The file associated with the special +file reverts to its ordinary interpretation (see mount_____). + +The user must take +care that all activity on the file system has ceased. +.sp +.ti 0 +SEE ALSO umount(I), mount(II) +.sp +.ti 0 +DIAGNOSTICS Error bit +(c-bit) set if +no +file system was mounted on the special file. +.sp +.ti 0 +BUGS Use +of this call should +be restricted to the super-user. diff --git a/man/man2/unlink.2 b/man/man2/unlink.2 new file mode 100644 index 0000000000..45ef7a0831 --- /dev/null +++ b/man/man2/unlink.2 @@ -0,0 +1,33 @@ +.pa 1 +.he 'UNLINK (II)'3/15/72'UNLINK (II)' +.ti 0 +NAME unlink -- remove directory entry +.sp +.ti 0 +SYNOPSIS sys unlink; name / unlink = 10. +.sp +.ti 0 +DESCRIPTION Name____ +points to a null-terminated string. +Unlink______ +removes the entry for the file pointed to by name____ +from its directory. +If this entry was the last link to the file, +the contents of the file are freed and the file is destroyed. +If, however, the file was open in any process, the actual +destruction is delayed until it is closed, even though +the directory entry has disappeared. +.sp +.ti 0 +SEE ALSO rm(I), rmdir(I), link(II) +.sp +.ti 0 +DIAGNOSTICS The error bit +(c-bit) is set to indicate that the file does not +exist or that its directory cannot be written. +Write permission is not required on the file itself. +It is also illegal to unlink a directory +(except for the super-user). +.sp +.ti 0 +BUGS -- diff --git a/man/man2/wait.2 b/man/man2/wait.2 new file mode 100644 index 0000000000..1c76ef1a22 --- /dev/null +++ b/man/man2/wait.2 @@ -0,0 +1,59 @@ +.pa 1 +.he 'WAIT (II)'9/4/72'WAIT (II)' +.ti 0 +NAME wait -- wait for process to die +.sp +.ti 0 +SYNOPSIS sys wait / wait = 7. +.br +(process ID in r0) +.br +(termination status/user status in r1) +.sp +.ti 0 +DESCRIPTION wait____ +causes its caller to delay until one of its child +processes terminates. +If any child has died since the last wait____, return is immediate; +if there are no children, return is immediate with +the error bit set. +In the case of several children several wait____s are needed +to learn of all the deaths. +.sp +If the error bit is not set on return, +the r1 high byte contains the low byte of the +child process r0 when it terminated. +The r1 low byte contains the termination status +of the process from the following list: +.sp + 0 exit + 1 bus error + 2 illegal instruction + 3 trace trap + 4 IOT trap + 5 power fail trap + 6 EMT trap + 7 bad system call + 8 PIR interrupt + 9 floating point exception + 10 memory violation + 11 quit + 12 interrupt + 13 kill (see kill(II)) + 14 User I/O (not currently possible) + +16 core image produced +.sp +.ti 0 +SEE ALSO exit(II), fork(II) +.sp +.ti 0 +DIAGNOSTICS error bit +(c-bit) on if no children not previously waited for. +.sp +.ti 0 +BUGS A child +which dies, but is never +waited for consumes +a slot in the process table. +When this table is full, +the system is effectively hung. diff --git a/man/man2/write.2 b/man/man2/write.2 new file mode 100644 index 0000000000..6a8d2ddbf6 --- /dev/null +++ b/man/man2/write.2 @@ -0,0 +1,36 @@ +.pa 1 +.he 'WRITE (II)'3/15/72'WRITE (II)' +.ti 0 +NAME write -- write on file +.sp +.ti 0 +SYNOPSIS (file descriptor in r0) +.br +sys write; buffer; nbytes / write = 4. +.br +(number written in r0) +.sp +.ti 0 +DESCRIPTION A file descriptor is a word returned from a +successful open____ or creat_____ call. +.sp +buffer______ is the address of nbytes______ contiguous +bytes which are written on the output file. +The number of characters actually written is returned in r0. +It should be regarded as an error +if this is not the same as requested. +.sp +Writes which are multiples +of 512 characters long and begin on a 512-byte boundary +are more efficient than any others. +.sp +.ti 0 +SEE ALSO creat(II), open(II) +.sp +.ti 0 +DIAGNOSTICS The error bit +(c-bit) is set on an error: bad descriptor, buffer address, or +count; physical I/O errors. +.sp +.ti 0 +BUGS -- diff --git a/man/man3/atan.3 b/man/man3/atan.3 new file mode 100644 index 0000000000..543c8edd5c --- /dev/null +++ b/man/man3/atan.3 @@ -0,0 +1,29 @@ +.pa 1 +.he 'ATAN, ATAN2 (III)'1/15/73'ATAN, ATAN2 (III)' +.ti 0 +NAME atan -- arc tangent function +.sp +.ti 0 +SYNOPSIS jsr r5,atan[2] +.sp +.ti 0 +DESCRIPTION The +atan entry returns the arc tangent +of fr0 in fr0. +The range is -J/2 to J/2. +.sp +The atan2 entry returns the arc tangent +of fr0/fr1 in fr0. +The range is -J to J. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS there is no error return +.sp +.ti 0 +BUGS -- diff --git a/man/man3/atof.3 b/man/man3/atof.3 new file mode 100644 index 0000000000..07d596136f --- /dev/null +++ b/man/man3/atof.3 @@ -0,0 +1,43 @@ +.pa 1 +.he 'ATOF (III)'1/15/73'ATOF (III)' +.ti 0 +NAME atof -- ascii to floating +.sp +.ti 0 +SYNOPSIS jsr r5,atof; subr +.sp +.ti 0 +DESCRIPTION atof____ +will convert an ascii stream to a floating +number returned in fr0. + +The subroutine subr____ +(supplied by the caller) +is called on r5 for each character of the +ascii stream. +subr____ should return the character in r0. +The first character not used in the conversion +is left in r0. +.sp +The only numbers recognized are: an optional minus +sign followed by a string of digits optionally containing +one decimal point, then followed optionally by the +letter "e" followed by a signed integer. +.sp +The subroutine subr____ must not disturb any registers. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO Calls atoi (III) +.sp +.ti 0 +DIAGNOSTICS There are none; overflow results in a very large +number and garbage characters terminate the scan. +.sp +.ti 0 +BUGS The +routine should accept initial "+", initial blanks, and "E" for "e". + +Overflow should be signalled with the carry bit. diff --git a/man/man3/atoi.3 b/man/man3/atoi.3 new file mode 100644 index 0000000000..9db85352fe --- /dev/null +++ b/man/man3/atoi.3 @@ -0,0 +1,43 @@ +.pa 1 +.he 'ATOI (III)'1/15/73'ATOI (III)' +.ti 0 +NAME atoi -- ascii to integer +.sp +.ti 0 +SYNOPSIS jsr r5,atoi; subr +.sp +.ti 0 +DESCRIPTION atoi____ +will convert an ascii stream to a binary +number returned in r1. + +The subroutine subr____ +(supplied by the caller) +is called on r5 for each character of the +ascii stream. +subr____ should return the character in r0. +The first character not used in the conversion +is left in r0. +.sp +The numbers recognized are: an optional minus sign +followed by a string of digits. +.sp +The subroutine subr____ must not disturb any registers. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS There are none; +the routine charges on regardless of consequences; see BUGS. +.sp +.ti 0 +BUGS It +pays no attention to overflow - you get whatever the machine +instructions mul and div happen to leave in the low order half +- in fact, the carry bit should be set and isn't. +.sp +The routine should accept initial "+" and initial blanks. diff --git a/man/man3/compar.3 b/man/man3/compar.3 new file mode 100644 index 0000000000..3fc488d541 --- /dev/null +++ b/man/man3/compar.3 @@ -0,0 +1,43 @@ +.pa 1 +.he 'COMPAR (III)'1/15/73'COMPAR (III)' +.ti 0 +NAME compar -- default comparison routine for qsort +.sp +.ti 0 +SYNOPSIS jsr pc,compar +.sp +.ti 0 +DESCRIPTION Compar is the default comparison routine +called by qsort and is separated out so that the user can +supply his own comparison. +.sp +The routine is called with the width (in bytes) of +an element in r3 and it compares byte-by-byte the element +pointed to by r0 with the element pointed to by r4. +.sp +Return is via the condition codes, +which are tested by the instructions "blt" and "bgt". +.a +That is, in the absence of overflow, then the +condition (r0) < (r4) should leave the Z-bit off and N-bit +on while (r0) > (r4) should leave Z and N off. +Still another way of putting it is that for elements +of length 1 the instruction + + cmpb (r0),(r4) + +suffices. +.sp +Only r0 is changed by the call. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO qsort (III) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS It could be recoded to run faster. diff --git a/man/man3/crypt.3 b/man/man3/crypt.3 new file mode 100644 index 0000000000..a6b054632e --- /dev/null +++ b/man/man3/crypt.3 @@ -0,0 +1,30 @@ +.pa 1 +.he 'CRYPT (III)'1/15/73'CRYPT (III)' +.ti 0 +NAME crypt -- password encoding +.sp +.ti 0 +SYNOPSIS mov $key,r0 +.br +jsr pc,crypt +.sp +.ti 0 +DESCRIPTION On entry, r0 should point to a string of +characters terminated by an ASCII NULL. The routine +performs an operation on the key which is difficult to invert +(i.e. encrypts it) and leaves the resulting eight bytes +of ASCII alphanumerics in a global cell called "word". +.sp +Login uses this result as a password. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO passwd(I),passwd(V), login(I) +.sp +.ti 0 +DIAGNOSTICS there are none; garbage is accepted. +.sp +.ti 0 +BUGS -- diff --git a/man/man3/ctime.3 b/man/man3/ctime.3 new file mode 100644 index 0000000000..a0c2514439 --- /dev/null +++ b/man/man3/ctime.3 @@ -0,0 +1,36 @@ +.pa 1 +.he 'CTIME (III)'1/15/73'CTIME (III)' +.ti 0 +NAME ctime -- convert date and time to ASCII +.sp +.ti 0 +SYNOPSIS sys time +.br +mov $buffer,r2 +.br +jsr pc,ctime +.br +.sp +.ti 0 +DESCRIPTION The output buffer +is 16 characters long and +the time has the format +.sp + Oct 9 17:32:24\\0 +.sp +The input time must be in the r0 and r1 registers in the form +returned by sys___ time____. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO ptime(III), time(II) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS The routine must be reassembled for leap year. +.br +Dec 31 is followed by Dec 32 and so on. diff --git a/man/man3/ddsput.3 b/man/man3/ddsput.3 new file mode 100644 index 0000000000..b84a058b43 --- /dev/null +++ b/man/man3/ddsput.3 @@ -0,0 +1,82 @@ +.pa 1 +.he 'DDSPUT, DDSINIT (III)'1/15/73'DDSPUT, DDSINIT (III)' +.ti 0 +NAME ddsput -- put a character on display data set +.sp +.ti 0 +SYNOPSIS (file descriptor in r0) +.br +jsr pc,ddsinit + +.br +(character in r0) +.br +jsr pc,ddsput +.sp +.ti 0 +DESCRIPTION These routines +provide an interface to the Display Data Set, a peculiar +device which can be called by Picturephone sets and which +will display some of the ASCII character set and certain +other graphics on the Picturephone screen. + +If the DC11 or other interface hardware is not already +set up to talk to the Display Data Set, the ddsinit_______ +entry should be called with the appropriate file descriptor in r0. +On the only known DDS attached to UNIX, the associated special file +is called "/dev/ttyc". +ddsinit_______ also clears the display. + +Thereafter, characters may be displayed +by calling ddsput______. +To the extent possible, ddsput______ simulates an ordinary terminal. +Characters falling to the right of the 22X22 screen +area are ignored; the 23rd line on the screen causes +the screen to be erased and that line to be put at the top +of the new display. +Certain ASCII characters are interpreted specially as follows: + +.in +5 +.ti -5 +FF clear screen, go to top left +.ti -5 +HT expand to right number of spaces +.ti -5 +DC1 treat as reverse line feed (move N) +.ti -5 +DC2 move cursor 1 place right (move E) +.ti -5 +DC3 forward line feed (move S) +.ti -5 +DC4 backspace 1 position (move W) +.ti -5 +SO enter graph mode +.ti -5 +SI leave graph mode +.ti -5 +CR put cursor at start of current line + +.in -5 +Graph mode allows display of the non-ASCII characters and +will be described when hell freezes over. + +Lower-case ASCII alphabetics are mapped into upper case. +Several ASCII non-alphabetic graphics +are unavailable as well. Also the lower right circle of +the "%" character is missing. +Also one of the circuit cards in the DDS has a crack in it and +sometimes it doesn't work. +All in all, +it is best to avoid this device. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO AT&T writeup on DDS +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS yes diff --git a/man/man3/ecvt.3 b/man/man3/ecvt.3 new file mode 100644 index 0000000000..753307ff71 --- /dev/null +++ b/man/man3/ecvt.3 @@ -0,0 +1,47 @@ +.pa 1 +.he 'ECVT, FCVT (III)'1/15/73'ECVT, FCVT (III)' +.ti 0 +NAME ecvt, fcvt -- output conversion +.sp +.ti 0 +SYNOPSIS jsr pc,ecvt +.sp +or +.sp +jsr pc,fcvt +.sp +.ti 0 +DESCRIPTION Ecvt +is called with a floating point number in fr0. +.sp +On exit, the number has been converted into a +string of ascii digits in a buffer pointed to by r0. +The number of digits produced is controlled +by a global variable "_ndigits". + +Moreover, the position of the decimal point is +contained in r2: r2=0 means the d.p. is at the +left hand end of the string of digits; +r2>0 means the d.p. is within or to the right +of the string. + +The sign of the number is indicated by r1 (0 for +; 1 for -). + +The low order digit has suffered decimal rounding +(i. e. may have been carried into). +.sp +Fcvt is identical to ecvt, except that the correct digit +has had decimal rounding for F-style output of the number +of digits specified by "_ndigits". +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO ftoa(III) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man3/exp.3 b/man/man3/exp.3 new file mode 100644 index 0000000000..43f56f35fe --- /dev/null +++ b/man/man3/exp.3 @@ -0,0 +1,28 @@ +.pa 1 +.he 'EXP (III)'1/15/73'EXP (III)' +.ti 0 +NAME exp -- exponential function +.sp +.ti 0 +SYNOPSIS jsr r5,exp +.sp +.ti 0 +DESCRIPTION The +exponential of fr0 is returned in fr0. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS If +the result is not representable, the +c-bit is set +and the largest positive number is returned. +.sp +Zero is returned if the result would underflow. +.sp +.ti 0 +BUGS --- diff --git a/man/man3/ftoa.3 b/man/man3/ftoa.3 new file mode 100644 index 0000000000..be2061a455 --- /dev/null +++ b/man/man3/ftoa.3 @@ -0,0 +1,39 @@ +.pa 1 +.he 'FTOA (III)'1/15/73'FTOA (III)' +.ti 0 +NAME ftoa -- floating to ascii conversion +.sp +.ti 0 +SYNOPSIS jsr r5,ftoa; subr +.sp +.ti 0 +DESCRIPTION ftoa____ +will convert the floating point number in fr0 +into ascii in the form + + [-]ddddd.dd* + +if possible, otherwise in the form + + [-]d.dddddddde_[-]dd*. +.sp +For each character generated by ftoa, +the subroutine subr____ (supplied by the caller) is called on +register r5 with the character in r0. +.sp +The number of digits can be changed by changing the value +of "_ndigits" in ecvt (default is 10.). +.sp +The subroutine subr____ must not disturb any registers. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO ecvt(III), itoa(III) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man3/ftoo.3 b/man/man3/ftoo.3 new file mode 100644 index 0000000000..cebd1b3e88 --- /dev/null +++ b/man/man3/ftoo.3 @@ -0,0 +1,32 @@ +.pa 1 +.he 'FTOO (III)'1/15/73'FTOO (III)' +.ti 0 +NAME ftoo -- floating to octal conversion +.sp +.ti 0 +SYNOPSIS jsr r5,ftoo; subr +.sp +.ti 0 +DESCRIPTION ftoo wil convert the floating point number +in fr0 into ascii in the conventional octal form + + 000000;000000;000000;000000 +.sp +For each character generated by ftoo, the subroutine +subr____ +(supplied by the caller) is called on register r5 +with the character in r0. +.sp +The subroutine subr____ must not disturb any registers. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man3/gerts.3 b/man/man3/gerts.3 new file mode 100644 index 0000000000..2738ac2650 --- /dev/null +++ b/man/man3/gerts.3 @@ -0,0 +1,43 @@ +.pa 1 +.he 'CONNECT, GERTS (III)'3/15/72'CONNECT, GERTS (III)' +.ti 0 +NAME connect, gerts -- Gerts communication over 201 +.sp +.ti 0 +SYNOPSIS jsr r5,connect +.br +(error return) +.a +.br +.li +... + +jsr r5,gerts; fc; oc; ibuf; obuf +.br +(error return) +.br +.li +... +.sp +other entry points: gcset, gout +.sp +.ti 0 +DESCRIPTION The +GCOS GERTS interface is so bad that +a description here is inappropriate. +Anyone needing to use this interface should +seek divine guidance. +.sp +.ti 0 +FILES /dev/dn0, /dev/dp0 +.br +kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO dn(IV), dp(IV), HIS documentation +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man3/getc.3 b/man/man3/getc.3 new file mode 100644 index 0000000000..7a1557abcc --- /dev/null +++ b/man/man3/getc.3 @@ -0,0 +1,59 @@ +.pa 1 +.he 'GETC, GETW, FOPEN (III)'3/15/72'GETC, GETW, FOPEN (III)' +.ti 0 +NAME getw, getc, fopen -- buffered input +.sp +.ti 0 +SYNOPSIS mov $filename,r0 +.br +jsr r5,fopen; iobuf + +jsr r5,getc; iobuf +.br +(character in r0) + +jsr r5,getw; iobuf +.br +(word in r0) +.sp +.ti 0 +DESCRIPTION These routines are used to provide a buffered input +facility. +iobuf_____ is the address of a 518(10) byte buffer area whose +contents are maintained by these routines. Its format is: +.sp +.nf +ioptr: .=.+2 / file descriptor + .=.+2 / characters left in buffer + .=.+2 / ptr to next character + .=.+512. / the buffer +.sp +.fi +fopen_____ may be called initially to open the file. On return, +the error bit (c-bit) is set if the open failed. +If fopen_____ is never called, get___ will read from the standard +input file. +.sp +getc____ returns the next byte from the file in r0. The +error bit is set on end of file or a read error. +.sp +getw____ returns the next word in r0. getc____ and getw____ +may be used alternately; there are no odd/even +problems. +.sp +iobuf_____ must be provided by the user; it must be on a word boundary. + +To reuse the same buffer for another file, it is sufficient +to close the original file and call fopen_____ again. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO open(II), read(II), putc(III) +.sp +.ti 0 +DIAGNOSTICS c-bit set on EOF or error +.sp +.ti 0 +BUGS -- diff --git a/man/man3/hypot.3 b/man/man3/hypot.3 new file mode 100644 index 0000000000..2b477a7a68 --- /dev/null +++ b/man/man3/hypot.3 @@ -0,0 +1,35 @@ +.pa 1 +.he 'HYPOT (III)'6/12/72'HYPOT (III)' +.ti 0 +NAME hypot -- calculate hypotenuse +.sp +.ti 0 +SYNOPSIS movf a,fr0 +.br +movf b,fr1 +.br +jsr r5,hypot +.br +movf fr0,... +.sp +.ti 0 +DESCRIPTION The +square root of fr0*fr0 + fr1*fr1 +is returned in fr0. +The calculation is done in such a way +that overflow will not occur unless +the answer is not representable in floating point. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO sqrt(III) +.sp +.ti 0 +DIAGNOSTICS The +c-bit is set if the result cannot +be represented. +.sp +.ti 0 +BUGS -- diff --git a/man/man3/itoa.3 b/man/man3/itoa.3 new file mode 100644 index 0000000000..1c7a7db41c --- /dev/null +++ b/man/man3/itoa.3 @@ -0,0 +1,30 @@ +.pa 1 +.he 'ITOA (III)'3/15/72'ITOA (III)' +.ti 0 +NAME itoa -- integer to ascii conversion +.sp +.ti 0 +SYNOPSIS jsr r5,itoa; subr +.sp +.ti 0 +DESCRIPTION itoa____ +will convert the number in r0 +into ascii decimal preceded +by a - sign if appropriate. +For each character generated by itoa, +the subroutine subr____ (supplied by the caller) is called on +register r5 with the character in r0. +.sp +The subroutine subr____ must not disturb any registers. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man3/log.3 b/man/man3/log.3 new file mode 100644 index 0000000000..37e0fc84a0 --- /dev/null +++ b/man/man3/log.3 @@ -0,0 +1,26 @@ +.pa 1 +.he 'LOG (III)'3/15/72'LOG (III)' +.ti 0 +NAME log -- logarithm (base e) +.sp +.ti 0 +SYNOPSIS jsr r5,log +.sp +.ti 0 +DESCRIPTION The +logarithm (base e) of fr0 is returned in fr0. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS The error bit (c-bit) +is set if the input argument is less than or +equal to zero and the result is set to the largest +negative number. +.sp +.ti 0 +BUGS -- diff --git a/man/man3/mesg.3 b/man/man3/mesg.3 new file mode 100644 index 0000000000..f44f6e5c5f --- /dev/null +++ b/man/man3/mesg.3 @@ -0,0 +1,25 @@ +.pa 1 +.he 'MESG (III)'3/15/72'MESG (III)' +.ti 0 +NAME mesg -- write message on typewriter +.sp +.ti 0 +SYNOPSIS jsr r5,mesg; ; .even +.sp +.ti 0 +DESCRIPTION mesg____ +writes the string immediately following its call onto +the standard output file. +The string must be terminated by an ASCII NULL byte. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man3/nlist.3 b/man/man3/nlist.3 new file mode 100644 index 0000000000..5c67d5ed82 --- /dev/null +++ b/man/man3/nlist.3 @@ -0,0 +1,62 @@ +.pa 1 +.he 'NLIST (III)'6/12/72'NLIST (III)' +.ti 0 +NAME nlist -- get entries from name list +.sp +.ti 0 +SYNOPSIS jsr r5,nlist; file; list +.br +.li +... +.br +.ti -6 +file: ; .even +.br +.ti -6 +list: +.br +; type1; value1 +.br +; type2; value2 +.br +.li +... +.br +0 +.sp +.ti 0 +DESCRIPTION nlist_____ +will examine the name list in +the given assembler output file +and selectively extract a +list of values. +The name list consists of +a list of 8-character names (null padded) +each followed by two words. +The list is terminated with a zero. +Each name is looked up in the name list of +the file. +If the name is found, the type and value of the +name are placed in the two words following +the name. +If the name is not found, the type entry is set to -1. +.sp +This subroutine is useful for +examining the system name list kept in +the file /sys/sys/unix. +In this way programs can obtain system 'magic' +numbers that are up to date. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO a.out(V) +.sp +.ti 0 +DIAGNOSTICS All +type entries are set to -1 if the file cannot be found +or if it is not a valid namelist. +.sp +.ti 0 +BUGS -- diff --git a/man/man3/pow.3 b/man/man3/pow.3 new file mode 100644 index 0000000000..528ddecfb0 --- /dev/null +++ b/man/man3/pow.3 @@ -0,0 +1,36 @@ +.pa 1 +.he 'POW (III)'1/15/73'POW (III)' +.ti 0 +NAME pow -- floating exponentiation x^y +.sp +.ti 0 +SYNOPSIS movf x,fr0 +.br +movf y,fr1 +.br +jsr pc,pow +.br +movf fr0,... +.sp +.ti 0 +DESCRIPTION The +value of x^y (i.e. x\uy\d) is returned in fr0. + +0^x returns zero for all x. + +(-x)^y returns a result only if y is an integer. + +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO exp(III), log(III) +.sp +.ti 0 +DIAGNOSTICS The +carry bit is set on return in case of overflow or in case of +0^0 or +(-x)^y for y non-integer. +.sp +.ti 0 +BUGS -- diff --git a/man/man3/ptime.3 b/man/man3/ptime.3 new file mode 100644 index 0000000000..5f6c7f7035 --- /dev/null +++ b/man/man3/ptime.3 @@ -0,0 +1,34 @@ +.pa 1 +.he 'PTIME (III)'3/15/72'PTIME (III)' +.ti 0 +NAME ptime -- print date and time +.sp +.ti 0 +SYNOPSIS sys time +.br +mov file,r2 +.br +jsr pc,ptime +.sp +.ti 0 +DESCRIPTION ptime_____ prints the date and time in the form +.sp + Oct 9 17:20:33\ +.sp +on the file whose file descriptor is in r2. +The string is 15 characters long. +The time to be printed +must be placed in the r0 and r1 registers +in the form returned by sys___ time____. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO time(II), ctime(III) (used to do the conversion) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS see ctime diff --git a/man/man3/putc.3 b/man/man3/putc.3 new file mode 100644 index 0000000000..9a14bf8b69 --- /dev/null +++ b/man/man3/putc.3 @@ -0,0 +1,60 @@ +.pa 1 +.he 'PUTC,PUTW,FCREAT,FLUSH (III)'6/12/72'PUTC,PUTW,FCREAT,FLUSH (III)' +.ti 0 +NAME putc, putw, fcreat, flush -- buffered output +.sp +.ti 0 +SYNOPSIS mov $filename,r0 +.br +jsr r5,fcreat; iobuf + +(get byte in r0) +.br +jsr r5,putc; iobuf + +(get word in r0) +.br +jsr r5,putw; iobuf +.sp +jsr r5,flush; iobuf +.sp +.ti 0 +DESCRIPTION fcreat______ creates +the given file (mode 17) and sets up the buffer iobuf_____ (size 518(10) bytes); +putc____ and putw____ write a byte or word respectively +onto the file; +flush_____ forces the contents of the buffer to be written, but +does not close the file. +The format of the buffer is: +.sp +.nf +iobuf: .=.+2 / file descriptor + .=.+2 / characters unused in buffer + .=.+2 / ptr to next free character + .=.+512. / buffer +.sp +.fi +fcreat______ sets the error bit (c-bit) if the +file creation failed; none of the other routines +return error information. +.sp +Before terminating, a program should call +flush_____ to force out the last of the output. +.sp +The user must supply iobuf_____, which should begin on a word boundary. + +To write a new file using the same buffer, it +suffices to call flush_____, close the file, +and call fcreat______ again. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO creat(II), write(II), getc(III) +.sp +.ti 0 +DIAGNOSTICS error bit possible on fcreat______ call +.sp +.ti 0 +BUGS -- diff --git a/man/man3/qsort.3 b/man/man3/qsort.3 new file mode 100644 index 0000000000..54ddebe17d --- /dev/null +++ b/man/man3/qsort.3 @@ -0,0 +1,42 @@ +.pa 1 +.he 'QSORT (III)'6/12/72'QSORT (III)' +.ti 0 +NAME qsort -- quicker sort +.sp +.ti 0 +SYNOPSIS (base of data in r1) +.br +(end+1 of data in r2) +.br +(element width in r3) +.br +jsr pc,qsort +.sp +.ti 0 +DESCRIPTION qsort_____ +is an implementation +of the quicker sort algorithm. +It is designed to sort equal length +elements. +Registers r1 and r2 delimit the region of +core containing the array of byte strings to be sorted: +r1 points to the start of the first string, r2 to the first +location above the last string. +Register r3 contains the length of each string. +r2-r1 should be a multiple of r3. +On return, r0, r1, r2, r3, r4 are destroyed. +.sp +The routine compar (q.v.) is called to compare elements +and may be replaced by the user. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO compar(III) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS It scribbles on r4. diff --git a/man/man3/rand.3 b/man/man3/rand.3 new file mode 100644 index 0000000000..d502db75f4 --- /dev/null +++ b/man/man3/rand.3 @@ -0,0 +1,37 @@ +.pa 1 +.he 'RAND (III)'1/15/73'RAND (III)' +.ti 0 +NAME rand -- random number generator +.sp +.ti 0 +SYNOPSIS jsr pc,srand /to initialize +.br +jsr pc,rand /to get a random number +.sp +.ti 0 +DESCRIPTION The routine uses a multiplicative congruential +random number generator to return successive pseudo-random +numbers in r0 in the range from 1 to 2^15-1. +.sp +The generator is reinitialized by calling srand with 1 in r0. +.sp +It can be set to a random starting point by calling +srand with whatever you like in r0, +for example the result left in r1 from sys___ time____. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +WARNING The author of this routine has been writing +random-number generators for many years and has never been +known to write one that worked. diff --git a/man/man3/salloc.3 b/man/man3/salloc.3 new file mode 100644 index 0000000000..39f9ff6dc3 --- /dev/null +++ b/man/man3/salloc.3 @@ -0,0 +1,160 @@ +.pa 1 +.he 'SALLOC (III)'6/15/72'SALLOC (III)' +.ti 0 +.nf +NAME salloc -- string manipulation routines +.fi +.sp +.ti 0 +.nf +SYNOPSIS (get size in r0) +.br +jsr pc,allocate +.sp +(get source pointer in r0, +destination pointer in r1) +jsr pc,copy +.sp +jsr pc,wc +.sp +(all following instructions assume r1 contains pointer) + +jsr pc,release + +(get character in r0) +jsr pc,putchar +.sp +jsr pc,lookchar +(character in r0) + +jsr pc,getchar +(character in r0) + +(get character in r0) +jsr pc,alterchar + +(get position in r0) +jsr pc,seekchar + +jsr pc,backspace +(character in r0) + +(get word in r0) +jsr pc,putword + +jsr pc,lookword +(word in r0) + +jsr pc,getword +(word in r0) + +(get word in r0) +jsr pc,alterword + +jsr pc,backword +(word in r0) + +jsr pc,length +(length in r0) + +jsr pc,position +(position in r0) + +jsr pc,rewind + +jsr pc,create + +jsr pc,fsfile + +jsr pc,zero + +.fi +.ti 0 +DESCRIPTION This package is a complete set of routines +for dealing with almost arbitrary +length strings of words and bytes. +The strings are stored on a disk file, so the sum of +their lengths can be considerably larger than +the available core. + +For each string there is a header of four words, namely +a write pointer, a read pointer and pointers to the beginning and end of +the block containing the string. +Initially the read and write pointers point to the beginning of the string. +All routines that refer to a string require the header address in r1. +Unless the string is destroyed by the call, +upon return r1 will point to the same string, although +the string may have grown to the extent that it had to be +be moved. + +.ul +allocate +obtains a string of the requested size and returns +a pointer to its header in r1. +.sp +release_______ releases a string back to free storage. +.sp +putchar_______ and putword_______ write a byte or word respectively into the string +and advance the write pointer. + +.ul +lookchar +and +.ul +lookword +read +a byte or word respectively from the string but do not advance the read pointer. + +getchar_______ and getword_______ read a byte or word respectively from the string and advance the read pointer. + +alterchar_________ and alterword_________ write a byte or word respectively into the string where the read pointer +is pointing and advance the read pointer. + +backspace_________ and backword________ read the last byte or word written and decrement the write pointer. + +All write operations will automatically get a larger block if the current block is exceeded. +All read operations return with the error bit set if attempting to read beyond the write pointer. +.sp +seekchar________ moves the read pointer to the offset specified in r0. + +length______ returns the current length of the string (beginning pointer to write pointer) in r0. + +position________ returns the current offset of the read pointer in r0. + +rewind______ moves the read pointer to the beginning of the string. + +create______ returns the read and write pointers to the beginning of the string. + +fsfile______ moves the read pointer to the current position of the write pointer. + +zero____ zeros the whole string and sets the write pointer to the beginning of the string. + +copy____ copies the string whose header pointer is in r0 to the string whose header pointer is in +r1. +Care should be taken in using the copy instruction since r1 will be changed if the contents of the source string +is bigger than the destination string. + +wc__ forces the contents of the internal buffers and the header blocks to be written on disc. +.sp +.ti 0 +FILES The allocator is in +/lib/libs.a; +the -s__ option to ld__ will link edit +references to the allocator. + +alloc.d is the temporary file used to contain +the strings. + +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS "error in copy" if a disk write error occurs during the execution of the copy instruction. +"error in allocator" if any routine is called with a bad header pointer. +"Cannot open output file" if file alloc.d cannot be created or opened. +"Out of space" if there's no available block of the requested size or no headers available for a new block. +.sp +.fi +.in16 +.ti 0 +BUGS -- diff --git a/man/man3/sin.3 b/man/man3/sin.3 new file mode 100644 index 0000000000..80bdddb9bc --- /dev/null +++ b/man/man3/sin.3 @@ -0,0 +1,27 @@ +.pa 1 +.he 'SIN, COS (III)'3/15/72'SIN, COS (III)' +.ti 0 +NAME sin, cos -- sine cosine +.sp +.ti 0 +SYNOPSIS jsr r5,sin (cos) +.sp +.ti 0 +DESCRIPTION The +sine (cosine) of fr0 in radians +is returned in fr0. +.sp +The magnitude of the argument should be checked +by the caller to make sure the result is meaningful. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS there are none +.sp +.ti 0 +BUGS -- diff --git a/man/man3/sqrt.3 b/man/man3/sqrt.3 new file mode 100644 index 0000000000..425886cb1f --- /dev/null +++ b/man/man3/sqrt.3 @@ -0,0 +1,24 @@ +.pa 1 +.he 'SQRT (III)'3/15/72'SQRT (III)' +.ti 0 +NAME sqrt -- square root function +.sp +.ti 0 +SYNOPSIS jsr r5,sqrt +.sp +.ti 0 +DESCRIPTION The +square root of fr0 is returned in fr0. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS The c-bit is +set on negative arguments and 0 is returned. +.sp +.ti 0 +BUGS -- diff --git a/man/man3/switch.3 b/man/man3/switch.3 new file mode 100644 index 0000000000..c6ccccbc23 --- /dev/null +++ b/man/man3/switch.3 @@ -0,0 +1,44 @@ +.pa 1 +.he 'SWITCH (III)'3/15/72'SWITCH (III)' +.ti 0 +NAME switch -- switch on value +.sp +.ti 0 +SYNOPSIS (switch value in r0) +.br +jsr r5,switch; swtab +.br +(not-found return) +.br +.li +... +.ti -7 +swtab: val1; lab1; +.br +.li +... +.br +valn; labn +.br +.li +..; 0 +.sp +.ti 0 +DESCRIPTION switch______ +compares the value of r0 against each of the val\di\u; if +a match is found, control is transferred to the corresponding +lab\di\u (after popping the stack once). +If no match has been found by the time a null lab\di\u +occurs, switch______ returns. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man3/ttyn.3 b/man/man3/ttyn.3 new file mode 100644 index 0000000000..9c9d2399cf --- /dev/null +++ b/man/man3/ttyn.3 @@ -0,0 +1,26 @@ +.pa 1 +.he 'TTYN (III)'1/15/73'TTYN (III)' +.ti 0 +NAME ttyn -- return name of current tty +.sp +.ti 0 +SYNOPSIS jsr pc,ttyn +.sp +.ti 0 +DESCRIPTION The routine hunts up the name of the +input tty attached to the process (one byte from the set +{012345678abc} at present) and returns it in r0. +.sp +"x" is returned if no genuine input tty is attached to the process. +.sp +.ti 0 +FILES kept in /lib/liba.a +.sp +.ti 0 +SEE ALSO fstat(II) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man4/dc.4 b/man/man4/dc.4 new file mode 100644 index 0000000000..b161f0eb35 --- /dev/null +++ b/man/man4/dc.4 @@ -0,0 +1,214 @@ +.pa 1 +.he 'DC (IV)'6/12/72'DC (IV)' +.tr | +.ti 0 +NAME dc -- DC-11 communications interfaces +.sp +.ti 0 +DESCRIPTION +.br +.in 8 +The special files +/dev/tty0, /dev/tty1, ... +refer to the +DC11 asynchronous communications interfaces. +At the moment there are ten of them, but the number is subject +to change. + +When one of these files is opened, it causes +the process to wait until a connection is established. +(In practice, however, user's programs seldom open these +files; they are opened by init____ and become a user's standard +input and output file.) +The very first typewriter file open in a process becomes +the control_______ type____writer______ +for that process. The control typewriter plays a special +role in handling quit or interrupt signals, as discussed +below. +The control typewriter is inherited by a child process during a fork____. + +A terminal associated with one of these files ordinarily +operates in full-duplex mode. Characters may be typed at any time, +even while output is occurring, and are only lost when the +system's character input buffers become completely +choked, which is rare, +or when the user has accumulated the maximum allowed number of +input characters which have not yet been read by some program. +Currently this limit is 150 characters. +When this is happening the character "#" is echoed for every lost +input character. + +When first opened, +the interface mode is +ASCII characters; +150 baud; +even parity only accepted; +10 bits/character (one stop bit); +and newline action character. +The system delays transmission after sending certain function characters. +Delays for horizontal tab, newline, and form feed are calculated for +the Teletype Model 37; +the delay for carriage return is calculated for the GE TermiNet|300. +Most of these operating states can be changed +by using the system call stty(II). +In particular +the following hardware states are program settable independently +for input and output (see DC11 manual): +134.5, 150, 300, or 1200 baud; +one or two stop bits on output; +and 5, 6, 7, or 8 data bits/character. +In addition, the following software modes can be invoked: +acceptance of even parity, odd parity, or both; +a raw mode in which all characters may be read one at a time; +a carriage return (CR) mode in which +CR is mapped into newline on input and +either CR or line feed (LF) cause echoing of +the sequence LF-CR; +mapping of upper case letters into lower case; +suppression of echoing; +suppression of delays after function characters; +the printing of tabs as spaces; +and setting the system to handle IBM|2741s. +See getty(VII) for the way that terminal speed and type are +detected. + +Normally, typewriter input is processed in units of lines. +This means that a program attempting +to read will be suspended until an entire line has been +typed. Also, no matter how many characters are requested +in the read call, at most one line will be returned. +It is not however necessary to read a whole line at +once; any number of characters may be +requested in a read, even one, without losing information. + +During input, erase and kill processing is normally +done. +The character "#" erases the +last character typed, except that it will not erase +beyond the beginning of a line or an EOT. +The character "@" kills the entire +line up to the point where it was typed, but not beyond an EOT. Both these +characters operate on a keystroke basis independently +of any backspacing or tabbing that may have been done. +Either "@" or "#" may be entered literally by preceding +it by "\\"; +the erase or kill character remains, but the +"\\" disappears. + +It is possible to use raw mode in which +the program +reading is awakened on each character. +In raw mode, no erase or kill processing is done; +and the EOT, quit and interrupt characters +are not treated specially. + +The ASCII EOT character may be used to generate an end of file +from a typewriter. +When an EOT is received, all the characters +waiting to be read are immediately passed to +the program, without waiting for a new-line. +Thus if there are no characters waiting, which +is to say the EOT occurred at the beginning of a line, +zero characters will be passed back, and this is +the standard end-of-file signal. +The EOT is not passed on except in raw mode. + +When the carrier signal from the dataset drops (usually +because the user has hung up his terminal) any read +returns with an end-of-file indication. +Thus programs which read a typewriter and test for +end-of-file on their input +can terminate appropriately when +hung up on. + +Two characters have a special meaning when typed. +The ASCII DEL character (sometimes called "rubout") +is the interrupt_________ signal. +When this character is received from a given typewriter, +a search is made for all processes which have this typewriter +as their control typewriter, +and which have not informed the system that they wish +to ignore interrupts. +If there is more than one such process, one of these is +selected, for practical purposes at random. +The process is either forced to exit +or a trap is simulated to an agreed-upon location +in the process. +See intr(II). + +The ASCII character FS is the quit____ signal. +Its treatment is identical to the interrupt signal +except that unless the receiving process has +made other arrangements it will not only be terminated +but a core image file will be generated. +See quit(II). +The character is not passed on except in raw mode. + +Output is prosaic compared to input. +When one or more +characters are written, they are actually transmitted +to the terminal as soon as previously-written characters +have finished typing. +Input characters are echoed by putting them in the output queue +as they arrive. +When a process produces characters more rapidly than they can be typed, +it will be suspended when its output queue exceeds some limit. +When the queue has drained down to some threshold +the program is resumed. +Even-parity is always generated on output. +The EOT character is not transmitted to prevent terminals +which respond to it from being hung up. +.sp +The system will handle IBM|2741 terminals. +See getty(VII) for the way that 2741s are detected. +In 2741 mode, +the hardware state +is: +134.5 baud; +one output stop bit; +and 7 bits/character. +Because the 2741 is inherently half-duplex, +input is not echoed. +Proper function delays are provided. +For 2741s without a feature known as "transmit interrupt" +it is not possible to collect input ahead of the time that +a program reads the typewriter, +because once the keyboard has been enabled there is no way +to send further output to the 2741. +It is currently +assumed that the feature is absent; +thus the keyboard is unlocked only when some program reads. +The interrupt signal (normally ASCII DEL) is simulated +when the 2741 "attention" key is pushed to generate either +a 2741 style EOT or a break. +It is not possible to generate anything corresponding to +the end-of-file EOT or the quit signal. +Currently IBM EBCDIC is default for input and output; +correspondence code output is settable (see stty(I)). +.tr || +The full ASCII character set is not available: +"[", "]", "{", "}", "~", are missing on input and are printed as blank on output; +"c|" is used for "\\"; +"_" for "^"; +" " for both "'" and"`"on output; +and " " maps into "'" on input. +.tr | +Similar mappings occur with correspondence code output. +.sp +.in 16 +.ti 0 +FILES /dev/tty[01234567ab] 113B dataphones +.br +/dev/ttyc display data set +.br +/dev/ttyd 113B with /dev/dn1 +.sp +.ti 0 +SEE ALSO kl(IV), getty(VII) +.sp +.ti 0 +BUGS The +primarily Model 37 oriented delays +may not be appropriate +for all other ASCII terminals. +.tr || diff --git a/man/man4/dn.4 b/man/man4/dn.4 new file mode 100644 index 0000000000..d6ee9f8bac --- /dev/null +++ b/man/man4/dn.4 @@ -0,0 +1,35 @@ +.pa 1 +.he 'DN (IV)'3/15/72'DN (IV)' +.ti 0 +NAME dn -- dn-11 ACU interface +.sp +.ti 0 +DESCRIPTION dn?___ +is a write-only file. +Bytes written on dn?___ must be +ASCII as follows: + + 0-9 dial 0-9 + : dial * + ; dial # + = end-of-number + +The entire telephone number must be +presented in a single write_____ system call. + +It is recommended that an end-of-number +code be given even though only one of the +ACU's (113C) actually requires it. +.sp +.ti 0 +FILES /dev/dn0 connected to 801 with dp0 +.br +/dev/dn1 connected to 113C with ttyd +.br +/dev/dn2 not currently connected +.sp +.ti 0 +SEE ALSO dp(IV), dc(IV), write(II) +.sp +.ti 0 +BUGS -- diff --git a/man/man4/dp.4 b/man/man4/dp.4 new file mode 100644 index 0000000000..f35898c750 --- /dev/null +++ b/man/man4/dp.4 @@ -0,0 +1,32 @@ +.pa 1 +.he 'DP (IV)'3/15/72'DP (IV)' +.ti 0 +NAME dp -- dp-11 201 data-phone interface +.sp +.ti 0 +DESCRIPTION dp?___ +is a 201 data-phone interface file. +read____ and write_____ calls to dp?___ +are limited to a maximum of 400 bytes. +Each write call is sent as a single record. +Seven bits from each byte +are written along with an eighth odd parity +bit. +The sync must be user supplied. +Each read call returns characters received from a +single record. +Seven bits are returned unaltered; the eighth bit +is set if the byte was not received in odd parity. +A 20 second time out is set and a zero byte +record is returned if nothing is received in that time. +.sp +.ti 0 +FILES /dev/dp0 201 dataphone used to call GCOS +.sp +.ti 0 +SEE ALSO dn(IV), gerts(III) +.sp +.ti 0 +BUGS The dp__ file is +GCOS oriented. +It should be more flexible. diff --git a/man/man4/kl.4 b/man/man4/kl.4 new file mode 100644 index 0000000000..1a7dd0656b --- /dev/null +++ b/man/man4/kl.4 @@ -0,0 +1,41 @@ +.pa 1 +.he 'KL (IV)'3/15/72'KL (IV)' +.ti 0 +NAME kl -- KL-11/TTY-33 console typewriter +.sp +.ti 0 +DESCRIPTION tty___ +(as distinct from tty?____) +refers to the console +typewriter hard-wired to the PDP-11 via a KL-11 interface. + +Generally, the disciplines involved in dealing with tty___ +are similar to those for tty?____ and section +dc(IV) should be consulted. +The following differences are salient: + +The system calls stty____ and gtty____ do not apply to this +device. +It cannot be placed in raw mode; on input, upper case letters +are always mapped into lower case letters; +a carriage return is echoed when a line-feed is typed. + +The quit character is not FS (as with tty?____) but +is generated by the key labelled "alt mode." + +By appropriate +console switch settings, it is possible to cause +UNIX to +come up as a single-user system +with I/O on this device. +.sp +.ti 0 +FILES /dev/tty +.br +/dev/tty8 synonym for /dev/tty +.sp +.ti 0 +SEE ALSO dc(IV), init(VII) +.sp +.ti 0 +BUGS -- diff --git a/man/man4/mem.4 b/man/man4/mem.4 new file mode 100644 index 0000000000..19425567ac --- /dev/null +++ b/man/man4/mem.4 @@ -0,0 +1,34 @@ +.pa 1 +.he 'MEM (IV)'3/15/72'MEM (IV)' +.ti 0 +NAME mem -- core memory +.sp +.ti 0 +DESCRIPTION mem___ +is a special file that is an image of the core memory +of the computer. +It may be used, for example, to examine, +and even to patch the system using the debugger. + +Mem___ is a byte-oriented file; its bytes are numbered +0 to 65,535. + +If a non-existent memory location is +referenced, the user +suffers the resultant bus error. + +Memory referenced through +the file is treated with movb____ instructions. +Certain device registers do not implement +DATOB cycles to odd addresses. +Other registers react strangely to this +addressing. +.sp +.ti 0 +FILES /dev/mem +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +BUGS -- diff --git a/man/man4/pc.4 b/man/man4/pc.4 new file mode 100644 index 0000000000..461788eadb --- /dev/null +++ b/man/man4/pc.4 @@ -0,0 +1,38 @@ +.pa 1 +.he 'PC (IV)'3/15/72'PC (IV)' +.ti 0 +NAME pc -- PC-11 paper tape reader/punch +.sp +.ti 0 +DESCRIPTION ppt___ +refers to the PC-11 paper tape reader or punch, +depending on whether it is read or written. + +When ppt___ is opened for writing, a 100-character leader +is punched. +Thereafter each byte written is punched on +the tape. No editing of the characters +is performed. +When the file is closed, a 100-character trailer is punched. + +When ppt___ is opened for reading, the process +waits until tape is placed in the reader and the reader +is on-line. +Then requests to read cause the characters read +to be passed back to the program, again without +any editing. +This means that several null leader characters +will usually appear at the beginning of the file. +Likewise several nulls are likely to appear at the end. +End-of-file is generated when the tape runs out. + +Seek calls for this file are meaningless. +.sp +.ti 0 +FILES /dev/ppt +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +BUGS -- diff --git a/man/man4/rf.4 b/man/man4/rf.4 new file mode 100644 index 0000000000..134889be2f --- /dev/null +++ b/man/man4/rf.4 @@ -0,0 +1,37 @@ +.pa 1 +.he 'RF (IV)'3/15/72'RF (IV)' +.ti 0 +NAME rf -- RF11-RS11 fixed-head disk file +.sp +.ti 0 +DESCRIPTION This file refers to the +concatenation of both RS-11 disks. +It may be either read or written, although writing is inherently +very dangerous, since +a file system resides there. + +The disk contains 2048 256-word blocks, +numbered 0 to 2047. +Like the other block-structured devices (TC, RK) +this file is addressed in blocks, not bytes. +This has two consequences: +seek____ calls refer to block numbers, not byte numbers; +and sequential reading or writing always advance the read +or write pointer by at least one block. +Thus successive reads of 10 characters from this file +actually read the first 10 characters from successive +blocks. +.sp +.ti 0 +FILES /dev/rf0 +.sp +.ti 0 +SEE ALSO tc(IV), rk(IV) +.sp +.ti 0 +BUGS The fact that this device +is addressed in terms of blocks, not bytes, is extremely +unfortunate. It is due entirely to the fact that +read and write pointers (and consequently the arguments +to seek____) are single-precision +numbers. diff --git a/man/man4/rk.4 b/man/man4/rk.4 new file mode 100644 index 0000000000..5943231dbf --- /dev/null +++ b/man/man4/rk.4 @@ -0,0 +1,28 @@ +.pa 1 +.he 'RK (IV)'3/15/72'RK (IV)' +.ti 0 +NAME rk -- RK-11/RK03 (or RK05) disk +.sp +.ti 0 +DESCRIPTION rk?___ +refers to an entire RK03 disk as a single sequentially-addressed +file. +Its 256-word blocks are numbered 0 to 4871. +Like the RF disk and the tape files, its +addressing is block-oriented. +Consult the rf(IV) section. +.sp +.ti 0 +FILES /dev/rk0 user available drive +.br +/dev/rk1 /usr file system +.br +/dev/rk2 /sys file system +.br +/dev/rk3 /crp file system +.sp +.ti 0 +SEE ALSO rf(IV), tc(IV) +.sp +.ti 0 +BUGS See rf(IV) diff --git a/man/man4/tc.4 b/man/man4/tc.4 new file mode 100644 index 0000000000..6576c60e0f --- /dev/null +++ b/man/man4/tc.4 @@ -0,0 +1,31 @@ +.pa 1 +.he 'TC (IV)'3/15/72'TC (IV)' +.ti 0 +NAME tc -- TC-11/TU56 DECtape +.sp +.ti 0 +DESCRIPTION The +files tap0 ... tap7 refer to the +TC-11/TU56 DECtape drives 0 to 7. +Since the logical drive number can be manually set, +all eight files exist even though at present there are fewer +physical drives. + +The 256-word blocks on a standard DECtape are numbered 0 to 577. +However, the system makes no assumption about this number; +a block can be read or written if it exists on the +tape and not otherwise. +An error is returned if a transaction +is attempted for a block which does not exist. + +Addressing on the tape files, like that on the +RK and RF disks, is block-oriented. +.sp +.ti 0 +FILES /dev/tap? +.sp +.ti 0 +SEE ALSO rf(IV), tap(I) +.sp +.ti 0 +BUGS see rf(IV) diff --git a/man/man4/tm.4 b/man/man4/tm.4 new file mode 100644 index 0000000000..470af7b9d7 --- /dev/null +++ b/man/man4/tm.4 @@ -0,0 +1,38 @@ +.pa 1 +.he 'TM (IV)'6/12/72'TM (IV)' +.ti 0 +NAME tm -- TM-11/TU-10 magtape interface +.sp +.ti 0 +DESCRIPTION mt?___ +is the DEC TU10/TM11 magtape. +When opened for reading or writing, +the magtape is rewound. +A tape consists of a +series of 512 byte records terminated by an +end-of-file. +Reading less than 512 bytes +causes the rest of a record to be ignored. +Writing less than a record causes +null padding to 512 bytes. +When the magtape is closed +after writing, +an end-of-file is written. +.sp +Seek has no effect on the magtape. +The magtape can only be opened once at +any instant. +.sp +.ti 0 +FILES /dev/mt0 selected drive 0 +.sp +.ti 0 +SEE ALSO mt(I) +.sp +.ti 0 +BUGS Seek +should work on the magtape. +Also, a provision of having the tape open for +reading and writing should exist. +A multi-file and multi-reel facility should +be incorporated. diff --git a/man/man4/vt.4 b/man/man4/vt.4 new file mode 100644 index 0000000000..a74d00c2c7 --- /dev/null +++ b/man/man4/vt.4 @@ -0,0 +1,230 @@ +.pa 1 +.he 'VT (IV)'2/11/73'VT (IV)' +.ti 0 +NAME vt -- 11/20 (vt01) interface +.sp +.ti 0 +DESCRIPTION +.br +.in 8 +The file vt0___ provides +the interface to a PDP 11/20 which +runs both a VT01A-controlled Tektronix 611 +storage display, +and a Federal Screw Works (Vocal Interface Division) +voice synthesizer. +The inter-computer interface is +a pair of DR-11C word interfaces. + +Although the display has essentially only two commands, +namely "erase screen" and "display point", the 11/20 program +will draw points, lines, and arcs, and print +text on the screen. +The 11/20 can also type information +on the attached 33 TTY and generate utterances via the +voice synthesizer. + +This special file operates in two basic modes, selected +by bit 2 (octal 04) on the 11/20's console switches. +If this bit is on at the opening of the file, +all bytes written on the file are interpreted as ASCII characters +and written on the screen. +The screen has 33 lines (1/2 a standard page). +The file simulates a 37 TTY: the control characters +NL, CR, BS, and TAB are interpreted correctly. +It also interprets the usual escape sequences +for forward and reverse half-line motion and for +full-line reverse. +Greek is not available yet. +Normally, when the screen is full (i.e. the 34th line is started) +the screen is erased before starting a new page. +To allow perusal of the displayed text, it is usual to +assert bit 0 of the console switches (octal 01). +As explained below, this causes the program to +pause before erasing until one of the attached pushbuttons +is depressed. + +If bit 2 of the switches is down, the display is in graphic +mode. +In this case bytes written on the file +are interpreted as display and vocal +commands. +Each command consists of a single byte usually followed +by parameter bytes. +Often the parameter bytes represent +points in the plotting area. +Each point coordinate consists of 2 bytes +interpreted as a 2's complement 16-bit number. +The plotting area itself measures (+_03777)X(+_03777) +(numbers in octal); +that is, 12 bits of precision. +Attempts to plot +points outside the screen limits are ignored. + +The graphic and sonic commands are: + +.in +5 +.ti -5 +order (1); 1 parameter byte +.br +The parameter indicates a subcommand, possibly followed +by subparameter bytes, as follows: +.in +5 + +.ti -5 +erase (1) +.br +The screen is erased. +This action may be delayed, as explained below, +until a pushbutton is depressed. + +.ti -5 +label (2); several subparameter bytes +.br +The following bytes up to a null character +are taken as a label and typed on the console TTY. +One of the console switches gives labels +a special interpretation, as explained below. + +.ti -5 +.nf +display label (3); several subparameter bytes +.fi +.br +The following bytes up to a null byte are printed +as ASCII text on the screen. +The origin of the text is the last previous point +plotted; or the upper left hand of the screen if there were none. + +.in -5 +.ti -5 +point (2); 4 parameter bytes +.br +The 4 parameter bytes are taken as a pair of coordinates +representing a point to be plotted. + +.ti -5 +line (3); 8 parameter bytes +.br +The parameter bytes are taken as 2 pairs of coordinates +representing the ends of a line segment which is plotted. +Only the portion lying within the screen is displayed. + +.ti -5 +frame (4); 1 parameter byte +.br +The parameter byte is taken as a number of sixtieths of a second; +an externally-available lead is asserted for that time. +Typically the lead is connected to +an automatic camera +which advances its film and opens the +shutter for the specified time. + +.ti -5 +circle (5); 6 parameter bytes +.br +The parameter bytes are taken as a coordinate pair representing +the origin, and a word representing the radius of a circle. +That portion of the circle which lies within the screen is plotted. + +.ti -5 +arc (6); 12 parameter bytes +.br +The first 4 parameter bytes are taken to be a coordinate-pair +representing the center of a circle. +The next 4 represent a coordinate-pair specifying a point +on this circle. +The last 4 should represent another point on the +circle. +An arc is drawn counter-clockwise from the first circle point +to the second. +If the two points are the same, the whole circle is drawn. +For the second point, only the smaller in magnitude +of its two coordinates is significant; +the other is used only to find the quadrant of the end of the arc. +In any event only points within the screen limits are +plotted. + +.ti -5 +dot-line (7); at least 6 parameter bytes +.br +The first 4 parameter bytes are taken +as a coordinate-pair representing the origin +of a dot-line. +The next byte is taken as a signed +x-increment. +The next byte is an unsigned word-count, +with "0" meaning "256". +The indicated +number of words is picked up. +For each bit in each word a point is plotted +which is visible if the bit is "1", invisible +if not. +High-order bits are plotted first. +Each successive point (or non-point) is offset +rightward by the given x-increment. + +.ti -5 +speak(8); several parameter bytes +.br +The following bytes up to a null byte are taken +to represent phonemes which are fed to +the voice synthesizer. +vsp(VII) gives the encoding. + +.in -5 +The 3 low-order console switches of the 11/20 +modify the operation of the display as follows. + +Bit 2 (octal 04) is examined at the time the display +file is opened (more precisely, when the first byte +is written after an open); as indicated, +when on__ it selects character mode, otherwise graphic +mode. + +Bit 1 (octal 02) +determines whether TTY labels are to be interpreted. +Unless this bit is on__, labels are ignored. +(except to terminate skip mode, see below). + +Bit 0 (octal 01) determines +whether the display will pause before erasing +the screen; +if off___ there will be no pause. +.a +If bit 0 is on__, the erase will occur +and displaying will resume only when one of the +16 pushbuttons is depressed. + +There is a box with 16 pushbuttons connected +to the 11/20. +Their state is at all times available in the 11/45 +by executing the csw___ system call (II). +They are used by the 11/20 when it is pausing +before an erase. +14 of the buttons merely serve to allow the display +to continue. +If, however, button 7 +is pushed, +the display will ignore commands up to the +next erase command, then ring the TTY console's bell, +thereby skipping an entire picture. + +If button 8 is depressed, +the display will ignore commands up to the next TTY label +(whether or not its typing is suppressed) before +resuming the displays. +Thus a sequence of frames may be skipped. +.sp +.in 16 +.ti 0 +FILES /dev/vt0 +.sp +.ti 0 +SEE ALSO csw(II), vsp(VII) +.sp +.ti 0 +BUGS Two +users using vt0 simultaneously +can interfere with each other, +e.g. plot phonemes or speak display coordinates. diff --git a/man/man5/a.out.5 b/man/man5/a.out.5 new file mode 100644 index 0000000000..15cc5e8ed9 --- /dev/null +++ b/man/man5/a.out.5 @@ -0,0 +1,150 @@ +.pa 1 +.he 'A.OUT (V)'3/15/72'A.OUT (V)' +.ti 0 +.nf +NAME a.out -- assembler and link editor output +.fi +.sp +.ti 0 +DESCRIPTION +.br +.in 8 +a.out_____ +is the output file of the assembler as__ and the link editor ld__. +In both cases, a.out_____ may be executed provided there +were no errors and no unresolved external references. +.sp +This file has four sections: +a header, the program and data text, a symbol table, and relocation bits +(in that order). +The last two may be empty +if the program was loaded +with the "-s" option +of ld__ or if the symbols and relocation have been +removed by strip_____. + +The header always contains 8 words: + +.in +6 +.ti -3 +1 A magic number (407(8)) +.ti -3 +2 The size of the program text segment +.ti -3 +3 The size of the initialized data segment +.ti -3 +4 The size of the uninitialized (bss) segment +.ti -3 +5 The size of the symbol table +.ti -3 +6 The entry location (always 0 at present) +.ti -3 +7 The stack size required (0 at present) +.ti -3 +8 A flag indicating relocation bits have been suppressed + +.in -6 +The sizes of each segment are in bytes but are even. +The size of the header is not included in any of the other sizes. + +When a file produced by the assembler or loader is +loaded into core for execution, three segments are +set up: the text segment, the data segment, +and the bss (uninitialized data) segment, +in that order. +The text segment begins at the lowest +location in the core image; the header is not loaded. +The data segment begins immediately after the text +segment, and the bss segment immediately after +the data segment. +The bss segment is initialized by 0's. +In the future the text segment will be write-protected +and shared. + +The start of the text segment in the file is 20(8); +the start of the data segment is 20+S9t8 (the size of the text) +the start of the relocation information is 20+S9t8+S9d8; +the start of the symbol table is 20+2(S9t8+S9d8) if the +relocation information is present, 20+S9t8+S9d8 if not. + +The symbol table consists of 6-word entries. The first +four contain the ASCII name of the symbol, null-padded. +The next word is a flag indicating the type of symbol. +The following values are possible: + + 00 undefined symbol + 01 absolute symbol + 02 text segment symbol + 03 data segment symbol + 04 bss segment symbol + 40 undefined external (.globl) symbol + 41 absolute external symbol + 42 text segment external symbol + 43 data segment external symbol + 44 bss segment external symbol + +Values other than those given above may +occur if the user has defined some of his own instructions. + +The last word of a symbol table entry contains the value of the symbol. + +If the symbol's type is undefined external, +and the value field is non-zero, +the symbol is interpreted by the loader ld__ as +the name of a common region +whose size is indicated by the value of the +symbol. + +The value of a word in the text or data portions which is not +a reference to an undefined external symbol +is exactly that value which will appear in core +when the file is executed. +If a word in the text or data portion +involves a reference to an undefined external symbol, +as indicated by the relocation bits +for that word, +then the value of the word as stored in the file +is an offset from the associated external symbol. +When the file is processed by the +link editor and the external symbol becomes +defined, the value of the symbol will +be added into the word in the file. + +If relocation +information is present, it amounts to one word per +word of program text or initialized data. +There is no relocation information if the "suppress relocation" +flag in the header is on. + +Bits 3-1 of a relocation word indicate the segment referred +to by the text or data word associated with the relocation +word: + +.in +6 +.ti -4 +00 indicates the reference is absolute +.ti -4 +02 indicates the reference is to the text segment +.ti -4 +04 indicates the reference is to the data segment +.ti -4 +06 indicates the reference is to the bss segment +.ti -4 +10 indicates the reference is to an undefined external symbol. + +.in -6 +Bit 0 of the relocation word indicates if on__ that the +reference is relative to the pc (e.g. "clr x"); +if off___, the reference is to the actual symbol (e.g., +"clr *$x"). + +The remainder of the relocation word (bits 15-4) +contains a symbol number in the case of external +references, and is unused otherwise. +The first symbol is numbered 0, the second 1, etc. +.sp +.in 16 +.ti 0 +SEE ALSO as__, +.ul +ld, strip, nm, un(I) diff --git a/man/man5/ar.5 b/man/man5/ar.5 new file mode 100644 index 0000000000..c5287fef15 --- /dev/null +++ b/man/man5/ar.5 @@ -0,0 +1,55 @@ +.pa 1 +.he 'ARCHIVE (V)'3/15/72'ARCHIVE (V)' +.ti 0 +NAME archive (library) file format +.sp +.ti 0 +DESCRIPTION The +archive command ar__ is used to combine several files into +one. +Archives are used mainly as libraries to be searched +by the link-editor ld__. + +A file produced by ar__ +has a "magic number" at the start, +followed by the constituent files, each preceded by a file header. +The magic number is +177555(8) +(it was chosen to be unlikely to occur anywhere else). +The header of each file is 16 bytes long: + +.in +5 +.ti -3 +0-7 +.br +file name, null padded on the right + +.ti -3 +8-11 +.br +Modification time of the file + +.ti -3 +12 +.br +User ID of file owner + +.ti -3 +13 +.br +file mode + +.ti -3 +14-15 +.br +file size + +.in -5 +If the file is an odd number of bytes long, it is padded +with a null byte, but the size in the header is correct. + +Notice there is no provision for empty areas in an archive +file. +.sp +.ti 0 +SEE ALSO ar__, ld__ diff --git a/man/man5/core.5 b/man/man5/core.5 new file mode 100644 index 0000000000..c65f8daef7 --- /dev/null +++ b/man/man5/core.5 @@ -0,0 +1,57 @@ +.pa 1 +.he 'CORE (V)'2/7/73'CORE (V)' +.ti 0 +NAME format of core image +.sp +.ti 0 +DESCRIPTION UNIX +writes out a core image of a terminated +process when any of various errors occur. +See wait____(II) for the list of reasons; +the most common are memory violations, illegal +instructions, bus errors, and user-generated +quit signals. + +The core image is called "core" and is written in the process's +working directory (provided it can be; normal +access controls apply). + +The size and structure of the core image file +depend to some extent on which system is involved. +In general there is a 512-byte area +at the end which contains the system's per-process +data for that process. +(64 bytes in older systems). The +remainder represents the actual contents of +the user's core area when the core image +was written. +In the current system, +this area is variable in size in that only the locations +from user 0 to the program break, plus the stack, are +dumped. + +When any fatal trap occurs, +all the useful registers are stored on the stack. +In the current system, which has relocation and protection +hardware, the stack used is the system +stack, which is kept in the per-process area; +in older systems, +there is only one stack, and it is located in the +user's core area. + +The actual format of the information is complicated +because it depends on what hardware is present (EAE, +floating-point option), +whether single- or double-precision +floating mode is in effect, +and also involves relocating addresses in the +system's address space. +A guru will have to be consulted +if enlightenment is required. + +In general the debugger +db(I) should +be used to deal with core images. + +.ti 0 +SEE ALSO db(I), wait(II) diff --git a/man/man5/dir.5 b/man/man5/dir.5 new file mode 100644 index 0000000000..c2c41e2a15 --- /dev/null +++ b/man/man5/dir.5 @@ -0,0 +1,34 @@ +.pa 1 +.he 'DIRECTORY (V)'3/15/72'DIRECTORY (V)' +.ti 0 +NAME format of directories +.sp +.ti 0 +DESCRIPTION A directory +behaves exactly like an ordinary file, save that no +user may write into a directory. +The fact that a file is a directory is indicated by +a bit in the flag word of its i-node entry. + +Directory entries are 10 bytes long. +The first word is the i-number of the file represented +by the entry, if non-zero; if zero, the entry is empty. + +Bytes 2-9 represent the (8-character) +file name, null padded on the right. +These bytes are not cleared for empty slots. + +By convention, the first two entries in each directory +are for "." and "..". The first is an entry for the +directory itself. The second is for the parent +directory. +The meaning of ".." is modified for the root directory +of the master file system and for the root directories of removable +file systems. +In the first case, there is no parent, and in the second, +the system does not permit off-device references. +Therefore in both cases ".." has the +same meaning as ".". +.sp +.ti 0 +SEE ALSO file system (V) diff --git a/man/man5/fs.5 b/man/man5/fs.5 new file mode 100644 index 0000000000..0d52b7115b --- /dev/null +++ b/man/man5/fs.5 @@ -0,0 +1,147 @@ +.pa 1 +.he 'FILE SYSTEM (V)'3/15/72'FILE SYSTEM (V)' +.ti 0 +NAME format of file system +.sp +.ti 0 +DESCRIPTION +.br +.in 8 +Every +file system storage volume +(e.g. RF disk, RK disk, DECtape reel) +has a common format for certain vital information. + +Every such volume is divided into a certain number +of 256 word (512 byte) blocks. Blocks 0 and 1 are +collectively known as the super_____-block_____ for the device; +they define its extent and contain an i-node map +and a free-storage map. +The first word +contains the number of bytes in the free-storage +map; it is always even. +It is followed by the map. +There is one bit for each block on the device; the bit is "1" +if the block is free. +Thus if the +number of free-map bytes is n_, the blocks on the device +are numbered 0 through 8n_-1. +The free-map count is followed by the free map +itself. +The bit for block k_ of the device +is in byte k_/8 of the map; it is offset k_(mod 8) bits from the right. +Notice that bits exist for the superblock and the i-list, +even though they are never allocated or freed. + +After the free map is a word containing the byte count +for the i-node map. It too is always even. +I-numbers below 41(10) are reserved +for special files, and are +never allocated; the first bit in the i-node +free map refers to i-number 41. +Therefore the byte number in the i-node map +for i-node i_ is (i_-41)/8. +It is offset (i_-41) (mod 8) bits from the right; unlike +the free map, a "0" bit indicates an available i-node. + +I-numbers begin at 1, and the storage for i-nodes +begins at block 2. +Also, i-nodes are 32 bytes long, so 16 of them fit into a block. +Therefore, i-node i_ is located in block (i_+31)/16 of +the file system, and begins 32\u.\d((i_+31)(mod 16)) bytes +from its start. + +There is always one file system which is always mounted; +in standard UNIX it resides on the RF disk. +This device is also used for swapping. +On the primary file system device, there are +several pieces of information following that previously +discussed. +There are two words with the calendar time +(measured since 00:00 Jan 1, 1972); +two words with the time spent executing in the system; +two words with the time spent waiting for I/O on the RF and RK +disks; two words with the time spent executing in a user's +core; one byte with the count of errors on the RF +disk; and one byte with the count of errors on the RK disk. +All the times are measured in sixtieths of a second. + +I-node 41(10) is reserved for the root directory of the +file system. +No i-numbers other than this one and those from +1 to 40 (which represent special files) have a built-in +meaning. +Each i-node represents one file. +The format of an i-node is as follows, where the +left column represents the offset from the beginning +of the i-node: +.sp +.nf +.in +3 +0-1 flags (see below) +2 number of links +3 user ID of owner +4-5 size in bytes +6-7 first indirect block or contents block +.li +... +20-21 eighth indirect block or contents block +22-25 creation time +26-29 modification time +30-31 unused +.fi +.sp +.ti -3 +The flags are as follows: +.sp +.nf +100000 i-node is allocated +040000 directory +020000 file has been modified (always on) +010000 large file +000040 set user ID on execution +000020 executable +000010 read, owner +000004 write, owner +000002 read, non-owner +000001 write, non-owner +.sp +.in -3 +.fi +The allocated bit (flag 100000) is believed even +if the i-node map says the i-node is free; +thus corruption of the map may cause i-nodes +to become unallocatable, but will not cause active +nodes to be reused. + +Byte number n_ of a file is accessed as follows: +n_ is divided by 512 to find its logical block number (say b_) +in the file. +If the file is small (flag 010000 is 0), +then b_ must be less than 8, and the physical block +number corresponding to b_ is the b_th entry +in the address portion of the i-node. + +Even if the file is large, b_ will be less than +128 (128*512 = 2^16). +The first number in the i-node address +portion +gives the physical block number of the indirect block. +b_ is doubled +to give a byte offset in the indirect block +and the word there found is the physical address of +the block corresponding to b_. + +For block b_ in a file to exist, it +is not necessary that all blocks less than b_ exist. +A zero block number either in the address words of +the i-node or in an indirect block indicates that the +corresponding block has never been allocated. +Such a missing block reads as if it contained all zero words. + +.in 16 +.ti 0 +BUGS Two blocks are not enough to handle +the i- and free-storage maps for an RP02 +disk pack, which contains around 10 million words. +.sp diff --git a/man/man5/passwd.5 b/man/man5/passwd.5 new file mode 100644 index 0000000000..23f55875d1 --- /dev/null +++ b/man/man5/passwd.5 @@ -0,0 +1,33 @@ +.pa 1 +.he 'PASSWD (V)'12/11/72'PASSWD (V)' +.ti 0 +NAME passwd -- password file +.sp +.ti 0 +DESCRIPTION passwd______ +contains for each user the +following information: + + name (login name, contains no upper case) + encrypted password + numerical user ID + GCOS job number and box number + initial working directory + program to use as Shell + +This is an ASCII file. Each field within each user's entry +is separated from the next by a colon. +The job and box numbers are separated by a comma. +Each user is separated from the next by a new-line. +If the password field is null, no password is demanded; +if the Shell field is null, the Shell itself +is used. + +This file resides in directory /etc. +Because of the encrypted +passwords, it can and does have general read +permission and can be used, for example, +to map numerical user ID's to names. +.sp +.ti 0 +SEE ALSO login(I), crypt(III), passwd(I) diff --git a/man/man5/tap.5 b/man/man5/tap.5 new file mode 100644 index 0000000000..2bc1171da6 --- /dev/null +++ b/man/man5/tap.5 @@ -0,0 +1,68 @@ +.pa 1 +.he 'TAP (V)'6/12/72'TAP (V)' +.ti 0 +NAME tap -- DEC/mag tape formats +.sp +.ti 0 +DESCRIPTION The +DECtape command tap___ and +the magtape command mt__ +dump and extract files to and +from their respective tape media. +The formats of these tapes are the same except +that magtapes have larger directories. +.sp +Block zero of the tape is not used. +It is available to contain a boot program to be +used in a stand-alone environment. +This has proved valuable for DEC diagnostic programs. +.sp +Blocks 1 through 24 +for DECtape (1 through 146 for magtape) +contain a directory of the tape. +There are 192 (resp. 1168) entries in the directory; +8 entries per block; +64 bytes per entry. +Each entry has the following format: +.sp +.in +3 +path name 32 bytes +.br +mode 1 byte +.br +uid 1 byte +.br +size 2 bytes +.br +time modified 4 bytes +.br +tape address 2 bytes +.br +unused 20 bytes +.br +check sum 2 bytes +.sp +.in -3 +The path name entry is the path name of the +file when put on the tape. +If the pathname starts with a zero word, +the entry is empty. +It is at most 32 bytes long and ends in a null byte. +Mode, uid, size and time modified +are the same as described under i-nodes (see file system (V)) +The tape address is the tape block number of the start of +the contents of the file. +Every file +starts on a block boundary. +The file occupies (size+511)/512 blocks +of continuous tape. +The checksum entry has a value such that +the sum of the 32 words of the directory entry is zero. +.sp +Blocks 25 (resp. 147) on are available for file storage. +.sp +A fake entry (see mt(I), tap(I)) +has a size of zero. +.sp +.ti 0 +SEE ALSO filesystem(V), mt(I), tap(I) diff --git a/man/man5/utmp.5 b/man/man5/utmp.5 new file mode 100644 index 0000000000..8b50684704 --- /dev/null +++ b/man/man5/utmp.5 @@ -0,0 +1,23 @@ +.pa 1 +.he 'UTMP (V)'3/15/72'UTMP (V)' +.ti 0 +NAME /tmp/utmp -- user information +.sp +.ti 0 +DESCRIPTION This +file allows one to discover information about who is currently +using UNIX. +The file is binary; each entry is 16(10) bytes long. +The first eight bytes contain a user's login name or +are null if the table slot is unused. +The low order byte of the next word contains the last +character of a typewriter name. +The next two words contain the user's login time. +The last word is unused. + +This file resides in directory /tmp. +.sp +.ti 0 +SEE ALSO /etc/init, which maintains the file; +.br +who(I), which interprets it. diff --git a/man/man5/wtmp.5 b/man/man5/wtmp.5 new file mode 100644 index 0000000000..5e840a6c48 --- /dev/null +++ b/man/man5/wtmp.5 @@ -0,0 +1,21 @@ +.pa 1 +.he 'WTMP (V)'3/15/72'WTMP (V)' +.ti 0 +NAME /tmp/wtmp -- user login history +.sp +.ti 0 +DESCRIPTION This +file records all logins and logouts. +Its format is exactly like utmp(V) except that +a null user name indicates a logout on the associated +typewriter, and the typewriter name 'x' indicates +that UNIX was rebooted at that point. + +Wtmp is maintained by login(I) and init(VII). +Neither of these programs creates the file, +so if it is removed record-keeping is turned off. + +This file resides in directory /tmp. +.sp +.ti 0 +SEE ALSO init(VII), login(I), acct(VIII), swtmp(VIII) diff --git a/man/man6/bc.6 b/man/man6/bc.6 new file mode 100644 index 0000000000..c0cdc8f674 --- /dev/null +++ b/man/man6/bc.6 @@ -0,0 +1,62 @@ +.pa 1 +.he 'BC (VI)'6/12/72'BC (VI)' +.ti 0 +NAME bc -- B interpreter +.sp +.ti 0 +SYNOPSIS bc__ [ -c__ ] sfile\d1\u.b__ ... ofile\d1\u ... +.sp +.ti 0 +DESCRIPTION bc__ +is the UNIX B interpreter. +It accepts three types of arguments: + +Arguments whose names end with ".b" are assumed to be +B source programs; they are compiled, and +the object program is left on the file sfile\d1\u.o (i.e. +the file whose name is that of the source with ".o" substituted +for ".b"). + +Other arguments (except for "-c") are assumed +to be either loader flag arguments, or B-compatible +object programs, typically produced by an earlier bc__ run, +or perhaps libraries of B-compatible routines. +These programs, together with the results of any +compilations specified, are loaded (in the order +given) to produce an executable program with name +a.out_____. + +The "-c" argument suppresses the loading phase, as does +any syntax error in any of the routines being compiled. +.sp +The language itself is described in [1]. +.sp +The future of B is uncertain. +The language has been totally eclipsed by the +newer, more powerful, more compact, and faster +language C. +.sp +.ti 0 +FILES file.b input file +.nf +a.out loaded output +b.tmp1 temporary (deleted) +b.tmp2 temporary (deleted) +/usr/lang/bdir/b[ca] translator +/usr/lang/bdir/brt[12] runtime initialization +/usr/lib/libb.a builtin functions, etc. +/usr/lang/bdir/bilib.a interpreter library +.fi +.sp +.ti 0 +SEE ALSO [1] K. Thompson; MM-72-1271-1; Users' Reference to B. +.br +cc(I) +.sp +.ti 0 +DIAGNOSTICS see [1]. +.sp +.ti 0 +BUGS Certain +external initializations are illegal. +(In particular: strings and addresses of externals.) diff --git a/man/man6/bj.6 b/man/man6/bj.6 new file mode 100644 index 0000000000..e10a5b1945 --- /dev/null +++ b/man/man6/bj.6 @@ -0,0 +1,84 @@ +.pa 1 +.he 'BJ (VI)'3/15/72'BJ (VI)' +.ti 0 +NAME bj -- the game of black jack +.sp +.ti 0 +SYNOPSIS /usr/games/bj +.sp +.ti 0 +DESCRIPTION +.br +.in 8 +bj__ +is a serious attempt at +simulating the dealer +in the game of black jack (or twenty-one) +as might be found in Reno. +The following rules apply: +.sp +.in +3 +The bet is $2 every hand. +.sp +A player 'natural' (black jack) pays $3. +A dealer natural loses $2. +Both dealer and player naturals +is a 'push' (no money exchange). +.sp +If the dealer has an ace up, +the player is allowed to make an 'insurance' +bet against the chance of a dealer natural. +If this bet is not taken, play resumes as normal. +If the bet is taken, it is a side bet +where the player wins $2 if the dealer has +a natural and loses $1 if the dealer does not. +.sp +If the player is dealt two cards +of the same value, he is allowed to +'double'. +He is allowed to play two +hands, each with one of these cards. +(The bet is doubled also; $2 on each hand.) +.sp +If a dealt hand +has a total of ten or eleven, +the player may 'double down'. +He may double the bet ($2 to $4) +and receive exactly one more card on that hand. +.sp +Under normal play, +the player may 'hit' (draw a card) +as long as his total is not over twenty-one. +If the player 'busts' (goes over twenty-one), +the dealer wins the bet. +.sp +When the player 'stands' (decides not to hit), +the dealer hits until he attains +a total of seventeen or more. +If the dealer busts, the player wins the bet. +.sp +If both player and dealer stand, +the one with the largest total wins. +A tie is a push. +.sp +.in -3 +The machine deals and keeps score. +The following questions will be asked at +appropriate times. +Each question is +answered by y_ followed by a new line for 'yes', +or just new line for 'no'. +.sp +? (means, "do you want a hit?") +.br +Insurance? +.br +Double down? +.sp +Every time the deck is shuffled, +the dealer so states and the 'action' (total bet) +and 'standing' (total won or loss) +is printed. +To exit, hit the interrupt key (DEL) +and the action and standing will be printed. +.in 16 diff --git a/man/man6/ptx.6 b/man/man6/ptx.6 new file mode 100644 index 0000000000..c79ba8b32e --- /dev/null +++ b/man/man6/ptx.6 @@ -0,0 +1,36 @@ +.pa 1 +.he 'PTX (VI)'3/15/72'PTX (VI)' +.ti 0 +NAME ptx -- permuted index +.sp +.ti 0 +SYNOPSIS ptx___ input output +.sp +.ti 0 +DESCRIPTION ptx___ +generates a permuted index from file input_____ on file output______. +It has three phases: the first does the permutation, generating +one line for each keyword in an input line. The +keyword is rotated to the front. +The permuted file is then +sorted. +Finally the sorted lines are rotated so the keyword +comes at the middle of the page. + +input_____ should be edited to remove useless lines. +The following words are suppressed: "a", "and", "as", +"is", "for", "of", "on", "or", "the", "to", "up". + +The index for this manual was generated using ptx___. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO sort(I) +.sp +.ti 0 +DIAGNOSTICS some +.sp +.ti 0 +BUGS -- diff --git a/man/man6/yacc.6 b/man/man6/yacc.6 new file mode 100644 index 0000000000..2abc64a6fa --- /dev/null +++ b/man/man6/yacc.6 @@ -0,0 +1,43 @@ +.pa 1 +.he 'YACC (VI)'1/20/73'YACC (VI)' +.ti 0 +NAME yacc -- yet another compiler compiler +.sp +.ti 0 +SYNOPSIS _____________/crp/scj/yacc [ |077 ? | +|100 @ |101 A |102 B |103 C |104 D |105 E |106 F |107 G | +|110 H |111 I |112 J |113 K |114 L |115 M |116 N |117 O | +|120 P |121 Q |122 R |123 S |124 T |125 U |126 V |127 W | +|130 X |131 Y |132 Z |133 [ |134 \\ |135 ] |136 ^ |137 _ | +|140 ` |141 a |142 b |143 c |144 d |145 e |146 f |147 g | +|150 h |151 i |152 j |153 k |154 l |155 m |156 n |157 o | +|160 p |161 q |162 r |163 s |164 t |165 u |166 v |167 w | +|170 x |171 y |172 z |173 { |174 | |175 } |176 ~ |177 del| + +.fi +.in +16 +.sp +.ti 0 +FILES found in /usr/pub diff --git a/man/man7/dpd.7 b/man/man7/dpd.7 new file mode 100644 index 0000000000..41a0f6fb2d --- /dev/null +++ b/man/man7/dpd.7 @@ -0,0 +1,75 @@ +.pa 1 +.he 'DPD (VII)'3/15/72'DPD (VII)' +.ti 0 +NAME dpd -- spawn data phone daemon +.sp +.ti 0 +SYNOPSIS /etc/dpd________ +.sp +.ti 0 +DESCRIPTION dpd___ +is the 201 data phone daemon. +It is designed to submit jobs to +the Honeywell 6070 computer via the gerts +interface. +.sp +dpd___ uses the directory /usr/dpd________. +The file lock____ in that directory is used +to prevent two daemons from becoming active. +After the daemon has successfully set the lock, +it forks and the main path exits, thus +spawning the daemon. +/usr/dpd________ is scanned for any file +beginning with df__. +Each such file is submitted as a job. +Each line of a job file must begin with a key +character to specify what to do with the remainder +of the line +.sp +.in +3 +S_ directs dpd to generate a unique snumb card. +This card is generated by incrementing the first +word of the file /usr/dpd/snumb______________ +and converting that to decimal concatenated with +the station ID. +.sp +L_ specifies that the remainder of the line is to +be sent as a literal. +.sp +B_ specifies that the rest of the line +is a file name. That file is to +be sent as binary cards. +.sp +F_ is the same as B_ except a form feed is prepended to the file. +.sp +U_ specifies that the rest of the line +is a file name. +After the job has been transmitted, +the file is unlinked. +.sp +.in -3 +Any error encountered will cause the daemon to +drop the call, wait up to 20 minutes and start over. +This means that an improperly constructed +df__ file may cause the same job to be submitted +every 20 minutes. +.sp +While waiting, the +daemon checks to +see that the lock____ file still exists. +If the lock____ is gone, the +daemon will exit. +.sp +.ti 0 +FILES /dev/dn0, +/dev/dp0, +/usr/dpd/* +.sp +.ti 0 +SEE ALSO opr(I) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man7/getty.7 b/man/man7/getty.7 new file mode 100644 index 0000000000..358aad5e86 --- /dev/null +++ b/man/man7/getty.7 @@ -0,0 +1,75 @@ +.pa 1 +.he '12/11/72''GETTY (VII)' +.tr | +.ti 0 +.nf +NAME getty -- set typewriter mode and get user's name +.fi +.sp +.ti 0 +SYNOPSIS /etc/getty +.sp +.ti 0 +DESCRIPTION +.br +.in 8 +getty_____ +is invoked +by init (VII) +immediately after a typewriter is opened +following a dial-in. +The user's login name is read and the login(I) command +is called with this name as an argument. +While reading this name getty_____ +attempts to adapt the system to the speed and type of terminal +being used. +.sp +getty_____ initially sets the speed of the interface to 150 baud, +specifies that raw mode is to be used (break on every character), +that echo is to be suppressed, and either parity +allowed. +It types the "login:" message +(which includes the characters which put the 37 Teletype +terminal into full-duplex and unlock its keyboard). +Then the user's name is read, a character at a time. +If a null character is received, it is assumed to be the result +of the user pushing the "break" ("interrupt") key. +The speed is then +changed to 300 baud and the "login:" is typed again, +this time with the appropriate +sequence which puts a GE TermiNet 300 into full-duplex. +This sequence is acceptable to other 300 baud terminals also. +If a subsequent null character is received, +the speed is changed again. +The general approach is to cycle through a set of speeds in +response to null characters caused by breaks. +The sequence at this installation is 150, 300, and 134.5 baud. +.sp +Detection of IBM|2741s is accomplished while the speed is +set to 150 baud. +The user sends a 2741 style "eot" +character by pushing the attention key or by typing return; +at 150 baud, this character looks like the ascii "~" (174988). +Upon receipt of the "eot", the system is set to operate 2741s +and a "login: " message is typed. + +The user's name is terminated by a new-line or +carriage-return character. +The latter results in the system being set to +to treat carriage returns appropriately (see stty(II)). + +The user's name is scanned to see if +it contains any lower-case alphabetic characters; if not, +and if the name is nonempty, the +system is told to map any future upper-case characters +into the corresponding lower-case characters. +Thus UNIX is usable from upper-case-only terminals. + +Finally, login is called with the user's name as argument. +.sp +.in 16 +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO init(VII), login(I), stty(II) diff --git a/man/man7/glob.7 b/man/man7/glob.7 new file mode 100644 index 0000000000..b158355726 --- /dev/null +++ b/man/man7/glob.7 @@ -0,0 +1,36 @@ +.pa 1 +.he 'GLOB (VII)'6/15/72'GLOB (VII)' +.ti 0 +NAME glob -- generate command arguments +.sp +.ti 0 +SYNOPSIS /etc/glob +.sp +.ti 0 +DESCRIPTION glob____ +is used to expand arguments to the shell containing "*", '[', or +"?". It is passed the argument list +containing the metacharacters; glob____ +expands the list and calls the command itself. +The actions of glob____ are detailed in +the Shell writeup. +.sp +.ti 0 +FILES found in /etc/glob +.sp +.ti 0 +SEE ALSO sh(I) +.sp +.ti 0 +DIAGNOSTICS "No match", "No command", "No directory" +.sp +.ti 0 +BUGS If any of +'*', '[', or '?' occurs both quoted and unquoted in the +original command line, +even the quoted metacharacters are expanded. + +glob____ gives the "No match" diagnostic only if +no arguments at all result. +This is never the case if there is any +argument without a metacharacter. diff --git a/man/man7/greek.7 b/man/man7/greek.7 new file mode 100644 index 0000000000..cd409018a0 --- /dev/null +++ b/man/man7/greek.7 @@ -0,0 +1,42 @@ +.pa 1 +.he 'GREEK (VII)'10/31/72'GREEK (VII)' +.ti 0 +NAME greek -- graphics for extended ascii type box +.sp +.ti 0 +SYNOPSIS cat___ /usr/pub/greek______________ +.sp +.ti 0 +DESCRIPTION greek_____ +gives the mapping +from ascii +to the "shift out" graphics in effect between SO and SI +on model 37 teletypes +with a 128-character type box. +It contains: + +.nf +alpha A A | beta B B | gamma \\ \\ +GAMMA G G | delta D D | DELTA W W +epsilon S S | zeta Q Q | eta N N +theta T T | THETA O O | lambda L L +LAMBDA E E | mu M M | nu @ @ +xi X X | pi J J | PI P P +rho K K | sigma Y Y | SIGMA R R +tau I I | phi U U | PHI F F +psi V V | PSI H H | omega C C +OMEGA Z Z | nabla [ [ | not _ _ +partial ] ] | integral ^ ^ | +.fi +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO ascii (VII) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man7/init.7 b/man/man7/init.7 new file mode 100644 index 0000000000..70c6f22126 --- /dev/null +++ b/man/man7/init.7 @@ -0,0 +1,75 @@ +.pa 1 +.he 'INIT (VII)'6/15/72'INIT (VII)' +.ti 0 +NAME init -- process control initialization +.sp +.ti 0 +SYNOPSIS /etc/init +.sp +.ti 0 +DESCRIPTION +.in 8 +init____ +is invoked inside UNIX as the last step in the boot procedure. +Generally its role is to create a process for each +typewriter on which a user may log in. + +First, init____ checks +to see if the console switches contain 173030. +(This number is likely to vary between +systems.) +If so, the console typewriter tty___ is opened for reading +and writing and the shell is invoked immediately. +This feature is used to bring up a test system, or one +which does not contain DC-11 communications interfaces. +When the system is brought up in this way, the getty_____ +and login_____ routines mentioned below and described elsewhere are not needed. + +Otherwise, init____ does some housekeeping: the mode of +each DECtape file is changed to 17 (in case the system +crashed during a tap___ command); +directory /usr is mounted +on the RK0 disk; +directory /sys is mounted on the RK1 disk. +Also a data-phone daemon +is spawned to restart any jobs being sent. + +Then init____ forks several times to create a process +for each typewriter mentioned in an internal table. +Each of these processes opens the appropriate typewriter +for reading and writing. These channels thus +receive file descriptors 0 and 1, the standard input and +output. +Opening the typewriter will usually involve a delay, +since the open____ is not completed until someone +is dialled in (and carrier established) on the channel. +Then the process executes the program /etc___/getty_____ +(q.v.). +getty_____ will read the user's name and invoke login_____ (q.v.) +to log in the user and execute the shell. + +Ultimately the shell will terminate +because of an end-of-file either +typed explicitly or generated as a result of hanging up. +The main path of init____, which has been waiting +for such an event, +wakes up and removes the appropriate entry from the +file utmp____, which records current users, and +makes an entry in wtmp____, which maintains a history +of logins and logouts. +Then the appropriate typewriter is reopened and getty_____ +reinvoked. +.sp +.in 16 +.ti 0 +FILES /dev/tap?, +/dev/tty, /dev/tty?, /tmp/utmp, /tmp/wtmp +.sp +.ti 0 +SEE ALSO login(I), login(VII), getty(VII), sh(I), dpd(VII) +.sp +.ti 0 +DIAGNOSTICS none possible +.sp +.ti 0 +BUGS none possible diff --git a/man/man7/msh.7 b/man/man7/msh.7 new file mode 100644 index 0000000000..bbf39109bc --- /dev/null +++ b/man/man7/msh.7 @@ -0,0 +1,34 @@ +.pa 1 +.he 'MSH (VII)'6/15/72'MSH (VII)' +.ti 0 +NAME msh -- mini-shell +.sp +.ti 0 +SYNOPSIS /etc/msh +.sp +.ti 0 +DESCRIPTION msh___ +is a heavily simplified version of the Shell. +It reads one line from the standard +input file, interprets it as a command, and calls the command. + +The mini-shell supports few of the advanced features +of the Shell; none of the following characters is special: + + > < $ \\ ; & + +However, "*", "[", and "?" are recognized and glob____ is called. +The main use of msh___ is to provide a command-executing +facility for various interactive sub-systems. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO sh(I), glob(VII) +.sp +.ti 0 +DIAGNOSTICS "?" +.sp +.ti 0 +BUGS -- diff --git a/man/man7/tabs.7 b/man/man7/tabs.7 new file mode 100644 index 0000000000..df3985739d --- /dev/null +++ b/man/man7/tabs.7 @@ -0,0 +1,30 @@ +.pa 1 +.he 'TABS (VII)'6/15/72'TABS (VII)' +.ti 0 +NAME tabs -- set tab stops +.sp +.ti 0 +SYNOPSIS cat /usr/pub/tabs +.sp +.ti 0 +DESCRIPTION When +printed on a suitable terminal, this file +will set tab stops every 8 columns. +Suitable terminals include the Teletype model 37 and +the GE TermiNet 300. +.sp +These tab stop settings are +desirable because UNIX assumes them +in calculating delays. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man7/vsp.7 b/man/man7/vsp.7 new file mode 100644 index 0000000000..57315f4b78 --- /dev/null +++ b/man/man7/vsp.7 @@ -0,0 +1,61 @@ +.pa 1 +.he 'VSP (VII)'2/2/73'VSP (VII)' +.ti 0 +NAME vsp -- voice synthesizer code +.sp +.ti 0 +SYNOPSIS cat /usr/pub/vsp +.sp +.ti 0 +DESCRIPTION vsp___ +contains a list of phonemes understood by the voice +synthesizer on device vt__. +Phonemes are usually written in the form + +.ce +comma inflection phoneme +.sp +The inflection and the phoneme codes are or-ed together. +The phoneme codes are as follows (numbers in octal). + +.nf +.in 6 +0 = 300 strong inflection p = 32 p_enny p_ound +1 = 200 a0 = 33 co_ntact ca_r +2 = 100 a1 = 52 co_nnect +3 = 000 weak inflection ai = 37 na_me ca_me + aj = 71 na_mely +aw = 02 aw__ful law__ s = 40 s_even s_ix +ie = 03 zer__o d = 41 d_o d_iet +e0 = 04 e_nter me_t f = 42 f_our f_ive +e1 = 76 se_ven g = 43 g_et g_rand +e2 = 77 seve_n h = 44 h_ello h_ow +er = 05 weather__ j = 45 j_udge edg_e +th = 06 th__ree th__ick k = 46 c_ame lock_ +dh = 07 th__is th__en l = 47 hell__o l_ight +yu = 27 u_se you_ oo = 50 loo__k boo__k +iu = 10 u_nite ou = 51 goo__d shou__d +ju = 11 ne_w yo_u ng = 53 ring__ ang__le +o0 = 31 o_nly no_ z = 55 z_ero haz_y +o1 = 12 hello_ sh = 56 sh__ow sh__ip +o2 = 13 no_tice ch = 57 ch__air ch__ime +u0 = 14 bu_t mu_st v = 60 sev_en ev_en +u1 = 15 u_ncle b = 61 b_all b_ed +u2 = 16 stirru_p n = 62 n_in_e seven_ +u3 = 34 app_le ab_le m = 63 m_ile m_en +ae = 21 ca_t sa_t iy = 66 lie__ +ea = 20 a_ntenna zh = 70 az_ure pleas_ure +w = 22 w_on w_ish ih = 72 statio__n conditio__n +ee = 23 three__ ay = 36 may_ lay_ +r = 24 r_adio r_adar_ +t = 25 t_wo t_ime -0 = 35 long space +ey = 26 sixty_ eighty_ -1 = 17 +i0 = 30 si_x mi_x -2 = 01 +i1 = 64 i_nept i_nside -3 = 74 short delay +i2 = 65 crypti_c stati_c +.in 16 +.fi + +.sp +.ti 0 +SEE ALSO speak(I), vt(IV) diff --git a/man/man8/20boot.8 b/man/man8/20boot.8 new file mode 100644 index 0000000000..893cb16792 --- /dev/null +++ b/man/man8/20boot.8 @@ -0,0 +1,31 @@ +.pa 1 +.he '20BOOT (VIII)'1/25/73'20BOOT (VIII)' +.ti 0 +NAME 20boot -- install new 11/20 system +.sp +.ti 0 +SYNOPSIS 20boot______ [ x_ ] +.sp +.ti 0 +DESCRIPTION This +shell command file copies the current version +of the 11/20 program used to run the VT01 display +onto the /dev/vt0 file. + +If no argument is given, the 11/20 program should be executing +but idle; the 11/20 program is sent preceded by a +"reboot" command. +If an argument is given, the 11/20 should +have been restarted at its ROM location +777300. +.sp +.ti 0 +FILES /dev/vt0; +.br +/sys/mdec/20.o (11/20 program) +.sp +.ti 0 +SEE ALSO vt0 (IV) +.sp +.ti 0 +DIAGNOSTICS -- diff --git a/man/man8/acct.8 b/man/man8/acct.8 new file mode 100644 index 0000000000..fe5bebbcd5 --- /dev/null +++ b/man/man8/acct.8 @@ -0,0 +1,37 @@ +.pa 1 +.he 'ACCT (VIII)'1/20/73'ACCT (VIII)' +.ti 0 +NAME acct -- login accounting +.sp +.ti 0 +SYNOPSIS acct____ [ -w__ wtmp ] [ -p__ ] [ -d__ ] people +.sp +.ti 0 +DESCRIPTION acct____ +produces a printout giving +connect time +for each user who has logged in +during the life of the current wtmp____ file. +A total is also produced. +-w__ is used to specify an alternate wtmp file. +-p__ prints individual totals; without this option, +only totals are printed. +-d__ causes a printout for each midnight to midnight +period. +The people______ argument will limit the +printout to only the specified login names. +If no wtmp file is given, +/usr/adm/wtmp_____________ +is used. +.sp +.ti 0 +FILES /usr/adm/wtmp +.sp +.ti 0 +SEE ALSO init(VII), login(I), wtmp(V). +.sp +.ti 0 +DIAGNOSTICS "Cannot open 'wtmp'" if argument is unreadable. +.sp +.ti 0 +BUGS -- diff --git a/man/man8/bproc.8 b/man/man8/bproc.8 new file mode 100644 index 0000000000..fd4f5a778c --- /dev/null +++ b/man/man8/bproc.8 @@ -0,0 +1,235 @@ +.pa 1 +.he 'BOOT PROCEDURES (VIII)'2/6/73'BOOT PROCEDURES (VIII)' +.ti 0 +NAME bos, maki, vcboot, msys, et__ al__. +.sp +.ti 0 +DESCRIPTION +.br +.in 8 +On +the RF disk, the highest 16K words are +reserved for stand-alone programs. +These 16K words are allocated as follows: +.sp +bos (1K) +.br +Warm UNIX (7K) +.br +Cold UNIX (8K) +.sp +The program bos___ (Bootstrap Operating System) +examines the console switches and executes +one of several internal programs depending on the setting. +The following settings are currently recognized: +.sp +.in +8 +.ti -8 +??? Will read Warm UNIX from +the RF into core location 0 and transfer to 600. +.sp +.ti -8 +1 Will read Cold UNIX from the +RF into core location 0 and transfer to 600. +.sp +.ti -8 +10 Will dump all of memory +from core location 0 onto DECtape drive 7 +and then halt. +.sp +.ti -8 +20 Will read 256 words from RK0 into +core 0 and transfer to zero. +This is the procedure to boot +DOS from an RK. +.sp +.ti -8 +40 This is the same as 10 above, but +instead of halting, UNIX warm is loaded. +.sp +.ti -8 +0 Will load a standard UNIX binary paper tape +into core location 0 and transfer to 0. +.sp +.ti -8 +77500 Will load the standard DEC absolute and binary +loaders and transfer to 77500. +.sp +.in 8 +All manual methods of booting the system involve +manipulation of the console switches. +In order for this to be possible, +the panel must be unlocked +and the machine must be halted. +Also, remember that at the time UNIX comes up, +the console switches must contain 773030 +for a single-user system; anything else gives +a multi-user system. + +There are four temperatures of boots. +They are: + +.in +4 +Hot boot: restart the system without refreshing +its code, that is simply by transferring to +its start. +The only use for this procedure is if the +system has been patched and one doesn't wish +to redo the patches. +The procedure is: + + 600 in switches + Load address + (773030 in switches for single-user system) + start + +Warm boot: refresh system code from the RF disk, but +the "panic" routine must be in core. +Best for general use if it works, since +outstanding I/O +is cleaned up. +Procedure: + + 602 in switches + load address + (773030 in switches for single-user system) + start (flushes any I/O, then executes bos___) + +Cool boot: RF disk is OK, but nothing in core. +Procedure: + + UTIL DECtape on drive 0 + 773030 in switches + load address + (602 in switches for multi-user system) + start + type "boot" on console tty to load bos___ + +Cold boot: nothing in core, nothing on RF. +Best to have an expert around for this +one. +Procedure: + + INIT DECtape on drive 0 + 773030 in switches + load address + 1 in switches + start + (machine halts. last chance to preserve RF!) + 773030 in switches + continue + (reads in basic files) + +UNIX is then up, but for various reasons, one should +do a warm boot (single user) right away. +At this point also, one might +consider whether the INIT tape UNIX is the +latest version. +If there is reason for doubt, +mount the /sys disk pack, change to directory +/sys/sys, do "msys u unix", and reboot. +Then get the /bin-/etc-/lib tape which contains +the rest of of the RF disk, +and do an "mt x". +Conceivably, "create errors" due to lack of some +directories will occur; make the directories, +then try again. +Set the date correctly; the system starts off +at time 0. + +At this point UNIX is in full operation and +can be rebooted for +a multi-user system. +.sp +.in 8 +Here is what happens during a cold boot: +the INIT tape contains a program called +.ul +vcboot. +The ROM program reads vcboot +from the tape into +core location 0 and transfers to it. +vcboot then reads 16K words from +the DECtape (blocks 1-32) +and copies the data to the highest 16K words of +the RF. +Thus this initializes the read-only part of the RF. +vcboot then reads in bos___ and executes it. +bos___ reads in Cold UNIX and executes that. +Cold UNIX halts for a last chance before +it completely initializes the RF file system. +When continue is pressed, +Cold UNIX initializes the RF. +It then reads the DECtape for initialization files +starting from block 33. +Normal operation then commences +with the execution of "/etc/init". +.sp +The INIT tape is made by the program maki____ +running under UNIX. +maki____ writes vcboot______ on block 0 of +.ul +/dev/tap7. +It then copies the RF 16K words (using +.ul +/dev/rf0) +onto blocks 1 thru 32. +It has internally a list of files to +be copied from block 33 on. +This list follows: +.sp +.nf +.in +8 +/etc/init +/bin/chmod +/bin/date +/bin/login +/bin/ls +/bin/mkdir +/etc/mount +/bin/sh +/bin/tap +/bin/mt +.in -8 +.fi +.sp +Thus this is the set of programs available after a cold boot. +init____ and sh__ are mandatory. +For multi-user UNIX, +getty_____ and login_____ are also necessary. +mkdir_____ is necessary due to a bug in tap___. +mt__, tap___ and mount_____ are useful to +bring in new files. +As soon as possible, date____ should be done. +That leaves ls__ and chmod_____ as frosting. +.sp +The last link in this incestuous +daisy chain is the program msys____. +.sp + msys____ char file +.sp +will copy the file file____ onto the +RF read only slot specified by the character char____. +Char is taken from the following set: +.sp + b_ bos + u_ Warm UNIX + 1_ Cold UNIX +.sp +.in 16 +.ti 0 +FILES /dev/rf0, +/dev/tap? +.sp +.ti 0 +SEE ALSO init(VII), +tap(I), +sh(I), +mkdir(I) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS This +section is very configuration dependent. diff --git a/man/man8/check.8 b/man/man8/check.8 new file mode 100644 index 0000000000..9f6e030bda --- /dev/null +++ b/man/man8/check.8 @@ -0,0 +1,50 @@ +.pa 1 +.he 'CHECK (VIII)'1/20/73'CHECK (VIII)' +.ti 0 +NAME check -- file system consistency check +.sp +.ti 0 +SYNOPSIS check_____ [ filesystem [ blockno918 ... ] ] +.sp +.ti 0 +DESCRIPTION check_____ +will examine a file system, +build a bit map of used blocks, +and compare this bit map against +the bit map maintained on the file system. +If the file system is not specified, +a check of all +of the normally mounted file systems +is performed. +Output includes the number of files on the file system, +the number of these that are 'large', the number +of indirect blocks, +the number +of used blocks, and the number of free blocks. +.sp +check_____ works by examining the i-nodes +on the file system and is entirely +independent of its directory hierarchy. +The file system may be, +but need not be, mounted. + +.ti 0 +FILES /dev/rf?, +/dev/rk?, +/dev/rp? +.sp +.ti 0 +SEE ALSO find(I), ds(I) +.sp +.ti 0 +DIAGNOSTICS Diagnostics are produced for +blocks missing, duplicated, and bad block addresses. +Diagnostics are also produced for block numbers passed as parameters. +In each case, the block number, i-number, and +block class (i_ = inode, x_ indirect, f_ free) is printed. +.sp +.ti 0 +BUGS The +checking process is two pass in nature. +If checking is done on an active file system, +extraneous diagnostics may occur. diff --git a/man/man8/chk.8 b/man/man8/chk.8 new file mode 100644 index 0000000000..54114b62d8 --- /dev/null +++ b/man/man8/chk.8 @@ -0,0 +1,21 @@ +.pa 1 +.he 'CHK (VIII)'1/20/73'CHK (VIII)' +.ti 0 +NAME chk -- check + dcheck +.sp +.ti 0 +SYNOPSIS chk +.sp +.ti 0 +DESCRIPTION This +command file does a check_____ and a dcheck______ of all of the normally mounted +file systems. +.sp +.ti 0 +FILES /dev/[fkp]* +.sp +.ti 0 +SEE ALSO check (VIII), dcheck (VIII) +.sp +.ti 0 +DIAGNOSTICS see "SEE ALSO" diff --git a/man/man8/clri.8 b/man/man8/clri.8 new file mode 100644 index 0000000000..68ec27af68 --- /dev/null +++ b/man/man8/clri.8 @@ -0,0 +1,41 @@ +.pa 1 +.he 'CLRI (VIII)'1/20/73'CLRI (VIII)' +.ti 0 +NAME clri -- clear i-node +.sp +.ti 0 +SYNOPSIS clri i-number [ file system ] +.sp +.ti 0 +DESCRIPTION clri____ +writes zeros on the 32 bytes occupied by the i-node +numbered +.ul +i-number. +If the +.ul +file system +argument is given, the i-node resides on +the given device, otherwise on a +default file system. +The file system argument +must be a special file +name referring to a device +containing a file system. + +After clri____, any blocks +in the affected file +will show up as "missing" in a check_____ of +the file system. + +Read and write permission is required on the specified +file system device. +The i-node becomes allocatable. + +The primary purpose of this routine +is to remove a file which +for some reason appears in no +directory. +.sp +.ti 0 +DIAGNOSTICS "error" diff --git a/man/man8/dcheck.8 b/man/man8/dcheck.8 new file mode 100644 index 0000000000..9f9d8eec89 --- /dev/null +++ b/man/man8/dcheck.8 @@ -0,0 +1,44 @@ +.pa 1 +.he 'DCHECK (VIII)'1/20/73'DCHECK (VIII)' +.ti 0 +NAME dcheck -- directory consistency check +.sp +.ti 0 +SYNOPSIS dcheck______ [ -l__ ] [ device ] +.sp +.ti 0 +DESCRIPTION dcheck______ +builds an image of the directory hierarchy +of the specified device +by reading all its directories (using physical I/O +guided by the i-nodes on the device). +A list entry is made for +each file encountered. +A second pass reads the i-nodes and for +each file compares the number of links +specified in its i-node +with the number of entries actually seen. +All discrepancies are noted. +.sp +If no device is specified, +a default device is assumed. +.sp +The argument -l__ causes a complete +listing of the file names on the device +in i-node order. +.sp +.ti 0 +FILES /dev/rk? +.sp +.ti 0 +SEE ALSO check(VIII) +.sp +.ti 0 +DIAGNOSTICS inconsistent i-numbers, +unnamed files, +unreachable files, +loops in directory "hierarchy". +.sp +.ti 0 +BUGS Unreachable files and loops are +discovered only under the "-l" option. diff --git a/man/man8/dli.8 b/man/man8/dli.8 new file mode 100644 index 0000000000..b63e9af0c9 --- /dev/null +++ b/man/man8/dli.8 @@ -0,0 +1,27 @@ +.pa 1 +.he 'DLI (VIII)'3/15/72'DLI (VIII)' +.ti 0 +NAME dli -- load DEC binary paper tapes +.sp +.ti 0 +SYNOPSIS dli output [input] +.sp +.ti 0 +DESCRIPTION dli___ +will load a DEC binary paper tape +into the output file. +The binary format paper tape +is read from the input file +(/dev/ppt is default.) +.sp +.ti 0 +FILES /dev/ppt +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS "checksum" +.sp +.ti 0 +BUGS -- diff --git a/man/man8/istat.8 b/man/man8/istat.8 new file mode 100644 index 0000000000..d44f3133d7 --- /dev/null +++ b/man/man8/istat.8 @@ -0,0 +1,35 @@ +.pa 1 +.he 'ISTAT (VIII)'1/20/73'ISTAT (VIII)' +.ti 0 +NAME istat -- get inode status +.sp +.ti 0 +SYNOPSIS istat_____ [ filesystem ] inumber\d1\u ... +.sp +.ti 0 +DESCRIPTION istat_____ +gives information about one or more i-nodes +on the given file system or on /dev/rk0 if no file system +is given. +.sp +The information is in exactly the same form +as that for stat(I), +except that mode letter "a" is +used to indicate that the i-node is allocated, +"u" that it is unallocated. +.sp +.ti 0 +FILES /etc/uids, +/dev/rk0 +.sp +.ti 0 +SEE ALSO stat(I), ls(I) (-l option) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS istat_____ +ignores any read error +and pretends to give status even if the file system +is not physically present. diff --git a/man/man8/kill.8 b/man/man8/kill.8 new file mode 100644 index 0000000000..0c6db3ff47 --- /dev/null +++ b/man/man8/kill.8 @@ -0,0 +1,36 @@ +.pa 1 +.he 'KILL (VIII)'1/20/73'KILL (VIII)' +.ti 0 +NAME kill -- terminate process with extreme prejudice +.sp +.ti 0 +SYNOPSIS /usr/adm/kill_____________ processnumber +.sp +.ti 0 +DESCRIPTION After ps__ +(q.v.) has given you the unique ID of a process, you can terminate +it by this command. +A core image is produced in the process's working directory. + +Only the super-user can exercise this privilege. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO ps (VIII) +.sp +.ti 0 +DIAGNOSTICS yes +.sp +.ti 0 +BUGS If the process +has executed sys nice (II) +and there is another process which has not, but +which loops, +the first process cannot be done in properly, +since it has to be swapped in so as cooperate +in its own murder. + +It would also be nice if ordinary people could +kill their own processes. diff --git a/man/man8/mount.8 b/man/man8/mount.8 new file mode 100644 index 0000000000..278fe3af45 --- /dev/null +++ b/man/man8/mount.8 @@ -0,0 +1,31 @@ +.pa 1 +.he 'MOUNT (VIII)'1/20/73'MOUNT (VIII)' +.ti 0 +NAME mount -- mount file system +.sp +.ti 0 +SYNOPSIS /etc/mount__________ special file +.sp +.ti 0 +DESCRIPTION mount_____ +announces to the system that a removable file system +is present on the device corresponding to special +file special_______ (which must refer to a disk or possibly DECtape). +The file____ must exist already; it +becomes the name of the root of the newly mounted +file system. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO umount(VIII) +.sp +.ti 0 +DIAGNOSTICS "?", +if the special file is already in use, cannot be read, +or if file____ does not exist. +.sp +.ti 0 +BUGS Should be usable only by the super-user. +Mounting file systems full of garbage can crash the system. diff --git a/man/man8/ps.8 b/man/man8/ps.8 new file mode 100644 index 0000000000..fcab9ac7f7 --- /dev/null +++ b/man/man8/ps.8 @@ -0,0 +1,77 @@ +.pa 1 +.he 'PS (VIII)'1/20/73'PS (VIII)' +.ti 0 +NAME ps -- process status +.sp +.ti 0 +SYNOPSIS /usr/adm/ps [ -xlt____ ] +.sp +.ti 0 +DESCRIPTION +.br +.in 8 +ps__ +prints certain facts about active +processes. +The information is columnar and consists of: + +.in +3 +The (numerical) ID of the user associated +with the process; + +The last character of the control typewriter of the process +or "x" if there is no control typewriter; +"x" lines are suppressed unless the "x" option +is given. + +The number of 512-byte disk blocks holding the core +image of the process; + +The process's unique ID (only with "l" option) + +The number of hours (mod 100) and minutes of system, disk, and +user-process time accumulated by the process and +all its terminated descendants (only with "t" option) + +An educated guess as to the command line which caused the +process to be created. + +.in -3 +Some caveats: + +The guess as to the command name and arguments is obtained by examining +the process's stack. +The process is entitled to destroy this information. +Also, only processes whose core images are on disk have +visible names. +The ps__ command in particular +does not, nor does any other process which happens to +be in core at the same time. +ps__ tries to overcome this limitation by spawning +a subprocess designed to take up the other core +slot, and is usually successful. +Because ps__ examines a dynamically changing data structure, +it can produce incorrect results, for example if +a process's core image moves between the time +ps__ gets its disk address and reads its stack. + +Besides its utility for simple spying, +ps__ is the only plausible +way to find the process number of someone you are trying +to kill (VIII). +.sp +.in 16 +.ti 0 +FILES /dev/rf0, +/sys/sys/unix (to get magic numbers). +.sp +.ti 0 +SEE ALSO kill (VIII) +.sp +.ti 0 +DIAGNOSTICS "Bad RF", if +a bad swap address turns up; +various missing-file diagnostics. +.sp +.ti 0 +BUGS As described. diff --git a/man/man8/salv.8 b/man/man8/salv.8 new file mode 100644 index 0000000000..cf9d808f43 --- /dev/null +++ b/man/man8/salv.8 @@ -0,0 +1,86 @@ +.pa 1 +.he 'SALV (VIII)'1/20/73'SALV (VIII)' +.ti 0 +NAME salv -- file system salvage +.sp +.ti 0 +SYNOPSIS /etc/salv_________ filesystem [ -akfs_____ ] +.sp +.ti 0 +DESCRIPTION +.br +.in 8 +salv____ +will place a given file system +in a consistent state with +almost no loss of information. +This is the first step in putting things +together after a bad crash. +Salv performs the following functions: +.sp +.in +3 +A valid free list is constructed. + +.in -3 +The previous step is always performed; the following steps +are performed only if the "a" option is given. +If the file system's only defect is missing blocks, +"a" should not be specified. +.in +3 +.sp +All bad pointers in the file system are zeroed. +.sp +All duplicate pointers to the same block +are resolved by changing one of the pointers +to point at a new block containing a copy of the data. +.sp +Inodes (not directory entries) for special files +are generated (mode 16). + +Files whose size is too large for the number of +blocks they contain (after bad pointers are zeroed) +have their size revised downward. + +.in -3 +The file system should be unmounted while it is +being salvaged. +In cases of extreme need the permanently mounted +file system may be salvaged; in such a case +the system must be rebooted before it +has a chance to write out the old, bad super-block. + +The "k", "f", and "s" options +tell salv what magic numbers to use to generate +the size of the free list and the i-node map. +"k" is default (RK disk); "f" is RF; "s" is RK with +swap space on it. +If salv is to be used away +from the mother system its code should be cheked +to verify the numbers. +.sp +After a salv, files may be safely created +and removed without causing +more trouble. +If the "a" option had to be used, +a dcheck (VIII) should be done to find the degree +of the damage to the hierarchy. +.sp +.in 16 +.ti 0 +FILES /dev/rk0 +.sp +.ti 0 +SEE ALSO check(I), ds(I) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS In +only one (known) way does salv____ destroy information: +if some random block appears to be an indirect block +for a file, +all "bad pointers" (for example, ASCII text) in it +will be zeroed. If +the block also appears in another file, it may be +scribbled on before it is copied. diff --git a/man/man8/su.8 b/man/man8/su.8 new file mode 100644 index 0000000000..99721bb9b9 --- /dev/null +++ b/man/man8/su.8 @@ -0,0 +1,34 @@ +.pa 1 +.he 'SU (VIII)'1/20/73'SU (VIII)' +.ti 0 +NAME su -- become privileged user +.sp +.ti 0 +SYNOPSIS su__ +.sp +.ti 0 +DESCRIPTION su +allows one to become the super-user, who has +all sorts of marvelous (and correspondingly dangerous) powers. +In order for su to do its magic, the user must +supply a password. +If the password is correct, su +will execute the shell with the UID set to +that of the super-user. +To restore normal UID privileges, +type an end-of-file to the super-user shell. + +To remind the super-user of his responsibilities, +the shell substitutes "#" for its usual prompt "%". +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO sh(I) +.sp +.ti 0 +DIAGNOSTICS "Sorry" if password is wrong +.sp +.ti 0 +BUGS -- diff --git a/man/man8/swtmp.8 b/man/man8/swtmp.8 new file mode 100644 index 0000000000..e19ed31c54 --- /dev/null +++ b/man/man8/swtmp.8 @@ -0,0 +1,24 @@ +.pa 1 +.he 'SWTMP (VIII)'2/11/73'SWTMP (VIII)' +.ti 0 +NAME swtmp -- update accounting file +.sp +.ti 0 +SYNOPSIS swtmp_____ +.sp +.ti 0 +DESCRIPTION This +shell sequence concatenates /tmp/wtmp onto /usr/adm/wtmp +and truncates /tmp/wtmp. +It should be used before +using acct(VIII) +and every so often in any case if accounting +is to be maintained. +.sp +.ti 0 +FILES /tmp/wtmp, +/usr/adm/wtmp +.sp +.ti 0 +SEE ALSO acct(VIII), +wtmp(V) diff --git a/man/man8/tm.8 b/man/man8/tm.8 new file mode 100644 index 0000000000..4240c17354 --- /dev/null +++ b/man/man8/tm.8 @@ -0,0 +1,48 @@ +.pa 1 +.he 'TM (VIII)'3/15/72'TM (VIII)' +.ti 0 +NAME tm -- provide time information +.sp +.ti 0 +SYNOPSIS tm__ +.sp +.ti 0 +DESCRIPTION tm__ +is used to provide timing information. +Output like the following +is given: +.sp +.in +5 + tim 371:51:09 2:00.8 + ovh 20:00:33 17.0 + swp 13:43:20 4.6 + dsk 27:14:35 4.5 + idl 533:08:03 1:33.3 + usr 24:53:50 1.2 + der 0, 54 0, 0 +.sp +.in -5 +The first column of numbers gives totals in the named categories +since the last time the system was cold-booted; the second +column gives the changes since the last time tm__ was invoked. +The top left number is badly truncated and should be ignored. +ovh___ is time spent +executing in the system; +swp___ is time waiting for swap I/O; +dsk___ is time spent waiting for +file system disk I/O; idl___ is idle time; usr___ is user execution +time; der___ is RF disk error count (left number) and RK disk error +count (right number). + +.ti 0 +FILES /dev/rf0 (for absolute times); +/tmp/ttmp for differential timing history. +.sp +.ti 0 +SEE ALSO time(I), file system(V) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- diff --git a/man/man8/umount.8 b/man/man8/umount.8 new file mode 100644 index 0000000000..a69a5b8d52 --- /dev/null +++ b/man/man8/umount.8 @@ -0,0 +1,31 @@ +.pa 1 +.he 'UMOUNT (VIII)'1/20/73'UMOUNT (VIII)' +.ti 0 +NAME umount -- dismount file system +.sp +.ti 0 +SYNOPSIS /etc/umount___________ special +.sp +.ti 0 +DESCRIPTION umount______ +announces to the system that the removable file system previously +mounted on special file special_______ is to be removed. + +The user must take care not +only that all I/O activity on the file system has ceased, +but that no one has his current directory on it. + +Only the super-user may issue this command. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO mount(VIII) +.sp +.ti 0 +DIAGNOSTICS "?" +.sp +.ti 0 +BUGS This +command is not, in fact, restricted to the super-user. diff --git a/man/manx/as.1 b/man/manx/as.1 new file mode 100644 index 0000000000..6d85e25342 --- /dev/null +++ b/man/manx/as.1 @@ -0,0 +1,331 @@ +.pa 1 +.he '1/15/73''AS (I)' +.ti 0 +NAME as -- assembler +.sp +.ti 0 +SYNOPSIS as__ [ -_ ] name918 ... +.sp +.ti 0 +DESCRIPTION as__ +assembles the concatenation of name\d1\u, .... as__ +is based on the DEC-provided assembler PAL-11R [1], although +it was coded locally. +Therefore, only the differences will be recorded. +.sp +If the optional first argument +-_ is used, +all undefined symbols in the assembly +are treated as global. +.sp +Character changes are: +.sp + for use + @ * + # $ + ; / +.sp +In as__, the character ";" is a logical new line; several operations +may appear on one line if separated by ";". +Several new expression operators have been provided: +.sp + \\> right shift (logical) + \\< left shift + * multiplication + \\/ division +.nf + % remainder (no longer means "register") + | inclusive or +.fi + ! one's complement + [] parentheses for grouping +.nf + ^ result has value of left, type of right +.sp +.fi +For example location 0 (relocatable) can be written "0^."; +another way to denote register 2 is "2^r0". + +All of the preceding operators are binary; if +a left operand is missing, it is taken +to be 0. +The "!" operator adds its left operand to the one's +complement of its right operand. + +All operators evaluate left-to-right except for +the effect of brackets; all operators have the +same priority. + +There is a conditional assembly operation code different +from that of PAL-11R (whose conditionals are not provided): +.sp + .if expression + ... + .endif +.sp +If the expression__________ evaluates to non-zero, the section of +code between the ".if" and the ".endif" is assembled; otherwise +it is ignored. ".if"s may be nested. +.sp +Temporary labels like those introduced by Knuth [2] may +be employed. +A temporary label is defined as follows: +.sp + n: +.sp +where n_ is a digit 0 ... 9. Symbols of the form "n_f" refer to the +first label "n_:" following the use of the symbol; those +of the form "n_b" refer to the last "n_:". The same "n_" may +be used many times. +Labels of this form are less taxing both on the +imagination of the programmer and on the symbol table space +of the assembler. +.sp +The PAL-11R opcodes ".word", ".eot" and ".end" are redundant and are omitted. +.sp +The symbols +.sp + r0 ... r5 + fr0 ... fr5 (floating-point registers) + sp + pc + .. +.sp +are predefined with appropriate values. +".." is the relocation constant and is added to +each relocatable reference. +On a PDP-11 with relocation hardware, its value is +0; on most systems without protection, +its value is 40000(8). +.sp +The new opcode "sys" is used to specify system +calls. +Names for system calls are predefined. +See section (II). +.sp +The opcodes "bes" (branch on error set) +and "bec" (branch on error clear) +are defined to test the error status bit +set on return from system calls. +.sp +Strings of characters may be assembled in a way more +convenient than PAL-11's ".ascii" operation (which is, +therefore, omitted). Strings are included between the +string quotes "<" and ">": +.sp + +.sp +Escape sequences exist to enter non graphic +and other difficult characters. These sequences are +also effective in single and double character constants introduced +by single (') and double (") quotes respectively. +.sp + use___ for___ + \\n newline (012) + \\0 NULL (000) + \\> > + \\t TAB (011) + \\a ACK (006) + \\r CR (015) + \\p ESC (033) + \\\\ \\ (134) +.sp +as__ provides a primitive segmentation facility. +There are three segments: text____, data____ and +bss___. +The text segment is ordinarily used for +code. The data segment is provided +for initialized but variable data. +The bss segment cannot be initialized, but +symbols may be defined to lie within this +segment. +In the future, it is expected that the +text segment will be write-protected and sharable. +Assembly begins in the text segment. +The pseudo-operations + + .text + .data + .bss + +cause the assembler +to switch to the text, data, or bss segment respectively. +Segmentation is useful at present +for two reasons: +Non-initialized +tables and variables, if placed +in the bss segment, occupy no space in the +output file. +Also, alternative use of the +text and data segments provides a primitive +dual location-counter feature. + +In the output file, all text-segment information comes +first, followed by all data-segment information, +and finally bss information. +Within each segment, information appears in +the order written. + +Note: +since nothing explicit can be assembled +into the bss segment, the usual appearance +of this segment is in the following style: + + .bss + var1: .=.+2 + tab1: .=.+100. + ... + +That is, space is reserved but nothing explicit +is placed in it. + +As is evident from the example, it is legal to +assign to the location counter ".". +It is also permissible in segments other than ".bss". +The restriction is made, however, +that the value so assigned must be defined +in the first pass and it must be a value +associated with the same segment as ".". + +The pseudo-op + + .comm symbol,expression + +makes symbol______ an undefined global symbol, +and places the value of the expression in +the value field of the symbol's definition. +Thus the above declaration is equivalent to + + .globl symbol + symbol = expression ^ symbol + +The treatment of such a symbol by the loader ld(I) +is as follows: +If another routine in the same load defines the symbol to be an ordinary +text, data, bss, or absolute symbol, +that definition takes precedence and the symbol +acts like a normal undefined external. +If however no other routine defines the symbol, the loader +defines it as an external bss-segment symbol +and reserves n_ bytes after its location, +where n_ is the value of the expression in the .comm +operation. +Thus ".comm x,100" +effectively declares x to be a common region 100 +bytes long. +Note: all such declarations for the same symbol +in various routines should request the same amount +of space. +.sp +The binary output of the assembler is placed on the file "a.out" in the +current directory. +a.out_____ also contains the symbol table from the assembly +and relocation bits. +The output of the assembler is executable immediately +if the assembly was error-free and if there were no +unresolved external references. +The link editor ld__ may be used to combine several +assembly outputs and resolve global symbols. +.sp +The assembler does not produce a listing of the source program. +This is not a serious drawback; the debugger db__ discussed +below is sufficiently powerful to render a printed +octal translation of the source unnecessary. + +On the last pages of this section is a list of all the assembler's +built-in symbols. +In the case of instructions, the addressing modes +are as follows: + +.nf + src, dst source, destination + r general register + fsrc,fdst floating source, destination + fr floating register + exp expression + +.fi +The names of certain 11/45 opcodes are different +from those in the 11/45 manual +to draw analogies with existing 11/20 instructions. +..pa +2 + +.ti 0 +FILES /etc/as2 pass 2 of the assembler +.br +/tmp/atm1? temporary +.br +/tmp/atm2? temporary +.br +/tmp/atm3? temporary +.br +a.out object +.sp +.ti 0 +SEE ALSO ld(I), +nm(I), +sh(I), +un(I), +db(I), +a.out(V), +[1] PAL-11R Assembler; +DEC-11-ASDB-D, +[2] Knuth, +.ul +The Art of Computer Programming, +Vol. I; Fundamental Algorithms., +"UNIX Assembler Manual" (in preparation). +.sp +.ti 0 +DIAGNOSTICS When +an input file cannot be read, its name +followed by a question mark is typed and assembly +ceases. +When syntactic or semantic errors occur, a single-character diagnostic is typed out +together with the line number and the file name in which it +occurred. Errors in pass 1 cause cancellation of pass 2. +The possible errors are: +.sp +.in +6 +.ti -6 +) parentheses error +.ti -6 +] parentheses error +.ti -6 +< String not terminated properly +.ti -6 +* Indirection ("*_") used illegally +.ti -6 +.li +. Illegal assignment to "." +.ti -6 +A error in A_ddress +.ti -6 +B B_ranch instruction is odd or too remote +.ti -6 +E error in E_xpression +.ti -6 +F error in local ("F_" or "b") type symbol +.ti -6 +G G_arbage (unknown) character +.ti -6 +I End of file inside an If__ +.ti -6 +M M_ultiply defined symbol as label +.ti -6 +O O_dd-- word quantity assembled at odd address +.ti -6 +P P_hase error-- "." different in pass 1 and 2 +.ti -6 +R R_elocation error +.ti -6 +U U_ndefined symbol +.ti -6 +X syntaX_ error +.in -6 +.sp +.ti 0 +BUGS Symbol table overflow is not checked. +.sp +If "." is moved backwards by an odd number of bytes, +relocation bits are corrupted. diff --git a/man/manx/asmt.cat b/man/manx/asmt.cat new file mode 100644 index 0000000000..29141a1679 --- /dev/null +++ b/man/manx/asmt.cat @@ -0,0 +1,198 @@ + + +1/15/73 AS (I) + + + Special variables: ilgins + nice + . + .. Double operand: + + Register: mov src,dst + movb " + r0 cmp " + r1 cmpb " + r2 bit " + r3 bitb " + r4 bic " + r5 bicb " + sp bis " + pc bisb " + fr0 add " + fr1 sub " + fr2 + fr3 Branch: + fr4 + fr5 br + bne + System calls: beq + bge + exit blt + fork bgt + read ble + write bpl + open bmi + close bhi + wait blos + creat bvc + link bvs + unlink bhis + exec bec (= bcc) + chdir bcc + time blo + makdir bcs + chmod bes (= bcs) + chown + break Single operand: + stat + seek clr dst + tell clrb " + mount com " + umount comb " + setuid inc " + getuid incb " + stime dec " + quit decb " + intr neg " + fstat negb " + cemt adc " + mdate adcb " + stty sbc " + gtty sbcb " + + - 7 - + + + + + +1/15/73 AS (I) + + + ror " ash src,r + rorb " ashc src,r + rol " mul src,r + rolb " div src,r + asr " xor r,dst + asrb " sxt dst + asl " mark exp + aslb " sob r,exp + jmp " + swab " Specials + tst src + tstb src .byte + .even + Miscellaneous: .if + .endif + jsr r,dst .globl + rts r .text + sys exp (= trap) .data + .bss + Flag-setting: .comm + + clc + clv + clz + cln + sec + sev + sez + sen + + Floating point ops: + + cfcc + setf + setd + seti + setl + clrf fdst + negf fdst + absf fdst + tstf fsrc + movf fsrc,fr (= ldf) + movf fr,fdst (= stf) + movif src,fr (= ldcif) + movfi fr,dst (= stcfi) + movof fsrc,fr (= ldcdf) + movfo fr,fdst (= stcfd) + addf fsrc,fr + subf fsrc,fr + mulf fscr,fr + divf fsrc,fr + cmpf fsrc,fr + modf fsrc,fr + + 11/45 operations + + + - 8 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/man/manx/asmt.x b/man/manx/asmt.x new file mode 100644 index 0000000000..25eedcaec7 --- /dev/null +++ b/man/manx/asmt.x @@ -0,0 +1,224 @@ +'pl132 +.pn 1 +.de hd +'sp2 +.tl '1/15/73''AS (I)' +'sp2 +'in16 +.. +.de im +'sp10 +'in 46 +.. +.de fo +'sp +.tl ''- A% -'' +'bp +.. +.wh 0 hd +.wh 61 im +.wh -6 fo +.br +.nf +.ti-5 +Special variables: +.sp +.li 2 +. +.. +.sp +.ti -5 +Register: +.sp +r0 +r1 +r2 +r3 +r4 +r5 +sp +pc +fr0 +fr1 +fr2 +fr3 +fr4 +fr5 +.sp +.ti -5 +System calls: +.sp +exit +fork +read +write +open +close +wait +creat +link +unlink +exec +chdir +time +makdir +chmod +chown +break +stat +seek +tell +mount +umount +setuid +getuid +stime +quit +intr +fstat +cemt +mdate +stty +gtty +ilgins +nice +.sp +.ti -5 +Double operand: +.sp +mov src,dst +movb " +cmp " +cmpb " +bit " +bitb " +bic " +bicb " +bis " +bisb " +add " +sub " +.sp +.ti -5 +Branch: +.sp +br +bne +beq +bge +blt +bgt +ble +bpl +bmi +bhi +blos +bvc +bvs +bhis +bec (= bcc) +bcc +blo +bcs +bes (= bcs) +.sp +.ne 5 +.ti-5 +Single operand: +.sp +clr dst +clrb " +com " +comb " +inc " +incb " +dec " +decb " +neg " +negb " +adc " +adcb " +sbc " +sbcb " +ror " +rorb " +rol " +rolb " +asr " +asrb " +asl " +aslb " +jmp " +swab " +tst src +tstb src +.sp +.ti -5 +Miscellaneous: +.sp +jsr r,dst +rts r +sys exp (= trap) +.sp +.ti -5 +Flag-setting: +.sp +clc +clv +clz +cln +sec +sev +sez +sen +.sp +.ti -5 +Floating point ops: +.sp +cfcc +setf +setd +seti +setl +clrf fdst +negf fdst +absf fdst +tstf fsrc +movf fsrc,fr (= ldf) +movf fr,fdst (= stf) +movif src,fr (= ldcif) +movfi fr,dst (= stcfi) +movof fsrc,fr (= ldcdf) +movfo fr,fdst (= stcfd) +addf fsrc,fr +subf fsrc,fr +mulf fscr,fr +divf fsrc,fr +cmpf fsrc,fr +modf fsrc,fr +.sp +.ti -5 +11/45 operations +.sp +ash src,r +ashc src,r +mul src,r +div src,r +xor r,dst +sxt dst +mark exp +sob r,exp +.sp +.ti -5 +Specials +.sp +.li 9 +.byte +.even +.if +.endif +.globl +.text +.data +.bss +.comm diff --git a/man/manx/basic.6 b/man/manx/basic.6 new file mode 100644 index 0000000000..2d0c57282a --- /dev/null +++ b/man/manx/basic.6 @@ -0,0 +1,32 @@ +.pa 1 +.he '3/15/72''BASIC (VI)' +.ti 0 +NAME basic -- DEC supplied BASIC +.sp +.ti 0 +SYNOPSIS basic [file] +.sp +.ti 0 +DESCRIPTION Basic +is the standard BASIC V000 distributed +as a stand alone program. +The optional file argument is read before the console. +See DEC-11-AJPB-D manual. +.sp +Since bas___ is smaller and faster, +basic_____ is not maintained on line. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO bas +.sp +.ti 0 +DIAGNOSTICS See manual +.sp +.ti 0 +BUGS GOK +.sp +.ti 0 +OWNER dmr diff --git a/man/manx/cal.6 b/man/manx/cal.6 new file mode 100644 index 0000000000..fce9eb75e4 --- /dev/null +++ b/man/manx/cal.6 @@ -0,0 +1,35 @@ +.pa 1 +.he '3/15/72''CAL (VI)' +.ti 0 +NAME cal -- print calendar +.sp +.ti 0 +SYNOPSIS /usr/ken/cal year +.sp +.ti 0 +DESCRIPTION Cal +will print a calendar for the given year. +The year can be between 0 (really 1 BC) +and 9999. +For years when +several calendars were in vogue in +different countries, +the calendar of England (and therefore her colonies) +is printed. +.sp +P.S. try cal of 1752. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +OWNER ken diff --git a/man/manx/chash.1 b/man/manx/chash.1 new file mode 100644 index 0000000000..fbe4e38c30 --- /dev/null +++ b/man/manx/chash.1 @@ -0,0 +1,44 @@ +.pa 1 +.he '6/13/1972''CHASH (I)' +.fi +.in16 +.ti 0 +NAME chash -- precompile a hash table for cref____ +.sp +.fi +.in16 +.ti 0 +SYNOPSIS chash_____ file1 file2 +.sp +.fi +.in16 +.ti 0 +DESCRIPTION CHASH +takes symbols (character sequences; one per line) from +file1_____ and compiles a hash table for the use of cref____. +The table is written on file2_____. +.sp +A subroutine suitable for searching such a hash table +is available from the author. +.sp +.fi +.in16 +.ti 0 +FILES --- +.sp +.fi +.in16 +.ti 0 +SEE ALSO cref(I) +.sp +.fi +.in16 +.ti 0 +DIAGNOSTICS --- +.sp +.fi +.in16 +.ti 0 +BUGS There +can only be 199 symbols; they may total +only 600 characters of text. diff --git a/man/manx/das.6 b/man/manx/das.6 new file mode 100644 index 0000000000..a9a293f1eb --- /dev/null +++ b/man/manx/das.6 @@ -0,0 +1,27 @@ +.pa 1 +.he '3/15/72''DAS (VI)' +.ti 0 +NAME das -- disassembler +.sp +.ti 0 +SYNOPSIS -- +.sp +.ti 0 +DESCRIPTION A PDP-11 +disassembler exists. +Contact the owner for more information. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +OWNER ken diff --git a/man/manx/dds.1 b/man/manx/dds.1 new file mode 100644 index 0000000000..35023aa4a8 --- /dev/null +++ b/man/manx/dds.1 @@ -0,0 +1,25 @@ +.pa 1 +.he 'Y''X' +.ti 0 +NAME X +.sp +.ti 0 +SYNOPSIS X +.sp +.ti 0 +DESCRIPTION X +.sp +.ti 0 +FILES X +.sp +.ti 0 +SEE ALSO X +.sp +.ti 0 +DIAGNOSTICS X +.sp +.ti 0 +BUGS X +.sp +.ti 0 +OWNER X diff --git a/man/manx/dpt.6 b/man/manx/dpt.6 new file mode 100644 index 0000000000..9b1f3a4336 --- /dev/null +++ b/man/manx/dpt.6 @@ -0,0 +1,31 @@ +.pa 1 +.he '3/15/72''DPT (VI)' +.ti 0 +NAME dpt -- read DEC ASCII paper tape +.sp +.ti 0 +SYNOPSIS dpt output [input] +.sp +.ti 0 +DESCRIPTION dpt___ +reads the input file (/dev/ppt default) +assuming the format is a DEC generated +ASCII paper tape of an assembly language program. +The output is a UNIX ASCII assembly program. +.sp +.ti 0 +FILES /dev/ppt +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS Almost +always a hand pass is required to get +a correct output. +.sp +.ti 0 +OWNER ken, dmr diff --git a/man/manx/fptrap.3 b/man/manx/fptrap.3 new file mode 100644 index 0000000000..489015c381 --- /dev/null +++ b/man/manx/fptrap.3 @@ -0,0 +1,94 @@ +.pa 1 +.he '3/15/72''FPTRAP (III)' +.ti 0 +NAME fptrap -- PDP-11/45 floating point simulator +.sp +.ti 0 +.nf +SYNOPSIS .globl fptrap +.br +sys ilgins; fptrap +.fi +.sp +.ti 0 +DESCRIPTION fptrap______ +is a package which picks up instructions which are illegal +for the PDP-11/20, and if they correspond to 11/45 floating +point instructions, simulates their operation. +The following instructions are supported: + + cfcc + setf + seti + setd + setl +. ldfps src (not in assembler) +. stfps dst (not in assembler) + clrf fdst + tstf fsrc + absf fdst + negf fdst + mulf fsrc,fr + modf fsrc,fr + addf fsrc,fr + movf fsrc,fr (=ldf) + movf fr,fdst (=stf) + subf fsrc,fr + cmpf fsrc,fr + divf fsrc,fr +.nf +. movei fr,dst (=stexp) (not in assembler) +. movie src,fr (=ldexp) (not in assembler) + movfi fr,dst (=stcfi) + movif src,fr (=ldcif) + movfo fr,fdst (=stcxy) + movof fsrc,fr (=ldcyx) +.fi + +Here src___ and dst___ stand for source and destination, fsrc____ +and fdst____ for floating source and destination, and fr__ for +floating register. +Notice that the names of several of the opcodes have changed. +The only strange instruction +is movf____, which turns into stf___ if its source +operand is a floating register, and into ldf___ if not. +.sp +The simulator sets the floating condition codes +on both ldf___ and stf___. +The 11/45 hardware does not set +the fcc on stf. + +Short and long format for both floating point numbers +and integers is supported. Truncation mode is always in effect. +Traps for overflow and other arithmetic errors are not supported. +Illegal instructions or addresses cause a simulated trap +so that a core image is produced. + +The condition code bits are maintained correctly. + +For floating-point source operands, immediate mode ((pc)+) is +not supported, since the PDP-11/45 +handbook is not clear on what to do about it. + +After an arithmetic error the result is generally +meaningless. + +The arithmetic is always done in double-precision, so exact +but unrounded results are to be expected in single-precision +mode. Double precision results are probably less correct +than the hardware will be. + +The lower parts of the floating registers become meaningless +during single-precision operations. +.sp +.ti 0 +FILES kept in /usr/lib/liba.a +.sp +.ti 0 +SEE ALSO PDP-11/45 handbook, ilgins(II) +.sp +.ti 0 +DIAGNOSTICS trap, c-bit, v-bit +.sp +.ti 0 +BUGS see above diff --git a/man/manx/fstrip.1 b/man/manx/fstrip.1 new file mode 100644 index 0000000000..8e89e8c7bf --- /dev/null +++ b/man/manx/fstrip.1 @@ -0,0 +1,37 @@ +.pa 1 +.he '10/24/72''FSTRIP (I)' +.ti 0 +NAME fstrip -- remove Fortran internal symbols +.sp +.ti 0 +SYNOPSIS fstrip______ name\d1\u ... +.sp +.ti 0 +DESCRIPTION Fortran output +files occasionally refer to so +many symbols that the debugger db__ (I) balks. +.ul +fstrip +massages a Fortran output file to remove the symbols +which are internal to Fortran. + +From the symbol tables contained in the files +given as arguments, +fstrip______ removes the symbols of the form "l#", +where "l" is one of "t", "c", or "d", and "#" is +a decimal number. + +The output of fstrip______ is unacceptable to the loader +under any circumstances. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO fc(I) +.sp +.ti 0 +DIAGNOSTICS yes, hopefully self-explanatory +.sp +.ti 0 +BUGS -- diff --git a/man/manx/ident.5 b/man/manx/ident.5 new file mode 100644 index 0000000000..c9d1dc0b8a --- /dev/null +++ b/man/manx/ident.5 @@ -0,0 +1,37 @@ +.pa 1 +.he '6/12/72''IDENT (V)' +.ti 0 +NAME ident -- IDENT card file +.sp +.ti 0 +SYNOPSIS -- +.sp +.ti 0 +DESCRIPTION ident_____ +is a file used to generate GECOS $IDENT +cards by the off-line print program opr(I). +There is one entry per line in the following +style: + + 05:m1234,m789,name + +which causes the following $IDENT card to be generated: + + $ IDENT m1234,m789,name + +.sp +.ti 0 +FILES kept +in /etc/ident. +.sp +.ti 0 +SEE ALSO opr(I) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +OWNER ken, dmr diff --git a/man/manx/kbd.7 b/man/manx/kbd.7 new file mode 100644 index 0000000000..5c5b7f7a72 --- /dev/null +++ b/man/manx/kbd.7 @@ -0,0 +1,44 @@ +.pa 1 +.he '6/15/72''KBD (VII)' +.ti 0 +NAME kbd -- keyboard map +.sp +.ti 0 +SYNOPSIS cat /usr/pub/kbd +.sp +.ti 0 +DESCRIPTION kbd___ +contains a map to the keyboard for model 37 Teletype +terminals with the extended character set feature. +If kbd___ +is printed on such a terminal, the following will appear: + +.nf +.in -2 +<[1234567890-_]^\\ >qwertyuiop@ asdfghjkl;: zxcvbnm,./ + +<[1234567890-_]^\\ > @ ;: ,./ + + +<{!"#$%&'() =_}~| >QWERTYUIOP` ASDFGHJKL+* ZXCVBNM,.? + +<{ !"#$%&'() =_} ~ | >QWERTYUIOP` ASDFGHJKL+* ZXCVBNM,.? + + +.fi +.sp +.in +2 +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +OWNER jfo diff --git a/man/manx/login.7 b/man/manx/login.7 new file mode 100644 index 0000000000..bb221e5c08 --- /dev/null +++ b/man/manx/login.7 @@ -0,0 +1,101 @@ +.pa 1 +.he '6/15/72''LOGIN, LOGOUT (VII)' +.ti 0 +NAME logging in and logging out +.sp +.ti 0 +SYNOPSIS -- +.sp +.ti 0 +DESCRIPTION UNIX +must be called from an appropriate terminal. +UNIX supports ASCII terminals typified by the Teletype M37, +the GE Terminet 300, the Memorex 1240, and various +graphical terminals on the one hand, and IBM 2741-type +terminals on the other. + +Not all installations support +all these terminals. +Often the M33/35 Teletype is supported instead +of the 2741. +Depending on the hardware installed, most +terminals operating at 110, 134.5, 150, or 300 baud can +be accommodated. + +To use UNIX, +it is also necessary to have +a valid UNIX user ID and (if desired) password. These +may be obtained, together with the telephone number, from the system administrators. + +The same telephone number +serves terminals operating at all the standard speeds. +The discussion below applies when the standard +speeds of 134.5 (2741's) +150 (TTY 37's) and 300 (Terminet 300's) +are available. + +When a connection is established via a 150-baud terminal +(e.g. TTY 37) UNIX types out "login:"; you respond with +your user name, and, if requested, with a password. +(The printer is turned off while you type the +password.) +If the login was successful, the "@" character +is typed by the Shell to indicate +login is complete and commands may be issued. +A message of the day may be typed if there are any announcements. +Also, if there is a file called "mailbox", you are notified +that someone has sent you mail. +(See the mail____ command.) + +From a 300-baud terminal, the procedure is slightly different. +Such terminals often have a full-duplex switch, which should +be turned on (or conversely, half-duplex should be turned off). +When a connection with UNIX is established, a few garbage +characters are typed (these are the "login:" message at the wrong speed). +You should depress the "break" key; +this is a speed-independent signal to UNIX that a 300-baud +terminal is in use. It will type "login:" (at the correct speed +this time) and from then on the procedure is the same as described +above. + +From a 2741, no message will appear. +After the telephone connection is established, +press the "ATTN" button. +UNIX should type "login:" as described above. +If the greeting does not appear after a few seconds, +hang up and try again; something has gone wrong. +If a password is required, +the printer cannot be turned off, so it will appear on the paper +when you type it. + +For more information, consult +getty(VII), which discusses the login sequence in more +detail, and tty0(IV), which discusses typewriter I/O. + +Logging out is simple by comparison (in fact, sometimes too simple). +Simply generate an end-of-file at Shell level by using +the EOT character; the "login:" message will appear again to +indicate that you may log in again. + +It is also possible to log out simply by hanging up the terminal; +this simulates an end-of-file on the typewriter. +.sp +.ti 0 +FILES /etc/motd +may contain a message-of-the-day. +.sp +.ti 0 +SEE ALSO init(VII), getty(VII), tty0(IV) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS Hanging up +on programs which never read +the typewriter or which ignore end-of-files +is very dangerous; in the worst cases, +the programs can only be halted by restarting the system. +.sp +.ti 0 +OWNER ken, dmr diff --git a/man/manx/lpr.4 b/man/manx/lpr.4 new file mode 100644 index 0000000000..7c9415efc2 --- /dev/null +++ b/man/manx/lpr.4 @@ -0,0 +1,52 @@ +.pa 1 +.he '6/12/72''LPR (IV)' +.ti 0 +NAME /dev/lpr -- line printer +.sp +.ti 0 +SYNOPSIS -- +.sp +.ti 0 +DESCRIPTION The +line printer special file is +the UNIX interface to a DEC LP-11 line printer. +This file may only be opened (or creat'ed) for writing. +Anything written on this file is printed on the line printer. +The following special cases for the +printer are handled: +.sp +.in +3 +On opening and on closing, the paper is +slewed to the top of the next page. +.sp +For the 64 character printer (LP11-FA), +all lower case letters are +converted to upper case. +.sp +Tabs are converted to align on every eighth column. +.sp +New lines and form feeds are ignored when the +printer is at the top of a page. +This is done so that pr__ and roff____ output may +be directed to the printer and sync on +page boundaries even with automatic page slew. +.sp +Carriage return and back space +can cause multiple printing on a single line +to allow for overstruck graphics. +.sp +.in -3 +.ti 0 +FILES found in /dev +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +OWNER ken, dmr diff --git a/man/manx/moo.6 b/man/manx/moo.6 new file mode 100644 index 0000000000..7b95a18558 --- /dev/null +++ b/man/manx/moo.6 @@ -0,0 +1,26 @@ +.pa 1 +.he '3/15/72''MOO (VI)' +.ti 0 +NAME moo -- a game +.sp +.ti 0 +SYNOPSIS /usr/games/moo +.sp +.ti 0 +DESCRIPTION moo___ +is a guessing game imported from England. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +OWNER ken diff --git a/man/manx/obproc.7 b/man/manx/obproc.7 new file mode 100644 index 0000000000..6855370d2a --- /dev/null +++ b/man/manx/obproc.7 @@ -0,0 +1,240 @@ +.pa 1 +.he '3/15/72''BOOT PROCEDURES (VII)' +.ti 0 +NAME bos, maki, rom, vcboot, msys, et al +.sp +.ti 0 +SYNOPSIS -- +.sp +.ti 0 +DESCRIPTION On +the RF disk, the highest 16K words are +reserved for stand-alone programs. +These 16K words are allocated as follows: +.sp +bos (1K) +.br +Warm UNIX (7K) +.br +Cold UNIX (8K) +.sp +The UNIX read only memory (ROM) +is home cut with 2 programs of 16 words each. +The first (address 173000) +reads bos___ from the RF disk into core +location 154000 +and transfers to 154000. +The other ROM program +(address 173040) +reads a DECtape sitting in the end-zone +on drive 0 +into core location 0 and transfers to 0. +This latter operation is compatible with +part of DEC's standard ROM. +The disassembled code for the UNIX ROM follows: +.sp +.nf +.in 8 +173000: mov $177472,r0 12700;177472 + mov $3,-(r0) 12740;3 + mov $140000,-(r0) 12740;140000 + mov $154000,-(r0) 12740;154000 + mov $-2000,-(r0) 12740;176000 + mov $5,-(r0) 12740;5 + tstb (r0) 105710 + bge .-2 2376 + jmp *$154000 137;154000 +.sp +173040: mov $177350,r0 12700;177350 + clr -(r0) 5040 + mov r0,-(r0) 10040 + mov $3,-(r0) 12740;3 + tstb (r0) 105710 + bge .-2 2376 + tst *$177350 5737;177350 + bne . 1377 + movb $5,(r0) 112710;5 + tstb (r0) 105710 + bge .-2 2376 + clr pc 5007 +.fi +.in 16 +.sp +The program bos___ (Bootstrap Operating System) +examines the console switchs and executes +one of several internal programs depending on the setting. +The following settings are currently recognized: +.sp +.in +8 +.ti -8 +??? Will read Warm UNIX from +the RF into core location 0 and transfer to 600. +.sp +.ti -8 +1 Will read Cold UNIX from the +RF into core location 0 and transfer to 600. +.sp +.ti -8 +10 Will dump all of memory +from core location 0 onto DECtape drive 7 +and then halt. +.sp +.ti -8 +20 Will read 256 words from RK0 into +core 0 and transfer to zero. +This is the procedure to boot +DOS from an RK. +.sp +.ti -8 +40 This is the same as 10 above, but +instead of halting, UNIX warm is loaded. +.sp +.ti -8 +0 Will load a standard UNIX binary paper tape +into core location 0 and transfer to 0. +.sp +.ti -8 +77500 Will load the standard DEC absolute and binary +loaders and transfer to 77500. +.sp +.in 16 +Thus we come to the UNIX warm boot procedure: +put 173000 into the switches, push +.ul +load address +and then push +.ul +start. +The alternate switch setting of 173030 +that will load warm UNIX is used +as a signal to bring up +a single user system for special +purposes. +See +init(VII). +For systems without a rom, +UNIX (both warm and cold) +have a copy of the disk boot +program at location 602. +This is probably a better warm boot +procedure because +the program at 602 also +attempts to complete outstanding I/O. +.sp +Cold boots can be accomplished with the +Cold UNIX program, but they're not. +Thus the Cold UNIX slot on the RF may have +any program desired. +This slot is, however, used during a cold boot. +Mount the UNIX INIT DECtape on drive +0 positioned in the end-zone. +Put 173040 into the switches. +Push +.ul +load address. +Put 1 into the switches. +Push +.ul +start. +This reads a program called +.ul +vcboot +from the tape into +core location 0 and transfers to it. +vcboot______ then reads 16K words from +the DECtape (blocks 1-32) +and copies the data to the highest 16K words of +the RF. +Thus this initializes the read-only part of the RF. +vcboot______ then reads in bos___ and executes it. +bos___ then reads in Cold UNIX and executes that. +Cold UNIX halts for a last chance before +it completely initializes the RF file system. +Push +.ul +continue, +and Cold UNIX will initialize the RF. +It then sets into execution a user program +that reads the DECtape for initialization files +starting from block 33. +.a +When this is done, the program executes +/etc/init +which should have been on the tape. +.sp +The INIT tape is made by the program maki____ +running under UNIX. +maki____ writes vcboot______ on block 0 of +.ul +/dev/tap7. +It then copies the RF 16K words (using +.ul +/dev/rf0) +onto blocks 1 thru 32. +It has internally a list of files to +be copied from block 33 on. +This list follows: +.sp +.nf +.in +8 +/etc/init +/bin/chmod +/bin/date +/bin/login +/bin/ls +/bin/mkdir +/etc/mount +/bin/sh +/bin/tap +.in -8 +.fi +.sp +Thus this is the set of programs available after a cold boot. +init____ and sh__ are mandatory. +For multi-user UNIX, +getty_____ and login_____ are also necessary. +mkdir_____ is necessary due to a bug in tap___. +tap___ and mount_____ are useful to +bring in new files. +As soon as possible, date____ should be done. +That leaves ls__ and chmod_____ as frosting. +.sp +The last link in this incestuous +daisy chain is the program msys____. +.sp + msys____ char file +.sp +will copy the file file____ onto the +RF read only slot specified by the characacter char____. +Char is taken from the following set: +.sp + b_ bos + u_ Warm UNIX + 1_ Cold UNIX +.sp +Due to their rarity of use, +maki____ and msys____ are maintained off line and +must be reassembled before used. +.sp +.ti 0 +FILES /dev/rf0, +/dev/tap? +.sp +.ti 0 +SEE ALSO init(VII), +tap(I), +sh(I), +mkdir(I) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS This +section is very configuration dependent. +Thus, it does not +describe the boot procedure for +any one machine. +.sp +.ti 0 +OWNER ken diff --git a/man/manx/rp.4 b/man/manx/rp.4 new file mode 100644 index 0000000000..8e8a1bfaa5 --- /dev/null +++ b/man/manx/rp.4 @@ -0,0 +1,34 @@ +.pa 1 +.he '6/12/72''RP0 (IV)' +.ti 0 +NAME rp0 -- RP11/RP02 disk +.sp +.ti 0 +SYNOPSIS -- +.sp +.ti 0 +DESCRIPTION rp0___ +refers to the entire RP02 disk as a single sequentially-addressed +file. +Its 256-word blocks are numbered 0 to 40599. +Like the RF disk and the tape files, its +addressing is block-oriented. +Consult the rf0(IV) section. +.sp +.ti 0 +FILES found in /dev +.sp +.ti 0 +SEE ALSO rf0(IV), tap0(IV) +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS See rf0(IV) +.br +Due to a hardware bug, +block 40599 on the RP cannot be accessed. +.sp +.ti 0 +OWNER ken, dmr diff --git a/man/manx/speakm.5 b/man/manx/speakm.5 new file mode 100644 index 0000000000..c0cb906532 --- /dev/null +++ b/man/manx/speakm.5 @@ -0,0 +1,42 @@ +.pa 1 +.he '2/5/73''SPEAK.M (V)' +.ti 0 +NAME /etc/speak.m -- voice synthesizer vocabulary +.sp +.ti 0 +DESCRIPTION The memory file for +.ul +speak. +It contains: +.sp +- a word containing n, the number of entries +.br +- n 4-word entries, counted 0,1...n-1 +.br +- a word containing m, the number of bytes of strings +.br +- m bytes of strings, counted 0,1...m-1, each null-terminated +.sp +The entries are arranged in a tree. +Each consists of four pointers. +Zero pointers point nowhere. +The pointers are: +.sp +- the number (in string storage) of the first byte of the +word for this entry +.br +- the number of the first byte of the phonetic line +for the word. The line is coded according to vsp___ (VII). +.br +- the number of an entry that precedes the present word +in ascii lexicographic order +.br +- the number of an entry that follows the present +word in lexicographic order +.br +.sp +Entry zero points to no word. +Byte zero of string storage is null. +.sp +.ti 0 +SEE ALSO speak(I), vsp(VII) diff --git a/man/manx/ttt.6 b/man/manx/ttt.6 new file mode 100644 index 0000000000..f9b78c7b92 --- /dev/null +++ b/man/manx/ttt.6 @@ -0,0 +1,29 @@ +.pa 1 +.he '3/15/72''TTT (VI)' +.ti 0 +NAME ttt -- tic-tac-toe +.sp +.ti 0 +SYNOPSIS /usr/games/ttt +.sp +.ti 0 +DESCRIPTION ttt___ +is the X's and O's game +popular in 1st grade. +This is a learning program that never +makes the same mistake twice. +.sp +.ti 0 +FILES ttt.k -- old mistakes +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +OWNER ken diff --git a/man/manx/uids.5 b/man/manx/uids.5 new file mode 100644 index 0000000000..c7d9bd8eb9 --- /dev/null +++ b/man/manx/uids.5 @@ -0,0 +1,33 @@ +.pa 1 +.he '3/15/72''UIDS (V)' +.ti 0 +NAME /etc/uids -- map user names to user IDs +.sp +.ti 0 +SYNOPSIS -- +.sp +.ti 0 +DESCRIPTION This file +allows programs to map user names into user numbers and vice versa. +Anyone can read it. +It resides in directory /etc, and should be updated +along with the password file when a user is added or deleted. + +The format is an ASCII name, +followed by a colon, followed by a decimal ASCII +user ID number. +.sp +.ti 0 +FILES -- +.sp +.ti 0 +SEE ALSO -- +.sp +.ti 0 +DIAGNOSTICS -- +.sp +.ti 0 +BUGS -- +.sp +.ti 0 +OWNER dmr, ken