Direct-Access Color Graphics Chapter 11. Graphics modes C++ provides a different combination of graphics characteristics. These characteristics include.

Slides:



Advertisements
Similar presentations
Monitors and Sound Systems
Advertisements

Lecture 2 Concepts, Terms and Definitions. Display Devices They are divided into a lot of small squares called pixels (“PICture ELements”). Each pixel.
DOS and BIOS Interrupts DOS and BIOS interrupts are used to perform some very useful functions, such as displaying data to the monitor, reading data from.
1 RTL Example: Video Compression – Sum of Absolute Differences Video is a series of frames (e.g., 30 per second) Most frames similar to previous frame.
Image Data Representations and Standards
BY Kamran Yousaf BY Kamran Yousaf Display Technologies Color Graphics Adapter (CGA), 1981 four colors 320 * 200 pixels Enhanced Graphics Adapter (EGA)
VGA Text Mode An introduction to font selection and to reprogramming of the Character Generator ram.
Video systems (continue). Practice Modify the program to get a string from a keyboard to display the input string on the middle of the screen with reverse.
BY Kamran Yousaf Application of Computer Graphics and Animation Using C++ Language.
Assembly Language for Intel-Based Computers Chapter 15: BIOS-Level Programming (c) Pearson Education, All rights reserved. You may modify and.
PC Peripherals for Technicians
SET 19 PROGRAMMING THE MOUSE. Mouse Features All mouse operations within a program are performed by standard INT 33H functions of the form: MOV AX, function.
Bits are Not just for Numbers Computers store characters as bits or binary digits. Characters from the English-language keyboard are represented in ASCII.
Chapter 7 Programming with DOS and BIOS Function Calls Objectives: The use of DOS and BIOS function call How to read the PC’s keyboard How to send text.
Graphics Bitmaps Drawing characters glyphs and multicolor patterns.
Early PC Graphics Capabilities of the IBM Color Graphics Adapter (CGA) and Enhanced Graphics Adapter (EGA)
Screen Display Module M15.2 Sections 9.5, 13.1, 13.2.
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphicsIntroduction Dr. Eng. Farag Elnagahy
Copyright © 2007 Heathkit Company, Inc. All Rights Reserved PC Fundamentals Presentation 40 – Displays and Resolution.
Computer Monitors Principles of Information Technology Lytle High School Click to Continue.
1 Internet Graphics. 2 Representing Images  Raster Image: Images consist of “dots” of color, not lines  Pixel: Picture element-tiny rectangle  Resolution:
LIS508 lecture 6: output devices Thomas Krichel
Peripherals The term peripherals refers to all hardware devices that are attached to your computer and are controlled by your computer system Peripherals.
ORG ; FOUR INT 21H and INT 10H Programming and Macros Dec Hex Bin
Objective Understand concepts used to create digital graphics. Course Weight : 15% Part Three : Concepts of Digital Graphics.
Digital Terminology. Bitmap A representation consisting of rows and columns of dots of a graphic image stored in computer memory. To display a bitmap.
ECE291 Computer Engineering II Lecture 9 Josh Potts University of Illinois at Urbana- Champaign.
Video Monitor Uses raster scanning to display images –Beam of electrons illuminates phosphorus dots on the screen called pixels. Starting at the top of.
1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory.
Slide 1 Wednesday, October 07, 2015 Low Level Machine.
BIOS and DOS Programming in DOS INT 10 and 21H. Interrupts There are some extremely useful subroutines within BIOS or DOS that are available to the user.
Nov 061 Size Control How is a component’s size determined during layout and during resize operations? Three factors determine component sizes: The component’s.
1 Screen and Keyboard Operations Suthida Chaichomchuen
Lab 8 Bit-Mapped Graphics Moving from text-based graphics to bit- mapped graphics. Easy to draw graphic points and lines using INT 10h, Function 0Ch (write.
Video Monitor CRT: Cathode Ray Tube
Text-Mode Programming Question #1 What are the three levels of access to the video display when writing characters on the screen in text mode?
Lecture 10: BIOS and DOS Programming
Character Generation.
Computers Are Your Future Chapter 1 Slide 1 Introduction to the Computers & Internet Chapter 1 Concepts of Information Technology IT.
ECE291 Lecture 12 Mode 13h Graphics. ECE 291 Lecture 12Page 2 of 27 Lecture outline Color theory Video Hardware Mode 13h Graphics File Formats.
ECE291 Computer Engineering II Lecture 15 Josh Potts University of Illinois at Urbana- Champaign.
Graphics An image is made up of tiny dots called pixels (“picture elements”) The resolution determines the.
Video systems. Lesson plan Review the code for the previous exercise Video systems Review for midterm exam.
3 Types of Video Output for Text DOS-level INT (Int 21) Output can be easily redirected to other devices (printer, disk) Slow Speed Cannot control the.
ECE 103 Engineering Programming Chapter 53 Generic Algorithms Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material.
Video Card CES Industries, Inc. Lesson 10.  Translates computer information of binary digital data into visual information that the monitor can understand.
10H Interrupt. Option 0H – Sets video mode. Registers used: – AH = 0H – AL = Video Mode. 3H - CGA Color text of 80X25 7H - Monochrome text of 80X25 Ex:
4. Kernel and VGA ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  None.
Microprocessors Monday, Apr. 16 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
ROM BIOS Chapter 9. The ROM BIOS PC computer come with a set od built in routines collectively called the ROM BIOS. These routines are permanent part.
Week 9 Monitors and output to the screen. Monitors, also known as Visual display units (V.D.Us) Desktop computers contain a Cathode Ray Tube (C.R.T.)
Chapter 3 Color Objectives Identify the color systems and resolution Clarify category of colors.
Lecture 11 Text mode video
Computer Graphics Lecture 03 Graphics Systems Cont… Taqdees A. Siddiqi
Graphics Basic Concepts 1.  A graphic is an image or visual representation of an object.  A visual representation such as a photo, illustration or diagram.
ECE291 Computer Engineering II Lecture 12 Josh Potts University of Illinois at Urbana- Champaign.
Final Project Virtual Slot Machine. By: Bander Alrogi Khaled Al Nuaimi Mohammed Almajhad Metaib Al-Enzai Course Title: ECE 2552 Instructor: Dr Kepuska.
Computer Graphics Lecture 04 Point Taqdees A. Siddiqi
DISPLAY DEVICES CIS 10, Group #1 April 01, 2006 C. X. A. L. K. H. A. V. ((( L. C.
Flowchart of basic interrupt mechanism
Computer Graphics Lecture 13 Graphics Systems Taqdees A
VIDEO GRAPHICS ARRAY CARD (VGA CARD)
Data Representation Images.
ACCEL SOFTWARE AND TECHNOLOGIES LTD.
9/17/2018 Kiến Trúc Máy Tính.
Microprocessor and Assembly Language
EEL 3705 / 3705L Digital Logic Design
Interrupt Mechanism Interrupt Compared With Procedures Call MyProc
Graphics Systems Lecture-2
Multimedia System Image
Presentation transcript:

Direct-Access Color Graphics Chapter 11

Graphics modes C++ provides a different combination of graphics characteristics. These characteristics include the resolution, the number of possible colors, whether text or graphics are to be displayed and other elements Different modes required different hardware ( monitors and adaptors boards), and different Programing approaches

IBM Color Graphics Modes Modes (dec)ColorResolutionAdaptorMonitorMinimum MemoryPages 0 text16 grey40x25*CGACD2K8(16k) 1 text1640x25*CGACD2K8(16k) 2 text16 grey80x25*CGACD4K4(16k) 3 text1680x25*CGACD4K4(16k) 4 text4320x200CGACD16K1(16k) 5 grph4 grey320x200CGACD16K1(16k) 6 grph2 (B&W)640x200CGACD16K1(16k) 7 text2 (B&W)80x25*MAMD4K1(4k) Modes 8,9 abd 10 are for the PC jr Modes 11 and 12 are used internally by EGA board 13 grph16320x200EGAECD32K2(64k) 14 grph16640x200EGAECD64K1(64k) 15 grph2 (B&W)640x350EGAECD64K1(64k) 16 grph16640x350EGAECD128K1(128k) 17 grph2 (B&W)640x480VGAVD256K4(256k) 18 grph16640x481VGAVD256K1(256k) 19 grph256320x200VGAVD256K4(256k) * Characters, other resolution in pixels grphGraphicsMAMonochromo Adaptor MDmonochrome DisplayCGAColor Graphics Adaptor CDColor DisplayEGAEnhanced Graphics Adaptor ECDEnhanced Color DisplayVGAVideo Graphics Array VDVGA Display

Resolution Graphics images on a computer screen are composed of tiny dots called pixels/pels, for “picture element”. Pixels are arranged on the screen in horizontal rows: There are fixed numbers of rows and each row contains a certain number of pixels. Number of pixel used on the screen is called the resolution e.g. mode 4 uses a resolution of 200 rows, each 320 pixels across 320x200 Higher resolution means a sharper, clear picture, with less pronounced “jaggies” (the stairstep effect on diagonal lines) Higher resolution uses more memory for the display and is more expensive.

Text or Graphics Some modes exist only to place text on the color screen Others are made for graphics In the graphic modes, each bit, or each group of bit, corresponds to a particular pixel(dot) on the screen. In the text modes, a group of bits (actually two bytes) corresponds to a character

Color Several modes provide only two colors: black and white Others modes provide 4, 16, or 256 colors A particular mode may allow only four colors on the screen, but it may be possible to switch to a second group of four colors (can’t appear both groups at exactly the same time). These groups of colors are called palettes.

Display Monitors Different monitors are used for the different modes. The simplest and least expensive is text-only monitor. This can be used only with mode 7 The least expensive color monitor display only the CGA modes: 0 through 6 An EGA-capable monitor can display additional modes, from 13 through 16, as well as the CGA modes VGA monitors can display still more modes, from 17 to 19, as well as the CGA and EGA modes Higher the mode number, greater the resolution or number of color displayed

The Display Adaptor PC computers haven't the ability to send signals necessary to generate text or graphics on the monitor. This is the function of printed circuit board called a “display adaptor” which plugs into one of the slot inside the computer. There are display adaptors corresponding to the four graphics standards: monochrome(text only), CGA, EGA, and VGA.

CGA, EGA and VGA graphics modes The CGA allows resolution up to 640x200 At this resolution, two colors are available. At lower resolution, 320x200, four color are available. The CGA also provides several text modes. The EGA adaptor increases resolution to 640 x 350 with 16 colors The VGA increases resolution again to 640x480 with 16 colors and allows 256 colors, but at a lower resolution of 320x200

Display Memory The data place in random access memory causes an immediate change in the picture Different display adaptors come with different amount of memory ResolutionColor x2008K16K32K 640x20016K32K64K 640x35032K64K128K

Pages Enough graphics memory is available in the adaptor, its possible to keep several screens of data in the memory at the same time On the EGA boad, mode 13(320x200), 16 colors) requires only 32K, but 64K is available The extra memory can be used to hold a second screen image By switching from one page to another, very rapid changes can be made to the image on the screen

Using Modes We will use following modes in Programs: mode 4, which is available for all graphics adaptors Mode 13 which work on EGA and VGA adaptors And two VGA-specific modes 18 and 19

Setting Modes The ROM BIOS Set Mode Command use – ROM BIOS routine: Set video mode – Interrupt 10 Hex: Video – Input registers: AH=0, AL = mode number – Output register: None

ROM BIOS graphics routines /* setmode.c */ /* sets graphics mode to value supplied*/ #include /* Declare REGS*/ #define SETMODE 0 /*"set video mode" service*/ #define VIDEO 0x10 /*video BIOS interrupt number*/ void main (int argc, char *argv[]) {union REGS regs; int mode; if(argc !=2) {printf("Example input: setmode 7"); exit();} mode = atoi(argv[1]); /*string to integer*/ regs.h.al = (char)mode; /*mode number in AL register*/ regs.h.ah = SETMODE; /*service# in AH register*/ int86(VIDEO,&regs, &regs); /*call video interrupt*/ }

Display Pixels routine C>setmode 4 C>cstripes – ROM BIOS routine: Write dot – Interrupt 10 Hex: Video – Input registers: AH=0C hex, CX = column number DX = row number AL = color BH = page number – Output register: None Palette 1 NumberColor 0black 1cyan 2magenta 3white

Display Pixels with ROM Routines /* cstripes.c */ /* fills CGA screen with 4 color bars. Use mode 4 (320x200)*/ #include /* Declare REGS*/ #define MAXR 200 /*rows*/ #define MAXC 320 /*columns*/ #define VIDEO 0x10 /*video BIOS interrupt number*/ #define WDOT 12 /*'write dot' ROM BIOS */ void main (void) {union REGS regs; int row, col; for(row;row<MAXR;row++) for(col=0;col<MAXC;col++) { regs.h.ah = WDOT; /*'write dot' service*/ regs.x.dx= row;/*row in DX*/ regs.x.cx = col;/* column in CX*/ regs.h.al = col/80;/* color change every 80 rows*/ regs.h.bh = 0;/* page number */ int86(VIDEO,&regs, &regs); /*call video interrupt*/ }

Set Palette – ROM BIOS routine: Set color platte – Interrupt 10 Hex: Video – Input registers: AH=0B, – BH = 1 (to change palette), – BL = Plate number – Output register: None – C>setmode 4 – C>corect – C>setpal 0 Palette 0 NumberColor 0black 1green 2red 3broen

Set Color Palette /* setpal.c */ /* sets color palette to one of two values*/ #include /* Declare REGS*/ #define SETPAL 0x0B /*"set color platette" service*/ #define VIDEO 0x10 /*video BIOS interrupt number*/ void main (int argc, char * argv[]) {union REGS regs; int pal; /*palette number*/ if (argc != 2) {printf(Example usage:C>setpal 0");exit();} pal = atoi(argv[1]); /*string to integer*/ regs.h.bh = 1; /*BH =1 to set palette*/ regs.h.bl = pal;/* palette # from user*/ regs.h.ah = SETPAL;/* service # in AH register */ int86(VIDEO,&regs, &regs); /*call video interrupt*/ }

Changing the back ground – ROM BIOS routine: Set background – Interrupt 10 Hex: Video – Input registers: AH=0B, – BH = 0 (to change background), – BL = Plate number – Output register: None

Changing the Background /* setback.c */ /* sets color of background to one of 16 values*/ #include /* Declare REGS*/ #define SETPAL 0x0B /*"set color platette" service*/ #define VIDEO 0x10 /*video BIOS interrupt number*/ void main (int argc, char * argv[]) {union REGS regs; int pal; /*palette number*/ if (argc != 2) {printf(Example usage:C>setback 15");exit();} pal = atoi(argv[1]); /*string to integer*/ regs.h.bh = 0; /*BH =0 to set background*/ regs.h.bl = pal;/* palette # from user*/ regs.h.ah = SETPAL;/* service # in AH register */ int86(VIDEO,&regs, &regs); /*call video interrupt*/ }

Color Generation Four Signals can be combination in specific ways to produce the 16 colors 2^4 = 16 combination For example mode 4 – two bit combination

Direct access to graphics memory /* fstripes.c */ /* fills CGA screen with 4 color bars. Use mode 4 (320x200)*/ /* uses direct memory access*/ #define MAXR 200 /*rows*/ #define MAXC 320 /*columns*/ #define MAXB (MAXC/4) /*bytes in a row (80)*/ #define BPC (MAXB/4) /*bytes per color (20)*/ char table[4]= {0x00,0x55,0xAA,0xFF}; /*color byte table*/ void main (void) { char color, far *farptr; int addr,index,row,col; for(row;row<MAXR;row++) for(col=0;col<MAXC;col++) { index = (col/BPC) & 0x03; /* clr chng every 20 bytes*/ color = table[index];; /*get color pattern*/ addr = now*(MAXB/2)+col; /*address of bytes*/ if(row & 1) addr += ( ); /* use second bank*/ *(farptr +addr)=color; /*set 4 pixls*/ }

EGA bit-plane graphics /* estripes.c */ /* fills EGA screen with 16 color bars. Use mode 13 (320x200)*/ #include /* Declare REGS*/ #define MAXR 200 /*rows*/ #define MAXC 320 /*columns*/ #define VIDEO 0x10 /*video BIOS interrupt number*/ #define WDOT 12 /*'write dot' ROM BIOS */ void main (void) {union REGS regs; int row, col; for(row;row<MAXR;row++) for(col=0;col<MAXC;col++) { regs.h.ah = WDOT; /*'write dot' service*/ regs.x.dx= row;/*row in DX*/ regs.x.cx = col;/* column in CX*/ regs.h.al = col/20;/* color change every 20 rows*/ regs.h.bh = 0;/* page number */ int86(VIDEO,&regs, &regs); /*call video interrupt*/ }

VGA bit-plane graphics /* vgastrip.c */ /* Horizontal stripes. Use mode 18(640x480)*/ /* uses VGA write mode 0*/ #define MAXR 480 /*rows*/ #define MAXC 640 /*columns*/ #define MAXB (MAXC/8) /*bytes in a row*/ void main (void) { char far *farptr; int row,col; unsigned char color; farptr = (char far*) 0xA ; /*set ptr to VGA mem*/ for(row;row<MAXR;row++) { color = (row/30) & 0x0f; /*color chng every 30 rows*/ outportb(0x3C4,2); /*set color to write*/ outportb(3C5,color); /*set color to write*/ for(col=0;col<MAXB;col++) *(farptr + row*MAXB + col) = 0xff; /*set 8 pixels*/ }

VGA 256 Colors /* vga256.c */ /* Draw 256 different colored squares. Use mode 19*/ #define MAXX 320 /*horizontal pixels*/ #define MAXY 192 /*vert pixels (divisible by 16)*/ #define PPBX (MAXX/16) /*pixels per color box, horizontal*/ #define PPBY (MAXY/16) /*pixels per color box, horizontal*/ void main (void) { char far *farptr; /* pointer to video memory*/ int x, y; /*pixel coordinates (0-319,0-191)*/ int row,col;/*color box coordinates (0-15)*/ unsigned char color;/*color of box */ farptr = (char far*) 0xA ; /*set ptr to VGA mem*/ for(y= 0;y<MAXY;y++)/*cycle down*/ for(x=0;x<MAXX;x++)/*cycle across*/ { col = x/PPBX; /*find box coords*/ row = y/PPBY; /*find box coords*/ color = col + row * 16; *(farptr + y*MAXX + x) = color; /*set pixel*/ }