LC-3 Pseudo-Ops (Assembler Directives)  pp. 182 – 183, Introduction to Computing Systems, Patt & Patel

 

The pseudo-op or assembler directive is strictly a message to the assembler to help in the assembly process.  Once the assembler handles the message, the pseudo-op is discarded.  The LC-3 assembler contains 5 pseudo-ops: .ORIG, .FILL, .BLKW, .STRINGZ, and .END.  The dot is the first character of these pseudo-ops.

 

.ORIG

 

.ORIG tells the assembler where in memory to place the LC-3 program.  Ex:

                        .ORIG            x3000

 

.FILL

 

.FILL tells the assembler to set aside the next location in the program and initialize it with the value of the operand. A label on the left binds a name to the location. <This is a constant> Ex:

            SIX            .FILL            x0006

 

.BLKW

 

.BLKW tells the assembler to set aside some number of sequential memory locations (i.e. a BlocK of Words) in the program  The actual number is the opearand of the .BLKW pseudo-op.  A label on the left of .BLKW binds a label to the memory location. <This is a variable to store a value> Ex:

            NUMBER            .BLKW        1

 

.STRINGZ

 

.STRINGZ tells the assembler to initialize a sequence of n + 1 memory locations.  The argument is a sequence of n characters, inside double quotation marks.  The first n words of memory are initialized with the zer-extended ASCII codes of the corresponding characters in the string.  The final word of memory is initialized to 0.  The last character, x0000, provides a convenient sentinel for processing the string of ASCII codes.  Ex:

                        .ORIG            x3010

            HI            .STRINGZ    “Hey!”

 

Would store the following values in the indicated locations:

 

x3010:                  x0048              ; the letter H

x3011:                  x0065              ; e

x3012:                  x0079              ; y

x3013:                  x0021              ; !

x3014                  x0000              ; sentinel value

 

.END

 

.END tells the assembler where the program ends.  Any characters that come after .END will not be used by the assembler.  Note: .END does not stop the program during execution.  In fact, .END does not even exist at the time of execution.  It is simply a delimiter – it marks the end of the source program.  Ex:

                        .END