Homework 9

22C:18, Fall 1996

Due Tuesday Nov. 12, 1996 in discussion

Douglas W. Jones
Look at the calculator code given in Lecture 25 (Monday Nov 4) to answer the first two problems below:
  1. Rewrite the assembly language version of the case statement (the code starting at the label NONNULL up to and including the jump table JUMPTAB) so that it uses bounds checking to minimize the size of the jump table. Thus, the jump table should begin with the entry for space and end with the entry for lower case p.

  2. Rewrite the code for the E command (the code starting at the label ENTER) so that it checks for stack overflow. You will have to refer to the notes on memory layout for the linker in order to find the symbolic name for the end of the stack.

  3. Rewrite the code for KBGETS in the monitor so that it accepts, as a second parameter, the maximum allowed length for an input string from the terminal, so that it ignores (does not echo and does not enter into the buffer) characters that cannot be stored, and also fix it so that it ignores backspace characters that attempt to delete characters before the start of the buffer.