?? assembler
字號:
undefinedabsolutetextdatabssundefined externalother.DEThe combination rules are then:If one of the operandsis undefined, the result is undefined.If both operands are absolute, the result is absolute.If an absolute is combined with one of the ``other types''mentioned above,or with a register expression, the resulthas the register or other type.As a consequence,one can refer to r3 as ``r0+3''.If two operands of ``other type'' are combined,the result has thenumerically larger typeAn ``other type'' combined with an explicitlydiscussed type other than absoluteacts like an absolute..PPFurther rules applying to particular operatorsare:.IP +If one operand is text-, data-, or bss-segmentrelocatable, or is an undefined external,the result has the postulated type and the other operandmust be absolute..IP \-If the first operand is a relocatabletext-, data-, or bss-segment symbol, the second operandmay be absolute (in which case the result has thetype of the first operand);or the second operand may have the same typeas the first (in which case the result is absolute).If the first operand is external undefined, the second must beabsolute.All other combinations are illegal..IP ^This operator follows no other rule thanthat the result has the valueof the first operand and the type of the second..PP.IP others.brIt is illegal to apply these operators to any but absolutesymbols..SH7. Pseudo-operations.PPThe keywords listed below introducestate%ments that generate data in unusual forms orinfluence the later operations of the assembler.The metanotation.DS[ stuff ] .\|.\|..DEmeans that 0 or more instances of the given stuff may appear.Also, boldface tokens are literals, italic wordsare substitutable..SH7.1 \fB.byte \fIexpression \fR[ \fB, \fIexpression \fR] .\|.\|..PPThe \fIexpression\fRs in the comma-separatedlist are truncated to 8 bits and assembled in successivebytes.The expressions must be absolute.This state%ment and the string state%ment above are the only onesthat assemble data one byte at at time..SH7.2 \fB.even\fR.PPIf the location counter ``\|\fB.\fP\|'' is odd, it is advanced by oneso the next state%ment will be assembledat a word boundary..SH7.3 \fB.if \fIexpression\fR.PPThe \fIexpression\fR must be absolute and defined in pass 1.If its value is nonzero, the \fB.if\fR is ignored; if zero,the state%ments between the \fB.if\fR and the matching \fB.endif\fR(below) are ignored.\&\fB.if\fR may be nested.The effect of \fB.if\fR cannot extend beyondthe end of the input file in which it appears.(The state%ments are not totally ignored, inthe followingsense: \fB.if\fRs and \fB.endif\fRs are scanned for, andmoreover all namesare entered in the symbol table.Thus names occurring only insidean \fB.if\fRwill show up as undefined if the symboltable is listed.).SH7.4 \fB.endif\fR.PPThis state%ment marks the end of a conditionally-assembled section of code.See \fB.if\fR above..SH7.5 \fB.globl \fIname \fR[ \fB,\fI name \fR] .\|.\|..PPThis state%ment makes the \fInames\fR external.If they are otherwise defined (by assignment orappearance as a label)they act within the assembly exactly as ifthe \fB.globl\fR state%ment were not given; however,the link editor \fIld\fR may be usedto combine this routine with other routines that referthese symbols..PPConversely, if the given symbols are not definedwithin the current assembly, the link editorcan combine the output of this assemblywith that of others which define the symbols.As discussed in \(sc1, it is possible to forcethe assembler to make all otherwiseundefined symbols external..SH7.6 \fB.text\fR.SH7.7 \fB.data\fR.SH7.8 \fB.bss\fR.PPThese three pseudo-operations cause theassembler to begin assembling into the text, data, orbss segment respectively.Assembly starts in the text segment.It is forbidden to assemble anycode or data into the bss segment, but symbols maybe defined and ``\|\fB.\fP\|'' moved about by assignment..SH7.9 \fB.comm\fI name \fB, \fIexpression\fR.PPProvided the \fIname\fR is not defined elsewhere,this state%ment is equivalent to.DS\&.globl namename = expression ^ name.DEThat is, the type of \fIname\fRis ``undefined external'', and its value is \fIexpression\fR.In fact the \fIname\fR behavesin the current assembly just like anundefined external.However, the link-editor \fIld\fR has been special-casedso that all external symbols which are nototherwise defined, and which have a non-zerovalue, are defined to lie in the bsssegment, and enough space is left after thesymbol to hold \fIexpression\fRbytes.All symbols which become defined in this wayare located before all the explicitly definedbss-segment locations..SH8. Machine instructions.PPBecause of the rather complicated instruction and addressingstructure of the \s8PDP\s10-11, the syntax of machine instructionstate%ments is varied.Although the following sections give the syntaxin detail, the machine handbooks shouldbe consulted on the semantics..SH8.1 Sources and Destinations.PPThe syntax of general source and destinationaddresses is the same.Each must have one of the following forms,where \fIreg\fR is a register symbol, and \fIexpr\fRis any sort of expression:.DS C.TSc c cl l l.syntax words mode_\fIreg\fR 0 00+\fIreg\fB(\|\fIreg\fB\|)\|+ \fR0 20+\fIreg\fB\fB\-\|(\|\fIreg\fB\|) \fR0 40+\fIreg\fR\fIexpr\|\fB(\|\fIreg\fB\|) \fR1 60+\fIreg\fB(\|\fIreg\fB\|) \fR0 10+\fIreg\fB*\|\fIreg\fB \fR0 10+\fIreg\fB\fB*\|(\|\fIreg\fB\|)\|+ \fR0 30+\fIreg\fB\fB*\|\-\|(\|\fIreg\fB\|) \fR0 50+\fIreg\fB*\|(\|\fIreg\fB\|) \fR1 70+\fIreg\fB\fB*\|\fIexpr\fB\|(\|\fIreg\fB\|) \fR1 70+\fIreg\fB\fIexpr \fR1 67\fB$\|\fIexpr \fR1 27\fB*\|\fIexpr \fR1 77\fB*\|$\|\fIexpr \fR1 37.TE.DEThe \fIwords\fR column gives the number of address words generated;the \fImode\fR column gives the octal address-mode number.The syntax of the address forms isidentical to that in \s8DEC\s10 assemblers, except that ``*'' hasbeen substituted for ``@''and ``$'' for ``#''; the \s8UNIX\s10 typing conventions make ``@'' and ``#''rather inconvenient..PPNotice that mode ``*reg'' is identical to ``(reg)'';that ``*(reg)'' generates an index word (namely, 0);and that addresses consisting of an unadorned expressionare assembled as pc-relative ref%er%ences independentof the type of the expression.To force a non-relative ref%er%ence, the form ``*$expr'' canbe used, but notice that further indirection is impossible..SH8.3 Simple machine instructions.PPThe following instructionsare defined as absolute symbols:.KS.DS.ft Bclcclvclzclnsecsevsezsen.DE.KEThey therefore requireno special syntax.The \s8PDP\s10-11 hardware allows more than one of the ``clear''class, or alternatively more than one of the ``set'' classto be \fBor\fR-ed together; this may be expressed as follows:.DSclc\|\|\|\(bv\|\|clv.DE.SH8.4 Branch.PPThe following instructions take an expression as operand.The expression must lie in the same segment as the ref%er%ence,cannot be undefined-external,and its value cannot differ from the current location of ``\|\fB.\fP\|''by more than 254 bytes:.KS.DS.ft B.ta 1.5i 2.5ibr blosbne bvcbeq bvsbge bhisblt bec \fR(=\fB bcc\fR)\fBbgt bccble blobpl bcsbmi bes \fR(=\fB bcs\fR)\fBbhi.DE.KE\fBbes\fR (``branch on error set'')and \fBbec\fR (``branch on error clear'')are intended to test the error bitreturned by system calls (whichis the c-bit)..SH8.5 Extended branch instructions.PPThe following symbols are followed by an expressionrepresenting an addressin the same segment as ``\|\fB.\|\fP''.If the target address is close enough,a branch-type instruction is generated;if the address is too far away,a \fBjmp\fR will be used..pg.KS.DS.ft B.ta 1.5ijbr jlosjne jvcjeq jvsjge jhisjlt jecjgt jccjle jlojpl jcsjmi jesjhi.DE.KE\fBjbr\fR turns into a plain \fBjmp\fRif its target is too remote;the others (whose names are contructedby replacing the ``b'' in the branch instruction'sname by ``j''\|)turn into the converse branch over a \fBjmp\fRto the target address..SH8.6 Single operand instructions.PPThe followingsymbols are names of single-operandmachine instructions.The formof address expected is discussed in \(sc8.1 above..KS.DS.ta 1.5iclr sbcbclrb rorcom rorbcomb rolinc rolbincb asrdec asrbdecb aslneg aslbnegb jmpadc swabadcb tstsbc tstb.DE.KE.SH8.7 Double operand instructions.PPThe following instructions take a general sourceand destination (\(sc8.1), separated by a comma, as operands..KS.DS.ft B.ta 1.5imovmovbcmpcmpbbitbitbbicbicbbisbisbaddsub.DE.KE.SH8.8 Miscellaneous instructions.PPThe following instructions havemore specialized syntax.Here \fIreg\fR isa register name, \fIsrc\fR and \fIdst\fR a general sourceor destination(\(sc8.1), and \fIexpr\fR is an expression:.KS.DS.ta .5i 2i\fBjsr\fI reg,dst\fBrts\fI reg\fBsys\fI expr\fBash \fIsrc\|,\|reg \fR(or, \fBals\fR)\fB\fBashc \fIsrc\|,\|reg \fR(or, \fBalsc\fR)\fB\fBmul \fIsrc\|,\|reg \fR(or, \fBmpy\fR)\fB\fBdiv \fIsrc\|,\|reg \fR(or, \fBdvd\fR)\fR\fBxor \fIreg\|,\|dst\fB\fBsxt \fIdst\fB\fBmark \fIexpr\fB\fBsob \fIreg\|,\|expr\fB.DE.KE\fBsys\fR is another name for the \fBtrap\fR instruction.It is used to code system calls.Its operand is required to be expressible in 6 bits.The expression in \fBmark\fR must be expressiblein six bits, and the expression in \fBsob\fR mustbe in the same segment as ``\fB\|.\|\fR'',must not be external-undefined, must be less than ``\|\fB.\fR\|'',and must be within 510 bytes of ``\|\fB.\fR\|''..SH8.9 Floating-point unit instructions.PPThe following floating-point operations are defined,with syntax as indicated:.KS.DS.ta .5i 2i\fBcfcc\fBsetf\fBsetd\fBseti\fBsetl\fBclrf \fIfdst\fBnegf \fIfdst\fBabsf \fIfdst\fBtstf \fIfsrc\fBmovf \fIfsrc,\|freg \fR(= ldf\fR\|)\fBmovf \fIfreg,\|fdst \fR(= stf\fR\|)\fBmovif \fIsrc,\|freg \fR(= ldcif\fR\|)\fBmovfi \fIfreg,\|dst \fR(= stcfi\fR\|)\fBmovof \fIfsrc,\|freg \fR(= ldcdf\fR\|)\fBmovfo \fIfreg,\|fdst \fR(= stcfd\fR\|)\fBmovie \fIsrc,\|freg \fR(= ldexp\fR)\fBmovei \fIfreg,\|dst \fR(= stexp\fR)\fBaddf \fIfsrc,\|freg\fBsubf \fIfsrc,\|freg\fBmulf \fIfsrc,\|freg\fBdivf \fIfsrc,\|freg\fBcmpf \fIfsrc,\|freg\fBmodf \fIfsrc,\|freg\fBldfps \fIsrc\fBstfps \fIdst\fBstst \fIdst\fR.DE.KE\fIfsrc\fR, \fIfdst\fR, and \fIfreg\fR mean floating-pointsource, destination, and register respectively.Their syntax is identical to that fortheir non-floating counterparts, butnote that onlyfloating registers 0-3 can be a \fIfreg\fR..PPThe names of several of the operationshave been changed to bring out an analogy withcertain fixed-point instructions.The only strange case is \fBmovf\fR, which turns intoeither \fBstf\fR or \fBldf\fRdepending respectively on whether its first operand isor is not a register.Warning: \fBldf\fR sets the floating condition codes,\fBstf\fR does not..SH9. Other symbols.SH9.1 \fB.\|.\fR.PPThe symbol ``\fB\|.\|.\|\fR''is the\fIrelocation counter\fR.Just before each assembled word is placed in the output stream,the current value of this symbol is added to the wordif the word refers to a text, data or bss segment location.If the output word is a pc-relative address wordthat refers to an absolute location,the value of ``\fB\|.\|.\|\fR'' is subtracted..PPThus the value of ``\fB\|.\|.\|\fR'' can be taken to meanthe starting memory location of the program.The initial value of ``\|\fB.\|.\fR\|'' is 0..PPThe value of ``\|\fB.\|.\fR\|'' may be changed by assignment.Such a course of action is sometimesnecessary, but the consequencesshould be carefully thought out.It is particularly ticklishto change ``\|\fB.\|.\fR\|'' midway in an assemblyor to do so in a program which willbe treated by the loader, which hasits own notions of ``\|\fB.\|.\fR\|''..SH9.2 System calls.PPSystem call names are not predefined.They may be found in the file.I /usr/include/sys.s.SH10. Diagnostics.PPWhenan input file cannot be read, its namefollowed by a question mark is typed and assemblyceases.When syntactic or semantic errors occur, a single-character diagnostic is typed outtogether with the line number and the file name in which itoccurred. Errors in pass 1 cause cancellation of pass 2.The possible errors are:.KS.DS.ta .3i) parentheses error] parentheses error> string not terminated properly* indirection (\|*\|) used illegally\&\fB.\fR illegal assignment to ``\|\fB.\fR\|''\s8A\s10 error in address\s8B\s10 branch address is odd or too remote\s8E\s10 error in expression\s8F\s10 error in local (``f\|'' or ``b'') type symbol\s8G\s10 garbage (unknown) character\s8I\s10 end of file inside an \fB.if\fR\s8M\s10 multiply defined symbol as label\s8O\s10 word quantity assembled at odd address\s8P\s10 phase error\(em ``\|\fB.\fP\|'' different in pass 1 and 2\s8R\s10 relocation error\s8U\s10 undefined symbol\s8X\s10 syntax error.DE.KE
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -