MICROCOMPUTER MN1030 MN1030 Series Cross Assembler User’s Manual Pub.No.
PanaXSeries is a trademark of Matsushita Electric Industrial Co., Ltd. Sun and Sun OS are registered trademarks of Sun Microsystems Inc. of the United States. MS-DOS is a registered trademark of Microsoft Corporation of the United States. VZ Editor is a registered trademark of Village Center, Inc. PC/AT is a registered trademark of the International Business Machines Corporation of the United States. UNIX is a registered trademark licensed by X/Open Co., Ltd. in the United States and/or other countries.
About This Manual This manual describes the functions and operation of the cross assembler for this series of microcomputers. • Manual Features • Chapters on installation, program development flow, and introductory operation are provided, so first-time users can quickly get an overview and easily master operation. • Optimization, a special feature of the cross assembler, is explained in its own chapter.
• How to read Chapter 1 Installation Heading 1.3.4 Environment Settings Before using the Cross-Assembler, verify or change the following two files. CONFIG.SYS If FILES and BUFFERS specifications do not already exist in CONFIG.SYS, then you must add them. If they do already exist, then check their settings, and change them if necessary. Program example FILES=20 BUFFERS=20 NOTE: Be sure to make these settings.
• Related Manuals The following related manuals are available. Please contact our sales representative for more details.
Chapter 1 Getting Started Chapter 2 Program Development Flow Chapter 3 Introduction to Operation Chapter 4 Optimization Chapter 5 Using Assembler Chapter 6 Using Linker Chapter 7 Types of Source Statements Chapter 8 Chapter 9 Chapter 10 Writing Source Statements Writing Machine Language Instruction Statements and Directive Statements Writing Assembler Control Statements Chapter 11 Writing Macro Control Statements Chapter 12 List of Machine Language Instructions Chapter 13 Error Messages
Table of Contents Chapter 1 1.1 1.2 1.3 1.4 1.5 1.6 Getting Started Purpose of This Chapter............................................................................................................................. 2 Operating Environment .............................................................................................................................. 3 File Organization...........................................................................................................................
6.2 Starting Linker ......................................................................................................................................... 85 6.3 Command Options ................................................................................................................................... 88 6.3.1 Output File Options ....................................................................................................................... 89 6.3.2 Error Message Options ...................
9.4.4 listoff, liston ................................................................................................................................. 9.4.5 notation......................................................................................................................................... 9.4.6 org ................................................................................................................................................ 9.4.7 opt............................................
12.3.1 12.3.2 12.3.3 12.3.4 12.3.5 12.3.6 12.3.7 Data Move Instructions.............................................................................................................. Arithmetic Instructions .............................................................................................................. Logical Instructions ................................................................................................................... Bit Manipulation Instructions ...........................
16.2.6 Error Correction Using Tag Jumps ............................................................................................ 306 Chapter 17 Appendix 17.1 Numeric Restrictions............................................................................................................................ 17.2 List of Command Options .................................................................................................................... 17.2.1 List of Assembler Command Options................
Chapter 1 Getting Started 1
Chapter 1 Getting Started 1.1 Purpose of This Chapter This chapter describes the operating environment for this system and the usage of the file conversion tool.
Chapter 1 Getting Started 1.2 Operating Environment This system runs on the following workstations, personal computers and compatibles. Host machine Operating system Version of OS Sun/Sparc Solaris 2.
Chapter 1 Getting Started 1.3 File Organization The installation media for this system contain the following files. as103 (assembler) as103 is the assembler. For a description, see Chapter 5 "Using Assembler." ld103 (linker) ld103 is the linker. For a description, see Chapter 6 "Using Linker." slib103 (library manager) slib103 is the library manager, a utility for creating library files. For a description, see Chapter 15 "Using Library Manager.
Chapter 1 Getting Started 1.4 Installation For the installation media, installation procedures, and notes on installation, see the Installation Manual.
Chapter 1 Getting Started 1.5 Setup These procedures are for setting up this system when it has just been installed or for altering basic settings. Setting command path Unix uses the environment variable PATH when searching for executable files. Setting up this variable properly allows users to omit the directory name for commands and run them using their base names only.
Chapter 1 Getting Started NOTE: Note that the command line is preceded when specifying the option which can be set in an environmental setting file with the command line at starting the assembler and the linker. Refer to the Chapter 5 “Using Assembler” for the assembler and to the Chapter 6 “Using Linker” for the linker. The order of precedence is as follows.
Chapter 1 Getting Started The start-up file .as103rc supports the following keywords. Keyword Description message This entry specifies the language and coding scheme for messages from the assembler. One of the parameters ENGLISH, EUC, SJIS, or JIS comes after the keyword “message” followed by a blank space. These parameters have the following meanings.
Chapter 1 Getting Started Keyword Description En-OPTION This entry controls the output of debugging of the symbol table to the executable file. Either ON or OFF of the parameters comes after the keyword En-OPTION followed by a blank space. These parameters have the following meanings. En-OPTION ON Disable output of the symbol table to the executable file. En-OPTION OFF Enable output of the symbol table to the executable file.
Chapter 1 Getting Started 1.6 File Conversion Utility This file conversion utility converts an EX format file produced by the linker into a file in Intel HEX format, or Motorola S format. General command format The general command format used to start the file conversion utility is shown below. excv103 [options] EX format file name Contents of brackets [ ]may be omitted. Options Option Description -j Displays error and warning messages in Japanese.
Chapter 1 Getting Started Default specification See the default settings for the following operations. Operation Message to output Default Setting UNIX and PC/AT versions: English DOS/V version: Japanese Conversion method Not with a work file Output format Intel HEX format Padding No padding Output file name The same file name as EX format file but with “.hex” or “.rom” extensions. Conversion range From the start to the end address in EX format file.
Chapter 1 Getting Started Example of specifying options 1. Specify the range of data conversion. (-R) excv103 -R1000, 1020 sample.ex Converts the data between the address 1000 and the address 1020 in the file of sample.ex. 2. Specify the start address upon format conversion. (-A) excv103 -A1000 sample.ex In the file of sample.ex, the information of start address specified when linking has been set. It will be needed when changing the start address for the format conversion.
Chapter 2 Program Development Flow 2
Chapter 2 Program Development Flow 2.1 Purpose of This Chapter Programs can be developed with a compiler or an assembler. Currently most program development is done with a compiler, but an assembler is where compact code generation or faster processing speed is required. This chapter gives an overview of development with the assembler, and explains the flow of development through completion.
Chapter 2 Program Development Flow 2.2 Program Development Flow Main development flow The microcomputers are used in such diverse applications as AV equipment, household electronics, information equipment, automobiles, robots, portable phones, computer peripherals, etc. Programs developed with the Cross-Assembler are ultimately incorporated into these products.
Chapter 2 Program Development Flow Source code debugger The software developed on a workstation or personal computer must be checked using a hardware environment similar to that used by the final product. Nearly all of this series microcomputers will ultimately be incorporated within end products. Therefore, program debugging must also be performed under the same conditions as the end product. This is why a source code debugger and in-circuit emulator are provided.
Chapter 2 Program Development Flow 2.3 Programming with Assembler Before creating programs using the assembler, you must understand the following items. Required knowledge • Machine-language instructions • Device operation • Editor use • C compiler use • Assembler and linker use (in this manual) • Debugger use Program development is an iterative process of editing, assembling, linking, and debugging many times until finished.
Chapter 2 Program Development Flow Programming style It is important to use a consistent style for program coding from start to finish. When several people are to create a program, they should meet in advance to decide on a common style. You should consider the following points regarding the fixed style of the Cross Assembler. • Header files Constants and variables used in all files and define identifiers used in common should be gathered into a single header file.
Chapter 2 Program Development Flow Conditional assembly If a program for product A is to be created by partially modifying a program for product B, both can be combined into a single program by using conditional assembler control instructions. Conditional assembly is done by defining a single symbol at the start of the program using a define control directive. Here is an example.
Chapter 2 Program Development Flow 20 Programming with Assembler
Chapter 3 Introduction to Operation 3
Chapter 3 Introduction to Operation 3.1 Purpose of This Chapter Many options are provided with the Cross-Assembler and Linker, but you can use the assembler and linker without knowing all of them. This chapter explains how to use the most useful options while demonstrating actual operation. This chapter first uses an example to show how to run the assembler and linker.
Chapter 3 Introduction to Operation 3.2 Files Used by Assembler and Linker Figure 3-1 shows the inter-relationships of the files used by the assembler and linker. Map file Source file Include file SAMPLE.MAP SANPLE.ASM SAMPLE.H -a -l List file Assembler SAMPLE.LST Library file SAMPLE.LIB Relocatable object files SAMPLE.RF ... Linker -m Map file m103.map Executable file m103.ex Figure: 3-1 Files Used The assembler inputs source files and include files, and outputs relocatable object files.
Chapter 3 Introduction to Operation Depending on the option specifications input for the source file and map file, a list file will be output with fully resolved addresses. The map file is used to output a list file with fully resolved addresses. The linker inputs relocatable object files output by the assembler and, depending on option specifications, library files. It generates an executable format file and, depending on option specifications, a map file.
Chapter 3 Introduction to Operation 3.3 Basic Operation of Assembler and Linker The Cross-Assembler uses a section address format, in which the start address for each section as defined with the section directive corresponds to its start address when linked. This allows the programmer to freely change the order of linking files. The following explanation illustrates a simple example of only one section. In this example you will assemble and link two source files, program1.asm and program2.asm.
Chapter 3 Introduction to Operation The contents of program2.asm are as follows. __CODE data_set global section data_set CODE, PUBLIC, 1 mov 0, D2 cmp bcc D1, D2 data_set_end mov add add bra D0, (A00 1, D2 2, A0 data_set_loop data_set_loop data_set_end rts end program2.asm also consists of a section called _CODE (attribute CODE, link type PUBLIC), and it makes an external declaration of data_set. Assemble Assemble the two programs that you created to generate relocatable object files.
Chapter 3 Introduction to Operation Link Link the two relocatable object files to generate an executable format file. A map file will be generated along with the executable format file at this time. ld103 -m -T_CODE=40000000 program1.rf program2.rf m option Option to output map file. T option Option to specify section address. The above command line links two relocatable object files (program1.rf and program2.rf) and creates an executable file (m103.ex) and a map file (m103.
Chapter 3 Introduction to Operation The contents of the final list file program1.lst are as follows. Loc 40000000 40000000 40000002 40000005 40000008 40000010 40000014 40000024 *** Symbol program1.lst Page 1 *** PanaX Series MN1030 Cross Assembler Object Line Source 1 global 2 3 _CODE section 4 main 9000 5 mov 2CFF00 6 mov 2D8000 7 mov F8FEFCFCFF0C0000 8 jsr 00F8FE04 8 CAF2 9 bra 10 11 _DATA section 00000000 12 data1 ds 13 end program1.
Chapter 3 Introduction to Operation The contents of the final list file program2.lst are as follows. Loc 40000016 40000016 40000018 40000018 40000019 4000001b 4000001c 4000001e 40000020 40000022 40000022 *** Symbol program2.lst Page *** PanaX Series MN1030 Cross Object Line Source 1 2 3 _CODE 4 data_set 8A00 5 6 7 data_set_ A6 8 C60A 9 10 60 11 2A01 12 2002 13 CAF8 14 15 16 data_set__ F0FC 17 18 program2.
Chapter 3 Introduction to Operation 3.4 Assembling and Linking Multiple Sections In section 3.3, "Basic Operation of the Assembler and Linker", source files each comprising one section were assigned to the same section as a basic example. However, normally a program will be divided into multiple sections to clearly divide programs by function and type. The start addresses of a program in section format are set for each section during linking.
Chapter 3 Introduction to Operation The contents of program4.asm are as follows.
Chapter 3 Introduction to Operation generate list files (program3.lst and program4.lst) respectively in the current directory (l option). Adding debug information (g option) enables symbols to be used during debugging. Let's take a look at the list files that were created. The contents of the list file program3.lst are as follows. Note that the symbol table is not displayed. Loc 00000000 00000000 00000002 00000005 00000008 00000010 00000014 0000001c 00000020 00000000 program3.
Chapter 3 Introduction to Operation The contents of the list file program4.lst are as follows. Note that the symbol table is not displayed. Loc 00000000 00000000 00000002 00000002 00000003 00000005 00000006 00000008 0000000a 0000000c 0000000c 00000000 00000000 00000002 00000002 00000003 00000005 00000007 00000007 program4.
Chapter 3 Introduction to Operation Link Link the two relocatable object files to generate an executable format file. Specify the g option to add debug information to the executable format file. A>ld103 -m -g -T_CODE_00=800000000 -T_CODE_01=80005000 program3.rf program4.rf m option Option to output map file. g option Option to add debug information to the executable format file. T option Option to specify section address. The above command line links two relocatable object files (program3.
Chapter 3 Introduction to Operation Generate final list files After link processing is complete, generate the final list files using the map file (program3.MAP). This will show what happens to the previous '+' and 'R' marks. as103 -l -a m103.map program3.asm as103 -l -a m103.map program4.asm l option Option to output a list file. a option Option to use a map file. Specify the map file name after the a option, followed by the source file name.
Chapter 3 Introduction to Operation The contents of the final list file program4.lst are as follows. Note that the symbol table is not displayed. Loc 80005000 80005000 80005002 80005002 80005003 80005005 80005006 80005008 8000500a 8000500c 8000500c 80000022 80000022 80000024 80000024 80000025 80000027 8000002a 8000002a program4.
Chapter 3 Introduction to Operation program locations after linking program locations in the executable file after linking as above are shown below. 0X0000 ~~ ~~ Unused 0X080000 ~~ ~~ main 0X080016 time_filler 0X08001E ~~ ~~ Unused 0X080200 ~~ ~~ data_set 0X08020E data1 0X080211 ~~ ~~ Unused ~~ ~~ Figure: 3-2 program Location If the program contains multiple sections, it is laid out using the following rules. • Each section is assigned the starting address specified to the linker.
Chapter 3 Introduction to Operation 3.5 Conditional Assembly and Linking The Cross-Assembler provides many assembler directives. Assembler directives are not converted directly to machine language, but are used to control how the assembler processes. For example, during the development stage a programmer may want to include a special program only for debugging. This program must be deleted when the product is complete.
Chapter 3 Introduction to Operation Assemble and link Assemble and link the program that you have created. as103 program5.asm ld103 -m -T_CODE=400000000 program5.rf as103 -l -a m103. program5.asm The first assembly generates the relocatable object file program5.rf. The second assembly generates the final list file program5.lst. See the contents of the list file that was generated. The contents of the final list file program5.lst are as follows. Note that the symbol table is not displayed.
Chapter 3 Introduction to Operation Select false condition, assemble, and link Make the define source statement line into a comment line, or just delete it. Then assemble and link with the same procedure as before. as103 program5.asm ld103 -m -T_CODE=40000000 program5.rf as103 -l -a m103.map program5.asm The contents of the final list file program5.lst are as follows. Note that the symbol table is not displayed. Loc 40000000 40000000 40000006 40000008 4000000C 40000010 program5.
Chapter 3 Introduction to Operation In the previous file, you either deleted the define line or made it into a comment, so you can use it to once again select the true condition. as103 -D DEBUG program5.asm ld103 -m -T_CODE=40000000 program5.rf as103 -l -a m103.map -D DEBUG program5.asm D option Option to specify an identifier (DEBUG), having the same effect as specifying define DEBUG in the source file. The contents of the final list file program5.lst are as follows.
Chapter 3 Introduction to Operation 42 Conditional Assembly and Linking
Chapter 4 Optimization 4
Chapter 4 Optimization 4.1 Purpose of This Chapter The assembler and linker examine source statements containing conditional branches, unconditional branches, subroutine calls, data transfer instructions, arithmetic instructions, logical instructions, bit manipulation instructions, and user-defined instructions to determine the shortest possible machine language instruction corresponding to the instruction. This chapter uses examples to explain what optimization is.
Chapter 4 Optimization 4.2 Rules of Usage To use the optimization function, optimization must be turned on by using the O option or by placing an opt directive at the start of the source file. opt NOTE: on Optimization is off by default.
Chapter 4 Optimization 4.3 Usage Example Optimization Instructions Optimization covers the following conditional branches, unconditional branches, subroutine calls, data transfer instructions, arithmetic instructions, logical instructions, bit manipulation instructions, and user-defined instructions.
Chapter 4 Optimization Table 4-3 Data Transfer Instructions Subject To Optimization Instruction MOV MOV MOV MOV MOVBU MOVBU MOVB MOVB MOVHU MOVHU MOVH MOVH MOV MOV MOV MOV MOV MOV MOV MOV MOVBU MOVBU MOVBU MOVBU MOVB MOVB MOVB MOVB MOVHU MOVHU MOVHU MOVHU MOVH MOVH MOVH MOVH MOV MOV (abs), An (abs), Dn An, (abs) Dn, (abs) (abs), Dn Dn, (abs) (abs), Dn Dn, (abs) (abs), Dn Dn, (abs) (abs), Dn Dn, (abs) (d, An), An (d, An), Dn (d, SP), An (d, SP), Dn An, (d, An) An,(d, SP) Dn, (d, An) Dn, (d, SP) (d, An), Dn
Chapter 4 Optimization Table 4-4 Arithmetic Instructions Subject To Optimization Instruction ADD imm, An ADD imm, Dn ADD imm, SP AND imm, Dn CMP imm, An CMP imm, Dn Type Immediate addressing Branch Range 32-bit immediate data Table 4-5 Logical Instructions Subject To Optimization Instruction OR imm, Dn XOR imm, Dn Type Immediate addressing Branch Range 32-bit immediate data.
Chapter 4 Optimization Table 4-7 Data Transfer Instructions Subject To Optimization Instruction Type UDF00 imm, Dn UDF01 imm, Dn UDF02 imm, Dn UDF03 imm, Dn UDF04 imm, Dn UDF05 imm, Dn UDF06 imm, Dn UDF07 imm, Dn UDF08 imm, Dn UDF09 imm, Dn UDF10 imm, Dn UDF11 imm, Dn UDF12 imm, Dn UDF13 imm, Dn UDF14 imm, Dn UDF15 imm, Dn UDFU00 imm, Dn UDFU01 imm, Dn UDFU02 imm, Dn UDFU03 imm, Dn UDFU04 imm, Dn UDFU05 imm, Dn UDFU06 imm, dn UDFU07 imm, Dn UDFU08 imm, Dn UDFU09 imm, dn UDFU10 imm, Dn UDFU11 imm, Dn UDFU
Chapter 4 Optimization Optimization processing of conditional branch instructions The linker resolves address values for labels when linking multiple files. In the example below, the linker will determine whether or not the label coded as an operand is within the allowable range of the current instruction. If not in range, the linker will replace it with instructions for a wider branch range. Take the BEQ instruction for example. BEQ LABEL ......
Chapter 4 Optimization Optimization of function calls This section describes the optimization of function calls by the linker. The assembler provides advanced processing for function calls. This processing uses a combination of the call and ret instructions and the global and funcinfo directives. The following is an example.
Chapter 4 Optimization Table 4-8 Substituted Instructions For Out-Of Range Conditional Branch Instructions Source Instruction Candidate instruction 1 Candidate instruction 2 BLT LABEL BRA LABEL BGT LABEL BGT LABEL BGE LABEL BGE LABEL BLE LABEL BLE LABEL BCS LABEL BCS LABEL BHI LABEL BHI LABEL BCC LABEL BCC LABEL BLS LABEL BLS LABEL BEQ LABEL BEQ LABEL BNE LABEL BNE LABEL BVC LABEL BVC LABEL BVS LABEL BVS LABEL BNC LABEL BNC LABEL BNS LABEL BNS LABEL BGE *+5 JMP LABEL BLE *+5
Chapter 4 Optimization Optimization of data transfer, arithmetic, logical, bit manipulation and user-defined instructions For data transfer, arithmetic, logical, bit manipulation, and user-defined instructions, the assembler uses the shortest instruction available for expressing the specified immediate data, memory address, or displacement data. The user thus obtains optimal code size without having to worry about instruction variants.
Chapter 4 Optimization Table 4-10 optimization of data transfer, arithmetic, logical bit manipulation...
Chapter 4 Optimization Example: branch destination of conditional branch instruction within range This example shows a branch in the permitted range (-128 to 127 of PC) of a BCC LABEL conditional branch instruction. The source list is as follows. _TEXT opt on section CODE, PUBLIC,1 mov 0, D2 sub_func addr_set cmp D1, D2 bcc func_end org addr_set+127 func_end rts end The final list file after assembly is shown next. The start address during linking is assumed to be 40000000 (hex.).
Chapter 4 Optimization Example: branch destination of conditional branch instruction out of range This example shows a branch outside the permitted range (-128 to +127 of PC) of a BCC LABEL conditional branch instruction. The source list is as follows. _TEXT opt on section CODE, PUBLIC,1 mov 0, D2 sub_func addr_set cmp D1, D2 bcc func_end org addr_set+128 func_end rts end The final list file after assembly is shown next.
Chapter 4 Optimization Example: unconditional branch instruction converted to relative branch This example shows the branch destination of a JMP LABEL unconditional branch instruction within the permitted range (-128 to +127 of PC) for relative branching. The source list is as follows. _TEXT opt on section CODE, PUBLIC,1 jmp func_end org addr_set+127 sub_func addr_set fun_end end The final list file after assembly is shown next.
Chapter 4 Optimization Example: subroutine call converted to a relative branch This section gives an example of a CALLS LABEL instruction with a target address within the range of a relative jump--that is, between -32,768 and +32,767 from the current program counter. The source list is as follows. _TEXT opt on section CODE, PUBLIC,1 calls func_end org addr_set+128 sub_func addr_set func_end rts end The final list file after assembly is shown next.
Chapter 5 Using Assembler 5
Chapter 5 Using Asssembler 5.1 Purpose of This Chapter This Chapter describes assembler operating procedures. Chapter 3 "Introduction to Operation" described the basic operation of the assembler and linker, but this one describes the many options available with the assembler and gives examples.
Chapter 5 Using Assembler 5.2 Starting Assembler The assembler is started by entering the command name and the desired parameters. The command name differs depending on the device being used. This chapter uses the terminology of as103 as its general format. General format of commands Below is the general format of the command to use when starting the assembler. as103 [options] source_filename Contents of brackets [ ] may be omitted.
Chapter 5 Using Asssembler Summary of options The following Table lists the available command line options. Table 5-1 Assembler Options Option Type Symbol o file_name Specify the relocatable object file name to be output. l Output a list file. Li Do not output files included by include to the list file. Lm Do not output assembler source created by macro expansion using macro or irp to the list file. Output only the machine language code. Ls Do not output a symbol table to the list file.
Chapter 5 Using Assembler 5.3 Command Options This section describes the options available for the assembler. The assembler has an abundance of options for controlling assembler processing and output files. Not all options are available at the same time. Certain options have default values that are used when the option is not specified. These defaults have been chosen to reflect the most frequently used settings. As long as the default settings are acceptable, it is possible to omit most options.
Chapter 5 Using Asssembler 5.3.1 Output File Options o file_name Specify the relocatable object file name to be output Functional description This option specifies the relocatable object file name to be output by the assembler. If the specified file already exists, its previous contents will be erased. If a path name that does not exist is specified, the assembler will display an error message and suspend processing.
Chapter 5 Using Assembler l Output a list file Functional Description This option outputs a list file. The file name of the list file will be the source file name with the extension .lst. The list file will be generated in the same directory as the source file. If any assembler errors are detected, error information will also be written to the list file. Rules of Use This option is specified with the hyphen (-) option specification character, followed by the lower-case letter 'l'. as103 -l sample.
Chapter 5 Using Asssembler Li Do not output files included by include to the list file Functional Description This option suppresses output of source file contents included by assembler directive (include) to the list file. However, the machine language code will be written to the relocatable object file. This option is convenient when you need a listing only for a particular source file while debugging. The Li option specification will be ignored for source files that do not have any include statements.
Chapter 5 Using Assembler Lm Do not output files included by include to the list file Functional Description This option suppresses output of assembler source created by macro expansion using macro directives macro and irp to the list file. Only display of machine language instruction mnemonics will be suppressed; machine language code will be output. By using names that represent their processing actions, macro names can make listings easier to read.
Chapter 5 Using Asssembler Do not output source statements that were not assembled due to unfulfilled conditions of conditional assembly to the list file Lc Functional Description This option suppresses output of blocks of unsatisfied conditions with conditional assembly to the list file. It also suppresses source statements of conditional directives. Rules of Use This option is specified with the hyphen (-) option specification character, followed by the upper-case letter 'L' and lower-case letter 'c'.
Chapter 5 Using Assembler Ls Do not output a symbol table to the list file Functional Description This directive suppresses output of a symbol table when the list file is output. Rules of Use This option is specified with the hyphen (-) option specification character, followed by the upper-case letter 'L' and lower-case letter 's'. The pair of characters of Ls are handled as a single option. as103 -Ls -l sample.
Chapter 5 Using Asssembler 5.3.2 Error Message Options j Output error and warning messages in Japanese Functional Description This option causes all error and warning messages and help screens sent to the console or the listing file to appear in Japanese. The character coding depends on the host machine and the operating system.
Chapter 5 Using Assembler Je Output error and warning messages in Japanese using EUC encoding Functional Description This option causes all error and warning messages and help screens sent to the console or the listing file to appear in Japanese using EUC coding. Rules of Use To specify the option, enter the hyphen (-) followed by the upper case letter 'J' and the lower case letter 'e'. The two letters together function as a single option. as103 -Je sample.
Chapter 5 Using Asssembler Js Output error and warning messages in Japanese using Shift JIS encoding Functional Description This option causes all error and warning messages and help screens sent to the console or the listing file to appear in Japanese using Shift JIS coding. Rules of Use To specify the option, enter the hyphen (-) followed by the upper case letter 'J' and the lower case letter 's'. The two letters together function as a single option. as103 -Js sample.
Chapter 5 Using Assembler Jj Output error and warning messages in Japanese using JIS encoding Functional Description This option causes all error and warning messages and help screens sent to the console or the listing file to appear in Japanese using JIS coding. Rules of Use To specify the option, enter the hyphen (-) followed by the upper case letter 'J' and the lower case letter 'j'. The two letters together function as a single option. as103 -Jj sample.
Chapter 5 Using Asssembler e Output error and warning messages in English Functional Description This option causes all error and warning messages and help screens sent to the console or the listing file to appear in English. Rules of Use To specify the option, enter the hyphen (-) followed by the lower case letter 'e'. as103 -e sample.asm Default Specification The default language used depends on the host machine and the operating system.
Chapter 5 Using Assembler W number Do not output warning messages of the specified number Functional Description This option suppresses output of warning messages generated during assembler operation. For a list of warning messages and their numbers, see Chapter 13 "Error Messages." The assembler ignores specifications for warning numbers that do not have messages assigned to them. Rules of Use To specify the option, enter the hyphen (-) followed by the upper case letter 'W' and the number.
Chapter 5 Using Asssembler 5.3.3 Preprocessor Options I path_name Specify the trace directory of the include file. Functional Description Trace from the directory that specifies the include file in the assembler source file. If the absolute path starting with “/” is written, tis option is invalid. Assembler traces the include file from the directory as follows. 1. Directory contains assembler source file 2. Directory specified with -I option.
Chapter 5 Using Assembler D identifier Specify an identifier to be used by ifdef during conditional assembly Functional Description The assembler directives #ifdef, #else, and #endif select which source statements are to be assembled depending on whether an identifier has been defined by a define directive. The D option has the same function as the define directive, but with direct specification from the command line. Identifier specifications by define directives in source statements may be omitted.
Chapter 5 Using Asssembler 5.3.4 Program Generation Options g Output debug information to the relocatable object file Functional Description This option causes the assembler to include in the relocatable object file information for use in debugging at the source code level.
Chapter 5 Using Assembler O Turn on optimization Functional Description This option enables optimization of instructions by the assembler and linker. For the instructions subject to optimization, see Chapter 4 "Optimization Functions." Rules of Use To specify the option, enter the hyphen (-) followed by the upper case letter 'O'. as103 -O sample.asm Default Specification The default is to suppress optimization.
Chapter 5 Using Asssembler 5.3.5 Other Options h Display listing of available assembler option on the console Functional Description This option displays assembler command options and their descriptions to the screen. The -j, -Je, -Js, -Jj, and -e options, if they appear, control the language and the coding scheme used to display this information. Rules of Use To specify the option, enter the hyphen (-) followed by the lower case letter 'h'.
Chapter 5 Using Assembler 5.4 Operation Examples There are three steps to perform when you need a final list file with resolved addresses. 1. With the assembler, generate a relocatable object file (.rf). 2. With the linker, generate an executable format file (.ex) and map file (.map). 3. With the assembler again, use the map file to generate a final list file (.lst) with addresses resolved by the linker.
Chapter 5 Using Asssembler Generation of final list file with resolved program addresses The final list file is generated as follows. 1. First use the assembler to generate a relocatable object file. Valid options at this stage are o, I, D, g, and the optimization options (O, Od). 2. Next use the linker to generate an executable format file by specifying the start address of each section and linking multiple files. Specify the linker's m option to generate the map file.
Chapter 6 Using Linker 6
Chapter 6 Using Linker 6.1 Purpose of This Chapter This chapter explains how to use all the options provided by the linker. The linker reads relocatable object files output by the assembler, outputs an executable format file, and if specified by option outputs a map file containing link information. If optimization was specified at the assembly stage, the linker will also adjust code such that it outputs optimal code for conditional and unconditional branch instructions.
Chapter 6 Using Linker 6.2 Starting Linker The linker is started by entering a command name and parameters, just as for other MS-DOS external commands. The parameters are linker options and names of files to be linked. The command name differs depending on the device being used. This chapter uses the terminology of ld103 as is general format. General format of commands Below is the general format of the command to use when starting the linker. ld103 [options] relocatable_object_filename ...
Chapter 6 Using Linker Parameters can be specified right after the option character or separated by one space. -T@CODE=80000000 or -T @CODE=80000000 When options are omitted, assembly will be performed in accordance with the default interpretations built in to the assembler. Refer to section 6.3, "Command Options," for default interpretations NOTE: 86 Starting Linker When specifying multiple files, separate them with spaces. Files without path specifications are assumed to be in the current directory.
Chapter 6 Using Linker Summary of Options Table 6-1 Linker options Option Type Output file options Symbol o filename Specify the path name and file name of the executable format file to be output. m Output a map file Error message options j Program generation options Library file options Instruction RAM options Other Description Output error and warning messages in Japanese. Je Output error and warning messages in English.
Chapter 6 Using Linker 6.3 Command Options This section describes the options used by the linker. The linker has many options for controlling output file specifications and the information written to files. The linker reads multiple relocatable object files, links them into one, and creates an executable format file.
Chapter 6 Using Linker 6.3.1 Output File Options Specify the path name and file name of the executable format file to be output o filename Functional description This option specifies the directory and file name of the executable format file to be output by the linker. If the directory is omitted, the file will be output to the current directory. If a file name that already exists is specified, that file will be overwritten with new contents.
Chapter 6 Using Linker m Output a map file Functional description The map file lists the addresses and sizes of all sections linked by the linker plus identifying information and values for local and global symbols. For all programs, the addresses assigned to sections and symbols are not determined until linking. To create a final list file, reassemble the source file using the map file.
Chapter 6 Using Linker 6.3.2 Error Message Options j Output error and warning messages in Japanese Functional description This option causes all error and warning messages and help screens sent to the console or the listing file to appear in Japanese. The character coding depends on the host machine and the operating system.
Chapter 6 Using Linker Je Output error and warning messages in Japanese using EUC coding Functional description This option causes all error and warning messages and help screens sent to the console or the listing file to appear in Japanese using EUC coding. Rules of use This option is specified with the hyphen (-) option specification character, followed by the upper-case letter “J” and the lower case letter “e”. The two letters together function as a single option. ld103 -Je sample.
Chapter 6 Using Linker Js Output error and warning messages in Japanese using Shift JIS coding Functional description This option causes all error and warning messages and help screens sent to the console or the listing file to appear in Japanese using Shift JIS coding. Rules of use This option is specified with the hyphen (-) option specification character, followed by the upper-case letter “J” and the lower case letter “e”. The two letters together function as a single option. ld103 -Js sample.
Chapter 6 Using Linker Jj Output error and warning messages in Japanese using JIS coding Functional description This option causes all error and warning messages and help screens sent to the console or the listing file to appear in Japanese using JIS coding. Rules of use This option is specified with the hyphen (-) option specification character, followed by the upper-case letter “J” and the lower case letter “e”. The two letters together function as a single option. ld103 -Jj sample.
Chapter 6 Using Linker e Output error and warning messages in English. Functional description This option displays messages for errors and warnings detected in link commands and link processing to the screen and list file in English. Rules of use This option is specified with the slash (/) or hyphen (-) option specification character, followed by the lower-case letter 'e'. ld103 -e sample.rf Default specification The default language used depends on the host machine and the operating system.
Chapter 6 Using Linker W number Do not output warning messages of the specified number Functional description This option suppresses output of specified warnings detected during linking. Unlike errors, warnings are not fatal, so the W option is used when you understand their meanings sufficiently and need to suppress their output. Specifying Wall will suppress output of all warnings. Refer to chapter 13, "Error Messages", for warning numbers and their corresponding messages.
Chapter 6 Using Linker 6.3.3 Program Generation Options g Output debug information to the executable format file Functional description This option causes the linker to include in the executable file information for use in debugging at the source code level.
Chapter 6 Using Linker T section =addresses Specify starting address for a section Functional description This option specifies the starting address for the specified section. It changes the starting address for all sections in all relocatable object files specified to the right of this option. The linker checks these specifications for overlap between sections. Rules of use This option is specified with the hyphen (-) option specification character, followed by the upper-case letter 'T'.
Chapter 6 Using Linker Section layout with -T option specification 0x00000000 0x20000000 Fixed layout 0x00000000 _TEXT@CODE ( b.rf ) _CONST@CODE ( b.rf ) _TEXT@CODE ( b.rf ) _CONST@CODE ( b.rf ) 0x20000000 _TEXT@CODE ( c.rf ) _GCONST@CODE ( c.rf ) Sections without ... _TEXT@CODE ( a.rf ) _TEXT@CODE ( c.rf, a.rf ) _GCONST@CODE ( c.rf ) _ROM@CODE ( b.rf ) _DATA@DATA ( b.rf ) _ROM@CODE( b.rf ) _DATA@DATA( b.rf ) 0xffffffff 0xffffffff ld103 a.rf -T_TEST, _CONST-0 b.rf -T_TEST, _GCONST=20000000 c.
Chapter 6 Using Linker The linker merges the CODE sections from the input files, starting at address 80000000 (hex). It merges the DATA sections from the file sub.rf, starting at address 0. The DATA section from main.rf do not have an address specification, so are merged following the DATA section from sub.rf. NOTE: 100 Command Options For specifying a parameter of _T option, a parameter file can not be used because the character @ would not be considered as an attribute specifying letter.
Chapter 6 Using Linker r Output an executable format file even if errors are detected Functional description The linker normally suppresses the creation of an executable file if it detects errors during linking. This option forces file creation even if there are errors. NOTE: An executable created with known linker errors will not execute properly. The r option is only a temporary measure. Do not run the executable that results.
Chapter 6 Using Linker En Do not output symbol table within the executable format file Functional description This option suppresses output of a symbol table in the executable format file. Only executable code will be output to the executable format file. Rules of use This option is specified with the hyphen (-) option specification character, followed by the upper-case letter 'E' and lower-case letter 'n'. The pair of characters of En are handled as a single option. ld103 -En main.rf sub.
Chapter 6 Using Linker 6.3.4 Library File Options l library_filename Specify a library file Functional description This option specifies a library file. Rules of use This option is specified with the hyphen (-) option specification character, followed by the lower-case letter 'l', then either immediately followed by the path name and file name or a space and the path name and file name. The l option must be coded end of the command line. ld103 -l /usr/lib/sample.lib main.rf sub.
Chapter 6 Using Linker L path_name Specify a directory containing library files Functional description This option specifies a directory that contains library files. Library files following the L option specification will be searched for in the specified directory. First, the current directory is searched. And then, the specified directory is searched. When the L option is used multiple times, the search will be performed in the order of definition.
Chapter 6 Using Linker 6.3.5 Other Options @filename Specify a parameter file Functional description By writing various option used by the linker in a file, the @ option lets you specify just that file during execution, and the linker will replace it with the option specifications. All options other than the @ option can be written in a parameter file. If a parameter file that does not exist is specified, the linker will display an error message.
Chapter 6 Using Linker h Output help information to the screen Functional description This option displays linker command options and their descriptions to the screen. The h option is used alone. Rules of use This option is specified with the hyphen (-) option specification character, followed by the lower-case letter 'h'. ld103 -h NOTE: Even if the h option is not specified, input of ld103 alone will also display the help screen.
Chapter 6 Using Linker 6.4 Instruction RAM Support This series includes members with instruction RAM for use in copying program portions to RAM for execution there. The linker therefore supports special options for creating executable files with support for instruction RAM. This section gives the particulars of the instruction RAM format for executable files and the procedures for creating them.
Chapter 6 Using Linker 6.4.1 Structure of IRAM Support Executable File Structural Elements of an IRAM Support Executable (A) Fixed program portion This portion resides in external memory and runs using addresses as is in the normal fashion. Normal executable files contain only this portion. (B) Instruction RAM program This portion resides in external memory, but only works properly when transferred to the instruction RAM.
Chapter 6 Using Linker Executable file created by linker E.Instruction RAM status management table Extra symbol "_ _iram_manage" External memory 1 A. Fixed portion RF file specified by T option RF file specified by OVL option D.Transfer program Assigned at the highest address of CODE attribute. 4 3 Instruction RAM B.
Chapter 6 Using Linker File layout and transfer operations for an instruction RAM executable file 1. Use the linker's T and OVL layout options to divide the program into a fixed portion (A) and an instruction RAM portion (B). The linker assigns the latter to a location in external memory immediately following the former. 2. The linker automatically generates the instruction RAM program management table (C) at the address specified with the PUT option.
Chapter 6 Using Linker 6.4.2 IRAM Support Options Using the following options creates an executable file supporting instruction RAM operation. OVL ID_number: section=address Specify address in instruction RAM for a section Functional description This option assigns an address in instruction RAM for the specified section. The linker resolves all addresses to assume that the relocatable object file following the option is running in instruction RAM.
Chapter 6 Using Linker The starting address in instruction RAM is given in hexadecimal. ld103 -T @CODE=80000000 main.rf sub.rf -OVL 1:@CODE=40000000 seg1.rf -OVL 2:@CODE=40000000 seg2.rf ld103 -T @CODE=80000000 main.rf sub.rf -OVL 1:_TEXT,_CONST=40000000 seg1.rf -OVL 2:_TEXT,_CONST=40000000 seg2.rf ld103 -T @CODE=80000000 main.rf sub.rf -OVL 1:_TEXT@CODE=40000000 seg1.rf -OVL 2:_TEXT@CODE=40000000 seg2.
Chapter 6 Using Linker PUT symbol=address Specify address for extra symbol Functional description This option is used to specify addresses for the extra symbols used by the instruction RAM function. NOTE: A PUT option is only valid when there are one or more -OVL options. Rules of use This option is specified with the hyphen (-) option specification character, followed by the upper case letters 'PUT', the name of an extra symbol, an equals sign, and the address for that symbol.
Chapter 6 Using Linker 6.4.3 Operation Examples The following are examples of section layouts using the OVL option for the five relocatable object files, main.rf, sub.rf, prog1.rf, prog2.rf, and prog3.rf, in the current directory. All files contain multiple CODE and DATA sections. Assigning to different addresses in instruction RAM ld103 -T @CODE=80000000 -T @DATA=1000 main.rf sub.rf -OVL 1:_TEXT=40001000 prog1.rf -OVL 2:_TEXT=40002000 prog2.rf -OVL 3:_TEXT=40003000 prog3.
Chapter 6 Using Linker NOTE: If multiple sections share the same or overlapping regions in instruction RAM, their code must be mutually exclusive. In other words, in the above example, the files prog1.rf, prog2.rf, and prog3.rf must not contain references to each other's symbols because that would require that they both be in instruction RAM at the same time—a physical impossibility. The linker automatically detects such conflicts and suppresses executable file output.
Chapter 6 Using Linker 116 Instruction RAM Support
Chapter 7 Types of Source Statements 7
Chapter 7 Type of Source Statements 7.1 Purpose of This Chapter Programs used by the Cross Assembler are collections of source statements. There are five types of source statements, classified by their purpose.
Chapter 7 Type of Source Statements 7.2 Program Format A program is text created to assemble as machine language instructions in order to operate a microprocessor. The assembler translates the text into machine language code, while the linker joins that code to make an executable format file. One line of text is called a source statement. There are five types of source statements, with the type determining how a source statement is written. Basic program format is shown below.
Chapter 7 Type of Source Statements Below is an example source file. ; ; comment SAMPLE PROGRAM #include ;include a file "FILE1.
Chapter 7 Type of Source Statements 7.3 Machine Language Instruction Statements and Directive Statements Machine language instruction statements Machine language instructions are instructions that the microprocessor directly executes on its own hardware. Each machine language code has a corresponding mnemonic. Machine language instruction statements are statements that code these mnemonics. The assembler will convert them into machine language code (called object code).
Chapter 7 Type of Source Statements 7.4 Assembler Control Statements Assembler control statements are source statements that control how the assembler processes. The assembler provides include directives that include files and conditional assembly directives that specify conditions for changing which instructions are assembled. The example below shows assembler control statements. #include “FILE1.ASM ;include a file #define MODE ;define an identifier . . .
Chapter 7 Type of Source Statements 7.5 Macro Control Statements Macro control statements reduce coding effort by replacing strings coded in source statements with other strings. This enables low-level assembly language for a program block to be abstracted as a macro name. Macros are coded in two formats: macro definitions and macro calls. A macro definition defines a macro name and macro body. The macro body uses multiple machine language instructions to construct a single program process.
Chapter 7 Type of Source Statements 7.6 Comment Statements The comment statements start from: 1) an asterisk (*) in the beginning of the line 2) a semicolon (;) in the beginning or middle of the line If you find an asterisk (*) in a line, the whole line is the comment statement. If you find a semicolon (;) in a line, the sentence after the semicolon is the comment statement. No matter what a comment is, it will not affect program operation of function.
Chapter 7 Type of Source Statements 7.7 Blank Statements A blank statement consists of a single carriage return. Blank statements are used to make printed lists easier to read.
Chapter 7 Type of Source Statements 126 Blank Statements
Chapter 8 Writing Source Statements 8
Chapter 8 Writing Source Statements 8.1 Purpose of This Chapter This chapter explains common information for writing source statements. Source statements include machine language instruction statements, assembler control statements, and macro control statements. This chapter explains how to code the characters and numbers that can be used when writing source statements, and it describes how to write character constants, address constants, location counters, and expressions.
Chapter 8 Writing Source Statements 8.2 Permitted Characters There are three types of characters that can be coded in source statements for the cross assembler of this series. Digits 0123456789 Letters Upper-case ABCDEFGHIJKLMNOPQRSTUVWXYZ Lower-case abcdefghijklmnopqrstuvwxyz Control characters space tab carriage return line feed !” # $ % & ’ ( ) * + – .
Chapter 8 Writing Source Statements 8.3 Numbers The cross assembler provides three coding formats for use in numbers and (single) character constants (refer to section 8.4, "Character Constants"). • Extended C language format • Intel format • Matsushita format One of these formats is selected by using the notation directive. The default is extended C language format. Four radices can be used.
Chapter 8 Writing Source Statements Extended C language format Current default radix Radix Binary Octal Decimal Hexadecimal Binary -- -- 0B101 -- Octal -- -- 0765 -- Decimal -- -- 789 -- Hexadecimal -- -- 0XDEF -- Coding rules: Binary Start with '0' (zero) and letter 'B' (or 'b'), followed by binary digits. Octal Start with '0' (zero), followed by octal digits. Decimal Code decimal number as is.
Chapter 8 Writing Source Statements Matsushita format Current default radix Radix Binary Octal Decimal Hexadecimal Binary Octal Decimal Hexadecimal B’101’ 101 O’567’ B’101’ B’101’ B’101’ O’567’ O’567’ F’789’ O’567’ 567 F’789’ F’789’ X7’def’ X’def’ F’789’ 789 X’def’ X’def’ 0def Coding rules: Binary Start with letter 'B' (or 'b'), and enclose binary digits in single quotation marks ( ' ). When the default is binary, code the binary number as is.
Chapter 8 Writing Source Statements 8.4 Character Constants ASCII characters ,which can be displayed, can be coded as character constants or string constants. The characters that can be used for constants are as follows. • Digits • Letters (upper or lower cases) • Blank letters • Special characters NOTE: “\” letters make the following letters valid. Example: ‘\”, ‘\\’, “\””, “\\” Character constants A character constant is stored as an ASCII code in the space of a single character.
Chapter 8 Writing Source Statements String constants String constants are strings of one or more characters stored as ASCII code. When a string constant is one character it will be the same as a character constant. Coding rules: String constants are specified by enclosing the string in double quotation marks ( " ). "ABCDEFG" Specifies the string ABCDEFG as ASCII code. "+-[&%$#@!,.;:'" Specifies the string +-[&%$#@!,.;:' as ASCII code.
Chapter 8 Writing Source Statements 8.5 Address Constants Address constants return particular bits from expressions that can be evaluated as addresses. They are written as follows. address_specifier (expression) An address constant is written as an expression enclosed in parentheses following an address specifier. An expression consists of names, self-reference address symbols, and constants linked by operators, with the result representing a single value (refer to section 8.
Chapter 8 Writing Source Statements 8.6 Location Counter The assembler contains an variable for counting addresses of instructions. This variable is called the location counter. Each time the assembler converts an instruction to machine language, it increments the location counter by the number of words in that instruction.
Chapter 8 Writing Source Statements 8.7 Expressions Expressions are symbols, self-reference address symbols, and constants linked by operators, with the result representing a single value. When an expression is coded as an operand, its result will be a number or an address depending on the type of instruction.
Chapter 8 Writing Source Statements 8.7.1 Operators There are three types of operators. • Arithmetic operators • Shift operators • Logical operators Arithmetic operators Arithmetic operators perform the four standard arithmetic calculations.
Chapter 8 Writing Source Statements Logical operators Logical operators perform calculation in bit units.
Chapter 8 Writing Source Statements 8.7.2 Expression Evaluation There are seven levels of operator precedence. The order of precedence can be changed using parentheses ( ). Operators with the same precedence are evaluated in order from left to right.
Chapter 8 Writing Source Statements 8.7.3 Expression Syntax Below is an expression syntax diagram ( expression expression binary operator ) expression unary operator symbol constant * Expression Syntax NOTE: When the expressions starting with parenthesis are coded to the operands of Machine language instructions, it will be regarded as an address-reference. To be proceeded as expressions, put 0+ before the parenthesis and distinguish them from others.
Chapter 8 Writing Source Statements 8.7.4 Expression Attributes When expression operands are connected by an operator, the calculated result of the expression will have attributes of the operands and the operator. The most important attributes for expression evaluation are as follows.
Chapter 8 Writing Source Statements For + (addition) operator Operand 2 + (addition) UND ABS REL EXT UND UND UND UND UND ABS UND ABS REL EXT REL UND REL REL EXT EXT UND EXT EXT EXT Operand 1 For - (subtraction) operator operand1 - operand2 -(SUBTRACTION) Operand 2 UND ABS REL EXT UND UND UND UND UND ABS UND ABS REL EXT REL UND REL REL EXT EXT UND EXT EXT EXT Operand 1 For *, /, %, <<, >>, &, ^ , | operators operand1 operator operand2 *, /, %, <<, >>, &, ^
Chapter 8 Writing Source Statements 8.8 Reserved Words The assembler gives special meanings to the symbols listed below, so they cannot be used for other purposes. These symbols are called reserved words. Either all upper-case or all lower-case letters may be used to code reserved words, but they cannot be mixed within one reserved word.
Chapter 9 Writing Machine Language Instruction Statements and Directive Statements 9
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.1 Purpose of This Chapter This chapter explains how to write machine language instructions and directives. There are five source statement formats • Instruction statements that code machine language instructions and directives.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.2 Instruction Statement Fields Source statements that code machine language instructions and directives are built from four fields. [label] [operation [operand [, operand]]] [comment] Contents of brackets [ ] can be omitted. Coding rules Source statements may contain a label field only. Depending on the operation, source statements may contain no operand. Fields are delimited by at least one space or tab.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.2.1 Writing Label Field Labels are called both symbols and names. The assembler assigns a label the value of the location counter at the point it is defined. Coding rules Labels can use upper-case and lower-case letters, digits, underscores (_). Labels are coded in the first column. The first character of a label must not be a digit. Labels are case sensitive. The same label name cannot be defined twice.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.2.2 Writing Operation Field The operation field is written with a machine language instruction or directive. Coding rules Machine language instructions cannot mix case. They must use either upper or lower case throughout.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.2.3 Writing Operand Field The operand field coding is determined by the machine language instruction or directive in the operation field. Refer to the "Instruction Manual" for details on coding machine language instructions. Coding rules Operands are written with expressions and reserved words (register names, etc.). Operands cannot include spaces, except for character constants and string constants.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.2.4 Writing Comment Field The field that starts from a semicolon (;) after the operands is called the comment field. Comments coded in this position are called end-of-line comments, as opposed to comment statements where the entire line is a comment. Coding rules Comments being with a semicolon (;) and end with a line feed (LF).
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.3 Writing Machine Language Instruction Statements Each machine language instruction is defined by specific mnemonics. Mnemonics are formed from operations and operands accurately coded in the statement fields previously described. Both upper-case and lower-case letters may be used. Refer to the "Instruction Manual" for details of machine language instructions.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4 Writing Directive Statements Directives differ from machine language instructions in that they only have effect on the assembler. Directives specify program structure and start addresses, set constants and radices, and specify options and label attributes. List of directives Below is a list of directives.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.1 section Syntax label operation operand section_name section [definition1 [,definition2 [,expression]]] definition1 Section attribute (CODE or DATA) definition2 Link type (PUBLIC) (Note that the words PRIVATE and COMMON are reserved for use in expansion. However, they are treated as PUBLIC for now.
Chapter 9 Writing Machine Language Instructions and Directive Statements Operand coding rules Only specific strings can be defined for definition1 and definition2. If some other string is defined, the assembler will generate an error and ignore this directive. The value of expression must be a power of 2 between 1 and 32768, or 0. If its value is outside this range, the assembler will assume the closest valid value instead.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.2 align Syntax label operation operand align expression Default settings The current location counter value will be inherited. Functional description The align directive adjusts the location counter to be a multiple of the value indicated by expression. The expression must be a power of 2 in the range 1 to 215. When the expression value is 4, the multiples of 4 will be the following series. 4, 8, 12, 16, 20, 24, 28, 32, ..
Chapter 9 Writing Machine Language Instructions and Directive Statements Usage example Below is an example use of the align directive. align.lst Page 1 *** PanaX Series MN1030 Cross Assembler Loc Object Line Source 1 _DATA section 00000000 2 TABLE 00000000 01 3 dc 00000001 02 4 dc 00000002 03 5 dc 6 align align.asm(6) :Warning 2002: Illegal operand value.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.3 end Syntax label operation operand [name] end Default settings If the end directive is omitted, the assembler file will assume that the end of the file is the end of the program. Functional description This directive is coded once at the end of a program. All text coded after the end directive will be ignored by the assembler (but it will be output to the source list).
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.4 listoff, liston Syntax label operation [name] listoff operand . . . [name] liston Functional description The listoff and liston directives are used in pairs. Statements from the statement following the listoff directive until the statement preceding the liston directive will not be output to the list file. These directives are used when you do not want to output an already debugged program to the list file.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.5 notation Syntax label operation operand notation CLANG | INTE | PANA Default settings CLANG will be selected. Functional description This directive selects the format of numbers and character constants (single character). The Cross-Assembler provides three numeric formats.
Chapter 9 Writing Machine Language Instructions and Directive Statements Usage example Below is an example use of the notation directive. Loc 00000000 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000009 0000000a 0000000b 0000000c notation.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.6 org Syntax label operation operand org expression Default settings The current location counter value will be inherited. Functional description This directive sets the location counter to the address value specified by expression. Operand coding rules For the expression coded in the operand, the attribute of the calculation result must be abs(absolute).
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.7 opt Syntax label operation operand opt on | off Default settings If omitted, opt off will be assumed. Functional description This directive enables and disables the optimization functions of the assembler and linker. The optimization applies only to conditional and unconditional branch instructions.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.8 page Syntax label operation operand page lines_expression [,columns_expression] Default settings Number of lines = 60 Number of columns = 132 Functional description This directive specifies the number of lines and columns per page. At the line where the page directive itself is specified the assembler will output a carriage return and apply the newly set values.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.9 radix Syntax label operation operand radix expression Default settings Radix 10 (decimal). Functional description This directive specifies the radix that will be used by default. The Cross-Assembler provides three coding formats for numbers. • Extended C language format • Intel format • Matsushita format The format is selected with the notation directive. Refer to the description of the notation directive.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.10 dc Syntax label operation operand [name] dc constant | expression (, constant | expression )... Functional description This directive is used to define constants in a memory area. The 8-bit constant specified by the operand will be stored at the location of the statement specifying this directive. When a name is coded for the label, the assembler will assign the current location counter value to that name.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.11 ds Syntax label operation operand [name] ds expression1 [, expression2 [, expression3]] expression1 Number of bytes of memory to reserve expression2 Initial value expression3 Number of iterations Default settings expression2 (initial value) If omitted, the assembler will assume 0. expression3 (iterations) If omitted, the assembler will assume 1.
Chapter 9 Writing Machine Language Instructions and Directive Statements Usage example Below is an example use of the ds directive. DC.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.12 dw Syntax label operation operand [name] dw expression (, expression )... Functional description This directive is used to define 16-bit constants in a memory area. The 16-bit constant specified by the operand will be stored at the location of the statement specifying this directive. When a name is coded for the label, the assembler will assign the current location counter value to that name.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.13 dd Syntax label operation operand [name] dd expression(, expression)... Functional description This directive is used to define 32-bit constants in a memory area. The 32-bit constant specified by the operand will be stored at the location of the statement specifying this directive. When a name is coded for the label, the assembler will assign the current location counter value to that name.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.14 equ Syntax label operation operand name equ expression Functional description This directive defines the name to be the value of the expression coded in the operand. When that name is coded in the operand of machine language instructions or directive instructions, the assembler will reference the name's value. System constants often used in programs (memory size, clock frequency, etc.
Chapter 9 Writing Machine Language Instructions and Directive Statements Usage example Below is an example use of the equ directive. Loc 00000000 00000002 00000004 00000006 equ.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.15 global Syntax label operation operand [name] global name(, name)... Default settings External reference when omitted = undefined label error External declaration when omitted = undefined label error during linking Functional description This directive declares external references and external declarations. For external references, the global directive declares that the names coded in the operand are from other files.
Chapter 9 Writing Machine Language Instructions and Directive Statements Usage example Below is an example use of the global directive. main global SUB1 ;external declaration global READ, WRITE ;external reference jsr READ . . jsr WRITE . . SUB1 mov 0x11, D0 . . rts end NOTE: If a section name was referred as an external label, declaration with the section directive, not with the global directive, is necessary.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.16 tit Syntax label operation operand tit ["string"] Functional description This directive specifies that the string coded as its operand is to be output as the header of the list file. Typically the string is written with the program name, function, author, version, company, date, etc. Operand coding rules The operand is written with any string enclosed by double quotation marks (").
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.17 xlistoff, xliston Syntax label operation [name] xlistoff operand . . . xliston Functional description The xlistoff and xliston directives are used in pairs. Statements from the xlistoff directive until the xliston directive will not be output to the list file. These directives are used when you do not want to output an already debugged program to the list file.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.18 funcinfo Syntax label operation function_namefuncinfo where operand label_name, expression, register list expression: Stack frame size Functional description This directive provides additional information about a function name specified as the operand to a call instruction. The call instruction branches to the function after saving registers to the stack and setting up the stack frame.
Chapter 9 Writing Machine Language Instructions and Directive Statements Usage Example The following gives an example of funcinfo usage. _TEXT _TEXT _func _0func NOTE: global section : call : global section _0func CODE, PUBLIC, 1 movm add funcinfo : : ret [D2], (SP) -4, SP _func, 8, [D2] _0func _0func, _func CODE, PUBLIC, 1 The ret and retf instructions free the stack frame and restore registers from the stack. The assembler bases this code on the information provided by the funcinfo directive.
Chapter 9 Writing Machine Language Instructions and Directive Statements 9.4.19 assign Syntax label operation operand name assign expression Functional description This directive defines the name to be the value of the expression coded in the operand. When that name is coded in the operand of machine language instructions or directive instructions, the assembler will refer the name’s value. Operand coding rules The expression coded in the operand must result in the attribute abs (absolute).
Chapter 9 Writing Machine Language Instructions and Directive Statements 180 Writing Directive Statements
Chapter 10 Writing Assembler Control Statements 10
Chapter 10 Writing Assembler Control Statements 10.1 Purpose of This Chapter Assembler control statements are statements that control assembler processing. They specify include files and refinement of the identifier and control conditional assembly. Include files are used to place definitions of constants, memory areas, I/O ports, and bit assignments common to the entire program in separate files. They read in during assembly.
Chapter 10 Writing Assembler Control Statements 10.2 File Inclusion The file inclusion is an assembler control instruction that reads the specific file to the source file. It is used for the following purpose.
Chapter 10 Writing Assembler Control Statements 10.2.1 #include Syntax #include ”filename” Functional description This directive causes the assembler to read in the source file with the specified name at the location of the directive. NOTE: The included file will be assembled and output to the relocatable object file and list file. In order for the list file to show that lines were included as part of an include file, a period (.) will be prefixed before the line number.
Chapter 10 Writing Assembler Control Statements Usage example The following example illustrates the use of an include file. The file inc.h consists of the following statement. data equ 0x12 The file to be assembled consists of the following statements. #include “inc.h” _TEXT section CODE, PUBLIC, 1 mov data, A0 mov 0x34, D0 mov D0, (A0) main end The above file is assembled with the file inc.h included.
Chapter 10 Writing Assembler Control Statements 10.3 Identifier Definement Identifier definement names a variable or a set of steps, and replace the name (the identifier) in the source code to the string that has been defined. It is used for the following purposes.
Chapter 10 Writing Assembler Control Statements 10.3.1 #define Syntax #define [replacement_string] [; comment] Functional description This directive causes the assembler to replace the identifier with the replacement_string on all further lines. The #define directive differs from the #equ directive in that a string can be specified. Furthermore, when used in conjunction with the #undef directive, redefinition is possible. Coding rules Any string can be coded for the replacement_string.
Chapter 10 Writing Assembler Control Statements 10.3.2 #undef Syntax identifier #undef Functional description This directive deletes an identifier defined by a #define directive. The effective range of an identifier is from the line following #define until the line before #undef. To redefine the replacement string of an identifier, redefine it with #define after performing an #undef.
Chapter 10 Writing Assembler Control Statements 10.4 Conditional Assembly The cross assembler provides conditional assembly capabilities. The directives explained in this section are provided for this purpose. By coding conditional assembly directives in a program, the assembler will select which block to assemble by judging the specified conditions at the time of assembly. Many conditional assembly directives are used only within macro definitions.
Chapter 10 Writing Assembler Control Statements The table below lists the conditional assembly directives. Directive Condition for selecting block1 Condition for selecting block2 #ifdef Identifier has been defined by #define. Identifier has not been defined. #ifndef Identifier has not been defined by #define. Identifier has been defined. #if Expression value is not 0. Expression value is 0. #ifn Expression value is 0. Expression value is not 0.
Chapter 10 Writing Assembler Control Statements 10.4.1 #ifdef, #ifndef Syntax Syntax for #ifdef #ifdef identifier Syntax for #ifndef #ifndef block1 [#else identifier block1 [#else block2] #endif block2] #endif Functional description #ifdef If the identifier has been defined by a #define directive before the #ifdef statement, block1 will be assembled. If it has not been defined and an #else directive has been coded, block2 will be assembled.
Chapter 10 Writing Assembler Control Statements Usage example A source file that uses #ifdef and #ifndef is shown below. #define VERSION _TEXT section #ifdef VERSION CODE, PUBLIC,1 mov 0x01, D0 mov 0x02, D0 #else #endif #ifndef VERSION mov 0x03, D1 mov 0x04, D1 #else #endif The assembled list file is shown below. ifdef.
Chapter 10 Writing Assembler Control Statements 10.4.2 #if, #ifn Syntax Syntax for #if #if Syntax for #ifn expression #ifn block1 [#else expression block1 [#else block2] #endif block2] #endif Functional description #if If the value of expression is not 0, block1 will be assembled. If it is 0 and an #else directive has been coded, block2 will be assembled. #ifn If the value of expression is 0, block1 will be assembled. If it is not 0 and an #else directive has been coded, block2 will be assembled.
Chapter 10 Writing Assembler Control Statements Usage example A source file that uses #if and #ifn is shown below. DEVICE equ 1 _TEXT section CODE, PUBLIC, 1 #if DEVICE-1 mov 0x01, D0 mov 0x02, D0 #else #endif #ifn DEVICE-1 mov 0x03, D0 mov 0x04, D0 #else #endif The assembled list file is shown below. The program first sets DEVICE to 1.
Chapter 10 Writing Assembler Control Statements 10.4.3 #ifeq, #ifneq Syntax Syntax for #ifeq #ifeq parameter1, parameter2 Syntax for #ifneq #ifneq block1 [#else parameter1, parameter2 block1 [#else block2] #endif block2] #endif Functional description #ifeq If parameter1 and parameter2 are the same string, block1 will be assembled. If they are different and an #else directive has been coded, block2 will be assembled.
Chapter 10 Writing Assembler Control Statements Usage example A source file that uses #ifeq and #ifneq is shown below. The macro named compare uses two dummy parameters(data1,data2). Within the macro it compares the strings of those dummy parameters. If they match, an instruction that sets the A register to 1 will be assembled. If they do not match, an instruction that sets the A register to 0 will be assembled. The macro is called by specifying strings to be passed to the dummy parameters.
Chapter 10 Writing Assembler Control Statements The assembled list file is shown below. Line number 11 assembles the statements for a match, and line number 12 assembles the statements for a mismatch. ifeq.
Chapter 10 Writing Assembler Control Statements 10.4.4 #iflt, #ifle Syntax Syntax for #iflt Syntax for #ifle expression #iflt #ifle block1 expression block1 [#else [#else block2] block2] #endif #endif Functional description #iflt If the value of expression is negative, block1 will be assembled. If it is not negative and an #else directive has been coded, block2 will be assembled. #ifle If the value of expression is 0 or negative, block1 will be assembled.
Chapter 10 Writing Assembler Control Statements The assembled list file is shown below. iflt.
Chapter 10 Writing Assembler Control Statements 10.4.5 #ifgt, #ifge Syntax Syntax for #ifgt #ifgt Syntax for #ifge expression #ifge block1 expression block1 [#else [#else block2] block2] #endif #endif Coding rules #ifgt If the value of expression is positive, block1 will be assembled. If it is not positive and an #else directive has been coded, block2 will be assembled. #ifge If the value of expression is 0 or positive, block1 will be assembled.
Chapter 10 Writing Assembler Control Statements The assembled list file is shown below. You can see that the expression's value is 0, so block 2 was assembled. ifgt.
Chapter 10 Writing Assembler Control Statements 10.4.6 #ifb, #ifnb Syntax Syntax for #ifb #ifb dummy_parameter Syntax for #ifnb #ifnb block1 [#else dummy_parameter block1 [#else block2] #endif block2] #endif Functional description #ifb If the dummy_parameter is a null character, block1 will be assembled. If it is not a null character and an #else directive has been coded, block2 will be assembled. #ifnb If the value of expression is not a null character, block1 will be assembled.
Chapter 10 Writing Assembler Control Statements Usage example A source file that uses #ifb is shown below. If the dummy parameter para to the macro debug is a null character, the program will execute next_cycle. If it is not a null character, the program will execute test and then execute next_cycle. In this example, the identifier MODE is passed to the macro debug. When a replacement string has been specified, the call is without a null character.
Chapter 10 Writing Assembler Control Statements The assembled list file is shown below. Where the characters debug_on have been specified, block 2 is assembled. Where the null character has been specified, block 1 is assembled. ifb.
Chapter 11 Writing Macro Control Statements 11
Chapter 11 Writing Macro Control Statements 11.1 Purpose of This Chapter Macros consist of two parts: macro definitions and macro calls. A macro that has been defined can be coded as a macro call in any source statement after that. When a macro without parameters is called, it becomes a simple text substitution. When a macro with parameters is called, part of the text to be substituted will be modified by the strings specified as the parameters. This chapter explains how define and call macros.
Chapter 11 Writing Macro Control Statements 11.2 Macro Definitions (macro, endm) Syntax macro_name macro [dummy_parameter (, dummy_parameter)...] macro_body endm NOTE: Up to 10 dummy parameters can be specified. Functional description A macro assigns a name to a single process that is used repeatedly in a program, simplifying the coding of source statements. Macros must be defined before they are called.
Chapter 11 Writing Macro Control Statements Coding rules The following instructions cannot be used within macro definitions. • include directive • macro directive — within a macro definition another different macro cannot be defined • purge directive — within a macro definition macros cannot be purged The symbols used in the label fields within a macro definition must be declared with the local directive or passed from the outside using dummy parameters. Refer to section 11.
Chapter 11 Writing Macro Control Statements 11.3 Macro Calls and Expansion Syntax macro_name NOTE: [parameter (, parameter)... ] Up to10 dummy parameters can be specified. Functional description A macro is called by coding its name in the operation field of a source statement. The assembler then inserts the text of the macro body at that position. When parameters are specified, their values are passed in the same order as the dummy parameter when the macro was defined.
Chapter 11 Writing Macro Control Statements Usage example A source file is shown below. The macro add_adr has one dummy parameter. The dummy parameter is used as the operand of an add machine language instruction within the macro body. Take note whether a macro name is the same as a machine language instruction. The macro is called with var1 and var2 as parameters.
Chapter 11 Writing Macro Control Statements 11.4 Macro Operators Macro operators are used in macro bodies to operate on parameters of macro calls. Macro operators are listed below. Operator & Description Concatenates strings. Macro definition dummy parameters \ Macro expansion abcdefghi p1&p2&p3 → abc, def,ghi → p1&p2&p3 → data, 1, 3 → data13 Escape characters for including normally unusable characters (<, >, &, \) in parameters of macro calls.
Chapter 11 Writing Macro Control Statements The assembled list file is shown below. *** Loc Object 00000000 8001 00000002 2801 212 Macro Operators macexp.
Chapter 11 Writing Macro Control Statements 11.5 Local Symbol Declaration (local) Syntax macro_name symbol macro parameter local symbol (, symbol)... . . . endm NOTE: Up to 30 symbols can be specified. Functional description The local directive declares local symbols used in a macro body. When local symbols are expanded, they will be expanded in the form ??XXXXX, where XXXXX is in the range starting 00001 to 99999.
Chapter 11 Writing Macro Control Statements Usage example An example using the local directive is shown below. loc lab1 lab2 macro p1 local lab1, lab2 mov p1, D0 cmp 0, D0 jmp lab2 mov 1, A1 mov 0, A0 endm ; _TEXT section CODE, PUBLIC, 1 loc 0 loc 1 The assembled list file is shown next. You can see that each time the local symbol is expanded, it is changed to ??00001, ??00002, ... local.
Chapter 11 Writing Macro Control Statements 11.6 Forced Termination of Macro Expansion (exitm) Syntax macro_name macro #ifndef identifier parameter exitm #endif . . . endm Functional description The exitm directive forcibly terminates macro expansion at the point it appears. Used in conjunction with an #ifndef directive, it can end macro expansion if an identifier is undefined. If the identifier has been defined, expansion beyond #endif will be performed.
Chapter 11 Writing Macro Control Statements global debug ; extml macro mov #ifndef 1, D0 TEST exitm #endif jsr debug endm ; _TEXT section CODE, PUBLIC, 1 extm1 #define TEST extm1 The list file is shown below. The second macro call has been expanded after #endif. exitm.
Chapter 11 Writing Macro Control Statements 11.7 Purging Macro Definitions (purge) Syntax macro_name (, macro_name)... purge Functional description The purge directive purges the definitions of the specified macro names. Coding rules The macro names specified with the purge directive are valid for previously defined macro names. After the purge directive, purged macros will not be expanded even if they are called. They will be processed as instructions or symbols.
Chapter 11 Writing Macro Control Statements 11.8 rept Syntax expression rept block endm Functional description The rept directive repeatedly expands the specified block the specified number of times. It is used for simple repeating without parameters. The rept directive can be coded anywhere in a program or even within a macro definition. Coding rules Symbols cannot be used within a block. If used, a double definition error will occur. The local directive cannot be used either.
Chapter 11 Writing Macro Control Statements The assembled list file is shown below. Loc *** Object 00000000 00000002 2801 2801 00000004 00000006 00000008 2901 2901 2901 rept.
Chapter 11 Writing Macro Control Statements 11.9 irp Syntax irp dummy_parameter, parameter (, parameter) ... block endm NOTE: Up to10 dummy parameters can be specified. Functional description The irp directive repeatedly expands the specified block the specified number of times. The dummy parameter is used within the block. The macro expansion replaces the dummy parameter with each parameter in turn, repeated for the number of parameters. Coding rules Symbols cannot be used within a block.
Chapter 11 Writing Macro Control Statements The assembled list file is shown below. *** Loc Object 00000000 8001 00000002 00000004 8A00 8F00 irp.
Chapter 11 Writing Macro Control Statements 11.10 irpc Syntax dummy_parameter, "string" irpc block endm Functional description The irpc description repeatedly replaces the dummy parameter with each character in the specified string one at a time. The dummy parameter can be used in the block. The macro expansion replaces the dummy parameter with each character in turn, repeated for the number of characters. Coding rules The string cannot include the characters &, \, ', and ".
Chapter 11 Writing Macro Control Statements The assembled list file is shown below. Loc 00000000 00000001 00000002 00000003 00000004 00000005 00000006 00000007 00000008 00000009 irpc.
Chapter 11 Writing Macro Control Statements 224 irpc
Chapter 12 List of Machine Language Instructions 12
Chapter 12 List of Machine Language Instructions 12.1 Purpose of This Chapter The chapter lists machine language instructions of this series microcomputers. This comprehensive list of addressing modes and mnemonics for every instruction can be quite useful when you are coding machine language instruction statements. If you need to know about the detailed operation of individual instructions, refer to the “MN1030/ MN103S Series Instruction Manual”.
Chapter 12 List of Machine Language Instructions 12.2 Addressing Modes This series of the microcomputers supports four addressing modes for memory accesses. The following four address formats are methods for accessing an address specified as an address register's contents or as the sum of an address register's contents and a displacement.
Chapter 12 List of Machine Language Instructions Register relative indirect addressing Register relative indirect addressing determines the address to access using the following three combinations. 1. An address register, An, plus a sign-extended 8-bit or 16-bit displacement or the stack pointer register, SP, plus a zero-extended 8-bit or 16-bit displacement. 0 16 d16/d8 0 31 31 An/SP 0 sign-extended + 0 31 RAM Address specification 2.
Chapter 12 List of Machine Language Instructions 3. The program counter, PC, plus a sign-extended 8-bit or 16-bit displacement or a 32-bit displacement. 0 16 31 d32/d16/d8 0 31 31 PC 0 sign-extended + 0 31 RAM Address specification Absolute addressing Absolute addressing specifies the address to be accessed as a 16-bit or 32-bit displacement.
Chapter 12 List of Machine Language Instructions Index addressing Index addressing adds the contents of an address register, An, and a data register, Dn, to yield a displacement.
Chapter 12 List of Machine Language Instructions 12.
Chapter 12 List of Machine Language Instructions 12.3.
Chapter 12 List of Machine Language Instructions Mnemonic Description of operation Transfers the contents of the memory location specified by Am and displacement d to An. 8- and 16-bit displacements are sign-extended. Transfers the contents of the memory location specified by SP and MOV (d, SP), An displacement d to An. 8- and 16-bit displacements are zero-extended. Transfers the contents of the memory location specified by Am and MOV (d8, Am), SP displacement d to SP.
Chapter 12 List of Machine Language Instructions Mnemonic Register Relative Indirect Index Description of operation Transfers, with zero-extension, the 16-bit contents of the memory MOVHU (d, Am), Dn location specified by Am and displacement d to Dn. 8- and 16-bit displacements are sign-extended. Transfers, with zero-extension, the 16-bit contents of the memory MOVHU (d, SP), Dn location specified by SP and displacement d to Dn. 8- and 16-bit displacements are zero-extended.
Chapter 12 List of Machine Language Instructions Mnemonic MOV (abs32), Dn MOV (abs16), An MOV (abs32), An MOV Dm, (abs16) MOV Dm, (abs32) MOV Am, (abs16) MOV Am, (abs32) MOVBU (abs16), Dn MOVBU (abs32), Dn MOVBU Dm, (abs16) MOVBU Dm, (abs32) Absolute MOVB (abs16), Dn MOVB (abs32), Dn MOVB Dm, (abs16) MOVB Dm, (abs32) MOVHU (abs16), Dn MOVHU (abs32), Dn MOVHU Dm, (abs16) MOVHU Dm, (abs32) MOVH (abs16), Dn MOVH (abs32), Dn MOVH Dm, (abs16) MOVH Dm, (abs32) Description of operation Transfer the 32-bit conte
Chapter 12 List of Machine Language Instructions EXTEND Sign Mnemonic Description of operation EXT Dn Extend Dn to 64 bits and store the highest 32 bits in MDR. EXTB Dn Sign-extend the lowest 8 bits of Dn to fill Dn. EXTBU Dn Zero-extend the lowest 8 bits of Dn to fill Dn. EXTH Dn Sign-extend the lowest 16 bits of Dn to fill Dn. EXTHU Dn Zero-extend the lowest 16 bits of Dn to fill Dn. MOVM Mnemonic Description of operation MOVM (SP), regs Load the specified registers from a block in memory.
Chapter 12 List of Machine Language Instructions 12.3.2 Arithmetic Instructions ADD Mnemonic Description of operation ADD Dm, Dn Add the contents of Dm and Dn and store the result in Dn. ADD Dm, An Add the contents of Dm and An and store the result in An. ADD Am, Dn Add the contents of Am and Dn and store the result in Dn. ADD Am, An Add the contents of Am and An and store the result in An.
Chapter 12 List of Machine Language Instructions MULTIPLY Mnemonic MUL Dm, Dn MULU Dm, Dn Description of operation Multiplies the 32-bit signed integer multiplicand in Dm by the 32-bit signed integer multiplier in Dn and store the upper 32 bits of the product in MDR and the lower 32 bits in Dn. Multiplies the 32-bit unsigned integer multiplicand in Dm by the 32-bit unsigned integer multiplier in Dn and store the upper 32 bits of the product in MDR and the lower 32 bits in Dn.
Chapter 12 List of Machine Language Instructions 12.3.3 Logical Instructions AND source with destination Mnemonic Description of operation AND Dm, Dn AND Dm with Dn and store the result in Dn. AND imm, Dn AND the zero-extended imm8, zero-extended imm16, or imm32 with Dn and store the result in Dn. AND imm16, PSW AND imm16 with PSW and store the result in PSW. OR source with destination Mnemonic Description of operation OR Dn, Dm OR Dm with Dn and store the result in Dn.
Chapter 12 List of Machine Language Instructions ARITHMETIC SHIFT RIGHT Mnemonic ASR Dm, Dn ASR imm8, Dn ASR Dn Description of operation Arithmetically shift the contents of Dn right the number of bits specified in Dm and store the result in Dn. Arithmetically shift the contents of Dn right the number of bits specified by imm8 and store the result in Dn. Arithmetically shift the contents of Dn right one bit and store the result in Dn.
Chapter 12 List of Machine Language Instructions 12.3.4 Bit Manipulation Instructions Bit operations Mnemonic BTST imm, Dn BTST imm8, (d8,An) BTST imm8, (abs32) BSET Dm, (An) BSET imm8, (d8,An) BSET imm8, (abs32) BCLR Dm,(An) BCLR imm8,(d8,An) Description of operation AND the zero-extended imm8, zero-extended imm16, or imm32 with the contents of Dn and set the flags according to the result.
Chapter 12 List of Machine Language Instructions Mnemonic BCLR imm8,(abs32) Description of operation This instruction proceeds through the following three stages: 1.Transfer, with zero-extension, the 8-bit contents of the memory location specified with abs32 to a 32-bit internal temporary register. 2.AND the temporary register with zero-extended imm8 and set the flags according to the result. 3.
Chapter 12 List of Machine Language Instructions 12.3.5 Branching Instructions CALL Subroutine Mnemonic CALL label CALLS (An) CALLS label RET RETF RETS JSR (An) JSR label RTS RTI TRAP Description of operation label is either (d16,PC) or (d32,PC). Push the program counter containing the address of the next instruction and necessary registers onto the stack, secure the necessary stack area, and branch to the specified address. This instruction is used paired with either a RET or RETF instruction.
Chapter 12 List of Machine Language Instructions Unconditional BRANCH Mnemonic Description of operation JMP (An) Store the contents of An in the program counter. JMP label If label is (d16,PC), the 16-bit displacement is sign-extended and added to the program counter. The result is stored in the program counter. Any overflow during the addition is ignored. The result is stored in the program counter. If label is (d32,PC), the 32-bit displacement is added to the program counter.
Chapter 12 List of Machine Language Instructions Conditional BRANCH Mnemonic BEQ label Meaning = ZF=1 BNE label ZF=0 BGT label < (signed) BGE label < (signed) BLE label > (signed) BLT label > (signed) BHI label < (unsigned) BCC label < (unsigned) CF=0 BLS label > (unsigned) BCS label < (unsigned) CF=1 BVC label VF=0 BVS label VF=1 BNC label NF=0 BNS label NF=1 BRA label 1 Description of operation If ZF = 1, execute a relative branch to the address specified by label.
Chapter 12 List of Machine Language Instructions Conditional BRANCH for LOOP Mnemonic LEQ Meaning LGT = ZF=1 = ZF=0 < (signed) LGE < (signed) LLE > (signed) LLT > (signed) LHI < (unsigned) LCC < (unsigned) CF=0 > (unsigned) LNE LLS LCS LRA < (unsigned) CF=1 1 Description of operation If ZF = 1, branch to the top of the loop as specified with SETLB. If ZF = 0, execute next instruction. If ZF = 0, branch to the top of the loop as specified with SETLB. If ZF = 1, execute next instruction.
Chapter 12 List of Machine Language Instructions 12.3.6 User-Defined Instructions User Defined FUNCTION Mnemonic UDFnn Dm, Dn UDFnn imm, Dn UDFUnn imm, Dn Description of operation If nn is between 00 and 15, compute with the contents of Dm and Dn and store the result in Dn. The nature of the calculation and the effects on the flags are user defined. If nn is between 20 and 35, compute with the contents of Dm and Dn. Do not store the result in Dn or modify the flags.
Chapter 12 List of Machine Language Instructions 12.3.7 Other Instructions NO OPERATION Mnemonic NOP Description of operation Do nothing.
Chapter 13 Error Messages 13
Chapter 13 Error Messages 13.1 Purpose of This Chapter Error messages are divided into three categories depending on the severity of the error. • Warnings • Errors • Fatal errors These messages are displayed during assembler and linker operations. A warning message warns the user of some state and consists of the marker "Warning," the warning number, and the text of the message. After displaying the warning message, the assembler or linker continues processing.
Chapter 13 Error Messages 13.2 Assembler Errors The assembler displays three types of messages: warning messages, error messages, and fatal error messages.
Chapter 13 Error Messages 13.2.1 Warning Messages 2001 Operand error An operand is of the wrong type. Check the number and types of operands, 2002 Illegal operand value An operand does not have an acceptable value. Change the value of the operand. 2003 Define symbol multiple defined. The same symbol is defined twice. Change the identifier after the #define or use the #undef control statement. 2004 Define symbol not defined. The identifier specified in an #undef statement has not been defined.
Chapter 13 Error Messages 2011 Not guaranteed operand by the instruction allocation. The usage of a series of instructions may be restricted in the microcomputer. Careful operation is needed as some operations are not guaranteed. Refer to the notes, attentions or warnings written in the Instruction Manual for 32-bit and ensure that the expected operation is guaranteed. If it is not guaranteed, modify the program. 2012 Symbol name too long. The symbol name exceeds the length limit.
Chapter 13 Error Messages 13.2.2 Error Messages 2301 Syntax error. The current line contains a syntax error. Consult this Manual and the MN1030/MN103S Series Instruction Manual. 2302 Illegal character. A string contains an illegal character. Use only legal characters 2303 Illegal string. A string contains an error. Correct the string. 2304 Instruction not found The specified instruction does not exist. Consult this Manual and the MN1030/MN103S Series Instruction Manual. 2305 Code size overflow.
Chapter 13 Error Messages 2314 Illegal section name. There is an error in a section name. Check the spelling of the section name. 2315 Operand error. An operand of the wrong type is used. Check the number and types of operands. 2316 Illegal operand expression. An operand expression does not evaluate to a value within the specified range. Check the operand expression. 2317 Too many operands. An operand of the wrong type is used. Check the number and types of operands, 2318 Illegal operand value.
Chapter 13 Error Messages 2328 Too many arguments. A macro invocation has too many arguments. Check the macro definition. 2329 Can’t find FUNCINFO directive. There is a ret or retf machine instruction before the corresponding funcinfo directive. Declare funcinfo directive before the ret or retf machine instruction. 2330 Line too long. A source statement exceeds the length limit. Edit the source statement so that its length is within the limit. 2331 No optimizing information.
Chapter 13 Error Messages 13.2.3 Fatal Error Messages 2501 Illegal option (string). There is an unrecognized option on the command line. Check the command line options. 2502 Too many input files (filename). There is more than one input file name on the command line. Limit the command line to a single input file. 2503 Input file name not found. There is no input file specification. Specify an input file. 2504 Output file name not found. There is no output file specification. Specify an output file.
Chapter 13 Error Messages 13.3 Linker Errors The linker displays three types of messages: warning messages, error messages, and fatal error messages.
Chapter 13 Error Messages 13.3.1 Warning Messages 3000 filename: Section not found. This file ignored. The input file does not contain section information. Check the contents of the specified input file. 3001 filename: Illegal section[name] attribute or align value. Different files have sections with the same name, but different attributes or alignment values. Make sure that the attributes and alignment value for all sections with the same name agree across files.
Chapter 13 Error Messages 13.3.2 Error Messages 3300 Bad option switch.(string) There is an error in the option specifications. Check the option specifications 3301 No parameter for (option) option. There is no parameter for the specified option. Check the command line options. 3302 Illegal parameter with (option) option. The parameter for the specified option is in the wrong format. Check the option specifications. 3303 Illegal address with (option) option. (addr) The specified address is invalid.
Chapter 13 Error Messages 3313 Extra symbol[name] used as normal symbol. The extra symbol, which is reserved for instruction RAM use, is used in a context other than a PUT option. Modify the program to use a different symbol in that context.
Chapter 13 Error Messages 13.3.3 Fatal Error Messages 3500 No memory space. There is insufficient memory. Make sure that there is sufficient memory capacity available 3501 fileneme: Cannot open file. The specified input file does not exist. Check the disk for the file. 3502 filename: Cannot read file. There is an error with the input file. Reassemble the corresponding source file and check the disk for hardware errors. 3503 filename: Cannot read parameter-file.
Chapter 13 Error Messages 3512 filename: Illegal relocation information.(line lineno) The relocation information in the specified input file is invalid. Check the specified line in the source file. If there are no problems there, reassemble the corresponding source file and check the disk for hardware errors. 3513 filename: Illegal optimize information.(line lineno) The optimization information in the specified input file is invalid. Check the specified line in the source file.
Chapter 13 Error Messages 264 Linker Errors
Chapter 14 Readinig List Files 14
Chapter 14 Reading List Files 14.1 Purpose of This Chapter This chapter explains how to read the list files output during assembly. There are two types of information output in a list file. • Machine language code • Symbol table This chapter also explains how to read the information added by individual options and the meanings of special symbols.
Chapter 14 Reading List Files 14.2 Reading List Files Adding the l (letter) option, when the assembler is invoked, will generate the list file in the current directory. List file contents are entirely in text format, so those can be viewed by using an editor.
Chapter 14 Reading List Files 14.2.1 Output Format of Machine Language Code The output format of the machine language code section is shown below. Location Machine Language Code Loc Object Supplemental Information + M @ Line Number Supplemental Information Source Statement + Line Source . Each of these fields is described below. Location (Loc) The location field shows the location counter values during assembly.
Chapter 14 Reading List Files Supplemental information A line number can provide additional information in the form of preceding periods and the suffixes X or +. “.” .10 ..10 ...10 Line numbers preceding by a period indicate that the line was included by an include directive. The number of periods indicate the nesting levels of include directives. For example, “.” means the line was included by an include directive that itself was within an include file.
Chapter 14 Reading List Files Source statement (Source) The source statements of the source file are output as is. If the Lm option is added when the assembler is invoked, output of source statements resulting from macro expansion will be suppressed. Below are example of source statement. Loc 00000000 00000000 00000001 00000002 00000004 00000006 00000007 00000008 0000000a 0000000c listspl.lst Page 1 *** PanaX Series MN1030 Cross Assembler *** Object Line Source 1 #include “outlist.h” .
Chapter 14 Reading List Files 14.2.2 Symbol Table If only the l (letter) option is specified, and not the c or s options, when the assembler is invoked, the assembler will output a symbol table to the list file after the machine language code section. If the c option is specified, a cross-reference table will be output instead of the symbol table. The symbol table outputs the name, value, and type of every symbol in the source file. It has the following format.
Chapter 14 Reading List Files Symbol Name Symbol names are shown up to 255 characters. An output example of a symbol table is shown below. listspl.
Chapter 15 Using Library Manager 15
Chapter 15 Using Library Manager 15.1 Purpose of This Chapter A library file is a collection of relocatable object files which you can pull out as needed. Library files are convenient for placing frequently used modules. When a module is called from within a program, the linker searches the library file, extracts only the required relocatable object file, and loads it in the executable format file. The library manager is a utility for managing library files.
Chapter 15 Using Library Manager 15.2 Starting Library Manager The library manager is started by entering a command name and parameters, just as for other MS-DOS external commands. General format of commands Below is the general format of the command to use when starting the library manager. slib103 library_file_name[options](relocatable_object_file_name) ... Contents of brackets [ ] may be omitted.
Chapter 15 Using Library Manager 15.3 Command Options This section describes the options using the following categories. 15.3.1 Error Message Options j Output error and warning messages in Japanese Functional description This option causes an error and warning messages and help screens sent to the console to appear in Japanese. The character coding depends on the host machine and the operating system.
Chapter 15 Using Library Manager Je Output error and warning messages in Japanese using EUC encoding Functional description This option causes all error and warning messages and help screens sent to the console to appear in Japanese using EUC coding. Rules of use To specify the option, enter the hyphen (-) followed by the upper case letter “J” and the lower case letter “e”. The two letters together function as a single option. slib103 NOTE: test.lib -f -Je test1.rf test2.rf test3.
Chapter 15 Using Library Manager Output error and warning messages in Japanese using Shift JIS encoding Js Functional description This option causes all error and warning messages and help screens sent to the console to appear in Japanese using Shift JIS coding. Rules of use To specify the option, enter the hyphen(-) followed by the upper case letter ’J’ and the lower case letter ’s’. The two letters together function as a single option. slib103 NOTE: test.lib -f -Js test1.rf test2.rf test3.
Chapter 15 Using Library Manager Jj Output error and warning messages in Japanese using JIS encoding Functional description This option causes all error and warning messages and help screens sent to the console to appear in Japanese using JIS coding. Rules os use To specify the option, enter the hyphen (-) followed by the upper case letter “J” and the lower case letter “j”. The two letters together function as a single option. slig103 NOTE: test.lib -f -Jj test1.rf test2.rf test3.
Chapter 15 Using Library Manager e Output error and warning messages in English Functional description This option causes all error and warning messages and help screens sent to the console to appear in English. Rules of use To specify the option, enter the hyphen (-) followed by the lower case letter”e”. slib103 test.lib -f -e test1.rf test2.rf test3.rf Default specification The default language used depends on the host machine and the operating system.
Chapter 15 Using Library Manager W number Do not output warning messages of the specific number Functional description This option suppresses output of warning messages generated during library manager operation. For a list of warning messages and numbers, see Chapter 15 “Using the Library Manager” Section 15.4 “Error Messages” Section 15.4.1.”Warning Messages”. The library manager ignores specifications for warning numbers that do not have messages assigned to them.
Chapter 15 Using Library Manager 15.3.2 Program Generation Options c Create a new library file Functional description If a file with same name of the specified library file already exists, the library manager will inquire if the file should be modified. Based on the response, the library manager with determine whether or not to create the library file. Rules of use To specify the option, enter the hyphen (-) followed by the lower case letter “c”. slib103 test.lib -c test1.rf test.lib -c test1.
Chapter 15 Using Library Manager f Force creation of a library file Functional description This option forces creation of the library file. If a file with the same name as the specified library file already exist, the library manager will overwrite it. Rules of use To specify the option, enter the hyphen (-) followed by the lower case letter “r”. slib103 test.lib -f test1.rf test.lib -f test1.rf Operation example slib103 test2.rf test3.rf test4.
Chapter 15 Using Library Manager 15.3.3 Functional Options a Add the specified relocatable object file to the library file Functional description This option is used to add relocatable object files to the library file. Rules of use To specify the option, enter the hyphen (-) followed by the lower case letter “a”. slib103 test.lib -a test.1.rf test.lib -a test.1.rf Operation example slib103 The example adds the relocatable file test1.rf to the library file test.lib.
Chapter 15 Using Library Manager d Delete the specified relocatable object file from the library file Functional description This option is used to delete relocatable object files from the library file. If a specified file does not exist in the library file, the library manager will output a warning message and continue processing. Rules of use To specify the option, enter the hyphen (-) followed by the lower case letter “d”. slib103 test.lib -d test1.rf Operation example slib103 test.lib -d test1.
Chapter 15 Using Library Manager p Output information about externally defined symbols in the library file Functional description This option is used when you want know the externally defined symbol names that exist in the library file. When a relocatable object file name is specified following the -p option, and a file with the same name exists in the library file, the externally defined symbol names in that relocatable object file will be output.
Chapter 15 Using Library Manager r Replace the specified relocatable object file in the library file Functional description This option is used to replace relocatable object files in the library file. If a specified file does not exist in the library file, the library manager will output a message add the relocatable object file. Rules of use To specify the option, enter the hyphen (-) followed by the lower case letter “r”. slib103 test.lib -r test1.
Chapter 15 Using Library Manager t Output a list of the relocatable object files that make up the library file. Functional description This option is used when you want to know the names of the relocatable object files that exist in the library file. When a relocatable object file name is specified following the -t option, and a file with the same name exists in the library file, that file name will be output.
Chapter 15 Using Library Manager x Extract the specified relocatable object file from the library file Functional description This option is used when you want to extract relocatable object files that exist in the library file. When a relocatable object file name is specified following the -x option, and a file with the same name exists in the library file, that relocatable object file will be extracted into the specified file name.
Chapter 15 Using Library Manager 15.3.4 Other Options @filename Specify a parameter file. Functional description The options you will use with slib103 can be written to a file, so instead of specifying all those options for execution, you can specify just that file name. Every option other than the @ option can be written in a parameter file. If a parameter file that doesn't exist is specified, the library manager will display an error message.
Chapter 15 Using Library Manager h Display a listing at available library manager’s options on the console Functional description This option displays the library manager’s version number, command line options and a brief description on the console. The -j, -Je, -Js, -Jj and -e options, if they appear, control the language and the coding scheme used to display this information. Rules of use To specify the option, enter the hyphen (-) followed by the lower case letter “h”.
Chapter 15 Using Library Manager 15.4 Error Messages The library manager displays three types of messages: warning message, error messages, and fatal error messages. These messages are display during library manager operation. A warning message warns the user of some state and consists of the marker “warning”, the warning number, and the text of the message. After displaying the warning message, the library manager continue processing.
Chapter 15 Using Library Manager 15.4.1 Warning Messages 4001 Filename not found The specified file is not in the library. Check the list of files in the library file. 4002 This file has no public symbol information.(filename) There is no public symbol information for the file filename. Check whether the file is actually needed. 4003 “filename” not found. In addition to library. This message indicates that the file to be replaced does not exist in the library.
Chapter 15 Using Library Manager 15.4.2 Error Messages 4301 Multiply specified object file name.(filename) Either the same object file is specified twice on the command line or an object file with the same name is in the library. Check the filename specifications. If necessary, change the file names. 4302 Premature EOF. (filename) There is something wrong with the contents of the specified file. Since the file is most likely corrupted, re-create it. 4303 Can not create temporary file name.
Chapter 15 Using Library Manager 4313 Parameter-file already specified. (filename) The same parameter file is specified more than once. Eliminate the duplicate specifications. 4314 Cannot read parameter-file. (filename) The library manager cannot read the parameter file--because it contains illegal characters, for example. Check the parameter file for control characters and kanji codes outside comments.
Chapter 15 Using Library Manager 15.4.3 Fatal Error Messages 4501 Illegal option. (string) The library manager does not support the specified option. Check the command line option specifications. 4502 Library file name not found. Either the command line contains no library file specification or the specification is in the wrong place. Check the library file specification. 4503 Multiply specified library file name. (filename) The command name contains multiple library file specification.
Chapter 16 Notes on Operating Environment 16
Chapter 16 Notes on the Operating Environment 16.1 Purpose of This Chapter This chapter contains descriptions left out of other chapters.
Chapter 16 Notes on the Operating Environment 16.2 Personal Computer Versions This section contains notes on using the personal computer versions of the software in this package.
Chapter 16 Notes on the Operating Environment 16.2.1 Operating Environment This system runs on the following personal computers and compatibles.
Chapter 16 Notes on the Operating Environment 16.2.2 Files The installation media for this system contains the following files. AS103.EXE (Assembler) AS103.EXE is the assembler. For a description, see the chapter 5 “Using the Assembler.” LD103.EXE (linker) LD103.EXE is the linker. For a description, see the chapter 6 “Using the Linker.” SLIB103.EXE (library manager) SLIB103.EXE is the library manager; a utility for creating library files. For a description, see the chapter 15 “Using the Library Manager.
Chapter 16 Notes on the Operating Environment 16.2.3 Installation For the installation media, installation procedures, and notes on installation, see the MN1030 Series Installation Manual.
Chapter 16 Notes on the Operating Environment 16.2.4 Environment Settings Before using this series Cross-Assembler, verify or change the following two files. CONFIG.SIS If FILES and BUFFER specifications do not already exist in CONFIG.SYS, you must add them. If they do already exist, check their settings and change them if necessary. FILES=20 BUFFERS=20 NOTE: Be sure to make these settings.
Chapter 16 Notes on the Operating Environment NOTE: Once you have edited AUTOEXEC.BAT, reset the computer and restart. The new setting will then automatically take effect. Terminology: AUTOEXEC.BAT AUTOEXEC.BAT is a batch file that MS-DOS automatically runs when it loads. SET is the command for setting MS-DOS environment variables. Application programs have free access to these variables.
Chapter 16 Notes on the Operating Environment 16.2.5 Differences From Workstation Versions The personal computer versions of the assembler, linker function and the library manager are exactly the same as their workstation counterparts. Command line differences • When specifying the command name, omit the file extension .EXE. • The personal computer versions use the forward slash(/) and backslash (\) as directory separators. NOTE: Example: AS103-1 -0 \USER\TMP\SAMPLE.RF SAMPLE.
Chapter 16 Notes on the Operating Environment 16.2.6 Error Correction Using Tag Jumps This section describes a convenient way to fix errors. When code mistakes, syntax errors, or other errors and warnings occur in a source file, further development cannot proceed unless they are fixed. In long source files, it can be a lot of work to find the source statements in which errors and warnings were detected.
Chapter 16 Notes on the Operating Environment 5 move 0x11, D0 MAIN.ASM(5):Error 2304: Instruction not found. 7 main MAIN.ASM(7):Error 2306: Multiple define symbol. Errors: 2 Warnings: 0 (MAIN.ASM) The following explanation is for the programmer’s editor MIFES. Start up MIFES and open two files. MI MAIN.ASM ERROR The contents of the file ERROR will be displayed on the screen. 5 move 0x11, D0 MAIN.ASM(5):Error 2304: Instruction not found. 7 main MAIN.ASM(7):Error 2306: Multiple define symbol.
Chapter 16 Notes on the Operating Environment Return to error file To return to the error file, press the HOME CLR key (above and to the left of the period key). When the screen switches to the error file, the cursor will move to the next error line. MAIN.ASM(7): Error 2306: Multiple define symbol. Press F10 for the source screen. By repeating this procedure, you can fix all the errors. Supplemental Explanation: You can use other editors that support tag jumps (VZ Editor‘, RED++‘).
Chapter 17 Appendix 17
Chapter 17 Appendix 17.1 Numeric Restrictions This section shows the numeric restrictions on this series cross-assembler. Be sure not to exceed these values when writing programs.
Chapter 17 Appendix 17.2 List of Command Options How to read The entries in the command option tables below and their meanings are as follows.
Chapter 17 Appendix 17.2.1 List of Assembler Command Options Assembler command general format Below is the general format of the command to use when starting the assembler. as103 [options] source_filename Contents of brackets [ ] may be omitted. Output file options Specify the relocatable object file name to be output. o file_name as103 -o/usr/obj/test.rf sample.asm Output a list file l as103 -1 sample.asm Do not output files included by #include to the list file. Li as103 -Li -l sample.
Chapter 17 Appendix Error message options Output error and warning messages in Japanese j as103 -j sample.asm Output error and warning messages in Japanese using EUC encoding. Je as103 -Je sample.asm Output error and warning messages in Japanese using Shift JIS encoding. Js as103 -Js sample.asm Output error and warning messages in Japanese using JIS encoding. Jj as103 -Jj sample.asm Output error and warning messages in English e as103 -e sample.asm Do not output warning messages of the specified number.
Chapter 17 Appendix Others Display a listing of available assembler options on the console. h as103 -h Display the assembler’s version number on the console.
Chapter 17 Appendix 17.2.2 List of Linker Command Options Linker command general format Below is the general format of the command to use when starting the linker. ld103 [options] (filename)... Contents of brackets [ ] may be omitted. Ellipses (...) indicates item may be repeated. Output file options Specify the path name and file name of the executable format file to be output. o filename ld103 -o /usr/tmp/test.ex main.rf sub.rf Output a map file. m ld103 -m main.rf sub.
Chapter 17 Appendix Program generation options Output debug information to the executable format file. g ld103 -g main.rf sub.rf Specify a section start address. T section-address ld103 -T_TEXT@CODE=80000000 -T@DATA=0 main.rf sub.rf Output an executable format file even if errors are detected. r ld103 -r main.rf Do not output symbol table within the executable format file. En ld103 -En main.rf sub.rf Enable output of DATA sections to the executable file. Ed ld103 -Ed main.rf sub.
Chapter 17 Appendix Others Specify a parameter file. @ ld103 @ pfile Display help information on the console. h ld103 -h Display the linker’s version number on the console.
Chapter 17 Appendix 17.3 List of Assembler Directives This section provides a list of assembler directives. Directives for program control Syntax Function & Notes symbol instruction operand align expression end name Adjust the location counter to be a multiple of the value indicated by expression. The expression must be a power of 2 in the range 1 to 215 Indicates the end of the program. org expression Change the program address to the value special by expression.
Chapter 17 Appendix Directives for data area allocation Syntax Function & Notes symbol instruction operand dc definition | expression(,definition Allocates 8-bit data areas. | expression)... dw expression(,expression)... Allocates 16-bit data areas. dd expression(,expression)... Allocates 32-bit data areas. ds expression1 [,expression2[. expression3]] Allocates the number of bytes specified by expression1 to a data area.
Chapter 17 Appendix Other directives Syntax Function & Notes symbol name instruction operand notation format Selects the coding format of numbers, format (CLANG | INTEL | PANA) CLANG: Extended C language format (default) INTEL: Intel format PANA: Matsushita format radix expression Specifies the radix to be used by default. The result of expression must be either 2, 8, 10 or 16.
Chapter 17 Appendix 17.4 List of Assembler Control Statements This section provides a list of assembler control statements. Syntax Function & Notes #include “file_name Reads in the source file specified by file_name. #define identifier[replacement_string] Replaces the identifier with the replacement_string. #undef identifier Purges the identifier previously defined by #define. #ifdef identifier block1 Assembles block1 if the identifier was defined before the #ifdef statement.
Chapter 17 Appendix Syntax #iflt expression block1 [#else Function & Notes Assembles block1 if the expression is negative. Assembles block2 if it is not negative (nothing will be assembled if there is no #else). block2] #endif #ifle expression block1 [#else Assembles block1 if the expression is zero or negative. Assembles block2 if it is positive. (nothing will be assembled if there is no #else). block2] #endif #ifgt expression block1 [#else Assembles block1 if the expression is positive.
Index Symbols D #define .................................................................187 #else .....................................................................191 #endif ...................................................................189 #if .........................................................................193 #ifb .......................................................................202 #ifdef ....................................................................191 #ifeq ..............
J O j ...................................................................... 91, 111 o filename ..............................................................89 Object ...................................................................268 Operand Field ......................................................150 Operation Field ....................................................149 Operators ..............................................................138 opt ..............................................
U Unary minus .........................................................138 Unary negation .....................................................139 Unary plus ............................................................138 Unconditional Branch Instructions ........................46 UND .....................................................................142 Undefined .............................................................142 undefined .............................................................
< 4 Index >
MN1030 Series Cross Assembler User’s Manual June, 2004 12th Edition Issued by Matsushita Electric Industrial Co., Ltd. Matsushita Electric Industrial Co., Ltd.
SALES OFFICES NORTH AMERICA ASIA ˜ U.S.A. Sales Office: Panasonic Industrial Company [PIC] — New Jersey Office: 2 Panasonic Way Secaucus, New Jersey 07094, U.S.A. Tel:1-201-348-5257 Fax:1-201-392-4652 — Chicago Office: 1707 N. Randall Road Elgin, Illinois 60123-7847, U.S.A. Tel:1-847-468-5720 Fax:1-847-468-5725 — San Jose Office: 2033 Gateway Place, Suite 200, San Jose, California 95110, U.S.