10/23/2006
A student writes:
Dr. Patt,
During TA session on friday, we went over the .Stringz pseudo-op.
I am writing my program, and i am wondering if we are required to
incorporate this opcode into our program? Or another way of asking,
is it absolutely necessary to have the .stringz in our program,
or can we write one that does not use this pseudo-op?
<<name withheld to protect the student who is afraid of .STRINGZ>>
Actually, I strongly prefer that you NOT use .STRINGZ in this programming
assignment. You could use it, and it is a short cut that will work in this
assignment. However, I believe it is a bad short cut, and one that is
counterproductive. Exactly why it is counterproductive, we can deal with
later.
For now, I want you to understand that .STRINGZ is a useful pseudo-op for
putting a string of ascii codes into the object file of the program that can
be used to display a banner on the screen. It is part of the program.
We are not asking you to display banners on the screen in this assignment.
That will come later.
Rather, we are asking you to sort (that is, arrange in order) a set of data
elements, where the elements are ascii codes of individual characters. This
is part of the DATA, not part of the program. This program has to be able
to work on any characters that happen to be in x30F0 to x30FF. In fact,
in general, you will not know what is in x30F0 to x30FF when you write the
program. Certainly you are going to want to test your program on some
sample data. The simplest way to provide that input data is by inserting
ascii codes into x30F0 to x30FF using the Simulator.
Alternatively, if you don't want to type in those values every time you use
the Simulator, you could construct a file of ascii codes in assembly language,
as follows, and then load it into memory using the Simulator as your TA showed
you. For example:
.ORIG x30F0
.FILL x0032
.FILL x0033
.FILL x0045
.END
will be assembled into an object file of three ascii codes (2, 3, E) that
will be stored in memory locations x30F0, x30F1, and x30F2.
Got it?
Yale Patt