Assembler/Linker/Librarian
Total Page:16
File Type:pdf, Size:1020Kb
The Western Design Center, Inc. September 2005 Assembler/Linker v3.49 SOFTWARE DEVELOPMENT SYSTEM ASSEMBLER/LINKER/LIBRARIAN The Western Design Center, Inc. 2005 1 The Western Design Center, Inc. September 2005 Assembler/Linker v3.49 THIS PAGE LEFT INTENTIONALLY BLANK The Western Design Center, Inc. 2005 2 The Western Design Center, Inc. September 2005 Assembler/Linker v3.49 Table of Contents CHAPTER 1 Introduction ....................................................................................................................... 9 Assembler ...............................................................................................................................................................................9 Linker .....................................................................................................................................................................................9 Librarian ................................................................................................................................................................................9 Manual organization............................................................................................................................................................10 CHAPTER 2 Files................................................................................................................................... 11 Source files............................................................................................................................................................................11 Macro files............................................................................................................................................................................11 Object modules and libraries..............................................................................................................................................11 Output files...........................................................................................................................................................................11 CHAPTER 3 Program Structure .......................................................................................................... 13 Modules.................................................................................................................................................................................13 Sections .................................................................................................................................................................................13 Pre-defined sections.............................................................................................................................................................14 Absolute versus Relative .....................................................................................................................................................14 Section location ....................................................................................................................................................................15 Copying data ........................................................................................................................................................................15 Startup.ASM ........................................................................................................................................................................16 Nintendo development.........................................................................................................................................................18 CHAPTER 4 Statement Syntax............................................................................................................. 19 Comments.............................................................................................................................................................................19 Labels....................................................................................................................................................................................19 Operation..............................................................................................................................................................................19 Processor Instructions .....................................................................................................................................................20 Assembler Directives .......................................................................................................................................................20 Section Directives.............................................................................................................................................................20 Macro Calls ......................................................................................................................................................................20 Operands ..............................................................................................................................................................................20 Operators..........................................................................................................................................................................20 Unary Operators..............................................................................................................................................................21 Binary Operators .............................................................................................................................................................21 Comparison Operators....................................................................................................................................................21 Operator Precedence Table ............................................................................................................................................21 Numbers............................................................................................................................................................................22 Addresses..........................................................................................................................................................................22 Immediate Operands .......................................................................................................................................................23 Character Constants and Strings ...................................................................................................................................23 Program Counter.............................................................................................................................................................23 Assembler Addressing Modes.........................................................................................................................................24 CHAPTER 5 Macros and Conditionals................................................................................................ 25 Macros ..................................................................................................................................................................................25 Macro Definition..............................................................................................................................................................25 Calling a Macro................................................................................................................................................................25 Redefining Assembler Directives and Opcodes.............................................................................................................26 Macro Labels....................................................................................................................................................................26 Conditional assembly...........................................................................................................................................................27 CHAPTER 6 WDCxxAS (ASSEMBLER)............................................................................................ 29 Running the Program..........................................................................................................................................................29 Option Summary .................................................................................................................................................................29 Option Descriptions .............................................................................................................................................................29 The Western Design Center, Inc. 2005 3 The Western Design Center, Inc. September 2005 Assembler/Linker v3.49 CHAPTER 7 WDCLN (LINKER) ........................................................................................................33 Running the Program..........................................................................................................................................................33 Option Summary .................................................................................................................................................................34