NAME as31 - An Intel 8031/8051 assembler. SYNOPSIS as31 [-h] [-l] [-s] [-v] [-Aarg] [-Ffmt] [-Ofile] infile.asm

Similar documents
Microcontroller Intel [Instruction Set]

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

Programming of 8085 microprocessor and 8051 micro controller Study material

Digital Blocks Semiconductor IP

Q. Classify the instruction set of 8051 and list out the instructions in each type.

Digital Blocks Semiconductor IP

Digital Blocks Semiconductor IP

SN8F5000 Family Instruction Set

8051 Microcontroller

INSTRUCCIONES ARITMETICAS ERROR! MARCADOR NO DEFINIDO.

Instruction Set Of 8051

DR bit RISC Microcontroller. Instructions set details ver 3.10

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

Microcontroller. Instruction set of 8051

UNIT 2 THE 8051 INSTRUCTION SET AND PROGRAMMING

8051 Overview and Instruction Set


Highlights. FP51 (FPGA based 1T 8051 core)

Dodatak. Skup instrukcija

Programming Book Microcontroller Kit. Rev 3.0 January, Wichit Sirichote

UNIT THE 8051 INSTRUCTION SET AND PROGRAMMING

TUTORIAL Assembly Language programming (2)

MASSEY UNIVERSITY PALMERSTON NORTH CAMPUS

Module Contents of the Module Hours COs

Dragonchip. Instruction Set Manual

Embedded Controller Programming

Memory organization Programming model - Program status word - register banks - Addressing modes - instruction set Programming examples.

C51 Family. Architectural Overview of the C51 Family. Summary

Application Brief D-005

8051 Microcontrollers

Control Transfer Instructions Jump, Loop, and Call. ECE473/573 Microprocessor System Design, Dr. Shiue

8051 Microcontroller Assembly Programming

AL8051S 8-BIT MICROCONTROLLER Application Notes

Assembly Language programming (2)

Y51 Microcontroller. Technical Manual

Principle and Interface Techniques of Microcontroller

MCS -51 Programmer s Guide and Instruction Set

~: Simple Programs in 8051 assembly language :~

80C51 family programmer s guide and instruction set. 80C51 Family. PROGRAMMER S GUIDE AND INSTRUCTION SET Memory Organization. Philips Semiconductors

Chapter Family Microcontrollers Instruction Set

Assembly Language programming (3)

ET355 Microprocessors Thursday 6:00 pm 10:20 pm

ELEG3923 Microprocessor Ch.6 Arithmetic and Logics

What Registers are available? Programming in Assembler. Assembler Programming - like early Basic. Assembler Data Movement Instructions

8051 Core Specification

8051 Programming: Arithmetic and Logic

8051 Single Board Monitor Programming. Minmon - Yeralan & Ahluwalia. PaulMon1 & PaulMon2 - Paul Stoffregen

Application Brief D-002

Lab-Report Microprocessors

TUTORIAL. Donal Heffernan University of Limerick May Tutorial D.Heffernan 2000,

UNIT MICROCONTROLLER AND ITS PROGRAMMING

Introduction to uc & Embedded Systems

CW6631B Bluetooth Audio Player Microcontroller User Manual

Arithmetic and Logic

Lecture 5. EEE3410 Microcontroller Applications Department of Electrical Engineering Assembly Language Programming (1)

C51 Family. C51 Family Programmer s Guide and Instruction Set. Summary

It is possible to define a number using a character or multiple numbers (see instruction DB) by using a string.

MICROPROCESSOR LABORATORY MANUAL

University of Toronto at Scarborough CSC CSSF - Microprocessor Systems

Lecture Instruction Set

UNIT-III ASSEMBLY LANGUAGE PROGRAMMING. The CPU can access data in various ways, which are called addressing modes

System & Program Developments of 8051

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

8051 CROSS ASSEMBLER USER'S MANUAL. MetaLink Corporation Chandler, Arizona

UNIT MICROCONTROLLER

8051 Programming using Assembly

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

Legacy documentation refer to the Altium Wiki for current information. TSK52x MCU

Section Microcontroller Instruction Set

ENE 334 Microprocessors

Chapter 3. Bit Addressable Area. By DeccanRobots

MASSEY UNIVERSITY PALMERSTON NORTH CAMPUS

8051 Instruction Set

ELEG3924 Microprocessor

2. Write an 8051 program to generate a square wave of 25 khz at pin P2.3 using XTAL = 12 MHz. Solution:

International Journal of Digital Application & Contemporary research Website: (Volume 1, Issue 2, September 2012)

Legacy documentation refer to the Altium Wiki for current information. TSK51x MCU

1. Write A Program to move a block of data within the internal RAM

Report Title: Digital Voltmeter using 89C51

Principle and Interface Techniques of Microcontroller

ELEG3923 Microprocessor Ch.3 Jump, Loop, and Call

JUMP, LOOP AND CALL INSTRUCTIONS


Microcontroller and Applications

Microcontroller Lab Manual

D: arc SRC KUT51 KUT51LCD.LST KUT51LCD PAGE 1

Chương 3 Tập lệnh họ MSC-51

APPLICATION NOTE 601 Accelerating 16/32-Bit Math Operations with the DS80C390/ DS80C400

CHAPTER 3 JUMP, LOOP, AND CALL INSTRUCTIONS

Core8051. Advanced v0.1

MICROPROCESSOR & MICROCONTROLLER

;~~~~~~~~~~~~ ;P4-6-1.ASM ~ ;~~~~~~~~~~~~ SYMBOLS RS REG P2.0 EN REG P2.1 PICK REG P3.0 RELAY0 REG P3.1 RELAY1 REG P3.6 RELAY2 REG P3.

S.J.P.N Trust's. Hirasugar Institute of Technology, Nidasoshi.

A First-step Towards an Architecture Tuning Methodology for Low Power

MODEL ANSWER SUMMER 17 EXAMINATION Subject Title: Microcontroller Subject Code:

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 9 Simple I/O Interfacing

VRS540-4kB Flash, 128B RAM, 25~40MHz, 8-Bit MCU

VRS550-8kB Flash, 256B RAM, 25~40MHz, 8-Bit MCU VRS560-16kB Flash, 256B RAM, 40MHz, 8-Bit MCU

3.4 Tập lệnh

VRS570 32K Flash, 1kB RAM, 25~40MHz, 8-Bit MCU VRS580 64K Flash, 1kB RAM, 25~40MHz, 8-Bit MCU

Transcription:

NAME as31 - An Intel 8031/8051 assembler SYNOPSIS as31 [-h] [-l] [-s] [-v] [-Aarg] [-Ffmt] [-Ofile] infile.asm DESCRIPTION As31 assembles infile.asm into one of several different output formats. The output will be in a file called infile.hex. The.asm extenstion is required. OPTIONS The options must appear before the input file name. Both options are optional. The text of each flag must appear on the same argument as the flag. For example, "-Fod" is a valid argument, but "-F od" is not. h l s v Aarg This causes the assembler to print out a verbose message describing its options. The message is written to the standard error. This option tells the assembler to also generate a listing file. A listing will be placed in the file infile.lst. Where infile is the file that is being assembled. This option may appear anywhere before infile.asm. The option must occur isolated on the command line. The listing file shows the assembler generated code in hex, and up to 60 characters are retained from the source file. This causes the assembler to write output to standard output. This causes the assembler to print a version number to the standard output. This option specifies a format specific string which is passed to the format generator. Both format "tdr" and the srecord formats use this option. Fformat This options specifies the output format that is to be used. Currently the only options available for this are: hex This format is the Intel HEX format which is expected by a number of EPROM programmers and the PAULMON debugger. For use with some programmers, the output file s extension may have to be changed to.hex to be recognized by the programmer. No-A option is used. This format should be the default if no -F option is used. tdr byte od This format generates an asci file of hex digits formatted in such a way, so that they can be read by tdr s debugger. An argument can be specified (See -A option) which will pass a format specific string to the format generator. In this case, the argument string represents an offset to add to the location counter. This offset is specified in decimal and defaults to 64*1024 (0x10000). To specify and offset of 100, you would need "-Ftdr -A100" when invoking the assembler. This format is simply an address and a byte on each line, in ascii. No -A option is used. This format is similar to the output from od(1). The format consists of an address followed by sixteen hexadecimal bytes, followed by the equivilant ASCII. No -A option is used. srec2, srec3, srec4 The srecord generator is capable of generating output with any one of 2, 3, or 4 byte addresses. The -A option can be used to set the base address offset, the default here is 0x0000 (unlike tdr). 1

Ofile NOTE: This assembler allows for the output formats to be expanded to include many different output formats. This option tells the assembler to write the output to a file. ASSEMBLER INSTRUCTIONS This assembler accepts standard 8031/8051 instruction formats. Below is a list of instructions and addressing modes. INSTRUCTION BYTES CYCLES ----------- ----- ------ ACALL addr11 2 24 ADD A, #data8 2 12 ADD A, @Ri 1 12 ADD A, Rn 1 12 ADD A, direct 2 12 ADDC A, #data8 2 12 ADDC A, @Ri 1 12 ADDC A, Rn 1 12 ADDC A, direct 2 12 AJMP addr11 2 24 ANL A, #data8 2 12 ANL A, @Ri 1 12 ANL A, Rn 1 12 ANL A, direct 2 12 ANL C, /bit 2 24 ANL C,!bit 2 24 ANL C, bit 2 24 ANL direct, #data8 3 24 ANL direct, A 2 12 CJNE @Ri, #data8, rel 3 24 CJNE A, #data8, rel 3 24 CJNE A, direct, rel 3 24 CJNE Rn, #data8, rel 3 24 CLR A 1 12 CLR C 1 12 CLR bit 2 12 CPL A 1 12 CPL C 1 12 CPL bit 2 12 DA A 1 12 DEC @Ri 1 12 DEC A 1 12 DEC DPTR 1 12 DEC Rn 1 12 DEC direct 2 12 DIV AB 1 48 DJNZ Rn, rel 2 24 DJNZ direct, rel 3 24 INC @Ri 1 12 INC A 1 12 INC DPTR 1 24 INC Rn 1 12 INC direct 2 12 2

JB bit, rel 3 24 JBC bit, rel 3 24 JC relative 2 24 JMP @A + DPTR 1 24 JMP @DPTR + A 1 24 JNB bit, rel 3 24 JNC relative 2 24 JNZ relative 2 24 JZ relative 2 24 LCALL addr16 3 24 LJMP addr16 3 24 MOV @Ri, #data8 2 12 MOV @Ri, A 1 12 MOV @Ri, direct 2 24 MOV A, #data8 2 12 MOV A, @Ri 1 12 MOV A, Rn 1 12 MOV A, direct 2 12 MOV C, bit 2 12 MOV DPTR, #data16 3 24 MOV Rn, #data8 2 12 MOV Rn, A 1 12 MOV Rn, direct 2 24 MOV bit, C 2 24 MOV direct, #data8 3 24 MOV direct, @Ri 2 24 MOV direct, A 2 12 MOV direct, Rn 2 24 MOV direct, direct 3 24 MOVC A, @A + DPTR 1 24 MOVC A, @A + PC 1 24 MOVC A, @DPTR + A 1 24 MOVC A, @PC + A 1 24 MOVX @DPTR, A 1 12 MOVX @Ri, A 1 24 MOVX A, @DPTR 1 24 MOVX A, @Ri 1 24 MUL AB 1 48 NOP 1 12 ORL A, #data8 2 12 ORL A, @Ri 1 12 ORL A, Rn 1 12 ORL A, direct 2 12 ORL C, /bit 2 24 ORL C,!bit 2 24 ORL C, bit 2 24 ORL direct, #data8 3 24 ORL direct, A 2 12 POP direct 2 24 PUSH direct 2 24 RET 1 24 RETI 1 24 RL A 1 12 RLC A 1 12 3

RR A 1 12 RRC A 1 12 SETB A 1 12 SETB bit 2 12 SJMP relative 2 24 SUBB A, #data8 2 12 SUBB A, @Ri 1 12 SUBB A, Rn 1 12 SUBB A, direct 2 12 SWAP A 1 12 XCH A, #data8 2 12 XCH A, @Ri 1 12 XCH A, Rn 1 12 XCH A, direct 2 12 XCHD A, #data8 2 12 XCHD A, @Ri 1 12 XCHD A, Rn 1 12 XCHD A, direct 2 12 XRL A, #data8 2 12 XRL A, @Ri 1 12 XRL A, Rn 1 12 XRL A, direct 2 12 XRL direct, #data8 3 12 XRL direct, A 2 12 ASSEMBLER DIRECTIVES As31 includes the following assembler directives:.org expr Start assembling at the address specified by the expression expr. An error occurs if the assembler starts assembling over anaddress space that has previously been assembled into..equ symbol, expr Set symbol to the value of expr. The value for expr must be known during the first pass, when the line containing the.equ isencountered..byte expr, expr,... Assemble the bytes specified by the expression into memory. A string may also be specified with this directive..word expr, expr,... Assemble the words specified by the expression into memory. The byte ordering used, is that used by the 8031..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 bit address..end This directive is ignored. 4

.SKIP expr Adds the value of expr to the location counter. Used to reserve a block of uninitialized data. Expr should be in bytes. LEXICAL CONVENTIONS - All characters following a semi-colon are ignored until a newline is encountered. - All numbers default to decimal, unless the number starts with one of the following: 0x or 0X This indicates a hexadecimal number. ie. 0x00ff 0b or 0B This indicates a binary number. (1 s and 0 s). ie. 0b1100110010 0 This indicates an octal number. ie. 0377 - All numbers default to decimal, unless the number ends with one of the following characters: borb h or H dord ooro This indicates a binary number. Unless 0x was used above. ie. 1010101b This always indicates a hex number, However the if the first character is non-numerical, then either 0x or 0 must be specified. This avoids confusing the assembler into thinking a hex number is a symbol. For example: 0ffh, 0xffh, 0XffH, 20h, 0x20 and 020h are means to specify a valid hexdigit. But the following are not: ffh, 0ff. This forces a number to decimal. Unless 0X was used. ie. 129d This causes the number to be interpreted as octal. ie. 377o - Acharacter constant can be entered as c where c is some character. \b, \n, \r, \t, \ \0 are also valid. A character constant can be used anywhere that an integer value can. - Astring is entered as a set of characters enclosed in double quotes "". Astring is only valid with the.byte directive. \b, \n, \r, \t, \" are also valid escapes. However \0isnot. - 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 without assembler confusion. These words however cannot be defined as a user symbol. Any user symbol may be used, and case will be preserved. So the user symbols "foo" and "Foo" are different, but "addc" is the same as "addc". - Asymbol can be any alpha numerical character plus the underscore ( _ ). - Expressions are accepted in most places where a value or a symbol is needed. An expression consists of the following operators. All operators evaulate to integer objects (higher precedence opertors listed first): - Unary minus & Bit-wise AND. Bit-Wise OR. * Integer multiplication. / Integer division % Integer modulus + Integer addition. 5

- Integer subtraction. - In addition to these operators, a special symbol * may be used to represent the current location counter. EXAMPLES Below isasample assembly program..org 0 start: mov P3, #0xff ; use alternate fns on P3 ; leds on P1 are inverted. setb F0 ; climbing up mov A, #0x01 ; initial bit write: 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 write climbup: rl A ; up - shift left jnb ACC.7, write ; back for more clr F0 ajmp write.end ; this directive ignored. AUTHORS Ken Stauffer (University of Calgary) <stauffer@cpsc.ucalgary.ca> Martin Langer <martin-langer@gmx.de> 6