Home
MN1030 Series Cross Assembler User`s Manual
Contents
1. Mnemonic Description of operation MOV Dm Dn Transfers the contents of Dm to Dn MOV Dm An Transfers the contents of Dm to An MOV Am Dn Transfers the contents of Am to Dn MOV Am An Transfers the contents of Am to An Register MOV SP An Transfers the contents of SP to An Direct MOV Am SP Transfers the contents of Am to SP MOV PSW Dn Transfers the contents of PSW to Dn MOV Dm PSW Transfers the contents of Dm to PSW MOV MDR Dn Transfers the contents of MDR to Dn MOV Dm MDR Transfers the contents of Dm to MDR MOV imm Dn Transfers the sign extended imm8 sign extended imm16 imm32 to Immediate Dn Value Transfers the zero extended zero extended imm16 imm32 to MOV imm An A MOV Am Dn Transfers the contents of the memory location specified by Am to Dn MOV Am An Transfers the contents of the memory location specified by Am to An MOV Transfers the contents of Dm to the memory location specified by An MOV Am An Transfers the contents of Am to the memory location specified by An MOVBU Am Dn Transfers with Zero extension the 8 bit contents of the memory location specified by Am to Dn MOVBU Dm An the lowest 8 bits of Dm to the memory location specified by Transfers with sign extension the 8 bit contents of the memory Register MOVLA TKDN location specified by Am to Dn Indirect MOVB Dm the lowest
2. UR tie RO REDE ERES IRE evs 258 13 3 1 Warning Messages oet ae eterne Eee te p er petiti tet oes 259 13 3 2 Error Messages ioco A io E EID E Ns 260 13 3 3 Fatal Error Messages cere b PH Gre Rr ede pU rie 262 Chapter 14 Readinig List Files 14 1 Purpose of This Chapter Oel nee bremen IO 266 14 2 Reading List Elles ge nee Fe RE Or udev Meson deii Uer 267 14 2 1 Output Format of Machine Language Code sess 268 14 2 2 Symbol Table 3e e Pede ete AA ANAS 271 Chapter 15 Using Library Manager 15 1 PurposeOL This Chapter ses RAS Ie accelerate remit 274 15 2 Starting Library Manager eren 275 15 3 Command OptlOhs s e het e td eie e a av guns tee e e D 276 15 3 1 Error Message Options asian ihe anna ie ne eae 276 15 3 2 Program Generation Options eere ie RE ede eO IRE 282 15 3 3 Functional A E E E 284 15 3 4 Other OptOnS s nie tee eei tier one Hp eee rd pete edes 290 15 4 Error Messages donee Se eR dte 292 19 41 Warning MeSSages oes eR Irt 293 15 4 2 Error Rh etian aie 294 15 453 Fatal Error 5 oi tee et eo
3. Mnemonic Description of operation Arithmetically shift the contents of Dn left the number of bits specified in Dm ASL Dm Dn and store the result in Dn Zeros enter from the least significant bit Arithmetically shift the contents of Dn left the number of bits specified by ASL imm8 Dn imm6 and store the result in Dn Zeros enter from the least significant bit Arithmetically shift the contents of Dn left two bits and store the result in Dn ASL2 Dn nune Zeros enter from the least significant bit ROTATE RIGHT Mnemonic Description of operation ROR Dn Rotate the contents of Dn plus the C flag right one bit and store the result in Dn ROTATE LEFT Mnemonic Description of operation ROL Dn Rotate the contents of Dn plus the C flag left one bit and store the result in Dn 240 List of Machine Language Instructions Chapter 12 List of Machine Language Instructions 12 3 4 Bit Manipulation Instructions Bit operations Mnemonic Description of operation AND the zero extended imm8 zero extended imm16 imm32 with the contents Brotini pn of Dn and set the flags according to the result AND the zero extended imm8 with the zero extended 8 bit contents of the memory BTS taming dgan location specified by 48 and An and set the flags according to the result AND the zero extended imm8 with the zero extended 8 bit content
4. Output error and warning messages in Japanese J ld103 3 main rf sub rf Output error and warning messages in Japanese using EUC encoding Je 1d103 Je main rf sub rf Output error and warning messages in Japanese using Shift JIS encoding Js 1d103 Js main rf sub rf Output error and warning messages in Japanese using JIS encoding Jj ld103 Jj main rf sub rf Output error and warning messages in English e 1d103 e main rf sub rf Do not output warning messages of the specified number W number 1d103 W 3001 main rf sub rf Do not output any warning messages Wall 1d103 Wall main rf sub rf List of Command Options 315 Chapter 17 Appendix Program generation options Output debug information to the executable format file 1d103 main rf sub rf T section address 1d103 Specify a section start address T_TEXT CODE 80000000 T DATA 0 main rf sub rf Output an 1d103 executable format file even if errors are detected Yr main rt En 10103 Do not output symbol table within the executable format file En main rf sub rf Ed 10103 Enable output of DATA sections to the executable file Ed main rf sub rf Library file options l library_filename Specify a library file 1d103 1 usr local lib sample lib main rf sub rf L path_name 1d103 sub rf Specify a pat
5. definition file include macro h macro definition file define VERSION conditional assembly definition Program Start main 124 Comment Statements 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 Blank Statements 125 Chapter 7 Type of Source Statements 126 Blank Statements Chapter 8 Writing Source Statements 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 128 Purpose of This Chapter 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 17 8 MR lt gt 4 Permitted Characters 129 Chapter 8 Writing Source
6. 98 TYPE ES 267 U Unary MINUS csiis eee 138 Unary negation seen 139 Unaty plus ueteres 138 Unconditional Branch Instructions 46 INI D EMEN 142 Undefined i uus nivel eR 142 undefined sse 173 W W nuniD6et 96 Walle utet udine e to d te doe 96 Warning Messages esee 313 X 289 MS COMB eian ere 176 e 176 lt Index 3 gt 4 Index gt 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 U S A Sales Office Panasonic Industrial Company 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 A PIC Tel 1 408 487 9510 e Atlanta Office 1225 Northbrook Parkway Suite 1 151 Suwanee Georgia 30024 U S A Fax 1 408 436 8037 Tel 1 770 338 6953 San Diego Office 9444 Balboa Avenue Suite 185 San Diego California 92123 U S A Fax 1 770 338 6849 Tel 1 858 503 2910 Canada Sales Office P
7. 222 lt Index 1 gt ettet equa ung 91 111 L llibrary filename eene 103 L paths Mame 5 oni Ete me 104 Label Field noit iain 148 L DIOS EXE 300 LDIO3 eine 302 Library File Options 20 103 Library Manager esee 275 Line nde eere pee 268 Line number 4 0 eoo 268 Linker options 87 ae 159 liston ese 159 IURE 268 local 213 Local Symbol Declaration 213 Location Counter 2 136 Logical AND dieere 139 Logical left shift nnne eom 138 Logical operators 2 2 139 Logical usen eee 139 logical right shift sess 138 M Inest 90 Machine language code 268 Machine language code supplemental information 268 Machine language instruction statements 121 207 Macro Calls 0 641 209 Macro Control Statements 123 Macro Operators esses 211 MACTO body asc nts 207 MACTO NAME 207 209 Matsushita 132 2
8. DERE RUD EH PERDER GEO RHENO RPG OR EUHERR 218 IMMER es 220 11 10 Arp ien e Rete oe RU e FO ED ER OE POR 222 Chapter 12 List of Machine Language Instructions 12 1 Purpos ot IhisCbapter ee resto RERO eee eget 226 12 2 Addressing Modes een e IRE ERO E IU DER e Te Mb aaa UR 227 12 3 List of Machine Language Instructions eseseeeeeeeeeeeeenee nennen nennen nennen 231 3 TOC gt 12 3 1 Data Move 232 12 3 2 Arithmetic Instructions teg ee Re ee eb Pee eae Pes 237 12 3 3 Logical Instructions eee teret eerte ipe e Up e Re bete ie 239 12 3 4 Bit Manipulation Instructions esee eerte nennen nennen 241 12 3 5 Branching Instructions e te iip rt rete ario rper ee 243 1233 6 User Defined Instructions cs onte ttt etre cobs tee ngon XR Ee etae eve i 247 12 3 T Other Instructions evita uadb oop POLT Pr 248 Chapter 13 Error Messages 13 1 Purpose of This Chapter eere tei 250 13 2 Assembler uie SEP DERE ROS p d gm dpi ees 251 13 2 1 Warning Messages ident deo RR HE ER br EPI hri E tr TOI eripe tbt 252 13 2 2 Error Messages csset bees eee e e iter BAIS AGIA RERO Eee ud 254 13 2 3 Fatal Error Messages eee neue E reU ERR 257 13 3
9. re er che e capes eiie re it iHe 128 8 2 Permitted Characters a eR iri tnter pr Y ssh Id ed e RECENTE ee 129 8 3 Numbers orent eti VORNE RERO REG PRENNE I TO eere e D e Pe P RR 130 8 4 Character RECEN CRE 133 8 5 Address Gonstants roe er me UEFA EFE e e tages PN EP ERE eevee PERENNE EEG 135 6 Location CoUntet x cec tee eter te eter ee RR UAR Eee epe eate Ee Ae ae e EYE 136 8 7 BA I AEO EEE E RREPODPIPEPRIEPODIDIIGRUP OR Ue beu HR 137 8 7 1 Operator UL 138 8 7 2 Expression Evaluation unte etr rper e e EP tpe E bs 140 8 7 3 Expression Syntax societa dept at d bre EE pu 141 8 7 4 Expression Attributes eee eee dea e RO Mure PP teo idee ede 142 SiS Reserved WOrds euet e cu e eR E RU e P AERE EN eee eue deed 144 Chapter 9 Writing Machine Language Instruction Statements and Directive Statements 9 1 Purpose of This Chapter cessere oie ite d ed IPC HERD DER 146 92 Instruction Statement Fields e eR I te D REI E Reb e LEER ERE 147 9 2 T Wating babel Field er ehh one nete recede a ti 148 9 2 2 Writing Operation Pield eee ee eH needs 149 9 2 3 Writing Operand Bield etes eeepc nro eer eer ie qe 150 9 2 4 Writing Comment ee ee eter Rr ete E IE tne CERE bees 151 9 3 Writing Machine Language Instruction State
10. 103 Wall sample asm Default Specification The default is to display all warning messages Command Options 75 Chapter 5 Using Asssembler 5 3 3 Preprocessor Options 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 Rules of Use This option is specified with the hyphen option specification character followed by the upper case letter I then either immediately followed by the path name or a space and the path name as103 I user defs main asm Default Specification If not specifying this option the assembler traces the directory 1 written above 76 Command Options 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
11. _ 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 It can create library files and add delete replace and search for relocatable object files This chapter explains how to use the library manager 274 Purpose of This Chapter 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 5115103 library_file_name options relocatable_object_file_name Contents of brackets may be omitted Table 15 1 Library Manager Options Option type Option Description j Output error and warning messages in Japanese Je Output error and warning messages in Japanese using EUC encoding Js Output error and warning messages in Japanese using Shift JIS encoding Error message options Jj Output error and warning messages in Japanese using JIS encoding e Output error and warning messages in English W number Do
12. Register indirect addressing specifies the address to access with the address register An MQ SS gg lt a Address specification Addressing Modes 227 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 Address specification 2 An address register An or the stack pointer register SP plus a 32 bit displacement Address specification 228 Addressing Modes 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 displace ment RMX Xs sayy ay Address specification Absolute addressing Absolute addressing specifies the address to be accessed as a 16 bit or 32 bit displacement abs32 abs16 RX rss Address specification Addressing Modes 229 Chapter 12 List of Machine Language Instructions Index addressing Index addressing adds the contents of an address r
13. Syntax Syntax for ifb Syntax for ifnb ifb dummy_parameter ifnb dummy_parameter block1 block1 ls felse block2 block2 endif 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 block will be assembled If it is a null character and an else directive has been coded block2 will be assembled Coding rules These directives can only be used within macro definitions The parameter must be a dummy parameter 202 Conditional Assembly Usage example Chapter 10 Writing Assembler Control Statements 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 debug ifb else endif TEXT define undef define global macro string jsr jsr jsr endm section MODE debug MODE MODE debug check string check proc proc CODE PUBLIC debug on MODE MODE proc Conditional
14. 23 3 3 Basic Operation of Assembler and 25 3 4 Assembling and Linking Multiple Sections essere nennen nre 30 3 5 Conditional Assembly and Linking 2 38 Chapter 4 Optimization 4 1 Purpose of This Chapter x ie rte p EH de a 44 42 Rules of 0 ot 45 4 3 Usage Example vss cove nee eene eret cos Shien 46 Chapter 5 Using Assembler 5 1 Purpose of This Chapter eie ettet nete ege net 60 5 2 Starung Assembler eto tenet eesqenmelliidutei emet 61 5 3 Command Options ei p RE ug ed det b dete Meee iE 63 5 3 1 Output File Options otro reme eter etn o dp be rers 64 5 3 2 Error Message Options ie temet tee reete eei OEE eb ere DE 70 5 3 3 Preprocessor OptionS impen DI S HR De pue o HUI Peer 76 5 3 4 Program Generation Options sse eene enne nen nennen trennen nennen nennen nennen 78 5 3 9 Other Options n HT P RE p pee 80 5 4 Operation Examples esc eed ete EE ee eta rate ar SA 81 Chapter 6 Using Linker 6 1 Purpose of This Chapter isa cnet uec e ede REM sob n Dr O dee bebe 84 1 TOC gt 6 2 Starting Iumker uda OUO ER ERE PEDI Beeb ibe apes open tinged aes 85 6 3 Command Options coda UE ela A eh ho
15. Compare this listing file to the one with indeterminate addresses Note how the plus signs have disappeared from lines 9 11 and how the addresses start from 80000000 hex the number specified with the T option Assembling and Linking Multiple Sections 35 Chapter 3 Introduction to Operation The contents of the final list file program4 Ist are as follows Note that the symbol table is not displayed program4 lst Page 1 PanaX series Series MN1030 Cross Assembler Loc Object Line Source 1 global data set time filler 2 3 CODE 01 section CODE PUBLIC 1 80005000 4 data set 80005000 8A00 5 mov Oy D2 6 0005002 7 data set loop 80005002 A6 8 cmp D1 D2 80005003 C60A 9 bec data set end 10 80005005 60 11 mov DO 0 80005006 2A01 12 Ly D2 80005008 2002 13 add 2 AO 8000500a CAF8 14 bra data set loop 1 5 8000500c 16 data_set_ end 8000500c FOFC 17 rts 18 19 _CODE_00 section CODE PUBLIC 1 20 80000022 21 time_filler 80000022 8A00 22 mov 0 D2 23 80000024 24 time_filler loop 80000024 A4 25 cmp D1 DO 80000025 C605 26 bcc time filler end 80000027 CA03 27 bra time filler loop 28 8000002a 29 time filler end 8000002a FOFC 30 rts 31 end 32 In this file the on line numbers 14 and 27 have disappeared and the start address of the first section CODE 01 has been changed to address 80005000 hex as specified by the T option However the start addr
16. Octal 0765 Decimal E 789 Hexadecimal E OXDEF Coding rules Binary Start with 0 zero and letter B or b5 followed by binary digits Octal Start with 0 zero followed by octal digits Decimal Code decimal number as is Hexadecimal Start with 0 and letter X or x followed by hexadecimal digits Current default radix Radix Binary Octal Decimal Hexadecimal Binar 101B 101B 101B 101B y 101 5670 5670 5670 5670 Octal 567Q 567Q 567Q 567Q 567 789D 789D 789D 789D Decimal 789 OdefH OdefH OdefH OdefH Hexadecimal Odef Coding rules Binary Follow binary digits with letter or b When the default is binary the suffix B may be omitted Octal Follow octal digits with letter O or o or Q or q When the default is octal the suffix O or Q may be omitted Decimal Follow decimal digits with letter D or d When the default is decimal the suffix may be omitted Hexadecimal Follow hexadecimal digits with letter H or h If the digits begin with a letter A F they must be prefixed with the digit 0 zero When the default is hexadecimal the suffix H may be omitted Numbers 131 Chapter 8 Writing Source Statements Matsushita format Current default radix Radix Binary Octal Decimal Hexadecimal B 101 B 101 B 101 B 101 y 101 0567 07567 07567 0567 Octal 567 F789 F789 F789 F789 Decimal 789 XT def X de
17. The expression coded in the operand must result in the attribute abs absolute Refer to section 8 7 4 Expression Attributes regafding attributes of expressions Specify one of the following constants or the operand character constant string constant The operands are delimited with commas Any number of operands can be coded If data that exceeds 8 bits is specified the lower 8 bits will be valid and the upper bits will be lost The assembler will output a warning message in such cases When the specified data has fewer than 8 bits those bits will fill the lower bits and the upper bits will be padded with zeroes Usage example Below is an example use of the dc directive DC LST Page 1 PanaX Series MN1030 Cross Assembler Loc Object Line Source T _DATA section DATA PUBLIC 4 00000000 41 2 0 DE 00000001 414243 3 cdl dc 00000004 4 cd2 255 gt gt 2 00000005 OE 5 12 3 2 2 00000006 6 4 0611111111 00000007 FFFE 5 0377 0376 00000009 8 cd6 255 166 Writing Directive Statements Chapter 9 Writing Machine Language Instructions and Directive Statements 9 4 11 ds Syntax label operation operand name ds expression expression2 expression3 expression Number of bytes of memory to reserve expression2 Initial value expression3 Number of iterations Default settings expression initial
18. followed by the upper case letter J and the lower case letter j The two letters together function as a single option 5114103 test lib f Jj testl rf test2 rf test3 rf NOTE This option is not available on DOS V or PC AT machines Default specification The default language used depends on the host machine and the operating system Host machine Message language Sun Sparc English DOS V Japanese in Shift JIS PC AT English Command Options 279 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 5110103 test lib f e testl rf test2 rf test3 rf Default specification The default language used depends on the host machine and the operating system Host machine Message language Sun Sparc English DOS V Japanese in Shift JIS PC AT English 280 Command Options 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 1
19. 152 Modulo operator remainder 138 Multiplication 0 nosmet 138 N eL 160 Numbers ssi POST eR 130 2 Index O o filename 89 268 Field itr 150 Operation Field sse 149 Operators aieo erectae demens 138 cima regret et E eun 163 OEB t ete ru ei tend t 162 Output File Options eee 89 P p esee IE Seat dite 281 286 PASE ssepe OR E EH 164 iussi ieget iore depen 160 Permitted Characters 2 2 2 129 Program Format eee 61 119 Program Generation Options 97 Purging Macro Definitions purge 217 R EE 101 287 E EORR 165 Reading List Files 267 inerat 142 Rel tive c sien ae oe ate hee 142 22 cime 187 cose trap EEA 218 Reserved Words eese 144 S SEC IOD iio ite dapi Aie I ete recte 154 Shift operators easet eerie 138 SOULCE EE qe RR EORR EA 268 String constants 2 2 134 Subtraction iiiter teret 138 Supplemental information sess 260 Symbol Table 271 T b serait a m reu nO FOE 288 Ut ao Reads 175 177 Tsection name
20. 8001 8A00 8F00 KKK irp lst Panax Series MN1030 Cross Assembler Line Source init EXT macro irp mov endm endm section init irp mov endm mov irp mov endm mov mov Page 1 pl opr lt 1 amp 0 0 gt opr DO CODE 1 opr lt 1 amp 0 0 gt PUBLIC opr DO 1 amp 0x0f DO reg D2 D3 0 reg 0 D2 0 D3 irp 221 Chapter 11 Writing Macro Control Statements 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 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 amp V Symbols cannot be used within a block If used a double definition error will occur The local directive cannot be used either A dummy parameter appearing in a string or character constant inside the irpc block is not expanded Usage example The following example uses the irpc directive DATA section CODE PUBLIC 1 irpc dummy 0123456789 dc dummy endm end 222 irpc Chapter 11 Writing Macro Control Statements The assembled list file is shown below irpc lst Page 1 Panax Series MN1
21. Chapter 1 Getting Started 1 4 Installation __ For the installation media installation procedures and notes on installation see the Installation Manual Installation 5 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 If this system has been installed in usr local bin for example adding the directory usr local bin to the PATH environment variable permits the use of the command name only for the commands in this system Under Unix most users initialize environment variables via a start up file named cshrc and located in the user s home directory If this is the case use an editor to modify the PATH variable setting in this start up file To put the changes into effect either log out and then log in again or use the source command to execute the contents of cshrc Start up files The assembler and linker start by reading start up files which contain statements for initializing start up variables The assembler start up file as103rc contains statements specifying the following three items 1 The default language and character coding scheme for messages from the assembler 2
22. Head Office 6F 550 Sec 4 Chung Hsiao E RD Taipei 110 Taiwan Tel 886 2 2757 1900 886 2 2757 1906 Kaohsiung Office 6th Floor Hsin Kong Bldg No 251 Chi Hsien 1st Road Kaohsiung 800 Taiwan Tel 886 7 346 3815 Fax 886 7 236 8362 Korea Sales Office Panasonic Industrial Korea Co Ltd PIKL Kukje Center Bldg 11th Floor 191 Hangangro 2ga Youngsan ku Seoul 140 702 Korea Tel 82 2 795 9600 Fax 82 2 795 1542 Semiconductor Company Matsushita Electric Industrial Co Ltd Nagaokakyo Kyoto 617 8520 Japan Tel 075 951 8151 http panasonic co jp semicon e index html Printed in Japan
23. 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 The result is stored in the program counter Any overflow during the addition is ignored The result is stored in the program counter 244 List of Machine Language Instructions Conditional BRANCH Chapter 12 List of Machine Language Instructions Mnemonic Meaning Description of operation BEQ label If ZF 1 execute a relative branch to the address specified by label Range ZF 1 128 to 127 If ZF 0 execute next instruction BNE label 4 If ZF 0 execute a relative branch to the address specified by label Range ZF 0 128 to 127 If ZF 1 execute next instruction BGT label lt signed If ZF 0 and NF VF execute a relative branch to the address specified by label Range 128 to 127 If ZF 1 or NF VF execute next instruction BGE label lt signed If NF VF execute a relative branch to the address specified by label Range 128 to 127 If NF VF execute next instruction BLE label gt si
24. 103 1 Lc sampl asm 68 Command Options 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 and lower case letter s The pair of characters of Ls are handled as a single option 103 Ls 1 sample asm NOTE This option is used in conjunction with the option lower case list output Default Specification A symbol table will be output Read the map file to output a list file with resolved address Functional Description This option is used to generate a final list file with resolved addresses First you must have generated a map file by specifying the m option with the linker Then using this map file reassemble with the a option to generate the final list file Specifying the wrong map file or specifying the different option from the one assembled at first results in an error Rules of Use This option is specified with the hyphen option specification character followed by the lower case letter a then followed by the map file name as103 a sample map 1 sample asm NOTE When specifying the a option always specify the option to output a list file No list file wil
25. Below is an expression syntax diagram expression binary operator expression unary operator contort 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 mov 10 5 move the value of address 15 to 40 equal to mov 15 d0 mov 0 10 5 move the value of constant 15 to dO equal to mov 15 dO mov 10 5 2 dod Error 104 5 is regarded as an address reference It causes syntax error Expressions 141 Chapter 8 Writing Source Statements 8 7 4 Expression Attributes E 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 Undefined undefined UND e Absolute absolute ABS External external EXT Relative relocate REL Operation result attributes The operation result attributes for the label itself or the labels are following four UND undefined attributes The label is undefined at the reference e ABS absolute attributes The label is undefined with equ pseudo instruction The value is not changed The constant value written directl
26. Description of operation CLR Dn Clear Dn to zero 236 List of Machine Language Instructions Chapter 12 List of Machine Language Instructions 12 3 2 Arithmetic Instructions 8 OOOO lt lt 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 ADD imm Dn Add the sign extended imm8 sign extended imm16 imm322 to the contents of Dn and store the result in Dn ADD imm An Add the sign extended imm8 sign extended imm16 imm322 to the contents of An and store the result in An ADD imm SP Add the sign extended imm8 sign extended imm16 or imm32 to the contents of SP and store the result in SP ADD with CARRY Mnemonic Description of operation ADDC Dm Dn Add the contents of Dm and the carry flag to Dn and store the result in Dn SUBTRACT Mnemonic Description of operation SUB Dm Dn Subtract the contents of Dm from Dn and store the result in Dn SUB Dm An Subtract the contents of Dm from An and store the result in An SUB Am Dn Subtract the contents of Am from Dn and store the result in Dn SUB Am An Subtract the conten
27. Eliminate the label specification 2310 Label nothing The label specification is missing Specify a label 2311 Illegal operand size An operand is of the wrong size Check the size specification 2312 Out of section error A specification is not inside a section Move the specification inside a section 2313 Section name count over max 255 There are more than 255 section names Reduce the number of section names to within 255 254 Assembler Errors 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 An operand has a value that is not within the specified range Check the operand value to place it within the specified range 2319 Operand type should be absolute An operand does not have an absolute value Specify an absolute value for the operand 2320 Debug operand error The assembler and the C compiler h
28. include 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 Assembles block1 if the identifier was defined before block1 the ifdef statement else Assembles block2 if it was not defined nothing will be block2 assembled if there is no else endif ifndef identifier Assembles block1 if the identifier was defined before block1 the ifdef statement else Assembles block2 if it was not defined nothing will be block2 assembled if there is no else endif if expression Assembles block1 if the expression is not 0 block1 else Assembles block2 if it is 0 nothing will be assembled block2 if there is no else endif ifn expression Assembles block if the expression is 0 block1 else Assembles block2 if it is not 0 nothing will be block2 assembled if there is no else endif ifeq parameterl parameter2 Assembles block1 if parameter and parameter2 are block1 equal Assembles block2 if they are not equal nothing will be assembled if there is no else At least one or else block2 the other of parameter and parameter2 must be a dummy parameter within a macro definition ifeq can endif AA only be used within macro definitions ifneq parameter1 parameter2 Assembles block1 if parameter and parameter2 are block1 equal Assemble
29. 88 6 3 1 Output File Options ede etre rro RUP ete 89 6 3 2 Error Message 4o ROREM eG E ER RE gh 91 6 3 3 Program Generation Options nene ee ERROR FO 97 6 3 4 Library File Options cen nte oet HEC ee ep eee PO eR 103 6 3 5 Other Options necne elei Dep NO OUO OTI CP OUR pH 105 6 4 Instruction RAM Support eerte CERT ERU ee Re LESE e ERE er eR dod 107 6 4 1 Structure of IRAM Support Executable 22 4 0 enne 108 6 4 2 IRAM Support orie eene nennen rennen 111 6 4 3 Operation ndo eg ene entendre dip tte oiii 114 Chapter 7 of Source Statements T L Purposeof This Chapter ceste eem bI RHET Re ERG DOT CH E ER E EE 118 7 2 Program Format cte E E REI E Ei e Re PEE aE 119 7 3 Machine Language Instruction Statements and Directive Statements esses 121 7 4 Assembler Control Statements cess eese essei a eK eE EEE E e Eai Ea enne tne 122 7 3 Macro Control Statements dae ree o o RP Pu EC eO UI Phi EU Higher ree 123 76 Ee eg 124 727 Blank Statements ope T 125 Chapter 8 Writing Source Statements 8 1 Purpose of This Ch ptet
30. 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 1d103 e sample rf Default specification The default language used depends on the host machine and the operating system Host machine Character coding Sun Parc English DOS V Japanese in Shift JIS PC AT English It is also possible to change the default message specification with an entry in the linker s start up file See Chapter 1 Getting Started Section 1 5 Setup Command Options 95 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 Rules of use This option is specified with the hyphen option specification character followed by the upper case letter W and followed by the warning number specification 142103 W3001 progrl rf prog2 rf Default specifi
31. MOV An abs32 MOV An d An MOV An d8 An MOV 416 An MOV An d32 An MOV An d SP MOV An 48 SP MOV 416 SP MOV An d32 SP MOV Dn abs MOV Dn abs 16 MOV Dn abs32 MOV Dn d An MOV Dn d8 An MOV Dn 416 An MOV Dn d32 An MOV Dn d SP MOV Dn d8 SP MOV Dn 416 SP MOV Dn d32 SP MOV imm An MOV imm8 An MOV imm16 An MOV imm32 An MOV imm Dn MOV imm8 Dn MOV imm16 Dn MOV imm32 Dn MOVBU abs Dn MOVBU abs16 Dn MOVBU abs32 Dn MOVBU d An Dn MOVBU d8 An Dn MOVBU d16 An Dn MOVBU d32 An Dn MOVBU d SP Dn MOVBU d8 SP Dn MOVBU d16 SP Dn MOVBU d32 SP Dn MOVBU Dn abs MOVBU Dn abs 16 MOVBU Dn abs32 MOVBU Dn d An MOVBU Dn d8 An MOVBU Dn d16 An MOVBU Dn d32 An MOVBU Dn d SP MOVBU Dn d8 SP MOVBU Dn d16 SP MOVBU Dn d32 SP MOVB abs Dn MOVB abs16 Dn MOVB abs32 Dn MOVB d An Dn MOVB d8 An Dn MOVB d16 An Dn MOVB d32 An Dn MOVB d SP Dn MOVB d8 SP Dn MOVB d16 SP Dn MOVB d32 SP Dn MOVB Dn abs MOVB Dn abs16 MOVB Dn abs32 MOVB Dn d An MOVB Dn d8 An MOVB Dn d16 An MOVB Dn d32 An MOVB Dn d SP MOVB Dn d8 SP MOVB Dn d16 SP MOVB Dn d32 SP MOVHU abs Dn MOVHU abs16 Dn abs32 Dn MOVHU d An Dn MOVHU d8 An Dn MOVHU d16 An
32. Specify by Command 2 Specify in Environmental setting file Start up file format The start up files contain statements using the following format keyword parameter The first field is a keyword giving the name of the start up parameter The second field specifies the value to assign to that parameter The two fields must be separated by at least one tab or space A sharp may be used to incorporate comments into these start up files The assembler and linker then ignore all text from the sharp through to the end of the line NOTE Each specification must end with a carriage return In particular make sure that the last line ends with a carriage return Some editors allow users to end the last line with an end of file mark instead of a carriage return NOTE There is no way to specify multiple parameters on the same line Setup 7 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 message ENGLISH Outputs messages in English message EUC Outputs messages in Japanese using EUC encoding message SJIS Outputs messages in Japanese using Shift JIS encoding message JIS Outputs messages in Japanese us
33. The developer must create this portion and add it to the fixed program portion E Instruction RAM status management table During execution this table keeps track of which portions are currently in the instruction RAM Since this is for use by the debugger in identifying the portions currently in the instruction RAM it is not necessary for a program that merely runs in instruction RAM The contents and usage of this table is determined by the debugger The linker creates an extra symbol iram manage indicating the location of this table 108 Instruction RAM Support Chapter 6 Using Linker E Instruction RAM status Executable file management table created by linker External memory Extra symbol iram manage FF file specified by T option D Transfer program Assigned at the highest address of CODE attribute PF file specified 3 by OVL option Referring instruction Instruction RAM RAM addresses A Fixed portion Programs are transferred Program 1 o instruction RAM in accordance with the instruction RAM program management table PF file specified by OVL option Automatically generated table information Program 2 Program 1 management information Program 2 management Extra symbol overlay table information 9 gt lt a 5 3 C Instruction RAM program management table portion Figure 6
34. 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 It also describes the directives used for macros Common coding rules The characters that can be used for macro names dummy parameters parameters and identifiers are upper and lower case letters digits and underscores _ The first character must not be a digit Symbols used in expressions must have been previously defined The following directives cannot be coded within macro blocks include directive macro definitions Refer to section 11 2 Macro Definitions regarding macro definitions and blocks The rept and irp directives and macro calls can be coded within macro blocks Up to 20 nesting levels are allowed A dummy parameter appearing in a string or character constant inside the macro is not expanded Document conventions Symbols used in this chapter have the following meanings Contents of brackets may be omitted Contents of parentheses may be repeated 206 Purpose of This Chapter Chapter 11 Writing Macro Control Statements 11 2 Macro Definitions macro endm ET o 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 simpl
35. zero extended imm 16 imm32 with Dn and store the result in Dn OR imm Dn OR imm16 PSW OR imm16 with PSW and store the result in PSW EXCLUSIVE OR source with destination Mnemonic Description of operation XOR Dm Dn XOR Dm with Dn and store the result in Dn XOR imm Dn XOR the zero extended imm16 imm32 with Dn and store the result in Dn NOT destination Mnemonic Description of operation NOT Dn Reverse all bits in Dn and store the result in Dn List of Machine Language Instructions 239 Chapter 12 List of Machine Language Instructions ARITHMETIC SHIFT RIGHT Mnemonic Description of operation ASR Dm Dn Arithmetically shift the contents of Dn right the number of bits specified in Dm and store the result in Dn ASR imme Dn Arithmetically shift the contents of Dn right the number of bits specified by imm8 and store the result in Dn ASR Dn Arithmetically shift the contents of Dn right one bit and store the result in Dn LOGICAL SHIFT RIGHT Mnemonic Description of operation LSR Dm Dn Logically shift the contents of Dn right the number of bits specified in Dm and store the result in Dn LSR imme Dn Logically shift the contents of Dn right the number of bits specified by imm8 and store the result in Dn LSR Dn Logically shift the contents of Dn right one bit and store the result in Dn ARITHMETIC SHIFT LEFT
36. 1 Purpose of This Chapter This chapter contains descriptions left out of other chapters 298 Purpose of This Chapter Chapter 16 Notes on the Operating Environment 16 2 Personal Computer Versions RU EEE _ This section contains notes on using the personal computer versions of the software in this package Personal Computer Versions 299 Chapter 16 Notes on the Operating Environment 16 2 1 Operating Environment uI ee ee ee ee This system runs on the following personal computers and compatibles Host Machine Operating System Version of OS PC AT Windows 98 2000 Me XP DOS V Windows 98 2000 Me XP 300 Personal Computer Versions 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 SLIB 103 EXE is the library manager a utility for creating library files For a description see the chapter 15 Using the Library Manager EXCV103 EXE file conversion utility This utility converts an executable produced by the linker into a file in Motorola S format Intel HEX format or Matsushita format Personal Computer Versions 301 Chapter 16 Notes on the Operating Envi
37. 4 will assemble block 1 line number 5 here and will not assemble block 2 shown as line number X The ifndef directive inverts the condition so block 2 line number 12 will be assembled 192 Conditional Assembly 10 4 2 Chapter 10 Writing Assembler Control Statements Syntax Syntax for if if expression block1 else block2 endif Functional description Tif Syntax for ifn ifn expression block1 else block2 ndif If the value of expression is not 0 block 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 1 will be assembled If it is not 0 and an else directive has been coded block2 will be assembled Coding rules These directives can be used within macro definitions and wherever machine language instructions can be coded Conditional Assembly 193 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 DO 15 mov 0x02 DO ndif ifn DEVICE 1 mov 0x03 DO ls mov 0x04 DO ndif The assembled list file is shown below The program first sets DEVICE to 1 Therefore the expression DEVICE 1 will be 0 so the if directive causes line number 7 to
38. 5 7 JMP LABEL JMP LABEL BGT LABEL BGT LABEL BLE 5 BLE 7 JMP LABEL JMP LABEL BGE LABEL BGE LABEL BLT 5 BLT 7 JMP LABEL JMP LABEL BLE LABEL BLE LABEL BGT 5 BGT 7 JMP LABEL JMP LABEL BCS LABEL BCS LABEL BCC 5 BCC 7 JMP LABEL JMP LABEL BHI LABEL BHI LABEL BLS 5 BLS 7 JMP LABEL JMP LABEL BCC LABEL BCC LABEL BCS 5 BCS 7 JMP LABEL JMP LABEL BLS LABEL BLS LABEL BHI 5 BHI 7 JMP LABEL JMP LABEL BEQ LABEL BEQ LABEL BNE 45 BNE 47 JMP LABEL JMP LABEL BNE LABEL BNE LABEL BEQ 5 BEQ 7 JMP LABEL JMP LABEL BVC LABEL BVC LABEL BVS 6 BVS 8 JMP LABEL JMP LABEL BVS LABEL BVS LABEL BVC 6 BVC 8 JMP LABEL JMP LABEL BNC LABEL BNC LABEL BNS 6 BNS 8 JMP LABEL JMP LABEL BNS LABEL BNS LABEL BNC 6 BNC 8 JMP LABEL JMP LABEL Optimization of branches For unconditional branch instructions 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 Similarly a CALL label CALLS label or JSR label instruction is replaced by the shorter version with a 16 bit displacement d16 PC instead of the one with the 32 bit displacement d32 PC The following table shows the possibilities for optimizing the unconditional branch instructions and the subroutine call instructions Table 4 9 Optimization of branches Source Instruction First Candidate Second Candidate Third Candid
39. 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 Machine language instruction mnemonics Port names Register names Address constants Directives e Assembler control instructions Macro control instructions Except for machine language instruction mnemonics and port names the reserved words are listed below Register name dO di d2 a0 al a2 PSW mdr sp Address constants a Directives align dc ds dw end equ global listoff liston xlistoff xliston notation org opt page radix section tit funcinfo assign Assembler control define if ifb ifdef ifeq ifge ifgt ifle instructions iflt ifn ifnb ifndef ifneq include undef Macro control endm exitm irp irpc local macro purg rept instructions 144 Reserved Words Chapter 9 Writing Machine Language Instruction Statements and Directive Statements Chapter 9 Writing Machine Language Instructions and Directive Statements 91 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 in
40. 8 bits of Dm to the memory location specified by MOVHU Am Dn Transfers with zero extension the 16 bit contents of the memory location specified by Am to Dn MOVHU Dm An Pid the lowest 16 bits of Dm to the memory location specified by MOVH Am Dn Transfers with sign extension the 16 bit contents of the memory location specified by Am to Dn MOVH Dm An o the lowest 16 bits of Dm to the memory location specified by Transfers the contents of the memory location specified by Am and MOV Am Dn displacement d to Dn Register Sigs Relative 8 and 16 bit displacements are sign extended Indirect Transfers the contents of the memory location specified by SP and MOV d SP Dn displacement d to Dn 8 and 16 bit displacements are zero extended 232 List of Machine Language Instructions Chapter 12 List of Machine Language Instructions Mnemonic Description of operation Register Relative Indirect MOV d Am An Transfers the contents of the memory location specified by Am and displacement d to An 8 and 16 bit displacements are sign extended MOV d SP An Transfers the contents of the memory location specified by SP and displacement d to An 8 and 16 bit displacements are zero extended MOV d8 Am SP Transfers the contents of the memory location specified by Am and displacement d to SP 8 and 16 bit displacements are sign extended MOV Dm d An Transfers the contents
41. AND macl macro pl p2 p3 mov pl amp p2 gt gt amp p3 amp 0x0f DO endm mac2 macro pls p2 pl p2 endm TEXT section CODE PUBLIC 1 macl 1 22 2 add 1 DO gt end Macro Operators 211 Chapter 11 Writing Macro Control Statements The assembled list file is shown below macexp lst Page 1 Series MN1030 Cross Assembler Loc Object Line Source M1 macl macro pl p2 p3 mov pl amp p2 gt gt amp p3 amp 0x0F DO endm M5 mac2 macro pl p2 6 pl p2 7 endm 8 9 TEXT SECTION CODE PUBLIC 1 M10 macl dy 35x23 00000000 8001 10 mov 12 gt gt 3 amp 0x0f DO M11 mac2 add 1 DO 00000002 22801 11 1 DO 12 end 212 Macro Operators Chapter 11 Writing Macro Control Statements 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 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 Coding rules Symbols specified with the local directive should not be used outside the macro definition The local directive can be used only within macro definitions Local symbols should be used after they have been declared by the local directive If the local symbol XXXXX used by
42. Example operand amp operand2 ADDRESS amp MASK operand operand2 CONST 0b0011110000 operand1 2 050011110000 operand MAIN Expressions 139 Chapter 8 Writing Source Statements 8 7 2 Expression Evaluation EEE 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 Precedence Operator Description Highest Unary negation unary plus unary minus Multiplication division remainder T Addition subtraction T lt lt gt gt Left shift right shift T amp Logical AND Exclusive OR Lowest Logical An example of operator is shown below cl equ 10 2 equ 0b01101110 _CODE section CODE PUBLIC 1 datal c1 3 3 4 data2 c1 3 3 4 data3 2 data4 c2 data5 dc 2 gt gt 2 data6 1 lt lt 2 data7 dc main gt gt 2 data8 dc 2 gt gt 270500001111 gt gt 2 data9 dc c2 amp 0b00001111 data10 2 0500001111 org 0x100 main mov c2 amp 0600001111 DO end An asterisk is used as both the self reference address symbol and the multiplication operator so take care in its use The expression will be multiplication of the self reference address symbol by itself 140 Expressions Chapter 8 Writing Source Statements 8 7 3 Expression Syntax
43. 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 To use call instructions the program must define the stack frame size and the reg isters to be saved using a special format in the function s declaration section This special format takes the form of the funcinfo directive The linker uses the specified stack size and register list to automatically set up the proper calling se quences for calls to the function Operand coding rules The label name gives the branch target used by instructions other than the call instruction the call in struction for example This label name is necessary even if no other instructions call it In that case assign a label to any empty statement immediately preceding the funcinfo directive and use the name of that label The label name must be defined prior to the funcinfo directive Otherwise an error results The expression gives the size of the stack frame used by the function It must evaluate to a value be tween 0 and255 A value outside this range results in an error The register list gives a list of registers to be saved to the stack before entering the function proper Enclose the list in square brackets and separate the registers in the list with commas The registers that can appear in th
44. In the align 6 directive on line 6 the expression value 6 is not a power of 2 so the assembler will convert it to align 8 The series of multiples of 8 is shown below Numbers in parentheses are hexadecimal 8 8 16 10 24 18 32 20 40 28 48 30 56 38 64 40 The location counter value at the line of align 6 is 0003 hex which is between 0000 and 0008 hex Therefore the next line will start from location 0008 hex The same series applies to the align 8 on line 10 The location counter there is 000B hex which is between 0008 and 0010 hex Therefore the next line will start from location 0010 hex Similarly the align 16 on line 13 uses the series 16 10 32 20 48 30 The location counter there is 0012 hex which is between 0010 and 0020 hex Therefore the next line will start from location 0020 hex Writing Directive Statements 157 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 When a name is coded in the label field the current location counter value will be assigned to it Op
45. List Files 269 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 Object 00000000 00000000 70 00000001 61 00000002 2004 00000004 2104 00000006 70 00000007 61 00000008 2004 0000000 2104 0000000 FCFF0000000 0 Symbol Table 12345678 00000000 Line 1 sh 24 25 listspl lst Source include data equ global load macro mov mov add add endm _TEXT main ifdef VERSION mov section mov else load mov mov add add mov mov add add calls end listspl lst data move main Page 1 PanaX Series MN1030 Cross Assembler outlist h 0x12345678 move A0 DO DO A1 4 0 4 Al CODE PUBLIC data DO DO A0 A0 DO DO A1 4 AO 4 Al 0 DO DO A1 4 AO 4 Al move Page 2 1 270 Reading List Files Chapter 14 Reading List Files 14 2 2 Symbol Table Bum EET O If only the 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
46. 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 The optimization function evaluates how the source statements are coded and converts them to the optimal code with the linker While the linker is linking multiple files it outputs the instructions with the smallest possible code size for the instructions subject to optimization Refer to chapter 4 Optimization for details NOTE The Od assembler option disables the optimization function however optimization will be enabled if opt on is coded in the source file Operand coding rules The strings that can be coded for the operand and their meanings are as follows opt on Enables optimization opt off Disables optimization Usage example Below is an example use of the opt directive opt on opt off Writing Directive Statements 163 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 spec
47. OPTION This entry controls the output of the map file Either ON or OFF of the parameters comes after the keyword m OPTION followed by a blank space These parameters have the following meanings m OPTION ON Enable output of the map file m OPTION OFF Disable output of the map file The default setting is to disable output of the map file m OPTION This entry controls the output of the executable file when there are assembler errors Either ON or OFF of the parameters comes after the keyword r OPTION followed by a blank space These parameters have the following meanings r OPTION ON Enable output of the executable file when there are assembler errors r OPTION OFF Disable output of the executable file when there are assembler errors The default setting is to disable output of executable file when there are assembler errors r OPTION This entry specifies the library file The library file name comes after the keyword stdlib stdlib followed by a blank space Two or more stdlib descriptions are allowed The default setting is no specification This entry specifies the directory for searching library files The library file name comes libdir after the keyword libdir followed by a blank space Two or more libdir descriptions are allowed The default setting is no specification Setup 9 Chapter 1 Getting Started 1 6 File Conversion Utility This file conversion utility converts an EX format file produced by the
48. Statements 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 Identifier definement names a variable or a set of steps and replace the name the identifier to the string that has been defined Conditional assembly allows the assembler to evaluate conditions and then to select a block of statements to assemble depending on whether the conditions are fulfilled or not This chapter describes these functions and how to code them and provides examples of actual use Many directives used in conditional assembly are used only within macro definitions Refer to chapter 11 Writing Macro Statements as needed Common coding rules Here are some rules common to coding of all assembly control statements The assembler directive should be coded from the first column of its statement Both upper and lower case letters can be used The characters that can be used as identifiers are upper and lower case letter digits and underscores _ However the first character must not be a digit Further conditional assembly directives can be used within a block of
49. Statements 8 3 Numbers TT S TuN FE The cross assembler provides three coding formats for use in numbers and single character constants refer to section 8 4 Character Constants e Extended C language format Intel format e 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 Radix 2 binary e Radix 8 octal e Radix 10 decimal e Radix 16 hexadecimal Any radix can be selected by using the radix directive but only decimal is allowed in extended C language format The default is decimal regardless of coding format To code numbers with a radix other than the default a fixed suffix indicating the radix is appended to the digits Radices and allowed digits Radix 2 binary Radix 8 octal Radix 10 decimal 0 0 4 5 6 7 0 Radix 16 hexadecimal 0 A dls A lt 16 5 8 9 3 3 3 4 55 6 7 8 9 AB B C D E F of D hexadecimal digits that correspond to decimal 0 11 12 13 14 15 Lower case letters can also be used HB ANNDAN The next page shows how the various radices and formats are coded 130 Numbers Extended C language format Chapter 8 Writing Source Statements Intel format Current default radix Radix Binary Octal Decimal Hexadecimal Binary x B 101
50. Subject To Optimization Instruction Type Branch Range ADD imm An ADD imm Dn ADD imm SP AND imm Dn CMP imm An CMP imm Dn Immediate addressing 32 bit immediate data Table 4 5 Logical Instructions Subject To Optimization Instruction Type Branch Range OR imm Dn Immediate addressing 32 bit immediate data XOR imm Dn Table 4 6 Logical Instructions Subject To Optimization Instruction Type Branch Range BTST imm Dn Immediate addressing 32 bit immediate data 48 Usage Example Chapter 4 Optimization Table 4 7 Data Transfer Instructions Subject To Optimization Instruction Type Branch Range UDFO0O0 imm Dn UDFO01 imm Dn UDFO2 imm Dn UDFO03 imm Dn UDFO04 imm Dn UDFO05 imm Dn UDFO06 imm Dn UDFO07 imm Dn UDFO08 imm Dn UDFO09 imm Dn UDF10 imm Dn UDF11 imm Dn UDF12 imm Dn UDF13 imm Dn UDF14 imm Dn UDF15 imm Dn UDFUOO imm Dn UDFUO imm Dn UDFUO2 imm Dn UDFUO3 imm Dn UDFU04 imm Dn UDFUOS imm Dn UDFUO6 imm dn UDFUO7 imm Dn UDFUOS imm Dn UDFU09 imm dn UDFU10 imm Dn UDFUI1 imm Dn UDFUI2 imm Dn UDFUI3 imm Dn UDFU14 imm Dn UDFU15 imm Dn Immediate addressing 32 bit immediate data Optimization processing The assembler informs the linker about all instructions to be optimized Ba
51. The macro named compare uses two dummy parameters datal 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 compare macro datal data2 ifeq datal data2 mov 0 01 DO else mov 0x02 DO fendif endm _TEXT section CODE PUBLIC 1 compare abc abc compare abc acb 196 Conditional Assembly 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 lst Page 1 KER PanaX Series MN1030 Cross Assembler Loc Object Line Source 1 compare macro datal data2 2 ifeg datal data2 3 mov 0 01 DO 4 else 5 mov 0x02 DO 6 endif 7 endm 8 9 _TEXT section CODE PUBLIC 1 M10 compare abc abc 10 ifeq abc abc 00000000 8001 10 mov 0x01 DO 10 else 10 mov 0x02 DO 10 endif M11 compare abc acb TEF ifeq abc 11 mov 0x01 DO 11 else 00000002 8002 11 mov 0x02 DO 11 endif Conditional Assembly 197 Chapter 10 Writing Assembler Control Statements 10 4 4 iflt Syntax Syntax for iflt Syntax for ifle iflt expression ifle expre
52. The radix notation used for numbers 3 The default toggle switch setting for optimization The linker start up file l1d103rc contains statements specifying the following eight items 1 The language and character coding scheme for messages from the linker A toggle controlling output of debugging information to the executable file A toggle controlling output of the symbol table to the executable file A toggle controlling output of DATA sections to the executable file A toggle controlling output of a map file A toggle controlling output of an executable file when there are errors A library file Ww Rw A directory searching for a library file The assembler and linker search directories for these start up files in the following order the current directory the user s home directory and the directory containing the executable If they find such a file they use the contents to initialize their starting parameters Otherwise they set the parameters to their default values These default values are given in the section Start up file format 6 Setup 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 1
53. as103 W 2016 sample asm Do not output any warning messages Wall 5103 Wall sample asm Preprocessor options Specify the path name of the directory that contains files specified by include I path name as103 I usr defs sample asm D identifier Specify an identifier to be used by ifdef during conditional assembly 5103 D VERSION sample asm Program generation options Output debug information to the relocatable object file g as103 g sample asm Turn off optimization Od as103 Od sample asm Turn on optimization 5103 O sample asm List of Command Options 313 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 103 314 List of Command Options 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 1d103 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 1d103 o usr tmp test ex main rf sub rf Output a map file m 142103 main rf sub rf Error message options
54. be assembled and the ifn directive causes line number 10 to be assembled ihe St Page 1 PE PanaX Series MN1030 Cross Assembler Loc Object Line Source 00000001 1 DEVICE equ 1 2 3 _TEXT section CODE PUBLIC 1 4 if DEVICE 1 5X mov 0 01 DO 6 15 00000000 8002 7 mov 0x02 DO 8 ndif 9 ifn DEVICE 1 00000002 8503 10 mov 0x03 D1 EL ls 12x mov 0x04 D1 13 ndif 194 Conditional Assembly Chapter 10 Writing Assembler Control Statements 10 4 3 ifeq ifneq Syntax Syntax for ifeq Syntax for ifneq fifeq parameter2 fifneq parameter2 block1 block1 else else block2 block2 fendif ndif Functional description ifeq If parameter 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 ifneq If parameter and parameter2 are different strings block will be assembled If they are the same and an else directive has been coded block2 will be assembled Coding rules These directives can only be used within macro definitions Either or both of parameter and parameter2 may be dummy parameters set up during macro definition Conditional Assembly 195 Chapter 10 Writing Assembler Control Statements Usage example A source file that uses ifeq and ifneq is shown below
55. called test lib from the four relocatable object files test1 rf test2 rf test3 rf and test4 rf NOTE slib103 cannot create a library file from an relocatable object file with the same name NOTE If specifying file name with path name for a relocatable object file its file name without path name will be registered in a library file 282 Command Options 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 Slib103 test lib f testl rf Operation example 5110103 test lib f testl rf test2 rf test3 rf test4 rf This example will create a library file called test lib from the four relocatable object files test1 rf test2 rf test3 rf and test4 rf NOTE With slib103 files that mutually reference symbols cannot be placed in library files with the same name NOTE If specifying a file name with path name for relocatable object file its file name without path name will be registered in a library file Command Options 283 Chapter 15 Using Library Manager 15 3 3 Functional Options a Add the specified relocatable object file to the library file Functional descript
56. conditional assembly directives Up to 255 nesting levels are allowed The else directive and the second block can be omitted Refer to section 10 4 Conditional Assembly for details about the second block An expression combines symbols self reference address symbols and constants with operators into an equation that returns a single value as its result The value must have the attribute abs absolute Refer to section 8 7 Expressions regarding attributes of expressions Document conventions Symbols used in this chapter have the following meanings Contents of brackets may be omitted 182 Purpose of This Chapter Chapter 10 Writing Assembler Control Statements 10 2 File Inclusion Ol The inclusion is assembler control instruction that reads the specific file to the source file It is used for the following purpose Using same macro or same declarations variables in several source files File Inclusion 183 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
57. d Am Dn Transfers with sign extension the 8 bit contents of the memory location specified by Am and displacement d to Dn 8 and 16 bit displacements are sign extended MOVB d SP Dn Transfers with sign extension the 8 bit contents of the memory location specified by SP and displacement d to Dn 8 and 16 bit displacements are zero extended MOVB Dm d An Transfers the lowest 8 bits of Dm to the memory location specified by An and displacement d 8 and 16 bit displacements are sign extended MOVB Dm d SP Transfers the lowest 8 bits of Dm to the memory location specified by SP and displacement d 8 and 16 bit displacements are zero extended List of Machine Language Instructions 233 Chapter 12 List of Machine Language Instructions Mnemonic Description of operation MOVHU d Am Dn Transfers with zero extension the 16 bit contents of the memory location specified by Am and displacement d to Dn 8 and 16 bit displacements are sign extended MOVHU d SP Dn Transfers with zero extension the 16 bit contents of the memory location specified by SP and displacement d to Dn 8 and 16 bit displacements are zero extended MOVHU Dnm d An Transfers the lowest 16 bits of Dm to the memory location specified by An and displacement d 8 and 16 bit displacements are sign extended MOVHU Dm d SP Transfers the lowest 16 bits of Dm to the memory location
58. display this information Rules of Use To specify the option enter the hyphen followed by the lower case letter h as103 h NOTE Even if the h option is not specified input of AS103 alone will also display the help screen When displaying help information version number is also displayed on the screen Default Specification Help information will not be displayed to the screen V Display the assembler s version number on the console Functional Description This option displays the assembler s version number on the console Rules of Use To specify the option enter the hyphen followed by the lower case letter v 103 v Default Specification The default is to not display the version number NOTE Even if the v option is not specified input of as103 alone will also display the help screen When displaying help information version number is also displayed on the screen 80 Command Options Chapter 5 Using Assembler 5 4 Operation Examples aaa 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 Program assembly Generation of a list file with the 1 opt
59. 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 If the assembler is started without them then the error message bad tmpbss w will be output and processing will stop This Usage note means that the number of files that can be opened simultaneously is insufficient Terminology CONFIG SYS This is the file that sets the MS DOS operating environment FILES specifies Su ppl eme ntary expl an atio n the number of files that can be read and written simultaneously BUFFERS specifies the size of memory used for reading writing disks Installing PC Version 14 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 command options and instructions used by the assembler First time users should refer to these examples when trying to use the assembler Usage note These give important information Usage note provide cautions about usage so they should always be read Supplementary explanation These are hints and terminology definitions that can help the reader use the assembler About This Manual 2 e Related Manuals The following related manuals are available Please contact our sales representative for more details e MN1030 MN103S Series Instruction Manual Describes th
60. else to endif will be assembled if DEBUG is undefined In this example DEBUG was defined on line 1 so the instructions in the defined block will be assembled This program also uses a macro control directive Lines 4 to 8 are the macro definition The macro s name is dat set and it has two parameters adr dat 38 Conditional Assembly and Linking Chapter 3 Introduction to Operation Assemble and link Assemble and link the program that you have created 103 program5 asm 142103 T CODE 400000000 program5 rf 103 1 a m103 program5 asm The first assembly generates the relocatable object file program5 rf The second assembly generates the final list file programS Ist 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 program5 1lst Page 1 PanaX series Series MN1030 Cross Assembler Loc Object Line Source al define DEBUG 2 3 4 dat set macro adr dat 5 mov adr AO 6 mov dat DO 7 mov DO 0 8 endm 9 0 CODE section CODE PUBLIC 1 40000000 1 2 main 13 ifdef DEBUG M14 dat_set datal 0x11 40000000 0 000040 14 mov datal AO 40000006 8011 14 mov 0 11 DO 40000008 60 14 mov DO 0 5 else 16 dat_set datal 0x22 17 endif 18 19 _DATA section DATA PUBLIC 4 4000000C 00000000 20 datal dd 0 40000010 00
61. equ varl 2 add_adr macro adr add adr AO endm _CODE section CODE PUBLIC 2 main add_adr varl add_adr var2 end Reference By adding the Lm option when the assembler is started you can suppress the output of mnemonics of macros expanded by the assembler 210 Macro Calls and Expansion 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 amp Concatenates strings Macro definition dummy parameters Macro call Macro expansion pl amp p2 amp p3 gt abc def ghi gt abcdefghi pl amp p2 amp p3 gt data 1 3 gt datal3 Escape characters for including normally unusable characters lt gt amp in parameters of macro calls Macro definition dummy parameters Macro call Macro expansion pl amp p2 amp gt gt amp p3 amp 0x0f gt var 3 2 var3 gt gt 2 amp 0x0f lt gt Passes the enclosed string as a single parameter of a macro call Macro parameters Macro call Macro expansion pl gt lt abc 1 gt abc 1 Usage example The following example uses the operators V lt gt amp amp characters in the body of macro macl are used with two different meanings The amp before the dummy parameters is a macro operator The amp before the hexadecimal OxOf indicates a logical
62. func_end 56 Usage Example 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 opt on TEXT section CODE PUBLIC 1 sub_func addr_set jmp func_end org addr_set 127 fun_end end The final list file after assembly is shown next The branch destination of the JMP LABEL instruction on line number 4 is in the permitted range for relative branching so it has been converted to BRA LA BEL Note that the mnemonics and object code are different opt3 lst Page 1 PanaX series Series MN1030 Cross Assembler Loc Object Line Source 1 opt on 2 TEXT section CODE PUBLIC 1 40000000 3 sub_func 40000000 CA7F 4 addr_set jmp func_end 5 6 org addr_set 127 4000007 7 func_end 4000007 FOFC 8 rts 9 end opt3 lst Page 2 Symbol Table KEX 40000000 T sub_func 40000000 T addr_set 4000007 T func_end Usage Example 57 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 o
63. 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 103 options EX format file name Contents of brackets be omitted Options Option Description j Displays error and warning messages in Japanese 1 Displays error warning messages in English 2 h Displays help information regarding file conversion utility options to the screen Perform conversion using a work file during execution This enables a large amount of W data to be converted even if the personal computer has little memory However conversion speed will be slower i Output the execution file in Intel HEX format S3 Output the execution file in Motorola S3 format S2 Output the execution file in Motorola S2 format S1 Output the execution file in Motorola S1 format ofile Specify the file name to output p No padding P Padding Converts the addresses within the specified range If omitting the end address a conversion is performed until the last address of the execution module R start address end address Perform conversion for the starting address of EX format file into the specified A start address address Option for UNIX version 2 Option for DOS V version 10 File Conversion Utility Chapter 1 Getting Started Default specifica
64. not output warning messages of the specified number Refer to chapter 10 Error Messages for warning messages and their corresponding numbers Wall Do not output any warning messages Program generation g Output debug information to the executable format file T section address Specify the start end addresses of a start address end address section section group Output an executable format file even if errors are detected En Do not output symbol table within the executable format file Ed Enable output of DATA sections to the executable format file Library file options library filename Specify a library file L path name Specify a path name for library files Instruction RAM OVL ID number Specify starting address for section in options section address instruction RAM PUT extra_symbol address Specify address for extra symbol Other filename Specify a parameter file h Output help information to the screen Display the linker s version number on the console Starting Linker 87 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 If optimization was selected at the assembly
65. operating system Host machine Message language Sun Sparc English DOS V Japanese in Shift JIS PC AT English It is also possible to change the default message specification with an entry in the assembler s start up file See Chapter 1 Getting Started Section 1 5 Setup 72 Command Options 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 The two letters together function as a single option as103 Jj sample asm NOTE This option is not available on DOS V or PC AT machines Default Specification The default language used depends on the host machine and the operating system Host machine Message language Sun Sparc English DOS V Japanese in Shift JIS PC AT English It is also possible to change the default message specification with an entry in the assembler s start up file See Chapter 1 Getting Started Section 1 5 Setup Command Options 73 Chapter 5 Using Asssembler Output error and warning messages English Functional Description This option causes all error and warning messages and help screens sent to th
66. purge macl macl macro pl p2 add pl p2 endm macl 1 1 Purging Macro Definitions purge 217 Chapter 11 Writing Macro Control Statements 11 8 rept Syntax rept expression 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 Further rept and irp directives and macro calls can be coded within a block Up to 20 nesting levels are allowed Usage example In the following example the rept directive is in a macro definition that is used twice in the program main repeat macro pl rept pl add Ily DO endm endm TEXT section CODE PUBLIC 1 repeat 2 rept 3 add Ly Dal endm 218 rept The assembled list file is shown below Chapter 11 Writing Macro Control Statements Loc 00000000 00000002 00000004 00000006 00000008 Object 2801 2801 2901 2901 2901 rept lst Page 1 Panax Series MN1030 Cross Assembler Line M Q PN Z Z PrP PP FP amp o re spa pay 4 eae 03 1 Source repeat EXT macro rept add endm endm
67. section repeat rept add endm add add rept add endm add add add pl pl 1 DO CODE a CO Or so PUBLIC 1 rept 219 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 If used a double definition error will occur The local directive cannot be used either If a comma delimiters in a row are specified the corresponding parameter will be processed as though a null character had been specified To specify strings that include commas and spaces use the macro operator lt gt Usage example In the following example the irp directive is in a macro definition that is used twice in the program init macro pl irp opr lt pl amp 0x0f gt mov opr DO endm endm _ TEXT section CODE PUBLIC 1 init 1 irp reg D2 D3 mov 0 reg endm 220 irp The assembled list file is shown below Chapter 11 Writing Macro Control Statements Loc 00000000 00000002 00000004 Object
68. specified by SP and displacement d ba 8 and 16 bit displacements are zero extended te m Transfers with sign extension the 16 bit contents of the memory MOVH d Am Dn location specified by Am and displacement d to Dn 8 and 16 bit displacements are sign extended Transfers with sign extension the 16 bit contents of the memory MOVH d SP Dn location specified by SP and displacement d to Dn 8 and 16 bit displacements are zero extended Transfers the lowest 16 bits of Dm to the memory location specified by MOVH Dnm d An An and displacement d 8 and 16 bit displacements are sign extended Transfers the lowest 16 bits of Dm to the memory location specified by MOVH Dnm d SP SP and displacement d 8 and 16 bit displacements are zero extended MOV Di Am Dn Transfers the 32 bit contents of the memory location specified by Di and Am to Dn MOV Di Am An Transfers the 32 bit contents of the memory location specified by Di and Am to An MOV Dm Di An Transfers the contents of Dm to the memory location specified by Di and An MOV Am Di An Transfers the contents of Am to the memory location specified by Di and An MOVBU Di Am Transfers with zero extension the 8 bit contents of the memory Dn location specified by Di and Am to Dn MOVBU Dn Di Transfers the lowest 8 bits of Dm to the memory location specified by An Di and An index MOVB Di Am Dn Transfers with sign ext
69. stage the linker will output the optimal machine language code for conditional and unconditional branch instructions regardless of the mnemonics defined in the source file In addition the linker resolves the values of forward referenced symbols and undefined operands 88 Command Options Chapter 6 Using Linker 6 3 1 Output File Options Specify the path name and file name of the executable format file to be o filename output 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 If just a path name is specified or if a directory that does not exist is specified an error message will be displayed NOTE Because the symbol is used as the character for specifying parameter files it cannot be used as the first character of file names Rules of use This option is specified with the hyphen option specification character followed by the lower case letter o then either immediately followed by the file name or a space and the file name 14103 usr tmp test ex main rf sub rf Default specification The executable format file named m103 ex will be output to the current directory Command Options 89 Chapter 6 Using Linker m Ou
70. the assembler you must understand the following items Required knowledge MAKE Machine language instructions Device operation Editor use e 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 Therefore you should as much as possible automate assembler and linker commands debugger calls and error correction When a program is divided into multiple files for joint development efforts by several programmers a control system must be created for assembly and linking without error If this is not done an old undebugged program could be linked within the iterative development process The solution lies with the following program which runs on the workstation or personal computer MAKE With MAKE the programmer defines the dependency relationships of the files needed to generate the final executable file and list files Afterwards MAKE will automatically assemble and link only those files that have been modified Program format The Cross Assembler utilizes a program format called section address format Section address format specifies the start addresses of programs for each section linked Even when the program is divided between multiple files or when a file is divided into multiple sections identical sections are linked together with the same attributes Therefore the pr
71. the contents of An and store the result in An INC4 An Add 4 to the contents of An and store the result in An COMPARE source with destination Mnemonic Description of operation CMP Dm Dn Subtract the contents of Dm from Dn and set the flags according to the result CMP Dm An Subtract the contents of Dm from An and set the flags according to the result CMP Am Dn Subtract the contents of Am from Dn and set the flags according to the result CMP Am An Subtract the contents of Am from Dn and set the flags according to the result Subtract the sign extended imm8 sign extended imm16 110132 from Dn CMP imm Dn and set the flags according to the result Subtract the zero extended zero extended imm16 or imm32 from An CMP imm An 4 and set the flags according to the result 23 List of Machine Language Instructions 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 the zero extended imm8 zero extended imm16 or imm32 with Dn and store the result in Dn AND imm 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 OR the zero extended
72. the line number By specifying the assembler s Li option you can suppress output of include files to the list file Coding rules The file is specified by the file name enclosed in double quotation marks If the file is in a different directory the file name specification must include the path name The assembler will assume an ASM extension if the extension is omitted NOTE By adding the option when starting the assembler you can specify a path name for include files However even in this case the option will be ignored if a specific path name is coded within filename NOTE As the assembler ignores all text after the directive coding rules end directive coding rules should not be written in a file captured with include 184 File Inclusion Usage example Chapter 10 Writing Assembler Control Statements The following example illustrates the use of an include file The file inc h consists of the following statement data equ 0 12 The to be assembled consists of the following statements include _TEX section main mov mov mov end CODE PUBLIC data AO 0x34 DO DO 0 1 The above file is assembled with the inc h included For this reason at points after the include statement the operand data is interpreted as the numerical value 0x12 File Inclusion 185 Chapter 10 Writing Assembler Control S
73. the local directive is undefined an error will occur Local Symbol Declaration local 213 Chapter 11 Writing Macro Control Statements Usage example An example using the local directive is shown below loc macro pl local labl lab2 mov pl DO labl cmp 0 DO jmp lab2 mov 1 Al lab2 mov 0 AO 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 2200001 2200002 Loc 00000000 00000002 00000004 00000009 0000000b 0000000d 0000000 00000011 00000016 00000018 local lst Page 1 Panax Series MN1030 Cross Assembler Object Line Source M1 loc macro pi 2 local labl lab2 3 mov pl DO 4 labl cmp 0 DO 5 jmp lab2 6 mov 1 A1 T lab2 mov 0 A0 8 endm 9 i 10 _TEXT section CODE PUBLIC M11 loc 0 M11 local labl lab2 8000 114 mov 0 DO A000 114 2200001 0 DO DC00000000 11 jmp 2200002 9501 114 mov 1 Al 9000 114 2200002 mov 0 0 M12 loc 1 M12 local labl lab2 8001 12 mov 1 DO A000 12 2200003 0 DO DC00000000 12 jmp 2200004 9501 12 mov 1 Al 9000 12 2200004 mov 0 0 1 214 Local Symbol Declaration local Chapter 11 Writing Macro Control Statements 11 6 Forced Termination of Macro Expansion exitm Syntax macro_name macro parameter ifndef identifier exitm endif endm Functional descrip
74. the same sections in main rf and sub rf according to the T option placement rules See Section 6 3 3 The linker resolves all internal references within the TEXT sections of progl rf prog2 rf and prog3 rf so that the sections are ready to run at the instruction RAM address 40000000 hex but places the sections in the order that they appear in the input files beginning at the address following the end of the sections with the CODE attribute as placed with the T option Finally at the address following the end of all segments in external memory with the CODE option the linker creates the instruction RAM program management table used by the routine for copying sections to instruction RAM 114 Instruction RAM Support 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 Specifying an address for the instruction RAM program management table 142103 T CODE 80000000 T8DATA 1000 main rf sub rf OVL 1 _TEXT 40000000 progl rf OVL 2 _TEXT 40000000 prog2 rf OVL 3 TEXT 40000000 prog3 rf PUT __ove
75. the source statement so that its length is within the limit 2331 No optimizing information The map file does not contain optimization information Check the map file 2332 Error in configure file There is an error in the start up file Correct the start up file 2333 Illegal map file value The map file and the assembly result disagree Check the value in the map file 256 Assembler Errors 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 2505 Can t open filename file There is an error in the input output file specifications Alternatively the disk is full or defective In the former case check the file name specification in the latter check the disk 2506 Memory allocation error The assembler was unable to allocate memory Check the amount of memory available 2507 Data write error The assembler was unable to write dat
76. 000000 21 data2 dd 0 22 Line number 14 extends over four lines This indicates lines where macro expansion has been performed An M is added before the line number where the macro instruction statement is shown and a is added after the line numbers where the instruction statements from macro expansion are shown DEBUG has been defined so the block between ifdef to else was assembled Line number 16 has an X after the line number This indicates a statement that was not assembled because a condition was not fulfilled Conditional Assembly and Linking 39 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 103 program5 asm ld103 m T CODE 40000000 program5 rf 103 1 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 program5 1lst Page 1 PanaX series Series MN1030 Cross Assembler Loc Object Line Source 1 define DEBUG 2 3 M4 dat_set macro adr dat 5 mov adr AO 6 mov dat DO 7 mov DO 0 8 endm 9 10 11 CODE section CODE PUBLIC 1 40000000 T2 main 13 ifdef DEBUG 14X dat_set datal 0x11 15 else M16 dat_set datal 0x22 40000000 0 000040 16 mov datal AO 40000006 8022 16
77. 001 8001 F8FEFCFCFF000000 14 E04 14 00 8 Line exitm lst Source extml ifndef endif ifndef define itndef endif global JSE endm section extm1 mov Page 1 Panax Series MN1030 Cross Assembler debug debug CODE debug PUBLIC 1 216 Forced Termination of Macro Expansion exitm Chapter 11 Writing Macro Control Statements 11 7 Purging Macro Definitions purge Syntax purge macro_name macro_name 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 The purge directive cannot be used within macro definitions When multiple macro names are specified they are delimited by commas Usage example The following example illustrates the use of the purge control statement The above example contains two definitions for the same macro name The first instance of mac ex pands to a mov instruction After the purge control statement the second definition for mac takes ef fect maci macro pl p2 mov pl pz endm _ section CODE PUBLIC 1 macl 0 1
78. 030 Cross Assembler Loc Object Line Source 1 DATA section DATA PUBLIC 1 M2 irpc dummy 0123456789 3 dc dummy 4 endm 00000000 00 4 dc 0 00000001 01 4 1 00000002 02 4 de 2 00000003 03 4 3 00000004 04 4 de 4 00000005 05 4 5 00000006 06 4 6 00000007 07 4 7 00000008 08 4 8 00000009 09 4 9 irpc 223 Chapter 11 Writing Macro Control Statements 224 irpc Chapter 12 List of Machine Language Instructions 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 MN 1030 MN103S Series Instruction Manual 226 Purpose of This Chapter 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 Register indirect addressing Register relative indirect addressing e Absolute addressing ndex addressing Register indirect addressing
79. 1 D2 0019 C60A 9 data_set_end 10 0015 60 4 mov DO 0 001 2A01 12 add 1 D2 001 2002 13 add 2 0 0020 CAF8 14 bra data set loop 15 0022 16 data set end 0022 FOFC 17 rts 18 end program2 1st Page 2 Symbol Table 40000016 T data set 40000018 T data set loop 40000022 T data set end Here is a simple explanation of how to read the list files A list file shows four items of information Source statements and machine language code e Source statements and machine language code e Symbol table Source statements and their corresponding machine language code are further divided into Loc Object Line and Source headings The Loc heading gives location counter values which show execution addresses in the final list files programl lst starts from location 40000000 hex and program2 Ist starts from location 40000016 hex The Object heading shows the codes of instructions converted to machine language by the assembler Instructions consist of one to four bytes 1 byte 8 bits shown as two to eight hex digits After some machine language code the symbol M will be added The M indicates an instruction that was expanded from a macro instruction The Line heading shows line numbers added by the assembler The Source heading shows the source statements as coded Basic Operation of Assembler and Linker 29 Chapter 3 Introduction to Operation 3 4 Assembling and Linking Multiple Section
80. 2 Dn UDFO02 imm Dn UDF02 imm8 Dn UDF02 imm16 Dn UDF02 imm32 Dn UDF03 imm Dn UDF03 imm8 Dn UDF03 imm16 Dn UDF03 imm32 Dn UDF04 imm Dn UDF04 imm8 Dn UDF04 imm16 Dn UDF04 imm32 Dn UDFO05 imm Dn UDF05 imm8 Dn UDFO05 imm16 Dn UDFO05 imm32 Dn UDFO06 imm Dn UDF06 imm8 Dn UDF06 imm16 Dn UDF06 imm32 Dn UDF07 imm Dn UDF07 imm8 Dn UDF07 imm16 Dn UDF07 imm32 Dn UDFO08 imm Dn UDFO08 imm8 Dn UDFO08 imm16 Dn UDFO08 imm32 Dn UDF09 imm Dn UDF09 imm8 Dn UDF09 imm16 Dn UDF09 imm32 Dn UDF10 imm Dn UDF10 imm8 Dn UDF10 imm16 Dn UDF10 imm32 Dn UDF11 imm Dn UDF11 imm8 Dn UDF11 imm16 Dn UDF11 imm32 Dn UDF12 imm Dn UDF12 imm8 Dn UDF12 imm16 Dn UDF12 imm32 Dn UDF13 imm Dn UDF13 imm8 Dn UDF13 imm16 Dn UDF13 imm32 Dn UDF14 imm Dn UDF14 imm8 Dn UDF14 imm16 Dn UDF14 imm32 Dn UDFI15 imm Dn UDF15 imm8 Dn UDF15 imm16 Dn UDF15 imm32 Dn UDFUOO imm Dn UDFU00 imm8 Dn UDFU00 imm16 Dn UDFU00 imm32 Dn UDFU01 imm Dn UDFUOI imm8 Dn UDFU01 imm16 Dn UDFU01 imm32 Dn UDFU02 imm Dn UDFU02 imm8 Dn UDFU02 imm16 Dn UDFU02 imm32 Dn UDFUO3 imm Dn UDFUO3 imm8 Dn UDFUO3 imm16 Dn UDFU03 imm32 Dn UDFU04 imm Dn UDFU04 imm8 Dn UDFU04 imm16 Dn UDFU04 imm32 Dn UDFU05 imm Dn UDFU0S5 imm8 Dn UDFUO5 imm16 Dn UDFUO5 imm32 Dn UDFU06 imm Dn UDFU06 imm8 Dn UDFU06 imm16 Dn UDFU06 imm32 Dn UDFU07 imm Dn UDFU07 imm8 Dn UDFU07 imm16 Dn UDFU07 imm32 Dn UDFU08 imm Dn UDFU08 imm8 Dn UDFU08 imm16 Dn UDFU08 imm32 Dn UDFUO
81. 3 Layout Image for Instruction RAM and External Memory NOTE When the instruction RAM function is in use the linker reserves the extra symbol names overlay table and iram manage for its own use so do not use these names for ordinary symbols Instruction RAM Support 109 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 The linker automatically generates the instruction RAM program management table C at the address specified with the PUT option If there is no specification the table immediately follows the instruction RAM portion The linker resolves address references to other portions of the program assuming that the instruction RAM portions are running at the specified addresses in instruction RAM The linker creates an instruction RAM transfer unit for each OVL option making entry for each one in the instruction RAM program management table The transfer program D obtains its parameters from this table during actual transfers When the program runs the actual code for an instruction RAM portion referenced must be in the instruction RAM The software must call upon the transfer routine to copy the necessary code into the instruction RAM imm
82. 5 4 1 Warning Messages The library manager 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 5110103 test lib W4001 testl rf test2 rf test3 rf Default specification The default is to display all warning messages Wall Do not output any warning messages Functional description This option suppresses output of all warning messages generated during library manager operation Rules of use To specify the option enter the hyphen followed by the letters Wall Slib103 test lib Wall c testl rf test2 rf test3 rf Default specification The default is to display all warning messages Command Options 281 Chapter 15 Using Library Manager 15 3 2 Program Generation Options 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 Slib103 test lib testl rf Operation example Slib103 test lib c testl rf test2 rf test3 rf test4 rf This example will create a library file
83. 51 309 AUTOEXEC centre 301 B Blank Statements 2 serene 125 C Character Constants esee 133 CLANG zie iere Re ete 160 Command Options 12 2 276 Comment Field 151 Comment Statements 2 124 Conditional Assembly 2 2 22 189 GONFIG S YS nicam toner 301 D EO 278 285 n 166 Differences From Workstation Versions 303 Directive statements seen 121 Division i eet ee be RES 138 d teet iet Et Ee etti 167 dummy parameter 22 202 QW aie etat eoe tee i gue 169 E Gabel inei iti me pP 95 279 Eden Rad me 102 ED enm ehem adn eg aits 102 ONG aA e hnc nei E 158 eet 207 Environment Settings 2244222 111 301 CCU e a REPRE DRE FR EHE er MEUS 171 Error Messages 2 2224 2 1 252 259 310 eu 215 Expansion etin giis 209 EXT 142 Extended C language format 131 External 5 eter errem 142 F Bae ERE ees 280 Fatal Error Messages 254 257 260 262 Forced Termination Of Macro Expansion 215 G B dade DX RR REPE 97 global nee nee eer 173 H 106 291 Intel tert Rode 131 160 RERO BERE NER HE RE EE 220 It DC oe UE ERE ORE
84. A section ds0 ds ds dsl ds Page 1 DATA PUBLIC 4 1 2 0x1122 4 0x33445566 2 168 Writing Directive Statements 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 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 Operand coding rules The operands are delimited with commas Any number of operands can be coded If data that exceeds 16 bits is specified the lower 16 bits will be valid and the upper bits will be lost The assembler will output a warning message in such cases When the specified data has fewer than 16 bits those bits will fill the lower bits and the upper bits will be padded with zeroes Usage example Below is an example use of the dw directive dw lst Page 1 PanaX Series MN1030 Cross Assembler Loc Object Line Source 1 _DATA section DATA PUBLIC 4 00000000 3930 2 dw0 dw 12345 00000002 34127856 9 dwl dw 0x1234 0x5678 00000006 0000 4 dw2 dw 0 Writing Directive Statements 169 Chapter 9 Writing Machine Language Instructions and Directive Statements 9 4 13 dd
85. Assembler instructions and dc dw ds and dd directives must be coded after a section has been defined If used before a section has been defined the assembler will generate an error and ignore that assembler instruction or directive NOTE The value for the section name will be the starting address in the same section after link If separating the sections the starting address of the lowest section will be used Writing Directive Statements 155 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 219 When the expression value is 4 the multiples of 4 will be the following series 4 8 12 16 20 24 28 32 When the location counter value is 13 the statement after align 4 will have its location counter changed to 16 When the location counter is 23 the statement will have its location counter changed to 24 When the location counter is 30 the statement counter will have its location counter changed to 32 Thus the align directive rounds up the current location counter value up to the next greater multiple of the expression value Operand coding rules The a
86. Assembly 203 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 lst Page 1 KEKR PanaX Series MN1030 Cross Assembler AKE Loc Object Line Source 1 global check proc 2 M3 debug macro string 4 ifb string 5 jsr check 6 jsr proc 7 ls 8 jsr proc 9 ndif 10 enam 11 H 12 TEXT section CODE PUBLIC 1 13 defin MODE debug on M14 debug MODE 144 ifb debug on LAX jsr check LAX jsr proc 14 ls 00000000 F8FEFCFCFF000000 14 jsr proc 00000008 00 8 04 14 14 ndif 15 undef MODE 16 defin MODE M17 debug MODE 157 ifb 0000000 F8FEFCFCFF000000 1 7 jsr check 00000014 00 8 04 17 00000018 F8FEFCFCFF000000 17 jsr proc 00000020 00 8 04 17 1 7 15 17 jsr proc 17 ndif 204 Conditional Assembly Chapter 11 Writing Macro Control Statements Chapter 11 Writing Macro Control Statements 11 11 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
87. Dn MOVHU d32 An Dn MOVHU 4d SP Dn MOVHU d8 SP Dn MOVHU d16 SP Dn MOVHU d32 SP Dn MOVHU Dn abs MOVHU Dn abs16 MOVHU Dn abs32 MOVHU Dn d An MOVHU Dn d8 An MOVHU Dn d16 An MOVHU Dn d32 An MOVHU Dn d SP MOVHU Dn d8 SP MOVHU Dn d16 SP MOVHU Dn d32 SP MOVH abs Dn MOVH abs16 Dn MOVH abs32 Dn MOVH d An Dn MOVH d8 An Dn MOVH d16 An Dn MOVH d32 An Dn Usage Example 53 Chapter 4 Optimization Table 4 10 optimization of data transfer arithmetic logical bit manipulation Source instruction First Candidate Second Candidate Third Candidate 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 MOVH Dn d32 An MOVH Dn d SP MOVH Dn d8 SP MOVH Dn d16 SP MOVH Dn d32 SP ADD imm An ADD imm8 An ADD imm16 An ADD imm32 An ADD imm Dn ADD imm Dn ADD imm16 Dn ADD imm32 Dn ADD imm SP ADD imm8 SP ADD imm16 SP ADD imm32 SP AND imm Dn AND imm Dn AND imm16 Dn AND imm32 Dn CMP imm An CMP imm8 An CMP imm16 An CMP imm32 An CMP imm Dn CMP imm8 Dn CMP imm16 Dn CMP imm32 Dn OR imm Dn OR imm8 Dn OR imm16 Dn OR imm32 Dn XOR imm Dn XOR imm16 Dn XOR imm32 Dn BTST imm Dn BTST imm8 Dn BTST imm16 Dn BTST imm32 Dn UDF00 imm Dn UDF00 imm8 Dn UDFO00 imm16 Dn UDFO00 imm32 Dn UDF01 imm Dn UDFO01 imm8 Dn UDFO01 imm16 Dn UDFO01 imm3
88. E and lower case letter n The pair of characters of are handled as a single option 1d103 main rf sub rf NOTE The En option cannot be used in conjunction with the g option Default specification The entire symbol table will be output It is also possible to disable symbol table output by default with an entry in the linker s Start up file See Chapter 1 Getting Started Section 1 5 Setup Ed Output the DATA section to the executable file Functional description This option causes the linker to write sections with the DATA attribute to the executable Rules of use This option is specified with the hyphen option specification character followed by the upper case letter and lower case letter d The pair of characters of En are handled as a single option 1d103 Ed main rf sub rf Default specification The default is not to output DATA sections to the executable It is also possible to enable DATA section output by default with an entry in the linker s start up file See Chapter 1 Getting Started Section 1 5 Setup 102 Command Options Chapter 6 Using Linker 6 3 4 Library File Options llibrary 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 then
89. G dc TOS end Machine Language Instruction Statements and Directive Statements 121 Chapter 7 Type of Source Statements 7 4 Assembler Control Statements E559 559 Cn 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 sinclude a file define MODE define an identifier ifdef MODE begin conditional assembly mov 0x22 DO block to assemble if condition is fulfilled else mov 0 11 DO sblock to assemble if unfulfilled 122 Assembler Control Statements Chapter 7 Type of Source Statements 7 5 Macro Control Statements eee 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 lan guage instructions to construct a single program process A macro call is just a macro name coded as a source statement The assembler will replace it with all the machine language instructi
90. NOTE The Lm option is specified with the hyphen option specification character Default Specification Source statements expanded from macros will be output to the list file Operation Example The following command line assembles the source file samp1 asm and creates a listing file samp1 Ist that suppresses all text generated by the expansion of macros 103 1 Lm sampl asm Command Options 67 Chapter 5 Using Asssembler Do not output source statements that were not assembled due to unfulfilled conditions of conditional assembly to the list file 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 The pair of characters of Lc are handled as a single option 103 Lc 1 sample asm NOTE This option is used in conjunction with the option lower case I list output Default Specification Blocks of unsatisfied conditions will be output to the list file Operation Example The following command line assembles the source file samp1 asm and creates a listing sampl Ilst that suppresses all text from conditional assembly blocks for which the condition is not satisfied
91. O 6 mov dat DO F mov DO 0 8 endm 9 0 11 CODE section CODE PUBLIC 1 12 main 13 ifdef DEBUG M14 dat_set datal 0x11 0 000040 14 mov datal AO 8011 14 mov 0 11 DO 60 14 mov DO 0 15 else 16 dat_set datal 0x22 17 endif 18 19 _DATA section DATA PUBLIC 4 00000000 20 datal dd 0 00000000 21 data2 dd 0 22 end Line number 14 was assembled Check for yourself that omitting D DEBUG will assemble line number 16 instead This technique enables the programmer to freely choose assembly conditions with command option specifications There is also an assembler option for suppressing the source code lines not selected during conditional assembly For further details see Chapter 5 Using the Assembler and Chapter 6 Using the Linker Conditional Assembly and Linking 41 Chapter 3 Introduction to Operation 42 Conditional Assembly and Linking Chapter 4 Optimization 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 NOTE The assembler and linker make c
92. O imm Dn UDFU09 imm8 Dn UDFU09 imm16 Dn UDFU09 imm32 Dn UDFU 10 imm Dn UDFU10 imm8 Dn UDFU10 imm16 Dn UDFU10 imm32 Dn UDFU 11 imm Dn UDFU11 imm8 Dn UDFU11 imm16 Dn UDFU11 imm32 Dn UDFU 12 imm Dn UDFU12 imm8 Dn UDFU12 imm16 Dn UDFU12 imm32 Dn UDFU 13 imm Dn UDFU13 imm8 Dn UDFU13 imm16 Dn UDFU13 imm32 Dn UDFU 14 imm Dn UDFU 14 imm8 Dn UDFU 14 imm16 Dn UDFU 14 imm32 Dn UDFU15 imm Dn UDFU15 imm8 Dn UDFU15 imm16 Dn UDFU15 imm32 Dn 54 Usage Example 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 aBCC LABEL conditional branch instruction The source list is as follows TEXT sub_func addr_set func_end opt section mov cmp bee org rts end on CODE 0 D1 PUBLIC 1 D2 func_end addr_set 127 The final list file after assembly is shown next The start address during linking is assumed to be 40000000 hex The mark on line number 6 indicates that the instruction was the object of optimi zation Since the target address is within the range of a relative jump the assembler generates a BCC LABEL instruction Loc 400 400 400 400 400 400 Co c 00 00 02 03 CO C3 C9 82 82 Symbol Object 8A00 6 C67F FOFC Table 40000000 40000003 40000082 Line PrReoO
93. ONA WM OF WN FP optl lst Page 1 PanaX series Series MN1030 Cross Assembler Source TEXT sub func addr set func end opt mov cmp bcc org rts end optl lst Page 2 sub func set func end on section CODE 0 D2 D1 D2 func_end addr_set 127 PUBLIC 1 Usage Example 55 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 con ditional branch instruction The source list is as follows opt on TEAL section CODE PUBLIC 1 sub_func mov 0 D2 cmp Dl D2 addr_set bec func_end org addr_set 128 func_end rts end The final list file after assembly is shown next LABEL exceeds the permitted branch range of BCC LA BEL so the code has been converted to BCS 5 JMP LABEL Note that the mnemonics and object code are different opt2 lst Page 1 PanaX series Series MN1030 Cross Assembler Loc Object Line Source 1 opt on 2 _TEXT section CODE PUBLIC 1 40000000 sub_func 40000000 8A00 4 mov 0 D2 40000002 6 5 cmp D1 D2 40000003 405 0080 6 addr_set bec func_end 7 8 org addr_set 128 40000083 9 func_end 40000083 FOFC 10 rts 11 end 12 opt2 lst Page 2 Symbol Table 40000000 sub_func 40000003 T addr_set 40000083 L
94. OTE The coding format also applies to numbers Refer to section 8 3 Numbers for details Coding rules In extended C format and Intel format character constants are specified just with the character enclosed in single quotation marks In Matsushita format the enclosed character is preceded by the letter C or The character A ASCII code 042 is specified in each coding format as follows Coding Format Character Constant Extended C language format Matsushita format or Intel format Specifying more than one character such as CFEDCBA will cause an error NOTE To specify a single quotation mark or a backslash for a character constant a backslash precedes the character Character Constants 133 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 amp Specifies the string amp as ASCII code NOTE To specify a double quotation mark or a backslash in a character constant a backslash precedes the character NOTE Note that string constants are specified the sa
95. Options e 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 Host machine Character coding Sun Sparc EUC DOS V Shift JIS PC AT not supported Rules of use 66599 To specify the option enter the hyphen followed by the lower case letter 4 Slib103 test lib f j testl rf test2 rf test3 rf NOTE This option is not available on PC AT machines Default specification The default language used depends on the host machine and the operating system Host machine Character coding Sun Sparc English DOS V Japanese in Shift JIS PC AT English 276 Command Options 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 Jap anese 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 The two letters together function as a single option 5110103 test lib f Je testl rf
96. Pana Series The One toWatch for Constant Innovation Making the Future ComeAlive MICROCOMPUTER MN1030 1030 Series Cross Assembler User s Manual Pub No 13110 120E Panasonic 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 MIFES is a trademark of Megasoft Inc All other corporation names logotype and product names written in this book are trademarks or registered trademarks of their corresponding corporations Request for your special attention and precautions in using the technical information and semiconductors described in this book 1 An export permit needs to be obtained from the competent authorities of the Japanese Government if any of the products or technologies described in this book and controlled under the Foreign Exchange and Foreign Trade Law is to be exported or taken out of Japan 2 The technical information described in this book is limited to showing representative characteristics and applied circuits examples of the products It neither warrants n
97. Series MN1030 Cross Assembler Object Line Source 1 _DATA section 2 notation 3 dc 4 5 6 8 notation 9 10 11 12 13 notation 14 15 16 17 CODE INTEL 11111111b 3774 3770 255d Offh CLANG 0377 255 Oxff PANA b 11111111 07377 255 x ff PUBLIC 4 Writing Directive Statements 161 Chapter 9 Writing Machine Language Instructions and Directive Statements 9 46 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 For a discussion of attributes of expressions see Chapter 8 Writing Source Statements Section 8 7 Expressions Section 8 7 4 Expression Attributes If the expression value is less than the current location counter it causes an error Usage example Below is an example use of the org directive _ CODE section CODE PUBLIC 2 sec_adr instructions org 0x20 sec fnc instructions org 0x100 end 162 Writing Directive Statements Chapter 9 Writing
98. Syntax label operation operand name dd expression expression Functional description This directive is used to define 32 bit constants in 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 Operand coding rules The operands are delimited with commas Any number of operands can be coded When the specified data has fewer than 24 bits those bits will fill the lower bits and the upper bits will be padded with zeros Usage example Below is an example use of the dw directive dd LST Page 1 PanaX Series MN1030 Cross Assembler Loc Object Line Source 1 global 0 ddl 2 3 _DATA section DATA PUBLIC 4 00000000 78563412 4 ddo dd 0x12345678 00000004 00000000 5 dd 00000008 00000000 6 ddl dd ddO 170 Writing Directive Statements 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 pr
99. T CODE 01 80005000 program3 rf program4 rf 34 Assembling and Linking Multiple Sections Chapter 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 1 a m103 map program3 asm 103 1 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 Based on the link information written in the map file the assembler will reassemble the source file and generate a final list file Let s look at the final list files with all addresses resolved The contents of the final list file program3 Ist are as follows Note that the symbol table is not displayed Loc 800 800 800 800 800 800 800 800 800 8000 OOO Cy C program3 lst Page 1 PanaX series Series MN1030 Cross Assembler Object Line Source 1 global main 2 global data_set time_filler 3 4 _CODE_00 section CODE PUBLIC 1 000 5 main 000 9000 6 mov 0 0 002 2 00 7 mov Oxff DO 005 2D8000 8 mov 0x80 D1 008 F8FEFCFCFFF44F00 9 jsr data set 010 00 8 04 9 014 F8FEFCFCFFOCOO00 10 JSE time_filler Olc 00 8 04 10 020 0 11 bra main 12 13 DATA section DATA PUBLIC 4 500e 00000000 14 datal ds 4 15 end
100. 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 Symbol Value Supplemental Symbol Type Symbol Name Information x c 00000000 T XXXXXX t U D Symbol Value The symbol s value is shown as eight hexadecimal digits Supplemental Information The symbol type may be preceded by a or This indicates an externally defined symbol This indicates an undefined symbol This indicates an externally referenced symbol Symbol Type This indicates the type of symbol All symbols can be classified into four types A U T and D A This indicates that the symbol value is absolute T This indicates a symbol with the CODE attribute and an address as its symbol value U This indicates that the symbol is not defined in the source file D This indicates a symbol with the DATA attribute and an address as its symbol value Reading List Files 271 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 Symbol Table 12345678 00000000 A U T KKK listspl lst data move main Page 2 272 Reading List Files Chapter 15 Using Library Manager Chapter 15 Using Library Manager 15 1 Purpose of This Chapter _
101. 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 The probe of the in circuit emulator can operate in place of the microcomputer by connecting it through the microcomputer socket in the product The source code debugger is a program for controlling the in circuit emulator s hardware The debugger downloads the application developed on a workstation or personal computer to the emulator s memory to create an environment in which the application runs as if it were in the microcomputer s ROM It can start program execution as the address of any source statement and can temporarily stop execution Also when execution is stopped the source code debugger can display values of internal registers and memory and can be used to verify desired operation of programs by changing those values It also enables more detailed operation checks with step operation whereby execution proceeds one instruction at a time Using this development environment the developer can prove programs in the same state as when finally incorporated into the microprocessor 16 Program Development Flow 2 3 Chapter 2 Program Development Flow Programming with Assembler Before creating programs using
102. a to the output file Check the file system capacity 2508 File is used recursively filename The specified file is used recursively Check the file specifications 2509 Illegal map file information The map file information is incorrect Check the map file information Assembler Errors 257 Chapter 13 Error Messages 13 3 Linker Errors The linker displays three types of messages warning messages error messages and fatal error messag es 258 Linker Errors Chapter 13 Error Messages 13 3 1 Warning Messages HEIN 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 3002 Extra symbol name address aligned address The linker s alignment processing has changed the address assigned to the specified extra symbol Generate a map file and check the value for the extra symbol 3003 Address overlay with IRAM manager A section address overlaps the area assigned to the instruction RAM status management table Generate a map file check the address and change the command li
103. anager 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 The creation of the temporary file failed for some reason Check the memory capacity 4304 Can not create library file filename The library manager could not create the library file Check the file system s capacity 4305 This file is not object file for MN1030 filename The specified object file is not an object file Check the object file specifications If they are correct the file is most likely corrupted so re create it 4306 This file is not library file for MN1030 filename The specified library file is not a library file Check the library file specification If it is correct the file is most likely corrupted so re create it 4307 Object file name not found An option calling for an object file name is missing an object file specification Check the option syntax 4308 Invalid file information type exist filename The specified file contains incorrec
104. anasonic Canada Inc PCI 5770 Ambler Drive 27 Mississauga Ontario LAW 2T3 Canada Tel 1 905 238 2243 Fax 1 905 238 2414 Fax 1 858 715 5545 LATIN AMERICA Mexico Sales Office Panasonic de Mexico S A de C V PANAMEX Amores 1120 Col Del Valle Delegacion Benito Juarez C P 03100 Mexico D F Mexico Tel 52 5 488 1000 Guadalajara Office Sucursal Guadarajara Av Lazaro Cardenas 2305 Local G 102 Plaza Comercial Abastos Col Las Torres Guadalajara Jal 44920 Mexico Tel 52 3 671 1205 9 Brazil Sales Office Panasonic do Brasil Ltda PANABRAS Caixa Postal 1641 Sao Jose dos Campos Estado de Sao Paulo Brasil Fax 52 5 488 1073 Fax 52 3 671 1256 Tel 55 12 3935 9000 55 12 3931 3789 EUROPE Europe Sales Office Panasonic Industrial Europe GmbH Germany Sales Office Hans Pinsel Strasse 2 85540 Haar Germany Tel 49 89 46159 119 49 89 46159 195 PIE ASIA Singapore Sales Office Panasonic Semiconductor Sales Asia PSCSA 300 Beach Road 16 01 the Concourse Singapore 199555 the Republic of Singapore Tel 65 6390 3688 Malaysia Sales Office Panasonic Industrial Company M Sdn Bhd Head Office 15th Floor Menara IGB Mid Valley City Lingkaran Syed Putra 59200 Kuala Lumpur Malaysia Tel 60 3 2297 6888 Fax 60 6 2284 6898 Penang Office Suite 20 07 20th Floor MWE Plaza No 8 Lebuh Farquhar 10200 Penang Malaysia Tel 60 4 201 5113 Johore Sales Office Menara Pelangi Su
105. and the path name 1d103 L usr lib lsample lib sample2 lib progl rf prog2 rf The files sample lib and sample2 lib will be searched for in the directory usr lib Default specification Library files specified by the 1 option will be read 104 Command Options 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 Rules of use This option does not use the slash or hyphen option specification character It specified alone followed by the parameter file name 1d103 pfile NOTE Comments may be inserted into parameter files by starting them with a sharp The linker ignores everything from the sharp to the end of the line Default specification Not applicable Operational example Assume the following contents for pfile main ex gm TGCODE 80000000 progl rf TGDATA f0000000 prog2 rf Then specifying the following two commands is equivalent 1d103 pfile ld103 o main ex gm T CODE 80000000 progl rf TGDATA f0000000 prog2 rf Comman
106. ate BRA label BRA label JMP label JMP label JMP label BRA label JMP label JMP label CALL label CALL label CALL label CALLS label CALLS label CALLS label JSR label JSR label JSR label 52 Usage Example 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 dis placement data The user thus obtains optimal code size without having to worry about instruction vari ants The following table shows the possibilities for optimizing data transfer arithmetic logical bit manipu lation and user defined instructions Table 4 10 optimization of data transfer arithmetic logical bit manipulation Source instruction First Candidate Second Candidate Third Candidate MOV lt abs MOV abs16 An MOV abs32 An abs Dn MOV abs16 Dn MOV abs32 Dn MOV d An An MOV d8 An An MOV d16 An An MOV 432 An MOV d An Dn MOV 48 An Dn MOV 416 An Dn MOV 432 An Dn MOV d SP An MOV d8 SP An MOV dl6 SP An MOV d32 SP An MOV d SP Dn MOV d8 SP Dn MOV 416 SP Dn MOV d32 SP Dn MOV An abs MOV An abs16
107. ated 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 When specifying multiple files separate them with spaces Files without path specifications are assumed to be in the current directory The map file and executable file are always generated in the current directory regardless of any path specifications on the relocatable object files The default names for the executable file and the map file are m103 ex and m103 map respectively The o option is available for creating the executable file in a directory other than the current directory The map file is created in the same directory as the executable file 86 Starting Linker Summary of Options Chapter 6 Using Linker options Table 6 1 Linker options Option Type Symbol Description Output file options 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 Output error and warning messages in Japanese Je Output error and warning messages in English Js Output error and warning messages in Japanese using Shift JIS encoding Jj Output error and warning messages in Japanese using JIS encoding e Output error and warning messages in English W number Do
108. atements 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 Coding rules When coding a label insert at least one space or tab between it and the operation field When the label field is omitted replace it with at least one space or tab Both upper case and lower case letters may be used Insert at least one space or tab between the operation field and operand field The assembler and linker optimization function will adjust conditional and unconditional branch instructions to generate the optimal code When a relative address is specified in an operand and only labels with specific addresses are coded the assembler will calculate and set the relative values Coding examples START mov DO 0 src register dst register indirect mov 0 11 DO src immediate data dst register not DO snegate rol DO rotate left ror DO rotate right and OxOf DO logical AND or 0x30 DO logical OR DO D1 exclusive OR add D1 DO addition sub Dili ADO subtraction mul D1 DO multiplication divu D1 DO division cmp 0x05 DO comparison bra SUBR unconditional branch jmp 0 sunconditional branch register indirect
109. ation to the executable format file A 1d103 m g T CODE 00 800000000 T CODE 01280005000 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 rf and program4 rf in the current directory assigning the starting address 80000000 hex to section CODE 00 and the starting address 80005000 hex to section CODE 01 and creates an executable file m103 ex including debugging information and a map file m103 map in the current directory Parameter file during linking The following command was input to link A gt 1d103 m g T CODE 00 800000000 T CODE 01 80005000 program3 rf program4 rf Repeated input of lines like this is tedious and prone to errors For this reason the very convenient option is provided with the linker With an editor create a file PFILE the name can be freely chosen with the following contents The contents of pfile are as follows m g T CODE 00 80000000 T CODE 01 80005000 program3 rf program4 rf This file is called a parameter file If the option is specified when linking the linker will read a parameter file and will interpret its contents as command options for execution The two specifications below will be equivalent 1d103 PFILE 1d103 m g 00 80000000
110. ave different version numbers Check that the assembler and C compiler are the most recent versions 2321 Illegal location counter The location counter value for an org direction has an illegal value Change the location counter value for the org directive 2322 Operand not need There is a superfluous operand Eliminate the superfluous operand 2323 Include file cannot read There is a mistake in the file name specification Check the file name specification 2324 Too many else There are too many else Check the else specification 2325 Too many if or endif The if and endif are not balanced Check the if and endif 2326 Missing endm A macro statement is missing its closing endm Check all macro and endm statements 2327 Macro symbol is used recursively A macro is defined recursively Check the macro definitions Assembler Errors 255 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
111. block2 fendif Coding rules ifgt Syntax for ifge ifg expression block1 else block2 endif If the value of expression is positive block 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 If it is negative and an else directive has been coded block2 will be assembled Note that 0 is not included in positive numbers Usage example A source file that uses ifgt is shown below PUBLIC 1 DEVICE equ 1 _ TEXT section CODE ifgt DEVICE 1 mov 0x01 DO else mov 0x02 DO endif ifge DEVICE 1 mov 0x03 D1 else mov 0x04 D1 endif 200 Conditional Assembly 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 lst Page 1 KA PanaX Series MN1030 Cross Assembler LEK Loc Object Line Source 1 DEVICE equ 1 2 3 _ TEXT section CODE PUBLIC 1 4 ifgt DEVICE 1 5 mov 0 01 DO 6 ls 00000000 8002 7 mov 0x02 DO 8 ndif 9 ifg DEVICE 1 00000002 8503 10 mov 0x03 D1 11 15 12 mov 0x04 D1 13 ndif Conditional Assembly 201 Chapter 10 Writing Assembler Control Statements 10 4 6 ifb ifnb
112. cation Warning messages are output Wall Do not output any warning messages Function description This option suppresses output of all warnings detected during linking Rules of use This option is specified with the slash or hyphen option specification character followed by the letters Wall 1d103 Wall main rf sub rf Default specification Warning messages are output 96 Command Options Chapter 6 Using Linker 6 3 3 Program Generation Options SSS ee 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 This information includes the following Names and addresses of variables Detailed information on variables e Correspondences between line numbers and code addresses With this information debugging is much easier since the user can specify variables by name instead of by address NOTE The g option must also be specified when assembling If the g option is not specified for either the assembler or linker debug information will not be output to the executable format file EX If files assembled with the g option and files not assembled with the g option are linked with the g option debug information will be output only for the files assembled with the g option Rules of use This option is specified
113. ch instruction Branch within the 4 gigabyte memory space JMP label JSR label 46 Usage Example Chapter 4 Optimization Table 4 3 Data Transfer Instructions Subject To Optimization Instruction Type Branch Range MOV abs An MOV abs Dn MOV An abs MOV Dn abs MOVBU abs Dn MOVBU Dn abs MOVB abs Dn MOVB Dn abs MOVHU abs Dn MOVHU Dn abs MOVH abs Dn MOVH Dn abs Absolute addressing 16M byte memory space MOV d An An MOV d An Dn MOV d SP An MOV d SP Dn MOV An d An MOV An d SP MOV Dn d An MOV Dn d SP MOVBU d An Dn MOVBU d SP Dn MOVBU Dn d An MOVBU Dn 4 SP MOVB d An Dn MOVB d SP Dn MOVB Dn d An MOVB Dn d SP MOVHU d An Dn MOVHU d SP Dn MOVHU Dn d An MOVHU Dn d SP MOVH d An Dn MOVH d SP Dn MOVH Dn d An MOVH Dn d SP Register relative indirect addressing Branches possible to anywhere in the 4 gigabyte memory space MOV imm An MOV imm Dn Immediate addressing 32 bit immediate data Usage Example 47 Chapter 4 Optimization Table 4 4 Arithmetic Instructions
114. character Usage example Source file contents are shown below The first line replaces data with the character 5 The next line is an example of changing a mnemonic so mov data DO can be coded as load define data 5 define load mov data DO CODE section CODE PUBLIC 2 main mov data DO load end Identifier Definement 187 Chapter 10 Writing Assembler Control Statements 10 3 2 undef Syntax undef identifier 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 Coding rules The identifier for an undef directive must be the same string as the identifier for the corresponding define directive The string is case sensitive Usage example A source file that uses undef is shown below define define CODE undef undef define define datal data2 section mov mov datal mov data2 mov mov end 0 11 0 22 CODE da da da da da da da tal ta2 tal tal ta2 tal ta2 PUBLIC DO D1 DO DO D1 0x33 0x44 2 188 Identifier Definement Chapter 10 Writing Assembler Control Statements 10 4 Conditional Assembly The cross assembler provi
115. cludes an instruction whose value will be the object of optimization during linking The machine language code does not indicate the final values Line number Line The assembler adds a line number to each source statement 268 Reading List Files 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 xs 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 10 include include include 10 include include include If the Li option is added when the assembler is invoked output of lines included by include directives will be suppressed X The suffix on the line number indicates a line that the assembler ignores and does not process During conditional assembly this is used for lines in the block of the unfulfilled condition If the Lc option is added when the assembler is invoked output of blocks of unfulfilled conditions will be suppressed Line numbers followed by a plus sign indicate the line was a result of macro expansion In addition to macro expansions defined by macro directives a plus sign is added to expansions by irp and rept directives Reading
116. d Options 105 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 1d103 h NOTE Even if the h option is not specified input of Id103 alone will also display the help screen When displaying help information version number is also displayed on the screen Default specification Help information will not be displayed to the screen V Display the linker s version number on the console Functional description This option displays the linker s version number on the console Rules of use This option is specified with the hyphen option specification character followed by the lower case letter v ld103 v Default specification Version number will not be displayed on the console NOTE If not specifying v option and input Id103 a version number is displayed In this case the help information is also displayed 106 Command Options 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 sup
117. d an error in the assembler or linker Example sec section CODE PUBLIC 1 TEXT section CODE PUBLIC 1 mov sec 0 Expressions 137 Chapter 8 Writing Source Statements 8 7 1 Operators There are three types of operators e Arithmetic operators e Shift operators Logical operators Arithmetic operators Arithmetic operators perform the four standard arithmetic calculations Operator Meaning Multiplication Division Modulo operator remainder Addition Subtraction Unary plus positive Unary minus negative Formats Example operand operand2 123 LABEL operand operand2 123 10 operand 1 operand2 COUNT 4 operand 1 operand2 SATRT 0x10 operand 1 operand2 STACK 16 operand SIGN operand SIGN Shift operators The shift operators shift to the left or right in bit units Operator Meaning gt gt Logical right shift lt lt Logical left shift Formats operand gt gt countADDRESS gt gt 3 3 bit right shift operand lt lt countADDRESS lt lt 4 4 bit left shift Binary 0 zero will be shifted in Shifted out bits will be lost 138 Expressions Chapter 8 Writing Source Statements Logical operators Logical operators perform calculation in bit units Operator Meaning amp Logical AND Exclusive OR Logical OR Unary negation 175 complement Formats
118. d check the disk for hardware errors 3511 filename Cannot make output file There is a problem creating the output file Check the file system capacity and other factors affecting file creation 262 Linker Errors 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 If there are no problems there reassemble the corresponding source file and check the disk for hardware errors 3514 filename Illegal relocation optimization data format line lineno The relocation optimization data in the specified input file is in the wrong format Check the specified line in the source file 3515 Section size overflow The section s layout overflows the upper bound of memory If a map file is available check that Re evaluate the options for specifying section layout or the program itself 3516 Section address overlay Sections have relocation address that overlap If a map file is available check that Re evaluate the options f
119. ddress 0 The remaining sections are assigned using the rule 2 mentioned above NOTE If a section has been divided into two or more parts sections a starting address of the lowest section is referred to the section name Operation example The following are examples of section layout for two files main rf and sub rf in the current directory Both files contain multiple CODE and DATA sections 1d103 main rf sub rf The linker merges the CODE sections in the order that they appear in the input files starting at address 0 It merges the DATA sections in the order in which they appear starting at address 0 It merges the DATA sections in the order in which they appear ld103 T CODE 80000000 TGDATA 0 main rf sub rf The linker merges the DATA sections in the order that they appear in the input files starting at address 0 It merges the CODE sections in the order in which they appear starting at address 80000000 hex ld103 T CODE 80000000 main rf T DATA 0 sub rf Command Options 99 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 For specifying a parameter of _T option a parameter file can not be used because the character would not b
120. defined by define Identifier has not been defined ifndef Identifier has not been defined by define Identifier has been defined T f Expression value is not 0 Expression value is 0 ifn Expression value is 0 Expression value is not 0 ifeq Parameters 1 2 are the same string Parameters 1 and 2 are not the same string see note ifneq Parameters 1 and 2 are not the same string Parameters and 2 are the same string see note iflt Expression value is negative Expression value is not negative ifle Expression value is 0 or negative Expression value is not 0 and not negative ifgt Expression value is positive Expression value is not positive ifge Expression value is 0 or positive Expression value is not 0 and not positive ifb Parameter is the null character Parameter is not the null character see note ifnb Parameter is not the null character Parameter is the null character see note NOTE These directives can be used only within macro definitions 190 Conditional Assembly Chapter 10 Writing Assembler Control Statements 10 4 1 ifdef ifndef Syntax Syntax for ifdef Syntax for ifndef ifdef identifier ifndef identifier block1 block1 else else block2 block2 endif endif Functional description ifdet 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 b
121. des 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 The actual program structure of conditional assembly is shown below dif expression identifier parameter etc block1 to be assembled if condition is true ls block 2 to be assembled if condition is false ndif NOTE The contents of brackets from else on can be omitted The basic function of conditional assembly directives are for the assembler to evaluate the condition specified by if and then to select the block to assemble based on the result Conditional assembly directives are used for the following purposes Different object code for different versions can be output with a single source program Machine language instructions differ depending on the device type Conditional assembly directives can be included in programs being debugged Conditional Assembly 189 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
122. different extensions for map files and list files You can only specify whether or not to output these files However the extensions of relocatable object files and the executable format file can be changed with assembler and linker option specifications In this case the file specification must include the extension 24 Files Used by Assembler and Linker Chapter Introduction to Operation 3 3 Basic Operation of Assembler and Linker X X 25 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 These two files have related external references and external definitions where the subroutine of program2 asm is called from program1 asm Therefore the final list files cannot be created just by assembling programl asm In this example you will generate with the linker a map file and generate the final list files Create source files First create the source files Using an editor create the two programs shown below program1 asm and program2 asm The contents of programl1 asm are as follows global data set CODE sect
123. directives in source statements may be omitted The statements to be assembled can instead be selected by specifying identifiers with the D option as needed Thus the D option allows conditions to be set freely at the assembly stage without fixing the conditions with define directives in source statements There are two conditional assembly directives that can make use of the D option ifdef ifndef No error will occur if identifiers specified by the D option are not used in the source file Assembly will process as though conditions are unfulfilled Rules of Use This option is specified with the hyphen option specification character followed by the upper case letter D then followed by the identifier A space can be inserted between D and the identifier The identifier must exactly match the string specified by ifdef Characters are case sensitive 103 D VERSION sample asm Default Specification Unfulfilled conditions will be selected The else to endif blocks will be assembled Command Options 77 Chapter 5 Using Asssembler 5 3 4 Program Generation Options SSS re 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 This information includes the following Names and addresses of variables Detailed information on variab
124. dress format In addition there may be addresses unresolved until after link processing due to forward references optimization etc Refer to chapter 4 Optimization Basic Operation of Assembler and Linker 27 Chapter 3 Introduction to Operation The contents of the final list file program1 Ist are as follows Loc 40000000 40000000 40000002 40000005 40000008 40000010 40000014 40000024 Symbol Object 9000 2 00 208000 F8FEFCFCFF0C0000 00F8FEO04 CAF2 00000000 Table 40000016 40000000 40000024 programl lst Page 1 PanaX Series MN1030 Cross Assembler Line 10 OF WN S 13 programl lst Page 2 Source global CODE section main mov mov mov jsr bra DATA section datal ds end data set main datal data set CODE PUBLIC 0 AO Oxff DO 0x80 D1 data set main DATA PUBLIC 4 i 4 28 Basic Operation of Assembler and Linker Chapter 3 Introduction to Operation The contents of the final list file program2 Ist are as follows Loc 400 400 400 400 400 400 400 400 400 400 400 Er Co x program2 1st Page 1 PanaX Series 1030 Cross Assembler Object Line Source ab global data_set 2 3 _CODE section CODE PUBLIC 1 0016 4 data_set 0016 8A00 5 mov 0 D2 6 0018 7 data_set_ loop 0018 6 8 D
125. e considered as an attribute specifying letter In addition the description should include the option in order to use a parameter file 100 Command Options 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 Rules of use This option is specified with the hyphen option specification character followed by the lower case letter r ld103 r progl rf Default specification An executable format file will not be generated It is also possible to force creation of executable file by default with an entry in the linker s start up file See Chapter 1 Getting Started Section 1 5 Setup Command Options 101 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
126. e 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 Host machine Message language Sun Sparc English DOS V Japanese in Shift JIS PC AT English It is also possible to change the default message specification with an entry in the assembler s start up file See Chapter 1 Getting Started Section 1 5 Setup 74 Command Options 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 as103 W 2001 sample asm Default Specification The default is to display all warning messages Wall Do not output any warning messages Functional Description This option suppresses output of all warning messages generated during assembler operation Rules of Use To specify the option enter the hyphen followed by the letters Wall
127. e instruction set e MN1030 Series C Compiler User s Manual Usage Guide Describes the installation the commands and options of the C Compiler e MN1030 MN103S MN103E Series C Compiler User s Manual Language Description Describes the syntax of the C Compiler e MN1030 MN103S MN103E Series C Compiler User s Manual Library Reference Describes the standard library of the C Compiler e MNI0930 Series C Source Code Debugger for Windows User s Manual Describes the use of the C source code debugger for Windows e MN1030 MN103S MN103E Series Onboard Debug Unit Setup Manual Describes the connection of the Debug Unit and explains about initial settings of the Onboard Debugger e MN1030 MN103S Series Installation Manual lt Describes the installation of the C compiler cross assembler and C source code debugger and the procedure for bringing up the in circuit emulator gt lt About This Manual 3 gt Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter Chapter c o N O Ci A C N me 0 N A A C N Oo Getting Started Program Development Flow Introduction to Operation Optimization Using Assembler Using Linker Types of Source Statements Writing Source Statements Writing Machine Language Instruction Statements and Directive Statements Writing Assembler Control Statements Writing Macro Cont
128. e list are D2 D3 A2 A3 and OTHER where OTHER indicates DO D1 AO Al MDR LIR A register specification other than these five results in an error NOTE When writing directive statements in between the function and label name it may not link properly or it may create a bad execution format NOTE Optimization can be performed for the instructions between label name and the function name For details see Chapter 4 Optimization Functions Section 4 3 Usage Examples Optimization of function calls Directive Specification Rules The funcinfo directive must always define a branch target label for use with the call instruction Writing Directive Statements 177 Chapter 9 Writing Machine Language Instructions and Directive Statements Usage Example The following gives an example of funcinfo usage global _Ofunc _TEXT section CODE PUBLIC 1 call _Ofunc global Ofunc func TEXT section CODE PUBLIC 1 func movm D2 SP add 4 SP Ofunc funcinfo 8 LDZ ret NOTE 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 For this reason the ret and retf instructions cannot precede the funcinfo directive 178 Writing Directive Statements Chapter 9 Writing Machine Language Instructions and Directive Statements 9 4 19 assig
129. e name exists in the library file that file name will be output If the file does not exist the library manager will output a warning message and continue processing When no relocatable object file name is specified the names of all relocatable object files that exist in the library file will be output Rules of use To specify the option enter the hyphen followed by the lower case letter t 5110103 test lib t testl rf Operation example Slib103 test lib t testl rf Slib103 test lib t The first example checks whether or not the file test1 rf exists in test lib The second example outputs the names of all relocatable object files in test lib 288 Command Options 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 If the file does not exist the library manager will output a warning message and continue processing When no relocatable object file name is specified all relocatable object files that exist in the library file will be extracted Rules of use To specify the option enter the hyphen follow
130. e next instruction LCC lt unsigned If CF 0 branch to the top of the loop as specified with SETLB CF 0 If CF 1 execute next instruction LLS gt unsigned If CF 1 or ZF 1 branch to the top of the loop as specified with SETLB If CF 0 and ZF 0 execute next instruction LCS lt unsigned If CF 1 branch to the top of the loop as specified with SETLB CF 1 If CF 0 execute next instruction LRA 1 Unconditionally branch to the top of the loop as specified with SETLB Mnemonic Description of operation SETLB Store the four bytes following the SETLB and the address of the fifth byte in the Loop Instruction Register LIR and the Instruction Fetch Address Register LSR respectively 246 List of Machine Language Instructions Chapter 12 List of Machine Language Instructions 12 3 6 User Defined Instructions NENNEN User Defined FUNCTION Mnemonic 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 UDFnn Dm Dn 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 Compute with the contents of Dn and the sign extended imm8 sign UDFnn imm Dn extended imm16 or imm32 and store the result in Dn The nature of the calculation and the effects on the flags are user defined If nn is betwe
131. e that order is the order in which the linker merges sections Section layout rules The sections are merged according to the following rules 1 Sections appearing with T option specifications are assigned to the specified addresses 2 The remaining sections with no such specifications are arranged with the CODE sections proceed ing the DATA sections using the following rules Sections with the same name and same attribute are merged after the sections with the highest address b Sections with the same attribute are merged after the sections with the highest address c Remaining sections are merged after the sections with the highest address Figure 6 2 illustrates the process 98 Command Options Chapter 6 Using Linker Section layout with T option specification Fixed layout 0x00000000 _TEXT CODE 0x00000000 TEXTGCODE b rf b rf _CONST CODE _CONST CODE b rf 0x20000000 0x20000000 _TEXT CODE Sections without GCONSTGCODE _TEXT CODE _GCONST CODE _ROM CODE b rf erf _ROM CODE _DATA DATA b rf b rf _DATA DATA b rf _TEXT CODE arf Oxffffffff Oxfffffftf 4103 a rf T TEST CONST 0 1 TEST GCONST 20000000 c rf Figure 6 2 Memory Space Layout Default specification When there are no address specifications whatsoever the first section in the first file is assigned to a
132. e warning number and the text of the message After displaying the warning message the library manager continue processing An error message notifies the user of an error and consists of the marker error the error number and the text of the message A fatal error message notifies the user of a system error and consists of the marker Fatal error the error number and the text of the message The library manager aborts after displaying the message The following pages list the error messages that may appear during library manager operation The list uses the following format How to read The meanings of each entry in the error message tables are as shown below error_number displayed_message cause solutions 292 Error Messages Chapter 15 Using Library Manager 15 4 1 Warning Messages eC 77 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 In this case slib103 adds the file to the library Check whether the object file to be replaced is in the library Error Messages 293 Chapter 15 Using Library M
133. ecified with abs32 This instruction proceeds through the following three stages 1 Transfer with zero extension the 8 bit contents of the memory location specified with An to a 32 bit internal temporary register BCLR 2 AND the temporary register with the contents of Dm and set the flags according to the result 3 AND the temporary register with the ones complement of the contents of Dm and store the lowest 8 bits of the result in the memory location specified with An This instruction proceeds through the following three stages 1 Transfer with zero extension the 8 bit contents of the memory location specified with d8 and An 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 AND the temporary register with the ones complement of zero extended imm8 and store the lowest 8 bits of the result in the memory location specified with d8 and An BCLR imme d8 An List of Machine Language Instructions 241 Chapter 12 List of Machine Language Instructions Mnemonic 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 BCLR imm8 abs32 2 AND the temporary register with zero extended imm8 and set the flags according to the result 3 AND the temp
134. ed 1 2 Operating Environment E This system runs on the following workstations personal computers and compatibles Host machine Operating system Version of OS Sun Sparc Solaris 2 6 or later PC AT Windows 98 Me 2000 XP DOS V Windows 98 Me 2000 XP For the PC AT and compatibles because of such differences as the ability to display Japanese this Manual indicates a machine running the English only operating system as a PC AT and one running the Japanese operating system as a DOS V machine Refer to the Release Notes for other restrictions Operating Environment 3 Chapter 1 1 3 Getting Started 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 19103 linker 1d103 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 excv103 file conversion utility This utility converts an executable produced by the linker into a file in Motorola S format Intel HEX format or Matsushita format In addition to the above files the installation media may contain a README or README DCC file containing late breaking news missing from this Manual Please read this file carefully before proceeding 4 File Organization
135. ed by the lower case letter x Slib103 test lib testl rf Operation example Slib103 test lib x testl rf Slib103 test lib x The first example checks whether or not the test1 rf exists in test lib and if it does extracts test1 rf The second example extracts all relocatable object files in test lib NOTE When an object file is extracted it will overwrite any file of the same name existing in the current directory Command Options 289 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 Rules of use This option uses neither a hyphen nor an option letter Enter alone followed by the name of the parameter file 5110103 pfile Default specification There is no default specification Operation example Assume that the file pfile contains the following line test lib f testl rf test2 rf test3 rf 5110103 pfile 5110103 test lib f testl rf test2 rf test3 rf The above command line then produces the same result as the following one 290 Com
136. ediately before it is referenced The instruction RAM status management table is for use by the debugger in determining how the instruction RAM is currently being used 110 Instruction RAM Support 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 Specify address in instruction RAM for a section section address 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 Note that this processing applies only to those relocatable object files between the current OVL option to the next T or OVL option or end of line Sections without OVL specifications are processed in accordance with the T specifications The linker merges all sections matching the OVL specification and places the result in the external memory starting immediately after the highest section with the CODE attribute NOTE The linker produces an error message if the relevant object files do not contain the specified section Specifying an OVL option without a following file produces the same result Rules of use This option is specified with the hyphen option specification character followed by the upper case letters OVL the ID number a colon the sectio
137. ee eA EUR 184 10 5 Identifier Define ments is ioo irt err n EGER ERE EE PER 186 10 3 T sdefine REI RE 187 10 3 2 undef oO HR ton OH 188 10 4 Conditional Assembly teca ie ERR e e ste Eine Late cus ce 189 10 41 f fndet coe eene upon o emet 191 10 4 2 Tu fn aep iU ERI whee 193 10 4 3 feq PINEA n oer teat eroe aedes 195 10 4 4 tlt HALLE so ox e tesoro et tree iet odi eite qe pei e de 198 10 45 PALS HAE GS eoe ro emen reget Ep EBD GER 200 10 46 ifb ch sete 202 Chapter 11 Writing Macro Control Statements TIL Purpose of This cc poem Retirer DO HE ns Ga ces 206 11 2 Macro Definitions macro endm ssssssssssessesesee eene enne nnne enne enne nenne ener nennen enne e nnn 207 11 3 Macro Calls and Expansion eee testet te te Hitt ete cuvach sepuadbucbsetuaseseencecbeuscesy 209 11 4 Macro Operators ose veg eogne deg ved st dug een gie HEP HEU PUT 211 11 5 Local Symbol Declaration local eese esses enne enne enne nennen neret netten en 213 11 6 Forced Termination of Macro Expansion exitm esses nennen enne nnne 215 11 7 Purging Macro Definitions 217 11 8
138. eei e e eet a e etes 296 Chapter 16 Notes on Operating Environment 16 1 Purpose OL This Chapter ie iet cre ende ids 298 16 2 Personal Computer Versions 2224 0 1 1 0000 299 16 2 1 Operating Environment ir cen Ul e ur iet pietate te 300 1622 2 EXes uc snERORUBRORERRGCSERO T ine i 301 16 2 3 Installaatiot be to dba nie eei eene ee ie eee idi 302 16 2 4 Environment Set ngs oe tene Umm Peel meet 303 16 2 5 Differences From Workstation Versions 305 16 2 6 Error Correction Using Tag 2 00 1 1 306 Chapter 17 Appendix 17 1 Numernc Restrictions dp Immediate 310 17 2 Lastof Command Options ete ete de ree IER 311 17 2 1 List of Assembler Command Options sse nennen 312 17 2 2 List of Linker Command Options essent nennen erret nennen 315 17 3 List of Assembler 318 17 4 List of Assembler Control Statements 321 5 TOC gt Chapter 1 Getting Started 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 2 Purpose of This Chapter Chapter 1 Getting Start
139. egister An and a data register Dn to yield a displacement Rss Address specification 230 Addressing Modes Chapter 12 List of Machine Language Instructions 12 3 List of Machine Language Instructions BE Symbol Description An Am Address register n m 3 to 0 Dn Dm Data register n m 3 to 0 Di Index a data register i 0 1 2 3 SP Stack pointer register imm Immediate data imm8 8 bit immediate data specified with an instruction imm16 16 bit immediate data specified with an instruction imm32 32 bit immediate data specified with an instruction abs16 A 16 bit absolute address specified by the instruction abs32 A 32 bit absolute address specified by the instruction d Displacement data d8 8 bit offset data specified with an instruction d16 16 bit offset data specified with an instruction d32 32 bit offset data specified with an instruction MDR Multiply divide register LIR Loop instruction register LAW Instruction fetch address register PSW Program status word CF Carry flag ZF Zero flag NF Negative flag VF Overflow flag PC Program counter regs Specification of multiple registers Indicates an indirect address List of Machine Language Instructions 231 Chapter 12 List of Machine Language Instructions 12 3 1 Data Move Instructions MOVE source to destination
140. either immediately followed by the path name and file name or a space and the path name and file name The option must be coded end of the command line 1d103 1 usr lib sample lib main rf sub rf Default specification No library files will be read NOTE The linker will search for a library file one time only in order to solve the problem of the undefined symbols For instance if an undefined symbol has defined in the former library file the linker could never solve the problem and a error message will be appeared Be sure to specify the library file at the end of the command line of the undefined symbol Object files would not limit any restriction Command Options 103 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 If any library file is not found the linker outputs an error message to terminate operation Rules of use This option is specified with the hyphen option specification character followed by the upper case letter then either immediately followed by the path name or a space
141. elds 149 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 When two operands are coded they must be delimited by a comma Coding examples ROL DO One operand mov CONST 3 DO Operands are register and expression 392 Operand is an address 150 Instruction Statement Fields 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 Comment fields may be written with letters digits special characters and control characters other than carriage return and line feed Coding examples mov 0x10 DO Set count value Instruction Statement Fields 151 Chapter 9 Writing Machine Language Instructions and Directive St
142. embler restrictions Numeric Restrictions ins Numeric Restriction Characters per symbol 255 characters Characters per line 1022 characters Lines per file Certain restrictions apply to source files with 65536 lines or more Linker restrictions Numeric Restriction Number of OVL options 255 Directive restrictions Numeric Restriction Section directives Number of distinct section names 255 Assembler control directive restrictions Item Numeric Restriction Include nesting levels 3 levels ifXX nesting levels 255 levels Macro directive restrictions Item Numeric Restriction Macro nesting levels 20 levels Macro local symbols 30 symbols within one macro definition Parameter file restrictions Item Numeric Restriction String length 1024 characters 310 Numeric Restrictions 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 f functional_description option_name specification_example List of Command Options 311 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 103 options source_
143. en 00 and 15 compute with the contents of Dn and the zero extended imm8 zero extended imm16 imm32 and store the result in Dn The nature of the calculation and the effects on the flags are user defined UDFUnn imm Dn List of Machine Language Instructions 247 Chapter 12 List of Machine Language Instructions 12 3 7 Other Instructions NO OPERATION Mnemonic Description of operation NOP Do nothing 248 List of Machine Language Instructions Chapter 13 Error Messages 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 e Errors e 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 con tinues processing An error message notifies the user of an error and consists of the marker Error the error number and the text of the message A fatal error message notifies the user of a system error and consists of the marker Fatal error the error number and the text of the message The assembler or linker aborts after displaying the message 250 Purpose of This Chapter Chapter 13 Error Messages 13 2 Assembler Errors SSS SSS SSS The assembler displays th
144. ension the 8 bit contents of the memory location specified by Di and Am to Dn MOVB Dm Di An Transfers the lowest 8 bits of Dm to the memory location specified by Di and An MOVHU Di Am Dn Transfers with zero extension the 16 bit contents of the memory location specified by Di and Am to Dn MOVHU Dm Di An Transfers the lowest 16 bits of Dm to the memory location specified by Di and An MOVH Di Am Dn Transfers with sign extension the 16 bit contents of the memory location specified by Di and Am to Dn MOVH Dm Di An Transfers the lowest 16 bits of Dm to the memory location specified by Di and An MOV abs16 Dn Transfer the 32 bit contents of the memory location specified by abs16 to Dn abs16 is zero extended 234 List of Machine Language Instructions Chapter 12 List of Machine Language Instructions Mnemonic Description of operation Absolute MOV abs32 Dn Transfer the 32 bit contents of the memory location specified by abs32 to Dn MOV abs16 An Transfer the 32 bit contents of the memory location specified by abs 16 to An abs16 is zero extended MOV abs32 An Transfer the 32 bit contents of the memory location specified by abs32 to An MOV Dn abs 16 Transfer the contents of Dm to the memory location specified by abs16 abs16 is zero extended MOV Dm abs32 Transfer the contents of Dm to the memo
145. erand coding rules The end directive takes no operands If operands are coded they will cause an assembler syntax error Usage example Below is an example use of the end directive CODE section CODE PUBLIC 2 main jsr data move mov 0 DO end 158 Writing Directive Statements Chapter 9 Writing Machine Language Instructions and Directive Statements 9 4 4 listoff liston Syntax label operation operand name listoff 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 NOTE The listoff and liston directives themselves are output Only output to the list file will be suppressed Output of object code will not be suppressed at all Operand coding rules These directives take no operands Usage example Below is an example use of the listoff and liston directives The mov 0x22 D0 is a statement that should not be output to the list file CODE section CODE PUBLIC 2 main mov Ox11 DO listoff mov 0x22 DO liston mov 0x33 DO end Writing Directive Statements 159 Chapter 9 Writing Machine Language Instructions and Directive Statements 9 4 5 notation S
146. ess of section CODE 00 is address 80000022 hex This shows that it has been linked after the same section existing in program3 36 Assembling and Linking Multiple Sections Chapter Introduction to Operation program locations after linking program locations in the executable file after linking as above are shown below 0X0000 ib Unused E 0X080000 i main 0X080016 time_filler 0X08001E Unused 4 0X080200 data_set 0X08020E data1 0X08021 1 met 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 Sections with the same section name and section attributes are merged in the order specified to the linker that is in the order in which they appear in the object file names following the linker options Rules for joining sections Join in the order in which the sections appear during linking Join sections for which both name and attribute match Join sections for which either name or attribute match For further details see Chapter 6 Using the Linker Section 6 3 Command Options Section 6 3 3 Program Generation Options Assembling and Linking Multiple Sections 37 Chapter 3 Introduction to Operation 3 5 Conditional Assembly and Linking The Cross Assembler provides many assembler directives Assembler directives are not converted directly
147. f Source statements of unfulfilled conditions and macro expansion source will not be output 82 Operation Examples Chapter 6 Using Linker 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 In addition the linker also resolves forward references For programs in section address format the start address of each section is specified when linking The linker links relocatable object files by section in the order specified by the link command and outputs an executable format file Relocatable Object Files Executable Format File 0x00000000 sectionA Start Addresses PROGRAM1 PROGRAM1 RF sectionA 0x00000000 sectionB 0x00000000 sectionC 0x00000000 sectionA PROGRAMS 0x40000000 sectionB PROGRAM1 PROGRAM2 RF Linker sectionB PROGRAM sectionB PROGRAMS PROGRAMS RF 0x80000000 sectionC PROGRAMe Figure 6 1 Link Model of Section Address Format 84 Purpose of This Chapter Chapter 6 Using Linker 6 2 Starting Linker The li
148. f X def X def Hexadecimal Odef Coding rules Binary Start with letter B b and enclose binary digits in single quotation marks When the default is binary code the binary number as is Octal Start with letter O or o and enclose octal digits in single quotation marks When the default is octal code the octal number as is Decimal Start with letter F and enclose decimal digits in single quotation marks When the default is decimal code the decimal number as is Hexadecimal Start with letter X or x and enclose hexadecimal digits in single quotation marks 7 When the default is hexadecimal code the hexadecimal number as is When the number begins with a letter prefix it with 0 zero 132 Numbers Chapter 8 Writing Source Statements 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 e Blank letters e Special characters NOTE letters make the following letters valid Example P V 9 v Character constants A character constant is stored as an ASCII code in the space of a single character The method for specifying character constants differs depending on the coding format The coding format is selected using the notation directive The default is extended C language format N
149. fferent 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 5 Local Symbol Declaration local for details A macro can be redefined The new definition will be effective from the following line on The purge directive can purge a macro definition The macro will be recognized as an instruction or symbol from the following line on The macro name cannot be the same as a machine language mnemonic The assembler does not perform syntax checks when a macro is defined If there are errors or warnings they will be output when the macro is expanded Usage example An example macro definition is shown below xchg macro mov D2 DO mov Di D2 mov Dl endm 208 Macro Definitions macro endm Chapter 11 Writing Macro Control Statements 11 3 Macro Calls and Expansion Syntax macro_name parameter parameter NOTE 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 def
150. filename Contents of brackets may be omitted Output file options Specify the relocatable object file name to be output ofile name as103 o usr obj test rf sample asm Output a list file as103 1 sample asm Do not output files included by include to the list file d 103 Li 1 sample asm Do not output assembler source created by macro expansion using macro or irp to the list Lm file 103 Lm 1 sample asm Do not output a symbol table to the list file 103 Ls 1 sample asm Do not output source statements that were not assembled due to unfulfilled conditions of conditional assembly to the list file 5103 Lc 1 sample asm Read the map file to output a list file with resolved address a map_file name 5103 1 a m103 sample asm 312 List of Command Options Chapter 17 Appendix Error message options 5 Output error and warning messages Japanese J 103 1 sample asm Output error and warning messages in Japanese using EUC encoding Je 5103 sample asm Output error and warning messages Japanese using Shift JIS encoding Js 5103 25 sample asm Output error and warning messages Japanese using JIS encoding Jj 5103 Jj sample asm Output error and warning messages in English e 103 sample asm Do not output warning messages of the specified number W number
151. ger 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 Slib103 test lib r testl rf Operation example Specify the following to replace the relocatable object file test1 rf in the library file test lib Slib103 test lib r testl rf Multiple files can be replaced with one r option To delete test1 rf test2 rf and test3 rf from test lib specify the following slib103 test lib r testl rf test2 rf test3 rf This example replaces the relocatable object files test1 rf test2 rf and test3 rf in test lib NOTE If specifying a file names with path name for relocatable object file to be switched the file name without path name exists or will be traced in the library file Command Options 287 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 sam
152. gned If CF 1 or ZF 1 execute a relative branch to the address specified by label Range 128 to 127 If CF 0 and ZF 0 execute next instruction BLT label gt signed If NF 1 and VF 1 or NF 0 and VF 0 execute a relative branch to the address specified by label Range 128 to 127 If NF 1 and VF 0 or NF 0 and VF 1 execute next instruction BHI label lt unsigned If CF 0 and ZF 0 execute a relative branch to the address specified by label Range 128 to 127 If CF 1 or ZF 1 execute next instruction BCC label lt unsigned If CF 0 execute a relative branch to the address specified by label Range CF 0 128 to 127 If CF 1 execute next instruction BLS label gt unsigned If CF 1 or ZF 1 execute a relative branch to the address specified by label Range 128 to 127 If CF 0 and ZF 0 execute next instruction BCS label lt unsigned If CF 1 execute a relative branch to the address specified by label Range CF 1 128 to 127 If CF 0 execute next instruction label 0 If VF 0 execute a relative branch to the address specified by label Range 128 to 127 If VF 1 execute next instruction BVS label VF 1 If VF 1 execute a relative branch to the address specified by label Range 128 to 127 If VF 0 execute next instruction BNC label NF 0 If NF 0 execute a relative branch to the address specified by label Range 128 to 127 If NF 1 e
153. hanges to object code not instruction mnemonics Pay close attention to this point when viewing list files When an is displayed before a line number in the list file it indicates that the statement has been optimized 44 Purpose of This Chapter 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 on NOTE Optimization is off by default Rules of Usage 45 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 Table 4 1 Optimized Conditional Branch Instructions Instruction Type Branch Range BLT label BGT label BGE label BLE label BCS label BHI label BCC label BLS label BEQ label BNE label BVC label BVS label BNC label BNS label Relative branch instruction Branch within 128 to 127 bytes of the PC Table 4 2 Unconditional Branches and Subroutine Calls Subject to Optimization Instruction Type Branch Range BRA label Relative branch instruction Branch within 128 to 127 bytes of the PC CALL label CALLS label TT Bran
154. he address 1000 103 4000 8000 A1000 sample ex Converts the data between the address 4000 the address 8000 in the file of sample ex into the data of the address 1000 Convert into a file in Intel HEX format 103 sample ex Perform conversion file into a file in Intel HEX format Convert into a file in Motorola S format 103 S1 sample ex 103 52 sample ex 103 53 sample ex Perform conversion a file into a in Motorola format S1 16 bit address format 52 24 bit address format 53 32 bit address format Convert without padding 103 sample ex Do not pad Oxff when converting Convert with padding 103 sample ex Do pad Oxff when converting 12 File Conversion Utility Chapter 2 Program Development Flow 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 14 Purpose of This Chapter Chapter 2 Program Development Flow 2 2 Program Development Flow Em eT Main development flow The microcomputers are used in such diverse applications as AV equipment house
155. hname for library files L usr lib L usr local lib lsample lib main rf Instruction RAM options OVL ID number Specify starting address for section in instruction RAM 1d1d103 T CODE 80000000 main rf sub rf section address OVL 1 TEXT 40000000 segl rf OVL 2 TEXT CONST 40000000 seg2 rf Specify address for extra symbol 1d103 T CODE 80000000 main rf sub rf PUT extra symbol OVL 1 TEXT 40000000 segl rf address OVL 2 TEXT 40000000 seg2 rf PUT _ overlay table a0000000 PUT iram manage 30000000 316 List of Command Options Chapter 17 Appendix Others Specify a parameter file 102103 8 pfile Display help information on the console i 1d103 h Display the linker s version number on the console 142103 v List of Command Options 317 Chapter 17 Appendix 17 3 List of Assembler Directives G This section provides a list of assembler directives Directives for program control Syntax Function amp Notes symbol instruction operand align expression 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 end Indicates the end of the program org expression Change the program address to the value special by expression expression label_name constant name section defi
156. hold electronics information equipment automobiles robots portable phones computer peripherals etc Programs developed with the Cross Assembler are ultimately incorporated into these products The software is developed using a source code debugger running the software on a target board which differs from the operating environment for the final application Assembler and compiler Both the assembler and C compiler can be used to develop programs for the microcomputers Compared to assembly language C language is a more productive language Programs coded using a high level language also offer superior ability for documentation On the other hand microcomputer operations can be directly coded by programming with assembly language Compared to high level languages programs can be created with more compact code size less redundancy and faster processing Given the features of both languages the main body of a program can be coded using C language while parts that require fast processing can be coded using assembly language When developing a program the programmer must first consider which language to use program structure processing speed required to meet the target performance of the end product ROM size of the device and several other related factors Program Development Flow 15 Chapter 2 Program Development Flow Source code debugger The software developed on a workstation or personal computer must be checked using
157. ied line in the source file 3310 filename Symbol name not defined with FUNCINFO line lineno The specified input file contains a CALL instruction to a label without a FUNCINFO directive Check the specified line in the source file 3311 Program ID multiplied Two or more OVL options to use different numbers Edit the OVL options to use different numbers 3312 filename Section not found specified by OVL ID id Either the target files do not contain the specified section or there are no target files Check the section specification for the specified OVL option as well as the file names following it 260 Linker Errors Chapter 13 Error Messages used as normal symbol 3313 Extra symbol name 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 Linker Errors 261 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 filena
158. ifies 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 Operand coding rules The expressions coded in the operand must result in the attribute abs absolute Refer to section 8 7 4 Expression Attributes regarding attributes of expressions Specify the number of lines in the range 10 255 Specify the number of columns in the range 60 255 If a value outside the allowable range is specified the assembler will generate an error and ignore this directive Usage example Below is an example use of the page directive page 24 80 page LINE NO COLUMN NO 164 Writing Directive Statements Chapter 9 Writing Machine Language Instructions and Directive Statements 9 49 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 The default is extended C language format The radix directive specifies the default radix for numbers in these coding formats by the expression in the operand Select one from radix 2 binar
159. ify the program 2012 Symbol name too long The symbol name exceeds the length limit Edit the symbol name so that its length is within the limit 2013 The line of the source file exceed 65535 lines Some pieces of debug information are not outputted for the instruction after the 65536th line Divide the source file into files under 65535 lines per file Assembler Errors 253 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 A section contains too much code Divide the section into smaller parts 2306 Multiple define symbol A symbol is defined more than once Use different symbol names 2307 Illegal symbol name There is an error in a symbol name Change the symbol name 2308 Label symbol is reserved word A reserved word is used as a label Change the label name 2309 Label not permitted A label specification is not permitted here
160. ifying the coding of source statements Macros must be defined before they are called The macro body is coded with multiple machine language instructions directives macro control instructions and conditional assembly control instructions A macro definition is the assignment of a name to the single process in the macro body 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 This is called macro expansion Macro definitions can have up to 10 dummy parameters Dummy parameters are used within the macro body to allow the caller to modify some of the expanded text Reference Subroutines have similar functions but macros and subroutines differ on the following points 1 Macro expansion actually writes the macro body s machine language code in the object file each time the macro is called at that call s position For subroutines the subroutine body exists at one location in the program 2 By using parameters macro expansion allows the programmer to change the expanded machine language instructions each time the macro is called For subroutines the process cannot be changed Macro Definitions macro endm 207 Chapter 11 Writing Macro Control Statements Coding rules The following instructions cannot be used within macro definitions e include directive macro directive within a macro definition another di
161. ile xlistoff Stops list output including this directive xliston Starts list output from the line following this directive funcinfo Specifies additional information for a function assign Defines a name as the value of an operand expression Document conventions Symbols used in this chapter have the following meanings Contents of brackets may be omitted Contents of parentheses may be repeated Specify one or the other of the terms delimited by a vertical bar l Writing Directive Statements 153 Chapter 9 Writing Machine Language Instructions and Directive Statements 9 4 1 section Syntax label operation operand section_name section definitionl definition2 expression definition 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 expression Alignment factor for the location counter 2 to the specified power Default settings If the section name appears for the first time in the file the following defaults are used definition CODE definition2 PUBLIC expression 1 For subsequent appearances of the section name the section inherits the values from previous appear ances Functional description The section directive specifies a section name as well as its attribute link type and location boundary During linking the l
162. ile extension EXE personal computer versions use the forward slash and backslash as directory separators NOTE Example AS103 1 0 USER TMP SAMPLE RF SAMPLE ASM Personal Computer Versions 305 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 The error correction method described in this section uses the tag jump function of editors such as MIFES etc This assumes the necessity of an error file that incorporates tag jumps Assembler error messages implement the tag jump function When the assembler detects an error it outputs an error message to the display It will also output error messages to the list file if the 1 option was specified When the 1 option has not been specified and the assembler detects errors you can assemble again such that errors are not displayed to the screen but are redirected to an error files that the assembler generates The list file will include correct source statements in which errors were not detected while the file created by redirection will consist only of source statements in which errors were detected It is acc
163. iller end rus end data set time filler CODI 0 D1 D2 D2 data_set_end DO 1 2 CODI 0 D1 time_filler_end time_filler_loop 0 2 0 data_set_loop D2 DO E PUBLIC 1 E PUBLIC 1 As can be seen from the above two files these programs are divided as follows main time filler CODE 00 data set e datal Assemble and generate list files CODE 01 DATA Next assemble the two programs Assemble with the option for output of list files in order to see what the list file is like when final addresses are not resolved as103 1 g program3 asm 103 1 g program4 asm g option Option to output debug information in the relocatable object file l option Option to output list file not normally specified at this stage before linking but specify it here to see intermediate values This will assemble the two source files program3 asm and program4 asm in the current directory It will add debug information g option to the relocatable object files program3 rf and program4 rf and Assembling and Linking Multiple Sections 31 Chapter 3 Introduction to Operation generate list files program3 lst and program4 lst respectively in the current directory 1 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 p
164. in its own chapter Explanations of how to operate the assembler and linker and how to write programs are made mostly through the use of examples Syntax usage notes and examples are given for each assembler directive assembler control statement and macro control statement Use of the library manager a tool for managing library files is also explained For users of engineering workstations EWS a separate chapter describes differences from the MS DOS version Chapters provides listings of machine language instructions and error messages as well as sample programs that demonstrate usage Reference Techniques This document supports four techniques for quickly finding the required information 1 2 3 Use the index at the front of the document to find the beginnings of chapters Use the table of contents at the front of the document to find subsection headings The chapter name and the subsection heading are listed at the top and bottom edges respectively on each page Thus the contents of each page can be seen at a glance Use the index at the end of the document to find technical terms lt About This Manual 1 gt How to read Chapter 1 Installation Heading 1 3 4 Environment Settings SSS 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
165. ined macl macro paral para2 para3 macro definition endm main macl address data count macro call In this example paral para2 and para3 are dummy parameters The parameters of the macro call are passed to the dummy parameters as follows paral address para2 data para3 count Coding rules Any string can be specified as a parameter To specify a string that includes commas or spaces use the macro operator lt gt Refer to section 11 4 Macro Operators for details If there are more parameters than there were dummy parameters in the macro definition an error will occur If there are fewer parameters than there were dummy parameters in the macro definition the assembler will process the remaining parameters as though null characters were specified In the list file the line numbers of source statements with macro calls will be prefixed by the letter M The source statements resulting from macro expansion will have a appended to the line number Macro Calls and Expansion 209 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 varl and var2 as parameters varl equ 0x10 var2
166. ing Assembler 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 Ist 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 103 1 sample asm Default Specification No list file will be output Command Options 65 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 Rules of Use This option is specified with the hyphen option specification character followed by the upper case letter L and lower case letter 1 The pair of characters of Li are handled as a single option 103 Li 1 sample asm NOTE This option is used in conjunction with the option lower case l list
167. ing JIS encoding The default setting depends on the host machine and operating system Sun Sparc ENGLISH DOS V SJIS PC AT ENGLISH notation This entry specifies the notation used for numbers in assembly language programs One of the parameters PANA CLANG or INTEL comes after the keyword notation followed by a blank space These parameters have the following meanings notation PANA Use Panasonic notation notation CLANG Use C language notation notation INTEL Use Intel notation The default setting is in extended C language format O OPTION This entry controls optimization Either ON or OFF of the parameters comes after the keyword O OPTION followed by a blank space These parameters have the following meanings O OPTION ON Enable optimization O OPTION OFF Disable optimization The default setting is to disable optimization The start up file 1d103rc supports the following keyboards Keyword Description message This entry specifies the language and coding scheme for messages from the linker 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 message ENGLISH Outputs messages in English message EUC Outputs messages in Japanese using EUC encoding message SJIS Outputs messages in Japanese using Shift JIS encoding message JIS Outputs messages in Japanese using JIS encoding The default setting de
168. inker gathers sections with the same name and links them together by attribute The order of linking is determined by the link type and the order in which the linker encounters the sections Section linking rules 1 Link sections in order of appearance 2 Link by attribute 3 Link by link type PUBLIC Link across all linked files 154 Writing Directive Statements Chapter 9 Writing Machine Language Instructions and Directive Statements Operand coding rules Only specific strings can be defined for definition 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 The attribute link type and location boundary of sections with the same name must be either identical or omitted If a different attribute link type or location boundary is defined actual value will be inherited from the setting of the very first section If there is the same section name in a file with a different attribute link type or location boundary the linker warns Directive coding rules The section directive has no restrictions on where in the source file it can be defined Usage example Below is an example use of the section directive CODE section CODE PUBLIC 2 main jsr INIT NOTE
169. ion 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 5110103 test lib test l rf Operation example 5110103 test lib test l rf The example adds the relocatable file test1 rf to the library file test lib Multiple files can be added with one a option To add test rf test2 rf and test3 rf to test lib specify the following Slib103 test lib testl rf test2 rf test3 rf NOTE If any of the relocatable object files to add already exists in this library file the library manage will output an error messages and terminates without performing any processing If specifying a file name with path name its file name without path name will be added in the library file 284 Command Options 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 5110103 test lib d testl rf Operation example 5110103 test lib d testl rf This example deletes the relocatable file test1 rf from the library file
170. ion CODE PUBLIC 1 main mov 0 0 mov Oxff DO mov 0x80 jsr data set bra main DATA section DATA PUBLIC 4 datal ds 4 end programl asm consists of a section called CODE attribute CODE link type PUBLIC and a section called DATA attribute DATA link type PUBLIC Basic Operation of Assembler and Linker 25 Chapter 3 Introduction to Operation The contents of program2 asm are as follows global data set CODE section CODE PUBLIC 1 data set mov 02 2292 data_set_loop cmp D1 D2 bec data_set_end mov DO 00 add lj D2 add 2 AO bra 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 103 programl asm 103 program2 asm This will generate two relocatable object files program 1 rf and program2 rf List files cannot be generated at this stage These files will be generated after linking when the relationships of external references and external definitions are resolved 26 Basic Operation of Assembler and Linker Link Chapter 3 Introduction to Operation 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 142103 m T CODE 40000000 program
171. ion on the first assembly will not resolve addresses so you would not do so unless you have some special purpose For the same reason the Li Lm and Lc options are also not used as103 g sample asm The above command assembles the source file sample asm in the current directory and generates a relocatable object file sample rf with debug information in the current directory 103 g D VERSION test rf user source main asm The above command assembles the source file main asm in the user source directory For conditional assembly of the source file assembly will proceed as though VERSION were defined The above command also generates a relocatable object file named test rf with debug information in the current directory asl03 g o test rf I user lib sample asm The above example assembles the source file sample asm in the current directory Files specified by include will be read from the user lib directory The above command also generates a relocatable object file named test rf with debug information in the current directory as103 I user defs o user src sample rf D TYPE file asm The above example assembles the source file file asm in the current directory For conditional assembly ifdef assembly will proceed as though TYPE were declared The assembler reads files specified with the include directive from the directory user defs The above example will store the relocatable object file with
172. ion to machine language it increments the location counter by the number of words in that instruction Location counter values are first set during linking for each section defined by the section directive so location counter values during assembly will not necessarily match the addresses assigned to instructions during execution Location counter values during execution will be offset values from the start of each section The address of the current instruction can be coded as an asterisk This asterisk is called the self reference address symbol By using a self reference address symbol in the operand field of a source statement you can reference the address assigned to that statement during execution 136 Location Counter 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 When a symbol or self reference address included in an expression is a forward referenced symbol a relocatable symbol or an undefined symbol the result of the expression cannot be resolved by the assembler It will then be resolved by the linker NOTE If a section name in the expression was used as a symbol declaration with the section directive must be done in the file Without doing this would lea
173. ions requiring backward compatibility with JSR RET Restore saved registers from the stack free the stack area and branch to the return address saved on the stack RET is used paired with CALL and the funcinfo directive RETF Restore saved registers from the stack free the stack area and branch to the return address stored in MDR RETF is used paired with CALL and the funcinfo directive Branch to the return address saved on the stack RETS is used paired with CALLS It is also used to maintain backward compatibility with RTS RETS JSR An Push the program counter containing the address of the next instruction onto the stack and branch to the specified address label is either d16 PC or d32 PC Push the program counter containing the address of the next instruction onto the stack and branch to the specified address JSR label Branch to the return address saved on the stack EIS RTS is used paired with JSR to maintain backward compatibility Return from an interrupt service routine RTI Restore the PSW stored on the stack and branch to the return address saved on the stack Push the program counter containing the address of the next instruction onto the stack TRAP and branch to the predefined address 0x40000010 This instruction is used for system calls to the operating system and libraries List of Machine Language Instructions 243 Chapter 12 List of Machine Language Instructions
174. is not a null block1 character Assembles block2 if it is equal nothing will be assembled if there is no else ifnb can only be else ieri block2 used within macro definitions endif 322 List of Assembler Control Statements Index Symbols 187 else cuu 191 osten a 189 Til dice CE 193 LED 202 n 191 Tifequ ooa ten 195 Hige C A 200 iet asusta eo RR UH iE 200 198 198 TED rt e onto ded 193 PAIN Da tet eric ce Ru 202 191 Tufn q ien 195 Tanclude s nn Ree 184 Ti ndef 45 eut I Reno eos 188 ET 211 Qfilename E enne 105 290 A Asi 135 HERES 282 283 284 8 eee eid 142 AD OE 142 AdditiOri 225 ccr reticere cte 138 Address Constant 2 135 address specifiers 22222221 135 align ooo oto eet 156 Arithmetic operators 2 2 138 ASTOS EXB aont em 300 ASTO3IRC SERERE NERONE 302 Assembler Control Statements 122 Assembler Errors 2
175. ist file program4 Ist are as follows Note that the symbol table is not displayed program4 lst Page 1 PanaX series Series MN1030 Cross Assembler Loc Object Line Source 1 global data Set time filler 2 global data_set time_filler 3 _CODE_01 section CODE PUBLIC 1 00000000 4 data_set 00000000 8A00 5 mov 0 D2 6 00000002 data_set_loo p 00000002 6 8 cmp D1 D2 00000003 C600 F9 bec data set end 10 00000005 60 11 mov DO 0 00000006 2A01 12 add 1 D2 00000008 2002 13 add 2 0 0000000 00 14 bra data_set_loop 15 16 data_set_end 0000000c FOFC 17 rts 0000000c 18 19 CODE 00 section CODE PUBLIC 1 20 00000000 21 time filler 00000000 8A00 22 mov 0 D2 23 00000002 24 time_filler_ loop 00000002 A4 25 cmp D1 DO 00000003 C600 26 bec time_filler_end 00000005 00 27 bra time_filler_loop 28 00000007 29 Time_filler_ end 00000007 FOFC 30 rts 31 end 32 This file is defined as two sections The addresses of the starting locations of both sections is assumed 00000000 The plus signs in lines 14 and 27 have the same meaning that they had in program3 st namely that the line contains a symbol that is not assigned a final value until linking Assembling and Linking Multiple Sections 33 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 inform
176. ite8 3A Level8 No 2 Jalan Kuning Taman Pelangi 80400 Johor Bahru Johor Malaysia Tel 60 7 331 3822 Fax 60 7 355 3996 Thailand Sales Office Panasonic Industrial Thailand Ltd 252 133 Muang Thai Phatra Complex Building 31st Floor Rachadaphisek Road Huaykwang Bangkok 10320 Thailand Tel 66 2 693 3400 to 3421 Fax 66 2 693 3422 to 3427 Philippines Sales Office Panasonic Industrial Sales Philippines PISP 102 Laguna Boulevard Bo Don Jose Laguna Technopark Santa Rosa Laguna 4026 the Philippines Tel 63 2 520 8615 China Sales Office Panasonic Industrial Shanghai Co Ltd Floor 12 China Insurance Building 166 East Road Lujiazui Pudong New District Shanghai 200120 China Tel 86 21 6841 9642 86 21 6841 9631 Panasonic Industrial Tianjin Co Ltd PI TJ Room No 1001 Tianjin International Building 75 Nanjin Road Tianjin 300050 China Tel 86 22 2313 9771 Fax 86 22 2313 9770 Panasonic SH Industrial Sales Shenzhen Co Ltd PSI SZ Shum Yip Centre Office 25F Shum Yip Centre 5045 East Shennan Road Shenzhen China Fax 65 6390 3689 PICM Fax 60 4 261 9989 PICT Fax 63 2 520 8629 PI SH Tel 86 755 8211 0888 86 755 8211 0970 Panasonic Shun Hing Industrial Sales Hong Kong Co Ltd PSI HK 11th Floor Great Eagle Center 23 Harbour Road Wanchai Hong Kong Tel 852 2529 7322 Taiwan Sales Office Fax 852 2865 3697 Panasonic Industrial Sales Taiwan Co Ltd PIST
177. itten Basic program format is shown below Comment statement Write comments as needed include include specifications define Define define identifiers definitions of constants macros globals Statements to define constants and macros and to declare and define globals section name section Declare start of section program body Machine language instructions conditional assembly directives macro expansions end End of program There are several points to be aware of when writing programs e Always declare an attribute and link type for a section name the first time it appears in a file The same section name cannot be set to a different attribute or link type e The effective scope of a directive coding rule section is until the line preceding the next directive coding rule section Ignore all text after the directive coding rule instruction Program Format 119 Chapter 7 Type of Source Statements Below is an example source file H SAMPLE PROGRA comment include FILE1 H include a file define define identifier for conditional assembly KEYBORD equ 0x32 define a constant data set macro data define a macro movw data 0 mov 0x12 DO mov DO 0 endm of macro _ CODE section CODE PUBLIC 1 sblank statement main statement with label only mov 0x10 machine language instruction statement ifdef TYPE conditional assembly directive data set KEYBORD expand
178. jsr SUBR subroutine call rts return from subroutine 152 Writing Machine Language Instruction Statements Chapter 9 Writing Machine Language Instructions and Directive Statements 9 4 Writing Directive Statements Directives differ from machine language instructions in that they 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 Directive Function section Specifies a section align Aligns the location counter value to a multiple of an expression end Indicates the end of the program listoff Stops list output from the line following this directive liston Starts list output from this directive notation Selects the coding format for numbers org Changes the program address opt Enables disables optimization functions page Specifies the number of columns and rows on one page of the list file radix Selects the radix to be specified by default Stores an 8 bit constant in a memory area ds Reserves an 8 bit data area in a memory area dw Stores a 16 bit constant in a memory area dd Stores a 32 bit constant in a memory area equ Defines a name as the value of an operand expression global Declares external references with external declarations tit Specifies the header name of the list f
179. l be generated if only the a option is specified Specify a option and 1 option adding to the first assembled option for the final list file Default Specification The assembler will not generate a final list file with addresses resolved by a map file Command Options 69 Chapter 5 Using Asssembler 5 3 2 Error Message Options E M I 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 Host machine Character coding Sun Sparc EUC DOS V Shift JIS PC AT not supported Rules of Use To specify the option enter the hyphen followed by the lower case letter 7 as103 j sample asm NOTE This option is not available on PC AT machines Default Specification The default language used depends on the host machine and the operating system Host machine Message Language Sun Sparc English DOS V Japanese in Shift JIS PC AT English It is also possible to change the default message specification with an entry in the assembler s start up file See Chapter 1 Getting Started Section 1 5 Setup 70 Command Options Chapter 5 Using Assembler Je Output error and warning messages in Japanese using EUC encoding Functional Description This option ca
180. l 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 map in the current directory Supplemental Explanation The o option is also available for specifying a different output file name and directory for the executable file Omitting this option results in the use of the default name m103 and the extension ex There is no option for specifying the name of the map file It uses the same default name as the executable file m103 and the extension map The output directory is the same as that used for the executable file Generate final list files After link processing is complete generate the final list files using the map file m103 map as103 1 a m103 map programl asm 103 1 a m103 map program2 asm l option Option to output a list file a option Option to read a map file Specify the map file name after it This operation will generate the final list files programl1 lst and program2 Ist in the current directory With the above operations you can generate an executable format file and final list files in the current directory You must generate the final list files using the map file after linking This is because linking determines the start addresses of sections following the T option for files in section ad
181. l sections with the DATA attribute from all input files beginning at the address 1000 hex The linker places all sections other than those named TEXT after the same sections in main rf and sub rf according to the T option placement rules See Section 6 3 3 The linker resolves all internal references within the TEXT sections of prog1 rf prog2 rf and prog3 rf so that the sections are ready to run in the specified instruction RAM addresses above 40000000 hex but places the sections in the order that they appear in the input files beginning at the address following the end of the sections with the CODE attribute as placed with the T option Finally at the address following the end of all segments in external memory with the CODE option the linker creates the instruction RAM program management table used by the routine for copying sections to instruction RAM Assignment to the same address in instruction RAM ld103 T CODE 80000000 TGDATA 1000 main rf sub rf OVL 1 TEXT 40000000 progl rf OVL 2 TEXT 40000000 prog2 rf OVL 3 TEXT 40000000 prog3 rf The linker first places all sections with the CODE attribute from main rf and sub rf in the order that they appear in the input files beginning at the address 80000000 hex It places all sections with the DATA attribute from all input files beginning at the address 1000 hex The linker places all sections other than those named TEXT after
182. ler 5 3 1 Output File Options o 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 NOTE Because the 9 symbol is used as the character for specifying parameter files it cannot be used as the first character of file names Rules of Use This option is specified with the hyphen option specification character followed by the lower case letter o then either immediately followed by the file name or a space and the file name If the file is to be output to the current directory only the file name needs to be specified If the file is to be output to a different directory both a path name and a file name must be specified as103 o user obj test rf main asm Default Specification The assembler creates a file with the same name as the input file but with the extension changed to rf in the current directory Operation Example The following command line assembles the source file samp1 asm in the current directory and creates the relocatable object file user obj sampl rf It does not create a listing file as103 o user obj sampl rf sampl asm 64 Command Options Chapter 5 Us
183. les e Correspondences between line numbers and code addresses With this information debugging is much easier since the user can specify variables by name instead of by address NOTE This option must also be specified when linking If the g option is not specified for either the assembler or linker debug information will not be output to the executable format file EX NOTE If the number of lines per source file exceeds 65535 some part of the debug information will not be output Make sure when you debug programs one source file can contain up to 65535 lines Divide a file with more than 65535 lines to avoid errors Note that the file names or line numbers in error messages will not be shown if the linker generates error or warning messages after the line 65535 Rules of Use This option is specified with the hyphen option specification character followed by the lower case letter g as103 g sample asm Default Specification Debug information will not be output 78 Command Options Chapter 5 Using Assembler 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 sample asm Default Specification The default i
184. lock2 will be assembled ifndef If the identifier has not been defined by a define directive before the ifndef statement block will be assembled If it has been defined and an else directive has been coded block2 will be assembled Coding rules These directives can be used within macro definitions and wherever machine language instructions can be coded If an identifier is defined after ifdef or ifndef it will be considered undefined Identifiers can be specified by the D option when the assembler is started even if they are not defined with define directives Conditional Assembly 191 Chapter 10 Writing Assembler Control Statements Usage example A source file that uses ifdef and ifndef is shown below define VERSION _TEXT section CODE PUBLIC 1 ifdef VERSION mov 0x01 DO else mov 0x02 DO lendif ifndef VERSION mov 0x03 D1 else mov 0x04 D1 endif The assembled list file is shown below ifdef lst Page 1 FRR PanaX Series MN1030 Cross Assembler Tk Loc Object Line Source 1 define VERSION 2 3 _TEXT section CODE PUBLIC 1 4 ifdef VERSION 00000000 8001 5 mov 0x01 DO 6 else 7x mov 0x02 DO 8 endif 9 ifndef VERSION 10x mov 0x03 D1 11 else 00000002 8504 12 mov 0x04 D1 13 endif The identifier VERSION is defined in line number 1 The replacement string is a null character Since VERSION has been defined the ifdef starting from line number
185. m name The names are delimited with commas Any number of operands can be coded When a specified name has been coded in a label field within the program it will be considered an external declaration When it has been coded as operands it will be considered an external reference Writing Directive Statements 173 Chapter 9 Writing Machine Language Instructions and Directive Statements Usage example Below is an example use of the global directive global SUB1 external declaration global READ external reference WRITE main jsr READ jsr WRITE SUB1 mov 0 11 DO 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 Example sec section CODE PUBLIC 1 _ TEXT section CODE PUBLIC 1 mov sec AO 174 Writing Directive Statements 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 A double quotation mark itself cannot be included in the string U
186. macro else mov 0 DI fendif end end of program 120 Program Format Chapter 7 Type of Source Statements 7 3 Machine Language Instruction Statements and Directive Statements se 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 After the program has been converted to ROM these statements will be executed by the microprocessor The instructions have the following features e Memory oriented instruction set all calculations performed throughout memory Single and double operand instructions Minimized instruction set and instruction codes Six addressing formats The example below shows machine language instruction statements mov Oxff DO mov datal AO mov DO A0 add Tuo rts Directive statements Directive statements are not converted to machine language code Within programs they specify assem bler attributes to modify program structure and addresses select radices define constants and control list file style The example below shows directive statements global save CONST equ 0x12 TEX section CODE PUBLIC 1 org 100 MES
187. mand Options 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 5110103 h Default specification The default is not to display this help information on the console NOTE If the h option is not used input of slib103 will also display help information Display the library manager s version number on the console Functional description This option displays the library manager s version number on the console Rules of use To specify the option enter the hyphen followed by the lower case letter v 5115103 v Default specification The default is not to display the version number Command Options 291 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 th
188. me Cannot read parameter file There is an error in the parameter file Make sure that the parameter file exists and has the proper access permissions If it passes both tests check the file for illegal characters 3504 Object file not specified There is no object file with extension rf specified as an input file Make sure that the object file is properly specified 3505 filename This file is not a object file for MN1030 The input file is not a relocatable object file Check the file name specification for errors 3506 filename This file is not a library file for MN1030 The input file is not a library file Check the file name specification for errors 3507 filename Invalid file information type type There is a problem with the specified file Reassemble the corresponding source file and check the disk for hardware errors 3508 filename Bad file search There is a problem with the specified file Reassemble the corresponding source file and check the disk for hardware errors 3509 filename Illegal section attribute A section attribute in the specified input file is invalid Reassemble the corresponding source file and check the disk for hardware errors 3510 filename Invalid symbol detail information type type The symbol detailed information in the specified input file is invalid Reassemble the corresponding source file an
189. me regardless of coding format The coding format has no effect even when a single character string constant is specified 134 Character Constants 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 7 Expressions for details The address specifiers are shown below A or a Return the lower 32 bits of the expression value bits 0 to 31 Example Assume that the following address is assigned to the label with the name MESSAGE address 00000000001 110010101011011101001 binary a MESSAGE represents 00000000001110010101011011101001 The values expressed by MESSAGE and 55 are the same In a context calling for the address value associated with a symbol it is more common to use the symbol itself alone instead of adding the address specifier Address Constants 135 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 instruct
190. memory location specified by abs32 to Dn MOVHU Dm Transfer the lowest 16 bits of Dm to the memory location specified by abs 16 abs16 abs16 is zero extended MOVHU Dm Transfer the lowest 16 bits of Dm to the memory location specified by abs32 abs32 MOVH abs16 Dn Transfer with sign extension the 16 bit contents of the memory location specified by abs16 to Dn abs16 is zero extended MOVH abs32 Dn Transfer with sign extension the 16 bit contents of the memory location specified by abs32 to Dn MOVH Dn abs 16 Transfer the lowest 16 bits of Dm to the memory location specified by abs16 abs16 is zero extended MOVH Dnm abs32 Transfer the lowest 16 bits of Dm to the memory location specified by abs32 List of Machine Language Instructions 235 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 MOVM regs SP Save the specified registers to a block in memory CLR Mnemonic
191. ments 022422044 000 eene 152 OA Writing Directive Statements ossia ite oet Itt reet Eee eee ce 153 9 4 T Ded e RIO RET ED FORI RUIT EB uH 154 9412 tet Se eR ERE te ERR ERU RR NR eusondvuapegeapers 156 DAB end ioo RE DEO RU PD OPE HG OD HEP UR HERR PE 158 9 474 Mistott histone eben bua EERE 159 94 55 cec Neh AT eia nc HI NAI eee 160 9 46 ONG EE 162 0427 lt Oh dens dep A EE 163 94 8 DdBe iecore ee Pre d entere edP 164 CONUM HE 165 02 10 deu nette ctm nc nm e 166 dette tee ee 167 D MM EIL PM Em 169 02 13 dd aS Scelus eate ntu e cn e ER Mis 170 QA VA eqs eere ure mE a PUO e 171 OAS elobal ERU E TEE UE EH QR EUR QU E NERIS 173 94 esee ementi meets EEL 175 17 KIS TOM cce aieo eee e ER Eee 176 OPA NS 7 TUICITIO 5o iO HORTON D d ADOS TO eite 177 9419 179 Chapter 10 Writing Assembler Control Statements P tpose ofr This potete err RU RERO ED Oe Ln das eee 182 10 2 oi rr Ut RETE ERE 183 10 2 1 include cono a
192. mov 0x22 DO 40000008 60 16 mov DO 0 I endif 18 19 _DATA section DATA PUBLIC 4 4000000C 00000000 20 datal dd 0 40000010 00000000 21 data2 dd 0 22 end Note how line number 14 is not assembled because the condition fails and how line number 16 is assembled instead Specify assembly conditions in the command Until this point the condition has been specified by define in the source file but it has been bothersome to edit the source file each time The explanation below describes how to directly specify conditions with command options This operation is valid only with regards to ifdef 40 Conditional Assembly and Linking Chapter 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 103 D DEBUG program5 asm ld103 m T CODE 40000000 program5 rf 103 1 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 programS Ist are as follows Note that the symbol table is not displayed Loc 40000000 40000000 40000006 40000008 4000000c 40000010 program5 1lst 1 PanaX series Series MN1030 Cross Assembler Object Line Source 1 define DEBUG 2 3 4 dat_set macro adr dat 5 mov adr A
193. ms in this system simply by entering their names SET PATH A usr local bin NOTE Ending a directory specification in the PATH environment variable with a backslash results in errors The following are examples of incorrect PATH settings Example SET PATH A SET PATH A usn local bin Personal Computer Versions 303 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 Start up files The assembler and linker start by reading start up files that provides a means of changing initial settings For a detailed description see Chapter 1 Getting Started Section 1 5 Setup Paragraph Start Up Files and substitute the file names AS103 RC and LD103 RC for as103rc and 1d103rc respectively 304 Personal Computer Versions Chapter 16 Notes on the Operating Environment 16 2 5 Differences From Workstation Versions LL u 8 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 f
194. n 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 The two letters together function as a single option ld103 Je sample rf NOTE This option is not available on DOS V or PC AT machines Default specification The default language used depends on the host machine and the operating system Host machine Character coding Sun Parc English DOS V Japanese in Shift JIS PC AT English It is also possible to change the default message specification with an entry in the linker s start up file See Chapter 1 Getting Started Section 1 5 Setup 92 Command Options 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 The two letters together function as a single option ld103 Js sample rf NOTE This option is not available on PC AT machines Defa
195. n 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 Refer to Chapter 8 Writing Source Statements section 8 7 Expressions section 8 7 4 Expression Attributes regarding attributes of expression Names defined with the assign directive can be defined again with the assign directive Names defined with the assign directive cannot be declared external references or external declarations No memory ares is reserved when an assign directive statement is executed Usage examples The example below is a use of the assign directive assign lst Page 1 PanaX Series MN1030 Cross Assembler Loc Object Line Source 1 _TEXT section CODE PUBLIC 1 2 NU assign 0 01 00000000 8001 3 mov NUM DO 4 5 NUM assign 0x02 00000002 8002 6 mov NUM DO NOTE If aname defined with this directive is used you must define the value before the statement Writing Directive Statements 179 Chapter 9 Writing Machine Language Instructions and Directive Statements 180 Writing Directive Statements Chapter 10 Writing Assembler Control
196. n another directory Starting Assembler 61 Chapter 5 Using Asssembler Summary of options The following Table lists the available command line options Table 5 1 Assembler Options Option Type Symbol Description o file_name Specify the relocatable object file name to be output 1 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 Output file macro or irp to the list file Output only the machine language code Ls Do not output a symbol table to the list file Le Do not output source statements that were not assembled due to unfulfilled conditions of conditional assembly to the list file name Read the map file to output a list file with resolved addresses j Output error and warning messages in Japanese Output will be to the screen and when a list file is specified to the list file Je Output error and warning messages in Japanese using EUC encoding to the console and if specified the listing file Js Output error and warning messages in Japanese using Shift JIS encoding to the console and if specified the listing file Errormessage Jj Output error and warning messages Japanese using JIS encoding to the console and if specified the listing file options Output error and warning messages in English Output will be to the screen and
197. n specification an equals sign and the address in instruction RAM A space between the OVL option letters and the ID number is optional The ID number identifies a set of sections extracted from the corresponding object files and is used to reference that set during program operation It can be any number between and 255 Sections may be specified by section name section attribute or both To specify a section attribute precede the name of the attribute with the character Multiple sections may be specified together as a comma delimited list Instruction RAM Support 111 Chapter 6 Using Linker The starting address in instruction RAM is given in hexadecimal 142103 CODE 80000000 main rf sub rf OVL 1 CODE 40000000 segl rf OVL 2 CODE 40000000 seg2 rf 1d103 CODE 80000000 main rf sub rf OVL 1 5 40000000 segl rf OVL 2 TEXT CONST 40000000 seg2 rf 1d103 T CODE 80000000 main rf sub rf OVL 1 TEXTQGCODE 40000000 segl rf OVL 2 TEXTQGCODE 40000000 seg2 rf Default specification If there are no OVL options the instruction RAM function is not used and linking proceeds in the normal fashion 112 Instruction RAM Support 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 func
198. name sample rf in the user src directory Operation Examples 81 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 Refer to chapter 6 Using The Linker for details 3 Use the assembler once more to assemble the source file This time read the map file generated by the linker with the assembler s a option If the I or D options are specified the parameters at this stage must be the same as those of the first assembly The following descriptions assume that a map file has already been generated 103 1 a main map sub asm In the above example all files exist in or are output to the current directory The source file sub asm is assembled using a map file main map generating a list file sub lst 103 1 Lc Lm a main map D MODE progl asm The above example assembles the source file prog1 asm in the current directory using a map file main map generating a list prog Ist Assembly will be performed assuming that the identifier MODE has been defined for conditional assembly directives ifde
199. ne options to eliminate the overlap Linker Errors 259 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 Check the specified address value 3304 Illegal value with option option value The specified value is invalid Check the specified value 3305 Conflicting option specified option Conflicting options have been specified Check the option specifications 3306 filename Parameter file already specified The parameter file includes another parameter file Edit the parameter file to eliminate the duplication 3307 Multiply defined symbol A symbol is defined more than once Check the symbol declarations 3308 Undefined symbol A symbol is undefined Check the symbol declarations 3309 filename Relocation address out of range line lineno The results of a relocatable address calculation are out of range Check the specif
200. neral 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 Specifying options An option starts with a hyphen as the options specifier followed by a character that indicate the particular option 1 Option specifications are case sensitive so upper case and lower case letters must be specified correctly hG Single character options not accompanied by parameters can be specified as multiple characters following the hyphen option specifier The order is optional gl When an option is accompanied by a parameter and other options are to follow add a space after the parameter and follow with the hyphen option specifier I user source Li Lc Parameters can be specified right after the option character or separated by one space I user source or I user source When options are omitted assembly will be perform in accordance with the default interpretations built in to the assembler Refer to section 5 3 Command Options for default interpretations NOTE Omitting the path specifies that the source file is in the current directory Specifying a path for the source file does not affect the listing file and relocatable object file They are always created in the current directory Note however that the o option is available for creating the relocatable object file i
201. nitionl Sets the start of a section definition2 expression definition 1 section attribute CODE DATA definition 2 link type PUBLIC PRIVATE COMMON expression location counter boundary value power of 2 opt on off Enables disables optimization Directives for symbols Syntax Function amp Notes symbol instruction operand name equ value Defines a name as the value of the expression coded in the operand name assign value Defines a name as the value of the expression coded in the operand global name name Declares global declarations and global references 318 List of Assembler Directives Directives for data area allocation Chapter 17 Appendix Syntax Function amp Notes symbol instruction operand de 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 expression expression2 Allocates the number of bytes specified by expression3 expression to a data area If expression2 initial value is specified the data area will be filled with that initial value If expression3 repeat count is specified this operation will be repeated for the specific number of times Directives for list control Syntax Function amp Notes symb
202. nker 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 1d103 as is general format General format of commands Below is the general format of the command to use when starting the linker 1d103 options relocatable_object_filename library filename Contents of brackets may be omitted Ellipses indicate item may be repeated Specifying options Except for the option an option starts with a hyphen as the options specifier followed by a character that indicate the particular option 74 option is not preceded by hyphen Option specifications are case sensitive so upper case and lower case letters must be specified correctly Ed Single character options not accompanied by parameters can be specified as multiple characters following the slash or hyphen option specifier The order is optional jmg If you want to separate multiple options delimit them with spaces zen When an option is accompanied by a parameter and other options are to follow add a space after the parameter and follow with the slash or hyphen option specifier o main ex gm Starting Linker 85 Chapter 6 Using Linker Parameters can be specified right after the option character or separ
203. not output warning messages of the specified number Wall Do not output any warning messages Program generation options Create a new library manager displays an update confirmation prompt f Force creation of a library file Functional options Add the specified relocatable object file to the library file Delete the specified relocatable object file from the library file Output information about externally defined symbols in the library file ajs Replace the specified relocatable object file in the library file Output a list of the relocatable object that makes up the library file X Extract the specified relocatable object file from the library file Gfilename Specify a parameter file Other options h Display a listing available library manager s options on the console Display the library manager s version number on the console NOTE When slib103 is used to group relocatable object files into libraries it will store them in the relocatable object files after deleting debug information if such debug information exists Therefore when an ordinary relocatable object file is placed in a library it will be the same as that file when extracted form the library However there will be differences if the relocatable file was generated with the g option Starting Library Manager 275 Chapter 15 Using Library Manager 15 3 Command
204. of Dm to the memory location specified by An and displacement d 8 and 16 bit displacements are sign extended MOV Dnm d SP Transfers the contents of Dm to the memory location specified by SP and displacement d 8 and 16 bit displacements are zero extended MOV Am d An Transfers the contents of Am to the memory location specified by An and displacement d 8 and 16 bit displacements are sign extended MOV Am d SP Transfers the contents of Am to the memory location specified by SP and displacement d 8 and 16 bit displacements are zero extended MOV SP d8 An Transfers the contents of SP to the memory location specified by An and 8 bit displacement d8 8 bit displacements are sign extended MOVBU d Am Dn Transfers with zero extension the 8 bit contents of the memory location specified by Am and displacement d to Dn 8 and 16 bit displacements are sign extended MOVBU d SP Dn Transfers with zero extension the 8 bit contents of the memory location specified by SP and displacement d to Dn 8 and 16 bit displacements are zero extended MOVBU Dm d Transfers the lowest 8 bits of Dm to the memory location specified by An and displacement d 8 and 16 bit displacements are sign extended MOVBU Dnm d SP Transfers the lowest 8 bits of Dm to the memory location specified by SP and displacement d 8 and 16 bit displacements are zero extended MOVB
205. ogrammer must create programs such that addresses do not overlap Reference Chapter 6 Using Linker for details Programming with Assembler 17 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 e Header files Constants and variables used in all files and define identifiers used in common should be gathered into a single header file As a result changes can be made at just one location in the header file Library files Subroutine programs frequently used by different files should be gathered by function as library files to make programs easier to use Declaration position global directives Use one position for global directive declarations The global directive can be declared anywhere within a program but confusion will result if the declaration positions differ across source files e Unify radix and notation directives Choose a common default radix for coding numbers constant values strings etc Comment statements Comments reveal program algorithms and processing details within a program Choose a common format for coding comment statements Optimization This Series optimizations apply to unconditional branches data transfer ins
206. ograms memory size clock frequency etc can be assigned to names that describe those values MEMORY equ 0x20 MOTOR equ 10 STOP equ 0000001000 BASE equ 0x1000 This allows numbers used in programs to be coded as descriptive names instead making programs easier to read Furthermore values can be changed just by modifying the equ directive which in turn changes the data wherever it is used This makes programs easier to maintain Operand coding rules The expression coded in the operand must result in the attribute abs absolute Refer to Section 8 7 4 Expression Attributes regarding attributes of expressions If the attributes of expressions are not the attribute abs absolute define of the assembler control state ment should be used instead of the equ of the directive statement Names defined in other programs cannot be specified within expression Names defined once with the equ directive cannot be defined again No memory area is reserved when an equ directive statement is executed NOTE Symbols with unresolved values cannot be coded in the operand In the following example the value of ram1 is not resolved at the point where the value of ram2 is to be resolved so the assembler will generate an error Error example ram2 equ ram1 0x1 1 0x10 By changing the order such that the value of ram1 is resolved first no error will occur No error example 1 0x10 ram2 equ ram1 0
207. ol instruction operand tit string Specifies the header for the list file listoff Suppresses list output from the next line after this directives liston Resume list output from the line of this directives xlistoff Suppresses list output from the line of this directives xliston Resume list output from the next line after this directives page lines columns Specifies the number of lines and columns on a page of list file List of Assembler Directives 319 Chapter 17 Appendix Other directives Syntax symbol instruction operand Function amp Notes 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 If the default is 10 and if extended C language format has been selected the radix will always be 10 regardless of the specification name funcinfo label expression register list Specifies additional information for a function name that appears as an operand for the CALL machine language instruction 320 List of Assembler Directives Chapter 17 Appendix 17 4 List of Assembler Control Statements SaaS This section provides a list of assembler control statements Syntax Function amp Notes
208. on infringement of intellectual property right or any other rights owned by our company or a third party nor grants any license 3 We are not liable for the infringement of rights owned by a third party arising out of the use of the product or technologies as described in this book 4 The products described in this book are intended to be used for standard applications or general electronic equipment such as office equipment communications equipment measuring instruments and household appliances Consult our sales staff in advance for information on the following applications Special applications such as for airplanes aerospace automobiles traffic control equipment combustion equipment life support systems and safety devices in which exceptional quality and reliability are required or if the failure or malfunction of the products may directly jeopardize life or harm the human body Any applications other than the standard applications intended 5 The products and product specifications described in this book are subject to change without notice for modification and or improvement At the final stage of your design purchasing or use of the products therefore ask for the most up to date Product Standards in advance to make sure that the latest specifications satisfy your requirements 6 When designing your equipment comply with the guaranteed values in particular those of maximum rating the range of operating power
209. on 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 global _Ofunc _TEXT section CODE PUBLIC 1 call Ofunc 1 global _Ofunc func TEXT section CODE PUBLIC 1 func movm 0216 SP 2 add 4 SP _Ofunc funcinfo _func 8 D2 3 ret 1 gives the call to the function _Ofunc 3 is the body of the function 2 the section between the labels _func and _Ofunc saves a register and sets up the stack frame When this source file is assembled and linked the linker eliminates section 2 This section is preserved when the symbol _func is referred For further details on machine instructions and directives see the Instruction Manual and Section 9 4 Writing Directives NOTE This optimization of function calls is always carried out regardless of the state of the optimization option O It is suppressed throughout if even one of the source files to be linked contains a calls instruction with the operand An Usage Example 51 Chapter 4 Optimization Table 4 8 Substituted Instructions For Out Of Range Conditional Branch Instructions Source Instruction Candidate instruction 1 Candidate instruction 2 Candidate instruction 3 BLT LABEL BRA LABEL
210. ons coded in the macro body This process is called macro expansion The basic difference between a macro call and a subroutine call is that a macro call actually outputs ma chine language instructions as source statements with arguments used to output different machine lan guage instructions for each call The example below shows macro control statements macro definition adr_set macro data reg mov reg 0 mov data DO mov DO 0 endm macro call adr set datal regl adr set data2 reg2 Macro Control Statements 123 Chapter 7 Type of Source Statements 7 6 Comment Statements 24 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 Comments are used to explain data structures program algorithms etc Comment statements are an important structural element of documentation You should add comments that are detailed as possible to enhance program maintenance The example below shows comment statements MN1030 Series Cross Assembler Sample Program include
211. or specifying section layout or the program itself 3517 Not exist CODE section in external memory OVL options have relocated all CODE sections to instruction RAM Modify the program so that there is at least on CODE section in external memory 3518 filename Referring to symbol name defined in a program ID id which overlap at IRAM area The input file contains a program with a reference to a symbol in the program with the specified ID and the two programs cannot coexist in the IRAM area because their addresses overlap Either change the OVL options so that the two programs can coexist in the IRAM area or revise the entire program 3519 Internal Error string The linker has detected an internal fault Contact Matsushita Electronics Linker Errors 263 Chapter 13 Error Messages 264 Linker Errors Chapter 14 Readinig List Files 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 266 Purpose of This Chapter Chapter 14 Reading List Files 14 2 Reading List Files Adding the letter option when the assembler is invoked will generate the list file in the curren
212. orary register with the ones complement of zero extended imm8 and store the lowest 8 bits of the result in the memory location specified with abs32 242 List of Machine Language Instructions Chapter 12 List of Machine Language Instructions 12 3 5 Branching Instructions CALL Subroutine Mnemonic 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 This pair provides high speed saving and restoring of registers to and from the stack and the securing and release of the stack area CALL label Push the program counter containing the address of the next instruction onto the stack and branch to the specified address This instruction is used paired with a RETS CALLS An instruction for table jumps and other situations where the registers to be saved and the size of the stack area are not known and for situations requiring backward compatibility with JSR label is either d16 PC or d32 PC Push the program counter onto the stack and branch to the specified address This instruction is used paired with a RETS CALLS label instruction for table jumps and other situations where the registers to be saved and the size of the stack area are not known and for situat
213. ordingly faster to access the file created by redirection when the source file is large Generate error file The example below shows the generation of an error of an error file ERROR9 by redirection This example assembles MAIN ASM and outputs error messages to the file ERROR instead of the screen First assemble a file that actually includes errors and generate an error file The following source file MAIN ASM includes two errors _ CODE section CODE PUBLIC 1 data equ sil main mov 0 11 DO move 0 11 DO mov DO data main end The assembler will detect the errors so it will generate an error file by redirection AS103 MAIN ASM gt ERROR The contents of the generated error file ERROR are as follows 306 Personal Computer Versions Chapter 16 Notes on the Operating Environment 5 move 0 11 DO 5 Error 2304 Instruction not found iy 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 0 11 DO 5 Error 2304 Instruction not found 7 main MAIN ASM 7 Error 2306 Multiple define symbol Errors 2 Warnings 0 MAIN ASM Tag jumps The first error message matches this displa
214. output Default Specification Source files included by include will be output to the list file Operation Example The following command line assembles the source file sampl asm and creates a listing file samp1 Ist that suppresses all text merged with the assembler directive include 103 1 Li sampl asm NOTE Files included with include must not terminate with the end directive 66 Command Options 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 In such cases listings without expanded mnemonics will be easier to look at This is why the Lm option is provided If the option is not specified the Lm option will be ignored even if specified Source files with no macro expansion will be assembled normally even if assembled with the Lm option Rules of Use This option is specified with the hyphen option specification character followed by the upper case letter and lower case letter m The pair of characters of Lm are handled as a single option 103 Lm 1 sample asm
215. pends on the host machine and operating system Sun Sparc ENGLISH DOS V SJIS PC AT ENGLISH g OPTION This entry controls the output of debugging information Either ON or OFF of the parameters comes after the keyword g OPTION followed by a blank space These parameters have the following meanings g OPTION ON Enable output of debugging information g OPTION OFF Disable output of debugging information The default setting is to disable output of debugging information 8 Setup Chapter 1 Getting Started Keyword Description 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 The default setting is to disable output of the symbol table to the executable file En OPTION This entry controls the output of DATA sections to the executable file Either ON or OFF of the parameters comes after the keyword Ed OPTION followed by a blank space These parameters have the following meanings Ed OPTION ON Enable output of DATA section to the executable file O OPTION OFF Disable output of DATA section to the executable file The default setting is to disable output of DATA section to the executable file Ed
216. port for instruction RAM This section gives the particulars of the instruction RAM format for executable files and the procedures for creating them Instruction RAM Support 107 Chapter 6 Using Linker 6 41 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 This is automatically assigned to the external memory immediately following the fixed program portion C Instruction RAM program management table When the program contains instruction RAM portions the linker automatically generates this table in the executable file Each entry for the transfer units contains the following information ID number 2 bytes Program size 2 bytes External memory address 4 bytes Instruction RAM address 4 bytes NOTE The linker indicates the last entry in this table by setting the highest bit in the ID number field to 1 The linker creates a extra symbol overlay table indicating the location of this table D Transfer program This portion copies the instruction RAM program from the external memory to the instruction RAM It refers to the instruction RAM program management table in the process
217. pt on section CODE PUBLIC 1 sub_func addr_set calls func_end org addr_set 128 func_end rts end The final list file after assembly is shown next Since the CALLS LABEL instruction in line four con tains a target address that may be expressed with a 2 byte relative branch the assembler replaces it with the CALLS LABEL variant with a 2 byte address field Note that the mnemonics and object code are different opt4 lst Page 1 PanaX series Series MN1030 Cross Assembler Loc Object Line Source 1 opt on 2 _TEXT section CODE PUBLIC 1 40000000 3 sub_func 40000000 FAFF 8000 4 addr_set Calls func_end 5 6 org addr_set 128 40000080 7 func_end 40000080 FOFC 8 rts 9 end opt4 lst Page 2 Symbol Table OK 40000000 T sub func 40000000 addr_set 40000080 T func end 58 Usage Example Chapter 5 Using Assembler 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 60 Purpose of This Chapter 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 ge
218. ram 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 defin TYPE A Using TYPE and conditional assembler control directives to process different parts of the program the programmer writes code in the format below TYPE Program of product A 15 Program of product ndif TYPE has been defined with define so in this case the program for product A will be assembled If the statement define TYPE A is omitted the program for product B will be assembled By using conditional assembler control directives in this manner different versions of programs can be managed in a single source file Reference Chapter 10 Writing Assembler Control Statements for details Macros Macros are an important function of the assembler A macro assigns a name to a process thereby simplifying the coding of that process By assigning an appropriate macro name to a block of multiple machine language instructions the programmer can create custom instructions Debugging When performing final program debugging the programmer must verify whether the intended operations are being performed or not A source code debugger is pro
219. ration is needed as some operations are not guaranteed Refer to the notes attentions or warnings written in MN1030 MN103S Series Instruction Manual for 32 bit and ensure that the expected operation is guaranteed If it is not guaranteed modify the program See Chapter 3 How to Use Instructions in the Instruction Manual 3rd version or later or Chapter 5 section 2 Programming Notes in the former versions 2010 The usage of this instruction may be restricted in MN1030 103S series The usage of a series of instructions may be restricted in MN1030 series hardware Careful operation is needed as some operations are not guaranteed Refer to the notes attentions or warnings written in MN1030 MN103S Series Instruction Manual for 32 bit and ensure that the expected operation is guaranteed If it is not guaranteed modify the program See Chapter 3 How to Use Instructions in the Instruction Manual 3rd version or later or Chapter 5 section 2 Programming Notes in the former versions 252 Assembler Errors 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 mod
220. ree types of messages warning messages error messages and fatal error mes sages Assembler Errors 251 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 Check the spelling of the identifier 2005 Ignore RADIX If an expression uses extended language syntax the assembler ignores the radix directive Delete the radix directive 2006 Change RADIX equal 10 An expression using extended language syntax does not use a radix of 10 Use the radix directive to change the radix to 10 2007 Line too long A source statement exceeds the length limit Edit the source statement so that its length is within the limit 2008 Macro name multiple defined Multiple macros share the same name Change the names of the extra macros 2009 The usage of a series of instructions may be restricted in MN1030 1035 series The usage of a series of instructions may be restricted in MN1030 series Careful ope
221. rlay_table a0000000 The section layout is the same as the previous example The only difference is that the linker moves the instruction RAM program management table to the address a0000000 hex NOTE The developer must be careful not assign this table to an address where it overlaps with actual code Instruction RAM Support 115 Chapter 6 Using Linker 116 Instruction RAM Support Chapter 7 Types of Source Statements 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 Machine language instruction statements and directive statements e Assembler control statements Macro control statements Comment statements e Blank statements This chapter describes these five types of statements and at the same time explains their position and use when constructing a program 118 Purpose of This Chapter Chapter 7 Type of Source Statements 7 2 Program Format 8 A program is text created to assemble as machine language instructions in order to operate micropro cessor 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 wr
222. rogram3 Ist are as follows Note that the symbol table is not displayed program3 lst Page 1 PanaX series Series MN1030 Cross Assembler Loc Object Line Source 1 global main 2 global data_set time_filler 3 4 _CODE_00 section CODE PUBLIC 1 00000000 5 main 00000000 9000 6 mov 0 AO 00000002 2CFF00 7 mov Oxff DO 00000005 2D8000 8 mov 0x80 D1 00000008 FS8FEFCFCFF00000 9 jsr data set 00000010 00 8 04 9 00000014 F8FEFCFCFF000000 10 time_filler 0000001 00 8 04 10 00000020 00 11 bra main 12 13 _DATA section DATA PUBLIC 4 00000000 00000000 14 datal ds 4 15 end There is a plus sign before line numbers 9 and 10 This indicates that the object code does not have final values This is because the two functions data set and time filler do not exist in this program so the call addresses will not be resolved unless linked That further means that this list file is not the final list file Line number 11 also has a plus sign This indicator warns that the line contains a symbol that is not assigned a final value until linking Finally notice that the list begins from location 000000 The start addresses of section format programs are specified with the linker Here the assembler uses relative values beginning from 000000 as location counter values 32 Assembling and Linking Multiple Sections Chapter 3 Introduction to Operation The contents of the l
223. rol Statements List of Machine Language Instructions Error Messages Reading List Files Using Library Manager Notes on Operating Environment Appendix Table of Contents Chapter 1 Getting Started 1 1 EES Ee TE r EEEa E EE Ero E ESEE ORELE ES 2 1 2 Operating Environment etie eine tere eee cete het Mete Pe cud 3 1 3 File 4 1 4 as 5 1 5 6 1 6 Fil Converston Utility te ares 10 Chapter 2 Program Development Flow 2 1 Burpose of Thus Chapter edt eo eee dett ere Op ore eb eere edes 14 2 2 Program Development FlOWw eese restet HR nete o etr RU 15 2 3 Programming with Assembler e a E nEn E AE ennt EEA E EES 17 Chapter 3 Introduction to Operation 3 1 Purpose of This C hapter ess sich ho gem eR ee RE RE RR 22 3 2 Files Used by Assembler and erret eter pe Fue e
224. ronment 16 2 3 Installation For the installation media installation procedures and notes on installation see the MN1030 Series Installation Manual 302 Personal Computer Versions Chapter 16 Notes on the Operating Environment 16 2 4 Environment Settings 4 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 If the assembler is started without them the error message bad tmpboss w will be output and processing will stop This means that the number of files that can be opened simultaneously is insufficient Terminology CONFIG SYS This is the file that sets the MS DOS operating environment FILES specifies the number of files that can be read and written simultaneously BUFFERS specifies the size of memory used for reading writing disks AUTOEXEC BAT To be able to run the software simply by typing in its name include its directory in the path search list given by the environment variable PATH Under MS DOS adding the directory in which the software is installed to the PATH variable and activating the new value for PATH allows you to run the progra
225. ry location specified by abs32 MOV abs 16 Transfer the contents of Am to the memory location specified by abs16 abs16 is zero extended MOV Am abs32 Transfer the contents of Am to the memory location specified by abs32 MOVBU abs16 Dn Transfer with zero extension the 8 bit contents of the memory location specified by abs16 to Dn abs16 is zero extended MOVBU abs32 Dn Transfer with zero extension the 8 bit contents of the memory location specified by abs32 to Dn MOVBU Dm Transfer the lowest 8 bits of Dm to the memory location specified by abs16 abs16 abs16 is zero extended MOVBU Dn Transfer the lowest 8 bits of Dm to the memory location specified by abs32 abs32 MOVB abs16 Dn Transfer with sign extension the 8 bit contents of the memory location specified by abs16 to Dn abs16 is zero extended MOVB abs32 Dn Transfer with sign extension the 8 bit contents of the memory location specified by abs32 to Dn MOVB Dn abs16 Transfer the lowest 8 bits of Dm to the memory location specified by abs16 abs16 is zero extended MOVB Dm abs32 Transfer the lowest 8 bits of Dm to the memory location specified by abs32 MOVHU abs16 Dn Transfer with zero extension the 16 bit contents of the memory location specified by abs16 to Dn abs16 is zero extended MOVHU abs32 Dn Transfer with zero extension the 16 bit contents of the
226. s 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 Therefore when a program divided into multiple files is developed work can proceed without the programmer staying aware of the code size of each file The programmer an also freely change the order in which files are linked The following explanation illustrates a simple example dividing two source files into sections for each routine allocated to two sections Create source files Using an editor create the two programs shown below program3 asm and program4 asm The contents of program3 asm are as follows global main global data set time filler CODE 00 section CODE PUBLIC 1 main mov 0 0 mov Oxff DO mov 0x80 D1 jsr data set jsr time filler bra main DATA section DATA PUBLIC 4 datal ds 4 end 30 Assembling and Linking Multiple Sections Chapter 3 Introduction to Operation The contents of program4 asm are as follows global CODE 01 section data set mov data set loop cmp bcc mov add add bra data set end rts CODE 00 section time filler mov Time filler loop cmp bcc bra time f
227. s block2 if they are not equal nothing will be assembled if there is no else At least one or else block2 the other of parameter and parameter2 must be a dummy parameter within a macro definition 1 endif Bets S can only be used within macro definitions List of Assembler Control Statements 321 Chapter 17 Appendix Syntax Function amp Notes iflt expression Assembles block1 if the expression is negative block1 Assembles block2 if it is not negative nothing will be assembled if there is no else else block2 endif ifle expression Assembles block1 if the expression is zero or negative block1 Assembles block2 if it is positive nothing will be assembled if there is no else else block2 endif ifgt expression Assembles block1 if the expression is positive block1 Assembles block2 if it is not positive nothing will be assembled if there is no else else block2 endif ifge expression Assembles block1 if the expression is zero or positive block1 Assembles block2 if it is negative nothing will be assembled if there is no else else block2 endif ifb dummy_ parameter Assembles block1 if dummy parameter is a null block1 character Assembles block2 if it is not equal nothing will be assembled if there is no else ifb can only be else RAN we block2 used within macro definitions endif ifnb dummy_ parameter Assembles block1 if dummy parameter
228. s of the memory 40992 location specified by abs32 and set the flags according to the result This instruction proceeds through the following three stages 1 Transfer with zero extension the 8 bit contents of the memory location specified with An to a 32 bit internal temporary register BSET Dm An 2 AND the temporary register with the contents of Dm and set the flags according to the result 3 OR the temporary register with the contents of Dm and store the lowest 8 bits of the result in the memory location specified with An This instruction proceeds through the following three stages 1 Transfer with zero extension the 8 bit contents of the memory location specified with d8 and An to a 32 bit internal temporary register BSET d8 An 2 AND the temporary register with zero extended imm8 and set the flags according to the result 3 OR the temporary register with zero extended imm8 and store the lowest 8 bits of the result in the memory location specified with d8 and An 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 BSET imme8 abs32 2 AND the temporary register with zero extended imm8 and set the flags according to the result 3 OR the temporary register with zero extended imm8 and store the lowest 8 bits of the result in the memory location sp
229. s to suppress optimization It is also possible to change the optimization default with an entry in the assembler s start up file See Chapter 1 Getting Started Section 1 5 Setup Od Turn off optimization Functional Description This option disables optimization of instructions by the assembler and linker For the instructions subject to optimization see Chapter 4 Optimization Functions This option overrides any opt on directives included in the source files For further details on the opt on directive see Chapter 9 Writing Machine Language Instructions and Directives Section 9 4 Writing Directives Section 9 4 opt Rules of Use To specify the option enter the hyphen followed by the upper case letter O and the lower case letter d The two letters together function as a single option as103 Od sample asm Default Specification The default is to suppress optimization It is also possible to change the optimization default with an entry in the assembler s start up file See Chapter 1 Getting Started Section 1 5 Setup Command Options 79 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
230. sage example Below is an example use of the tit directive TIT LST Page 1 xxx TEST PROGRAM Loc Object Line Source 1 tit TEST PROGRAM 000000 54 2 dc 0x54 3 end 4 Writing Directive Statements 175 Chapter 9 Writing Machine Language Instructions and 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 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 NOTE The xlistoff and xliston directives themselves are not output Only output to the list file will be suppressed Output of object code will not be suppressed at all Operand coding rules These directives take no operand Usage example Below is an example use of the xlistoff and xliston directives The range from xlistoff to xliston will be suppressed _ CODE section CODE PUBLIC 2 main mov Ox11 DO xlistoff mov 0x22 DO xliston mov 0x33 DO end 176 Writing Directive Statements Chapter 9 Writing Machine Language Instructions and Directive Statements 9 4 18 funcinfo Syntax label operation operand function namefuncinfo label name expression register list where expression Stack frame size
231. sed on the information from the assembler the linker outputs instruction codes with the smallest code size Usage Example 49 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 LABEL The destination label of the BEQ instructions must be in the range 128 to 127 However the assembler cannot make that determination so the following determinations are made during assembly and linking Assembler processing The assembler outputs information about instructions to be optimized to the linker Linker processing 1 The linker inputs information from the assembler 2 The linker determines if the branch destinations of conditional branches are in range 3 If determined to be in range the linker generates the normal code 4 If determined to be not in range the linker will substitute code that can branch correctly The substitution for the above example would be as follows BNE ED JMP LABEL LABEL 50 Usage Example Chapter 4 Optimization Optimization of function calls This section describes the optimizati
232. ssembler SAMPLE LST Library file SAMPLE LIB Relocatable object files 4 i SAMPLE RF 1 9 Executable file Map file m103 map m103 ex Figure 3 1 Files Used The assembler inputs source files and include files and outputs relocatable object files Include files are not special files but are just files that comprise parts of the source file They are incorporated into assembly at the location of include directives defined within source statements Files Used by Assembler and Linker 23 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 Library files are collections of relocatable object files of frequently used programs and hardware interface programs Only needed modules are specified to have the linker extract the appropriate relocatable object files from library files and load them into the executable format file Several library files are provided but you can maintain them or newly create them yourself Refer to chapter 15 Using The Library Manager for details You cannot force
233. ssion block1 block1 ls 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 else directive has been coded block2 will be assembled ifle If the value of expression is 0 or negative block will be assembled If it is positive and an else directive has been coded block2 will be assembled Usage example The first example will be of iflt A source file is shown below size 16 expression of the iflt is not negative so block 2 is assembled MNXXX equ 32 i dsize macro size iflt size 32 mov 0x01 DO else mov 0x02 DO endif endm _TEXT section CODE PUBLIC 1 dsize MNXXX 198 Conditional Assembly Chapter 10 Writing Assembler Control Statements The assembled list file is shown below VE ES Page 1 Series MN1030 Cross Assembler Loc Object Line Source 1 MNXXX equ 32 2 M3 dsize macro size 4 iflt size 32 5 mov 0 01 DO 6 ls 7 mov 0x02 DO 8 ndif 9 endm 10 11 _TEXT section CODE PUBLIC 1 M12 dsize MNXXX 12 iflt MNXXX 32 12X mov 0x01 DO 12 ls 00000000 8002 12 mov 0x02 DO 12 ndif Conditional Assembly 199 Chapter 10 Writing Assembler Control Statements 10 4 5 ifgt ifge Syntax Syntax for ifgt ifgt expression block1 15
234. structions and directives e Assembler control statements that code assembler control instructions Macro control statements that code macro control instructions Comment statements Blank statements Each is coded differently This chapter explains in detail the code syntax and usage examples of machine language instructions and directives Refer to Chapter 8 Writing Source Statements regarding address constants numeric constants expressions and the syntax rules for numbers and characters Refer to the Instruction Manual for detailed descriptions of machine language instructions 146 Purpose of This Chapter Chapter 9 Writing Machine Language Instructions and Directive Statements 9 2 Instruction Statement Fields ae 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 Two operands are delimited by a comma A statement with an LF only omitting all fields is a blank statement Statements are terminated by the LF character line feed 0x0A The maximum number of characters on one line is 255 Instruction Statement Fields 147 Chapter 9 Writing Machine Language Instructions and Direc
235. supply voltage and heat radiation characteristics Otherwise we will not be liable for any defect which may arise later in your equipment Even when the products are used within the guaranteed values take into the consideration of incidence of break down and failure mode possible to occur to semiconductor products Measures on the systems such as redundant design arresting the spread of fire or preventing glitch are recommended in order to prevent physical injury fire social damages for example by using the products 7 When using products for which damp proof packing is required observe the conditions including shelf life and amount of time let standing of unsealed items agreed upon when specification sheets are individually exchanged 8 This book may be not reprinted or reproduced whether wholly or partially without the prior written permission of Matsushita Electric Industrial Co Ltd If you have any inquiries or questions about this book or our semiconductors please contact one of our sales offices listed at the back of this book About This Manual This manual describes the functions and operation of the cross assembler for this series of microcomputers e 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
236. t directory List file contents are entirely in text format so those can be viewed by using an editor Reading List Files 267 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 Supplemental Line Supplemental Source Language Code Information Number Information Statement Loc Object M Line Source Each of these fields is described below Location Loc The location field shows the location counter values during assembly For section address format programs the location field shows the relative value from the start of the section However if the assembly is to output the final list by incorporating the map file from linking the location field will match the execution addresses Machine language code Object This field shows machine language code The eight bits of one byte are shown as two hexadecimal digits These 1 byte 2 byte 3 byte and 4 byte instructions Machine language code supplemental information The characters M and may be added to the machine language code as supplemental information The meaning of each character is as follows This line includes an externally defined symbol whose value will be determined during linking The machine language code does not indicate the final values M This line is a result of macro expansion This line in
237. t file information Since the object file is most likely corrupted re create it 4309 Conflicting option specified option The command line contains options that cannot occur together Oe and f for example Check the command line options 4310 This file has redefined public symbol filename The specified file redefines a public symbol already in the library Check the object files making up the library 4311 Object file number over max 65535 The number of object files in the library exceeds the limit Reduce the number of object files to within the limit 4312 Symbol name length over max 66 symbol A symbol in an object file exceeds the length limit Re create the object file using a shorter name for the symbol 294 Error Messages 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 If the parameter file passes this test the problem could be insufficient memory so check the memory capacity 4315 Not warning message number There is no warning message for
238. tatements 10 3 Identifier Definement Hm LLL 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 Ifthe same process or the same variable has been used several times To make clear of the meaning of the process or the variable 186 Identifier Definement Chapter 10 Writing Assembler Control Statements 10 3 1 define SSS 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 The string can include spaces and tabs If the replacement_string is omitted the identifier will be defined as a null character Everything after a semicolon is considered a comment Therefore semicolons cannot be included in the replacement_string The same identifier cannot just be redefined with another define directive When used in conjunction with the undef directive redefinition is possible Refer to section 10 4 undef for details If the replacement_string is omitted the identifier will be defined as a null
239. ted in the current directory locates the resulting and CONST sections starting at the addresses 80000000 hex and 80005000 hex respectively and generates an executable file m103 ex and map file m103 map in the current directory 90 Command Options 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 Host machine Character coding Sun Parc EUC DOS V Shift JIS PC AT not supported Rules of use This option is specified with the hyphen option specification character followed by the lower case 66599 letter j 1d103 1 sample rf NOTE This option is not available on PC AT machines Default specification The default language used depends on the host machine and the operating system Host machine Character coding Sun Parc English DOS V Japanese in Shift JIS PC AT English It is also possible to change the default message specification with an entry in the linker s start up file See Chapter 1 Getting Started Section 1 5 Setup Command Options 91 Chapter 6 Using Linker Je Output error and warning messages in Japanese using EUC coding Functional descriptio
240. test lib Multiple files can be deleted with one d option To delete test1 rf test2 rf and test3 rf from test lib specify the following 5110103 test lib d testl rf test2 rf test3 rf Command Options 285 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 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 If the file does not exist the library manager will output a warning message and continue processing When no relocatable object file name is specified the externally defined symbols in all relocatable object files that exist in the library file will be output Rules of use To specify the option enter the hyphen followed by the lower case letter 5110103 test lib Operation example 511 103 test lib p testl rf 5110103 test lib p The first example checks whether or not the file test1 rf exists in test lib and if it does outputs the externally defined symbols within it The second example outputs the externally defined symbols in all relocatable object files in test lib 286 Command Options Chapter 15 Using Library Mana
241. test2 rf test3 rf NOTE This option is not available on DOS V or PC AT machines Default specification The default language used depends on the host machine and the operating system Host machine Message language Sun Sparc English DOS V Japanese in Shift JIS PC AT English Command Options 277 Chapter 15 Using Library Manager Output error and warning messages in Japanese using Shift JIS a encoding 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 test lib f Js testl rf test2 rf test3 rf NOTE This option is not available on PC AT machines Default specification The default language used depends on the host machine and the operating system Host machine Message language Sun Sparc English DOS V Japanese in Shift JIS PC AT English 278 Command Options 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
242. the number specified with the W option Check the number specification Error Messages 295 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 Check the library file specification 4504 Memory allocation error The library manager was unable to allocate memory Check the amount of memory available 4505 Cannot open file filename The library manager was unable to open the specified file Make sure that the file name exists and has the proper access permissions 4506 Cannot read file filename The library manager was unable to read the specified file Make sure that the filename exists and has the proper access permissions 4507 Cannot write file filename The library manager was unable to write to the specified output file Check the file system capacity 296 Error Messages Chapter 16 Notes on Operating Environment Chapter 16 Notes on the Operating Environment 16
243. tion 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 There are two extra symbols overlay table and iram manage The address is in hexadecimal ld103 T CODE 80000000 main rf sub rf OVL 1 TEXT 40000000 segl rf PUT overlay table a0000000 PUT iram manage 30000000 Default specification The default for the extra symbol iram manage is the address 0 that for overlay table the address following the last section in the external memory Instruction RAM Support 113 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 progl 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 GDATA 1000 main rf sub rf OVL 1 TEXT 40001000 progl rf OVL 2 TEXT 40002000 prog2 rf OVL 3 TEXT 40003000 prog3 rf The linker first places all sections with the CODE attribute from main rf and sub rf in the order that they appear in the input files beginning at the address 80000000 hex It places al
244. tion See the default settings for the following operations Operation Default Setting UNIX and PC AT versions English DOS V version Japanese Message to output 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 rom extensions Conversion range From the start to the end address in EX format file Rules of output file name Based on input file name or the file name specified with option change the extension It is an output file name The rules are different from each option specified Option Extension i hex S3 S2 S1 mot default hex In addition a file with extension is output with them The file contains its tool information File Conversion Utility 11 Chapter 1 Getting Started Example of specifying options 1 Specify the range of data conversion R 103 R1000 1020 sample ex Converts the data between the address 1000 and the address 1020 in the file of sample ex Specify the start address upon format conversion A 103 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 The example above conversion has performed as the start address for t
245. tion 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 The conditions are reversed when ifdef is used Coding rules In addition to ifdef endif all directives listed in chapter 10 Writing Assembler Control Statements section 10 5 Conditional Assembly can be used The exitm directive can be used at any location The assembler will terminate macro expansion after it appears The exitm directive can only be used within macro definitions Usage example Usage example with ifb directive A source file is shown below The identifier TEST is used for the condition In main the first macro call is made with TEST undefined This causes exitm to be executed so jsr debug will not be expanded TEST is defined before the second macro call so here the statements after endif will be assembled Forced Termination of Macro Expansion exitm 215 Chapter 11 Writing Macro Control Statements extml ifndef endif define j e S 5 ndm ection xtml EST xtml debug debug CODE PUBLIC 1 The list file is shown below The second macro call has been expanded after endif Loc 00000000 00000002 00000004 0000000c Object 8
246. tive 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 When the label is omitted it must be replaced with at least one space or tab Terminology Column This is a column on the display or printer paper One character takes one column Columns are counted from the left as column 1 2 etc Coding examples ABEL jONGLABELLONGLABELLONGLABELLONGLAB main start cont The following examples are incorrect 1LABEL Starts with a digit STAR Uses a prohibited character STAR Does not start from the first column 148 Instruction Statement Fields 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 Coding examples CONST1 equ 10 _ CODE section CODE PUBLIC 2 start mov CONST1 DO rts Instruction Statement Fi
247. 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 That can be accomplished by editing the source file but if that editing is spread throughout the program mistakes will be easy to make It is convenient to use assembler directives in such cases The conditions for assembly are defined at the start of the program and programs to be assembled when the conditions are satisfied or not satisfied are written in the source file Create source file Using an editor create the program program5 asm shown below The contents of program5 asm are as follows fdefine DEBUG dat set macro adr dat mov adr AO mov dat DO mov DO 0 endm _CODE section CODE PUBLIC 2 main DEBUG ifdef dat_set datal 0 11 else dat_set datal 0x22 _DATA section DATA PUBLIC 2 datal dw 0 data2 dw 0 end The operation of this program is meaningless The program will be used instead to explain program structure as it pertains to conditional assembly The define DEBUG on the first line selects DEBUG as a condition by defining the identifier DEBUG In the assembly control block starting with ifdef DEBUG on line 13 the instructions between ifdef to else will be assembled if DEBUG has been defined and the instructions between
248. tput 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 Rules of use This option is specified with hyphen option specification character followed by the lower case letter m The map file name will be the name of the first file specified in the link command with the extension MAP The map file will be output to the same directory as the directory where the executable format file is generated 1d103 m main rf sub rf Default specification A map file will not be output The default can be changed to output a map file by using customization Refer to section 1 5 User Customization Operation example 1d103 o user obj main ex m T CODE 80000000 progl rf prog2 rf The above command line links two relocatable object files prog1 rf and prog2 rf located in the current directory locates the resulting CODE section starting at the address 80000000 hex and generates an executable file main ex and map file main map in the directory user obj ld103 m T TEXT 80000000 T CONST 80005000 progl rf prog2 rf The above command line links two relocatable object files prog1 rf and prog2 rf loca
249. tructions arithmetic instructions logical instructions bit manipulation instructions and user defined instructions e Unconditional branches that undergo optimization Data transfer arithmetic logical bit manipulation and user defined instructions that undergo optimization Coding is not a simple task if the programmer must always select the optimal instruction from the above instructions In particular it is nearly impossible to select the optimal instructions when coding a program divided between files in section format The optimization functions provide a solution to these problems The assembler and linker use them to produce the optimal code no matter what the source code The assembler evaluates the source statement notation It evaluates the immediate data memory specifications and displacement data appearing as operands to a data transfer arithmetic logical bit manipulation and user defined instructions and selects the shortest version of the instruction The assembler also examines unconditional branches choosing the shortest versions for the CALL CALLS JMP and JSR instructions The linker evaluates instructions that were the object of optimization and selects the optimal codes As a result the programmer must be aware that the generated code will differ from the source statements coded in the list file 18 Programming with Assembler Chapter 2 Program Development Flow Conditional assembly If a prog
250. ts of Am from An and store the result in An SUB imm32 Dn Subtract imm32 from Dn and store the result in Dn SUBTRACT with BORROW Mnemonic Description of operation Subtract the contents of Dm and the carry flag from Dn and store the result in SUBC Dm Dn Dn List of Machine Language Instructions 237 Chapter 12 List of Machine Language Instructions MULTIPLY Mnemonic Description of operation Multiplies the 32 bit signed integer multiplicand in Dm by the 32 bit signed MUL Dm Dn 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 MULU Dm Dn unsigned integer multiplier in Dn and store the upper 32 bits of the product in and the lower 32 bits in Dn DIVIDE Mnemonic Description of operation Divide the 64 bit signed integer dividend with its upper 32 bits in MDR and DIV Dm Dn its lower 32 bits in Dn by the 32 bit signed divisor in Dm and store the 32 bit remainder in MDR and the 32 bit quotient in Dn Divide the 64 bit unsigned integer dividend with its upper 32 bits in MDR DIVU Dm Dn and its lower 32 bits in Dn by the 32 bit unsigned divisor in Dm and store the 32 bit remainder in MDR and the 32 bit quotient in Dn INC Mnemonic Description of operation INC Dn Add 1 to the contents of Dn and store the result in Dn INC An Add 1 to
251. ttribute of the calculated result of the expression coded in the operand must be abs absolute For a discussion of expression attributes see Chapter 8 Writing Source Statements Section 8 7 Expressions 8 7 4 Expression Attributes The expression value must be a power of 2 in the range 1 to o 2 4 8 16 32 64 128 256 If the expression value is not a power of 2 the assembler will generate an error and round up to the next greater power of 2 In such a case if the assembler s r option has been specified the assembler will generate a relocatable object file even with the error When the expression value is between 5 to 7 it can be round up to 8 Also when the expression value is between 17to 31 it can be round up to 32 156 Writing Directive Statements 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 DATA PUBLIC 4 00000000 2 TABLE 00000000 01 3 0 01 00000001 02 4 0 02 00000002 03 5 0 03 6 align 6 align asm 6 Warning 2002 Illegal operand value 00000008 04 7 0 04 00000009 05 8 0 05 0000000a 06 9 0 06 10 align 8 00000010 07 TT dc 0x07 00000011 08 12 dc 0x08 13 align 16 00000020 09 14 dc 0x09 00000021 0A 15 dc 0x0a Errors 0 Warnings 1 align asm
252. ult specification The default language used depends on the host machine and the operating system Host machine Character coding Sun Parc English DOS V Japanese in Shift JIS PC AT English It is also possible to change the default message specification with an entry in the linker s start up file See Chapter 1 Getting Started Section 1 5 Setup Command Options 93 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 The two letters together function as a single option ld103 Jj sample rf NOTE This option is not available on DOS V or PC AT machines Default specification The default language used depends on the host machine and the operating system Host machine Character coding Sun Parc English DOS V Japanese in Shift JIS PC AT English It is also possible to change the default message specification with an entry in the linker s start up file See Chapter 1 Getting Started Section 1 5 Setup 94 Command Options Chapter 6 Using Linker e Output error and warning messages in English
253. uses 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 The two letters together function as a single option as103 Je sample asm NOTE This option is not available on DOS V or PC AT machines Default Specification The default language used depends on the host machine and the operating system Host machine Message language Sun Sparc English DOS V Japanese in Shift JIS PC AT English It is also possible to change the default message specification with an entry in the assembler s start up file See Chapter 1 Getting Started Section 1 5 Setup Command Options 71 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 The two letters together function as a single option as103 25 sample asm NOTE This option is not available on PC AT machines Default Specification The default language used depends on the host machine and the
254. value If omitted the assembler will assume 0 expression3 iterations If omitted the assembler will assume 1 Functional description This directive reserves a memory area of the number of bytes specified by expression of the operand When expression2 initial value is specified that memory area will be filled with the initial value Note that expression2 can be specified only when the value of expressionl is 4 orless When expression3 iterations is specified the same specification will be repeated for the number of iterations For example if the operand is 4 0 3 a 4 byte area will be filled with 0 three times Thus a 12 byte area will be reserved When a name is coded for the label the assembler will assign the current location counter value to that name Operand coding rules The expression bytes expression2 initial value and expression3 iterations coded in the operand must result in the attribute abs absolute Refer to section 8 7 4 Expression Attributes regarding attributes of expressions NOTE When expression2 is omitted expression3 cannot be specified Writing Directive Statements 167 Chapter 9 Writing Machine Language Instructions and Directive Statements Usage example Below is an example use of the ds directive Loc Object 00000000 00 00000001 1122 DC LST PanaX Series MN1030 Cross Assembler Line 1 2 3 00000003 3344556633445566 4 Source _DAT
255. vided for this The programmer uses the debugger to download generated and linked object code and verify operation The g option of the assembler and linker generates information that allows the debugger to work with symbols This allows symbols to be used for specifying debugger start addresses breakpoint settings memory references and changes etc Programming with Assembler 19 Chapter 2 Program Development Flow 20 Programming with Assembler Chapter 3 Introduction to Operation 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 Next it explains assembler and linker use when assembler control statements and macro instructions are included for high level operations After reading this chapter once through and trying actual operation you will have mastered basic assembler and linker operation 22 Purpose of This Chapter Chapter 3 Introduction to Operation 3 2 Files Used by Assembler and Linker BE Figure 3 1 shows the inter relationships of the files used by the assembler and linker Include file Source file SAMPLE H Map file SAMPLE MAP SANPLE ASM 1 List file A
256. when a list file is specified to the list file W number Do not output warning messages of the specified number Output will not be performed to either the screen or list file Refer to chapter 13 Error Messages for warning messages and their corresponding numbers Wall Do not output any warning messages I path_name Specify the path name of the directory that contains files specified by Preprocessor include options D identifier Specify an identifier to be used by ifdef during conditional assembly g Output debug information to the relocatable object file Program generation Od Turn off optimization Turn on optimization h Display a listing of available assembler options on the console Others Display the assembler s version number the console 62 Starting Assembler 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 For the details of the interpretation when an option is omitted see the description below for that option Command Options 63 Chapter 5 Using Asssemb
257. with the hyphen option specification character followed by the lower case letter g ld103 g main rf sub rf Default specification Debug information will not be output Itis also possible to change the default with an entry in the linker s start up file See Chapter 1 Getting Started section 1 5 Setup Command Options 97 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 Section may be specified by section name section attribute or both To specify a section attribute precede the name of the attribute with the character Multiple sections may be specified together as a comma delimited list The starting address is given in hexadecimal In T CODE abc ABC is a hexadecimal number 142103 T CODE 80000000 T DATA 0 progl rf prog2 rf 14103 5 80000000 main rf _CONST 80002000 sub rf 1d103 EXT CODE 80000000 testl rf test2 rf Be careful with the specification order for files sinc
258. x1 Writing Directive Statements 171 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 Object 8020 800A 8008 2C0010 PanaX Series Line 10 5 WN FP equ lst Page 1 MN1030 Cross Assembler Source MEMORY MOTOR STOP BASE equ equ equ equ section mov mov mov mov 0x20 10 0500001000 0x1000 CODE PUBLIC MEMORY DO MOTOR DO STOP DO BASE DO 1 172 Writing Directive Statements 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 For external declarations the global directive declares that the names coded in the operand can be referenced externally The global directive can be coded anywhere in a source programs Operand coding rules Write the name coded in the label field as an operand Generally this will be a progra
259. xecute next instruction BNS label NF 1 If NF 1 execute a relative branch to the address specified by label Range 128 to 127 If NF 0 execute next instruction BRA label 1 Unconditionally execute a relative branch to the address specified by label Range 128 to 127 List of Machine Language Instructions 245 Chapter 12 List of Machine Language Instructions Conditional BRANCH for LOOP Mnemonic Meaning Description of operation LEQ If ZF 1 branch to the top of the loop as specified with SETLB ZF 1 If ZF 0 execute next instruction LNE If ZF 0 branch to the top of the loop as specified with SETLB ZF 0 If ZF 1 execute next instruction LGT lt signed If ZF 0 and NF VF branch to the top of the loop as specified with SETLB If ZF 1 or NF VF execute next instruction LGE lt signed If NF VF branch to the top of the loop as specified with SETLB If NF VF execute next instruction LLE gt signed If CF 1 or ZF 1 branch to the top of the loop as specified with SETLB IUf CF 0 and ZF 0 execute next instruction LLT gt signed If NF 1 and VF 1 or NF 0 and VF 0 branch to the top of the loop as specified with SETLB If NF 1 and VF 0 or NF 0 and VF 1 execute next instruction LHI unsigned If CF 0 and ZF 0 branch to the top of the loop as specified with SETLB If CF 1 or ZF 1 execut
260. y radix 8 octal radix 10 decimal and radix 16 hexadecimal NOTE In extended C language format the default radix cannot be specified by the radix directive The default is fixed as radix 10 decimal and it cannot be changed to another radix Operand coding rules The expression coded in the operand must result in the attribute abs absolute Refer to section 8 7 4 Expression Attributes regarding attributes of expressions The calculated result of the expression coded in the operand must be either 2 8 10 or 16 The radix of the expression in the operand is always 10 decimal regardless of the current default radix If the expression results in a number that does not specify a radix the assembler will generate an error and ignore this directive Usage example Below is an example use of the radix directive radix 16 radix BINARY Writing Directive Statements 165 Chapter 9 Writing Machine Language Instructions and Directive Statements 9 4 10 dc Syntax label operation operand name constant expression constant expression Functional description This directive is used to define constants in a memory area 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 Operand coding rules
261. y on the screen MAIN ASM 5 Error 2304 Instruction not found This line works with tag jumps regardless of the character position on screen Look at the display of function key F10 on the CRT screen It should be Tag JP This key specifies a tag jump so try pressing F10 The screen will switch and the cursor will be placed at the source file statement in which the error was detected _ CODE section CODE PUBLIC 1 data equ c main mov Ox11 DO move Ox11 DO mov DO data main end Fix errors The cursor will be located on the fifth line Fix the error here Change move to mov That alone fixes the line Switch the screen again to the error file Personal Computer Versions 307 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 308 Personal Computer Versions Chapter 17 Appendix Chapter 17 Appendix 17 1 This section shows the numeric restrictions on this series cross assembler Be sure not to exceed these values when writing programs Ass
262. y will be regarded as an absolute attribute e REL relative attributes The label is already defined in the same file at the reference the label referring forward EXT external reference attributes The label is declared with global pseudo instruction and defined by another file The rules for connecting attributes are as follows For unary operators Attribute of Operand Attribute of Result UND UND ABS ABS REL REL EXT EXT 142 Expressions For addition operator Chapter 8 Writing Source Statements instruction must result in absolute attributes ABS Operand 2 addition UND ABS REL EXT UND UND UND UND UND ABS UND ABS REL EXT Operand 1 REL UND REL REL EXT EXT UND EXT EXT EXT For Subtraction operator operand operand2 SUBTRACTION Operand 2 UND ABS REL EXT UND UND UND UND UND ABS UND ABS REL EXT Operand 1 REL UND REL REL EXT EXT UND EXT EXT EXT For 96 lt lt gt gt amp operators operand1 operator operand2 f 96 lt lt gt gt amp Operand 2 UND ABS REL EXT UND UND UND UND UND ABS UND ABS REL EXT Operand 1 REL UND REL REL EXT EXT UND EXT EXT EXT NOTE The expressions writing in directive coding instructions and assembler control Expressions 143 Chapter 8 Writing Source Statements
263. yntax 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 e Extended C language format Intel format Matsushita format Each format gives a specific way to represent binary octal decimal and hexadecimal numbers as well as character constants The notation directive selects which format numbers and character constants will be coded with This directive can be coded any number of times in a program Refer to Chapter 8 Writing Source Statements section 8 7 Expressions section 8 7 4 Expression Attributes Operand coding rules The strings that can be specified in the operand and the format that they select are listed below operand Format CLANG Extended C language format INTEL Intel format PANA Matsushita format If other strings are specified the assembler will generate an error and ignore this directive 160 Writing Directive Statements Usage example Chapter 9 Writing Machine Language Instructions and Directive Statements Below is an example use of the notation directive Loc 00000000 00000001 00000002 00000003 00000004 0000005 0000006 0000007 0000008 00000009 0000000a 0000000b 0000000c notation lst page 1 xxx
Download Pdf Manuals
Related Search
Related Contents
MIMOSA CANALIZZABILE 1769-UM001 - Rockwell Automation Lexmark C530 User's Manual all-purpose manual Brinkmann Kettle Grill Charcoal Grill User Manual Service Manual - BrandsMart USA Epson Stylus Color 900 Ink Jet Printer Product Support Bulletin ECOstyle - Van nature bewust Español - Kopimask ficha técnica genius goc Copyright © All rights reserved.
Failed to retrieve file