Assignment 2, due Sep 5

Part of the homework for CS:2630, Fall 2019
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper in discussion section on Thursday. Some parts of assignments may be submitted on-line and completed in discussion section. Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!

  1. An exercise in signed number systems: For each of the following 8-bit quantities, show its interpretation as (i) a 2's complement number, (ii) a biased number with the default bias for 8-bit values, and (iii) a signed magnitude number. Note that in some of these number systems, for some of these bit patterns, the answer is positive. (0.2 points each, -0.1 point per error)

    a) 01011101
    b) 11100010
    c) 01101010
    d) 11110011
    e) 01111011

  2. A simple question: Are the machines you access through fastx highbyters or lowbyters? (see exercise b in Chapter 3 of the notes.) (1.0 point)

  3. Background: Here are some declarations in C:
    const void * const a = NULL;
    const void * const b = &a;
    const void * const c = &b;
    

    Note that const void * x declares x to be a pointer to a constant value, while void * const x declares x to be a constant-valued pointer to a variable. The above three declarations declare constant-valued pointers to constant values. That is to say, the pointers can be stored in read-only memory and the values to which they point might as well be in read-only memory as well. The fact that these are void pointers suppresses lots of type checking but plays little role in this assignment.

    Note that, by default, everything you assemble with the SMAL assembler gets put in read-only memory.

    A problem: Write SMAL code equivalent to the above. Note, it can be written in 3 lines of code and it would be foolish to expand it beyond 6 lines (what you get by putting labels on separate lines from the word they label). (1.0 points)