0% found this document useful (0 votes)
18 views26 pages

Assembly - Chapter - 12 - Updated

Uploaded by

70148553
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views26 pages

Assembly - Chapter - 12 - Updated

Uploaded by

70148553
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Chapter

no.12

Text Display and


Keyboard
Programming
Engr. Fiaz
Khan
Engr. Muhammad Fiaz 1
How a Computer Monitor Works:
•Functioning of Electron Gun:
•A monitor works like a TV, using an electron gun to shoot a stream of
electrons onto a phosphor screen to create bright spots.
•Line Generation:
•Lines are made by moving the beam across the screen.
•The beam turns on and off to create dots.
•Raster Creation:
•The beam starts at the top-left corner, moves to the right, turns off, and
resets to the next line.
•This repeats until the entire screen is scanned, and the process starts
over

Engr. Muhammad Fiaz 2


How a Computer Monitor Works
- Continue
•Monochrome Monitors:
•Use one electron beam and show one color (amber or green).
•Brightness varies to create a gray scale.
•Color Monitors:
•The screen has three phosphors for red, green, and blue.
•Three electron beams create colored dots by varying intensity.
•Close placement of colored dots makes the human eye see a single
color.

Engr. Muhammad Fiaz 3


Video Adapters and Display
Mode
•Role of Video Adapter:
•The monitor display is managed by a video adapter, a circuit in
the computer (often an add-in card).
•Main Components of Video Adapter:
•Display Memory (Video Buffer): Stores the data to be shown on
the monitor and can be accessed by both the CPU and video
controller.
•Video Controller: Reads data from the display memory and
creates video signals for the monitor.

Engr. Muhammad Fiaz 4


Video Adapters and Display
Mode
•Memory Address:
•The display memory starts at address segment A000h or higher,
•depending on the adapter type.
•Video Signals for Color Display:
•For color monitors:
•Generates separate signals for red, green, and blue (RGB monitors).
•Or combines them into one composite signal (composite monitors).
•When the color burst signal is off, the monitor shows in black and white.

Engr. Muhammad Fiaz 5


Display Modes
•Types of Display:
•Monitors can show both text and picture images using different
techniques and memory setups.
•Display Modes:
•Text Mode:
•The screen is divided into columns and rows (usually 80 columns
by 25 rows).
•Each position displays a character.
•Graphics Mode:
•The screen is divided into columns and rows to display images or
graphics.
Engr. Muhammad Fiaz 6
Display Modes - Continue
• Video Adapters:
• MDA: Monochrome Display Adapter
• CGA: Color Graphics Adapter
• EGA: Enhanced Graphics Adapter
• MCGA: Multi-color Graphics Array
• VGA: Video Graphics Array

Engr. Muhammad Fiaz 7


Display Modes - Continue
•Pixels and Pictures:
•Each position on the screen is called a pixel.
•Pictures are displayed by defining the color of each pixel.
•Focus on Text Mode:
•This section focuses on text mode, while graphics mode is covered
separately.
•Character Generation in Text Mode:
•A character on the screen is made of a dot array called a character cell.
•The video adapter uses a character generator circuit to create these dot
patterns.

Engr. Muhammad Fiaz 8


Display Modes - Continue

• Resolution:
• Adapter Resolution: Determines the number of dots it can display.
• Monitor Resolution: Must be compatible with the video adapter to work
correctly.

Engr. Muhammad Fiaz 9


Kinds of Video Adapters
•Video Adapters Overview:
•Video adapters differ in resolution and the number of colors they can display.
•Early Adapters (IBM PC):
•MDA (Monochrome Display Adapter):
•Displays only text with high resolution (character cell: 9 x 14 dots).
•Designed for business software like word processors and spreadsheets.
•CGA (Color Graphics Adapter):
•Displays both text and graphics in color but has lower resolution
(character cell: 8 x 8 dots).

Engr. Muhammad Fiaz 10


Kinds of Video Adapters
•Enhanced Graphics Adapter (1984):
•EGA (Enhanced Graphics Adapter):
•Improved resolution and color graphics.
•Character cell: 8 x 14 dots.
•Advanced Adapters (1988):
•VGA (Video Graphics Array) and MCGA (Multi-color Graphics Array):
•Introduced with IBM PS/2 models.
•Higher resolution and more colors in graphics mode compared to EGA.
•Character cell: 8 x 19 dots.

Engr. Muhammad Fiaz 11


Mode Numbers:
1.Program Selection of Modes:
1. Programs can choose text or graphics modes based on the type of video adapter.
2. Each mode is identified by a unique mode number.
2.Mode Details:
1. Mode 0: 40 x 25 text with 16 colors (color burst off).
2. Mode 2: 40 x 25 text with 16 colors.
3. Mode 3: 80 x 25 text with 16 colors.
4. Mode 7: 80 x 25 text in monochrome.

Engr. Muhammad Fiaz 12


Mode Numbers - Continue

3. Adapter Compatibility:
1. Modes 0, 2, and 3 work with CGA, EGA, MCGA, VGA adapters.
2. Mode 7 works with MDA, EGA, VGA adapters.
4. Color Burst Note:
3. For composite monitors, the color burst signal is turned off in Modes 0 and 2.
4. RGB monitors display all 16 colors.

Engr. Muhammad Fiaz 13


Text Mode Programming
•Screen Layout in Text Mode:
•Default: 80 columns by 25 rows.
•Alternative: 40 columns by 25 rows (for color graphics
adapters).
•Screen Coordinates:
•Each position is identified by (column, row) coordinates.
•Example:
•Upper-left corner: (0,0).
•For an 80 x 25 display:
•Rows: 0 to 24.
•Columns: 0 to 79.

Engr. Muhammad Fiaz 14


Text Mode Programming -
Continue
•Character Representation:
•Each screen position is linked to a word in display memory:
•Low byte: ASCII code of the character.
•High byte: Attribute (color, blinking, underline, etc.).
•Attributes:
•Define how characters are displayed.
•All 256 byte combinations correspond to display characters (see Appendix A).

Engr. Muhammad Fiaz 15


Display Pages
•Display Memory:
•MDA: Can hold one screen of data.
•Graphics Adapters: Can store multiple screens of data due to larger memory size.
•Display Pages in Graphics Adapters:
•Graphics adapters divide their memory into display pages.
•Each page holds one screen of data, starting with Page 0.
•The number of pages depends on the adapter and selected mode.
•If multiple pages are available, the program can display one page while updating another.
•Page Sizes and Adapter Details:
•In 80 x 25 text mode, each display page is 4 KB.
•MDA: Has one page (Page 0), starting at memory address B000:0000h.
•CGA: Has four pages, starting at memory address B800:0000h.
•EGA and VGA: Can emulate either MDA or CGA in text mode.

Engr. Muhammad Fiaz 16


Display Pages - Continue

Table 12.3: Some 80 x 25 Screen Positions

Position Decimal Column Decimal Row Hex Column


Upper left corner 0 0 0
Lower left corner 0 24 0
Upper right corner 79 0 4F
Lower right corner 79 24 4F
Center of the screen 39 12 27

Engr. Muhammad Fiaz 17


Display Pages - Continue

Table 12.4: Number of Text Mode Display Pages

Maximum Number
Modes CGA EGA VGA
of Pages
0-1 1 8 8 8
2-3 1 8 8 8
7 1 8 8 8

Engr. Muhammad Fiaz 18


The Active Display Page
•The active display page is the page currently being shown on the screen.
•Memory Requirements:
•For 80 x 25 text mode, the memory needed is 2000 words or 4000 bytes.
•This is less than the full 4 KB (4096 bytes) available on the display page.
•Displaying on Screen:
•The video controller shows the first word from the active display page at the upper left corner
(column 0, row 0).
•The next word is shown in column 1, row 0, and so on.
•Row-by-Row Display:
•The active display page is shown row by row, making the screen look like a two-dimensional
array stored in row-major order.

Engr. Muhammad Fiaz 19


The Attribute Byte
1. Attribute Byte:
• The high byte of the word specifying a display character is called the attribute byte.
• It defines:
• Character color (foreground)
• Background color
• Character properties like blinking or underlined.
2. 16-Color Display (Modes O-3):
• The attribute byte in a 16-color text display follows a specific format.
• Bits 2: Define the foreground color of the character.
• Bits 4-6: Define the background color.
• Example: To display a red character on a blue background, the attribute byte would be 0001
0100 = 14h.

Engr. Muhammad Fiaz 20


The Attribute Byte
3. Creating Other Colors:
• By combining red, green, and blue, other colors can be created.
• For example, magenta is the sum of red and blue.
4. Intensity and Blinking:
• If bit 3 (intensity) is 1, the character color becomes lighter.
• If bit 7 (blinking) is 1, the character will blink.
5. Table of Colors:
• 16 colors are available, and all can be used for the character's foreground color, but the
background can only use basic colors.

Engr. Muhammad Fiaz 21


The Attribute Byte

Engr. Muhammad Fiaz 22


Monochrome Display
•In a monochrome display, the possible colors are white and black.
• For white, all the RGB bits are 1.
• For black, all the RGB bits are 0.
•Normal Video:
• Normal video displays a white character on a black background.
• The attribute byte for this is 0000 0111 = 7h.
•Reverse Video:
• Reverse video shows a black character on a white background.
• The attribute byte for this is 0111 0000 = 30h.

Engr. Muhammad Fiaz 23


Table: Sixteen-Color Text Display
Color Type Binary Code Color
Basic Colors 0000 Black
0001 Blue
0010 Green
0011 Cyan
0100 Red
0101 Magenta
0110 Brown
0111 White
Bright Colors 0000 Black
1000 Gray
1001 Light Blue
1010 Light Green
1011 Light Cyan
1100 Light Red
1101 Light Magenta
1110 Yellow
1111 Intense White

Engr. Muhammad Fiaz 24


• ;TITLE PGM12: SCREEN DISPLAY
• .MODEL SMALL
• .STACK 100H

Program to display .CODE
• MAIN PROC
screen letter “A” • ; Set DS to active display page
Blue background and red text color • MOV AX, 0B800h ; Color active display page
Output address
• MOV DS, AX ; Load AX into DS

; Fill active display page
• MOV CX, 2000 ; 80x25 = 2000 words
(screen buffer size)
• MOV DI, 0 ; Initialize DI to start of
buffer

FILL_BUF:
• MOV [DI], 1441h ; Red 'A' on blue
background
• ADD DI, 2 ; Move to next word
• LOOP FILL_BUF ; Loop until CX = 0

; Exit program
• MOV AH, 4CH ; DOS terminate program
• INT 21H ; Call DOS interrupt
• MAIN ENDP
• END MAIN

Engr. Muhammad Fiaz 25


E N G R . M U H A M M A D F IA Z
LECTURER COMPUTER SCIENCE

T E L F / E F S E T / A C E P T C E RT I F I E D

M I C R O S O F T A C A D E M Y T RA I N E R

O RA C L E C E RT I F I E D P R O F E S S I O N A L

G O O G L E C E RT I F I E D P R O F E S S I O N A L

THANK YOU! Lahore, Pakistan

+92-320-7617-093

Do you have any questions? [email protected]

https://www.linkedin/in/fiazofficials

Engr. Muhammad Fiaz 26

You might also like