Homework 1

22C:18, Fall 1996

Due Friday June. 13, 1997, in class

Douglas W. Jones

This assignment begins with 2 review questions that are not as much specific to the material in this course as they are to material you should have learned in prior courses or work experience. The final 3 questions focus on material central to success in the remainder of this course! This assignment is worth 3 points!

  1. Part A: Write, in legal Pascal, C or C++, the declarations necessary to create a doubly linked list data structure where each node contains a single character called ch. Don't worry about any operations on this structure, just the declaration of the structure itself!

    Part B: Write, in legal Pascal, C or C++, the declarations of a function that will search the list described above; the function should take, as parameters, a character and a pointer to a doubly linked list, and it should return a pointer to the node in the list that contains that character, or a null pointer in the case that the character is not found in the list.

  2. Write, in legal Pascal, C or C++, function that takes, as parameters, a number base (an integer from 0 to 35) and the textual representation of a positive integer written in that base (a blank or null terminated character string) and returns that number as an integer. Obviously, the set of digits must be extended beyond the normal 0 to 9 to handle this! Use upper case letters as extended digits, so that the digit A has the value 10, the digit B has the value 11, etc.

    Don't treat this as a machine problem; you may test your code, but a handwritten submission is good enough, so long as you are confident of its function.

  3. Convert the following numbers to base 10:

    556 5556 558 5558 D00B16 1ED016 IOWA34

  4. Convert the numbers 10, 100 and 1000 from base 10 to bases 6, 8 and 16.

  5. Convert the following string to ASCII, and show how it would be stored in consecutive words of memory by a Hawk system, starting at address #1000. Your answer should show the contents of each word of memory in hexadecimal.
    	The string is this!
    
    Note that if you just use the ASCII assembly directive, the assembly listing does not give you the contents of each word in hex, it gives you the contents of consecutive bytes in hex, and while the relation between bytes and words is trivial, this assignment asks for words and not consecutive bytes!

  6. The Computer Control Corporation DDP-516 was one of the first minicomputers sold in the 1960's. This machine had word addressing only (no byte addresses!), a 16 bit word, and a 14 bit memory address. The character set used for textual I/O on this machine was 8 bit ASCII.

    Part A: What is the maximum memory you can attach to this machine, in words?

    Part B: How many characters of text could you store in the memory of this machine? (for this part, ignore the problem of where the program would have to be stored if you actually filled the memory with text.)

  7. On a Hawk machine, the 32 bit memory location 1016 contains the value 7654321016. Give, in hex, the contents of each 8 bit byte at locations 1016, 1116, 1216 and 1316.