Section 18.2
Review Questions

How I/O actually works

  1. What are the three groups of wires that are usually needed to communicate between a CPU and a peripheral?
  1. If there are 8 data bits that get transmitted, 2 bits of status information and 2 bit commands, how many ports are needed?
  1. Which of the following commands would the CPU use to find out what state the tape reader is in? Circle one.
     START   HALT   REWIND   ALERT    QUERY   PAUSE
  1. Do any of the above commands transmit information?
  1. The tape reader example in this section uses two bits: DA = Data Accepted, and DR = Data Ready. What does Data Ready = 1 mean?
  1. Which wire does the CPU set to 1 when it is ready for the tape reader to move on to the next byte?
  1. Which bit value combination for DA/DR is not used?
  1. How does the tape reader ever stop?
  1. What does it mean to poll?
  1. Suppose port 0 is the status port, 1 is the control port, and 2 is the data port. Write an instruction which the CPU would issue to find out if there is any data to obtain.
  1. Continuing, write an instruction which the CPU would issue to tell the tape reader to begin reading.
  1. Continuing, write an instruction which the CPU would issue to obtain a byte of data.
  1. What register is implictly used with every IN and OUT instruction?
  1. In the polling program below, which instructions actually get a data byte and save it in main memory?
                    LDI  "10b"     ;send GO command to the tape reader
                    OUT  1
          CHECKCTL: IN   0         ;read data ready bit from control port
                    SUB  "01"b     ;compare to 01b
                    JNZ  CHECKCTL  ;if not equal jump up to top of loop
                    IN   2         ;read data byte on port 2
                    STD  X         ;store into main memory somewhere
                    LDI  "11"b     ;get ready to write 1 into data accepted
                    OUT  0         ;write to status port
                    JMP  CHECKCTL  ;do it all over again