Assignments for CS149-01 Winter 2006
Reading assignments are not listed below. Students should keep slightly ahead of the in-class content when reading the text. Watch out for in-class modification of assignments and due dates. This page often is "behind the times"
Homework One - hexadecimal conversion/arithmetic worksheet.
Homework Two - two's complement representation worksheet.
Homework Three - IEEE 64-bit floating point representation worksheet.
Project One - Hello World program.
- Modify the EAT.ASM program from the book to print a different message.
- Purpose - to verify that the students DOS machine are properly set up for nasm and nasmide.
- Input - None.
- Output - a message is displayed in the DOS window.
- New Concepts Covered - hexadecimal representation, addressing, DOS interrupts, Pentium architecture: operations, operands, and register set, and basic program structure for DOS COM files.
Project Two - Hexidecimal dump of EAX.
- Convert the current value of EAX to an hexadecimal string and display it in the DOS window.
- Purpose - to explore the difficulty of I/O in Assembly Language..
- Input - None.
- Output - (1) a greeting and (2) a labeled hexadecimal number showing the current value of EAX are displayed in the DOS window.
- New Concepts Covered - hexadecimal representation, counted loops, indexed addressing, ASCII characters, pentium division.
Project Three - Body Mass Index.
- Given a person's weight(lbs) and height(ins) compute: BMI = 72*wgt/(hgt^2).
- Purpose - to demonstrate decimal integer input/output and integer arithmetic.
- Input - positive integers for the user's weight in pounds and height in inches. (You may use the getNum and EAXtoDecimal procedures developed in class)
- Output - a message giving the user's BMI is displayed in the DOS window.
- Concepts Covered - integer input, integer output, integer arithmetic, simple procedures.
Project Four - Gregorian Epact .
- Compute the Gregorian Epact, i.e., the age of the moon on Jan 1 for a given year. The formula is
C = Y/100; E = (8 + (C/4) - C + ((8*C + 13)/25) + 11*(Y%19))%30
- Purpose - to solidify student understanding of concepts introduced to date.
- Input - a year. (For best results the year should be within a millennium of current year.)
- Output - the Epact is displayed in the DOS window.
- Concepts Covered - a review of all concepts to date.
Project Five - Absolute Calendar Procedures. handout with python code and parameter conventions
- Develop a set of calendar procedures for converting standard dates (eg, 02/27/2006) to and from absolute dates (eg, 02/27/2006 is 732369 days since 1/1/1(Gregorian) inclusive)
- Purpose - to demonstrate the use of registers to pass parameters to (non-recursive) procedures.
- Input - the main program should be student designed and test all the procedures. Therefore input will vary. One possibility is to (1) request a day, month and year, verify that it is legal and then convert them to an absolute day number and then (2) request an absolute day number and convert it to normal
- Output - will vary but will demonstrate that the procedures work.
- Concepts Covered - parameter passing for non-recursive procedures, global variables, linking programs developed in separate files, basic program structure for DOS EXE files.
Project Six - Stupid Calendar Tricks. handout with descriptions of options
- To use the calendar procedures in the last project to do "interesting" calculations.
- Purpose - to verify that the students DOS machine are properly set up for nasm and nasmide.
- Input - will vary as user selects menu options and responds to prompts for input.
- Output - will vary as program displays results of selected computations.
- Concepts Covered - review of all concepts to date.
Project Seven - Recursion.
- (1) Compute 1+2+3 ... + n recursively, OR (2) compute the Nth Fibonacci number recursively, or (3) recursively compute the number of binary search trees having N nodes.
- Purpose - to introduce the run-time-stack, call frames and use of stack for parameter passing and local variables.
- Input - A positive integer N.
- Output - resulting numeric answer is displayed in the DOS window [stdout].
- Concepts Covered - run-time stack, call frames.
Project Eight - linux Hello World program.
- Modify the EAT.ASM program from the book to print a different message.
- Purpose - to verify that the students linux machine are properly set up for nasm and gcc.
- Input - None.
- Output - a message is displayed.
- New Concepts Covered - linux tools eg., emacs, linking to the C library, basic program structure under linux.
Project Nine - Celsius to Fahrenheit.
- Convert a Celsius Temperature to Fahrenheit. F = 9 * C / 5 + 32 using integer arithmetic.
- Purpose - to use scanf and printf for decimal input and output.
- Input - a Celsius temperature (integer).
- Output - the equivalent Fahrenheit temperature.
- New Concepts Covered - scanf, printf, linking to the C library, basic program structure under linux.
Project Ten - Cost per square inch for pizza.
- Compute the cost of a square inch of pizza. For a circle: area = π*radius^2.
- Purpose - to use floating point arithmetic.
- Input - the diameter and cost of a pizza.
- Output - the cost per square inch for the pizza.
- New Concepts covered - IEEE 64-bit floating point representation, floating point arithmetic, the architecture of the FPU: registers and operations.
Projet Eleven - Newton's method.
- Find the real roots of x^3-3x^2+1 using Newton's method. note: The one we want lies between 0.0 and 1.0.
- Purpose - to introduce the Pentium floating point unit (FPU) and floating point arithmetic.
- Input (optional) a starting value, an error tolerance, and a maximum number of iterations.
- Output - a value for the real root of P(x) to the desired tolerance, starting at the given x-value.
- New Concepts Covered - IEEE 64-bit floating point representation, floating point arithmetic, the architecture of the FPU: registers and operations, Newton's method.
Project Twelve - Sorting.
- Read a file of integers into an array and sort them. Insertion or Selection sort is sufficient. Students may choose any in-place "better" sort if they wish for bonus credit.
- Purpose - to introduce one dimensional arrays and indexing concepts.
- Input a count, N, followed by N-many integers. Input from keyboard (for small values of N or from a file redirected to standard input.
- Output - indication that the array is sorted.
- New Concepts Covered - input/output through redirection of standard input and output. One-dimensional arrays and indexed/indirect addressing.