HPlogo HP Assembler Reference Manual: HP 9000 Computers > Chapter 4 Assembler Directives and Pseudo-Operations

.STRING and .STRINGZ Pseudo-Operations

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

The .STRING pseudo-operation reserves storage for a data area and initializes it to ASCII values. The .STRINGZ pseudo-operation reserves storage the same as .STRING, but appends a zero byte to the data. This creates a C-language-type string. If the statement is labeled, the label refers to the first byte of the storage area.

Syntax

.STRING "init_value"

.STRINGZ "init_value"

Parameters

init_value

A sequence of ASCII characters, surrounded by quotation marks. A string can contain up to 256 characters. The enclosing quotation marks are not stored.

The following escape sequences can be used to represent characters:

Title not available (Parameters )

\"

Quotation mark

\0

Null (=\x00; ASCII NUL)

\\

Backslash

\b

Backspace (=\x08; ASCII BS)

\f

Form feed (=\x0C; ASCII FF)

\n

Newline (=\x0A; ASCII LF)

\r

Carriage return (=\x0D; ASCII CR)

\t

Tab (=\x09; ASCII HT)

\xhh or \Xhh

Any 8-bit character; hh is two hexadecimal digits.

Discussion

The .STRING pseudo-operation requests the required number of bytes to store the string (where each character is stored in a byte). The .STRINGZ pseudo-operation also requests the required storage for the quoted string but then appends a zero byte for compatibility with C language strings.

When you label one of these pseudo-operations, the label refers to the first byte of the storage area.

Examples

This pseudo-operation allocates eight bytes, the first of which is labeled G. Then it initializes this area with the characters: A, space, S, T, R, I, N, and G.

G   .STRING "A STRING"

This pseudo-operation allocates eight bytes to hold A STRING, allocates an additional byte for the appended zero, and associates the label G with the first byte of the storage area.

G   .STRINGZ  "A STRING"
© 1998 Hewlett-Packard Development Company, L.P.