Texas Instruments TI-89 Software Manual

Texas Instruments TI-89 Software Manual

Sierra c assembler
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

TI-89 / TI-92 Plus
Sierra C™ Assembler Reference Manual,
Beta Version .02

Advertisement

Table of Contents
loading

Summary of Contents for Texas Instruments TI-89

  • Page 1 TI-89 / TI-92 Plus Sierra C™ Assembler Reference Manual, Beta Version .02...
  • Page 2: Important Information

    The latest version of this Guide, along with all other up-to-date information for developers, is available at www.ti.com/calc/developers/. © 2000, 2001 Texas Instruments , TI-GRAPH LINK, and TI FLASH Studio are trademarks of Texas Instruments Incorporated. Sierra C is a trademark of Sierra Systems.
  • Page 3: Table Of Contents

    1.4.8.4. Symbol Value Field... 25 1.4.8.5. Section Number Field ... 26 1.4.8.6. Section Numbers and Storage Classes... 27 1.4.8.7. Type Entry ... 28 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 4 2.8. Character Strings ... 57 2.9. Types and Representations ... 58 2.9.1. Integer Types... 59 2.9.2. Integer Representations ... 59 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Table of Contents Not for Distribution Beta Version February 2, 2001...
  • Page 5 2.12.1. Internal Integer Arithmetic Functions ... 82 2.12.2. Internal Floating-Point Functions ... 83 2.12.3. Debugging Functions ... 86 2.13. Sections ... 87 2.14. Static Storage Initialization ... 87 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 6 3.2.2. Command Line Flags ... 132 3.2.3. File Name Conventions... 136 3.2.4. Environment Variables ... 136 3.2.5. Invocation Examples ... 137 3.3. Assembly Language... 137 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Table of Contents Not for Distribution Beta Version February 2, 2001...
  • Page 7 3.4.3. Instruction Optimization... 153 3.5. Effective Addressing Modes... 155 3.5.1. Overview ... 155 3.5.2. Terminology ... 157 3.5.3. Effective Address Syntax ... 158 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 8 3.8.2. Structured Control Macros ... 278 3.8.2.1. Structured Control Expressions ... 278 3.8.2.2. Macro Invocation ... 280 3.8.2.3. Structured Control Reference ... 280 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Table of Contents Not for Distribution Beta Version February 2, 2001...
  • Page 9 4.7. Relocation Hole Compression... 303 4.8. Reserved Symbols ... 305 5. Utilities...309 5.1. Symbol Table Name Utility ... 309 5.2. Object File Size Utility ... 313 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 10 Table 1.15: Example Symbol Table for Functions and Nested Blocks ... 20 Table 1.16: Symbol Table Entry... 21 Table 1.17: Storage Classes... 23 Table 1.18: Storage Class of Special Symbols... 24 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 11 Table 2.2: Character Constants ... 57 Table 2.3: Integer Types ... 59 Table 2.4: Determination of Argument Size ... 78 Table 2.5: Integer Arithmetic Functions ... 82 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 12 Table of Contents TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 13 1.4.8.3. Storage Classes for Special Symbols... 24 1.4.8.4. Symbol Value Field... 25 1.4.8.5. Section Number Field ... 26 1.4.8.6. Section Numbers and Storage Classes... 27 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 14 Table 1.8: Relocation Section Contents... 15 Table 1.9: Relocation Types ... 15 Table 1.10: Complex Relocation Entries... 16 Table 1.11: Line Number Grouping... 17 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Not for Distribution Beta Version February 2, 2001...
  • Page 15 Table 1.33: Auxiliary Symbol Entry for End of Structures ... 35 Table 1.34: Auxiliary Symbol Entry for Structures, Unions, Enumerations ... 35 Table 1.35: Example String Table... 36 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 16 Section 1: General Information TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 17: General Information

    This manual describes the Sierra tools, including the compiler, assembler, and linker invoked by the TI FLASH Studio™ for development of Flash applications (apps) and Assembly Language Programs (ASMs) for the TI-89 / TI-92 Plus calculators, and other Plusutilities that are available to the developer. They were developed by Sierra Systems to support certain Motorola processors and coprocessors and IEEE format floating-point numbers.
  • Page 18: Command Line Wildcard Expansion

    Match all filenames in the subdirectory c:\doc with a base name of version followed by a hexadecimal digit and a .doc extension. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Match zero or more characters, where characters matched may be any character except the period ( ) .
  • Page 19: Environment Variables

    SIERRA environment variable. The SIERRA environment variable will be set when the setup program for the TI FLASH Studio is executed. The SIERRA environment variable must be set before using any of the Sierra utilities.
  • Page 20: Object File Format

    Object File Format This section describes the Common Object File Format (COFF) used by TI FLASH Studio. COFF is the format of the object files created by the assemblers and linker, and recognized by TI FLASH Studio and various object file examination utilities.
  • Page 21: Table 1.2: Object File Layout

    If there are no symbols with names longer than eight characters, the string table is not needed and is thus absent. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 22: Definitions And Conventions

    .ld_tbl. TI-89 / TI-92 Plus apps and ASMs also have a .const section, and the .ld_tbl section is unused. Additional named and unnamed sections, up to a total of 126, can also be added.
  • Page 23: File Header

    COFF standard. The size of the optional header is specified in the file header to allow system-independent object file utilities to skip past the optional header. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Name Description fh_magic...
  • Page 24: Flags

    (-r flag). Defined in file_fmt.txt are A_OUT_HDR and A_OUT_HDR_SIZE, the typedefs for the optional header structure and optional header size, respectively. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Flag Meaning...
  • Page 25: Section Headers

    28-31 unsigned long 32-33 unsigned short 34-35 unsigned short 36-39 unsigned long TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Name Description sh_name 8-character null-padded section name sh_phys_addr Physical address of section sh_virt_addr Virtual address of section...
  • Page 26: Relocation Information

    Table 1.8 describes the information carried in the object file for each relocatable reference. Defined in file_fmt.txt are RELOC_INFO and RELOC_INFO_SIZE, the typedefs for the relocation entry structure and relocation entry size, respectively. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Flag Meaning...
  • Page 27: Relocation

    (external symbol or section name symbol) is saved in the relocation entry. In addition, if the reference is PC-relative, the address or section-relative offset of the hole is subtracted from the contents of the hole. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Name Description...
  • Page 28: Complex Relocation

    External Operand Note that the field r_type_info for the primary entry has the RL_CMPLX_OP bit set to designate the start of a complex relocatable expression. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information COFF Relocation Entry...
  • Page 29: Line Number Information

    The absolute C source line number of the function's open brace is specified in the auxiliary entry for the .bf symbol (see section 1.4.9.4 Beginning of Blocks and Functions). Absolute C source line numbers TI-89 / TI-92 Plus Sierra C Assembler Reference Manual line number line number .
  • Page 30: Symbol Table

    A symbol table entry contains the name of the symbol (or file offset to the name), the value, the type, and other information. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Not for Distribution...
  • Page 31: Special Symbols

    In the case where a file defined three unnamed structures, structure tags with the names .0fake, .1fake, and .2fake would be generated. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 32: Inner Blocks

    ) int f; int g; int h; Table 1.15: Example Symbol Table for Functions TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Symbol Table _func1 int d; _func2 and Nested Blocks...
  • Page 33: Symbols And Functions

    12-13 unsigned short 14-15 unsigned short char char TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Name Description sym_name 8-character null padded symbol name sym_zeroes Zero in this field indicates the name is in the string table...
  • Page 34: Symbol Names

    Note that not all the storage classes listed in Table 1.17 appear in the object file. Some of the storage classes such as C_EFCN, C_ARRAY, C_SUE, and C_SKIP are used only internally by the compiler and assemblers. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Not for Distribution...
  • Page 35: Table 1.17: Storage Classes

    C_FIELD C_ARRAY C_SUE C_SKIP C_BLOCK C_FCN C_EOS C_FILE C_ALIAS C_HIDDEN TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Physical end of function Automatic variable External symbol Static Register variable External definition Label Undefined label Member of structure Function argument...
  • Page 36: Storage Classes For Special Symbols

    Special Symbol .file .target . x fake .eos .text .data .bss Table 1.18: Storage Class of Special Symbols TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Storage Class C_FILE C_BLOCK C_BLOCK C_FCN C_FCN C_AUTO C_STRTAG, C_UNTAG, C_ENTAG...
  • Page 37: Symbol Value Field

    Relocatable symbols have a value that is equal to the virtual address of the symbol. When a section is relocated by the linker, the values of the section's relocatable symbols change. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Meaning of Value Stack offset in bytes...
  • Page 38: Section Number Field

    This is the only case where a symbol has a section number 0 and a non-zero value. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Section Number...
  • Page 39: Section Numbers And Storage Classes

    C_TPDEF C_ENTAG C_MOE C_REGPARM C_FIELD C_BLOCK C_FCN C_EOS C_FILE C_ALIAS Table 1.21: Section Number and Storage Class TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section Number N_ABS N_ABS, N_UNDEF, N_SCNUM N_SCNUM N_ABS N_UNDEF, N_SCNUM N_ABS N_ABS N_DEBUG N_ABS...
  • Page 40: Type Entry

    T_FLOAT T_DOUBLE T_STRUCT T_UNION T_ENUM T_MOE T_UCHAT T_USHORT T_UINT T_ULONG Table 1.22: Fundamental Types TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information type Value Type Type not assigned Long double Character Short Integer Long integer...
  • Page 41: Table 1.23: Derived Types

    Combining the information into a single word (11 01 10 01 11 11 0011), as previously described, the hexadecimal representation of the value in the type field is 0xD9F3. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Value Type...
  • Page 42: Type Entries And Storage Classes

    Conditions for the derived types shown in Table 1.24 apply to all derived types, d1 through d6, with the added restriction that it is impossible to have two consecutive derived types of function. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Derived Type...
  • Page 43: Auxiliary Table Entries

    Future extensions may allow symbols to have more than one auxiliary entry and auxiliary entries that are not listed in the above referenced tables. Defined in file_fmt.txt is AUX_ENT, the typedef for the auxiliary symbol table entry structure. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Storage Type Entry Class...
  • Page 44: Filenames

    Function is prototyped Bit 1 – Parameters of type short and char pushed as four-bytes when prototyped (Parameters of type short and char are always pushed as two-bytes for TI calculators.) Bit 2 – Parameters of type float pushed as 10 bytes (double) when prototyped Bit 3 –...
  • Page 45: Beginning Of Blocks And Functions

    Table 1.30. Bytes Declaration – unsigned short 6-17 – Table 1.30: Auxiliary Symbol Entry for End of Blocks and Functions TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Name Description symbol.tag_index Tag index symbol.u1.func_size Size of function symbol.u2.s.line_ptr File pointer to line number symbol.u2.s.end_index...
  • Page 46: Arrays

    Table 1.32. Bytes Declaration – unsigned short 8-11 – 12-15 unsigned long 16-17 – TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information Name symbol.tag_index symbol.u1.s.c_line_nbr symbol.u1.s.size symbol.u2.array_dim[0] symbol.u2.array_dim[1] symbol.u2.array_dim[2] symbol.u2.array_dim[3] – Table 1.31: Auxiliary Symbol Entry for Arrays Name –...
  • Page 47: End Of Structures

    Bytes Declaration unsigned long – unsigned short 8-17 – Table 1.34: Auxiliary Symbol Entry for Structures, Unions, Enumerations TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Name Description symbol.tag_index Tag index – Unused (filled with 0's) symbol.u1.s.size Size of structure, union, or enumeration –...
  • Page 48: String Table

    ' e ' ' \0 ' The string table offset of this_is_a_long_name is 4, and the string table offset of this_is_a_still_longer_name is 24. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 1: General Information ' t ' ' h '...
  • Page 49 2.9.7. Bit Field Internal Representation... 66 2.9.8. Const Type Specifier... 67 2.9.9. Volatile Type Specifier ... 68 2.9.10. Touch Operator... 69 2.9.11. Void Type Specifier ... 69 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 50 2.16.3.2. The # Operator (stringizing) ... 97 2.16.3.3. The ## Operator (concatenation)... 97 2.16.3.4. Rescanning and Further Replacement ... 97 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution Beta Version February 2, 2001...
  • Page 51 2.16.8. Pragma Directive ... 100 2.16.9. Trigraph Sequences... 100 2.16.10. Comment Delimiters ... 101 2.16.11. Predefined Macro Names ... 101 2.17. Compiler Error Messages ... 102 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 52 Table 2.2: Character Constants ... 57 Table 2.3: Integer Types ... 59 Table 2.4: Determination of Argument Size ... 78 Table 2.5: Integer Arithmetic Functions ... 82 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 53: Compiler

    Invoking the Compiler Typically, the TI FLASH Studio™ will handle all invocations of the compiler, using the correct command line flags required to produce TI-89 / TI-92 Plus apps or ASMs. The following discussion of command line format and flags is included for developers who may wish to use com68 directly from the command line or create their own makefile.
  • Page 54: Usage

    The TI-89 / TI-92 Plus SDK includes example invocations of the compiler. It is highly recommended that you only use the flags as shown in those files.
  • Page 55: Description Of Flags

    Do not perform common subexpression optimizations. 2.3.3. Description of Flags name string TI-89 / TI-92 Plus Sierra C Assembler Reference Manual flag, C source lines with comments and blank Leave comments in the preprocessed C source. The implied. Define the name name .
  • Page 56 -M2[t nbr ] -M3[t nbr ] -M4[t nbr ] TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Insert C source lines including comments into the assembly language output. Place line numbers in front of each C source line in the assembly language listing.
  • Page 57 Section 2: Compiler TI-89 / TI-92 Plus Sierra C Assembler Reference Manual causes multiple function call stack cleanups to be coalesced into a single cleanup. stack cleanups from being coalesced (default). specifies that a stack frame (link and unlk) should not be setup if it is not essential (default).
  • Page 58 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Specifies how automatic variables are selected for placement into machine registers. variables are to be placed into registers. only variables declared with the register storage-class specifier are to be candidates for placement into registers.
  • Page 59 Section 2: Compiler -p proc -U name TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Optimize the generated code for size, possibly at the expense of speed. routine, the unrolling of structure copy loops, and the expansion of multiplication by constants (except where the expanded code is more compact).
  • Page 60 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Warn about automatic variables that may be defined before they are used. The compiler will erroneously issue a warning if it finds a path that would result in a use before definition when such a path will never be taken during program execution.
  • Page 61 Section 2: Compiler TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Use long offsets in table look-up switch tables instead of word offsets. Long offsets must be specified if the total size of the code inside a switch statement exceeds 32767 bytes.
  • Page 62 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual s[ size ] Make a function call to _ _ stk_ck at the beginning of every function that requires more than stack space or calls other functions. The needed stack space is available to _ _ stk_ck in register d0; the default value for the optional stack size is 40.
  • Page 63: Pragma Directives

    #pragma dsection .data will cause the name of the data section to switch back to .data the default name. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Save and restore register d2 in all functions that use the register to guarantee that the value of the register remains unmodified across function calls.
  • Page 64: Translation Limits

    (after concatenation) • † The number of characters can be increased with the -XC flag. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution Beta Version February 2, 2001...
  • Page 65: Reserved Keywords

    The keyword signed can be used in conjunction with the previously existing keyword unsigned to control the interpretation of certain object TI-89 / TI-92 Plus Sierra C Assembler Reference Manual double struct...
  • Page 66: Constants

    The u (or U) specifier coerces the constant to an unsigned type, and the l (or L) specifier coerces the constant to a long int. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual 3.1415 5E+9l 0.31415E1F...
  • Page 67: Enumeration Constants

    See section 2.9.5 Enumeration Types, for additional information. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual 0xf9a 0XF9al 275uL...
  • Page 68: Character Constants

    0xFF to force it to fit into eight bits. The construct ' \x123 ' is a character constant containing a single character. To TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Common Name...
  • Page 69: Character Strings

    (') can be specified directly or with its escape sequence, whereas the double quote (") must be specified with its escape sequence. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Hexadecimal Value Decimal Value...
  • Page 70: Types And Representations

    It also describes the correct usage of enumeration types and bit fields, and discusses the issues concerning the const, volatile, and void type specifiers. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual "has " "3" (two characters)
  • Page 71: Integer Types

    † unsigned long int † Integers are 16-bit objects on the TI-89 / TI-92 Plus (the -XI command line flag is specified). 2.9.2. Integer Representations The memory address of any integer data object is the address of its highest order byte (i.e., the byte containing the most significant bits).
  • Page 72: Floating-Point Types

    TI BCD floating-point format, removing all other previously supported floating-point formats and coprocessors, except for an IEEE format which is used in special cases and exists only in the compiler, not on the TI-89 / TI-92 Plus. (See section 2.12.2 Internal Floating-Point Functions for more information on the IEEE format.)
  • Page 73: Floating-Point Representations

    2.9.4. Floating-Point Representations All TI BCD floating points are 10 byte objects. The first two bytes in the TI BCD floating-point format are the mantissa sign and exponent. The mantissa sign is the most significant bit of that word (1=negative, 0=positive) and the other 15 bits...
  • Page 74 TI-92 Plus calculators is L999 to 999. See chapter 16. Working with Numbers in the TI-89 / TI-92 Plus Developers Guide for information on how and when to verify that the exponent is within the range required by the calculator user floating-point representation and what to do when it is not.
  • Page 75: Enumeration Types

    However, none of the special values shown above can be directly entered on the TI-89 or TI-92 Plus calculators. The signed zeros may result from a calculation but since they are displayed as 0. on the calculator, they can only be recognized by their behavior in other calculations.
  • Page 76 Otherwise, the enumeration type is the same size as an int. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 77: Bit Field Description

    } y = { -1, -1, -1 }; y.i = 7 y.j = -1 y.k = 7 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual /* legal /* legal /* illegal, red is constant /* legal...
  • Page 78: Bit Field Internal Representation

    :5; long int d:8; long int :0; long int e:12; } s; TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Section 2: Compiler Beta Version February 2, 2001...
  • Page 79: Const Type Specifier

    Read-Only Memory (ROM). TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ' operator. The following /* illegal...
  • Page 80: Volatile Type Specifier

    TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler / * infinite loop * /...
  • Page 81: Touch Operator

    (void)printf("Error %d on line: %d\n", error, line); TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 82: Void Pointer (Void *)

    When a value of one type is converted to a value of another type, the internal representation (i.e., bit pattern) may change. Conversions between floating-point types and integer types always involve a change in representation. When TI-89 / TI-92 Plus Sierra C Assembler Reference Manual / * legal / * illegal, cast required...
  • Page 83: Integer Types

    If the integral part cannot fit in a signed long, it is assigned the largest positive or negative value (depending on the sign of the integral part) that can be represented by a signed long. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 84: Floating-Point Types

    If either operand is not of type int, it is converted to type int. (Exception: if • 16-bit integers are used, as on the TI-89 / TI-92 Plus, and the operand type is unsigned short int, it will be converted to unsigned int in order to preserve its value.)
  • Page 85: Restrictions

    (i.e., the stack pointer is not decremented); otherwise, it is pushed onto the stack. Additional arguments are always pushed onto the stack. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 86: Declarations And Definitions

    Function f4 is declared to accept no arguments; calling f4 with any arguments will result in an error. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 87: Old-Style Declarations

    This declaration could be deleted from the program without any effect, since the default function return type is int. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 88: Mixing Prototype And Old-Style Declarations

    ); int func( a ) short a; /* function body */ TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution Beta Version February 2, 2001...
  • Page 89: Passing Argument Values

    The -XI flag instructs the compiler to interpret objects of type int as 16 bits rather than 32 bits (default). Specifying the -XI flag, as on the TI-89 / TI-92 Plus, will cause all integer types (except for type long) to be passed as 16-bit objects independent of whether a function prototype is in scope.
  • Page 90: Accessing Parameters

    -XI -Os5 Note:Sizes are in bytes, with and without prototype — (with prototype) / (without prototype). The TI-89 / TI-92 Plus requires use of the LXI flag. Table 2.4: Determination of Argument Size Table 2.4 shows the sizes in bytes that function arguments occupy on the stack.
  • Page 91: Returning Values

    Immediately after the function returns, the pointer in a0 is used to copy the returned structure to its destination. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 92 The called function, which assumes that the memory pointer has been pushed, cannot access its parameters correctly and may corrupt memory when it attempts to return a structure. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Example B struct s { int a;...
  • Page 93: Register Usage

    The following sections describe the special calling conventions used by each category of compiler-generated function calls. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 94: Internal Integer Arithmetic Functions

    ) i = i / j; TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Operation Divide 16-bit unsigned by 16-bit unsigned Divide 32-bit signed by 32-bit signed...
  • Page 95: Internal Floating-Point Functions

    IEEE and BCD. Floating used with caution for this reason, although since the IEEE format is comparable to 20 BCD digits and the TI BCD values have 16 digits, differences will be extremely rare. double flt1=1024. * 16.;...
  • Page 96: Figure 2.4: Floating-Point Emulation Code Word

    The following example demonstrates the interface to the TI BCD floating-point routines. Shown below is a sample C listing, followed by the code that is generated after compilation. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual...
  • Page 97 .short .short .long .long fmove.d move.l move.l move.w unlk .def .endef TI-89 / TI-92 Plus Sierra C Assembler Reference Manual proc=68000 "test.c" _area,10,2 _radius,10,2 ; 4 double area, radius; ; 5 void circle( void ) _circle _circle\ .val _circle\ .scl a6,#-36 ;...
  • Page 98: Debugging Functions

    TI-89 / TI-92 Plus, this is done through hardware. Even though the traditional use for _stk_ck is no longer necessary, the function may be used for any other debugging purpose desired.
  • Page 99: Sections

    2.13. Sections The TI-89 / TI-92 Plus SDK includes example invocations of the compiler. You must use the sections as shown in those files when compiling applications. The compiler places information into four different sections for TI-89 / TI-92 Plus applications: .text, .data, .const, and .bss (blank static storage).
  • Page 100 = { 10, 20, 30 }; int a[3] = { {10}, {20}, {30} }; The scalar-level braces are rarely used, however. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual int a; int b[3]; Not for Distribution...
  • Page 101 = {'x', 'y', 'z', '\0'}; The following two declarations are similar, but not identical: char * p = "abc"; char q[] = "abc"; TI-89 / TI-92 Plus Sierra C Assembler Reference Manual "b" "c" Not for Distribution Beta Version February 2, 2001...
  • Page 102: Compiler Algorithms

    TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 103 Every variable in TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 104: Switch Statements

    The difference between the maximum and minimum case values divided by the number of case statements is not less than three (i.e., (20 - 4) / 5 > 3). TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ... ; ... ;...
  • Page 105: The C Preprocessor

    Character sequences recognized as tokens by the preprocessor are: header names within a #include directive, identifiers, constants, string literals, punctuation, and non-whitespace characters that are not one of the previously mentioned. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual #endif #include #line...
  • Page 106: Source File Inclusion

    The #if directives (i.e., #if, #else, #elif, #ifdef, #ifndef, and #endif) allow selected lines of text in the file to be conditionally included or excluded from further processing. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 107 # ifdef identifier # ifndef identifier The above directives are functionally identical to the following: #if defined (identifier) #if !defined (identifier) TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 108: Macro Replacement

    ' # ' or ' ## ' operator, is fully expanded (i.e., all macros replaced) before it is substituted into the replacement list. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 109: The # Operator (Stringizing)

    If it is necessary to redefine a macro and the second definition has a different replacement list, a #undef directive must appear before the redefinition. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 110: Macro Examples

    (f)(5) f(5 + (4->m)) f(36) f(+ + (b + c + c->m)) f(+ + (f(y)->m)) 35++12 35e+12 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler f(q + (i->m)) b + c (a)(b) a(b) g(y) Not for Distribution...
  • Page 111: Line And Name Control

    The directive that results after macro substitution must match one of the two previous forms and is processed accordingly. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual a ## b op##n##_info(size##n(),type##n())
  • Page 112: Error Directive

    -T flag on the compiler command line. The supported trigraph sequences are as follows: ??< ??> TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Section 2: Compiler Beta Version February 2, 2001...
  • Page 113: Comment Delimiters

    /* Results After Preprocessing and String Concatenation */ printf("test.c: compiled on Aug 29 1992 at 17:35:23\n"); TI-89 / TI-92 Plus Sierra C Assembler Reference Manual The date that the source file was compiled given as a string literal of the form " Mmm dd yyyy ", where the first character of dd is a space if the value is less than 10.
  • Page 114: Compiler Error Messages

    The compiler could not open the given #include file. cannot open file for reading The given file could not be opened for reading. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution Beta Version February 2, 2001...
  • Page 115 The compiler accepts at most two filenames on the command line (not counting filenames that are arguments to flags): an input file and an output file. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 116 The given case number appears more than once inside a switch statement. duplicate default inside switch The default label appears more than once inside a switch statement. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 117 The default size for the expression stack is 30. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 118 It is illegal to declare a function as returning a function. function cannot return an array It is illegal to declare a function as returning an array. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 119 ( number hex) in # if or # elif expression The nonprinting character with the given hexadecimal representation is illegal in the expression following a #if or #elif preprocessor directive. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 120 An expression with type other than function type was used where an expression with function type was expected. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution Beta Version February 2, 2001...
  • Page 121 The left operand of the given assignment operator must be a modifiable value. illegal operation on void type, op CAST It is illegal to cast a void type to any other type. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 122 #if or #elif directive. illegal to use & on a bit field It is illegal to take the address of a bit field. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 123 The object that is being cast cannot be converted to an object of the type of the cast. incompatible operand, type , op BOOLEAN It is illegal to apply the specified Boolean operator to the given type . TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 124 A comma cannot appear in front of the first argument in a function call, nor can it appear in a function call with no arguments. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 125 - flag flag The argument to a -D or -U flag is missing or is an invalid C identifier. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 126 It is illegal to cast aggregate types, such as arrays and structures. parameters illegal in a function declaration A function declaration must not contain parameters. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler ) operator must be...
  • Page 127 The given structure, union, or enumeration tag is multiply defined. reference to macro identifier is nested too deep Macros cannot be nested deeper than 32 levels. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 128 (not type) required The left operand of the arrow ( > ) operator is a structure type instead of a structure pointer. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution Beta Version February 2, 2001...
  • Page 129 The formal parameter list of the given macro contains a grammatical error. too many errors: compiler exiting The compiler exits after 100 errors have been reported. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 130 A macro in a #include directive does not expand to the form " filename " or < filename >. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 131 It is illegal to return a value from a function declared as returning void. void type illegal in switch The expression following the switch keyword must evaluate to an integer type. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 132 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution...
  • Page 133 The type of the object being returned and the type of the function do not match. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 134 The number of arguments in a macro invocation does not match the number of arguments in the macro definition. zero or negative array dimension Array dimensions must be positive integer values. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 2: Compiler Not for Distribution Beta Version February 2, 2001...
  • Page 135 3.3.5.3. Symbol Assignment ... 143 3.3.5.4. Comm and Lcomm Symbols ... 144 3.3.5.5. Undefined Symbols ... 144 3.3.5.6. Compiler Locals... 145 3.3.5.7. Floating-Point Symbols... 145 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 136 3.7.1. Asm68k Section Directives... 210 3.7.2. Asm68k Symbol Directives... 211 3.7.3. Asm68k Data/Fill Directives... 212 3.7.4. Asm68k Control Directives ... 213 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 137 3.8.2. Structured Control Macros... 278 3.8.2.1. Structured Control Expressions ... 278 3.8.2.2. Macro Invocation ... 280 3.8.2.3. Structured Control Reference... 280 3.9. Instruction Set Summary ... 289 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 138 Table 3.21: Output Directives ... 167 Table 3.22: Debugging Directives... 168 Table 3.23: Directive Groups ... 209 Table 3.24: Section Directives ... 210 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 139 Table 3.29: Debugging Directives... 215 Table 3.30: Integer Conditional Tests ... 279 Table 3.31: Structured Control Macros ... 280 Table 3.32: Instructions and Size Qualifiers ... 290 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 140 Section 3: Assembler TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 141: Assembler

    Although the software has not been modified to exclude support for processors other than the 68000, the 68000 is the only processor supported by Texas Instruments. The license from Texas Instruments to use these products is restricted to development of software that is targeted to execute only on TI calculators. 3.1.
  • Page 142: Prerequisite Reading

    The assembler section assumes a working knowledge of the Motorola 68000 microprocessor and the programming issues that govern it and familiarity with the other documentation supplied with the TI-89 / TI-92 Plus SDK. For information regarding these topics, the following sources should be consulted: M68000 Family Resident Structured Assembler Reference Manual , •...
  • Page 143: Notational Conventions

    Typically, the TI FLASH Studio will handle all invocations of the assembler, using the correct command line flags required to produce TI-89 / TI-92 Plus apps or ASMs. The following discussion of the command line syntax and flags is included for developers who may wish to use either assembler directly from the command line or create their own makefile.
  • Page 144: Command Line Syntax

    However, it is highly recommended that you only use the flags as shown in the sample assembler invocations included in the TI-89 / TI-92 Plus SDK files. Other flag combinations may produce output incompatible with the TI-89 / TI-92 Plus data objects.
  • Page 145 -D symbol [= value ] -g file . . . -h file TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Alert the user that the following error messages are from the assembler. The message, “Assembler Errors,” is printed before the first error message.
  • Page 146 -OPT option [, option ] . . . -p[ length ] TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Perform relocation hole compression on the source file. The is used during the second assembly pass. The information in the...
  • Page 147 -w[ width ] -y file -Y file TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Write error messages to the standard error stream, stderr. This is useful only when the input assembly source is read from the standard input stream, stdin. The source file is specified.
  • Page 148: File Name Conventions

    The environment variables INCLUDE68 and SIERRA can be used to control inclusion of assembly source files (see .include / INCLUDE directive). The TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Returns the specified options to their default conditions. Not supported by Texas Instruments, however, a reserved flag by the assembler.
  • Page 149: Invocation Examples

    Assembly languages provide an efficient means of developing and maintaining machine-level programs. This section describes the format of assembly language source files, as well as the major concepts necessary to write them. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual (or, asm68 -lT) Not for Distribution...
  • Page 150: Overview

    Directive Assignment Comment Table 3.3: Statement Syntax (asm68) TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Syntax label : [ ; comment ] [ label : ] instruction [ operand ] [ ; comment ] [ label : ] directive [ operand ] [ ; comment ] [ label : ] symbol { = | == } expression [ ;...
  • Page 151: Statement Syntax (Asm68K)

    Macros). Comment statements are ignored by the assembler; they allow source files to contain explanatory text. The maximum length of any statement is 256 characters. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Syntax label [ :] [ ! | ; comment ] [ label [ :] ] instruction [ operand ] [ [ ! | ;...
  • Page 152: Character Set

    .bss (see .comm and .lcomm directives). Note: TI-89 / TI-92 Plus apps and ASMs also have a .const section. See chapter 7. Flash Application Layout in the TI-89 / TI-92 Plus Developer Guide for information on the use and initialization of the TI-89 / TI-92 Plus sections.
  • Page 153: Creating Sections

    During assembly, the value of a relocatable symbol is an offset from the base of a relocatable section; it becomes absolute during linkage (after relocatable sections have been bound to absolute addresses). TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 154: Symbol Syntax

    256 characters. All characters of a symbol name are significant. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution...
  • Page 155: Labels

    == operator permits future assignments. Attempting to assign a value to a symbol whose value has been set with the = operator results in an error. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual init move.l (a0)+,(a1)+ cmpa.l...
  • Page 156: Comm And Lcomm Symbols

    The only difference in behavior is whether or not an error message is generated. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution...
  • Page 157: Compiler Locals

    Table 3.5. The syntax for specifying the base of an integer constant is different for the two assemblers. Any integer constant can be preceded by the unary minus ( - ) operator. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 158: Character Constants

    .word 'a' .long 'ab' When using asm68k, the bytes are left-justified: DC.W DC.L 'ab' TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Prefix (asm68) Prefix (asm68k) @ or 0 † @ or 0 0 † – 9 1 – 9...
  • Page 159 ( " ). It has the following effect: .byte "xyz" Strings are not null terminated (whereas they are in the C language). TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Table 3.7: Escaped Characters 'abc' ;...
  • Page 160: Floating-Point Constants

    (or E). Internally, the constant is converted to the TI BCD floating-point format. Floating-point constants can be specified directly in the TI BCD floating-point format by specifying their bit patterns in hexadecimal. The prefixes used to introduce a bit pattern are the hexadecimal integer constant prefixes ($, 0x, or 0X).
  • Page 161: Operators

    The rules for asm68 are identical to those of the C language, while the rules for asm68k are identical to those of the Motorola M68000 Resident Structured Assembler. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Description Unary One’s complement...
  • Page 162: Expression Evaluation

    = 18 sym_b: .long .long .long .long .long .long sym_f: TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Operator left to right right to left left to right << >> left to right & | ! ^ left to right...
  • Page 163 A + B resolves to the value 0x9040, the first statement will generate a linker warning and the second will be accepted: .word .word TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; linker warning generated (A+B)&0xffff ; ok...
  • Page 164: Instruction Set

    Word size is not legal for the lea instruction, and the jsr instruction is unsized. movea.l move .opt move TI-89 / TI-92 Plus Sierra C Assembler Reference Manual #array,a0 ; instruction size is long (rule 1) func,d0 ; instruction size is long (rule 2) isize = w ;...
  • Page 165: Instruction Optimization

    The instruction optimizations and corrections are summarized in Table 3.10. As is shown, optimizations produce faster code with exactly the same results, and corrections produce legal code with the original code’s intent. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 166 #<data>,<ea> #<data>,<ea> #<data>,<ea> MOVE.L #<bdata>,Dn MOVE <ea>,An Notation: <ea> #<data> #<bdata> #<qdata> Table 3.10: Instruction Optimizations and Corrections TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Modified Form ADDA <ea>,An ADDI #<data>,<ea> ADDA #<data>,An ADDQ #<qdata>,<ea> ADDQ #<qdata>,<ea> ADDQ #<qdata>,An...
  • Page 167: Effective Addressing Modes

    For example, a data alterable mode is one that is both a data reference and alterable. Table 3.12 summarize the effective addressing modes and the categories to which they belong. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 168 Program Counter Memory Indirect Postindexed Preindexed Absolute Data Addressing Short Long Immediate *Not supported by Texas Instruments. Notation: TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Syntax 68000/08/1 (An) (An)+ –(An) (d 16 ,An) (d 8 ,An,Xn) (bd,An,Xn) ([bd,An],Xn,od)
  • Page 169: Terminology

    The term index register refers to the register that is added to the base address in an indexed addressing mode. Any data register or address register can be used as an index register. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Data Memory...
  • Page 170: Effective Address Syntax

    • All registers (i.e., data, address, floating-point, and control registers) are • specified using Motorola’s naming conventions. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler ) are used to specify the Not for Distribution Beta Version February 2, 2001...
  • Page 171 PC-relative reference of 8 bytes from the beginning of the current instruction, the correct syntax is (.+8,PC) or ( * +8,PC), depending on the assembler. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ) and slash ( / ) are used to specify register lists; the hyphen...
  • Page 172: Addressing Mode Selection

    PC-relative displacement can be computed when its associated effective address is encountered. The computation can be performed if the displacement involves no forward or external references, and the effective address and referenced TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler pcf / PCF...
  • Page 173: Displacement Sizing

    Table 3.14 and Table 3.15, which show the sizing rules for unknown absolute and PC-relative displacements, respectively. For more information on these options, see the .opt / OPT directive. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 174: Mode Selection

    If the address consists of a byte or word displacement, a base register, and no memory indirection, then the (d 16 ,An) or (d 16 ,PC) mode is selected. The TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Option (asm68) Option (asm68k) FRL †...
  • Page 175: Asm68 Assembler Directives

    Symbol directives Data/Fill directives Control directives Output directives Debugging directives Table 3.16: Directive Groups TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Description Create and resume sections Create and modify symbols Generate initialized/uninitialized data Control assembly Specify output settings...
  • Page 176: Asm68 Section Directives

    Table 3.17 summarizes the section directives for asm68. For more information, see section 3.3.4 Sections. See chapter 7. Flash Application Layout in the TI-89 / TI-92 Plus Developer Guide for information on the use and initialization of the TI-89 / TI-92 Plus sections.
  • Page 177: Asm68 Symbol Directives

    .global .globl .lcomm .xdef .xref Table 3.18: Symbol Directives TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Function Define a comm symbol Declare external a referenced symbol Declare external a referenced symbol Declare external a defined symbol Declare external a defined symbol...
  • Page 178: Asm68 Data/Fill Directives

    Generate integer data (word) .single Not supported .space Generate a block of uninitialized data .word Generate integer data (word) Table 3.19: Data/Fill Directives TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 179: Asm68 Control Directives

    Table 3.21 summarizes the output directives for asm68. Directive .echo .page Table 3.21: Output Directives TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Function Echo message Begin new listing page Not for Distribution Beta Version February 2, 2001...
  • Page 180: Asm68 Debugging Directives

    Asm68 Directive Reference The remainder of this section provides, in alphabetical order, detailed descriptions of the directives supported by asm68. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 181 .ascii 16 * 4 + 3 Each of the above examples is shown with the code sequence (in hexadecimal) that it generates. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; 4865 6c6c 6f21 00 ; 61 ; 0f0f 0f0f ;...
  • Page 182 Directories specified with the -I flag. Directories specified with the environment variables INCLUDE68 or SIERRA (see section 3.2.4 Environment Variables). Examples .bin "table.inc" .bin "../include/graphics.std" TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 183 The section .bss is present in all object files, regardless of whether it is specified. For more information, see section 3.3.4.1 Section Types. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; relocatable ; absolute...
  • Page 184 Example .cmnt These lines are ignored by the assembler; no other comment markers are needed. .endc TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler ; 4865 6c6c 6f21 00 ; 61 ; 0f0f 0f0f ; 43...
  • Page 185 The section .data contains initialized read/write data. It is present in all object files, regardless of whether it is specified. For additional information, refer to section 3.3.4.1 Section Types. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 186 .val init .scl 2 .type 0x24 .endef .def tbl \ .val 12 \ .scl 3 \ .type 0x4 \ .endef TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 187 .def buf .val buf .dim 16,4 .scl 2 .type 0xf4 .line 25 .size 256 .endef TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; buf is a two-dim array, int buf[16][4] Not for Distribution Beta Version February 2, 2001...
  • Page 188 Specifies a floating-point symbol or floating-point constant. No forward references are allowed. The .double directive generates TI BCD floating-point data. The values of the specified operands are placed in 10 bytes beginning at the current location in the current section. A warning is issued if the alignment is odd.
  • Page 189 (see .opt fillval). Relocatable sections cannot be resumed with an address specification. Examples .dsection table .dsection ram, 0x8000 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; relocatable ; absolute Not for Distribution Beta Version February 2, 2001...
  • Page 190 If the value of the label is 0x42f8, then this directive produces the following message: The end of the data section is 42f8 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Signed decimal Unsigned decimal...
  • Page 191 The .elifdef directive is optional within a conditional assembly block. Example .ifdef option1 moveq .elifdef option2 moveq .elifdef option3 moveq .endif TI-89 / TI-92 Plus Sierra C Assembler Reference Manual #1,d0 #2,d0 #3,d0 Not for Distribution Beta Version February 2, 2001...
  • Page 192 .endc — End Comment Block Syntax .endc Description The .endc directive ends a comment block (see .cmnt directive). TI-89 / TI-92 Plus Sierra C Assembler Reference Manual #1,d0 #0,d0 Not for Distribution Section 3: Assembler Beta Version February 2, 2001...
  • Page 193 .struct directive for more information. .extend — Generate Floating-Point Data (Extended-Precision) Not supported by Texas Instruments. However, .extend is still recognized as a reserved name by asm68. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 194 C source file when the -L command line flag is used. For more information, see section 1.4.7.1 Special Symbols. Example .file "demo.c" TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 195 . This directive cannot be used in BSS-type sections. Examples .fill 256, 0xff .fill.l 16, err_vector TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer (1 byte) Word Integer (2 bytes) Long-word Integer (4 bytes) Single-precision Real (not supported)
  • Page 196 Specifies a floating-point symbol or floating-point constant. No forward references are allowed. The .float directive generates TI BCD floating-point data. The values of the specified operands are placed in 10 bytes beginning at the current location in the current section. A warning is issued if the alignment is odd. The data generated is the same as the .double directive, allowing 16 digits in the mantissa.
  • Page 197 .ifdef directive are skipped and control passes to the aforementioned matching directive. Conditional assembly directives can be nested to 40 levels. Example .ifdef serial move.l #serial_dev, io_func .endif TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 198 Conditional assembly directives can be nested to 40 levels. Example .ifndef serial move.l #parallel_dev, io_func .endif TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 199 This directive can be nested, i.e., included files can themselves include files. The assembler imposes no limit on the level of nesting. Examples .include "table.inc" .include "../include/vector.h" TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 200 For more information, refer to section 3.3.5.4 Comm and Lcomm Symbols. Examples .lcomm table, 4096 .lcomm strings, 256, 4 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 201 Example .def buf .val buf .dim 16,4 .scl 2 .type 0xf4 .line 25 .size 256 .endef TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; buf is defined on line 25 Not for Distribution Beta Version February 2, 2001...
  • Page 202 The .ln directive is typically used only for C source-level debugging; it is ignored when assembler source-level line number information is generated with the -L command line flag. Example .ln 33 add d0,d1 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 203 .long 16777215, 0xffffff .long 0xff << 24 Each of the above examples is shown with the sequence of long words (in hexadecimal) that it generates. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; 61626364 ; 00ffffff 00ffffff ; ff000000...
  • Page 204 Set the fill value to value (see .align and .space directives). fpid= n fpisize= size fr16 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Set the size of unknown absolute displacements to either 16 or 32 bits (see section 3.5.4.2 Displacement Sizing). (Default: a32) Enable/disable full listing of data directive assembly.
  • Page 205 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Enable displacement size checking for forward branches. The assembler will issue a warning for each displacement that can be reduced in size. (Default: disabled) Enable/disable instruction optimizations (see section 3.4.3 Instruction Optimization).
  • Page 206 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Enable coercion to PC-relative addressing modes for forward references, references to locations positioned at an unknown distances. This option also enables the pcb16 option. For more information, see section 3.5.4.1 PC-relative Coercion.
  • Page 207 .packed — Generate Floating-Point Data (Packed Decimal) Not supported by Texas Instruments. However, .packed is still recognized as a reserved name by asm68. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 208 .bsection tbl, 0x1000 move.l .reorg 0x8000 As the second example illustrates, the .reorg directive can be applied to any absolute section, regardless of its declaration. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual #7,d0 _abc,d0 Not for Distribution Section 3: Assembler...
  • Page 209 (see also .type directive). Example .def x .val 3 .scl 4 .type 4 .endef TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; x is in a register Not for Distribution Beta Version February 2, 2001...
  • Page 210 Relocatable sections cannot be resumed with an address specification. This directive is a synonym for the .dsection directive. Examples .section table .section ram, 0x8000 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler ; relocatable ; absolute Not for Distribution...
  • Page 211 .single — Generate Floating-Point Data (Single-Precision) Not supported by Texas Instruments. However, .single is still recognized as a reserved name by asm68. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; 6162 ; 03ff 03ff 03ff ; 4000...
  • Page 212 .val buf .dim 16,4 .scl 2 .type 0xf4 .line 25 .size 256 .endef TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; buf is an array 256 bytes long Not for Distribution Section 3: Assembler Beta Version February 2, 2001...
  • Page 213 (see .opt fillval), unless the section is of BSS-type. Examples .space .space.l TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer (1 byte) Word Integer (2 bytes) Long-word Integer (4 bytes) Single-precision Real (not supported)
  • Page 214 This example illustrates how the .struct and .ends directives are used to define a set of structure field labels. The .space and .align directives are used to allocate space and maintain proper alignment, respectively. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler ; struct node { ;...
  • Page 215 The section .text contains read-only data. It is present in all object files, regardless of whether it is specified. For more information, see section 3.3.4.1 Section Types. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; s is the tag of the structure ; of which x is a member...
  • Page 216 (see .opt fillval). Relocatable sections cannot be resumed with an address specification. Examples .tsection code .tsection rom, 0xf800 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler ; relocatable ; absolute Not for Distribution...
  • Page 217 Function types can only be attributed to labels defined in text-type sections. Example .type 0x24 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; x is a function that returns an int Not for Distribution Beta Version February 2, 2001...
  • Page 218 Example .def x .val x .scl 2 .type 4 .endef TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; x is a variable its value is its location Not for Distribution Section 3: Assembler Beta Version February 2, 2001...
  • Page 219 (since the default symbol scope is static). Examples .xdef init .xdef proc1, diag_list TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; 6162 ; 03ff 03ff 03ff ; 4000 Not for Distribution...
  • Page 220 (unless the -E flag is specified on the command line). Examples .xref base, init, input .xref proc1 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 221: Asm68K Assembler Directives

    When two mnemonics are equivalent and referenced from within this document, the names of the mnemonics are shown separated by a slash (e.g., .global / XDEF). TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Description Create and resume sections...
  • Page 222: Asm68K Section Directives

    Table 3.24 summarizes the section directives for asm68k. For more information, see section 3.3.4 Sections. See chapter 7. Flash Application Layout in the TI-89 / TI-92 Plus Developer Guide for information on the use and initialization of the TI-89 / TI-92 Plus sections.
  • Page 223: Asm68K Symbol Directives

    Define a register list symbol Define/redefine an integer symbol XDEF Declare external a defined symbol XREF Declare external a referenced symbol Table 3.25: Symbol Directives TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 224: Asm68K Data/Fill Directives

    Generate a block of uninitialized data Generate integer/floating-point data Generate a block of initialized data Generate a block of uninitialized data Table 3.26: Data/Fill Directives TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 225: Asm68K Control Directives

    Assemble if condition true IFNC Assemble if strings not equal INCLUDE Include assembler source file MASK2 Not supported Set assembler options Table 3.27: Control Directives TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 226: Asm68K Output Directives

    When the -L command line flag is specified, a line number entry is generated for each instruction and memory allocation directive in text-type sections. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Function Echo message...
  • Page 227: Asm68K Directive Reference

    3.7.7. Asm68k Directive Reference The remainder of this section provides, in alphabetical order, detailed descriptions of the directives supported by asm68k. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Function Begin symbol attribute block Set array dimension attribute End symbol attribute block...
  • Page 228 Directories specified with the -I flag. Directories specified with the environment variables INCLUDE68 or SIERRA (see section 3.2.4 Environment Variables). Examples BIN "table.inc" BIN "../include/graphics.seg" TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 229 No object code can be generated in BSS-type sections; they contain only uninitialized read/write data. Examples BSECTION BSECTION xyz,$4000 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; relocatable ; absolute Not for Distribution Beta Version February 2, 2001...
  • Page 230 .byte %1111,017,15,0xF .byte 16*4+3 Each of the above examples is shown with the code sequence (in hexadecimal) that it generates. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler ; 4865 6C6C 6F21 00 ; 61 ; 0F0F 0F0F ;...
  • Page 231 Each byte is filled with the current fill value (see OPT FILLVAL), unless the section is of BSS-type. This directive’s intended use is not applicable to asm68k; it is supported only for Motorola compatibility. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 232 (i.e., the symbol will reside in the top or bottom 32K of memory). Examples COMM table,4096 COMM strings,256,2 COMM.S buffer,4 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 233 The section .data contains initialized read/write data. It is present in all object files, regardless of whether it is specified. For additional information, refer to section 3.3.4.1 Section Types. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 234 DC.D 2.71828182846 Each of the above examples is shown with the sequence of words (in hexadecimal) that it generates. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer (1 byte) Word Integer (2 bytes) Long-word Integer (4 bytes)
  • Page 235 . This directive cannot be used in BSS-type sections. Examples 256,$FF DCB.L 16,err_vector TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer (1 byte) Word Integer (2 bytes) Long-word Integer (4 bytes) Single-precision Real (not supported)
  • Page 236 VAL init SCL 2 TYPE $24 ENDEF DEF tbl ; VAL 12 ; SCL 3 ; TYPE 4 ; ENDEF TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 237 DEF buf VAL buf DIM 16,4 SCL 2 TYPE $F4 LINE 25 SIZE 256 ENDEF TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; buf is a two-dim array, int buf[16][4] Not for Distribution Beta Version February 2, 2001...
  • Page 238 Specifies a floating-point symbol or floating-point constant. No forward references are allowed. The .double directive generates TI BCD floating-point data. The values of the specified operands are placed in 10 bytes beginning at the current location in the current section. A warning is issued if the alignment is odd.
  • Page 239 Specifying a count of zero forces alignment for the selected data size (e.g., DS.W 0 forces word alignment). Examples DS.L 64 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer (1 byte) Word Integer (2 bytes) Long-word Integer (4 bytes)
  • Page 240 (i.e., the section will reside in the top or bottom 32K of memory). Examples DSECTION table DSECTION ram,$8000 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler ; relocatable ; absolute Not for Distribution...
  • Page 241 If the value of the label is 0x42f8, then this directive produces the following message: The end of the data section is 42f8 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Signed decimal Unsigned decimal...
  • Page 242 The .elifdef directive is optional within a conditional assembly block. Example .ifdef option1 moveq .elifdef option2 moveq .elifdef option3 moveq .endif TI-89 / TI-92 Plus Sierra C Assembler Reference Manual #1,d0 #2,d0 #3,d0 Not for Distribution Section 3: Assembler Beta Version February 2, 2001...
  • Page 243 The ELSEC directive is optional within a conditional assembly block. Example IFNE debug MOVEQ ELSEC MOVEQ ENDC TI-89 / TI-92 Plus Sierra C Assembler Reference Manual #1,d0 #0,d0 #1,D0 #0,D0 Not for Distribution Beta Version February 2, 2001...
  • Page 244 Description The ENDC directive ends a conditional assembly block (see IFC, IFNC, and IFcc directives). Example IFNE debug mem_dump ENDC TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 245 .endif — End Conditional Assembly Block Syntax .endif Description The .endif directive ends a conditional assembly block (see .ifdef and .ifndef directives). Example .ifdef debug mem_dump .endif TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 246 .extend — Generate Floating-Point Data (Extended-Precision) Not supported by Texas Instruments. However, .extend is still recognized as a reserved name by asm68k. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 247 -L command line flag is used. For more information, see section 1.4.7.1 Special Symbols. Example .file "demo.c" TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; second argument inside a macro Not for Distribution Beta Version February 2, 2001...
  • Page 248 Specifies a floating-point symbol or floating-point constant. No forward references are allowed. The .float directive generates TI BCD floating-point data. The values of the specified operands are placed in 10 bytes beginning at the current location in the current section. A warning is issued if the alignment is odd. The data generated is the same as the .double directive, allowing 16 digits in the mantissa.
  • Page 249 For more information, refer to the discussion of the .file symbol in section 1.4.7.1 Special Symbols. Example demo.s IDNT TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 250 Conditional assembly directives can be nested to 40 levels. Example IFC '\2','' MOVE.L #1,match ENDC TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler i.e., they can be Not for Distribution Beta Version February 2, 2001...
  • Page 251 Example IFGT count MOVEQ #5,D2 ENDC TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Expression is equal to zero Expression is not equal to zero Expression is greater than or equal to zero Expression is greater than zero Expression is less than or equal to zero...
  • Page 252 .ifdef directive are skipped and control passes to the aforementioned matching directive. Conditional assembly directives can be nested to 40 levels. Example .ifdef serial move.l #serial_dev,io_func .endif TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 253 Conditional assembly directives can be nested to 40 levels. Example IFNC '\1','' MOVE.W D0,D3 ENDC TI-89 / TI-92 Plus Sierra C Assembler Reference Manual i.e., they can be Not for Distribution Beta Version February 2, 2001...
  • Page 254 Conditional assembly directives can be nested to 40 levels. Example .ifndef serial move.l #parallel_dev,io_func .endif TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 255 This directive can be nested, i.e., included files can themselves include files. The assembler imposes no limit on the level of nesting. Examples INCLUDE "table.inc" INCLUDE "../include/vector.h" TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 256 (i.e., the symbol will reside in the top or bottom 32K of memory). Examples LCOMM table,4096 LCOMM strings,256,4 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 257 Example DEF buf VAL buf DIM 16,4 SCL 2 TYPE $F4 LINE 25 SIZE 256 ENDEF TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; buf is defined on line 25 Not for Distribution Beta Version February 2, 2001...
  • Page 258 The LLEN directive sets the line length of the listing file to length characters. The default line length is 80. Example LLEN 132 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 259 The .ln / LN directive is typically used only for C source-level debugging; it is ignored when assembler source-level line number information is generated with the -L command line flag. Example LN 33 ADD D0,D1 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 260 NOFORMAT — Do Not Format Assembly Listing Syntax NOFORMAT Description The NOFORMAT directive is ignored. It is recognized only for Motorola compatibility. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler ; 61626364 ; 00FFFFFF 00FFFFFF ; FF000000 Not for Distribution...
  • Page 261 NOPAGE — Do Not Page Listing File Syntax NOPAGE Description The NOPAGE directive suppresses paging in the listing file. The listing is generated as one continuous page. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 262 This example illustrates how the OFFSET directive is used to define a set of structure field labels. The DS directive is used to allocate space and maintain proper alignment. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler ; struct node { char visited;...
  • Page 263 NOCEX CHOP NOCHOP NOCL NOEQU TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Set the size of unknown PC-relative displacements to 8 or 16 bits (see section 3.5.4.2 Displacement Sizing). (Default: Enable/disable character case-sensitivity in symbol names (see section 3.3.5.1 Symbol Syntax).
  • Page 264 NOMC NOMD NOMEX NOPC TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Set the fill value to value (see DS directive). A warning is issued if the specified value does not fit in a signed or unsigned byte. (Default:...
  • Page 265 NOPCA PCB16 PCB32 RNGCHK [ = ] type SCEX NOSCEX UHEX ULOC TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Enable/disable old branch sizing (see section 3.5.4.2 Displacement Sizing). (Default: NOOLD Set the target processor. 68000 Texas Instruments. (Default:...
  • Page 266 Description The PAGE directive begins a new page in the listing file. This directive does not appear in the listing. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Absolute short reference (16-bit) Absolute long reference (32-bit) Not for Distribution...
  • Page 267 Register list symbols are suitable for use with the MOVEM and FMOVEM instructions. For more information on register list specification, see section 3.5.3 Effective Address Syntax. Examples SAVE REG D3-D7/A2 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 268 $8000 As the second example illustrates, the REORG directive can be applied to any absolute section, regardless of its declaration. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 269 -L command line flag (see also .type / TYPE directive). Example DEF x VAL 3 SCL 4 TYPE 4 ENDEF TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; x is in a register Not for Distribution Beta Version February 2, 2001...
  • Page 270 (i.e., the section will reside in the top or bottom 32K of memory). This directive is a synonym for the DSECTION directive. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution...
  • Page 271 For more information, see section 3.3.5.3 Symbol Assignment. Examples COUNT SET 1 COUNT SET COUNT+1 COUNT SET COUNT+1 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 272 .short 01777,1023,0x3FF .short 1024*16 Each of the above examples is shown with the sequence of words (in hexadecimal) that it generates. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler ; 6162 ; 03FF 03FF 03FF ; 4000...
  • Page 273 DEF buf VAL buf DIM 16,4 SCL 2 TYPE $F4 LINE 25 SIZE 256 ENDEF TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; buf is an array 256 bytes long Not for Distribution Beta Version February 2, 2001...
  • Page 274 (see OPT FILLVAL), unless the section is of BSS-type. Examples .space .space.l TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer (1 byte) Word Integer (2 bytes) Long-word Integer (4 bytes) Single-precision Real (not supported)
  • Page 275 The SPC directive generates count blank lines in the listing file. This directive does not appear in the listing. Example SPC 3 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 276 The section .text contains read-only data. It is present in all object files, regardless of whether it is specified. For more information, see section 3.3.4.1 Section Types. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; s is the tag of the structure ; of which x is a member...
  • Page 277 (i.e., the section will reside in the top or bottom 32K of memory). Examples TSECTION code TSECTION rom,$F800 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; relocatable ; absolute Not for Distribution Beta Version February 2, 2001...
  • Page 278 Example TTL "macro assembler" TTL Sierra Systems is #1 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 279 Function types can only be attributed to labels defined in text-type sections. Examples TYPE $24 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; x is a function that returns an int Not for Distribution Beta Version February 2, 2001...
  • Page 280 Example DEF x VAL x SCL 2 TYPE 4 ENDEF TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; x is a variable its value is its location Not for Distribution Section 3: Assembler Beta Version February 2, 2001...
  • Page 281 (since the default symbol scope is static). Examples XDEF init XDEF proc1,diag_list TI-89 / TI-92 Plus Sierra C Assembler Reference Manual ; 6162 ; 03FF 03FF 03FF ; 4000 Not for Distribution...
  • Page 282 The optional section number is ignored; it is recognized only for Motorola compatibility. Examples XREF base,init,input XREF.S proc1 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution Beta Version February 2, 2001...
  • Page 283: Asm68K Macros

    Specifies a comment, which is typically used to document any formal parameters of the macro. statement Specifies an assembler statement. It cannot be a macro definition (i.e., macro definitions cannot be nested). TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 284: Macro Invocation

    \2, etc. Parameters are passed by name, not by value. Since the parameter-passing mechanism is simply textual substitution, values of symbols can be modified by the macro. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution...
  • Page 285: Parameters

    If an actual parameter contains whitespace or commas, it must be enclosed in angle brackets ( < > ). Angle brackets can be nested, but must always appear in pairs. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 286: Local Labels

    MEXIT and ENDM directives). Only the current invocation is terminated; if macros are nested, control is returned to the previous level of macro expansion. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution...
  • Page 287: Macro Examples

    The definition of this macro is followed by a pair of example invocations and their associated expansions. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual <\1>,?(\2-1) <MOVE.B (A0)+,(A1)+>,8...
  • Page 288 COUNT uses the qualifier to compute the number of move instructions needed to perform the copy. Two example invocations are shown following the macro definitions. COPY MACRO IFNC COUNT ENDC IFEQ TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler \1,?(\2-1),\3 \3\2 BIT,7,1<< 1<<0 1<<1 1<<2 1<<3...
  • Page 289 ENDM COUNT MACRO ELSEC ELSEC ENDC ENDC ENDM COPY.B L.0000 MOVE.B COPY.L MOVEQ L.0001 MOVE.L TI-89 / TI-92 Plus Sierra C Assembler Reference Manual \2,A\6 (A\6)+,(A\5)+ ; \3 \1,A0 \2,A1 (A1)+,(A0)+ ; \3 '\3','STRING COPY' D0,L\@ '\2','B' #(\1-1),\4 '\2','L' #((\1>>2)-1),\4 #((\1>>1)-1),\4...
  • Page 290: Structured Control Macros

    Specifies an effective address expression (see section 3.5 Effective Addressing Modes). logical_op Specifies one of the following logical operators: TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Logical AND Logical OR Not for Distribution Section 3: Assembler...
  • Page 291 Equal Greater or Equal Greater Than High Less or Equal Table 3.30: Integer Conditional Tests TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer Word Integer Long-word Integer Single-precision Real (not supported) Double-precision Real (not supported) Extended-precision Real (not supported) Packed Decimal Real (not supported) The second operand is immediate data.
  • Page 292: Macro Invocation

    3.8.2.3. Structured Control Reference The remainder of this section contains detailed descriptions of the various structured control macros. The descriptions are ordered alphabetically. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Function Terminate Loop Execution Begin Next Loop Iteration...
  • Page 293 The BREAK macro expands into an unconditional branch to the assembler-generated label that immediately follows the smallest enclosing loop. Using this macro outside a loop results in an error. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual 8-bit forward branch 8-bit forward branch...
  • Page 294 The CONTINUE macro expands into an unconditional branch to the assembler-generated label that immediately precedes the condition test of the smallest enclosing loop. Using this macro outside a loop results in an error. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual 8-bit forward branch 8-bit forward branch...
  • Page 295 The legal values are shown below; if omitted, the branch extent is determined by the current default forward branch size (see OPT BRB/BRS/BRW directive). statement Specifies an assembler statement. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer Word Integer Long-word Integer 8-bit forward branch...
  • Page 296 As the first example illustrates, the default step size of 1 is inappropriate when the loop counter is used directly to index through word or long-word data. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 3: Assembler Not for Distribution...
  • Page 297 3.4.2 Instruction Sizing. expression Specifies a structured control expression (see section 3.8.2.1 Structured Control Expressions). TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer. Word Integer. Long-word Integer. Single-precision Real (not supported).
  • Page 298 Example IF.W D1 <GT> D2 THEN.S MOVE.W D1,D0 ELSE.S MOVE.W D2,D0 ENDI TI-89 / TI-92 Plus Sierra C Assembler Reference Manual 8-bit forward branch. 8-bit forward branch. 16-bit forward branch. Not for Distribution Section 3: Assembler Beta Version February 2, 2001...
  • Page 299 REP macro in the first example in section 3.8.1.7 Macro Examples. Example REPEAT MOVE.B (A0)+,(A1)+ UNTIL <EQ> TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer Word Integer Long-word Integer Not for Distribution Beta Version February 2, 2001...
  • Page 300 Upon normal exit from the loop, the condition codes will reflect the final evaluation of expression . TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Byte Integer Word Integer...
  • Page 301: Instruction Set Summary

    This is especially true of the floating-point instructions. The legal size qualifiers and the default sizes are summarized for each instruction. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 302 BFINS BFSET BFTST BGND BKPT BSET BTST CALLM CAS2 CHK2 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Size Qualifiers asm68 W L † B/L ‡ B/L ‡ W L † B/L ‡ W L † B/L ‡ W L †...
  • Page 303 FABS FACOS FADD FASIN FATAN FATANH FBcc Table 3.32: Instructions and Size Qualifiers (continued) TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Default Size Size Qualifiers asm68 W L † W L † Not for Distribution asm68k Not Supported Ÿ...
  • Page 304 FMUL FNEG FNOP FREM FRESTORE FSABS FSADD FSAVE Table 3.32: Instructions and Size Qualifiers (continued) TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Default Size Size Qualifiers asm68 Not for Distribution Section 3: Assembler asm68k Not Supported Ÿ Ÿ...
  • Page 305 MOVE from CCR MOVE from SR MOVE to CCR MOVE to SR MOVE USP Table 3.32: Instructions and Size Qualifiers (continued) TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Default Size Size Qualifiers asm68 W L † Not for Distribution...
  • Page 306 PRESTORE PSAVE PScc PTEST PTRAPcc PVALID RESET Table 3.32: Instructions and Size Qualifiers (continued) TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Default Size Size Qualifiers asm68 W L † W L † Not for Distribution Section 3: Assembler...
  • Page 307 † Size qualifier .L legal with 68020/30/40 and CPU32 only ‡ Size qualifier is determined by the destination operand: .B (memory), .L (register) Table 3.32: Instructions and Size Qualifiers (continued) TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Default Size Size Qualifiers...
  • Page 308 Section 3: Assembler TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 309 4.4. Object Files ... 302 4.4.1. Sections... 302 4.5. Symbols ... 302 4.6. Relocation Entries ... 303 4.7. Relocation Hole Compression... 303 4.8. Reserved Symbols ... 305 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 310 Section 4: Linker TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 311: Linker

    Sierra C™ software package. Under license from Sierra Systems, Texas Instruments has modified this software to support TI BCD floating-point numbers, and support for coprocessors has been removed. Although the software has not been modified to exclude support for processors other than the 68000, the 68000 is the only processor supported by Texas Instruments.
  • Page 312: Options

    Sierra C library files have been rewritten as part of the calculator operating system and are accessed through the jump table instead. No other library file is required to create apps or ASMs for use on the TI-89 or TI-92 Plus.
  • Page 313 -L dir -o outfile -x ext TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Cause undefined symbols to be an error instead of a warning. Errors cause the linker to exit (after completion) with a nonzero return value. Include (interpolate) the file file command line or command file.
  • Page 314: Object Files

    Sections are indivisible, contiguous pieces of object code. When creating an app, sections must be defined and used only as shown in the examples supplied with the TI-89 / TI-92 Plus SDK. See chapter 7. Flash Application Layout in the TI-89 / TI-92 Plus Developers Guide for more information.
  • Page 315: Relocation Entries

    The majority of the linker directives are contained in the file app.lnk in this example. Refer to the sample files supplied with the TI-89 / TI-92 Plus SDK for information on what should be included in app.lnk.
  • Page 316 The two assembly/linkage passes (plus any necessary additional passes) required for relocation hole compression are performed automatically by the TI FLASH Studio. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Section 4: Linker Not for Distribution Beta Version February 2, 2001...
  • Page 317: Reserved Symbols

    Texas Instruments. However, they are still reserved names and must be avoided. See chapter 13. Memory Management in the TI-89 / TI-92 Plus Developers Guide for information on the memory routines available on the TI-89 / TI-92 Plus.
  • Page 318 Section 4: Linker TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 319 Section 5: Utilities 5. Utilities...309 5.1. Symbol Table Name Utility ... 309 5.2. Object File Size Utility ... 313 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 320 Section 5: Utilities TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 321: Utilities

    Suppress the header information at the start of the formatted and raw symbol listings. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 322 All symbols are listed in the order that they appear in their respective object files. Print only static symbols. When used with the are also printed. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual start_offset and continuing through file offset or the specified length flag.
  • Page 323 The output from the above invocation of nm68 is as follows: Name hello.c _main _printf _scanf TI-89 / TI-92 Plus Sierra C Assembler Reference Manual absolute symbol, global absolute symbol, local bss symbol, local bss symbol, global comm variable data symbol, local...
  • Page 324 Physical address (hexadecimal) of section. See section 1.4.1.2 Physical and Virtual Addresses. Virtual address (hexadecimal) of section. See section 1.4.1.2 Physical and Virtual Addresses. Size in bytes (hexadecimal) of section. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual (001932 , 002862 ) FLAGS: 0x0003...
  • Page 325: Object File Size Utility

    The output from the above invocation of size68 is as follows: Section ------- .text .ld_tbl .data .bss Total: TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Address Length Decimal ------- ------ ------- 5000 17dc 6108...
  • Page 326 Section 5: Utilities TI-89 / TI-92 Plus Sierra C Assembler Reference Manual Not for Distribution Beta Version February 2, 2001...
  • Page 327 .data, 10 , 19 , 24 , 140 , 173 , 221 .def, 174 , 224 .dim, 175 , 225 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual .double, 176 , 226 .dsection, 177 , 228 .eb, 19 , 20 , 24 , 31 .echo, 178 , 229...
  • Page 328 __FLOAT__, 101 __INT__, 101 __LINE__, 101 __line_ck, 48 __ms16u16, 82 __ms32s32, 82 __mu16u16, 82 __mu32u32, 82 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual __PCREL__, 101 __SIERRA__, 101 __stk_ck, 50 __TIME__, 101 _edata, 19 _end, 19 _etext, 19 _line_ck, 86...
  • Page 329 274 MEXIT, 274 NARG, 274 options, 252 , 253 overview, 271 parameters, 273 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual assembly language, 137 See also expression. See also label. character set, 140 comm symbol, 144 expression evaluation, 150 expressions, 148 –...
  • Page 330 47 , 49 , 50 static storage initialization, 87 switch statement implementation, 92 translation limits, 52 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual volatile, 68 warning generation, 48 , 50 const, 53 , 67 CONTINUE, 282 conversion, 70 –...
  • Page 331 11 flags, 12 file_fmt.txt, 10 fill value, 183 , 192 , 252 See also section, fill value. TI-89 / TI-92 Plus Sierra C Assembler Reference Manual floating-point arithmetic See also compiler, internal floating-point functions. IEEE format, 83 TI BCD, 83...
  • Page 332 See assembler macro. See preprocessor. See structured control macro. magic number , 11 , 12 MASK2, 248 MEXIT, 274 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual NARG, 274 nm68 See symbol table name utility. NOFORMAT, 248 NOL, 249...
  • Page 333 OR, 278 , 280 overview, 278 reference, 280 structured control expression, 278 THEN, 280 , 285 TI-89 / TI-92 Plus Sierra C Assembler Reference Manual TO, 280 , 283 suppressed register , 158 , 163 symbol, 141 , 302 See also assembly language.
  • Page 334 28 , 30 fundamental, 28 , 30 TAG, 264 TI BCD floating-point, 5 , 54 , 60 , 61 , 72 , 78 , 83 , 148 , 166 , 176 , 184 , 212 , 226 , 236 trigraph sequences, 100 TSECTION, 265 See _touch.

This manual is also suitable for:

Ti-92 plusTi-89 plusTi-92 plus

Table of Contents