Assignment 11, due Jul 19
Part of
the homework for CS:2630, Summer 2018

On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (Tuesday or Thursday). 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!
Q = x nor Q
Q = y nor Q
a) Draw this logic circuit. Neatness counts! (0.5 points)
b) For all possible values of x and y, show all possible values of Q and Q. Arrange this as a truth table, but note that some row or rows will have more than one value for each output. (0.5 points)
x  y  Q  
0  0  0  1 
1  0  
0  1  1  0 
1  0  0  1 
1  1  0  0 
c) Using the truth table you worked out above, which combinarion of x and y should be used to make this flipflop hold a value? (0.2 points)
Set x and y to zero.
d) How do you make this flipflop hold Q = 1? Your instructions should assume that x and y are initially as specified in part c and that they return to that condition at the end. (0.3 points)
Given that x and y are initially zero, set y to 1 and then back to zero.
CR, by rights, ought to return the display pointer dspptr (the X coordinate) to the first byte on the current line, without changing the Y coordinate, and LF ought to move the display pointer down one line without changing the X coordinate.
a) Give Clike pseudocode for getat() a routine you could add to the Hawk monitor that returns, in R3 and R3, the current X and Y coordinates. Feel free to write things like return (x,y) to indicate the return of two different integers. You can compute X and Y from dispptr. (0.5 points)
(int,int) getat() { int xy = origin  dspptr; int col = xy % (* pcolumns); int line = xy / (* pcolumns); return (col, line) }
b) Give Clike pseudocode for a modified version of putchar(ch) that outputs the character if it was not a CR or LF, and that properly interprets CR and LF. Feel free to use x,y=getat() and setat(x,y) in your code. (1.0 points)
void putchar( char ch ) { if (ch == CR) { (col, line) = getat() col = 0; putat( col, line ) } else if (ch == LF) { (col, line) = getat() line = line + 1; putat( col, line ) } else { * dspptr = ch; dspptr = dspptr + 1; } }