Annotation of researchv10no/cmd/PDP11/11as/as24.c, revision 1.1.1.1

1.1       root        1: /* a4 -- pdp-11 assembler pass2 */
                      2: #include "as2.h"
                      3: 
                      4: putw(w,fp)
                      5: FILE *fp;
                      6: {
                      7:        if (1!=fwrite(&w,2,1,fp)) wrterr();
                      8: }
                      9: 
                     10: wrterr()
                     11: {
                     12:        fprintf(stderr,"as: write error on output\n"); saexit();
                     13: }
                     14: 
                     15: OP savop;
                     16: OP lastop;
                     17: 
                     18: OP
                     19: readop()
                     20: {
                     21:        extern struct expr symtab[];
                     22: 
                     23:        if (savop.xp) {lastop=savop; savop.xp=0; return(lastop);}
                     24:        lastop.v=getw();
                     25:        if (ISCHAR(lastop)) return(lastop);
                     26:        if (lastop.v>=04000) lastop.xp=usymtab+(lastop.v-04000);
                     27:        else lastop.xp=symtab+(lastop.v-01000);
                     28:        return(lastop);
                     29: }
                     30: 
                     31: getw()
                     32: {
                     33:        register int t,error=0;
                     34:        if (savop.xp) {lastop=savop; savop.xp=0; return(lastop.v);}
                     35:        if (EOF==(t=getchar())) ++error;
                     36:        lastop.v=t;
                     37:        if (EOF==(t=getchar())) ++error;
                     38:        lastop.v |= t<<8;
                     39:        if (error) lastop.v=4;
                     40:        return(lastop.v);
                     41: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.