Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-04 - 43,50325/jbeg.beg
There are no other files named jbeg.beg in the archive.
! File:   JBEG.BEG
!
!    This work was supported by the Advanced Research
!    Projects Agency of the Office of the Secretary of
!    Defense (F44620-73-C-0074) and is monitored by the
!    Air Force Office of Scientific Research.

BEGIN


EXTERNAL
    CODESIZE,
    GETLABEL,
    GETSPACE,
    RELEASESPACE,
    ST,
    UNLOCFLG;



BIND

    UNUSED = 0,

!CONTENTS OF CELLTYPEF

    CODECELLT = 1,
    LABCELLT = 2,
    REFCELLT = 3,

!CONTENTS OF LABTYPEF

    ROUTLABT = 0,
    USERLABT = 1,
    COMPLABT = 2,

!CONTENTS OF OPTYPEF

    NORMALOPT = 0,
    CASPARAMT = 1,
    INLINET = 2,
    UNCONDJMPT = 3,
    ADDIOPT = 4,
    CONDJMPT = 5,

!CONTENTS OF ANAME

    NORMNAME = 0,
    LABELNAME = 1,
    ERRORNAME = 2,
    FORMALNAME = 3,

!CONTENTS OF ATYPE

    IMMEDAT = 1,
    REGAT = 2,
    INDAT = 3,
    MEMAT = 4,

!CONTENTS OF OPDTYPEF

    NORMALT = 1,
    NAMET = 2,
    ERRORT = 3,
    INLNOPDT = 4,
    TRAPIDT = 6,
    LABELTYPE = 25,   %6,A%

!CONTENTS OF CELLSIZEF

    CODECELLSIZE = 6,
    LABCELLSIZE = 2,
    REFCELLSIZE = 2,

!CONTENTS OF OPERTYPE PLIT

    NOOP = 0,
    ONEOP = 1,
    TWOOP = 2,
    BROP = 3,
    JSROP = 4,
    RTSOP = 5,
    TRAPOP = 6,
    WORDOP = 7,
    CASEOP = 8,

    ADRBLKSIZ = 2,

    MINCELLSIZE = 3,

    MINLABNAM = #400000000000,

    SOURCEL = 2,
    DESTINL = 4,

    POSTYPEF = 24,
    POSMODEF = 21,
    POSREGF = 18;


BIND
    !
    !BE CAREFUL WITH THESE.  THEY MUST BE ASSIGNED CONSECUTIVELY
    !IN THE GIVEN ORDER.
    !
    PINLINE=0,
    PMOV=1, PMOVB=2,
    PCMP=3, PCMPB=4,
    PBIT=5, PBITB=6,
    PBIC=7, PBICB=8,
    PBIS=9, PBISB=10,
    PADD=11,
    PSUB=12,
    PCLR=13, PCLRB=14,
    PCOM=15, PCOMB=16,
    PINC=17, PINCB=18,
    PDEC=19, PDECB=20,
    PNEG=21, PNEGB=22,
    PADC=23, PADCB=24,
    PSBC=25, PSBCB=26,
    PTST=27, PTSTB=28,
    PROR=29, PRORB=30,
    PROL=31, PROLB=32,
    PASR=33, PASRB=34,
    PASL=35, PASLB=36,
    PJMP=37,
    PSWAB=38,
    PJSR=39,
    PRTS=40,
    PHALT=41,
    PWAIT=42,
    PRTI=43,
    PIOT=44,
    PRESET=45,
    PEMT=46,
    PTRAP=47;


BIND
	!
	! BE CAREFUL WITH THESE.  MUST BE ABLE TO REVERSE SENSE
	! OF BRANCH OP BY COMPLEMENTING BIT 0.
        !
        !ALSO THEY MUST APPEAR IN THE ORDER GIVEN.
	!
	PBR=48,PNBR=PBR OR 1,
	PBNE=50,PBEQ=PBNE OR 1,
	PBGE=52,PBLT=PBGE OR 1,
	PBLE=54,PBGT=PBLE OR 1,
	PBPL=56,PBMI=PBPL OR 1,
	PBHI=58,PBLOS=PBHI OR 1,
	PBVC=60,PBVS=PBVC OR 1,
	PBHIS=62,PBLO=PBHIS OR 1;


BIND
    !
    !BE CAREFUL  WITH THESE.  THEY MUST BE ASSIGNED CONSECUTIVELY
    !IN THE GIVEN ORDER.
    !
    PNOP=64,
    PCLC=65,
    PCLVC=66,
    PWORD=67,
    PCASE=68,
    PMFPI=69,
    PMFPD=70,
    PMTPI=71,
    PMTPD=72,
    INFLOOPOP=73,
    SETEQLOP=74;



MACRO
    ADELTA = 0,28,3$,
    ADELTAV(X) = EXTENDBIT(.X[ADELTA],3)$,
    AFORM = 0,24,4$,
    AMODE = 0,24,3$,
    ANAME = 0,0,18$,
    ANAMET = 0,31,3$,
    AOFFSET = 1,0,16$,
    AOFFSETV(X) = EXTENDBIT(.X[AOFFSET],16)$,
    AREG = 0,18,3$,
    AREGNAME = 0,0,21$,
    ATYPE = 0,21,3$,
    ATYPREGNAME = 0,0,24$,
    DSTP(X) = ((X)+DESTINL)$,
    DSTDELTA = DESTINL+ADELTA$,
    DSTDELTAV(X) = EXTENDBIT(.X[DSTDELTA],3)$,
    DSTFORM = DESTINL+AFORM$,
    DSTMODE = DESTINL+AMODE$,
    DSTNAME = DESTINL+ANAME$,
    DSTNAMET = DESTINL+ANAMET$,
    DSTOFFSET = DESTINL+AOFFSET$,
    DSTOFFSETV(X) = EXTENDBIT(.X[DSTOFFSET],16)$,
    DSTREG = DESTINL+AREG$,
    DSTTYPE = DESTINL+ATYPE$,
    SRCP(X) = ((X)+SOURCEL)$,
    SRCDELTA = SOURCEL+ADELTA$,
    SRCDELTAV(X) = EXTENDBIT(.X[SRCDELTA],3)$,
    SRCFORM = SOURCEL+AFORM$,
    SRCMODE = SOURCEL+AMODE$,
    SRCNAME = SOURCEL+ANAME$,
    SRCNAMET = SOURCEL+ANAMET$,
    SRCOFFSET = SOURCEL+AOFFSET$,
    SRCOFFSETV(X) = EXTENDBIT(.X[SRCOFFSET],16)$,
    SRCREG = SOURCEL+AREG$,
    SRCTYPE = SOURCEL+ATYPE$;




MACRO		! FIELD NAMES FOR THE GMA RESULT WORD
    OPDF = RF$,
    OPDMODEF = POSMODEF,3$,
    OPDREGF = POSREGF,3$,
    OPDTYPEF = POSTYPEF,12$;

MACRO		! FIELD NAMES IN CODE, LABEL, AND REF CELLS
    PREVF = -3,LF$,
    NEXTF = -3,RF$,

    BOTF = -2,LF$,
    TOPF = -2,RF$,

    CELLTYPEF = -1,LF$,
    CELLSIZEF = -1,RF$,

    MINLOCF = 0,LF$,
    MINLENF = 0,RF$,

    REFEF = 0,LF$,
    REFRF = 0,RF$,

    SYMNAMEF = 1,LF$,
    SYMOFFSETF = 1,RF$,

    OPTYPEF = 1,LF$,
    OPF = 1,RF$,

    LABNAMF = 1,0,36$,
    LABSEENF = 1,35,1$,
    LABTYPEF = 1,18,17$,
    LABVALF = 1,RF$,

    INLCOM = SOURCEL+0,23,1$,
    INLNARG = SOURCEL+0,LEXPART$,
    HYDWORD = DESTINL+0,35,1$;

MACRO		! VARIOUS LIST PACKAGE FUNCTIONS
    BST(I) = ST[I,BOTF]$,
    TST(I) = ST[I,TOPF]$,
    PST(I) = ST[I,PREVF]$,
    NST(I) = ST[I,NEXTF]$,

    BOTELSEPREV(PRED,I) = (IF (PRED) THEN BST(I) ELSE PST(I))$,
    TOPELSENEXT(PRED,I) = (IF (PRED) THEN TST(I) ELSE NST(I))$,

    PREVPT(I) = TOPELSENEXT(.NST(.PST(I)) NEQ (I),.PST(I))$,
    NEXTPT(I) = BOTELSEPREV(.PST(.NST(I)) NEQ (I),.NST(I))$;

MACRO		! VARIOUS PREDICATES
    CCP(I) = (.ST[I,CELLTYPEF] EQL CODECELLT)$,
    CODEP(I) = (.ST[I,CELLTYPEF] EQL CODECELLT)$,
    LABELP(I) = (.ST[I,CELLTYPEF] EQL LABCELLT)$,
    LCCP(I) = ONEOF(.ST[I,CELLTYPEF],BIT2(CODECELLT,LABCELLT))$,

    ADDIMMEDP(I) = (.ST[I,OPTYPEF] EQL ADDIOPT)$,
    CONDJMPP(I) = (.ST[I,OPTYPEF] EQL CONDJMPT)$,
    JMPP(I) = ONEOF(.ST[I,OPTYPEF],BIT2(CONDJMPT,UNCONDJMPT))$,
    NOBOP(I) = ONEOF(.ST[I,OPTYPEF],BIT3(CASPARAMT,INLINET,UNCONDJMPT))$,
    UNCONDJMPP(I) = (.ST[I,OPTYPEF] EQL UNCONDJMPT)$,

    CASPARAMP(I) = (.ST[I,OPF] EQL PCASE)$,
    INFLOOPP(I) = (.ST[I,OPF] EQL INFLOOPOP)$,
    SETEQLP(I) = (.ST[I,OPF] EQL SETEQLOP)$,

    HASSOURCE(OP) = ONEOF(.OPERTYPE[OP],BIT5(ONEOP,TWOOP,BROP,WORDOP,CASEOP))$,
    HASDEST(OP) = ONEOF(.OPERTYPE[OP],BIT3(TWOOP,JSROP,CASEOP))$,

    EMPTYP(I) = (.BST(I) EQL (I))$,
    LABSEENP(I) = (.ST[I,LABSEENF])$,
    USERLABP(I) = ONEOF(.ST[I,LABTYPEF],BIT2(USERLABT,ROUTLABT))$,

    INDORMEMP(OPND) = ONEOF(.ST[OPND,ATYPE],BIT2(INDAT,MEMAT))$,
    REGORMEMP(OPND) = ONEOF(.ST[OPND,ATYPE],BIT2(REGAT,MEMAT))$,
    IMMORREGP(OPND) = ONEOF(.ST[OPND,ATYPE],BIT2(IMMEDAT,REGAT))$;


MACRO		! MISCELLANEOUS STUFF
    ADRPLIT(FORM,REG,TYPE,NAMETYPE,NAME) = PLIT(FORM^24+TYPE^21+REG^18+NAMETYPE^31+NAME,0)$,
    ADR1PLIT(FORM,REG,TYPE,NAMETYPE,NAME) = PLIT(FORM^24+TYPE^21+REG^18+NAMETYPE^31+NAME,1)$,
    BUILDOPD(TYP,MD,REG,OPRND)=((TYP)^POSTYPEF OR (MD)^POSMODEF OR (REG)^POSREGF OR (OPRND AND #777777))$,
    CCSHIFT(X) = ((X)^9)$,
    CONTLOOP = EXITBLOCK$,
    COPYADR(X,Y) = ((X)<0,36>_.(Y)<0,36>; (X+1)<0,36>_.(Y+1)<0,36>)$,
    DUMMYBLOCK = BIND ZZZZZZZZZZ=0;$,
    DXWD(A) = XWD(A,A)$,
    ELSF = ELSE IF$,
    EQLFS(I,J,F) = (.ST[I,F] EQL .ST[J,F])$,
    EXTENDBIT(VAL,NB) = ((VAL)^(36-(NB))/1^(36-(NB)))$,
    FMSK(P,S) = ((1^(S)-1)^(P))$,
    LABNAME(TYP,IDEN) = XWD(TYP,IDEN)$,
    LCCROUT(NAME,DIR,PRED) =
        ROUTINE NAME(I) =
          BEGIN
            UNTIL (I_.ST[.I,DIR];PRED(.I)) DO;
            RETURN .I
          END$,
    LF = 18,18$,
    NAMF = LF$,
    OFFSF = RF$,
    PLITLEN(P) =(@(P-1))$,
    REDUCEADR(X) = DELADR(SRCP(X),X); COPYADR(SRCP(X),DSTP(X))$,
    REVCOND(I) = (I XOR 1)$,
    RF = 0,18$,
    RMSK1(NB) = FMSK(0,NB)$,
    SETCHANGE = (CHANGE _ -1)$,
    THEF = THEN IF$,
    VS3(V1,V2,S2,V3,S3) = (VS2[VS2[V1,V2,S2],V3,S3])$,
    VS4(V1,V2,S2,V3,S3,V4,S4) = (VS2[VS3(V1,V2,S2,V3,S3),V4,S4])$,
    XWD(A,B) = (VS2[A,B,18])$;


STRUCTURE ADRVARSTR[I,P,S] = [ADRBLKSIZ] (.ADRVARSTR+.I)<.P,.S>;
STRUCTURE ARY2[L1,U1,L2,U2] =
    [(U1-L1+1)*(U2-L2+1)](.ARY2+(U2-L2+1)*(.L1-L1)+.U1-L2)<>;
STRUCTURE NORMALVEC[I] = [I] (.NORMALVEC + .I)<0,36>;
STRUCTURE STSTR[I,W,P,S] = (.I+.W)<.P,.S>;
STRUCTURE VECTOR[W,P,S] = (.(.VECTOR)<0,18>+.W)<.P,.S>;
STRUCTURE VS2S[V1,V2,S2] = .V1^.S2 OR .V2 AND FMSK(0,.S2);

MAP STSTR ST;

BIND VS2S VS2 = 0;