PROGRAM MAIN C C M68000 CROSS-ASSEMBLER MAIN PROGRAM C C C REVISION: C X1.0 (EXPERIMENTAL PRE-RELEASE) C C AUTHOR: C Allen Kossow C Department of Physiology C Medical College of Wisconsin C 8701 Watertown Plank Road C Milwaukee, WI 53226 C C SYMBOLS ARE A MAXIMUM OF EIGHT CHRS IN LENGTH C THERE CAN BE UP TO 512 SYMBOLS C C C.... LOGICAL UNIT DEFINITION C 1 = SOURCE FILE C 2 = OBJECT FILE C 3 = LIST FILE C 5 = KEYBD C C IMPLICIT INTEGER (A-Z) BYTE NAME(8),SYMFLG(513) C COMMON /LST/ LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT C COMMON /SYMT/STIND,SYMADR,PC,NOSYM,NEWPC,SYMFLG C COMMON /PRSE/ OPPTR,MODPTR,OPNPTR,LABEL,CMTPTR +,PRFLG,SCANPT,OPCLEN,OPNPT2,IMODE C COMMON /SRC/ LNELEN,ISERR,NOCARD,SRCLNE C COMMON /OBJOUT/ OBJBUF,OBJWC,LFLG,RFLG,DBFLG C COMMON /OPCPTS/ OPTYP,OPSKEL,OPSK2,OPIDX C COMMON /CNVT / WORD,PL C COMMON /HEXFLG/ ENDFLG,HEXWC,HEXPC,OLDPC C DIMENSION OBJBUF(40) C INTEGER*4 PC,NEWPC,SYMADR(512),HEXPC,OLDPC C BYTE ERR,SRCLNE(81),LABEL(8),PL(132) C C.... TELL FORTRAN TO IGNORE INTEGER OVERFLOWS ON MULTIPLY AND DIVIDE. C ERR=128 C C.... THE FOLLOWING CALL IS NO OP'ED OUT FOR F4P C C CALL SETERR(1,ERR) C C.... INITIALIZE VARIABLES C 5 NOPAGE=0 RFLG=1 LFLG=1 C C.... OPEN FILES C CALL SOURCE(1) CALL LIST(1) CALL OBJECT(1) C C.... DO PASS 1 C 1 NOSYM=0 PASS=1 CALL I4CLR(PC) DO 10 I=1,8 NAME(I)=32 10 CONTINUE C C.... READ ONE LINE OF SOURCE FILE C 15 CALL I4CLR(NEWPC) CALL SOURCE(2) C C.... IF EOF DETECTED DO PASS 2 C IF(ISERR.EQ.1) GOTO 20 C C.... RESET MULTIPLE ERROR FLG C MEFLG = 0 C C.... PARSE SOURCE LINE C CALL PARSE C C.... IF NULL LINE GET NEXT LINE C IF(PRFLG.EQ.0) GOTO 15 C C.... PROCESS SOURCE LINE C CALL PRCESS C C.... IF END DETECTED DO PASS 2 ELSE GET NEXT LINE C IF(ISERR.EQ.1) GOTO 20 I=JADD(PC,NEWPC,PC) GOTO 15 C C.... DO PASS 2 C C C.... REW SOURCE SET TO PASS 2 AND RESET PC C 20 CALL SOURCE(3) PASS=2 IERCNT = 0 CALL I4CLR(PC) CALL I4CLR(HEXPC) CALL I4CLR(OLDPC) C C.... FLUSH PRINT BUFFER IN CASE ANYTHING LEFT C.... FROM LAST ASSEMBLY C DO 25 I=1,132 25 PL(I) = "40 C C.... INITIALIZE OBJECT BUFFER C ENDFLG = 0 HEXWC = 0 C C.... PRINT FIRST PAGE HEADING C CALL NEWPAG 30 CALL I4CLR(NEWPC) OBJWC = 0 CALL SOURCE(2) C C.... EOF DETECTED C IF(ISERR.EQ.1) GOTO 50 C C.... RESET MULTIPLE ERROR FLG C MEFLG = 0 C C.... PARSE LINE C CALL PARSE C C.... PRINT A LINE OF ONLY COMMENTS NORMALLY C IF(CMTPTR.EQ.1) GOTO 40 C C.... CHECK FOR PARSING ERRORS C IF(PRFLG.EQ.0) GOTO 30 C C.... PROCESS IT C 38 CALL PRCESS C C.... GENERATE LISTING C 40 CALL LSTLNE C C.... CHECK IF THERE IS OBJ CODE TO GENERATE C IF(OBJWC.EQ.0) GOTO 45 CALL BLDOBJ C C.... DO NEXT LINE IF NOT END C 45 IF(ISERR.EQ.1) GOTO 50 I=JADD(PC,NEWPC,PC) GOTO 30 C C.... END OF ASSEMBLY, OUTPUT BALANCE OF OBJ BUFFER C 50 ENDFLG = 1 CALL BLDOBJ C C.... PRINT SYMBOL TABLE C CALL PST C C.... CLOSE FILES AND DO IT AGAIN C CALL SOURCE(4) CALL LIST(2) CALL OBJECT(2) GOTO 5 END SUBROUTINE SOURCE(ICODE) C C PERFORMS ALL OPERATIONS OF SOURCE INPUT FILE C C INPUT: C ICODE = 1 => OPEN SOURCE FILE (NAME READ FROM KEYBOARD) C 2 => READ ONE LINE FROM SOURCE FILE INTO C 'SRCLNE' (80R1 FORMAT). TRAILING BLANKS C ARE DELETED. ZERO CHAR IS INSERTED AT C THE END OF THE LINE. C 3 => REWIND SOURCE FILE. C 4 => CLOSE SOURCE FILE. C C OUTPUT: C SRCLNE = SOURCE LINE FOR CODE 2 C LNELEN = LENGTH OF LINE FOR CODE 2 C ISERR = 1 IF END OF FILE ON READ (ZERO OTHERWISE) C NOCARD = CARD NUMBER READ FROM SOURCE (1-?) C BYTE FILNAM(12) BYTE SRCLNE(81) COMMON/SRC/LNELEN,ISERR,NOCARD,SRCLNE COMMON /FNAM/ FILNAM,OBJFLG C C SELECT FUNCTION C GO TO (100,200,300,400),ICODE C C OPEN SOURCE FILE C 100 TYPE 110 110 FORMAT('$Src file name: ') READ (5,120) ICNT,FILNAM 120 FORMAT(Q,12A1) IF(ICNT.EQ.0) STOP CALL ASSIGN(1,FILNAM,ICNT) NOCARD=0 GOTO 500 C C READ SOURCE LINE C 200 ISERR=0 READ(1,210,END=250) (SRCLNE(I),I=1,80) 210 FORMAT(80A1) NOCARD=NOCARD+1 C C CONVERT ALL CHARACTERS C DO 225 I=1,80 IF(SRCLNE(I).GE.32) GO TO 220 215 SRCLNE(I)=32 GO TO 225 220 IF(SRCLNE(I).LT.96) GO TO 225 SRCLNE(I)=SRCLNE(I)-32 IF(SRCLNE(I).GE.96) GO TO 215 225 CONTINUE C C REMOVE TRAILING BLANKS C LNELEN=80 230 IF(SRCLNE(LNELEN).NE.32) GO TO 240 LNELEN=LNELEN-1 IF(LNELEN.GT.0) GO TO 230 240 LNELEN=LNELEN+1 SRCLNE(LNELEN)=0 GO TO 500 C C END OF FILE C 250 ISERR=1 GO TO 500 C C REWIND SOURCE FILE C 300 REWIND 1 NOCARD=0 GO TO 500 C C CLOSE SOURCE FILE C 400 CLOSE(UNIT=1) 500 RETURN END SUBROUTINE LIST(LCODE) C C PERFORMS OPEN AND CLOSE ON LIST FILE C C INPUT:LCODE = 1 => OPEN FILE (NAME READ FROM KEYBOARD) C 2 => CLOSE FILE C BYTE FILNAM(12) INTEGER PASS BYTE NAME(8) C COMMON /LST/ LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT C COMMON /FNAM/ FILNAM,OBJFLG C C SELECT FUNCTION C GO TO (100,200),LCODE C C.... ASSIGN DEFAULT LISTING TO CONSOLE C 100 LUNIT=5 TYPE 110 110 FORMAT('$Lst file name: ') READ (5,115) ICNT,FILNAM 115 FORMAT(Q,12A1) IF(ICNT.EQ.0) GOTO 116 C C.... IF THERE IS A FILENAME ASSIGN LISTING TO LUN 3 C LUNIT = 3 CALL ASSIGN(LUNIT,FILNAM,ICNT) 116 NOPAGE=0 GO TO 300 C C CLOSE FILE C 200 IF(LUNIT.EQ.5) RETURN CALL CLOSE(LUNIT) 300 RETURN END SUBROUTINE OBJECT(ICODE) C C PERFORMS OPEN AND CLOSE ON OBJECT FILE C BYTE FILNAM(12) INTEGER PASS BYTE NAME(8) COMMON /LST/ LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT COMMON /FNAM/ FILNAM,OBJFLG GOTO (100,200),ICODE 100 TYPE 110 110 FORMAT ('$Obj file name: ') READ (5,115) ICNT,FILNAM 115 FORMAT(Q,12A1) IF(ICNT .EQ.0) GOTO 116 CALL ASSIGN(2,FILNAM,ICNT) OBJFLG = 1 RETURN 116 OBJFLG = 0 RETURN 200 IF(OBJFLG.EQ.0) RETURN CALL CLOSE(2) RETURN END SUBROUTINE SYMTBL(ICODE,IADDR,SYMSTR) C C SYMBOL TABLE PROCESSOR C C INPUT: C ICODE = 1 => FIND OPERAND IN SYMBOL TABLE. IF NOT FOUND, C IT IS ENTERED INTO THE TABLE AS REFERENCED C BUT NOT DEFINED. THE INDEX OF THE SYMBOL C IN THE SYMBOL IS RETURNED IN 'STIND'. C C 2 => FIND LABEL IN SYMBOL TABLE. IF FOUND AND ALREADY C DEFINED AND THIS IS THE FIRST PASS OF THE C ASSEMBLER, THE MULTIPLE DEFINED BIT IS SET IN C SYMFLG. IF FOUND BUT ONLY PREVIOUSLY REFERENCED, C THE DEFINED BUT PREVIOUSLY REFERENCED BIT IS SET C AND THE REFERENCED BIT IS CLEARED. IF NOT FOUND, C IT IS ENTERED AND THE DEFINED BIT IS SET. C C IADDR = ADDRESS OF SYMBOL FOR ENTERING INTO SYMBOL TABLE. C SYMBOL= SYMBOL TO LOOK UP OR ENTER IN SYMBOL TABLE. C C OUTPUT: C STIND = INDEX INTO SYMBOL TABLE FOR SYMBOL. C C FORMAT OF 'SYMFLG': C C BIT MEANING IF SET C 0 SYMBOL HAS BEEN REFERENCED BUT NOT DEFINED. C 1 SYMBOL HAS BEEN DEFINED AND WAS REFERENCED BEFORE DEFINITION. C 2 SYMBOL HAS BEEN DEFINED AND THERE WERE NO REFERENCES BEFORE. C 3 SYMBOL HAS BEEN MULTIPLE DEFINED. C 4 SYMBOL IS AN EQUATED VALUE C IMPLICIT INTEGER (A-Z) BYTE SYMFLG(513),SYMSTR(8),SRCLNE(81) DIMENSION SYMSYM(4,512),SYMBOL(4),SYMLIN(512) INTEGER*4 SYMADR(512),IADDR INTEGER*4 PC,NEWPC COMMON/SYMT/STIND,SYMADR,PC,NOSYM,NEWPC,SYMFLG BYTE NAME(8) COMMON /LST/ LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT COMMON /SRC/ LNELEN,ISERR,NOCARD,SRCLNE COMMON/SYMN/SYMSYM,SYMLIN C C PACK SYMBOL TWO BYTES TO A WORD C DO 100 J=1,4 I = J*2 100 SYMBOL(J) = ((SYMSTR(I-1)*256).OR.SYMSTR(I)) C C SEARCH FOR SYMBOL IN SYMBOL TABLE C STIND = 1 MOVFLG = 0 IF(NOSYM.EQ.0) GO TO 200 DO 120 STIND=1,NOSYM DO 110 J=1,4 IF(SYMSYM(J,STIND).NE.SYMBOL(J)) GO TO 115 110 CONTINUE GO TO 300 115 DO 118 J=1,4 IF (SYMSYM(J,STIND).LT.SYMBOL(J)) GOTO 120 IF (SYMSYM(J,STIND).EQ.SYMBOL(J)) GOTO 118 MOVFLG = 1 GOTO 200 118 CONTINUE 120 CONTINUE C C SYMBOL WAS NOT FOUND C 200 IF(NOSYM.LT.513) GO TO 210 CALL ERROR(221) STIND=513 GOTO 400 210 IF (MOVFLG.EQ.0) GOTO 218 ITEMP = NOSYM 211 DO 212 J=1,4 212 SYMSYM(J,ITEMP+1) = SYMSYM(J,ITEMP) CALL JMOV (SYMADR(ITEMP),SYMADR(ITEMP+1)) SYMFLG(ITEMP+1) = SYMFLG(ITEMP) SYMLIN(ITEMP+1) = SYMLIN(ITEMP) ITEMP = ITEMP - 1 IF (ITEMP.GE.STIND) GOTO 211 218 NOSYM = NOSYM + 1 DO 220 J = 1,4 220 SYMSYM (J,STIND) = SYMBOL(J) IF(ICODE.EQ.1) GO TO 250 SYMFLG(STIND)=4 CALL I4CLR(SYMADR(STIND)) I=JADD(SYMADR(STIND),IADDR,SYMADR(STIND)) SYMLIN(STIND) = NOCARD GOTO 400 250 CALL I4CLR(SYMADR(STIND)) SYMFLG(STIND)=1 SYMLIN(STIND) = 0 GOTO 400 C C SYMBOL FOUND C 300 IF(PASS.EQ.2.OR.ICODE.EQ.1) GOTO 400 IF(SYMFLG(STIND).NE.1) GO TO 310 SYMFLG(STIND)=2 CALL I4CLR(SYMADR(STIND)) I=JADD(SYMADR(STIND),IADDR,SYMADR(STIND)) SYMLIN(STIND) = NOCARD GOTO 400 310 SYMFLG(STIND)=SYMFLG(STIND).OR.8 400 RETURN END SUBROUTINE CNVHEX(INDEX) C C CONVERTS 4 BITS TO HEX ASCII AND INSERTS INTO 'PL' AT 'INDEX' C C INPUT: WORD = VALUE C INDEX= WHERE TO INSERT IN PL C C OUTPUT: C WORD = WORD/16 C BYTE PL(132),DIG INTEGER WORD COMMON /CNVT/ WORD,PL CALL GETBIT(WORD,DIG) PL(INDEX)=DIG RETURN END SUBROUTINE INSDAT(IPL,IDIG) C C CONVERTS BINARY DATA TO HEX ASCII AND INSERTS INTO 'PL' C C INPUT:IPL = INDEX TO INSERT INTO PL C IDIG= NUMBER OF DIGITS TO CONVERT AND INSERT C WORD= VALUE TO CONVERT (IN COMMON - NOT REFERENCED HERE) C I=IDIG 5 J=IPL+I-1 CALL CNVHEX(J) I=I-1 IF(I.LE.0) RETURN GO TO 5 END SUBROUTINE IHX(ISZ,IDTA,IPPOS) C C PRINT A 4 OR 8 DIGIT HEX VALUE C NUMBER OBTAINED STARTING AT 'WORD' C AND PUT INTO PRINT BUFFER 'PL' STARTING IN COL 1 C IMPLICIT INTEGER (A-Z) COMMON /CNVT/ WORD,PL COMMON /LST/LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT BYTE PL(132),NAME(8) DIMENSION IDTA(3) PL(1)=32 IF(ISZ.EQ.2) GOTO 15 WORD=IDTA(1) CALL INSDAT(IPPOS,4) RETURN 15 WORD=IDTA(2) CALL INSDAT(IPPOS,4) WORD=IDTA(1) CALL INSDAT(IPPOS+4,4) RETURN END SUBROUTINE PST C C SORT AND PRINT SYMBOL TABLE C INTEGER PASS,STIND,SYMLIN(512) INTEGER*4 PC,NEWPC,SYMADR(512) BYTE NAME(8),SYMSYM(8,512),SYMFLG(513),PL(132) COMMON/LST/LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT COMMON/SYMN/SYMSYM,SYMLIN COMMON/SYMT/STIND,SYMADR,PC,NOSYM,NEWPC,SYMFLG COMMON /CNVT/ WORD,PL IF(NOSYM.EQ.0) RETURN C C START OUT WITH CLEAN BUFFER C DO 50 I = 1,132 50 PL(I) = "40 C C GOTO TOP OF PAGE C CALL NEWPAG C C GENERATE THE SYMBOL LIST A LINE AT A TIME C DO 300 I = 1,NOSYM,5 DO 210 IDX=0,4 IF (I+IDX.GT.NOSYM) GOTO 290 DO 170 IPT=1,7,2 PL(IPT+(IDX*24)+1) = SYMSYM(IPT,(I+IDX)) 170 PL(IPT+(IDX*24)) = SYMSYM(IPT+1,(I+IDX)) CALL IHX(2,SYMADR(I+IDX),(IDX*24)+12) IFTMP = SYMFLG(I+IDX) IF ((IFTMP.AND.16).NE.16 ) GOTO 180 PL((IDX*24)+19) = 'E' PL((IDX*24)+20) = 'Q' 180 IF ((IFTMP.AND.8).NE.8 ) GOTO 190 PL((IDX*24)+19) = 'M' PL((IDX*24)+20) = 'U' 190 IF ((IFTMP.AND.1).NE.1) GOTO 200 PL((IDX*24)+19) = 'U' PL((IDX*24)+20) = 'N' 200 IF ((IFTMP.AND."31).NE.0) GOTO 210 PL((IDX*24)+19) = ' ' PL((IDX*24)+20) = ' ' 210 CONTINUE 290 WRITE (LUNIT,400) (PL(N),N=1,IDX*24) NOLINE = NOLINE -1 CALL PAGCHK 300 CONTINUE 400 FORMAT (' ',132A1) WRITE (LUNIT,410) NOSYM,IERCNT 410 FORMAT (/,' ',I3,' SYMBOLS , ',I3,' ERRORS DETECTED') IF (LUNIT.EQ.5) RETURN WRITE (5,410) NOSYM,IERCNT RETURN END SUBROUTINE NEWPAG IMPLICIT INTEGER (A-Z) C C PUTS OUT HEADERS AT TOP OF EACH PAGE C INTEGER PASS BYTE NAME(8),FF COMMON /LST/ LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT FF="14 NOPAGE=NOPAGE+1 NOLINE = 57 IF(NOPAGE.EQ.1) FF = 0 WRITE(LUNIT,10)FF,NAME,NOPAGE 10 FORMAT(' ',1A1,8A1,T28,'M68000 CROSS-ASSEMBLER X1.0 +',T83,'PAGE ',I3,/) RETURN END SUBROUTINE PAGCHK IMPLICIT INTEGER (A-Z) C C CHECKS TO SEE IF A PAGE HAS BEEN FILLED C BYTE NAME(8) COMMON /LST/ LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT IF(NOLINE.EQ.0) CALL NEWPAG RETURN END SUBROUTINE ERROR(IERR) IMPLICIT INTEGER(A-Z) C C AND PRINTS ERROR MESSAGE DURING PASS 2 C COMMON /LST/ LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT COMMON /SRC/ LNELEN,ISERR,NOCARD,SRCLNE COMMON /PRSE/ OPPTR,MODPTR,OPNPTR,LABEL,CMTPTR +,PRFLG,SCANPT,OPCLEN,OPNPT2,IMODE COMMON /OBJOUT/ OBJBUF,OBJWC,LFLG,RFLG,DBFLG DIMENSION OBJBUF(40) COMMON /SYMT/STIND,SYMADR,PC,NOSYM,NEWPC,SYMFLG INTEGER*4 PC,NEWPC,SYMADR(512) LOGICAL*1 SYMFLG(513),ERRPTR(80),NAME(8),SRCLNE(81) LOGICAL*1 LABEL(8) C C.... ERRORS ARE IGNORED DURING THE FIRST PASS C IF(PASS.EQ.1) RETURN C PRFLG = 3 C C.... WE NEED AT LEAST THREE LINES TO PRINT AN BAD LINE C IF(NOLINE.LE.2) NOLINE = 0 CALL PAGCHK C C.... IF THIS IS NOT THE FIRST ERROR THEN DON'T PRINT THE LINE C IF (MEFLG.EQ.1) GOTO 15 WRITE(LUNIT,10) NOCARD,(SRCLNE(I),I=1,LNELEN-1) 10 FORMAT(' ',/,' ',I4,35X,80A1:) NOLINE = NOLINE - 2 15 DO 20,I=1,SCANPT 20 ERRPTR(I)="40 ERRPTR(I)="136 WRITE(LUNIT,30) IERR,(ERRPTR(I),I=1,SCANPT+1) 30 FORMAT(' ++++ ERROR ',I3,20X,80A1:) NOLINE = NOLINE - 1 IERCNT = IERCNT + 1 MEFLG = 1 RETURN END SUBROUTINE LSTLNE IMPLICIT INTEGER (A-Z) C C BUILD LINE (OR LINES IF DC.B DC.W DC.L) C FOR DISPLAY C COMMON /SRC/ LNELEN,ISERR,NOCARD,SRCLNE C COMMON /CNVT/ WORD,PL C COMMON /LST/ LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT C COMMON /OBJOUT/ OBJBUF,OBJWC,LFLG,RFLG,DBFLG C COMMON /SYMT/ STIND,SYMADR,PC,NOSYM,NEWPC,SYMFLG C COMMON /PRSE/ OPPTR,MODPTR,OPNPTR,LABEL,CMTPTR +,PRFLG,SCANPT,OPCLEN,OPNPT2,IMODE C INTEGER*4 PC,NEWPC,SYMADR(512) DIMENSION OBJBUF(40) BYTE SYMFLG(513),NAME(8),LABEL(8),SRCLNE(81),PL(132) DATA PL/132*"40/ C C PRFLG = 0 ERRORS DETECTED (PRINT LINE AS READ) C 1 NO ERRORS DETECTED (PRINT NORMALLY) C 2 DC.W / DC.L DIRECTIVES C 3 SUPRESS PRINTOUT OF LINE C 4 DC.B DIRECTIVE C 5 NAM / END / MON DIRECTIVES C 6 EQU / SET DIRECTIVES C 7 ORG / RORG DIRECTIVES C 8 DS DIRECTIVE C 9 PAGE DIRECTIVE C C C C IF THIS IS THE FIRST PASS, THEN DONT PRINT ANYTHING C IF (PASS.EQ.1) RETURN C C IF CODE IS LONGER THAN FIVE WORDS THEN C ONLY PRINT 5 WORDS OF AN INSTRUCTION C LSWRDS = OBJWC IF(OBJWC.GT.5) LSWRDS=5 C C CHECK IF WE HAVE TO GO TO NEXT PAGE C CALL PAGCHK C C IF(CMTPTR.NE.1)GOTO 80 OPPTR=1 GOTO 220 80 GOTO (200,200,200,410,500,600,200,200,200,400),PRFLG+1 200 CALL IHX(2,PC,7) C C IF(LSWRDS.EQ.0) GOTO 212 205 DO 210,I=1,LSWRDS 210 CALL IHX(1,OBJBUF(I),11+(5*I)) C C 212 IF(LABEL(1).EQ.0) GOTO 220 DO 215,I=1,8 215 PL(I+40)=LABEL(I) 220 J=0 DO 230 I=OPPTR,LNELEN PL(J+50)=SRCLNE(I) IF(SRCLNE(I).EQ."40) GOTO 240 230 J=J+1 GOTO 1000 240 III=0 DO 250 II=I+1,LNELEN IF (II.EQ.CMTPTR) III = 25 PL(57+III)=SRCLNE(II) III = III + 1 250 IF ((III + 57).GT.132) GOTO 255 GOTO 1000 255 PL(132) = 0 GOTO 1000 C C PRFLG = 3 (NEW PAGE) C 400 CALL NEWPAG 410 RETURN C C 500 GOTO 205 C C 600 GOTO 220 C C 700 CALL IHX(2,OBJBUF(2),16) GOTO 212 C C 1000 DO 1001 I=48,132 1001 IF(PL(I).EQ.0)GOTO 1002 1002 WRITE(LUNIT,1110) NOCARD,(PL(II),II=6,I-1) 1110 FORMAT(' ',I4,132A1) DO 1120 II = 1,I 1120 PL(II) = "40 NOLINE = NOLINE - 1 RETURN END SUBROUTINE BLDOBJ IMPLICIT INTEGER (A-Z) C C BUILD OBJ FILE C COMMON /FNAM / FILNAM,OBJFLG C COMMON /OBJOUT/ OBJBUF,OBJWC,LFLG,RFLG,DBFLG C COMMON /CNVT / WORD,PL C COMMON /SYMT / STIND,SYMADR,PC,NOSYM,NEWPC,SYMFLG C COMMON /HEXFLG/ ENDFLG,HEXWC,HEXPC,OLDPC C DIMENSION OBJBUF(40),HEXBUF(8) INTEGER*4 PC,NEWPC,SYMADR(512),OLDPC,NEWVAL,HEXPC LOGICAL*1 SYMFLG(513),PL(132),FILNAM(12) C C CHECK IF OBJ FILE IS TO BE GENERATED C IF (OBJFLG.EQ.0) RETURN C C CHECK FOR THE END OF ASSEMBLY FLAG C IF IT IS SET, WRITE OUT THE BALANCE OF THE OBJ BUFFER C IF (ENDFLG.EQ.0) GOTO 10 IF (HEXWC.NE.0) CALL WRTOBJ(HEXPC,HEXWC,HEXBUF) RETURN C C CHECK THE CURRENT VALUE OF THE PC WITH THAT OF THE ONE SAVED C IF THE TWO ARE NOT EQUAL, THEN WRITE OUT THE BALANCE OF THE C OBJ BUFFER AND START AT THE NEW PC VAL C 10 CALL DBLSGL(PC,PC1,PC2) CALL DBLSGL(OLDPC,OLDPC1,OLDPC2) IF (PC1.NE.OLDPC1) GOTO 50 IF (PC2.EQ.OLDPC2) GOTO 75 50 IF (HEXWC.NE.0) CALL WRTOBJ(HEXPC,HEXWC,HEXBUF) CALL JMOV(PC,HEXPC) CALL JMOV(PC,OLDPC) C C EXTRACT OBJECT WORDS FROM OBJECT BUFFER AND C PUT THEM INTO AN INTERNAL BUFFER. IF THE C INTERNAL BUFFER IS FULL, THEN OUTPUT THE BUFFER. C 75 I = 1 76 HEXWC = HEXWC + 1 HEXBUF(HEXWC) = OBJBUF(I) IF (HEXWC.NE.8) GOTO 99 C C.... OBJECT BUFFER IS FULL, OUTPUT IT TO OBJ FILE C CALL WRTOBJ(HEXPC,HEXWC,HEXBUF) C C CALCULATE NEW STARTING PC FOR HEX BUFFER C N = JICVT(I*2,NEWVAL) N = JADD(PC,NEWVAL,HEXPC) 99 I = I + 1 IF (I.LE.OBJWC) GOTO 76 C C CALCULATE WHAT THE NEW PC SHOULD BE BY ADDING C THE OBJECT WORD COUNT TO THE CURRENT PC C I = JADD(OLDPC,NEWPC,OLDPC) RETURN END SUBROUTINE WRTOBJ(HEXPC,HEXWC,HEXBUF) IMPLICIT INTEGER(A-Z) C C OUTPUT THE CONTENTS OF THE OBJECT BUFFER C C HEXPC = STARTING PC FOR BUFFER C HEXWC = NUMBER OF WORDS USED IN BUFFER C HEXBUF= 8 WORD OBJECT BUFFER C COMMON /CNVT/ WORD,PL LOGICAL*1 PL(132) INTEGER*4 HEXPC DIMENSION HEXBUF(8) DO 10, I = 1,80 10 PL(I) = "40 CALL IHX(2,HEXPC,1) PLIDX = 10 DO 20,I=1,HEXWC 20 CALL IHX(1,HEXBUF(I),PLIDX+(5*(I-1))) WRITE (2,100)(PL(I),I=3,10+(5*HEXWC)) 100 FORMAT(' ',80A1) HEXWC = 0 DO 900, I = 1,80 900 PL(I) = "40 RETURN END SUBROUTINE PRCESS C C PROCESSES SOURCE LINE AFTER IT HAS BEEN PARSED BY PARSE C C INPUT:PARSE OUTPUTS C C OUTPUT: C C OBJWC NUMBER OF WORDS REQUIRED FOR INSTRUCTION C C OBJBUF TABLE OF WORDS GENERATED C C PRFLG 0 ERRORS DETECTED (PRINT LINE AS READ C 1 NO ERRORS DETECTED (PRINT NORMALLY) C 2 DC.W/DC.L DIRECTIVES C 3 DONT PRINT LINE C 4 DC.B DIRECTIVE C 5 NAM/END/MON DIRECTIVES C 6 EQU/SET DIRECTIVE C 7 ORG/RORG DIRECTIVE C 8 DS DIRECTIVE C 9 PAGE DIRECTIVE C C NEWPC NEW VALUE FOR PC C C C OP1EA 0 NOT REG OR IMMEDIATE DATA C 1 D REG C 2 A REG C 3 (AN) C 4 (AN)+ C 5 -(AN) C 6 # DATA C 7 SR C 8 CCR C 9 USP C 10 ERROR DETECTED C C IMODE 0 NO SIZE SPECIFIED (DEFAULT IS WORD) C 1 .B C 2 .W C 3 .L C 4 .S (SHORT BRANCH) C C ERRORS DEFINED..... C C 400 UNDEFINED OPCODE C 401 OPERAND MISSING FOR OPCODE C 402 NO ORG SPECIFIED FOR ORG INSTRUCTION C 403 ERROR IN DC OPN VALUE C 406 GENERAL ERROR IN DECODING C 407 UNDEFINED SYMBOL C 408 ERROR IN SIZE OF Y(Ax,Rx) INDEX C 409 MULT DEFN SYMBOL C IMPLICIT INTEGER (A-Z) C COMMON /OPWD / OPNFLG,OPNWC,OPNWRD C COMMON /LST / LUNIT,PASS,NAME,NOPAGE,NOLINE,MEFLG,IERCNT C COMMON /OBJOUT/ OBJBUF,OBJWC,LFLG,RFLG,BRFLG C COMMON /SRC / LNELEN,ISERR,NOCARD,SRCLNE C COMMON /SYMT / STIND,SYMADR,PC,NOSYM,NEWPC,SYMFLG C COMMON /PRSE / OPPTR,MODPTR,OPNPTR,LABEL,CMTPTR +,PRFLG,SCANPT,OPCLEN,OPNPT2,IMODE C COMMON /OPCPTS/ OPTYP,OPSKEL,OPSK2,OPIDX C INTEGER*4 PC,NEWPC,SYMADR(512),SYMVAL,TMPVAL,J2 LOGICAL*1 SRCLNE(81),LABEL(8),NAME(8),SYMFLG(513) DIMENSION OBJBUF(40),OPNWRD(3) C C.... SET UP FLAGS THAT CHANGE EACH TIME THRU C CALL I4CLR(NEWPC) J2 = 2 OP1EA = 0 OP2EA = 0 OP1DA = 0 OP2DA = 0 OPNWC = 0 C C.... DECODE OPCODE C CALL DECOPC IF(OPTYP.NE.0) GOTO 10 CALL ERROR(400) RETURN C C.... SKIP IF NO OPERANDS C 10 IF(OPNPTR.EQ.0)GOTO 20 C C.... DECODE FIRST OPERAND C OP1EA=OPNPTR CALL EATYP(OP1EA,OP1DA) IF(OPNPT2.EQ.0)GOTO 20 C C.... DECODE SECOND OPERAND C OP2EA=OPNPT2 CALL EATYP(OP2EA,OP2DA) C C.... CHECK FOR OPERANDS C 20 IF(OP1EA.EQ.10.OR.OP2EA.EQ.10) GOTO 8500 IF(OPTYP.EQ.1.OR.OPTYP.EQ.2) GOTO 90 IF(OPNPTR.NE.0) GOTO 90 CALL ERROR(401) RETURN C C.... DEFAULT SIZE IS ONE WORD FOR INSTRUCTIONS C 90 OBJWC=1 C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C GOTO OPCODE EVALUATION ROUTINES VIA OPTYPE C C ++++++++++++++++++++++++++++++++++++++++++++++++++ GOTO(100,200,300,500,400,600,700,800,900,1000 +,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100),OPTYP C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C PROCESS PSEUDO OPS C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C.... PSEUDO OPS NORMALLY DON'T GENERATE CODE C.... THE EXECEPTION BEING 'DC' C 100 OBJWC=0 GOTO(110,120,130,140,150,195,150,160,170,180,190),OPIDX C C DC C 110 PRFLG=2 IFLG = RFLG RFLG = 1 111 CALL PROCOP(OPNPTR) IF(OPNWC.EQ.0) GOTO 115 IF(IMODE.EQ.3) OBJWC = OBJWC+2 IF(IMODE.NE.3) OBJWC = OBJWC+1 IF(IMODE.EQ.3) OBJBUF(OBJWC-1) = OPNWRD(3) IF(IMODE.EQ.3) OBJBUF(OBJWC ) = OPNWRD(2) IF(IMODE.NE.3) OBJBUF(OBJWC ) = OPNWRD(2) IF(SRCLNE(OPNPTR).NE."54) GOTO 119 OPNPTR = OPNPTR+1 GOTO 111 115 CALL ERROR(403) 118 RFLG = IFLG GOTO 7000 119 IF(IMODE.NE.1.OR.OPNWRD(2).GE.256) GOTO 118 OBJBUF(OBJWC)=(OBJBUF(OBJWC)*"400) GOTO 118 C C DS C 120 PRFLG=7 IF(OPNPTR.EQ.0) GOTO 8500 CALL PROCOP(OPNPTR) IF(OPNWC.EQ.7) GOTO 134 IF(IMODE.EQ.1) GOTO 122 IF(IMODE.NE.3) GOTO 125 I=JICVT(4,NEWPC) I=JMUL(NEWPC,OPNWRD(2),NEWPC) GOTO 128 122 I=JMOV(OPNWRD(2),NEWPC) GOTO 128 125 I=JICVT(2,NEWPC) I=JMUL(NEWPC,OPNWRD(2),NEWPC) 128 I=JMOV(PC,OBJBUF(2)) I=JMOV(PC,SYMVAL) GOTO 7005 C C ORG C 130 IF(LABEL(1).EQ.0) GOTO 132 131 CALL ERROR(402) RETURN C 132 RFLG=1 133 PRFLG=7 IF(OPNPTR.NE.0) GOTO 134 CALL I4CLR(NEWPC) CALL I4CLR(PC) RETURN 134 CALL PROCOP(OPNPTR) IF(OPNWC.EQ.7) GOTO 135 CALL I4CLR(PC) I=JADD(NEWPC,OPNWRD(2),NEWPC) RETURN 135 CALL ERROR(403) RETURN C C END C 140 ISERR=1 IF(LABEL(1).NE.0) GOTO 131 PRFLG=5 RETURN C C EQU C 150 IF(LABEL(1).EQ.0) GOTO 131 PRFLG=6 IF(OPNPTR.EQ.0) GOTO 8500 CALL PROCOP(OPNPTR) IF(OPNWC.EQ.7) RETURN CALL SYMTBL(2,OPNWRD(2),LABEL) IF((SYMFLG(STIND).AND."10).EQ."10)CALL ERROR(409) I=JMOV(OPNWRD(2),SYMADR(STIND)) SYMFLG(STIND)=SYMFLG(STIND).OR.16 I=JMOV(SYMADR(STIND),OBJBUF(2)) RETURN C C RORG C 160 IF(LABEL(1).NE.0) GOTO 131 RFLG=0 GOTO 133 C C PAGE C 170 IF(LABEL(1).NE.0)GOTO 131 LFLG=0 PRFLG=9 RETURN C C LIST C 180 IF(LABEL(1).NE.0)GOTO 131 LFLG=1 PRFLG=3 RETURN C C NLIST C 190 IF(LABEL(1).NE.0) GOTO 131 LFLG=0 PRFLG=3 RETURN C C NAM C 195 IF(LABEL(1).NE.0) GOTO 131 DO 197 I=1,8 197 NAME(I)="40 N=1 DO 196 I=OPNPTR,OPNPTR+7 NAME(N)=SRCLNE(I) N=N+1 196 IF(I.EQ.LNELEN-1) RETURN RETURN C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C PROCESS INHERENT INSTRUCTIONS..IE NOP C C ++++++++++++++++++++++++++++++++++++++++++++++++++ 200 OBJBUF(1)=OPSKEL GOTO 7000 C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C PROCESS MOVE INSTRUCTION C , SR, ,CCR ,SR USP,An An,USP C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C.... LOOK FOR OBVIOUS MISTAKES C 300 IF(OP2EA .EQ.6.OR.OP1EA .EQ.8) GOTO 8500 IF(OP1EA.EQ.9 .AND.OP2EA.NE.2) GOTO 8500 IF(OP1EA.NE.2 .AND.OP2EA.EQ.9) GOTO 8500 IF(OPNPTR.EQ.0.OR.OPNPT2.EQ.0) GOTO 8500 C C.... SR, - USP, C IF(OP1EA.EQ.7.OR. OP1EA.EQ.9) GOTO 350 C C.... OP1EA = 1 THRU 5 C IF((OP1EA.GE.1).AND.(OP1EA.LE.5)) GOTO 305 C C.... PROCESS FIRST OPN HERE IF COMPLEX C CALL PROCOP(OPNPTR) C C.... CHECK FOR EA TYPES 7-9 C 303 IF(OP2EA.GT.6) GOTO 340 C C.... CHECK FOR FIRST OPERAND IMMEDIATE MODE ADDRESSING C IF (OP1EA.NE.6) GOTO 304 C C.... SKIP MOVQ IF FWD REF SYMBOL C IF(OPNFLG.EQ.1) GOTO 304 ! CANNOT BE FWD REF SYM IF(IMODE .NE.3) GOTO 304 ! MUST BE .L MODE IF(OPNWRD(3).EQ. 0) GOTO 301 ! HI WORD MUST BE ZERO IF(OPNWRD(3).EQ.-1) GOTO 301 ! OR MINUS ONE GOTO 304 C C.... CHECK IF VAL WITHIN RANGE FOR MOVEQ (+/- 128) C.... ALSO CHECK IF DESTINATION IS A DATA REGISTER C 301 I=ICKVAL(OPNWRD(2)) IF ((I.EQ.0).AND.(OP2EA.EQ.1)) GOTO 330 C C.... ADD IN OPCODE SIZE BITS C 304 OBJBUF(1)=OBJBUF(1).OR."30000 IF(IMODE.EQ.1) OBJBUF(1)=(OBJBUF(1)).AND."17777 IF(IMODE.EQ.3) OBJBUF(1)=(OBJBUF(1)).AND."27777 C C.... MOVE IN NUMBERS FOR 1ST AND 2ND EXT WORDS C OBJWC = OBJWC+OPNWC OBJBUF(2) = OPNWRD(2) OBJBUF(1) = OPNWRD(1) IF(OPNWC.EQ.2) OBJBUF(2) = OPNWRD(3) IF(OPNWC.EQ.2) OBJBUF(3) = OPNWRD(2) GOTO 310 C C.... PROCESS EA TYPES 0-5 FOR FIRST OPN C 305 OBJBUF(1)=(((OP1EA-1)*"10).OR.OP1DA) C C.... CHK FOR SIMPLE SECOND OPERANDS C 310 IF(OP2EA.EQ.0) GOTO 315 C C.... CHK FOR SR,CCR,USP C IF(OP2EA.GT.6) GOTO 340 GOTO 320 C C.... CALCULATE COMPLEX SECOND OPN C 315 CALL PROCOP(OPNPT2) OBJBUF(OBJWC+1)=OPNWRD(2) IF(OPNWC.EQ.2) OBJBUF(OBJWC+2)=OPNWRD(2) IF(OPNWC.EQ.2) OBJBUF(OBJWC+1)=OPNWRD(3) OBJWC=OBJWC+OPNWC I=(OPNWRD(1).AND.7)*"10 J=(OPNWRD(1).AND."70)/8 OBJBUF(1)=OBJBUF(1).OR.((I+J)*"100).OR."30000 GOTO 325 C C.... PROCESS EA TYPES 0-5 FOR SECOND OPN C 320 OBJBUF(1)=OBJBUF(1)+(((OP2EA-1).OR.(OP2DA*"10))*"100).OR."30000 C C.... ADD IN SIZE BITS C 325 IF(IMODE.EQ.1)OBJBUF(1)=OBJBUF(1).AND."17777 IF(IMODE.EQ.3)OBJBUF(1)=OBJBUF(1).AND."27777 GOTO 7000 C C.... GEN MOVEQ ALSO CLR SIZE BITS IF SET C 330 OBJBUF(1) = 0 OBJBUF(1) = (OPNWRD(2).AND."377).OR."70000.OR.(OP2DA*"1000) GOTO 7000 C C.... GENERATE MOVE ,SR - ,CCR - AN,USP C 340 IF(OP2EA.EQ.7) OBJBUF(1)="43300 IF(OP2EA.EQ.8) OBJBUF(1)="42300 IF(OP2EA.NE.9) GOTO 342 OBJBUF(1) = "47140.OR.OP1DA GOTO 7000 C C.... GET NON-REG EA'S IF 0 OR 6 C 342 IF(OP1EA.EQ.0.OR.OP1EA.EQ.6) GOTO 349 C C.... ELSE JUST ADD OR IN THE EA AND REG C OBJBUF(1)=OBJBUF(1).OR.OP1DA.OR.((OP1EA-1)*"10) GOTO 7000 C C.... HANDLE STUFF FOR EA'S 0 AND 6 C 349 OBJBUF(1)=OBJBUF(1).OR.OPNWRD(1) OBJBUF(2)=OPNWRD(2) IF(OPNWC.EQ.2)OBJBUF(2)=OPNWRD(3) IF(OPNWC.EQ.2)OBJBUF(3)=OPNWRD(2) OBJWC=OBJWC+OPNWC GOTO 7000 C C.... GENERATE MOVE SR, - USP,AN C 350 IF (OP1EA.EQ.9) GOTO 355 ! SR, IF (OP2EA.EQ.2) GOTO 8500 ! USP,AN IF (OP2EA.EQ.0) GOTO 353 OBJBUF(1) = "40300.OR.OP2DA.OR.((OP2EA-1)*"10) GOTO 7000 C 353 CALL PROCOP(OPNPT2) OBJBUF(2)=OPNWRD(2) IF(OPNWC.EQ.2) OBJBUF(2) = OPNWRD(3) IF(OPNWC.EQ.2) OBJBUF(3) = OPNWRD(2) OBJWC = OBJWC + OPNWC OBJBUF(1) = "43000.OR.OPNWRD(1) GOTO 7000 C 355 OBJBUF(1) = "47150.OR.OP2DA GOTO 7000 C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C PROCESS CMP INSTRUCTION C ,DN ,AN #DATA, (AY)+,(AX)+ C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C 400 IF((OP1EA.EQ.6).AND.(OP2EA.NE.2)) GOTO 460 ! CMPI INSTR IF((OP1EA.EQ.5).AND.(OP2EA.EQ.5)) GOTO 480 ! CMPM INSTR IF((OP2EA.EQ.1).OR. (OP2EA.EQ.2)) GOTO 410 ! CMP ,DN OR AN GOTO 8500 ! ALL ELSE ILLEGAL C C.... PROCESS ,DN ,AN C 410 IF(OP2EA.EQ.2.AND.IMODE.EQ.1) GOTO 8500 ! CMPA CANT HAVE .B IF(OP2EA.NE.2) GOTO 411 IF(IMODE.EQ.3) OPSKEL = OPSKEL.OR."500 ! CMPA.L IF(IMODE.NE.3) OPSKEL = OPSKEL.OR."200 ! CMPA.W 411 IF((OP1EA.EQ.0).OR.(OP1EA.EQ.6)) GOTO 415 ! COMPLEX OPN C C.... PROCESS FOR REG OPNS C 412 OBJBUF(1)=OPSKEL.OR.(OP2DA*"1000).OR.((OP1EA-1)*"10).OR.OP1DA GOTO 6000 C C.... PROCESS FOR COMPLEX 1ST OPNS C 415 CALL PROCOP(OPNPTR) OBJBUF(1) = OPSKEL.OR.(OP2DA*"1000).OR.(OPNWRD(1).AND."77) OBJBUF(2)=OPNWRD(2) IF(OPNWC.EQ.2) OBJBUF(2)=OPNWRD(3) IF(OPNWC.EQ.2) OBJBUF(3)=OPNWRD(2) OBJWC=OBJWC+OPNWC GOTO 6000 C C.... CMPI INSTRUCTION C.... EVALUATE THE IMMEDIATE PART C 460 CALL PROCOP(OPNPTR) OBJWC = OBJWC + OPNWC OBJBUF(2)=OPNWRD(2) IF(OPNWC.EQ.2) OBJBUF(2) = OPNWRD(3) ! PLAY GAMES IF 2 WDS IF(OPNWC.EQ.2) OBJBUF(3) = OPNWRD(2) C C.... CHECK FOR SIMPLE DESTINATION EA C IF((OP2EA.GT.0).AND.(OP2EA.LT.6)) GOTO 470 IF(OP2EA.GT.6) GOTO 8500 CALL PROCOP(OPNPT2) OBJBUF(1) = OPSK2.OR.(OPNWRD(1).AND."77) OBJBUF(OBJWC+1) = OPNWRD(2) IF (OPNWC.EQ.2) OBJBUF(OBJWC+1) = OPNWRD(3) IF (OPNWC.EQ.2) OBJBUF(OBJWC+2) = OPNWRD(2) OBJWC = OBJWC+OPNWC GOTO 6000 C C.... SECOND EA IS NOT COMPLEX C 470 OBJBUF(1) = OPSK2.OR.OP2DA.OR.((OP2EA-1)*"10) GOTO 6000 C C.... CMPM (AY)+,(AX)+ C 480 OBJBUF(1)=OPSKEL+((OP2DA*"1000)+OP1DA) GOTO 6000 C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C PROCESS ADD,SUB INSTRUCTIONS C ,DN ,AN DN, #DATA, C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C 500 IF(OP2EA.EQ.2) GOTO 525 ! ADDA,SUBA IF(OP1EA.EQ.6) GOTO 530 ! ADDI,SUBI IF(OP1EA.EQ.1.OR.OP2EA.EQ.1) GOTO 510 GOTO 8500 ! ALL OTHERS ILLEGAL C C.... C 510 IF(OP2EA.EQ.1) GOTO 520 OPSKEL = OPSKEL .OR. "400 C C.... GENERATE DN, C OPSKEL = OPSKEL.OR.(OP1DA*"1000) IF(OP2EA.EQ.0) GOTO 511 OBJBUF(1) = OPSKEL.OR.((OP2EA-1)*"10).OR.OP2DA GOTO 6000 C 511 CALL PROCOP(OPNPT2) 514 OBJBUF(2) = OPNWRD(2) IF(OPNWC.EQ.2) OBJBUF(2) = OPNWRD(3) IF(OPNWC.EQ.2) OBJBUF(3) = OPNWRD(2) OBJWC = OBJWC+OPNWC OBJBUF(1) = OPSKEL.OR.OPNWRD(1) GOTO 6000 C C.... GENERATE ,DN C 520 OPSKEL = OPSKEL.OR.(OP2DA*"1000) IF(OP1EA.EQ.0) GOTO 522 521 OBJBUF(1) = OPSKEL.OR.((OP1EA-1)*"10).OR.OP1DA GOTO 6000 C 522 CALL PROCOP(OPNPTR) GOTO 514 C C.... GENERATE ,AN C 525 IF (IMODE.EQ.1) GOTO 8500 IF (IMODE.EQ.3) OPSKEL = OPSKEL .OR. "500 IF ((IMODE.EQ.2).OR.(IMODE.EQ.0)) OPSKEL = OPSKEL.OR."200 OPSKEL = OPSKEL .OR.(OP2DA*"1000) IF((OP1EA.EQ.0).OR.(OP1EA.EQ.6)) GOTO 522 OBJBUF(1) = OPSKEL.OR.((OP1EA-1)*"10).OR.OP1DA GOTO 6000 C C.... GENERATE xxxI C 530 IF(OP2EA.GT.6) GOTO 8500 C C.... EVALUATE IMMEDIATE EXPRESSION C CALL PROCOP(OPNPTR) C C.... TRY GENERATING SHORT FORM OF INSTRUCTION C.... AFTER CHECKING TO SEE IF OPERAND WAS FWD REF C IF(OPNFLG.EQ.1) GOTO 536 IF(OPNWRD(2).GE.1.AND.OPNWRD(2).LE.8) GOTO 550 C C.... GENERATE EXTENSION WORDS C.... LENGTH OF OPERAND DEPENDS ON THE IMODE OF INSTRUCTION C 536 OBJBUF(2) = OPNWRD(2) IF(OPNWC.EQ.2)OBJBUF(2) = OPNWRD(3) IF(OPNWC.EQ.2)OBJBUF(3) = OPNWRD(2) 537 OBJWC = OBJWC + OPNWC C C.... IF DEST THRU REG EVAL IT HERE C 538 IF(OP2EA.EQ.0) GOTO 540 OBJBUF(1)=OPSK2.OR.((OP2EA-1)*"10).OR.OP2DA GOTO 6000 C C.... EVAL NON-REG DEST C 540 CALL PROCOP(OPNPT2) OBJWC = OBJWC + OPNWC OBJBUF(1) = OPSK2.OR.OPNWRD(1) IF(OPNWC.EQ.1) OBJBUF(OBJWC ) = OPNWRD(2) IF(OPNWC.EQ.2) OBJBUF(OBJWC+1) = OPNWRD(3) IF(OPNWC.EQ.2) OBJBUF(OBJWC ) = OPNWRD(2) GOTO 6000 C C.... GENERATE xxxQ C 550 IF(OPNWRD(2).EQ.8) OPNWRD(2) = 0 IF(OPSK2.EQ."2000) OPSK2 = "50400 IF(OPSK2.EQ."3000) OPSK2 = "50000 OPSK2 = OPSK2.OR.(OPNWRD(2)*"1000) GOTO 538 C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C PROCESS AND,OR INSTRUCTIONS C ,DN DN, #DATA, C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C 600 IF(OP1EA.EQ.6) GOTO 610 IF(OP2EA.NE.1) GOTO 620 C C.... PROCESS ,DN C OPSKEL=OPSKEL+(OP2DA*"1000) IF(OP1EA.EQ.0) GOTO 605 OBJBUF(1)=OPSKEL.OR.OP1DA.OR.((OP1EA-1)*"10) GOTO 6000 C 605 CALL PROCOP(OPNPTR) OBJBUF(1)=OPSKEL.OR.OPNWRD(1) OBJBUF(2)=OPNWRD(2) IF(OPNWC.EQ.2) OBJBUF(2)=OPNWRD(3) IF(OPNWC.EQ.2) OBJBUF(3)=OPNWRD(2) OBJWC=OBJWC+OPNWC GOTO 6000 C C.... PROCESS #DATA, C 610 OPSKEL = OPSK2 IF(OP2EA.EQ.6) GOTO 8500 CALL PROCOP(OPNPTR) OBJBUF(2)=OPNWRD(2) IF(OPNWC.EQ.2) OBJBUF(2)=OPNWRD(3) IF(OPNWC.EQ.2) OBJBUF(3)=OPNWRD(2) OBJWC=OBJWC+OPNWC C C.... NOW THAT WE HAVE IMMEDIATE DATA GET , C IF(OP2EA.EQ.0.AND.OP1EA.EQ.1) GOTO 6000 IF(OP2EA.EQ.0) GOTO 615 C C.... CHECK FOR #DATA,SR OR #DATA,CCR C IF(OP2EA.LT.7) GOTO 612 IF(OP2EA.GT.8) GOTO 8500 IF((IMODE.EQ.1).AND.(OP2EA.EQ.8)) GOTO 611 IF((IMODE.EQ.1).OR.(IMODE.EQ.3)) GOTO 8500 611 OBJBUF(1) = OPSKEL.OR."74 GOTO 6000 612 OBJBUF(1) = OPSKEL.OR.((OP2EA-1)*"10).OR.OP2DA GOTO 6000 C C.... EVALUATE , FOR COMPLEX ADR C 615 CALL PROCOP(OPNPT2) 630 OBJBUF(OBJWC+1)=OPNWRD(2) IF(OPNWC.EQ.2) OBJBUF(OBJWC+1)=OPNWRD(3) IF(OPNWC.EQ.2) OBJBUF(OBJWC+2)=OPNWRD(2) OBJWC=OBJWC+OPNWC OBJBUF(1)=OBJBUF(1).OR.OPSKEL GOTO 6000 C C.... EVALUATE DN, C 620 OPSKEL=OPSKEL+(OP1DA*"1000).OR."400 IF(OP2EA.EQ.0) GOTO 615 OBJBUF(1) = OPSKEL.OR.OP2DA.OR.((OP2EA-1)*"10) GOTO 6000 C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C PROCESS EOR INSTRUCTION C DN, #DATA, C C ++++++++++++++++++++++++++++++++++++++++++++++++++ 700 IF(OP1EA.EQ.6) GOTO 610 IF(OP1EA.NE.1) GOTO 8500 IF(OP2EA.EQ.0) GOTO 620 OBJBUF(1)=OPSKEL+((OP1EA-1)*"1000)+OP2DA+((OP1EA-1)*"10) GOTO 6000 C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C PROCESS ROTATES AND SHIFTS C DX,DY DATA,DY C C ++++++++++++++++++++++++++++++++++++++++++++++++++ 800 IF(OP1EA.EQ.1.AND.OP2EA.EQ.1) GOTO 810 IF(OP1EA.EQ.6.AND.OP2EA.EQ.1) GOTO 820 IF(OP1EA.EQ.0.AND.OP2EA.EQ.1) GOTO 820 C C.... PROCESS C IF(OP1EA.EQ.0) GOTO 801 IF(OP1EA.LT.3.OR.OP1EA.GT.5) GOTO 8500 OBJBUF(1)=OPSKEL+((OP1EA-1)*"10)+OP1DA GOTO 7000 C 801 CALL PROCOP(OPNPTR) OBJBUF(1)=OPSKEL+OPNWRD(1) OBJBUF(2) = OPNWRD(2) IF (OPNWC.EQ.2) OBJBUF(2) = OPNWRD(3) IF (OPNWC.EQ.2) OBJBUF(3) = OPNWRD(2) OBJWC = OBJWC + OPNWC GOTO 7000 C 810 OBJBUF(1) = OPSKEL.OR."40.OR.(OP1DA*"1000).OR.OP2DA GOTO 6000 C 820 CALL PROCOP(OPNPTR) IF(OPNWRD(2).LT.1.OR.OPNWRD(2).GT.8) GOTO 8500 IF(OPNWRD(2).EQ.8) OPNWRD(2)=0 OBJBUF(1)=OPSKEL+(OPNWRD(2)*"1000)+OP2DA GOTO 6000 C C ++++++++++++++++++++++++++++++++++++++++++++++++++ C C PROCESS BRANCH INSTRUCTIONS C