HP B3641 68000 Family Cross Assembler/Linker/ Librarian Notice
Total Page:16
File Type:pdf, Size:1020Kb
User’s Guide HP B3641 68000 Family Cross Assembler/Linker/ Librarian Notice Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material. Hewlett-Packard assumes no responsibility for the use or reliability of its software on equipment that is not furnished by Hewlett-Packard. © Copyright 1988, 1990, 1991, 1993, Hewlett-Packard Company. This document contains proprietary information, which is protected by copyright. All rights are reserved. No part of this document may be photocopied, reproduced or translated to another language without the prior written consent of Hewlett-Packard Company. The information contained in this document is subject to change without notice. IBM is a registered trademark of International Business Machines Corporation. MS and MS-DOS are registered trademarks of Microsoft Corporation. Windows is a trademark of Microsoft Corporation. Microtec is a registered trademark of Microtec Research Inc. SunOS, SPARCsystem, OpenWindows, and SunView are trademarks of Sun Microsystems, Inc. UNIX is a registered trademark of UNIX System Laboratories Inc. in the U.S.A. and other countries. Hewlett-Packard Company P.O . Box 2197 1900 Garden of the Gods Road Colorado Springs, CO 80901-2197, U.S.A. RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the U.S. Government is subject to restrictions set forth in subparagraph (C) (1) (ii) of the Rights in Technical Data and Computer Software Clause in DFARS 252.227-7013. Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A. iii Rights for non-DOD U.S. Government Departments and Agencies are set forth in FAR 52.227-19(c)(1,2). About this edition Many product updates and fixes do not require manual changes, and manual corrections may be done without accompanying product changes. Therefore, do not expect a one-to-one correspondence between product updates and manual revisions. Edition dates and the corresponding HP manual part numbers are as follows: Edition 1 64870-90902, March 1987 E0387 Edition 2 64870-90902, August 1987 E0887 Edition 3 64870-90902, April 1988 E00488 Edition 1 64874-97000, June 1989 Edition 4 64870-97001, December 1989 Edition 2 64874-97002, September 1990 Edition 5 64870-97002, October 1990 Edition 6 64870-97004, October 1991 Edition 3 64874-97004, October 1991 Edition 1 B3641-97000, -97001, -92000, May 1993 Edition 2 B3641-97002, September 1993 Certification and Warranty Certification and warranty information can be found on the pages before the back cover. iv In this Book If you will be using the assembler with the cc68k compiler, you may not need to use this manual, because cc68k calls the assembler with the appropriate options. This book is divided into two parts: Quick Start This part contains: • installation instructions • a brief tutorial • printed copies of the on-line manual pages Reference This part contains detailed reference information about the software, including: • descriptions of listing formats • details about assembler, linker, and librarian operation • descriptions of assembler error messages This book does not discuss how to use assembly language. v Contents Part 1 Quick Start Guide 1 Getting Started Installing on an HP Workstation 2 Installing on a Sun Workstation 2 Installing on a PC (MS-DOS) 2 Installing on a PC (Windows) 3 Description of the Example Program 4 The "mov_mesg.s" Program Module 4 The "transfer.s" Program Module 7 The "delay.s" Program Module 8 Assembling the Program Module Source Files 9 Creating an Example Library File 15 Linking the Program Module Relocatable Object Files 17 Linking the Object Modules 18 2 Command Syntax File Extensions 25 as68k(1) 26 ld68k(1) 32 ar68k(1) 44 vi Part 2 Reference 3 Assembler Introduction as68k Features 52 Assembler Statements 53 Label Field 54 Operation Field 54 Operand Field 54 Comment Field 54 Statement Examples 55 Instruction Statement 55 Directive Statement 56 Macro Statement 56 Comment Statement 56 Return Codes 57 Assembler Syntax 57 Assembler Character Set 58 Symbols 59 Reserved Symbols 60 Location Counter Symbol (*) 61 Symbol Types 61 Constants 62 Integer Constants 62 Floating-Point Constants 63 Character Constants 64 Expressions 66 Assembler Listing Description 68 Assembler Listing 68 Cross Reference Table Format 70 vii 4 Instructions and Address Modes Instructions 73 Qualifiers 74 Scope Qualifiers 74 Floating Point Qualifiers 75 Mnemonics 75 Floating Point Mnemonics 80 Variants of Instruction Types 83 Instruction Operands 84 Registers 84 Address Modes 88 The 68000 Model 90 The 68020 Model 91 The 68332 Model 92 Explanations of Address Modes 93 68881 Floating-Point Coprocessor and Address Modes 98 68040 Floating-Point Unit and Address Modes 99 Assembler Syntax for Effective Address Fields 100 Rules of Assembler Syntax 100 Operand Syntax and Addressing Modes 102 How Code is Generated for Forward Defined Symbols 111 User Control of Address Modes 112 A2-A5 Relative Addressing 114 Address Register Indirect with Displacement Modes 114 Advantages of A2-A5 Relative Addressing 115 viii 5 Relocation Program Sections 125 Common vs. Noncommon Attributes 125 Short vs. Long Attributes 126 Section Alignment Attribute 126 Section Contents Attributes 127 Other Things to Know About Sections 129 How the Assembler Assigns Section Attributes 130 Linking 131 Relocatable vs. Absolute Symbols 132 Relocatable Expressions 133 Label Alignment 135 6 Assembler Directives Notation 141 ALIGN 142 CHIP 143 COMLINE 145 COMMON 146 DC 148 DCB 151 DS 153 ELSEC 155 END 156 ENDC 157 ENDR 158 EQU 159 FAIL 161 FEQU 162 FILE 164 FOPT 165 FORMAT, NOFORMAT 166 IDNT 167 IFEQ, IFNE, IFGT, IFGE, IFLT, IFLE 168 IFC, IFNC 169 ix IFDEF, IFNDEF 171 INCLUDE 172 [NO]INTFILE 173 IRP 174 IRPC 175 LIST 176 LLEN 177 MASK2 178 NAME 179 NOLIST 180 NOOBJ 181 NOPAGE 182 OFFSET 183 OPT 185 ORG 191 PAGE 193 PLEN 194 REG 195 REPT 196 RESTORE 197 SAVE 198 SECT, SECTION 199 SET 201 SPC 202 TTL 203 XCOM 204 XDEF 205 XREF 206 7 Macros Macro Heading 211 Macro Body 212 Macro Terminator 213 Macro Call 214 LOCAL - Define Local Symbol 217 MEXIT - Alternate Macro Exit 219 Macro Parameter Count 220 8 Structured Control Statements Structured Control Expressions 223 x FOR...ENDF Loop 225 IF ... THEN ... ELSE ... ENDI Conditional Execution 227 REPEAT ... UNTIL Loop 229 WHILE ... ENDW Loop 230 BREAK - Premature Loop Exit 231 NEXT - Proceed to Next Loop Iteration 232 Structured Directive Nesting 233 Structured Directive Listings 234 9 Linker/Loader Introduction Linker/Loader Features 237 Linker/Loader Operation 237 Program Sections 238 Absolute Section 238 Relocatable Section 238 Noncommon Section 239 Common Section 239 Short Section 239 Long Section 240 Section Alignment 240 Section Contents 240 xi HP Section Type 241 Memory Space Assignment 241 Incremental Linking 243 Relocation Types 243 Generating HP Format Absolute Files 244 Return Codes 245 Loader Listing Description 245 Loader Listings 245 10 Linker/Loader Commands Summary of Commands 250 Command Format 253 Processing Order 253 ; (Comment) 255 # (Continuation) 256 ABSOLUTE 257 ALIAS 259 ALIGN{MOD} 260 BASE 261 [UPPER]CASE, [LOWER]CASE 262 CHIP 264 COMMON 266 CPAGE 267 [NO]DEBUG_SYMBOLS 268 END 269 ERROR, WARN, NOERROR 270 EXIT 271 EXTERN 272 FORMAT 273 INCLUDE 274 INDEX 276 Purpose of the INDEX Command 277 INITDATA 278 [NO]INTFILE 281 xii LIST 282 LISTABS 285 LISTMAP 286 LOAD 287 LOAD_SYMBOLS 289 MERGE 290 NAME 292 NLIST 293 NOPAGE 295 ORDER/SORDER 296 PAGE 299 PUBLIC 300 RESADD/RESMEM 302 SECT 304 SECTSIZE 305 START 306 11 Librarian Introduction Librarian Features 309 Librarian Operation 310 Librarian Function -- Overview 310 Command Syntax 316 Use of Special Characters 316 Blanks 317 Command File Comments 317 Module Names 317 Return Codes 318 Library Listing Format 318 Sample Test Program Description 318 Example Librarian Listing 319 Description of Example 320 xiii Brief Format Example Library Listing 320 Brief Format Listing Description 320 12 Librarian Commands Command Summary 322 ADDLIB 323 ADDMOD 324 CLEAR 325 CREATE 326 DELETE 327 DIRECTORY 328 END, EXIT, QUIT 330 EXTRACT 331 FULLDIR, LIST 332 HELP 333 OPEN 335 REPLACE 336 SAVE 337 A Assembler Error Messages B Loader Error Messages C Librarian Error Messages D Error Message Formats Error Classes 366 Warnings 366 Errors 366 Fatal Errors 367 xiv Interactive and Non-Interactive Conditions 368 E Converting to HP B3641 Assembly Language Converting HP 64845 Assembly Language Programs 370 Converting HP 64845 Pseudo-Ops 373 Converting HP 64845 Operands 377 Converting Character Constants 378 Converting Logical Operators 378 Converting HP 64845 Macros 379 Macro Headings 379 Unique Label Generation 379 Conditional Assembly Within Macros 380 Indexing Parameters 381 Converting HP 64845— Miscellaneous 382 White Space 382 Compatibility with older HP 64870 and HP 64874 Files 383 Relocatable and Library Files 383 Assembly Source Files 384 F About this Version Version 2.01 386 PC Platform Support 386 Re-organized manual 386 Version 2.00 386 Combined products 386 New features: as68k 386 New features: ld68k 388 xv Part 1 Quick Start Guide Part 1 Getting Started 1 Getting Started Installing and using the assembler, linker, and librarian. 1 Getting Started Installing on an HP Workstation This software uses standard HP-UX installation procedures. Look for installation instructions in your HP-UX System Administration manual. Installing on a Sun Workstation Look for installation instructions in the Software Installation Guide, which is packaged with the tape. Installing on a PC (MS-DOS) To install from MS-DOS: 1 Insert the assembler disk into the floppy disk drive. 2 Enter (if the floppy drive is drive A:) a:\install Follow the instructions on the screen.