Description
Purpose: Become familiar with data conversion, addressing modes, and assembly language macro’s.
Points: 100
Background:
The Septenary1
numbering system (also known as base-7) is a positional notation numeral system using
seven as its base. The number seventeen (that is, the number written as “17” in the base ten numeriing
system) is instead written as “23” in base seven or Septenary notation (meaning “2 sets of 7 and 3 units”,
instead of “1 set of ten and 7 units”).
base-10 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …
base-7 1 2 3 4 5 6 10 11 12 13 14 15 16 20 21 …
Assignment
Write an assembly language program to convert
ASCII/septenary string to integers and to convert
integers to ASCII/septenary strings. The main will
display the strings to the screen. Using the provided
template, the program has a series steps as follows:
1. Write the code to convert a string of ASCII
digits representing a septenary value into an
integer (double-word sized). This code should
be placed in the provided main at the marked
location (step #1) and will convert the string
aSeptLength (septenary representation) into an
integer stored in the variable length. This
should not be a macro.
2. Convert the code from step #1 into a macro, aSept2int, which is called multiple times in the next
part of the provided template. The empty macro shell is at the top of the provided template at the
marked location (step #2). Once the string is converted to an integer, the circle diameter area can
be calculated and the diamsArray[] array populated. The formula for calculating the diameter
of a circle is:
diamsArray [i] = raduis[i ] × 2
3. Add the code to compute the cube statistics; sum, average, minimum, and maximum. This will
read the diamsArray[] array (when populated). This code is similar to the previous assignment.
Note, you will not be able to test this code until step #2 is completed.
4. Write the code to convert an integer into a string of ASCII digits representing the septenary value
(NULL terminated) This code should be placed in the provided main at the marked location
(step #4) and will convert the integer stored in the variable diamSum into a string
diamSumString (ASCII/septenary representation). This should not be a macro.
1 For more information regarding base-7 representation, refer to: http://en.wikipedia.org/wiki/Septenary
5. Convert the code from step #4 into a macro, int2aSept, which is called multiple times in the next
part of the provided template. The empty macro shell is at the top of the provided template at the
marked location (step #5).
The codeGrade is configured to test each step, 1-5, individually. As such, it is possible to upload and
test the code after each step.
The provided main will also invoke a print macro, which will display the strings to the screen. The print
macro does not perform any error checking, so the data must be correct in order for the display to work.
Note, since the program displays the results to the screen, typing the program name (without the
debugger), will display the results to the screen.
You may assume valid/correct data. As such, no error checking is required. You may add additional
variables as needed.
Debugging
Since macro’s can be difficult to debug. To address this, the code for step 1 should be working before
attempting step 2.
The code for a macro will not be displayed in the source window. In order to see the macro code,
display the machine code window (View → Machine Code Window). In the window, the machine
code for the instructions are displayed. The step and next instructions will execute the entire macro. In
order to execute the macro instructions, the stepi and nexti commands must be used (which are only
used for macro’s).
To help check results, an on-line base conversion is available at the following URL:
http://www.cleavebooks.co.uk/scol/calnumba.htm.
Debugger Commands:
Below is an example of some of the commands to display a few of the variables within DDD.
x/dw &length
x/34dw &diamsArray
Note, in DDD, select View → Execution Window to display a window that shows the output.
Example Output:
Below is an example output of the program.
ed-vm%
ed-vm% ./ast06
—————————————————–
CS 218 – Assignment #6
Diameter Calculations
Diameters:
+13 +20 +35 +51
+103 +125 +143 +156
+215 +316 +321 +343
-5414 -3520 -3052 +565
+660 +1142 +1304 +1335
+1614 +2352 +2303 +2525
-2235 -2000 -305 +3410
+3632 +4332 +4352 +20156
-23012 +24451
Diameters Sum: +45463
Diameters Ave: +664
Diameters Min: -23012
Diameters Max: +24451
ed-vm%
ed-vm%
Submission:
• All source files must assemble and execute on Ubuntu with yasm.
• Submit source files
◦ Submit a copy of the program source file via the on-line submission
• Once you submit, the system will score the project and provide feedback.
◦ If you do not get full score, you can (and should) correct and resubmit.
◦ You can re-submit an unlimited number of times before the due date/time.
• Late submissions will be accepted for a period of 24 hours after the due date/time for any given
assignment. Late submissions will be subject to a ~2% reduction in points per an hour late. If
you submit 1 minute – 1 hour late -2%, 1-2 hours late -4%, … , 23-24 hours late -50%. This
means after 24 hours late submissions will receive an automatic 0.
Program Header Block
All source files must include your name, section number, assignment, NSHE number, and program
description. The required format is as follows:
; Name:
; NSHE ID:
; Section:
; Description:
Failure to include your name in this format will result in a loss of up to 3%.
Scoring Rubric
Scoring will include functionality, code quality, and documentation. Below is a summary of the scoring
rubric for this assignment.
Criteria Weight Summary
Assemble – Failure to assemble will result in a score
of 0.
Program Header 3% Must include header block in the
required format (see above).
General Comments 7% Must include an appropriate level of
program documentation.
Note, must include comments for the
conversion algorithm being used.
Omitting these comments will zero the
comments score.
Program Functionality
(and on-time)
90% Program must meet the functional
requirements as outlined in the
assignment. Must be submitted on time
for full score.




