|
II. Programming exercises: Due by noon on Friday, September 29, 2006.
Consider the following assembly language program to process the entries in a table of 3 byte
integers, adding up the absolute values and then calculating the average.
- Replace the RESW statement used to define
TABLE ("TABLE RESW 100")
with at least 10 "hard-coded" WORD statements,
half positive and half negative, using integers generated by the program
rand-ints in the class directory
/usr/public/cop3601/cwinton/sicstuff.
Also replace the line
COUNT RESW 1
with a "hard-coded" WORD statement giving the value of
"COUNT" that matches the number of
3-byte SIC integers that you have installed.
SUM START 3A0
FIRST STL RETADDR
LDX ZERO
LDA COUNT
COMP ZERO
JEQ DONE
MUL THREE
STA WCNT
LOOP LDA TABLE,X
COMP ZERO
JGT ADD
MUL MONE
ADD ADD TOTAL
STA TOTAL
TIX WCNT
TIX WCNT
TIX WCNT
JLT LOOP
DIV COUNT
STA AVRG
DONE LDL RETADDR
RSUB
ZERO WORD 0
ONE WORD 1
THREE WORD 3
MONE WORD -1 "hard coded"
COUNT RESW 1 [COUNT WORD 10]
WCNT RESW 1
TOTAL WORD 0
AVRG WORD 0
RETADDR RESW 1
TABLE RESW 100 [TABLE WORD -123]
END FIRST [ WORD 56]
[ WORD 410]
[ WORD -15]
etc.
[ END FIRST]
- Hand assemble the program for simple SIC, and install the object code in an object
file named <student-id>-2.A.obj
(don't forget that the object module format requires load point and starting address
information at the head of each module). Again, you may check your work using sicasm as used
in assignment 1.
- Execute your program on the SIC simulator
(sicsimrun <student-id>-2.A.obj).
The program is set up to run as a subroutine of another program (what tips you off to this?). Use break points to dump memory
at the beginning, at 3 or more intermediate points, and at the end
(just prior to executing the RSUB instruction), showing in
each case the running values in TOTAL. Move
your sic.log file to <student-id>-2.A.sic.log,
for use as an (edited) appendix included with your Part A documentation.
- Construct a source file named <student-id>-2.A.src
(to be used in part B of the assignment). In the source file add comments to the source code.
Explain in the comments why 3 successive TIX instructions
are employed (this should also be summarized in the Constructions Employed section of
your general documentation). The source file (possibly with supplemental annotations) is also
to be included as an appendix for Part A documentation.
- Construct your documentation for Part A. In general (as already implied above), computer
generated listings included as appendices may be edited (the "raw" file is submitted separately).
Just be sure to italicize any text that you add to the listing to distinguish it
from what the computer has produced and use the Courier
font for all computer generated text.
In editing your log file, notate that this is the run for simple SIC.
Add italicized comments and use the word processor's highlighting feature to highlight the
values of TOTAL where it occurs on dumps. Confirm in base 10 that
the value observed is correct.
For your general write-up, include with the Assessment
a listing of your data and base-10 values confirming correctness of results.
Assemble your (commented) source file <student-id>-2.A.src
for SIC/XE using the SIC/XE assembler (sicasm <student-id>-2.A.src ),
which produces two files
- <student-id>-2.A.src.obj (the object file)
- <student-id>-2.A.src.lst (the assembler report).
Consulting the assembler report,
- produce an appendix which shows side-by-side your simple SIC object code, the object code produced by the assembler, and your source code, using italics or highlighting to note the differences between the simple SIC code and the SIC/XE code.
- execute the SIC simulator using the (SIC/XE) object file produced by the assembler
(sicsimrun <student-id>-2.A.src.obj )
- verify that the execution generates the same results as in part A; i.e., break program execution as before
and observe the values of TOTAL .
- move sic.log to <student-id>-2.B.sic.log, to be
incorporated as an appendix for Part B.
For the appendix edit the log, notating this time that it is a SIC/XE run and again
highlighting TOTAL. Among your
annotations on the log, you must include (italicized) comments to identify equivalence
of outcomes to Part A, in each case pointing out the Part B match-up. Be sure to include a
statement regarding this verification in your Assessment for Part B.
Continue your Word documentation from part A with a new section for part B as specified on the assignments page. A common mistake is to forget that your documentation file is to have 2 distinct parts, a write-up for Part A and a write-up for Part B, each with its own executive summary and set of appendices.
Use the submit shell script (copy
from /usr/public/cop3601/cwinton) to "shar" your
- documentation (<student-id>-2.doc)
- source code file (<student-id>-2.A.src)
- object code file (<student-id>-2.A.obj)
- sicasm .lst file (<student-id>-2.A.src.lst)
- sicasm .obj file (<student-id>-2.A.src.obj).
- Part A log file (<student-id>-2.A.sic.log)
- Part B log file (<student-id>-2.B.sic.log)
and "turnin" by noon on Friday, September 29 to cnw.3601.2.
Late submissions can be submitted until the due date for the next assignment via submit
to cnw.3601.2L (late points
assessed as stipulated on the assignments page).
|