Home

TICE99IDE Cross Assembler User Manual Rev V1.2

image

Contents

1. 1 1010 11 3 2 Chip Type 0 222222222 6 6 66006 11 77 111 0 11 3 3 Other Instructions 602 62 6 66606 12 LY ADDR 7 7 111111 12 2 3 1 0 12 95 ea Ne GBYTE ci 12 CSN NN TT 12 DN eS a I Sr mene Ure NTT ee eee Nery 13 5 87 631111111 3 13 G 3 1 11 1 7 7 1 13 8 DEF 13 9 DEFINEOLDSTYLE 2 2 31
2. 7 1 23 PARE OG WN 23 33 MAC 7 7 797 77 7 78 7 7 24 GSEMATCH 2 3 233 33 3 3131111 1111 111111 25 O3 MAIN aces 3 1 111 100 26 30 ORG a 83 7 171 26 77 1 27 38 2 0 0 27 9 8 28 40 RPLANE T 500 5 28 41y SEGMENT 420023506204 29 42 0 29 43 33 1 13113151115131311111 1 90 30 A 31 UM TICE99IDEASM_E 4 Rev 1 2 2014 04 10 A EE i TI
3. HE TICE99IDE ross Assembler User Manual Rev V1 2 tenx reserves the right to change or discontinue the manual and online documentation to this product herein to improve reliability function or design without further notice Tenx does not assume any liability arising out of the application or use of any product or circuit described herein neither does it convey any license under its patent rights nor the rights of others Tenx products are not designed intended or authorized for use in life support appliances devices or systems If Buyer purchases or uses tenx products for any such unintended or unauthorized application Buyer shall indemnify and hold tenx and its officers employees subsidiaries affiliates and distributors harmless against all claims cost damages and expenses and reasonable attorney fees arising out of directly or indirectly any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that tenx was negligent regarding the design or manufacture of the part 2 gt ik TICE99IDE Cross Assembler User Manual AMENDMENT HISTORY Version Date Description V1 0 Aug 2012 New release 1 Modify Features section 2 Replace number system with value system 3 Add and in Logical Operations section 4 Add else if V1 1 Jan 2013 5 Add comment 6 Add _main 7 Add reference between EXPORT IMPORT and AUTOIMPORT 8
4. MOD modular operator lt Example gt addr equ 4 movlw addr 3 movlw 1 movlw addr mod 4 movlw 0 lt lt left shift operator lt Example gt adde equ 2 movlw adde lt lt 2 movlw 8 gt gt right shift operator lt Example gt adde equ 8 movlw adde gt gt 2 movlw 2 I BITOR bit wise OR operator lt Example gt adde equ 2 movlw addr 4 movlw 6 movlw addr BITOR 2 movlw 2 UM TICE99IDEASM_E 8 Rey 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual amp BITAND bit wise AND operator lt Example gt adde equ 6 movlw adde amp 4 movlw 4 movlw adde BITAND amp 2 movlw 2 BITNOT bit wise NOT operator lt Example gt Correct adde equ 2 molvw adde amp FF FD movlw BITNOT adde FF FD Wrong adde equ 2 movlw adde movlw BITNOT adde BITXOR bit wise XOR operator lt Example gt adde equ FO movlw adde FF movlw 0F adde BITXOR FF movlw 0F parentheses lt Example gt Two tier parentheses calculation HIGHT equ 10 5 2 3 or assign operator equal to lt gt or comparison operator not equal to lt comparison operator less than gt comparison operator greater than lt comparison operator less than or equal to gt comparison operator greater than or equal to
5. SET_BANKO The same as BSF 03H 5 The same as using define instruction to define define SET_BANKO BSF3 5 SS OMC UM TICE99IDEASM_E 14 Rev 1 2 2014 04 10 i TICE99IDE Cross Assembler User Manual 11 DN Declare a variable to replace the address of data RAM and define the Byte amount of data RAM which is occupied by this variable In the program this variable can directly replace the address of data RAM address This instruction can only be declared inside RAM segment and constant segment The declaration is as follows Variable DN Value where Variable variable name Value declare byte count of data RAM which is occupied by this variable but it does not exceed max address of the data RAM This instruction must be used together with ORG instruction in order to define the starting address of the data RAM lt Example gt RAM ORG 20H Define the start address of data RAM variable DISPLAY DN 1 Declare the data RAM 20H address as DISPLAY SPEED DN 2 Declare the data RAM 21H and 22H address as SPEED SPEED replaces the 21H address of data RAM SPEED 1 replaces the 22H address of data RAM CHAR DN 1 Declare the data RAM 23H address as CHAR ORG 30H LCD1 DN 1 Declare the data RAM 30H address as LCD 1 ENDRAM CODE movwf SPEED SPEED replaces data RAM 21H address SPEED 1 replaces data RAM 22H address END UM TICE99IDEASM_E 15 Rev 1 2 2014 04 10 gt ik TICE99IDE Cross Assembler User Manual
6. 0 1 0 14 0 14 1 111 1 11 0101 15 O DWORD 1 6 11 1 16 13 1 7 1 0 16 14 ELSEIF 16 15 1 16 16 ENDMAC ENDMACRO 16 I ENDPROC 7 9006 76111 410 0 16 LS 11 11 0701 17 111 17 UM TICE99IDEASM_E 3 Rev 1 2 2014 04 10 A lt gt ik TICE99IDE Cross Assembler User Manual y 20 SEXITMAC S S a eine 18 OD EXPORT 7 7 7771 1 1 7 18 22 077 7 7 7 7 7 Reo 18 et 19 24 FPLEANET 333 3 3 0 1 1331 10 0 20 25 GLOBAL 20 PN 3 1 21 QT 333333333 3 3131 1111111 0 0 21 11111111111 22 CO 17 777 7 22 GO IMPOR E NR E or E E E er R EE SSG 23 INCLUDE re 333 2 9
7. 12 Define 4 byte data type this instruction must be followed by a series of consecutive expressions lt Example gt dword 12344512 12FA489 13 ELSE Conditional instruction which is used to reverse the condition expression Please refer to ERROR 14 ELSEIF ELSE IF Conditional instruction which is used to reverse current condition expression and to check other conditional expressions Please refer to ERROR ELSEIF is compatible with ELSE IF instruction 15 ENDIF Conditional instruction which ends an IF or ELSE statement Please refer to ERROR 16 ENDMAC ENDMACRO End of macro definition Please refer to MACRO 17 ENDPROC End of part of program segment Please refer to PROC 6 I UM TICE99IDEASM_E 16 Rev 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual 18 EQU This instruction is used to define constant and it is case sensitive Declaration is as follows Constant EQU data where Constant constant name Data constant content lt Example gt VALUE1 EQU 10H lt Example 2 gt RODATA AH EQU 00H BH EQU OIH CODE MOVLW AH AH is equal to 00H MOVLW BH BH is equal to 01H END 19 ERROR Assembly error warning Assembler will output a user defined error message and therefore object file will not be created This instruction is used to check the conditions which must b
8. lt Example gt dbyt 1234 4512 The byte results are 12 34 45 12 and will be written into current segment according to this order 7 DEFINE This instruction must be followed by an identifier macro name in addition it can be followed by a series of variable in parentheses After the parentheses can be followed by a series of variable please refer to MACRO 8 DEF DEFINED This instruction must contain a defined parameter inside the parentheses This parameter will be checked if this parameter has been defined somewhere else before current program position the function will return TRUE otherwise return FALSE Below lt Example gt can replace JFDEF instruction lt Example gt if defined a UM TICE99IDEASM_E 13 Rev 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual 9 DEFINEOLDSTYLE Declare identifier name can use special character such as etc default value is allow identifier name using special character lt Example gt defineoldstyle on enabled T_0 5S equ 3DH define LCDBrightness_ 12Div19 b 00000001 define LCDpin_use_com 0 3 andseg 20 23 b 00010000 define LCD_ON 0x23 movlw LCDBrightness_ 12Div19 movlw LCDpin_use_com 0 3 andseg 20 23 movlw LCD_ON movlw LCDBrightness_ 12Div19 movlw LCD_ON movlw T_0 5S defineoldstyle off disabled 10 DEFSTR defstr defstring lt Example gt SET_BANKO defstr BSF 03H 5
9. 71 72 73 74 75 76 77 78 No open lexical level Segment attribute mismatch Segment stack overflow Segment stack is empty Segment stack is not empty at end of assembly Reserved Counter underflow Reserved Reserved File name s not found in file table DN must define in RAM segment DN must be used in RAM segment ENDRAM expected RAM and ENDRAM must be in pairs DN expected TICE99IDE Cross Assembler User Manual LDN must be used in RAM segment Please refer to Pseudo Instruction Other Instructions Illegal data Operand error The number of the operand is error lt Example gt movlw sre lt lt 1 1 Correction movlw src lt lt 1 Cannot open COE file Please make sure whether COE file exists Reserved UM TICE99IDEASM_E 35 Rey 1 2 2014 04 10 l gt i TICE99IDE Cross Assembler User Manual 79 Program ROM XXXXH out of range YYY YH The max address of Program ROM is YYYYH XXXXH is out of range 80 Table ROM XXXXH out of range YYY YH The max address of Table ROM is YYYYH XXXXH is out of range 00 0 0505080 0 0 0 UM TICE99IDEASM_E 36 Rev 1 2 2014 04 10
10. FPLANEO pseudo instruction are all defined in R Plane location 2 Constant variable INDF and the other variables which are defined before FPLANE1 pseudo instruction are all defined in F Plane bankO location 3 Constant variable ABC_B1 and variables defined later are all defined in F Plane bank1 location Note 1 Without declare pseudo instruction of RAM block the variable are defined in F Plane bankO location by default 2 If there is bank in operating memory and declare a constant variable in F Plane bank1 user still needs to control bank switch during instruction operation i e by using instruction bsf 0x3 5 to switch to bank1 3 The purpose of FPLANEO FPLANE1 or RPLANE pseudo instructions is to classify the defined constant variable according to RAM block and it can be shown according to the class in TICE99IDE assembler variable window It is shown as below figure UM TICE99IDEASM_E 19 Rev 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual A 1 INDF 0000h 11111111 FF 255 E 1 TIMERO 0001h 11111111 FF 255 1 PC 0002h 11111111 FF 255 1 STATUS 0003h 11111111 FF 255 1 FSR 0004h 11111111 FF 255 i PAD 0005h 11111111 FF 255 1 PBD 0006h 11111111 FF 255 n 1 RSR 0007h 11111111 FF 255 A f Space VarName Address Bn Hes Value 1 INTF1 0009h 11111111 FF 255 1 INDR 0000h 11111111 FF 255 a 1 TIMERIL 000dh 11111111 FF 255 1 OPTION 0002h 11111111 FF 255 1 TIMERIH 0008h 111111
11. 14 expected A right parenthesis is missing in the arithmetic operation 15 Reserved 16 expected lt Example gt BCF port Correction BCF port 0 17 Boolean switch value expected on off 18 Reserved 19 Reserved 20 Integer constant expected 21 String constant expected lt Example gt include a asm Correction include a asm 22 Character constant expected 23 Constant expression expected Constant name is undefined 24 Identifier expected The character in variable constant and label can only contain below text symbols 0 9 a Z A Z _ however cannot be started with the number 0 9 25 ENDMACRO expected ENDMACRO instruction must be used together with MACRO 26 Option key expected 27 expected 28 Reserved UM TICE99IDEASM_E 32 Rev 1 2 2014 04 10 HE y 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 User error User defined error message String constant too long The max size of string constant is up to 255 characters Newline in string constant String constant must be in the same line Illegal character constant lt Example gt BYTE c1 2 Correction B YTE 6 2 Illegal addressing mode Illegal character to start local symbols Ilegal use of local symbol Illegal segment name Illegal segment attribute Illegal macro package name
12. Add default value for DEFINEOLDSTYLE ji Modify the autoimport directive description Yua SG SIS 2 High line important directive import export autoimport UM TICE99IDEASM_E 2 Rev 1 2 2014 04 10 2 e gt ik TICE99IDE Cross Assembler User Manual 2 3 3 33 1 1 1 5 3 3 1 5 1 1 Naming 5 1 2 Case 1 333333 11 1 311 1111 1 1 1111 1 1 5 2 6 2 3 2323 2223 3 11590 7 Bak 2 332 2 2 3233 31 3 1 131 1 1 31 131 11 15 1 sssr 7 2 2 Arithmetic Bitwise and Logical Operations 22 62 6056 8 3 Pseudo InstructiONS 2 2 3 11 3 1 Local Specified Instructions 202222 6 66006 11 1 CODE 1 1 1 40 11 O CRODATA 33 3 1 0 0 11 BG END 071
13. amp amp AND Boolean AND operator UM TICE99IDEASM_E 9 Rey 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual lt Example gt adde equ 0 IF adde gt 1 1 movlw adde Will not execute ENDIF II OR Boolean OR operator lt Example gt adde equ 1 IF adde gt 1 Il 1 movlw adde 02 movlw 03 ENDIF XOR Boolean XOR operator lt Example gt adde equ 20 IF adde gt 20 xor 0 movlw 20 ENDIF 1 NOT Boolean NOT operator lt Example gt adde equ 1 IF adde gt 20 movlw 20 ENDIF UM TICE99IDEASM_E 10 Rev 1 2 2014 04 10 A lt gt ik TICE99IDE Cross Assembler User Manual Y 3 Pseudo Instructions 3 1 Local Specified Instructions Below segments have no precedence order however each segment must use KEYWORD to separate each other No need to define unused segment 1 CODE Switch to code segment case insensitive Define the program source code in this segment It is abbreviation of segment CODE 2 RODATA Switch to data segment case insensitive It is used to define Table ROM contents in addition it can use labels 3 END Case insensitive it can be declared only once Assembler will be forced to terminate if this instruction is encountered Assembler will stop here although the end of instruction is read from include file 3 2 Chip Type Instruction 0 CPU Case insensitive it can be declared only
14. 11 FF 255 1 PWRDOWN 0003h 11111111 FF 255 1 PWMODUTY 000Ch 11111111 FF 255 1 RO4_CLRWDT 0004h 11111111 FF 255 1 PDD 0012h 11111111 FF 255 1 PAE 0005h 11111111 FF 255 1 PED 0013h 11111111 FF 255 1 PBE 0006h 11111111 FF 255 1 PFD 0014h 11111111 FF 255 1 PWMOPRD 0007h 11111111 FF 255 1 PWM1DUTY 0016 11111111 FF 255 1 PAPU 0008h 11111111 FF 255 1 PBPU o009h 11111111 FF 255 1 WKTPSC 000Bh 11111111 FF 255 1 ROC 000Ch 11111111 FF 255 4 1 TM2CTRL 000Dh 11111111 FF 255 ASM F Plane 1 ASM F_Plane 2 ASM A_Plane 1 TKCTRL 000Eh 11111111 FF 255 EE 1 TESTREG 000Fh 11111111 FF 255 1 CLKCTRL 0010h 11111111 FF 255 1 LCDCTRL 0011h 11111111 FF 255 1 PDE 0012h 11111111 FF 255 1 PEE 0013h 11111111 FF 255 1 PFE 0014h 11111111 FF 255 oe 4 gt 24 FPLANE1 The same as FPLANEO define the declared variable is in F Plane Bank1 location 25 GLOBAL Declare global symbols This instruction declaration must use commas to separate a list of symbols The list of symbols are defined somewhere in source code and they are exported Import must be applied when other program needs to use these symbols Besides the same symbol is allowed to be used both in IMPORT or EXPORT instructions lt Example gt global foo bar UM TICE99IDEASM_E 20 Rev 1 2 2014 04 10 gt ik TICE99IDE Cross Assembler User Manual 26 IF Evaluate an expression and based on the result value of the expression to determine whether assembler proce
15. Assembler User Manual Define the entry point of program in ASM file same as void main in C program to let Link program set the PC value which is suggested when there are more than one ASM in one project or it is mixed project 36 ORG Define a starting address for the follow up program or the use of variable declarations It can be defined multiple times in the same segment If it is used in table segment RODATA it is not suitable for C and ASM hybrid project It is suggested for user to use in pure ASM project can use with RELOC instruction to avoid mistaken overlap condition This instruction is case insensitive and the declaration is as follows 0860 Setting_addr Setting addr program RAM or Table ROM address When using ORG instruction in code segment user can directly define next effective source address in the program But behind the label name cannot be followed by ORG lt Example gt code org movlw org movlw OxOa 1 30H OxOb 0 40H OxOc 1 50H 30H 1H 40H 2H 50H 3H Program PC address is 30H Program PC address is 40H Program PC address is 50H When using ORG instruction in RAM segment user can directly define next data RAM address which is represented by data RAM variable which is defined by DN instruction UM TICE99IDEASM_E 26 Rey 1 2 2014 04 10 d gt ik TICE99IDE Cross Assembler User Manual 37 PARAMCOUNT Used in macro to decid
16. CE99IDE Cross Assembler User Manual Features 1 Operand can be defined as constant and the constant can perform arithmetic bitwise and logical operations 2 Macro function Frequently used program can be written as Macro which can be called by other programs 3 Can compile and link multiple source files Please refer to TICE99 IDE User Manual 4 Each project can set library path for itself Please refer to TICE99 IDE User Manual 5 Provide multi line comment which is similar with C language This is comment and conditional compiler pseudo instruction if elseif endif 1 Limitations 1 1 Naming Rule The string of variable constant and label can only use below text symbols 0 9 a z A Z however cannot be started with the number 0 9 Length of name is unlimited 1 2 Case Sensitive When assembling label name and macro name user can decide whether to set as case sensitive default setting is case sensitive please refer to CASE UM TICE99IDEASM_E 5 Rey 1 2 2014 04 10 A gt ik TICE99IDE Cross Assembler User Manual y 1 3 Symbols and Labels 1 Numeric constants Numeric constants are defined using equal sign for example two 2 Then user can use constant two at anywhere in the program and the content is 2 lt Example gt four two two 2 Standard labels 1 The usage of labels is to define a label name at the beginning of each line and the label
17. Illegal emulation feature Illegal scope specify Syntax error Symbol is already defined Symbol is defined repeatedly Undefined symbol If the symbol name is in other source file please use AUTOIMPORT ON Symbol is already marked as import Symbol is already marked as export TICE99IDE Cross Assembler User Manual UM TICE99IDEASM_E 33 Rev 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 6l Exported symbol is undefined Symbol name is not defined Reserved Unexpected end of file Unexpected end of line lt Example gt BYTE c 2 Correction BYTE c 2 Reserved Division by zero Modulo operation with zero Range error The integer constant size is more than data type size lt Example gt BYTE 1234 Correction BYTE 12 Too many macro parameters There are too many parameters for a macro Macro parameter expected Circular reference in symbol definition Symbol redeclaration mismatch Alignment value must be a power of 2 Duplicate ELSE ELSE is reused before ENDIF Conditional assembly branch was never closed ENDIF is missing in the end of the IF or ELSE conditional assembly branch Lexical level was not terminated correctly UM TICE99IDEASM_E 34 Rev 1 2 2014 04 10 62 63 64 65 66 67 68 69 70
18. LW V1 V2 MOVWE pbd NOP ELSE If there is a different perform the following code MOVLW V2 V1 MOVWE pbd NOP ENDIF ENDM DEFINE TESTI A TEST is character A ASCII code is 041H DEFINE TEST2 41h TEST2 is 41 DEFINE TEST3 C TEST3 is character C ASCII code is 043H Match_Value TEST1 TEST2 UM TICE99IDEASM_E 30 Rev 1 2 2014 04 10 A gt ik TICE99IDE Cross Assembler User Manual Y 4 Error Messages 10 11 12 13 Command operation not implemented Cannot open include file Please make sure whether the file exists Cannot read from include file Please make sure whether the file exists Include nesting too deep Include files cannot be more than 245 levels depth Invalid input character Hex digit expected Please refer to Value System Hexadecimal representation Digit expected Please refer to Value System Decimal representation 0 or 1 expected Please refer to Value System Binary representation Numerical overflow The integer is too large must be less than or equal to FFFFFFFF Control statement expected lt Example gt INCLUDE a asm Correction INCLUDE a asm Too many characters expected A colon is missing in the Label definition expected A left parenthesis is missing in the arithmetic operation UM TICE99IDEASM_E 31 Rev 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual
19. Manual Built in function Matches two token lists against each other This is most useful within macros since macros are not stored as strings but as lists of tokens The syntax is MATCH lt token list 1 gt lt token list 2 gt Generally macro parameter can be used as token list Both token list may contain arbitrary tokens with the exception of the terminator token comma resp right parenthesis and end of line end of file Please note that the function only compares tokens not token attributes So any number is equal to any other number regardless of the actual value The same is true for strings If you need to compare tokens and token attributes use the X MATCH function lt Example gt Match_Value MACRO V1 V2 JF MATCH V1 V2 MOVLW V1 V2 MOVWFEF rs NOP ELSE NOP ENDIF JF XMATCH V1 V2 MOVLW V1 V2 MOVWF pbd NOP ELSE MOVLW V2 V1 MOVWE pbd NOP ENDIF ENDM DEFINE TEST 1 A DEFINE TEST2 41h DEFINE TEST3 C Match_Value TEST1 TEST2 Match_Value TEST1 TEST3 Compare if the type of V1 and V2 is the same If yes MOV V1 V2 TO W MOV W TO RSR If not execute NOP Compare if the value and type of V1 and V2 are the same If value or type is different then execute this Define TEST1 A ASCII code is 041H Define TEST2 41 Define TEST3 C ASCII code is 043H UM TICE99IDEASM_E Rey 1 2 2014 04 10 35 main TICE99IDE Cross
20. ame which meets variable naming rule lt Example gt segment RODATA Switch to data segment INT_Counter db setl 02 db set2 03 segment CODE Switch to program segment IntCounterMode movlw 20 set1 movlw 30 set2 42 WORD Define 2 bytes data type this command must be followed by a string of consecutive expressions word ranged not necessarily be a constant value lt Example gt word 0D00 AF13 e a e a UM TICE99IDEASM_E 29 Rev 1 2 2014 04 10 d gt ik TICE99IDE Cross Assembler User Manual 43 XMATCH Built in function Matches two token lists against each other This is most useful within macros since macros are not stored as strings but as lists of tokens The syntax is XMATCH lt token list 1 gt lt token list 2 gt Often a macro parameter is used for any of the token lists Both token list may contain arbitrary tokens with the exception of the terminator token comma resp right parenthesis and end of line end of file The function compares tokens and token values If you need a function that just compares the type of tokens have a look at the MATCH function lt Example gt Match_Value MACRO V1 V2 JF MATCH V1 V2 Decide whether the TYPE of V1 and V2 is the same MOVLW V1 V2 If yes MOV V1 V2 TO W MOVWE rsr MOV W TO RSR NOP ELSE If not execute NOP NOP ENDIF F XMATCH V1 V2 Decide whether the TYPE and content of V1 and V2 are similar MOV
21. cro is expanded many times the label will be used repeatedly If local label is used outside the macro error message will occur during assembling time lt Example gt macro ADDI v1 v2 sum local L1 L1 is defined as label in ADD1 macro program outside macro cannot refer this label movlw vl movwf v2 call L1 movwf v2 LI movlw sum ret endmacro UM TICE99IDEASM_E 23 Rev 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual 33 MAC MACRO Start a macro definition this instruction must be followed by an identifier macro name and can use comma to separate the identifier of the macro parameters lt Example gt CODE macro foo argl arg2 arg3 if arg3 gt 0 define sum 123 endif if paramcount lt 3 Determine whether the imported variable of macro is less than 3 error Too few parameters for macro foo Output user defined error message endif if paramcount gt 3 Determine whether the imported variable of macro is larger than 3 error Too many parameters for macro foo Output user defined error message exitmacro endif movlw 0x01 movwf 0x20 movwf 0x21 ifdef sum Determine whether sum is defined addlw 0x04 exitmacro endif subwf 0x20 0 Subtract the content of W with content in RAM 20H endmacro start foo 5 9 foo 5 9 1 goto start END UM TICE99IDEASM_E 24 Rev 1 2 2014 04 10 34 MATCH TICE99IDE Cross Assembler User
22. e meet by assembler lt Example gt wif foo 1 elseif bar 1 same as else if bar 1 or elseif bar else error Must define foo or bar endif lt Example 2 gt if DEBUG 1 same as if DEBUG lt gt 1 error No support in Debug mode endif UM TICE99IDEASM_E 17 Rev 1 2 2014 04 10 gt ik TICE99IDE Cross Assembler User Manual 20 EXITMAC EXITMACRO Jump out from the macro immediately This instruction is frequently used in recursive macro Please refer to MACRO 21 EXPORT Let the other programming files asm c can also linked to current declared symbols In this instruction user must use commas to separate a list of symbols Below lt Example gt uses two programming files for illustration those are main asm and labels asm Please refer to AUTOIMPORT JMPORT lt Example gt Main asm include texn_TM57FLA80_ inc autoimport on call lab end llabels asm export lab lab movlw 02H movwf 20H 22 FIXCODE A switch to open or close Freeze auto switch RAM Bank function the default is closed which means the auto switch RAM Bank is taken over by compiler This instruction must be followed by a or sign to decide whether to open or close the function lt Example gt fixcode Freeze auto switch RAM Bank fixcode Auto switch RAM Bank is done by compiler In some conditions if user wa
23. e the number of parameters which are used in the macro Please refer to MACRO 38 PROC Using PROC command will enter lexical declaration of function All symbols defined after PROC will only exist in this local declaration block and cannot be accessed from outside The symbols defined outside the declaration layer can be accessed as long as they are not redefined by local words The symbols in other declaration layer will not cause naming conflicts therefore user can use same name in different declaration block to declare variables When ENDPROC instruction is found the lexical declaration layer will be ended There are at most 8 layers of lexical declaration layer for example TM57FLA80 has 8 layers PROC instruction must be followed by a function name or label to be called by this program function or other function To allow other program to call export instruction must be used at first to export the program name In this way when it is in link process linked program can use import or autoimport on pseudo instruction to check every symbol name which is imported whether it is exported in other function by using export pseudo instruction if not then the link error message will occur lt Example gt export Clear export program name to be called by other program proc Clear Declare portion of Clear program start a new declaration level movlw 01 Clear_all Clear_all is for local if it is used in ot
24. eds to output This expression must be a constant expression which means all operators must be a defined constant If the expression value is 0 it means FALSE otherwise it means TRUE Please refer to ERROR 27 IFBLANK Conditional instruction determine whether the parameters of macro are imported or not If the condition does not hold the next program will not be assembled until meet the ELSE or ELSEIF or ENDIF instruction This instruction is generally used to determine whether the parameters of macro are imported if macro parameters are not imported then it is TRUE otherwise is FALSE lt Example gt macro ADD2 v1 v2 sum movlw v1 ifblank v2 addlw sum If v2 IS NOT imported else addlw v2 If v2 IS imported endif movwf sum endmacro code ADD2 1 sum If no parameters are imported must be replaced by endcode UM TICE99IDEASM_E 21 Rev 1 2 2014 04 10 gt ik TICE99IDE Cross Assembler User Manual 28 IFDEF Conditional instruction test whether symbol is defined This instruction must be followed by a symbol name If the condition is hold TRUE means that symbol is defined otherwise is FALSE Please refer to MACRO lt Example gt vl equ 10 ifdef v2 If v2 IS defined v3 equ v1 gt gt 3 movlw v2 movwf 0x20 nop else If v2 IS NOT defined v3 equ v1 gt gt 2 movlw value2 movwf 0x20 nop endif 29 IFNDEF Conditional instruction test whether symbol is def
25. efinition the undefined symbol during compilation stage will show undefined symbol error Please refer to EXPORT IMPORT for the usage lt Example gt autoimport Enable auto import symbol feature or autoimport on Enable auto import symbol feature 3 BYT BYTE Define the data of 1 byte size This instruction must be followed by a series of consecutive expressions or string lt Example gt byte T 1 n k byt f i T OD 00 4 CASE Enable or disable the case sensitivity function during assembling time default is disabled means the identifier is case insensitive by default This instruction must be followed by a or sign to decide whether to enable or disable lt Example gt case Case insensitive reserved keyword or variable name or case on Case sensitive reserved keyword or variable name UM TICE99IDEASM_E 12 Rev 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual 5 DB Define the data of byte size lt Example gt RODATA db 2 13 4 5 The byte results are 32 33 34 35 org 10h byte 12 34 56 78 9a Data are set starting from TABLE ROM address 10h org 20h db 11 22 33 44 Data are set starting from TABLE ROM address 20h db A B C D 6 DBYT Define the data of 2 byte and high low byte can be exchanged This instruction must be followed by a series of word ranged
26. g lt Example gt 1000 10000100 1 3 Use B at the beginning use single quotes to mark the beginning and end of the value lt Example gt B 1000 B 10000100 2 Decimal no need to add any identifier lt Example gt 20 20 Decimal 10 10 syntax support 3 Hexadecimal 3 1 Use H as identifier H is case insensitive lt Example gt 8H OFFH Ofh 3 2 Use at the beginning lt Example gt 9A FD It is suggested to use at the beginning to avoid confusion in EQU and DN name definition 3 3 Use Ox at the beginning x is case insensitive lt Example gt 0x8 OXOFF 4 Constant or address Use EQU as identifier EQU is case insensitive Or an equal sign is followed behind the constant name lt Example 1 gt addr EQU 4 lt Example 2 gt addr 4 UM TICE99IDEASM_E 7 Rev 1 2 2014 04 10 A lt gt ik TICE99IDE Cross Assembler User Manual Y 2 2 Arithmetic Bitwise and Logical Operations In source code there are some operations for the constants including arithmetic operations bitwise operations and logical operations Arithmetic operations follow the order of precedence of four types operations which is multiplication and division first then addition and subtraction The operators are as below addition operator subtraction operator x multiplication operator division operator
27. her place it will not cause error in the same symbol movlw 02 movlw 03 endproc End of this declaration layer Clear_all Will not conflict with Clear_all mentioned above movlw 04 6 UM TICE99IDEASM_E 27 Rev 1 2 2014 04 10 lt i TICE99IDE Cross Assembler User Manual 39 RELOC Interrupt ORG command let linker reorganize PC address use with ORG command lt Example gt RODATA Declare TABLE ROM segment org 00h db 03fh 0f3h db OOfh OfOh db Ocfh Ofch org 20h db Of1h 00fh db Of0h 00fh db Of8h 08fh CODE RELOC Interrupt the org which is set in RODATA let link program to organize the PC address LCD_clear MOVLW 00 MOVWR 20 MOVWR 21 MOVWR 22 40 RPLANE The same as FPLANEO define the declared variable is in R Plane location eee UM TICE99IDEASM_E 28 Rev 1 2 2014 04 10 i TICE99IDE Cross Assembler User Manual 41 SEGMENT Command to switch to another segment CODE and RODATA regularly output to their segments The so called segment is a kind of named data block the default segment is program segment There may be up to 254 different segments per object file and up to 65534 per executable CODE and RODATA are the two most frequently commands which are used to declare segment Segment declaration command is followed by user defined segment name there are some restrictions on the naming it is suggested to use segment n
28. ined This instruction must be followed by a symbol name If the condition is hold TRUE means that symbol is not defined otherwise is FALSE lt Example gt v1 equ 10 ifndef v2 If v2 IS NOT defined v3 equ v1 gt gt 3 movlw v2 movwf 0x20 nop else If v2 IS defined v3 equ v1 gt gt 2 value2 movwf 0 20 nop endif UM TICE99IDEASM_E 22 Rev 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual 30 IMPORT Import a symbol from the other module this instruction is followed by a string of comma separated imported symbol Please refer to EXPORT AUTOIMPORT for the usage lt Example gt import foo bar 31 INCLUDE Include another file the depth of nested including file is up to 16 levels Syntax include filename If filename consists of file path Ex include tm57fla8O test tm57 inc it will directly open include file however if the filename does not consist of file path Ex include tm57 ic the search priority will be as follows 1 At first search the files in the project path 2 If not found in 1 then search the installed path of TICE99IDE 3 Search other include path which user specified lt Example gt include subs inc 32 LOCAL Declare local label name it can be used only in the macro it cannot be used outside the macro The purpose of using local declared label is to avoid problem especially when ma
29. name is then followed by a colon 2 The statement without operand and it does not conflict with instruction name and then assembler will treat it as label 3 Local labels and symbols Use PROC instruction it can setup a program segment Labels and symbols which are declared inside the segment are regarded as having local property Outside this segment these labels and symbols are treated as unknown and cannot be accessed 4 Using macros to define labels and constants Sometimes using macros to define labels and constants is not so convenient but it may be convenient in some case For example use DEFINE instruction to define symbols or other constants which are used in other place Basically using macro is not restricted it can be used in low level operation or calculation In addition you can also use macro to define string constant the other data types of symbols are not allowed lt Example gt DEFINE two 2 DEFINE version SOS V2 3 four two two Ok byte version Ok PROC Start local scope two 3 two 3 two is local constant ENDPROC end of local scope UM TICE99IDEASM_E 6 Rey 1 2 2014 04 10 A lt gt ik TICE99IDE Cross Assembler User Manual Y 2 Value System 2 1 Representation 1 Binary 1 1 Use B as identifier B is case insensitive or use at the beginning lt Example gt 1000B 10000100B 1011b b 10001000 1 2 Use at the beginnin
30. nts to decide when to switch RAM Bank user can use pseudo instruction fixcode for this purpose Compiler will temporarily close auto switch RAM Bank function until fixcode is found and then it will be reopened It is suggested that fixcode and fixcode should be used in pair and when switch RAM Bank by user is not necessary then switch RAM Bank should be done by compiler to avoid unexpected error UM TICE99IDEASM_E 18 Rev 1 2 2014 04 10 lt gt ik TICE99IDE Cross Assembler User Manual 23 FPLANEO In inc or asm file user can define particular register as a significant constant variable name refer to EQU Before a variable declaration is defined RAM segment pseudo instructions FPLANEO FPLANE 1 or RPLANE can be optionally used to clearly indicate the memory location of the variable F Plane bankO F Plane bank or R Plane In using FPLANEO FPLANE1 or RPLANE pseudo instructions it is suggested to declare RPLANE at first then declare FPLANEO or FPLANE1 Example RPLANE_ _ _ INDR EQU 00H i i Define the constant variable is in I l R Plane location l l FPLANEO 00 F INDF EQU 00H l I l Define the constant variable is in F l l Plane BankO location 0 ABC_B1 EQU 30H Define the constant variable is in F l i Plane Bank1 location L om where 1 Constant variable INDR and the other variables which are defined before
31. once and can be declared anyplace outside of the segment it is suggested to declare CPU on the beginning of the file The declaration is as below CPU chip_species chip_species chip code lt Example gt CPU TM57FLA80 CODE movlw 10H UM TICE99IDEASM_E 11 Rev 1 2 2014 04 10 A EE i TICE99IDE Cross Assembler User Manual 3 3 Other Instructions 1 ADDR Define the data of 2 byte size This is an alias name for WORD instruction and it is more readable when using ADDR especially the data content is address This instruction must be followed by a series of expressions not necessarily have to be constant value can also be an identifier lt Example gt addr 0D00 AF13 Clear 2 AUTOIMPORT Auto import symbol definition feature Using autoimport on or autoimport to enable auto import symbol definition feature or using autoimport off or autoimport to disable auto import symbol definition feature this is default value The main difference between enable disable auto import symbol definition features is when the feature is enabled undefined symbol during compilation stage will be ignored automatically and will not generate error messages until linking stage after linking all routines when the symbol is not defined in all routines the error messages of undefined symbol will be generated Otherwise when this feature is disabled and import directive is not used to import the symbol d

Download Pdf Manuals

image

Related Search

Related Contents

SuperMicro GC-SL 5 (X5SS8  Onduleur GE Notice  Xerox WorkCentre 7535    Nikon (1855mm Kit) Red Digital Camera User Manual  LG 55LS5700 Energy Guide : Free Download, Borrow, and Streaming : Internet Archive  Tripp Lite Mini HDMI to VGA Converter Adapter for Smartphones/Tablets/Ultrabooks - 1920x1200, 1080p  CREME D`EMBELLISSEMENT ALU  Studyaid D.B.の評価 (数学ソフトウェアとその効果的教育利用に関する  JVC LVT0282-002A Portable CD Player User Manual  

Copyright © All rights reserved.
Failed to retrieve file