In addition to calls to conswrite from handleevents characters to be displayed

In addition to calls to conswrite from handleevents

This preview shows page 60 - 62 out of 140 pages.

In addition to calls to cons_write from handle_events, characters to be displayed are also sent to the console by echo and rawecho in the hardware independent part of the terminal driver. If the console is the current output device, calls via the tp->tty_echo pointer are directed to the next function, cons_echo (line 16105). Cons_echo does all of its work by calling out_char and then flush. Input from the keyboard arrives character by character and the person doing the typing wants to see the echo with no perceptible delay, so putting characters into the output queue would be unsatisfactory. Out_char (line 16119). does a test to see if an escape sequence is in progress, calling parse_escape and then returning immediately if so (lines 16124 to 16126). Otherwise, a switch is entered to check for special cases: null, backspace, the bell character, and so on. The handling of most of these is easy to follow. The linefeed and the tab are the most complicated, since they involve complicated changes to the position of the cursor on the screen and may require scrolling as well. The last test is for the ESC code. If it is found, the cons->c_esc_state flag is set (line 16181), and future calls to out_char are diverted to parse_escape until the sequence is complete. At the end, the default is taken for printable
Image of page 60
characters. If the screen width has been exceeded, the screen may need to be scrolled, and flush is called. Before a character is placed in the output queue a test is made to see that the queue is not full, and flush is called if it is. Putting a character into the queue requires the same bookkeeping we saw earlier in cons_write. [Page 360] The next function is scroll_screen (line 16205). Scroll_screen handles both scrolling up, the normal situation that must be dealt with whenever the bottom line on the screen is full, and scrolling down, which occurs when cursor positioning commands attempt to move the cursor beyond the top line of the screen. For each direction of scroll there are three possible methods. These are required to support different kinds of video cards. We will look at the scrolling up case. To begin, chars is assigned the size of the screen minus one line. Softscrolling is accomplished by a single call to vid_vid_copy to move chars characters lower in memory, the size of the move being the number of characters in a line. Vid_vid_copy can wrap, that is, if asked to move a block of memory that overflows the upper end of the block assigned to the video display, it fetches the overflow portion from the low end of the memory block and moves it to an address higher than the part that is moved lower, treating the entire block as a circular array. The simplicity of the call hides a fairly slow operation, even though vid_vid_copy is an assembly language routine (defined in drivers/tty/vidcopy.s, not listed in Appendix B). This call requires the CPU to move 3840 bytes, which is a large job even in assembly language.
Image of page 61
Image of page 62

You've reached the end of your free preview.

Want to read all 140 pages?

  • One '20
  • ASCII

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors