Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc Intel XENIX 286 Programmers Guide (86) - Tenox.tc

09.06.2013 Views

XENIX Programming Floating-Point Directives . float float .double float as: A sse m bier The .float and .double directives accept one or more floating-point numbers as operands and allocate storage for each number. A floating-point number has the form [-] integer. fraction [ E [ - ] exponent ] where integer is a decimal number, fraction is a combination of decimal digits, and exponent is an decimal nu mber. Examples of these directives are .float .double .float 25.1 1.03E12 -34718.235E4 The .float and .double directives allocate a different number of bytes. The .float sets aside four bytes, while .double sets aside eight. Global Directive .globl name The .globl directive makes the text or data associated with name globally known to all files in a program. name must be explicitly defined by assignment or by appearance as a label in exactly one file. All other files that wish to access this name must use .globl to give the name global meaning; no other definition is allowed in these files. The link editor ld resolves all global references to name when the final program is created. If more than one name is given, they must be separated with com mas (,). Segment Directives .text .data .bss The .text, .data, and .bss directives cause the assembler to copy subsequent · instruction or data code (or allocated storage) to the text, data, or bss segment respectively. The offset of the location counter is set to the previous value for that segment and subsequent statements are processed as defined in the earlier section "Assembly Segments." The directives may be used any nu mber of times within a program. The offset for each segment is initially set to 0. Changing a segment causes the current offset to be saved. Restoring a segment causes the old offset to be restored. Thus, each segment is copied as a contiguous block even if the original source statements were not contiguous. 7-9

as: Assembler XENIX Programming Instructions and data definitions with initial values must not be used after a .bss directive, but symbols may be defined and dot moved by assignment. If no explicit segment directive is given in a program, code is copied to the text segment. Common Directive .comm name [, expression The .comm directive makes name globally known to all files of the program. If name also appears in an assignment or as a label in a file, then the .comm directive has the same effect as the .globl directive. In this case, any expression given is ignored. If name does not have an explicit definition, then .comm directs the XENIX linker to automatically allocate expression bytes for name in the bss segment of the program. These bytes appear before any bytes specifically allocated within the bss segment. Insert Directive .insrt "filename" The .insrt directive directs the assembler to suspend processing of the current file until all statements in the given file have been read. filename must be enclosed within double quotation marks. If the file cannot be opened or does not exist, the assembler displays the message Cannot open insert file Otherwise, it reads the contents of the file. The file may contain other .insrt directives; up to ten levels of directives may be nested in this way. The .insrt directive is useful for including a standard set of comments or symbol assignments at the beginning of a program, e.g., the definitions for system calls found in the file /usr/include/sys.s. The directive is also useful for breaking up a large source program into easily manageable pieces. ASCII Directives .ascii /string/ .asciz /string/ The .ascii and .asciz directives translate string into an equivalent sequence of ASCII byte values and copy these bytes to allocated storage in the current segment. The .asciz directive also appends a null byte to the end of the sequence. 7-10

<strong>XENIX</strong> Programming<br />

Floating-Point Directives<br />

. float float<br />

.double float<br />

as: A sse m bier<br />

The .float and .double directives accept one or more floating-point numbers as operands<br />

and allocate storage for each number. A floating-point number has the form<br />

[-] integer. fraction [ E [ - ] exponent ]<br />

where integer is a decimal number, fraction is a combination of decimal digits, and<br />

exponent is an decimal nu mber. Examples of these directives are<br />

.float<br />

.double<br />

.float<br />

25.1<br />

1.03E12<br />

-34718.235E4<br />

The .float and .double directives allocate a different number of bytes. The .float sets<br />

aside four bytes, while .double sets aside eight.<br />

Global Directive<br />

.globl name<br />

The .globl directive makes the text or data associated with name globally known to all<br />

files in a program. name must be explicitly defined by assignment or by appearance as a<br />

label in exactly one file. All other files that wish to access this name must use .globl to<br />

give the name global meaning; no other definition is allowed in these files. The link<br />

editor ld resolves all global references to name when the final program is created. If<br />

more than one name is given, they must be separated with com mas (,).<br />

Segment Directives<br />

.text<br />

.data<br />

.bss<br />

The .text, .data, and .bss directives cause the assembler to copy subsequent · instruction<br />

or data code (or allocated storage) to the text, data, or bss segment respectively. The<br />

offset of the location counter is set to the previous value for that segment and<br />

subsequent statements are processed as defined in the earlier section "Assembly<br />

Segments."<br />

The directives may be used any nu mber of times within a program. The offset for each<br />

segment is initially set to 0. Changing a segment causes the current offset to be saved.<br />

Restoring a segment causes the old offset to be restored. Thus, each segment is copied<br />

as a contiguous block even if the original source statements were not contiguous.<br />

7-9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!