Instruction/ maintenance manual of the product MN1030 Panasonic
Go to page of 340
MICROCOMPUTER MN1030 MN1030 Series Cross Assembler User’s Manual Pub.No.13110-120E.
.
PanaXSeries is a trademark of Matsus hita Electric Industrial Co., Ltd. Sun and Sun OS are registered trademarks of Sun Microsystems Inc. of the United States. MS-DOS is a registere d trad em ark of Mi crosoft Corporation of the United States. VZ Editor is a registered tr ademark of Village Center, Inc.
< About This Manual 1 > About This Manual This manual describes the functions and op eration of th e cross assembler for this series of micr ocomputers.
<About This Manual 2 > • How to read • Heading Chapter titles are shown here on each page, so the reader can get a quick idea of contents while flipping through the pages. • Program example These are actual examples of co mmand options and instructions used by the assembler.
< About This Manual 3 > • Related Manuals The following related manuals are available. Please contact our sales representative for more details.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 index Chapter 1 Getting Started Chapter 2 Program Development Flow Chapter 3 Introdu ction to Operation Chapter 4 Optimization Chapter 5 Using Assembler Cha.
< 1 TOC > Table of Contents Chapter 1 Getting Started 1.1 Purpose of This Chapter ............. ................. .............. ................. ................. .............. ...... ........ ... .............. .. 2 1.2 Operating Environment .
< TOC 2 > 6.2 Starting Linker ................... ................. ................. .............. ................. .............. .............. .............. ........... 85 6.3 Command Options ..................... .............. .........
< 3 TOC > 9.4.4 listoff, liston ..................... ................. ................. .............. ................. .............. .............. ............... 159 9.4.5 notation ....................... ................. .............. .
< TOC 4 > 12.3.1 Data Move Instructions ......................... .............. ................. ................. .............. .. ............ ......... 232 12.3.2 Arithmetic Instructions ........... .............. ................. .......
< 5 TOC > 16.2. 6 Error Correction Using Tag Jumps ..................... ................. ................. ................ ........ ......... .... 306 Chapter 17 Appendix 17.1 Numeric Restrictions ................... ................. .......
1 Chapter 1 Getting S tarted.
Chapter 1 Getting Started 2 Purpose of This Chapter 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 Operating Environment 3 1.2 Operating Environment This system runs on the following workstations, personal compu ters and com pati bles.
Chapter 1 Getting Started 4 File Organization 1.3 File Organization The installation media fo r thi s system contain the following files. as103 (assembler) as103 is the assembler. For a descrip tion, see Chapter 5 "Using Assembler." ld103 (linker) ld103 is the linker.
Chapter 1 Getting Started Installation 5 1.4 Installation For the installation media, instal lation procedures , and notes on installation, see the Inst allation Manual.
Chapter 1 Getting Started 6 Setup 1.5 Setup These procedures are for setting up this system wh en it has just been installed or for altering basic settings. Setting command path Unix uses the environment variable PATH when searching for executable files.
Chapter 1 Getting Started Setup 7 NOTE: Note that the command line is preced ed when specifying the option wh ich ca n be set in an environmen tal setting file with the command line at starting the assembler a nd the linker. Refer to the Chapter 5 “Using Assembler” for the assembler and to the Chapter 6 “Using Link er” for the linker.
Chapter 1 Getting Started 8 Setup The start-up file .as103rc supports the follo win g keywords. The start-up file .ld103rc supports the following keyboards. Keyword Des cription message This entry specifies the language and coding scheme for messages from the assembler.
Chapter 1 Getting Started Setup 9 En-OPTION This entry controls the output of debu ggi ng 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 parame ters have the following meanings.
Chapter 1 Getting Started 10 File Conversion Utility 1.6 File Conversion Utility This file conversion utility converts an EX form at fil e prod uced by th e linker into a file in Intel HEX format, or Motorola S format. General command format The general command format used to start th e file conversion utility is shown below.
Chapter 1 Getting Started File Conversion Utility 11 Default specification See the default setting s for the following operations. Rules of output file name Based on input file name or the file name specified with “o” option, change th e extension .
Chapter 1 Getting Started 12 File Conversion Utility Example of specifying options 1. Specify the range of data conversion. (-R) excv103 -R1000, 1020 sample.ex Converts the data between the address 1000 an d the address 1020 in the file of sample.ex. 2.
2 Chapter 2 Program Development Flow.
Chapter 2 Program Development Flow 14 Purpose of This Chapter 2.1 Purpose of This Chapter Programs can b e developed with a compiler or an assembler. Currently most program dev elopment is done with a compiler, but an assembler i s where compact code generation or faster processing speed is required.
Chapter 2 Program Development Flow Program Development Flow 15 2.2 Program Development Flow Main development flow The microcomputers are used in such diverse appl ications as AV equipment, household electronics, information equipment, automob iles, robots, po rt able phones, computer peripherals, etc.
Chapter 2 Program Development Flow 16 Program Development Flow Source code debugger The software developed on a workstation or personal com put er mu st be checked using a hardware environment similar to that used by the final pr od uct. Nearly all of this seri es microcomputers will ulti matel y be incorporated within end products.
Chapter 2 Program Development Flow Programming with Assembler 17 2.3 Programming with Assembler Before creating programs using the assembler, you must understand the follo wing items.
Chapter 2 Program Development Flow 18 Programming with Assembler Programming style It is important to use a consistent style for program coding from start to finish. When several peopl e are to create a program, they should meet in advance to decide on a common style.
Chapter 2 Program Development Flow Programming with Assembler 19 Conditional assembly If a program for pro duct A is to be created b y partially modifying a p rogram for product B, bo th can be combined into a single program by using conditional assembler control inst ructions.
Chapter 2 Program Development Flow 20 Programming with Assembler.
3 Chapter 3 Introdu ction to Operation.
Chapter 3 Introduction to Operation 22 Purpose of This Chapter 3.1 Purpose of This Chapter Many options are provided with the Cross-Assembler and Link er, but you can use the assembler and linker without knowing all of them. This chapter explains how to use the most useful options whi le demonstrating actu al operation.
Chapter 3 Introduction to Operation Files Used by Assembler and Linker 23 3.2 Files Used by Assembler and Linker Figure 3-1 shows the inter-relationships of the files used by the assembler and lin ker. Figure: 3-1 Files Used The assembler inputs source file s and include files, and output s relocatable object files.
Chapter 3 Introduction to Operation 24 Files Used by Assembler and Linker Depending on the option specificatio ns inpu t 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 ad dresses.
Chapter 3 Introduction to Operation Basic Operation of Assembler and Linker 25 3.3 Basic Operation of Assembler and Linker The Cross-Assembler uses a sectio n address format, in which the st art address for each section as defined with the section directive corresponds to its start address when li nked.
Chapter 3 Introduction to Operation 26 Basic Operation of Assembler and Linker The contents of program2.asm are as follows. program2.asm also consists of a section called _C ODE (attribute CODE, link type PUBLIC), and it makes an external declaration of data_set.
Chapter 3 Introduction to Operation Basic Operation of Assembler and Linker 27 Link Link the two relocatable object files to gen erate an executable format file. A map file will be generated along with the executable fo rmat file at this time. ld103 -m -T_CODE=40000000 program1.
Chapter 3 Introduction to Operation 28 Basic Operation of Assembler and Linker The contents of the final list fi le program1.lst are as follows. program1.
Chapter 3 Introduction to Operation Basic Operation of Assembler and Linker 29 The contents of the final list file program2.lst are as follows. Here is a simple explanation of how to read the list files.
Chapter 3 Introduction to Operation 30 Assembling and Linking Multiple Sections 3.4 Assembling and Linking Multiple Sections In section 3.3, "Basic Operatio n of the Assembler and Linker", source files each comprising one section were assigned to the same section as a ba sic example.
Chapter 3 Introduction to Operation Assembling and Linking Multiple Sections 31 The contents of program 4.asm are as follows. As can be seen from the above two files, these pro grams are divi ded as follows. • main, time_filler ..._CODE_00 • data_set .
Chapter 3 Introduction to Operation 32 Assembling and Linking Multiple Sections generate list files (program 3.lst and program4.lst) respectively in the curr ent dir ecto r y (l option). Adding debug informati on (g option) enables symbols to be used during debuggi ng.
Chapter 3 Introduction to Operation Assembling and Linking Multiple Sections 33 The contents of the list file program4.lst are as follows. Note that the symbol table is not disp layed. This file is defined as two sections. The addresses of the starting lo cat ions of both sections is assumed 00000000.
Chapter 3 Introduction to Operation 34 Assembling and Linking Multiple Sections Link Link the two relocatable object files to generate an executable format file. Specify the g option to add debug information to the execut able fo rmat file. A>ld103 -m -g -T_CODE_00 =800 0000 00 -T_C ODE_01=8000500 0 pro gram3.
Chapter 3 Introduction to Operation Assembling and Linking Multiple Sections 35 Generate final list files After link processing is complete, ge nerate the final l ist files using the map file (program3.MAP). This will show what happen s to the previous '+' and 'R' marks.
Chapter 3 Introduction to Operation 36 Assembling and Linking Multiple Sections The contents of the final list fi le program4.lst are as follows. Note that the symbol tabl e is not displ ayed.
Chapter 3 Introduction to Operation Assembling and Linking Multiple Sections 37 program locations after linking program locations in the executable file after linking as above are shown below. Figure: 3-2 pro gra m Location If the program contains multiple sect ions, it is laid ou t using the following rules.
Chapter 3 Introduction to Operation 38 Conditional Assembly and Linking 3.5 Conditional Assembly and Linking The Cross-Assembler provides many assembler direct ives. Assembler directives are not converted directly to machine language , but are used to control how the ass embler processes.
Chapter 3 Introduction to Operation Conditional Assembly and Linking 39 Assemble and link Assemble and link the program that you have creat ed. as103 program5.asm ld103 -m -T_CODE=400000000 program5.rf as103 -l -a m103. program5.asm The first assembly generates the relocatable object fi le program5.
Chapter 3 Introduction to Operation 40 Conditional Assembly and Linking 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.
Chapter 3 Introduction to Operation Conditional Assembly and Linking 41 In the previous file, you eith er deleted the define li ne 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.
Chapter 3 Introduction to Operation 42 Conditional Assembly and Linking.
4 Chapter 4 Optimization.
Chapter 4 Optimization 44 Purpose of This Chapter 4.1 Purpose of This Chapter The assembler and linker examine source statements containin g cond itio nal branches, unconditional branches, subroutine .
Chapter 4 Optimization Rules of Usage 45 4.2 Rules of Usage To use the optimization function, opt imization must be turn ed on by using the O option or by placing an opt directive at the start of the source file . NOTE: Optimization is off by default.
Chapter 4 Optimization 46 Usage Example 4.3 Usage Example Optimization Instructions Optimization covers the following conditional branches, unco nditional branches, su broutine calls, data transfer instructions, arithmetic instructions, logical instructions, bit manipulation instructions, an d user-defined instructions.
Chapter 4 Optimization Usage Example 47 T able 4-3 Dat a T ransfer Instructions Subject T o Optimization Instruction T ype Branch Range MOV (abs), An Absolute addressing 16M-byte memory space MOV (abs.
Chapter 4 Optimization 48 Usage Example T able 4-4 Arithmetic Instructions Subje ct T o Optimization Instruction T ype Branch R ange ADD imm, An Immediate addressing 32-bit immediate data ADD imm, Dn .
Chapter 4 Optimization Usage Example 49 Optimization processing The assembler informs the linker about all instructions t o be optimized. Based on th e information from the assembler, the lin ker outputs instru ction codes with the sm allest code size.
Chapter 4 Optimization 50 Usage Example Optimization processing of conditional branch instructions The linker resolves address values for la bels when linking multiple files. In the example below, the linker will d etermine whether or not the label coded as an operand is within the allowable range of the current instruction.
Chapter 4 Optimization Usage Example 51 Optimization of function calls This section describes the optimization of function calls by the link er. The assembler provides advanced processing for functio n calls. This processing uses a combinat ion of the call and ret instructions and the global and fu ncinfo directives.
Chapter 4 Optimization 52 Usage Example Optimization of branches For unconditional branch in structions, a JMP label instruction is replaced by a BRA label instruction if the jump target is within the range available for the shorter, relative branch instruction BRA .
Chapter 4 Optimization Usage Example 53 Optimization of data transfer, arithmetic, logica l, bit manipulati on and user-defined instructions For data transfer, arithmet ic, logical, bit manipulati on,.
Chapter 4 Optimization 54 Usage Example MOVH (d,SP),Dn MOVH (d8,SP),Dn MOVH (d16,SP),Dn MOVH (d32,SP),Dn MOVH Dn,(abs) MOVH Dn,(abs16) MOVH Dn,(abs32) MOVH Dn,(d,An) MOVH Dn,(d8,An) MOVH Dn,(d16,An) M.
Chapter 4 Optimization Usage Example 55 Example: branch destinati on of conditional branch instructio n within range This example shows a branch in the permitted range (-128 to 127 of PC) of a BCC LABEL conditi onal branch instruction. The source list is as follows.
Chapter 4 Optimization 56 Usage Example Example: branch destination of condition al branch instruct ion out of range This example shows a branch outside the permitted range (-128 to +127 of PC) of a BCC LABEL con- ditional branch instruct ion . The source list is as follows.
Chapter 4 Optimization Usage Example 57 Example: unconditional br anch instruction convert ed to relative branch This example shows the branch de stination of a JMP LABEL unconditional branch instru ction within the permitted range (-128 to +127 of PC) for relative branching.
Chapter 4 Optimization 58 Usage Example Example: subroutine call c onverted to a relative branch This section gives an example of a CALLS LABEL inst ruction with a target address within the range of a relative jump--that is, between -32,768 and +32,767 from the current prog ram counter.
5 Chapter 5 Using Assembler.
Chapter 5 Using Asssembler 60 Purpose of This Chapter 5.1 Purpose of This Chapter This Chapter describes assembler operating proced ures. Chapter 3 "Introduction to Operation" described the basic operation of the assembler and li nker, but this one descri bes the man y opti ons available with the assembler and gives examples.
Chapter 5 Using Assembler Starting Assembler 61 5.2 Starting Assembler The assembler is started by entering the comman d name and the desired parameters. The command name differs depending on the device being used. Th is chapter uses the terminology of as103 as its general format.
Chapter 5 Using Asssembler 62 Starting Assembler Summary of options The following Table lists the available command line options. T able 5-1 Assembler Options Option T ype Symbol Description Output file o file_name Specify the relocatable object file name to be output.
Chapter 5 Using Assembler Command Options 63 5.3 Command Options This section describes the options available for th e assembler. The assembler has an abundance of options for controlling assem bler pro cessing and output files. Not all options are available at the same time.
Chapter 5 Using Asssembler 64 Command Options 5.3.1 Output File Options Functional description This option specifies the relocatable ob ject file nam e to be output by th e assembler. If the specified file already exists, its prev ious contents will be erased.
Chapter 5 Using Assembler Command Options 65 Functional Description This option outputs a list file. The file name of th e list file will be the source fil e name with the extension .lst. The list file will be generated in the same directory as the source file.
Chapter 5 Using Asssembler 66 Command Options Functional Description This option suppresses output of source file contents inclu ded by assemb ler di rective (include) to the list file. However, the machine lan guage code will be written to the relocatable object file.
Chapter 5 Using Assembler Command Options 67 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 m achine language inst ruct ion mnemonics will be suppressed; machine language code will be output.
Chapter 5 Using Asssembler 68 Command Options Functional Description This option suppresses output of blocks of unsatisfied con ditions with conditional assem bl y to the list file.
Chapter 5 Using Assembler Command Options 69 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 (-) optio n specification character, followed by the upper-case letter 'L' and lower-case letter 's'.
Chapter 5 Using Asssembler 70 Command Options 5.3.2 Error Message Options Functional Description This option causes all error and warning messages and help screens sen t 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 Command Options 71 Functional Description This option causes all error and warning messages and help screens sent to the console or th e listing file to appear in Japanese using EUC coding.
Chapter 5 Using Asssembler 72 Command Options Functional Description This option causes all error and warning messages and help screens sen t to the console or the listing file to appear in Japanese using Shift JIS coding.
Chapter 5 Using Assembler Command Options 73 Functional Description This option causes all error and warning messages and help screens sent to the console or th e listing file to appear in Japanese using JIS coding.
Chapter 5 Using Asssembler 74 Command Options Functional Description This option causes all error and warning messages and help screens sen t to the console or the listing file to appear in English . Rules of Use To specify the option, enter the hyphen (-) follo wed by th e lower case letter 'e'.
Chapter 5 Using Assembler Command Options 75 Functional Description This option suppresses output of warnin g messages generated during assem bler operation.
Chapter 5 Using Asssembler 76 Command Options 5.3.3 Preprocessor Options Functional Description Trace from the directory that specifi es the include file in the assembler source file. If the absolu te path starting with “/” is written, tis op tion is invalid.
Chapter 5 Using Assembler Command Options 77 Functional Description The assembler directives #ifdef, #else, and #endif se lect which source statements are to be assembled depending on whether an identifier has been defined by a define directive.
Chapter 5 Using Asssembler 78 Command Options 5.3.4 Program Generation Options Functional Description This option causes the assembler to i nclude in the relocatable object file information for use in debugging at t he source code level.
Chapter 5 Using Assembler Command Options 79 Functional Description This option enables optimization of instructions by th e assembler and linker. For the instructio ns subject to optimizatio n, see Chapter 4 "Opti mization Function s .
Chapter 5 Using Asssembler 80 Command Options 5.3.5 Other Options Functional Description This option displ ays assembler command options and their descript ions 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 informati on.
Chapter 5 Using Assembler Operation Examples 81 5.4 Operation Examples There are three steps to perfor m 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 (.
Chapter 5 Using Asssembler 82 Operation Examples 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 opti mization options (O, Od).
6 Chapter 6 Using Linker.
Chapter 6 Using Linker 84 Purpose of This Chapter 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, an d if specified by option outputs a map file containing link information.
Chapter 6 Using Linker Starting Linker 85 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 nam e s of files to be linked . The command name differs depending on the dev ice being used.
Chapter 6 Using Linker 86 Starting 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 acco rdan ce with the default interpretations built in to the assembler.
Chapter 6 Using Linker Starting Linker 87 Summary of Options T able 6-1 Linker options Option T yp e Symbol Description Output file options o filename Specify the path name and file name of the executable format file to be output. m O utput a map file Error message options j Output error and warning messages in Japanese.
Chapter 6 Using Linker 88 Command Options 6.3 Command Options This section describes the options used by the linker. The lin ker has man y options for controlling output file specifications and the inform ati on written to files. The linker reads multiple rel ocatable object files, links them into one, an d creates an executable format file.
Chapter 6 Using Linker Command Options 89 6.3.1 Output File Options Functional description This option specifies the directory an d file name of the executable format file to be outp ut by the linker. If the directory is omitted, the file will be output to the current directory.
Chapter 6 Using Linker 90 Command Options Functional description The map file lists the addresses and sizes of a ll sections linked by the linker plus identifying information and valu es for lo cal and global symbols. For all programs, the addresses assigned to sections and symbols are not determined until linking.
Chapter 6 Using Linker Command Options 91 6.3.2 E rror Message Options Functional description This option causes all error and warning messages and help screens sent to the console or th e listing file to appear in Japanese. The character coding depends on the host machine and the operating system.
Chapter 6 Using Linker 92 Command Options Functional description This option causes all error and warning messages and help screens sen t to the console or the listing file to appear in Japanese using EUC coding.
Chapter 6 Using Linker Command Options 93 Functional description This option causes all error and warning messages and help screens sent to the console or th e listing file to appear in Japanese using Shift JIS coding.
Chapter 6 Using Linker 94 Command Options Functional description This option causes all error and warning messages and help screens sen t to the console or the listing file to appear in Japanese using JIS coding.
Chapter 6 Using Linker Command Options 95 Functional description This option displays messages for errors and warnings detected in li nk commands and link processing to the screen and list file in English.
Chapter 6 Using Linker 96 Command Options Functional description This option suppresses output of specified warnings detected during linki ng. Unli ke errors, warni ngs are not fatal, so the W option is used when you understand thei r mean ings sufficiently and need to suppress their output.
Chapter 6 Using Linker Command Options 97 6.3.3 P rogram Generation Options Functional description This option causes the linker to include in the executa ble file information for use in debugging at the source code level.
Chapter 6 Using Linker 98 Command Options Functional description This option specifies the st arting 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.
Chapter 6 Using Linker Command Options 99 Figure: 6-2 Memo ry Sp ace Layout Default specification When there are no address specifica tions whatsoever, the fi rst section in the first file is assigned to address 0. The remaining sections are as signed using the rule 2 mention ed above.
Chapter 6 Using Linker 100 Command Options The linker merges the CODE sections from the input fil es, st arting at address 80000000 (hex). It merges the DATA sections from the file sub.rf, starting at address 0. The DA TA section from main.rf do not have an address specification, so are merged following the DATA section from sub.
Chapter 6 Using Linker Command Options 101 Functional description The linker normally suppresses the creat ion 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 linke r errors will not exec ute properly.
Chapter 6 Using Linker 102 Command Options Functional description This option su ppresses output of a sym bol table in the executable format file . Only executable code will be output to the executable format file.
Chapter 6 Using Linker Command Options 103 6.3.4 Library File Options Functional description This option specifies a library file. Rules of use This option is specified with the hyphen (-) optio n spe.
Chapter 6 Using Linker 104 Command Options Functional description This option specifies a director y that contains library files. Library files following the L optio n specification will be searched for in the speci fied directory. First, the current directory is searched.
Chapter 6 Using Linker Command Options 105 6.3.5 Other Options Functional description By writing various option used by th e linker in a file, the @ option lets you specify just that file during execution, and the linker will repl ace it with the option specifications.
Chapter 6 Using Linker 106 Command Options Functional description This option displays linker comm and options and their descriptions to the screen. Th e h optio n is used alone. Rules of use This option is speci fied with the h yphen (-) option specification character, followed by the lower-case letter 'h'.
Chapter 6 Using Linker Instruction RAM Support 107 6.4 Instruction RAM Support This series includes members with instruction RAM for use in copy ing program portions to RAM for execution there. The linker therefore suppo rts special options for creating executabl e files with support for in st ruction RAM.
Chapter 6 Using Linker 108 Instruction RAM Support 6.4.1 Structure of IRAM Support Executable File Structural Elements of an IRAM Support Executable (A) Fixed pr o gr am portion This portion resides in external memory and runs us ing addresses as is in the normal fashion.
Chapter 6 Using Linker Instruction RAM Support 109 Figure: 6-3 Layout Image for Instruction RAM and Exter nal Memory NOTE: When the instruction RAM function is in use , the linker reserves the extra s.
Chapter 6 Using Linker 110 Instruction RAM Support File layout and transfer operations for an instru ction RAM executable file 1. Use the linker's T and OVL layou t options to divide th e program into a fixed port ion (A) and an instruction RAM po rtion (B).
Chapter 6 Using Linker Instruction RAM Support 111 6.4.2 IRAM Support Options Using the following options creat es an ex ecutable file supporting instruction RAM operatio n. Functional description This option assigns an address in instruction RAM for the specified section.
Chapter 6 Using Linker 112 Instruction RAM Support The starting address in instruction RAM is given in hex adecimal. 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.
Chapter 6 Using Linker Instruction RAM Support 113 Functional description This option is used to specify addresses for the extra symbols used by the instruct ion RAM function.
Chapter 6 Using Linker 114 Instruction RAM Support 6.4.3 Operation Examples The following are examples of s ection layouts using the OVL option for the five relocatable obj ect files, main.rf, sub.rf, prog1.rf, prog2.rf, and prog3.rf, in t he curren t directory.
Chapter 6 Using Linker Instruction RAM Support 115 NOTE: If multiple sections share the same or overlapping regions in instruction RAM, their code mu st be mutua lly exclusive. In other words, in the abov e exampl e, the files prog1.rf, prog2.rf, and prog3.
Chapter 6 Using Linker 116 Instruction RAM Support.
7 Chapter 7 T ypes of Source S tatements.
Chapter 7 Type of Source Statements 118 Purpose of This Chapter 7.1 Purpose of This Chapter Programs used by the Cross Assembler are collections of source statements.
Chapter 7 Type of Source Statements Program Format 119 7.2 Program Format A program is text created to assemble as machine language instru ctions in or der to operate a micropro- cessor. The assembler translates the text into mach ine language code, while the linker joins that code to make an executabl e form at fi le.
Chapter 7 Type of Source Statements 120 Program Format Below is an example source file. ; SAMPLE PROGRAM ; comment #include "FILE1.H ;include a file #define ;define identifier for conditio nal as.
Chapter 7 Type of Source Statements Machine Language Instruction Statements an d Directive Statements 121 7.3 Machine Language Instruction Statements and Directive Statements Machine language instruction statements Machine language instructio ns are instructions th at the microprocesso r directl y executes on its own hardware.
Chapter 7 Type of Source Statements 122 Assembler Control Statements 7.4 Assembler Control Statements Assembler control statements ar e source statements that contro l how th e assembler processes.
Chapter 7 Type of Source Statements Macro Control Statements 123 7.5 Macro Control Statements Macro control statements reduce coding effort by replacing strings code d in source statements with other strings. This enables low-level assembly language for a program bloc k to be abstracted as a macro name.
Chapter 7 Type of Source Statements 124 Comment Statements 7.6 Comment Statements The comment statements start from: 1) an asterisk (*) in the beginnin g of the line 2) a semicolon (;) in the beginning or middle of the lin e If you find an asterisk (*) in a line, the whole line is th e comment statement.
Chapter 7 Type of Source Statements Blank Statements 125 7.7 Blank Statements A blank statement consists of a si ngle carriage return. Blank statements are used to make printed lists easier to read.
Chapter 7 Type of Source Statements 126 Blank Statements.
8 Chapter 8 Writi ng Source S t atements.
Chapter 8 Writing Source Statements 128 Purpose of This Chapter 8.1 Purpose of This Chapter This chapter explains common info rmation for writing so urce statem ents. Source statements include machine language instruction statem ents, assembler control statements , and macro control statements.
Chapter 8 Writing Source State ments Permitted Characters 129 8.2 Permitted Characters There are three types of characters that can be coded in source s tatem ents for the cross assembler of this series.
Chapter 8 Writing Source Statements 130 Numbers 8.3 Numbers The cross assembler provides three coding formats fo r use in numbers and (sin gle) character constants (refer to section 8.
Chapter 8 Writing Source State ments Numbers 131 Extended C language format Coding rules: Binary Start with '0' (zero) and l etter 'B' (or 'b'), follo wed by binary digi ts. Octal S tart with '0' (zero), followed by octal digits.
Chapter 8 Writing Source Statements 132 Numbers Matsushita format Coding ru les: Binary Start wit h lett er 'B' (or 'b'), and enclose binary di gits in sin gle quo tation marks ( ' ). When the default is bi nary, code the binary number as is.
Chapter 8 Writing Source State ments Character Constants 133 8.4 Character Constants ASCII characters ,which can be displayed, can be coded as character cons tants or string constants.
Chapter 8 Writing Source Statements 134 Character Constants 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 sa me as a character constant. Coding rules: String constants are specified by enclosing the strin g in double quotation marks ( " ).
Chapter 8 Writing Source State ments Address Constants 135 8.5 Address Constants Address constants return p articular 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 parenthese s following an address specifier.
Chapter 8 Writing Source Statements 136 Location Counter 8.6 Location Counter The assembler contains an variable for counting addresses of instructi ons. This v ariable is called the location counter. Each time the assembler converts an instruction to machine langua ge, it increments the location counter by the number of words in that instruction .
Chapter 8 Writing Source State ments Expressions 137 8.7 Expressions Expressions are symbols, self-ref erence address sy mbols, 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 138 Expressions 8.7.1 Operators There are three types of operators. • Arithmetic operators • Shift oper ators • Logical operators Arithmetic operators Arithmetic operators perform the fou r standard arithmetic calculatio ns.
Chapter 8 Writing Source State ments Expressions 139 Logical operators Logical operators perform calculation in bit unit s. Formats: Example: operand1 & operand2 A DDRESS & MASK operand1 ^ ope.
Chapter 8 Writing Source Statements 140 Expressions 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 eva luated in order from left to right.
Chapter 8 Writing Source State ments Expressions 141 8.7.3 E xpression Syntax Below is an expression syntax diagram Expression Sy ntax NOTE: When the expressions starting with pa renthesis are coded to the ope rands of Machine language instructions, it will be r egarded as an addre ss-reference.
Chapter 8 Writing Source Statements 142 Expressions 8.7.4 Expression Attributes When expression operands are connected by an oper ator, the calculated result of the expression will have attributes of the operands and the operator. The most important attributes for expression evaluatio n are as follows.
Chapter 8 Writing Source State ments Expressions 143 For + (addition) operator For - (subtraction) operator For *, /, %, <<, >>, &, ^ , | operators NOTE: The expressions writing in directive coding instructions and assembler control instruction must result in absolute attributes(ABS).
Chapter 8 Writing Source Statements 144 Reserved Words 8.8 Reserved Words The assembler gives special meanings to the symbols listed below, so they cannot be used fo r other purposes.
9 Chapter 9 W riting Machine Language Instruction S t atements and Directive S tatements.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 146 Purpose of This Chapter 9.1 Purpose of This Chapter This chapter explains how to write machine language in structions and directives. There are five source statement formats • Instruction statements that code machin e language instructions and directives.
Chapter 9 Writing Machine Language Instructions and Directive Statements Instruction Statement Fields 147 9.2 Instruction Statement Fields Source statements that code machin e language instructions and directives are built from four fields. [label] [operation [op e rand [, operand]]] [commen t] Contents of brackets [ ] can be omitted.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 148 Instruction Statement Fields 9.2.1 Writing Label Field Labels are called both symbols and names. The asse mbler assigns a label the value of the location counter at the point it is defined.
Chapter 9 Writing Machine Language Instructions and Directive Statements Instruction Statement Fields 149 9.2.2 W riting Operation Field The operation field is writt en with a machine language instruction or directive. Coding rules Machine language instructio ns cannot mix case.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 150 Instruction Statement Fields 9.2.3 Writing Operand Field The operand field coding is determined by the machine languag e instruction or directive in the operation field. Refer to the "Instruction Manual " fo r details on coding machine lang uage instructions.
Chapter 9 Writing Machine Language Instructions and Directive Statements Instruction Statement Fields 151 9.2.4 W riting Comment Field The field that starts from a semi colon (;) after the operands is call ed the comment field.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 152 Writing Machine Language Instruction Statements 9.3 Writing Machine Language Instruction Statements Each machine language instru ct ion is defined by specific mnemonics.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 153 9.4 Writing Directive Statements Directives differ from machine language i nstructions in that th ey only have effect on the assembler.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 154 Writing Directive Statements 9.4.1 section Syntax label operation operand section_name section [definitio n1 [,definition2.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 155 Operand coding rules Only specific strin gs can be defined for definitio n1 and definition2. If some other string is defined, the assembler will gener ate an er ror and ignore this directive.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 156 Writing Directive Statements 9.4.2 align Syntax label operation operand align expression Default settings The current location counter value will be inherited.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 157 Usage example Below is an example use of the align directive. In the align 6 directive on line 6, the expression val ue 6 is not a power of 2, so the assembler w ill convert it to align 8.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 158 Writing Directive Statements 9.4.3 end Syntax label operation operand [name] end Default settings If the end directive is omitted, the assembler file wil l assum e that th e end of th e file is the end of the program.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 159 9.4.4 listoff, liston Syntax label operatio n operand [name] listoff . . . [name] liston Functional description The listoff and liston direct ives are used in pairs.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 160 Writing 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 form at of numbers and character co nstants (single character).
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 161 Usage example Below is an example use of the notation directive.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 162 Writing 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 locat ion counter to the address value speci fied by expression.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 163 9.4.7 opt Syntax label operatio n operand opt on | off Default settings If omitted, opt o ff will be assumed. Functional description This directive enables and disa bles the optimizat ion functi ons of the assembler and linker.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 164 Writing Directive Statements 9.4.8 page Syntax label operation operand page lines_expression [,columns_expression] Default settings Number of li nes = 60 Number of columns = 132 Functional description This directive specifies the number of lines and columns per page.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 165 9.4.9 radix Syntax label operation operand radix expression Default settings Radix 10 (decimal) . Functional description This directive specifies the radix th at will be used by d efault.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 166 Writing Directive Statements 9.4.10 dc Syntax label operation operand [name] dc constan t | expression (, constant | expression )... Functional description This directive is u sed to define constan ts in a memory area.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 167 9.4.11 ds Syntax label operation operand [name] ds expression1 [, e xpression2 [, expression3 .
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 168 Writing Directive Statements Usage example Below is an example use of the ds directive.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 169 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.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 170 Writing Directive Statements 9.4.13 dd Syntax label operation operand [name] dd expression(, expression)... Functional description This directive is us ed to defi ne 32-bit cons tan ts in a memo ry area.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 171 9.4.14 equ Syntax label operation operand name equ expr ession Functional description This directive defines the name to be the value of the expression coded in th e operand.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 172 Writing Directive Statements Usage example Below is an example us e of the equ directive.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 173 9.4.15 global Syntax label operatio n operand [name] global name(, name).
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 174 Writing Directive Statements Usage example Below is an example use of the global directive. 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 Writing Directive Statements 175 9.4.16 tit Syntax label operatio n operand tit ["string"] Functional description This directive specifies that the stri ng coded as its op erand is to be outp ut as the header of the list file.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 176 Writing Directive Statements 9.4.17 xlistoff, xliston Syntax label operation operand [name] xlistoff . . . xliston Functional description The xlistoff and xliston directives are used in pairs.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 177 9.4.18 funcinfo Syntax label operatio n operand function_namefuncinfo label_name, expression, .
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 178 Writing Directive Statements Usage Example The following gives an example of funcinfo usage. NOTE: The ret and retf instructions free the stack frame and restore registers fr om the stack.
Chapter 9 Writing Machine Language Instructions and Directive Statements Writing Directive Statements 179 9.4.19 assign Syntax label operatio n operand name assign expression Functional description This directive defines the name to be the value of the exp ression coded in the operand.
Chapter 9 Writing Machine Language Instructions and Directive Statemen ts 180 Writing Directive Statements.
10 Chapter 10 Writi ng Assembler Control S tatement s.
Chapter 10 Writing Assembler Control Statements 182 Purpose of This Chapter 10.1 Purpose of This Chapter Assembler control statements are st atements that control assembler processing. They specify include files and refinement of the identifier and control conditional assembly.
Chapter 10 Writing Assembler Control State ments File Inclusion 183 10.2 File Inclusion The file inclusion is an assembler control instruct ion that reads the specific file to the source file.
Chapter 10 Writing Assembler Control Statements 184 File Inclusion 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.
Chapter 10 Writing Assembler Control State ments File Inclusion 185 Usage example The following example illustrate s the use of an include file. The file inc.h consists of the following statement. The file to be assembled cons is ts of the following statements.
Chapter 10 Writing Assembler Control Statements 186 Identifier Definement 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.
Chapter 10 Writing Assembler Control State ments Identifier Definement 187 10.3.1 #define Syntax #define [replacement_st ring] [; comment] Functional description This directive causes the assembler to replace the iden tifier with the replacemen t_string on all further lines.
Chapter 10 Writing Assembler Control Statements 188 Identifier Definement 10.3.2 #undef Syntax #undef identifier Functional description This directive deletes an ident ifier defined by a #define directive. The effective ra nge of an identifier is from the line following #defin e until the line before #undef.
Chapter 10 Writing Assembler Control State ments Conditional Assembly 189 10.4 Conditional Assembly The cross assembler provides conditional assembly capabiliti es.
Chapter 10 Writing Assembler Control Statements 190 Conditional Assembly The table below lists the conditional assembly directiv es. NOTE: These directives can be us ed only within macr o definitions Directive Condition for selec ting bl ock1 Condition for selecting block2 #ifdef Identifier has been defined by #defin e.
Chapter 10 Writing Assembler Control State ments Conditional Assembly 191 10.4.1 #ifdef, #ifndef Syntax Syntax for #ifdef Syntax for #ifndef #ifdef identifier #ifndef identifier block1 block1 [#else [.
Chapter 10 Writing Assembler Control Statements 192 Conditional Assembly Usage example A source file that uses #ifdef and #ifnd ef is sh own below. The assembled list file is shown below. The identifier VERSION is defined in line number 1 . The replacement string is a null character.
Chapter 10 Writing Assembler Control State ments Conditional Assembly 193 10.4.2 #if, #ifn Syntax Syntax for #if Syntax for #ifn #if expression #ifn expression block1 block1 [#else [#else block2] block2] #endif #endif Functional description #if If the value of expression is not 0, block1 will be assembled.
Chapter 10 Writing Assembler Control Statements 194 Conditional Assembly Usage example A source file that uses #if and #ifn is shown below. The assembled list file is shown below.
Chapter 10 Writing Assembler Control State ments Conditional Assembly 195 10.4.3 #ifeq, #ifneq Syntax Syntax for #ifeq Syntax for #ifneq #ifeq parameter1, parameter2 #ifneq param eter1, parameter2 blo.
Chapter 10 Writing Assembler Control Statements 196 Conditional Assembly Usage example A source file that uses #ifeq and #ifneq is s how n below. The macro named compare uses two dummy parameters(data1,data2). Within the macro it compares the strings of those dummy param eters.
Chapter 10 Writing Assembler Control State ments Conditional Assembly 197 The assembled list file is shown belo w. Line numb er 11 assembles the statements for a match, and line number 12 assembles the statements for a mismatch.
Chapter 10 Writing Assembler Control Statements 198 Conditional Assembly 10.4.4 #iflt, #ifle Syntax Syntax for #if lt Syntax for #ifle #iflt expressi on #ifle expression block1 block1 [#else [#else block2] block2] #endif #endif Functional description #iflt If the value of expression is negative, block1 will be assembled.
Chapter 10 Writing Assembler Control State ments Conditional Assembly 199 The assembled list file is shown below. iflt.lst Page 1 *** PanaX Series MN1030 Cross Assembler *** Loc Object Line Source 1 M.
Chapter 10 Writing Assembler Control Statements 200 Conditional Assembly 10.4.5 #ifgt, #ifge Syntax Syntax for #ifgt Syntax fo r #ifge #ifgt expression #ifge expression block1 block1 [#else [#else block2] block2] #endif #endif Coding rules #ifgt If the value of expression is positive, block1 will be assembled .
Chapter 10 Writing Assembler Control State ments Conditional Assembly 201 The assembled list file is shown below. You can see that the expression's value is 0, so block 2 was assembled.
Chapter 10 Writing Assembler Control Statements 202 Conditional Assembly 10.4.6 #ifb, #ifnb Syntax Syntax for #ifb Syntax for #ifn b #ifb dummy_parameter #ifnb dum my_parameter block1 block1 [#else [#else block2] block2] #endif #endif Functional description #ifb If the dummy_parameter is a null character, block1 wi ll be assembled.
Chapter 10 Writing Assembler Control State ments Conditional Assembly 203 Usage example A source file that uses #i fb 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.
Chapter 10 Writing Assembler Control Statements 204 Conditional Assembly The assembled list file is shown below. Where the characters debug_on have been specified, bl ock 2 is assembled. Where the null character has been specified, block 1 is assembled.
11 Chapter 1 1 Writing Macro Control S t atements.
Chapter 11 Writing Macro Control Statements 206 Purpose of This Chapter 11.1 Purpose of This Chapter Macros consist of two part s: macro definition s and macro calls. A macro that has been defined can b e coded as a macro call in any source statement after that.
Chapter 11 Writing Macro Control State ments Macro Definitions (macro, endm) 207 11.2 Macro Definitions (macro, endm) Syntax macro_name macro [dummy_parameter (, dummy_parameter).
Chapter 11 Writing Macro Control Statements 208 Macro Definitions (macro, endm) Coding rules The following instructions cannot be used withi n macro defi nit ions.
Chapter 11 Writing Macro Control State ments Macro Calls and Expansion 209 11.3 Macro Calls and Expansion Syntax macro_name [param eter (, parameter)... ] NOTE: Up to10 dummy parameters ca n be specified. Functional description A macro is called by coding its name in the operation fi eld of a sour ce statement.
Chapter 11 Writing Macro Control Statements 210 Macro Calls and Expansion Usage example A source fil e is shown below. The macro add _adr has one dummy pa rameter. T he dummy parameter is used as the operand of an add machine language in struction within the macro body.
Chapter 11 Writing Macro Control State ments Macro Operators 211 11.4 Macro Operators Macro operators are used in macro bodies to operate on parameters of macro calls. Macro operators are listed below. Usage example The following example uses the operators , <>, an d &.
Chapter 11 Writing Macro Control Statements 212 Macro Operators The assembled list file is shown below. macexp.lst Page 1 *** Panax Series MN1030 Cross Assembler *** Loc Object Line Source M1 mac1 mac.
Chapter 11 Writing Macro Control State ments Local Symbol Declaration (local) 213 11.5 Local Symbol Declaration (local) Syntax macro_name macro parameter local symbol (, symbol)... symbol . . . endm NOTE: Up to 30 symbols can be specified. Functional description The local directive declar es local symbols used in a macro bo dy.
Chapter 11 Writing Macro Control Statements 214 Local Symbol Declaration (local) Usage example An example using the local directive is shown below. The assembled list file is shown next. You can see that each time th e local s ymbol is expanded, it is changed to ??00001, ??00002, .
Chapter 11 Writing Macro Control State ments Forced Termination of Macro Expan sion (exitm) 215 11.6 Forced Termination of Macro Expansion (exitm) Syntax macro_name macro parameter #ifndef identifier exitm #endif . . . endm Functional description The exitm directive forcibly termin ates macro expan sion at the po int it appears.
Chapter 11 Writing Macro Control Statements 216 Forced Termination of Macro Expansion (exitm) The list file is shown below. The second macro call has been expanded after #endif. global debug ; extml macro mov 1, D0 #ifndef TEST exitm #endif jsr debug endm ; _TEXT section CODE, PUBLIC, 1 extm1 #define TEST extm1 exitm.
Chapter 11 Writing Macro Control State ments Purging Macro Definitions (purge) 217 11.7 Purging Macro Definitions (purge) Syntax purge macro_name (, m acro_name)... Functional description The purge directive purges the defini tions of the specified macro names.
Chapter 11 Writing Macro Control Statements 218 rept 11.8 rept Syntax rept expression block endm Functional description The rept directive repeat ed ly exp a n ds the spe cified block the spe cified number of times . It is used for simple repeating wit hout parameters.
Chapter 11 Writing Macro Control State ments rept 219 The assembled list file is shown below. rept.lst Page 1 *** Panax Series MN1030 Cross Assemb ler *** Loc Object Line Source M1 repeat macro p1 2 r.
Chapter 11 Writing Macro Control Statements 220 irp 11.9 irp Syntax irp dummy_parameter, parameter (, parameter) ... block endm NOTE: Up to10 dummy paramet ers can be specified. Functional description The irp directive repeatedly expands the specified block the specif ied number of times.
Chapter 11 Writing Macro Control State ments irp 221 The assembled list file is shown below. irp.lst Page 1 *** Panax Series MN1030 Cross Assem bler *** Loc Object Line Source M1 init macro p1 2 irp o.
Chapter 11 Writing Macro Control Statements 222 irpc 11.10 irpc Syntax irpc dummy_parameter, "string" block endm Functional description The irpc description repeatedly replaces the dummy parameter with each character in the specified string one at a time.
Chapter 11 Writing Macro Control State ments irpc 223 The assembled list file is shown below. irpc.lst Page 1 *** Panax Series MN1030 Cross Assemb ler *** Loc Object Line Source 1 _DATA section DATA, .
Chapter 11 Writing Macro Control Statements 224 irpc.
12 Chapter 12 List of Mach ine Language Instructions.
Chapter 12 List of Machine Language Instructions 226 Purpose of This Chapter 12.1 Purpose of This Chapter The chapter lists machin e lan guage instructions of thi s series microcomputers.
Chapter 12 List of Machine Language Instructions Addressing Modes 227 12.2 Addressing Modes This series of the microcomputers supports four addressing modes for memory accesses.
Chapter 12 List of Machine Language Instructions 228 Addressing Modes Register relative indirect addressing Register relative indirect addr essing determines the address to access using the following three combinations.
Chapter 12 List of Machine Language Instructions Addressing Modes 229 3. The program counter, PC, plus a sign-extended 8-bit or 16-bit displacement or a 32-bit displace- ment. 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 230 Addressing Modes Index addressing Index addressing adds t he contents of an address register, An, and a data register, Dn, to yield a displacement.
Chapter 12 List of Machine Language Instructions List of Machine Language Instructions 231 12.3 List of Machine Language Instructions Symbol Description An, Am Address register (n, m=3 to 0) Dn, Dm Da.
Chapter 12 List of Machine Language Instructions 232 List of Machine Language Instructions 12.3.1 Data Move Instructions MOVE source to destination Mnemonic Description of operation Register Direct MOV Dm, Dn T ransfers the co ntents of Dm to Dn. MOV Dm, An T ransfers the co ntents of Dm to An.
Chapter 12 List of Machine Language Instructions List of Machine Language Instructions 233 Register Relative Indirect MOV (d, Am), An T ransfers the contents of the memo ry location specified by Am and displacemen t d to An . 8- and 16-bit displacemen ts are sign-extended.
Chapter 12 List of Machine Language Instructions 234 List of Machine Language Instructions Register Relative Indirect MOVHU (d, Am), Dn T ransfers, with zero-extension, th e 16-bit contents of the memory location specified by Am an d displacement d to Dn.
Chapter 12 List of Machine Language Instructions List of Machine Language Instructions 235 Absolute MOV (abs32), Dn T ransfer the 32-bit contents of th e memory location specified by abs32 to Dn. MOV (abs16), An T ransfer the 32-bit contents of th e memory location specified by abs16 to An.
Chapter 12 List of Machine Language Instructions 236 List of Machine Language Instructions EXTEND Sign MOVM CLR Mnemonic Description of o peration EXT Dn Extend Dn to 64 bits and store the highest 32 bits in MDR. EXTB Dn Sign-extend the lowest 8 bit s of Dn to fill Dn.
Chapter 12 List of Machine Language Instructions List of Machine Language Instructions 237 12.3.2 Arithmetic Instructions ADD ADD with CARRY SUBTRACT SUBTRACT with BORROW Mnemonic Description of operation ADD Dm, Dn Add the contents of Dm and Dn and store the result in Dn.
Chapter 12 List of Machine Language Instructions 238 List of Machine Language Instructions MULTIPLY DIVIDE INC COMPARE source with destination Mnemonic Description of operation MUL Dm, Dn Multiplies t.
Chapter 12 List of Machine Language Instructions List of Machine Language Instructions 239 12.3.3 Logical Instructions AND source wi th destination OR source with destination EXCLUSIVE-OR sour ce with destination NOT destination Mnemonic Description of operation AND Dm, Dn AND Dm with Dn an d store th e result in Dn.
Chapter 12 List of Machine Language Instructions 240 List of Machine Language Instructions ARITHMETIC SHIFT RIGHT LOGICAL SHIFT RIGHT ARITHMETIC SHIFT LEFT ROTATE RIGHT ROTATE LEFT Mnemonic Description of operat ion ASR Dm, Dn Ari thm etical ly shift the contents of Dn right the number of bits specified in Dm and store the result in Dn.
Chapter 12 List of Machine Language Instructions List of Machine Language Instructions 241 12.3.4 Bit Manipulation Instructions Bit operations Mnemonic Description of oper ation BTST imm, Dn AND the zero-extended imm8, zero-extended imm1 6, or imm32 with the contents of Dn and set the flags according to the result.
Chapter 12 List of Machine Language Instructions 242 List of Machine Language Instructions BCLR imm8,(abs32) This instruction p roceeds through the following three stag es: 1.T ransfer , with zero- extension, the 8-bit content s of the memory location specified with abs32 to a 32-bit intern al temporary regi ster .
Chapter 12 List of Machine Language Instructions List of Machine Language Instructions 243 12.3.5 Branching Instructions CALL Subroutine Mnemonic Description of operation CALL label label is either (d16,PC) or (d3 2,PC).
Chapter 12 List of Machine Language Instructions 244 List of Machine Language Instructions Unconditional BRANCH Mnemonic Description of oper ation JMP (An) S tore the contents of An in the program counter . JMP lab el If label is (d16,PC), the 16-bit displacement is sign-extended and added to the program counter .
Chapter 12 List of Machine Language Instructions List of Machine Language Instructions 245 Conditional BRANCH Mnemonic Meaning Description of operation BEQ label = ZF=1 If ZF = 1, execute a relative branch to the address specified by label. (Range: -128 to 127) If ZF = 0, execute next i nstruction.
Chapter 12 List of Machine Language Instructions 246 List of Machine Language Instructions Conditional BRANCH for LOOP Mnemonic Meaning Descr iption of operation LEQ = ZF=1 If ZF = 1, branch to the top of the loop as specifi ed with SETLB. If ZF = 0, execute next instruction.
Chapter 12 List of Machine Language Instructions List of Machine Language Instructions 247 12.3.6 User-Defined Instructions User Defined FUNCTION Mnemonic Description of operation UDFnn Dm, Dn If nn is between 00 and 15, com pute with the contents of D m and Dn and store the result in Dn.
Chapter 12 List of Machine Language Instructions 248 List of Machine Language Instructions 12.3.7 Other Instructions NO OPERATION Mnemonic Description of operation NOP Do nothing.
13 Chapter 13 Error Messages.
Chapter 13 Error Messages 250 Purpose of This Chapter 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.
Chapter 13 Error Messages Assembler Errors 251 13.2 Assembler Errors The assembler displays three types of messages: wa rning messages, error mess ages, and fatal error mes- sages.
Chapter 13 Error Messages 252 Assembler Errors 13.2.1 Warning Messages 2001 Operand error An operand is of the wrong type. Check the number and types of operand s, 2002 Illegal operand value An operand does not have an acceptable value. Change the value of the operand.
Chapter 13 Error Messages Assembler Errors 253 2011 Not guaranteed operand by the instruction allocation. The usage of a series of instructions may be rest ricted in the microcomput er. Careful operation is needed as some operatio ns are not guaranteed.
Chapter 13 Error Messages 254 Assembler Errors 13.2.2 Error Messages 2301 Syntax error. The current line cont ains a syntax error. Consult this Manual and the MN1030/MN103 S Series Instruct ion Manual. 2302 Illegal character. A string contains an illegal character.
Chapter 13 Error Messages Assembler Errors 255 2314 Illegal section name. There is an error in a sect ion nam e . 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.
Chapter 13 Error Messages 256 Assembler Errors 2328 Too many arguments. A macro invocation has too many arg um e nts. Check the macro definition. 2329 Can’t find FUNCINFO directive. There is a ret or retf machin e instruction before the corr esponding funcinfo directive.
Chapter 13 Error Messages Assembler Errors 257 13.2.3 Fatal Error Messages 2501 Illegal option (string). There is an unreco gnized 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.
Chapter 13 Error Messages 258 Linker Errors 13.3 Linker Errors The linker displays three types of messages : warni ng messages, error messages, and fatal error mes sag- es.
Chapter 13 Error Messages Linker Errors 259 13.3.1 Warning Messages 3000 filename: Section not found. This file ignored. The input file does not contain sect ion information. Check the contents of the specified input file. 3001 filename: Illegal section[name] attribute or align value.
Chapter 13 Error Messages 260 Linker Errors 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 parame ter for the specified option.
Chapter 13 Error Messages Linker Errors 261 3313 Extra symbol[name] used as normal symbol. The extra symbol, which is reserved for instru ction RAM use, is used in a context other than a - PUT option. Modify the program t o use a diff erent symbol in that context.
Chapter 13 Error Messages 262 Linker Errors 13.3.3 Fatal Error Messages 3500 No memory space. There is insufficient m emory. Make sure that there is suffic ient memory capacity available 3501 fileneme: Cannot open file. The specified input file does not exist.
Chapter 13 Error Messages Linker Errors 263 3512 filename: Illegal relocation information.(line lineno) The relocation information in the specified inp ut fi le is inval id. 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.
Chapter 13 Error Messages 264 Linker Errors.
14 Chapter 14 Readinig List Files.
Chapter 14 Reading List Files 266 Purpose of This Chapter 14.1 Purpose of This Chapter This chapter explains how to read th e list files output during assembly.
Chapter 14 Reading List Files Reading List Files 267 14.2 Reading List Files Adding the l (letter) option, when the assembler is invoked, will generate the list file in the curren t directory. List file contents ar e entirely in text form at, so those can be vi ewed by using an editor.
Chapter 14 Reading List Files 268 Reading List Files 14.2.1 Output Format of Machine Language Code The output format of the machine language code section is shown below. Each of these fields is descri bed below. Location (Loc) The location field shows the location counter values during assembly.
Chapter 14 Reading List Files Reading List Files 269 Supplemental information A line number can provide additi onal informatio n in the form of preceding pe riods and the suffixes X or +. “.” Line numbers preceding by a period indicate that the li ne was included by an include directive.
Chapter 14 Reading List Files 270 Reading List Files Source statement (Source) The source statements of the s ource file are output as is. If the Lm optio n is added when t he assembler is invoked, output of source statemen ts resulting from macro expansio n wi ll be suppressed.
Chapter 14 Reading List Files Reading List Files 271 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 symb ol table to th e lis t file after the machine language code section.
Chapter 14 Reading List Files 272 Reading List Files Symbol Name Symbol names are shown up to 255 characters. An output example of a symbol table is sh own bel ow.
15 Chapter 15 Using Library Manager.
Chapter 15 Using Library Manager 274 Purpose of This Chapter 15.1 Purpose of This Chapter A library file is a collection of relocatable object files which you can pull out as needed.
Chapter 15 Using Library Manager Starting Library Manager 275 15.2 Starting Library Manager The library manager is started by entering a comman d name and parameters, just as for other MS-DOS external commands. General format of commands Below is the general format of the comman d to use when starting th e library manager.
Chapter 15 Using Library Manager 276 Command Options 15.3 Command Options This section describes t he options using the following categories. 15.3.1 Error Message Options Functional description This option causes an error and warning mes sages and help screens sent to the console to appear in Japanese.
Chapter 15 Using Library Manager Command Options 277 Functional description This option causes all error and warning messages and he lp screens sent to the console to appear in Jap- anese using EUC coding. Rules of use To specify the option, enter the h yphen (-) followed by the upper case letter “J” and the lower case letter “e”.
Chapter 15 Using Library Manager 278 Command Options Functional description This option causes all error and warning mess ages and help screens sent to th e console to appear in Japanese using Shift JIS coding. Rules of use To specify the optio n, enter the h yphen(-) followed by t he upper case le tter ’J’ and the lower case letter ’s’.
Chapter 15 Using Library Manager Command Options 279 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 h yphen (-) followed by the upper case letter “J” and the lower case letter “j”.
Chapter 15 Using Library Manager 280 Command Options Functional description This option causes all error and warning mess ages and help screens sent to th e console to appear in English. Rules of use To specify the option, enter the hyphe n (-) followed by the lower case letter”e”.
Chapter 15 Using Library Manager Command Options 281 Functional description This option suppresses outp ut of warning messages ge nerated during lib rary m ana ger op er atio n. Fo r a list of warning messages and nu mbers, see Chapter 15 “Using the Library Manager” Section 15.
Chapter 15 Using Library Manager 282 Command Options 15.3.2 Program Generation Options Functional description If a file with same name of the specified library fi le already exists, the library m anager will inquire if the file should be modified. Based on the response, the library m anager with determine whether or not to create the library file.
Chapter 15 Using Library Manager Command Options 283 Functional description This option forces creation of the libra ry file. If a file with the same name as the specified library file already exist, the library manager will overwri te it. Rules of use To specify the option, enter the hyphen (- ) followed by the lower case letter “r”.
Chapter 15 Using Library Manager 284 Command Options 15.3.3 Functional Options Functional description This option is used to add relocatable object files to the li brary file. Rules of use To specify the option, enter the hyphen (-) followed by the lower case letter “a”.
Chapter 15 Using Library Manager Command Options 285 Functional description This option is used to delete relocatable ob ject fi les from the library file. If a specified file does not exist in the library fi le, the library manager will ou tpu t a warning message and continue processing.
Chapter 15 Using Library Manager 286 Command Options Functional description This option is used when you want kno w the externall y defi ned symbol names that exist in the library file.
Chapter 15 Using Library Manager Command Options 287 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 ou tpu t a message add the relocatable object file.
Chapter 15 Using Library Manager 288 Command Options Functional description This option is used when you want to kn ow the nam e s of the relocatable object files that exist in the library file.
Chapter 15 Using Library Manager Command Options 289 Functional description This option is used when you want to extract relo catable object files that ex ist in the library file.
Chapter 15 Using Library Manager 290 Command Options 15.3.4 Other Options Functional description The options you will use with slib103 can be wri tten to a file, so instead of specifying all those option s for execution, you can specify just that file name.
Chapter 15 Using Library Manager Command Options 291 Functional description This option displays the library manager’s vers ion numb er, comm and li ne 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 .
Chapter 15 Using Library Manager 292 Error Messages 15.4 Error Messages The library manager displays three types of m ess ages: warning message, error messages, and fatal error messages.
Chapter 15 Using Library Manager Error Messages 293 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 inform ation.(filename) There is no public symbol information fo r the file filename.
Chapter 15 Using Library Manager 294 Error Messages 15.4.2 Error Messages 4301 Multiply specified object file name.(filename) Either the same object file is specified twice on th e command line or an obj ect file with the same name is in the librar y.
Chapter 15 Using Library Manager Error Messages 295 4313 Parameter-file already specified. (fi lename) The same parameter file is specified more than once. Eliminate the duplic ate specifications. 4314 Cannot read parameter-file. (filename ) The library manager cannot read the parameter file--because it co ntains illegal characters, for example.
Chapter 15 Using Library Manager 296 Error Messages 15.4.3 Fatal Error Messages 4501 Illegal option. (string) The library manager does not support the specified opt ion.
16 Chapter 16 Notes on Operating Environment.
Chapter 16 Notes on the Operating Envir onment 298 Purpose of This Chapter 16.1 Purpose of This Chapter This chapter contains descriptions left out of other chapters.
Chapter 16 Notes on the Operating Environment Personal Computer Versions 299 16.2 Personal Computer Versions This sectio n contains not es on usin g the personal computer versions of the software in this package.
Chapter 16 Notes on the Operating Envir onment 300 Personal Computer Versions 16.2.1 Operating Environment This system runs on the following personal comput ers and com pati bles.
Chapter 16 Notes on the Operating Environment Personal Computer Versions 301 16.2.2 Files The installation medi a for this syst em contains the following files. AS103.EXE (Assembler) AS103.EXE is the assembler. For a descriptio n, see the chapter 5 “Using the Assembler.
Chapter 16 Notes on the Operating Envir onment 302 Personal Computer Versions 16.2.3 Installation For the installation media, installation procedures, and notes on in st allat ion, see the MN1030 Series Installation Manual.
Chapter 16 Notes on the Operating Environment Personal Computer Versions 303 16.2.4 Environment Settings Before using this series Cross-Assembl e r, verif y or change the following two files. CONFIG.SIS If FILES and BUFFER specifications do not already exi st in CONF IG .
Chapter 16 Notes on the Operating Envir onment 304 Personal Computer Versions NOTE: Once you have edited AUTOEXEC.BAT, reset the co mputer and restart. The new setting will then auto matically take effect. Terminology: AUTOEXEC.BAT AUTOEXEC.BAT is a batch file that MS-DOS automatically runs wh en it loads.
Chapter 16 Notes on the Operating Environment Personal Computer Versions 305 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.
Chapter 16 Notes on the Operating Envir onment 306 Personal Computer Versions 16.2.6 Error Correction Using Tag Jumps This section describes a convenient way to fix erro rs. When code mistakes, syntax errors, or other errors and warnings occur in a source file, further development cannot proceed unless they are fixed.
Chapter 16 Notes on the Operating Environment Personal Computer Versions 307 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.
Chapter 16 Notes on the Operating Envir onment 308 Personal Computer Versions 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.
17 Chapter 17 Appendix.
Chapter 17 Appendix 310 Numeric Restrictions 17.1 Numeric Restrictions This section shows the numeric restriction s on this se ries cross-assembler. Be sure not to exceed these values when writing programs.
Chapter 17 Appendix List of Command Options 311 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 312 List of Command Options 17.2.1 List of Assembler Command Options Assembler command general format Below is the general format of the co mmand to use when starting the assembler. as103 [options] source_filename Contents of brackets [ ] may be omitted.
Chapter 17 Appendix List of Command Options 313 Error message options Preprocessor options Program generation options j Output error and warning messages in Japanese as103 -j sample.asm Je Output error and warning messages in Japanese using EUC encoding.
Chapter 17 Appendix 314 List of Command Options Others h Display a listing of available assembl er options on th e console. as103 -h v Display the assembler’s version number on the console.
Chapter 17 Appendix List of Command Options 315 17.2.2 List of Linker Command Options Linker command general format Below is the general format of the co mmand to use when starting the linker. ld103 [options] (filename)... Contents of brackets [ ] may be omitted.
Chapter 17 Appendix 316 List of Command Options Program generation options Library file options Instruction RAM options g Output debug informati on to the executabl e format file. ld103 -g main.rf sub.rf T section-address Specify a section start address.
Chapter 17 Appendix List of Command Options 317 Others @ Specify a parameter file. ld103 @ pfile h Display help inform ation on the console. ld103 -h v Display the linker’s version number on the consol e.
Chapter 17 Appendix 318 List of Assembler Directives 17.3 List of Assembler Directives This section provides a list of assembler directives. Directives for program control Directives for symbols Synta.
Chapter 17 Appendix List of Assembler Directives 319 Directives for dat a area allocation Directives for list control Syntax Function & Notes symbol instruction operan d dc definition | expressi on(,definition | expression)... Allocates 8-bit data areas.
Chapter 17 Appendix 320 List of Assembler Directives Other directives Syntax Function & Notes symbol instruction operand notation format Selects the codin g format of numbers, format (CLANG | INTE.
Chapter 17 Appendix List of Assembler Control Statements 321 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 s ource file specified by file_name.
Chapter 17 Appendix 322 List of Assembler Control Statements #iflt expression block1 Assembles block1 if the expression is negativ e. Assembles block2 if it is not negative (nothi ng wil l be assembled if there is no #else). [#else #endif block2] #ifle expression block1 Assembles block1 if the expressio n is zero or negative.
< Index 1 > Index Symbols #define ............ ............... ................ ................. ..... 187 #else ........... .............. ................. .............. .............191 #endif .............. ............... ................
< 2 Index > J j ............. .............. ................. .............. ............ 91, 111 L l library_filename ........................... ................. .... 103 L path_name .................. ................. ................. ...
< Index 3 > U Unary minus ................... ................ ................. ..... 138 Unary negation .................... ................. ................139 Unary plus ................... ................. .............. ..........138 Unconditional Branch Inst ruct ions .
< 4 Index >.
Issued by Matsushita Electric Indust ri al C o., Ltd. Matsushit a Electric Industrial Co., Ltd . MN1030 Series Cross Assembler User’s Manual June, 2004 12th Edition.
SALES OFFICES NORTH AMERICA ˜ U.S.A. Sales Office: Panasonic Industrial Company [PIC] — New Jersey Office: 2 Panasonic W ay 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.
An important point after buying a device Panasonic MN1030 (or even before the purchase) is to read its user manual. We should do this for several simple reasons:
If you have not bought Panasonic MN1030 yet, this is a good time to familiarize yourself with the basic data on the product. First of all view first pages of the manual, you can find above. You should find there the most important technical data Panasonic MN1030 - thus you can check whether the hardware meets your expectations. When delving into next pages of the user manual, Panasonic MN1030 you will learn all the available features of the product, as well as information on its operation. The information that you get Panasonic MN1030 will certainly help you make a decision on the purchase.
If you already are a holder of Panasonic MN1030, but have not read the manual yet, you should do it for the reasons described above. You will learn then if you properly used the available features, and whether you have not made any mistakes, which can shorten the lifetime Panasonic MN1030.
However, one of the most important roles played by the user manual is to help in solving problems with Panasonic MN1030. Almost always you will find there Troubleshooting, which are the most frequently occurring failures and malfunctions of the device Panasonic MN1030 along with tips on how to solve them. Even if you fail to solve the problem, the manual will show you a further procedure – contact to the customer service center or the nearest service center