• Navigation überspringen
  • Zur Navigation
  • Zum Seitenende
Organisationsmenü öffnen Organisationsmenü schließen
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
  • FAUZur zentralen FAU Website
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Suche öffnen
  • English
  • Campo
  • StudOn
  • FAUdir
  • Stellenangebote
  • Lageplan
  • Hilfe im Notfall
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
Menu Menu schließen
  • Lehrstuhl
    • Team
    • Aktuelles
    • Kontakt und Anfahrt
    • Leitbild
    • 50-jähriges Jubiläum
    Portal Lehrstuhl
  • Forschung
    • Forschungsbereiche
      • Betriebssysteme
      • Confidential Computing
      • Eingebettete Systemsoftware
      • Verteilte Systeme
    • Projekte
      • AIMBOS
      • BALu
      • BFT2Chain
      • DOSS
      • Mirador
      • NEON
      • PAVE
      • ResPECT
      • Watwa
    • Projektkampagnen
      • maRE
    • Seminar
      • Systemsoftware
    Portal Forschung
  • Publikationen
  • Lehre
    • Sommersemester 2025
      • Applied Software Architecture
      • Ausgewählte Kapitel der Systemsoftware
      • Betriebssystemtechnik
      • Projekt angewandte Systemsoftwaretechnik
      • System-Level Programming
      • Systemnahe Programmierung in C
      • Systemprogrammierung 1
      • Verteilte Systeme
    • Wintersemester 2024/25
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Systemprogrammierung 2
      • Verlässliche Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Extern

Extern

Bereichsnavigation: Lehre
  • Betriebssysteme
    • Vorlesung
      • Folien
    • Übung
      • Seminar
      • Aufgaben
      • Aufgabe 0: C++ Streams
        • Aufgabe 1: Ein-/Ausgabe
          • Aufgabe 2: Unterbrechungen
            • Aufgabe 3: Pro-/Epilog
              • Aufgabe 4: Kontextwechsel
                • Aufgabe 5: Zeitscheiben
                  • Aufgabe 6: Synchronisation
                    • Aufgabe 7: Anwendung
                      • Assembler Crashkurs
                        • C++ Crashkurs
                          • Entwicklungsumgebung
                            • FAQ
                              • Ruhmeshalle
                              • Evaluation

                              Aufgabe 1: Ein-/Ausgabe

                              Output in Text Mode

                              Video-RAM

                              Each PC graphics card has its own memory area, the video RAM (VRAM), with which the screen content can be programmed. In graphics mode, one or more bits in the Video RAM must be set or deleted for each pixel, depending on the number of possible colors. In text mode, however, it is sufficient to transfer the ASCII code of the desired character together with its display attributes into the Video-RAM. The conversion of the ASCII code into a pixel matrix is then performed autonomously by the graphics card.

                              In the first assignments of StuBS, all output should be done in CGA text mode. This mode is supported by almost all graphics cards, is easy to program and completely sufficient for our operating system.

                              In CGA text mode, each screen position occupies two bytes in the video RAM. The first of the two bytes (even offset address) takes the ASCII code of the character to be displayed, the second (odd offset address) takes the desired foreground and background color. The mapping of the screen positions to the entries in the Video RAM is done by rows and columns. At a resolution of 80 characters per line and 25 lines, the character in the upper left corner occupies bytes 0 and 1, the character to the right occupies bytes 2 and 3 and the character at the end of the first line occupies bytes 158 and 159. Counting continues with the first character of the second line.

                              The Video RAM is mapped into the main memory of the PC and can therefore easily be written using normal memory accesses. The Video RAM starts at address 0xb8000 (= Offset 0).

                              Attributes

                              For each character, foreground color, background color and character blinking can be set individually using a byte whose bits have the following meaning:

                              Bit 7Bits 4-6Bits 0-3
                              blinkingbackgroundforeground

                              In CGA text mode the following 16 colors are available:

                              Fore- and background Foreground only
                              0

                              black

                              8 (dark) grey
                              1

                              blue

                              9 light blue
                              2

                              green

                              10 light green
                              3

                              cyan

                              11 light cyan
                              4

                              red

                              12 light red
                              5

                              magenta

                              13 light magenta
                              6

                              brown

                              14

                              yellow

                              7

                              light grey

                              15 white

                              Since only three bits are available for the background color in the attribute byte, only the first eight colors can be used for the background.

                              Controlling the Hardware Cursor

                              To be able to retrieve or set the current cursor position, the video controller of the graphics card must be programmed. The video controller of the CGA card provides a total of 18 control registers (with 8-bit word length:

                              Index Register
                              0 Horizontal Total
                              1 Horizontal Displayed
                              2 Horizontal Sync Position
                              3 Horizontal Sync Width
                              4 Vertical Total
                              5 Vertical Total Adjust
                              6 Vertical Displayed
                              7 Vertical Sync Position
                              8 Interlace Mode
                              9 Maximum Scan Line Address
                              10 Cursor Start
                              11 Cursor End
                              12 Start Address (High Byte)
                              13 Start Address (Low Byte)
                              14 Cursor Address (High Byte)
                              15 Cursor Address (Low Byte)
                              16 Light Pen (High Byte)
                              17 Light Pen (Low Byte)

                              Only control registers 14 and 15 are required to control the cursor in StuBS.

                              However, unlike the Video RAM, these registers cannot be addressed directly – indirect access is possible via an index and a data register using I/O Ports (using the in and out instructions). For this purpose, the number of the control register to be accessed is first written into the index register. The actual access to the contents of the desired control register (read/write) is then performed via the data register.

                              I/O Port Register Access type
                              0x3d4 index register write only
                              0x3d5 data register read and write
                              Friedrich-Alexander-Universität
                              Erlangen-Nürnberg

                              Schlossplatz 4
                              91054 Erlangen
                              • Impressum
                              • Datenschutz
                              • Barrierefreiheit
                              • Facebook
                              • RSS Feed
                              • Xing
                              Nach oben