hewlett-packard HP 9835A — 073

Assembly Language Fundamentals 73 Literals can be part of expressions as well as having expressions as part of them. Since they ultimately are replaced by an address (pointing to a specific location within a literal pool), their "type" is "relocatable". See the section on "Expressions" later in this Chapter. Basically, a literal means "the address of {expression}". An example should help in the under- standing of literals. Suppose that you want to store the value 1 into the A register. There are two ways you could accomplish that purpose. You could code - or, you could use a literal and code - : ::~j :::::! Using the literal method is easier and is more self-documenting.

While the literal form strictly says "load A with the contents of the address of the constant 1" , it can also be read as "load A with the constant 1", and this short-hand version can be an excellent way of self-documenting your programs, not to mention the elimination of a lot of unnecessar'y symbols. Nesting Literals Since literals use expressions, and literals may be used in expressions, it is possible to have a literal within a literal (nesting). In fact, it may be done to any depth, though the most useful form of nesting is a single level. Suppose you want to initialize a variable to the value of pi each time you enter a routine.

A nested literal would be a way of accomplishing this in a clean, straight-forward fashion - :::::::::::::'; .. ~ . , ..... :::",>:::: : .... , .. ':. J