8051 CROSS ASSEMBLER USER'S MANUAL MetaLink Corporation Chandler, Arizona MetaLink Corporation P.O. BOX 1329 Chandler, Arizona 85244-1329 (602) 926-0797 TELEX: 4998050 MTLNK FAX: (602) 926-1198 PURCHASE TERMS AND CONDITIONS Since MetaLink Corporation does business and is located solely in the State of Arizona, such orders or agreements and the rights of the parties hereunder shall be governed by the laws of the State of Arizona. PAYMENTS TERMS: Unless otherwise agreed upon, the TOTAL UNPAID BALANCE is due and payable 30 days following the invoice date. LIMITED WARRANTY: METALINK MAKES NO WARRANTIES OTHER THAN THOSE CONTAINED HEREIN AND METALINK EXPRESSLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES, INCLUDING ANY WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR OF MERCHANTABILITY. The foregoing limited warranty shall not apply unless Buyer has paid for in full the MetaLink products. Updates to the MetaLink Assembler User's Manual and MetaLink Assembler software are available free to Registered Buyer upon request for a one (1) year period from the invoice date. NOTICE MetaLink Corp. reserves the right to make improvements in the software product described in this manual as well as the manual itself at any time and without notice. DISCLAIMER OF ALL WARRANTIES AND LIABILITY METALINK CORP. MAKES NO WARRANTIES, EITHER EXPRESSED OR IMPLIED, WITH RESPECT TO THIS MANUAL OR WITH RESPECT TO THE SOFTWARE DESCRIBED IN THIS MANUAL, ITS QUALITY, PERFORMANCE, MERCHANTABILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. METALINK CORP. SOFTWARE IS SOLD OR LICENSED "AS IS". IN NO EVENT SHALL METALINK CORP. BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT IN THE SOFTWARE. Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 by MetaLink Corp. All rights are reserved. This manual may not, in whole or part, be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine readable form without the prior agreement and written permission of MetaLink Corp. MS-DOS is a trademark of Microsoft, Inc. IBMR is a registered trademark of IBM Corp. IntelR is a registered trademark of Intel Corp. MetaLink is a trademark of MetaLink Corp. T A B L E O F C O N T E N T S 1. 8051 OVERVIEW............................................1-1 1.1. Introduction........................................1-1 1.2. 8051 Architecture...................................1-2 1.3. Summary of the 8051 Family of Components............1-4 1.4. References..........................................1-5 2. 8051 CROSS ASSEMBLER OVERVIEW............................2-1 2.1. Introduction........................................2-1 2.2. Symbols.............................................2-1 2.3. Labels..............................................2-2 2.4. Assembler Controls..................................2-3 2.5. Assembler Directives................................2-3 2.6. 8051 Instruction Mnemonics..........................2-4 2.7. Bit Addressing......................................2-6 2.8. ASCII Literals......................................2-6 2.9. Comments............................................2-6 2.10. The Location Counter...............................2-7 2.11. Syntax Summary.....................................2-7 2.12. Numbers and Operators..............................2-7 2.13. Source File Listing...............................2-10 2.14. Object File.......................................2-11 3. RUNNING THE 8051 CROSS ASSEMBLER.........................3-1 3.1. Cross Assembler Files...............................3-1 3.2. Minimum System Requirements.........................3-1 3.3. Running the Cross Assembler.........................3-1 3.4. Example Running the Cross Assembler.................3-3 3.5. DOS Hints and Suggestions...........................3-3 3.6. References..........................................3-4 4. 8051 INSTRUCTION SET.....................................4-1 4.1. Notation............................................4-1 4.2. 8051 Instruction Set Summary........................4-4 4.3. Notes..............................................4-14 4.4. References.........................................4-14 5. 8051 CROSS ASSEMBLER DIRECTIVES..........................5-1 5.1. Introduction........................................5-1 5.2. Symbol Definition Directives........................5-1 5.3. Segment Selection Directives........................5-4 5.4. Memory Reservation and Storage Directives...........5-5 5.5. Miscellaneous Directives............................5-7 5.6. Conditional Assembly Directives.....................5-8 6. 8051 CROSS ASSEMBLER CONTROLS............................6-1 6.1. Introduction........................................6-1 6.2. Assembler Control Descriptions......................6-1 7. 8051 CROSS ASSEMBLER MACRO PROCESSOR.....................7-1 7.1. Introduction........................................7-1 7.2. Macro Definition....................................7-1 7.3. Special Macro Operators.............................7-4 7.4. Using Macros........................................7-4 7.4.1. NESTING MACROS...............................7-4 7.4.2. LABELS IN MACROS.............................7-6 8. 8051 CROSS ASSEMBLER ERROR CODES.........................8-1 8.1. Introduction........................................8-1 8.2. Explanation of Error Messages.......................8-2 Appendices A. SAMPLE PROGRAM AND LISTING...............................A-1 A.1. Source File.........................................A-1 A.2. Source File Listing.................................A-4 B. PRE-DEFINED BYTE AND BIT ADDRESSES.......................B-1 B.1. Pre-defined Byte Addresses..........................B-1 B.2. Pre-defined Bit Addresses..........................B-11 C. RESERVED SYMBOLS.........................................C-1 D. CROSS ASSEMBLER CHARACTER SET............................D-1 CHAPTER 1 8051 OVERVIEW 1.1. Introduction For new users of MetaLink's ASM51 Cross Assembler, please take a moment to fill out and return postage-prepaid User Registration Card. This card will be found with the system diskette in the vinyl jacket at the front of this manual. MetaLink will use this information to send out, free of charge, any software updates occurring during the warranty period. Respondents will also be notified of any new products or product enhancements. The 8051 series of microcontrollers are highly integrated single chip microcomputers with an 8-bit CPU, memory, interrupt controller, timers, serial I/O and digital I/O on a single piece of silicon. The current members of the 8051 family of components include: 80C152JA/JB/JC/JD, 83C152JA/JC, 80C157 80C154, 83C154, 85C154 8044, 8344, 8744 80C451, 83C451, 87C451 80C452, 83C452, 87C452 8051, 8031, 8751, 80C51, 80C31, 87C51 80512, ...
abys