What is ASCIIZ

An ASCIIZ is an alternative name for `null-terminated string', or `C String', which is a string stored with an terminating `NULL', or `\0'. The name derives from MIPS Assembly Language.

15–8 The SPIM provides two directives to allocate storage for strings: .ASCII and .ASCIIZ. The .ASCII directive can be used to allocate space for a string that is not terminated by the NULL character. The statement
.ASCII string
allocates a number of bytes equal to the number of characters in string. For example,
.ASCII "Toy Story"
allocates nine bytes of contiguous storage and initializes it to “Toy Story”. Strings are normally NULL-terminated as in C. For example, to display a string using print string service, the string must be NULL-terminated. Using .ASCIIZ instead of ASCII stores the specified string in the NULL-terminated format. The .ASCII directive is useful for breaking a long string into multiple string statements as shown in the following example:
.ASCII    "Toy Story is a good computer-animated movie. \n"
.ASCII    "This reviewer recommends it to all kids \n"
.ASCIIZ   "and their parents."

There is also a word `UnicodeZ'. Similarly, it means a unicode string with an terminating `NULL', but it's rarely used.

Back to Top | Home Page | GitHub | Email Me