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

1.1       root        1: /* a3 -- pdp-11 assembler pass 1 */
                      2: #include "as1.h"
                      3: #define checkeos() (LAST('\n') || LAST(';') || LAST('\004'))
                      4: 
                      5: assem()
                      6: {
                      7:        OP op1,op2;
                      8: 
                      9:        for (;;) {
                     10:        op1=readop();
                     11:        if (!checkeos()) {
                     12:                if (ifflg) {
                     13:                        if (ISCHAR(op1)) continue;
                     14:                        if (op1.xp->typ==T_IF) ++ifflg;
                     15:                        if (op1.xp->typ==T_ENDIF) --ifflg;
                     16:                        continue;
                     17:                }
                     18:                op2=readop();
                     19:                if (LAST('=')) {
                     20:                        struct expr x;
                     21:                        x=expres(readop());
                     22:                        if (ISCHAR(op1)) error('x');
                     23:                        else if ((&op1.xp->typ)==dotrel         /* as in ".=.+2" */
                     24:                          && (x.typ&=~T_EXTERN)!=*dotrel) {
                     25:                                error('.'); *dotrel=T_TEXT;
                     26:                        } else {
                     27:                                op1.xp->typ&=~037;
                     28:                                if ((x.typ&=037)==0) x.val=0;
                     29:                                op1.xp->typ |= x.typ; op1.xp->val=x.val;
                     30:                        }
                     31:                } else if (LAST(':')) {
                     32:                        register int t;
                     33:                        if (ISCHAR(op1)) {
                     34:                                if (op1.v!=T_ABS) {error('x'); continue;}
                     35:                                t=fbcheck(numval);
                     36:                                curfbr[t]= *dotrel; curfb[t]= *dot;
                     37:                                nxtfb.c0= *dotrel; nxtfb.c1=t; nxtfb.val= *dot;
                     38:                                if (1!=fwrite(&nxtfb,sizeof(nxtfb),1,fbfil)) wrterr();
                     39:                        } else {
                     40:                                if (op1.xp->typ&037) error('m');
                     41:                                op1.xp->typ |= *dotrel; op1.xp->val = *dot;
                     42:                        }
                     43:                        continue;
                     44:                } else {
                     45:                        savop=op2; opline(op1);
                     46:                }
                     47:        }
                     48:        if (LAST('\n')) ++line;
                     49:        else if (LAST(';')) ;
                     50:        else if (LAST('\004')) {
                     51:                if (ifflg) error('x');
                     52:                return;         /* sole exit */
                     53:        } else {
                     54:                error('x'); while (!checkeos()) readop();
                     55:        }
                     56:        }
                     57: }
                     58: 
                     59: fbcheck(t)
                     60: {
                     61:        if (((unsigned)t)>9) {error('f'); t=0;}
                     62:        return(t);
                     63: }

unix.superglobalmegacorp.com

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