Welcome

The Assembler Description



-... General Assembler Directives

   An  ASxxxx  directive  is placed in the operator field of the
source line.  Only one directive is  allowed  per  source  line.
Each  directive  may  have  a blank operand field or one or more
operands.  Legal operands differ with each directive.  


.module Directive 

Format:  

        .module string 

   The .module directive causes the string to be included in the
assemblers output file as an identifier for this particular  ob-
ject  module.   The  string  may  be  from  1 to 8 characters in
length.  Only one identifier is allowed  per  assembled  module.
The  main use of this directive is to allow the linker to report
a modules' use of undefined symbols.  At link time all undefined
symbols  are  reported  and  the  modules  referencing  them are
listed.  

=> Section Index

.title Directive Format: .title string The .title directive provides a character string to be placed on the second line of each page during listing.
=> Section Index

.sbttl Directive Format: .sbttl string The .sbttl directive provides a character string to be placed on the third line of each page during listing.
=> Section Index

.page Directive Format: .page The .page directive causes a page ejection with a new heading to be printed. The new page occurs after the next line of the source program is processed, this allows an immediately follow- ing .sbttl directive to appear on the new page. The .page source line will not appear in the file listing. Paging may be disabled by invoking the -p directive.
=> Section Index

.byte and .db Directives Format: .byte exp ;Stores the binary value .db exp ;of the expression in the ;next byte. .byte exp1,exp2,expn ;Stores the binary values .db exp1,exp2,expn ;of the list of expressions ;in successive bytes. where: exp, represent expressions that will be exp1, truncated to 8-bits of data. . Each expression will be calculated . as a 16-bit word expression, . the high-order byte will be truncated. . Multiple expressions must be expn separated by commas. The .byte or .db directives are used to generate successive bytes of binary data in the object module.
=> Section Index

.word and .dw Directives Format: .word exp ;Stores the binary value .dw exp ;of the expression in ;the next word. .word exp1,exp2,expn ;Stores the binary values .dw exp1,exp2,expn ;of the list of expressions ;in successive words. where: exp, represent expressions that will occupy two exp1, bytes of data. Each expression will be . calculated as a 16-bit word expression. . Multiple expressions must be expn separated by commas. The .word or .dw directives are used to generate successive words of binary data in the object module.
=> Section Index

.blkb, .blkw, and .ds Directives Format: .blkb N ;reserve N bytes of space .blkw N ;reserve N words of space .ds N ;reserve N bytes of space The .blkb and .ds directives reserve byte blocks in the ob- ject module; the .blkw directive reserves word blocks.
=> Section Index

.ascii Directive Format: .ascii /string/ where: string is a string of printable ascii characters. / / represent the delimiting characters. These delimiters may be any paired printing characters, as long as the characters are not contained within the string itself. If the delimiting characters do not match, the .ascii directive will give the (q) error. The .ascii directive places one binary byte of data for each character in the string into the object module.
=> Section Index

.ascis Directive Format: .ascis /string/ where: string is a string of printable ascii characters. / / represent the delimiting characters. These delimiters may be any paired printing characters, as long as the characters are not contained within the string itself. If the delimiting characters do not match, the .ascis directive will give the (q) error. The .ascis directive places one binary byte of data for each character in the string into the object module. The last character in the string will have the high order bit set.
=> Section Index

.asciz Directive Format: .asciz /string/ where: string is a string of printable ascii characters. / / represent the delimiting characters. These delimiters may be any paired printing characters, as long as the characters are not contained within the string itself. If the delimiting characters do not match, the .asciz directive will give the (q) error. The .asciz directive places one binary byte of data for each character in the string into the object module. Following all the character data a zero byte is inserted to terminate the character string.
=> Section Index

.radix Directive Format: .radix character where: character represents a single character specifying the default radix to be used for succeeding numbers. The character may be any one of the following: B,b Binary O,o Octal Q,q D,d Decimal 'blank' H,h Hexidecimal X,x
=> Section Index

.even Directive Format: .even The .even directive ensures that the current location counter contains an even boundary value by adding 1 if the current loca- tion is odd.
=> Section Index

.odd Directive Format: .odd The .odd directive ensures that the current location counter contains an odd boundary value by adding one if the current lo- cation is even.
=> Section Index

.area Directive Format: .area name [(options)] where: name represents the symbolic name of the program sec- tion. This name may be the same as any user-defined symbol as the area names are in- dependent of all symbols and labels. options specify the type of program or data area: ABS absolute (automatically invokes OVR) REL relocatable OVR overlay CON concatenate PAG paged area The .area directive provides a means of defining and separat- ing multiple programming and data sections. The name is the area label used by the assembler and the linker to collect code from various separately assembled modules into one section. The name may be from 1 to 8 characters in length. The options are specified within parenthesis and separated by commas as shown in the following example: .area TEST (REL,CON) ;This section is relocatable ;and concatenated with other ;sections of this program area. .area DATA (REL,OVR) ;This section is relocatable ;and overlays other sections ;of this program area. .area SYS (ABS,OVR) ;(CON not allowed with ABS) ;This section is defined as ;absolute. Absolute sections ;are always overlayed with ;other sections of this program ;area. .area PAGE (PAG) ;This is a paged section. The ;section must be on a 256 byte ;boundary and its length is ;checked by the linker to be ;no larger than 256 bytes. ;This is useful for direct page ;areas. The default area type is REL|CON; i.e. a relocatable sec- tion which is concatenated with other sections of code with the same area name. The ABS option indicates an absolute area. The OVR and CON options indicate if program sections of the same name will overlay each other (start at the same location) or be concatenated with each other (appended to each other). Multiple invocations of the .area directive with the same name must specify the same options or leave the options field blank, this defaults to the previously specified options for this program area. The ASxxxx assemblers automatically provide two program sections: '. .ABS.' This dumby section contains all absolute symbols and their values. '_CODE' This is the default program/data area. This program area is of type (REL,CON). The ASxxxx assemblers also automatically generate two symbols for each program area: 's_' This is the starting address of the pro- gram area. 'l_' This is the length of the program area.
=> Section Index

.org Directive Format: .org exp where: exp is an absolute expression that becomes the cur- rent location counter. The .org directive is valid only in an absolute program section and will give a (q) error if used in a relocatable program area. The .org directive specifies that the current location counter is to become the specified absolute value.
=> Section Index

.globl Directive Format: .globl sym1,sym2,...,symn where: sym1, represent legal symbolic names. When sym2,... When multiple symbols are specified, symn they are separated by commas. A .globl directive may also have a label field and/or a com- ment field. The .globl directive is provided to define (and thus provide linkage to) symbols not otherwise defined as global symbols within a module. In defining global symbols the directive .globl J is similar to: J == expression or J:: Because object modules are linked by global symbols, these symbols are vital to a program. All internal symbols appearing within a given program must be defined at the end of pass 1 or they will be considered undefined. The assembly directive (-g) can be be invoked to make all undefined symbols global at the end of pass 1.
=> Section Index

.if, .else, and .endif Directives Format: .if expr . ;} . ;} range of true condition . ;} .else . ;} . ;} range of false condition . ;} .endif The conditional assembly directives allow you to include or exclude blocks of source code during the assembly process, based on the evaluation of the condition test. The range of true condition will be processed if the expres- sion 'expr' is not zero (i.e. true) and the range of false con- dition will be processed if the expression 'expr' is zero (i.e false). The range of true condition is optional as is the .else directive and the range of false condition. The following are all valid .if/.else/.endif constructions: .if A-4 ;evaluate A-4 .byte 1,2 ;insert bytes if A-4 is .endif ;not zero .if K+3 ;evaluate K+3 .else .byte 3,4 ;insert bytes if K+3 .endif ;is zero .if J&3 ;evaluate J masked by 3 .byte 12 ;insert this byte if J&3 .else ;is not zero .byte 13 ;insert this byte if J&3 .endif ;is zero The .if/.else/.endif directives may be nested upto 10 levels. The .page directive is processed within a false condition range to allow extended textual information to be incorporated in the source program with out the need to use the comment delimiter (;): .if 0 .page This text will be bypassed during assembly but appear in the listing file. . . . .endif
=> Section Index

.include Directive Format: .include string where: string represents a delimited string that is the file specification of an ASxxxx source file. The .include directive is used to insert a source file within the source file currently being assembled. When this directive is encountered, an implicit .page directive is issued. When the end of the specified source file is reached, an implicit .page directive is issued and input continues from the previous source file. The maximum nesting level of source files specified by a .include directive is five. The total number of separately specified .include files is unlimited as each .include file is opened and then closed during each pass made by the assembler.
=> Section Index

.setdp Directive Format: .setdp [base [,area]] The set direct page directive has a common format in all the AS68xx assemblers. The .setdp directive is used to inform the assembler of the current direct page region and the offset ad- dress within the selected area. The normal invocation methods are: .area DIRECT (PAG) .setdp or .setdp 0,DIRECT for all the 68xx microprocessors (the 6804 has only the paged ram area). The commands specify that the direct page is in area DIRECT and its offset address is 0 (the only valid value for all but the 6809 microprocessor). Be sure to place the DIRECT area at address 0 during linking. When the base address and area are not specified, then zero and the current area are the defaults. If a .setdp directive is not issued the assembler defaults the direct page to the area "_CODE" at offset 0. The assembler verifies that any local variable used in a direct variable reference is located in this area. Local vari- able and constant value direct access addresses are checked to be within the address range from 0 to 255. External direct references are assumed by the assembler to be in the correct area and have valid offsets. The linker will check all direct page relocations to verify that they are within the correct area. The 6809 microprocessor allows the selection of the direct page to be on any 256 byte boundary by loading the appropriate value into the dp register. Typically one would like to select the page boundary at link time, one method follows: .area DIRECT (PAG) ; define the direct page .setdp . . . .area PROGRAM . ldd #DIRECT ; load the direct page register tfr a,dp ; for access to the direct page At link time specify the base and global equates to locate the direct page: -b DIRECT = 0x1000 -g DIRECT = 0x1000 Both the area address and offset value must be specified (area and variable names are independent). The linker will verify that the relocated direct page accesses are within the direct page. The preceeding sequence could be repeated for multiple paged areas, however an alternate method is to define a non-paged area and use the .setdp directive to specify the offset value: .area DIRECT ; define non-paged area . . . .area PROGRAM . .setdp 0,DIRECT ; direct page area ldd #DIRECT ; load the direct page register tfr a,dp ; for access to the direct page . . .setdp 0x100,DIRECT ; direct page area ldd #DIRECT+0x100 ; load the direct page register tfr a,dp ; for access to the direct page The linker will verify that subsequent direct page references are in the specified area and offset address range. It is the programmers responsibility to load the dp register with the cor- rect page segment corresponding to the .setdp base address specified. For those cases where a single piece of code must access a defined data structure within a direct page and there are many pages, define a dumby direct page linked at address 0. This dumby page is used only to define the variable labels. Then load the dp register with the real base address but donot use a .setdp directive. This method is equivalent to indexed addressing, where the dp register is the index register and the direct addressing is the offset.
=> Section Index

... Exit the ASxxxx Documentation

... Home Page