This is an array of 16 bit words Alternate bytes are filled in with the current

This is an array of 16 bit words alternate bytes are

This preview shows page 24 - 26 out of 140 pages.

transferred to another buffer, ramqueue. This is an array of 16-bit words. Alternate bytes
Image of page 24
are filled in with the current value of the screen attribute byte, which determines foreground and background colors and other attributes. When possible, characters are transferred directly into ramqueue, but certain characters, such as control characters or characters that are parts of escape sequences, need special handling. Special handling is also required when a character's screen position would exceed the width of the screen, or when ramqueue becomes full. In these cases out_char (line 16119) is called to transfer the characters and take whatever additional action is called for. For instance, scroll_screen (line 16205) is called when a linefeed character is received while addressing the last line of the screen, and parse_escape handles characters during an escape sequence. Usually out_char calls flush (line 16259) which copies the contents of ramqueue to the video display memory, using the assembly language routine mem_vid_copy. Flush is also called after the last character is transferred into ramqueue to be sure all output is displayed. The final result of flush is to command the 6845 video controller chip to display the cursor in the correct position. [Page 325] Logically, the bytes fetched from the user process could be written into the video RAM one per loop iteration. However, accumulating the characters in ramqueue and then copying the block with a call to mem_vid_copy are more efficient in the protected memory environment of Pentium-class processors. Interestingly, this technique was introduced in early versions of MINIX 3 that ran on older processors without protected memory. The precursor of mem_vid_copy dealt with a timing problemwith older video displays the copy into the video memory had to be done when the screen was blanked during vertical retrace of the CRT beam to avoid generating visual garbage all over the screen. MINIX 3 no longer provides this support for obsolete equipment as the performance penalty is too great. However, the modern version of MINIX 3 benefits in other ways from copying ramqueue as a block. The video RAM available to a console is delimited in the console structure by the fields c_start and c_limit. The current cursor position is stored in the c_column and c_row fields. The coordinate (0, 0) is in the upper left corner of the screen, which is where the hardware starts to fill the screen. Each video scan begins at the address given by c_org and continues for 80x 25 characters (4000 bytes). In other words, the 6845 chip pulls the word at offset c_org from the video RAM and displays the character byte in the upper left-hand corner, using the attribute byte to control color, blinking, and so forth. Then it fetches the next word and displays the character at (1, 0). This process continues until it gets to (79, 0), at which time it begins the second line on the screen, at coordinate (0, 1).
Image of page 25
Image of page 26

You've reached the end of your free preview.

Want to read all 140 pages?

  • One '20

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