⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 as31.1

📁 MCS51系列单片机的汇编器
💻 1
字号:
.TH AS31 1L.SH NAMEas31 - An Intel 8031/8051 assembler.SH SYNOPSIS.B as31[.B \-Fformat] [.B \-Aarg] [.B \-l].BR infile.asm.SH DESCRIPTION.I As31assembles.IR infile.asminto one of several different output formats. The outputwill be in a file called infile.obj. The .asm extenstionis required..SH OPTIONSThe options must appear before the input file name. Bothoptions are optional. The text of each flag must appearon the same argument as the flag. For example, "-Fod" is avalid argument, but "-F od" is not..TP.I \-FformatThis options specifies the output format that is to be used..IPCurrently the only options available for this are:.RS.IP "hex"This format is the Intel HEX format which is expected by anumber of EPROM programmers and the PAULMON debugger.  Foruse with some programmers, the output file's extension mayhave to be changed to .HEX to be recognized by the programmer.No -A option is used.  This format should be thedefault if no -F option is used..IP "tdr"This format generates an asci file of hex digits formatted in such away, so that they can be read by tdr's debugger. An argument can bespecified (See -A option) which will pass a format specific string tothe format generator. In this case, the argument string representsan offset to add to the location counter. This offset isspecified in decimal and defaults to 64*1024 (0x10000). To specifyand offset of 100, you would need "-Ftdr -A100" when invoking theassembler..IP "byte"This format is simply an address and a byte on each line, in ascii.No -A option is used..IP "od"This format is similar to the output from od(1). The format consists of an address followed by sixteen hexadecimal bytes, followedby the equivilant ASCII. No -A option is used..IP "srec2, srec3, srec4"The srecord generator is capable of generating output with any oneof 2, 3, or 4 byte addresses. The -A option can be used to set thebase address offset, the default here is 0x0000 (unlike \fBtdr\fP)..RE.IPNOTE: This assembler allows for the output formats to be expanded toinclude many different output formats..IP \-AargThis option specifies a format specific string which ispassed to the format generator. Both format "tdr" and the srecordformats use this option..IP \-lThis option tells the assembler to also generate a listing file.A listing will be placed in the file infile.lst. Where 'infile' isthe file that is being assembled. This option may appearanywhere before infile.asm. The option must occur isolated onthe command line..IPThe listing file shows the assembler generated code in hex, and up to60 characters are retained from the source file..IP \-cgiThis option instructs the assembler to supress the listing, output the object code to stdout, and DELETE the originalassembly source file.  This is intended to be used with acgi script which builds a custom cunfigured temporary copyof an assembly source.  This option should not normally be used..DE.SH "ASSEMBLER INSTRUCTIONS"This assembler accepts standard 8031/8051 instruction formats.Below is a list of instructionsand addressing modes..IP.RS.nf.ta +1i +2i +1i +1iINSTRUCTION		BYTES	CYCLES-----------		-----	------ACALL	addr11		2	24ADD	A, #data8		2	12ADD	A, @Ri		1	12ADD	A, Rn		1	12ADD	A, direct		2	12ADDC	A, #data8		2	12ADDC	A, @Ri		1	12ADDC	A, Rn		1	12ADDC	A, direct		2	12AJMP	addr11		2	24ANL	A, #data8		2	12ANL	A, @Ri		1	12ANL	A, Rn		1	12ANL	A, direct		2	12ANL	C, /bit		2	24ANL	C, !bit		2	24ANL	C, bit		2	24ANL	direct, #data8		3	24ANL	direct, A		2	12CJNE	@Ri, #data8, rel		3	24CJNE	A, #data8, rel		3	24CJNE	A, direct, rel		3	24CJNE	Rn, #data8, rel		3	24CLR	A		1	12CLR	C		1	12CLR	bit		2	12CPL	A		1	12CPL	C		1	12CPL	bit		2	12DA	A		1	12DEC	@Ri		1	12DEC	A		1	12DEC	DPTR		1	12DEC	Rn		1	12DEC	direct		2	12DIV	AB		1	48DJNZ	Rn, rel		2	24DJNZ	direct, rel		3	24INC	@Ri		1	12INC	A		1	12INC	DPTR		1	24INC	Rn		1	12INC	direct		2	12JB	bit, rel		3	24JBC	bit, rel		3	24JC	relative		2	24JMP	@A + DPTR		1	24JMP	@DPTR + A		1	24JNB	bit, rel		3	24JNC	relative		2	24JNZ	relative		2	24JZ	relative		2	24LCALL	addr16		3	24LJMP	addr16		3	24MOV	@Ri, #data8		2	12MOV	@Ri, A		1	12MOV	@Ri, direct		2	24MOV	A, #data8		2	12MOV	A, @Ri		1	12MOV	A, Rn		1	12MOV	A, direct		2	12MOV	C, bit		2	12MOV	DPTR, #data16		3	24MOV	Rn, #data8		2	12MOV	Rn, A		1	12MOV	Rn, direct		2	24MOV	bit, C		2	24MOV	direct, #data8		3	24MOV	direct, @Ri		2	24MOV	direct, A		2	12MOV	direct, Rn		2	24MOV	direct, direct		3	24MOVC	A, @A + DPTR		1	24MOVC	A, @A + PC		1	24MOVC	A, @DPTR + A		1	24MOVC	A, @PC + A		1	24MOVX	@DPTR, A		1	12MOVX	@Ri, A		1	24MOVX	A, @DPTR		1	24MOVX	A, @Ri		1	24MUL	AB		1	48NOP			1	12ORL	A, #data8		2	12ORL	A, @Ri		1	12ORL	A, Rn		1	12ORL	A, direct		2	12ORL	C, /bit		2	24ORL	C, !bit		2	24ORL	C, bit		2	24ORL	direct, #data8		3	24ORL	direct, A		2	12POP	direct		2	24PUSH	direct		2	24RET			1	24RETI			1	24RL	A		1	12RLC	A		1	12RR	A		1	12RRC	A		1	12SETB	A		1	12SETB	bit		2	12SJMP	relative		2	24SUBB	A, #data8		2	12SUBB	A, @Ri		1	12SUBB	A, Rn		1	12SUBB	A, direct		2	12SWAP	A		1	12XCH	A, #data8		2	12XCH	A, @Ri		1	12XCH	A, Rn		1	12XCH	A, direct		2	12XCHD	A, #data8		2	12XCHD	A, @Ri		1	12XCHD	A, Rn		1	12XCHD	A, direct		2	12XRL	A, #data8		2	12XRL	A, @Ri		1	12XRL	A, Rn		1	12XRL	A, direct		2	12XRL	direct, #data8		3	12XRL	direct, A		2	12.fi.RE.SH "ASSEMBLER DIRECTIVES"As31 includes the following assembler directives:.IP ".ORG expr"Start assembling at the address specified by the expression expr.An error occurs if the assembler starts assembling over an addressspace that has previously been assembled into..IP ".EQU symbol, expr"Set symbol to the value of expr. The value for expr must beknown during the first pass, when the line containing the .EQUis encountered..IP ".BYTE expr, expr, ..."Assemble the bytes specified by the expression into memory. Astring may also be specified with this directive..IP ".WORD expr, expr, ..."Assemble the words specified by the expression into memory.The byte ordering used, is that used by the 8031..IP ".FLAG symbol1, symbol.[0-7]"Sets symbol1 to the bit address specified by the symbol.[0-7]expression. Where [0-7] denotes a character between 0 and 7.The resulting bit address is checked to see if it is a valid bitaddress..IP ".END"This directive is ignored..IP ".SKIP expr"Adds the value of expr to the location counter. Usedto reserve a block of uninitialized data. Expr shouldbe in bytes..SH "LEXICAL CONVENTIONS".IP "-"All characters following a semi-colon are ignored until a newlineis encountered..IP "-"All numbers default to decimal, unless the number starts withone of the following:.RS.IP "0x or 0X"This indicates a hexadecimal number. ie. 0x00ff.IP "0b or 0B"This indicates a binary number. (1's and 0's). ie. 0b1100110010.IP "0"This indicates an octal number. ie. 0377.RE.IP "-"All numbers default to decimal, unless the number ends withone of the following characters:.RS.IP "b or B"This indicates a binary number. Unless 0x was used above.ie. 1010101b.IP "h or H"This always indicates a hex number, However the if the firstcharacter is non-numerical, then either 0x or 0 must be specified.This avoids confusing the assembler into thinking a hex number isa symbol.For example: 0ffh, 0xffh, 0XffH, 20h, 0x20 and 020h are meansto specify a valid hexdigit. But the following are not:ffh, 0ff..IP "d or D"This forces a number to decimal. Unless 0X was used. ie. 129d.IP "o or O"This causes the number to be interpreted as octal. ie. 377o.RE.IP "-"A character constant can be entered as 'c' where c is somecharacter. \\b, \\n, \\r, \\t, \\' \\0 are also valid. A characterconstant can be used anywhere that an integer value can..IP "-"A string is entered as a set of characters enclosed in double quotes "".A string is only valid with the .BYTE directive. \\b, \\n, \\r, \\t, \\"are also valid escapes. However \\0 is not..IP "-"Instructions, directives, and the symbols: R0, R1, R2, R3, R4, R5,R6, R7, A, AB, and C can be entered in upper or lower case withoutassembler confusion. These words however cannot be defined as a user symbol.Any user symbol may be used, and case will be preserved. So theuser symbols "foo" and "Foo" are different, but "addc" is the sameas "aDdC"..IP "-"A symbol can be any alpha numerical character plus the underscore ('_')..IP "-"Expressions are accepted in most places where a value or a symbol isneeded. An expression consists of the following operators. Alloperators evaulate to integer objects (higher precedence opertors listedfirst):.RS.IP "-"Unary minus.IP "&"Bit-wise AND..IP "|"Bit-Wise OR..IP "*"Integer multiplication..IP\\ Integer division.IP "%"Intieger modulus.IP "+"Integer addition..IP "-"Integer subtraction..RE.IP "-"In addition to these operators, a special symbol '*' may be usedto represent the current location counter..SH EXAMPLES.IPBelow is a sample assembly program..RS.nf                .org    0start:          mov     P3, #0xff       ; use alternate fns on P3			                ; leds on P1 are inverted.                setb    F0              ; climbing up                mov     A, #0x01        ; initial bitwrite:          cpl     A               ; write it                mov     P1, A                cpl     A                acall   delay                jb      F0, climbup     ; climbing which way?climbdn:        rr      A               ; down - shift right                jnb     ACC.0, write    ; back for more                setb    F0                ajmp    writeclimbup:        rl      A               ; up - shift left                jnb     ACC.7, write    ; back for more                clr     F0                ajmp    write                .end			; this directive ignored..fi.SH AUTHORKen Stauffer (University of Calgary).brstauffer@cpsc.ucalgary.ca

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -