Although some terminals support idiosyncratic escape sesequence sets it is

Although some terminals support idiosyncratic escape

This preview shows page 15 - 17 out of 140 pages.

Although some terminals support idiosyncratic escape sesequence sets, it is advantageous to have a standard to facilitate adapting software from one system to another. The American National Standards Institute (ANSI) has defined a set of standard escape sequences, and MINIX 3 supports a subset of the ANSI sequences, shown in Fig. 3-32, that is adequate for many common operations. When the driver sees the character that starts the escape sequences, it sets a flag and waits until the rest of the escape sequence comes in. When everything has arrived, the driver must carry it out in software. Inserting and deleting text require moving blocks of characters around the video RAM. The hardware is of no help with anything except scrolling and displaying the cursor. [Page 316] Figure 3-32. The ANSI escape sequences accepted by the terminal driver on output. ESC denotes the ASCII escape character (0x1B), and n, m, and s are optional numeric parameters. Escape sequence Meaning ESC [ n A Move up n lines ESC [ n B Move down n lines ESC [ n C Move right n spaces ESC [ n D Move left n spaces ESC [ m; n H Move cursor to (y = m, x = n) ESC [ s J Clear screen from cursor (0 to end, 1 from start, 2 all) ESC [ s K Clear line from cursor (0 to end, 1 from start, 2 all) ESC [ n L Insert n lines at cursor ESC [ n M Delete n lines at cursor ESC [ n P Delete n chars at cursor ESC [ n @ Insert n chars at cursor ESC [ n m Enable rendition n (0=normal, 4=bold, 5=blinking, 7=reverse) ESC M Scroll the screen backward if the cursor is on the top line 3.8.3. Overview of the Terminal Driver in MINIX 3
Image of page 15
The terminal driver is contained in four C files (six if RS-232 and pseudo terminal support are enabled) and together they far and away constitute the largest driver in MINIX 3. The size of the terminal driver is partly explained by the observation that the driver handles both the keyboard and the display, each of which is a complicated device in its own right, as well as two other optional types of terminals. Still, it comes as a surprise to most people to learn that terminal I/O requires thirty times as much code as the scheduler. (This feeling is reinforced by looking at the numerous books on operating systems that devote thirty times as much space to scheduling as to all I/O combined.) The terminal driver accepts more than a dozen message types. The most important are: 1. Read from the terminal (from FS on behalf of a user process). 2. Write to the terminal (from FS on behalf of a user process). 3. Set terminal parameters for ioctl (from FS on behalf of a user process). 4. A keyboard interrupt has occurred (key pressed or released). 5. Cancel previous request (from FS when a signal occurs). 6. Open a device. 7. Close a device. [Page 317] Other message types are used for special purposes such as generating diagnostic displays when function keys are pressed or triggering panic dumps.
Image of page 16
Image of page 17

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